--- name: spec-architect description: "Turn a one-line seed into a SPEC the batch runner can execute: sheet-driven interview, then docs/SPEC-.md with Execution Mode per batch." version: 1.0.0 license: MIT metadata: hermes: tags: [architect, spec, interview, quick-review, a2b-pipeline, kanban] category: workflow phase: design role: architect abstract_roles: [role:planner, role:builder, role:visual-reviewer, role:decision-framer] recommended_role: role:planner quality_tier: decision-ready --- # Spec Architect (turn one line into a spec a runner can finish alone) The Architect's job is not "writing a spec"; it is **producing, in two rounds, a spec that the Builder (the autonomous kanban worker) can finish without asking anything extra**. Do not line up long questions in chat. Put decisions on a question sheet so a human answers with one tap. This skill ships with the **`hermes-pilot` plugin**. `hermes-pilot init` installs it into `~/.hermes/skills/spec-architect/`. ## Language Write user-facing prose in the run's UI language — sheet title/topic/question/option text, SPEC prose, and the comments and summaries you post. Keep machine tokens ASCII and unchanged: `label=`, `sheet=`, `mode=`, `round=`, `target=`, task ids, file paths, and the SPEC keys **Execution Mode** / **Objective** / **Files** / **Verify**. This is `LANGUAGE_RULE_MARKER` / `LANGUAGE_RULE_EN` in `apps/bridge/src/language-rule.js`; `apps/bridge/test/languageRule.test.js` keeps this section and the bridge prompt identical. When the run's language is Japanese, only the prose switches to Japanese (JA variant in the same module); the machine line and paths stay ASCII. The rule covers the sheet you write and every prose line you post to the board, including the 1-line `complete --summary`. ## When to use it Use it: - Turning a one-line note / voice dictation (`Spec Seed`) into an implementation plan - Adding a new group of features (several batches) to an existing repository - The human can say "what to build" but has not decided "how to build it" Do not use it: - The change is one file with a unique answer (implement it and pass `npm run verify`) - `docs/SPEC-*.md` already exists and you only need to file it through the hermes-pilot spec launcher ## Two-round protocol ### Round 1 — interview straight into Quick Review Instead of listing questions in chat, build **exactly one question sheet**. **The first choice is structured JSON (`mode=standard`)**. Hand-written HTML and headless-browser captures are an optional extension for "the visual comparison itself is the question". 1. **3±1 questions.** Each question is "one thing a human decides". Put the facts (`file:line`, command output) in the body and leave only the decision to the human. Evidence needs only a **minimal check of the relevant spot** (do not build out the whole repo or mock things up; file the sheet as soon as it is decided). **Do not run `npm test` / `npm run verify` in Round 1.** Explore with `rg` / `grep` for the specific symbols; do not spend time checking every dependency or building. Tests and builds belong in Round 2, written into the SPEC (each batch's Verify). Once the sheet is written, **block immediately**. 2. Two or three options per question, one `recommended: true`. Always give the reason (gain / cost). 3. Draw both options **only** for visual questions (placement, information density, colour comparison). Everything else (spec, logic, wording, API, data design) is filed as `.json` alone and blocked immediately — no `browser_exec` capture and no 300-line HTML. When a picture is needed for an existing screen, first capture a faithful shot of the current UI. 4. Same location and format as the `quick-review` skill. **The primary artefact is `.json`:** ```text ~/.hermes/plugin-data/hermes-pilot/review/sheets/spec--1.json <- primary (mode=standard) ~/.hermes/plugin-data/hermes-pilot/review/sheets/spec--1.html <- only for visual questions ``` 5. File it on kanban and set it **blocked** (do not implement until the answer arrives): ```bash hermes kanban create "Q1-Q3: design direction for " --assignee --body "$(cat <<'BODY' [review] label=spec- round=1 mode=standard sheet=sheets/spec--1.json target= chat= BODY )" hermes kanban block "Waiting for the spec interview (Q1-Q3)" --kind needs_input ``` With the `.json` alone both the PWA native form (``) and "open the whole sheet ↗" work (when `.html` is missing the bridge generates safe HTML from the `.json`). While waiting, work on other tasks. **Never invent answers.** ### Round 2 — generate the SPEC Read the answers (`.answer.json` / `.answer.txt` / the `[Review Answer]` comment) and write `docs/SPEC-.md`. `(unselected = take recommended)` may be settled with the recommendation. Required format (`apps/bridge/src/specs.js` parses it mechanically. **Do not change the shape**): ```markdown # SPEC: (`SPEC-`) Status: decided (, interview Q1-Q3 agreed) Based on: ## 1. Concept <3-6 lines. What, for whom, how far.> ## 2. Agreed decisions (interview outcome) | # | Topic | Decision | Rationale | |---|---|---|---| | **D1** | | | | ## 3. Detailed technical spec ### 3.1 Targets: , 1. ****: ## 4. Kanban task breakdown (Batch -1 .. -N) ### Batch -1: - **Execution Mode**: `[Mode: Zero-Stop]` - **Recommended Role**: `role:builder` - **Objective**: <1-3 lines. What goes into which file.> - **Files**: - New: `` - Changed: `` - **Verify**: - - `npm run verify` passes for everything. --- ``` ## Batch heading rules (break these and filing breaks) - Batch headings must be **`### Batch : `** only. `<ID>` starts with a letter and is at most 16 characters (`V5-1` / `P2` / `T3` are fine, `1.1` is not). - Any other `###` heading **must start with a digit** (`### 3.1 …`). Otherwise the spec launcher mistakes it for a batch and files it. - Every batch needs these three lines: `- **Execution Mode**: ...` / `- **Objective**: ...` / `- **Verify**: ...`. A batch without `Execution Mode` gets no behaviour contract (`[Hermes Pilot Execution Contract]`) injected at filing time, so autonomy is not guaranteed. - An optional `- **Recommended Role**: role:planner | role:builder | role:visual-reviewer` line may sit right after `Execution Mode` (design-heavy → `role:planner`, implement and verify → `role:builder`, include visual sign-off → `role:visual-reviewer`). Filing still works when it is absent. ## Choosing the Execution Mode | Mode | When | Contract injected into the worker | |---|---|---| | `Zero-Stop` | The answer is unique (tests, build, mechanical refactor) | No questions; self-repair until `npm run verify` passes, then `done` | | `Fast-Track Review` | The approach is not settled and may branch mid-way | On a branch, file a `quick-review` sheet before implementing and wait for one-tap approval | | `Visual Gate` | The look changes (UI, CSS, wording, layout) | `npm run deploy` → check and capture 390×844 / 820×1180 → `annotation` review when needed | When in doubt use `Visual Gate`. If you cannot claim the look is unchanged, insert a visual check. ## Abstract roles, delegation and fallback (model-agnostic) This skill is **model-agnostic**. Never write a specific model name, provider name, pricing plan or personal path here. "Which abstract role maps to which real model, and where to fall back on failure" is owned by the **device profile** (profile memory / the assignment table in `SOUL.md`). Specs and skills deal in abstract role names only. ### The four abstract roles - `role:planner` — heavy reasoning, design, spec authoring, complex root-causing. Round 1 question design; Round 2 impact analysis and batch breakdown. - `role:builder` — routine implementation, test fixes, builds, mechanical work. Implementing the SPEC and repairing `npm test` / `npm run verify`. - `role:visual-reviewer` — reading screenshot diffs and redlined images (`.annotated.png`), visual sign-off at `390x844` / `820x1180`. **Only when the visual comparison is the question.** - `role:decision-framer` — question design and trade-off framing: cutting to 3±1 questions and composing options with the reason to recommend. How to apply them: - Round 1 / Round 2 design reasoning, impact analysis and batch breakdown → **`role:planner`**. - Only when judging pictures (mocks, screenshots) **also use `role:visual-reviewer`**. Do not attach it to non-visual questions (API, storage format, naming, logic). - Each batch definition may carry the optional `- **Recommended Role**: role:builder` line (`role:planner` / `role:visual-reviewer` / `role:decision-framer` likewise). Without it the role is inferred from the Execution Mode. ### Native delegation and fallback Use only Hermes Agent's standard **`delegate_task`** for delegation. 1. The parent cuts a sub-task that matches a role and delegates once, naming the role in `goal` / `context`. 2. Children are **read-only advisers**. File edits, commits, installs and `npm run verify` are the parent's. 3. If delegation fails (error / rate limit / timeout / unsupported model / no delegation tool), **do not stop**. Switch to the fallback order in the profile assignment table (next choice → main model) and finish on your own. 4. Record the fallback in one line of the completion report or a comment (never silently drop verification). 5. If the same role fails twice, do not send a third attempt. Finish it yourself. ### Hard boundary: no external AI CLIs **Do not spawn external AI CLIs such as the `gemini` CLI (`gemini -p`, …) or `agy -p` to do the reasoning.** Launching them through `spawn` / `execFile` / `exec`, or piping from a shell, is also covered. Runtime code is machine-checked by `npm run check:oauth`. Delegation means the Hermes native API provider plus `delegate_task` only. ## Sizing the batches - One batch = a change **that closes within a single `npm run verify`** (roughly 200-600 lines). - Dependencies run one way, front to back. If `V5-2` uses an API from `V5-1`, put `V5-1` first. - Order it "foundation → features → polish → end-to-end verification", and make the last batch the integration check plus a real-screen audit. - More than six batches: split into independent SPECs (one SPEC = one purpose). ## Wrap-up (A2B handoff) After writing the SPEC, emit exactly one of these: ```text Spec: docs/SPEC-<SLUG>.md (Batch <SLUG>-1 .. <SLUG>-N / n batches) File it: hermes-pilot Tasks → spec launcher, or `specs.launchSpec` from your scripts (dryRun: true first, then run) ``` If the request was tagged `autoStart=true`, file the unfiled batches **exactly once** (`dryRun: true` → `dryRun: false`; never create duplicates). ## Pitfalls - **Do not hand-write HTML or shoot with `browser_exec` in Round 1.** Unless the visual comparison is the question, file one `.json` and block immediately (HTML and mock images burn minutes without changing the decision). Pictures are only for placement / density / colour comparisons. - **`docs/SPEC-*.md` file names start with uppercase `SPEC`.** `spec-*.md` is not scanned. - `BATCH_ID_RE` allows 16 characters. Longer ids (`V5-1-optimizer`) are truncated. - Any `### ` heading in the body becomes a batch boundary at filing time. **Make sub-headings inside a batch `####` or deeper.** - The `- **Execution Mode**` / `[Mode: ...]` notation must match the `specs.js` regex (`- **Execution Mode**: \`[Mode: Zero-Stop]\``). Backticks are optional. - **Never put credentials, tokens or personal data in a spec.** Write paths as `~` or relative. - Do not start writing the SPEC before the interview answers arrive. Work on other tasks while waiting.