thevoidforge 21.0.10 → 21.0.12
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/dist/.claude/commands/ai.md +69 -0
- package/dist/.claude/commands/architect.md +121 -0
- package/dist/.claude/commands/assemble.md +201 -0
- package/dist/.claude/commands/assess.md +75 -0
- package/dist/.claude/commands/blueprint.md +135 -0
- package/dist/.claude/commands/build.md +116 -0
- package/dist/.claude/commands/campaign.md +201 -0
- package/dist/.claude/commands/cultivation.md +166 -0
- package/dist/.claude/commands/current.md +128 -0
- package/dist/.claude/commands/dangerroom.md +74 -0
- package/dist/.claude/commands/debrief.md +178 -0
- package/dist/.claude/commands/deploy.md +99 -0
- package/dist/.claude/commands/devops.md +143 -0
- package/dist/.claude/commands/gauntlet.md +140 -0
- package/dist/.claude/commands/git.md +104 -0
- package/dist/.claude/commands/grow.md +146 -0
- package/dist/.claude/commands/imagine.md +126 -0
- package/dist/.claude/commands/portfolio.md +50 -0
- package/dist/.claude/commands/prd.md +113 -0
- package/dist/.claude/commands/qa.md +107 -0
- package/dist/.claude/commands/review.md +151 -0
- package/dist/.claude/commands/security.md +100 -0
- package/dist/.claude/commands/test.md +96 -0
- package/dist/.claude/commands/thumper.md +116 -0
- package/dist/.claude/commands/treasury.md +100 -0
- package/dist/.claude/commands/ux.md +118 -0
- package/dist/.claude/commands/vault.md +189 -0
- package/dist/.claude/commands/void.md +108 -0
- package/dist/CHANGELOG.md +1918 -0
- package/dist/CLAUDE.md +250 -0
- package/dist/HOLOCRON.md +856 -0
- package/dist/VERSION.md +123 -0
- package/dist/docs/NAMING_REGISTRY.md +478 -0
- package/dist/docs/methods/AI_INTELLIGENCE.md +276 -0
- package/dist/docs/methods/ASSEMBLER.md +142 -0
- package/dist/docs/methods/BACKEND_ENGINEER.md +165 -0
- package/dist/docs/methods/BUILD_JOURNAL.md +185 -0
- package/dist/docs/methods/BUILD_PROTOCOL.md +426 -0
- package/dist/docs/methods/CAMPAIGN.md +568 -0
- package/dist/docs/methods/CONTEXT_MANAGEMENT.md +189 -0
- package/dist/docs/methods/DEEP_CURRENT.md +184 -0
- package/dist/docs/methods/DEVOPS_ENGINEER.md +295 -0
- package/dist/docs/methods/FIELD_MEDIC.md +261 -0
- package/dist/docs/methods/FORGE_ARTIST.md +108 -0
- package/dist/docs/methods/FORGE_KEEPER.md +268 -0
- package/dist/docs/methods/GAUNTLET.md +344 -0
- package/dist/docs/methods/GROWTH_STRATEGIST.md +466 -0
- package/dist/docs/methods/HEARTBEAT.md +168 -0
- package/dist/docs/methods/MCP_INTEGRATION.md +139 -0
- package/dist/docs/methods/MUSTER.md +148 -0
- package/dist/docs/methods/PRD_GENERATOR.md +186 -0
- package/dist/docs/methods/PRODUCT_DESIGN_FRONTEND.md +250 -0
- package/dist/docs/methods/QA_ENGINEER.md +337 -0
- package/dist/docs/methods/RELEASE_MANAGER.md +145 -0
- package/dist/docs/methods/SECURITY_AUDITOR.md +320 -0
- package/dist/docs/methods/SUB_AGENTS.md +335 -0
- package/dist/docs/methods/SYSTEMS_ARCHITECT.md +171 -0
- package/dist/docs/methods/TESTING.md +359 -0
- package/dist/docs/methods/THUMPER.md +175 -0
- package/dist/docs/methods/TIME_VAULT.md +120 -0
- package/dist/docs/methods/TREASURY.md +184 -0
- package/dist/docs/methods/TROUBLESHOOTING.md +265 -0
- package/dist/docs/patterns/README.md +52 -0
- package/dist/docs/patterns/ad-billing-adapter.ts +537 -0
- package/dist/docs/patterns/ad-platform-adapter.ts +421 -0
- package/dist/docs/patterns/ai-classifier.ts +195 -0
- package/dist/docs/patterns/ai-eval.ts +272 -0
- package/dist/docs/patterns/ai-orchestrator.ts +341 -0
- package/dist/docs/patterns/ai-router.ts +194 -0
- package/dist/docs/patterns/ai-tool-schema.ts +237 -0
- package/dist/docs/patterns/api-route.ts +241 -0
- package/dist/docs/patterns/backtest-engine.ts +499 -0
- package/dist/docs/patterns/browser-review.ts +292 -0
- package/dist/docs/patterns/combobox.tsx +300 -0
- package/dist/docs/patterns/component.tsx +262 -0
- package/dist/docs/patterns/daemon-process.ts +338 -0
- package/dist/docs/patterns/data-pipeline.ts +297 -0
- package/dist/docs/patterns/database-migration.ts +466 -0
- package/dist/docs/patterns/e2e-test.ts +629 -0
- package/dist/docs/patterns/error-handling.ts +312 -0
- package/dist/docs/patterns/execution-safety.ts +601 -0
- package/dist/docs/patterns/financial-transaction.ts +342 -0
- package/dist/docs/patterns/funding-plan.ts +462 -0
- package/dist/docs/patterns/game-entity.ts +137 -0
- package/dist/docs/patterns/game-loop.ts +113 -0
- package/dist/docs/patterns/game-state.ts +143 -0
- package/dist/docs/patterns/job-queue.ts +225 -0
- package/dist/docs/patterns/kongo-integration.ts +164 -0
- package/dist/docs/patterns/middleware.ts +363 -0
- package/dist/docs/patterns/mobile-screen.tsx +139 -0
- package/dist/docs/patterns/mobile-service.ts +167 -0
- package/dist/docs/patterns/multi-tenant.ts +382 -0
- package/dist/docs/patterns/oauth-token-lifecycle.ts +223 -0
- package/dist/docs/patterns/outbound-rate-limiter.ts +260 -0
- package/dist/docs/patterns/prompt-template.ts +195 -0
- package/dist/docs/patterns/revenue-source-adapter.ts +311 -0
- package/dist/docs/patterns/service.ts +224 -0
- package/dist/docs/patterns/sse-endpoint.ts +118 -0
- package/dist/docs/patterns/stablecoin-adapter.ts +511 -0
- package/dist/docs/patterns/third-party-script.ts +68 -0
- package/dist/scripts/thumper/gom-jabbar.sh +241 -0
- package/dist/scripts/thumper/relay.sh +610 -0
- package/dist/scripts/thumper/scan.sh +359 -0
- package/dist/scripts/thumper/thumper.sh +190 -0
- package/dist/scripts/thumper/water-rings.sh +76 -0
- package/dist/scripts/voidforge.js +1 -1
- package/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# SUB-AGENT ORCHESTRATOR
|
|
2
|
+
## System Protocol · Orchestrates: All Agents
|
|
3
|
+
## The Danger Room
|
|
4
|
+
|
|
5
|
+
> *"Assemble."*
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Parallelize development across multiple Claude Code sessions. Each session runs a specialist. The orchestrator delegates, resolves conflicts, integrates changes.
|
|
10
|
+
|
|
11
|
+
**All orchestration uses the build journal.** Every delegation, handoff, and resolution is logged to `/logs/handoffs.md`. Agents read journal files to recover context. See `/docs/methods/BUILD_JOURNAL.md`.
|
|
12
|
+
|
|
13
|
+
**Full character roster: `/docs/NAMING_REGISTRY.md`** — 260+ named characters across 9 universes. No duplicates allowed.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## The Full Roster
|
|
18
|
+
|
|
19
|
+
| Lead | Universe | Domain | Method Doc |
|
|
20
|
+
|------|----------|--------|-----------|
|
|
21
|
+
| **Galadriel** | Tolkien | Frontend, UX, Design | `PRODUCT_DESIGN_FRONTEND.md` |
|
|
22
|
+
| **Stark** | Marvel | Backend Engineering | `BACKEND_ENGINEER.md` |
|
|
23
|
+
| **Batman** | DC Comics | QA & Bug Hunting | `QA_ENGINEER.md` |
|
|
24
|
+
| **Kenobi** | Star Wars | Security Auditing | `SECURITY_AUDITOR.md` |
|
|
25
|
+
| **Picard** | Star Trek | Systems Architecture | `SYSTEMS_ARCHITECT.md` |
|
|
26
|
+
| **Kusanagi** | Anime | DevOps & Infrastructure | `DEVOPS_ENGINEER.md` |
|
|
27
|
+
| **Coulson** | Marvel | Release Management | `RELEASE_MANAGER.md` |
|
|
28
|
+
| **Bombadil** | Tolkien | Forge Sync & Updates | `FORGE_KEEPER.md` |
|
|
29
|
+
| **Chani** | Dune | Worm Rider (Telegram Bridge) | `THUMPER.md` |
|
|
30
|
+
| **Fury** | Marvel | The Initiative (Full Pipeline) | `ASSEMBLER.md` |
|
|
31
|
+
|
|
32
|
+
### Default Sub-Agents
|
|
33
|
+
|
|
34
|
+
**Tolkien:** Radagast, Aragorn, Legolas, Samwise, Elrond, Arwen, Gimli, Bilbo + 12 more
|
|
35
|
+
**Marvel:** Rogers, Banner, Strange, Barton, Romanoff, Thor, Hill, Loki + 17 more
|
|
36
|
+
**DC Comics:** Oracle, Red Hood, Alfred, Lucius, Nightwing, Deathstroke, Constantine + 18 more
|
|
37
|
+
**Star Wars:** Yoda, Windu, Ahsoka, Leia, Rex, Padmé, Chewie, Maul + 16 more
|
|
38
|
+
**Star Trek:** Spock, Scotty, Uhura, La Forge, Data + 19 more
|
|
39
|
+
**Dune:** Stilgar, Thufir, Idaho, Mohiam + 16 more
|
|
40
|
+
**Anime:** Senku, Levi, Spike, Bulma, Vegeta, Goku + 66 more (from Tom's watch list)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## When to Deploy Which Agent
|
|
45
|
+
|
|
46
|
+
| Task | Primary | May Also Involve |
|
|
47
|
+
|------|---------|-----------------|
|
|
48
|
+
| New frontend feature | Galadriel | Stark (API), Picard (if architectural) |
|
|
49
|
+
| New API endpoint | Stark | Galadriel (UI), Batman (testing) |
|
|
50
|
+
| Fix a bug | Batman | Stark or Galadriel (depending on location) |
|
|
51
|
+
| Security audit | Kenobi | All (review their domains) |
|
|
52
|
+
| Architecture decision | Picard | Stark, Kusanagi (implementation) |
|
|
53
|
+
| Deploy to production | Kusanagi | Batman (smoke test), Kenobi (security) |
|
|
54
|
+
| Performance issue | Stark or Galadriel | Picard (if arch), Kusanagi (if infra) |
|
|
55
|
+
| Database migration | Stark (Banner) | Picard (Spock review), Batman (verify) |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Scope Boundaries (Example)
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Galadriel: /src/app/, /src/components/, /src/styles/, /src/hooks/
|
|
63
|
+
Stark: /src/lib/, /src/workers/, /src/types/, /prisma/
|
|
64
|
+
Batman: Cross-cutting (reads everything, writes fixes)
|
|
65
|
+
Kenobi: Cross-cutting (reads everything, writes fixes)
|
|
66
|
+
Picard: /docs/ (ADRs, architecture), reviews all schemas
|
|
67
|
+
Kusanagi: /scripts/, config files, /docs/RUNBOOK.md
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Cross-cutting changes (shared types, DB schema, utils) require orchestrator approval.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Conflict Resolution
|
|
75
|
+
|
|
76
|
+
### Single-domain conflicts
|
|
77
|
+
1. **Data/schema** → Picard decides
|
|
78
|
+
2. **Security vs UX** → Kenobi decides (security wins default)
|
|
79
|
+
3. **Performance vs readability** → Stark decides (Picard review)
|
|
80
|
+
4. **Design vs implementation** → Galadriel decides (UX wins default)
|
|
81
|
+
|
|
82
|
+
### Multi-agent conflicts (two agents disagree, both are right)
|
|
83
|
+
1. **Check the PRD.** If the PRD specifies a requirement, it wins. No agent overrides the PRD.
|
|
84
|
+
2. **If the PRD is silent:** Both agents present trade-offs to the user with a recommendation. Include: option A (agent 1's approach), option B (agent 2's approach), consequences of each, recommended path.
|
|
85
|
+
3. **Document the resolution** as an ADR in `/docs/adrs/` and log to `/logs/decisions.md`.
|
|
86
|
+
|
|
87
|
+
### Common multi-agent conflicts
|
|
88
|
+
|
|
89
|
+
| Conflict | Resolution |
|
|
90
|
+
|----------|-----------|
|
|
91
|
+
| Picard (microservices) vs Kusanagi (VPS can't support it) | Picard adjusts architecture to match real infrastructure constraints |
|
|
92
|
+
| Stark (convenience) vs Kenobi (security) | Security wins. Find the simplest *secure* approach. |
|
|
93
|
+
| Galadriel (UX ideal) vs Stark (backend limitation) | Present trade-offs. If UX is degraded, document as tech debt. |
|
|
94
|
+
| Batman (needs refactor to fix) vs timeline | Fix the bug with smallest safe change. Log the deeper refactor as tech debt. |
|
|
95
|
+
| Picard (ideal architecture) vs PRD (feature requires compromise) | PRD wins. Picard documents the compromise as an ADR with future migration path. |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Agent Activity Logging (Danger Room Ticker)
|
|
100
|
+
|
|
101
|
+
When dispatching an agent via the Agent tool, append a JSONL entry to `logs/agent-activity.jsonl` **before** the tool call:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{"agent":"Picard","task":"scanning architecture","timestamp":"2026-03-22T12:00:00Z"}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This powers the Danger Room's live agent ticker. The wizard server watches this file and broadcasts events via WebSocket. Without these entries, the ticker shows "Sisko standing by..." permanently.
|
|
108
|
+
|
|
109
|
+
**Rules:**
|
|
110
|
+
- One line per agent dispatch (JSON, no pretty-printing)
|
|
111
|
+
- `agent` field uses the character name (Picard, Batman, Galadriel — not "Agent 1")
|
|
112
|
+
- `task` field is a 3-5 word summary of the agent's assignment
|
|
113
|
+
- Truncate the file at the start of each `/campaign` or `/gauntlet` run (historical entries from previous sessions are not meaningful for the live ticker)
|
|
114
|
+
- If the file exceeds 1MB, truncate to the most recent 100 entries
|
|
115
|
+
|
|
116
|
+
This is **methodology-driven logging**, not hook-driven. Hooks cannot extract agent identity from tool input — the orchestrator must write the log entry explicitly. (Field report #128, architectural review)
|
|
117
|
+
|
|
118
|
+
## Delegation Template
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
AGENT: [Name]
|
|
122
|
+
TASK: [One sentence]
|
|
123
|
+
SCOPE: [Files/directories]
|
|
124
|
+
CONTEXT: [What to know from other agents]
|
|
125
|
+
ACCEPTANCE: [What "done" looks like]
|
|
126
|
+
CONSTRAINTS: [What NOT to touch]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Response Template
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
AGENT: [Name]
|
|
133
|
+
STATUS: Done / Blocked / Needs Review
|
|
134
|
+
CHANGES: [Files modified, one-line each]
|
|
135
|
+
DECISIONS: [Non-obvious choices with rationale]
|
|
136
|
+
ASSUMPTIONS: [Needs confirmation]
|
|
137
|
+
RISKS: [Side effects]
|
|
138
|
+
REGRESSION: [How to verify]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Agent Debate Protocol
|
|
142
|
+
|
|
143
|
+
When two agents disagree on a finding, run a structured debate instead of listing both opinions:
|
|
144
|
+
|
|
145
|
+
1. **Agent A states the finding** with evidence (file, line, reasoning)
|
|
146
|
+
2. **Agent B responds** with counter-evidence or alternative interpretation
|
|
147
|
+
3. **Agent A rebuts** — addresses Agent B's counter-evidence
|
|
148
|
+
4. **Arbiter decides** — Picard (for architecture), Batman (for QA), Kenobi (for security), or the user
|
|
149
|
+
|
|
150
|
+
**3 exchanges maximum.** If not resolved after the rebuttal, the arbiter decides.
|
|
151
|
+
|
|
152
|
+
**Log the debate** as an ADR in `/docs/adrs/` with both positions, evidence, and the decision. This is better than a one-line finding because future developers can understand WHY the decision was made.
|
|
153
|
+
|
|
154
|
+
**When to trigger:** When `/review`, `/qa`, or `/security` produces conflicting findings on the same code — e.g., Spock says "this is correct" and Kenobi says "this is a vulnerability." Don't debate on matters of fact (a missing import is a missing import). Debate on matters of judgment (is this pattern secure enough? is this abstraction worth the complexity?).
|
|
155
|
+
|
|
156
|
+
## Custom Sub-Agents
|
|
157
|
+
|
|
158
|
+
Users can create project-specific sub-agents that carry domain knowledge. Define them in `docs/CUSTOM_AGENTS.md`:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
### Jarvis-Tailwind
|
|
162
|
+
**Universe:** Marvel | **Reports to:** Galadriel
|
|
163
|
+
**Domain:** Tailwind CSS v4 configuration, PostCSS, source() directive
|
|
164
|
+
**Behavioral directives:** Always check for v3→v4 migration issues. Verify @config path.
|
|
165
|
+
**Reference docs:** tailwindcss.com/docs/upgrade-guide
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Rules:**
|
|
169
|
+
- Custom agents run alongside built-in agents, not instead of them
|
|
170
|
+
- Names must NOT collide with the naming registry — check `docs/NAMING_REGISTRY.md` before creating
|
|
171
|
+
- Use the format `[BaseName]-[Specialty]` to avoid collisions (e.g., `Jarvis-Tailwind`, not just `Jarvis`)
|
|
172
|
+
- Custom agents are loaded during Phase 0 Orient when the orchestrator reads `docs/CUSTOM_AGENTS.md`
|
|
173
|
+
- They participate in the review rounds of their lead's domain (e.g., a Galadriel custom agent runs during UX reviews)
|
|
174
|
+
|
|
175
|
+
**When to create a custom agent:** When a project has a domain-specific pattern that the built-in agents miss repeatedly. If the same lesson appears 3+ times in LESSONS.md about the same technology, that's a signal for a custom agent rather than more method doc checklist items.
|
|
176
|
+
|
|
177
|
+
## Naming Rule
|
|
178
|
+
|
|
179
|
+
When spinning up agents, check NAMING_REGISTRY.md AND `docs/CUSTOM_AGENTS.md` (if it exists). First claim wins. No duplicates across sessions. Log active names.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Single-Session Parallelism (Agent Tool)
|
|
184
|
+
|
|
185
|
+
Claude Code's built-in Agent tool can run sub-agents within a single session. Use this for parallelizing independent work without separate terminal windows.
|
|
186
|
+
|
|
187
|
+
### When to Use the Agent Tool
|
|
188
|
+
|
|
189
|
+
| Situation | Approach |
|
|
190
|
+
|-----------|----------|
|
|
191
|
+
| Independent audits (Oracle + Red Hood + Alfred) | Parallel agents — no dependencies |
|
|
192
|
+
| Independent reviews (Spock schema + Uhura integrations) | Parallel agents — no dependencies |
|
|
193
|
+
| Sequential dependencies (schema → API → UI) | Sequential — each depends on previous |
|
|
194
|
+
| Cross-cutting changes (shared types, DB schema) | Sequential — conflict risk |
|
|
195
|
+
|
|
196
|
+
### Agent Tool Pattern
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
Use the Agent tool to run these in parallel:
|
|
200
|
+
- Agent 1 (Oracle): Scan /src/lib/ for logic flaws, missing awaits, type mismatches
|
|
201
|
+
- Agent 2 (Red Hood): Test all API endpoints with malformed inputs
|
|
202
|
+
- Agent 3 (Alfred): Run npm audit and review package.json dependencies
|
|
203
|
+
- Agent 4 (Deathstroke): Adversarial probing — bypass validations, exploit business logic
|
|
204
|
+
- Agent 5 (Constantine): Hunt cursed code — dead branches, impossible conditions
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Each agent runs in its own context, reports back, and results are synthesized by the lead agent.
|
|
208
|
+
|
|
209
|
+
### Double-Pass Review Pattern
|
|
210
|
+
|
|
211
|
+
With 1M context, review phases use a double-pass pattern to catch fix-induced regressions:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
Pass 1 (parallel): All review agents analyze → findings
|
|
215
|
+
Fix batch: Resolve all critical/high findings
|
|
216
|
+
Pass 2 (parallel): Verification agents re-probe fixed areas → confirm
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
This pattern applies to:
|
|
220
|
+
- Batman's QA (Nightwing + Red Hood + Deathstroke re-verify)
|
|
221
|
+
- Galadriel's UX (Samwise + Radagast re-verify)
|
|
222
|
+
- Kenobi's Security (Maul re-probes remediations)
|
|
223
|
+
|
|
224
|
+
**Important distinction:** The Agent tool enables **parallel analysis**, not parallel coding. Sub-agents return text findings — the lead agent then implements code changes sequentially. This is still faster than sequential analysis, but don't expect parallel file edits.
|
|
225
|
+
|
|
226
|
+
### Multi-Session Parallelism (Separate Terminals)
|
|
227
|
+
|
|
228
|
+
For larger projects where agents need to make code changes simultaneously, use separate Claude Code sessions in different terminal windows. Each session works on separate files within defined scope boundaries.
|
|
229
|
+
|
|
230
|
+
**Git coordination for multi-session:** Each session works on a feature branch. Merge to main after verification. If two sessions modify the same file, resolve conflicts before proceeding.
|
|
231
|
+
|
|
232
|
+
**Rule of thumb:** Read-only analysis → Agent tool (parallel). Code changes on separate files → separate sessions (parallel). Code changes on same files → single session (sequential).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Parallel Agent Coordination
|
|
237
|
+
|
|
238
|
+
When launching parallel background agents that modify overlapping concerns, the orchestrator MUST specify:
|
|
239
|
+
1. **Schema ownership:** Only ONE agent may modify shared schemas (Prisma, SQL migrations, TypeScript interfaces). Other agents consume the schema, they don't change it.
|
|
240
|
+
2. **Naming conventions:** Specify casing and format for shared values (e.g., "tab values are lowercase", "enum values are UPPER_SNAKE"). Agents working in isolation will choose different conventions.
|
|
241
|
+
3. **Required fields:** List fields that MUST appear in shared data shapes (e.g., "all user selects must include isAnonymous"). Otherwise each agent cherry-picks different fields.
|
|
242
|
+
|
|
243
|
+
Without this lock, ~30% of cross-agent MUST FIX findings are convention conflicts, not logic bugs. (Field report #33)
|
|
244
|
+
|
|
245
|
+
### Mode Instructions Must Replace, Not Append
|
|
246
|
+
|
|
247
|
+
When an AI system has modal behavior (e.g., different output types, deck modes, project types), each mode's instructions must COMPLETELY REPLACE the default instructions — not append a footnote. A one-line override ("no scrolling") gets ignored when the default 11-section architecture contradicts it. Each mode needs its own complete specification. (Field report #27: one-line mode instructions were ignored because they contradicted the default architecture.)
|
|
248
|
+
|
|
249
|
+
## Parallel Agent Standard (ADR-036)
|
|
250
|
+
|
|
251
|
+
**All heavy work MUST be dispatched to sub-agents. The main thread is an orchestrator, not a worker.**
|
|
252
|
+
|
|
253
|
+
Proven in production: a full `/assemble --muster` (11 phases, 15+ agents) ran entirely through background sub-agents. Context stayed at 15-25% (vs 80%+ inline). 3x faster review phases. Better findings from parallel perspectives. (Field report #270)
|
|
254
|
+
|
|
255
|
+
### Main Thread Responsibilities
|
|
256
|
+
|
|
257
|
+
| Does | Does NOT |
|
|
258
|
+
|---|---|
|
|
259
|
+
| Plan agent dispatch | Read source files |
|
|
260
|
+
| Launch agents with structured briefs | Analyze code inline |
|
|
261
|
+
| Triage agent results | Write/edit source files directly |
|
|
262
|
+
| Make decisions at gates | Generate findings from raw code |
|
|
263
|
+
| Track status, report to user | Do work an agent could do |
|
|
264
|
+
| Git operations (commit, push) | Launch agent-to-agent dispatch |
|
|
265
|
+
|
|
266
|
+
### Standard Agent Brief
|
|
267
|
+
|
|
268
|
+
Every agent launch MUST include a structured brief:
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
AGENT: [Name] ([Universe])
|
|
272
|
+
ROLE: [One sentence]
|
|
273
|
+
MISSION: [One sentence]
|
|
274
|
+
SCOPE:
|
|
275
|
+
READ: [files/directories]
|
|
276
|
+
WRITE: [files] or NONE (read-only)
|
|
277
|
+
CONTEXT: [2-5 sentences from prior phases — NOT raw file contents]
|
|
278
|
+
DELIVERABLE FORMAT: [findings-table | change-report | position-statement | build-report]
|
|
279
|
+
CONSTRAINTS: [list]
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Structured Deliverables (mandatory)
|
|
283
|
+
|
|
284
|
+
| Agent Type | Deliverable |
|
|
285
|
+
|---|---|
|
|
286
|
+
| Review / QA / Security | Findings Table: severity, file:line, finding, fix recommendation |
|
|
287
|
+
| Fix agents | Change Report: finding ref, file, what changed, verified |
|
|
288
|
+
| Architecture / Council | Position Statement: assessment, concerns, sign-off |
|
|
289
|
+
| Build agents | Build Report: files created/modified, tests added, decisions made |
|
|
290
|
+
|
|
291
|
+
### Concurrency Rules
|
|
292
|
+
|
|
293
|
+
- **Max 3 concurrent agents** (hard cap — prevents context thrashing)
|
|
294
|
+
- Batch into waves when >3 agents needed
|
|
295
|
+
- **No two concurrent agents may write to the same file** — partition by domain or concern
|
|
296
|
+
- Read-only agents can run in parallel without restriction
|
|
297
|
+
- Partition strategies: by domain (frontend/backend), by concern (security/UX), or read-only
|
|
298
|
+
|
|
299
|
+
### Context Passing Between Phases
|
|
300
|
+
|
|
301
|
+
- Pass **findings summaries** between phases, not raw file contents
|
|
302
|
+
- The orchestrator distills what matters for the next phase
|
|
303
|
+
- Each agent gets only the context it needs, not the full conversation history
|
|
304
|
+
|
|
305
|
+
### Orchestration Loop
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
PLAN → LAUNCH → WAIT → TRIAGE → DECIDE → REPORT → NEXT
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Command-Level Dispatch Specs
|
|
312
|
+
|
|
313
|
+
| Command | Main Thread | Agents | Parallelism |
|
|
314
|
+
|---|---|---|---|
|
|
315
|
+
| `/review` | Partition files, triage findings | 2-3 review agents per round, fix agents | Domain-parallel reads, sequential fixes |
|
|
316
|
+
| `/security` | Route findings, manage fixes | Kenobi (full audit), Maul (re-probe) | Sequential (Maul needs Kenobi's fixes) |
|
|
317
|
+
| `/qa` | Triage bugs, prioritize | Batman QA + Batman Test | Parallel (different focus) |
|
|
318
|
+
| `/assemble` | Full pipeline orchestration | ALL phases dispatched | Wave-batched per phase |
|
|
319
|
+
| `/gauntlet` | Round management | 5-8 agents per round | Waves of 3 |
|
|
320
|
+
| `/build` | Phase sequencing | Build agents per mission | 2-3 parallel when independent |
|
|
321
|
+
|
|
322
|
+
### Exception: Trivial Operations
|
|
323
|
+
|
|
324
|
+
Do NOT dispatch for: <3 files, <10 lines of analysis, single-file edits, git operations, user-facing questions. The 10-second agent launch overhead exceeds the value for trivial ops.
|
|
325
|
+
|
|
326
|
+
## Anti-Patterns
|
|
327
|
+
|
|
328
|
+
1. Don't run all agents at once on fresh codebase. Start Picard + Stark, layer others.
|
|
329
|
+
2. Don't let agents refactor outside scope.
|
|
330
|
+
3. Don't skip handoff checklist.
|
|
331
|
+
4. Don't ignore conflicts between agents on same file.
|
|
332
|
+
5. Don't forget Batman. Every significant change gets QA.
|
|
333
|
+
6. Don't use parallel agents for work that touches the same files — merge conflicts waste more time than sequential work.
|
|
334
|
+
7. **Don't do inline analysis when an agent could do it.** Reading 50 files fills context with raw code instead of synthesized findings. Dispatch to an agent, get back a findings table. (Field report #270)
|
|
335
|
+
8. **Don't let agents dispatch other agents.** The main thread is the hub. Agent-to-agent dispatch creates coordination chaos.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# SYSTEMS ARCHITECT
|
|
2
|
+
## Lead Agent: **Picard** · Sub-agents: Star Trek Universe
|
|
3
|
+
|
|
4
|
+
> *"Make it so."*
|
|
5
|
+
|
|
6
|
+
## Identity
|
|
7
|
+
|
|
8
|
+
**Picard** operates above implementation — deciding *how* things should be built. Decisive, strategic, allergic to unnecessary complexity. Documents decisions for the crew that follows.
|
|
9
|
+
|
|
10
|
+
**Behavioral directives:** Always choose the simplest architecture that meets the requirements for the next 12 months. Default to monolith — earn microservices with specific evidence. When reviewing a system, draw the data flow first — most architectural problems are data flow problems. Every non-obvious decision gets an ADR. When two approaches are roughly equal, pick the one that's easier to change later. Never let theoretical scale concerns drive decisions for a product that doesn't have users yet.
|
|
11
|
+
|
|
12
|
+
**See `/docs/NAMING_REGISTRY.md` for the full Star Trek character pool. When spinning up additional agents, pick the next unused name from the Star Trek pool.**
|
|
13
|
+
|
|
14
|
+
## Sub-Agent Roster
|
|
15
|
+
|
|
16
|
+
| Agent | Name | Role | Lens |
|
|
17
|
+
|-------|------|------|------|
|
|
18
|
+
| Data Architect | **Spock** | Schema design, data flow, storage, integrity | Logical. Precise. |
|
|
19
|
+
| Infrastructure | **Scotty** | Compute, networking, scaling, cost | Knows the limits. |
|
|
20
|
+
| Integration | **Uhura** | Service boundaries, API contracts, dependencies | Every connection is her domain. |
|
|
21
|
+
| Reliability | **La Forge** | Failure modes, redundancy, recovery, degradation | Keeps engines running. |
|
|
22
|
+
| Tech Debt | **Data** | Wrong abstractions, premature optimization, patterns | Analytical. Emotionless about cutting bad code. |
|
|
23
|
+
|
|
24
|
+
**Need more?** Pull from Star Trek pool: Riker, Worf, Sisko, Janeway, Seven, O'Brien, Pike. See NAMING_REGISTRY.md.
|
|
25
|
+
|
|
26
|
+
## Goal
|
|
27
|
+
|
|
28
|
+
Ensure architecture matches product needs. Identify structural risks and scaling cliffs before they're expensive. Decide, don't defer — one clear path, not a menu.
|
|
29
|
+
|
|
30
|
+
## When to Call Other Agents
|
|
31
|
+
|
|
32
|
+
| Situation | Hand off to |
|
|
33
|
+
|-----------|-------------|
|
|
34
|
+
| Decision impacts API/DB | **Stark** (Backend) |
|
|
35
|
+
| Decision impacts UI | **Galadriel** (Frontend) |
|
|
36
|
+
| Security implications | **Kenobi** (Security) |
|
|
37
|
+
| Infrastructure cost/deploy | **Kusanagi** (DevOps) |
|
|
38
|
+
| Need to verify decision didn't break things | **Batman** (QA) |
|
|
39
|
+
|
|
40
|
+
## Operating Rules
|
|
41
|
+
|
|
42
|
+
1. Decide, don't defer. One recommended path + one fallback.
|
|
43
|
+
2. Optimize for next 12 months.
|
|
44
|
+
3. Simplicity is a feature. Earn complexity.
|
|
45
|
+
4. Data outlives code. Get schema right.
|
|
46
|
+
5. Assume failure.
|
|
47
|
+
6. Document decisions, not just outcomes.
|
|
48
|
+
7. PRD decides *what*. Picard decides *how*.
|
|
49
|
+
8. Branch before destroying. Before any destructive git operation (`git rm`, `git revert`, `git reset`, `git checkout --`), verify the current branch with `git branch --show-current`. Never run destructive ops on `main` without explicit intent. (Field report #281)
|
|
50
|
+
|
|
51
|
+
## Conflict Checklist
|
|
52
|
+
|
|
53
|
+
Before building, scan the PRD frontmatter for structural contradictions. These are the common patterns that escape until late-stage reviews:
|
|
54
|
+
|
|
55
|
+
| Contradiction | Why It Breaks |
|
|
56
|
+
|--------------|---------------|
|
|
57
|
+
| `auth: yes` + `database: none` | Auth requires session storage |
|
|
58
|
+
| `payments: stripe` + `auth: no` | Payments need user identity for billing |
|
|
59
|
+
| WebSocket features + `deploy: cloudflare` | Cloudflare Workers don't support persistent connections |
|
|
60
|
+
| `workers: yes` + `deploy: vercel` | Vercel has no background process support |
|
|
61
|
+
| `database: postgres` + `deploy: static` | Static hosting can't run a database |
|
|
62
|
+
| `cache: redis` + `deploy: static` | Static hosting can't run Redis |
|
|
63
|
+
| `admin: yes` + `auth: no` | Admin panel without auth is an open backdoor |
|
|
64
|
+
| Email integration + no provider credentials | Email features will fail at runtime |
|
|
65
|
+
| `access: role-based` + per-item content gating | Role checks at route level don't enforce per-item access; need row-level or attribute-level authorization |
|
|
66
|
+
|
|
67
|
+
When running `/architect` or Phase 0.5 of `/build`, check every combination. Flag contradictions with specific resolution options (e.g., "Add `database: sqlite` for local auth, or switch to a stateless auth provider like Auth0").
|
|
68
|
+
|
|
69
|
+
## Sequence
|
|
70
|
+
|
|
71
|
+
**Step 0 — System Discovery:** System identity, component inventory, data flow diagram, dependency graph. **Load operational learnings:** If `docs/LEARNINGS.md` exists, read it before analysis. Prior decision rationale ("we rejected X because Y"), known API constraints, and root-caused issues prevent re-evaluation of settled questions and inform architectural recommendations. Flag entries with `verified` older than 90 days as potentially stale. (ADR-035)
|
|
72
|
+
|
|
73
|
+
**Step 1 — Parallel Analysis (Spock + Uhura + Worf):**
|
|
74
|
+
Use the Agent tool to run these in parallel — they are independent analysis tasks:
|
|
75
|
+
- **Spock's Schema Review:** Normalization, relationships, indexes match queries, nullable intentional, audit fields, PII isolation, data lifecycle, backup/recovery plan.
|
|
76
|
+
- **Uhura's Integration Review:** External service matrix (purpose, failure mode, fallback, cost, lock-in). API versions pinned. Responses validated. Abstraction layer exists. **Geographic test matrix:** If the system resolves locations (city names, regions, addresses), test against a 5-country matrix: JP (Tokyo — `administrative_area_level_1` is the city), US (California — state-level), UK (England — country constituent), FR (Île-de-France — region), AU (New South Wales — state). No single resolution rule works globally — Google Places `administrative_area_level_1` means fundamentally different things per country. Require database-aware fallback with fuzzy matching for location features. (Field report #259: city resolution required 3 iterations to handle geographic edge cases.)
|
|
77
|
+
- **Worf's Security Implications:** For each architectural decision (schema, service boundaries, data flows), flag security implications. "This schema stores PII in the same table as public data — separate." "This service boundary allows unauthenticated access to internal state." Different from Kenobi (who audits code); Worf audits *design*.
|
|
78
|
+
|
|
79
|
+
Synthesize findings from all three agents.
|
|
80
|
+
|
|
81
|
+
**Seldon Review (conditional — if AI architecture detected):** When the system includes AI/LLM components, Picard delegates AI-specific architecture review to Hari Seldon. Seldon evaluates: orchestration pattern appropriateness, model selection justification, prompt management strategy, and AI observability architecture. Findings feed into Picard's ADR process.
|
|
82
|
+
|
|
83
|
+
**Step 2 — Scotty's Service Architecture:** Boundary assessment, monolith vs services (default: monolith until specific reason to split), async vs sync decisions. Informed by Spock's schema, Uhura's integrations, and Worf's security flags.
|
|
84
|
+
|
|
85
|
+
**Step 3 — Scotty's Scaling Assessment + Torres's Performance Architecture:**
|
|
86
|
+
- **Scotty:** First bottleneck analysis. Three-tier plan: Tier 1 (single server), Tier 2 (vertical + optimization, 10x), Tier 3 (horizontal, 100x). Cost analysis.
|
|
87
|
+
- **Torres:** Performance architecture review — identifies N+1 query patterns in schema design, missing indexes for anticipated query patterns, connection pool sizing, caching strategy gaps. Catches performance problems *before code is written* (cheaper than finding them in QA).
|
|
88
|
+
|
|
89
|
+
**Step 4 — Parallel Analysis (La Forge + Data):**
|
|
90
|
+
Use the Agent tool to run these in parallel — they are independent analysis tasks:
|
|
91
|
+
- **La Forge's Failure Analysis:** What happens when each component fails. Graceful degradation rules. Recovery procedures.
|
|
92
|
+
- **Data's Tech Debt:** Wrong abstractions, missing abstractions, premature optimization, deferred decisions, dependency debt, documentation debt. Each with impact, risk, effort, urgency.
|
|
93
|
+
|
|
94
|
+
**Step 5 — ADRs + Riker's Decision Review:**
|
|
95
|
+
- **Picard writes ADRs:** Architecture Decision Records for every non-obvious choice. Status, context, decision, consequences, alternatives. **Each ADR must include an Implementation Scope field:** "Fully implemented in vX.Y" or "Deferred to vX.Y — no stub code committed." This prevents the pattern where architecture is decided, stubs are shipped as placeholders, and the real implementation never arrives. (Field report: v17.0 assessment found 3,500+ lines of infrastructure built on stub adapters that were "deferred" in v11.0 and never completed through v16.1.)
|
|
96
|
+
- **Riker reviews:** "Number One, does this hold up?" Riker challenges each ADR's trade-offs — are the alternatives truly worse? Are the consequences acceptable? Did we consider the second-order effects? **Riker also verifies the implementation scope is honest** — if an ADR says "fully implemented" but the code throws `'Implement...'`, that's a finding. Riker's review prevents architectural decisions made in a vacuum.
|
|
97
|
+
|
|
98
|
+
### `--adr-only` Lightweight Mode
|
|
99
|
+
|
|
100
|
+
When architecture work is deferred (e.g., designing auth that won't be built for months), skip the full parallel analysis (Steps 1-4) and go straight to Step 5:
|
|
101
|
+
|
|
102
|
+
1. Picard reads the relevant PRD sections
|
|
103
|
+
2. Picard writes ADRs capturing decisions, constraints, and alternatives
|
|
104
|
+
3. Riker reviews the ADRs
|
|
105
|
+
4. Deliverable: `/docs/adrs/` only — no ARCHITECTURE.md, no SCALING.md, no FAILURE_MODES.md
|
|
106
|
+
|
|
107
|
+
This saves ~100K tokens on work that's far from execution. The full bridge crew (Spock, Uhura, Worf, Tuvok, La Forge, Data) deploys when the architecture is about to be built, not when it's first discussed. ADRs capture the "why" cheaply; the detailed analysis can wait. (Field report #129: full 4-agent bridge crew deployed for auth architecture that was then deferred to Phase 4.)
|
|
108
|
+
|
|
109
|
+
### Extended Star Trek Roster (activate as needed)
|
|
110
|
+
|
|
111
|
+
**Janeway (Novel Architectures):** When the standard monolith doesn't fit — event-sourcing, CQRS, serverless, edge computing. Janeway navigates uncharted territory and proposes architectures the team hasn't tried before.
|
|
112
|
+
**Tuvok (Security Architecture):** Auth flow design, token storage strategy, session architecture, encryption at rest vs in transit decisions. Different from Worf (who flags security *implications*); Tuvok designs the security *architecture* from scratch.
|
|
113
|
+
**Crusher (System Diagnostics):** "What's the health of this codebase before we start?" Tech health assessment — test coverage, build time, dependency age, code complexity metrics. Baseline before changes.
|
|
114
|
+
|
|
115
|
+
**Dependency health (Crusher, conditional — if project has package.json/requirements.txt/Gemfile):**
|
|
116
|
+
- Run `npm outdated` (or equivalent) — flag packages with major version bumps
|
|
117
|
+
- Check Node.js/Python/Ruby version against EOL schedule
|
|
118
|
+
- Scan for known deprecation patterns in dependencies
|
|
119
|
+
- Flag any dependency not updated in >12 months
|
|
120
|
+
- If project hasn't been touched in >30 days, this check is mandatory before any build work
|
|
121
|
+
|
|
122
|
+
**Archer (Greenfield):** For new projects — proposes the initial directory structure, module boundaries, naming conventions, and bootstrap sequence. "Where no one has gone before."
|
|
123
|
+
**Kim (API Design):** REST conventions, consistent error shapes, pagination patterns, versioning strategy, GraphQL schema design. API surface architect.
|
|
124
|
+
**Pike (Bold Planning):** In `/campaign` — challenges Dax's mission ordering. "Should we attempt a harder mission first while context is fresh?" Bold decisions about sequencing.
|
|
125
|
+
|
|
126
|
+
## Architect-to-Campaign Handoff
|
|
127
|
+
|
|
128
|
+
When `/architect` produces a plan that will be executed via `/campaign`, offer to generate a PRD skeleton from the architecture deliverables. The architect's output (ADRs, component inventory, design decisions) maps directly to PRD sections: ADRs → Tech Stack + System Architecture, component inventory → Core Features, design decisions → Implementation phases. If the user says "build this" after an `/architect` session, route to `/campaign --plan` with the architect's output as input — don't restart the analysis from scratch. (Field report #116)
|
|
129
|
+
|
|
130
|
+
**Detecting campaign intent:** If the user invokes `/architect --plan` but their request describes a new product/feature (not a review of existing architecture), suggest `/campaign --plan` instead. Signs: "create a new page," "build a feature," "add a subdomain."
|
|
131
|
+
|
|
132
|
+
## Iterative PRD Evolution via `/architect --plan`
|
|
133
|
+
|
|
134
|
+
`/architect --plan` supports iterative PRD evolution — multiple rounds of architectural planning where the PRD itself is the deliverable being refined. This is a recognized workflow, not a workaround.
|
|
135
|
+
|
|
136
|
+
**How it works:** Each `/architect --plan` iteration analyzes the current PRD state, proposes structural improvements (phase ordering, dependency resolution, missing infrastructure, strategy validation), and produces a commit. The PRD evolves across 5-15+ commits before any code is written.
|
|
137
|
+
|
|
138
|
+
**When to use:** When the project domain is complex enough that a single PRD generation pass can't capture all architectural constraints — trading systems, multi-tenant platforms, real-time collaboration tools, systems with complex data pipelines.
|
|
139
|
+
|
|
140
|
+
**Commit discipline:** Each iteration commits the PRD changes separately with a descriptive message. The git history becomes the PRD evolution record — `git log docs/PRD.md` shows the reasoning arc. (Field report #126)
|
|
141
|
+
|
|
142
|
+
## Data Mutation Parity Check
|
|
143
|
+
|
|
144
|
+
When reviewing architecture, identify all endpoints/services that mutate the same data (same table, same store, same file). Verify they use identical safety mechanisms: locking strategy, transaction boundaries, version sync, validation rules. Drift between parallel mutation paths is the #1 source of data corruption in multi-endpoint applications. (Field report #102: inline-edit route was missing optimistic locking, default version sync, and atomic transactions that the chat service had — three rounds found three separate gaps in the same file.)
|
|
145
|
+
|
|
146
|
+
**How to check:** For each mutable entity, grep all write paths (POST/PUT/PATCH/DELETE). List the safety mechanisms each path uses. If any path is missing a mechanism that another path has, flag it.
|
|
147
|
+
|
|
148
|
+
## Security Tradeoff Register
|
|
149
|
+
|
|
150
|
+
When architecture requires accepting a known security risk (e.g., iframe sandbox weakening for UX, storing tokens in memory for operational continuity), document it as an ADR with explicit risk acceptance. Include: the tradeoff made, what is gained, what attack surface is expanded, what mitigations are in place, and who accepted the risk. This prevents the same finding from appearing in every future audit and reduces Gauntlet noise. (Field report #102: preview iframe `allow-scripts + allow-same-origin` sandbox escape was a known tradeoff but was never documented — flagged in every security pass.)
|
|
151
|
+
|
|
152
|
+
### Strategy Consolidation Check
|
|
153
|
+
|
|
154
|
+
When a system implements N parallel strategies for the same goal (payment providers, notification channels, API versions, deployment targets, content pipelines), periodically verify that each strategy still justifies its maintenance cost. If usage data shows one strategy handling 95%+ of traffic or value while the others sit idle or near-zero, the idle strategies are not "options" — they are dead code with maintenance burden.
|
|
155
|
+
|
|
156
|
+
**Data's checklist (add to Tech Debt analysis):**
|
|
157
|
+
- List every set of parallel implementations serving the same purpose
|
|
158
|
+
- Pull usage/value metrics for each (requests, revenue, active users — whatever applies)
|
|
159
|
+
- If one strategy dominates and the others have near-zero activity for 90+ days, recommend decommission with an ADR documenting why
|
|
160
|
+
- If a dormant strategy is kept for disaster recovery, document it explicitly as a cold standby with a test schedule — otherwise it rots silently
|
|
161
|
+
|
|
162
|
+
Parallel strategies that nobody uses still consume review time, test maintenance, dependency updates, and cognitive load. Decommissioning is not giving up — it is recognizing what the data already proved. (Field report #274)
|
|
163
|
+
|
|
164
|
+
## Deliverables
|
|
165
|
+
|
|
166
|
+
1. ARCHITECTURE.md
|
|
167
|
+
2. /docs/adrs/ directory
|
|
168
|
+
3. SCALING.md
|
|
169
|
+
4. TECH_DEBT.md
|
|
170
|
+
5. FAILURE_MODES.md
|
|
171
|
+
6. Recommendations backlog
|