@vpxa/aikit 0.1.74 → 0.1.76

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 (128) hide show
  1. package/package.json +5 -1
  2. package/packages/cli/dist/index.js +2 -2
  3. package/packages/cli/dist/{init-DQkar6Es.js → init-CuRXmyD9.js} +1 -1
  4. package/packages/cli/dist/scaffold-WMQ2uQ48.js +2 -0
  5. package/packages/cli/dist/{user-CopNWxHP.js → user-vbJwa7x2.js} +1 -1
  6. package/scaffold/dist/adapters/claude-code.mjs +4 -0
  7. package/scaffold/dist/adapters/copilot.mjs +75 -0
  8. package/scaffold/dist/adapters/flows.mjs +1 -0
  9. package/scaffold/dist/adapters/skills.mjs +1 -0
  10. package/scaffold/{compiled → dist/compiled}/flows-data.mjs +304 -446
  11. package/scaffold/{compiled → dist/compiled}/skills-data.mjs +554 -2281
  12. package/scaffold/dist/definitions/agents.mjs +9 -0
  13. package/scaffold/dist/definitions/bodies.mjs +512 -0
  14. package/scaffold/dist/definitions/exclusions.mjs +1 -0
  15. package/scaffold/dist/definitions/hooks.mjs +1 -0
  16. package/scaffold/dist/definitions/models.mjs +1 -0
  17. package/scaffold/dist/definitions/plugins.mjs +1 -0
  18. package/scaffold/dist/definitions/prompts.mjs +225 -0
  19. package/scaffold/dist/definitions/protocols.mjs +835 -0
  20. package/scaffold/dist/definitions/tools.mjs +1 -0
  21. package/packages/cli/dist/scaffold-ukCDW3wQ.js +0 -2
  22. package/scaffold/_preview/agents/Architect-Reviewer-Alpha.agent.md +0 -132
  23. package/scaffold/_preview/agents/Architect-Reviewer-Beta.agent.md +0 -132
  24. package/scaffold/_preview/agents/Code-Reviewer-Alpha.agent.md +0 -112
  25. package/scaffold/_preview/agents/Code-Reviewer-Beta.agent.md +0 -112
  26. package/scaffold/_preview/agents/Debugger.agent.md +0 -412
  27. package/scaffold/_preview/agents/Documenter.agent.md +0 -468
  28. package/scaffold/_preview/agents/Explorer.agent.md +0 -76
  29. package/scaffold/_preview/agents/Frontend.agent.md +0 -440
  30. package/scaffold/_preview/agents/Implementer.agent.md +0 -425
  31. package/scaffold/_preview/agents/Orchestrator.agent.md +0 -452
  32. package/scaffold/_preview/agents/Planner.agent.md +0 -481
  33. package/scaffold/_preview/agents/README.md +0 -57
  34. package/scaffold/_preview/agents/Refactor.agent.md +0 -435
  35. package/scaffold/_preview/agents/Researcher-Alpha.agent.md +0 -151
  36. package/scaffold/_preview/agents/Researcher-Beta.agent.md +0 -152
  37. package/scaffold/_preview/agents/Researcher-Delta.agent.md +0 -153
  38. package/scaffold/_preview/agents/Researcher-Gamma.agent.md +0 -152
  39. package/scaffold/_preview/agents/Security.agent.md +0 -433
  40. package/scaffold/_preview/agents/_shared/architect-reviewer-base.md +0 -104
  41. package/scaffold/_preview/agents/_shared/code-agent-base.md +0 -366
  42. package/scaffold/_preview/agents/_shared/code-reviewer-base.md +0 -87
  43. package/scaffold/_preview/agents/_shared/decision-protocol.md +0 -27
  44. package/scaffold/_preview/agents/_shared/forge-protocol.md +0 -90
  45. package/scaffold/_preview/agents/_shared/researcher-base.md +0 -114
  46. package/scaffold/_preview/agents/templates/adr-template.md +0 -28
  47. package/scaffold/_preview/agents/templates/execution-state.md +0 -26
  48. package/scaffold/_preview/flows/_epilogue/steps/docs-sync/README.md +0 -120
  49. package/scaffold/_preview/flows/aikit-advanced/README.md +0 -70
  50. package/scaffold/_preview/flows/aikit-advanced/steps/design/README.md +0 -178
  51. package/scaffold/_preview/flows/aikit-advanced/steps/execute/README.md +0 -145
  52. package/scaffold/_preview/flows/aikit-advanced/steps/plan/README.md +0 -122
  53. package/scaffold/_preview/flows/aikit-advanced/steps/spec/README.md +0 -121
  54. package/scaffold/_preview/flows/aikit-advanced/steps/task/README.md +0 -119
  55. package/scaffold/_preview/flows/aikit-advanced/steps/verify/README.md +0 -145
  56. package/scaffold/_preview/flows/aikit-basic/README.md +0 -51
  57. package/scaffold/_preview/flows/aikit-basic/steps/assess/README.md +0 -109
  58. package/scaffold/_preview/flows/aikit-basic/steps/design/README.md +0 -116
  59. package/scaffold/_preview/flows/aikit-basic/steps/implement/README.md +0 -131
  60. package/scaffold/_preview/flows/aikit-basic/steps/verify/README.md +0 -123
  61. package/scaffold/_preview/prompts/aikit-ask.prompt.md +0 -13
  62. package/scaffold/_preview/prompts/aikit-debug.prompt.md +0 -15
  63. package/scaffold/_preview/prompts/aikit-design.prompt.md +0 -15
  64. package/scaffold/_preview/prompts/aikit-flow-add.prompt.md +0 -84
  65. package/scaffold/_preview/prompts/aikit-flow-create.prompt.md +0 -80
  66. package/scaffold/_preview/prompts/aikit-flow-manage.prompt.md +0 -24
  67. package/scaffold/_preview/prompts/aikit-implement.prompt.md +0 -17
  68. package/scaffold/_preview/prompts/aikit-plan.prompt.md +0 -15
  69. package/scaffold/_preview/prompts/aikit-review.prompt.md +0 -24
  70. package/scaffold/_preview/skills/adr-skill/SKILL.md +0 -335
  71. package/scaffold/_preview/skills/adr-skill/assets/templates/adr-madr.md +0 -89
  72. package/scaffold/_preview/skills/adr-skill/assets/templates/adr-readme.md +0 -20
  73. package/scaffold/_preview/skills/adr-skill/assets/templates/adr-simple.md +0 -46
  74. package/scaffold/_preview/skills/adr-skill/references/adr-conventions.md +0 -95
  75. package/scaffold/_preview/skills/adr-skill/references/examples.md +0 -193
  76. package/scaffold/_preview/skills/adr-skill/references/review-checklist.md +0 -77
  77. package/scaffold/_preview/skills/adr-skill/references/template-variants.md +0 -52
  78. package/scaffold/_preview/skills/adr-skill/scripts/bootstrap_adr.js +0 -259
  79. package/scaffold/_preview/skills/adr-skill/scripts/new_adr.js +0 -391
  80. package/scaffold/_preview/skills/adr-skill/scripts/set_adr_status.js +0 -169
  81. package/scaffold/_preview/skills/aikit/SKILL.md +0 -754
  82. package/scaffold/_preview/skills/brainstorming/SKILL.md +0 -265
  83. package/scaffold/_preview/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  84. package/scaffold/_preview/skills/c4-architecture/SKILL.md +0 -389
  85. package/scaffold/_preview/skills/c4-architecture/references/advanced-patterns.md +0 -552
  86. package/scaffold/_preview/skills/c4-architecture/references/c4-syntax.md +0 -510
  87. package/scaffold/_preview/skills/c4-architecture/references/common-mistakes.md +0 -437
  88. package/scaffold/_preview/skills/c4-architecture/references/html-design-system.md +0 -337
  89. package/scaffold/_preview/skills/c4-architecture/references/html-template.html +0 -627
  90. package/scaffold/_preview/skills/docs/SKILL.md +0 -553
  91. package/scaffold/_preview/skills/docs/references/diataxis-anti-patterns.md +0 -147
  92. package/scaffold/_preview/skills/docs/references/diataxis-compass.md +0 -123
  93. package/scaffold/_preview/skills/docs/references/diataxis-quadrants.md +0 -192
  94. package/scaffold/_preview/skills/docs/references/diataxis-quality.md +0 -76
  95. package/scaffold/_preview/skills/docs/references/diataxis-templates.md +0 -120
  96. package/scaffold/_preview/skills/docs/references/flow-artifacts-guide.md +0 -70
  97. package/scaffold/_preview/skills/docs/references/project-knowledge-gotchas.md +0 -32
  98. package/scaffold/_preview/skills/docs/references/project-knowledge-templates.md +0 -281
  99. package/scaffold/_preview/skills/docs/references/project-knowledge-workflow.md +0 -80
  100. package/scaffold/_preview/skills/frontend-design/SKILL.md +0 -237
  101. package/scaffold/_preview/skills/lesson-learned/SKILL.md +0 -113
  102. package/scaffold/_preview/skills/lesson-learned/references/anti-patterns.md +0 -55
  103. package/scaffold/_preview/skills/lesson-learned/references/se-principles.md +0 -109
  104. package/scaffold/_preview/skills/multi-agents-development/SKILL.md +0 -448
  105. package/scaffold/_preview/skills/multi-agents-development/architecture-review-prompt.md +0 -81
  106. package/scaffold/_preview/skills/multi-agents-development/code-quality-review-prompt.md +0 -91
  107. package/scaffold/_preview/skills/multi-agents-development/implementer-prompt.md +0 -93
  108. package/scaffold/_preview/skills/multi-agents-development/parallel-dispatch-example.md +0 -167
  109. package/scaffold/_preview/skills/multi-agents-development/spec-review-prompt.md +0 -81
  110. package/scaffold/_preview/skills/present/SKILL.md +0 -616
  111. package/scaffold/_preview/skills/react/SKILL.md +0 -309
  112. package/scaffold/_preview/skills/repo-access/SKILL.md +0 -178
  113. package/scaffold/_preview/skills/repo-access/references/error-patterns.md +0 -116
  114. package/scaffold/_preview/skills/repo-access/references/platform-matrix.md +0 -142
  115. package/scaffold/_preview/skills/requirements-clarity/SKILL.md +0 -333
  116. package/scaffold/_preview/skills/session-handoff/SKILL.md +0 -199
  117. package/scaffold/_preview/skills/session-handoff/references/handoff-template.md +0 -139
  118. package/scaffold/_preview/skills/session-handoff/references/resume-checklist.md +0 -80
  119. package/scaffold/_preview/skills/session-handoff/scripts/check_staleness.js +0 -269
  120. package/scaffold/_preview/skills/session-handoff/scripts/create_handoff.js +0 -299
  121. package/scaffold/_preview/skills/session-handoff/scripts/list_handoffs.js +0 -113
  122. package/scaffold/_preview/skills/session-handoff/scripts/validate_handoff.js +0 -241
  123. package/scaffold/_preview/skills/typescript/SKILL.md +0 -405
  124. package/scaffold/adapters/claude-code.mjs +0 -73
  125. package/scaffold/adapters/copilot.mjs +0 -292
  126. package/scaffold/adapters/flows.mjs +0 -27
  127. package/scaffold/adapters/skills.mjs +0 -25
  128. package/scaffold/generate.mjs +0 -92
@@ -1,7 +1,4 @@
1
- // Auto-generated by scaffold/compile.mjs — DO NOT EDIT
2
- export const SKILLS = {
3
- "adr-skill": [
4
- { file: "assets/templates/adr-madr.md", content: `---
1
+ const e={"adr-skill":[{file:`assets/templates/adr-madr.md`,content:`---
5
2
  status: '{proposed | accepted | rejected | deprecated | superseded by [title](YYYY-MM-DD-title.md)}'
6
3
  date: { YYYY-MM-DD }
7
4
  decision-makers: '{list everyone who owns the decision}'
@@ -90,29 +87,7 @@ Chosen option: "{title of option 1}", because {justification — reference drive
90
87
  ## More Information
91
88
 
92
89
  {Additional context, links to related ADRs, team agreements, implementation notes, or conditions that would trigger revisiting this decision. This section is a catch-all for anything that helps future readers (human or agent) understand the full picture.}
93
- ` },
94
- { file: "assets/templates/adr-readme.md", content: `# Architecture Decision Records (ADR)
95
-
96
- An Architecture Decision Record (ADR) captures an important architecture decision along with its context and consequences.
97
-
98
- ## Conventions
99
-
100
- - Directory: \`{ADR_DIR}\`
101
- - Naming:
102
- - Use date-prefixed files: \`YYYY-MM-DD-choose-database.md\`
103
- - If the repo already uses slug-only names, keep that: \`choose-database.md\`
104
- - Status values: \`proposed\`, \`accepted\`, \`rejected\`, \`deprecated\`, \`superseded\`
105
-
106
- ## Workflow
107
-
108
- - Create a new ADR as \`proposed\`.
109
- - Discuss and iterate.
110
- - When the team commits: mark it \`accepted\` (or \`rejected\`).
111
- - If replaced later: create a new ADR and mark the old one \`superseded\` with a link.
112
-
113
- ## ADRs
114
- ` },
115
- { file: "assets/templates/adr-simple.md", content: `---
90
+ `},{file:`assets/templates/adr-readme.md`,content:"# Architecture Decision Records (ADR)\n\nAn Architecture Decision Record (ADR) captures an important architecture decision along with its context and consequences.\n\n## Conventions\n\n- Directory: `{ADR_DIR}`\n- Naming:\n - Use date-prefixed files: `YYYY-MM-DD-choose-database.md`\n - If the repo already uses slug-only names, keep that: `choose-database.md`\n- Status values: `proposed`, `accepted`, `rejected`, `deprecated`, `superseded`\n\n## Workflow\n\n- Create a new ADR as `proposed`.\n- Discuss and iterate.\n- When the team commits: mark it `accepted` (or `rejected`).\n- If replaced later: create a new ADR and mark the old one `superseded` with a link.\n\n## ADRs\n"},{file:`assets/templates/adr-simple.md`,content:`---
116
91
  status: '{proposed | accepted | rejected | deprecated | superseded by [title](YYYY-MM-DD-title.md)}'
117
92
  date: { YYYY-MM-DD }
118
93
  decision-makers: '{list everyone who owns the decision}'
@@ -158,8 +133,7 @@ decision-makers: '{list everyone who owns the decision}'
158
133
  ## More Information
159
134
 
160
135
  {Related ADRs, PRs, issues, docs, or conditions that would trigger revisiting this decision.}
161
- ` },
162
- { file: "references/adr-conventions.md", content: `# ADR Conventions (Reference)
136
+ `},{file:`references/adr-conventions.md`,content:`# ADR Conventions (Reference)
163
137
 
164
138
  ## Directory
165
139
 
@@ -254,8 +228,7 @@ contributing/decisions/ # or docs/decisions/
254
228
  Date prefixes are local to each category. Choose a categorization scheme early (by architectural layer, by domain, by team) and document it in the index.
255
229
 
256
230
  Alternative: use tags or a flat structure with a searchable index. Subdirectories are simpler and work with all tools.
257
- ` },
258
- { file: "references/examples.md", content: `# ADR Examples
231
+ `},{file:`references/examples.md`,content:`# ADR Examples
259
232
 
260
233
  These are filled-out examples showing the same decision at two levels of detail. Use these as reference when drafting ADRs — never leave placeholder text in a real ADR.
261
234
 
@@ -448,8 +421,7 @@ Spin up a fresh PostgreSQL container for each CI job.
448
421
  - Revisit trigger: if dialect-drift bugs exceed 2 per quarter, reconsider Docker PostgreSQL approach
449
422
  - Code references: after implementation, key files will have \`// ADR: 2025-06-15-use-sqlite-for-test-database\` comments at entry points
450
423
  \`\`\`
451
- ` },
452
- { file: "references/review-checklist.md", content: `# ADR Review Checklist
424
+ `},{file:`references/review-checklist.md`,content:`# ADR Review Checklist
453
425
 
454
426
  Use this checklist in Phase 3 to validate an ADR before finalizing. The goal: **could a coding agent read this ADR and start implementing the decision immediately, without asking any clarifying questions?**
455
427
 
@@ -526,8 +498,7 @@ Count the checked items. This isn't a gate — it's a conversation tool.
526
498
  | Implementation Plan says "update the code" | Too abstract | Ask: "which files, which functions, what pattern?" |
527
499
  | Verification says "it works" | Not testable | Ask: "what command would you run to prove it works?" |
528
500
  | No affected paths listed | Implementation Plan is hand-wavy | Agent should scan the codebase and propose specific paths |
529
- ` },
530
- { file: "references/template-variants.md", content: `# Template Variants
501
+ `},{file:`references/template-variants.md`,content:`# Template Variants
531
502
 
532
503
  This skill ships two templates in \`assets/templates/\`.
533
504
 
@@ -579,8 +550,7 @@ This template aligns with [MADR 4.0](https://adr.github.io/madr/) and extends it
579
550
  | Needs stakeholder review | No | Yes |
580
551
 
581
552
  When in doubt, start with Simple. You can always expand to MADR if the discussion reveals more complexity.
582
- ` },
583
- { file: "scripts/bootstrap_adr.js", content: `#!/usr/bin/env node
553
+ `},{file:`scripts/bootstrap_adr.js`,content:`#!/usr/bin/env node
584
554
  /**
585
555
  * Bootstrap ADRs in a repo:
586
556
  * - create ADR directory
@@ -839,8 +809,7 @@ function main() {
839
809
  }
840
810
 
841
811
  main();
842
- ` },
843
- { file: "scripts/new_adr.js", content: `#!/usr/bin/env node
812
+ `},{file:`scripts/new_adr.js`,content:`#!/usr/bin/env node
844
813
  /**
845
814
  * Create a new ADR markdown file using repo conventions and a template.
846
815
  *
@@ -1231,8 +1200,7 @@ function main() {
1231
1200
  }
1232
1201
 
1233
1202
  main();
1234
- ` },
1235
- { file: "scripts/set_adr_status.js", content: `#!/usr/bin/env node
1203
+ `},{file:`scripts/set_adr_status.js`,content:`#!/usr/bin/env node
1236
1204
  /**
1237
1205
  * Update an ADR's status in-place.
1238
1206
  *
@@ -1401,8 +1369,7 @@ function main() {
1401
1369
  }
1402
1370
 
1403
1371
  main();
1404
- ` },
1405
- { file: "SKILL.md", content: `---
1372
+ `},{file:`SKILL.md`,content:`---
1406
1373
  name: adr-skill
1407
1374
  description: Create and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose, write, update, accept/reject, deprecate, or supersede an ADR; bootstrap an adr folder and index; consult existing ADRs before implementing changes; or enforce ADR conventions. This skill uses Socratic questioning to capture intent before drafting, and validates output against an agent-readiness checklist.
1408
1375
  metadata:
@@ -1737,767 +1704,7 @@ Notes:
1737
1704
  - Scripts auto-detect ADR directory and filename strategy.
1738
1705
  - Use \`--dir\` and \`--strategy\` to override.
1739
1706
  - Use \`--json\` to emit machine-readable output.
1740
- ` },
1741
- ],
1742
- "aikit": [
1743
- { file: "SKILL.md", content: `---
1744
- name: aikit
1745
- description: "Use the @vpxa/aikit AI Kit MCP server for codebase search, analysis, and persistent memory. Load this skill when using aikit_search, aikit_remember, aikit_analyze_*, or any aikit_* tool. Covers all 82 MCP tools: search (hybrid/semantic/keyword), code analysis (structure, dependencies, symbols, patterns, entry points, diagrams, blast radius), knowledge graph (auto-populated module/symbol/import graph with traversal), context management (worksets, stash, checkpoints, restore, lanes), code manipulation (rename, codemod, eval), knowledge management (remember/read/update/forget), web access (fetch, search, http), FORGE protocol (ground, classify, evidence map, stratum cards, digest), brainstorming (interactive ideation sessions), presentation (rich dashboards via present tool), onboarding (full codebase analysis in one call), and developer utilities (regex, encode, measure, changelog, schema-validate, snippet, env, time)."
1746
- metadata:
1747
- category: cross-cutting
1748
- domain: general
1749
- applicability: always
1750
- inputs: [codebase]
1751
- outputs: [search-results, analysis, knowledge]
1752
- relatedSkills: [present]
1753
- ---
1754
-
1755
- # @vpxa/aikit — AI Kit
1756
-
1757
- Local-first AI developer toolkit — 82 MCP tools for search, analysis, context compression, FORGE quality gates, knowledge management, code manipulation, execution, web access, brainstorming, presentation, and developer utilities.
1758
-
1759
- ## When to Use
1760
-
1761
- - You need long-term memory across coding sessions
1762
- - You want to search a codebase semantically (by meaning, not just keywords)
1763
- - You need to compress large contexts to focus on what matters
1764
- - You want structured output from build tools (tsc, vitest, biome, git)
1765
- - You need to plan which files to read for a task
1766
- - You want to safely explore refactors in isolated lanes
1767
- - You need to rename symbols, apply codemods, or run code transformations
1768
- - You want to fetch and read web pages or search the web
1769
- - You need to make HTTP requests, test APIs, or debug endpoints
1770
- - You want to test regex patterns, encode/decode data, or validate JSON schemas
1771
- - You need code complexity metrics or a git changelog
1772
- - You want to save and reuse code snippets across sessions
1773
-
1774
- ## Skills Reference
1775
-
1776
- | Context | Skill | Load when |
1777
- |---------|-------|----------|
1778
- | Repository access recovery | \`repo-access\` | When encountering git auth failures, accessing private/enterprise repos, or when \`web_fetch\`/\`http\` returns auth errors on repository URLs. |
1779
-
1780
- ## Architecture
1781
-
1782
- 10-package monorepo published as a single npm package:
1783
-
1784
- \`\`\`
1785
- core → store → embeddings → chunker → indexer → analyzers → tools → server → cli → tui
1786
- \`\`\`
1787
-
1788
- - **MCP server**: 82 tools + 2 resources (via \`@modelcontextprotocol/sdk\`)
1789
- - **CLI**: 45 commands (thin dispatcher + 10 command groups)
1790
- - **Search**: Hybrid vector + keyword + RRF fusion
1791
- - **Embeddings**: ONNX local (mxbai-embed-large-v1, 1024 dimensions)
1792
- - **Vector store**: LanceDB (embedded, zero infrastructure)
1793
- - **Chunking**: Tree-sitter AST (TS/JS/Python/Go/Rust/Java) + regex fallback
1794
- - **TUI**: Ink/React dashboard for human monitoring (search, status, curated, activity log)
1795
-
1796
- ## Session Protocol (MANDATORY)
1797
-
1798
- ### Start (do ALL)
1799
- \`\`\`
1800
- flow_status({}) # Check/resume active flow FIRST
1801
- # If flow active → flow_read_instruction({ step }) → follow step instructions
1802
- status({}) # Check AI Kit health + onboard state
1803
- # If onboard not run → onboard({ path: "." }) # First-time codebase analysis
1804
- flow_list({}) # See available flows
1805
- # Select flow based on task → flow_start({ flow: "<name>", topic: "<task>" }) # Start — creates .flows/{topic}/
1806
- list() # See stored knowledge
1807
- search({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
1808
- \`\`\`
1809
-
1810
- ### During Session
1811
- \`\`\`
1812
- search → scope_map → symbol → trace (orient)
1813
- check → test_run (validate changes)
1814
- remember (capture insights)
1815
- \`\`\`
1816
-
1817
- ### End of Session
1818
- \`\`\`
1819
- session_digest({ persist: true }) # Auto-capture session activity
1820
- remember({ title: "Session checkpoint: <topic>", content: "<what was done, decisions made, next steps>", category: "conventions" })
1821
- \`\`\`
1822
-
1823
- ## Tool Catalog (82 tools)
1824
-
1825
- ### Search & Discovery (8)
1826
- | Tool | CLI | Purpose |
1827
- |------|-----|---------|
1828
- | \`search\` | \`aikit search\` | Hybrid/semantic/keyword search with \`search_mode\` param |
1829
- | \`find\` | \`aikit find\` | Federated search: vector + FTS + glob + regex in one call. Use \`mode: 'examples'\` to find usage examples. |
1830
- | \`symbol\` | \`aikit symbol\` | Resolve symbol definition, imports, and references |
1831
- | \`lookup\` | \`aikit lookup\` | Full-file retrieval by path or record ID |
1832
- | \`scope_map\` | \`aikit scope-map\` | Task-scoped reading plan with token estimates |
1833
- | \`trace\` | \`aikit trace\` | Forward/backward flow tracing through call chains |
1834
- | \`dead_symbols\` | \`aikit dead-symbols\` | Find exported symbols never imported — separates source (actionable) from docs (informational). Accepts \`path\` to scope the search. |
1835
- | \`file_summary\` | \`aikit summarize\` | Structural overview of a file (exports, imports, functions) |
1836
-
1837
- ### Code Analysis (7)
1838
- | Tool | CLI | Purpose |
1839
- |------|-----|---------|
1840
- | \`analyze_structure\` | \`aikit analyze structure\` | Project structure overview |
1841
- | \`analyze_dependencies\` | \`aikit analyze deps\` | Dependency graph with confidence |
1842
- | \`analyze_symbols\` | \`aikit analyze symbols\` | Symbol extraction and cross-references |
1843
- | \`analyze_patterns\` | \`aikit analyze patterns\` | Design pattern detection |
1844
- | \`analyze_entry_points\` | \`aikit analyze entry-points\` | Find entry points: handlers, CDK constructs, test suites, package exports (walks workspace packages) |
1845
- | \`analyze_diagram\` | \`aikit analyze diagram\` | Generate Mermaid diagrams |
1846
- | \`blast_radius\` | \`aikit analyze blast-radius\` | Change impact analysis |
1847
-
1848
- ### Context Management (6)
1849
- | Tool | CLI | Purpose |
1850
- |------|-----|---------|
1851
- | \`compact\` | \`aikit compact\` | Compress text to relevant sections using embeddings (no LLM). Accepts \`path\` for server-side file read. |
1852
- | \`workset\` | \`aikit workset\` | Named file set management (save/load/add/remove) |
1853
- | \`stash\` | \`aikit stash\` | Named key-value store for session data |
1854
- | \`checkpoint\` | \`aikit checkpoint\` | Save/restore session checkpoints |
1855
- | \`restore\` | \`aikit restore\` | Restore a previously saved checkpoint |
1856
- | \`parse_output\` | \`aikit parse-output\` | Parse tsc/vitest/biome/git output → structured JSON |
1857
-
1858
- ### Code Manipulation (4)
1859
- | Tool | CLI | Purpose |
1860
- |------|-----|---------|
1861
- | \`rename\` | \`aikit rename\` | Smart whole-word symbol rename across files (dry-run supported) |
1862
- | \`codemod\` | \`aikit codemod\` | Regex-based code transformations with rules (dry-run supported) |
1863
- | \`diff_parse\` | \`aikit diff\` | Parse unified diff → structured changes |
1864
- | \`data_transform\` | \`aikit transform\` | JQ-like JSON transformations |
1865
-
1866
- ### Execution & Validation (5)
1867
- | Tool | CLI | Purpose |
1868
- |------|-----|---------|
1869
- | \`eval\` | \`aikit eval\` | Sandboxed JavaScript/TypeScript execution |
1870
- | \`check\` | \`aikit check\` | Incremental typecheck + lint. \`detail\` param: summary (default, ~300 tokens), errors, full |
1871
- | \`test_run\` | \`aikit test\` | Run tests with structured pass/fail results |
1872
- | \`batch\` | \`aikit batch\` | Execute multiple operations in parallel |
1873
- | \`audit\` | \`aikit audit\` | Unified project audit: structure, deps, patterns, health, dead symbols, check, entry points → synthesized report with score and recommendations. 6 round-trips → 1. |
1874
-
1875
- ### Knowledge Management (6)
1876
- | Tool | CLI | Purpose |
1877
- |------|-----|---------|
1878
- | \`remember\` | \`aikit remember\` | Store a curated knowledge entry |
1879
- | \`update\` | \`aikit update\` | Update an existing entry |
1880
- | \`forget\` | \`aikit forget\` | Delete an entry (requires reason) |
1881
- | \`read\` | \`aikit read\` | Read a curated entry by path |
1882
- | \`list\` | \`aikit list\` | List curated entries |
1883
- | \`produce_knowledge\` | — | Auto-generate knowledge from analysis |
1884
-
1885
- ### Auto-Knowledge (automatic background extraction)
1886
-
1887
- Auto-knowledge runs automatically in the background after every tool completion. It extracts useful facts from tool outputs and stores them in curated memory — no manual action required.
1888
-
1889
- **What gets captured:**
1890
-
1891
- | Extractor | Triggers on | What it stores |
1892
- |-----------|-------------|----------------|
1893
- | Test results | \`check\`, \`test_run\` | Framework detection (vitest/jest/mocha), test file naming patterns |
1894
- | Environment | \`env\`, \`config\`, \`status\` | Node.js version, OS, workspace path, store backend, embedding model |
1895
- | Research | \`web_search\`, \`web_fetch\`, \`search\` | Web research findings, fetched page summaries |
1896
- | Conventions | \`check\`, \`analyze_patterns\`, \`analyze_structure\`, \`onboard\` | Linter/formatter, TypeScript strict mode, package manager, monorepo detection |
1897
- | Build commands | \`check\`, \`test_run\` | Verified check results, test summaries, test runner commands |
1898
- | Codebase insights | \`analyze_*\`, \`scope_map\`, \`blast_radius\`, \`onboard\` | Structure analysis, dependency info, entry points, impact analysis |
1899
- | Tool failures | All tools (global) | Classified actionable errors (filters out transient network/ENOENT errors) |
1900
-
1901
- **Quality controls:**
1902
- - **Quality gate**: Facts scored 0-1; only facts >= 0.3 are stored
1903
- - **Dedup**: Checks existing curated titles + in-memory hash dedup
1904
- - **TTL**: Transient facts (errors, blast radius, search context) automatically expire after 1-2 hours
1905
- - **Session limit**: Maximum 50 auto-knowledge facts per session
1906
-
1907
- **Searching auto-knowledge:**
1908
- Auto-knowledge facts are stored as regular curated entries. Search them with:
1909
- \`\`\`
1910
- search({ query: "error patterns", origin: "curated" })
1911
- search({ query: "conventions", origin: "curated" })
1912
- list({ category: "conventions" })
1913
- list({ tags: ["errors"] })
1914
- \`\`\`
1915
-
1916
- ### Verified Lanes (1 tool, 6 actions)
1917
- | Tool | CLI | Purpose |
1918
- |------|-----|---------|
1919
- | \`lane\` | \`aikit lane\` | Manage isolated file copies for parallel exploration |
1920
-
1921
- Lane actions: \`create\` (copy files to lane), \`list\`, \`status\` (modified/added/deleted), \`diff\` (line-level diff), \`merge\` (apply back to originals), \`discard\`.
1922
-
1923
- ### Git & Environment (4)
1924
- | Tool | CLI | Purpose |
1925
- |------|-----|---------|
1926
- | \`git_context\` | \`aikit git\` | Branch, status, recent commits |
1927
- | \`process\` | \`aikit proc\` | Process supervisor (start/stop/logs) |
1928
- | \`watch\` | \`aikit watch\` | Filesystem watcher |
1929
- | \`delegate\` | \`aikit delegate\` | Delegate subtask to local Ollama model |
1930
-
1931
- ### Web & Network (3)
1932
- | Tool | CLI | Purpose |
1933
- |------|-----|---------|
1934
- | \`web_fetch\` | — | Fetch web page → markdown/raw/links/outline for LLM consumption |
1935
- | \`web_search\` | — | Search the web via DuckDuckGo (no API key needed) |
1936
- | \`http\` | — | Make HTTP requests for API testing/debugging |
1937
-
1938
- ### Developer Utilities (8)
1939
- | Tool | CLI | Purpose |
1940
- |------|-----|---------|
1941
- | \`regex_test\` | — | Test regex patterns with match/replace/split modes |
1942
- | \`encode\` | — | Base64, URL, SHA-256, MD5, hex encode/decode, JWT decode |
1943
- | \`measure\` | — | Code complexity metrics (cyclomatic, cognitive complexity, lines, functions) |
1944
- | \`changelog\` | — | Generate changelog from git history (conventional commits) |
1945
- | \`schema_validate\` | — | Validate JSON data against JSON Schema |
1946
- | \`snippet\` | — | Save/get/search/delete persistent code snippets |
1947
- | \`env\` | — | System and runtime environment info (sensitive values redacted) |
1948
- | \`time\` | — | Date parsing, timezone conversion, duration math |
1949
-
1950
- ### FORGE Quality Gates (5)
1951
- | Tool | CLI | Purpose |
1952
- |------|-----|---------|
1953
- | \`forge_ground\` | — | Full Ground phase: classify tier, scope map, unknowns, constraints |
1954
- | \`forge_classify\` | — | Quick tier classification (Floor/Standard/Critical) |
1955
- | \`evidence_map\` | — | CRUD + Gate evaluation for verified/assumed/unknown claims. Safety gate tags (\`provenance\`/\`commitment\`/\`coverage\`) enable mandatory pre-YIELD checks |
1956
- | \`stratum_card\` | — | Generate T1/T2 compressed context cards from files (10-100x token reduction) |
1957
- | \`digest\` | — | Compress N text sources into token-budgeted summary |
1958
-
1959
- ### System (9)
1960
- | Tool | CLI | Purpose |
1961
- |------|-----|---------|
1962
- | \`config\` | \`aikit config\` | View or update project configuration (kb.config.json) |
1963
- | \`status\` | \`aikit status\` | Index statistics |
1964
- | \`reindex\` | \`aikit reindex\` | Rebuild index |
1965
- | \`health\` | \`aikit health\` | Project health checks (package.json, tsconfig, lockfile, circular deps) |
1966
- | \`guide\` | \`aikit guide\` | Tool discovery — given a goal, recommends tools and workflow order |
1967
- | \`onboard\` | \`aikit onboard\` | Full codebase onboarding in one call (structure + deps + patterns + knowledge) |
1968
- | \`graph\` | \`aikit graph\` | Query the auto-populated knowledge graph (modules, symbols, imports) |
1969
- | \`queue\` | \`aikit queue\` | Task queue for sequential agent operations (create/push/next/done/fail) |
1970
- | \`replay\` | \`aikit replay\` | View or clear the audit trail of tool invocations (action: list/clear) |
1971
-
1972
- ### Flows (11)
1973
- | Tool | CLI | Purpose |
1974
- |------|-----|---------|
1975
- | \`flow_list\` | \`aikit flow list\` | List available flows and active run |
1976
- | \`flow_info\` | \`aikit flow info\` | Get flow details including steps and skill paths |
1977
- | \`flow_start\` | \`aikit flow start\` | Start a flow with topic — creates \`.flows/{topic-slug}/\` run directory |
1978
- | \`flow_step\` | \`aikit flow step\` | Advance, skip, or redo the current step |
1979
- | \`flow_status\` | \`aikit flow status\` | Check active run including slug, runDir, artifactsPath |
1980
- | \`flow_read_instruction\` | \`aikit flow read-instruction\` | Read instruction with \`{{artifacts_path}}\` and \`{{run_dir}}\` resolved |
1981
- | \`flow_reset\` | \`aikit flow reset\` | Abandon the active flow (preserves run directory) |
1982
- | \`flow_runs\` | \`aikit flow runs\` | List all flow runs (current and past) |
1983
- | \`flow_add\` | \`aikit flow add\` | Add a custom flow from a directory |
1984
- | \`flow_update\` | \`aikit flow update\` | Update an existing custom flow |
1985
- | \`flow_remove\` | \`aikit flow remove\` | Remove a custom flow |
1986
-
1987
- ### Presentation (1)
1988
- | Tool | CLI | Purpose |
1989
- |------|-----|---------|
1990
- | \`present\` | — | Rich dashboards, charts, tables, timelines. Use \`format: "browser"\` then \`openBrowserPage\` to display. **In CLI mode (no VS Code chat), always use \`format: "browser"\`** — \`html\` UIResource is invisible in terminal. |
1991
-
1992
- ### Brainstorming (1)
1993
- | Tool | CLI | Purpose |
1994
- |------|-----|---------|
1995
- | \`brainstorm\` | — | Interactive brainstorming and ideation sessions with structured output |
1996
-
1997
- ### Meta-Tools — Tool Discovery (3)
1998
- | Tool | CLI | Purpose |
1999
- |------|-----|---------|
2000
- | \`list_tools\` | — | List all active AI Kit tools with names, titles, and categories. Accepts optional \`category\` filter. Use for initial tool discovery. |
2001
- | \`describe_tool\` | — | Get detailed metadata for a specific tool (title, categories, annotations). Use after \`list_tools\` to understand a tool before calling it. |
2002
- | \`search_tools\` | — | Search active tools by keyword across names, titles, and categories. Use when you know what you need but not the tool name. |
2003
-
2004
- ### Session Management (1)
2005
- | Tool | CLI | Purpose |
2006
- |------|-----|---------|
2007
- | \`session_digest\` | — | Generate a compressed digest of session activity (replay log, stash, checkpoints). Options: \`scope\` (tools/stash/all), \`since\`, \`last\`, \`focus\`, \`mode\` (deterministic/sampling), \`tokenBudget\`, \`persist\`. Use at session end for handoff or mid-session to review what happened. |
2008
-
2009
- ## Flow System
2010
-
2011
- Flows are multi-step guided workflows that structure complex tasks. Each step has a skill file with detailed instructions, required artifacts, and agent assignments.
2012
-
2013
- ### Built-in Flows
2014
-
2015
- | Flow | Steps | Use When |
2016
- |------|-------|----------|
2017
- | \`aikit:basic\` | assess → implement → verify | Bug fixes, config changes, small features |
2018
- | \`aikit:advanced\` | spec → plan → task → execute → verify | New modules, cross-service changes, architectural work |
2019
-
2020
- ### Flow Lifecycle
2021
-
2022
- \`\`\`text
2023
- flow_list() # See available flows
2024
- flow_info({ flow: "aikit:basic" }) # View steps, skills, agents
2025
- flow_start({ flow: "aikit:basic", topic: "Fix login bug" }) # Start — creates .flows/fix-login-bug/
2026
- flow_read_instruction() # Read current step's instructions ({{artifacts_path}} resolved)
2027
- # ... do the work described in the instruction ...
2028
- flow_step({ action: "next" }) # Advance to next step
2029
- flow_step({ action: "skip" }) # Skip current step
2030
- flow_step({ action: "redo" }) # Redo current step
2031
- flow_status() # Check progress (includes slug, runDir, artifactsPath, phase, isEpilogue)
2032
- flow_reset() # Abandon active flow
2033
- flow_runs() # List all runs (current + past)
2034
- # Epilogue steps (mandatory, injected after every flow):
2035
- # After last flow step → _docs-sync epilogue runs automatically
2036
- # flow_status() shows phase: 'after', isEpilogue: true during epilogue
2037
- \`\`\`
2038
-
2039
- Custom flow lifecycle management:
2040
-
2041
- \`\`\`text
2042
- flow_add({ source: ".github/flows/my-flow" })
2043
- flow_update({ name: "my-flow" })
2044
- flow_remove({ name: "my-flow" })
2045
- \`\`\`
2046
-
2047
- ### Creating Custom Flows
2048
-
2049
- 1. Create a directory under \`.github/flows/<flow-name>/\`
2050
- 2. Add \`manifest.yaml\`:
2051
-
2052
- \`\`\`yaml
2053
- name: my-flow
2054
- version: "1.0.0"
2055
- description: "My custom flow"
2056
- artifacts_dir: .spec
2057
- steps:
2058
- - id: design
2059
- name: Design
2060
- instruction: steps/design/README.md
2061
- description: "Create the design document"
2062
- produces: [design.md]
2063
- requires: []
2064
- agents: [Planner]
2065
- - id: implement
2066
- name: Implement
2067
- instruction: steps/implement/README.md
2068
- description: "Implement the design"
2069
- produces: [code]
2070
- requires: [design]
2071
- agents: [Implementer]
2072
- agents:
2073
- - agents/planner.agent.md
2074
- install: []
2075
- \`\`\`
2076
-
2077
- 3. Add skill files under \`.github/flows/<flow-name>/skills/<step-id>/SKILL.md\`
2078
- 4. The flow appears in \`flow_list()\` automatically
2079
-
2080
- ### How Flows Are Delivered
2081
-
2082
- - **Built-in flows** ship with the AI Kit MCP server in \`scaffold/flows/\`
2083
- - \`aikit init\` copies them to \`.github/flows/\` in your workspace
2084
- - At runtime, flow tools resolve paths to \`.github/flows/\` (workspace-local copies)
2085
- - Custom flows placed in \`.github/flows/\` are discovered alongside built-in ones
2086
-
2087
- ### Agent-Flow Integration
2088
-
2089
- - All code agents have a "Flows" section instructing them to check \`flow_status()\` first
2090
- - If a flow is active, the agent follows the current step's instruction via \`flow_read_instruction()\`
2091
- - After completing a step's work, advance with \`flow_step({ action: "next" })\`
2092
- - The **Orchestrator** selects and starts flows; other agents follow them
2093
- - The **Orchestrator** specifies \`aikit\` skill loading — all agents should load \`aikit\` skill to access flow tools
2094
-
2095
- ## CRITICAL: Use AI Kit Tools Instead of Native IDE Tools
2096
-
2097
- AI Kit tools provide **10x richer output** than native IDE tools — with AST-analyzed call graphs, scope context, import classification, and cognitive complexity. **You MUST use AI Kit tools instead of native read/search tools.**
2098
-
2099
- ### ⛔ PROHIBITED: Native File Reading
2100
-
2101
- **\`read_file\` / \`read_file_raw\` MUST NOT be used to understand code.** They waste tokens and miss structural information.
2102
-
2103
- The **ONLY** acceptable use of \`read_file\`: getting exact lines immediately before an edit (to verify the \`old_str\` for replacement). Even then, use \`file_summary\` first to identify which lines to read.
2104
-
2105
- ### Tool Replacement Table
2106
-
2107
- | ❌ NEVER do this | ✅ Use AI Kit Tool | Why |
2108
- |---|---|---|
2109
- | \`read_file\` (full file) | \`file_summary\` | Exports, imports, call edges — **10x fewer tokens** |
2110
- | \`read_file\` (specific section) | \`compact({ path, query })\` | Server-side read + extract — **5-20x reduction** |
2111
- | \`grep_search\` / \`textSearch\` | \`search\` | Semantic + keyword hybrid across all indexed content |
2112
- | \`grep_search\` for a symbol | \`symbol\` | Definition + references **with scope context** |
2113
- | Multiple \`read_file\` calls | \`digest\` | Compresses multiple sources into token-budgeted summary |
2114
- | \`listDirectory\` + \`read_file\` | \`scope_map\` | Identifies relevant files for a task automatically |
2115
- | Manual code tracing | \`trace\` | AST call-graph traversal with scope context |
2116
- | Line counting / \`wc\` | \`measure\` | Lines, complexity, **cognitive complexity**, functions |
2117
- | Grep for unused exports | \`dead_symbols\` | AST-powered export detection with regex fallback |
2118
- | Repeated file reads | \`stratum_card\` | Reusable compressed context — **10-100x reduction** |
2119
- | \`fetch_webpage\` | \`web_fetch\` | Readability extract + token budget — richer output |
2120
- | Web research / browsing | \`web_search\` | Structured web results without browser — **unique to KB** |
2121
-
2122
- ### Decision Tree — How to Read Code
2123
-
2124
- \`\`\`
2125
- Need to understand a file?
2126
- ├─ Just structure? → file_summary (exports, imports, call edges — ~50 tokens)
2127
- ├─ Specific section? → compact({ path, query }) — 5-20x reduction
2128
- ├─ Multiple files? → digest (multi-source compression — token-budgeted)
2129
- ├─ Repeated reference? → stratum_card (T1/T2 card — 10-100x reduction)
2130
- ├─ Need exact lines to EDIT? → read_file (the ONLY acceptable use)
2131
- └─ "I want to read the whole file" → ⛔ STOP. Use file_summary or compact instead.
2132
- \`\`\`
2133
-
2134
- ### Decision Tree — Need Structural Relationships?
2135
-
2136
- When vector search and file reads don't answer the question (e.g. "who imports this?",
2137
- "what does this depend on?", "how are these files connected?"), use \`graph\`:
2138
-
2139
- \`\`\`
2140
- Need to understand relationships between code?
2141
- ├─ Who imports / calls this? → graph({action:'find_nodes', name_pattern}) → graph({action:'neighbors', node_id, direction:'incoming'})
2142
- ├─ What does this depend on? → graph({action:'neighbors', node_id, direction:'outgoing'})
2143
- ├─ Full context for a symbol? → graph({action:'symbol360', name})
2144
- ├─ Related files within N hops? → graph({action:'traverse', node_id, max_depth:2})
2145
- ├─ Layer/module isolation check? → graph({action:'depth_traverse', node_id, max_depth:3})
2146
- └─ Graph size/health? → graph({action:'stats'})
2147
- \`\`\`
2148
-
2149
- **Use this BEFORE** reaching for \`analyze_dependencies\` (slower, less precise) or manually
2150
- tracing via \`symbol\` + \`trace\` chains. The graph is auto-populated during indexing.
2151
-
2152
- ### What AI Kit Tools Return (AST-Enhanced)
2153
-
2154
- These tools use Tree-sitter WASM to analyze source code at the AST level, providing structured data that raw file reads cannot:
2155
-
2156
- | Tool | Rich Output |
2157
- |------|-------------|
2158
- | \`file_summary\` | Imports classified as **external vs internal** (\`isExternal\` flag). **Call edges** between functions (e.g., \`handleRequest() → validateInput() @ line 42\`). \`exported\` flag on interfaces and types. Import count breakdown. |
2159
- | \`symbol\` | References include **scope** — which function/class/method contains each usage (e.g., \`referenced in processOrder() at auth-service.ts:55\`). |
2160
- | \`trace\` | **Call-graph edges** discovered via AST syntax tree, not text matching. Supports forward (who does X call?) and backward (who calls X?) tracing. Scope context on each node. |
2161
- | \`measure\` | **Cognitive complexity** — weights nesting depth (nested \`if\` inside \`for\` inside \`try\` scores higher). More useful than cyclomatic complexity for understanding code difficulty. |
2162
- | \`dead_symbols\` | **AST export enumeration** — catches \`export default\`, barrel re-exports (\`export { x } from\`), \`export =\`, and \`export type\`. Regex fallback for non-AST-supported languages. |
2163
-
2164
- ### Example: \`file_summary\` Output
2165
-
2166
- \`\`\`
2167
- src/auth-service.ts
2168
- Language: typescript | Lines: 180 | Estimated tokens: ~1400
2169
-
2170
- Imports (6): 3 external, 3 internal
2171
- - import { hash } from 'bcrypt' [external]
2172
- - import { UserRepo } from './user-repo' [internal]
2173
-
2174
- Functions (4):
2175
- - authenticate @ line 22 [exported]
2176
- - validateToken @ line 55 [exported]
2177
- - hashPassword @ line 90
2178
- - generateJwt @ line 110
2179
-
2180
- Call edges (12 intra-file):
2181
- - authenticate() → hashPassword() @ line 35
2182
- - authenticate() → generateJwt() @ line 42
2183
- - validateToken() → UserRepo.findById() @ line 68
2184
-
2185
- Interfaces (2):
2186
- - AuthResult @ line 8 [exported]
2187
- - TokenPayload @ line 14
2188
- \`\`\`
2189
-
2190
- Compare: \`read_file\` would cost ~1400 tokens for raw text. \`file_summary\` gives structured data in ~120 tokens — **12x reduction** with richer information.
2191
-
2192
- ## Search Strategy
2193
-
2194
- 1. **Start broad**: \`search({ query: "topic", search_mode: "hybrid" })\`
2195
- 2. **Narrow**: Add \`content_type\`, \`origin\`, or \`category\` filters
2196
- 3. **Exact match**: Use \`search_mode: "keyword"\` for identifiers
2197
- 4. **Federated**: Use \`find\` to combine vector + glob + regex
2198
-
2199
- ## Workflow Chains
2200
-
2201
- ### Codebase Onboarding
2202
- \`\`\`
2203
- analyze_structure({ path: "src/" })
2204
- → analyze_dependencies({ path: "src/" })
2205
- → analyze_entry_points({ path: "src/" })
2206
- → produce_knowledge({ path: "src/" })
2207
- → remember({ title: "Codebase onboarding complete", ... })
2208
- \`\`\`
2209
-
2210
- ### Planning a Task
2211
- \`\`\`
2212
- scope_map({ task: "implement user auth" })
2213
- → compact({ path: "src/auth.ts", query: "auth flow" })
2214
- → workset({ action: "save", name: "auth-task", files: [...] })
2215
- \`\`\`
2216
-
2217
- ### Bug Investigation
2218
- \`\`\`
2219
- parse_output({ output: <error> }) → symbol({ name: "failingFn" })
2220
- → trace({ symbol: "failingFn", direction: "backward" })
2221
- → blast_radius({ changed_files: ["suspect.ts"] })
2222
- → eval({ code: "hypothesis test" }) → check({ files: ["suspect.ts"] })
2223
- \`\`\`
2224
-
2225
- ### Safe Refactor with Lanes
2226
- \`\`\`
2227
- scope_map({ task: "rename UserService" })
2228
- → lane({ action: "create", name: "refactor", files: [...] })
2229
- → [make changes in lane files]
2230
- → lane({ action: "diff", name: "refactor" })
2231
- → check({}) → test_run({})
2232
- → lane({ action: "merge", name: "refactor" })
2233
- \`\`\`
2234
-
2235
- ### Lane — isolated read-only exploration
2236
-
2237
- \`lane({ action:'create', name })\` creates an isolated copy of the workspace. Use to try approach A vs B WITHOUT touching canonical source. Other actions: \`list\`, \`diff\`, \`delete\`. Compare with \`lane({ action:'diff', names:['a','b'] })\`. Do NOT use \`lane\` for actual refactors — use \`checkpoint\` instead (\`checkpoint\` = reversible on canonical source; \`lane\` = isolated copies for comparison).
2238
-
2239
- ### After Making Changes
2240
- \`\`\`
2241
- blast_radius({ changed_files: ["src/auth.ts"] })
2242
- → check({}) → test_run({ grep: "auth" })
2243
- → reindex()
2244
- → remember({ title: "Implemented auth", content: "..." })
2245
- \`\`\`
2246
-
2247
- ### Pre-Commit Validation
2248
- \`\`\`
2249
- git_context({ diff: true })
2250
- → diff_parse({ diff: <staged diff> })
2251
- → blast_radius({ changed_files: [...] })
2252
- → check({}) → test_run({})
2253
- \`\`\`
2254
-
2255
- ---
2256
-
2257
- ## Persistent Memory (Long-Term Knowledge)
2258
-
2259
- AI Kit provides cross-session persistent memory via a curated knowledge store. Use it to remember decisions, patterns, conventions, and context that should survive beyond the current conversation.
2260
-
2261
- ### Writing to Memory
2262
-
2263
- | Tool | Purpose | Example |
2264
- |------|---------|---------|
2265
- | \`remember\` | Store a new knowledge entry | \`remember({ title: "Auth uses JWT RS256", content: "All API auth uses RS256 JWT tokens issued by /auth/token. Refresh via httpOnly cookie.", category: "decisions" })\` |
2266
- | \`update\` | Modify an existing entry | \`update({ id: "<entry-id>", content: "Updated: now also supports Ed25519" })\` |
2267
- | \`produce_knowledge\` | Auto-generate analysis entries from code | \`produce_knowledge({ path: "src/" })\` |
2268
-
2269
- **Categories** — use these to organize entries:
2270
- - \`conventions\` — coding standards, naming rules, file organization
2271
- - \`decisions\` — architecture decisions, technology choices, trade-offs made
2272
- - \`patterns\` — recurring code patterns, design patterns in use
2273
- - \`context\` — project context, domain knowledge, business rules
2274
- - \`session\` — session checkpoints for resuming work
2275
-
2276
- ### Reading from Memory
2277
-
2278
- | Tool | Purpose | Example |
2279
- |------|---------|---------|
2280
- | \`list\` | Browse all stored entries | \`list()\` or \`list({ category: "decisions" })\` |
2281
- | \`read\` | Read a specific entry by ID | \`read({ id: "<entry-id>" })\` |
2282
- | \`search\` | Find entries by content/query | \`search({ query: "authentication", origin: "curated" })\` |
2283
- | \`forget\` | Remove an outdated entry | \`forget({ id: "<entry-id>" })\` |
2284
-
2285
- ### When to Remember
2286
-
2287
- | Situation | What to store | Category |
2288
- |-----------|--------------|----------|
2289
- | Architecture decision made | Decision + rationale + alternatives considered | \`decisions\` |
2290
- | Pattern discovered in codebase | Pattern description + example locations | \`patterns\` |
2291
- | Convention established | Rule + enforcement approach | \`conventions\` |
2292
- | Session ending | Checkpoint: what was done, what's next, blockers | \`session\` |
2293
- | Bug root cause found | Root cause + fix approach + prevention strategy | \`context\` |
2294
- | External API behavior learned | Behavior quirks, rate limits, gotchas | \`context\` |
2295
-
2296
- ### Session Checkpoint Pattern
2297
-
2298
- At the END of every meaningful work session:
2299
- \`\`\`
2300
- remember({
2301
- title: "Session checkpoint: <topic>",
2302
- content: "## Done\\n- <completed items>\\n\\n## Decisions\\n- <key decisions made>\\n\\n## Next\\n- <pending work>\\n\\n## Blockers\\n- <issues encountered>",
2303
- category: "session"
2304
- })
2305
- \`\`\`
2306
-
2307
- At the START of the next session:
2308
- \`\`\`
2309
- search({ query: "SESSION CHECKPOINT", origin: "curated" }) # Find last checkpoint
2310
- list({ category: "session" }) # Browse all checkpoints
2311
- \`\`\`
2312
-
2313
- ### Memory Best Practices
2314
-
2315
- 1. **Remember decisions, not code** — store *why*, not *what*. Code changes; rationale persists.
2316
- 2. **Search before remembering** — avoid duplicates: \`search({ query: "..." })\` first.
2317
- 3. **Use categories** — structured categories enable filtered \`list()\` queries.
2318
- 4. **Checkpoint regularly** — don't wait for session end. Checkpoint at milestones.
2319
- 5. **Clean up** — \`forget()\` outdated entries. Memory is only valuable when accurate.
2320
- 6. **Cross-reference** — mention related entry titles in content for discoverability.
2321
-
2322
- ## CLI Quick Reference
2323
-
2324
- \`\`\`bash
2325
- aikit init # Scaffold AI Kit in current directory
2326
- aikit init --force # Overwrite all scaffold/skill files
2327
- aikit init --guide # JSON report of stale files for LLM-driven updates
2328
- aikit serve # Start MCP server (stdio or HTTP)
2329
- aikit search <q> # Hybrid search
2330
- aikit find <q> # Federated search
2331
- aikit symbol <name> # Resolve symbol
2332
- aikit scope-map <t> # Task reading plan
2333
- aikit compact <q> # Context compression (--path file or stdin)
2334
- aikit check # Typecheck + lint (--detail summary|errors|full)
2335
- aikit test # Run tests
2336
- aikit rename <old> <new> <path> # Rename symbol
2337
- aikit lane create <name> --files f1,f2 # Create lane
2338
- aikit lane diff <name> # View lane changes
2339
- aikit lane merge <name> # Merge lane back
2340
- aikit status # Index stats
2341
- aikit reindex # Rebuild index
2342
- \`\`\`
2343
-
2344
- ## Configuration
2345
-
2346
- \`kb.config.json\` in project root:
2347
- \`\`\`json
2348
- {
2349
- "sources": [{ "path": ".", "excludePatterns": ["node_modules/**", "**/node_modules/**", "dist/**", "coverage/**", ".aikit-data/**"] }],
2350
- "indexing": { "chunkSize": 1500, "chunkOverlap": 200, "minChunkSize": 100, "concurrency": 5 },
2351
- "embedding": { "model": "mixedbread-ai/mxbai-embed-large-v1", "dimensions": 1024 },
2352
- "store": { "backend": "lancedb", "path": ".aikit-data" },
2353
- "curated": { "path": "curated", "adapter": "filesystem" }
2354
- }
2355
- \`\`\`
2356
-
2357
- ## Tool Profiles
2358
-
2359
- Tool profiles control which subset of the 82 tools are active. Profiles reduce token overhead by exposing only relevant tools for a given task.
2360
-
2361
- ### Built-in Profiles
2362
-
2363
- | Profile | Description | Use When |
2364
- |---------|-------------|----------|
2365
- | \`full\` | All tools enabled (default) | General development, orchestration |
2366
- | \`safe\` | Read-only tools — no file/state modifications | Code review, analysis, research |
2367
- | \`research\` | Search, analysis, knowledge, web access | Investigation, documentation |
2368
- | \`minimal\` | Essential tools only — search, check, test | Simple tasks, low-token budgets |
2369
- | \`discovery\` | Full toolset + meta-tools for guided exploration | New users, onboarding, tool learning |
2370
-
2371
- ### Activating a Profile
2372
-
2373
- Set \`toolProfile\` in \`kb.config.json\`:
2374
-
2375
- \`\`\`json
2376
- {
2377
- "toolProfile": "research"
2378
- }
2379
- \`\`\`
2380
-
2381
- Base tools (\`status\`, \`config\`, \`guide\`, \`health\`) are **always available** regardless of profile.
2382
-
2383
- ### Meta-Tool Discovery Pattern (Token Cost Reduction)
2384
-
2385
- Instead of loading all 82 tool descriptions at session start, use the \`discovery\` profile:
2386
-
2387
- 1. \`list_tools()\` — get a compact list of tool names + categories (~50 tokens)
2388
- 2. \`search_tools({ query: "what I need" })\` — find relevant tools by keyword
2389
- 3. \`describe_tool({ tool_name: "specific_tool" })\` — get full metadata only for tools you'll use
2390
-
2391
- This pattern reduces initial tool-loading cost from ~3000 tokens to ~200 tokens.
2392
-
2393
- ## IDE Integration
2394
-
2395
- ### VS Code — HTTP mode (recommended for development)
2396
- \`\`\`json
2397
- // .vscode/mcp.json
2398
- {
2399
- "servers": {
2400
- "kb": {
2401
- "type": "http",
2402
- "url": "http://localhost:3210/mcp"
2403
- }
2404
- }
2405
- }
2406
- \`\`\`
2407
- Start server: \`npx aikit serve --http --port 3210\`
2408
-
2409
- ### VS Code — stdio mode (no separate server)
2410
- \`\`\`json
2411
- {
2412
- "servers": {
2413
- "kb": {
2414
- "type": "stdio",
2415
- "command": "npx",
2416
- "args": ["@vpxa/aikit", "serve", "--stdio"]
2417
- }
2418
- }
2419
- }
2420
- \`\`\`
2421
-
2422
- ### Claude Code (\`.mcp.json\`)
2423
- \`\`\`json
2424
- {
2425
- "mcpServers": {
2426
- "kb": {
2427
- "command": "npx",
2428
- "args": ["@vpxa/aikit", "serve"]
2429
- }
2430
- }
2431
- }
2432
- \`\`\`
2433
-
2434
- ## Development (Self-Dogfooding)
2435
-
2436
- When developing @vpxa/aikit itself, use the tool on its own codebase:
2437
-
2438
- \`\`\`bash
2439
- # Build → Reindex → Use loop
2440
- pnpm build # Build all 10 packages
2441
- node bin/aikit.mjs reindex # Index own source into LanceDB
2442
- node bin/aikit.mjs search "query" # Search own code
2443
- node bin/aikit.mjs symbol "FnName" # Resolve symbols in own code
2444
- node bin/aikit.mjs check # Typecheck + lint
2445
- pnpm test # Run 287+ tests
2446
-
2447
- # Start MCP server for agent use during development
2448
- node bin/aikit.mjs serve --http --port 3210
2449
- \`\`\`
2450
-
2451
- **Rules:**
2452
- - Always \`pnpm build\` before using CLI/server (runs from \`dist/\`)
2453
- - Always \`reindex\` after structural code changes
2454
- - LanceDB is single-process — don't run CLI and HTTP server simultaneously
2455
- - Curated entries in \`curated/\` survive reindex and are indexed separately
2456
-
2457
- ---
2458
-
2459
- ## Flows
2460
-
2461
- Flows are structured multi-step workflows that guide agents through complex tasks. They are the **primary workflow system** — use them instead of ad-hoc planning when a matching flow exists.
2462
-
2463
- ### Flow Tools
2464
-
2465
- | Tool | Purpose |
2466
- |------|---------|
2467
- | \`flow_status\` | Check if a flow is active + current step + phase (before/flow/after) + isEpilogue |
2468
- | \`flow_list\` | List available flows |
2469
- | \`flow_info\` | Get flow details including steps and skill paths |
2470
- | \`flow_start\` | Start a named flow |
2471
- | \`flow_step\` | Advance: \`next\`, \`skip\`, or \`redo\` current step |
2472
- | \`flow_read_instruction\` | Read the current step's instruction file content directly |
2473
- | \`flow_reset\` | Clear flow state to start over |
2474
- | \`flow_add\` | Add a custom flow from a directory |
2475
- | \`flow_update\` | Update an existing custom flow |
2476
- | \`flow_remove\` | Remove a custom flow |
2477
-
2478
- ### Flow Selection
2479
-
2480
- | Task Type | Flow | Why |
2481
- |-----------|------|-----|
2482
- | Bug fix, config change, small refactor | \`aikit:basic\` | Known scope, low risk |
2483
- | New feature in existing module | \`aikit:basic\` | Clear boundaries |
2484
- | New system/service/module | \`aikit:advanced\` | Needs spec + planning |
2485
- | Cross-service changes | \`aikit:advanced\` | Multiple boundaries |
2486
- | Architectural change | \`aikit:advanced\` | High impact |
2487
- | Unclear scope or exploratory | No flow | Use agent's native workflow |
2488
-
2489
- ### Flow Lifecycle
2490
-
2491
- 1. **Start**: \`flow_list({})\` → choose flow → \`flow_start({ flow: "<name>", topic: "<task>" })\`
2492
- 2. **Each step**: \`flow_read_instruction({ step: "<name>" })\` → follow step instructions → complete work
2493
- 3. **Advance**: \`flow_step({ action: "next" })\` → repeat from step 2
2494
- 4. **Epilogue**: After last flow step, mandatory epilogue steps run (e.g., \`_docs-sync\` updates \`docs/\`)
2495
- 5. **Resume**: \`flow_status({})\` → if active, \`flow_read_instruction\` for current step → continue
2496
- 6. **Reset**: \`flow_reset({})\` if you need to start over
2497
- ` },
2498
- ],
2499
- "brainstorming": [
2500
- { file: "SKILL.md", content: `---
1707
+ `}],aikit:[{file:`SKILL.md`,content:'---\nname: aikit\ndescription: "Use the @vpxa/aikit AI Kit MCP server for codebase search, analysis, and persistent memory. Load this skill when using aikit_search, aikit_remember, aikit_analyze_*, or any aikit_* tool. Covers all 82 MCP tools: search (hybrid/semantic/keyword), code analysis (structure, dependencies, symbols, patterns, entry points, diagrams, blast radius), knowledge graph (auto-populated module/symbol/import graph with traversal), context management (worksets, stash, checkpoints, restore, lanes), code manipulation (rename, codemod, eval), knowledge management (remember/read/update/forget), web access (fetch, search, http), FORGE protocol (ground, classify, evidence map, stratum cards, digest), brainstorming (interactive ideation sessions), presentation (rich dashboards via present tool), onboarding (full codebase analysis in one call), and developer utilities (regex, encode, measure, changelog, schema-validate, snippet, env, time)."\nmetadata:\n category: cross-cutting\n domain: general\n applicability: always\n inputs: [codebase]\n outputs: [search-results, analysis, knowledge]\n relatedSkills: [present]\n---\n\n# @vpxa/aikit — AI Kit\n\nLocal-first AI developer toolkit — 82 MCP tools for search, analysis, context compression, FORGE quality gates, knowledge management, code manipulation, execution, web access, brainstorming, presentation, and developer utilities.\n\n## When to Use\n\n- You need long-term memory across coding sessions\n- You want to search a codebase semantically (by meaning, not just keywords)\n- You need to compress large contexts to focus on what matters\n- You want structured output from build tools (tsc, vitest, biome, git)\n- You need to plan which files to read for a task\n- You want to safely explore refactors in isolated lanes\n- You need to rename symbols, apply codemods, or run code transformations\n- You want to fetch and read web pages or search the web\n- You need to make HTTP requests, test APIs, or debug endpoints\n- You want to test regex patterns, encode/decode data, or validate JSON schemas\n- You need code complexity metrics or a git changelog\n- You want to save and reuse code snippets across sessions\n\n## Skills Reference\n\n| Context | Skill | Load when |\n|---------|-------|----------|\n| Repository access recovery | `repo-access` | When encountering git auth failures, accessing private/enterprise repos, or when `web_fetch`/`http` returns auth errors on repository URLs. |\n\n## Architecture\n\n10-package monorepo published as a single npm package:\n\n```\ncore → store → embeddings → chunker → indexer → analyzers → tools → server → cli → tui\n```\n\n- **MCP server**: 82 tools + 2 resources (via `@modelcontextprotocol/sdk`)\n- **CLI**: 45 commands (thin dispatcher + 10 command groups)\n- **Search**: Hybrid vector + keyword + RRF fusion\n- **Embeddings**: ONNX local (mxbai-embed-large-v1, 1024 dimensions)\n- **Vector store**: LanceDB (embedded, zero infrastructure)\n- **Chunking**: Tree-sitter AST (TS/JS/Python/Go/Rust/Java) + regex fallback\n- **TUI**: Ink/React dashboard for human monitoring (search, status, curated, activity log)\n\n## Session Protocol (MANDATORY)\n\n### Start (do ALL)\n```\nflow_status({}) # Check/resume active flow FIRST\n# If flow active → flow_read_instruction({ step }) → follow step instructions\nstatus({}) # Check AI Kit health + onboard state\n# If onboard not run → onboard({ path: "." }) # First-time codebase analysis\nflow_list({}) # See available flows\n# Select flow based on task → flow_start({ flow: "<name>", topic: "<task>" }) # Start — creates .flows/{topic}/\nlist() # See stored knowledge\nsearch({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work\n```\n\n### During Session\n```\nsearch → scope_map → symbol → trace (orient)\ncheck → test_run (validate changes)\nremember (capture insights)\n```\n\n### End of Session\n```\nsession_digest({ persist: true }) # Auto-capture session activity\nremember({ title: "Session checkpoint: <topic>", content: "<what was done, decisions made, next steps>", category: "conventions" })\n```\n\n## Tool Catalog (82 tools)\n\n### Search & Discovery (8)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `search` | `aikit search` | Hybrid/semantic/keyword search with `search_mode` param |\n| `find` | `aikit find` | Federated search: vector + FTS + glob + regex in one call. Use `mode: \'examples\'` to find usage examples. |\n| `symbol` | `aikit symbol` | Resolve symbol definition, imports, and references |\n| `lookup` | `aikit lookup` | Full-file retrieval by path or record ID |\n| `scope_map` | `aikit scope-map` | Task-scoped reading plan with token estimates |\n| `trace` | `aikit trace` | Forward/backward flow tracing through call chains |\n| `dead_symbols` | `aikit dead-symbols` | Find exported symbols never imported — separates source (actionable) from docs (informational). Accepts `path` to scope the search. |\n| `file_summary` | `aikit summarize` | Structural overview of a file (exports, imports, functions) |\n\n### Code Analysis (7)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `analyze_structure` | `aikit analyze structure` | Project structure overview |\n| `analyze_dependencies` | `aikit analyze deps` | Dependency graph with confidence |\n| `analyze_symbols` | `aikit analyze symbols` | Symbol extraction and cross-references |\n| `analyze_patterns` | `aikit analyze patterns` | Design pattern detection |\n| `analyze_entry_points` | `aikit analyze entry-points` | Find entry points: handlers, CDK constructs, test suites, package exports (walks workspace packages) |\n| `analyze_diagram` | `aikit analyze diagram` | Generate Mermaid diagrams |\n| `blast_radius` | `aikit analyze blast-radius` | Change impact analysis |\n\n### Context Management (6)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `compact` | `aikit compact` | Compress text to relevant sections using embeddings (no LLM). Accepts `path` for server-side file read. |\n| `workset` | `aikit workset` | Named file set management (save/load/add/remove) |\n| `stash` | `aikit stash` | Named key-value store for session data |\n| `checkpoint` | `aikit checkpoint` | Save/restore session checkpoints |\n| `restore` | `aikit restore` | Restore a previously saved checkpoint |\n| `parse_output` | `aikit parse-output` | Parse tsc/vitest/biome/git output → structured JSON |\n\n### Code Manipulation (4)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `rename` | `aikit rename` | Smart whole-word symbol rename across files (dry-run supported) |\n| `codemod` | `aikit codemod` | Regex-based code transformations with rules (dry-run supported) |\n| `diff_parse` | `aikit diff` | Parse unified diff → structured changes |\n| `data_transform` | `aikit transform` | JQ-like JSON transformations |\n\n### Execution & Validation (5)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `eval` | `aikit eval` | Sandboxed JavaScript/TypeScript execution |\n| `check` | `aikit check` | Incremental typecheck + lint. `detail` param: summary (default, ~300 tokens), errors, full |\n| `test_run` | `aikit test` | Run tests with structured pass/fail results |\n| `batch` | `aikit batch` | Execute multiple operations in parallel |\n| `audit` | `aikit audit` | Unified project audit: structure, deps, patterns, health, dead symbols, check, entry points → synthesized report with score and recommendations. 6 round-trips → 1. |\n\n### Knowledge Management (6)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `remember` | `aikit remember` | Store a curated knowledge entry |\n| `update` | `aikit update` | Update an existing entry |\n| `forget` | `aikit forget` | Delete an entry (requires reason) |\n| `read` | `aikit read` | Read a curated entry by path |\n| `list` | `aikit list` | List curated entries |\n| `produce_knowledge` | — | Auto-generate knowledge from analysis |\n\n### Auto-Knowledge (automatic background extraction)\n\nAuto-knowledge runs automatically in the background after every tool completion. It extracts useful facts from tool outputs and stores them in curated memory — no manual action required.\n\n**What gets captured:**\n\n| Extractor | Triggers on | What it stores |\n|-----------|-------------|----------------|\n| Test results | `check`, `test_run` | Framework detection (vitest/jest/mocha), test file naming patterns |\n| Environment | `env`, `config`, `status` | Node.js version, OS, workspace path, store backend, embedding model |\n| Research | `web_search`, `web_fetch`, `search` | Web research findings, fetched page summaries |\n| Conventions | `check`, `analyze_patterns`, `analyze_structure`, `onboard` | Linter/formatter, TypeScript strict mode, package manager, monorepo detection |\n| Build commands | `check`, `test_run` | Verified check results, test summaries, test runner commands |\n| Codebase insights | `analyze_*`, `scope_map`, `blast_radius`, `onboard` | Structure analysis, dependency info, entry points, impact analysis |\n| Tool failures | All tools (global) | Classified actionable errors (filters out transient network/ENOENT errors) |\n\n**Quality controls:**\n- **Quality gate**: Facts scored 0-1; only facts >= 0.3 are stored\n- **Dedup**: Checks existing curated titles + in-memory hash dedup\n- **TTL**: Transient facts (errors, blast radius, search context) automatically expire after 1-2 hours\n- **Session limit**: Maximum 50 auto-knowledge facts per session\n\n**Searching auto-knowledge:**\nAuto-knowledge facts are stored as regular curated entries. Search them with:\n```\nsearch({ query: "error patterns", origin: "curated" })\nsearch({ query: "conventions", origin: "curated" })\nlist({ category: "conventions" })\nlist({ tags: ["errors"] })\n```\n\n### Verified Lanes (1 tool, 6 actions)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `lane` | `aikit lane` | Manage isolated file copies for parallel exploration |\n\nLane actions: `create` (copy files to lane), `list`, `status` (modified/added/deleted), `diff` (line-level diff), `merge` (apply back to originals), `discard`.\n\n### Git & Environment (4)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `git_context` | `aikit git` | Branch, status, recent commits |\n| `process` | `aikit proc` | Process supervisor (start/stop/logs) |\n| `watch` | `aikit watch` | Filesystem watcher |\n| `delegate` | `aikit delegate` | Delegate subtask to local Ollama model |\n\n### Web & Network (3)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `web_fetch` | — | Fetch web page → markdown/raw/links/outline for LLM consumption |\n| `web_search` | — | Search the web via DuckDuckGo (no API key needed) |\n| `http` | — | Make HTTP requests for API testing/debugging |\n\n### Developer Utilities (8)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `regex_test` | — | Test regex patterns with match/replace/split modes |\n| `encode` | — | Base64, URL, SHA-256, MD5, hex encode/decode, JWT decode |\n| `measure` | — | Code complexity metrics (cyclomatic, cognitive complexity, lines, functions) |\n| `changelog` | — | Generate changelog from git history (conventional commits) |\n| `schema_validate` | — | Validate JSON data against JSON Schema |\n| `snippet` | — | Save/get/search/delete persistent code snippets |\n| `env` | — | System and runtime environment info (sensitive values redacted) |\n| `time` | — | Date parsing, timezone conversion, duration math |\n\n### FORGE Quality Gates (5)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `forge_ground` | — | Full Ground phase: classify tier, scope map, unknowns, constraints |\n| `forge_classify` | — | Quick tier classification (Floor/Standard/Critical) |\n| `evidence_map` | — | CRUD + Gate evaluation for verified/assumed/unknown claims. Safety gate tags (`provenance`/`commitment`/`coverage`) enable mandatory pre-YIELD checks |\n| `stratum_card` | — | Generate T1/T2 compressed context cards from files (10-100x token reduction) |\n| `digest` | — | Compress N text sources into token-budgeted summary |\n\n### System (9)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `config` | `aikit config` | View or update project configuration (kb.config.json) |\n| `status` | `aikit status` | Index statistics |\n| `reindex` | `aikit reindex` | Rebuild index |\n| `health` | `aikit health` | Project health checks (package.json, tsconfig, lockfile, circular deps) |\n| `guide` | `aikit guide` | Tool discovery — given a goal, recommends tools and workflow order |\n| `onboard` | `aikit onboard` | Full codebase onboarding in one call (structure + deps + patterns + knowledge) |\n| `graph` | `aikit graph` | Query the auto-populated knowledge graph (modules, symbols, imports) |\n| `queue` | `aikit queue` | Task queue for sequential agent operations (create/push/next/done/fail) |\n| `replay` | `aikit replay` | View or clear the audit trail of tool invocations (action: list/clear) |\n\n### Flows (11)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `flow_list` | `aikit flow list` | List available flows and active run |\n| `flow_info` | `aikit flow info` | Get flow details including steps and skill paths |\n| `flow_start` | `aikit flow start` | Start a flow with topic — creates `.flows/{topic-slug}/` run directory |\n| `flow_step` | `aikit flow step` | Advance, skip, or redo the current step |\n| `flow_status` | `aikit flow status` | Check active run including slug, runDir, artifactsPath |\n| `flow_read_instruction` | `aikit flow read-instruction` | Read instruction with `{{artifacts_path}}` and `{{run_dir}}` resolved |\n| `flow_reset` | `aikit flow reset` | Abandon the active flow (preserves run directory) |\n| `flow_runs` | `aikit flow runs` | List all flow runs (current and past) |\n| `flow_add` | `aikit flow add` | Add a custom flow from a directory |\n| `flow_update` | `aikit flow update` | Update an existing custom flow |\n| `flow_remove` | `aikit flow remove` | Remove a custom flow |\n\n### Presentation (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `present` | — | Rich dashboards, charts, tables, timelines. Use `format: "browser"` then `openBrowserPage` to display. **In CLI mode (no VS Code chat), always use `format: "browser"`** — `html` UIResource is invisible in terminal. |\n\n### Brainstorming (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `brainstorm` | — | Interactive brainstorming and ideation sessions with structured output |\n\n### Meta-Tools — Tool Discovery (3)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `list_tools` | — | List all active AI Kit tools with names, titles, and categories. Accepts optional `category` filter. Use for initial tool discovery. |\n| `describe_tool` | — | Get detailed metadata for a specific tool (title, categories, annotations). Use after `list_tools` to understand a tool before calling it. |\n| `search_tools` | — | Search active tools by keyword across names, titles, and categories. Use when you know what you need but not the tool name. |\n\n### Session Management (1)\n| Tool | CLI | Purpose |\n|------|-----|---------|\n| `session_digest` | — | Generate a compressed digest of session activity (replay log, stash, checkpoints). Options: `scope` (tools/stash/all), `since`, `last`, `focus`, `mode` (deterministic/sampling), `tokenBudget`, `persist`. Use at session end for handoff or mid-session to review what happened. |\n\n## Flow System\n\nFlows are multi-step guided workflows that structure complex tasks. Each step has a skill file with detailed instructions, required artifacts, and agent assignments.\n\n### Built-in Flows\n\n| Flow | Steps | Use When |\n|------|-------|----------|\n| `aikit:basic` | assess → implement → verify | Bug fixes, config changes, small features |\n| `aikit:advanced` | spec → plan → task → execute → verify | New modules, cross-service changes, architectural work |\n\n### Flow Lifecycle\n\n```text\nflow_list() # See available flows\nflow_info({ flow: "aikit:basic" }) # View steps, skills, agents\nflow_start({ flow: "aikit:basic", topic: "Fix login bug" }) # Start — creates .flows/fix-login-bug/\nflow_read_instruction() # Read current step\'s instructions ({{artifacts_path}} resolved)\n# ... do the work described in the instruction ...\nflow_step({ action: "next" }) # Advance to next step\nflow_step({ action: "skip" }) # Skip current step\nflow_step({ action: "redo" }) # Redo current step\nflow_status() # Check progress (includes slug, runDir, artifactsPath, phase, isEpilogue)\nflow_reset() # Abandon active flow\nflow_runs() # List all runs (current + past)\n# Epilogue steps (mandatory, injected after every flow):\n# After last flow step → _docs-sync epilogue runs automatically\n# flow_status() shows phase: \'after\', isEpilogue: true during epilogue\n```\n\nCustom flow lifecycle management:\n\n```text\nflow_add({ source: ".github/flows/my-flow" })\nflow_update({ name: "my-flow" })\nflow_remove({ name: "my-flow" })\n```\n\n### Creating Custom Flows\n\n1. Create a directory under `.github/flows/<flow-name>/`\n2. Add `manifest.yaml`:\n\n```yaml\nname: my-flow\nversion: "1.0.0"\ndescription: "My custom flow"\nartifacts_dir: .spec\nsteps:\n - id: design\n name: Design\n instruction: steps/design/README.md\n description: "Create the design document"\n produces: [design.md]\n requires: []\n agents: [Planner]\n - id: implement\n name: Implement\n instruction: steps/implement/README.md\n description: "Implement the design"\n produces: [code]\n requires: [design]\n agents: [Implementer]\nagents:\n - agents/planner.agent.md\ninstall: []\n```\n\n3. Add skill files under `.github/flows/<flow-name>/skills/<step-id>/SKILL.md`\n4. The flow appears in `flow_list()` automatically\n\n### How Flows Are Delivered\n\n- **Built-in flows** ship with the AI Kit MCP server in `scaffold/flows/`\n- `aikit init` copies them to `.github/flows/` in your workspace\n- At runtime, flow tools resolve paths to `.github/flows/` (workspace-local copies)\n- Custom flows placed in `.github/flows/` are discovered alongside built-in ones\n\n### Agent-Flow Integration\n\n- All code agents have a "Flows" section instructing them to check `flow_status()` first\n- If a flow is active, the agent follows the current step\'s instruction via `flow_read_instruction()`\n- After completing a step\'s work, advance with `flow_step({ action: "next" })`\n- The **Orchestrator** selects and starts flows; other agents follow them\n- The **Orchestrator** specifies `aikit` skill loading — all agents should load `aikit` skill to access flow tools\n\n## CRITICAL: Use AI Kit Tools Instead of Native IDE Tools\n\nAI Kit tools provide **10x richer output** than native IDE tools — with AST-analyzed call graphs, scope context, import classification, and cognitive complexity. **You MUST use AI Kit tools instead of native read/search tools.**\n\n### ⛔ PROHIBITED: Native File Reading\n\n**`read_file` / `read_file_raw` MUST NOT be used to understand code.** They waste tokens and miss structural information.\n\nThe **ONLY** acceptable use of `read_file`: getting exact lines immediately before an edit (to verify the `old_str` for replacement). Even then, use `file_summary` first to identify which lines to read.\n\n### Tool Replacement Table\n\n| ❌ NEVER do this | ✅ Use AI Kit Tool | Why |\n|---|---|---|\n| `read_file` (full file) | `file_summary` | Exports, imports, call edges — **10x fewer tokens** |\n| `read_file` (specific section) | `compact({ path, query })` | Server-side read + extract — **5-20x reduction** |\n| `grep_search` / `textSearch` | `search` | Semantic + keyword hybrid across all indexed content |\n| `grep_search` for a symbol | `symbol` | Definition + references **with scope context** |\n| Multiple `read_file` calls | `digest` | Compresses multiple sources into token-budgeted summary |\n| `listDirectory` + `read_file` | `scope_map` | Identifies relevant files for a task automatically |\n| Manual code tracing | `trace` | AST call-graph traversal with scope context |\n| Line counting / `wc` | `measure` | Lines, complexity, **cognitive complexity**, functions |\n| Grep for unused exports | `dead_symbols` | AST-powered export detection with regex fallback |\n| Repeated file reads | `stratum_card` | Reusable compressed context — **10-100x reduction** |\n| `fetch_webpage` | `web_fetch` | Readability extract + token budget — richer output |\n| Web research / browsing | `web_search` | Structured web results without browser — **unique to KB** |\n\n### Decision Tree — How to Read Code\n\n```\nNeed to understand a file?\n├─ Just structure? → file_summary (exports, imports, call edges — ~50 tokens)\n├─ Specific section? → compact({ path, query }) — 5-20x reduction\n├─ Multiple files? → digest (multi-source compression — token-budgeted)\n├─ Repeated reference? → stratum_card (T1/T2 card — 10-100x reduction)\n├─ Need exact lines to EDIT? → read_file (the ONLY acceptable use)\n└─ "I want to read the whole file" → ⛔ STOP. Use file_summary or compact instead.\n```\n\n### Decision Tree — Need Structural Relationships?\n\nWhen vector search and file reads don\'t answer the question (e.g. "who imports this?",\n"what does this depend on?", "how are these files connected?"), use `graph`:\n\n```\nNeed to understand relationships between code?\n├─ Who imports / calls this? → graph({action:\'find_nodes\', name_pattern}) → graph({action:\'neighbors\', node_id, direction:\'incoming\'})\n├─ What does this depend on? → graph({action:\'neighbors\', node_id, direction:\'outgoing\'})\n├─ Full context for a symbol? → graph({action:\'symbol360\', name})\n├─ Related files within N hops? → graph({action:\'traverse\', node_id, max_depth:2})\n├─ Layer/module isolation check? → graph({action:\'depth_traverse\', node_id, max_depth:3})\n└─ Graph size/health? → graph({action:\'stats\'})\n```\n\n**Use this BEFORE** reaching for `analyze_dependencies` (slower, less precise) or manually\ntracing via `symbol` + `trace` chains. The graph is auto-populated during indexing.\n\n### What AI Kit Tools Return (AST-Enhanced)\n\nThese tools use Tree-sitter WASM to analyze source code at the AST level, providing structured data that raw file reads cannot:\n\n| Tool | Rich Output |\n|------|-------------|\n| `file_summary` | Imports classified as **external vs internal** (`isExternal` flag). **Call edges** between functions (e.g., `handleRequest() → validateInput() @ line 42`). `exported` flag on interfaces and types. Import count breakdown. |\n| `symbol` | References include **scope** — which function/class/method contains each usage (e.g., `referenced in processOrder() at auth-service.ts:55`). |\n| `trace` | **Call-graph edges** discovered via AST syntax tree, not text matching. Supports forward (who does X call?) and backward (who calls X?) tracing. Scope context on each node. |\n| `measure` | **Cognitive complexity** — weights nesting depth (nested `if` inside `for` inside `try` scores higher). More useful than cyclomatic complexity for understanding code difficulty. |\n| `dead_symbols` | **AST export enumeration** — catches `export default`, barrel re-exports (`export { x } from`), `export =`, and `export type`. Regex fallback for non-AST-supported languages. |\n\n### Example: `file_summary` Output\n\n```\nsrc/auth-service.ts\nLanguage: typescript | Lines: 180 | Estimated tokens: ~1400\n\nImports (6): 3 external, 3 internal\n - import { hash } from \'bcrypt\' [external]\n - import { UserRepo } from \'./user-repo\' [internal]\n\nFunctions (4):\n - authenticate @ line 22 [exported]\n - validateToken @ line 55 [exported]\n - hashPassword @ line 90\n - generateJwt @ line 110\n\nCall edges (12 intra-file):\n - authenticate() → hashPassword() @ line 35\n - authenticate() → generateJwt() @ line 42\n - validateToken() → UserRepo.findById() @ line 68\n\nInterfaces (2):\n - AuthResult @ line 8 [exported]\n - TokenPayload @ line 14\n```\n\nCompare: `read_file` would cost ~1400 tokens for raw text. `file_summary` gives structured data in ~120 tokens — **12x reduction** with richer information.\n\n## Search Strategy\n\n1. **Start broad**: `search({ query: "topic", search_mode: "hybrid" })`\n2. **Narrow**: Add `content_type`, `origin`, or `category` filters\n3. **Exact match**: Use `search_mode: "keyword"` for identifiers\n4. **Federated**: Use `find` to combine vector + glob + regex\n\n## Workflow Chains\n\n### Codebase Onboarding\n```\nanalyze_structure({ path: "src/" })\n→ analyze_dependencies({ path: "src/" })\n→ analyze_entry_points({ path: "src/" })\n→ produce_knowledge({ path: "src/" })\n→ remember({ title: "Codebase onboarding complete", ... })\n```\n\n### Planning a Task\n```\nscope_map({ task: "implement user auth" })\n→ compact({ path: "src/auth.ts", query: "auth flow" })\n→ workset({ action: "save", name: "auth-task", files: [...] })\n```\n\n### Bug Investigation\n```\nparse_output({ output: <error> }) → symbol({ name: "failingFn" })\n→ trace({ symbol: "failingFn", direction: "backward" })\n→ blast_radius({ changed_files: ["suspect.ts"] })\n→ eval({ code: "hypothesis test" }) → check({ files: ["suspect.ts"] })\n```\n\n### Safe Refactor with Lanes\n```\nscope_map({ task: "rename UserService" })\n→ lane({ action: "create", name: "refactor", files: [...] })\n→ [make changes in lane files]\n→ lane({ action: "diff", name: "refactor" })\n→ check({}) → test_run({})\n→ lane({ action: "merge", name: "refactor" })\n```\n\n### Lane — isolated read-only exploration\n\n`lane({ action:\'create\', name })` creates an isolated copy of the workspace. Use to try approach A vs B WITHOUT touching canonical source. Other actions: `list`, `diff`, `delete`. Compare with `lane({ action:\'diff\', names:[\'a\',\'b\'] })`. Do NOT use `lane` for actual refactors — use `checkpoint` instead (`checkpoint` = reversible on canonical source; `lane` = isolated copies for comparison).\n\n### After Making Changes\n```\nblast_radius({ changed_files: ["src/auth.ts"] })\n→ check({}) → test_run({ grep: "auth" })\n→ reindex()\n→ remember({ title: "Implemented auth", content: "..." })\n```\n\n### Pre-Commit Validation\n```\ngit_context({ diff: true })\n→ diff_parse({ diff: <staged diff> })\n→ blast_radius({ changed_files: [...] })\n→ check({}) → test_run({})\n```\n\n---\n\n## Persistent Memory (Long-Term Knowledge)\n\nAI Kit provides cross-session persistent memory via a curated knowledge store. Use it to remember decisions, patterns, conventions, and context that should survive beyond the current conversation.\n\n### Writing to Memory\n\n| Tool | Purpose | Example |\n|------|---------|---------|\n| `remember` | Store a new knowledge entry | `remember({ title: "Auth uses JWT RS256", content: "All API auth uses RS256 JWT tokens issued by /auth/token. Refresh via httpOnly cookie.", category: "decisions" })` |\n| `update` | Modify an existing entry | `update({ id: "<entry-id>", content: "Updated: now also supports Ed25519" })` |\n| `produce_knowledge` | Auto-generate analysis entries from code | `produce_knowledge({ path: "src/" })` |\n\n**Categories** — use these to organize entries:\n- `conventions` — coding standards, naming rules, file organization\n- `decisions` — architecture decisions, technology choices, trade-offs made\n- `patterns` — recurring code patterns, design patterns in use\n- `context` — project context, domain knowledge, business rules\n- `session` — session checkpoints for resuming work\n\n### Reading from Memory\n\n| Tool | Purpose | Example |\n|------|---------|---------|\n| `list` | Browse all stored entries | `list()` or `list({ category: "decisions" })` |\n| `read` | Read a specific entry by ID | `read({ id: "<entry-id>" })` |\n| `search` | Find entries by content/query | `search({ query: "authentication", origin: "curated" })` |\n| `forget` | Remove an outdated entry | `forget({ id: "<entry-id>" })` |\n\n### When to Remember\n\n| Situation | What to store | Category |\n|-----------|--------------|----------|\n| Architecture decision made | Decision + rationale + alternatives considered | `decisions` |\n| Pattern discovered in codebase | Pattern description + example locations | `patterns` |\n| Convention established | Rule + enforcement approach | `conventions` |\n| Session ending | Checkpoint: what was done, what\'s next, blockers | `session` |\n| Bug root cause found | Root cause + fix approach + prevention strategy | `context` |\n| External API behavior learned | Behavior quirks, rate limits, gotchas | `context` |\n\n### Session Checkpoint Pattern\n\nAt the END of every meaningful work session:\n```\nremember({\n title: "Session checkpoint: <topic>",\n content: "## Done\\n- <completed items>\\n\\n## Decisions\\n- <key decisions made>\\n\\n## Next\\n- <pending work>\\n\\n## Blockers\\n- <issues encountered>",\n category: "session"\n})\n```\n\nAt the START of the next session:\n```\nsearch({ query: "SESSION CHECKPOINT", origin: "curated" }) # Find last checkpoint\nlist({ category: "session" }) # Browse all checkpoints\n```\n\n### Memory Best Practices\n\n1. **Remember decisions, not code** — store *why*, not *what*. Code changes; rationale persists.\n2. **Search before remembering** — avoid duplicates: `search({ query: "..." })` first.\n3. **Use categories** — structured categories enable filtered `list()` queries.\n4. **Checkpoint regularly** — don\'t wait for session end. Checkpoint at milestones.\n5. **Clean up** — `forget()` outdated entries. Memory is only valuable when accurate.\n6. **Cross-reference** — mention related entry titles in content for discoverability.\n\n## CLI Quick Reference\n\n```bash\naikit init # Scaffold AI Kit in current directory\naikit init --force # Overwrite all scaffold/skill files\naikit init --guide # JSON report of stale files for LLM-driven updates\naikit serve # Start MCP server (stdio or HTTP)\naikit search <q> # Hybrid search\naikit find <q> # Federated search\naikit symbol <name> # Resolve symbol\naikit scope-map <t> # Task reading plan\naikit compact <q> # Context compression (--path file or stdin)\naikit check # Typecheck + lint (--detail summary|errors|full)\naikit test # Run tests\naikit rename <old> <new> <path> # Rename symbol\naikit lane create <name> --files f1,f2 # Create lane\naikit lane diff <name> # View lane changes\naikit lane merge <name> # Merge lane back\naikit status # Index stats\naikit reindex # Rebuild index\n```\n\n## Configuration\n\n`kb.config.json` in project root:\n```json\n{\n "sources": [{ "path": ".", "excludePatterns": ["node_modules/**", "**/node_modules/**", "dist/**", "coverage/**", ".aikit-data/**"] }],\n "indexing": { "chunkSize": 1500, "chunkOverlap": 200, "minChunkSize": 100, "concurrency": 5 },\n "embedding": { "model": "mixedbread-ai/mxbai-embed-large-v1", "dimensions": 1024 },\n "store": { "backend": "lancedb", "path": ".aikit-data" },\n "curated": { "path": "curated", "adapter": "filesystem" }\n}\n```\n\n## Tool Profiles\n\nTool profiles control which subset of the 82 tools are active. Profiles reduce token overhead by exposing only relevant tools for a given task.\n\n### Built-in Profiles\n\n| Profile | Description | Use When |\n|---------|-------------|----------|\n| `full` | All tools enabled (default) | General development, orchestration |\n| `safe` | Read-only tools — no file/state modifications | Code review, analysis, research |\n| `research` | Search, analysis, knowledge, web access | Investigation, documentation |\n| `minimal` | Essential tools only — search, check, test | Simple tasks, low-token budgets |\n| `discovery` | Full toolset + meta-tools for guided exploration | New users, onboarding, tool learning |\n\n### Activating a Profile\n\nSet `toolProfile` in `kb.config.json`:\n\n```json\n{\n "toolProfile": "research"\n}\n```\n\nBase tools (`status`, `config`, `guide`, `health`) are **always available** regardless of profile.\n\n### Meta-Tool Discovery Pattern (Token Cost Reduction)\n\nInstead of loading all 82 tool descriptions at session start, use the `discovery` profile:\n\n1. `list_tools()` — get a compact list of tool names + categories (~50 tokens)\n2. `search_tools({ query: "what I need" })` — find relevant tools by keyword\n3. `describe_tool({ tool_name: "specific_tool" })` — get full metadata only for tools you\'ll use\n\nThis pattern reduces initial tool-loading cost from ~3000 tokens to ~200 tokens.\n\n## IDE Integration\n\n### VS Code — HTTP mode (recommended for development)\n```json\n// .vscode/mcp.json\n{\n "servers": {\n "kb": {\n "type": "http",\n "url": "http://localhost:3210/mcp"\n }\n }\n}\n```\nStart server: `npx aikit serve --http --port 3210`\n\n### VS Code — stdio mode (no separate server)\n```json\n{\n "servers": {\n "kb": {\n "type": "stdio",\n "command": "npx",\n "args": ["@vpxa/aikit", "serve", "--stdio"]\n }\n }\n}\n```\n\n### Claude Code (`.mcp.json`)\n```json\n{\n "mcpServers": {\n "kb": {\n "command": "npx",\n "args": ["@vpxa/aikit", "serve"]\n }\n }\n}\n```\n\n## Development (Self-Dogfooding)\n\nWhen developing @vpxa/aikit itself, use the tool on its own codebase:\n\n```bash\n# Build → Reindex → Use loop\npnpm build # Build all 10 packages\nnode bin/aikit.mjs reindex # Index own source into LanceDB\nnode bin/aikit.mjs search "query" # Search own code\nnode bin/aikit.mjs symbol "FnName" # Resolve symbols in own code\nnode bin/aikit.mjs check # Typecheck + lint\npnpm test # Run 287+ tests\n\n# Start MCP server for agent use during development\nnode bin/aikit.mjs serve --http --port 3210\n```\n\n**Rules:**\n- Always `pnpm build` before using CLI/server (runs from `dist/`)\n- Always `reindex` after structural code changes\n- LanceDB is single-process — don\'t run CLI and HTTP server simultaneously\n- Curated entries in `curated/` survive reindex and are indexed separately\n\n---\n\n## Flows\n\nFlows are structured multi-step workflows that guide agents through complex tasks. They are the **primary workflow system** — use them instead of ad-hoc planning when a matching flow exists.\n\n### Flow Tools\n\n| Tool | Purpose |\n|------|---------|\n| `flow_status` | Check if a flow is active + current step + phase (before/flow/after) + isEpilogue |\n| `flow_list` | List available flows |\n| `flow_info` | Get flow details including steps and skill paths |\n| `flow_start` | Start a named flow |\n| `flow_step` | Advance: `next`, `skip`, or `redo` current step |\n| `flow_read_instruction` | Read the current step\'s instruction file content directly |\n| `flow_reset` | Clear flow state to start over |\n| `flow_add` | Add a custom flow from a directory |\n| `flow_update` | Update an existing custom flow |\n| `flow_remove` | Remove a custom flow |\n\n### Flow Selection\n\n| Task Type | Flow | Why |\n|-----------|------|-----|\n| Bug fix, config change, small refactor | `aikit:basic` | Known scope, low risk |\n| New feature in existing module | `aikit:basic` | Clear boundaries |\n| New system/service/module | `aikit:advanced` | Needs spec + planning |\n| Cross-service changes | `aikit:advanced` | Multiple boundaries |\n| Architectural change | `aikit:advanced` | High impact |\n| Unclear scope or exploratory | No flow | Use agent\'s native workflow |\n\n### Flow Lifecycle\n\n1. **Start**: `flow_list({})` → choose flow → `flow_start({ flow: "<name>", topic: "<task>" })`\n2. **Each step**: `flow_read_instruction({ step: "<name>" })` → follow step instructions → complete work\n3. **Advance**: `flow_step({ action: "next" })` → repeat from step 2\n4. **Epilogue**: After last flow step, mandatory epilogue steps run (e.g., `_docs-sync` updates `docs/`)\n5. **Resume**: `flow_status({})` → if active, `flow_read_instruction` for current step → continue\n6. **Reset**: `flow_reset({})` if you need to start over\n'}],brainstorming:[{file:`SKILL.md`,content:`---
2501
1708
  name: brainstorming
2502
1709
  description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
2503
1710
  metadata:
@@ -2762,8 +1969,7 @@ Use the \`present\` MCP tool for showing mockups, diagrams, and visual options d
2762
1969
 
2763
1970
  - **Use \`present({ format: "html" })\`** for visual content — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
2764
1971
  - **Use regular chat** for text content — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
2765
- ` },
2766
- { file: "spec-document-reviewer-prompt.md", content: `# Spec Document Reviewer Prompt Template
1972
+ `},{file:`spec-document-reviewer-prompt.md`,content:`# Spec Document Reviewer Prompt Template
2767
1973
 
2768
1974
  Use this template when dispatching a spec document reviewer subagent.
2769
1975
 
@@ -2812,10 +2018,7 @@ Task tool (general-purpose):
2812
2018
  \`\`\`
2813
2019
 
2814
2020
  **Reviewer returns:** Status, Issues (if any), Recommendations
2815
- ` },
2816
- ],
2817
- "c4-architecture": [
2818
- { file: "references/advanced-patterns.md", content: `# Advanced C4 Architecture Patterns
2021
+ `}],"c4-architecture":[{file:`references/advanced-patterns.md`,content:`# Advanced C4 Architecture Patterns
2819
2022
 
2820
2023
  This guide covers advanced patterns for documenting complex architectures including microservices, event-driven systems, deployments, and API documentation.
2821
2024
 
@@ -3367,8 +2570,7 @@ C4Context
3367
2570
  5. **Link to ADRs**: Document why decisions were made
3368
2571
  6. **Use system landscape for enterprise views**: Show all systems and their relationships
3369
2572
  7. **Keep diagrams focused**: One concern per diagram, split when complex
3370
- ` },
3371
- { file: "references/c4-syntax.md", content: `# C4 Mermaid Diagram Syntax Reference
2573
+ `},{file:`references/c4-syntax.md`,content:`# C4 Mermaid Diagram Syntax Reference
3372
2574
 
3373
2575
  Complete syntax reference for Mermaid C4 diagrams. Compatible with PlantUML C4 syntax.
3374
2576
 
@@ -3878,8 +3080,7 @@ For features Mermaid doesn't support, consider:
3878
3080
  - **Structurizr DSL** - Full C4 support with model-based generation
3879
3081
  - **C4-PlantUML** - More mature C4 implementation
3880
3082
  - **IcePanel** - Visual C4 diagram editor
3881
- ` },
3882
- { file: "references/common-mistakes.md", content: `# Common C4 Model Mistakes to Avoid
3083
+ `},{file:`references/common-mistakes.md`,content:`# Common C4 Model Mistakes to Avoid
3883
3084
 
3884
3085
  This guide documents frequent anti-patterns and errors when creating C4 architecture diagrams, with examples of what to do instead.
3885
3086
 
@@ -4316,346 +3517,7 @@ Before finalizing any C4 diagram, verify:
4316
3517
  - [ ] Message topics shown individually (not as single broker)
4317
3518
  - [ ] No infrastructure details in container diagrams
4318
3519
  - [ ] Consistent with other diagrams in the set
4319
- ` },
4320
- { file: "references/html-design-system.md", content: `# HTML/SVG Architecture Diagram Design System
4321
-
4322
- This file is the centralized design system for HTML and SVG architecture diagrams.
4323
-
4324
- It is the single source of truth for visual tokens, component categories, layout rules, and \`present\` tool composition guidance used by the \`c4-architecture\` skill and the \`present\` skill. Update component types, colors, layout rules, and icon slots here only.
4325
-
4326
- ## Purpose
4327
-
4328
- - Define a reusable visual language for C4-style architecture diagrams rendered as HTML and inline SVG.
4329
- - Keep category styling extensible through a registry instead of hardcoded component types.
4330
- - Standardize diagram composition for both skill-authored documentation and \`present\` output.
4331
-
4332
- ## Core Design Tokens
4333
-
4334
- ### Typography
4335
-
4336
- - Font family: \`"JetBrains Mono", monospace\`
4337
- - Font source: Google Fonts (\`https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap\`)
4338
- - Component names: \`12px\`
4339
- - Sublabels: \`9px\`
4340
- - Annotations: \`8px\`
4341
- - Tiny labels: \`7px\`
4342
- - Legend: \`10px\`
4343
- - Icon area labels: \`11px\`
4344
-
4345
- ### Background
4346
-
4347
- - Page background: \`#020617\` (\`slate-950\`)
4348
- - Background pattern: inline SVG grid pattern over the page background
4349
- - Recommended grid line colors:
4350
- - Major grid: \`rgba(148, 163, 184, 0.08)\`
4351
- - Minor grid: \`rgba(148, 163, 184, 0.04)\`
4352
-
4353
- ### Component Box Defaults
4354
-
4355
- - Shape: rounded rectangle
4356
- - Border radius: \`rx="6"\`
4357
- - Stroke width: \`1.5px\`
4358
- - Fill: category-specific semi-transparent RGBA fill
4359
- - Stroke: category-specific hex stroke
4360
- - Label stack:
4361
- - Line 1: C4 label such as \`<<Container>>\`
4362
- - Line 2: component name
4363
- - Line 3: subtype or technology summary
4364
-
4365
- ## Category Registry
4366
-
4367
- The registry is hierarchical: categories define shared tokens and C4 intent, while sub-types inherit the category styling and reserve an icon slot for future SVG glyphs.
4368
-
4369
- | Category | Stroke Color | Fill Color | C4 Mapping | Sub-types |
4370
- |---|---|---|---|---|
4371
- | Frontend | \`#22d3ee\` | \`rgba(8, 51, 68, 0.4)\` | Container (SPA, web) | SPA, Mobile App, Static Site, Micro-frontend, PWA, Desktop App |
4372
- | Backend | \`#34d399\` | \`rgba(6, 78, 59, 0.4)\` | Container (service) | API Service, Worker/Job, BFF, Microservice, Serverless Function, gRPC Service |
4373
- | Data | \`#a78bfa\` | \`rgba(76, 29, 149, 0.4)\` | ContainerDb | Relational DB, Document DB, Key-Value Store, Cache, Search Engine, Data Warehouse, Graph DB, Time-Series DB |
4374
- | Infrastructure | \`#fbbf24\` | \`rgba(120, 53, 15, 0.3)\` | Deployment_Node | CDN, Load Balancer, DNS, Object Storage, Container Registry, Reverse Proxy, Service Mesh |
4375
- | Messaging | \`#fb923c\` | \`rgba(251, 146, 60, 0.3)\` | ContainerQueue | Message Queue, Event Bus, Stream, Pub/Sub, Webhook |
4376
- | Security | \`#fb7185\` | \`rgba(136, 19, 55, 0.4)\` | System_Ext / boundary | Auth Provider, API Gateway, WAF, Secret Manager, Certificate Manager, Identity Provider |
4377
- | External | \`#94a3b8\` | \`rgba(30, 41, 59, 0.5)\` | System_Ext | Third-party API, SaaS, Legacy System, Partner Service, Payment Provider |
4378
- | Monitoring | \`#38bdf8\` | \`rgba(12, 74, 110, 0.4)\` | Container | Logging, Metrics, Tracing, Alerting, APM |
4379
-
4380
- ## Sub-type Registry
4381
-
4382
- Each sub-type inherits its category tokens and keeps a placeholder slot for an inline SVG icon.
4383
-
4384
- | Category | Sub-type | C4 Label | Icon Slot |
4385
- |---|---|---|---|
4386
- | Frontend | SPA | \`<<Container>>\` | \`icon-spa\` |
4387
- | Frontend | Mobile App | \`<<Container>>\` | \`icon-mobile-app\` |
4388
- | Frontend | Static Site | \`<<Container>>\` | \`icon-static-site\` |
4389
- | Frontend | Micro-frontend | \`<<Container>>\` | \`icon-micro-frontend\` |
4390
- | Frontend | PWA | \`<<Container>>\` | \`icon-pwa\` |
4391
- | Frontend | Desktop App | \`<<Container>>\` | \`icon-desktop-app\` |
4392
- | Backend | API Service | \`<<Container>>\` | \`icon-api-service\` |
4393
- | Backend | Worker/Job | \`<<Container>>\` | \`icon-worker-job\` |
4394
- | Backend | BFF | \`<<Container>>\` | \`icon-bff\` |
4395
- | Backend | Microservice | \`<<Container>>\` | \`icon-microservice\` |
4396
- | Backend | Serverless Function | \`<<Container>>\` | \`icon-serverless-function\` |
4397
- | Backend | gRPC Service | \`<<Container>>\` | \`icon-grpc-service\` |
4398
- | Data | Relational DB | \`<<ContainerDb>>\` | \`icon-relational-db\` |
4399
- | Data | Document DB | \`<<ContainerDb>>\` | \`icon-document-db\` |
4400
- | Data | Key-Value Store | \`<<ContainerDb>>\` | \`icon-key-value-store\` |
4401
- | Data | Cache | \`<<ContainerDb>>\` | \`icon-cache\` |
4402
- | Data | Search Engine | \`<<ContainerDb>>\` | \`icon-search-engine\` |
4403
- | Data | Data Warehouse | \`<<ContainerDb>>\` | \`icon-data-warehouse\` |
4404
- | Data | Graph DB | \`<<ContainerDb>>\` | \`icon-graph-db\` |
4405
- | Data | Time-Series DB | \`<<ContainerDb>>\` | \`icon-time-series-db\` |
4406
- | Infrastructure | CDN | \`<<Deployment_Node>>\` | \`icon-cdn\` |
4407
- | Infrastructure | Load Balancer | \`<<Deployment_Node>>\` | \`icon-load-balancer\` |
4408
- | Infrastructure | DNS | \`<<Deployment_Node>>\` | \`icon-dns\` |
4409
- | Infrastructure | Object Storage | \`<<Deployment_Node>>\` | \`icon-object-storage\` |
4410
- | Infrastructure | Container Registry | \`<<Deployment_Node>>\` | \`icon-container-registry\` |
4411
- | Infrastructure | Reverse Proxy | \`<<Deployment_Node>>\` | \`icon-reverse-proxy\` |
4412
- | Infrastructure | Service Mesh | \`<<Deployment_Node>>\` | \`icon-service-mesh\` |
4413
- | Messaging | Message Queue | \`<<ContainerQueue>>\` | \`icon-message-queue\` |
4414
- | Messaging | Event Bus | \`<<ContainerQueue>>\` | \`icon-event-bus\` |
4415
- | Messaging | Stream | \`<<ContainerQueue>>\` | \`icon-stream\` |
4416
- | Messaging | Pub/Sub | \`<<ContainerQueue>>\` | \`icon-pub-sub\` |
4417
- | Messaging | Webhook | \`<<ContainerQueue>>\` | \`icon-webhook\` |
4418
- | Security | Auth Provider | \`<<System_Ext>>\` | \`icon-auth-provider\` |
4419
- | Security | API Gateway | \`<<System_Ext>>\` | \`icon-api-gateway\` |
4420
- | Security | WAF | \`<<System_Ext>>\` | \`icon-waf\` |
4421
- | Security | Secret Manager | \`<<System_Ext>>\` | \`icon-secret-manager\` |
4422
- | Security | Certificate Manager | \`<<System_Ext>>\` | \`icon-certificate-manager\` |
4423
- | Security | Identity Provider | \`<<System_Ext>>\` | \`icon-identity-provider\` |
4424
- | External | Third-party API | \`<<System_Ext>>\` | \`icon-third-party-api\` |
4425
- | External | SaaS | \`<<System_Ext>>\` | \`icon-saas\` |
4426
- | External | Legacy System | \`<<System_Ext>>\` | \`icon-legacy-system\` |
4427
- | External | Partner Service | \`<<System_Ext>>\` | \`icon-partner-service\` |
4428
- | External | Payment Provider | \`<<System_Ext>>\` | \`icon-payment-provider\` |
4429
- | Monitoring | Logging | \`<<Container>>\` | \`icon-logging\` |
4430
- | Monitoring | Metrics | \`<<Container>>\` | \`icon-metrics\` |
4431
- | Monitoring | Tracing | \`<<Container>>\` | \`icon-tracing\` |
4432
- | Monitoring | Alerting | \`<<Container>>\` | \`icon-alerting\` |
4433
- | Monitoring | APM | \`<<Container>>\` | \`icon-apm\` |
4434
-
4435
- ## Icon Registry
4436
-
4437
- Icons are inline SVG \`<symbol>\` elements with a 16x16 viewBox, rendered via \`<use>\` at \`(x+W-22, y+4)\` inside the component box. They use \`currentColor\` to inherit the category stroke color.
4438
-
4439
- ### Category-Level Icons (active)
4440
-
4441
- Each category has a shared icon defined in \`html-template.html\` \`<defs>\`. All sub-types within a category use their category icon by default. Sub-type-specific icons can override these in the future.
4442
-
4443
- | Category | Symbol ID | Shape | Status |
4444
- |---|---|---|---|
4445
- | Frontend | \`icon-frontend\` | Monitor with stand | **active** |
4446
- | Backend | \`icon-backend\` | Server rack (3 units) | **active** |
4447
- | Data | \`icon-data\` | Database cylinder | **active** |
4448
- | Infrastructure | \`icon-infrastructure\` | Cloud | **active** |
4449
- | Messaging | \`icon-messaging\` | Envelope | **active** |
4450
- | Security | \`icon-security\` | Shield with checkmark | **active** |
4451
- | External | \`icon-external\` | Globe with meridians | **active** |
4452
- | Monitoring | \`icon-monitoring\` | Line chart with axes | **active** |
4453
-
4454
- Usage pattern:
4455
- \`\`\`svg
4456
- <use href="#icon-frontend" class="icon-use" x="448" y="154" width="16" height="16"/>
4457
- \`\`\`
4458
-
4459
- ### Sub-type Icons (planned)
4460
-
4461
- When a sub-type icon is added, it overrides the category icon for that specific component. Until implemented, all sub-types use their category icon.
4462
-
4463
- | Sub-type | Icon | Status |
4464
- |---|---|---|
4465
- | SPA | \`icon-spa\` | planned |
4466
- | Mobile App | \`icon-mobile-app\` | planned |
4467
- | Static Site | \`icon-static-site\` | planned |
4468
- | Micro-frontend | \`icon-micro-frontend\` | planned |
4469
- | PWA | \`icon-pwa\` | planned |
4470
- | Desktop App | \`icon-desktop-app\` | planned |
4471
- | API Service | \`icon-api-service\` | planned |
4472
- | Worker/Job | \`icon-worker-job\` | planned |
4473
- | BFF | \`icon-bff\` | planned |
4474
- | Microservice | \`icon-microservice\` | planned |
4475
- | Serverless Function | \`icon-serverless-function\` | planned |
4476
- | gRPC Service | \`icon-grpc-service\` | planned |
4477
- | Relational DB | \`icon-relational-db\` | planned |
4478
- | Document DB | \`icon-document-db\` | planned |
4479
- | Key-Value Store | \`icon-key-value-store\` | planned |
4480
- | Cache | \`icon-cache\` | planned |
4481
- | Search Engine | \`icon-search-engine\` | planned |
4482
- | Data Warehouse | \`icon-data-warehouse\` | planned |
4483
- | Graph DB | \`icon-graph-db\` | planned |
4484
- | Time-Series DB | \`icon-time-series-db\` | planned |
4485
- | CDN | \`icon-cdn\` | planned |
4486
- | Load Balancer | \`icon-load-balancer\` | planned |
4487
- | DNS | \`icon-dns\` | planned |
4488
- | Object Storage | \`icon-object-storage\` | planned |
4489
- | Container Registry | \`icon-container-registry\` | planned |
4490
- | Reverse Proxy | \`icon-reverse-proxy\` | planned |
4491
- | Service Mesh | \`icon-service-mesh\` | planned |
4492
- | Message Queue | \`icon-message-queue\` | planned |
4493
- | Event Bus | \`icon-event-bus\` | planned |
4494
- | Stream | \`icon-stream\` | planned |
4495
- | Pub/Sub | \`icon-pub-sub\` | planned |
4496
- | Webhook | \`icon-webhook\` | planned |
4497
- | Auth Provider | \`icon-auth-provider\` | planned |
4498
- | API Gateway | \`icon-api-gateway\` | planned |
4499
- | WAF | \`icon-waf\` | planned |
4500
- | Secret Manager | \`icon-secret-manager\` | planned |
4501
- | Certificate Manager | \`icon-certificate-manager\` | planned |
4502
- | Identity Provider | \`icon-identity-provider\` | planned |
4503
- | Third-party API | \`icon-third-party-api\` | planned |
4504
- | SaaS | \`icon-saas\` | planned |
4505
- | Legacy System | \`icon-legacy-system\` | planned |
4506
- | Partner Service | \`icon-partner-service\` | planned |
4507
- | Payment Provider | \`icon-payment-provider\` | planned |
4508
- | Logging | \`icon-logging\` | planned |
4509
- | Metrics | \`icon-metrics\` | planned |
4510
- | Tracing | \`icon-tracing\` | planned |
4511
- | Alerting | \`icon-alerting\` | planned |
4512
- | APM | \`icon-apm\` | planned |
4513
-
4514
- ## Visual Elements
4515
-
4516
- ### Component Box Pattern
4517
-
4518
- Use a rounded component box with semi-transparent fill and category stroke.
4519
-
4520
- \`\`\`svg
4521
- <g class="node backend">
4522
- <rect x="280" y="210" width="190" height="60" rx="6" />
4523
- <text class="c4-tag" x="294" y="226">&lt;&lt;Container&gt;&gt;</text>
4524
- <text class="node-title" x="294" y="243">API Service</text>
4525
- <text class="node-subtitle" x="294" y="257">Backend / HTTPS JSON</text>
4526
- </g>
4527
- \`\`\`
4528
-
4529
- ### Arrow Masking Technique
4530
-
4531
- Use an opaque background rectangle below the box content to visually hide arrows beneath components without breaking the component fill style.
4532
-
4533
- \`\`\`svg
4534
- <g class="node-mask-layer">
4535
- <rect x="280" y="210" width="190" height="60" rx="6" fill="#020617" />
4536
- <rect x="280" y="210" width="190" height="60" rx="6"
4537
- fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5" />
4538
- </g>
4539
- \`\`\`
4540
-
4541
- ### Security Group Boundary
4542
-
4543
- - Purpose: show auth, gateway, WAF, or identity zones
4544
- - Stroke color: rose (\`#fb7185\`)
4545
- - Pattern: \`stroke-dasharray="4,4"\`
4546
- - Suggested label: \`Security Boundary\`
4547
-
4548
- \`\`\`svg
4549
- <rect x="700" y="140" width="220" height="180" rx="12"
4550
- fill="transparent" stroke="#fb7185" stroke-width="1.5"
4551
- stroke-dasharray="4,4" />
4552
- \`\`\`
4553
-
4554
- ### Region Boundary
4555
-
4556
- - Purpose: group a deployment region, platform segment, or domain slice
4557
- - Stroke color: amber (\`#fbbf24\`)
4558
- - Pattern: \`stroke-dasharray="8,4"\`
4559
- - Radius: \`rx="12"\`
4560
-
4561
- \`\`\`svg
4562
- <rect x="70" y="120" width="600" height="430" rx="12"
4563
- fill="transparent" stroke="#fbbf24" stroke-width="1.5"
4564
- stroke-dasharray="8,4" />
4565
- \`\`\`
4566
-
4567
- ### Arrow Marker SVG Definition
4568
-
4569
- \`\`\`svg
4570
- <defs>
4571
- <marker id="arrowhead" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto">
4572
- <path d="M0,0 L8,4 L0,8 Z" fill="#cbd5e1" />
4573
- </marker>
4574
- </defs>
4575
- \`\`\`
4576
-
4577
- ### Arrow Z-order Rule
4578
-
4579
- Draw arrows early in the SVG so component boxes and masking layers paint over them. This keeps connectors readable in dense diagrams and avoids arrow overlap across component interiors.
4580
-
4581
- ## Spacing Rules
4582
-
4583
- - Standard component height: \`60px\`
4584
- - Minimum vertical gap between stacked components: \`40px\`
4585
- - Inline connectors should route through gaps rather than through component interiors
4586
- - Keep labels inside the top \`28px\` of the box and the subtype line inside the lower third
4587
- - Place legends outside boundaries to prevent classification noise inside the diagram area
4588
-
4589
- ## Layout Structure
4590
-
4591
- The canonical page composition is:
4592
-
4593
- 1. Header: title, pulse dot, subtitle
4594
- 2. Main SVG diagram: embedded inside a rounded border card
4595
- 3. Summary cards: grid of 3 cards beneath the diagram
4596
- 4. Footer metadata: generator, scope, rendering notes, last-updated stamp
4597
-
4598
- ## Present Tool Integration
4599
-
4600
- Compose architecture diagrams with the \`present\` tool by embedding the full HTML/SVG diagram in a markdown block and pairing it with metrics or cards blocks as needed.
4601
-
4602
- ### \`format: "html"\`
4603
-
4604
- Use a \`markdown\` block with embedded \`<div>\`, inline SVG, and a \`<style>\` tag containing the full CSS. The \`present\` html format renders raw HTML in markdown blocks.
4605
-
4606
- ### \`format: "browser"\`
4607
-
4608
- Use the same composition: a \`markdown\` block containing the full HTML structure. Summary content can also be added with \`cards\` and \`metrics\` blocks alongside the SVG diagram block.
4609
-
4610
- ### Example \`present\` Call Structure
4611
-
4612
- \`\`\`js
4613
- present({
4614
- format: "html", // or "browser"
4615
- title: "System Architecture",
4616
- content: [
4617
- {
4618
- type: "metrics",
4619
- title: "Overview",
4620
- value: [
4621
- { label: "Services", value: "6" },
4622
- { label: "Data Stores", value: "2" },
4623
- { label: "External Systems", value: "3" }
4624
- ]
4625
- },
4626
- {
4627
- type: "markdown",
4628
- title: "Architecture Diagram",
4629
- value: "<div class='arch-diagram'>...(inline SVG)...</div><style>...(design system CSS)...</style>"
4630
- },
4631
- {
4632
- type: "cards",
4633
- title: "Summary",
4634
- value: [
4635
- { title: "Frontend", body: "React SPA..." },
4636
- { title: "Backend", body: "API + async workers..." },
4637
- { title: "Security", body: "Gateway + IdP..." }
4638
- ]
4639
- }
4640
- ]
4641
- })
4642
- \`\`\`
4643
-
4644
- This design system is the single source of truth. The \`c4-architecture\` skill and \`present\` skill both reference this file. Update component types, colors, or layout rules here only.
4645
-
4646
- ## Adding New Categories
4647
-
4648
- 1. Add a new row to the Category Registry with the category name, colors, C4 mapping, and initial subtype set.
4649
- 2. Add the new sub-types to the Sub-type Registry with a C4 label and icon slot name.
4650
- 3. Add icon placeholders to the Icon Registry.
4651
- 4. Update [html-template.html](html-template.html) legend content so the new category appears in the rendered template.
4652
- 5. Update summary card accent colors in [html-template.html](html-template.html) if the new category needs a dedicated card treatment.
4653
-
4654
- ## Template Pairing
4655
-
4656
- See [html-template.html](html-template.html) for the complete self-contained reference implementation of this design system.
4657
- ` },
4658
- { file: "SKILL.md", content: `---
3520
+ `},{file:`references/html-design-system.md`,content:'# HTML/SVG Architecture Diagram Design System\n\nThis file is the centralized design system for HTML and SVG architecture diagrams.\n\nIt is the single source of truth for visual tokens, component categories, layout rules, and `present` tool composition guidance used by the `c4-architecture` skill and the `present` skill. Update component types, colors, layout rules, and icon slots here only.\n\n## Purpose\n\n- Define a reusable visual language for C4-style architecture diagrams rendered as HTML and inline SVG.\n- Keep category styling extensible through a registry instead of hardcoded component types.\n- Standardize diagram composition for both skill-authored documentation and `present` output.\n\n## Core Design Tokens\n\n### Typography\n\n- Font family: `"JetBrains Mono", monospace`\n- Font source: Google Fonts (`https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap`)\n- Component names: `12px`\n- Sublabels: `9px`\n- Annotations: `8px`\n- Tiny labels: `7px`\n- Legend: `10px`\n- Icon area labels: `11px`\n\n### Background\n\n- Page background: `#020617` (`slate-950`)\n- Background pattern: inline SVG grid pattern over the page background\n- Recommended grid line colors:\n - Major grid: `rgba(148, 163, 184, 0.08)`\n - Minor grid: `rgba(148, 163, 184, 0.04)`\n\n### Component Box Defaults\n\n- Shape: rounded rectangle\n- Border radius: `rx="6"`\n- Stroke width: `1.5px`\n- Fill: category-specific semi-transparent RGBA fill\n- Stroke: category-specific hex stroke\n- Label stack:\n - Line 1: C4 label such as `<<Container>>`\n - Line 2: component name\n - Line 3: subtype or technology summary\n\n## Category Registry\n\nThe registry is hierarchical: categories define shared tokens and C4 intent, while sub-types inherit the category styling and reserve an icon slot for future SVG glyphs.\n\n| Category | Stroke Color | Fill Color | C4 Mapping | Sub-types |\n|---|---|---|---|---|\n| Frontend | `#22d3ee` | `rgba(8, 51, 68, 0.4)` | Container (SPA, web) | SPA, Mobile App, Static Site, Micro-frontend, PWA, Desktop App |\n| Backend | `#34d399` | `rgba(6, 78, 59, 0.4)` | Container (service) | API Service, Worker/Job, BFF, Microservice, Serverless Function, gRPC Service |\n| Data | `#a78bfa` | `rgba(76, 29, 149, 0.4)` | ContainerDb | Relational DB, Document DB, Key-Value Store, Cache, Search Engine, Data Warehouse, Graph DB, Time-Series DB |\n| Infrastructure | `#fbbf24` | `rgba(120, 53, 15, 0.3)` | Deployment_Node | CDN, Load Balancer, DNS, Object Storage, Container Registry, Reverse Proxy, Service Mesh |\n| Messaging | `#fb923c` | `rgba(251, 146, 60, 0.3)` | ContainerQueue | Message Queue, Event Bus, Stream, Pub/Sub, Webhook |\n| Security | `#fb7185` | `rgba(136, 19, 55, 0.4)` | System_Ext / boundary | Auth Provider, API Gateway, WAF, Secret Manager, Certificate Manager, Identity Provider |\n| External | `#94a3b8` | `rgba(30, 41, 59, 0.5)` | System_Ext | Third-party API, SaaS, Legacy System, Partner Service, Payment Provider |\n| Monitoring | `#38bdf8` | `rgba(12, 74, 110, 0.4)` | Container | Logging, Metrics, Tracing, Alerting, APM |\n\n## Sub-type Registry\n\nEach sub-type inherits its category tokens and keeps a placeholder slot for an inline SVG icon.\n\n| Category | Sub-type | C4 Label | Icon Slot |\n|---|---|---|---|\n| Frontend | SPA | `<<Container>>` | `icon-spa` |\n| Frontend | Mobile App | `<<Container>>` | `icon-mobile-app` |\n| Frontend | Static Site | `<<Container>>` | `icon-static-site` |\n| Frontend | Micro-frontend | `<<Container>>` | `icon-micro-frontend` |\n| Frontend | PWA | `<<Container>>` | `icon-pwa` |\n| Frontend | Desktop App | `<<Container>>` | `icon-desktop-app` |\n| Backend | API Service | `<<Container>>` | `icon-api-service` |\n| Backend | Worker/Job | `<<Container>>` | `icon-worker-job` |\n| Backend | BFF | `<<Container>>` | `icon-bff` |\n| Backend | Microservice | `<<Container>>` | `icon-microservice` |\n| Backend | Serverless Function | `<<Container>>` | `icon-serverless-function` |\n| Backend | gRPC Service | `<<Container>>` | `icon-grpc-service` |\n| Data | Relational DB | `<<ContainerDb>>` | `icon-relational-db` |\n| Data | Document DB | `<<ContainerDb>>` | `icon-document-db` |\n| Data | Key-Value Store | `<<ContainerDb>>` | `icon-key-value-store` |\n| Data | Cache | `<<ContainerDb>>` | `icon-cache` |\n| Data | Search Engine | `<<ContainerDb>>` | `icon-search-engine` |\n| Data | Data Warehouse | `<<ContainerDb>>` | `icon-data-warehouse` |\n| Data | Graph DB | `<<ContainerDb>>` | `icon-graph-db` |\n| Data | Time-Series DB | `<<ContainerDb>>` | `icon-time-series-db` |\n| Infrastructure | CDN | `<<Deployment_Node>>` | `icon-cdn` |\n| Infrastructure | Load Balancer | `<<Deployment_Node>>` | `icon-load-balancer` |\n| Infrastructure | DNS | `<<Deployment_Node>>` | `icon-dns` |\n| Infrastructure | Object Storage | `<<Deployment_Node>>` | `icon-object-storage` |\n| Infrastructure | Container Registry | `<<Deployment_Node>>` | `icon-container-registry` |\n| Infrastructure | Reverse Proxy | `<<Deployment_Node>>` | `icon-reverse-proxy` |\n| Infrastructure | Service Mesh | `<<Deployment_Node>>` | `icon-service-mesh` |\n| Messaging | Message Queue | `<<ContainerQueue>>` | `icon-message-queue` |\n| Messaging | Event Bus | `<<ContainerQueue>>` | `icon-event-bus` |\n| Messaging | Stream | `<<ContainerQueue>>` | `icon-stream` |\n| Messaging | Pub/Sub | `<<ContainerQueue>>` | `icon-pub-sub` |\n| Messaging | Webhook | `<<ContainerQueue>>` | `icon-webhook` |\n| Security | Auth Provider | `<<System_Ext>>` | `icon-auth-provider` |\n| Security | API Gateway | `<<System_Ext>>` | `icon-api-gateway` |\n| Security | WAF | `<<System_Ext>>` | `icon-waf` |\n| Security | Secret Manager | `<<System_Ext>>` | `icon-secret-manager` |\n| Security | Certificate Manager | `<<System_Ext>>` | `icon-certificate-manager` |\n| Security | Identity Provider | `<<System_Ext>>` | `icon-identity-provider` |\n| External | Third-party API | `<<System_Ext>>` | `icon-third-party-api` |\n| External | SaaS | `<<System_Ext>>` | `icon-saas` |\n| External | Legacy System | `<<System_Ext>>` | `icon-legacy-system` |\n| External | Partner Service | `<<System_Ext>>` | `icon-partner-service` |\n| External | Payment Provider | `<<System_Ext>>` | `icon-payment-provider` |\n| Monitoring | Logging | `<<Container>>` | `icon-logging` |\n| Monitoring | Metrics | `<<Container>>` | `icon-metrics` |\n| Monitoring | Tracing | `<<Container>>` | `icon-tracing` |\n| Monitoring | Alerting | `<<Container>>` | `icon-alerting` |\n| Monitoring | APM | `<<Container>>` | `icon-apm` |\n\n## Icon Registry\n\nIcons are inline SVG `<symbol>` elements with a 16x16 viewBox, rendered via `<use>` at `(x+W-22, y+4)` inside the component box. They use `currentColor` to inherit the category stroke color.\n\n### Category-Level Icons (active)\n\nEach category has a shared icon defined in `html-template.html` `<defs>`. All sub-types within a category use their category icon by default. Sub-type-specific icons can override these in the future.\n\n| Category | Symbol ID | Shape | Status |\n|---|---|---|---|\n| Frontend | `icon-frontend` | Monitor with stand | **active** |\n| Backend | `icon-backend` | Server rack (3 units) | **active** |\n| Data | `icon-data` | Database cylinder | **active** |\n| Infrastructure | `icon-infrastructure` | Cloud | **active** |\n| Messaging | `icon-messaging` | Envelope | **active** |\n| Security | `icon-security` | Shield with checkmark | **active** |\n| External | `icon-external` | Globe with meridians | **active** |\n| Monitoring | `icon-monitoring` | Line chart with axes | **active** |\n\nUsage pattern:\n```svg\n<use href="#icon-frontend" class="icon-use" x="448" y="154" width="16" height="16"/>\n```\n\n### Sub-type Icons (planned)\n\nWhen a sub-type icon is added, it overrides the category icon for that specific component. Until implemented, all sub-types use their category icon.\n\n| Sub-type | Icon | Status |\n|---|---|---|\n| SPA | `icon-spa` | planned |\n| Mobile App | `icon-mobile-app` | planned |\n| Static Site | `icon-static-site` | planned |\n| Micro-frontend | `icon-micro-frontend` | planned |\n| PWA | `icon-pwa` | planned |\n| Desktop App | `icon-desktop-app` | planned |\n| API Service | `icon-api-service` | planned |\n| Worker/Job | `icon-worker-job` | planned |\n| BFF | `icon-bff` | planned |\n| Microservice | `icon-microservice` | planned |\n| Serverless Function | `icon-serverless-function` | planned |\n| gRPC Service | `icon-grpc-service` | planned |\n| Relational DB | `icon-relational-db` | planned |\n| Document DB | `icon-document-db` | planned |\n| Key-Value Store | `icon-key-value-store` | planned |\n| Cache | `icon-cache` | planned |\n| Search Engine | `icon-search-engine` | planned |\n| Data Warehouse | `icon-data-warehouse` | planned |\n| Graph DB | `icon-graph-db` | planned |\n| Time-Series DB | `icon-time-series-db` | planned |\n| CDN | `icon-cdn` | planned |\n| Load Balancer | `icon-load-balancer` | planned |\n| DNS | `icon-dns` | planned |\n| Object Storage | `icon-object-storage` | planned |\n| Container Registry | `icon-container-registry` | planned |\n| Reverse Proxy | `icon-reverse-proxy` | planned |\n| Service Mesh | `icon-service-mesh` | planned |\n| Message Queue | `icon-message-queue` | planned |\n| Event Bus | `icon-event-bus` | planned |\n| Stream | `icon-stream` | planned |\n| Pub/Sub | `icon-pub-sub` | planned |\n| Webhook | `icon-webhook` | planned |\n| Auth Provider | `icon-auth-provider` | planned |\n| API Gateway | `icon-api-gateway` | planned |\n| WAF | `icon-waf` | planned |\n| Secret Manager | `icon-secret-manager` | planned |\n| Certificate Manager | `icon-certificate-manager` | planned |\n| Identity Provider | `icon-identity-provider` | planned |\n| Third-party API | `icon-third-party-api` | planned |\n| SaaS | `icon-saas` | planned |\n| Legacy System | `icon-legacy-system` | planned |\n| Partner Service | `icon-partner-service` | planned |\n| Payment Provider | `icon-payment-provider` | planned |\n| Logging | `icon-logging` | planned |\n| Metrics | `icon-metrics` | planned |\n| Tracing | `icon-tracing` | planned |\n| Alerting | `icon-alerting` | planned |\n| APM | `icon-apm` | planned |\n\n## Visual Elements\n\n### Component Box Pattern\n\nUse a rounded component box with semi-transparent fill and category stroke.\n\n```svg\n<g class="node backend">\n <rect x="280" y="210" width="190" height="60" rx="6" />\n <text class="c4-tag" x="294" y="226">&lt;&lt;Container&gt;&gt;</text>\n <text class="node-title" x="294" y="243">API Service</text>\n <text class="node-subtitle" x="294" y="257">Backend / HTTPS JSON</text>\n</g>\n```\n\n### Arrow Masking Technique\n\nUse an opaque background rectangle below the box content to visually hide arrows beneath components without breaking the component fill style.\n\n```svg\n<g class="node-mask-layer">\n <rect x="280" y="210" width="190" height="60" rx="6" fill="#020617" />\n <rect x="280" y="210" width="190" height="60" rx="6"\n fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5" />\n</g>\n```\n\n### Security Group Boundary\n\n- Purpose: show auth, gateway, WAF, or identity zones\n- Stroke color: rose (`#fb7185`)\n- Pattern: `stroke-dasharray="4,4"`\n- Suggested label: `Security Boundary`\n\n```svg\n<rect x="700" y="140" width="220" height="180" rx="12"\n fill="transparent" stroke="#fb7185" stroke-width="1.5"\n stroke-dasharray="4,4" />\n```\n\n### Region Boundary\n\n- Purpose: group a deployment region, platform segment, or domain slice\n- Stroke color: amber (`#fbbf24`)\n- Pattern: `stroke-dasharray="8,4"`\n- Radius: `rx="12"`\n\n```svg\n<rect x="70" y="120" width="600" height="430" rx="12"\n fill="transparent" stroke="#fbbf24" stroke-width="1.5"\n stroke-dasharray="8,4" />\n```\n\n### Arrow Marker SVG Definition\n\n```svg\n<defs>\n <marker id="arrowhead" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto">\n <path d="M0,0 L8,4 L0,8 Z" fill="#cbd5e1" />\n </marker>\n</defs>\n```\n\n### Arrow Z-order Rule\n\nDraw arrows early in the SVG so component boxes and masking layers paint over them. This keeps connectors readable in dense diagrams and avoids arrow overlap across component interiors.\n\n## Spacing Rules\n\n- Standard component height: `60px`\n- Minimum vertical gap between stacked components: `40px`\n- Inline connectors should route through gaps rather than through component interiors\n- Keep labels inside the top `28px` of the box and the subtype line inside the lower third\n- Place legends outside boundaries to prevent classification noise inside the diagram area\n\n## Layout Structure\n\nThe canonical page composition is:\n\n1. Header: title, pulse dot, subtitle\n2. Main SVG diagram: embedded inside a rounded border card\n3. Summary cards: grid of 3 cards beneath the diagram\n4. Footer metadata: generator, scope, rendering notes, last-updated stamp\n\n## Present Tool Integration\n\nCompose architecture diagrams with the `present` tool by embedding the full HTML/SVG diagram in a markdown block and pairing it with metrics or cards blocks as needed.\n\n### `format: "html"`\n\nUse a `markdown` block with embedded `<div>`, inline SVG, and a `<style>` tag containing the full CSS. The `present` html format renders raw HTML in markdown blocks.\n\n### `format: "browser"`\n\nUse the same composition: a `markdown` block containing the full HTML structure. Summary content can also be added with `cards` and `metrics` blocks alongside the SVG diagram block.\n\n### Example `present` Call Structure\n\n```js\npresent({\n format: "html", // or "browser"\n title: "System Architecture",\n content: [\n {\n type: "metrics",\n title: "Overview",\n value: [\n { label: "Services", value: "6" },\n { label: "Data Stores", value: "2" },\n { label: "External Systems", value: "3" }\n ]\n },\n {\n type: "markdown",\n title: "Architecture Diagram",\n value: "<div class=\'arch-diagram\'>...(inline SVG)...</div><style>...(design system CSS)...</style>"\n },\n {\n type: "cards",\n title: "Summary",\n value: [\n { title: "Frontend", body: "React SPA..." },\n { title: "Backend", body: "API + async workers..." },\n { title: "Security", body: "Gateway + IdP..." }\n ]\n }\n ]\n})\n```\n\nThis design system is the single source of truth. The `c4-architecture` skill and `present` skill both reference this file. Update component types, colors, or layout rules here only.\n\n## Adding New Categories\n\n1. Add a new row to the Category Registry with the category name, colors, C4 mapping, and initial subtype set.\n2. Add the new sub-types to the Sub-type Registry with a C4 label and icon slot name.\n3. Add icon placeholders to the Icon Registry.\n4. Update [html-template.html](html-template.html) legend content so the new category appears in the rendered template.\n5. Update summary card accent colors in [html-template.html](html-template.html) if the new category needs a dedicated card treatment.\n\n## Template Pairing\n\nSee [html-template.html](html-template.html) for the complete self-contained reference implementation of this design system.\n'},{file:`SKILL.md`,content:`---
4659
3521
  name: c4-architecture
4660
3522
  description: "Generate architecture documentation using C4 model diagrams. Supports two output formats: Mermaid (md) for documentation and HTML/SVG for presentations. Use when asked to create architecture diagrams, document system architecture, visualize software structure, create C4 diagrams, or generate context/container/component/deployment diagrams."
4661
3523
  metadata:
@@ -5044,10 +3906,7 @@ Write architecture documentation to \`docs/architecture/\` with naming conventio
5044
3906
  - [references/advanced-patterns.md](references/advanced-patterns.md) - Microservices, event-driven, deployment
5045
3907
  - [references/html-design-system.md](references/html-design-system.md) - Centralized HTML/SVG design system (types, colors, icons, present integration)
5046
3908
  - [references/html-template.html](references/html-template.html) - Self-contained HTML template for C4 diagrams
5047
- ` },
5048
- ],
5049
- "docs": [
5050
- { file: "references/diataxis-anti-patterns.md", content: `# Diátaxis Anti-Patterns
3909
+ `}],docs:[{file:`references/diataxis-anti-patterns.md`,content:`# Diátaxis Anti-Patterns
5051
3910
 
5052
3911
  Five common documentation anti-patterns that violate Diátaxis quadrant boundaries. Each pattern includes detection signals, a violation/compliant example pair, and remediation.
5053
3912
 
@@ -5193,8 +4052,7 @@ Common cases where the boundary between two quadrants is genuinely ambiguous:
5193
4052
 
5194
4053
  ## Attribution
5195
4054
 
5196
- This reference adapts concepts from the Diátaxis framework at diataxis.fr and from keithpatton/diataxis-agent-skill. Diátaxis framework content is licensed under CC-BY-SA 4.0; retain attribution and share-alike terms for further adaptations.` },
5197
- { file: "references/diataxis-compass.md", content: `# The Diataxis Compass
4055
+ This reference adapts concepts from the Diátaxis framework at diataxis.fr and from keithpatton/diataxis-agent-skill. Diátaxis framework content is licensed under CC-BY-SA 4.0; retain attribution and share-alike terms for further adaptations.`},{file:`references/diataxis-compass.md`,content:`# The Diataxis Compass
5198
4056
 
5199
4057
  The Diataxis Compass is a simple classification aid for documentation. It reduces classification to two axes so an author can decide what kind of document they are writing before structure and tone drift across quadrants.
5200
4058
 
@@ -5316,8 +4174,7 @@ This document adapts concepts from the Diataxis framework at [diataxis.fr](https
5316
4174
 
5317
4175
  Source material is licensed under **CC-BY-SA 4.0**.
5318
4176
 
5319
- Attribution: Daniele Procida, *Diataxis*, [https://diataxis.fr/](https://diataxis.fr/).` },
5320
- { file: "references/diataxis-quadrants.md", content: `# Diataxis Quadrants
4177
+ Attribution: Daniele Procida, *Diataxis*, [https://diataxis.fr/](https://diataxis.fr/).`},{file:`references/diataxis-quadrants.md`,content:`# Diataxis Quadrants
5321
4178
 
5322
4179
  This reference describes the four documentation quadrants in Diataxis: Tutorial, How-to guide, Reference, and Explanation. Use it when a document has already been classified, or when you need boundary tests to decide whether content belongs in one quadrant or has drifted into another.
5323
4180
 
@@ -5508,8 +4365,7 @@ This document adapts concepts from the Diataxis framework at [diataxis.fr](https
5508
4365
 
5509
4366
  Source material is licensed under **CC-BY-SA 4.0**.
5510
4367
 
5511
- Attribution: Daniele Procida, *Diataxis*, [https://diataxis.fr/](https://diataxis.fr/).` },
5512
- { file: "references/diataxis-quality.md", content: `# Diataxis Quality & Iteration
4368
+ Attribution: Daniele Procida, *Diataxis*, [https://diataxis.fr/](https://diataxis.fr/).`},{file:`references/diataxis-quality.md`,content:`# Diataxis Quality & Iteration
5513
4369
 
5514
4370
  How to assess and improve documentation quality using the Diátaxis framework.
5515
4371
 
@@ -5584,8 +4440,7 @@ Per document, count how many checklist items pass out of the total applicable it
5584
4440
 
5585
4441
  ---
5586
4442
 
5587
- *Quality framework follows the Diátaxis documentation framework (CC-BY-SA 4.0, Daniele Procida).*` },
5588
- { file: "references/diataxis-templates.md", content: `# Diataxis Templates
4443
+ *Quality framework follows the Diátaxis documentation framework (CC-BY-SA 4.0, Daniele Procida).*`},{file:`references/diataxis-templates.md`,content:`# Diataxis Templates
5589
4444
 
5590
4445
  Templates for Tutorial and Explanation documents. For How-To and Reference templates, see the main docs SKILL.md.
5591
4446
 
@@ -5704,110 +4559,7 @@ type: explanation
5704
4559
 
5705
4560
  ---
5706
4561
 
5707
- *Templates follow the Diátaxis documentation framework (CC-BY-SA 4.0, Daniele Procida).*` },
5708
- { file: "references/flow-artifacts-guide.md", content: `# Flow Artifacts Guide
5709
-
5710
- ## What Are Flow Artifacts
5711
-
5712
- Flows produce structured markdown artifacts in \`{{artifacts_path}}/\`. These files capture requirements, decisions, plan shape, implementation progress, and verification results for the completed flow.
5713
-
5714
- Use artifacts to document the why behind changes. Code diffs still matter, but artifacts usually contain the rationale, constraints, risks, and review findings that should shape durable documentation.
5715
-
5716
- ## How to Discover Artifacts
5717
-
5718
- \`\`\`text
5719
- flow_status() # Get artifactsPath
5720
- find({ pattern: "*.md", path: "<artifactsPath>" }) # Discover artifact files
5721
- digest({ sources: [ # Compress into working context
5722
- { path: "<found-artifact-1>" },
5723
- { path: "<found-artifact-2>" },
5724
- ...
5725
- ]})
5726
- \`\`\`
5727
-
5728
- Read every artifact \`find()\` returns. Different flows produce different files — do not assume specific filenames exist.
5729
-
5730
- ## Artifact Catalog
5731
-
5732
- | Artifact | Flow | Contains |
5733
- |---|---|---|
5734
- | \`design-decisions.md\` | \`aikit:basic\`, \`aikit:advanced\` | FORGE tier, approach, key decisions, constraints, and risks |
5735
- | \`assessment.md\` | \`aikit:basic\` | Goal, affected files, approach steps, risks, and open questions |
5736
- | \`spec.md\` | \`aikit:advanced\` | Requirements, acceptance criteria, and scope boundaries |
5737
- | \`plan.md\` | \`aikit:advanced\` | Phased implementation plan and architecture decisions |
5738
- | \`tasks.md\` | \`aikit:advanced\` | Atomic task list, dependencies, and agent assignments |
5739
- | \`progress.md\` | \`aikit:basic\`, \`aikit:advanced\` | Changes made, tests, deviations, and validation results |
5740
- | \`verify-report.md\` | \`aikit:basic\`, \`aikit:advanced\` | Verdict, quality gates, review findings, security, and recommendation |
5741
-
5742
- ## Artifact-to-Documentation Mapping
5743
-
5744
- | Artifact | Contains | Documentation Target | Action |
5745
- |---|---|---|---|
5746
- | \`design-decisions.md\` | FORGE tier, approach, key decisions | \`docs/decisions/\` | Create or update ADRs via \`adr-skill\` for each key decision |
5747
- | \`design-decisions.md\` | Architecture approach, constraints | \`docs/architecture/overview.md\` | Update the design rationale section |
5748
- | \`spec.md\` | Requirements, acceptance criteria | \`docs/reference/\` | Update API or component reference when public surface changed |
5749
- | \`plan.md\` | Architecture decisions, phase design | \`docs/architecture/\` | Update architecture docs with structural changes |
5750
- | \`tasks.md\` | Task breakdown, dependencies | Usually skip | Only document if it reveals new component boundaries |
5751
- | \`progress.md\` | Files changed, deviations, tests | \`docs/guides/testing.md\` | Update when testing strategy changed |
5752
- | \`progress.md\` | Deviations from plan | \`docs/decisions/\` | Document significant deviations as ADRs |
5753
- | \`verify-report.md\` | Code review findings, security | \`docs/architecture/overview.md\` | Update if findings reveal architectural patterns |
5754
- | \`verify-report.md\` | Security concerns | \`docs/guides/\` | Create or update security guidance when concerns are material |
5755
-
5756
- ## Reading Strategy
5757
-
5758
- Read every artifact \`find()\` returns. Triage by content type:
5759
-
5760
- | Content Signal | Documentation Value | Action |
5761
- |---|---|---|
5762
- | Decisions, rationale, constraints | High — durable knowledge | Extract into \`docs/decisions/\` or architecture docs |
5763
- | Requirements, scope, acceptance criteria | High — defines intent | Update reference docs if public surface changed |
5764
- | Review findings, security concerns, quality gates | Medium — surfaces issues | Update architecture or guides if findings are material |
5765
- | Implementation progress, task lists | Low — transient | Document only meaningful deviations from the plan |
5766
-
5767
- Skip artifacts that only repeat completed work with no insights beyond the code diff.
5768
-
5769
- > The catalog and mapping tables above list artifacts from built-in flows (\`aikit:basic\`, \`aikit:advanced\`). Custom flows may produce entirely different artifacts — always discover dynamically with \`find()\` and classify by content, not by filename.
5770
-
5771
- ## What Not to Document
5772
-
5773
- | Avoid | Do Instead |
5774
- |---|---|
5775
- | Copying artifact text verbatim into \`docs/\` | Extract decisions, rationale, constraints, and stable guidance |
5776
- | Documenting every task or progress update | Keep only durable insights that help future readers |
5777
- | Mirroring temporary planning details | Preserve the final reasoning, not the transient workflow chatter |` },
5778
- { file: "references/project-knowledge-gotchas.md", content: `# Project Knowledge — Gotchas
5779
-
5780
- Common pitfalls when documenting project knowledge. Reference this during Phase 2 (Investigate) and Phase 4 (Validate).
5781
-
5782
- ## Environment Gotchas
5783
-
5784
- **Monorepos:** Root \`package.json\` may have no source — check for \`workspaces\`, \`packages/\`, or \`apps/\` directories. Each workspace may have independent dependencies and conventions. Map each sub-package separately.
5785
-
5786
- **Outdated README:** README often describes intended architecture, not the current one. Cross-reference with actual file structure before treating any README claim as fact.
5787
-
5788
- **TypeScript path aliases:** \`tsconfig.json\` \`paths\` config means imports like \`@/foo\` don't map directly to the filesystem. Map aliases to real paths before documenting structure.
5789
-
5790
- **Generated/compiled output:** Never document patterns from \`dist/\`, \`build/\`, \`generated/\`, \`.next/\`, \`out/\`, or \`__pycache__/\`. These are artefacts — document source conventions only.
5791
-
5792
- **\`.env.example\` reveals required config:** Secrets are never committed. Read \`.env.example\`, \`.env.template\`, or \`.env.sample\` to discover required environment variables.
5793
-
5794
- **\`devDependencies\` ≠ production stack:** Only \`dependencies\` (or equivalent) runs in production. Document linters, formatters, and test frameworks separately as dev tooling in \`stack.md\`.
5795
-
5796
- **Test TODOs ≠ production debt:** TODOs inside test directories are coverage gaps, not production technical debt. Separate them in \`concerns.md\`.
5797
-
5798
- **High-churn files = fragile areas:** Files appearing most in recent \`git_context({})\` output have the highest modification rate and likely hidden complexity. Always note them in \`concerns.md\`.
5799
-
5800
- ## Anti-Pattern Table
5801
-
5802
- | ❌ Don't | ✅ Do instead |
5803
- |---------|--------------|
5804
- | "Uses Clean Architecture with Domain/Data layers" (when no such directories exist) | State only what directory structure actually shows |
5805
- | "This is a Next.js project" (without checking \`package.json\`) | Check \`dependencies\` first. State what's actually there |
5806
- | Guess the database from a variable name like \`dbUrl\` | Check manifest for \`pg\`, \`mysql2\`, \`mongoose\`, \`prisma\`, etc. |
5807
- | Document \`dist/\` or \`build/\` naming patterns as conventions | Source files only |
5808
- | Assume README describes current architecture | Cross-reference with actual file structure via \`analyze_structure\` |
5809
- | Treat test TODOs as production tech debt | Separate coverage gaps from production concerns in \`concerns.md\` |` },
5810
- { file: "references/project-knowledge-templates.md", content: `# Project Knowledge Templates
4562
+ *Templates follow the Diátaxis documentation framework (CC-BY-SA 4.0, Daniele Procida).*`},{file:`references/flow-artifacts-guide.md`,content:'# Flow Artifacts Guide\n\n## What Are Flow Artifacts\n\nFlows produce structured markdown artifacts in `{{artifacts_path}}/`. These files capture requirements, decisions, plan shape, implementation progress, and verification results for the completed flow.\n\nUse artifacts to document the why behind changes. Code diffs still matter, but artifacts usually contain the rationale, constraints, risks, and review findings that should shape durable documentation.\n\n## How to Discover Artifacts\n\n```text\nflow_status() # Get artifactsPath\nfind({ pattern: "*.md", path: "<artifactsPath>" }) # Discover artifact files\ndigest({ sources: [ # Compress into working context\n { path: "<found-artifact-1>" },\n { path: "<found-artifact-2>" },\n ...\n]})\n```\n\nRead every artifact `find()` returns. Different flows produce different files — do not assume specific filenames exist.\n\n## Artifact Catalog\n\n| Artifact | Flow | Contains |\n|---|---|---|\n| `design-decisions.md` | `aikit:basic`, `aikit:advanced` | FORGE tier, approach, key decisions, constraints, and risks |\n| `assessment.md` | `aikit:basic` | Goal, affected files, approach steps, risks, and open questions |\n| `spec.md` | `aikit:advanced` | Requirements, acceptance criteria, and scope boundaries |\n| `plan.md` | `aikit:advanced` | Phased implementation plan and architecture decisions |\n| `tasks.md` | `aikit:advanced` | Atomic task list, dependencies, and agent assignments |\n| `progress.md` | `aikit:basic`, `aikit:advanced` | Changes made, tests, deviations, and validation results |\n| `verify-report.md` | `aikit:basic`, `aikit:advanced` | Verdict, quality gates, review findings, security, and recommendation |\n\n## Artifact-to-Documentation Mapping\n\n| Artifact | Contains | Documentation Target | Action |\n|---|---|---|---|\n| `design-decisions.md` | FORGE tier, approach, key decisions | `docs/decisions/` | Create or update ADRs via `adr-skill` for each key decision |\n| `design-decisions.md` | Architecture approach, constraints | `docs/architecture/overview.md` | Update the design rationale section |\n| `spec.md` | Requirements, acceptance criteria | `docs/reference/` | Update API or component reference when public surface changed |\n| `plan.md` | Architecture decisions, phase design | `docs/architecture/` | Update architecture docs with structural changes |\n| `tasks.md` | Task breakdown, dependencies | Usually skip | Only document if it reveals new component boundaries |\n| `progress.md` | Files changed, deviations, tests | `docs/guides/testing.md` | Update when testing strategy changed |\n| `progress.md` | Deviations from plan | `docs/decisions/` | Document significant deviations as ADRs |\n| `verify-report.md` | Code review findings, security | `docs/architecture/overview.md` | Update if findings reveal architectural patterns |\n| `verify-report.md` | Security concerns | `docs/guides/` | Create or update security guidance when concerns are material |\n\n## Reading Strategy\n\nRead every artifact `find()` returns. Triage by content type:\n\n| Content Signal | Documentation Value | Action |\n|---|---|---|\n| Decisions, rationale, constraints | High — durable knowledge | Extract into `docs/decisions/` or architecture docs |\n| Requirements, scope, acceptance criteria | High — defines intent | Update reference docs if public surface changed |\n| Review findings, security concerns, quality gates | Medium — surfaces issues | Update architecture or guides if findings are material |\n| Implementation progress, task lists | Low — transient | Document only meaningful deviations from the plan |\n\nSkip artifacts that only repeat completed work with no insights beyond the code diff.\n\n> The catalog and mapping tables above list artifacts from built-in flows (`aikit:basic`, `aikit:advanced`). Custom flows may produce entirely different artifacts — always discover dynamically with `find()` and classify by content, not by filename.\n\n## What Not to Document\n\n| Avoid | Do Instead |\n|---|---|\n| Copying artifact text verbatim into `docs/` | Extract decisions, rationale, constraints, and stable guidance |\n| Documenting every task or progress update | Keep only durable insights that help future readers |\n| Mirroring temporary planning details | Preserve the final reasoning, not the transient workflow chatter |'},{file:`references/project-knowledge-gotchas.md`,content:'# Project Knowledge — Gotchas\n\nCommon pitfalls when documenting project knowledge. Reference this during Phase 2 (Investigate) and Phase 4 (Validate).\n\n## Environment Gotchas\n\n**Monorepos:** Root `package.json` may have no source — check for `workspaces`, `packages/`, or `apps/` directories. Each workspace may have independent dependencies and conventions. Map each sub-package separately.\n\n**Outdated README:** README often describes intended architecture, not the current one. Cross-reference with actual file structure before treating any README claim as fact.\n\n**TypeScript path aliases:** `tsconfig.json` `paths` config means imports like `@/foo` don\'t map directly to the filesystem. Map aliases to real paths before documenting structure.\n\n**Generated/compiled output:** Never document patterns from `dist/`, `build/`, `generated/`, `.next/`, `out/`, or `__pycache__/`. These are artefacts — document source conventions only.\n\n**`.env.example` reveals required config:** Secrets are never committed. Read `.env.example`, `.env.template`, or `.env.sample` to discover required environment variables.\n\n**`devDependencies` ≠ production stack:** Only `dependencies` (or equivalent) runs in production. Document linters, formatters, and test frameworks separately as dev tooling in `stack.md`.\n\n**Test TODOs ≠ production debt:** TODOs inside test directories are coverage gaps, not production technical debt. Separate them in `concerns.md`.\n\n**High-churn files = fragile areas:** Files appearing most in recent `git_context({})` output have the highest modification rate and likely hidden complexity. Always note them in `concerns.md`.\n\n## Anti-Pattern Table\n\n| ❌ Don\'t | ✅ Do instead |\n|---------|--------------|\n| "Uses Clean Architecture with Domain/Data layers" (when no such directories exist) | State only what directory structure actually shows |\n| "This is a Next.js project" (without checking `package.json`) | Check `dependencies` first. State what\'s actually there |\n| Guess the database from a variable name like `dbUrl` | Check manifest for `pg`, `mysql2`, `mongoose`, `prisma`, etc. |\n| Document `dist/` or `build/` naming patterns as conventions | Source files only |\n| Assume README describes current architecture | Cross-reference with actual file structure via `analyze_structure` |\n| Treat test TODOs as production tech debt | Separate coverage gaps from production concerns in `concerns.md` |'},{file:`references/project-knowledge-templates.md`,content:`# Project Knowledge Templates
5811
4563
 
5812
4564
  Templates for the seven project knowledge documents in \`docs/architecture/\`. Use these to ensure consistent structure across projects.
5813
4565
 
@@ -6087,8 +4839,7 @@ Templates for the seven project knowledge documents in \`docs/architecture/\`. U
6087
4839
  - \`audit()\` output — health issues
6088
4840
  - \`dead_symbols({})\` output — dead code
6089
4841
  - \`git_context({})\` output — high-churn files
6090
- \`\`\`` },
6091
- { file: "references/project-knowledge-workflow.md", content: `# Project Knowledge — Workflow
4842
+ \`\`\``},{file:`references/project-knowledge-workflow.md`,content:`# Project Knowledge — Workflow
6092
4843
 
6093
4844
  Detailed workflow for acquiring and documenting project knowledge into \`docs/architecture/\`.
6094
4845
 
@@ -6167,8 +4918,7 @@ If the user specifies a focus area (e.g., "architecture only" or "testing and co
6167
4918
  1. Always run Phase 1 in full
6168
4919
  2. Fully complete focus-area documents first
6169
4920
  3. For non-focus documents, keep required sections present and mark unknowns as \`[TODO]\`
6170
- 4. Still run the Phase 4 validation loop on all seven documents` },
6171
- { file: "SKILL.md", content: `---
4921
+ 4. Still run the Phase 4 validation loop on all seven documents`},{file:`SKILL.md`,content:`---
6172
4922
  name: docs
6173
4923
  description: "Living documentation management — Diátaxis framework, docs/ convention, create/update rules, staleness detection, integration with adr-skill and c4-architecture."
6174
4924
  metadata:
@@ -6720,10 +5470,7 @@ All links in generated docs must be correct relative to the file that contains t
6720
5470
 
6721
5471
  ---
6722
5472
 
6723
- *Diátaxis content in this skill and its reference files is adapted from the [Diátaxis framework](https://diataxis.fr/) by Daniele Procida, used under [CC-BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).*` },
6724
- ],
6725
- "frontend-design": [
6726
- { file: "SKILL.md", content: `---
5473
+ *Diátaxis content in this skill and its reference files is adapted from the [Diátaxis framework](https://diataxis.fr/) by Daniele Procida, used under [CC-BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).*`}],"frontend-design":[{file:`SKILL.md`,content:`---
6727
5474
  name: frontend-design
6728
5475
  description: "Comprehensive frontend design system — visual design thinking, typography, color, layout, motion, accessibility, performance, and anti-pattern detection."
6729
5476
  metadata:
@@ -6960,10 +5707,7 @@ If 3+ items match → **STOP and redesign**. The goal is distinctive, not generi
6960
5707
  3. **Progressive enhancement** — works without JS, enhanced with JS
6961
5708
  4. **Content-first** — design with real content, not lorem ipsum
6962
5709
  5. **Test in context** — view components inside the actual page, not just in isolation
6963
- ` },
6964
- ],
6965
- "lesson-learned": [
6966
- { file: "references/anti-patterns.md", content: `---
5710
+ `}],"lesson-learned":[{file:`references/anti-patterns.md`,content:`---
6967
5711
  description: Common anti-patterns to detect in code diffs. Use alongside se-principles.md for balanced analysis -- principles show what's good, anti-patterns show what to watch for.
6968
5712
  ---
6969
5713
 
@@ -7018,8 +5762,7 @@ Functions that do too much.
7018
5762
  Comments explaining "what" instead of "why."
7019
5763
  **Diff signals:** Comments restating the code (\`// increment counter\`). Large comment blocks before straightforward code. Commented-out code left in place.
7020
5764
  **Suggest:** Make the code self-documenting through better naming. Use comments only for "why" -- intent, trade-offs, non-obvious constraints.
7021
- ` },
7022
- { file: "references/se-principles.md", content: `---
5765
+ `},{file:`references/se-principles.md`,content:`---
7023
5766
  description: Curated catalog of software engineering principles. Load this before analyzing code changes so you can map observations to named principles.
7024
5767
  ---
7025
5768
 
@@ -7128,8 +5871,7 @@ Code signals: A switch/if-else chain replaced with a strategy pattern or subclas
7128
5871
 
7129
5872
  **Introduce Parameter Object**
7130
5873
  Code signals: Multiple related parameters grouped into a single options/config object. Function signatures simplified.
7131
- ` },
7132
- { file: "SKILL.md", content: `---
5874
+ `},{file:`SKILL.md`,content:`---
7133
5875
  name: lesson-learned
7134
5876
  description: "Analyze recent code changes via git history and extract software engineering lessons. Use when the user asks 'what is the lesson here?', 'what can I learn from this?', 'engineering takeaway', 'what did I just learn?', 'reflect on this code', or wants to extract principles from recent work."
7135
5877
  metadata:
@@ -7242,446 +5984,439 @@ If there is a second lesson worth noting (maximum 2 additional):
7242
5984
  - **If the code is good, say so.** Not every lesson is about what went wrong. Recognizing good patterns reinforces them.
7243
5985
  - **If the changes are trivial** (a single config tweak, a typo fix), say so honestly rather than forcing a lesson. "These changes are straightforward -- no deep lesson here, just good housekeeping."
7244
5986
  - **Be specific.** Generic advice is worthless. Every claim must point to a concrete code change.
7245
- ` },
7246
- ],
7247
- "multi-agents-development": [
7248
- { file: "architecture-review-prompt.md", content: `# Architecture Review Prompt Template
7249
-
7250
- 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.
7251
-
7252
- ---
7253
-
7254
- ## Prompt Template
7255
-
7256
- \`\`\`markdown
7257
- You are performing an architecture review. Focus on structural decisions, not code quality (that's handled separately).
7258
-
7259
- ## Change Summary
7260
- [What was changed and why — high-level description]
7261
-
7262
- ## Files Changed
7263
- [List of files with module/boundary information]
7264
-
7265
- ## Architectural Context
7266
- [Paste relevant architecture docs, module graph, dependency structure from compact/digest]
7267
-
7268
- ---
7269
-
7270
- ## Review Dimensions
7271
-
7272
- ### 1. Boundary Integrity
7273
- - Do changes respect existing module boundaries?
7274
- - Are there new cross-module dependencies that shouldn't exist?
7275
- - Is the dependency direction correct (inner → outer, not reverse)?
7276
-
7277
- ### 2. Pattern Adherence
7278
- - Do new components follow established architectural patterns?
7279
- - Are there deviations from the documented architecture?
7280
- - If a new pattern is introduced, is it justified and documented?
7281
-
7282
- ### 3. Coupling & Cohesion
7283
- - Are new dependencies minimal and well-justified?
7284
- - Could any coupling be reduced with interfaces or inversion?
7285
- - Are related concerns grouped together?
7286
-
7287
- ### 4. Scalability Impact
7288
- - Will this change create bottlenecks under load?
7289
- - Are there single points of failure introduced?
7290
- - Does this work with horizontal scaling?
7291
-
7292
- ### 5. Migration & Evolution
7293
- - Does this change make future changes harder?
7294
- - Are there implicit assumptions that will break?
7295
- - Is the change reversible if needed?
7296
-
7297
- ### 6. API Surface
7298
- - Are new public APIs minimal and well-designed?
7299
- - Could any public surface be internal instead?
7300
- - Are breaking changes flagged?
7301
-
7302
- ---
7303
-
7304
- ## Output Format
7305
-
7306
- ### Verdict: [APPROVE | APPROVE_WITH_NOTES | REQUEST_CHANGES]
7307
-
7308
- **APPROVE** — Architecture is sound.
7309
- **APPROVE_WITH_NOTES** — Acceptable, but track these concerns.
7310
- **REQUEST_CHANGES** Structural issues that must be resolved.
7311
-
7312
- ### Findings:
7313
- | # | Dimension | Severity | Description | Impact |
7314
- |---|-----------|----------|-------------|--------|
7315
- | 1 | [Dimension] | [Blocker/Concern/Note] | [Issue] | [What breaks/degrades] |
7316
-
7317
- ### Recommendation:
7318
- [Structural guidance for improvement]
7319
- \`\`\`
7320
-
7321
- ---
7322
-
7323
- ## Usage Notes
7324
-
7325
- - **Only trigger architecture review when**: changes cross module boundaries, new patterns are introduced, shared infrastructure is modified, or public API surface changes
7326
- - Both Alpha and Beta reviewers run in parallel for multi-model perspective
7327
- - Architecture blockers are HIGH priority — must resolve before merge
7328
- - If both reviewers flag the same concern, it's almost certainly a real issue
7329
- ` },
7330
- { file: "code-quality-review-prompt.md", content: `# Code Quality Review Prompt Template
7331
-
7332
- 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.
7333
-
7334
- This review runs AFTER spec compliance passes.
7335
-
7336
- ---
7337
-
7338
- ## Prompt Template
7339
-
7340
- \`\`\`markdown
7341
- You are performing a code quality review. The code has already passed spec compliance — it does what was asked. Your job is to evaluate HOW it does it.
7342
-
7343
- ## Task Context
7344
- [Brief description of what was implemented and why]
7345
-
7346
- ## Files Changed
7347
- [List of files with a one-line description of changes in each]
7348
-
7349
- ## Code Diff
7350
- [Paste the actual code changes — full diff or new file contents]
7351
-
7352
- ---
7353
-
7354
- ## Review Dimensions
7355
-
7356
- ### 1. Readability & Maintainability
7357
- - Are names clear and intention-revealing?
7358
- - Is the code self-documenting or does it need comments?
7359
- - Is complexity managed (small functions, single responsibility)?
7360
- - Would a new team member understand this in 5 minutes?
7361
-
7362
- ### 2. Pattern Adherence
7363
- - Does the code follow the project's established patterns?
7364
- - Are there inconsistencies with surrounding code?
7365
- - Are there framework idioms being violated?
7366
-
7367
- ### 3. Error Handling & Edge Cases
7368
- - Are errors handled at appropriate boundaries?
7369
- - Are edge cases considered (null, empty, overflow, concurrent access)?
7370
- - Are error messages helpful for debugging?
7371
-
7372
- ### 4. Performance
7373
- - Any obvious N+1 queries or unnecessary iterations?
7374
- - Any blocking operations that should be async?
7375
- - Any missing caching opportunities or unnecessary allocations?
7376
-
7377
- ### 5. Security
7378
- - Input validation present for external data?
7379
- - No secrets in code?
7380
- - No injection vulnerabilities (SQL, XSS, command)?
7381
- - Proper authorization checks?
7382
-
7383
- ### 6. Spec Alignment (Cross-Check)
7384
- - Does the implementation match what was requested?
7385
- - Any over-engineering beyond requirements?
7386
- - Any subtle deviations from the intended behavior?
7387
-
7388
- ### 7. Testability
7389
- - Is the code testable in isolation?
7390
- - Are dependencies injectable?
7391
- - Are there missing test cases?
7392
-
7393
- ---
7394
-
7395
- ## Output Format
7396
-
7397
- ### Verdict: [APPROVE | APPROVE_WITH_SUGGESTIONS | REQUEST_CHANGES]
7398
-
7399
- **APPROVE** — Code is production-ready.
7400
- **APPROVE_WITH_SUGGESTIONS** Good to merge, but consider these improvements.
7401
- **REQUEST_CHANGES** — Must fix before proceeding. List blocking issues.
7402
-
7403
- ### Findings:
7404
- | # | Dimension | Severity | Description | Location | Suggestion |
7405
- |---|-----------|----------|-------------|----------|------------|
7406
- | 1 | [Dimension] | [Blocker/Major/Minor/Nit] | [Issue] | [file:line] | [Fix] |
7407
-
7408
- ### Summary:
7409
- [2-3 sentence overall assessment]
7410
- \`\`\`
7411
-
7412
- ---
7413
-
7414
- ## Usage Notes
7415
-
7416
- - Both Alpha and Beta reviewers get this same template — multi-model cross-validation
7417
- - Combine findings from both reviewers before deciding on action
7418
- - **Blocker** findings = REQUEST_CHANGES (must fix)
7419
- - **Major** findings = usually REQUEST_CHANGES unless truly optional
7420
- - **Minor/Nit** = APPROVE_WITH_SUGGESTIONS (fix in follow-up or ignore)
7421
- ` },
7422
- { file: "implementer-prompt.md", content: `# Implementer Dispatch Prompt Template
7423
-
7424
- Use this template when dispatching **Implementer**, **Frontend**, or **Refactor** agents.
7425
-
7426
- Fill in the bracketed sections with task-specific content. The Orchestrator provides ALL context — the subagent should NOT need to search/explore.
7427
-
7428
- ---
7429
-
7430
- ## Prompt Template
7431
-
7432
- \`\`\`markdown
7433
- You are implementing a focused task. All context you need is provided below. Do NOT search for additional files or read the full plan work only within the scope defined here.
7434
-
7435
- ## 1. Scope
7436
- **Files to create/modify:**
7437
- - [exact/path/to/file1.ts] — [create | modify]
7438
- - [exact/path/to/file2.ts] — [create | modify]
7439
-
7440
- **Boundary do NOT touch:**
7441
- - [files/that/are/off/limits.ts]
7442
- - [other/agents/territory/]
7443
-
7444
- ## 2. Goal
7445
- [Clear description of what the code should do]
7446
-
7447
- **Acceptance criteria:**
7448
- - [ ] [Specific, testable criterion 1]
7449
- - [ ] [Specific, testable criterion 2]
7450
- - [ ] [Specific, testable criterion 3]
7451
-
7452
- ## 3. Architectural Context
7453
- [Relevant code snippets, patterns, conventions from compact/digest — paste actual code, don't reference files]
7454
-
7455
- Example existing pattern:
7456
- \\\`\\\`\\\`typescript
7457
- // From services/auth.service.ts — follow this pattern
7458
- export class AuthService {
7459
- constructor(private readonly repo: AuthRepository) {}
7460
- async validate(token: string): Promise<User> { ... }
7461
- }
7462
- \\\`\\\`\\\`
7463
-
7464
- ## 4. Constraints
7465
- - Follow [specific pattern/convention]
7466
- - Use [specific library/approach]
7467
- - Do NOT [specific anti-pattern to avoid]
7468
- - [Any other boundaries]
7469
-
7470
- ## 5. FORGE Context
7471
- **Tier:** [Floor | Standard | Critical]
7472
- **Evidence requirements:** [What evidence to collect test results, type coverage, etc.]
7473
-
7474
- ## 6. Self-Review Checklist
7475
- Before declaring your status, verify ALL:
7476
- - [ ] All acceptance criteria from §2 are met
7477
- - [ ] No files outside §1 scope were modified
7478
- - [ ] Code follows conventions from §3 and constraints from §4
7479
- - [ ] Tests pass (run them if possible)
7480
- - [ ] No TODO/FIXME/HACK left without justification
7481
- - [ ] No hardcoded values that should be configurable
7482
-
7483
- ---
7484
-
7485
- **STATUS PROTOCOL — End your response with EXACTLY ONE:**
7486
-
7487
- ### DONE
7488
- All tasks complete. Self-review checklist passed. Ready for review.
7489
-
7490
- ### DONE_WITH_CONCERNS
7491
- All tasks complete, but I have concerns:
7492
- - [Concern 1: description + suggested resolution]
7493
- - [Concern 2: description + suggested resolution]
7494
-
7495
- ### NEEDS_CONTEXT
7496
- Cannot proceed without the following:
7497
- - [Specific question or missing information]
7498
-
7499
- ### BLOCKED
7500
- Hit a wall and cannot proceed:
7501
- - [Description of blocker]
7502
- - [What I tried]
7503
- - [Suggestion for resolution]
7504
- \`\`\`
7505
-
7506
- ---
7507
-
7508
- ## Usage Notes
7509
-
7510
- - **Always paste actual code snippets** in §3 — use \`compact()\` or \`digest()\` to extract relevant context before crafting the prompt
7511
- - **Keep scope tight** — 1-3 files maximum per dispatch
7512
- - **Include failing test output** if dispatching a bug fix
7513
- - **For Frontend agent**: add design requirements, responsive breakpoints, component hierarchy
7514
- - **For Refactor agent**: include before/after expectations, what specifically to clean up
7515
- ` },
7516
- { file: "parallel-dispatch-example.md", content: `# Parallel Dispatch Worked Example
7517
-
7518
- This example shows how the Orchestrator decomposes a feature into parallel tasks, crafts context for each subagent, and manages the batch through review.
7519
-
7520
- ---
7521
-
7522
- ## Scenario: Add User Notification Preferences
7523
-
7524
- **User request:** "Add a notification preferences page where users can toggle email, push, and in-app notifications per category (marketing, security, product updates)."
7525
-
7526
- ---
7527
-
7528
- ## Step 1: Scope Map & Decomposition
7529
-
7530
- Orchestrator runs \`scope_map({ task: "notification preferences" })\` and identifies:
7531
-
7532
- | Area | Files | Agent |
7533
- |------|-------|-------|
7534
- | Backend API | \`services/notification-prefs.service.ts\`, \`routes/notification-prefs.route.ts\` | Implementer |
7535
- | Database | \`migrations/add-notification-prefs.ts\`, \`models/notification-prefs.model.ts\` | Implementer |
7536
- | Frontend Page | \`pages/settings/notifications.tsx\`, \`components/NotificationToggle.tsx\` | Frontend |
7537
- | Tests | \`__tests__/notification-prefs.test.ts\` | Implementer |
7538
-
7539
- ## Step 2: Independence Check (5-Question Checklist)
7540
-
7541
- | # | Question | Backend API + DB | Frontend Page |
7542
- |---|----------|-----------------|---------------|
7543
- | 1 | Same files? | \`services/\`, \`routes/\`, \`migrations/\`, \`models/\` | \`pages/\`, \`components/\` |
7544
- | 2 | Shared state? | No — backend defines API contract | No — consumes API contract |
7545
- | 3 | Execution order? | No — can define API while UI is built | No — can mock API response |
7546
- | 4 | Shared new types? | Exports \`NotificationPrefs\` type | Imports same type |
7547
- | 5 | Parallel-safe? | Yes — different directories | ✅ Yes — different directories |
7548
-
7549
- **Decision: PARALLEL** — But first define the shared type contract.
7550
-
7551
- ## Step 3: Shared Context Prep
7552
-
7553
- Before dispatching, Orchestrator creates the shared contract:
7554
-
7555
- \`\`\`typescript
7556
- // Type contract paste into BOTH agent prompts
7557
- interface NotificationPrefs {
7558
- userId: string;
7559
- categories: {
7560
- marketing: { email: boolean; push: boolean; inApp: boolean };
7561
- security: { email: boolean; push: boolean; inApp: boolean };
7562
- product: { email: boolean; push: boolean; inApp: boolean };
7563
- };
7564
- updatedAt: Date;
7565
- }
7566
-
7567
- // API contract
7568
- // GET /api/notifications/preferencesNotificationPrefs
7569
- // PUT /api/notifications/preferences → NotificationPrefs (body: Partial<NotificationPrefs['categories']>)
7570
- \`\`\`
7571
-
7572
- ## Step 4: Parallel Dispatch
7573
-
7574
- ### Dispatch A → Implementer (Backend + DB + Tests)
7575
-
7576
- \`\`\`markdown
7577
- You are implementing a focused task. All context below.
7578
-
7579
- ## 1. Scope
7580
- - services/notification-prefs.service.ts — create
7581
- - routes/notification-prefs.route.ts create
7582
- - migrations/add-notification-prefs.ts create
7583
- - models/notification-prefs.model.ts create
7584
- - __tests__/notification-prefs.test.ts create
7585
-
7586
- ## 2. Goal
7587
- Create backend API for notification preferences CRUD.
7588
- - GET endpoint returns current prefs (default all-true for new users)
7589
- - PUT endpoint updates partial categories
7590
- - Migration creates notification_preferences table
7591
-
7592
- ## 3. Architectural Context
7593
- [Paste existing service pattern from compact()]
7594
- [Paste existing route pattern from compact()]
7595
- [Paste existing migration pattern from compact()]
7596
- [Paste the shared type contract above]
7597
-
7598
- ## 4. Constraints
7599
- - Follow existing repository pattern (see §3)
7600
- - Use Zod for request validation
7601
- - Include unit tests for service layer
7602
-
7603
- ## 5. FORGE Context
7604
- Tier: Standard. Evidence: test pass, type coverage.
7605
-
7606
- ## 6. Self-Review Checklist
7607
- [standard checklist]
7608
-
7609
- STATUS PROTOCOL: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
7610
- \`\`\`
7611
-
7612
- ### Dispatch B → Frontend (UI Page + Components)
7613
-
7614
- \`\`\`markdown
7615
- You are implementing a focused task. All context below.
7616
-
7617
- ## 1. Scope
7618
- - pages/settings/notifications.tsx create
7619
- - components/NotificationToggle.tsx create
7620
-
7621
- ## 2. Goal
7622
- Create notification preferences settings page.
7623
- - Grid layout: rows = categories, columns = channels
7624
- - Toggle switches for each cell
7625
- - Auto-save on toggle (optimistic update with rollback)
7626
- - Loading skeleton on initial fetch
7627
-
7628
- ## 3. Architectural Context
7629
- [Paste existing settings page pattern from compact()]
7630
- [Paste existing toggle component from compact()]
7631
- [Paste the shared type contract + API contract above]
7632
-
7633
- ## 4. Constraints
7634
- - Use existing Toggle component from design system
7635
- - Follow settings page layout pattern
7636
- - Mobile responsive (stack columns on small screens)
7637
- - Mock API response for now: GET returns all-true defaults
7638
-
7639
- ## 5. FORGE Context
7640
- Tier: Floor. Evidence: renders without error.
7641
-
7642
- ## 6. Self-Review Checklist
7643
- [standard checklist]
7644
-
7645
- STATUS PROTOCOL: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
7646
- \`\`\`
7647
-
7648
- ## Step 5: Review Pipeline
7649
-
7650
- Both agents return DONE. Orchestrator runs review:
7651
-
7652
- 1. **Spec Review** (Code-Reviewer-Alpha as spec reviewer):
7653
- - Backend: PASS — all acceptance criteria met
7654
- - Frontend: PASS_WITH_NOTES missing keyboard accessibility on toggles
7655
-
7656
- 2. **Code Quality Review** (Alpha + Beta in parallel):
7657
- - Alpha: APPROVE_WITH_SUGGESTIONS — extract validation schema to shared file
7658
- - Beta: APPROVE — clean implementation
7659
-
7660
- 3. **Architecture Review** (not triggered — no boundary changes)
7661
-
7662
- 4. **FORGE Gate**: \`evidence_map({ action: "gate" })\` → YIELD (all evidence collected)
7663
-
7664
- ## Step 6: Commit
7665
-
7666
- \`\`\`
7667
- feat: add notification preferences page
7668
-
7669
- - Backend: CRUD API for notification preferences per category
7670
- - Frontend: Settings page with toggle grid, auto-save
7671
- - Migration: notification_preferences table
7672
- \`\`\`
7673
-
7674
- ---
7675
-
7676
- ## Key Takeaways
7677
-
7678
- 1. **Define shared contracts FIRST** — paste into all agent prompts
7679
- 2. **Independence check takes 30 seconds** — prevents hours of merge conflicts
7680
- 3. **Each agent gets ONLY its files** — focused context = better output
7681
- 4. **Review is sequential** — spec first, then quality, then architecture (conditional)
7682
- 5. **FORGE gates at the end** — not between every step
7683
- ` },
7684
- { file: "SKILL.md", content: `---
5987
+ `}],"multi-agents-development":[{file:`architecture-review-prompt.md`,content:`# Architecture Review Prompt Template
5988
+
5989
+ 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.
5990
+
5991
+ ---
5992
+
5993
+ ## Prompt Template
5994
+
5995
+ \`\`\`markdown
5996
+ You are performing an architecture review. Focus on structural decisions, not code quality (that's handled separately).
5997
+
5998
+ ## Change Summary
5999
+ [What was changed and why high-level description]
6000
+
6001
+ ## Files Changed
6002
+ [List of files with module/boundary information]
6003
+
6004
+ ## Architectural Context
6005
+ [Paste relevant architecture docs, module graph, dependency structure from compact/digest]
6006
+
6007
+ ---
6008
+
6009
+ ## Review Dimensions
6010
+
6011
+ ### 1. Boundary Integrity
6012
+ - Do changes respect existing module boundaries?
6013
+ - Are there new cross-module dependencies that shouldn't exist?
6014
+ - Is the dependency direction correct (inner → outer, not reverse)?
6015
+
6016
+ ### 2. Pattern Adherence
6017
+ - Do new components follow established architectural patterns?
6018
+ - Are there deviations from the documented architecture?
6019
+ - If a new pattern is introduced, is it justified and documented?
6020
+
6021
+ ### 3. Coupling & Cohesion
6022
+ - Are new dependencies minimal and well-justified?
6023
+ - Could any coupling be reduced with interfaces or inversion?
6024
+ - Are related concerns grouped together?
6025
+
6026
+ ### 4. Scalability Impact
6027
+ - Will this change create bottlenecks under load?
6028
+ - Are there single points of failure introduced?
6029
+ - Does this work with horizontal scaling?
6030
+
6031
+ ### 5. Migration & Evolution
6032
+ - Does this change make future changes harder?
6033
+ - Are there implicit assumptions that will break?
6034
+ - Is the change reversible if needed?
6035
+
6036
+ ### 6. API Surface
6037
+ - Are new public APIs minimal and well-designed?
6038
+ - Could any public surface be internal instead?
6039
+ - Are breaking changes flagged?
6040
+
6041
+ ---
6042
+
6043
+ ## Output Format
6044
+
6045
+ ### Verdict: [APPROVE | APPROVE_WITH_NOTES | REQUEST_CHANGES]
6046
+
6047
+ **APPROVE** — Architecture is sound.
6048
+ **APPROVE_WITH_NOTES** Acceptable, but track these concerns.
6049
+ **REQUEST_CHANGES** — Structural issues that must be resolved.
6050
+
6051
+ ### Findings:
6052
+ | # | Dimension | Severity | Description | Impact |
6053
+ |---|-----------|----------|-------------|--------|
6054
+ | 1 | [Dimension] | [Blocker/Concern/Note] | [Issue] | [What breaks/degrades] |
6055
+
6056
+ ### Recommendation:
6057
+ [Structural guidance for improvement]
6058
+ \`\`\`
6059
+
6060
+ ---
6061
+
6062
+ ## Usage Notes
6063
+
6064
+ - **Only trigger architecture review when**: changes cross module boundaries, new patterns are introduced, shared infrastructure is modified, or public API surface changes
6065
+ - Both Alpha and Beta reviewers run in parallel for multi-model perspective
6066
+ - Architecture blockers are HIGH priority — must resolve before merge
6067
+ - If both reviewers flag the same concern, it's almost certainly a real issue
6068
+ `},{file:`code-quality-review-prompt.md`,content:`# Code Quality Review Prompt Template
6069
+
6070
+ 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.
6071
+
6072
+ This review runs AFTER spec compliance passes.
6073
+
6074
+ ---
6075
+
6076
+ ## Prompt Template
6077
+
6078
+ \`\`\`markdown
6079
+ You are performing a code quality review. The code has already passed spec compliance — it does what was asked. Your job is to evaluate HOW it does it.
6080
+
6081
+ ## Task Context
6082
+ [Brief description of what was implemented and why]
6083
+
6084
+ ## Files Changed
6085
+ [List of files with a one-line description of changes in each]
6086
+
6087
+ ## Code Diff
6088
+ [Paste the actual code changes — full diff or new file contents]
6089
+
6090
+ ---
6091
+
6092
+ ## Review Dimensions
6093
+
6094
+ ### 1. Readability & Maintainability
6095
+ - Are names clear and intention-revealing?
6096
+ - Is the code self-documenting or does it need comments?
6097
+ - Is complexity managed (small functions, single responsibility)?
6098
+ - Would a new team member understand this in 5 minutes?
6099
+
6100
+ ### 2. Pattern Adherence
6101
+ - Does the code follow the project's established patterns?
6102
+ - Are there inconsistencies with surrounding code?
6103
+ - Are there framework idioms being violated?
6104
+
6105
+ ### 3. Error Handling & Edge Cases
6106
+ - Are errors handled at appropriate boundaries?
6107
+ - Are edge cases considered (null, empty, overflow, concurrent access)?
6108
+ - Are error messages helpful for debugging?
6109
+
6110
+ ### 4. Performance
6111
+ - Any obvious N+1 queries or unnecessary iterations?
6112
+ - Any blocking operations that should be async?
6113
+ - Any missing caching opportunities or unnecessary allocations?
6114
+
6115
+ ### 5. Security
6116
+ - Input validation present for external data?
6117
+ - No secrets in code?
6118
+ - No injection vulnerabilities (SQL, XSS, command)?
6119
+ - Proper authorization checks?
6120
+
6121
+ ### 6. Spec Alignment (Cross-Check)
6122
+ - Does the implementation match what was requested?
6123
+ - Any over-engineering beyond requirements?
6124
+ - Any subtle deviations from the intended behavior?
6125
+
6126
+ ### 7. Testability
6127
+ - Is the code testable in isolation?
6128
+ - Are dependencies injectable?
6129
+ - Are there missing test cases?
6130
+
6131
+ ---
6132
+
6133
+ ## Output Format
6134
+
6135
+ ### Verdict: [APPROVE | APPROVE_WITH_SUGGESTIONS | REQUEST_CHANGES]
6136
+
6137
+ **APPROVE** Code is production-ready.
6138
+ **APPROVE_WITH_SUGGESTIONS** — Good to merge, but consider these improvements.
6139
+ **REQUEST_CHANGES** Must fix before proceeding. List blocking issues.
6140
+
6141
+ ### Findings:
6142
+ | # | Dimension | Severity | Description | Location | Suggestion |
6143
+ |---|-----------|----------|-------------|----------|------------|
6144
+ | 1 | [Dimension] | [Blocker/Major/Minor/Nit] | [Issue] | [file:line] | [Fix] |
6145
+
6146
+ ### Summary:
6147
+ [2-3 sentence overall assessment]
6148
+ \`\`\`
6149
+
6150
+ ---
6151
+
6152
+ ## Usage Notes
6153
+
6154
+ - Both Alpha and Beta reviewers get this same template — multi-model cross-validation
6155
+ - Combine findings from both reviewers before deciding on action
6156
+ - **Blocker** findings = REQUEST_CHANGES (must fix)
6157
+ - **Major** findings = usually REQUEST_CHANGES unless truly optional
6158
+ - **Minor/Nit** = APPROVE_WITH_SUGGESTIONS (fix in follow-up or ignore)
6159
+ `},{file:`implementer-prompt.md`,content:`# Implementer Dispatch Prompt Template
6160
+
6161
+ Use this template when dispatching **Implementer**, **Frontend**, or **Refactor** agents.
6162
+
6163
+ Fill in the bracketed sections with task-specific content. The Orchestrator provides ALL context — the subagent should NOT need to search/explore.
6164
+
6165
+ ---
6166
+
6167
+ ## Prompt Template
6168
+
6169
+ \`\`\`markdown
6170
+ You are implementing a focused task. All context you need is provided below. Do NOT search for additional files or read the full plan — work only within the scope defined here.
6171
+
6172
+ ## 1. Scope
6173
+ **Files to create/modify:**
6174
+ - [exact/path/to/file1.ts] — [create | modify]
6175
+ - [exact/path/to/file2.ts][create | modify]
6176
+
6177
+ **Boundary do NOT touch:**
6178
+ - [files/that/are/off/limits.ts]
6179
+ - [other/agents/territory/]
6180
+
6181
+ ## 2. Goal
6182
+ [Clear description of what the code should do]
6183
+
6184
+ **Acceptance criteria:**
6185
+ - [ ] [Specific, testable criterion 1]
6186
+ - [ ] [Specific, testable criterion 2]
6187
+ - [ ] [Specific, testable criterion 3]
6188
+
6189
+ ## 3. Architectural Context
6190
+ [Relevant code snippets, patterns, conventions from compact/digest — paste actual code, don't reference files]
6191
+
6192
+ Example existing pattern:
6193
+ \\\`\\\`\\\`typescript
6194
+ // From services/auth.service.ts follow this pattern
6195
+ export class AuthService {
6196
+ constructor(private readonly repo: AuthRepository) {}
6197
+ async validate(token: string): Promise<User> { ... }
6198
+ }
6199
+ \\\`\\\`\\\`
6200
+
6201
+ ## 4. Constraints
6202
+ - Follow [specific pattern/convention]
6203
+ - Use [specific library/approach]
6204
+ - Do NOT [specific anti-pattern to avoid]
6205
+ - [Any other boundaries]
6206
+
6207
+ ## 5. FORGE Context
6208
+ **Tier:** [Floor | Standard | Critical]
6209
+ **Evidence requirements:** [What evidence to collect — test results, type coverage, etc.]
6210
+
6211
+ ## 6. Self-Review Checklist
6212
+ Before declaring your status, verify ALL:
6213
+ - [ ] All acceptance criteria from §2 are met
6214
+ - [ ] No files outside §1 scope were modified
6215
+ - [ ] Code follows conventions from §3 and constraints from §4
6216
+ - [ ] Tests pass (run them if possible)
6217
+ - [ ] No TODO/FIXME/HACK left without justification
6218
+ - [ ] No hardcoded values that should be configurable
6219
+
6220
+ ---
6221
+
6222
+ **STATUS PROTOCOL End your response with EXACTLY ONE:**
6223
+
6224
+ ### DONE
6225
+ All tasks complete. Self-review checklist passed. Ready for review.
6226
+
6227
+ ### DONE_WITH_CONCERNS
6228
+ All tasks complete, but I have concerns:
6229
+ - [Concern 1: description + suggested resolution]
6230
+ - [Concern 2: description + suggested resolution]
6231
+
6232
+ ### NEEDS_CONTEXT
6233
+ Cannot proceed without the following:
6234
+ - [Specific question or missing information]
6235
+
6236
+ ### BLOCKED
6237
+ Hit a wall and cannot proceed:
6238
+ - [Description of blocker]
6239
+ - [What I tried]
6240
+ - [Suggestion for resolution]
6241
+ \`\`\`
6242
+
6243
+ ---
6244
+
6245
+ ## Usage Notes
6246
+
6247
+ - **Always paste actual code snippets** in §3 — use \`compact()\` or \`digest()\` to extract relevant context before crafting the prompt
6248
+ - **Keep scope tight** — 1-3 files maximum per dispatch
6249
+ - **Include failing test output** if dispatching a bug fix
6250
+ - **For Frontend agent**: add design requirements, responsive breakpoints, component hierarchy
6251
+ - **For Refactor agent**: include before/after expectations, what specifically to clean up
6252
+ `},{file:`parallel-dispatch-example.md`,content:`# Parallel Dispatch Worked Example
6253
+
6254
+ This example shows how the Orchestrator decomposes a feature into parallel tasks, crafts context for each subagent, and manages the batch through review.
6255
+
6256
+ ---
6257
+
6258
+ ## Scenario: Add User Notification Preferences
6259
+
6260
+ **User request:** "Add a notification preferences page where users can toggle email, push, and in-app notifications per category (marketing, security, product updates)."
6261
+
6262
+ ---
6263
+
6264
+ ## Step 1: Scope Map & Decomposition
6265
+
6266
+ Orchestrator runs \`scope_map({ task: "notification preferences" })\` and identifies:
6267
+
6268
+ | Area | Files | Agent |
6269
+ |------|-------|-------|
6270
+ | Backend API | \`services/notification-prefs.service.ts\`, \`routes/notification-prefs.route.ts\` | Implementer |
6271
+ | Database | \`migrations/add-notification-prefs.ts\`, \`models/notification-prefs.model.ts\` | Implementer |
6272
+ | Frontend Page | \`pages/settings/notifications.tsx\`, \`components/NotificationToggle.tsx\` | Frontend |
6273
+ | Tests | \`__tests__/notification-prefs.test.ts\` | Implementer |
6274
+
6275
+ ## Step 2: Independence Check (5-Question Checklist)
6276
+
6277
+ | # | Question | Backend API + DB | Frontend Page |
6278
+ |---|----------|-----------------|---------------|
6279
+ | 1 | Same files? | \`services/\`, \`routes/\`, \`migrations/\`, \`models/\` | \`pages/\`, \`components/\` |
6280
+ | 2 | Shared state? | No — backend defines API contract | No — consumes API contract |
6281
+ | 3 | Execution order? | No — can define API while UI is built | No — can mock API response |
6282
+ | 4 | Shared new types? | Exports \`NotificationPrefs\` type | Imports same type |
6283
+ | 5 | Parallel-safe? | Yes different directories | Yes — different directories |
6284
+
6285
+ **Decision: PARALLEL** But first define the shared type contract.
6286
+
6287
+ ## Step 3: Shared Context Prep
6288
+
6289
+ Before dispatching, Orchestrator creates the shared contract:
6290
+
6291
+ \`\`\`typescript
6292
+ // Type contract — paste into BOTH agent prompts
6293
+ interface NotificationPrefs {
6294
+ userId: string;
6295
+ categories: {
6296
+ marketing: { email: boolean; push: boolean; inApp: boolean };
6297
+ security: { email: boolean; push: boolean; inApp: boolean };
6298
+ product: { email: boolean; push: boolean; inApp: boolean };
6299
+ };
6300
+ updatedAt: Date;
6301
+ }
6302
+
6303
+ // API contract
6304
+ // GET /api/notifications/preferences NotificationPrefs
6305
+ // PUT /api/notifications/preferences → NotificationPrefs (body: Partial<NotificationPrefs['categories']>)
6306
+ \`\`\`
6307
+
6308
+ ## Step 4: Parallel Dispatch
6309
+
6310
+ ### Dispatch A Implementer (Backend + DB + Tests)
6311
+
6312
+ \`\`\`markdown
6313
+ You are implementing a focused task. All context below.
6314
+
6315
+ ## 1. Scope
6316
+ - services/notification-prefs.service.ts create
6317
+ - routes/notification-prefs.route.ts — create
6318
+ - migrations/add-notification-prefs.ts — create
6319
+ - models/notification-prefs.model.ts create
6320
+ - __tests__/notification-prefs.test.ts — create
6321
+
6322
+ ## 2. Goal
6323
+ Create backend API for notification preferences CRUD.
6324
+ - GET endpoint returns current prefs (default all-true for new users)
6325
+ - PUT endpoint updates partial categories
6326
+ - Migration creates notification_preferences table
6327
+
6328
+ ## 3. Architectural Context
6329
+ [Paste existing service pattern from compact()]
6330
+ [Paste existing route pattern from compact()]
6331
+ [Paste existing migration pattern from compact()]
6332
+ [Paste the shared type contract above]
6333
+
6334
+ ## 4. Constraints
6335
+ - Follow existing repository pattern (see §3)
6336
+ - Use Zod for request validation
6337
+ - Include unit tests for service layer
6338
+
6339
+ ## 5. FORGE Context
6340
+ Tier: Standard. Evidence: test pass, type coverage.
6341
+
6342
+ ## 6. Self-Review Checklist
6343
+ [standard checklist]
6344
+
6345
+ STATUS PROTOCOL: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
6346
+ \`\`\`
6347
+
6348
+ ### Dispatch B → Frontend (UI Page + Components)
6349
+
6350
+ \`\`\`markdown
6351
+ You are implementing a focused task. All context below.
6352
+
6353
+ ## 1. Scope
6354
+ - pages/settings/notifications.tsx create
6355
+ - components/NotificationToggle.tsx — create
6356
+
6357
+ ## 2. Goal
6358
+ Create notification preferences settings page.
6359
+ - Grid layout: rows = categories, columns = channels
6360
+ - Toggle switches for each cell
6361
+ - Auto-save on toggle (optimistic update with rollback)
6362
+ - Loading skeleton on initial fetch
6363
+
6364
+ ## 3. Architectural Context
6365
+ [Paste existing settings page pattern from compact()]
6366
+ [Paste existing toggle component from compact()]
6367
+ [Paste the shared type contract + API contract above]
6368
+
6369
+ ## 4. Constraints
6370
+ - Use existing Toggle component from design system
6371
+ - Follow settings page layout pattern
6372
+ - Mobile responsive (stack columns on small screens)
6373
+ - Mock API response for now: GET returns all-true defaults
6374
+
6375
+ ## 5. FORGE Context
6376
+ Tier: Floor. Evidence: renders without error.
6377
+
6378
+ ## 6. Self-Review Checklist
6379
+ [standard checklist]
6380
+
6381
+ STATUS PROTOCOL: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
6382
+ \`\`\`
6383
+
6384
+ ## Step 5: Review Pipeline
6385
+
6386
+ Both agents return DONE. Orchestrator runs review:
6387
+
6388
+ 1. **Spec Review** (Code-Reviewer-Alpha as spec reviewer):
6389
+ - Backend: PASS — all acceptance criteria met
6390
+ - Frontend: PASS_WITH_NOTES — missing keyboard accessibility on toggles
6391
+
6392
+ 2. **Code Quality Review** (Alpha + Beta in parallel):
6393
+ - Alpha: APPROVE_WITH_SUGGESTIONS — extract validation schema to shared file
6394
+ - Beta: APPROVE clean implementation
6395
+
6396
+ 3. **Architecture Review** (not triggered no boundary changes)
6397
+
6398
+ 4. **FORGE Gate**: \`evidence_map({ action: "gate" })\` → YIELD (all evidence collected)
6399
+
6400
+ ## Step 6: Commit
6401
+
6402
+ \`\`\`
6403
+ feat: add notification preferences page
6404
+
6405
+ - Backend: CRUD API for notification preferences per category
6406
+ - Frontend: Settings page with toggle grid, auto-save
6407
+ - Migration: notification_preferences table
6408
+ \`\`\`
6409
+
6410
+ ---
6411
+
6412
+ ## Key Takeaways
6413
+
6414
+ 1. **Define shared contracts FIRST** — paste into all agent prompts
6415
+ 2. **Independence check takes 30 seconds** — prevents hours of merge conflicts
6416
+ 3. **Each agent gets ONLY its files** — focused context = better output
6417
+ 4. **Review is sequential** — spec first, then quality, then architecture (conditional)
6418
+ 5. **FORGE gates at the end** — not between every step
6419
+ `},{file:`SKILL.md`,content:`---
7685
6420
  name: multi-agents-development
7686
6421
  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."
7687
6422
  metadata:
@@ -8129,92 +6864,88 @@ Detailed prompt templates are provided as sidecar files:
8129
6864
  | Code quality review | [\`code-quality-review-prompt.md\`](code-quality-review-prompt.md) | Dual code quality review (Code-Reviewer-Beta) |
8130
6865
  | Architecture review | [\`architecture-review-prompt.md\`](architecture-review-prompt.md) | Boundary changes, pattern adherence review |
8131
6866
  | Parallel dispatch example | [\`parallel-dispatch-example.md\`](parallel-dispatch-example.md) | Worked example of decomposing a feature into parallel tasks |
8132
- ` },
8133
- { file: "spec-review-prompt.md", content: `# Spec Compliance Review Prompt Template
8134
-
8135
- Use this template when dispatching **Code-Reviewer-Alpha** for adversarial spec compliance review. This review runs BEFORE code quality review.
8136
-
8137
- **Mindset: "Don't trust the report."** The implementer says it's done — verify independently.
8138
-
8139
- ---
8140
-
8141
- ## Prompt Template
8142
-
8143
- \`\`\`markdown
8144
- You are performing an adversarial spec compliance review. Your job is to verify that the implementation matches what was requested — nothing more, nothing less.
8145
-
8146
- **Do NOT trust the implementer's self-assessment.** Verify independently.
8147
-
8148
- ## Task Specification
8149
- [Paste the original task that was dispatched to the implementer — including all acceptance criteria]
8150
-
8151
- ## Implementation Output
8152
- [Paste the implementer's response — code changes, self-review, status]
8153
-
8154
- ## Files Changed
8155
- [List of files modified with brief description of changes]
8156
-
8157
- ---
8158
-
8159
- ## Review Dimensions
8160
-
8161
- ### 1. Acceptance Criteria Match
8162
- For EACH acceptance criterion in the task spec:
8163
- - [ ] **Met** / **Not Met** / **Partially Met**
8164
- - Evidence: [specific code or test that proves it]
8165
-
8166
- ### 2. Over-Build Detection
8167
- - Are there features, functions, or abstractions NOT requested in the spec?
8168
- - Are there unnecessary generalizations?
8169
- - Were files modified outside the stated scope?
8170
- → Flag each over-build with: what was added, why it shouldn't be there
8171
-
8172
- ### 3. Under-Build Detection
8173
- - Are any acceptance criteria unaddressed?
8174
- - Are there edge cases implied by the spec but not handled?
8175
- - Are there missing tests for stated requirements?
8176
- → Flag each under-build with: what's missing, what should exist
8177
-
8178
- ### 4. Scope Compliance
8179
- - List every file modified does it match the scope in the original task?
8180
- - Were any out-of-scope files touched? (this is a red flag)
8181
-
8182
- ### 5. Contract Adherence
8183
- - Do new exports/interfaces match what other components expect?
8184
- - Are function signatures compatible with existing callers?
8185
- - Will this break anything downstream?
8186
-
8187
- ---
8188
-
8189
- ## Output Format
8190
-
8191
- ### Verdict: [PASS | PASS_WITH_NOTES | FAIL]
8192
-
8193
- **PASS** — Implementation matches spec completely.
8194
- **PASS_WITH_NOTES** — Matches spec but has minor concerns that don't block.
8195
- **FAIL** — Implementation does not match spec. List specific gaps.
8196
-
8197
- ### Findings:
8198
- | # | Type | Severity | Description | Location |
8199
- |---|------|----------|-------------|----------|
8200
- | 1 | [Over/Under/Scope/Contract] | [Critical/Major/Minor] | [Description] | [file:line] |
8201
-
8202
- ### Recommendation:
8203
- [What needs to change before this passes spec review]
8204
- \`\`\`
8205
-
8206
- ---
8207
-
8208
- ## Usage Notes
8209
-
8210
- - Run this BEFORE code quality review no point reviewing quality if spec is wrong
8211
- - Paste the ORIGINAL task spec, not a summary the reviewer needs exact acceptance criteria
8212
- - If verdict is FAIL, bounce back to implementer with specific gaps before proceeding
8213
- - PASS_WITH_NOTES can proceed to code quality review, but notes should be tracked
8214
- ` },
8215
- ],
8216
- "present": [
8217
- { file: "SKILL.md", content: `---
6867
+ `},{file:`spec-review-prompt.md`,content:`# Spec Compliance Review Prompt Template
6868
+
6869
+ Use this template when dispatching **Code-Reviewer-Alpha** for adversarial spec compliance review. This review runs BEFORE code quality review.
6870
+
6871
+ **Mindset: "Don't trust the report."** The implementer says it's done — verify independently.
6872
+
6873
+ ---
6874
+
6875
+ ## Prompt Template
6876
+
6877
+ \`\`\`markdown
6878
+ You are performing an adversarial spec compliance review. Your job is to verify that the implementation matches what was requested — nothing more, nothing less.
6879
+
6880
+ **Do NOT trust the implementer's self-assessment.** Verify independently.
6881
+
6882
+ ## Task Specification
6883
+ [Paste the original task that was dispatched to the implementer — including all acceptance criteria]
6884
+
6885
+ ## Implementation Output
6886
+ [Paste the implementer's response — code changes, self-review, status]
6887
+
6888
+ ## Files Changed
6889
+ [List of files modified with brief description of changes]
6890
+
6891
+ ---
6892
+
6893
+ ## Review Dimensions
6894
+
6895
+ ### 1. Acceptance Criteria Match
6896
+ For EACH acceptance criterion in the task spec:
6897
+ - [ ] **Met** / **Not Met** / **Partially Met**
6898
+ - Evidence: [specific code or test that proves it]
6899
+
6900
+ ### 2. Over-Build Detection
6901
+ - Are there features, functions, or abstractions NOT requested in the spec?
6902
+ - Are there unnecessary generalizations?
6903
+ - Were files modified outside the stated scope?
6904
+ → Flag each over-build with: what was added, why it shouldn't be there
6905
+
6906
+ ### 3. Under-Build Detection
6907
+ - Are any acceptance criteria unaddressed?
6908
+ - Are there edge cases implied by the spec but not handled?
6909
+ - Are there missing tests for stated requirements?
6910
+ → Flag each under-build with: what's missing, what should exist
6911
+
6912
+ ### 4. Scope Compliance
6913
+ - List every file modified — does it match the scope in the original task?
6914
+ - Were any out-of-scope files touched? (this is a red flag)
6915
+
6916
+ ### 5. Contract Adherence
6917
+ - Do new exports/interfaces match what other components expect?
6918
+ - Are function signatures compatible with existing callers?
6919
+ - Will this break anything downstream?
6920
+
6921
+ ---
6922
+
6923
+ ## Output Format
6924
+
6925
+ ### Verdict: [PASS | PASS_WITH_NOTES | FAIL]
6926
+
6927
+ **PASS** — Implementation matches spec completely.
6928
+ **PASS_WITH_NOTES** — Matches spec but has minor concerns that don't block.
6929
+ **FAIL** — Implementation does not match spec. List specific gaps.
6930
+
6931
+ ### Findings:
6932
+ | # | Type | Severity | Description | Location |
6933
+ |---|------|----------|-------------|----------|
6934
+ | 1 | [Over/Under/Scope/Contract] | [Critical/Major/Minor] | [Description] | [file:line] |
6935
+
6936
+ ### Recommendation:
6937
+ [What needs to change before this passes spec review]
6938
+ \`\`\`
6939
+
6940
+ ---
6941
+
6942
+ ## Usage Notes
6943
+
6944
+ - Run this BEFORE code quality review — no point reviewing quality if spec is wrong
6945
+ - Paste the ORIGINAL task spec, not a summary the reviewer needs exact acceptance criteria
6946
+ - If verdict is FAIL, bounce back to implementer with specific gaps before proceeding
6947
+ - PASS_WITH_NOTES can proceed to code quality review, but notes should be tracked
6948
+ `}],present:[{file:`SKILL.md`,content:`---
8218
6949
  name: present
8219
6950
  description: "Use the AI Kit \`present\` tool to display rich interactive dashboards, charts, timelines, status boards, and data visualizations in the browser or in-chat. Covers all block types, chart types, actions, composition patterns, and MCP Apps templates (list-sort, data-table, picker, flame-graph, form, timeline, kanban, tree, diff-view, dashboard). Load this skill before calling the present tool to ensure professional output."
8220
6951
  metadata:
@@ -8830,10 +7561,7 @@ Metric types: \`'stat'\` (default), \`'progress'\` (with bar), \`'list'\` (sub-i
8830
7561
  | tree | Display only | — |
8831
7562
  | diff-view | Display only | — |
8832
7563
  | dashboard | Display only | — |
8833
- ` },
8834
- ],
8835
- "react": [
8836
- { file: "SKILL.md", content: `---
7564
+ `}],react:[{file:`SKILL.md`,content:`---
8837
7565
  name: react
8838
7566
  description: "Comprehensive React development patterns — component architecture, React 19 APIs, Server Components, TypeScript integration, and performance optimization."
8839
7567
  metadata:
@@ -9142,448 +7870,7 @@ When implementing a React feature:
9142
7870
  5. **Loading?** → \`<Suspense>\` with skeleton fallback.
9143
7871
  6. **Performance?** → Try React Compiler first. Then manual memo. Then virtualization. Then code splitting.
9144
7872
  7. **Error?** → Error boundaries for rendering errors. try/catch for Server Actions.
9145
- ` },
9146
- ],
9147
- "repo-access": [
9148
- { file: "references/error-patterns.md", content: `# Repo Access Error Patterns
9149
-
9150
- Use this reference to distinguish missing repositories from authentication and policy failures when probing Git hosts.
9151
-
9152
- ## HTTP Status Code Matrix
9153
-
9154
- | Platform | No auth (private repo) | Wrong credentials | Rate limited | SSO required |
9155
- |---|---|---|---|---|
9156
- | GitHub REST API | \`404\` (TRAP!) | \`401\` -> \`403\` | \`403\` + rate limit body | \`403\` + \`X-GitHub-SSO\` header |
9157
- | GitHub Web | HTML "Page not found" or login redirect | Login redirect | - | - |
9158
- | GitLab | \`401\` | \`401\` | \`429\` | \`401\` (PAT mandatory) |
9159
- | Bitbucket | \`403\` | \`403\` | \`429\` | \`403\` |
9160
- | Azure DevOps | \`401\` | \`401\` | - | \`401\` |
9161
-
9162
- ## CRITICAL: The GitHub 404 Trap
9163
-
9164
- GitHub deliberately returns \`404\`, not \`401\`, for private repositories accessed without authentication.
9165
- This is by design to avoid leaking whether a repository exists.
9166
-
9167
- - Never conclude a GitHub repository does not exist from an unauthenticated \`404\`.
9168
- - \`GET https://api.github.com/repos/{owner}/{repo}\` without auth returns \`404\` for both "repo truly missing" and "repo exists but is private".
9169
- - The only reliable disambiguation is an authenticated probe.
9170
- - If the same request still returns \`404\` with valid auth, the repository is truly missing.
9171
-
9172
- Probe order:
9173
-
9174
- 1. Try the authenticated API request first.
9175
- 2. If it returns \`200\`, access works.
9176
- 3. If it returns \`404\` without auth context, treat it as ambiguous and recover.
9177
- 4. If it returns \`404\` with known-good auth, treat the repo as missing.
9178
-
9179
- ## Git CLI Stderr Patterns
9180
-
9181
- | Error Text Pattern | Platform | Diagnosis | Action |
9182
- |---|---|---|---|
9183
- | \`remote: Repository not found.\` | GitHub | Auth failure, not proof the repo is missing | Try auth strategies |
9184
- | \`git@github.com: Permission denied (publickey).\` | GitHub | SSH key not recognized | Check SSH keys, try HTTPS |
9185
- | \`remote: HTTP Basic: Access denied.\` | GitLab | Auth failure, 2FA likely | Use PAT; password auth is blocked with 2FA |
9186
- | \`error: The requested URL returned error: 403\` | Bitbucket | Auth failure | Try app password |
9187
- | \`TF401019: The Git repository with name or identifier X does not exist\` | Azure DevOps | Auth failure or missing repo | Try PAT with Code:Read scope |
9188
- | \`fatal: Authentication failed for 'https://...'\` | Any (HTTPS) | General auth failure | Escalate through the strategy ladder |
9189
- | \`Permission denied (publickey).\` | Any (SSH) | SSH key not recognized | Check \`~/.ssh/\`, run \`ssh-add\`, try HTTPS |
9190
- | \`fatal: Could not read from remote repository.\` | Any (SSH) | SSH access denied | Verify the SSH key is added to the platform |
9191
- | \`unable to access '...': SSL certificate problem\` | Any | Self-signed or enterprise CA issue | Ask about local cert config; skip to local clone if needed |
9192
-
9193
- Treat these stderr strings as direct signals from tool output. Do not reinterpret GitHub's \`Repository not found\` as a clean existence check.
9194
-
9195
- ## web_fetch / http Tool Detection
9196
-
9197
- - \`web_fetch\` against a private GitHub repo URL often returns HTML with "Page not found" or a login page.
9198
- - GitHub web responses can be \`200\` with a 404-looking body, so \`web_fetch\` is unreliable for auth diagnosis.
9199
- - \`http\` against the platform API gives machine-readable bodies and real status codes, so use it for probes.
9200
- - For \`web_fetch\` on \`github.com\`, inspect the body for \`Page not found\`, \`Sign in\`, or \`/login\` links. If present, assume private or auth-gated access and trigger recovery.
9201
-
9202
- Recommended diagnostic probe:
9203
-
9204
- \`\`\`text
9205
- http GET https://api.github.com/repos/{owner}/{repo}
9206
- -> 404 + no auth header -> might be private
9207
- -> 401 -> explicit auth failure
9208
- -> 200 -> repo is public, access works
9209
- \`\`\`
9210
-
9211
- ## Edge Cases
9212
-
9213
- | Edge Case | Signal | Response |
9214
- |---|---|---|
9215
- | GitHub.com SAML SSO | \`403\` + \`X-GitHub-SSO: required; url=...\` | PAT needs SSO authorization for the org |
9216
- | GHE SAML SSO (web_fetch) | \`200\` + body contains \`Initiating SAML single sign-on\`, redirect to \`login.microsoftonline.com\` or other IdP | Repo EXISTS and is auth-gated. NOT inaccessible. Use PAT + \`http\` with auth headers, or \`gh auth login --hostname <host>\` |
9217
- | GHE SAML SSO (http) | \`302\` redirect to \`/login?return_to=...\` or IdP URL | Same — repo exists, needs auth. Walk the Strategy Ladder |
9218
- | GHE SAML SSO (git CLI) | \`fatal: Authentication failed\` or credential prompt | \`gh auth login --hostname <host>\` or PAT via credential helper |
9219
-
9220
- ## SAML SSO — Detailed Pattern
9221
-
9222
- GitHub Enterprise instances commonly use SAML SSO via Azure AD (Entra ID), Okta, or other IdPs. When \`web_fetch\` hits a GHE URL without auth:
9223
-
9224
- 1. GHE returns \`200 OK\` (not 401/403!) with an HTML page
9225
- 2. The HTML contains \`Initiating SAML single sign-on\` and a redirect URL to the IdP
9226
- 3. The redirect URL includes \`SAMLRequest=\`, \`RelayState=\`, and often \`login.microsoftonline.com\`
9227
- 4. The agent sees HTML content and may conclude the repo is "inaccessible" or "behind SSO"
9228
-
9229
- **Detection strings** (check \`web_fetch\` output for ANY of these):
9230
- \`\`\`
9231
- Initiating SAML single sign-on
9232
- login.microsoftonline.com
9233
- You are being redirected to your identity provider
9234
- /login?return_to=
9235
- SAMLRequest=
9236
- RelayState=
9237
- \`\`\`
9238
-
9239
- **Correct response:** The repo exists. The \`web_fetch\` path will never work for SSO-protected GHE. Switch to:
9240
- - \`gh auth login --hostname <ghe-host>\` (if \`gh\` CLI available)
9241
- - PAT + \`http\` with \`Authorization: token <PAT>\` against \`<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}\`
9242
- - Ask user for local clone if no token can be obtained
9243
- | GitLab 2FA enabled | \`401\` on password auth | PAT is mandatory; 2FA blocks password auth |
9244
- | Expired token | \`401\` after providing a valid-looking PAT | Generate a new token and check expiry |
9245
- | GitHub rate limit | \`403\` + body contains \`rate limit\` | Not an auth failure; wait or authenticate for a higher limit |
9246
- | IP allowlisting | \`403\` + body mentions IP or org policies | Cannot be fixed programmatically; skip to local clone (Step 5) |
9247
- | Fine-grained PAT scope | \`403\` + \`insufficient scope\` | Switch to a classic PAT for org repos |
9248
- | SSH key not in agent | \`Permission denied (publickey)\` + key file exists | Run \`ssh-add ~/.ssh/id_ed25519\` |
9249
- | Wrong SSH username | \`Permission denied\` | Use \`git@host\`, not \`username@host\` |
9250
- | Deploy key conflict | \`key is already in use\` | Use a user SSH key or PAT instead |
9251
-
9252
- ## Escalation Decision Rules
9253
-
9254
- - Retry the same step for transient failures such as DNS failure, timeout, or \`5xx\` responses.
9255
- - Escalate to the next strategy step for \`401\`, \`403\`, \`404\`, \`Permission denied\`, \`Authentication failed\`, or \`Access denied\`.
9256
- - Skip directly to Step 5 (local clone) for IP allowlisting, enterprise SSL certificate issues, or org policy blocks.
9257
-
9258
- Default interpretation order:
9259
-
9260
- 1. Prefer API probes over web page fetches.
9261
- 2. Treat GitHub \`404\` as ambiguous until valid auth disproves privacy.
9262
- 3. Treat SSH \`publickey\` errors as key-distribution failures, not repo absence.
9263
- 4. Separate rate limits and org policy blocks from authentication failures before escalating.` },
9264
- { file: "references/platform-matrix.md", content: `# Platform Matrix
9265
-
9266
- Use this reference when a repository URL reveals the hosting platform and the skill needs platform-specific authentication or cloning guidance. Prefer platform CLI login flows or OS-backed credential helpers over raw PAT handling.
9267
-
9268
- ## Platform Detection
9269
-
9270
- | URL Pattern | Platform | CLI Tool (optional) | Auth Command | No-CLI Alternative |
9271
- |---|---|---|---|---|
9272
- | \`github.com\` | GitHub | \`gh\` | \`gh auth login\` | PAT + \`http\` with \`Authorization: token <PAT>\` |
9273
- | Any custom domain (e.g. \`ghe.corp.com\`, \`github.corp.com\`) | GitHub Enterprise | \`gh\` | \`gh auth login --hostname <host>\` | PAT + \`http\` against \`<host>/api/v3\` |
9274
- | \`gitlab.com\` | GitLab | \`glab\` | \`glab auth login\` | PAT + \`http\` with \`PRIVATE-TOKEN\` header |
9275
- | Self-hosted GitLab | GitLab Self-Managed | \`glab\` | \`glab auth login --hostname <host>\` | PAT + \`http\` with \`PRIVATE-TOKEN\` header |
9276
- | \`bitbucket.org\` | Bitbucket Cloud | None | N/A | App password + \`http\` with \`Authorization: Bearer\` |
9277
- | \`dev.azure.com\` or \`*.visualstudio.com\` | Azure DevOps | \`az\` + GCM | \`az login\` | PAT + \`http\` with Basic auth |
9278
- | Gitea instances | Gitea | \`tea\` (optional) | \`tea login add\` | PAT + \`http\` with \`Authorization: token\` |
9279
- | Unknown or custom domain | Ask user which platform | N/A | N/A | Probe \`http\` or ask before assuming generic Git |
9280
-
9281
- > **Note:** Platform CLIs (\`gh\`, \`glab\`, \`az\`, \`tea\`) are native binaries, not npm packages. Do NOT use \`npx\` to install them — it will fail or install unrelated/unofficial packages. When the CLI is unavailable, use the No-CLI Alternative column.
9282
-
9283
- ## GitHub / GitHub Enterprise
9284
-
9285
- - CLI: \`gh auth login\` uses a browser or device code flow and can open the browser automatically.
9286
- - GitHub Enterprise CLI: \`gh auth login --hostname <host>\`.
9287
- - PAT creation: \`https://github.com/settings/tokens\` for classic tokens.
9288
- - PAT creation: \`https://github.com/settings/personal-access-tokens\` for fine-grained tokens.
9289
- - Minimum scopes: \`repo\` for classic PATs (NOTE: \`repo\` grants read and write — prefer fine-grained PATs with \`Contents: Read\` for read-only access).
9290
- - Minimum scopes: \`Contents: Read\` for fine-grained PATs.
9291
- - SSH: \`git@github.com:owner/repo.git\`.
9292
- - Credential helper: \`gh auth setup-git\` configures Git to use the GitHub credential flow.
9293
- - Note: Fine-grained PATs may not cover organization-level access or every repo path; classic PATs are still required for some org repos.
9294
- - SAML SSO: PATs often require explicit org authorization from \`https://github.com/settings/tokens\` after creation.
9295
- - Enterprise note: PAT URLs and token policy can vary by host; reuse the same auth pattern with the enterprise hostname and instance settings pages.
9296
- - Enterprise detection: GHE instances use fully custom domains (e.g. \`ghe.coxautoinc.com\`, \`github.acme.com\`). If unsure, probe \`https://<host>/api/v3\` — a GitHub Enterprise instance returns a JSON response with \`installed_version\`. Use \`gh auth login --hostname <host>\` with any custom GHE domain.
9297
-
9298
- ## GitLab / GitLab Self-Managed
9299
-
9300
- - CLI: \`glab auth login\` uses a browser-backed OAuth flow.
9301
- - Self-managed CLI: \`glab auth login --hostname <host>\`.
9302
- - PAT creation: \`https://gitlab.com/-/user_settings/personal_access_tokens\`.
9303
- - Minimum scopes: \`read_repository\`.
9304
- - SSH: \`git@gitlab.com:owner/repo.git\`.
9305
- - Credential helper: \`glab auth setup-git\` configures Git credential handling.
9306
- - Note: If 2FA is enabled, username/password Git auth is blocked; a PAT is mandatory for HTTPS auth.
9307
- - Self-managed note: PAT URL is typically \`https://<host>/-/user_settings/personal_access_tokens\` unless the instance customizes settings paths.
9308
-
9309
- ## Bitbucket Cloud
9310
-
9311
- - CLI: No official first-party CLI OAuth flow for repo auth.
9312
- - PAT/App Password creation: \`https://bitbucket.org/{workspace}/settings/app-passwords\`.
9313
- - Minimum permissions: \`Repositories: Read\`.
9314
- - SSH: \`git@bitbucket.org:owner/repo.git\`.
9315
- - Note: Bitbucket Cloud uses App Passwords rather than standard PAT terminology.
9316
- - Note: HTTPS auth requires both the Bitbucket username and the app password, delivered through a credential helper or \`GIT_ASKPASS\` script — never embedded in the clone URL.
9317
-
9318
- ## Azure DevOps
9319
-
9320
- - CLI: \`az login\` authenticates to Microsoft Entra ID; Git Credential Manager then handles Git credentials automatically.
9321
- - PAT-based auth remains the fallback when Entra ID or GCM is unavailable.
9322
- - PAT creation: \`https://dev.azure.com/{org}/_usersSettings/tokens\`.
9323
- - Minimum scopes: \`Code: Read\`.
9324
- - SSH: \`git@ssh.dev.azure.com:v3/{org}/{project}/{repo}\`.
9325
- - Note: Microsoft Entra ID tokens are generally preferred over PATs in enterprise environments.
9326
- - Credential helper: Git Credential Manager via \`git-credential-manager configure\`.
9327
- - Legacy host note: Azure DevOps may also appear under \`*.visualstudio.com\` URLs.
9328
-
9329
- ## Gitea / Forgejo
9330
-
9331
- - CLI: \`tea login add\` is available but optional and not universally installed.
9332
- - PAT creation: \`https://{host}/user/settings/applications\`.
9333
- - Minimum scopes: \`repo\`.
9334
- - SSH: \`git@{host}:owner/repo.git\`.
9335
- - Note: Forgejo commonly mirrors the same applications-token path and PAT model as Gitea.
9336
- - Note: Some self-hosted instances rename scopes or disable API token creation, so confirm the instance policy if \`repo\` is rejected.
9337
-
9338
- ## Generic Git (Self-Hosted)
9339
-
9340
- - Platform CLI: None assumed.
9341
- - Auth path: Prefer SSH keys first, then PAT if the host documents HTTPS token auth.
9342
- - PAT creation: Ask the user for the platform's PAT or application-token settings URL.
9343
- - SSH: Use the host's documented SSH remote format; do not assume GitHub-style shortcuts if the server advertises a different pattern.
9344
-
9345
- ## API File-Read Endpoints (for web-based code access)
9346
-
9347
- When agents need to read individual files without cloning, use these authenticated API endpoints.
9348
-
9349
- ### GitHub / GitHub Enterprise
9350
-
9351
- \`\`\`text
9352
- # Read file contents (returns JSON with base64 content)
9353
- GET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}
9354
- Authorization: token <PAT>
9355
-
9356
- # GHE: replace api.github.com with <ghe-host>/api/v3
9357
- GET https://<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}?ref={branch}
9358
-
9359
- # Or use gh CLI (auto-authenticated):
9360
- gh api repos/{owner}/{repo}/contents/{path}?ref={branch} --jq '.content' | base64 -d
9361
- \`\`\`
9362
-
9363
- ### GitLab / GitLab Self-Managed
9364
-
9365
- \`\`\`text
9366
- # URL-encode the file path (/ becomes %2F)
9367
- GET https://gitlab.com/api/v4/projects/{project-id}/repository/files/{url-encoded-path}/raw?ref={branch}
9368
- PRIVATE-TOKEN: <PAT>
9369
-
9370
- # Or use project path instead of ID:
9371
- GET https://gitlab.com/api/v4/projects/{url-encoded-namespace%2Fproject}/repository/files/{url-encoded-path}/raw?ref={branch}
9372
- \`\`\`
9373
-
9374
- ### Azure DevOps
9375
-
9376
- \`\`\`text
9377
- GET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0
9378
- Authorization: Basic {base64(:PAT)}
9379
- \`\`\`
9380
-
9381
- ### Bitbucket Cloud
9382
-
9383
- \`\`\`text
9384
- GET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/src/{commit-or-branch}/{path}
9385
- Authorization: Bearer <app-password-or-token>
9386
- \`\`\`
9387
- - Note: Self-hosted products often customize auth policy, token names, and minimum scopes.
9388
-
9389
- ## Safe Credential Delivery Patterns
9390
-
9391
- | Method | Command | Safety |
9392
- |---|---|---|
9393
- | Platform CLI | \`gh auth login\` / \`glab auth login\` | Best — handles credential storage |
9394
- | Git Credential Manager | \`git credential-manager configure\` | Good — OS keychain storage |
9395
- | Environment variable | \`GH_TOKEN=xxx gh repo clone ...\` | OK — ephemeral; safer than URL tokens but visible to same-user processes |
9396
- | Git askpass | \`GIT_ASKPASS=script git clone ...\` | OK — no shell history exposure |
9397
- | Inline in URL | \`git clone https://token@host/...\` | FORBIDDEN — leaks in history/logs |
9398
-
9399
- ## Operational Notes
9400
-
9401
- - Prefer SSH when the user already has working keys and the host advertises a stable SSH remote format.
9402
- - Prefer platform CLI login for GitHub and GitLab because it also wires Git credential storage.
9403
- - Prefer Git Credential Manager for Azure DevOps and other HTTPS-heavy enterprise setups.
9404
- - When recommending PAT creation, always suggest setting a short expiry (7-30 days for task-specific work). Prefer fine-grained or short-lived tokens.
9405
- - Never recommend pasting tokens inline into clone URLs, scripts checked into the repo, or long-lived shell profiles.` },
9406
- { file: "SKILL.md", content: `---
9407
- name: repo-access
9408
- description: "Progressive repository access recovery for private and enterprise git repositories. Triggered when: (1) git clone/fetch/pull fails with auth errors (401, 403, 404, Permission denied), (2) web_fetch or http tool returns auth failure on repository URLs, (3) user mentions private repo, enterprise repo, or internal repo, (4) user asks to access code from GitHub Enterprise, GitLab Self-Managed, Bitbucket Server, Azure DevOps. Guides through 5-step progressive strategy: anonymous HTTPS, SSH keys, CLI OAuth, PAT, local clone fallback."
9409
- metadata:
9410
- category: cross-cutting
9411
- domain: general
9412
- applicability: on-demand
9413
- inputs: [git-error, repository-url, platform-context]
9414
- outputs: [authenticated-access, recovery-instructions]
9415
- requires: []
9416
- relatedSkills: [aikit]
9417
- argument-hint: "Repository URL or error message"
9418
- ---
9419
-
9420
- # Repository Access Recovery
9421
-
9422
- Progressively recover repository access for private, enterprise, and internal git hosts without leaking credentials.
9423
-
9424
- ## When to Activate
9425
-
9426
- ### Reactive triggers
9427
-
9428
- - \`git clone\`, \`git fetch\`, or \`git pull\` fails with \`401\`, \`403\`, \`404\`, \`Authentication failed\`, or \`Permission denied (publickey)\`.
9429
- - \`http\` diagnostics against a repo endpoint show auth failure or ambiguous private-repo responses.
9430
- - \`web_fetch\` returns login page HTML, SSO redirect, "Sign in", "Page not found", or empty/truncated content for a repo URL.
9431
- - Any tool output contains "behind SSO", "SSO required", "SAML", "requires authentication", or similar auth-gate language about a repository.
9432
- - A repository URL works in a browser for the user but fails from agent tools or terminal commands.
9433
- - **You are about to declare a repo "inaccessible" or "unreachable"** — STOP and activate this skill first.
9434
-
9435
- ### Proactive triggers
9436
-
9437
- - The user says the repo is private, enterprise, self-managed, internal, or SSO-protected.
9438
- - The repo is hosted on GitHub Enterprise, GitLab Self-Managed, Bitbucket Server/Data Center, Azure DevOps, Gitea, or another custom git host.
9439
- - The environment may need browser sign-in, SSH agent setup, or token-based recovery before any code access can work.
9440
-
9441
- ## When NOT to Activate
9442
-
9443
- - Public repositories that already clone or read successfully over HTTPS.
9444
- - Local-only repositories where no remote auth is involved.
9445
- - Problems caused by branch protection, merge conflicts, or rate limiting rather than repository access.
9446
-
9447
- ## Step 0: Platform Detection & Capability Gate
9448
-
9449
- Detect platform from the URL, then decide what recovery options are possible in this environment.
9450
-
9451
- | URL pattern | Platform |
9452
- | --- | --- |
9453
- | \`github.com\`, or any GHE host (e.g. \`ghe.*\`, \`github.*\`, custom domain) | GitHub / GitHub Enterprise |
9454
- | \`gitlab.com\`, \`gitlab.<corp-host>\` | GitLab / GitLab Self-Managed |
9455
- | \`bitbucket.org\`, \`bitbucket.<corp-host>\` | Bitbucket Cloud / Server |
9456
- | \`dev.azure.com\`, \`visualstudio.com\`, \`/_git/\` | Azure DevOps |
9457
- | anything else with git over HTTPS/SSH | Unknown — ask the user which platform before assuming generic Git |
9458
-
9459
- - Capability gate: has terminal, has browser, or conversation-only.
9460
- - If terminal is unavailable, skip directly to PAT guidance or local clone fallback.
9461
- - If browser is unavailable, prefer SSH or pre-created credentials over CLI OAuth.
9462
- - If only the \`http\` tool is available (no terminal, no CLI): use PAT + authenticated API reads (see "Web-Based Code Access" below). This is the zero-dependency path — no \`gh\`, \`glab\`, or \`az\` installation needed.
9463
-
9464
- For platform-specific details, read \`references/platform-matrix.md\`.
9465
-
9466
- ## Strategy Ladder
9467
-
9468
- ### Step 1: Try HTTPS Anonymous Access
9469
-
9470
- - Goal: prove the repo is public or already reachable without extra auth.
9471
- - What to do: normalize the remote to an HTTPS URL and run \`git ls-remote https://...\`. If it succeeds, use HTTPS and stop. If it fails with auth-like errors, continue instead of assuming the repo is missing.
9472
- - Verify: \`git ls-remote <url>\`; SUCCESS -> stop, FAIL -> Step 2.
9473
-
9474
- ### Step 2: Check Existing SSH Keys
9475
-
9476
- - Goal: reuse working SSH credentials before asking for new secrets.
9477
- - What to do: inspect \`~/.ssh/\` for key files, run \`ssh-add -l\`, then test host auth with \`ssh -T git@{host}\`. If SSH works, switch the remote to the SSH URL and continue with that transport.
9478
- - Verify: \`git ls-remote <ssh-url>\`; SUCCESS -> stop, FAIL -> Step 3.
9479
-
9480
- ### Step 3: Platform CLI OAuth
9481
-
9482
- - Goal: use the platform's interactive login flow with stored credentials.
9483
- - What to do: check whether the matching CLI exists, for example \`which gh\`, \`which glab\`, or \`which az\` (or platform equivalent). If installed, run \`{cli} auth login\` and let it complete browser or device OAuth, then retry git access.
9484
- - **If the CLI is not installed**: do NOT try \`npx\` — platform CLIs (\`gh\`, \`glab\`, \`az\`) are native binaries, not npm packages. Skip straight to Step 4 (PAT). For file-read-only tasks, the \`http\` tool with a PAT header is a zero-dependency alternative to any CLI.
9485
- - Verify: \`git ls-remote <url>\`; SUCCESS -> stop, FAIL -> Step 4.
9486
-
9487
- ### Step 4: Personal Access Token
9488
-
9489
- - Goal: recover access when SSH and CLI OAuth are unavailable or blocked.
9490
- - What to do: ask the user to create a PAT or app password at the platform-specific URL with minimum read scopes only. Have the user provide it through an env var or credential helper, then configure git credentials without embedding the token in the remote URL.
9491
- - Verify: \`git ls-remote <url>\`; SUCCESS -> stop, FAIL -> Step 5.
9492
-
9493
- ### Step 5: Local Clone Fallback
9494
-
9495
- - Goal: unblock work when remote auth cannot be completed from the current environment.
9496
- - What to do: ask the user to clone the repository on their machine using their normal workflow, then provide the local filesystem path. Use the local checkout as the source of truth for code access.
9497
- - Verify: local repo exists and \`git rev-parse --show-toplevel\` succeeds; SUCCESS -> stop.
9498
-
9499
- ## Security Rules (HARD GATE)
9500
-
9501
- - NEVER include a PAT in a git URL; it leaks into shell history, process lists, logs, and config.
9502
- - NEVER repeat a user's token value in chat output, summaries, examples, or when relaying tool output that may contain credentials.
9503
- - Use env vars, credential helpers, or platform login tools for token delivery.
9504
- - Recommend minimum scopes only: read-only repo scopes, not broad write/admin scopes.
9505
- - Prefer ephemeral credentials, OAuth/device flows, or short-lived tokens over long-lived PATs.
9506
- - When guiding PAT creation, recommend the shortest feasible expiry (7–30 days for task-specific work).
9507
-
9508
- ## After Access Is Established
9509
-
9510
- - Remind the user to revoke single-use PATs once the task is complete.
9511
- - If credentials were stored via a credential helper, note that they persist until manually removed or the token expires.
9512
-
9513
- ## Web-Based Code Access (web_fetch / http)
9514
-
9515
- Agents often use \`web_fetch\` or \`http\` to read individual files without a full clone. These requests fail silently on private repos — GitHub returns \`404\` or login HTML, not an auth error.
9516
-
9517
- ### Common URL Patterns That Fail on Private Repos
9518
-
9519
- | URL Pattern | Platform | What Happens |
9520
- |---|---|---|
9521
- | \`raw.githubusercontent.com/{owner}/{repo}/{ref}/{path}\` | GitHub | \`404\` — no auth header accepted |
9522
- | \`github.com/{owner}/{repo}/blob/{ref}/{path}\` | GitHub web view | \`200\` with login HTML, not code |
9523
- | \`api.github.com/repos/{owner}/{repo}/contents/{path}\` | GitHub API | \`404\` (the GitHub 404 trap) |
9524
- | \`<ghe-host>/{owner}/{repo}/*\` (any GHE URL) | GitHub Enterprise | \`200\` with SAML SSO redirect page — body contains "Initiating SAML single sign-on" and redirect to \`login.microsoftonline.com\` or other IdP |
9525
- | \`gitlab.com/{owner}/{repo}/-/raw/{ref}/{path}\` | GitLab | \`401\` or login redirect |
9526
- | \`dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items\` | Azure DevOps | \`401\` or \`203\` non-authoritative |
9527
-
9528
- ### SAML SSO Detection (CRITICAL)
9529
-
9530
- GHE instances with SAML SSO return \`200 OK\` with an HTML body that is NOT the requested content. **This is the most common false-"inaccessible" scenario.** Detect it by checking \`web_fetch\` output for ANY of these strings:
9531
-
9532
- - \`Initiating SAML single sign-on\`
9533
- - \`login.microsoftonline.com\` (Azure AD / Entra ID)
9534
- - \`You are being redirected to your identity provider\`
9535
- - \`/login?return_to=\`
9536
- - \`SAMLRequest=\`
9537
- - \`RelayState=\`
9538
-
9539
- If ANY of these appear → the repo exists and is accessible, it just needs authentication. This is NOT "inaccessible" — follow the Strategy Ladder.
9540
-
9541
- ### Recovery: Authenticated API Reads
9542
-
9543
- When \`web_fetch\` fails on a private repo URL, switch to authenticated \`http\` calls:
9544
-
9545
- 1. **Ensure auth is established first** — walk the Strategy Ladder (Steps 1-4) to get working credentials.
9546
- 2. **Use the platform API with auth headers**, not raw/web URLs:
9547
-
9548
- | Platform | Authenticated file-read endpoint | Auth header |
9549
- |---|---|---|
9550
- | GitHub / GHE | \`http GET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}\` | \`Authorization: token <PAT>\` or use \`gh api\` |
9551
- | GitLab | \`http GET https://gitlab.com/api/v4/projects/{id}/repository/files/{path}/raw?ref={branch}\` | \`PRIVATE-TOKEN: <PAT>\` |
9552
- | Azure DevOps | \`http GET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0\` | \`Authorization: Basic <base64(:PAT)>\` |
9553
- | Bitbucket | \`http GET https://api.bitbucket.org/2.0/repositories/{owner}/{repo}/src/{ref}/{path}\` | \`Authorization: Bearer <token>\` |
9554
-
9555
- 3. **Prefer \`http\` over \`web_fetch\`** for private repos — \`http\` sends proper headers and returns machine-readable JSON; \`web_fetch\` gets HTML login pages.
9556
- 4. **For bulk reads**, prefer \`git clone --depth 1\` over many individual API calls — it's faster and avoids rate limits.
9557
- 5. **NEVER embed tokens in URLs** — use auth headers via the \`http\` tool or \`gh api\` CLI wrapper.
9558
-
9559
- ### Quick Decision: Clone vs API Read
9560
-
9561
- | Situation | Preferred method |
9562
- |---|---|
9563
- | Need 1-3 specific files | Authenticated API via \`http\` |
9564
- | Need to browse/search the repo | \`git clone --depth 1\` (shallow) |
9565
- | Need file history or blame | \`git clone\` |
9566
- | No terminal available | Authenticated API via \`http\` with PAT |
9567
- | Rate-limited on API | \`git clone --depth 1\` |
9568
-
9569
- ## Tool Routing
9570
-
9571
- | Tool | Use |
9572
- | --- | --- |
9573
- | \`git_context\` | Check local repo state and confirm a clone or fallback checkout is usable |
9574
- | \`http\` | Probe platform APIs for auth diagnostics AND read file contents from private repos with auth headers |
9575
- | \`web_fetch\` | Only for public repos or after confirming access works; unreliable for private repos (returns HTML, not code) |
9576
- | \`web_search\` | Find current platform-specific auth documentation when the host is unusual or self-managed |
9577
- | Terminal | Run git commands, SSH tests, CLI auth flows, and credential-helper setup |
9578
-
9579
- For detailed error patterns, read \`references/error-patterns.md\`.
9580
-
9581
- ## CRITICAL: The GitHub 404 Trap
9582
-
9583
- GitHub commonly returns \`404 Not Found\` for private repositories when the caller is unauthenticated or under-authenticated. NEVER conclude that a GitHub repository does not exist from a \`404\` alone. Treat that response as an authentication signal first, then walk the ladder before declaring the repo missing.` },
9584
- ],
9585
- "requirements-clarity": [
9586
- { file: "SKILL.md", content: `---
7873
+ `}],"repo-access":[{file:`references/error-patterns.md`,content:'# Repo Access Error Patterns\n\nUse this reference to distinguish missing repositories from authentication and policy failures when probing Git hosts.\n\n## HTTP Status Code Matrix\n\n| Platform | No auth (private repo) | Wrong credentials | Rate limited | SSO required |\n|---|---|---|---|---|\n| GitHub REST API | `404` (TRAP!) | `401` -> `403` | `403` + rate limit body | `403` + `X-GitHub-SSO` header |\n| GitHub Web | HTML "Page not found" or login redirect | Login redirect | - | - |\n| GitLab | `401` | `401` | `429` | `401` (PAT mandatory) |\n| Bitbucket | `403` | `403` | `429` | `403` |\n| Azure DevOps | `401` | `401` | - | `401` |\n\n## CRITICAL: The GitHub 404 Trap\n\nGitHub deliberately returns `404`, not `401`, for private repositories accessed without authentication.\nThis is by design to avoid leaking whether a repository exists.\n\n- Never conclude a GitHub repository does not exist from an unauthenticated `404`.\n- `GET https://api.github.com/repos/{owner}/{repo}` without auth returns `404` for both "repo truly missing" and "repo exists but is private".\n- The only reliable disambiguation is an authenticated probe.\n- If the same request still returns `404` with valid auth, the repository is truly missing.\n\nProbe order:\n\n1. Try the authenticated API request first.\n2. If it returns `200`, access works.\n3. If it returns `404` without auth context, treat it as ambiguous and recover.\n4. If it returns `404` with known-good auth, treat the repo as missing.\n\n## Git CLI Stderr Patterns\n\n| Error Text Pattern | Platform | Diagnosis | Action |\n|---|---|---|---|\n| `remote: Repository not found.` | GitHub | Auth failure, not proof the repo is missing | Try auth strategies |\n| `git@github.com: Permission denied (publickey).` | GitHub | SSH key not recognized | Check SSH keys, try HTTPS |\n| `remote: HTTP Basic: Access denied.` | GitLab | Auth failure, 2FA likely | Use PAT; password auth is blocked with 2FA |\n| `error: The requested URL returned error: 403` | Bitbucket | Auth failure | Try app password |\n| `TF401019: The Git repository with name or identifier X does not exist` | Azure DevOps | Auth failure or missing repo | Try PAT with Code:Read scope |\n| `fatal: Authentication failed for \'https://...\'` | Any (HTTPS) | General auth failure | Escalate through the strategy ladder |\n| `Permission denied (publickey).` | Any (SSH) | SSH key not recognized | Check `~/.ssh/`, run `ssh-add`, try HTTPS |\n| `fatal: Could not read from remote repository.` | Any (SSH) | SSH access denied | Verify the SSH key is added to the platform |\n| `unable to access \'...\': SSL certificate problem` | Any | Self-signed or enterprise CA issue | Ask about local cert config; skip to local clone if needed |\n\nTreat these stderr strings as direct signals from tool output. Do not reinterpret GitHub\'s `Repository not found` as a clean existence check.\n\n## web_fetch / http Tool Detection\n\n- `web_fetch` against a private GitHub repo URL often returns HTML with "Page not found" or a login page.\n- GitHub web responses can be `200` with a 404-looking body, so `web_fetch` is unreliable for auth diagnosis.\n- `http` against the platform API gives machine-readable bodies and real status codes, so use it for probes.\n- For `web_fetch` on `github.com`, inspect the body for `Page not found`, `Sign in`, or `/login` links. If present, assume private or auth-gated access and trigger recovery.\n\nRecommended diagnostic probe:\n\n```text\nhttp GET https://api.github.com/repos/{owner}/{repo}\n-> 404 + no auth header -> might be private\n-> 401 -> explicit auth failure\n-> 200 -> repo is public, access works\n```\n\n## Edge Cases\n\n| Edge Case | Signal | Response |\n|---|---|---|\n| GitHub.com SAML SSO | `403` + `X-GitHub-SSO: required; url=...` | PAT needs SSO authorization for the org |\n| GHE SAML SSO (web_fetch) | `200` + body contains `Initiating SAML single sign-on`, redirect to `login.microsoftonline.com` or other IdP | Repo EXISTS and is auth-gated. NOT inaccessible. Use PAT + `http` with auth headers, or `gh auth login --hostname <host>` |\n| GHE SAML SSO (http) | `302` redirect to `/login?return_to=...` or IdP URL | Same — repo exists, needs auth. Walk the Strategy Ladder |\n| GHE SAML SSO (git CLI) | `fatal: Authentication failed` or credential prompt | `gh auth login --hostname <host>` or PAT via credential helper |\n\n## SAML SSO — Detailed Pattern\n\nGitHub Enterprise instances commonly use SAML SSO via Azure AD (Entra ID), Okta, or other IdPs. When `web_fetch` hits a GHE URL without auth:\n\n1. GHE returns `200 OK` (not 401/403!) with an HTML page\n2. The HTML contains `Initiating SAML single sign-on` and a redirect URL to the IdP\n3. The redirect URL includes `SAMLRequest=`, `RelayState=`, and often `login.microsoftonline.com`\n4. The agent sees HTML content and may conclude the repo is "inaccessible" or "behind SSO"\n\n**Detection strings** (check `web_fetch` output for ANY of these):\n```\nInitiating SAML single sign-on\nlogin.microsoftonline.com\nYou are being redirected to your identity provider\n/login?return_to=\nSAMLRequest=\nRelayState=\n```\n\n**Correct response:** The repo exists. The `web_fetch` path will never work for SSO-protected GHE. Switch to:\n- `gh auth login --hostname <ghe-host>` (if `gh` CLI available)\n- PAT + `http` with `Authorization: token <PAT>` against `<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}`\n- Ask user for local clone if no token can be obtained\n| GitLab 2FA enabled | `401` on password auth | PAT is mandatory; 2FA blocks password auth |\n| Expired token | `401` after providing a valid-looking PAT | Generate a new token and check expiry |\n| GitHub rate limit | `403` + body contains `rate limit` | Not an auth failure; wait or authenticate for a higher limit |\n| IP allowlisting | `403` + body mentions IP or org policies | Cannot be fixed programmatically; skip to local clone (Step 5) |\n| Fine-grained PAT scope | `403` + `insufficient scope` | Switch to a classic PAT for org repos |\n| SSH key not in agent | `Permission denied (publickey)` + key file exists | Run `ssh-add ~/.ssh/id_ed25519` |\n| Wrong SSH username | `Permission denied` | Use `git@host`, not `username@host` |\n| Deploy key conflict | `key is already in use` | Use a user SSH key or PAT instead |\n\n## Escalation Decision Rules\n\n- Retry the same step for transient failures such as DNS failure, timeout, or `5xx` responses.\n- Escalate to the next strategy step for `401`, `403`, `404`, `Permission denied`, `Authentication failed`, or `Access denied`.\n- Skip directly to Step 5 (local clone) for IP allowlisting, enterprise SSL certificate issues, or org policy blocks.\n\nDefault interpretation order:\n\n1. Prefer API probes over web page fetches.\n2. Treat GitHub `404` as ambiguous until valid auth disproves privacy.\n3. Treat SSH `publickey` errors as key-distribution failures, not repo absence.\n4. Separate rate limits and org policy blocks from authentication failures before escalating.'},{file:`references/platform-matrix.md`,content:"# Platform Matrix\n\nUse this reference when a repository URL reveals the hosting platform and the skill needs platform-specific authentication or cloning guidance. Prefer platform CLI login flows or OS-backed credential helpers over raw PAT handling.\n\n## Platform Detection\n\n| URL Pattern | Platform | CLI Tool (optional) | Auth Command | No-CLI Alternative |\n|---|---|---|---|---|\n| `github.com` | GitHub | `gh` | `gh auth login` | PAT + `http` with `Authorization: token <PAT>` |\n| Any custom domain (e.g. `ghe.corp.com`, `github.corp.com`) | GitHub Enterprise | `gh` | `gh auth login --hostname <host>` | PAT + `http` against `<host>/api/v3` |\n| `gitlab.com` | GitLab | `glab` | `glab auth login` | PAT + `http` with `PRIVATE-TOKEN` header |\n| Self-hosted GitLab | GitLab Self-Managed | `glab` | `glab auth login --hostname <host>` | PAT + `http` with `PRIVATE-TOKEN` header |\n| `bitbucket.org` | Bitbucket Cloud | None | N/A | App password + `http` with `Authorization: Bearer` |\n| `dev.azure.com` or `*.visualstudio.com` | Azure DevOps | `az` + GCM | `az login` | PAT + `http` with Basic auth |\n| Gitea instances | Gitea | `tea` (optional) | `tea login add` | PAT + `http` with `Authorization: token` |\n| Unknown or custom domain | Ask user which platform | N/A | N/A | Probe `http` or ask before assuming generic Git |\n\n> **Note:** Platform CLIs (`gh`, `glab`, `az`, `tea`) are native binaries, not npm packages. Do NOT use `npx` to install them — it will fail or install unrelated/unofficial packages. When the CLI is unavailable, use the No-CLI Alternative column.\n\n## GitHub / GitHub Enterprise\n\n- CLI: `gh auth login` uses a browser or device code flow and can open the browser automatically.\n- GitHub Enterprise CLI: `gh auth login --hostname <host>`.\n- PAT creation: `https://github.com/settings/tokens` for classic tokens.\n- PAT creation: `https://github.com/settings/personal-access-tokens` for fine-grained tokens.\n- Minimum scopes: `repo` for classic PATs (NOTE: `repo` grants read and write — prefer fine-grained PATs with `Contents: Read` for read-only access).\n- Minimum scopes: `Contents: Read` for fine-grained PATs.\n- SSH: `git@github.com:owner/repo.git`.\n- Credential helper: `gh auth setup-git` configures Git to use the GitHub credential flow.\n- Note: Fine-grained PATs may not cover organization-level access or every repo path; classic PATs are still required for some org repos.\n- SAML SSO: PATs often require explicit org authorization from `https://github.com/settings/tokens` after creation.\n- Enterprise note: PAT URLs and token policy can vary by host; reuse the same auth pattern with the enterprise hostname and instance settings pages.\n- Enterprise detection: GHE instances use fully custom domains (e.g. `ghe.coxautoinc.com`, `github.acme.com`). If unsure, probe `https://<host>/api/v3` — a GitHub Enterprise instance returns a JSON response with `installed_version`. Use `gh auth login --hostname <host>` with any custom GHE domain.\n\n## GitLab / GitLab Self-Managed\n\n- CLI: `glab auth login` uses a browser-backed OAuth flow.\n- Self-managed CLI: `glab auth login --hostname <host>`.\n- PAT creation: `https://gitlab.com/-/user_settings/personal_access_tokens`.\n- Minimum scopes: `read_repository`.\n- SSH: `git@gitlab.com:owner/repo.git`.\n- Credential helper: `glab auth setup-git` configures Git credential handling.\n- Note: If 2FA is enabled, username/password Git auth is blocked; a PAT is mandatory for HTTPS auth.\n- Self-managed note: PAT URL is typically `https://<host>/-/user_settings/personal_access_tokens` unless the instance customizes settings paths.\n\n## Bitbucket Cloud\n\n- CLI: No official first-party CLI OAuth flow for repo auth.\n- PAT/App Password creation: `https://bitbucket.org/{workspace}/settings/app-passwords`.\n- Minimum permissions: `Repositories: Read`.\n- SSH: `git@bitbucket.org:owner/repo.git`.\n- Note: Bitbucket Cloud uses App Passwords rather than standard PAT terminology.\n- Note: HTTPS auth requires both the Bitbucket username and the app password, delivered through a credential helper or `GIT_ASKPASS` script — never embedded in the clone URL.\n\n## Azure DevOps\n\n- CLI: `az login` authenticates to Microsoft Entra ID; Git Credential Manager then handles Git credentials automatically.\n- PAT-based auth remains the fallback when Entra ID or GCM is unavailable.\n- PAT creation: `https://dev.azure.com/{org}/_usersSettings/tokens`.\n- Minimum scopes: `Code: Read`.\n- SSH: `git@ssh.dev.azure.com:v3/{org}/{project}/{repo}`.\n- Note: Microsoft Entra ID tokens are generally preferred over PATs in enterprise environments.\n- Credential helper: Git Credential Manager via `git-credential-manager configure`.\n- Legacy host note: Azure DevOps may also appear under `*.visualstudio.com` URLs.\n\n## Gitea / Forgejo\n\n- CLI: `tea login add` is available but optional and not universally installed.\n- PAT creation: `https://{host}/user/settings/applications`.\n- Minimum scopes: `repo`.\n- SSH: `git@{host}:owner/repo.git`.\n- Note: Forgejo commonly mirrors the same applications-token path and PAT model as Gitea.\n- Note: Some self-hosted instances rename scopes or disable API token creation, so confirm the instance policy if `repo` is rejected.\n\n## Generic Git (Self-Hosted)\n\n- Platform CLI: None assumed.\n- Auth path: Prefer SSH keys first, then PAT if the host documents HTTPS token auth.\n- PAT creation: Ask the user for the platform's PAT or application-token settings URL.\n- SSH: Use the host's documented SSH remote format; do not assume GitHub-style shortcuts if the server advertises a different pattern.\n\n## API File-Read Endpoints (for web-based code access)\n\nWhen agents need to read individual files without cloning, use these authenticated API endpoints.\n\n### GitHub / GitHub Enterprise\n\n```text\n# Read file contents (returns JSON with base64 content)\nGET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}\nAuthorization: token <PAT>\n\n# GHE: replace api.github.com with <ghe-host>/api/v3\nGET https://<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}?ref={branch}\n\n# Or use gh CLI (auto-authenticated):\ngh api repos/{owner}/{repo}/contents/{path}?ref={branch} --jq '.content' | base64 -d\n```\n\n### GitLab / GitLab Self-Managed\n\n```text\n# URL-encode the file path (/ becomes %2F)\nGET https://gitlab.com/api/v4/projects/{project-id}/repository/files/{url-encoded-path}/raw?ref={branch}\nPRIVATE-TOKEN: <PAT>\n\n# Or use project path instead of ID:\nGET https://gitlab.com/api/v4/projects/{url-encoded-namespace%2Fproject}/repository/files/{url-encoded-path}/raw?ref={branch}\n```\n\n### Azure DevOps\n\n```text\nGET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0\nAuthorization: Basic {base64(:PAT)}\n```\n\n### Bitbucket Cloud\n\n```text\nGET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/src/{commit-or-branch}/{path}\nAuthorization: Bearer <app-password-or-token>\n```\n- Note: Self-hosted products often customize auth policy, token names, and minimum scopes.\n\n## Safe Credential Delivery Patterns\n\n| Method | Command | Safety |\n|---|---|---|\n| Platform CLI | `gh auth login` / `glab auth login` | Best — handles credential storage |\n| Git Credential Manager | `git credential-manager configure` | Good — OS keychain storage |\n| Environment variable | `GH_TOKEN=xxx gh repo clone ...` | OK — ephemeral; safer than URL tokens but visible to same-user processes |\n| Git askpass | `GIT_ASKPASS=script git clone ...` | OK — no shell history exposure |\n| Inline in URL | `git clone https://token@host/...` | FORBIDDEN — leaks in history/logs |\n\n## Operational Notes\n\n- Prefer SSH when the user already has working keys and the host advertises a stable SSH remote format.\n- Prefer platform CLI login for GitHub and GitLab because it also wires Git credential storage.\n- Prefer Git Credential Manager for Azure DevOps and other HTTPS-heavy enterprise setups.\n- When recommending PAT creation, always suggest setting a short expiry (7-30 days for task-specific work). Prefer fine-grained or short-lived tokens.\n- Never recommend pasting tokens inline into clone URLs, scripts checked into the repo, or long-lived shell profiles."},{file:`SKILL.md`,content:'---\nname: repo-access\ndescription: "Progressive repository access recovery for private and enterprise git repositories. Triggered when: (1) git clone/fetch/pull fails with auth errors (401, 403, 404, Permission denied), (2) web_fetch or http tool returns auth failure on repository URLs, (3) user mentions private repo, enterprise repo, or internal repo, (4) user asks to access code from GitHub Enterprise, GitLab Self-Managed, Bitbucket Server, Azure DevOps. Guides through 5-step progressive strategy: anonymous HTTPS, SSH keys, CLI OAuth, PAT, local clone fallback."\nmetadata:\n category: cross-cutting\n domain: general\n applicability: on-demand\n inputs: [git-error, repository-url, platform-context]\n outputs: [authenticated-access, recovery-instructions]\n requires: []\n relatedSkills: [aikit]\nargument-hint: "Repository URL or error message"\n---\n\n# Repository Access Recovery\n\nProgressively recover repository access for private, enterprise, and internal git hosts without leaking credentials.\n\n## When to Activate\n\n### Reactive triggers\n\n- `git clone`, `git fetch`, or `git pull` fails with `401`, `403`, `404`, `Authentication failed`, or `Permission denied (publickey)`.\n- `http` diagnostics against a repo endpoint show auth failure or ambiguous private-repo responses.\n- `web_fetch` returns login page HTML, SSO redirect, "Sign in", "Page not found", or empty/truncated content for a repo URL.\n- Any tool output contains "behind SSO", "SSO required", "SAML", "requires authentication", or similar auth-gate language about a repository.\n- A repository URL works in a browser for the user but fails from agent tools or terminal commands.\n- **You are about to declare a repo "inaccessible" or "unreachable"** — STOP and activate this skill first.\n\n### Proactive triggers\n\n- The user says the repo is private, enterprise, self-managed, internal, or SSO-protected.\n- The repo is hosted on GitHub Enterprise, GitLab Self-Managed, Bitbucket Server/Data Center, Azure DevOps, Gitea, or another custom git host.\n- The environment may need browser sign-in, SSH agent setup, or token-based recovery before any code access can work.\n\n## When NOT to Activate\n\n- Public repositories that already clone or read successfully over HTTPS.\n- Local-only repositories where no remote auth is involved.\n- Problems caused by branch protection, merge conflicts, or rate limiting rather than repository access.\n\n## Step 0: Platform Detection & Capability Gate\n\nDetect platform from the URL, then decide what recovery options are possible in this environment.\n\n| URL pattern | Platform |\n| --- | --- |\n| `github.com`, or any GHE host (e.g. `ghe.*`, `github.*`, custom domain) | GitHub / GitHub Enterprise |\n| `gitlab.com`, `gitlab.<corp-host>` | GitLab / GitLab Self-Managed |\n| `bitbucket.org`, `bitbucket.<corp-host>` | Bitbucket Cloud / Server |\n| `dev.azure.com`, `visualstudio.com`, `/_git/` | Azure DevOps |\n| anything else with git over HTTPS/SSH | Unknown — ask the user which platform before assuming generic Git |\n\n- Capability gate: has terminal, has browser, or conversation-only.\n- If terminal is unavailable, skip directly to PAT guidance or local clone fallback.\n- If browser is unavailable, prefer SSH or pre-created credentials over CLI OAuth.\n- If only the `http` tool is available (no terminal, no CLI): use PAT + authenticated API reads (see "Web-Based Code Access" below). This is the zero-dependency path — no `gh`, `glab`, or `az` installation needed.\n\nFor platform-specific details, read `references/platform-matrix.md`.\n\n## Strategy Ladder\n\n### Step 1: Try HTTPS Anonymous Access\n\n- Goal: prove the repo is public or already reachable without extra auth.\n- What to do: normalize the remote to an HTTPS URL and run `git ls-remote https://...`. If it succeeds, use HTTPS and stop. If it fails with auth-like errors, continue instead of assuming the repo is missing.\n- Verify: `git ls-remote <url>`; SUCCESS -> stop, FAIL -> Step 2.\n\n### Step 2: Check Existing SSH Keys\n\n- Goal: reuse working SSH credentials before asking for new secrets.\n- What to do: inspect `~/.ssh/` for key files, run `ssh-add -l`, then test host auth with `ssh -T git@{host}`. If SSH works, switch the remote to the SSH URL and continue with that transport.\n- Verify: `git ls-remote <ssh-url>`; SUCCESS -> stop, FAIL -> Step 3.\n\n### Step 3: Platform CLI OAuth\n\n- Goal: use the platform\'s interactive login flow with stored credentials.\n- What to do: check whether the matching CLI exists, for example `which gh`, `which glab`, or `which az` (or platform equivalent). If installed, run `{cli} auth login` and let it complete browser or device OAuth, then retry git access.\n- **If the CLI is not installed**: do NOT try `npx` — platform CLIs (`gh`, `glab`, `az`) are native binaries, not npm packages. Skip straight to Step 4 (PAT). For file-read-only tasks, the `http` tool with a PAT header is a zero-dependency alternative to any CLI.\n- Verify: `git ls-remote <url>`; SUCCESS -> stop, FAIL -> Step 4.\n\n### Step 4: Personal Access Token\n\n- Goal: recover access when SSH and CLI OAuth are unavailable or blocked.\n- What to do: ask the user to create a PAT or app password at the platform-specific URL with minimum read scopes only. Have the user provide it through an env var or credential helper, then configure git credentials without embedding the token in the remote URL.\n- Verify: `git ls-remote <url>`; SUCCESS -> stop, FAIL -> Step 5.\n\n### Step 5: Local Clone Fallback\n\n- Goal: unblock work when remote auth cannot be completed from the current environment.\n- What to do: ask the user to clone the repository on their machine using their normal workflow, then provide the local filesystem path. Use the local checkout as the source of truth for code access.\n- Verify: local repo exists and `git rev-parse --show-toplevel` succeeds; SUCCESS -> stop.\n\n## Security Rules (HARD GATE)\n\n- NEVER include a PAT in a git URL; it leaks into shell history, process lists, logs, and config.\n- NEVER repeat a user\'s token value in chat output, summaries, examples, or when relaying tool output that may contain credentials.\n- Use env vars, credential helpers, or platform login tools for token delivery.\n- Recommend minimum scopes only: read-only repo scopes, not broad write/admin scopes.\n- Prefer ephemeral credentials, OAuth/device flows, or short-lived tokens over long-lived PATs.\n- When guiding PAT creation, recommend the shortest feasible expiry (7–30 days for task-specific work).\n\n## After Access Is Established\n\n- Remind the user to revoke single-use PATs once the task is complete.\n- If credentials were stored via a credential helper, note that they persist until manually removed or the token expires.\n\n## Web-Based Code Access (web_fetch / http)\n\nAgents often use `web_fetch` or `http` to read individual files without a full clone. These requests fail silently on private repos — GitHub returns `404` or login HTML, not an auth error.\n\n### Common URL Patterns That Fail on Private Repos\n\n| URL Pattern | Platform | What Happens |\n|---|---|---|\n| `raw.githubusercontent.com/{owner}/{repo}/{ref}/{path}` | GitHub | `404` — no auth header accepted |\n| `github.com/{owner}/{repo}/blob/{ref}/{path}` | GitHub web view | `200` with login HTML, not code |\n| `api.github.com/repos/{owner}/{repo}/contents/{path}` | GitHub API | `404` (the GitHub 404 trap) |\n| `<ghe-host>/{owner}/{repo}/*` (any GHE URL) | GitHub Enterprise | `200` with SAML SSO redirect page — body contains "Initiating SAML single sign-on" and redirect to `login.microsoftonline.com` or other IdP |\n| `gitlab.com/{owner}/{repo}/-/raw/{ref}/{path}` | GitLab | `401` or login redirect |\n| `dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items` | Azure DevOps | `401` or `203` non-authoritative |\n\n### SAML SSO Detection (CRITICAL)\n\nGHE instances with SAML SSO return `200 OK` with an HTML body that is NOT the requested content. **This is the most common false-"inaccessible" scenario.** Detect it by checking `web_fetch` output for ANY of these strings:\n\n- `Initiating SAML single sign-on`\n- `login.microsoftonline.com` (Azure AD / Entra ID)\n- `You are being redirected to your identity provider`\n- `/login?return_to=`\n- `SAMLRequest=`\n- `RelayState=`\n\nIf ANY of these appear → the repo exists and is accessible, it just needs authentication. This is NOT "inaccessible" — follow the Strategy Ladder.\n\n### Recovery: Authenticated API Reads\n\nWhen `web_fetch` fails on a private repo URL, switch to authenticated `http` calls:\n\n1. **Ensure auth is established first** — walk the Strategy Ladder (Steps 1-4) to get working credentials.\n2. **Use the platform API with auth headers**, not raw/web URLs:\n\n| Platform | Authenticated file-read endpoint | Auth header |\n|---|---|---|\n| GitHub / GHE | `http GET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}` | `Authorization: token <PAT>` or use `gh api` |\n| GitLab | `http GET https://gitlab.com/api/v4/projects/{id}/repository/files/{path}/raw?ref={branch}` | `PRIVATE-TOKEN: <PAT>` |\n| Azure DevOps | `http GET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0` | `Authorization: Basic <base64(:PAT)>` |\n| Bitbucket | `http GET https://api.bitbucket.org/2.0/repositories/{owner}/{repo}/src/{ref}/{path}` | `Authorization: Bearer <token>` |\n\n3. **Prefer `http` over `web_fetch`** for private repos — `http` sends proper headers and returns machine-readable JSON; `web_fetch` gets HTML login pages.\n4. **For bulk reads**, prefer `git clone --depth 1` over many individual API calls — it\'s faster and avoids rate limits.\n5. **NEVER embed tokens in URLs** — use auth headers via the `http` tool or `gh api` CLI wrapper.\n\n### Quick Decision: Clone vs API Read\n\n| Situation | Preferred method |\n|---|---|\n| Need 1-3 specific files | Authenticated API via `http` |\n| Need to browse/search the repo | `git clone --depth 1` (shallow) |\n| Need file history or blame | `git clone` |\n| No terminal available | Authenticated API via `http` with PAT |\n| Rate-limited on API | `git clone --depth 1` |\n\n## Tool Routing\n\n| Tool | Use |\n| --- | --- |\n| `git_context` | Check local repo state and confirm a clone or fallback checkout is usable |\n| `http` | Probe platform APIs for auth diagnostics AND read file contents from private repos with auth headers |\n| `web_fetch` | Only for public repos or after confirming access works; unreliable for private repos (returns HTML, not code) |\n| `web_search` | Find current platform-specific auth documentation when the host is unusual or self-managed |\n| Terminal | Run git commands, SSH tests, CLI auth flows, and credential-helper setup |\n\nFor detailed error patterns, read `references/error-patterns.md`.\n\n## CRITICAL: The GitHub 404 Trap\n\nGitHub commonly returns `404 Not Found` for private repositories when the caller is unauthenticated or under-authenticated. NEVER conclude that a GitHub repository does not exist from a `404` alone. Treat that response as an authentication signal first, then walk the ladder before declaring the repo missing.'}],"requirements-clarity":[{file:`SKILL.md`,content:`---
9587
7874
  name: requirements-clarity
9588
7875
  description: Clarify ambiguous requirements through focused dialogue before implementation. Use when requirements are unclear, features are complex (>2 days), or involve cross-team coordination. Ask two core questions - Why? (YAGNI check) and Simpler? (KISS check) - to ensure clarity before coding.
9589
7876
  metadata:
@@ -9916,10 +8203,7 @@ Use \`create_file\` to save this file. Derive \`{version}\` from the document ve
9916
8203
  - Execution phases actionable with concrete tasks
9917
8204
  - User approves final PRD
9918
8205
  - Ready for development handoff
9919
- ` },
9920
- ],
9921
- "session-handoff": [
9922
- { file: "references/handoff-template.md", content: `# Handoff Template
8206
+ `}],"session-handoff":[{file:`references/handoff-template.md`,content:`# Handoff Template
9923
8207
 
9924
8208
  Use this template structure when creating handoff documents. The smart scaffold script will pre-fill metadata sections; complete the remaining sections based on session context.
9925
8209
 
@@ -10058,8 +8342,7 @@ When filling this template:
10058
8342
  3. Prioritize the "Important Context" and "Immediate Next Steps" sections
10059
8343
  4. Don't include sensitive data (API keys, passwords, tokens)
10060
8344
  5. Focus on WHAT and WHY, not just WHAT - rationale is crucial for handoffs
10061
- ` },
10062
- { file: "references/resume-checklist.md", content: `# Resume Checklist
8345
+ `},{file:`references/resume-checklist.md`,content:`# Resume Checklist
10063
8346
 
10064
8347
  Follow this checklist when resuming work from a handoff document to ensure zero-ambiguity continuation.
10065
8348
 
@@ -10139,8 +8422,7 @@ Rate the handoff quality to identify if more exploration is needed:
10139
8422
  | Context | Complete picture | Gaps or assumptions |
10140
8423
 
10141
8424
  If multiple aspects "Need Exploration", spend time re-exploring the codebase before continuing implementation.
10142
- ` },
10143
- { file: "scripts/check_staleness.js", content: `#!/usr/bin/env node
8425
+ `},{file:`scripts/check_staleness.js`,content:`#!/usr/bin/env node
10144
8426
  /**
10145
8427
  * Check staleness of a handoff document compared to current project state.
10146
8428
  *
@@ -10409,8 +8691,7 @@ if (args.includes('--json')) {
10409
8691
  const result = checkStaleness(args[0]);
10410
8692
  printReport(result);
10411
8693
  }
10412
- ` },
10413
- { file: "scripts/create_handoff.js", content: `#!/usr/bin/env node
8694
+ `},{file:`scripts/create_handoff.js`,content:`#!/usr/bin/env node
10414
8695
  /**
10415
8696
  * Smart scaffold generator for handoff documents.
10416
8697
  *
@@ -10709,8 +8990,7 @@ const { filepath } = generateHandoff(cwd, slug, continuesFrom);
10709
8990
  console.log(\`Created handoff: \${filepath}\`);
10710
8991
  console.log(\`\\nNext: Open the file and fill in all [TODO: ...] sections.\`);
10711
8992
  console.log(\`Then validate: node scripts/validate_handoff.js \${filepath}\`);
10712
- ` },
10713
- { file: "scripts/list_handoffs.js", content: `#!/usr/bin/env node
8993
+ `},{file:`scripts/list_handoffs.js`,content:`#!/usr/bin/env node
10714
8994
  /**
10715
8995
  * List available handoff documents in the current project.
10716
8996
  *
@@ -10823,8 +9103,7 @@ for (const h of handoffs) {
10823
9103
  if (args.includes('--json')) {
10824
9104
  console.log(\`\\n\${JSON.stringify(handoffs, null, 2)}\`);
10825
9105
  }
10826
- ` },
10827
- { file: "scripts/validate_handoff.js", content: `#!/usr/bin/env node
9106
+ `},{file:`scripts/validate_handoff.js`,content:`#!/usr/bin/env node
10828
9107
  /**
10829
9108
  * Validate a handoff document for completeness and quality.
10830
9109
  *
@@ -11065,8 +9344,7 @@ if (args.includes('--json')) {
11065
9344
  const result = validateHandoff(args[0]);
11066
9345
  printReport(result);
11067
9346
  }
11068
- ` },
11069
- { file: "SKILL.md", content: `---
9347
+ `},{file:`SKILL.md`,content:`---
11070
9348
  name: session-handoff
11071
9349
  description: "Creates comprehensive handoff documents for seamless AI agent session transfers. Triggered when: (1) user requests handoff/memory/context save, (2) context window approaches capacity, (3) major task milestone completed, (4) work session ending, (5) user says 'save state', 'create handoff', 'I need to pause', 'context is getting full', (6) resuming work with 'load handoff', 'resume from', 'continue where we left off'. Proactively suggests handoffs after substantial work (multiple file edits, complex debugging, architecture decisions). Solves long-running agent context exhaustion by enabling fresh agents to continue with zero ambiguity."
11072
9350
  metadata:
@@ -11265,10 +9543,7 @@ Example: \`2024-01-15-143022-implementing-auth.md\`
11265
9543
 
11266
9544
  - [handoff-template.md](references/handoff-template.md) - Complete template structure with guidance
11267
9545
  - [resume-checklist.md](references/resume-checklist.md) - Verification checklist for resuming agents
11268
- ` },
11269
- ],
11270
- "typescript": [
11271
- { file: "SKILL.md", content: `---
9546
+ `}],typescript:[{file:`SKILL.md`,content:`---
11272
9547
  name: typescript
11273
9548
  description: "Comprehensive TypeScript development patterns — type system performance, compiler configuration, advanced types, type safety, async patterns, module organization, and runtime optimization."
11274
9549
  metadata:
@@ -11673,6 +9948,4 @@ When writing TypeScript:
11673
9948
  5. **Import style?** → \`import type\` for types. Direct imports, not barrel files. Named exports, not default.
11674
9949
  6. **Error handling?** → Result pattern for expected errors. throw for unexpected/programmer errors.
11675
9950
  7. **Async?** → Promise.all for parallel. AbortController for timeouts. AsyncGenerator for streams.
11676
- ` },
11677
- ],
11678
- };
9951
+ `}]};export{e as SKILLS};