@vpxa/aikit 0.1.209 → 0.1.210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/dist/index.js +13 -13
  3. package/packages/core/dist/index.d.ts +2 -0
  4. package/packages/server/dist/auth-Bz5dmZgR.js +1 -0
  5. package/packages/server/dist/bin.js +12 -6
  6. package/packages/server/dist/config-C4mVyqAF.js +2 -0
  7. package/packages/server/dist/config-jGZ91cRx.js +1 -0
  8. package/packages/server/dist/curated-manager-D1u5qOwK.js +7 -0
  9. package/packages/server/dist/evolution-9hXRopDC.js +3 -0
  10. package/packages/server/dist/evolution-DJhTM6nu.js +2 -0
  11. package/packages/server/dist/index.d.ts +28 -1
  12. package/packages/server/dist/index.js +1 -1
  13. package/packages/server/dist/lessons-B05P_TOl.js +3 -0
  14. package/packages/server/dist/lessons-D7sdHa2e.js +2 -0
  15. package/packages/server/dist/promotion-Bd_YB7E1.js +3 -0
  16. package/packages/server/dist/promotion-OY53YCsT.js +2 -0
  17. package/packages/server/dist/proxy.js +1 -1
  18. package/packages/server/dist/replay-interceptor-CGLyom5f.js +7 -0
  19. package/packages/server/dist/retention-B4ITAs7F.js +1 -0
  20. package/packages/server/dist/retention-C3tsarCT.js +2 -0
  21. package/packages/server/dist/rolldown-runtime-DT7IzrpZ.js +1 -0
  22. package/packages/server/dist/{server-BaMsrcyc.js → server-BA1mIjBc.js} +163 -139
  23. package/packages/server/dist/{server-BhQwVWsr.js → server-CtFr8YsZ.js} +162 -140
  24. package/packages/server/dist/supersession-9edUDEQ8.js +1 -0
  25. package/packages/server/dist/{version-check-BgHzxxCW.js → version-check-D_uN0n0Y.js} +1 -1
  26. package/packages/store/dist/index.js +30 -30
  27. package/packages/tools/dist/index.d.ts +9 -1
  28. package/packages/tools/dist/index.js +78 -79
  29. package/packages/tools/package.json +5 -5
  30. package/scaffold/dist/adapters/claude-code.mjs +10 -10
  31. package/scaffold/dist/adapters/copilot.mjs +17 -17
  32. package/scaffold/dist/adapters/hooks.mjs +1 -0
  33. package/scaffold/dist/definitions/bodies.mjs +20 -114
  34. package/scaffold/dist/definitions/exec-hooks.mjs +1 -0
  35. package/scaffold/dist/definitions/flows.mjs +81 -345
  36. package/scaffold/dist/definitions/protocols.mjs +21 -4
  37. package/scaffold/dist/definitions/skills/aikit.mjs +35 -55
  38. package/scaffold/dist/definitions/skills/lesson-learned.mjs +46 -0
  39. package/scaffold/general/hooks/scripts/_runtime.mjs +161 -0
  40. package/scaffold/general/hooks/scripts/post-edit-check.mjs +36 -0
  41. package/scaffold/general/hooks/scripts/pre-compact-save.mjs +13 -0
  42. package/scaffold/general/hooks/scripts/privacy-guard.mjs +39 -0
  43. package/scaffold/general/hooks/scripts/scout-guard.mjs +45 -0
  44. package/scaffold/general/hooks/scripts/session-init.mjs +85 -0
  45. package/scaffold/general/hooks/scripts/session-learn.mjs +53 -0
  46. package/scaffold/general/hooks/scripts/session-observer.mjs +77 -0
  47. package/scaffold/general/hooks/scripts/subagent-context.mjs +59 -0
  48. package/packages/server/dist/auth-BfqgawfR.js +0 -1
  49. package/packages/server/dist/config-DAnAxrUW.js +0 -1
  50. package/packages/server/dist/config-PfoXsIC3.js +0 -2
  51. package/packages/server/dist/curated-manager-BnP6VqvL.js +0 -7
  52. package/packages/server/dist/supersession-BIV-v6JG.js +0 -3
  53. package/packages/server/dist/supersession-DJQGXMWm.js +0 -2
@@ -1,4 +1,53 @@
1
- const e={_epilogue:[{file:`steps/docs-sync/README.md`,content:`# Epilogue: Documentation Sync
1
+ const e=`### Orchestrator Dispatch Protocol
2
+
3
+ Follow the \`multi-agents-development\` skill patterns for dispatch:
4
+
5
+ 1. **Independence Check** before parallelizing:
6
+ - Same files? → sequential
7
+ - Shared mutable state? → sequential
8
+ - Execution-order dependent? → sequential
9
+ - Need shared new types? → define contract first, then parallel
10
+ - All clear? → **parallel dispatch**
11
+
12
+ 2. **Subagent Context Template** (each dispatch includes):
13
+ - **Scope**: exact files + boundary (do NOT touch)
14
+ - **Goal**: acceptance criteria, testable
15
+ - **Arch Context**: actual code snippets via \`compact()\`/\`digest()\`
16
+ - **Constraints**: patterns, conventions, anti-patterns
17
+ - **Self-Review**: checklist before declaring DONE
18
+
19
+ 3. **Status Protocol**: \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`
20
+ 4. **Max 2 retries** per task — then escalate to user`,t=`### FORGE Quality Gate
21
+
22
+ After all reviews complete:
23
+ 1. \`evidence_map({ action: "gate", task_id: "<slug>" })\` → returns YIELD/HOLD/HARD_BLOCK
24
+ 2. YIELD → approved, proceed to commit
25
+ 3. HOLD → minor issues, fix then re-gate (max 3 rounds)
26
+ 4. HARD_BLOCK → critical issues, escalate to user`;function n(e,t=``,n=``){return`## Foundation Integration
27
+
28
+ Load these skills BEFORE executing this step:
29
+
30
+ | Skill | Purpose | When |
31
+ |-------|---------|------|
32
+ | \`aikit\` | Core MCP tools — search, analyze, ${e}, validate | Always (auto-loaded) |
33
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
34
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
35
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |${t?`\n${t}`:``}
36
+
37
+ ### Presentation Rules
38
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
39
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
40
+ - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
41
+ - Tables, charts, progress tracking, code review findings → always present
42
+ - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
43
+ - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
44
+ - Only use plain text for brief confirmations and simple questions${n?`\n\n${n}`:``}`}const r=e=>`## Knowledge Capture
45
+
46
+ Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
47
+
48
+ ${e}
49
+
50
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.`,i={_epilogue:[{file:`steps/docs-sync/README.md`,content:`# Epilogue: Documentation Sync
2
51
 
3
52
  > **This is a mandatory epilogue step.** It runs automatically after every flow completes to keep project documentation synchronized with code changes.
4
53
 
@@ -327,27 +376,7 @@ Write \`{{artifacts_path}}/design-decisions.md\` to disk. **You MUST create this
327
376
  - \`Researcher-Gamma\` — Cross-domain patterns
328
377
  - \`Researcher-Delta\` — Feasibility and performance
329
378
 
330
- ## Foundation Integration
331
-
332
- Load these skills BEFORE executing this step:
333
-
334
- | Skill | Purpose | When |
335
- |-------|---------|------|
336
- | \`aikit\` | Core MCP tools — search, analyze, knowledge, validate | Always (auto-loaded) |
337
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
338
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
339
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
340
- | \`c4-architecture\` | C4 model diagrams showing system structure changes | When visualizing proposed architecture |
341
- | \`adr-skill\` | Architecture Decision Records for non-trivial decisions | Critical tier — document architecture decisions |
342
-
343
- ### Presentation Rules
344
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
345
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
346
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
347
- - Tables, charts, progress tracking, code review findings → always present
348
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
349
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
350
- - Only use plain text for brief confirmations and simple questions
379
+ ${n(`knowledge`,"| `c4-architecture` | C4 model diagrams showing system structure changes | When visualizing proposed architecture |\n| `adr-skill` | Architecture Decision Records for non-trivial decisions | Critical tier — document architecture decisions |")}
351
380
 
352
381
  ## Completion Criteria
353
382
 
@@ -357,15 +386,9 @@ Load these skills BEFORE executing this step:
357
386
  - [ ] Key design decisions documented with rationale
358
387
  - [ ] User approval received (🛑 MANDATORY STOP)
359
388
 
360
- ## Knowledge Capture
361
-
362
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
363
-
364
- - **Design decisions**: Chosen approach and alternatives considered with trade-offs
389
+ ${r(`- **Design decisions**: Chosen approach and alternatives considered with trade-offs
365
390
  - **Architecture patterns**: New patterns introduced or existing patterns that must be followed
366
- - **Constraints discovered**: Technical limitations, compatibility requirements, or performance boundaries
367
-
368
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
391
+ - **Constraints discovered**: Technical limitations, compatibility requirements, or performance boundaries`)}
369
392
  `},{file:`steps/execute/README.md`,content:`---
370
393
  name: execute
371
394
  description: Implement all tasks from the task breakdown, dispatching agents in parallel where possible.
@@ -466,47 +489,7 @@ Template:
466
489
  - File-modifying agents: parallel ONLY on completely different files
467
490
  - Max 4 concurrent file-modifying agents
468
491
 
469
- ## Foundation Integration
470
-
471
- Load these skills BEFORE executing this step:
472
-
473
- | Skill | Purpose | When |
474
- |-------|---------|------|
475
- | \`aikit\` | Core MCP tools — search, analyze, knowledge, validate | Always (auto-loaded) |
476
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
477
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
478
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
479
- | \`session-handoff\` | Context preservation for long-running execution phases | When execution spans multiple sessions or context is filling |
480
-
481
- ### Presentation Rules
482
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
483
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
484
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
485
- - Tables, charts, progress tracking, code review findings → always present
486
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
487
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
488
- - Only use plain text for brief confirmations and simple questions
489
-
490
- ### Orchestrator Dispatch Protocol
491
-
492
- Follow the \`multi-agents-development\` skill patterns for dispatch:
493
-
494
- 1. **Independence Check** before parallelizing:
495
- - Same files? → sequential
496
- - Shared mutable state? → sequential
497
- - Execution-order dependent? → sequential
498
- - Need shared new types? → define contract first, then parallel
499
- - All clear? → **parallel dispatch**
500
-
501
- 2. **Subagent Context Template** (each dispatch includes):
502
- - **Scope**: exact files + boundary (do NOT touch)
503
- - **Goal**: acceptance criteria, testable
504
- - **Arch Context**: actual code snippets via \`compact()\`/\`digest()\`
505
- - **Constraints**: patterns, conventions, anti-patterns
506
- - **Self-Review**: checklist before declaring DONE
507
-
508
- 3. **Status Protocol**: \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`
509
- 4. **Max 2 retries** per task — then escalate to user
492
+ ${n(`knowledge`,"| `session-handoff` | Context preservation for long-running execution phases | When execution spans multiple sessions or context is filling |",e)}
510
493
 
511
494
  ## Completion Criteria
512
495
 
@@ -516,15 +499,9 @@ Follow the \`multi-agents-development\` skill patterns for dispatch:
516
499
  - [ ] No blocked items remaining
517
500
  - [ ] \`{{artifacts_path}}/progress.md\` written
518
501
 
519
- ## Knowledge Capture
520
-
521
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
522
-
523
- - **Implementation decisions**: Why specific approaches were chosen over alternatives
502
+ ${r(`- **Implementation decisions**: Why specific approaches were chosen over alternatives
524
503
  - **Patterns established**: New conventions or patterns that future code should follow
525
- - **Gotchas encountered**: Edge cases, workarounds, or non-obvious behaviors discovered during execution
526
-
527
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
504
+ - **Gotchas encountered**: Edge cases, workarounds, or non-obvious behaviors discovered during execution`)}
528
505
  `},{file:`steps/plan/README.md`,content:`---
529
506
  name: plan
530
507
  description: Analyze the codebase, design the architecture, and create a detailed implementation plan.
@@ -620,27 +597,7 @@ Template:
620
597
 
621
598
  The Planner agent (\`Planner.agent.md\`) owns the \`{{artifacts_path}}/plan.md\` artifact. Pass it the spec content, Explorer findings, and artifacts path as context.
622
599
 
623
- ## Foundation Integration
624
-
625
- Load these skills BEFORE executing this step:
626
-
627
- | Skill | Purpose | When |
628
- |-------|---------|------|
629
- | \`aikit\` | Core MCP tools — search, analyze, knowledge, validate | Always (auto-loaded) |
630
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
631
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
632
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
633
- | \`adr-skill\` | Architecture Decision Records for non-trivial technical decisions | When plan involves architecture choices that need documentation |
634
- | \`c4-architecture\` | C4 model diagrams showing system structure changes | When plan modifies system architecture |
635
-
636
- ### Presentation Rules
637
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
638
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
639
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
640
- - Tables, charts, progress tracking, code review findings → always present
641
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
642
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
643
- - Only use plain text for brief confirmations and simple questions
600
+ ${n(`knowledge`,"| `adr-skill` | Architecture Decision Records for non-trivial technical decisions | When plan involves architecture choices that need documentation |\n| `c4-architecture` | C4 model diagrams showing system structure changes | When plan modifies system architecture |")}
644
601
 
645
602
  ## Completion Criteria
646
603
 
@@ -651,15 +608,9 @@ Load these skills BEFORE executing this step:
651
608
  - [ ] Risks identified with mitigations
652
609
  - [ ] \`{{artifacts_path}}/plan.md\` written
653
610
 
654
- ## Knowledge Capture
655
-
656
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
657
-
658
- - **Task dependencies**: Critical ordering constraints and parallel opportunities
611
+ ${r(`- **Task dependencies**: Critical ordering constraints and parallel opportunities
659
612
  - **Risk assessment**: Identified risks and mitigation strategies
660
- - **Resource decisions**: File ownership, module boundaries, and integration points
661
-
662
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
613
+ - **Resource decisions**: File ownership, module boundaries, and integration points`)}
663
614
  `},{file:`steps/spec/README.md`,content:`---
664
615
  name: spec
665
616
  description: Elicit requirements, clarify scope, and define acceptance criteria through structured dialogue.
@@ -781,26 +732,7 @@ Key Clarifications:
781
732
 
782
733
  Use the \`brainstorming\` skill for creative/design exploration before formalizing requirements. Use \`requirements-clarity\` skill to score and iterate until the spec is unambiguous.
783
734
 
784
- ## Foundation Integration
785
-
786
- Load these skills BEFORE executing this step:
787
-
788
- | Skill | Purpose | When |
789
- |-------|---------|------|
790
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
791
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
792
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
793
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
794
- | \`requirements-clarity\` | Score requirements 0-100, iterate until ≥90 before proceeding | Before writing spec — ensures requirements are clear enough |
795
-
796
- ### Presentation Rules
797
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
798
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
799
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
800
- - Tables, charts, progress tracking, code review findings → always present
801
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
802
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
803
- - Only use plain text for brief confirmations and simple questions
735
+ ${n(`remember`,"| `requirements-clarity` | Score requirements 0-100, iterate until ≥90 before proceeding | Before writing spec — ensures requirements are clear enough |")}
804
736
 
805
737
  ## Completion Criteria
806
738
 
@@ -810,15 +742,9 @@ Load these skills BEFORE executing this step:
810
742
  - [ ] No open questions remain
811
743
  - [ ] \`{{artifacts_path}}/spec.md\` written
812
744
 
813
- ## Knowledge Capture
814
-
815
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
816
-
817
- - **Requirements clarified**: Ambiguities resolved and assumptions validated
745
+ ${r(`- **Requirements clarified**: Ambiguities resolved and assumptions validated
818
746
  - **Scope boundaries**: What the spec covers and explicit exclusions
819
- - **Acceptance criteria**: Key testable conditions that define "done"
820
-
821
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
747
+ - **Acceptance criteria**: Key testable conditions that define "done"`)}
822
748
  `},{file:`steps/task/README.md`,content:`---
823
749
  name: task
824
750
  description: Break the implementation plan into ordered, atomic tasks with dependencies and agent assignments.
@@ -917,25 +843,7 @@ Use the template-driven graph for the dependency view; if you add supporting sum
917
843
 
918
844
  Planner does the decomposition, then Architect-Reviewer validates the task graph.
919
845
 
920
- ## Foundation Integration
921
-
922
- Load these skills BEFORE executing this step:
923
-
924
- | Skill | Purpose | When |
925
- |-------|---------|------|
926
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
927
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
928
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
929
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
930
-
931
- ### Presentation Rules
932
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
933
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
934
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
935
- - Tables, charts, progress tracking, code review findings → always present
936
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
937
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
938
- - Only use plain text for brief confirmations and simple questions
846
+ ${n(`remember`)}
939
847
 
940
848
  ## Completion Criteria
941
849
 
@@ -946,15 +854,9 @@ Load these skills BEFORE executing this step:
946
854
  - [ ] Architect review confirms no integration risks
947
855
  - [ ] \`{{artifacts_path}}/tasks.md\` written
948
856
 
949
- ## Knowledge Capture
950
-
951
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
952
-
953
- - **Task decomposition rationale**: Why tasks were split this way and what each accomplishes
857
+ ${r(`- **Task decomposition rationale**: Why tasks were split this way and what each accomplishes
954
858
  - **Interface contracts**: APIs, types, or data shapes that tasks depend on
955
- - **Coordination points**: Where tasks interact and handoff requirements
956
-
957
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
859
+ - **Coordination points**: Where tasks interact and handoff requirements`)}
958
860
  `},{file:`steps/verify/README.md`,content:`---
959
861
  name: verify
960
862
  description: Dual code review, architecture review, security review, and comprehensive test validation.
@@ -1062,35 +964,7 @@ APPROVE | REQUEST CHANGES
1062
964
 
1063
965
  **Parallelism**: All 5 reviewers can run in parallel — they are read-only.
1064
966
 
1065
- ## Foundation Integration
1066
-
1067
- Load these skills BEFORE executing this step:
1068
-
1069
- | Skill | Purpose | When |
1070
- |-------|---------|------|
1071
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1072
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1073
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1074
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1075
- | \`lesson-learned\` | Extract engineering principles from completed work | After verification — capture lessons from the implementation |
1076
- | \`session-handoff\` | Context preservation for session continuity | When verification spans sessions or for final handoff documentation |
1077
-
1078
- ### Presentation Rules
1079
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1080
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
1081
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
1082
- - Tables, charts, progress tracking, code review findings → always present
1083
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
1084
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
1085
- - Only use plain text for brief confirmations and simple questions
1086
-
1087
- ### FORGE Quality Gate
1088
-
1089
- After all reviews complete:
1090
- 1. \`evidence_map({ action: "gate", task_id: "<slug>" })\` → returns YIELD/HOLD/HARD_BLOCK
1091
- 2. YIELD → approved, proceed to commit
1092
- 3. HOLD → minor issues, fix then re-gate (max 3 rounds)
1093
- 4. HARD_BLOCK → critical issues, escalate to user
967
+ ${n(`remember`,"| `lesson-learned` | Extract engineering principles from completed work | After verification — capture lessons from the implementation |\n| `session-handoff` | Context preservation for session continuity | When verification spans sessions or for final handoff documentation |",t)}
1094
968
 
1095
969
  ## Completion Criteria
1096
970
 
@@ -1103,15 +977,9 @@ After all reviews complete:
1103
977
  - [ ] FORGE gate passed (YIELD)
1104
978
  - [ ] \`{{artifacts_path}}/verify-report.md\` written with clear verdict
1105
979
 
1106
- ## Knowledge Capture
1107
-
1108
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
1109
-
1110
- - **Test coverage gaps**: Areas that couldn't be fully tested and why
980
+ ${r(`- **Test coverage gaps**: Areas that couldn't be fully tested and why
1111
981
  - **Quality findings**: Issues found during verification and their resolutions
1112
- - **Session checkpoint**: Summarize what was accomplished, decisions made, and any remaining work
1113
-
1114
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
982
+ - **Session checkpoint**: Summarize what was accomplished, decisions made, and any remaining work`)}
1115
983
  `}],"aikit-basic":[{file:`README.md`,content:"# aikit:basic — Quick Development Flow\n\nQuick development flow for **bug fixes, small features, and refactoring**.\n\n## Steps\n\n| # | Step | Skill | Produces | Requires | Agents |\n|---|------|-------|----------|----------|--------|\n| 1 | **Design Gate** | `steps/design/README.md` | `design-decisions.md` | — | Researcher-Alpha/Beta/Gamma/Delta |\n| 2 | **Assessment** | `steps/assess/README.md` | `assessment.md` | `design-decisions.md` | Explorer, Researcher-Alpha |\n| 3 | **Implementation** | `steps/implement/README.md` | `progress.md` | `assessment.md` | Implementer, Frontend |\n| 4 | **Verification** | `steps/verify/README.md` | `verify-report.md` | `progress.md` | Code-Reviewer-Alpha, Security |\n\n## How It Works\n\nEach step has a **README.md** file that contains the detailed instructions for the agent(s) executing that step. The Orchestrator reads the README.md via `flow({ action: 'read' })` and delegates work accordingly.\n\n### Step 1: Design Gate\n- **Auto-skips** for bug fixes and refactors (produces a minimal `design-decisions.md` noting it was skipped)\n- For small features: runs quick brainstorming, FORGE classification, and optional decision protocol (see Orchestrator's inlined Multi-Model Decision Protocol for the full 3-phase process)\n- Read `steps/design/README.md` for the full decision tree\n\n### Step 2: Assessment\n- Explore the codebase to understand scope and impact\n- Use `search`, `scope_map`, `file_summary`, `compact` to gather context\n- Identify the approach and produce `assessment.md`\n\n### Step 3: Implementation\n- Write code following the assessment plan\n- The Orchestrator dispatches Implementer/Frontend agents with specific file scopes\n- Follow TDD practices where applicable\n\n### Step 4: Verification\n- Code review, test execution, security check\n- Run `check({})` + `test_run({})` + `blast_radius({})`\n- Produce `verify-report.md` with findings\n\n## Using Skills Inside Steps\n\nWhen the Orchestrator activates a step:\n\n1. **Read the instruction first** — `flow({ action: 'read' })` returns the README.md for the current step\n2. **Follow step instructions** — the README.md is the primary guide for what to do\n3. **Delegate to listed agents** — each step lists which agents are appropriate\n4. **Produce the required artifact** — the step's `produces` field specifies what file to create in the artifacts directory\n5. **Check dependencies** — the step's `requires` field lists artifacts from previous steps that must exist\n6. **Report status** — agents report `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED` to the Orchestrator\n\n## Artifacts\n\nAll artifacts are stored in the run directory under `.flows/{topic}/`. The template variable `{{artifacts_path}}` resolves to the actual path at runtime.\n"},{file:`steps/assess/README.md`,content:`---
1116
984
  name: assess
1117
985
  description: Understand scope, analyze the codebase, and identify the implementation approach.
@@ -1193,27 +1061,7 @@ Template:
1193
1061
 
1194
1062
  Use Explorer first for breadth, then Researcher-Alpha for depth on complex areas.
1195
1063
 
1196
- ## Foundation Integration
1197
-
1198
- Load these skills BEFORE executing this step:
1199
-
1200
- | Skill | Purpose | When |
1201
- |-------|---------|------|
1202
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1203
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1204
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1205
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1206
- | \`c4-architecture\` | C4 model architecture diagrams — system context, container, component, deployment views | When visualizing system structure during assessment |
1207
- | \`adr-skill\` | Architecture Decision Records — create, review, maintain ADRs | When assessment reveals non-trivial design decisions |
1208
-
1209
- ### Presentation Rules
1210
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1211
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
1212
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
1213
- - Tables, charts, progress tracking, code review findings → always present
1214
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
1215
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
1216
- - Only use plain text for brief confirmations and simple questions
1064
+ ${n(`remember`,"| `c4-architecture` | C4 model architecture diagrams — system context, container, component, deployment views | When visualizing system structure during assessment |\n| `adr-skill` | Architecture Decision Records — create, review, maintain ADRs | When assessment reveals non-trivial design decisions |")}
1217
1065
 
1218
1066
  ## Completion Criteria
1219
1067
 
@@ -1223,15 +1071,9 @@ Load these skills BEFORE executing this step:
1223
1071
  - [ ] No unresolved open questions that block implementation
1224
1072
  - [ ] \`{{artifacts_path}}/assessment.md\` written
1225
1073
 
1226
- ## Knowledge Capture
1227
-
1228
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
1229
-
1230
- - **Codebase discoveries**: File locations, architecture patterns, or dependency relationships found during assessment
1074
+ ${r(`- **Codebase discoveries**: File locations, architecture patterns, or dependency relationships found during assessment
1231
1075
  - **Problem diagnosis**: Root cause analysis, contributing factors, and affected components
1232
- - **Scope decisions**: What's in scope, what's explicitly excluded, and why
1233
-
1234
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
1076
+ - **Scope decisions**: What's in scope, what's explicitly excluded, and why`)}
1235
1077
  `},{file:`steps/design/README.md`,content:`# Design Gate — Basic Flow
1236
1078
 
1237
1079
  Lightweight design gate for bug fixes, small features, and refactoring. Evaluates the task type and determines whether design work is needed before proceeding.
@@ -1324,27 +1166,7 @@ Write \`{{artifacts_path}}/design-decisions.md\` to disk. **You MUST create this
1324
1166
 
1325
1167
  - \`Researcher-Alpha\`, \`Researcher-Beta\`, \`Researcher-Gamma\`, \`Researcher-Delta\` — for parallel research during decision protocol
1326
1168
 
1327
- ## Foundation Integration
1328
-
1329
- Load these skills BEFORE executing this step:
1330
-
1331
- | Skill | Purpose | When |
1332
- |-------|---------|------|
1333
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1334
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1335
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1336
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1337
- | \`c4-architecture\` | C4 model architecture diagrams — system context, container, component, deployment views | When visualizing system structure during design |
1338
- | \`adr-skill\` | Architecture Decision Records — create, review, maintain ADRs | When making non-trivial design or technology decisions |
1339
-
1340
- ### Presentation Rules
1341
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1342
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
1343
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
1344
- - Tables, charts, progress tracking, code review findings → always present
1345
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
1346
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
1347
- - Only use plain text for brief confirmations and simple questions
1169
+ ${n(`remember`,"| `c4-architecture` | C4 model architecture diagrams — system context, container, component, deployment views | When visualizing system structure during design |\n| `adr-skill` | Architecture Decision Records — create, review, maintain ADRs | When making non-trivial design or technology decisions |")}
1348
1170
 
1349
1171
  ## Completion Criteria
1350
1172
 
@@ -1352,15 +1174,9 @@ Load these skills BEFORE executing this step:
1352
1174
  - [ ] FORGE tier determined (for small features)
1353
1175
  - [ ] Key design decisions documented
1354
1176
 
1355
- ## Knowledge Capture
1356
-
1357
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
1358
-
1359
- - **Design decisions**: Chosen approach and alternatives considered with trade-offs
1177
+ ${r(`- **Design decisions**: Chosen approach and alternatives considered with trade-offs
1360
1178
  - **Architecture patterns**: New patterns introduced or existing patterns that must be followed
1361
- - **Constraints discovered**: Technical limitations, compatibility requirements, or performance boundaries
1362
-
1363
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
1179
+ - **Constraints discovered**: Technical limitations, compatibility requirements, or performance boundaries`)}
1364
1180
  `},{file:`steps/implement/README.md`,content:`---
1365
1181
  name: implement
1366
1182
  description: Write code following the assessment plan, using TDD practices where applicable.
@@ -1449,47 +1265,7 @@ Template:
1449
1265
 
1450
1266
  Dispatch Implementer for backend/logic changes, Frontend for UI changes. Both can run in parallel if working on different files.
1451
1267
 
1452
- ## Foundation Integration
1453
-
1454
- Load these skills BEFORE executing this step:
1455
-
1456
- | Skill | Purpose | When |
1457
- |-------|---------|------|
1458
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1459
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1460
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1461
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1462
- | \`session-handoff\` | Context preservation for session transfers | When implementation is long-running and context may fill up |
1463
-
1464
- ### Presentation Rules
1465
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1466
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
1467
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
1468
- - Tables, charts, progress tracking, code review findings → always present
1469
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
1470
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
1471
- - Only use plain text for brief confirmations and simple questions
1472
-
1473
- ### Orchestrator Dispatch Protocol
1474
-
1475
- Follow the \`multi-agents-development\` skill patterns for dispatch:
1476
-
1477
- 1. **Independence Check** before parallelizing:
1478
- - Same files? → sequential
1479
- - Shared mutable state? → sequential
1480
- - Execution-order dependent? → sequential
1481
- - Need shared new types? → define contract first, then parallel
1482
- - All clear? → **parallel dispatch**
1483
-
1484
- 2. **Subagent Context Template** (each dispatch includes):
1485
- - **Scope**: exact files + boundary (do NOT touch)
1486
- - **Goal**: acceptance criteria, testable
1487
- - **Arch Context**: actual code snippets via \`compact()\`/\`digest()\`
1488
- - **Constraints**: patterns, conventions, anti-patterns
1489
- - **Self-Review**: checklist before declaring DONE
1490
-
1491
- 3. **Status Protocol**: \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`
1492
- 4. **Max 2 retries** per task — then escalate to user
1268
+ ${n(`remember`,"| `session-handoff` | Context preservation for session transfers | When implementation is long-running and context may fill up |",e)}
1493
1269
 
1494
1270
  ## Completion Criteria
1495
1271
 
@@ -1499,15 +1275,9 @@ Follow the \`multi-agents-development\` skill patterns for dispatch:
1499
1275
  - [ ] No files modified outside assessed scope
1500
1276
  - [ ] \`{{artifacts_path}}/progress.md\` written
1501
1277
 
1502
- ## Knowledge Capture
1503
-
1504
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
1505
-
1506
- - **Implementation decisions**: Why specific approaches were chosen over alternatives
1278
+ ${r(`- **Implementation decisions**: Why specific approaches were chosen over alternatives
1507
1279
  - **Patterns established**: New conventions or patterns that future code should follow
1508
- - **Gotchas encountered**: Edge cases, workarounds, or non-obvious behaviors discovered during implementation
1509
-
1510
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
1280
+ - **Gotchas encountered**: Edge cases, workarounds, or non-obvious behaviors discovered during implementation`)}
1511
1281
  `},{file:`steps/verify/README.md`,content:`---
1512
1282
  name: verify
1513
1283
  description: Review code changes, run tests, validate correctness and quality.
@@ -1585,35 +1355,7 @@ Template:
1585
1355
 
1586
1356
  Run both in parallel — they review different aspects of the same changes.
1587
1357
 
1588
- ## Foundation Integration
1589
-
1590
- Load these skills BEFORE executing this step:
1591
-
1592
- | Skill | Purpose | When |
1593
- |-------|---------|------|
1594
- | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1595
- | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1596
- | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1597
- | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1598
- | \`lesson-learned\` | Extract engineering lessons from completed work via git history | After verification completes — capture principles from what was built |
1599
- | \`session-handoff\` | Context preservation for session transfers | When verification is the final step and session context should be saved |
1600
-
1601
- ### Presentation Rules
1602
- - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1603
- - Assessments, reports, comparisons, reviews, status boards → \`present({ schemaVersion: 1, title: "Assessment", blocks: [...] })\`
1604
- - Use \`table\` blocks for comparisons, \`kv\` for status/scores, \`list\` for findings, and \`metrics\` for numeric health indicators. NEVER \`code\` blocks for structured data.
1605
- - Tables, charts, progress tracking, code review findings → always present
1606
- - Use \`metrics\` for numeric indicators, \`checklist\` for task status, \`kv\` for summary, and \`table\` for review findings. NEVER \`code\` blocks for structured data.
1607
- - Artifact content and summaries → present with structured layout; use \`markdown\` for prose sections.
1608
- - Only use plain text for brief confirmations and simple questions
1609
-
1610
- ### FORGE Quality Gate
1611
-
1612
- After all reviews complete:
1613
- 1. \`evidence_map({ action: "gate", task_id: "<slug>" })\` → returns YIELD/HOLD/HARD_BLOCK
1614
- 2. YIELD → approved, proceed to commit
1615
- 3. HOLD → minor issues, fix then re-gate (max 3 rounds)
1616
- 4. HARD_BLOCK → critical issues, escalate to user
1358
+ ${n(`remember`,"| `lesson-learned` | Extract engineering lessons from completed work via git history | After verification completes — capture principles from what was built |\n| `session-handoff` | Context preservation for session transfers | When verification is the final step and session context should be saved |",t)}
1617
1359
 
1618
1360
  ## Completion Criteria
1619
1361
 
@@ -1624,13 +1366,7 @@ After all reviews complete:
1624
1366
  - [ ] Blast radius assessed
1625
1367
  - [ ] \`{{artifacts_path}}/verify-report.md\` written with clear PASS/FAIL verdict
1626
1368
 
1627
- ## Knowledge Capture
1628
-
1629
- Before completing this step, persist important findings using \`knowledge({ action: "remember", ... })\`:
1630
-
1631
- - **Test coverage gaps**: Areas that couldn't be fully tested and why
1369
+ ${r(`- **Test coverage gaps**: Areas that couldn't be fully tested and why
1632
1370
  - **Quality findings**: Issues found during verification and their resolutions
1633
- - **Session checkpoint**: Summarize what was accomplished, decisions made, and any remaining work
1634
-
1635
- **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`knowledge({ action: "remember", ... })\` now.
1636
- `}]};export{e as FLOWS};
1371
+ - **Session checkpoint**: Summarize what was accomplished, decisions made, and any remaining work`)}
1372
+ `}]};export{i as FLOWS};
@@ -18,7 +18,10 @@ When dispatched as a subagent within an active flow:
18
18
 
19
19
  ${e===`<PROFILE>`?`**Profile:** Check your role → implementer | documenter | reviewer | researcher | debugger`:`**Profile:** \`${e}\``}
20
20
 
21
- ---`}function t(){return"\n## Evidence Citation Protocol (tier-aware)\n\n**Standalone mode:** If no FORGE task_id was provided in your dispatch prompt, skip `evidence_map` calls entirely — provide free-form findings with `file:line` citations only.\n\nThe Orchestrator runs `forge_classify` before dispatching you, and runs the final `evidence_map({ action: 'gate', task_id })` after you respond. **Do not create your own task_id or run the gate** — feed into the Orchestrator's existing evidence map.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Free-form findings with `file.ts#Lxx` citations. No `evidence_map` calls required. |\n| Standard | For every CRITICAL or HIGH finding: `evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})`. Max 2-4 adds to keep signal high. |\n| Critical | Structured claims for all CRITICAL/HIGH findings (2-4 Verified + receipts) AND tag contract/security claims with `safety_gate:'commitment'` or `safety_gate:'provenance'`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT:\n- Create a new `evidence_map` (the Orchestrator already did)\n- Run `evidence_map({action:'gate'})` yourself — the Orchestrator owns the gate\n- Duplicate findings into the map that weren't CRITICAL/HIGH"}const n={"code-agent-base":`# Code Agent — Shared Base Instructions
21
+ ---`}function t(){return"\n## Evidence Citation Protocol (tier-aware)\n\n**Standalone mode:** If no FORGE task_id was provided in your dispatch prompt, skip `evidence_map` calls entirely — provide free-form findings with `file:line` citations only.\n\nThe Orchestrator runs `forge_classify` before dispatching you, and runs the final `evidence_map({ action: 'gate', task_id })` after you respond. **Do not create your own task_id or run the gate** — feed into the Orchestrator's existing evidence map.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Free-form findings with `file.ts#Lxx` citations. No `evidence_map` calls required. |\n| Standard | For every CRITICAL or HIGH finding: `evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})`. Max 2-4 adds to keep signal high. |\n| Critical | Structured claims for all CRITICAL/HIGH findings (2-4 Verified + receipts) AND tag contract/security claims with `safety_gate:'commitment'` or `safety_gate:'provenance'`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT:\n- Create a new `evidence_map` (the Orchestrator already did)\n- Run `evidence_map({action:'gate'})` yourself — the Orchestrator owns the gate\n- Duplicate findings into the map that weren't CRITICAL/HIGH"}function n(...e){return e.filter(Boolean).join(`
22
+
23
+ `)}function r({title:e=`Knowledge Recall`,intro:t,commands:r,followUp:i}={}){return n(`## Pre-Task: ${e} (MANDATORY)`,t,["```",...(Array.isArray(r)?r:[r]).filter(Boolean),"```"].join(`
24
+ `),i)}function i(){return n(`## Post-Task: Capture Lesson`,"**HARD RULE:** Before reporting DONE status, load the `lesson-learned` skill and extract 1-2 engineering lessons from the changes made. Skip ONLY if changes are pure config/formatting with no logic modified.",'Quick lesson capture (when full skill feels heavy):\n```\nknowledge({ action: "lesson", subAction: "create", context: "<what situation you faced>", insight: "<what principle the solution demonstrates>", evidence: "<file:line or commit that proves it>", confidence: 65 })\n```','**Confirm/Contradict (if pre-task recalled relevant lessons):**\n- Lesson proved correct → `knowledge({ action: "lesson", subAction: "confirm", id: "<recalled-lesson-path>" })`\n- Lesson was wrong/outdated → `knowledge({ action: "lesson", subAction: "contradict", id: "<recalled-lesson-path>", evidence: "<what actually happened>" })`','```\n// Periodic maintenance (suggest every ~5 sessions):\n// knowledge({ action: "lesson", subAction: "prune" }) // archive stale\n// knowledge({ action: "lesson", subAction: "group" }) // organize similar\n// knowledge({ action: "lesson", subAction: "promote" }) // share universal (user-level only)\n```')}const a={"code-agent-base":`# Code Agent — Shared Base Instructions
22
25
 
23
26
  > This file contains shared protocols for all code-modifying agents (Implementer, Frontend, Refactor, Debugger). Each agent's definition file contains only its unique identity, constraints, and workflow. **Do not duplicate this content in agent files.**
24
27
 
@@ -201,6 +204,19 @@ search({ query: "<feature/area keywords>", limit: 5 }) // check past decisions
201
204
  knowledge({ action: "list", category: "decisions" }) // scan recent decisions that might apply
202
205
  knowledge({ action: "list", category: "conventions" }) // see project conventions (includes auto-captured)
203
206
  knowledge({ action: "lesson", subAction: "list-lessons", topic: "<2-3 task keywords>", minConfidence: 70 }) // topic-scoped lessons
207
+
208
+ // Lesson lifecycle management
209
+ knowledge({ action: "lesson", subAction: "prune" }) // dry-run: review stale candidates
210
+ knowledge({ action: "lesson", subAction: "prune", dryRun: false }) // execute prune
211
+ knowledge({ action: "lesson", subAction: "group" }) // dry-run: show clusters
212
+ knowledge({ action: "lesson", subAction: "group", dryRun: false }) // execute grouping
213
+ knowledge({ action: "lesson", subAction: "promote" }) // dry-run: cross-workspace scan
214
+ knowledge({ action: "lesson", subAction: "promote", dryRun: false }) // promote to global
215
+ knowledge({ action: "lesson", subAction: "demote", path: "<path>" }) // remove from global
216
+
217
+ // Session prelude (at session start)
218
+ status({ includePrelude: true }) // top 3 lessons + top 2 conventions + checkpoint
219
+
204
220
  scope_map({ task: "what you need" }) // generates a reading plan
205
221
 
206
222
  // If running as sub-agent with flow context:
@@ -792,7 +808,8 @@ Each perspective was produced independently — they have NOT seen each other's
792
808
  [Perspective A]
793
809
  {Alpha's full response}
794
810
 
795
- [Perspective B]Beta's full response}
811
+ [Perspective B]
812
+ {Beta's full response}
796
813
 
797
814
  [Perspective C]Gamma's full response}
798
815
 
@@ -962,7 +979,7 @@ evidence_map({ action: "gate", task_id: "add-user-api" }) → YIELD ✅
962
979
  3. **Standard**: \`evidence_map create\` → add 3-8 claims during work → \`evidence_map gate\`
963
980
  4. **Critical**: Full 4-phase flow with comprehensive evidence
964
981
  5. **After gate**: YIELD = done, HOLD = fix + re-gate, HARD_BLOCK = escalate
965
- `},r={"execution-state":`# Execution State: {Task Title}
982
+ `},o={"execution-state":`# Execution State: {Task Title}
966
983
 
967
984
  **Status:** PLANNING | IN_PROGRESS | REVIEW | COMPLETED | BLOCKED
968
985
  **Started:** {timestamp}
@@ -1014,4 +1031,4 @@ evidence_map({ action: "gate", task_id: "add-user-api" }) → YIELD ✅
1014
1031
 
1015
1032
  ## Alternatives Considered
1016
1033
  {Other approaches evaluated and why they were rejected — keeps the "why not" alongside the "why"}
1017
- `};export{n as PROTOCOLS,r as TEMPLATES};
1034
+ `};export{a as PROTOCOLS,o as TEMPLATES,i as postTaskLesson,r as preTaskKnowledgeRecall};