@vpxa/aikit 0.1.1 → 0.1.2

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 (140) hide show
  1. package/README.md +8 -8
  2. package/package.json +1 -1
  3. package/packages/aikit-client/dist/types.d.ts +3 -3
  4. package/packages/cli/dist/aikit-init.d.ts +1 -1
  5. package/packages/cli/dist/aikit-init.js +1 -1
  6. package/packages/cli/dist/commands/context-cmds.js +1 -1
  7. package/packages/cli/dist/commands/environment.js +1 -1
  8. package/packages/cli/dist/commands/init/config.d.ts +1 -1
  9. package/packages/cli/dist/commands/init/config.js +2 -2
  10. package/packages/cli/dist/commands/init/constants.d.ts +3 -3
  11. package/packages/cli/dist/commands/init/index.d.ts +4 -4
  12. package/packages/cli/dist/commands/init/index.js +4 -4
  13. package/packages/cli/dist/commands/init/templates.js +12 -12
  14. package/packages/cli/dist/commands/init/user.d.ts +3 -3
  15. package/packages/cli/dist/commands/init/user.js +2 -2
  16. package/packages/cli/dist/commands/search.js +1 -1
  17. package/packages/cli/dist/commands/system.js +4 -4
  18. package/packages/cli/dist/commands/upgrade.js +1 -1
  19. package/packages/cli/dist/commands/workspace.js +1 -1
  20. package/packages/cli/dist/helpers.js +1 -1
  21. package/packages/cli/dist/index.d.ts +1 -1
  22. package/packages/core/dist/constants.d.ts +3 -3
  23. package/packages/core/dist/global-registry.d.ts +7 -1
  24. package/packages/core/dist/global-registry.js +1 -1
  25. package/packages/core/dist/index.d.ts +2 -2
  26. package/packages/core/dist/index.js +1 -1
  27. package/packages/core/dist/types.d.ts +4 -2
  28. package/packages/dashboard/dist/assets/{index-BjA4YODs.js → index-CO2S9BKY.js} +2 -2
  29. package/packages/dashboard/dist/assets/index-CO2S9BKY.js.map +1 -0
  30. package/packages/dashboard/dist/index.html +2 -2
  31. package/packages/enterprise-bridge/dist/er-client.d.ts +1 -1
  32. package/packages/indexer/dist/incremental-indexer.js +1 -1
  33. package/packages/kb-client/dist/__tests__/direct-client.test.d.ts +1 -0
  34. package/packages/kb-client/dist/__tests__/mcp-client.test.d.ts +1 -0
  35. package/packages/kb-client/dist/__tests__/parsers.test.d.ts +1 -0
  36. package/packages/kb-client/dist/direct-client.d.ts +38 -0
  37. package/packages/kb-client/dist/direct-client.js +1 -0
  38. package/packages/kb-client/dist/index.d.ts +4 -0
  39. package/packages/kb-client/dist/index.js +1 -0
  40. package/packages/kb-client/dist/mcp-client.d.ts +19 -0
  41. package/packages/kb-client/dist/mcp-client.js +4 -0
  42. package/packages/kb-client/dist/parsers.d.ts +32 -0
  43. package/packages/kb-client/dist/parsers.js +2 -0
  44. package/packages/kb-client/dist/types.d.ts +59 -0
  45. package/packages/kb-client/dist/types.js +1 -0
  46. package/packages/present/dist/index.html +3 -3
  47. package/packages/server/dist/background-task.d.ts +47 -0
  48. package/packages/server/dist/background-task.js +1 -0
  49. package/packages/server/dist/config.js +1 -1
  50. package/packages/server/dist/idle-timer.d.ts +29 -0
  51. package/packages/server/dist/idle-timer.js +1 -0
  52. package/packages/server/dist/index.js +1 -1
  53. package/packages/server/dist/memory-monitor.d.ts +37 -0
  54. package/packages/server/dist/memory-monitor.js +1 -0
  55. package/packages/server/dist/prompts.js +5 -5
  56. package/packages/server/dist/resource-links.d.ts +1 -1
  57. package/packages/server/dist/resource-links.js +1 -1
  58. package/packages/server/dist/resources/curated-resources.d.ts +2 -2
  59. package/packages/server/dist/resources/curated-resources.js +2 -2
  60. package/packages/server/dist/resources/resource-notifier.d.ts +1 -1
  61. package/packages/server/dist/resources/resource-notifier.js +1 -1
  62. package/packages/server/dist/resources/resources.js +1 -1
  63. package/packages/server/dist/server.d.ts +3 -1
  64. package/packages/server/dist/server.js +3 -3
  65. package/packages/server/dist/tool-metadata.d.ts +1 -1
  66. package/packages/server/dist/tool-metadata.js +1 -1
  67. package/packages/server/dist/tool-timeout.d.ts +27 -0
  68. package/packages/server/dist/tool-timeout.js +1 -0
  69. package/packages/server/dist/tools/bridge.tools.d.ts +1 -1
  70. package/packages/server/dist/tools/bridge.tools.js +3 -3
  71. package/packages/server/dist/tools/evolution.tools.js +1 -1
  72. package/packages/server/dist/tools/infra.tools.js +1 -1
  73. package/packages/server/dist/tools/onboard.tool.js +1 -1
  74. package/packages/server/dist/tools/present/browser.js +4 -4
  75. package/packages/server/dist/tools/present/tool.js +1 -1
  76. package/packages/server/dist/tools/reindex.tool.js +1 -1
  77. package/packages/server/dist/tools/search.tool.js +1 -1
  78. package/packages/server/dist/tools/status.tool.d.ts +1 -1
  79. package/packages/server/dist/tools/status.tool.js +2 -2
  80. package/packages/tools/dist/checkpoint.js +1 -1
  81. package/packages/tools/dist/config-extractor.js +1 -1
  82. package/packages/tools/dist/evidence-map.js +2 -2
  83. package/packages/tools/dist/find.d.ts +1 -1
  84. package/packages/tools/dist/forge-ground.d.ts +1 -1
  85. package/packages/tools/dist/guide.js +1 -1
  86. package/packages/tools/dist/lane.js +1 -1
  87. package/packages/tools/dist/onboard.d.ts +2 -2
  88. package/packages/tools/dist/onboard.js +2 -2
  89. package/packages/tools/dist/queue.js +1 -1
  90. package/packages/tools/dist/replay.js +1 -1
  91. package/packages/tools/dist/response-envelope.d.ts +1 -1
  92. package/packages/tools/dist/snippet.js +1 -1
  93. package/packages/tools/dist/stash.js +1 -1
  94. package/packages/tools/dist/synthesis-engine.js +2 -2
  95. package/packages/tools/dist/workset.js +1 -1
  96. package/packages/tui/dist/{App-DU2KEylW.js → App-B2-KJPt4.js} +1 -1
  97. package/packages/tui/dist/App.d.ts +1 -1
  98. package/packages/tui/dist/App.js +1 -1
  99. package/packages/tui/dist/LogPanel-E_1Do4-j.js +3 -0
  100. package/packages/tui/dist/hooks/useKBClient.d.ts +1 -1
  101. package/packages/tui/dist/{index-BXafekwr.d.ts → index-MXJeXmCf.d.ts} +3 -3
  102. package/packages/tui/dist/index.d.ts +1 -1
  103. package/packages/tui/dist/index.js +1 -1
  104. package/packages/tui/dist/panels/LogPanel.js +1 -1
  105. package/scaffold/README.md +192 -192
  106. package/scaffold/definitions/bodies.mjs +16 -16
  107. package/scaffold/definitions/plugins.mjs +1 -1
  108. package/scaffold/definitions/prompts.mjs +6 -6
  109. package/scaffold/definitions/protocols.mjs +12 -12
  110. package/scaffold/definitions/tools.mjs +1 -1
  111. package/scaffold/flows/aikit-advanced/skills/execute/SKILL.md +124 -124
  112. package/scaffold/flows/aikit-advanced/skills/plan/SKILL.md +100 -100
  113. package/scaffold/flows/aikit-advanced/skills/spec/SKILL.md +100 -100
  114. package/scaffold/flows/aikit-advanced/skills/task/SKILL.md +99 -99
  115. package/scaffold/flows/aikit-advanced/skills/verify/SKILL.md +122 -122
  116. package/scaffold/flows/aikit-basic/skills/assess/SKILL.md +82 -82
  117. package/scaffold/flows/aikit-basic/skills/implement/SKILL.md +105 -105
  118. package/scaffold/flows/aikit-basic/skills/verify/SKILL.md +96 -96
  119. package/scaffold/general/agents/Debugger.agent.md +2 -2
  120. package/scaffold/general/agents/Documenter.agent.md +2 -2
  121. package/scaffold/general/agents/Explorer.agent.md +2 -2
  122. package/scaffold/general/agents/Frontend.agent.md +1 -1
  123. package/scaffold/general/agents/Implementer.agent.md +2 -2
  124. package/scaffold/general/agents/Orchestrator.agent.md +1 -1
  125. package/scaffold/general/agents/Planner.agent.md +2 -2
  126. package/scaffold/general/agents/Refactor.agent.md +2 -2
  127. package/scaffold/general/agents/Security.agent.md +2 -2
  128. package/scaffold/general/agents/_shared/architect-reviewer-base.md +1 -1
  129. package/scaffold/general/agents/_shared/code-agent-base.md +6 -6
  130. package/scaffold/general/agents/_shared/code-reviewer-base.md +1 -1
  131. package/scaffold/general/agents/_shared/forge-protocol.md +1 -1
  132. package/scaffold/general/agents/_shared/researcher-base.md +3 -3
  133. package/scaffold/general/prompts/ask.prompt.md +4 -4
  134. package/scaffold/general/prompts/debug.prompt.md +1 -1
  135. package/scaffold/general/prompts/plan.prompt.md +1 -1
  136. package/scaffold/general/skills/aikit/SKILL.md +5 -5
  137. package/scaffold/general/skills/multi-agents-development/SKILL.md +2 -2
  138. package/scaffold/general/skills/present/SKILL.md +1 -1
  139. package/packages/dashboard/dist/assets/index-BjA4YODs.js.map +0 -1
  140. package/packages/tui/dist/LogPanel-Bo8a8QXB.js +0 -3
@@ -1,192 +1,192 @@
1
- # Scaffold System — Contributor Guide
2
-
3
- > **⚠️ GOLDEN RULE: Never edit files in `scaffold/general/` or `scaffold/claude-code/` directly.**
4
- > They are **generated output** and will be overwritten by `generate.mjs`.
5
- > Always edit the **source files** in `scaffold/definitions/`.
6
-
7
- ## Architecture
8
-
9
- ```
10
- scaffold/
11
- ├── definitions/ ← SOURCE OF TRUTH (edit here)
12
- │ ├── agents.mjs Agent metadata (name, description, model, tools, category)
13
- │ ├── bodies.mjs Agent body text (mode instructions per agent)
14
- │ ├── models.mjs Available models per IDE
15
- │ ├── protocols.mjs Shared protocol files (_shared/*.md) + templates
16
- │ ├── tools.mjs Tool capability → IDE tool mappings
17
- │ ├── prompts.mjs Prompt file content
18
- │ ├── hooks.mjs Hook definitions
19
- │ └── plugins.mjs Plugin definitions
20
-
21
- ├── adapters/ ← IDE-specific generators
22
- │ ├── copilot.mjs GitHub Copilot adapter (active — generates ~32 files)
23
- │ └── claude-code.mjs Claude Code adapter (stub — no output yet)
24
-
25
- ├── generate.mjs ← BUILD SCRIPT (run after any change)
26
-
27
- ├── general/ ← GENERATED OUTPUT for Copilot (DO NOT EDIT)
28
- │ ├── agents/
29
- │ │ ├── _shared/ Protocol files (from PROTOCOLS in protocols.mjs)
30
- │ │ ├── templates/ Template files (from TEMPLATES in protocols.mjs)
31
- │ │ └── *.agent.md Agent files (from AGENT_BODIES in bodies.mjs)
32
- │ └── prompts/ Prompt files (from PROMPTS in prompts.mjs)
33
-
34
- └── claude-code/ ← GENERATED OUTPUT for Claude Code (stub, DO NOT EDIT)
35
- ```
36
-
37
- ### Data Flow
38
-
39
- ```
40
- definitions/*.mjs → generate.mjs → scaffold/general/ → aikit init → .github/ (user project)
41
- (source) (build script) (generated output) (deploy) (user workspace)
42
- ```
43
-
44
- ## How to Make Changes
45
-
46
- ### Step 1: Edit Source Files
47
-
48
- | What you want to change | Edit this file |
49
- |--------------------------|---------------|
50
- | An agent's body/instructions | `definitions/bodies.mjs` → `AGENT_BODIES[agentName]` |
51
- | Shared rules for code agents | `definitions/protocols.mjs` → `PROTOCOLS['code-agent-base']` |
52
- | Shared rules for researchers | `definitions/protocols.mjs` → `PROTOCOLS['researcher-base']` |
53
- | Agent metadata (model, tools) | `definitions/agents.mjs` → `AGENTS[agentName]` |
54
- | Available models | `definitions/models.mjs` |
55
- | Tool mappings | `definitions/tools.mjs` |
56
- | Prompt files | `definitions/prompts.mjs` |
57
-
58
- ### Step 2: Regenerate Output
59
-
60
- ```bash
61
- node scaffold/generate.mjs
62
- ```
63
-
64
- This will:
65
- 1. Clean `general/agents/` and `general/prompts/` directories
66
- 2. Regenerate all files from definitions via the copilot adapter
67
- 3. Print every file written (expect ~32 files)
68
-
69
- To generate for a specific IDE only:
70
- ```bash
71
- node scaffold/generate.mjs --ide copilot
72
- node scaffold/generate.mjs --ide claude-code
73
- ```
74
-
75
- ### Step 3: Verify
76
-
77
- ```bash
78
- # Syntax check the source file you edited
79
- node -c scaffold/definitions/bodies.mjs
80
- node -c scaffold/definitions/protocols.mjs
81
-
82
- # Verify your changes appear in generated output
83
- # (use grep/Select-String for key phrases)
84
- grep -r "your key phrase" scaffold/general/agents/
85
- ```
86
-
87
- ### Step 4: Commit Both Source AND Generated
88
-
89
- Always commit the definition source files AND the regenerated output together.
90
- The generated files are checked into git so `aikit init` can deploy them without
91
- running the generator.
92
-
93
- ## Source File Details
94
-
95
- ### bodies.mjs
96
-
97
- Contains `AGENT_BODIES` — an object mapping agent names to their body text.
98
-
99
- - Most values are **template literal strings** (`` `...` ``)
100
- - The **Orchestrator** body is a **function** `(agentTable) => string` because it
101
- dynamically includes the agent roster table
102
- - Backticks inside content must be escaped: `` \` ``
103
-
104
- ```js
105
- export const AGENT_BODIES = {
106
- Orchestrator: (agentTable) => `# Orchestrator\n${agentTable}\n...`,
107
- Implementer: `# Implementer\n...`,
108
- Debugger: `# Debugger\n...`,
109
- // ...
110
- };
111
- ```
112
-
113
- ### protocols.mjs
114
-
115
- Contains `PROTOCOLS` and `TEMPLATES` — objects mapping names to markdown content.
116
-
117
- - Each `PROTOCOLS` key becomes a file in `_shared/`:
118
- - `'code-agent-base'` → `agents/_shared/code-agent-base.md`
119
- - `'researcher-base'` → `agents/_shared/researcher-base.md`
120
- - `'decision-protocol'` → `agents/_shared/decision-protocol.md`
121
- - etc.
122
- - Each `TEMPLATES` key becomes a file in `templates/`
123
- - All values are template literals — escape backticks as `` \` ``
124
-
125
- **Protocol → Agent mapping:**
126
-
127
- | Protocol | Used by |
128
- |----------|---------|
129
- | `code-agent-base` | Implementer, Frontend, Refactor, Debugger |
130
- | `researcher-base` | Researcher-Alpha/Beta/Gamma/Delta |
131
- | `code-reviewer-base` | Code-Reviewer-Alpha/Beta |
132
- | `architect-reviewer-base` | Architect-Reviewer-Alpha/Beta |
133
- | `decision-protocol` | Referenced by Orchestrator workflow |
134
- | `forge-protocol` | Referenced by code-agent-base |
135
-
136
- ### agents.mjs
137
-
138
- Defines every agent's metadata:
139
- - `description`, `argumentHint` — displayed in the agent picker
140
- - `model` — which LLM model to use
141
- - `tools` — abstract capability list (mapped to IDE-specific tools by the adapter)
142
- - `category` — orchestration, implementation, diagnostics, research, review, etc.
143
- - `sharedBase` — for variant agents (e.g., Researcher-Alpha uses `researcher-base`)
144
-
145
- ## How Users Receive Changes
146
-
147
- When users run `aikit init`, the scaffold files are deployed to their `.github/` directory.
148
-
149
- ### First Install (Legacy Path)
150
-
151
- `copyDirectoryRecursive()` — copies all scaffold files, **skips existing** files.
152
- No tracking, no merging.
153
-
154
- ### Updates (Smart Path)
155
-
156
- `smartCopyScaffold()` — manifest-based with `.aikit-scaffold.json`:
157
-
158
- | File Status | Strategy | Behavior |
159
- |-------------|----------|----------|
160
- | `new` (not in manifest, not on disk) | deploy | Copy file, record hash |
161
- | `new` (not in manifest, exists on disk) | record | Record hash only (preserve user edits) |
162
- | `outdated` (source hash changed) | `merge-frontmatter` | **Agent files**: update body, union tools, keep user's model choice |
163
- | `outdated` (source hash changed) | `overwrite` | **Protocol/shared files**: replace entirely |
164
- | `current` (unchanged) | skip | No action |
165
-
166
- The update strategy is determined by `getUpdateStrategy(relPath)` based on the file path.
167
-
168
- **Key implication**: When you update an agent body in `bodies.mjs`, existing users will
169
- get the updated body text while preserving their custom model choice and any extra tools
170
- they added. Protocol files (`_shared/*.md`) are fully replaced.
171
-
172
- ## Common Mistakes
173
-
174
- | Mistake | Why it's wrong | What to do instead |
175
- |---------|---------------|-------------------|
176
- | Editing `.agent.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `bodies.mjs` for agent bodies |
177
- | Editing `_shared/*.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `protocols.mjs` PROTOCOLS constant |
178
- | Forgetting to run `generate.mjs` | Generated files will be stale, `aikit init` deploys stale files | Always run after editing definitions |
179
- | Committing only source OR only generated | Source and output will be out of sync | Commit both together |
180
- | Unescaped backticks in template literals | JS syntax error in definitions | Use `` \` `` inside template literal strings |
181
-
182
- ## PR Checklist
183
-
184
- - [ ] Changes made in `scaffold/definitions/*.mjs` (NOT in generated output)
185
- - [ ] `node -c scaffold/definitions/<changed-file>.mjs` passes (syntax check)
186
- - [ ] `node scaffold/generate.mjs` runs without errors
187
- - [ ] Generated output contains expected changes (verified with grep)
188
- - [ ] Both source and generated files included in commit
189
- - [ ] If adding a new agent: entry in `agents.mjs` + body in `bodies.mjs`
190
- - [ ] If adding a new protocol: entry in `protocols.mjs` + reference in relevant agent bodies
191
- - [ ] If adding a new file type: check `getUpdateStrategy()` returns correct merge strategy
192
- - [ ] Consider impact on existing user installations (will merge preserve their customizations?)
1
+ # Scaffold System — Contributor Guide
2
+
3
+ > **⚠️ GOLDEN RULE: Never edit files in `scaffold/general/` or `scaffold/claude-code/` directly.**
4
+ > They are **generated output** and will be overwritten by `generate.mjs`.
5
+ > Always edit the **source files** in `scaffold/definitions/`.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ scaffold/
11
+ ├── definitions/ ← SOURCE OF TRUTH (edit here)
12
+ │ ├── agents.mjs Agent metadata (name, description, model, tools, category)
13
+ │ ├── bodies.mjs Agent body text (mode instructions per agent)
14
+ │ ├── models.mjs Available models per IDE
15
+ │ ├── protocols.mjs Shared protocol files (_shared/*.md) + templates
16
+ │ ├── tools.mjs Tool capability → IDE tool mappings
17
+ │ ├── prompts.mjs Prompt file content
18
+ │ ├── hooks.mjs Hook definitions
19
+ │ └── plugins.mjs Plugin definitions
20
+
21
+ ├── adapters/ ← IDE-specific generators
22
+ │ ├── copilot.mjs GitHub Copilot adapter (active — generates ~32 files)
23
+ │ └── claude-code.mjs Claude Code adapter (stub — no output yet)
24
+
25
+ ├── generate.mjs ← BUILD SCRIPT (run after any change)
26
+
27
+ ├── general/ ← GENERATED OUTPUT for Copilot (DO NOT EDIT)
28
+ │ ├── agents/
29
+ │ │ ├── _shared/ Protocol files (from PROTOCOLS in protocols.mjs)
30
+ │ │ ├── templates/ Template files (from TEMPLATES in protocols.mjs)
31
+ │ │ └── *.agent.md Agent files (from AGENT_BODIES in bodies.mjs)
32
+ │ └── prompts/ Prompt files (from PROMPTS in prompts.mjs)
33
+
34
+ └── claude-code/ ← GENERATED OUTPUT for Claude Code (stub, DO NOT EDIT)
35
+ ```
36
+
37
+ ### Data Flow
38
+
39
+ ```
40
+ definitions/*.mjs → generate.mjs → scaffold/general/ → aikit init → .github/ (user project)
41
+ (source) (build script) (generated output) (deploy) (user workspace)
42
+ ```
43
+
44
+ ## How to Make Changes
45
+
46
+ ### Step 1: Edit Source Files
47
+
48
+ | What you want to change | Edit this file |
49
+ |--------------------------|---------------|
50
+ | An agent's body/instructions | `definitions/bodies.mjs` → `AGENT_BODIES[agentName]` |
51
+ | Shared rules for code agents | `definitions/protocols.mjs` → `PROTOCOLS['code-agent-base']` |
52
+ | Shared rules for researchers | `definitions/protocols.mjs` → `PROTOCOLS['researcher-base']` |
53
+ | Agent metadata (model, tools) | `definitions/agents.mjs` → `AGENTS[agentName]` |
54
+ | Available models | `definitions/models.mjs` |
55
+ | Tool mappings | `definitions/tools.mjs` |
56
+ | Prompt files | `definitions/prompts.mjs` |
57
+
58
+ ### Step 2: Regenerate Output
59
+
60
+ ```bash
61
+ node scaffold/generate.mjs
62
+ ```
63
+
64
+ This will:
65
+ 1. Clean `general/agents/` and `general/prompts/` directories
66
+ 2. Regenerate all files from definitions via the copilot adapter
67
+ 3. Print every file written (expect ~32 files)
68
+
69
+ To generate for a specific IDE only:
70
+ ```bash
71
+ node scaffold/generate.mjs --ide copilot
72
+ node scaffold/generate.mjs --ide claude-code
73
+ ```
74
+
75
+ ### Step 3: Verify
76
+
77
+ ```bash
78
+ # Syntax check the source file you edited
79
+ node -c scaffold/definitions/bodies.mjs
80
+ node -c scaffold/definitions/protocols.mjs
81
+
82
+ # Verify your changes appear in generated output
83
+ # (use grep/Select-String for key phrases)
84
+ grep -r "your key phrase" scaffold/general/agents/
85
+ ```
86
+
87
+ ### Step 4: Commit Both Source AND Generated
88
+
89
+ Always commit the definition source files AND the regenerated output together.
90
+ The generated files are checked into git so `aikit init` can deploy them without
91
+ running the generator.
92
+
93
+ ## Source File Details
94
+
95
+ ### bodies.mjs
96
+
97
+ Contains `AGENT_BODIES` — an object mapping agent names to their body text.
98
+
99
+ - Most values are **template literal strings** (`` `...` ``)
100
+ - The **Orchestrator** body is a **function** `(agentTable) => string` because it
101
+ dynamically includes the agent roster table
102
+ - Backticks inside content must be escaped: `` \` ``
103
+
104
+ ```js
105
+ export const AGENT_BODIES = {
106
+ Orchestrator: (agentTable) => `# Orchestrator\n${agentTable}\n...`,
107
+ Implementer: `# Implementer\n...`,
108
+ Debugger: `# Debugger\n...`,
109
+ // ...
110
+ };
111
+ ```
112
+
113
+ ### protocols.mjs
114
+
115
+ Contains `PROTOCOLS` and `TEMPLATES` — objects mapping names to markdown content.
116
+
117
+ - Each `PROTOCOLS` key becomes a file in `_shared/`:
118
+ - `'code-agent-base'` → `agents/_shared/code-agent-base.md`
119
+ - `'researcher-base'` → `agents/_shared/researcher-base.md`
120
+ - `'decision-protocol'` → `agents/_shared/decision-protocol.md`
121
+ - etc.
122
+ - Each `TEMPLATES` key becomes a file in `templates/`
123
+ - All values are template literals — escape backticks as `` \` ``
124
+
125
+ **Protocol → Agent mapping:**
126
+
127
+ | Protocol | Used by |
128
+ |----------|---------|
129
+ | `code-agent-base` | Implementer, Frontend, Refactor, Debugger |
130
+ | `researcher-base` | Researcher-Alpha/Beta/Gamma/Delta |
131
+ | `code-reviewer-base` | Code-Reviewer-Alpha/Beta |
132
+ | `architect-reviewer-base` | Architect-Reviewer-Alpha/Beta |
133
+ | `decision-protocol` | Referenced by Orchestrator workflow |
134
+ | `forge-protocol` | Referenced by code-agent-base |
135
+
136
+ ### agents.mjs
137
+
138
+ Defines every agent's metadata:
139
+ - `description`, `argumentHint` — displayed in the agent picker
140
+ - `model` — which LLM model to use
141
+ - `tools` — abstract capability list (mapped to IDE-specific tools by the adapter)
142
+ - `category` — orchestration, implementation, diagnostics, research, review, etc.
143
+ - `sharedBase` — for variant agents (e.g., Researcher-Alpha uses `researcher-base`)
144
+
145
+ ## How Users Receive Changes
146
+
147
+ When users run `aikit init`, the scaffold files are deployed to their `.github/` directory.
148
+
149
+ ### First Install (Legacy Path)
150
+
151
+ `copyDirectoryRecursive()` — copies all scaffold files, **skips existing** files.
152
+ No tracking, no merging.
153
+
154
+ ### Updates (Smart Path)
155
+
156
+ `smartCopyScaffold()` — manifest-based with `.aikit-scaffold.json`:
157
+
158
+ | File Status | Strategy | Behavior |
159
+ |-------------|----------|----------|
160
+ | `new` (not in manifest, not on disk) | deploy | Copy file, record hash |
161
+ | `new` (not in manifest, exists on disk) | record | Record hash only (preserve user edits) |
162
+ | `outdated` (source hash changed) | `merge-frontmatter` | **Agent files**: update body, union tools, keep user's model choice |
163
+ | `outdated` (source hash changed) | `overwrite` | **Protocol/shared files**: replace entirely |
164
+ | `current` (unchanged) | skip | No action |
165
+
166
+ The update strategy is determined by `getUpdateStrategy(relPath)` based on the file path.
167
+
168
+ **Key implication**: When you update an agent body in `bodies.mjs`, existing users will
169
+ get the updated body text while preserving their custom model choice and any extra tools
170
+ they added. Protocol files (`_shared/*.md`) are fully replaced.
171
+
172
+ ## Common Mistakes
173
+
174
+ | Mistake | Why it's wrong | What to do instead |
175
+ |---------|---------------|-------------------|
176
+ | Editing `.agent.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `bodies.mjs` for agent bodies |
177
+ | Editing `_shared/*.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `protocols.mjs` PROTOCOLS constant |
178
+ | Forgetting to run `generate.mjs` | Generated files will be stale, `aikit init` deploys stale files | Always run after editing definitions |
179
+ | Committing only source OR only generated | Source and output will be out of sync | Commit both together |
180
+ | Unescaped backticks in template literals | JS syntax error in definitions | Use `` \` `` inside template literal strings |
181
+
182
+ ## PR Checklist
183
+
184
+ - [ ] Changes made in `scaffold/definitions/*.mjs` (NOT in generated output)
185
+ - [ ] `node -c scaffold/definitions/<changed-file>.mjs` passes (syntax check)
186
+ - [ ] `node scaffold/generate.mjs` runs without errors
187
+ - [ ] Generated output contains expected changes (verified with grep)
188
+ - [ ] Both source and generated files included in commit
189
+ - [ ] If adding a new agent: entry in `agents.mjs` + body in `bodies.mjs`
190
+ - [ ] If adding a new protocol: entry in `protocols.mjs` + reference in relevant agent bodies
191
+ - [ ] If adding a new file type: check `getUpdateStrategy()` returns correct merge strategy
192
+ - [ ] Consider impact on existing user installations (will merge preserve their customizations?)
@@ -117,7 +117,7 @@ Batch 2 (after batch 1):
117
117
  2. **Break tasks small** — 1-3 files per dispatch, clear scope, clear acceptance criteria
118
118
  3. **Maximize parallelism** — independent tasks MUST run as parallel \`runSubagent\` calls in the SAME function block. Sequential dispatch of parallelizable tasks is a protocol violation.
119
119
  4. **Fresh context per subagent** — paste relevant code, don't reference conversation history
120
- 5. **Search KB before planning** — check past decisions with \`search()\`
120
+ 5. **Search AI Kit before planning** — check past decisions with \`search()\`
121
121
  6. **Route correctly** — brainstorming for design, decision protocol for tech choices
122
122
  7. **Never proceed without user approval** at 🛑 stops
123
123
  8. **Max 2 retries** then escalate to user
@@ -182,7 +182,7 @@ At session start, check for an active flow:
182
182
  | \`flow_status\` | Check current execution state |
183
183
  | \`flow_reset\` | Clear flow state to start over |`,
184
184
 
185
- Planner: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
185
+ Planner: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
186
186
 
187
187
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
188
188
 
@@ -199,7 +199,7 @@ At session start, check for an active flow:
199
199
 
200
200
  ## Planning Workflow
201
201
 
202
- 1. **KB Recall** — Search for past plans, architecture decisions, known patterns. Check \`list()\` for stored knowledge.
202
+ 1. **AI Kit Recall** — Search for past plans, architecture decisions, known patterns. Check \`list()\` for stored knowledge.
203
203
  2. **FORGE Classify** — \`forge_classify({ task, files, root_path: "." })\` to determine complexity tier
204
204
  3. **FORGE Ground** — \`forge_ground\` to scope map, seed unknowns, load constraints
205
205
  4. **Research** — Delegate to Explorer and Researcher agents to gather context
@@ -252,7 +252,7 @@ At session start, check for an active flow:
252
252
  | \`adr-skill\` | When the plan involves non-trivial technical decisions — create executable ADRs |
253
253
  | \`session-handoff\` | When context window is filling up, planning session ending, or major milestone completed |`,
254
254
 
255
- Implementer: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
255
+ Implementer: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
256
256
 
257
257
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
258
258
 
@@ -269,13 +269,13 @@ At session start, check for an active flow:
269
269
 
270
270
  - **Test-first always** — No implementation without a failing test
271
271
  - **Minimal code** — Don't build what isn't asked for
272
- - **Follow existing patterns** — Search KB for conventions before creating new ones
272
+ - **Follow existing patterns** — Search AI Kit for conventions before creating new ones
273
273
  - **Never modify tests to make them pass** — Fix the implementation instead
274
274
  - **Run \`check\` after every change** — Catch errors early
275
275
  - **Loop-break** — If the same test fails 3 times with the same error after your fixes, STOP. Re-read the error from scratch, check your assumptions with \`trace\` or \`symbol\`, and try a fundamentally different approach. Do not attempt a 4th fix in the same direction
276
276
  - **Think-first for complex tasks** — If a task involves 3+ files or non-obvious logic, outline your approach before writing code. Check existing patterns with \`search\` first. Design, then implement`,
277
277
 
278
- Frontend: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
278
+ Frontend: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
279
279
 
280
280
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
281
281
 
@@ -294,13 +294,13 @@ At session start, check for an active flow:
294
294
  - **Responsive by default** — Mobile-first, test all breakpoints
295
295
  - **Test-first** — Component tests before implementation`,
296
296
 
297
- Debugger: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
297
+ Debugger: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
298
298
 
299
299
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
300
300
 
301
301
  ## Debugging Protocol
302
302
 
303
- 1. **KB Recall** — Search for known issues matching this error pattern
303
+ 1. **AI Kit Recall** — Search for known issues matching this error pattern
304
304
  2. **Reproduce** — Confirm the error, use \`parse_output\` on stack traces and build errors for structured analysis
305
305
  3. **Verify targets exist** — Before tracing, confirm the files and functions mentioned in the error actually exist. Use \`find\` or \`symbol\` to verify paths and signatures. **Never trace into a file you haven't confirmed exists**
306
306
  4. **Trace** — \`symbol\`, \`trace\`, follow call chains backwards
@@ -318,13 +318,13 @@ At session start, check for an active flow:
318
318
  - **Verify before asserting** — Don't claim a function has a certain signature without checking via \`symbol\`. Don't reference a config option without confirming it exists in the codebase
319
319
  - **Break debug loops** — If you apply a fix, test, and get the same error 3 times: your hypothesis is wrong. STOP, discard your current theory, re-examine the error output and trace from a different entry point. Return \`ESCALATE\` if a fresh approach also fails`,
320
320
 
321
- Refactor: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
321
+ Refactor: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
322
322
 
323
323
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
324
324
 
325
325
  ## Refactoring Protocol
326
326
 
327
- 1. **KB Recall** — Search for established patterns and conventions
327
+ 1. **AI Kit Recall** — Search for established patterns and conventions
328
328
  2. **Analyze** — \`analyze_structure\`, \`analyze_patterns\`, \`dead_symbols\`
329
329
  3. **Ensure test coverage** — Run existing tests, add coverage for untested paths
330
330
  4. **Refactor in small steps** — Each step must keep tests green
@@ -344,7 +344,7 @@ At session start, check for an active flow:
344
344
  |-------|--------------|
345
345
  | \`lesson-learned\` | After completing a refactor — extract principles from the before/after diff |`,
346
346
 
347
- Security: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
347
+ Security: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
348
348
 
349
349
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
350
350
 
@@ -359,7 +359,7 @@ At session start, check for an active flow:
359
359
 
360
360
  ## Security Review Protocol
361
361
 
362
- 1. **KB Recall** — \`search("security findings <area>")\` + \`list()\` for past security decisions and known issues
362
+ 1. **AI Kit Recall** — \`search("security findings <area>")\` + \`list()\` for past security decisions and known issues
363
363
  2. **Audit** — Run \`audit\` for a comprehensive project health check, then \`find\` for specific vulnerability patterns
364
364
  3. **OWASP Top 10 Scan** — Check each category systematically
365
365
  4. **Dependency Audit** — Check for known CVEs in dependencies
@@ -389,7 +389,7 @@ At session start, check for an active flow:
389
389
  1. **[SEVERITY]** Title — Description, file:line, remediation
390
390
  \`\`\``,
391
391
 
392
- Documenter: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
392
+ Documenter: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
393
393
 
394
394
  **Read _shared/code-agent-base.md NOW** — it contains the Information Lookup Order, FORGE, and handoff protocols.
395
395
 
@@ -404,7 +404,7 @@ At session start, check for an active flow:
404
404
 
405
405
  ## Documentation Protocol
406
406
 
407
- 1. **KB Recall** — \`search("documentation <area>")\` + \`list()\` for existing docs, conventions, architecture decisions
407
+ 1. **AI Kit Recall** — \`search("documentation <area>")\` + \`list()\` for existing docs, conventions, architecture decisions
408
408
  2. **Analyze** — \`analyze_structure\`, \`analyze_entry_points\`, \`file_summary\`
409
409
  3. **Draft** — Write documentation following project conventions
410
410
  4. **Cross-reference** — Link to related docs, ensure consistency
@@ -432,7 +432,7 @@ At session start, check for an active flow:
432
432
  | \`c4-architecture\` | When documenting system architecture — generate C4 Mermaid diagrams |
433
433
  | \`adr-skill\` | When documenting architecture decisions — create or update ADRs |`,
434
434
 
435
- Explorer: `**Read \`AGENTS.md\`** in the workspace root for project conventions and KB protocol.
435
+ Explorer: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
436
436
 
437
437
  ## MANDATORY FIRST ACTION
438
438
 
@@ -448,7 +448,7 @@ At session start, check for an active flow:
448
448
 
449
449
  ## Exploration Protocol
450
450
 
451
- 1. **KB Recall** — \`search\` for existing analysis on this area
451
+ 1. **AI Kit Recall** — \`search\` for existing analysis on this area
452
452
  2. **Discover** — Use \`find\`, \`symbol\`, \`scope_map\` to locate relevant files
453
453
  3. **Analyze** — Use \`analyze_structure\`, \`analyze_dependencies\`, \`file_summary\`
454
454
  4. **Compress** — Use \`compact\` for targeted file sections, \`digest\` when synthesizing 3+ sources, \`stratum_card\` for files you'll reference repeatedly
@@ -11,7 +11,7 @@
11
11
 
12
12
  export const PLUGINS = {
13
13
  aikit: {
14
- description: 'KB search, analysis, memory, and developer tools',
14
+ description: 'AI Kit search, analysis, memory, and developer tools',
15
15
  source: 'scaffold/general/skills/aikit/SKILL.md',
16
16
  required: true,
17
17
  },
@@ -10,17 +10,17 @@
10
10
 
11
11
  export const PROMPTS = {
12
12
  ask: {
13
- description: 'Quick research question — find answer using KB + web search',
13
+ description: 'Quick research question — find answer using AI Kit + web search',
14
14
  agent: 'Researcher-Alpha',
15
15
  tools: ['search', 'web_search', 'web_fetch', 'compact', 'file_summary', 'remember'],
16
16
  content: `## Quick Research
17
17
 
18
- 1. **KB Recall** — Search knowledge base for existing answers
19
- 2. **Web Search** — If KB has no relevant results, search the web
18
+ 1. **AI Kit Recall** — Search knowledge base for existing answers
19
+ 2. **Web Search** — If AI Kit has no relevant results, search the web
20
20
  3. **Synthesize** — Combine findings into a clear, concise answer
21
21
  4. **Remember** — If the answer is broadly useful, persist it to KB
22
22
 
23
- **Always cite sources** — KB entries, file paths, or URLs.`,
23
+ **Always cite sources** — AI Kit entries, file paths, or URLs.`,
24
24
  },
25
25
 
26
26
  debug: {
@@ -40,7 +40,7 @@ export const PROMPTS = {
40
40
  content: `## Debug Workflow
41
41
 
42
42
  1. **Parse Error** — Use \`parse_output\` on the error message/stack trace
43
- 2. **KB Recall** — Search for known issues matching this pattern
43
+ 2. **AI Kit Recall** — Search for known issues matching this pattern
44
44
  3. **Reproduce** — Run the failing command/test to confirm
45
45
  4. **Trace** — Use \`symbol\` and \`trace\` to follow the call chain
46
46
  5. **Diagnose** — Form hypothesis, gather evidence
@@ -91,7 +91,7 @@ Refer to the Orchestrator agent's full instructions for the detailed workflow.`,
91
91
  ],
92
92
  content: `## Planning Workflow
93
93
 
94
- 1. **KB Recall** — Search for past plans, architecture decisions
94
+ 1. **AI Kit Recall** — Search for past plans, architecture decisions
95
95
  2. **FORGE Ground** — Classify tier, scope map, seed unknowns
96
96
  3. **Research** — Explore codebase, understand subsystems
97
97
  4. **Draft Plan** — 3-10 phases with agent assignments, TDD steps
@@ -14,12 +14,12 @@ export const PROTOCOLS = {
14
14
  ## Invocation Mode Detection
15
15
 
16
16
  You may be invoked in two modes:
17
- 1. **Direct** — you have full KB tool access. Follow the **Information Lookup Order** below.
17
+ 1. **Direct** — you have full AI Kit tool access. Follow the **Information Lookup Order** below.
18
18
  2. **Sub-agent** (via Orchestrator) — you may have limited MCP tool access.
19
- The Orchestrator provides context under "## Prior KB Context" in your prompt.
20
- If present, skip KB Recall and use the provided context instead.
19
+ The Orchestrator provides context under "## Prior AI Kit Context" in your prompt.
20
+ If present, skip AI Kit Recall and use the provided context instead.
21
21
 
22
- **Detection:** If your prompt contains "## Prior KB Context", you are in sub-agent mode.
22
+ **Detection:** If your prompt contains "## Prior AI Kit Context", you are in sub-agent mode.
23
23
 
24
24
  ---
25
25
 
@@ -82,7 +82,7 @@ list() // see all stored knowledge entries
82
82
 
83
83
  ### Step 4: Tool Discovery
84
84
 
85
- If unsure which KB tool to use → run \`guide({ topic: "what you need" })\` for recommendations.
85
+ If unsure which AI Kit tool to use → run \`guide({ topic: "what you need" })\` for recommendations.
86
86
 
87
87
  ## FORGE Protocol (Quality Gate)
88
88
 
@@ -176,7 +176,7 @@ remember({
176
176
 
177
177
  **If you complete a task without remembering anything, you likely missed something.** Review what you learned.
178
178
 
179
- For outdated KB entries → \`update(path, content, reason)\`
179
+ For outdated AI Kit entries → \`update(path, content, reason)\`
180
180
 
181
181
  ---
182
182
 
@@ -287,7 +287,7 @@ Follow the **MANDATORY FIRST ACTION** and **Information Lookup Order** from code
287
287
 
288
288
  ## Research Methodology
289
289
 
290
- ### Phase 1: KB Recall (BLOCKING)
290
+ ### Phase 1: AI Kit Recall (BLOCKING)
291
291
  \`\`\`
292
292
  search("task keywords")
293
293
  scope_map("what you need to investigate")
@@ -358,8 +358,8 @@ When invoked for a decision analysis, you receive a specific question. You MUST:
358
358
 
359
359
  ## Invocation Mode Detection
360
360
 
361
- - **Direct** (has KB tools) → Follow the **Information Lookup Order** from code-agent-base
362
- - **Sub-agent** (prompt has "## Prior KB Context") → Skip KB Recall, use provided context
361
+ - **Direct** (has AI Kit tools) → Follow the **Information Lookup Order** from code-agent-base
362
+ - **Sub-agent** (prompt has "## Prior AI Kit Context") → Skip AI Kit Recall, use provided context
363
363
 
364
364
  ---
365
365
 
@@ -387,7 +387,7 @@ Follow the **MANDATORY FIRST ACTION** and **Information Lookup Order** from code
387
387
 
388
388
  ## Review Workflow
389
389
 
390
- 1. **KB Recall** — \`search("conventions relevant-area")\` + \`list()\` for past review findings, patterns
390
+ 1. **AI Kit Recall** — \`search("conventions relevant-area")\` + \`list()\` for past review findings, patterns
391
391
  2. **Blast Radius** — \`blast_radius\` on changed files to understand impact
392
392
  3. **FORGE Classify** — \`forge_classify\` to determine review depth
393
393
  4. **Review** — Evaluate against all dimensions below
@@ -452,7 +452,7 @@ Follow the **MANDATORY FIRST ACTION** and **Information Lookup Order** from code
452
452
 
453
453
  ## Review Workflow
454
454
 
455
- 1. **KB Recall** — \`search("architecture decisions boundaries")\` + \`list()\` for past ADRs, patterns
455
+ 1. **AI Kit Recall** — \`search("architecture decisions boundaries")\` + \`list()\` for past ADRs, patterns
456
456
  2. **Analyze** — \`analyze_structure\`, \`analyze_dependencies\`, \`blast_radius\`
457
457
  3. **Evaluate** — Check all dimensions below
458
458
  4. **Report** — Structured findings with verdict
@@ -529,7 +529,7 @@ Trigger the decision protocol when there is an **unresolved non-trivial technica
529
529
 
530
530
  > Follow the FORGE (Fact-Oriented Reasoning with Graduated Evidence) protocol for all code generation and modification tasks.
531
531
 
532
- ## KB Tools for FORGE
532
+ ## AI Kit Tools for FORGE
533
533
 
534
534
  | Tool | Purpose | When |
535
535
  |------|---------|------|