--- name: spiral-html description: Bootstrap or audit an HTML-first structural-discipline scaffold for long-running product work, with semantic ledgers for GDD coverage, progress, questions, follow-ups, dependencies, and playtest gates. Use when a project wants Spiral's durable agent state in HTML rather than Markdown. ---

Spiral (HTML edition)

The methodology for sustaining a multi-week autonomous PR loop without the agent losing context, running out of work prematurely, or accumulating debt. This is the HTML-first variant of spiral: the scaffold is identical in shape, but every ledger, rule, and contract is authored as HTML rather than Markdown.

The agent does not remember the project. The project remembers itself. Every kind of state lives in git-tracked ledger files with rigid templates. The agent's job collapses to: read ledgers, pick the next slice, run the loop, update ledgers. Every iteration returns to the same artifacts and finds them advanced. The shape is not a loop, it is a spiral: forward-while-circling.

Why HTML

HTML is the new way to communicate to agents. Structured elements (<section>, <article>, <table>, <ol>, <dl>, <details>) carry semantics that Markdown discards. An agent reading <section data-role="rule" data-id="rule-1"> can locate, cite, and update content without parsing prose. The audit script in this skill exploits that: it grep-checks for HTML attributes rather than heading prefixes.

Two files must stay Markdown: AGENTS.md and CLAUDE.md. Codex's native root-down walk only picks up AGENTS.md, and Claude Code's project-memory import only resolves CLAUDE.md. The contract therefore lives in AGENTS.md as Markdown; CLAUDE.md is a one-liner (@AGENTS.md) so Claude Code imports the same rules. Everything else under docs/ is HTML.

Path-scoped Rules under .claude/rules/ retain YAML frontmatter (Claude Code requires it for path globbing); only the body becomes HTML.

When to invoke

Per-slice execution is the job of randroid-loop. Per-task tracking is the job of task-tracking-dots-html (the HTML-backed dot-html fork, not the Markdown task-tracking-dots). This skill is the substrate those two run against.

Why this exists: the three case studies

Three multi-week autonomous-loop projects produced three outcomes. The pattern is in docs/case-studies.html. The short version:

Flatline is the failure case this skill explicitly prevents. The audit script flags both the chapter-granular coverage anti-pattern and the missing qualitative gate.

The scaffold

/spiral-html init writes these files into the target repo:

PathRole
AGENTS.mdRules-as-contract in Markdown (stays Markdown so Codex's root-down walk works): em-dash ban, pre-slice reading list, stack constraints, commit style, autonomous PR loop reference, secrets policy, testing expectations, pre-commit checklist. The pre-slice reading list points at the .html ledgers.
CLAUDE.mdOne line: @AGENTS.md. Claude Code's project-memory import only resolves CLAUDE.md, so the file exists to forward the same rules.
docs/IMPLEMENTATION_PLAN.htmlThe 18-step loop contract. Slice selection priority. Definition of done.
docs/WORKING_AGREEMENT.htmlProcess: branches, commits, PR template, bot-review settled-wait gate, verification minimums, merge-and-deploy expectations, risk gates.
docs/gdd/index.htmlGDD tree index. Each requirement is its own file. Build logs grow per-section as work ships.
docs/GDD_COVERAGE.jsonAtomic-row spec to code traceability. One row per requirement, not per chapter. Stays JSON (data, not prose).
docs/PROGRESS_LOG.htmlAppend-only slice receipts as <article data-slice="..."> elements (Branch / Changed / Verification / Assumptions / GDD coverage / Followups). Newest on top.
docs/OPEN_QUESTIONS.html<section data-q="Q-NNN"> entries with options, recommended default, status, resolution. Defaults let the loop ship without blocking.
docs/FOLLOWUPS.html<section data-f="F-NNN"> entries with priority (blocks-release, nice-to-have, polish), blocker condition, unblock condition.
docs/DEPENDENCY_LEDGER.htmlWatched dependencies with currently-pinned version + per-dep upgrade procedure. The Dependency Upgrade Gate fires every loop iteration that touches main.
docs/PLAYTEST.htmlQualitative second-gate checklist. The loop is not done until this resolves.
docs/FUN_FACTOR_AUDIT.htmlQualitative gap-finder. Run when coverage is ≥80% done. Source of P0/P1 polish work.
.claude/rules/slice-discipline.mdPath-scoped Rule. YAML frontmatter for path globbing; HTML body. Loads when editing source. Enforces "no drive-by refactors, no speculative abstractions, refactor-in-slice".
.claude/rules/ledger-append-only.mdPath-scoped Rule. YAML frontmatter for path globbing; HTML body. Loads when editing the four ledger files. Enforces append-only, never-rewrite-past-entries.
.claude/rules/gdd-build-log.mdPath-scoped Rule. YAML frontmatter for path globbing; HTML body. Loads when editing GDD section files. Enforces build-log-on-every-shipped-feature.

Cross-tool compatibility

The HTML-first scaffold cannot rely on every discovery contract the Markdown version uses. Two files stay Markdown so the canonical discovery paths keep working:

The seven parts of the spiral

  1. Vision: the canonical spec (GDD tree, atomic requirements) as HTML section files.
  2. Contract: the three docs that govern every iteration (rules in AGENTS.md, plan, agreement).
  3. Slice: the bounded unit of work (one PR, one log entry, small enough that a botched slice is reverted in one click).
  4. Ledgers: externalized memory (progress log, open questions, followups, coverage) as append-only HTML elements with data-* ids.
  5. Gates: what blocks merge AND what triggers a slice. Mechanical (CI green, type-check, tests, no em-dash, bot-review settled). Qualitative (playtest, fun-factor audit). Dependency Upgrade Gate (see docs/DEPENDENCY_LEDGER.html): a watched-dep release is the same kind of fresh state as a new commit on main; the agent observes and acts at every loop boundary that touches main. The qualitative gate is the second gate that prevents Flatline-style early termination.
  6. Selection rule: what to work on next: red CI > pending dep upgrade > P0/P1 dot > answered open question > high-priority followup > coverage gap > partial GDD section > cleanup.
  7. Loop: the continuous operation. Read context, pick slice, branch, implement, test, update ledgers, PR, handle review, wait for bot + CI, merge, pull main, smoke prod, close item, start next. Never voluntarily idles. Executed by randroid-loop.

How init works

Resolve scripts/init.sh relative to this skill directory and run it from inside the target repository with "<ProjectName>" "<one-line-pitch>" "<stack>".

The script:

  1. Refuses to run if AGENTS.md already exists at the repo root. Use audit instead.
  2. Prompts for project name, one-line pitch, and stack if not passed as args.
  3. Copies every template file into the target repo, substituting {{PROJECT_NAME}}, {{PITCH}}, {{STACK}}, {{TODAY}}.
  4. Creates docs/gdd/ for the GDD tree and .claude/rules/ for the path-scoped Rules.
  5. Writes AGENTS.md (the full Markdown contract) and CLAUDE.md (one-line @AGENTS.md import).
  6. Verifies em-dash cleanliness on every written file.
  7. Prints a next-steps note: draft the first GDD section under docs/gdd/, then use randroid-loop in implementation mode to start the spiral.

How audit works

Resolve scripts/audit.sh relative to this skill directory and run it from inside the repository to audit.

The script runs nine checks and prints a remediation checklist:

  1. Missing canonical files. Verifies the scaffold is present: the Markdown contract pair (AGENTS.md, CLAUDE.md), the docs HTML ledger set including DEPENDENCY_LEDGER.html, and the three .claude/rules files.
  2. Monolith GDD. Warns if docs/GDD.html exists alone without a docs/gdd/ directory.
  3. Chapter-granular coverage. Counts rows in docs/GDD_COVERAGE.json. Warns if row count is implausibly low for project age (heuristic: fewer than 14 rows per project-week).
  4. Missing qualitative gate. Warns if docs/PLAYTEST.html or docs/FUN_FACTOR_AUDIT.html is missing.
  5. Stale progress log. Reads the newest <article data-date="YYYY-MM-DD"> in docs/PROGRESS_LOG.html. Warns if older than 7 days.
  6. Open questions without defaults. Warns on any <section data-q="..."> missing a <dt>Recommended default</dt> entry.
  7. Followups without priority. Warns on any <section data-f="..."> missing a data-priority attribute.
  8. Em-dash drift. Greps the canonical files for U+2014 / U+2013. Warns on hits.
  9. Dependency ledger present. Warns if docs/DEPENDENCY_LEDGER.html is missing or empty (no <section id="watch-list"> recorded).

The output is a checklist, not a generated remediation file. One canonical place per kind of state.

Composition

Architecture

spiral-html/
├── SKILL.md                    # This file (YAML frontmatter + HTML body)
├── README.md                   # Human-facing one-pager (HTML body)
├── .claude-plugin/
│   └── plugin.json             # Plugin metadata
├── commands/
│   ├── spiral-html-init.md     # /spiral-html init slash command
│   └── spiral-html-audit.md    # /spiral-html audit slash command
├── templates/
│   ├── AGENTS.md               # The contract, in Markdown (Codex root-down walk)
│   ├── CLAUDE.md               # One-line @AGENTS.md import (Claude Code project memory)
│   ├── IMPLEMENTATION_PLAN.html
│   ├── WORKING_AGREEMENT.html
│   ├── docs-gdd-index.html
│   ├── GDD_COVERAGE.json
│   ├── PROGRESS_LOG.html
│   ├── OPEN_QUESTIONS.html
│   ├── FOLLOWUPS.html
│   ├── DEPENDENCY_LEDGER.html
│   ├── PLAYTEST.html
│   ├── FUN_FACTOR_AUDIT.html
│   ├── dot-claude-rules-slice-discipline.md
│   ├── dot-claude-rules-ledger-append-only.md
│   └── dot-claude-rules-gdd-build-log.md
├── scripts/
│   ├── init.sh                 # Bootstrap into a target repo
│   └── audit.sh                # Diff target repo against canon
└── docs/
    ├── methodology.html        # The meta-pattern essay
    └── case-studies.html       # VibeRacer / VibeGear2 / Flatline