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.
- package/README.md +2 -6
- package/assets/briefs/investigate.md +16 -17
- package/assets/briefs/review.md +41 -29
- package/assets/briefs/survey.md +17 -20
- package/assets/briefs/verifier.md +52 -40
- package/assets/harness-mcp.json +6 -6
- package/assets/platform-capabilities.json +387 -71
- package/assets/references/artifact-templates.md +67 -232
- package/assets/references/interview.md +83 -199
- package/assets/references/mcp-and-skills.md +35 -125
- package/assets/references/orchestration.md +96 -209
- package/assets/references/platforms.md +41 -110
- package/assets/skill-registry.json +10 -1
- package/assets/templates/adr.md +3 -3
- package/assets/templates/architecture.yaml +31 -28
- package/assets/templates/edge-matrix.md +8 -8
- package/assets/templates/mermaid.md +3 -10
- package/assets/templates/prd.md +15 -15
- package/assets/templates/tasks.yaml +25 -18
- package/package.json +2 -2
- package/src/cli.mjs +1 -2
- package/src/context.mjs +12 -42
- package/src/core/brief-context.mjs +106 -0
- package/src/core/brief-scope.mjs +218 -0
- package/src/core/briefs.mjs +109 -1
- package/src/core/codegraph-manager.mjs +12 -0
- package/src/core/doc-navigator.mjs +101 -17
- package/src/core/errors.mjs +1 -1
- package/src/core/harness-wiring.mjs +65 -22
- package/src/core/jsonc-config.mjs +706 -0
- package/src/core/plan-grapher.mjs +11 -3
- package/src/core/skill-manager.mjs +181 -13
- package/src/core/skill-roots.mjs +92 -0
- package/src/core/tokens.mjs +78 -0
- package/src/core/worker-contract.mjs +145 -18
- package/src/server.mjs +0 -3
- package/src/tools/help.mjs +17 -34
- package/src/tools/plan.mjs +36 -22
- package/src/tools/skills.mjs +67 -5
- package/src/tools/tasks.mjs +44 -18
- package/src/core/ui-channel.mjs +0 -222
- package/src/tools/ui.mjs +0 -67
|
@@ -1,262 +1,149 @@
|
|
|
1
1
|
# Orchestration playbook — survey, verify, dispatch
|
|
2
2
|
|
|
3
|
-
Sub-agent briefs and
|
|
4
|
-
calls into these sections; workers never read this file.
|
|
3
|
+
Sub-agent briefs and wave-execution rules for the orchestrator (`SKILL.md`). Workers never read this file.
|
|
5
4
|
|
|
6
5
|
## §survey — brownfield codebase analysis brief
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
Dispatch 1–2 sub-agents with it verbatim — do not hand-write the prompt.
|
|
10
|
-
|
|
11
|
-
Accept the map only if every section is present and non-empty.
|
|
7
|
+
Dispatch 1–2 survey sub-agents with `archgen_plan{action:'brief', kind:'survey'}` verbatim. Accept `.archgen/<slug>/codebase-map.md` only when all required sections (`Structure`, `Modules`, `Conventions`, `Affected`) are present and non-empty.
|
|
12
8
|
|
|
13
9
|
## §verifier — plan review brief
|
|
14
10
|
|
|
15
|
-
Dispatch AFTER artifacts exist and `archgen_plan{action:'validate'}`
|
|
11
|
+
Dispatch AFTER artifacts exist and `archgen_plan{action:'validate'}` returns `data.valid:true`.
|
|
16
12
|
|
|
17
13
|
### Agent tier — EVERY verifier dispatch
|
|
14
|
+
- **SMALL / MEDIUM plan:** 1 strong mid/high-tier reasoning agent.
|
|
15
|
+
- **LARGE plan:** 1 top-tier reasoning agent.
|
|
16
|
+
- **FORBIDDEN:** Never use explore, quick, fast, or cheap/low-tier models—weak verifiers miss defects and cause extra rounds.
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
sub-agent scaled to plan complexity:
|
|
23
|
-
|
|
24
|
-
- SMALL/MEDIUM plan → one strong (mid/high-tier) agent.
|
|
25
|
-
- LARGE plan → the stronger/highest tier available.
|
|
26
|
-
- NEVER an explore / research / quick / small / cheap / fast sub-agent,
|
|
27
|
-
whatever the harness calls its low-end tiers.
|
|
18
|
+
### ONE agent, the WHOLE plan, ONE pass
|
|
19
|
+
- **Never split verification across concerns.** One holistic verifier detects cross-artifact contradictions that sliced agents miss. (If a plan exceeds context limits, split strictly by artifact volume—e.g., `plans/` vs `docs/`—never by verification dimension).
|
|
20
|
+
- **Exhaustive single pass.** The verifier MUST return a complete `COVERAGE:` table (`PASS` / `FAIL` / `N/A` for every dimension) so all issues surface in Round 1.
|
|
28
21
|
|
|
29
22
|
### Verification pass — FULL-DEPTH, every run
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- the CONTRACT-COMPLETENESS sweep (functional coverage, security, data
|
|
50
|
-
integrity, state/lifecycle/recovery, resource limits, operational
|
|
51
|
-
entrypoints, metric traceability, consistency) — the brief lists every
|
|
52
|
-
dimension and says when to apply it. These failure classes are the TOP
|
|
53
|
-
cause of multi-round loops: round 1 MUST sweep the applicable dimensions
|
|
54
|
-
exhaustively.
|
|
55
|
-
4. Returns EXACTLY one line verdict: `APPROVE` or `ISSUES:` + numbered list.
|
|
24
|
+
Pass the output of `archgen_plan{action:'brief', kind:'verifier'}` verbatim (includes pre-rendered evidence map, Mermaid dependency graph, and `archgen_docs` validation status). The verifier executes all four steps:
|
|
25
|
+
1. Runs `archgen_plan{action:'verify', tasksYaml, planDir}` $\rightarrow$ requires `APPROVE` (checks cycles, dangling refs, wave ownership overlap, acceptance criteria, bidirectional plan$\leftrightarrow$task coverage).
|
|
26
|
+
2. Runs `archgen_docs{action:'validate', slugDir}` (if markdown exists) $\rightarrow$ requires `valid:true` (zero broken links/anchors).
|
|
27
|
+
3. Audits judgment dimensions across `plans/` and `tasks.yaml`:
|
|
28
|
+
- Wave boundary sanity (no artificial serialization).
|
|
29
|
+
- Objectively verifiable acceptance criteria (runnable command or observable output).
|
|
30
|
+
- Scope-appropriate edge-case coverage (`SKILL.md` Hard Rule 3).
|
|
31
|
+
- `references/code-standards.md` compliance.
|
|
32
|
+
- **Contract-completeness sweep** across all applicable dimensions: `functional coverage`, `security & data protection`, `data integrity`, `state, lifecycle & recovery`, `resource limits & abuse`, `operational entrypoints`, `metric traceability`, and `consistency`.
|
|
33
|
+
4. Outputs the strict deliverable format:
|
|
34
|
+
```
|
|
35
|
+
VERDICT: APPROVE | ISSUES
|
|
36
|
+
COVERAGE:
|
|
37
|
+
| dimension | status | reason | <- every dimension marked PASS / FAIL / N/A
|
|
38
|
+
FINDINGS: <- present when VERDICT: ISSUES
|
|
39
|
+
1. file § section — defect — impact — concrete fix
|
|
40
|
+
```
|
|
41
|
+
*Any report missing the `COVERAGE:` table is incomplete—treat as `ISSUES` and require examination of omitted dimensions.*
|
|
56
42
|
|
|
57
43
|
### Efficiency — fewer rounds + zero duplicate work, NEVER shallower checks
|
|
58
|
-
|
|
59
|
-
Every run stays FULL-DEPTH: both checks run to completion and the full
|
|
60
|
-
judgment checklist applies each time. Efficiency comes ONLY from:
|
|
61
|
-
|
|
62
|
-
- capping automatic rounds at 2 (gate protocol below);
|
|
63
|
-
- batching fixes per file (fix discipline below);
|
|
64
|
-
- never re-fixing an already-resolved finding.
|
|
65
|
-
|
|
66
|
-
"Efficient" NEVER means skipping or lightening the verifier, the docs
|
|
67
|
-
integrity check, or any judgment-checklist item.
|
|
44
|
+
Never weaken or skip checks. Efficiency comes strictly from: (1) the exhaustive coverage table, (2) capping automatic rounds at 2, (3) batching fixes per file, and (4) never re-applying failed edits.
|
|
68
45
|
|
|
69
46
|
### Fix discipline — batch per file, dedupe repeats
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
each file once per round, not once per finding.
|
|
75
|
-
- Round N reports the SAME finding as round N-1 (same file + same issue) →
|
|
76
|
-
the prior fix did not land: re-read the file and fix it properly — never
|
|
77
|
-
re-apply the identical edit.
|
|
47
|
+
When `VERDICT: ISSUES` returns:
|
|
48
|
+
- Group findings by file and apply all fixes to a file in a single edit pass.
|
|
49
|
+
- If Round $N$ reports the identical finding as Round $N-1$, re-read the target file and apply a structural fix rather than repeating the prior edit.
|
|
50
|
+
- If you disagree with a verifier finding, surface it verbatim to the user rather than ignoring or silently overriding it.
|
|
78
51
|
|
|
79
52
|
### Gate protocol — 2 automatic rounds, then ask the user
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
2. Round 2: dispatch verifier.
|
|
87
|
-
- Clean `APPROVE` → ask the user once more, recommending NO, proceed.
|
|
88
|
-
- `ISSUES:` → fix ALL findings → ask the user once more, recommending
|
|
89
|
-
YES, one more pass.
|
|
90
|
-
Ask recommendation-first per §interview/how-to-ask: "Run the verifier
|
|
91
|
-
once more to make sure everything passes?"
|
|
92
|
-
3. On YES → run another round; if it returns `ISSUES:`, fix all and ask again
|
|
93
|
-
— every round beyond 2 is user-approved. On NO → proceed to §plan-review.
|
|
94
|
-
4. On NO with findings still outstanding and no verifier `APPROVE` on record:
|
|
95
|
-
surface every outstanding finding verbatim and require an EXPLICIT user
|
|
96
|
-
waiver — never proceed silently. Hard rule 2 stands: the plan MUST NOT
|
|
97
|
-
reach the USER GATE without at least one verifier `APPROVE` (or that
|
|
98
|
-
explicit waiver on the record). An earlier `APPROVE` on record → proceed
|
|
99
|
-
to §plan-review, noting the latest unverified fixes.
|
|
53
|
+
1. **Round 1:** Dispatch verifier. `APPROVE` $\rightarrow$ proceed to `§plan-review`. `ISSUES` $\rightarrow$ batch-fix all findings $\rightarrow$ Round 2.
|
|
54
|
+
2. **Round 2:** Dispatch verifier.
|
|
55
|
+
- `APPROVE` $\rightarrow$ ask user recommendation-first: *"Run the verifier once more? 1. No, proceed (recommended) 2. Yes, run one more pass."*
|
|
56
|
+
- `ISSUES` $\rightarrow$ batch-fix all findings $\rightarrow$ ask user recommendation-first: *"Run the verifier once more to confirm fixes? 1. Yes, one more pass (recommended) 2. Waive remaining findings and proceed."*
|
|
57
|
+
3. **Round 3+ (user-approved):** Each approval runs 1 pass.
|
|
58
|
+
4. **Proceeding without `APPROVE`:** If the user declines another pass without a prior `APPROVE` on record, quote all unverified/outstanding findings verbatim and obtain an **explicit user waiver** before entering `§plan-review` (Hard Rule 2). Never cite token/cost numbers when reporting rounds.
|
|
100
59
|
|
|
101
60
|
## §plan-review — post-plan review stage
|
|
102
61
|
|
|
103
|
-
Run AFTER
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- SMALL: main-agent self-review acceptable if no reviewer mechanism exists.
|
|
108
|
-
- MEDIUM: 1 reviewer.
|
|
109
|
-
- LARGE: 1 holistic reviewer on the strongest reasoning tier. A 2nd reviewer
|
|
110
|
-
ONLY if the plan is genuinely too large for one reviewer's context — split
|
|
111
|
-
by ARTIFACT/VOLUME then (e.g. plans vs docs), never by concern.
|
|
112
|
-
|
|
113
|
-
One holistic reviewer analyzes ALL issues together: cross-issue reasoning
|
|
114
|
-
catches contradictions a narrow per-concern slice misses, and one reviewer
|
|
115
|
-
costs far fewer tokens than several. NEVER dispatch one sub-agent per
|
|
116
|
-
individual issue/concern.
|
|
117
|
-
|
|
118
|
-
**The brief is a tool output:** `archgen_plan { action: 'brief', kind: 'review' }`.
|
|
119
|
-
Dispatch it verbatim — it already carries the mermaid graph + docs-validate
|
|
120
|
-
context to attach.
|
|
121
|
-
|
|
122
|
-
Reviewers are read-only and report-only — they never edit artifacts or code.
|
|
123
|
-
The orchestrator fixes the artifacts itself, re-runs validate +
|
|
124
|
-
re-dispatches the verifier gate after every change.
|
|
125
|
-
|
|
126
|
-
### Review loop — bounded passes, then ask
|
|
127
|
-
|
|
128
|
-
The fix→re-verify cycle stays, but reviewer passes are countable and bounded:
|
|
129
|
-
|
|
130
|
-
1. Pass 1: holistic review. Zero findings → stage done.
|
|
131
|
-
2. Findings → fix ALL (batched per file), re-run validate + the verifier
|
|
132
|
-
gate → pass 2.
|
|
133
|
-
3. Pass 2 still yields findings → do NOT spawn more reviewers. Consolidate
|
|
134
|
-
the outstanding findings and ask the user once, recommendation-first per
|
|
135
|
-
§interview/how-to-ask: "Run one more targeted review pass on the N
|
|
136
|
-
open findings? 1. One more pass (recommended) 2. Waive these findings and
|
|
137
|
-
proceed."
|
|
138
|
-
4. On YES → run EXACTLY ONE more pass, then consolidate and STOP. Zero
|
|
139
|
-
findings → stage done; findings remain → surface them and require an
|
|
140
|
-
explicit user waiver before the user gate. On NO → record the explicit
|
|
141
|
-
waiver, proceed.
|
|
142
|
-
|
|
143
|
-
A "more review" approval authorizes EXACTLY ONE additional pass — never a
|
|
144
|
-
fresh loop, never more reviewers. The stage ends ONLY at zero findings or an
|
|
145
|
-
explicit user waiver on record.
|
|
146
|
-
|
|
147
|
-
## §investigate — root-cause protocol
|
|
148
|
-
|
|
149
|
-
Triggered when the USER reports repetitive/recurring issues AFTER implementation
|
|
150
|
-
waves completed. Do NOT patch-fix under this protocol.
|
|
151
|
-
|
|
152
|
-
**The brief is a tool output:** `archgen_plan { action: 'brief', kind: 'investigate' }`.
|
|
153
|
-
Complexity-sized dispatch:
|
|
62
|
+
Run AFTER Verifier `APPROVE` and BEFORE the User Gate. Dispatch read-only reviewer(s) using `archgen_plan{action:'brief', kind:'review'}` verbatim (pre-renders dependency graph, doc validation, and evidence map; reviewer makes zero `archgen_*` tool calls):
|
|
63
|
+
- **SMALL:** Main-agent self-review permitted if sub-agents are unavailable.
|
|
64
|
+
- **MEDIUM:** 1 holistic reviewer.
|
|
65
|
+
- **LARGE:** 1 top-tier holistic reviewer (2nd allowed ONLY if context size requires splitting `plans/` vs `docs/`; never split by concern).
|
|
154
66
|
|
|
155
|
-
-
|
|
156
|
-
|
|
67
|
+
Reviewers are strictly read-only. The orchestrator applies fixes, re-runs `validate` + Verifier Gate, and manages the bounded review loop:
|
|
68
|
+
1. **Pass 1:** Zero findings $\rightarrow$ stage complete. Findings $\rightarrow$ batch-fix per file, re-run `validate` + Verifier Gate $\rightarrow$ Pass 2.
|
|
69
|
+
2. **Pass 2:** Zero findings $\rightarrow$ stage complete. Findings remain $\rightarrow$ consolidate and ask user once (`§interview/how-to-ask`): *"Run one more targeted review pass on the N open findings? 1. One more pass (recommended) 2. Waive findings and proceed."*
|
|
70
|
+
3. **Pass 3 (final):** On `1`, run **EXACTLY ONE** final pass, then stop. If findings remain, require an explicit user waiver before the User Gate.
|
|
157
71
|
|
|
158
|
-
|
|
72
|
+
## §investigate — root-cause protocol
|
|
159
73
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
3
|
|
163
|
-
(`archgen_plan{action:'impact', tasksYaml, target}`).
|
|
164
|
-
4. Remediation plan — routed through the normal gates: new fix tasks get fresh
|
|
165
|
-
ids inheriting the affected task's ownership globs.
|
|
74
|
+
Triggered when the user reports recurring defects after wave execution. Pass `archgen_plan{action:'brief', kind:'investigate'}` verbatim:
|
|
75
|
+
- **SMALL:** Main agent investigates directly.
|
|
76
|
+
- **MEDIUM / LARGE:** 1–3 read-only investigator sub-agents split by disjoint suspected subsystem.
|
|
166
77
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
78
|
+
Mandatory 4-part deliverable (no patch-fixing allowed):
|
|
79
|
+
1. **Root cause statement:** One sentence identifying the underlying defect.
|
|
80
|
+
2. **Evidence:** Exact file paths, line numbers, and reproduction steps.
|
|
81
|
+
3. **Blast radius:** Affected tasks/artifacts via `archgen_plan{action:'impact', tasksYaml, target}`.
|
|
82
|
+
4. **Remediation plan:** New fix tasks with fresh IDs inheriting affected `file_ownership` globs, routed through normal Verifier/Review/User gates.
|
|
170
83
|
|
|
171
84
|
## §dispatch — wave execution
|
|
172
85
|
|
|
173
|
-
Dispatch
|
|
174
|
-
when available AND functional. If sub-agents do not exist on this platform, or
|
|
175
|
-
the sub-agent fails, or lacks required tool permissions (read/write/etc.), the
|
|
176
|
-
MAIN AGENT executes the task ITSELF — sequentially, respecting waves and
|
|
177
|
-
ownership globs. Cross-harness/platform delegation is allowed ONLY through an
|
|
178
|
-
explicit user gate (below). There is NO automatic fallback to other harnesses,
|
|
179
|
-
platforms, or CLIs — ever.
|
|
86
|
+
Dispatch tasks via the platform's native sub-agent mechanism (`archgen_setup{action:'harness_info'}`). If sub-agents are missing, fail to spawn, or lack file permissions, the **main agent executes tasks sequentially itself**. Never switch harnesses or spawn external CLIs without explicit user approval.
|
|
180
87
|
|
|
181
|
-
###
|
|
88
|
+
### WHEN to dispatch a sub-agent — and when NOT to
|
|
182
89
|
|
|
183
|
-
-
|
|
184
|
-
tasks whose ownership might brush shared files.
|
|
185
|
-
- Cursor: background subagents; request isolation when >2 parallel workers.
|
|
186
|
-
- Antigravity: invoke_subagent async.
|
|
187
|
-
- Codex: spawn_agent works but children can't nest — flatten the plan instead.
|
|
188
|
-
- Gemini CLI: parallel @agents are hub-and-spoke only AND have no isolation →
|
|
189
|
-
use them ONLY for read-only/research waves unless wrapping in worktrees.
|
|
90
|
+
**Sub-agents are for bounded implementation/analysis work, NEVER for state lookups:**
|
|
190
91
|
|
|
191
|
-
|
|
92
|
+
| Operation | Executor |
|
|
93
|
+
|---|---|
|
|
94
|
+
| Wave frontier, task list, task status (`archgen_tasks{next\|list}`) | **MAIN AGENT** (1 tool call; NEVER a sub-agent) |
|
|
95
|
+
| Plan health, graph, coverage, impact (`archgen_plan`, `archgen_docs`) | **MAIN AGENT** (1 tool call; NEVER a sub-agent) |
|
|
96
|
+
| Registry update, resume snapshot, CodeGraph status | **MAIN AGENT** (1 tool call; NEVER a sub-agent) |
|
|
97
|
+
| Single task implementation | **Worker sub-agent** (prompt = `archgen_tasks{action:'contract'}`) |
|
|
98
|
+
| Brownfield codebase survey | **Survey sub-agent** (`brief: 'survey'`, CodeGraph-first) |
|
|
99
|
+
| Verifier / Plan-Review / Investigation | **Gate / Investigator sub-agent** (`brief: 'verifier'\|'review'\|'investigate'`) |
|
|
192
100
|
|
|
193
|
-
|
|
101
|
+
### Reuse the agent's session — NEVER re-dispatch for the same context
|
|
194
102
|
|
|
195
|
-
-
|
|
196
|
-
- spawn failure (sub-agent never started / crashed at launch);
|
|
197
|
-
- tool-permission gaps (sub-agent runs but cannot read/write/edit files).
|
|
103
|
+
Maintain a **dispatch ledger** (`dispatchKey -> agent session` using the `dispatchKey` from `archgen_tasks{action:'contract'}`). If a task requires a follow-up fix, clarification, or re-verification in files the agent already touched, **continue that agent's existing session** rather than spawning a fresh agent.
|
|
198
104
|
|
|
199
|
-
|
|
105
|
+
### Parallel dispatch — no overlap, and never more than three at once
|
|
200
106
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
2.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
107
|
+
**HARD CAP: MAX 3 LIVE PARALLEL SUB-AGENTS.** Execute larger waves in batches of $\le 3$. Before parallel dispatch, verify all six invariants:
|
|
108
|
+
1. **Same wave only:** Dispatch only tasks returned in the current wave by `archgen_tasks{action:'next'}`.
|
|
109
|
+
2. **Disjoint write globs:** Enforced by `next` (`OWNERSHIP_CONFLICT` blocks overlap).
|
|
110
|
+
3. **No concurrent gate agents:** Never run Verifier or Reviewer agents while worker waves are executing.
|
|
111
|
+
4. **Single writer per shared file:** Serialize tasks that touch shared configs, lockfiles, or entrypoints.
|
|
112
|
+
5. **Ledger pre-registration:** Record `dispatchKey` in the dispatch ledger BEFORE spawning.
|
|
113
|
+
6. **Live-agent counting:** Completed/paused sessions awaiting follow-up do not count against the 3-agent active cap.
|
|
208
114
|
|
|
209
|
-
|
|
210
|
-
|
|
115
|
+
### Native sub-agents (preferred)
|
|
116
|
+
- **Claude Code:** Background `Agent` tool per task; use `git worktree` isolation when globs border shared files.
|
|
117
|
+
- **Cursor:** Background subagents; enable isolation when running $>2$ parallel workers.
|
|
118
|
+
- **Antigravity:** Async `invoke_subagent`.
|
|
119
|
+
- **Codex:** `spawn_agent` (children cannot nest—flatten orchestration).
|
|
120
|
+
- **Gemini CLI:** Parallel `@agents` lack write isolation—use only for read-only/survey waves unless wrapped in `git worktree`.
|
|
211
121
|
|
|
212
|
-
|
|
213
|
-
failure — run the diagnose-and-ask flow above first. Mark a task failed only
|
|
214
|
-
after execution was actually attempted (by sub-agent or main agent) and did
|
|
215
|
-
not complete.
|
|
122
|
+
### When sub-agents are unavailable or fail
|
|
216
123
|
|
|
217
|
-
|
|
124
|
+
If the sub-agent mechanism is missing, crashes at launch, or lacks read/write permissions (a **mechanism failure**, not a task failure):
|
|
125
|
+
1. **Default:** Main agent executes the task sequentially itself, honoring wave order and `file_ownership`. No user prompt required.
|
|
126
|
+
2. **Cross-harness fallback (USER GATE):** Only if the issue is platform-blocking, report the exact error, propose a specific alternative harness/CLI command, and wait for explicit user approval. Log the decision in the final report.
|
|
218
127
|
|
|
128
|
+
Optional worktree isolation for tight ownership boundaries:
|
|
219
129
|
```bash
|
|
220
130
|
git worktree add ".worktrees/$id" -b "task-$id"
|
|
221
|
-
#
|
|
131
|
+
# run sub-agent in .worktrees/$id, then merge task-$id on completion
|
|
222
132
|
```
|
|
223
|
-
### Worker prompt contract
|
|
224
133
|
|
|
225
|
-
|
|
134
|
+
### Worker prompt contract
|
|
226
135
|
|
|
136
|
+
Always generate the worker prompt via:
|
|
227
137
|
```
|
|
228
138
|
archgen_tasks { action: 'contract', tasksYaml: <tasks.yaml>, taskId: <id> }
|
|
229
139
|
```
|
|
140
|
+
It bundles: task ID/title, verbatim acceptance criteria, `file_ownership` globs, dependency neighborhood, `references/code-standards.md` path, inline normative rules (`MUST`/`SHOULD`/`NEVER`) + paths/indexes for all matched required skills, pre-located plan sections, `.agent/` workspace paths, completion protocol (`set_status` + `Skill compliance:` line + commit scope), worker prohibitions, CodeGraph usage directive, and `dispatchKey`.
|
|
230
141
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
- the task id + title;
|
|
234
|
-
- the acceptance criteria **VERBATIM**;
|
|
235
|
-
- the `file_ownership` globs ("edit NOTHING outside these");
|
|
236
|
-
- the dependency neighbourhood (prerequisites + what depends on this task);
|
|
237
|
-
- the code-standards reference path;
|
|
238
|
-
- the capability-skill follow-instruction, when the task matched one;
|
|
239
|
-
- the **pre-located doc sections** — the sections that mention the task id, never
|
|
240
|
-
the whole plan;
|
|
241
|
-
- the working-state location;
|
|
242
|
-
- the finish procedure (set_status + the `Skill compliance:` line + commit scope).
|
|
243
|
-
|
|
244
|
-
**CODEGRAPH:** if `.codegraph/` is present, the worker must navigate with the
|
|
245
|
-
CodeGraph MCP tools for anything needing understanding — never guess architecture
|
|
246
|
-
from prose.
|
|
247
|
-
|
|
248
|
-
**Workers do NOT talk to each other;** coordination happens only through
|
|
249
|
-
tasks.yaml state.
|
|
250
|
-
|
|
251
|
-
**Before dispatching**, check the contract's `warnings`: a task with no acceptance
|
|
252
|
-
criteria or no file ownership is not dispatchable — fix the plan first.
|
|
142
|
+
**Pre-dispatch check:** Inspect `contract.warnings`. Never dispatch a task with missing acceptance criteria, empty `file_ownership`, or an uninstalled required skill.
|
|
253
143
|
|
|
254
144
|
## Failure policy
|
|
255
145
|
|
|
256
|
-
-
|
|
257
|
-
|
|
258
|
-
-
|
|
259
|
-
-
|
|
260
|
-
- Report to user: failed id, log path, proposed fix-task description.
|
|
261
|
-
[wait for user] A fix task gets fresh id, depends_on=[], ownership of the
|
|
262
|
-
failed task's globs.
|
|
146
|
+
- **Mechanism failure** (missing/spawn crash/permissions) $\rightarrow$ follow fallback flow above (do not mark task `failed`).
|
|
147
|
+
- **Task execution failure** (non-zero exit or unmet acceptance) $\rightarrow$ mark `failed` via `set_status`. **NEVER auto-retry.**
|
|
148
|
+
- Downstream dependents are automatically held in `blockedByFailure` by the resolver.
|
|
149
|
+
- Report failed task ID, logs, and a proposed fix task (`new ID`, `depends_on: []`, inheriting failed `file_ownership` globs) to the user. `[wait for user]`
|
|
@@ -1,142 +1,73 @@
|
|
|
1
1
|
# Platform capability matrix (November 2026)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
not be confirmed. The capability DATA is served by
|
|
5
|
-
`archgen_setup{action:'harness_info'}` — this file keeps the narrative.
|
|
3
|
+
Authoritative platform capability data is served dynamically by `archgen_setup{action:'harness_info'}` from `packages/mcp/assets/platform-capabilities.json`.
|
|
6
4
|
|
|
7
5
|
## Harness capabilities
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
Query platform capabilities directly via the tool rather than static tables:
|
|
11
8
|
```
|
|
12
|
-
archgen_setup { action: 'harness_info' }
|
|
13
|
-
archgen_setup { action: 'harness_info', harness: 'claude' }
|
|
9
|
+
archgen_setup { action: 'harness_info' } # auto-detect current harness
|
|
10
|
+
archgen_setup { action: 'harness_info', harness: 'claude' } # query specific harness
|
|
14
11
|
```
|
|
15
|
-
|
|
16
|
-
It returns, per harness: the skill install paths (project + global), the MCP
|
|
17
|
-
config file + top-level key + entry shape, the MCP CLI, the restart semantics and
|
|
18
|
-
the sub-agent dispatch capability (mechanism, parallelism, isolation). The
|
|
19
|
-
canonical data is `packages/mcp/assets/platform-capabilities.json` — the tool
|
|
20
|
-
serves it, so it can never drift from reality.
|
|
12
|
+
Returns: project & global skill paths, MCP config path, top-level JSON/TOML key, server entry schema, CLI commands, restart semantics, and sub-agent dispatch mechanics (tool name, parallelism, isolation).
|
|
21
13
|
|
|
22
14
|
## Platform detection
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`.claude/` (Claude Code) · `.cursor/` (Cursor) · `.windsurf/` (Windsurf) ·
|
|
27
|
-
`.opencode|opencode.json` (OpenCode) · `.github/copilot-instructions.md`
|
|
28
|
-
(Copilot) · `~/.codex` (Codex) · `.gemini/` (Gemini CLI/Antigravity) ·
|
|
29
|
-
`.kiro/` (Kiro) · `.trae/` (Trae).
|
|
30
|
-
|
|
31
|
-
First match wins. `archgen_setup{action:'harness_info'}` does the same detection
|
|
32
|
-
and returns the row — prefer it over probing by hand.
|
|
16
|
+
`archgen_setup{action:'harness_info'}` probes in this priority order (first match wins):
|
|
17
|
+
`.claude/` (Claude Code) $\rightarrow$ `.cursor/` (Cursor) $\rightarrow$ `.windsurf/` (Windsurf) $\rightarrow$ `.opencode` / `opencode.json` (OpenCode) $\rightarrow$ `.github/copilot-instructions.md` (Copilot) $\rightarrow$ `~/.codex` (Codex) $\rightarrow$ `.gemini/` (Gemini CLI / Antigravity) $\rightarrow$ `.kiro/` (Kiro) $\rightarrow$ `.trae/` (Trae).
|
|
33
18
|
|
|
34
19
|
## archgen installed layout
|
|
35
20
|
|
|
36
|
-
`
|
|
37
|
-
thin bridges — the skill is never copied twice:
|
|
21
|
+
`npx archgen-skill install` maintains a single canonical store with lightweight bridges:
|
|
38
22
|
|
|
39
23
|
| Path | Role |
|
|
40
24
|
|---|---|
|
|
41
|
-
| `.agents/skills/archgen/` | Canonical store
|
|
42
|
-
| `.claude/skills/archgen` | Optional symlink
|
|
43
|
-
| `CLAUDE.md` |
|
|
44
|
-
| `AGENTS.md` |
|
|
25
|
+
| `.agents/skills/archgen/` | Canonical store: `SKILL.md` + `references/code-standards.md` |
|
|
26
|
+
| `.claude/skills/archgen` | Optional symlink $\rightarrow$ canonical store for Claude Code discovery |
|
|
27
|
+
| `CLAUDE.md` | Single-line `@AGENTS.md` pointer |
|
|
28
|
+
| `AGENTS.md` | Cross-harness hub hosting the feature registry between `<!-- archgen:features:start -->` and `<!-- archgen:features:end -->` |
|
|
45
29
|
|
|
46
|
-
|
|
47
|
-
`.archgen/<slug>/`) is machine-maintained by `archgen_registry{action:'update'}` after
|
|
48
|
-
every generate/plan/wave run — never hand-edit it; edit `.archgen/` state and
|
|
49
|
-
re-run the tool instead.
|
|
30
|
+
Never hand-edit the `AGENTS.md` registry table (`| Feature | Status | Updated |`); update it exclusively via `archgen_registry{action:'update'}`.
|
|
50
31
|
|
|
51
32
|
## MCP configuration
|
|
52
33
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
reports the exact field. Uncertainty triggers a web-search of the current
|
|
63
|
-
official docs, never invention.
|
|
64
|
-
|
|
65
|
-
**Wiring is a tool call:** `archgen_setup{action:'install_mcp', approve:true}`.
|
|
66
|
-
Never hand-edit a harness config.
|
|
34
|
+
Query `archgen_setup{action:'harness_info'}` for exact per-platform MCP schemas:
|
|
35
|
+
- **Top-level keys vary:**
|
|
36
|
+
- `mcpServers`: Claude Code, Cursor, Windsurf, Gemini CLI, Antigravity, Kiro, Trae
|
|
37
|
+
- `servers`: VS Code / GitHub Copilot
|
|
38
|
+
- `mcp.servers.<id>`: OpenCode (nested under `mcp.servers`, never flat `mcp.<id>`)
|
|
39
|
+
- `context_servers`: Zed
|
|
40
|
+
- `[mcp_servers.<id>]`: Codex CLI (TOML)
|
|
41
|
+
- **Remote URL keys vary:** `url` vs `serverUrl` vs `httpUrl` (check `harness_info`).
|
|
42
|
+
- **Automated wiring:** Use `archgen_setup{action:'install_mcp', approve:true}` rather than hand-editing config files.
|
|
67
43
|
|
|
68
44
|
## Sub-agent dispatch capability
|
|
69
45
|
|
|
70
|
-
|
|
71
|
-
dispatch mechanism, whether it parallelises, its limits and its isolation story.
|
|
72
|
-
Use it before dispatching — the fallback (self-execute) and the isolation advice
|
|
73
|
-
depend on it.
|
|
46
|
+
Always inspect `archgen_setup{action:'harness_info'}` before wave execution to determine the native sub-agent tool, parallel execution limits, worktree isolation requirements, or whether to fall back to sequential main-agent execution.
|
|
74
47
|
|
|
75
48
|
## Unknown platform procedure
|
|
76
49
|
|
|
77
|
-
1.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
3. Present findings + proposed config diff to the user. [approval gate]
|
|
81
|
-
4. Apply, verify, and offer to append findings to this table upstream.
|
|
50
|
+
1. **Web search:** `<platform> official docs MCP configuration` and `<platform> agent skills install path` (prioritize official vendor docs; note publication dates).
|
|
51
|
+
2. **Propose:** Present discovered paths and exact config diff to the user. `[approval gate]`
|
|
52
|
+
3. **Apply & verify:** Write approved config, verify tool availability, and offer to upstream the platform definition.
|
|
82
53
|
|
|
83
54
|
## Codegraph indexing scope
|
|
84
55
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
markdown headings or YAML task semantics, so archgen ships its own
|
|
90
|
-
deterministic graph tools:
|
|
91
|
-
|
|
92
|
-
- Source navigation → codegraph MCP (built automatically by Step 0 / the
|
|
93
|
-
the `archgen_codegraph` bootstrap flow).
|
|
94
|
-
- YAML plan graphs → exclusively `archgen_plan{action:'graph'}`.
|
|
95
|
-
- Markdown artifact navigation → `archgen_docs`.
|
|
96
|
-
|
|
97
|
-
If the harness exposes a markdown-heading indexer (e.g. a
|
|
98
|
-
`codegraph_index_markdown`-style tool), prefer it for general repo docs but
|
|
99
|
-
still use `archgen_docs` inside `.archgen/` — it understands TASK/FR
|
|
100
|
-
reference semantics. Brownfield surveys prefer codegraph once present.
|
|
56
|
+
Mainstream codegraph indexers parse **source-code symbols only** (functions, classes, imports)—never Markdown headings or YAML task dependencies. Use the dedicated tool for each artifact class:
|
|
57
|
+
- **Source code navigation:** CodeGraph MCP tools (`.codegraph/`).
|
|
58
|
+
- **YAML task dependency graphs:** `archgen_plan{action:'graph'}`.
|
|
59
|
+
- **`.archgen/` Markdown navigation & FR/TASK link validation:** `archgen_docs`.
|
|
101
60
|
|
|
102
61
|
### Codegraph bootstrap (official CLI, no command list here)
|
|
103
62
|
|
|
104
|
-
CodeGraph
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
> is missing** (an installed CodeGraph is the user's to manage and is never
|
|
116
|
-
> upgraded behind their back), wires every DETECTED harness with the correct
|
|
117
|
-
> per-platform shape, and builds the project index — idempotently, with an
|
|
118
|
-
> approval gate before any config write. It drives the official CLI; it never
|
|
119
|
-
> reimplements it.
|
|
120
|
-
> ```
|
|
121
|
-
> archgen_codegraph { action: 'ensure' } # install if missing + wire + index
|
|
122
|
-
> archgen_codegraph { action: 'status' } # what is installed/wired/indexed
|
|
123
|
-
> ```
|
|
124
|
-
|
|
125
|
-
**Rules that matter to the agent:**
|
|
126
|
-
- The index is built ONCE per project; the MCP server's watcher keeps it live,
|
|
127
|
-
so **never re-index** — no manual index/sync steps after the bootstrap.
|
|
128
|
-
- MCP configs are written only with `approve: true`; the tool returns its plan
|
|
129
|
-
otherwise. A config that is not valid JSON (e.g. JSONC) is reported, never
|
|
130
|
-
rewritten. Harnesses that are not installed are never touched.
|
|
131
|
-
- Only DETECTED harnesses get an entry. The per-platform file path, top-level
|
|
132
|
-
key (`mcpServers` / `servers` / `mcp` / `context_servers`) and server entry
|
|
133
|
-
live in `packages/mcp/assets/harness-mcp.json` — one source of truth.
|
|
134
|
-
- **Telemetry — disclose it, never claim "100% local":** it is enabled by
|
|
135
|
-
default on a fresh install and reports a machine ID (`~/.codegraph/`), and the
|
|
136
|
-
tool changes it only with an explicit `telemetry: 'off' | 'on'`.
|
|
137
|
-
|
|
138
|
-
Agent flow (Step 0): detect `.codegraph/` at the repo root.
|
|
139
|
-
- **Absent** → `archgen_codegraph{action:'ensure'}` once
|
|
140
|
-
per project (standing approval from the user's install-time consent; show the
|
|
141
|
-
printed plan). On decline → grep/Glob.
|
|
142
|
-
- **Present** → use the CodeGraph MCP tools for navigation. Never re-index.
|
|
63
|
+
CodeGraph (`@colbymchenry/codegraph`, MIT) maintains a local SQLite symbol graph in `.codegraph/` and serves it via MCP.
|
|
64
|
+
- **Entry point:**
|
|
65
|
+
```
|
|
66
|
+
archgen_codegraph { action: 'ensure' } # install CLI if missing + wire detected harnesses + index
|
|
67
|
+
archgen_codegraph { action: 'status' } # check install, wiring, and index state
|
|
68
|
+
```
|
|
69
|
+
- **Operational rules:**
|
|
70
|
+
- **Index once:** Built during bootstrap and kept live by the MCP file watcher—**never re-index manually**.
|
|
71
|
+
- **Safe config writes:** Non-bootstrap config edits require `approve: true`, touch only detected harnesses (`packages/mcp/assets/harness-mcp.json`), and never overwrite invalid JSON/JSONC or upgrade an existing user-installed CLI.
|
|
72
|
+
- **Telemetry disclosure:** CodeGraph enables anonymous machine-ID telemetry (`~/.codegraph/`) by default; disclose this accurately (never claim "100% offline/no telemetry") and pass `telemetry: 'off' | 'on'` only when requested.
|
|
73
|
+
- **Step 0 flow:** If `.codegraph/` is present, use CodeGraph MCP tools. If absent, run `archgen_codegraph{action:'ensure'}` once per project (fallback to grep/glob if declined).
|