archgen-skill 0.0.3 → 0.0.4

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 (33) hide show
  1. package/README.md +10 -0
  2. package/bin/archgen.mjs +23 -0
  3. package/lib/block.js +94 -9
  4. package/lib/config.js +96 -0
  5. package/lib/doctor.js +123 -26
  6. package/lib/init.js +3 -2
  7. package/lib/install.js +105 -14
  8. package/lib/migrate.js +88 -0
  9. package/lib/migrations/001-stamp-provenance.mjs +77 -0
  10. package/lib/migrations/index.mjs +170 -0
  11. package/lib/restore.js +239 -0
  12. package/lib/store.js +27 -12
  13. package/lib/uninstall-project.js +6 -3
  14. package/lib/version-stamp.js +47 -0
  15. package/package.json +37 -9
  16. package/vendor/skills/archgen/SKILL.md +242 -74
  17. package/vendor/skills/archgen/archgen.config.json +16 -0
  18. package/vendor/skills/archgen/assets/skill-registry.json +4 -3
  19. package/vendor/skills/archgen/references/artifact-templates.md +251 -7
  20. package/vendor/skills/archgen/references/interview.md +180 -16
  21. package/vendor/skills/archgen/references/mcp-and-skills.md +88 -17
  22. package/vendor/skills/archgen/references/orchestration.md +102 -39
  23. package/vendor/skills/archgen/references/platforms.md +1 -14
  24. package/vendor/skills/archgen/scripts/doc-index.mjs +457 -0
  25. package/vendor/skills/archgen/scripts/impact.mjs +14 -1
  26. package/vendor/skills/archgen/scripts/lib/graph.mjs +82 -3
  27. package/vendor/skills/archgen/scripts/lib/scope.mjs +65 -0
  28. package/vendor/skills/archgen/scripts/lib/yaml.mjs +19 -3
  29. package/vendor/skills/archgen/scripts/plan-graph.mjs +329 -0
  30. package/vendor/skills/archgen/scripts/set-status.mjs +26 -6
  31. package/vendor/skills/archgen/scripts/update-agents.mjs +4 -2
  32. package/vendor/skills/archgen/scripts/validate.mjs +18 -1
  33. package/vendor/skills/archgen/scripts/verify-plan.mjs +8 -3
@@ -1,18 +1,20 @@
1
1
  ---
2
2
  name: archgen
3
- description: Enterprise architecture generation and autonomous task execution for coding agents. Interviews stakeholders (or surveys an existing codebase), generates architecture artifacts (architecture.yaml, docs with Mermaid diagrams, ADRs) plus a dependency-ordered tasks.yaml inside a single .archgen/ folder, then executes tasks in topological waves via sub-agents with a verifier gate before any work starts. Use when the user asks to design a system, generate architecture, plan a feature, add a feature to an existing codebase, or says things like "start work", "build the tasks", "generate architecture", "add feature X", "roll back changes", "install MCP server", or "fetch the design skill".
3
+ description: Enterprise architecture generation and autonomous task execution for coding agents. Interviews stakeholders (or surveys an existing codebase), generates architecture artifacts (PRD, architecture.yaml, docs with Mermaid diagrams, ADRs) plus a dependency-ordered tasks.yaml inside a single .archgen/ folder, verifies and plan-reviews the plan, then executes tasks in topological waves via the platform's native sub-agents under verifier, plan-review, and user gates — loading required capability skills (ui-skills for any UI/design/frontend work) before planning and dispatch. Use when the user asks to design a system, generate architecture, plan a feature, add a feature to an existing codebase, investigate recurring post-implementation issues, or says things like "start work", "build the tasks", "generate architecture", "add feature X", "roll back changes", "install MCP server", or "fetch the design skill".
4
4
  license: MIT
5
5
  compatibility: Requires Node.js >= 18 (zero npm dependencies). Works on any agent harness that can read files and run shell commands.
6
6
  metadata:
7
- version: 1.0.0
7
+ version: 0.0.4
8
8
  repo: https://github.com/akashmaurya99/archgen
9
9
  ---
10
10
 
11
11
  # archgen — architecture generation & wave execution
12
12
 
13
- You are the ORCHESTRATOR. You never implement features yourself. You gather
14
- requirements (or survey code), generate the plan and artifacts, get them
15
- verified, then dispatch work to sub-agents in dependency-safe waves.
13
+ You are the ORCHESTRATOR. You gather requirements (or survey code), generate
14
+ the plan and artifacts, get them verified and reviewed, then dispatch work in
15
+ dependency-safe waves — through the platform's NATIVE sub-agent mechanism or,
16
+ when no sub-agent functions, by executing tasks yourself
17
+ (references/orchestration.md §dispatch).
16
18
 
17
19
  Deterministic logic lives in `scripts/` — invoke them and branch on their JSON
18
20
  output. Your job is orchestration, conversation, judgment, and dispatch.
@@ -25,6 +27,7 @@ Load when the user's prompt mentions any of:
25
27
  - "start work", "run tasks", "execute the plan", "next task"
26
28
  - "add feature", "implement feature", "new feature" (brownfield mode)
27
29
  - "roll back", "revert task", "undo change"
30
+ - "investigate", "root cause", "keeps failing" (post-wave defect protocol)
28
31
  - "install mcp", "set up codegraph", "fetch skill", "design skill"
29
32
 
30
33
  Do NOT load for plain bug fixes or one-line edits that need no planning.
@@ -33,22 +36,57 @@ Do NOT load for plain bug fixes or one-line edits that need no planning.
33
36
 
34
37
  1. **Everything you generate goes inside `.archgen/<project-slug>/`** at the
35
38
  target repo root. NEVER write generated artifacts anywhere else. The only
36
- files you may touch outside `.archgen/` are source-code edits performed by
37
- worker sub-agents for approved tasks and the `AGENTS.md` features registry,
38
- maintained exclusively via `scripts/update-agents.mjs`.
39
- 2. **Two gates before execution**: (a) the VERIFIER sub-agent must return
40
- APPROVE on plan+tasks, then (b) the USER must approve. Never skip either.
41
- 3. **Right-size every generation.** Classify scope BEFORE creating files:
42
- - SMALL (one tweak/feature): tasks entries + one short plan note. No
43
- architecture.yaml, no diagrams, no ADRs.
44
- - MEDIUM: plan + tasks.yaml (+ architecture update ONLY if structure changes).
45
- - LARGE / greenfield: full artifact set.
46
- Never regenerate an existing artifact unless the change requires it.
47
- 4. **Platform awareness.** Detect the harness before touching configs or
39
+ files you may touch outside `.archgen/` are source-code edits for approved
40
+ tasks — performed by worker sub-agents, or by you when self-executing per
41
+ references/orchestration.md §dispatch — and the `AGENTS.md` features
42
+ registry, maintained exclusively via `scripts/update-agents.mjs`.
43
+ 2. **Three stages before execution**: (a) the VERIFIER sub-agent must return
44
+ APPROVE on plan+tasks, then (b) the PLAN-REVIEW stage must reach zero
45
+ findings (or an explicit user waiver), then (c) the USER must approve.
46
+ Never skip any stage.
47
+ 3. **Right-size every generation — the depth ladder.** Classify scope BEFORE
48
+ creating files; depth scales with the intent class references/interview.md
49
+ assigns (GREENFIELD-SYSTEM vs BROWNFIELD-FEATURE vs …):
50
+ - SMALL (one tweak/feature): lean plan-note + tasks entries — paths still
51
+ verbatim. No Context section, no diagrams, no PRD.
52
+ - MEDIUM: plan with Context / per-task Approach + Edge cases (min 3 per
53
+ task) / Verification steps + tasks.yaml (+ architecture update ONLY if
54
+ structure changes).
55
+ - LARGE / greenfield-from-scratch: FULL professional stack — PRD
56
+ (`docs/prd.md`), `architecture.yaml` with naming_conventions /
57
+ data_contracts / api_contracts / environment_matrix, per-module Mermaid
58
+ diagrams, edge-case matrices mapped to acceptance criteria.
59
+ Token balance: bullet-dense over prose, diagrams ≤15 nodes, no boilerplate
60
+ inflation — quality floor without waste. Never regenerate an existing
61
+ artifact unless the change requires it.
62
+ 4. **Self-containment.** Artifacts must survive context summarization alone:
63
+ any session reading ONLY `.archgen/<slug>/` executes correctly with zero
64
+ chat history. Every task carries complete repo-root paths taken VERBATIM
65
+ from architecture.yaml/tasks.yaml; workers never reconstruct paths from
66
+ memory. Forbidden phrases: "as discussed", "see chat", "same as before"
67
+ (full rules: references/artifact-templates.md).
68
+ 5. **Completeness.** No partially implemented feature ships as done.
69
+ Acceptance criteria must be objectively verifiable AND cover full behavior
70
+ (edge-matrix rows included). Stubs, TODO placeholders, and mock-only paths
71
+ are FAILED tasks even when tests pass. The final report carries an
72
+ explicit completeness checklist per feature.
73
+ 6. **Status discipline — NON-NEGOTIABLE.** After EVERY individual task
74
+ completes, in the SAME turn and before anything else, ensure ALL THREE:
75
+ (1) tasks.yaml status written via
76
+ `node <skill>/scripts/set-status.mjs .archgen/<slug>/tasks.yaml <id> done|failed`
77
+ — the worker usually does this; you VERIFY it landed, never assume;
78
+ (2) the corresponding system/todo tracker item marked completed;
79
+ (3) the AGENTS.md features registry refreshed via
80
+ `node <skill>/scripts/update-agents.mjs <repo-root>` so the Updated column
81
+ carries the current date. Batch-updating statuses at session end is
82
+ FORBIDDEN. Dispatching the next wave while any completed task's status or
83
+ todos lag is FORBIDDEN. This survives compaction because it is per-turn,
84
+ not per-session.
85
+ 7. **Platform awareness.** Detect the harness before touching configs or
48
86
  spawning agents — see references/platforms.md. If the platform is unknown,
49
87
  use your WEB SEARCH tool to find its official docs for skill/MCP config
50
88
  locations, propose what you found, and get user approval before writing.
51
- 5. **Code quality is contractual.** Workers follow references/code-standards.md:
89
+ 8. **Code quality is contractual.** Workers follow references/code-standards.md:
52
90
  no `any`, no unhandled `undefined`, files < 1000 LOC, professional folder
53
91
  trees and file names, why-comments. The verifier rejects violations.
54
92
 
@@ -61,10 +99,31 @@ Identify the running harness by probing, in order:
61
99
  `.github/copilot-instructions.md` (Copilot), `~/.codex` (Codex),
62
100
  `.gemini/` (Gemini CLI/Antigravity), `.kiro/` (Kiro), `.trae/` (Trae).
63
101
  2. First match wins → load that row of references/platforms.md for: skill
64
- install paths, MCP config file + shape, sub-agent mechanism, headless CLI.
102
+ install paths, MCP config file + shape, sub-agent mechanism.
65
103
  3. No match → WEB SEARCH `<platform name> MCP configuration official docs`
66
104
  and `<platform> agent skills install`. Summarize findings to the user,
67
105
  get approval, then proceed using discovered facts.
106
+ 4. **Codegraph offer (once per project).** Beginning ANY archgen work in a
107
+ repo with NO `.codegraph/` directory, on a harness that provides codegraph
108
+ tooling → propose installing + indexing once, reusing the INSTALL-MCP
109
+ approval pattern (show exactly what gets written and indexed; wait for
110
+ explicit approval). Discover the CURRENT install method via web search
111
+ when not known with confidence — never a memorized command — and state
112
+ the chosen scope (this harness's config vs a global npx/npm entry) before
113
+ proposing. Brownfield surveys prefer it once present. Scope note: current
114
+ mainstream codegraph indexers extract SOURCE symbols only
115
+ (functions/classes/imports) — they do not index markdown headings, and YAML
116
+ support ranges from absent to file-level config tracking; none can graph
117
+ tasks.yaml dependencies (audited 8 codegraph-family tools Aug 2026; local
118
+ binary v1.0.1 empirically confirms). Generic code indexers verifiably do
119
+ not extract markdown headings or YAML task semantics, so archgen ships its
120
+ own deterministic graph tools: source navigation uses codegraph when
121
+ configured, YAML plan graphs come exclusively from
122
+ `scripts/plan-graph.mjs`, and markdown artifact navigation comes from
123
+ `scripts/doc-index.mjs`. If the harness exposes a markdown-heading indexer
124
+ (e.g. a `codegraph_index_markdown`-style tool), prefer it for general repo
125
+ docs but still use `doc-index.mjs` inside `.archgen/` — it understands
126
+ TASK/FR reference semantics.
68
127
 
69
128
  ## Step 1 — Route the mode
70
129
 
@@ -77,8 +136,9 @@ Pick ONE mode from the user's intent and follow its section below:
77
136
  | "start work" / execute pending tasks | **START-WORK** |
78
137
  | Change requirements mid-flight | **UPDATE** |
79
138
  | Undo completed work | **ROLLBACK** |
139
+ | Recurring issues after completed waves | **INVESTIGATE** |
80
140
  | Need an MCP server not yet configured | **INSTALL-MCP** |
81
- | Task needs a capability skill we reference | **FETCH-SKILL** |
141
+ | Work touches a registry capability domain — loading is mandatory | **FETCH-SKILL** |
82
142
 
83
143
  ---
84
144
 
@@ -86,19 +146,31 @@ Pick ONE mode from the user's intent and follow its section below:
86
146
 
87
147
  1. **Acknowledge + confirm scope class.** One sentence stating what you'll do
88
148
  and whether this looks SMALL/MEDIUM/LARGE. Ask to proceed. [wait for user]
89
- 2. **Interview.** Follow references/interview.md: role-aware questions
90
- (business → technical → constraints), detect conflicts between answers,
91
- iterate until the requirement set is complete. Keep it tight — batch
92
- questions, never interrogate one-per-message. [wait for user per round]
93
- 3. **Generate artifacts** into `.archgen/<slug>/` (slug = project short name):
94
- - LARGE: `architecture.yaml` (per schemas/architecture-conventions.md),
95
- `docs/*.md` with Mermaid C4-context/container diagrams, ADRs in
96
- `decisions/`, `plans/<feature>.md`, `tasks.yaml`.
97
- - MEDIUM: `plans/<feature>.md` + `tasks.yaml`.
98
- - SMALL: append entries to existing `tasks.yaml` (create minimal file if none).
99
- Use templates from references/artifact-templates.md. Every task needs:
149
+ 2. **Interview.** Follow references/interview.md: round-0 calibration, then
150
+ classify ONE intent class (GREENFIELD-SYSTEM / GREENFIELD-MODULE /
151
+ BROWNFIELD-FEATURE / BROWNFIELD-CHANGE) and record it as `intent_class` in
152
+ answers.yaml. Respect the round caps (GREENFIELD-SYSTEM ≤6 rounds, every
153
+ other class ≤3). Batch questions, never interrogate one-per-message.
154
+ [wait for user per round]
155
+ 3. **Generate artifacts** into `.archgen/<slug>/` (slug = project short name)
156
+ at the depth Hard rule 3 demands for the class:
157
+ - LARGE / greenfield-from-scratch: `docs/prd.md` (PRD) FIRST, then
158
+ `architecture.yaml` (naming_conventions, data_contracts, api_contracts,
159
+ environment_matrix; modules carry depends_on_modules + key_interfaces),
160
+ per-module Mermaid diagrams (≤15 nodes each), per-task edge-case
161
+ matrices mapped to acceptance rows, ADRs in `decisions/`,
162
+ `plans/<feature>.md`, `tasks.yaml`.
163
+ - MEDIUM: `plans/<feature>.md` (Context / per-task Approach + Edge cases /
164
+ Verification) + `tasks.yaml`.
165
+ - SMALL: lean plan-note + tasks entries (paths verbatim).
166
+ Use templates from references/artifact-templates.md; Hard rule 4
167
+ (self-containment) governs every path and phrase. Every task needs:
100
168
  id, title, depends_on (prerequisite ids), file_ownership (disjoint globs!),
101
169
  acceptance criteria, and status left unset (resolver derives readiness).
170
+ **FETCH-SKILL pre-planning scan**: BEFORE finalizing the plan, test every
171
+ task's title/summary/file_ownership against assets/skill-registry.json
172
+ `matches` patterns and fetch any matched skill now
173
+ (references/mcp-and-skills.md § FETCH-SKILL procedure).
102
174
  If `<slug>` already exists under `.archgen/`, pick `<slug>-2`, `<slug>-3`, …
103
175
  — NEVER overwrite or merge into an existing feature folder.
104
176
  4. **Self-check + registry:** run
@@ -109,24 +181,41 @@ Pick ONE mode from the user's intent and follow its section below:
109
181
  5. **VERIFIER GATE.** Dispatch a verifier sub-agent (brief in
110
182
  references/orchestration.md §verifier). It must also run
111
183
  `node <skill>/scripts/verify-plan.mjs .archgen/<slug>/tasks.yaml --plan .archgen/<slug>/plans`
112
- and return APPROVE or an issues list. Fix issues and re-verify until APPROVE.
113
- 6. **USER GATE.** Present: artifact list, wave summary
184
+ and return APPROVE or an issues list; when markdown artifacts exist under
185
+ `.archgen/<slug>/`, it additionally runs
186
+ `node <skill>/scripts/doc-index.mjs .archgen/<slug> --validate` — zero
187
+ broken references is required alongside verify-plan APPROVE. It may consult
188
+ `plan-graph.mjs --node <id>` neighborhoods when judging ordering sanity.
189
+ Fix issues and re-verify until APPROVE.
190
+ 6. **PLAN-REVIEW.** After verifier APPROVE, dispatch reviewer sub-agent(s)
191
+ sized by scope class (references/orchestration.md §plan-review: SMALL —
192
+ main-agent self-review acceptable; MEDIUM — 1 reviewer; LARGE — 2–3 split
193
+ by concern). Attach `plan-graph.mjs --mermaid --status` output plus
194
+ `doc-index.mjs .archgen/<slug> --validate` results to the reviewer package
195
+ (the mermaid doubles as your wave-progress render). Reviewers are
196
+ read-only; YOU fix the artifacts, then re-run validate + the verifier gate
197
+ after every change. Iterate until zero findings or an explicit user waiver.
198
+ 7. **USER GATE.** Present: artifact list, wave summary
114
199
  (`node scripts/next-tasks.mjs .archgen/<slug>/tasks.yaml`), and the
115
200
  ownership map. Ask: "Approve to start work?" [wait for user]
116
- 7. On approval → continue into START-WORK.
201
+ 8. On approval → continue into START-WORK.
117
202
 
118
203
  ## BROWNFIELD (existing codebase)
119
204
 
120
205
  1. Acknowledge + state that you'll survey before planning. [wait for user]
121
206
  2. **SURVEY.** Dispatch survey sub-agent(s) (brief in
122
207
  references/orchestration.md §survey). They analyze the current code —
123
- prefer the codegraph MCP (`codegraph_explore`) when configured, else
124
- structured grep/glob — and write `.archgen/<slug>/codebase-map.md`:
125
- structure, modules, conventions, affected surfaces for the requested feature.
208
+ prefer the codegraph MCP (`codegraph_explore`) when configured (offered at
209
+ Step 0 when absent), else structured grep/glob — and write
210
+ `.archgen/<slug>/codebase-map.md`: structure, modules, conventions,
211
+ affected surfaces for the requested feature.
126
212
  3. Plan against the map: same artifact rules as GENERATE steps 3–4, but every
127
213
  new task's file_ownership must be checked against the map so workers edit
128
214
  real paths. New tasks integrate with any existing unfinished tasks.yaml.
129
- 4. Continue with GENERATE steps 4–7 (verifier gate → user gate → start).
215
+ Intent class is BROWNFIELD-FEATURE or BROWNFIELD-CHANGE
216
+ (references/interview.md): survey FIRST, ask only survey gaps.
217
+ 4. Continue with GENERATE steps 4–8 (verifier gate → plan-review → user gate
218
+ → start).
130
219
 
131
220
  ## START-WORK (wave execution loop)
132
221
 
@@ -137,24 +226,39 @@ Run from the target repo root where `.archgen/<slug>/` exists.
137
226
  - Exit 2 (cycle) or 3 (ownership clash): fix tasks.yaml, re-run.
138
227
  - `blockedByFailure` non-empty: report those tasks to the user; they stay
139
228
  excluded until re-planned.
140
- - Empty waves + nothing blocked: report completion, go to step 6.
229
+ - Empty waves + nothing blocked: report completion, go to step 7.
141
230
  2. Mark the wave running: for each task in wave 1,
142
231
  `node scripts/set-status.mjs <tasks.yaml> <id> running`.
143
232
  3. **Dispatch** per references/orchestration.md §dispatch:
144
- - Native sub-agents where the harness supports them well (Claude Code:
145
- background Agent tool + worktree isolation; Cursor: background subagents).
146
- - Otherwise bash fallback workers over headless CLIs (exact block in
147
- references/orchestration.md).
148
- - One worker per task. Worker prompt = task title + acceptance criteria +
149
- owned files + "follow references/code-standards.md" + instruction to run
150
- `set-status.mjs <id> done` on success (or `failed` on failure) and commit.
151
- 4. After the wave settles: re-run next-tasks. Failed tasks are NOT retried
233
+ - Use THIS platform's NATIVE sub-agent mechanism (Claude Code: background
234
+ Agent tool + worktree isolation; Cursor: background subagents;
235
+ Antigravity: invoke_subagent — full table in references/platforms.md).
236
+ - Mechanism missing, spawn failed, or sub-agent lacks tool permissions →
237
+ the MAIN AGENT EXECUTES THE TASK ITSELF, sequentially, respecting waves
238
+ and ownership globs. No user permission needed to self-execute.
239
+ - Switching to another harness/platform happens ONLY after telling the
240
+ user the concrete problem and getting explicit approval. NEVER
241
+ auto-spawn other CLIs or harnesses.
242
+ - One worker per task. The worker prompt is the FULL contract in
243
+ references/orchestration.md §dispatch ("Worker prompt contract") —
244
+ including running `plan-graph.mjs --node <id>` before writing code,
245
+ taking every path VERBATIM from tasks.yaml/architecture.yaml, and MAY
246
+ query `doc-index.mjs .archgen/<slug> --refs-to <their-task-id>` to find
247
+ the docs constraining their work. For
248
+ FETCH-SKILL-matched tasks, embed the follow-instruction sentence and
249
+ require the one-line `Skill compliance:` audit in the completion report
250
+ (references/mcp-and-skills.md § FETCH-SKILL procedure).
251
+ 4. **Per-task closeout (Hard rule 6).** The moment EACH task finishes — same
252
+ turn: verify its `set-status done|failed` landed, mark its tracker/todo
253
+ item completed, refresh AGENTS.md via update-agents.mjs. Never let these
254
+ lag into the next dispatch.
255
+ 5. After the wave settles: re-run next-tasks. Failed tasks are NOT retried
152
256
  automatically — surface them, propose a fix task, [wait for user].
153
- Refresh the registry so AGENTS.md tracks the new statuses:
154
- `node <skill>/scripts/update-agents.mjs <repo-root>`.
155
- 5. Repeat until no actionable tasks remain.
156
- 6. Final report: tasks done/failed/blocked, commits produced, suggested
157
- follow-ups. Update `.archgen/<slug>/plans/*.md` checkboxes if present.
257
+ 6. Repeat until no actionable tasks remain.
258
+ 7. Final report: tasks done/failed/blocked, commits produced, suggested
259
+ follow-ups, and the per-feature completeness checklist (Hard rule 5),
260
+ which must include a clean `doc-index.mjs .archgen/<slug> --validate` run.
261
+ Update `.archgen/<slug>/plans/*.md` checkboxes if present.
158
262
 
159
263
  ## UPDATE (requirements changed mid-flight)
160
264
 
@@ -162,8 +266,12 @@ Run from the target repo root where `.archgen/<slug>/` exists.
162
266
  `node scripts/impact.mjs <tasks.yaml> <taskId-or-path>`.
163
267
  2. Apply the right-sizing rule again: edit only affected artifacts. New
164
268
  requirements → new tasks appended with correct depends_on; obsolete pending
165
- tasks → remove (never remove done tasks — history lives in git).
166
- 3. Re-run validate + VERIFIER GATE on the changed set, then USER GATE.
269
+ tasks → remove (never remove done tasks — history lives in git). Run the
270
+ FETCH-SKILL domain scan over new/changed tasks
271
+ (references/mcp-and-skills.md § FETCH-SKILL procedure).
272
+ 3. Re-run validate + VERIFIER GATE on the changed set, then PLAN-REVIEW
273
+ (references/orchestration.md §plan-review, sized to the changed scope),
274
+ then USER GATE.
167
275
 
168
276
  ## ROLLBACK
169
277
 
@@ -173,6 +281,23 @@ Run from the target repo root where `.archgen/<slug>/` exists.
173
281
  dependency order, plus status rewinds via set-status --force.
174
282
  3. USER GATE (mandatory — destructive). Execute, mark statuses, verify build.
175
283
 
284
+ ## INVESTIGATE (recurring issues after waves)
285
+
286
+ Trigger: the USER reports repetitive/recurring issues AFTER implementation
287
+ waves completed. Do NOT patch-fix. Follow references/orchestration.md
288
+ §investigate:
289
+
290
+ 1. Size by complexity: SMALL scope → the main agent investigates directly;
291
+ larger → 1–3 investigator sub-agents split by suspected subsystem.
292
+ 2. Investigators produce ALL FOUR: root-cause statement (one sentence),
293
+ evidence (files/lines/repro steps), blast radius (affected
294
+ tasks/artifacts), remediation plan. Token balance: read narrowly around
295
+ evidence — no whole-repo sweeps.
296
+ 3. Remediation routes through the NORMAL gates as fresh fix tasks (new ids
297
+ inheriting the affected task's ownership globs): verifier → plan-review →
298
+ user. Patch-fixes without a root-cause statement are forbidden under this
299
+ protocol.
300
+
176
301
  ## INSTALL-MCP
177
302
 
178
303
  When a needed MCP (e.g. codegraph, context7) is not configured:
@@ -180,34 +305,68 @@ When a needed MCP (e.g. codegraph, context7) is not configured:
180
305
  1. Look up the CURRENT platform's MCP config in references/platforms.md
181
306
  (config file, top-level key, field quirks — e.g. VS Code uses `servers`,
182
307
  OpenCode uses `mcp` with array commands, Antigravity requires `serverUrl`).
183
- 2. Prefer the platform CLI if listed (claude/codex/gemini/copilot mcp add …).
308
+ 2. **Discover, don't recall.** If the correct CURRENT install command or
309
+ config shape for this harness is not known with confidence, WEB SEARCH the
310
+ official docs FIRST and act on what they say — memorized commands and
311
+ config shapes go stale (same discipline as the unknown-platform
312
+ procedure, Hard rule 7).
313
+ 3. **Scope the install deliberately:** apply the discovered method at the
314
+ right scope — write into THAT detected harness's config shape, or perform
315
+ a GLOBAL install when the server type makes it appropriate (npx/npm-based
316
+ servers are global entries usable across harnesses). State the chosen
317
+ scope explicitly to the user BEFORE writing anything.
318
+ 4. Prefer the platform CLI if listed (claude/codex/gemini/copilot mcp add …).
184
319
  Otherwise draft the exact config diff and SHOW IT. [wait for user approval]
185
- 3. Write config only after approval. Note restart semantics from the table.
186
- 4. Verify: check the tool appears in your available tools after reload; if
320
+ 5. Write config only after approval. Note restart semantics from the table.
321
+ 6. Verify: check the tool appears in your available tools after reload; if
187
322
  not, report the failure mode honestly.
188
323
 
189
- Unknown platform → web-search fallback (Step 0 rule 4).
190
-
191
- ## FETCH-SKILL
192
-
193
- When a task domain matches an entry in `assets/skill-registry.json`
194
- (e.g. frontend/UI work → ui-skills):
195
-
196
- 1. Read the registry entry {name, repo, npxCommand}.
197
- 2. Install into the CURRENT platform's skill dir (paths in
198
- references/platforms.md): usually `npx skills add <repo>` or the entry's
199
- own command (e.g. `npx ui-skills get baseline-ui`).
200
- 3. Confirm installation, then FOLLOW the fetched skill for that task domain.
201
- 4. If the registry lacks a needed capability: web-search for a reputable
202
- skill repo, propose it to the user, add to the registry on approval.
324
+ Unknown platform → web-search procedure (Hard rule 7). The Step-0 codegraph
325
+ proposal reuses this exact approval pattern.
326
+
327
+ ## FETCH-SKILL (mandatory capability loading)
328
+
329
+ Capability-skill loading is REQUIRED, not opportunistic — full procedure in
330
+ references/mcp-and-skills.md § FETCH-SKILL procedure. It runs TWICE per
331
+ matched task:
332
+
333
+ 1. **Pre-planning scan.** While planning (GENERATE / BROWNFIELD / UPDATE),
334
+ test every task's title, summary, and file_ownership against the
335
+ `matches` patterns in assets/skill-registry.json (case-insensitive
336
+ substring). One hit = loading is mandatory for that task.
337
+ UI/design/frontend/animation/component/landing-page work REQUIRES
338
+ ui-skills (`policy: "required"`).
339
+ 2. **Install once per project.** Resolve the CURRENT platform's skill dir
340
+ from references/platforms.md § Skill install paths. Already present →
341
+ skip reinstall (cache hit). Absent → run the entry's `install` command
342
+ (e.g. `npx skills add ibelick/ui-skills`) and VERIFY presence. Registry
343
+ keys are exactly name/purpose/repo/install/direct_fetch/browse/
344
+ mcp_endpoint/matches/policy.
345
+ 3. **Pre-dispatch verification.** Immediately before dispatching each
346
+ matching worker: re-verify the match and that the skill is still present;
347
+ install first if missing. Dispatch does not proceed otherwise.
348
+ 4. **Integrate + audit.** Inject the follow-instruction sentence from
349
+ references/mcp-and-skills.md into every affected worker prompt and require
350
+ a one-line `Skill compliance:` statement in its completion report.
351
+ 5. **Missing capability.** Unmatched-but-obvious domain: web-search reputable
352
+ skill repos, propose to the user, add to the registry ONLY on explicit
353
+ approval.
203
354
 
204
355
  ## Things you must NOT do
205
356
 
206
357
  - Do NOT write artifacts outside `.archgen/<slug>/`.
207
358
  - Do NOT reuse or overwrite an existing `.archgen/<slug>/` folder — suffix
208
359
  `-2`, `-3`, … instead (multi-feature repos must stay isolated).
209
- - Do NOT skip the verifier gate or the user gate — ever, even for SMALL scopes.
210
- - Do NOT implement features yourself; dispatch workers.
360
+ - Do NOT skip the verifier gate, the plan-review stage, or the user gate —
361
+ ever, even for SMALL scopes.
362
+ - Do NOT batch status updates at session end or dispatch a wave while any
363
+ completed task's status/todos lag (Hard rule 6).
364
+ - Do NOT auto-spawn another harness/CLI when sub-agents misbehave — execute
365
+ the task yourself, or ask the user first (references/orchestration.md
366
+ §dispatch).
367
+ - Do NOT implement features yourself while a functioning sub-agent mechanism
368
+ exists — dispatch workers. Self-execution is the default ONLY when the
369
+ mechanism is missing/failing (§dispatch).
211
370
  - Do NOT put two same-wave tasks on overlapping file_ownership globs.
212
371
  - Do NOT retry failed tasks without user consent.
213
372
  - Do NOT modify MCP/skill configs silently — always show the diff first.
@@ -226,7 +385,8 @@ When a task domain matches an entry in `assets/skill-registry.json`
226
385
  | Worker finishes but acceptance unmet | Mark failed, do NOT cascade, propose fix task |
227
386
  | User interrupts mid-wave | Let running workers finish; stop before next wave |
228
387
  | No Node ≥18 available | State requirement; offer npx-based alternative if present |
229
- | Headless CLI missing for fallback workers | Use native sub-agents, else halt with clear message |
388
+ | Sub-agent mechanism missing/fails/lacks permissions | Main agent executes the task itself; cross-harness switch only after telling the user the concrete problem and getting explicit approval (references/orchestration.md §dispatch) |
389
+ | Recurring defects after waves completed | Switch to INVESTIGATE — root cause first, no patch-fixes |
230
390
 
231
391
  ## Scripts quick reference
232
392
 
@@ -238,4 +398,12 @@ scripts/update-agents.mjs <projectRoot> [--slug <s>] [--status <s>] [--prune]
238
398
  # AGENTS.md features registry
239
399
  scripts/impact.mjs <tasks.yaml> <id-or-artifactPath> # ripple JSON
240
400
  scripts/verify-plan.mjs <tasks.yaml> --plan <dir> # APPROVE|ISSUES
401
+ scripts/plan-graph.mjs <slug-dir-or-tasks.yaml> [--node <id>] [--mermaid [--status]] [--module <name>]
402
+ # task-DAG queries: --node neighborhood, --mermaid graph,
403
+ # --module filter — generic code indexers do not extract YAML task graphs.
404
+ # Scope-hardened to .archgen/<slug>/ only; dedup-guaranteed output
405
+ scripts/doc-index.mjs <slug> [--validate|--refs-to <id>|--stale|--diagrams]
406
+ # markdown artifact map: heading tree, backlinks,
407
+ # broken-reference gate, staleness, diagram inventory.
408
+ # Same .archgen/<slug>/ scope lock; unique-ref counting, dup-definition checks
241
409
  ```
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": "0.0.4",
3
+ "skillName": "archgen",
4
+ "markers": {
5
+ "start": "<!-- archgen:start (managed block - do not edit between markers) -->",
6
+ "end": "<!-- archgen:end -->",
7
+ "featuresStart": "<!-- archgen:features:start -->",
8
+ "featuresEnd": "<!-- archgen:features:end -->"
9
+ },
10
+ "files": {
11
+ "stamp": ".archgen-version",
12
+ "projectManifest": ".install-manifest.json",
13
+ "globalManifest": ".archgen-install-manifest.list",
14
+ "backupDir": ".backup"
15
+ }
16
+ }
@@ -1,5 +1,4 @@
1
1
  {
2
- "$schema": "./registry-schema-note.md",
3
2
  "version": 1,
4
3
  "skills": [
5
4
  {
@@ -10,14 +9,16 @@
10
9
  "direct_fetch": "npx ui-skills get <skill-name>",
11
10
  "browse": "npx ui-skills list --category <category>",
12
11
  "mcp_endpoint": "https://www.ui-skills.com/mcp",
13
- "matches": ["frontend", "ui", "ux", "design", "component", "animation", "motion", "landing page"]
12
+ "matches": ["frontend", "ui", "ux", "design", "component", "animation", "motion", "landing page"],
13
+ "policy": "required"
14
14
  },
15
15
  {
16
16
  "name": "vercel-skills-installer",
17
17
  "purpose": "Canonical cross-harness skill installer (75+ agents) - use when a registry entry lacks a direct command",
18
18
  "repo": "vercel-labs/skills",
19
19
  "install": "npx skills add <owner>/<repo> [-a <agent>] [-g] [--copy]",
20
- "matches": ["*installer*"]
20
+ "matches": ["*installer*"],
21
+ "policy": "on-demand"
21
22
  }
22
23
  ]
23
24
  }