mindforge-cc 11.4.0 → 11.5.1
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/.agent/CLAUDE.md +13 -0
- package/.agent/hooks/lib/hook-flags.js +78 -0
- package/.agent/hooks/lib/pretooluse-visible-output.js +46 -0
- package/.agent/hooks/mindforge-block-no-verify.js +552 -0
- package/.agent/hooks/mindforge-config-protection.js +144 -0
- package/.agent/hooks/run-with-flags.js +207 -0
- package/.agent/mindforge/checkpoint.md +76 -0
- package/.agent/mindforge/harness-audit.md +59 -0
- package/.agent/mindforge/instinct.md +46 -0
- package/.agent/mindforge/orch-add-feature.md +43 -0
- package/.agent/mindforge/orch-build-mvp.md +48 -0
- package/.agent/mindforge/orch-change-feature.md +45 -0
- package/.agent/mindforge/orch-fix-defect.md +43 -0
- package/.agent/mindforge/orch-refine-code.md +43 -0
- package/.claude/CLAUDE.md +13 -0
- package/.claude/commands/mindforge/checkpoint.md +76 -0
- package/.claude/commands/mindforge/execute-phase.md +47 -6
- package/.claude/commands/mindforge/harness-audit.md +59 -0
- package/.claude/commands/mindforge/instinct.md +46 -0
- package/.claude/commands/mindforge/orch-add-feature.md +43 -0
- package/.claude/commands/mindforge/orch-build-mvp.md +48 -0
- package/.claude/commands/mindforge/orch-change-feature.md +45 -0
- package/.claude/commands/mindforge/orch-fix-defect.md +43 -0
- package/.claude/commands/mindforge/orch-refine-code.md +43 -0
- package/.claude/commands/mindforge/plan-write.md +11 -0
- package/.claude/commands/mindforge/product-spec.md +76 -0
- package/.mindforge/config.json +2 -2
- package/.mindforge/engine/instincts/instinct-schema.md +17 -9
- package/.mindforge/imported-agents.jsonl +10 -0
- package/.mindforge/manifests/install-components.json +36 -0
- package/.mindforge/manifests/install-modules.json +193 -0
- package/.mindforge/manifests/install-profiles.json +57 -0
- package/.mindforge/memory/sync-manifest.json +1 -1
- package/.mindforge/personas/gan-evaluator.md +226 -0
- package/.mindforge/personas/gan-generator.md +151 -0
- package/.mindforge/personas/gan-planner.md +118 -0
- package/.mindforge/personas/harness-optimizer.md +55 -0
- package/.mindforge/personas/loop-operator.md +58 -0
- package/.mindforge/schemas/hooks.schema.json +199 -0
- package/.mindforge/schemas/install-modules.schema.json +44 -0
- package/.mindforge/schemas/install-state.schema.json +95 -0
- package/.mindforge/schemas/plugin.schema.json +75 -0
- package/.mindforge/schemas/provenance.schema.json +31 -0
- package/.mindforge/skills/agent-architecture-audit/SKILL.md +272 -0
- package/.mindforge/skills/continuous-learning/SKILL.md +16 -0
- package/.mindforge/skills/orch-pipeline/SKILL.md +284 -0
- package/.mindforge/skills/writing-plans/SKILL.md +76 -0
- package/CHANGELOG.md +120 -0
- package/MINDFORGE.md +3 -3
- package/README.md +0 -1
- package/RELEASENOTES.md +131 -0
- package/SECURITY.md +16 -0
- package/bin/autonomous/auto-runner.js +46 -5
- package/bin/autonomous/handoff-schema.js +114 -0
- package/bin/autonomous/session-guardian.sh +138 -0
- package/bin/autonomous/supervisor.js +98 -0
- package/bin/change-classifier.js +19 -5
- package/bin/dashboard/api-router.js +10 -1
- package/bin/governance/approve.js +65 -28
- package/bin/governance/config-manager.js +3 -1
- package/bin/governance/rbac-manager.js +14 -6
- package/bin/harness-audit.js +520 -0
- package/bin/hooks/instinct-capture-hook.js +16 -1
- package/bin/hooks/lib/detect-project.js +72 -0
- package/bin/installer/harness-adapter-compliance.js +321 -0
- package/bin/installer/install-manifests.js +200 -0
- package/bin/installer/install-state.js +243 -0
- package/bin/installer-core.js +1 -1
- package/bin/learning/instinct-cli.js +359 -0
- package/bin/learning/lib/ssrf-guard.js +252 -0
- package/bin/memory/eis-client.js +31 -10
- package/bin/memory/federated-sync.js +11 -2
- package/bin/memory/knowledge-capture.js +10 -1
- package/bin/memory/pillar-health-tracker.js +9 -1
- package/bin/models/llm-errors.js +79 -0
- package/bin/models/model-client.js +39 -4
- package/bin/models/ollama-provider.js +115 -0
- package/bin/models/openai-provider.js +40 -9
- package/bin/models/profiles-loader.js +147 -0
- package/bin/models/provider-registry.js +59 -0
- package/bin/review/ads-engine.js +2 -2
- package/bin/revops/market-evaluator.js +23 -2
- package/bin/revops/router-steering-v2.js +17 -2
- package/bin/security/trust-boundaries.js +20 -3
- package/bin/utils/readiness-gate.js +169 -0
- package/bin/worktree/engine.js +497 -0
- package/package.json +8 -2
- package/subagents/categories/04-quality-security/.claude-plugin/plugin.json +10 -0
- package/subagents/categories/04-quality-security/go-build-resolver.md +105 -0
- package/subagents/categories/04-quality-security/go-reviewer.md +87 -0
- package/subagents/categories/04-quality-security/python-reviewer.md +109 -0
- package/subagents/categories/04-quality-security/react-build-resolver.md +215 -0
- package/subagents/categories/04-quality-security/react-reviewer.md +167 -0
- package/subagents/categories/04-quality-security/rust-build-resolver.md +159 -0
- package/subagents/categories/04-quality-security/rust-reviewer.md +105 -0
- package/subagents/categories/04-quality-security/silent-failure-hunter.md +67 -0
- package/subagents/categories/04-quality-security/type-design-analyzer.md +58 -0
- package/subagents/categories/04-quality-security/typescript-reviewer.md +126 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-architecture-audit
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 11.4.0
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: agent audit, wrapper regression, memory contamination, tool discipline, hidden repair loop, 12-layer stack, multi-layer self-audit, agent architecture, harness diagnostic, layer-by-layer review, NexusTracer audit, soul-engine audit, swarm wave audit
|
|
7
|
+
compose: agent-introspection-debugging
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skill — Agent Architecture Audit
|
|
11
|
+
|
|
12
|
+
A full-stack diagnostic for MindForge's own multi-layer agent stack. Audits the
|
|
13
|
+
12-layer stack for wrapper regression, memory contamination, tool-discipline
|
|
14
|
+
failures, hidden repair loops, and rendering/transport corruption. Produces
|
|
15
|
+
severity-ranked findings with code-first fixes — for agent systems that hide
|
|
16
|
+
failures behind wrapper layers, stale memory, retry loops, or transport
|
|
17
|
+
mutations.
|
|
18
|
+
|
|
19
|
+
This skill **composes with `agent-introspection-debugging`** (already in
|
|
20
|
+
`.mindforge/skills/`): introspection debugs a single runtime failure (loop,
|
|
21
|
+
timeout, hallucination); this skill audits the whole stack for the systemic
|
|
22
|
+
wrapper-layer causes behind those failures. Invoke via `/mindforge:introspect`
|
|
23
|
+
when a single-failure debug keeps recurring or points at a structural cause.
|
|
24
|
+
|
|
25
|
+
## When this skill activates
|
|
26
|
+
|
|
27
|
+
**MANDATORY for:**
|
|
28
|
+
- Releasing any MindForge-driven agent or LLM-powered behavior to production
|
|
29
|
+
- Shipping features touching tool calling, the Sharded Memory Loop, or
|
|
30
|
+
multi-step swarm workflows
|
|
31
|
+
- Agent behavior degrades after adding a wrapper layer (new PersonaFactory
|
|
32
|
+
patch, new prompt-assembly stage, new WaveExecutor step)
|
|
33
|
+
- User reports "the agent is getting worse" or "tools are flaky"
|
|
34
|
+
- Same model works in playground but breaks inside the MindForge wrapper stack
|
|
35
|
+
- Debugging agent behavior for more than 15 minutes without finding root cause
|
|
36
|
+
|
|
37
|
+
**Especially critical when:**
|
|
38
|
+
- New prompt layers, tool definitions, or memory systems have been added
|
|
39
|
+
- Different swarm specialists behave inconsistently on the same input
|
|
40
|
+
- The model was fine yesterday but is hallucinating today
|
|
41
|
+
- You suspect a hidden repair/retry loop is silently mutating responses
|
|
42
|
+
|
|
43
|
+
**Do not use for:**
|
|
44
|
+
- Single-failure runtime debugging — use `agent-introspection-debugging`
|
|
45
|
+
- Code review — use language-specific reviewer agents
|
|
46
|
+
- Security scanning — use `/mindforge:security-scan` / `security-reviewer`
|
|
47
|
+
- Agent performance benchmarking — use `/mindforge:agent-eval`
|
|
48
|
+
- Writing new features — use the appropriate workflow skill
|
|
49
|
+
|
|
50
|
+
## Mandatory actions when this skill is active
|
|
51
|
+
|
|
52
|
+
### The MindForge 12-Layer Stack
|
|
53
|
+
|
|
54
|
+
Every MindForge agent run passes through these layers. Any one can corrupt the
|
|
55
|
+
answer. The concrete MindForge component owning each layer is named so the
|
|
56
|
+
audit has a real target, not an abstraction.
|
|
57
|
+
|
|
58
|
+
| # | Layer | MindForge Component | What Goes Wrong |
|
|
59
|
+
|---|-------|---------------------|-----------------|
|
|
60
|
+
| 1 | System prompt | SOUL.md + MINDFORGE.md + `.agent/CLAUDE.md` assembly | Conflicting directives, instruction bloat across the source-of-truth hierarchy |
|
|
61
|
+
| 2 | Session history | NexusTracer turn log | Stale context injected from previous turns |
|
|
62
|
+
| 3 | Long-term memory | shard-controller (Cold tier) | Pollution across sessions, old topics in new conversations |
|
|
63
|
+
| 4 | Distillation | shard-controller compaction (Hot/Warm rotation) | Compressed shards re-entering as pseudo-facts |
|
|
64
|
+
| 5 | Active recall | continuous-learning instinct recall | Redundant re-summary / instinct replay wasting context |
|
|
65
|
+
| 6 | Tool selection | PersonaFactory + hooks_route routing | Wrong tool routing, model skips a required tool |
|
|
66
|
+
| 7 | Tool execution | swarm WaveExecutor dispatch | Hallucinated execution — claims to call but doesn't |
|
|
67
|
+
| 8 | Tool interpretation | WaveExecutor result consolidation | Misread or ignored tool output |
|
|
68
|
+
| 9 | Answer shaping | SWARM-SUMMARY consolidation | Format corruption in the final response |
|
|
69
|
+
| 10 | Platform rendering | Dashboard (localhost:7339) / CLI / API transport | Transport-layer mutation of a valid answer |
|
|
70
|
+
| 11 | Hidden repair loops | soul-engine ADS rewrite + Temporal hindsight regeneration | Silent fallback/retry running a second LLM pass |
|
|
71
|
+
| 12 | Persistence | auto-state.json + Merkle audit log | Expired state or cached artifacts reused as live evidence |
|
|
72
|
+
|
|
73
|
+
### Common Failure Patterns
|
|
74
|
+
|
|
75
|
+
#### 1. Wrapper Regression
|
|
76
|
+
The base model produces correct answers, but MindForge's wrapper layers make it
|
|
77
|
+
worse.
|
|
78
|
+
|
|
79
|
+
**Symptoms:**
|
|
80
|
+
- Model works fine in playground or direct API call, breaks in the swarm
|
|
81
|
+
- Added a new PersonaFactory patch or prompt stage, existing behavior degraded
|
|
82
|
+
- Agent sounds confident but is confidently wrong
|
|
83
|
+
- "It was working before the last update"
|
|
84
|
+
|
|
85
|
+
#### 2. Memory Contamination
|
|
86
|
+
Old topics leak into new conversations through NexusTracer history, shard
|
|
87
|
+
recall, or distillation.
|
|
88
|
+
|
|
89
|
+
**Symptoms:**
|
|
90
|
+
- Agent brings up unrelated past topics
|
|
91
|
+
- User corrections don't stick (old shard/instinct overwrites new)
|
|
92
|
+
- Same-session artifacts re-enter as pseudo-facts
|
|
93
|
+
- Cold-tier memory grows without bound, degrading response quality over time
|
|
94
|
+
|
|
95
|
+
#### 3. Tool Discipline Failure
|
|
96
|
+
Tools are declared in the prompt but not enforced in code. The model skips them
|
|
97
|
+
or hallucinates execution.
|
|
98
|
+
|
|
99
|
+
**Symptoms:**
|
|
100
|
+
- "Must use tool X" in the prompt, but model answers without calling it
|
|
101
|
+
- Tool results look correct but were never actually executed by WaveExecutor
|
|
102
|
+
- Different swarm specialists fight over the same responsibility
|
|
103
|
+
- Model uses a tool when it shouldn't, or skips it when it must
|
|
104
|
+
|
|
105
|
+
#### 4. Rendering/Transport Corruption
|
|
106
|
+
The agent's internal answer is correct, but the platform layer mutates it during
|
|
107
|
+
delivery.
|
|
108
|
+
|
|
109
|
+
**Symptoms:**
|
|
110
|
+
- NexusTracer logs show the correct answer, user sees broken output
|
|
111
|
+
- Markdown rendering, JSON parsing, or streaming fragments corrupt valid output
|
|
112
|
+
- A hidden fallback quietly replaces the answer before delivery
|
|
113
|
+
- Output differs between the CLI and the dashboard
|
|
114
|
+
|
|
115
|
+
#### 5. Hidden Agent Layers
|
|
116
|
+
Silent repair, retry, summarization, or recall layers run without explicit
|
|
117
|
+
contracts.
|
|
118
|
+
|
|
119
|
+
**Symptoms:**
|
|
120
|
+
- Output changes between internal generation and user delivery
|
|
121
|
+
- soul-engine ADS "auto-fix" runs a second LLM pass the user doesn't know about
|
|
122
|
+
- Multiple swarm layers modify the same output without coordination
|
|
123
|
+
- Answers get "smoothed" or "corrected" by invisible layers
|
|
124
|
+
|
|
125
|
+
### Audit Workflow
|
|
126
|
+
|
|
127
|
+
#### Phase 1: Scope
|
|
128
|
+
Define what you're auditing:
|
|
129
|
+
- **Target system** — which MindForge agent / swarm / command?
|
|
130
|
+
- **Entrypoints** — how do users interact (CLI command, dashboard, hook)?
|
|
131
|
+
- **Model stack** — which LLM(s) and providers?
|
|
132
|
+
- **Symptoms** — what does the user report?
|
|
133
|
+
- **Time window** — when did it start?
|
|
134
|
+
- **Layers to audit** — which of the 12 layers apply?
|
|
135
|
+
|
|
136
|
+
#### Phase 2: Evidence Collection
|
|
137
|
+
Gather evidence from the codebase:
|
|
138
|
+
- **Source code** — swarm loop, hooks_route tool router, shard admission, prompt
|
|
139
|
+
assembly across the source-of-truth hierarchy
|
|
140
|
+
- **Logs** — NexusTracer session traces, Merkle-linked AUDIT entries, tool-call
|
|
141
|
+
records
|
|
142
|
+
- **Config** — MINDFORGE.md parameters, tool schemas, PersonaFactory patches,
|
|
143
|
+
provider settings
|
|
144
|
+
- **Memory files** — instinct store, shard archives, `auto-state.json`
|
|
145
|
+
|
|
146
|
+
Use `rg` to search for anti-patterns:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Tool requirements expressed only in prompt text (not code)
|
|
150
|
+
rg "must.*tool|required.*call" --type md
|
|
151
|
+
|
|
152
|
+
# Tool execution without validation
|
|
153
|
+
rg "tool_call|toolCall|tool_use"
|
|
154
|
+
|
|
155
|
+
# Hidden LLM calls outside the main swarm loop
|
|
156
|
+
rg "completion|chat\.create|messages\.create|llm\.invoke"
|
|
157
|
+
|
|
158
|
+
# Shard/instinct admission without user-correction priority
|
|
159
|
+
rg "memory.*admit|shard.*admit|instinct.*capture|persist.*memory"
|
|
160
|
+
|
|
161
|
+
# Fallback / repair loops that run additional LLM calls (soul-engine, hindsight)
|
|
162
|
+
rg "fallback|retry.*llm|repair.*prompt|re-?prompt|soul-engine|regenerat"
|
|
163
|
+
|
|
164
|
+
# Silent output mutation
|
|
165
|
+
rg "mutate|rewrite.*response|transform.*output|shap"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Phase 3: Failure Mapping
|
|
169
|
+
For each finding, document:
|
|
170
|
+
- **Symptom** — what the user sees
|
|
171
|
+
- **Mechanism** — how the wrapper causes it
|
|
172
|
+
- **Source layer** — which of the 12 layers (and which MindForge component)
|
|
173
|
+
- **Root cause** — the deepest cause
|
|
174
|
+
- **Evidence** — file:line or NexusTracer/AUDIT row reference
|
|
175
|
+
- **Confidence** — 0.0 to 1.0
|
|
176
|
+
|
|
177
|
+
#### Phase 4: Fix Strategy
|
|
178
|
+
Default fix order (code-first, not prompt-first):
|
|
179
|
+
1. **Code-gate tool requirements** — enforce in WaveExecutor, not prompt text
|
|
180
|
+
2. **Remove or narrow hidden repair layers** — make soul-engine / hindsight
|
|
181
|
+
regeneration explicit with contracts
|
|
182
|
+
3. **Reduce context duplication** — same info through prompt + NexusTracer
|
|
183
|
+
history + shard memory + distillation
|
|
184
|
+
4. **Tighten memory admission** — user corrections > agent assertions (shard +
|
|
185
|
+
instinct admission)
|
|
186
|
+
5. **Tighten distillation triggers** — don't compact shards that shouldn't be
|
|
187
|
+
compacted
|
|
188
|
+
6. **Reduce rendering mutation** — dashboard/CLI pass-through, don't transform
|
|
189
|
+
7. **Convert to typed JSON envelopes** — structured internal flow (SWARM-SUMMARY
|
|
190
|
+
as schema), not freeform prose
|
|
191
|
+
|
|
192
|
+
### Severity Model
|
|
193
|
+
|
|
194
|
+
| Level | Meaning | Action |
|
|
195
|
+
|-------|---------|--------|
|
|
196
|
+
| `critical` | Agent can confidently produce wrong operational behavior | Fix before next release |
|
|
197
|
+
| `high` | Agent frequently degrades correctness or stability | Fix this sprint |
|
|
198
|
+
| `medium` | Correctness usually survives but output is fragile or wasteful | Plan for next cycle |
|
|
199
|
+
| `low` | Mostly cosmetic or maintainability issues | Backlog |
|
|
200
|
+
|
|
201
|
+
### Output Format
|
|
202
|
+
Present findings to the user in this order:
|
|
203
|
+
1. **Severity-ranked findings** (most critical first)
|
|
204
|
+
2. **Architecture diagnosis** (which layer / component corrupted what, and why)
|
|
205
|
+
3. **Ordered fix plan** (code-first, not prompt-first)
|
|
206
|
+
|
|
207
|
+
Do not lead with compliments or summaries. If the system is broken, say so
|
|
208
|
+
directly.
|
|
209
|
+
|
|
210
|
+
### Quick Diagnostic Questions
|
|
211
|
+
When auditing a MindForge agent system, answer these:
|
|
212
|
+
|
|
213
|
+
| # | Question | If Yes → |
|
|
214
|
+
|---|----------|----------|
|
|
215
|
+
| 1 | Can the model skip a required tool and still answer? | Tool not code-gated in WaveExecutor |
|
|
216
|
+
| 2 | Does old conversation content appear in new turns? | Memory contamination (NexusTracer/shard) |
|
|
217
|
+
| 3 | Is the same info in system prompt AND shard memory AND history? | Context duplication |
|
|
218
|
+
| 4 | Does soul-engine or hindsight run a second LLM pass before delivery? | Hidden repair loop |
|
|
219
|
+
| 5 | Does output differ between internal generation and user delivery? | Rendering corruption (dashboard/CLI) |
|
|
220
|
+
| 6 | Are "must use tool X" rules only in prompt text? | Tool discipline failure |
|
|
221
|
+
| 7 | Can the agent's own monologue become a persistent instinct/shard? | Memory poisoning |
|
|
222
|
+
|
|
223
|
+
### Anti-Patterns to Avoid
|
|
224
|
+
- Avoid blaming the model before falsifying wrapper-layer regressions.
|
|
225
|
+
- Avoid blaming memory without showing the contamination path (which shard /
|
|
226
|
+
instinct / NexusTracer turn).
|
|
227
|
+
- Do not let a clean current `auto-state.json` erase a dirty historical incident.
|
|
228
|
+
- Do not treat markdown prose as a trustworthy internal protocol.
|
|
229
|
+
- Do not accept "must use tool" in prompt text when WaveExecutor never enforces it.
|
|
230
|
+
- Keep findings direct, evidence-backed, and severity-ranked.
|
|
231
|
+
|
|
232
|
+
### Report Schema
|
|
233
|
+
Audits MUST produce a structured report following this shape:
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"schema_version": "mindforge.agent-architecture-audit.report.v1",
|
|
238
|
+
"executive_verdict": {
|
|
239
|
+
"overall_health": "high_risk",
|
|
240
|
+
"primary_failure_mode": "string",
|
|
241
|
+
"most_urgent_fix": "string"
|
|
242
|
+
},
|
|
243
|
+
"scope": {
|
|
244
|
+
"target_name": "string",
|
|
245
|
+
"model_stack": ["string"],
|
|
246
|
+
"layers_to_audit": ["string"]
|
|
247
|
+
},
|
|
248
|
+
"findings": [
|
|
249
|
+
{
|
|
250
|
+
"severity": "critical|high|medium|low",
|
|
251
|
+
"title": "string",
|
|
252
|
+
"mechanism": "string",
|
|
253
|
+
"source_layer": "string",
|
|
254
|
+
"root_cause": "string",
|
|
255
|
+
"evidence_refs": ["file:line"],
|
|
256
|
+
"confidence": 0.0,
|
|
257
|
+
"recommended_fix": "string"
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"ordered_fix_plan": [
|
|
261
|
+
{ "order": 1, "goal": "string", "why_now": "string", "expected_effect": "string" }
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Self-check before task completion
|
|
267
|
+
- [ ] Did I scope the audit to a concrete MindForge target, entrypoint, and model stack?
|
|
268
|
+
- [ ] Did I map each finding to one of the 12 layers AND its MindForge component (NexusTracer, soul-engine, shard-controller, PersonaFactory, WaveExecutor, etc.)?
|
|
269
|
+
- [ ] Did I check all five failure patterns (wrapper regression, memory contamination, tool discipline, rendering/transport corruption, hidden repair loops)?
|
|
270
|
+
- [ ] Is every finding evidence-backed with a file:line or NexusTracer/AUDIT reference and a confidence score?
|
|
271
|
+
- [ ] Did I emit the `mindforge.agent-architecture-audit.report.v1` JSON report (severity-ranked findings + ordered, code-first fix plan)?
|
|
272
|
+
- [ ] Did I hand off to `agent-introspection-debugging` for any single runtime failure that still needs contained recovery?
|
|
@@ -60,6 +60,22 @@ The instinct engine runs in auto-capture mode, watching for:
|
|
|
60
60
|
- Instincts inactive for 30 days are auto-pruned
|
|
61
61
|
- User can manually deprecate any instinct
|
|
62
62
|
|
|
63
|
+
### Project scoping (no cross-project leak)
|
|
64
|
+
Every captured instinct carries a `project_id` (a stable 12-char SHA256 of the
|
|
65
|
+
git remote URL, normalized so https/ssh/scp clones of the same repo match) plus
|
|
66
|
+
a human-readable `project` name. Outside a git repo, both fall back to
|
|
67
|
+
`global`. This enforces the invariant that instincts learned in repo A never
|
|
68
|
+
surface in repo B:
|
|
69
|
+
|
|
70
|
+
- **Read-time filter:** when recalling instincts (status, evolve-skills,
|
|
71
|
+
cluster-instincts), match `project_id` to the current repo's detected id, OR
|
|
72
|
+
`global`. Ignore entries from other projects.
|
|
73
|
+
- **Detection:** `bin/hooks/lib/detect-project.js` (`detectProject(cwd)`) is the
|
|
74
|
+
single source of the id; the capture hook stamps it on write.
|
|
75
|
+
- **Promotion across projects:** an instinct seen in 2+ projects with avg
|
|
76
|
+
confidence >= 0.8 is a candidate to promote to a `global` instinct (deeper
|
|
77
|
+
cross-project promotion criteria are handled by evolve-skills).
|
|
78
|
+
|
|
63
79
|
### During any task (passive observation)
|
|
64
80
|
- Note patterns that repeat across tasks
|
|
65
81
|
- When user corrects behavior: acknowledge and create instinct
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orch-pipeline
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
min_mindforge_version: 11.4.0
|
|
5
|
+
status: stable
|
|
6
|
+
triggers: orchestration, multi-agent build, feature pipeline, size classification, blast radius, orch-add-feature, orch-fix-defect, orch-change-feature, orch-refine-code, orch-build-mvp, gated pipeline, research-plan-tdd-review-commit
|
|
7
|
+
origin: ECC (ported and adapted to MindForge)
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skill — Orchestrator Pipeline (shared engine)
|
|
11
|
+
|
|
12
|
+
The `orch-*` commands are thin wrappers. They do not re-implement any work — they
|
|
13
|
+
classify the request, choose which phases of *this* pipeline run, and delegate
|
|
14
|
+
each phase to an existing MindForge skill, command, persona, or subagent. This
|
|
15
|
+
file is that pipeline.
|
|
16
|
+
|
|
17
|
+
> Invoke an operation command (`/mindforge:orch-add-feature`,
|
|
18
|
+
> `/mindforge:orch-fix-defect`, …) rather than this engine directly. This file is
|
|
19
|
+
> the reference they point at.
|
|
20
|
+
|
|
21
|
+
## When this skill activates
|
|
22
|
+
|
|
23
|
+
- Loaded indirectly whenever an `orch-*` operation command runs.
|
|
24
|
+
- Activates on the triggers above: orchestration, multi-agent build, feature
|
|
25
|
+
pipeline, size classification, blast radius.
|
|
26
|
+
- Read directly only when adding a new operation to the family or tuning the
|
|
27
|
+
shared phases, gates, agent map, or the size classifier.
|
|
28
|
+
|
|
29
|
+
## Mandatory actions when this skill is active
|
|
30
|
+
|
|
31
|
+
1. Run **Step 0 — the SIZE CLASSIFIER** first; ceremony scales to blast radius.
|
|
32
|
+
Never skip it — emitting the size + plan is the contract.
|
|
33
|
+
2. Drive the work through the phases (research → plan → execute → verify →
|
|
34
|
+
review → commit) using the MindForge XML plan format.
|
|
35
|
+
3. Honor **both gates**: the plan-approval gate and GATE 2 (commit + AUDIT.jsonl
|
|
36
|
+
with conventional commits).
|
|
37
|
+
4. Route work through the remapped MindForge agent/capability map — never invoke
|
|
38
|
+
the original ECC agent names.
|
|
39
|
+
5. Respect the security auto-trigger and Tier-3 governance; the GAN inner loop is
|
|
40
|
+
descoped to `WaveExecutor` / the swarm-execution protocol.
|
|
41
|
+
|
|
42
|
+
## The operation family
|
|
43
|
+
|
|
44
|
+
| Command | Operation | Trigger | First move |
|
|
45
|
+
|---------|-----------|---------|------------|
|
|
46
|
+
| `/mindforge:orch-add-feature` | feature | capability does not exist yet | research + plan a new slice |
|
|
47
|
+
| `/mindforge:orch-change-feature` | tweak | works, but desired behavior differs | amend existing behavior *and its tests* |
|
|
48
|
+
| `/mindforge:orch-fix-defect` | fix | broken; behavior is wrong | reproduce as a failing test, then fix |
|
|
49
|
+
| `/mindforge:orch-refine-code` | refactor | behavior stays, structure improves | restructure while keeping tests green |
|
|
50
|
+
| `/mindforge:orch-build-mvp` | mvp | bootstrap from a design/spec doc | ingest doc → vertical slices |
|
|
51
|
+
|
|
52
|
+
> These wrappers **compose** existing MindForge capabilities rather than replace
|
|
53
|
+
> them: the `writing-plans` skill + `/mindforge:plan-write`, the
|
|
54
|
+
> `mindforge-tdd_extended` protocol, `/mindforge:cross-review` + `/mindforge:review`,
|
|
55
|
+
> the `04-quality-security` reviewer subagents, and the `quick.md` security
|
|
56
|
+
> auto-trigger. The orch-* family adds the shared **size classifier** and the
|
|
57
|
+
> **two human gates** on top of them, so one umbrella covers all five operations
|
|
58
|
+
> consistently.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Step 0 — SIZE CLASSIFIER (right-sizing) — the novel control
|
|
63
|
+
|
|
64
|
+
> **This is the whole point of the port. Ceremony scales to blast radius.** Do
|
|
65
|
+
> not skip it. Always run Step 0 first and always state the result in one line so
|
|
66
|
+
> the user can override.
|
|
67
|
+
|
|
68
|
+
Score the request on three signals, take the **highest** tier any signal
|
|
69
|
+
reaches, and emit one line:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
[orch] size: <tier> — phases <mask> — rationale: <one clause> (override with: size=<tier>)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| Tier | Files touched | New dependency / contract | Design ambiguity | Phases that run |
|
|
76
|
+
|------|---------------|---------------------------|------------------|-----------------|
|
|
77
|
+
| **tiny** | 1, a few lines | none | none — the change is obvious | 4 → 5 → 6 |
|
|
78
|
+
| **small** | 1 file / 1 function | none | clear once you read the code | (1 light) → 4 → 5 → 6 |
|
|
79
|
+
| **medium** | 2–5 files | maybe a new internal module | one real choice to make | 1 → 2 → 4 → 5 → 6 |
|
|
80
|
+
| **large** | many / cross-cutting | new external dep, public API, or a spec doc | multiple open questions | 1 → 2 → (3) → 4 → 5 → 6 |
|
|
81
|
+
|
|
82
|
+
Phase 0 (Intake) always runs and is omitted from the mask column above.
|
|
83
|
+
|
|
84
|
+
**Tie-breakers (force a floor regardless of file count):**
|
|
85
|
+
- Anything touching a **security trigger** (see below) is **at least medium**.
|
|
86
|
+
- Anything touching a **public API / contract / spec doc** is **at least medium**.
|
|
87
|
+
- Anything classified **Tier 3** under the MindForge security policy (see
|
|
88
|
+
`.claude/CLAUDE.md` → CRITICAL SECURITY & AUTO-TRIGGER) is **at least large**
|
|
89
|
+
and requires manual overhead before Gate 1.
|
|
90
|
+
- If the swarm controller (`.mindforge/engine/swarm-controller.md`) would trigger
|
|
91
|
+
on this task (`compositeScore >= AUTO_SWARM_THRESHOLD`, or a multi-disciplinary
|
|
92
|
+
marker like `UI + API` / `Auth + Database`), treat the tier as **large** and
|
|
93
|
+
run the Implement phase via the swarm-execution protocol (see Phase 4).
|
|
94
|
+
|
|
95
|
+
Per-operation default floors (the wrappers pass these in):
|
|
96
|
+
- `orch-fix-defect` → floor **small** (often **tiny**).
|
|
97
|
+
- `orch-change-feature` → floor **small**.
|
|
98
|
+
- `orch-refine-code` → floor **medium** (restructures touch multiple files).
|
|
99
|
+
- `orch-build-mvp` → floor **large**, full pipeline incl. Scaffold (Phase 3).
|
|
100
|
+
- `orch-add-feature` → no floor; classify on the three signals.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## The phases
|
|
105
|
+
|
|
106
|
+
Each phase delegates — it does not do the work inline.
|
|
107
|
+
|
|
108
|
+
- **0. Intake** — restate the request in one line. For `orch-build-mvp`, read the
|
|
109
|
+
spec/design doc and extract scope, locked decisions, and a feature list.
|
|
110
|
+
- **1. Research & Reuse** — Search-Before-Building (Builder Ethos): `gh search
|
|
111
|
+
repos` / `gh search code`, then Context7 / vendor docs, then package registries,
|
|
112
|
+
then Exa / web search. Prefer adopting a proven implementation over net-new
|
|
113
|
+
code. Use `/mindforge:research` for a focused research subagent when the task
|
|
114
|
+
involves unfamiliar libraries.
|
|
115
|
+
- **2. Plan** — delegate to the `writing-plans` skill via `/mindforge:plan-write`.
|
|
116
|
+
Output a MindForge **XML plan** (format below), ordered as thin vertical
|
|
117
|
+
slices, written under `.planning/`. → **GATE 1.**
|
|
118
|
+
- **3. Scaffold** — `orch-build-mvp` only: stand up the first end-to-end slice.
|
|
119
|
+
- **4. Implement (TDD)** — drive each task through the `mindforge-tdd_extended`
|
|
120
|
+
protocol (Red → Green → Refactor). Honor the operation's first-move rule. For
|
|
121
|
+
**large**/swarm-triggered tasks, delegate the implement wave to
|
|
122
|
+
`WaveExecutor` / the `mindforge-swarm-execution` protocol
|
|
123
|
+
(`.mindforge/engine/wave-executor.md`) instead of a single-threaded loop.
|
|
124
|
+
- **5. Review** — `/mindforge:review` (code-quality + security), escalating to
|
|
125
|
+
`/mindforge:cross-review` (multi-model consensus) for **large** tiers. Pull in
|
|
126
|
+
the matching `04-quality-security` reviewer subagent for the repo's language
|
|
127
|
+
(`typescript-reviewer`, `python-reviewer`, `rust-reviewer`, `go-reviewer`, …)
|
|
128
|
+
and `security-auditor` / `penetration-tester` whenever the diff touches a
|
|
129
|
+
security trigger.
|
|
130
|
+
- **6. Commit** — conventional commits (`feat:` / `fix:` / `refactor:` / …), one
|
|
131
|
+
per logical chunk, **+ a Merkle-linked AUDIT.jsonl entry per commit**. → **GATE 2.**
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## The MindForge XML plan format (Phase 2 output)
|
|
136
|
+
|
|
137
|
+
Plans are MindForge XML, written under `.planning/` — **never** ECC
|
|
138
|
+
`.claude/PRPs/` paths. For orch-* work the planning home is
|
|
139
|
+
`.planning/quick/[NNN]-[slug]/PLAN.md` (sequential numbering, per `quick.md`) for
|
|
140
|
+
tiny/small/medium, or `.planning/phases/[phase]/PLAN.md` when a phase is active.
|
|
141
|
+
|
|
142
|
+
```xml
|
|
143
|
+
<task type="orch-[operation]">
|
|
144
|
+
<n>[task name]</n>
|
|
145
|
+
<size>[tiny|small|medium|large]</size>
|
|
146
|
+
<persona>[appropriate persona — security-reviewer if a trigger is touched]</persona>
|
|
147
|
+
<files>[files to touch]</files>
|
|
148
|
+
<context>[why this work exists; cited file:line patterns from EXPLORE]</context>
|
|
149
|
+
<action>[ordered, no-placeholder vertical slices — the task_list]</action>
|
|
150
|
+
<verify>[exact verification command + expected output]</verify>
|
|
151
|
+
<done>[definition of done — incl. tests + coverage ≥ 80%]</done>
|
|
152
|
+
</task>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The `writing-plans` skill's EXPLORE protocol and "No Prior Knowledge" gate apply:
|
|
156
|
+
every convention the plan references must be cited from the actual codebase.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## The two gates
|
|
161
|
+
|
|
162
|
+
This family is **gated, not autonomous**:
|
|
163
|
+
|
|
164
|
+
1. **GATE 1 — after Plan.** Present the XML `<action>` task_list; do not write
|
|
165
|
+
implementation code until the user approves. For **Tier 3** security-classified
|
|
166
|
+
work, the manual security overhead is completed here before approval.
|
|
167
|
+
2. **GATE 2 — before Commit.** Present the diff summary and proposed conventional
|
|
168
|
+
commit messages; do not commit until the user confirms. Each confirmed commit
|
|
169
|
+
writes a Merkle-linked AUDIT.jsonl entry (below).
|
|
170
|
+
|
|
171
|
+
Everything between the gates flows without stopping.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Agent / capability map (remapped to MindForge)
|
|
176
|
+
|
|
177
|
+
| Phase | Primary (MindForge) | Fallback / escalation |
|
|
178
|
+
|-------|---------------------|-----------------------|
|
|
179
|
+
| Intake / understand | `/mindforge:map-codebase` / `/mindforge:code-tour` | trace existing paths before a tweak, fix, or refactor |
|
|
180
|
+
| Research | `/mindforge:research` | Context7 / vendor docs / package registries / Exa |
|
|
181
|
+
| Plan | `writing-plans` skill via `/mindforge:plan-write` | `/mindforge:system-design`, `/mindforge:rfc` for structural calls |
|
|
182
|
+
| Implement | `mindforge-tdd_extended` protocol (Red-Green-Refactor) | `/mindforge:debug` on build/test breaks |
|
|
183
|
+
| Implement (large/swarm) | `WaveExecutor` / `mindforge-swarm-execution` protocol | `SwarmController` cluster selection (`.mindforge/engine/swarm-controller.md`) |
|
|
184
|
+
| Review | `/mindforge:review` (code-quality + security) | `/mindforge:cross-review` (multi-model) for large tiers |
|
|
185
|
+
| Language review | `04-quality-security/<lang>-reviewer.md` subagent | match the reviewer to the repo (see its `CLAUDE.md`) |
|
|
186
|
+
| Security | `quick.md` security auto-trigger → `security-reviewer.md` persona + `security-auditor` / `penetration-tester` subagents | `/mindforge:security-scan` PRE-COMMIT |
|
|
187
|
+
|
|
188
|
+
Match the language reviewer to the repo. The `04-quality-security` subagents live
|
|
189
|
+
under `subagents/categories/04-quality-security/`.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Security-review trigger (the quick.md auto-trigger)
|
|
194
|
+
|
|
195
|
+
Reuse the `quick.md` **security auto-trigger**: scan the task description and the
|
|
196
|
+
files in scope for security keywords —
|
|
197
|
+
`auth, authentication, login, password, token, JWT, session, payment, PII, upload,
|
|
198
|
+
credential, secret, key` — and for changes to authorization, user-input handling,
|
|
199
|
+
database queries, file-system paths, external API calls, or cryptography.
|
|
200
|
+
|
|
201
|
+
If any match:
|
|
202
|
+
1. Load `security-review/SKILL.md` and activate the `security-reviewer.md` persona
|
|
203
|
+
for the Implement and Review phases (required even for tiny/small tiers).
|
|
204
|
+
2. Pull in the `security-auditor` (+ `penetration-tester` for large) subagents
|
|
205
|
+
from `04-quality-security/` during Phase 5.
|
|
206
|
+
3. Run `/mindforge:security-scan` PRE-COMMIT. **Fail the gate if any Medium+
|
|
207
|
+
findings are unaddressed** (per `.claude/CLAUDE.md`).
|
|
208
|
+
4. Treat the task as **at least medium** in Step 0 (Tier 3 → at least large, with
|
|
209
|
+
manual overhead before Gate 1).
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Handoff artifacts
|
|
214
|
+
|
|
215
|
+
The pipeline carries no hidden state — the planning docs *are* the handoff:
|
|
216
|
+
|
|
217
|
+
- The XML `<action>` task_list (from Plan) drives the Implement loop.
|
|
218
|
+
- Larger work may also emit PRD / architecture / system_design under `.planning/`
|
|
219
|
+
(via `/mindforge:system-design`, `/mindforge:product-spec`, `/mindforge:rfc`).
|
|
220
|
+
- Review findings (Blocking / CRITICAL / HIGH) must be resolved before Gate 2.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## GATE 2 — commit + AUDIT.jsonl (Phase 6)
|
|
225
|
+
|
|
226
|
+
On user confirmation at Gate 2, for **each** logical commit:
|
|
227
|
+
|
|
228
|
+
1. Commit with a **conventional** message scoped to one logical change:
|
|
229
|
+
`feat(<scope>): …` / `fix(<scope>): …` / `refactor(<scope>): …` / etc.
|
|
230
|
+
2. Append a **Merkle-linked** AUDIT.jsonl entry to `.planning/AUDIT.jsonl`. Each
|
|
231
|
+
entry sets `previous_hash` to the prior entry's `_hash` and computes its own
|
|
232
|
+
`_hash` (per `.mindforge/audit/AUDIT-SCHEMA.md`):
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"id": "uuid",
|
|
237
|
+
"timestamp": "ISO-8601",
|
|
238
|
+
"event": "orch_commit",
|
|
239
|
+
"agent": "orch-pipeline",
|
|
240
|
+
"operation": "add-feature | fix-defect | change-feature | refine-code | build-mvp",
|
|
241
|
+
"size_tier": "tiny | small | medium | large",
|
|
242
|
+
"phase": null,
|
|
243
|
+
"task_name": "[task name]",
|
|
244
|
+
"commit_sha": "abc1234",
|
|
245
|
+
"commit_type": "feat | fix | refactor",
|
|
246
|
+
"files_changed": ["src/..."],
|
|
247
|
+
"security_trigger": false,
|
|
248
|
+
"review_verdict": "approved | approved_with_conditions",
|
|
249
|
+
"gates_honored": ["gate1_plan", "gate2_commit"],
|
|
250
|
+
"previous_hash": "<prior _hash>",
|
|
251
|
+
"_hash": "<sha256 of this entry>"
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Verification (self-check before task completion)
|
|
258
|
+
|
|
259
|
+
- [ ] **Step 0 size tier was stated in one line** and matched the work.
|
|
260
|
+
- [ ] **Gate 1 (plan)** and **Gate 2 (commit)** were both honored.
|
|
261
|
+
- [ ] The plan was MindForge XML written under `.planning/` (never ECC `PRPs/`).
|
|
262
|
+
- [ ] The `quick.md` security auto-trigger ran; `security-reviewer` engaged iff a
|
|
263
|
+
security trigger was touched; `/mindforge:security-scan` passed PRE-COMMIT
|
|
264
|
+
with no unaddressed Medium+ findings.
|
|
265
|
+
- [ ] Commits are conventional and scoped to one logical change.
|
|
266
|
+
- [ ] Each commit wrote a Merkle-linked AUDIT.jsonl entry (`previous_hash`/`_hash`).
|
|
267
|
+
- [ ] New / changed behavior has tests; coverage ≥ 80%.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Note — GAN inner loop is DESCOPED
|
|
272
|
+
|
|
273
|
+
The ECC original drove `orch-build-mvp`'s inner build loop through a **GAN
|
|
274
|
+
generate/evaluate harness** (`/gan-build`, `gan-generator` → `gan-evaluator`,
|
|
275
|
+
`gan-harness/spec.md` + `eval-rubric.md`). **That GAN harness is not ported.** In
|
|
276
|
+
MindForge, `orch-build-mvp`'s build loop instead **delegates each vertical slice
|
|
277
|
+
to `WaveExecutor` / the `mindforge-swarm-execution` protocol**
|
|
278
|
+
(`.mindforge/engine/wave-executor.md`), with `SwarmController`
|
|
279
|
+
(`.mindforge/engine/swarm-controller.md`) selecting the cluster. The adversarial
|
|
280
|
+
quality bar is provided by the existing `mindforge-tdd_extended` (Red-Green) loop
|
|
281
|
+
plus `/mindforge:cross-review`, not by a GAN evaluator.
|
|
282
|
+
|
|
283
|
+
> **Deferred:** porting the GAN generate/evaluate harness (and its spec /
|
|
284
|
+
> eval-rubric artifacts) into MindForge is out of scope for v1.0.0 of this engine.
|
|
@@ -23,6 +23,79 @@ plans, migration plans, refactoring plans, and any multi-step work breakdown.
|
|
|
23
23
|
2. **Identify the scope boundary.** What is IN the plan vs OUT of scope?
|
|
24
24
|
3. **Identify dependencies.** Which steps depend on other steps? Which can be parallel?
|
|
25
25
|
|
|
26
|
+
### EXPLORE — Structured Codebase Discovery (run BEFORE plan authoring)
|
|
27
|
+
|
|
28
|
+
> Adapted from the PRP EXPLORE protocol (PRPs-agentic-eng by Wirasm). This is a
|
|
29
|
+
> discovery discipline that PRECEDES authoring the MindForge XML/structured plan —
|
|
30
|
+
> it does NOT replace the plan format. The output of EXPLORE feeds the plan's
|
|
31
|
+
> Context, Files, and Details sections with real, cited patterns.
|
|
32
|
+
|
|
33
|
+
**Golden Rule**: If you would need to search the codebase *during* implementation,
|
|
34
|
+
capture that knowledge NOW, during EXPLORE.
|
|
35
|
+
|
|
36
|
+
#### The 8 Search Categories
|
|
37
|
+
|
|
38
|
+
Search the codebase directly (grep, find, file reads) for each category. Do NOT
|
|
39
|
+
skip a category by assuming — confirm it against the actual repository.
|
|
40
|
+
|
|
41
|
+
1. **Existing Patterns** — Architectural patterns already in use (repository,
|
|
42
|
+
service, controller, middleware, hook, etc.) in the area you'll modify.
|
|
43
|
+
2. **Similar Features** — Existing features that resemble the planned one. The
|
|
44
|
+
closest analogue is the single most valuable reference.
|
|
45
|
+
3. **Conventions** — How files, functions, variables, classes, and exports are
|
|
46
|
+
named and organized in the relevant area.
|
|
47
|
+
4. **Dependencies** — Packages, imports, and internal modules used by similar
|
|
48
|
+
features. Note versions where they matter.
|
|
49
|
+
5. **Tests** — How similar features are tested: test file locations, naming,
|
|
50
|
+
setup/teardown, fixtures, and assertion style.
|
|
51
|
+
6. **Configs** — Relevant config files, environment variables, and feature flags.
|
|
52
|
+
7. **Error Handling** — How errors are caught, propagated, logged, and surfaced
|
|
53
|
+
to users in similar code paths.
|
|
54
|
+
8. **Integration Points** — Entry points, data flow, state changes, and the
|
|
55
|
+
contracts/interfaces the new code must honor.
|
|
56
|
+
|
|
57
|
+
#### Patterns to Mirror (capture as file:line snippet references)
|
|
58
|
+
|
|
59
|
+
For each category that yields a concrete convention, record a **Patterns to Mirror**
|
|
60
|
+
entry. Every entry MUST cite a real `file:line` source and quote the actual snippet
|
|
61
|
+
— never paraphrase, never invent:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
## Patterns to Mirror
|
|
65
|
+
|
|
66
|
+
### NAMING_CONVENTION
|
|
67
|
+
// SOURCE: src/services/userService.ts:1-5
|
|
68
|
+
[actual snippet copied from the file]
|
|
69
|
+
|
|
70
|
+
### ERROR_HANDLING
|
|
71
|
+
// SOURCE: src/middleware/errorHandler.ts:10-25
|
|
72
|
+
[actual snippet copied from the file]
|
|
73
|
+
|
|
74
|
+
### TEST_STRUCTURE
|
|
75
|
+
// SOURCE: tests/services/userService.test.ts:1-30
|
|
76
|
+
[actual snippet copied from the file]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
These mirrored snippets get folded into the plan's **Details** blocks so the
|
|
80
|
+
executor writes code indistinguishable from existing code.
|
|
81
|
+
|
|
82
|
+
#### The "No Prior Knowledge" Gate (MANDATORY before authoring)
|
|
83
|
+
|
|
84
|
+
The plan must be executable by someone with **NO prior knowledge of this repo**.
|
|
85
|
+
Therefore:
|
|
86
|
+
|
|
87
|
+
- Every convention the plan references MUST be cited from the actual codebase
|
|
88
|
+
(a real `file:line` + snippet). If you cannot cite it, you have not explored
|
|
89
|
+
enough — go search.
|
|
90
|
+
- NEVER invent a convention, path, type, or import. If the codebase does not
|
|
91
|
+
establish it, the plan does not assume it.
|
|
92
|
+
- If a needed pattern genuinely does not exist yet, say so explicitly and define
|
|
93
|
+
the new convention in the plan (rather than pretending it already exists).
|
|
94
|
+
|
|
95
|
+
**Gate check**: Before moving from EXPLORE to plan authoring, confirm —
|
|
96
|
+
"Could a developer who has never seen this repo implement every step using ONLY
|
|
97
|
+
this plan, without searching or asking?" If not, the EXPLORE pass is incomplete.
|
|
98
|
+
|
|
26
99
|
### During plan writing
|
|
27
100
|
|
|
28
101
|
#### Core Principle: NO PLACEHOLDERS
|
|
@@ -168,3 +241,6 @@ Before marking a task done when this skill was active:
|
|
|
168
241
|
- [ ] Plan scope (IN/OUT) is clearly defined.
|
|
169
242
|
- [ ] If > 15 steps, organized into phases with phase-level gates.
|
|
170
243
|
- [ ] All file paths verified to exist (or marked as "new file").
|
|
244
|
+
- [ ] EXPLORE ran across all 8 search categories before authoring.
|
|
245
|
+
- [ ] Patterns to Mirror captured as real `file:line` snippets (no invented conventions).
|
|
246
|
+
- [ ] "No Prior Knowledge" gate passes — every referenced convention is cited from the codebase.
|