archgen-mcp 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +2 -6
  2. package/assets/briefs/investigate.md +16 -17
  3. package/assets/briefs/review.md +41 -29
  4. package/assets/briefs/survey.md +17 -20
  5. package/assets/briefs/verifier.md +52 -40
  6. package/assets/harness-mcp.json +6 -6
  7. package/assets/platform-capabilities.json +387 -71
  8. package/assets/references/artifact-templates.md +67 -232
  9. package/assets/references/interview.md +83 -199
  10. package/assets/references/mcp-and-skills.md +35 -125
  11. package/assets/references/orchestration.md +96 -209
  12. package/assets/references/platforms.md +41 -110
  13. package/assets/skill-registry.json +10 -1
  14. package/assets/templates/adr.md +3 -3
  15. package/assets/templates/architecture.yaml +31 -28
  16. package/assets/templates/edge-matrix.md +8 -8
  17. package/assets/templates/mermaid.md +3 -10
  18. package/assets/templates/prd.md +15 -15
  19. package/assets/templates/tasks.yaml +25 -18
  20. package/package.json +2 -2
  21. package/src/cli.mjs +1 -2
  22. package/src/context.mjs +12 -42
  23. package/src/core/brief-context.mjs +106 -0
  24. package/src/core/brief-scope.mjs +218 -0
  25. package/src/core/briefs.mjs +109 -1
  26. package/src/core/codegraph-manager.mjs +12 -0
  27. package/src/core/doc-navigator.mjs +101 -17
  28. package/src/core/errors.mjs +1 -1
  29. package/src/core/harness-wiring.mjs +65 -22
  30. package/src/core/jsonc-config.mjs +706 -0
  31. package/src/core/plan-grapher.mjs +11 -3
  32. package/src/core/skill-manager.mjs +181 -13
  33. package/src/core/skill-roots.mjs +92 -0
  34. package/src/core/tokens.mjs +78 -0
  35. package/src/core/worker-contract.mjs +145 -18
  36. package/src/server.mjs +0 -3
  37. package/src/tools/help.mjs +17 -34
  38. package/src/tools/plan.mjs +36 -22
  39. package/src/tools/skills.mjs +67 -5
  40. package/src/tools/tasks.mjs +44 -18
  41. package/src/core/ui-channel.mjs +0 -222
  42. package/src/tools/ui.mjs +0 -67
@@ -1,277 +1,161 @@
1
1
  # Interview playbook — requirement elicitation
2
2
 
3
- Goal: complete, conflict-free requirements in the FEWEST round-trips.
4
- Batch 3–5 questions per message. Never ask what you can infer — ask only
5
- decision-forks, state everything else as a veto-able decision (§ How to ask).
3
+ Goal: achieve complete, conflict-free requirements in minimal round-trips. Batch 3–5 questions per turn, infer aggressively from context, ask only material decision-forks, and state derivative choices as veto-able defaults.
6
4
 
7
5
  ## How to ask
8
6
 
9
- - **Tool-first, options-fallback.** Use your harness's ask-question /
10
- interactive multiple-choice tool when one exists; no such tool → ask inline
11
- with labeled options. Same content either way.
12
- - **Recommendation-first.** Every option set leads with YOUR best judgment
13
- tagged `(recommended)`, then alternatives. The user accepts the
14
- recommendation by default and may override — never present bare options
15
- without a recommendation.
16
- - **Ask forks, state decisions.** Ask ONLY the few decision-forks that
17
- materially branch the plan. Everything derivative: DECIDE autonomously and
18
- announce — "I'll use X because Y — say so if you'd rather Z" — so the user
19
- can veto without being interrogated.
20
- - **Volume scales with scope.** Round caps (§ Step 1) are MAXIMA, not targets:
21
- SMALL/simple prompt → at most 1–2 core questions, decide the rest; MEDIUM →
22
- the targeted set; LARGE — or an experienced engineer signaling they want
23
- control → the fuller discovery set.
24
-
25
- Worked example (recommendation-first, inline fallback form):
7
+ - **Tool-first, inline-fallback:** Use the harness's interactive question/choice tool if available; otherwise present numbered inline options.
8
+ - **Recommendation-first:** Lead every question with your recommended option tagged `(recommended)` + brief rationale. Never present bare options.
9
+ - **Ask forks, state decisions:** Ask ONLY questions that materially branch the architecture. For derivative choices, declare: *"I'll use X because Y — let me know if you prefer Z."*
10
+ - **Scale volume to scope:** Round caps are ceilings, not targets. For simple/SMALL prompts, ask 1–2 core forks and infer the rest.
26
11
 
12
+ *Example:*
27
13
  > Rollout strategy?
28
- > 1. Feature flag + staged rollout **(recommended)** — existing users unaffected
29
- > 2. Immediate cutover — simpler, riskier
30
- > 3. Versioned API alongside — only if existing clients break
31
- > Reply 1–3, or just "ok" to accept the recommendation.
14
+ > 1. Feature flag + staged rollout **(recommended)** — zero impact on active users
15
+ > 2. Immediate cutover — simpler, higher risk
16
+ > 3. Versioned API alongside — if legacy clients cannot upgrade
17
+ > Reply 1–3, or "ok" to accept recommended.
32
18
 
33
19
  ## Round 0 — calibration exchange (skippable)
34
20
 
35
- Two or three rapid items, asked once at the very start — each INFERRED first
36
- (§ How to ask), asked only when genuinely ambiguous:
21
+ Infer from the prompt and repo first; ask only if genuinely ambiguous (skip entirely for SMALL/simple prompts or when already stated):
22
+ 1. **Target scale:** Prototype, MVP, or production-bound? (State inference + 1-line rationale for confirmation).
23
+ 2. **Team & tooling constraints:** Solo vs team, existing CI/lint/style conventions?
24
+ 3. **Timeline pressure:** None, moderate, or crunch?
37
25
 
38
- 1. Rough scale: prototype, MVP, or production-bound? INFER from the opening
39
- message + repo context; state the inference + one line of reasoning and
40
- let the user confirm or correct. Ask open-ended ONLY when genuinely
41
- ambiguous.
42
- 2. Team size + convention constraints? (solo? existing lint/CI/style guides?)
43
- 3. Deadline pressure: none, moderate, crunch?
44
-
45
- Purpose is ONLY to pick question-set depth and right-size later verification
46
- rigor — never to collect requirements. SKIP the whole exchange when the user's
47
- opening message already answers these items (e.g. "quick prototype by
48
- Friday"); SMALL/simple prompts skip calibration entirely and go straight to
49
- their 1–2 core forks (§ How to ask). Record whatever was captured under
50
- `calibration:` in answers.yaml.
26
+ Record under `calibration:` in `answers.yaml`.
51
27
 
52
28
  ## Step 1 — classify intent (decide during round 1)
53
29
 
54
- From the opening message + calibration, decide ONE intent class, state it to
55
- the user in one sentence, and record it as `intent_class` in answers.yaml:
56
-
57
- | intent_class | Signal | Question depth | Round cap |
58
- |---|---|---|---|
59
- | GREENFIELD-SYSTEM | net-new product/system from scratch; no host repo | full PRD-grade discovery | ≤6 |
60
- | GREENFIELD-MODULE | net-new capability inside an existing system/repo | targeted; infer from host repo first | ≤3 |
61
- | BROWNFIELD-FEATURE | existing repo, additive behavior | survey-first; ask only survey gaps (max ~5 questions) | ≤3 |
62
- | BROWNFIELD-CHANGE | modify existing behavior in place | survey-first; diff current vs desired | ≤3 |
63
-
64
- Never interrogate a BROWNFIELD-FEATURE with PRD-grade questions — token waste,
65
- user annoyance. Round caps INCLUDE round 0 when it runs.
30
+ Classify into ONE `intent_class`, state it in one sentence, and record in `answers.yaml`:
66
31
 
67
- Default `scope_class` from the intent class (user's choice wins — scope_class
68
- is agreed in GENERATE step 1 and recorded in answers.yaml):
69
- GREENFIELD-SYSTEM→LARGE, GREENFIELD-MODULE→MEDIUM,
70
- BROWNFIELD-FEATURE→MEDIUM/SMALL, BROWNFIELD-CHANGE→SMALL.
32
+ | `intent_class` | Signal | Elicitation Strategy | Max Rounds (incl. R0) | Default `scope_class` |
33
+ |---|---|---|---|---|
34
+ | `GREENFIELD-SYSTEM` | Net-new system; no host repo | Full PRD-grade discovery | $\le 6$ | `LARGE` |
35
+ | `GREENFIELD-MODULE` | Net-new module in existing repo | Infer from host repo first; targeted forks | $\le 3$ | `MEDIUM` |
36
+ | `BROWNFIELD-FEATURE` | Additive behavior in existing repo | Survey first; ask only unresolved gaps ($\le 5$ Qs) | $\le 3$ | `MEDIUM` / `SMALL` |
37
+ | `BROWNFIELD-CHANGE` | Modify existing behavior in place | Survey first; diff current vs target behavior | $\le 3$ | `SMALL` |
71
38
 
72
- Scale is INFERRED, not asked: derive scope_class from the opening message +
73
- repo context + the class above, state it with one line of reasoning, and let
74
- the user confirm or correct. Ask about scale ONLY when genuinely
75
- ambiguous/confused. Small/simple prompts: skip heavy calibration, ask only
76
- the 1–2 core forks (§ How to ask), decide the rest.
39
+ Infer `scope_class` (`SMALL`/`MEDIUM`/`LARGE`), state with 1-line reasoning, and let the user confirm or override. Never interrogate brownfield tasks with greenfield PRD questions.
77
40
 
78
41
  ## GREENFIELD-SYSTEM — professional discovery (≤6 rounds)
79
42
 
80
- Creating a system from scratch demands PRD-grade inputs. Each round below
81
- lists its questions and where the answers land (`feeds:` tags — see
82
- Traceability).
43
+ Tag recorded answers with `feeds:` targets for downstream traceability.
83
44
 
84
45
  ### R1 — problem, users, success → PRD
85
-
86
- 1. What problem does this solve, for whom — and what is explicitly NOT a goal?
87
- 2. Who uses it? Sketch 1–3 personas: role, key job-to-be-done, environment.
88
- 3. What does success look like — measurable (activation, conversion,
89
- time-saved, error rate)? Adjectives are not metrics.
46
+ 1. Core problem, target audience, and explicit non-goals? (`feeds: prd.problem|prd.non_goals`)
47
+ 2. 1–3 primary personas: role, job-to-be-done, operating environment? (`feeds: prd.personas`)
48
+ 3. Measurable success metrics (activation, latency, error rate—no adjectives)? (`feeds: prd.metrics`)
90
49
 
91
50
  ### R2 — shape & module decomposition → architecture.yaml `modules`
92
-
93
- Infer stack/hosting from stated preferences, then confirm:
94
-
95
- 4. Stack + hosting target correct? (state your inference)
96
- 5. Integration surfaces: auth, payments, email, existing APIs?
97
-
98
- Then PROPOSE a strawman module map from the domain talk — one line per
99
- candidate module as `name — responsibility` (mirroring `modules[]`:
100
- name/responsibility/owns) — and ask the user to react:
101
-
102
- 6. React to this strawman module map: [list]. What is missing, misnamed, or
103
- should be merged/split? Iterate until agreement — this seeds
104
- architecture.yaml `modules`.
51
+ 4. Confirm inferred tech stack + hosting target? (`feeds: prd.constraints`)
52
+ 5. External integrations (auth, payments, messaging, 3rd-party APIs)? (`feeds: prd.integrations`)
53
+ 6. **Strawman module map:** Propose candidate modules (`name — responsibility`) and ask user to add, merge, split, or rename until agreed. (`feeds: arch.modules`)
105
54
 
106
55
  ### R3 — data & API sketches → `data_contracts`, `api_contracts`
107
-
108
- 7. Core data entities and relationships — one line each: Entity — key fields —
109
- belongs-to / has-many? (seeds `data_contracts`)
110
- 8. Primary API surface: the 5–10 operations users/systems perform, verb +
111
- resource? (seeds `api_contracts`)
56
+ 7. Core entities, key fields, and relationships (`belongs-to`/`has-many`)? (`feeds: arch.data_contracts`)
57
+ 8. Primary API operations (5–10 core `VERB + resource` endpoints/actions)? (`feeds: arch.api_contracts`)
112
58
 
113
59
  ### R4 — NFRs with numbers → PRD
114
-
115
- Numbers or it didn't happen — reject "fast"/"scalable" without figures.
116
-
117
- 9. Performance budgets: p95 latency, throughput at peak?
118
- 10. Scale targets: users, reqs/day, data growth per year?
119
- 11. Security/compliance checklist level (GDPR/HIPAA/PCI)? i18n locales?
120
- Accessibility level (e.g. WCAG 2.2 AA)?
60
+ 9. Performance budgets: p95 latency, peak RPS/throughput? (`feeds: prd.nfrs`)
61
+ 10. Scale targets: active users, requests/day, annual data volume? (`feeds: prd.nfrs`)
62
+ 11. Security/compliance (GDPR/HIPAA/PCI), i18n locales, accessibility target (e.g., WCAG 2.2 AA)? (`feeds: prd.nfrs`)
121
63
 
122
64
  ### R5 — environment & naming → `environment_matrix`, `naming_conventions`
123
-
124
- 12. Environment/deploy reality: which environments exist (dev/staging/prod),
125
- hosting, config/secrets handling, deploy cadence? (seeds
126
- `environment_matrix`)
127
- 13. Naming/brand conventions that already exist: product-name casing, domain
128
- terms to preserve, UI copy language(s)? (seeds `naming_conventions`;
129
- "none" is a valid answer)
65
+ 12. Environments (dev/staging/prod), secret management, deploy cadence? (`feeds: arch.environment_matrix`)
66
+ 13. Existing naming, domain glossary, or brand casing rules (`none` is valid)? (`feeds: arch.naming_conventions`)
130
67
 
131
68
  ### R6 — close-out → PRD
69
+ 14. Explicit out-of-scope items excluded from this build? (`feeds: prd.out_of_scope`)
70
+ 15. Top 2 known technical or product risks? (`feeds: prd.risks`)
132
71
 
133
- 14. Explicit out-of-scope list — adjacent things on record as NOT in this build?
134
- 15. Top 2 risks you already know about?
135
-
136
- Close by presenting the agreed module map + captured NFR numbers for final
137
- confirmation ([wait for user]).
72
+ Present the finalized module map + numeric NFRs for confirmation. `[wait for user]`
138
73
 
139
74
  ### Traceability — `feeds:` tags
140
75
 
141
- Every recorded answer MAY carry a `feeds:` tag naming the artifact section it
142
- lands in. Keep the vocabulary literal — downstream templates consume these
143
- exact names:
144
-
145
- - PRD sections: `prd.problem`, `prd.goals`, `prd.non_goals`, `prd.personas`,
146
- `prd.metrics`, `prd.nfrs`, `prd.constraints`, `prd.integrations`,
147
- `prd.risks`, `prd.out_of_scope`
148
- - architecture.yaml keys: `arch.modules`, `arch.data_contracts`,
149
- `arch.api_contracts`, `arch.environment_matrix`, `arch.naming_conventions`
150
-
151
- Multiple targets join with `|`, e.g. `feeds: prd.goals|arch.modules`.
76
+ Valid literal `feeds:` targets (join multiple with `|`, e.g., `feeds: prd.goals|arch.modules`):
77
+ - **PRD:** `prd.problem`, `prd.goals`, `prd.non_goals`, `prd.personas`, `prd.metrics`, `prd.nfrs`, `prd.constraints`, `prd.integrations`, `prd.risks`, `prd.out_of_scope`
78
+ - **Architecture:** `arch.modules`, `arch.data_contracts`, `arch.api_contracts`, `arch.environment_matrix`, `arch.naming_conventions`
152
79
 
153
80
  ## GREENFIELD-MODULE — net-new inside an existing system (≤3 rounds)
154
81
 
155
- Infer first from the host repo (structure, conventions, neighboring modules),
156
- confirm second:
157
-
158
- 1. Where does it plug in — which host modules does it read from / expose to?
159
- 2. Contract with the host: data it consumes/produces, APIs or events it
160
- exposes? (seeds `data_contracts` / `api_contracts` deltas)
161
- 3. Inherited vs new NFRs: follow host perf/a11y/i18n baselines or set new ones?
162
- 4. Naming follows host conventions — confirm? (seeds `naming_conventions`)
82
+ Infer from the host repo first, then confirm:
83
+ 1. Host touchpoints: which existing modules does it import from or expose interfaces to? (`feeds: arch.modules`)
84
+ 2. Data & API delta: new entities, events, or endpoints vs existing ones? (`feeds: arch.data_contracts|arch.api_contracts`)
85
+ 3. NFRs: inherit host perf/a11y/i18n baselines or define custom targets? (`feeds: prd.nfrs`)
86
+ 4. Confirm adherence to host `naming_conventions`? (`feeds: arch.naming_conventions`)
163
87
 
164
88
  ## BROWNFIELD classes — survey BEFORE questioning (mandatory)
165
89
 
166
- Run the survey first (SKILL.md BROWNFIELD steps 1–2): prefer the CodeGraph MCP
167
- tools (Step 0 builds the index when absent), else structured glob/grep; produce or update `.archgen/<slug>/codebase-map.md`. Then ask ONLY
168
- what the survey could not answer. NEVER ask what a file already answers —
169
- quote the file and ask for confirmation instead.
170
-
171
- ### BROWNFIELD-FEATURE (additive; max ~5 questions, one batched message)
172
-
173
- Ask only unresolved gaps, typically:
90
+ Execute the codebase survey (`SKILL.md` BROWNFIELD steps 1–2) to produce `.archgen/<slug>/codebase-map.md` BEFORE asking questions. Never ask what the code already answers—cite the file path and confirm.
174
91
 
175
- 1. Acceptance criteria the code cannot reveal — exact expected behavior, edge
176
- cases that matter.
177
- 2. Back-compat expectations for existing records or clients.
178
- 3. Rollout preference: feature flag, staged, immediate?
179
- 4. Must-NOT-touch paths beyond what the map shows?
180
- 5. Anything the codebase-map got wrong?
92
+ ### BROWNFIELD-FEATURE (additive; max ~5 questions, 1 batched message)
93
+ 1. Target acceptance behavior and critical edge cases not evident from code?
94
+ 2. Backward-compatibility requirements for existing data/clients?
95
+ 3. Rollout mechanism (feature flag, staged, immediate)?
96
+ 4. Protected paths outside `codebase-map.md` that must not be modified?
97
+ 5. Any corrections to `codebase-map.md`?
181
98
 
182
99
  ### BROWNFIELD-CHANGE (behavior modification; ≤3 rounds)
183
-
184
- Survey focus: current behavior + blast radius (callers, tests, consumers).
185
-
186
- 1. Current vs desired behavior — precise diff, including what must stay.
187
- 2. Compatibility: migrate in place, version alongside, or breaking change?
188
- 3. Acceptance for "changed": how do we prove old behavior is gone and the new
189
- behavior holds?
100
+ 1. Exact behavioral diff: current vs desired behavior, plus invariants that must remain unchanged?
101
+ 2. Migration path: in-place update, parallel versioned endpoint, or breaking cutover?
102
+ 3. Verification criteria proving legacy behavior is removed and new behavior holds?
190
103
 
191
104
  ## Conflict detection
192
105
 
193
- While collecting, watch for and surface immediately:
194
- - Scale vs budget contradictions ("1M users" + "cheapest VPS")
195
- - Feature vs constraint collisions ("real-time" + "no websockets allowed")
196
- - Requirement vs existing-architecture conflicts (brownfield: check codebase-map)
197
-
198
- Format: "I see a tension between X and Y. Which wins?" — one per message,
199
- resolve before proceeding. [wait for user]
106
+ Immediately surface contradictions (scale vs budget, feature vs technical constraint, requirement vs `codebase-map.md`) one at a time:
107
+ *"I see a tension between X and Y. Which takes precedence?"* `[wait for user]`
200
108
 
201
109
  ## Token discipline
202
110
 
203
- - Batch 3–5 questions per message; never ping-pong one-per-message.
204
- - Hard round caps — MAXIMA, not targets (small prompts ask far fewer;
205
- § How to ask): GREENFIELD-SYSTEM ≤6 rounds, every other class ≤3
206
- (round 0 counts when it runs).
207
- - Skip any question already answered by the opening message, calibration, or
208
- survey artifacts.
111
+ - Batch 3–5 questions per turn; never ping-pong single questions.
112
+ - Respect round ceilings (`GREENFIELD-SYSTEM` $\le 6$, all others $\le 3$ including R0).
113
+ - Never re-ask facts provided in the prompt, calibration, or `codebase-map.md`.
209
114
 
210
115
  ## Answers-file format (machine-readable, enables non-interactive runs)
211
116
 
212
- For scripted E2E or re-runs, requirements may come from a file instead of
213
- conversation — `.archgen/<slug>/answers.yaml`.
214
-
215
- **The skeleton is a tool output:** `archgen_plan{action:'scaffold', scope:'LARGE'}`
216
- returns a ready-to-fill `answers.yaml` with every field below. The shape:
117
+ When `.archgen/<slug>/answers.yaml` is present and valid, treat it as authoritative input and skip conversational rounds. Generate its skeleton via `archgen_plan{action:'scaffold'}`:
217
118
 
218
119
  ```yaml
219
- scope_class: MEDIUM # SMALL | MEDIUM | LARGE — UNCHANGED; SKILL.md reads
220
- # this for right-sizing. Never remove or rename.
221
- intent_class: GREENFIELD-SYSTEM # optional: GREENFIELD-SYSTEM |
222
- # GREENFIELD-MODULE | BROWNFIELD-FEATURE |
223
- # BROWNFIELD-CHANGE
224
- calibration: # optional — from round 0
225
- scale: production # prototype | mvp | production
120
+ scope_class: MEDIUM # SMALL | MEDIUM | LARGE (REQUIRED by SKILL.md)
121
+ intent_class: GREENFIELD-SYSTEM # optional: GREENFIELD-SYSTEM | GREENFIELD-MODULE | BROWNFIELD-FEATURE | BROWNFIELD-CHANGE
122
+ calibration: # optional
123
+ scale: production # prototype | mvp | production
226
124
  teamConstraints: solo dev, repo lint rules apply
227
- pressure: medium # low | medium | high
125
+ pressure: medium # low | medium | high
228
126
  problem: one-line problem statement
229
127
  success_criteria:
230
- - text: measurable outcome # structured entries MAY carry feeds:
128
+ - text: measurable outcome
231
129
  feeds: prd.metrics
232
130
  constraints:
233
- - must-not-change item # plain scalars stay valid; tag via
234
- # trailing comment: # feeds: prd.constraints
235
- non_goals: # optional (GREENFIELD-SYSTEM)
131
+ - must-not-change item # feeds: prd.constraints
132
+ non_goals: # optional (GREENFIELD-SYSTEM)
236
133
  - multi-tenant accounts
237
- personas: # optional (GREENFIELD-SYSTEM)
134
+ personas: # optional (GREENFIELD-SYSTEM)
238
135
  - role: shopper
239
136
  goal: find and buy in under two minutes
240
- nfrs: # optional; NUMBERS required for GREENFIELD-SYSTEM
137
+ nfrs: # optional; numeric values required for GREENFIELD-SYSTEM
241
138
  - "p95 API latency < 300ms at 50 rps"
242
139
  - "locales: en, de"
243
140
  - "accessibility: WCAG 2.2 AA"
244
- out_of_scope: [] # optional
141
+ out_of_scope: [] # optional
245
142
  stack:
246
143
  language: typescript
247
144
  runtime: node
248
145
  hosting: vercel
249
146
  integrations: [auth0, stripe]
250
- compliance: [] # checklist placeholders only
147
+ compliance: []
251
148
  risks:
252
149
  - known risk text
253
150
  ```
254
151
 
255
- Backward compatibility: ALL additions (`intent_class`, `calibration`,
256
- `non_goals`, `personas`, `nfrs`, `out_of_scope`, per-answer `feeds:` tags) are
257
- OPTIONAL. Existing fields keep their names and semantics; `scope_class` is
258
- retained verbatim because SKILL.md consumes it. Consumers that do not trace
259
- provenance ignore `feeds:` tags in both forms (sibling key on structured
260
- entries, trailing comment on plain scalars).
261
-
262
- The orchestrator treats answers.yaml as authoritative user input and skips
263
- the conversational rounds when it exists and parses cleanly.
152
+ All fields added beyond `scope_class`, `problem`, `success_criteria`, `constraints`, `stack`, `integrations`, `compliance`, and `risks` are optional and backward-compatible. `feeds:` tags may appear as object keys or trailing `# feeds:` comments.
264
153
 
265
154
  ## Completion test
266
155
 
267
- Requirements are done when ALL hold:
268
- - Every applicable question in the chosen intent class's question set answered
269
- (or explicitly waived by the user)
270
- - All drafted inferences confirmed or corrected
271
- - Zero unresolved conflicts
272
- - Scope class agreed (SMALL/MEDIUM/LARGE) — this gates artifact generation
273
- (unchanged; SKILL.md consumes it)
274
- - Chosen `intent_class` recorded in answers.yaml
275
- - GREENFIELD-SYSTEM only: module-map agreement reached (user reacted to the
276
- strawman and the revision is confirmed) AND NFR numbers captured — an NFR
277
- without a number fails this gate
156
+ Elicitation is complete only when ALL hold:
157
+ - All applicable intent-class questions are answered or explicitly waived.
158
+ - Inferred decisions are confirmed or corrected by the user.
159
+ - Zero unresolved conflicts remain.
160
+ - `scope_class` (`SMALL`/`MEDIUM`/`LARGE`) and `intent_class` are agreed and recorded in `answers.yaml`.
161
+ - For `GREENFIELD-SYSTEM`: strawman module map is agreed AND every NFR contains a concrete numeric target.
@@ -2,121 +2,52 @@
2
2
 
3
3
  ## archgen's own MCP server — already handled
4
4
 
5
- The `archgen-mcp` server and CodeGraph are wired by the installer
6
- (`npx archgen-skill init` / `install`), into every DETECTED harness, with the
7
- correct per-platform file and key. You never configure them by hand.
5
+ `npx archgen-skill init` (or `install`) automatically wires `archgen-mcp` and CodeGraph into every detected harness. Never configure them manually. If `archgen_*` tools are missing, run `npx archgen-skill init` at the repo root and ask the user to reload the harness (`§platforms/mcp-configuration`).
8
6
 
9
- If the `archgen_*` tools are missing from your tool list, run
10
- `npx archgen-skill init` in the project root and ask the user to reload the
11
- harness — that is the only setup step. The full per-platform shapes live in
12
- §platforms/mcp-configuration and in the installer's registry; the
13
- `archgen_setup` tool reports exactly what it would write (`action:'harnesses'`).
14
-
15
- Everything below is for OTHER MCP servers (context7, …).
7
+ The procedures below govern **external** MCP servers (e.g., `context7`) and capability skills.
16
8
 
17
9
  ## INSTALL-MCP procedure (approval-gated)
18
10
 
19
- 1. **Identify** the platform (SKILL.md Step 0), load its row from
20
- §platforms/mcp-configuration: config file, top-level key, quirks.
21
- 2. **Discover** — when the correct installation method or config shape for
22
- the detected harness is not confidently known, web-search the CURRENT
23
- official installation docs/command FIRST. Never trust potentially-stale
24
- memorized commands or invented config shapes; uncertainty triggers search,
25
- not guessing.
26
- 3. **Scope** — choose and state the install scope explicitly:
27
- - **GLOBAL** — server types that are global entries (npx/npm-based MCP
28
- servers usable across harnesses). Recommended for universally-useful
29
- servers (codegraph is the canonical example) unless the user prefers
30
- project-local.
31
- - **HARNESS-SPECIFIC** — write into the detected platform's config only.
32
- Recommended when the server only matters to that platform.
33
- The user's approval covers the stated scope.
34
- 4. **Prefer the platform CLI** where the table lists one, passing the scope
35
- flag that matches the chosen scope:
36
- - `claude mcp add --scope project --transport http <name> <url>`
37
- - `codex mcp add <name> --url <url>` or `codex mcp add <n> -- cmd args`
38
- - `gemini mcp add -s project -t http <name> <url>`
39
- 5. No CLI available: draft the exact config diff against the platform's real
40
- shape (see `packages/mcp/assets/mcp-template.json` for annotated canonical
41
- forms) and SHOW
42
- it to the user. **USER APPROVAL GATE** — wait for an explicit yes before any
43
- write; approval is never inferred from earlier steps.
44
- 6. Apply, then apply the restart semantics from the platforms table.
45
- 7. Verify the tool is visible after reload; report failure modes honestly.
46
-
47
- Never write MCP configs silently. Never invent config shapes — the four known
48
- top-level keys are mcpServers / servers / mcp / context_servers; remote URL
49
- fields vary (url vs serverUrl vs httpUrl) per the platforms table. Uncertainty
50
- triggers web-search of current official docs, never invention.
11
+ 1. **Identify platform:** Call `archgen_setup{action:'harness_info'}` (or inspect `§platforms/mcp-configuration`) for the config path, top-level key (`mcpServers` / `servers` / `mcp` / `context_servers`), and URL field name (`url` / `serverUrl` / `httpUrl`).
12
+ 2. **Discover:** Web-search current official installation docs for the target MCP server and harness. Never guess commands or config schemas.
13
+ 3. **Declare scope:** State whether the install is **GLOBAL** (recommended for cross-project tools like CodeGraph) or **HARNESS-SPECIFIC** (project/platform-local).
14
+ 4. **Prefer native CLI** (matching chosen scope):
15
+ - Claude Code: `claude mcp add --scope project --transport http <name> <url>`
16
+ - Codex: `codex mcp add <name> --url <url>` or `codex mcp add <n> -- <cmd> <args>`
17
+ - Gemini CLI: `gemini mcp add -s project -t http <name> <url>`
18
+ 5. **Approval gate:** If editing config files directly, show the exact config diff (matching `packages/mcp/assets/mcp-template.json` conventions) and **WAIT FOR EXPLICIT USER APPROVAL** before writing.
19
+ 6. **Apply & verify:** Write config, apply platform restart/reload semantics, and verify tool visibility.
51
20
 
52
21
  ## FETCH-SKILL procedure
53
22
 
54
- Capability-skill loading is **REQUIRED, not opportunistic**. Whenever planned
55
- work touches a registry `matches` domain, the matching skill MUST be loaded —
56
- during planning (GENERATE / BROWNFIELD / UPDATE) AND re-verified during
57
- execution (worker dispatch). UI/design/frontend/animation/component/
58
- landing-page work REQUIRES the design skills (`ui-skills`, `policy:
59
- "required"`) loaded first. Referenced from elsewhere as:
60
- *see §mcp-and-skills/fetch-skill*.
61
-
62
- 0. **WHEN** — mandatory, twice per matched task:
63
- - **Pre-planning scan**: while planning, check every task's title, summary,
64
- and `file_ownership` against the registry BEFORE the plan is finalized;
65
- fetch any matched skill at that point.
66
- - **Pre-dispatch verification**: immediately before dispatching each worker,
67
- re-verify its match; if the skill is missing from the platform skill dir,
68
- install it before dispatch proceeds.
69
- 1. **MATCH** — call `archgen_skills { action: 'match', title, summary,
70
- fileOwnership }`. The tool holds the registry and applies **case-insensitive
71
- whole-WORD matching** (`\b` boundaries; a match requires the pattern to stand
72
- alone as a token or hyphen/underscore-delimited unit). Bare `"ui"` matches
73
- the task "redesign the ui" and "ui-skills audit", but does NOT match
74
- "guide", "build", "sequence", or "building" — the 2026-08 substring semantics
75
- mis-fired on every task and made the required gate meaningless. One
76
- `required` hit = this procedure is mandatory for that task.
77
- 2. **RESOLVE** — the tool reports, for every match, whether the skill is
78
- already installed and at which path. It owns the per-platform resolution
79
- (§platforms/harness-capabilities is the human-readable mirror);
80
- never duplicate that logic here.
81
- 3. **INSTALL once if absent** — cached check first: if the skill is already
82
- present, skip the reinstall and go to step 4. Otherwise call
83
- `archgen_skills { action: 'install', skillId, harness, approve: true }`.
84
- The tool drives the `skills` CLI (`npx -y skills add <repo> --skill <slug>
85
- --agent <agent> --yes --json`) — **one skill, never a bundle**, and
86
- non-interactively (the CLI PROMPTS without `--yes`/`--agent`, so an
87
- automated install would hang). Then VERIFY: the tool re-checks the
88
- filesystem and reports the path. Fetch happens ONCE per project; later runs
89
- are cache hits.
90
- 4. **INTEGRATE** — inject the follow-instruction into (a) the planning context
91
- so tasks reference the skill's standards, and (b) EVERY affected worker
92
- prompt, using this sentence template:
93
-
94
- > `<Domain> work: follow <skill-dir>/SKILL.md (installed via FETCH-SKILL) — apply its standards to every relevant decision.`
23
+ Capability-skill loading is **MANDATORY** whenever planned work matches a registry domain (especially `ui-skills` with `policy: "required"` for UI, frontend, design, animation, component, or landing-page tasks).
24
+
25
+ 0. **Execution points (runs TWICE per matched task):**
26
+ - **Pre-planning scan:** During GENERATE / BROWNFIELD / UPDATE, match every task before finalizing the plan.
27
+ - **Pre-dispatch verification:** Immediately before dispatching a worker, verify required skills are installed.
28
+ 1. **MATCH:** Call `archgen_skills{action:'match', title, summary, fileOwnership}`. Uses case-insensitive whole-word (`\b`) matching (e.g., `"ui"` matches `"redesign the ui"` or `"ui-skills"`, never `"build"` or `"guide"`). Any hit with `policy: "required"` makes steps 2–5 mandatory.
29
+ 2. **RESOLVE:** `archgen_skills` checks all project, harness, and global skill directories (`<project>/.agents/skills/<slug>/SKILL.md` and `~/.agents/skills/<slug>/`) and reports installation status and path.
30
+ 3. **INSTALL (if missing):** Skip if already installed (cache hit). Otherwise call:
31
+ ```
32
+ archgen_skills { action: 'install', skillId, harness, approve: true }
33
+ ```
34
+ This invokes `npx -y skills add <repo> --skill <slug> --agent <agent> --yes --json` to install the single matched skill non-interactively (never a full repo bundle) and verifies the resulting file path.
35
+ 4. **INTEGRATE (inline into worker contract):** Call `archgen_tasks{action:'contract', tasksYaml, taskId}`. It automatically extracts the normative rules (`MUST` / `SHOULD` / `NEVER`), file path, and section index from every matched required skill and embeds them directly into the worker prompt so workers cannot overlook them.
36
+ - To inspect a skill manually, call `archgen_skills{action:'load', skillId}` (full rules + index), `{action:'digest', skillId}` (index only), or `{action:'load', skillId, section}` (single section).
37
+ 5. **AUDIT:** Every worker completion report MUST include an explicit compliance line:
38
+ - `Skill compliance: followed <skill-slug> (<path/to/SKILL.md>)`
39
+ - `Skill compliance: NOT followed — <reason>`
40
+ 6. **MISSING CAPABILITY:** If a task clearly requires an specialized domain absent from the registry, web-search reputable skill repositories, propose the candidate to the user, and add to the registry ONLY after explicit user approval.
95
41
 
96
- Concrete design instantiation for ui-skills:
97
-
98
- > `Design work: follow <skill-dir>/SKILL.md (installed via FETCH-SKILL) — apply its component/motion/baseline standards to every visual decision.`
99
-
100
- 5. **AUDIT** — workers MUST state in their completion report whether they
101
- followed the injected skill, one auditable line, e.g.:
102
- `Skill compliance: followed ui-skills (<skill-dir>/SKILL.md)` or
103
- `Skill compliance: NOT followed — <reason>`.
104
- 6. **MISSING CAPABILITY** — unmatched-but-obvious domain (user says "make it
105
- pretty" with no registry entry): web-search reputable skill repos, propose
106
- to user, on approval append an entry to the registry (PR or local edit).
107
- Never add registry entries without explicit user approval.
108
42
  ## The registry
109
43
 
110
- The registry lives with the MCP server — `packages/mcp/assets/skill-registry.json`
111
- — and is read by the `archgen_skills` tool. The agent never edits it and never
112
- reads it directly; the tool is the only interface.
113
-
114
- Canonical entry keys, in order:
44
+ Managed by `archgen_skills` at `packages/mcp/assets/skill-registry.json` (never edit directly):
115
45
 
116
46
  ```json
117
47
  {
118
48
  "id": "ui-motion",
119
49
  "slug": "fixing-motion-performance",
50
+ "domain": "Motion",
120
51
  "family": "ui-skills",
121
52
  "repo": "ibelick/ui-skills",
122
53
  "purpose": "Motion and animation performance — jank-free transitions.",
@@ -125,28 +56,7 @@ Canonical entry keys, in order:
125
56
  }
126
57
  ```
127
58
 
128
- - `matches[]`: case-insensitive WHOLE-WORD patterns tested against task titles,
129
- summaries and file_ownership during the FETCH-SKILL domain scan (step 1).
130
- Never raw substrings — see step 1 for why.
131
- - `policy` (`required` | `on-demand`) — how mandatory loading is:
132
- - `"required"`: loading is MANDATORY whenever work touches any of the
133
- entry's `matches` domains — pre-planning fetch plus pre-dispatch
134
- verification (FETCH-SKILL steps 0–5 all apply).
135
- - `"on-demand"`: fetched only when a task explicitly names the capability.
136
-
137
- **Install model.** The `skills` CLI (npm package `skills`, from
138
- vercel-labs/skills) installs ONE named skill:
139
-
140
- ```
141
- npx -y skills add <repo> --skill <slug> --agent <agent> --yes --json
142
- ```
143
-
144
- `--yes` and `--agent` are MANDATORY for an automated install: without them the
145
- CLI is interactive and will hang. It lands the skill at
146
- `<project>/.agents/skills/<slug>/SKILL.md` (global: `~/.agents/skills/<slug>/`)
147
- — every harness reads `.agents/skills/`, so that one path is what a worker
148
- should be pointed at.
149
-
150
- **No clustering.** A task that mentions "animation" gets the motion skill — not
151
- the whole UI family. The registry maps a capability DOMAIN to ONE precise skill,
152
- and the tool installs exactly that.
59
+ - `domain`: Human-readable label injected into the worker contract (`"Motion work: follow ..."`).
60
+ - `matches[]`: Case-insensitive whole-word tokens matched against task `title`, `summary`, and `file_ownership`.
61
+ - `policy`: `"required"` (mandatory pre-planning + pre-dispatch enforcement) or `"on-demand"` (loaded only when explicitly requested).
62
+ - **Granular install:** Each domain maps to and installs ONE specific skill (`--skill <slug>`), never an entire skill family.