@vpxa/aikit 0.1.213 → 0.1.215

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.
@@ -1,6 +1,6 @@
1
1
  var e=[{file:`architecture-review-prompt.md`,content:`# Architecture Review Prompt Template
2
2
 
3
- Use this template when dispatching **Architect-Reviewer-Alpha** and **Architect-Reviewer-Beta** for architecture review. Only needed when changes cross module boundaries, introduce new patterns, or modify shared infrastructure.
3
+ Use when dispatching **Architect-Reviewer-Alpha** and **Architect-Reviewer-Beta** for boundary, pattern, infra, or public API changes.
4
4
 
5
5
  ---
6
6
 
@@ -75,15 +75,14 @@ You are performing an architecture review. Focus on structural decisions, not co
75
75
 
76
76
  ## Usage Notes
77
77
 
78
- - **Only trigger architecture review when**: changes cross module boundaries, new patterns are introduced, shared infrastructure is modified, or public API surface changes
79
- - Both Alpha and Beta reviewers run in parallel for multi-model perspective
80
- - Architecture blockers are HIGH priority must resolve before merge
81
- - If both reviewers flag the same concern, it's almost certainly a real issue
78
+ - Trigger for boundary, pattern, infra, or API-surface changes
79
+ - Run Alpha and Beta in parallel
80
+ - Shared blocker from both reviewers = likely real issue
82
81
  `},{file:`code-quality-review-prompt.md`,content:`# Code Quality Review Prompt Template
83
82
 
84
- Use this template when dispatching **Code-Reviewer-Alpha** and **Code-Reviewer-Beta** for dual code quality review. Both reviewers get the same prompt different models catch different issues.
83
+ Use when dispatching **Code-Reviewer-Alpha** and **Code-Reviewer-Beta** for dual code review. Same prompt; different models catch different issues.
85
84
 
86
- This review runs as part of the code review stage. Reviewers gather evidence first; the FORGE gate runs only after code review and any conditional reviews complete.
85
+ Runs in code review stage. Gather evidence first; FORGE gate runs after code review and any conditional reviews.
87
86
 
88
87
  ---
89
88
 
@@ -165,17 +164,13 @@ You are performing a code review. Your job is to evaluate HOW the implementation
165
164
 
166
165
  ## Usage Notes
167
166
 
168
- - Run this during the code review stage, before any architecture/security review and before the FORGE gate
169
- - Both Alpha and Beta reviewers can use this template for multi-model cross-validation, or one reviewer can use the spec-alignment-focused template below
170
- - Combine findings from both reviewers before deciding on action
171
- - **Blocker** findings = REQUEST_CHANGES (must fix)
172
- - **Major** findings = usually REQUEST_CHANGES unless truly optional
173
- - **Minor/Nit** = APPROVE_WITH_SUGGESTIONS (fix in follow-up or ignore)
167
+ - Run before architecture/security review and before FORGE gate
168
+ - Use for dual review or pair with spec-review prompt
169
+ - Blocker = REQUEST_CHANGES
170
+ - Minor/Nit = APPROVE_WITH_SUGGESTIONS
174
171
  `},{file:`implementer-prompt.md`,content:`# Implementer Dispatch Prompt Template
175
172
 
176
- Use this template when dispatching **Implementer**, **Frontend**, or **Refactor** agents.
177
-
178
- Fill in the bracketed sections with task-specific content. The Orchestrator provides ALL context — the subagent should NOT need to search/explore.
173
+ Use when dispatching **Implementer**, **Frontend**, or **Refactor**. Provide all needed context; subagent should not search beyond scope.
179
174
 
180
175
  ---
181
176
 
@@ -259,14 +254,13 @@ Hit a wall and cannot proceed:
259
254
 
260
255
  ## Usage Notes
261
256
 
262
- - **Always paste actual code snippets** in §3 — use \`compact()\` or \`digest()\` to extract relevant context before crafting the prompt
263
- - **Keep scope tight** 1-3 files maximum per dispatch
264
- - **Include failing test output** if dispatching a bug fix
265
- - **For Frontend agent**: add design requirements, responsive breakpoints, component hierarchy
266
- - **For Refactor agent**: include before/after expectations, what specifically to clean up
257
+ - Paste actual code snippets in §3
258
+ - Keep scope to 1-3 files
259
+ - Include failing test output for bug fixes
260
+ - Add frontend or refactor-specific constraints when needed
267
261
  `},{file:`parallel-dispatch-example.md`,content:`# Parallel Dispatch Worked Example
268
262
 
269
- This example shows how the Orchestrator decomposes a feature into parallel tasks, crafts context for each subagent, and manages the batch through review.
263
+ Shows parallel feature decomposition and review flow.
270
264
 
271
265
  ---
272
266
 
@@ -278,30 +272,18 @@ This example shows how the Orchestrator decomposes a feature into parallel tasks
278
272
 
279
273
  ## Step 1: Scope Map & Decomposition
280
274
 
281
- Orchestrator runs \`scope_map({ task: "notification preferences" })\` and identifies:
282
-
283
- | Area | Files | Agent |
284
- |------|-------|-------|
285
- | Backend API | \`services/notification-prefs.service.ts\`, \`routes/notification-prefs.route.ts\` | Implementer |
286
- | Database | \`migrations/add-notification-prefs.ts\`, \`models/notification-prefs.model.ts\` | Implementer |
287
- | Frontend Page | \`pages/settings/notifications.tsx\`, \`components/NotificationToggle.tsx\` | Frontend |
288
- | Tests | \`__tests__/notification-prefs.test.ts\` | Implementer |
275
+ Orchestrator runs \`scope_map({ task: "notification preferences" })\`:
276
+ Backend API + DB → Implementer. Frontend page → Frontend. Tests → Implementer.
289
277
 
290
278
  ## Step 2: Independence Check (5-Question Checklist)
291
279
 
292
- | # | Question | Backend API + DB | Frontend Page |
293
- |---|----------|-----------------|---------------|
294
- | 1 | Same files? | \`services/\`, \`routes/\`, \`migrations/\`, \`models/\` | \`pages/\`, \`components/\` |
295
- | 2 | Shared state? | No — backend defines API contract | No — consumes API contract |
296
- | 3 | Execution order? | No — can define API while UI is built | No — can mock API response |
297
- | 4 | Shared new types? | Exports \`NotificationPrefs\` type | Imports same type |
298
- | 5 | Parallel-safe? | ✅ Yes — different directories | ✅ Yes — different directories |
280
+ Different files, no shared mutable state, no execution-order dependency. Shared type contract first.
299
281
 
300
- **Decision: PARALLEL** — But first define the shared type contract.
282
+ **Decision: PARALLEL**
301
283
 
302
284
  ## Step 3: Shared Context Prep
303
285
 
304
- Before dispatching, Orchestrator creates the shared contract:
286
+ Before dispatching, Orchestrator creates shared contract:
305
287
 
306
288
  \`\`\`typescript
307
289
  // Type contract — paste into BOTH agent prompts
@@ -398,31 +380,22 @@ STATUS PROTOCOL: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
398
380
 
399
381
  ## Step 5: Review Pipeline
400
382
 
401
- Both agents return DONE. Orchestrator runs the ordered review cycle:
402
-
403
- 1. **Code Review** (Alpha + Beta in parallel):
404
- - Alpha: PASS_WITH_NOTES — acceptance criteria met; add keyboard accessibility on toggles
405
- - Beta: APPROVE_WITH_SUGGESTIONS — extract validation schema to shared file
406
-
407
- 2. **Architecture Review** (not triggered — no boundary changes)
383
+ Both agents return DONE. Orchestrator reviews:
408
384
 
409
- 3. **Security Review** (not triggered no auth, crypto, or risky input handling)
410
-
411
- 4. **FORGE Gate**: \`evidence_map({ action: "gate" })\` → YIELD (all review evidence collected)
385
+ 1. **Code Review** (Alpha + Beta): PASS_WITH_NOTES + APPROVE_WITH_SUGGESTIONS
386
+ 2. **Architecture Review**: not triggered
387
+ 3. **Security Review**: not triggered
388
+ 4. **FORGE Gate**: \`evidence_map({ action: "gate" })\` → YIELD
412
389
 
413
390
  ## Step 6: Present Results
414
391
 
415
- Stop here and present the review findings and gate result before any commit or merge action.
392
+ Present review findings and gate result before commit or merge.
416
393
 
417
394
  ---
418
395
 
419
396
  ## Key Takeaways
420
397
 
421
- 1. **Define shared contracts FIRST** paste into all agent prompts
422
- 2. **Independence check takes 30 seconds** — prevents hours of merge conflicts
423
- 3. **Each agent gets ONLY its files** — focused context = better output
424
- 4. **Review happens before the gate** — code review first, then architecture/security (conditional), then FORGE
425
- 5. **FORGE gates at the end** — not between every step
398
+ Define contract first. Batch only independent work. Review before gate.
426
399
  `},{file:`SKILL.md`,content:`---
427
400
  name: multi-agents-development
428
401
  description: "Comprehensive patterns for orchestrating multiple AI agents in parallel development workflows. Covers task decomposition, parallel dispatch, context crafting, status handling, review pipelines, and recovery."
@@ -438,11 +411,9 @@ metadata:
438
411
 
439
412
  # Multi-Agent Development
440
413
 
441
- Comprehensive patterns for orchestrating multiple AI agents in parallel development workflows. Covers task decomposition, parallel dispatch, context crafting, status handling, review pipelines, and recovery.
442
-
443
- **Core Principle**: Dispatch multiple agents for focused tasks. Each subagent gets fresh, focused context with explicit scope — never inherited session state.
414
+ Patterns for parallel multi-agent work: decomposition, dispatch, context, status, review, recovery.
444
415
 
445
- Load this skill when orchestrating multi-agent work: planning parallel batches, crafting delegation prompts, handling implementer status, running review pipelines, or recovering from agent failures.
416
+ **Core Principle**: Dispatch focused agents with fresh context and explicit scope.
446
417
 
447
418
  ---
448
419
 
@@ -452,25 +423,18 @@ Load this skill when orchestrating multi-agent work: planning parallel batches,
452
423
 
453
424
  | Role | Agents | When to Use | Parallelizable |
454
425
  |------|--------|-------------|----------------|
455
- | **Orchestration** | Orchestrator, Planner | Workflow control, planning | No (sequential) |
456
- | **Implementation** | Implementer, Frontend, Refactor | Code creation/modification | Yes (disjoint files only) |
457
- | **Research** | Explorer, Researcher-Alpha/Beta/Gamma/Delta | Codebase exploration, decisions | Yes (always) |
458
- | **Review** | Code-Reviewer-Alpha/Beta, Architect-Reviewer-Alpha/Beta | Quality verification | Yes (always) |
459
- | **Diagnostics** | Debugger, Security | Issue tracing, vulnerability analysis | Yes (read-only) |
460
- | **Documentation** | Documenter | README, API docs, changelog | Yes (disjoint files) |
426
+ | **Orchestration** | Orchestrator, Planner | Plan/control | No |
427
+ | **Implementation** | Implementer, Frontend, Refactor | Code changes | Yes |
428
+ | **Review** | Code-Reviewer-Alpha/Beta, Architect-Reviewer-Alpha/Beta | Verify | Yes |
461
429
 
462
430
  ### Model Selection by Task Complexity
463
431
 
464
- Choose the **least powerful model that can handle the role**:
465
-
466
432
  | Complexity Signal | Model Tier | Example Agents |
467
433
  |-------------------|-----------|----------------|
468
- | Mechanical (rename, move, add field) | Fast model | Explorer (Gemini Flash) |
469
- | Standard (implement spec, write tests) | Mid-tier | Implementer (GPT-5.4), Refactor (GPT-5.4) |
470
- | Judgment-heavy (architecture, security, debug) | Strongest | Debugger (Opus 4.6), Security (Opus 4.6) |
471
- | Multi-model cross-validation | Mixed | Researcher-Alpha/Beta/Gamma/Delta (all different) |
434
+ | Mechanical (rename, move, add field) | Fast model | Explorer |
435
+ | Standard (implement spec, write tests) | Mid-tier | Implementer/Refactor |
472
436
 
473
- **Upgrade signal**: If an agent returns \`BLOCKED\` or \`DONE_WITH_CONCERNS\` on a task classified as "Standard", consider re-dispatching to a stronger model.
437
+ **Upgrade signal**: \`BLOCKED\` or \`DONE_WITH_CONCERNS\` on Standard task re-dispatch to stronger model.
474
438
 
475
439
  ---
476
440
 
@@ -481,36 +445,31 @@ Choose the **least powerful model that can handle the role**:
481
445
 
482
446
  ### Decomposition Checklist
483
447
 
484
- For each task, specify ALL of:
485
- - [ ] **Target files** — exact paths to create or modify
486
- - [ ] **Acceptance criteria** — what "done" looks like (testable)
487
- - [ ] **Agent assignment** — which agent handles this
488
- - [ ] **Dependencies** — which tasks must complete first (if any)
448
+ For each task, specify:
449
+ - [ ] **Target files** — exact paths
450
+ - [ ] **Acceptance criteria** — testable done state
451
+ - [ ] **Agent assignment** — who owns task
452
+ - [ ] **Dependencies** — prerequisite tasks
489
453
 
490
454
  ### Sizing Guide
491
455
 
492
456
  | Task Size | Files | Example | Agent |
493
457
  |-----------|-------|---------|-------|
494
- | **Micro** | 1 file | Add a utility function | Implementer |
495
- | **Small** | 1-2 files | New endpoint + test | Implementer |
496
- | **Standard** | 2-3 files | Feature with service + controller + test | Implementer |
497
- | **Too big** | 4+ files | **SPLIT IT** — decompose further | — |
458
+ | **Standard** | 2-3 files | Service + controller + test | Implementer |
498
459
 
499
460
  ### Splitting Strategies
500
- - **By layer**: Service logic (Implementer) + UI component (Frontend) + tests (Implementer)
501
- - **By feature boundary**: Auth endpoints (Implementer A) + Profile endpoints (Implementer B)
502
- - **By concern**: Data model changes (Implementer) + API route changes (Implementer) + UI updates (Frontend)
461
+ - **By layer**: Service + UI + tests
503
462
 
504
463
  ---
505
464
 
506
465
  ## §3 Independence Decision Tree
507
466
 
508
- Before marking tasks as parallel, walk this tree:
467
+ Before marking tasks parallel, walk this tree:
509
468
 
510
469
  \`\`\`
511
470
  Task A and Task B — can they run in parallel?
512
471
 
513
- ├─ Do they share ANY files? (create, modify, or delete the same file)
472
+ ├─ Do they share ANY files? (create, modify, or delete same file)
514
473
  │ ├─ YES → SEQUENTIAL (or merge into one task)
515
474
  │ └─ NO ↓
516
475
 
@@ -518,7 +477,7 @@ Task A and Task B — can they run in parallel?
518
477
  │ ├─ YES → SEQUENTIAL
519
478
  │ └─ NO ↓
520
479
 
521
- ├─ Does B need A's output? (B reads a file A creates, B uses A's new export)
480
+ ├─ Does B need A's output? (B reads file A creates, B uses A's new export)
522
481
  │ ├─ YES → SEQUENTIAL (A before B)
523
482
  │ └─ NO ↓
524
483
 
@@ -537,19 +496,14 @@ Task A and Task B — can they run in parallel?
537
496
 
538
497
  | Situation | Verdict | Why |
539
498
  |-----------|---------|-----|
540
- | Both import from same module (read-only) | ✅ Parallel | Reading shared code is fine |
541
- | Both add exports to same index file | ❌ Sequential | Concurrent index.ts edits will conflict |
542
- | A creates a type, B uses that type | ❌ Sequential | B depends on A's output |
543
- | Both modify different test files | ✅ Parallel | Disjoint file sets |
544
- | Both touch package.json | ❌ Sequential | Shared file |
545
- | A adds a route, B adds middleware | ⚠️ Check | If B's middleware affects A's route → sequential |
499
+ | Same shared import only | ✅ Parallel | Read-only |
500
+ | Same index/package file | ❌ Sequential | Shared edit |
546
501
 
547
502
  ### Integration Verification (after parallel batch completes)
548
503
 
549
- 1. **Conflict check**: Did any agent unexpectedly modify a file assigned to another agent?
550
- 2. **Import check**: Do all new cross-references resolve?
551
- 3. **Full suite**: \`check({})\` + \`test_run({})\` — everything must pass
552
- 4. **Spot check**: Manually verify at least one task's output matches acceptance criteria
504
+ 1. **Conflict check**: unexpected overlap?
505
+ 2. **Import check**: cross-references resolve?
506
+ 3. **Full suite**: \`check({})\` + \`test_run({})\`
553
507
 
554
508
  ---
555
509
 
@@ -558,9 +512,9 @@ Task A and Task B — can they run in parallel?
558
512
  ### Dispatch Rules
559
513
 
560
514
  1. **Max 4 concurrent file-modifying agents** per batch
561
- 2. **Read-only agents have no limit** — Explorer, Researcher*, Reviewer*, Security can always run in parallel
562
- 3. **Build dependency graph first** — phases with no dependencies MUST be batched together
563
- 4. **Never dispatch two implementers to the same file** — even different sections
515
+ 2. **Read-only agents have no limit** — Explorer, Researcher*, Reviewer*, Security
516
+ 3. **Build dependency graph first** — dependency-free phases batch together
517
+ 4. **Never dispatch two implementers to same file**
564
518
 
565
519
  ### Batch Strategy
566
520
 
@@ -580,21 +534,18 @@ Execution:
580
534
 
581
535
  | ❌ Don't | ✅ Do Instead |
582
536
  |----------|--------------|
583
- | Dispatch 6 implementers at once | Max 4, queue the rest |
584
- | Give one agent 10 files | Split into 3-4 focused tasks |
585
- | Let agents read the full plan | Give each agent ONLY its task context |
586
- | Retry same prompt on failure | Diagnose first, then re-prompt with fix |
587
- | Skip review after parallel batch | ALWAYS review + integration verify |
588
- | Inherit session context to subagent | Build fresh, focused context per dispatch |
537
+ | Dispatch 6 implementers at once | Max 4, queue rest |
538
+ | Give one agent 10 files | Split tasks |
539
+ | Skip review after batch | ALWAYS review + integrate |
589
540
 
590
541
  ---
591
542
 
592
543
  ## §5 Context Crafting Guide
593
544
 
594
545
  ### The Controller Principle
595
- > **The Orchestrator provides ALL context. Subagents never need to search for context themselves.**
546
+ > **The Orchestrator provides ALL context. Subagents never search for it.**
596
547
 
597
- Each subagent gets a fresh, self-contained prompt. No inherited session state. No "read the plan first."
548
+ Fresh prompt only. No inherited session state.
598
549
 
599
550
  ### The 6-Point Prompt Template
600
551
 
@@ -635,21 +586,13 @@ End with status: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
635
586
 
636
587
  | ✅ Include | ❌ Omit |
637
588
  |-----------|---------|
638
- | Exact file paths and code snippets | Full session history |
639
- | Acceptance criteria | Other agents' tasks |
640
- | Relevant conventions (from KB) | Unrelated architecture context |
641
- | Compact/digest of relevant files | Raw file contents of large files |
642
- | Error messages (if fixing a bug) | Previous failed attempts (unless relevant) |
643
- | FORGE tier and ceremony | Full FORGE protocol explanation |
589
+ | Exact file paths and snippets | Full session history |
644
590
 
645
591
  ### Context Size Budget
646
592
 
647
593
  | Task Complexity | Context Target | Approach |
648
594
  |-----------------|---------------|----------|
649
- | Micro (1 file) | ~500 tokens | Inline code snippet + goal |
650
- | Small (1-2 files) | ~1000 tokens | \`compact\` of target files + goal |
651
- | Standard (2-3 files) | ~2000 tokens | \`digest\` of related files + architectural context |
652
- | Complex (judgment-heavy) | ~3000 tokens | \`digest\` + relevant decisions from AI Kit |
595
+ | Standard (2-3 files) | ~2000 tokens | \`digest\` + architecture |
653
596
 
654
597
  ---
655
598
 
@@ -679,10 +622,9 @@ Orchestrator Subagent (fresh instance)
679
622
 
680
623
  ### Key Rules
681
624
 
682
- 1. **One subagent = one task**. Never reuse a subagent for a different task.
683
- 2. **Controller provides context**. The subagent's prompt contains everything it needs — it should NOT need to search/explore the codebase.
684
- 3. **Self-review before handoff**. Every implementer must complete the self-review checklist before declaring DONE.
685
- 4. **Status is mandatory**. Every subagent response MUST end with exactly ONE status code.
625
+ 1. **One subagent = one task**
626
+ 2. **Controller provides context**
627
+ 3. **Status is mandatory**
686
628
 
687
629
  ---
688
630
 
@@ -690,14 +632,14 @@ Orchestrator Subagent (fresh instance)
690
632
 
691
633
  ### Status Codes
692
634
 
693
- Every implementer (Implementer, Frontend, Refactor) MUST end their response with exactly ONE:
635
+ Every implementer (Implementer, Frontend, Refactor) MUST end response with exactly ONE:
694
636
 
695
637
  | Status | Meaning | Orchestrator Action |
696
638
  |--------|---------|-------------------|
697
- | **DONE** | All tasks complete, self-review passed | → Code review Conditional architecture/security review → \`evidence_map\` gate → Present results |
698
- | **DONE_WITH_CONCERNS** | Complete but flagging issues: [list] | → Surface concerns in review and as \`Assumed\` claims in \`evidence_map\` → Likely HOLD at gate |
699
- | **NEEDS_CONTEXT** | Cannot proceed without: [specific question] | → Provide missing context → Re-dispatch same task (counts toward **Max 2 retries** per task) |
700
- | **BLOCKED** | Hit a wall: [description] | → Diagnose (see below) |
639
+ | **DONE** | Complete, self-review passed | → Reviewarch/security if needed → \`evidence_map\` gate |
640
+ | **DONE_WITH_CONCERNS** | Complete, concerns raised | → Review + \`Assumed\` claims |
641
+ | **NEEDS_CONTEXT** | Missing info | → Add context → re-dispatch |
642
+ | **BLOCKED** | Cannot proceed | → Diagnose |
701
643
 
702
644
  ### BLOCKED Diagnosis Tree
703
645
 
@@ -722,10 +664,8 @@ Agent returned BLOCKED
722
664
 
723
665
  ### FORGE Composition
724
666
 
725
- Status protocol and FORGE are **independent but composable**:
726
-
727
- - **Status** = subjective agent telemetry ("I think I'm done")
728
- - **FORGE** = objective quality evidence ("the evidence says it's done")
667
+ - **Status** = agent telemetry
668
+ - **FORGE** = evidence-based quality gate
729
669
 
730
670
  \`\`\`
731
671
  DONE → proceed to code review → conditional architecture/security review → FORGE evidence_map → present results
@@ -736,7 +676,7 @@ BLOCKED → diagnose:
736
676
  resource/scope issue → re-plan, no FORGE
737
677
  \`\`\`
738
678
 
739
- **Critical rule**: Every \`DONE\` status MUST complete code review and any conditional architecture/security review BEFORE \`evidence_map({ action: "gate" })\`. No shortcuts.
679
+ **Critical rule**: Every \`DONE\` must complete code review and any conditional architecture/security review BEFORE \`evidence_map({ action: "gate" })\`.
740
680
 
741
681
  ---
742
682
 
@@ -766,26 +706,17 @@ Stage 5: FORGE Gate — evidence_map({ action: "gate" })
766
706
  └─ HARD_BLOCK → escalate to user
767
707
  \`\`\`
768
708
 
769
- Use \`check({})\` + \`test_run({})\` to gather evidence for reviewers, but they are not the gate.
709
+ Use \`check({})\` + \`test_run({})\` for reviewer evidence; not gate.
770
710
 
771
711
  ### Spec Alignment Dimension (for Code Reviewers)
772
712
 
773
- Both Code-Reviewer-Alpha and Code-Reviewer-Beta evaluate an explicit **Spec Alignment** dimension:
774
-
775
- 1. Does the implementation match the acceptance criteria from the task?
776
- 2. Are there over-builds (features not requested)?
777
- 3. Are there under-builds (requirements missed)?
778
- 4. Does the output match the expected file changes?
779
-
780
- This catches spec drift that automated tests might miss.
713
+ Check acceptance criteria, over-build, under-build, and expected file set.
781
714
 
782
715
  ### When to Skip Stages
783
716
 
784
717
  | Stage | Skip When |
785
718
  |-------|-----------|
786
- | Architecture Review | No new modules, no boundary changes, no new patterns |
787
- | Security Review | No auth, no crypto, no external input handling |
788
- | FORGE Gate | Floor-tier tasks only (simple, mechanical changes) |
719
+ | Architecture Review | No new modules/boundary changes/patterns |
789
720
 
790
721
  ---
791
722
 
@@ -793,16 +724,14 @@ This catches spec drift that automated tests might miss.
793
724
 
794
725
  ### Retry Policy
795
726
 
796
- - **Max 2 retries** per task after that, re-plan or escalate
797
- - Each retry MUST include the specific failure reason in the new prompt
798
- - Never retry with the same prompt — always add diagnostic context
727
+ **Max 2 retries** per task. Include failure reason. Never reuse same prompt.
799
728
 
800
729
  ### Loop Detection
801
730
 
802
731
  If an agent returns the same error/status 2+ times:
803
- 1. **STOP** — do not retry again
804
- 2. Check if the approach is fundamentally wrong
805
- 3. Consider: different agent, different model, different decomposition, or user escalation
732
+ 1. **STOP**
733
+ 2. Recheck approach
734
+ 3. Change agent, model, decomposition, or escalate
806
735
 
807
736
  ### Emergency Procedures
808
737
 
@@ -823,9 +752,9 @@ DOCUMENT → remember what went wrong, update plan
823
752
 
824
753
  | Signal | Action |
825
754
  |--------|--------|
826
- | Agent modified **2x more files** than planned | Pause, review before continuing |
827
- | Agent returns \`ESCALATE\` or \`BLOCKED\` repeatedly | Do NOT re-delegate unchanged. Diagnose first |
828
- | Agent's output contradicts the plan | Stop, compare with plan, re-align |
755
+ | Agent modified **2x more files** than planned | Pause, review |
756
+ | Agent returns \`ESCALATE\` or \`BLOCKED\` repeatedly | Diagnose before re-delegating |
757
+ | Agent's output contradicts plan | Stop, compare, re-align |
829
758
  | Tests that were passing now fail | Immediate rollback of that agent's changes |
830
759
 
831
760
  ---
@@ -836,41 +765,24 @@ DOCUMENT → remember what went wrong, update plan
836
765
 
837
766
  | ❌ Mistake | Why It Fails | ✅ Fix |
838
767
  |-----------|-------------|--------|
839
- | **Too broad scope** — "implement the auth system" | Agent lacks clear boundaries, produces sprawling changes | Split: "add JWT middleware to auth.ts" + "add login endpoint to routes.ts" |
840
- | **No constraints** "add a feature" | Agent invents architecture, conflicts with existing patterns | Include conventions, boundaries, existing patterns in prompt |
841
- | **Vague output** — "make it work" | No way to verify completion | Specific acceptance criteria: "endpoint returns 200 with {schema}" |
842
- | **Session context inheritance** — "continue from where we left off" | Subagent has stale/polluted context | Fresh prompt with 6-point template every time |
843
- | **Skipping reviews** — "it's a small change" | Small changes cause big regressions | ALWAYS run automated gate minimum |
844
- | **Parallel on shared files** — "both agents edit config.ts" | Merge conflicts, lost changes | Sequential, or merge into one task |
845
- | **Trusting the report** — "agent said DONE so it's done" | Agents are optimistic, miss edge cases | Automated gate + dual code review catches this |
846
- | **Brute-force retries** — same prompt beyond **Max 2 retries** per task | Repeating without diagnosis will not change the outcome | Diagnose, change approach, then retry within the limit |
847
- | **Orchestrator implements** — "just this one small fix" | Breaks the delegation contract, no review | ALWAYS delegate, no matter how small |
768
+ | **Too broad scope** | Sprawling changes | Split tasks |
769
+ | **Parallel on shared files** | Merge conflicts | Sequential or merge task |
848
770
 
849
771
  ### Red Flags in Agent Output
850
772
 
851
773
  | Flag | What It Means | Action |
852
774
  |------|--------------|--------|
853
- | Agent modified files outside its scope | Scope creep or misunderstanding | Rollback out-of-scope files, re-delegate with tighter constraints |
854
- | Agent added dependencies not in plan | Unauthorized architectural decision | Review necessity, likely rollback |
855
- | Agent skipped self-review checklist | Rushing, likely incomplete | Bounce back with checklist requirement |
856
- | Agent's DONE but tests fail | Didn't actually self-test | Bounce back with failing test output |
857
- | Agent asks questions in output instead of using NEEDS_CONTEXT | Misunderstands status protocol | Treat as NEEDS_CONTEXT, educate in next prompt |
775
+ | Files outside scope | Scope creep | Roll back, re-delegate tighter |
858
776
 
859
777
  ---
860
778
 
861
779
  ## §11 Flow Context Sharing
862
780
 
863
- ### The Problem
864
- Subagents start fresh — they don't know what the Orchestrator already analyzed. Without context sharing, each subagent redundantly re-reads and re-analyzes the same files, wasting tokens and time.
781
+ ### Flow Context Broker
865
782
 
866
- ### The Solution: Flow Context Broker
867
- The \`knowledge\` tool has flow-scoped context actions that enable automatic context sharing between the Orchestrator and subagents during a flow.
783
+ The \`knowledge\` tool supports flow-scoped context sharing.
868
784
 
869
- **How it works:**
870
- 1. **Auto-deposit** — The auto-knowledge interceptor captures results from \`search\`, \`file_summary\`, \`stratum_card\`, \`compact\`, \`blast_radius\`, and \`scope_map\` as flow-scoped context entries
871
- 2. **Role-filtered retrieval** — Before dispatching a subagent, the Orchestrator calls \`withdraw\` with a role profile to get relevant context
872
- 3. **Manual deposit** — Subagents deposit their own discoveries for later agents
873
- 4. **Cleanup** — On flow completion or reset, \`flush\` removes all flow context
785
+ **How it works:** auto-deposit captures tool output, Orchestrator calls \`withdraw\`, subagents can deposit findings, \`flush\` clears flow context.
874
786
 
875
787
  ### Orchestrator Workflow
876
788
 
@@ -882,7 +794,7 @@ knowledge({ action: 'withdraw', profile: '<role>', budget: 6000 })
882
794
  // Profiles: implementer, documenter, reviewer, researcher, debugger
883
795
  \`\`\`
884
796
 
885
- Include the withdrawn context in the subagent's prompt under "## 3. Architectural Context" (from the 6-point template in §5).
797
+ Paste withdrawn context into "## 3. Architectural Context" from §5.
886
798
 
887
799
  #### After All Work Completes
888
800
 
@@ -893,8 +805,6 @@ knowledge({ action: 'flush' })
893
805
 
894
806
  ### Subagent Deposit Pattern
895
807
 
896
- Subagents can deposit discoveries for later agents:
897
-
898
808
  \`\`\`
899
809
  // Subagent deposits a finding for future agents
900
810
  knowledge({ action: 'remember', scope: 'flow', title: 'API validation pattern', content: '...' })
@@ -902,26 +812,11 @@ knowledge({ action: 'remember', scope: 'flow', title: 'API validation pattern',
902
812
 
903
813
  ### Profile Filtering
904
814
 
905
- Each profile prioritizes different context types:
906
-
907
- | Profile | Priorities (highest first) | Use For |
908
- |---------|---------------------------|---------|
909
- | \`implementer\` | decisions, patterns, file-cards | Implementer, Frontend, Refactor |
910
- | \`documenter\` | decisions, step-summaries, analysis | Documenter |
911
- | \`reviewer\` | decisions, patterns, analysis | Code-Reviewer, Architect-Reviewer |
912
- | \`researcher\` | search-results, analysis, decisions | Researcher-Alpha/Beta/Gamma/Delta |
913
- | \`debugger\` | file-cards, analysis, search-results | Debugger |
815
+ Use \`implementer\` profile for Implementer/Frontend/Refactor tasks.
914
816
 
915
817
  ### Budget Management
916
818
 
917
- The \`budget\` parameter (default: 6000 chars) caps the total context returned. Adjust based on task complexity:
918
-
919
- | Task Type | Recommended Budget |
920
- |-----------|--------------------|
921
- | Micro (1 file fix) | 2000 |
922
- | Standard implementation | 6000 |
923
- | Complex multi-file | 10000 |
924
- | Research/investigation | 8000 |
819
+ \`budget\` caps returned context. Standard implementation: 6000.
925
820
 
926
821
  ### Integration with 6-Point Template
927
822
 
@@ -935,28 +830,21 @@ Update the prompt template from §5 to include flow context:
935
830
 
936
831
  ### Key Rules
937
832
 
938
- 1. **Always withdraw before dispatch** — even if context seems small, it prevents redundant work
939
- 2. **Flush on completion** — flow context is temporary; don't let it accumulate across flows
940
- 3. **Profile matters** — a reviewer needs different context than an implementer
941
- 4. **Budget caps prevent bloat** — large context confuses subagents, keep it focused
942
- 5. **Auto-deposit is passive** — it captures tool output automatically, no extra calls needed
833
+ 1. **Always withdraw before dispatch**
834
+ 2. **Flush on completion**
835
+ 3. **Profile matters**
943
836
 
944
837
  ## Prompt Template Reference
945
838
 
946
- Detailed prompt templates are provided as sidecar files:
947
-
948
839
  | Template | File | Use When |
949
840
  |----------|------|----------|
950
- | Implementer dispatch | [\`implementer-prompt.md\`](implementer-prompt.md) | Dispatching Implementer, Frontend, or Refactor agents |
951
- | Code review (spec alignment focus) | [\`spec-review-prompt.md\`](spec-review-prompt.md) | Bias one code reviewer toward acceptance criteria, scope, and contract alignment |
952
- | Code review (quality focus) | [\`code-quality-review-prompt.md\`](code-quality-review-prompt.md) | Bias one or both code reviewers toward maintainability, quality, and security within the same review stage |
953
- | Architecture review | [\`architecture-review-prompt.md\`](architecture-review-prompt.md) | Boundary changes, pattern adherence review |
954
- | Parallel dispatch example | [\`parallel-dispatch-example.md\`](parallel-dispatch-example.md) | Worked example of decomposing a feature into parallel tasks |
841
+ | Implementer dispatch | [\`implementer-prompt.md\`](implementer-prompt.md) | Implementer/Frontend/Refactor |
842
+ | Parallel dispatch example | [\`parallel-dispatch-example.md\`](parallel-dispatch-example.md) | Worked example |
955
843
  `},{file:`spec-review-prompt.md`,content:`# Spec Alignment Review Prompt Template
956
844
 
957
- Use this template when dispatching a code reviewer who should emphasize spec alignment during the code review stage. This runs as part of code review, not before a separate gate.
845
+ Use when dispatching a code reviewer who should emphasize spec alignment during code review.
958
846
 
959
- **Mindset: "Don't trust the report."** The implementer says it's done — verify independently.
847
+ **Mindset: "Don't trust the report."** Verify independently.
960
848
 
961
849
  ---
962
850
 
@@ -1029,8 +917,8 @@ For EACH acceptance criterion in the task spec:
1029
917
 
1030
918
  ## Usage Notes
1031
919
 
1032
- - Run this during the code review stage — gather this evidence before any conditional architecture/security review and before the FORGE gate
1033
- - Paste the ORIGINAL task spec, not a summary — the reviewer needs exact acceptance criteria
1034
- - If verdict is FAIL, bounce back to implementer with specific gaps before moving to later reviews or the gate
1035
- - PASS_WITH_NOTES can proceed to the remaining reviews, but notes should be tracked
920
+ - Run during code review, before conditional architecture/security review and before FORGE gate
921
+ - Paste original task spec, not summary
922
+ - FAIL bounce back with specific gaps
923
+ - PASS_WITH_NOTES can proceed, but track notes
1036
924
  `}];export{e as default};