@aidemd-mcp/server 0.2.0

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 (114) hide show
  1. package/.aide/docs/.aide +128 -0
  2. package/.aide/docs/agent-readable-code.md +74 -0
  3. package/.aide/docs/aide-spec.md +201 -0
  4. package/.aide/docs/aide-template.md +110 -0
  5. package/.aide/docs/automated-qa.md +111 -0
  6. package/.aide/docs/cascading-alignment.md +107 -0
  7. package/.aide/docs/index.md +38 -0
  8. package/.aide/docs/plan-aide.md +77 -0
  9. package/.aide/docs/plan.aide +60 -0
  10. package/.aide/docs/progressive-disclosure.md +72 -0
  11. package/.aide/docs/todo-aide.md +77 -0
  12. package/.aide/intent.aide +256 -0
  13. package/.aide/plan.aide +169 -0
  14. package/.aide/todo.aide +47 -0
  15. package/.claude/.aide +246 -0
  16. package/.claude/commands/aide/align.md +15 -0
  17. package/.claude/commands/aide/build.md +17 -0
  18. package/.claude/commands/aide/fix.md +20 -0
  19. package/.claude/commands/aide/init.md +171 -0
  20. package/.claude/commands/aide/plan.md +25 -0
  21. package/.claude/commands/aide/qa.md +25 -0
  22. package/.claude/commands/aide/refactor.md +29 -0
  23. package/.claude/commands/aide/research.md +21 -0
  24. package/.claude/commands/aide/spec.md +24 -0
  25. package/.claude/commands/aide/synthesize.md +20 -0
  26. package/.claude/commands/aide/update-playbook.md +18 -0
  27. package/.claude/commands/aide/upgrade.md +91 -0
  28. package/LICENSE +21 -0
  29. package/README.md +88 -0
  30. package/dist/cli/App/index.d.ts +14 -0
  31. package/dist/cli/App/index.js +282 -0
  32. package/dist/cli/DetailPanel/index.d.ts +24 -0
  33. package/dist/cli/DetailPanel/index.js +57 -0
  34. package/dist/cli/TreePanel/index.d.ts +24 -0
  35. package/dist/cli/TreePanel/index.js +65 -0
  36. package/dist/cli/buildTreeData/index.d.ts +7 -0
  37. package/dist/cli/buildTreeData/index.js +51 -0
  38. package/dist/cli/findPrimaryIntent/index.d.ts +12 -0
  39. package/dist/cli/findPrimaryIntent/index.js +20 -0
  40. package/dist/cli/flattenTree/index.d.ts +16 -0
  41. package/dist/cli/flattenTree/index.js +20 -0
  42. package/dist/cli/index.d.ts +2 -0
  43. package/dist/cli/index.js +15 -0
  44. package/dist/cli/init/index.d.ts +2 -0
  45. package/dist/cli/init/index.js +33 -0
  46. package/dist/cli/init/writeInitCommand/index.d.ts +13 -0
  47. package/dist/cli/init/writeInitCommand/index.js +25 -0
  48. package/dist/cli/init/writeMcpEntry/index.d.ts +12 -0
  49. package/dist/cli/init/writeMcpEntry/index.js +51 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +228 -0
  52. package/dist/tools/discover/buildAncestorChain/index.d.ts +17 -0
  53. package/dist/tools/discover/buildAncestorChain/index.js +98 -0
  54. package/dist/tools/discover/buildTree/index.d.ts +9 -0
  55. package/dist/tools/discover/buildTree/index.js +57 -0
  56. package/dist/tools/discover/index.d.ts +20 -0
  57. package/dist/tools/discover/index.js +49 -0
  58. package/dist/tools/init/applySteps/index.d.ts +30 -0
  59. package/dist/tools/init/applySteps/index.js +76 -0
  60. package/dist/tools/init/configureIde/index.d.ts +21 -0
  61. package/dist/tools/init/configureIde/index.js +135 -0
  62. package/dist/tools/init/detectFramework/index.d.ts +11 -0
  63. package/dist/tools/init/detectFramework/index.js +53 -0
  64. package/dist/tools/init/index.d.ts +46 -0
  65. package/dist/tools/init/index.js +99 -0
  66. package/dist/tools/init/initContent/index.d.ts +99 -0
  67. package/dist/tools/init/initContent/index.js +162 -0
  68. package/dist/tools/init/installAgents/index.d.ts +12 -0
  69. package/dist/tools/init/installAgents/index.js +60 -0
  70. package/dist/tools/init/installMethodologyDocs/index.d.ts +14 -0
  71. package/dist/tools/init/installMethodologyDocs/index.js +62 -0
  72. package/dist/tools/init/installSkills/index.d.ts +12 -0
  73. package/dist/tools/init/installSkills/index.js +60 -0
  74. package/dist/tools/init/provisionBrain/index.d.ts +23 -0
  75. package/dist/tools/init/provisionBrain/index.js +239 -0
  76. package/dist/tools/init/resolveBrainHints/index.d.ts +17 -0
  77. package/dist/tools/init/resolveBrainHints/index.js +44 -0
  78. package/dist/tools/init/scaffoldCommands/index.d.ts +38 -0
  79. package/dist/tools/init/scaffoldCommands/index.js +94 -0
  80. package/dist/tools/init/wireMcp/index.d.ts +16 -0
  81. package/dist/tools/init/wireMcp/index.js +72 -0
  82. package/dist/tools/init/writeMethodology/index.d.ts +20 -0
  83. package/dist/tools/init/writeMethodology/index.js +94 -0
  84. package/dist/tools/read/index.d.ts +15 -0
  85. package/dist/tools/read/index.js +79 -0
  86. package/dist/tools/scaffold/index.d.ts +22 -0
  87. package/dist/tools/scaffold/index.js +128 -0
  88. package/dist/tools/upgrade/applyFiles/index.d.ts +33 -0
  89. package/dist/tools/upgrade/applyFiles/index.js +65 -0
  90. package/dist/tools/upgrade/buildVersionsMeta/index.d.ts +20 -0
  91. package/dist/tools/upgrade/buildVersionsMeta/index.js +51 -0
  92. package/dist/tools/upgrade/checkIdeConfig/index.d.ts +24 -0
  93. package/dist/tools/upgrade/checkIdeConfig/index.js +134 -0
  94. package/dist/tools/upgrade/checkMcpConfig/index.d.ts +17 -0
  95. package/dist/tools/upgrade/checkMcpConfig/index.js +81 -0
  96. package/dist/tools/upgrade/compareFile/index.d.ts +12 -0
  97. package/dist/tools/upgrade/compareFile/index.js +24 -0
  98. package/dist/tools/upgrade/index.d.ts +24 -0
  99. package/dist/tools/upgrade/index.js +139 -0
  100. package/dist/tools/upgrade/spliceStub/index.d.ts +13 -0
  101. package/dist/tools/upgrade/spliceStub/index.js +91 -0
  102. package/dist/tools/validate/index.d.ts +18 -0
  103. package/dist/tools/validate/index.js +65 -0
  104. package/dist/types/index.d.ts +277 -0
  105. package/dist/types/index.js +10 -0
  106. package/dist/util/classify/index.d.ts +17 -0
  107. package/dist/util/classify/index.js +134 -0
  108. package/dist/util/parseBody/index.d.ts +7 -0
  109. package/dist/util/parseBody/index.js +43 -0
  110. package/dist/util/parseFrontmatter/index.d.ts +12 -0
  111. package/dist/util/parseFrontmatter/index.js +64 -0
  112. package/dist/util/scan/index.d.ts +7 -0
  113. package/dist/util/scan/index.js +82 -0
  114. package/package.json +59 -0
package/.claude/.aide ADDED
@@ -0,0 +1,246 @@
1
+ ---
2
+ scope: .claude
3
+ status: aligned
4
+ description: AIDE harness — agents, commands, skills, and methodology docs that drive the intent pipeline
5
+ intent: >
6
+ The AIDE harness gains cascading alignment — the ability for agents to verify
7
+ that every spec in a tree honors the intent of its ancestors, and for drift
8
+ to be detected, flagged, and repaired without blocking the pipeline. A new
9
+ aide-aligner agent walks the spec tree top-down comparing each spec's
10
+ outcomes against its ancestors' outcomes, producing realignment items where
11
+ drift is found. The /aide:align command invokes this agent. Existing agent
12
+ definitions are simplified by removing verbose tree-walking instructions —
13
+ the enhanced discover tool's ancestor chain output teaches the protocol
14
+ directly, so agents learn by calling the tool, not by reading paragraphs
15
+ of instruction. A new methodology doc captures the cascading alignment
16
+ protocol as canonical doctrine.
17
+ outcomes:
18
+ desired:
19
+ - An aide-aligner agent exists, distinct from the QA agent, whose sole
20
+ job is spec-vs-spec alignment — comparing a child spec's outcomes
21
+ against every ancestor's outcomes to detect intent drift. QA checks
22
+ code-vs-spec; the aligner checks spec-vs-spec.
23
+ - The aligner walks the tree top-down using the discover tool's ancestor
24
+ chain, compares outcomes at each level, and produces a todo.aide at
25
+ each misaligned node listing concrete realignment items.
26
+ - The aligner sets status: misaligned on specs where it finds drift and
27
+ status: aligned on specs it has verified. It is the only agent that
28
+ can confirm alignment through a deliberate full-tree walk.
29
+ - The QA agent can set status: misaligned incidentally while reviewing
30
+ code-vs-spec, but cannot set aligned — only the aligner confirms
31
+ alignment.
32
+ - A /aide:align command exists that invokes the aligner agent, callable
33
+ by the user or suggestable by the orchestrator when drift is suspected.
34
+ - Agent definitions across the harness no longer contain verbose
35
+ tree-walking instructions. Agents call discover, the tool's output
36
+ teaches the protocol, and agents report misalignment flags they
37
+ encounter. If an agent needs paragraphs of instruction to use
38
+ discover correctly, that is a discover design failure, not an agent
39
+ instruction gap.
40
+ - A cascading-alignment.md methodology doc exists under .aide/docs/
41
+ documenting the protocol, the status field semantics, the aligner's
42
+ role, and how misalignment flows through the pipeline.
43
+ undesired:
44
+ - The aligner conflated with the QA agent. QA validates code against
45
+ spec outcomes; the aligner validates spec outcomes against ancestor
46
+ spec outcomes. Merging them produces an agent that does neither job
47
+ well and confuses which contract it is checking.
48
+ - Misalignment that blocks the pipeline. The status flag is
49
+ informational — it surfaces drift for human or agent judgment, not
50
+ a gate that stops work. A team may intentionally diverge a child
51
+ from its parent; blocking would make that impossible.
52
+ - Agent definitions that duplicate the discover tool's teaching by
53
+ including multi-paragraph instructions on how to walk the intent
54
+ tree. If agents need those instructions, the tool's description
55
+ and output are not doing their job — fix the tool, not the agents.
56
+ - An aligner that modifies spec intent or outcomes directly. The
57
+ aligner detects and flags; it does not rewrite. Realignment items
58
+ go into todo.aide for a human or spec-writer to resolve.
59
+ - A cascading-alignment doc that describes aspirational behavior the
60
+ tooling does not actually support. The doc must describe what the
61
+ discover tool, validate tool, and aligner agent actually do, not
62
+ what they might do someday.
63
+ ---
64
+
65
+ ## Context
66
+
67
+ The AIDE pipeline has agents that read specs, agents that write code, and
68
+ agents that validate results — but no agent whose job is to verify that
69
+ the specs themselves are internally consistent across the tree. A child
70
+ spec can contradict its parent's outcomes and no one catches it until QA
71
+ fails in a confusing way, or worse, the implementation faithfully serves
72
+ a child intent that violates the root intent. This is the cascading
73
+ alignment problem: intent trees grow, specs multiply, and drift between
74
+ levels accumulates silently.
75
+
76
+ The existing agents each contain a "walk the intent tree" instruction
77
+ telling them to call discover and consider ancestor outcomes. These
78
+ instructions are short (one line each) but they represent duplicated
79
+ responsibility — every agent is told to watch for alignment, yet none
80
+ of them owns it. The result is diffuse accountability: alignment is
81
+ everyone's side job and no one's primary job.
82
+
83
+ The harness also lacks a canonical doc explaining how alignment works,
84
+ what the status field means, and how misalignment flows through the
85
+ pipeline. Without that doc, every new agent or contributor re-derives
86
+ the protocol from scattered instructions across six agent definitions.
87
+
88
+ ## Strategy
89
+
90
+ **Separate spec-vs-spec from code-vs-spec.** The aligner agent checks
91
+ one thing: does a child spec's outcomes contradict or undermine any
92
+ ancestor's outcomes? QA checks a different thing: does the implementation
93
+ satisfy the spec's outcomes? These are different contracts requiring
94
+ different verification strategies. Merging them into one agent forces
95
+ the agent to context-switch between reading code and reading specs,
96
+ and makes it unclear which contract a finding refers to. The aligner
97
+ owns alignment; QA owns conformance. Each agent's findings are
98
+ unambiguous because each agent checks exactly one relationship.
99
+ (Traces to: desired #1, undesired #1)
100
+
101
+ **Walk top-down, flag at the leaf.** The aligner uses discover's
102
+ ancestor chain to walk from root to the target spec, comparing
103
+ outcomes at each level. When drift is found, the misalignment flag
104
+ goes on the leaf that deviated, not the ancestor that set the rule.
105
+ This preserves the ancestor as the source of truth and makes it
106
+ clear which spec needs revision. The aligner produces a todo.aide at
107
+ each misaligned node with concrete realignment items — what
108
+ specifically conflicts and which ancestor outcome it violates. It
109
+ never rewrites the spec's intent or outcomes directly; that is the
110
+ spec-writer's job, informed by the todo.aide.
111
+ (Traces to: desired #2, undesired #4)
112
+
113
+ **Status is informational, not a gate.** The status field has three
114
+ states: pending (implicit default, no field needed), aligned (set by
115
+ the aligner after a deliberate full-tree walk), and misaligned (set
116
+ by the aligner when drift is found, or by QA incidentally). The
117
+ aligner is the only agent that can confirm alignment — setting
118
+ aligned requires a deliberate full-tree walk, not an incidental
119
+ observation. QA can set misaligned when it notices spec-level
120
+ contradictions during code review, but it cannot confirm alignment
121
+ because it never performs a full tree walk. Misalignment is
122
+ non-blocking: it surfaces drift for human judgment without stopping
123
+ the pipeline. A team may intentionally diverge a child from its
124
+ parent; a blocking gate would make that impossible.
125
+ (Traces to: desired #3, desired #4, undesired #2)
126
+
127
+ **The /aide:align command is user-invoked, not automatic.** Alignment
128
+ checking is expensive — it walks the full tree and compares outcomes at
129
+ every level. Running it automatically on every spec change would slow
130
+ the pipeline and produce noise during active development when specs are
131
+ still being drafted. Instead, the orchestrator can suggest running
132
+ /aide:align when discover output shows misalignment flags or when a
133
+ spec edit touches outcomes, but the user decides when to invoke it.
134
+ (Traces to: desired #5)
135
+
136
+ **Agents learn discover by calling it, not by reading instructions
137
+ about it.** The current agent definitions each contain a one-line
138
+ "walk the intent tree" instruction. While these are not the
139
+ multi-paragraph instructions the spec warns against, they represent
140
+ duplicated responsibility that belongs in the tool, not in six agent
141
+ files. The discover tool's enhanced output — ancestor chain with
142
+ descriptions, misalignment flags — should teach the protocol directly.
143
+ Agents should still report misalignment flags they encounter in
144
+ discover output, but the instruction to do so should be minimal:
145
+ acknowledge what discover tells you, not re-derive how to use it.
146
+ If removing these instructions causes agents to misuse discover,
147
+ that signals a discover output design problem to fix at the tool
148
+ level.
149
+ (Traces to: desired #6, undesired #3)
150
+
151
+ **The methodology doc describes actual behavior.** The
152
+ cascading-alignment.md doc under .aide/docs/ documents what the
153
+ discover tool, validate tool, and aligner agent actually do — not
154
+ what they might do someday. It covers the status field lifecycle,
155
+ the aligner's role, how QA interacts with alignment, and how
156
+ misalignment flows through the pipeline. If the doc names a
157
+ capability the tooling does not support, the doc is wrong.
158
+ (Traces to: desired #7, undesired #5)
159
+
160
+ ## Good examples
161
+
162
+ The user runs /aide:align targeting a module three levels deep. The
163
+ aligner calls discover, receives the ancestor chain: root spec,
164
+ mid-level spec, leaf spec. It compares the leaf's outcomes against the
165
+ mid-level's outcomes — no conflicts. It compares the leaf's outcomes
166
+ against the root's outcomes — one desired outcome in the leaf
167
+ contradicts an undesired outcome in the root. The aligner produces a
168
+ todo.aide at the leaf with one item: "Leaf desired outcome #3 conflicts
169
+ with root undesired outcome #2 — leaf says X should always happen, root
170
+ says X is a failure mode." It sets the leaf's status to misaligned.
171
+ The mid-level and root specs are untouched. The pipeline continues;
172
+ nothing is blocked.
173
+
174
+ QA is reviewing an implementation and notices that the spec it is
175
+ validating against has an outcome that contradicts the parent spec's
176
+ intent. QA sets status: misaligned on the leaf and notes the
177
+ contradiction in its todo.aide under a "spec-gap" misalignment tag.
178
+ QA does not attempt to resolve the contradiction or set anything to
179
+ aligned — it finishes its code-vs-spec review and returns its verdict.
180
+ The user later runs /aide:align to get a full alignment assessment.
181
+
182
+ An agent calls discover on a module. The output includes the ancestor
183
+ chain with a one-line description of each ancestor's intent. The agent
184
+ reads this output and understands exactly where this module sits in the
185
+ tree and what constraints it inherits — without any instruction in its
186
+ agent definition telling it how to interpret discover's output. The
187
+ tool's output was self-teaching.
188
+
189
+ After the aligner confirms alignment across a subtree, a contributor
190
+ adds a new child spec. Its status is implicitly pending — no status
191
+ field in the frontmatter. The parent's status remains aligned because
192
+ alignment was confirmed before the child existed. The next /aide:align
193
+ run picks up the new child, compares it against ancestors, and either
194
+ confirms it as aligned or flags it as misaligned. The parent's status
195
+ is not retroactively changed by the child's addition.
196
+
197
+ ## Bad examples
198
+
199
+ An aligner agent that reads a misaligned child spec and rewrites its
200
+ outcomes to match the parent. The aligner's job is to detect and flag,
201
+ not to resolve. The spec-writer resolves, informed by the todo.aide
202
+ the aligner produced. An aligner that rewrites specs is an agent that
203
+ makes intent decisions it was never authorized to make.
204
+
205
+ A QA agent that runs a full tree walk and sets status: aligned on every
206
+ spec it touches. QA's job is code-vs-spec. It encounters alignment
207
+ issues incidentally — it can flag misaligned, but confirming alignment
208
+ requires a deliberate full-tree walk that only the aligner performs.
209
+ A QA agent setting aligned conflates the two contracts and gives false
210
+ confidence that spec-vs-spec alignment was checked when it was not.
211
+
212
+ An agent definition that contains three paragraphs explaining how to
213
+ call discover, what the ancestor chain means, how to interpret
214
+ misalignment flags, and when to escalate. If the agent needs this
215
+ much instruction, discover's output is not doing its job. The fix is
216
+ to improve discover's output format and descriptions, not to
217
+ compensate with verbose agent instructions.
218
+
219
+ A cascading-alignment.md doc that describes a "deep alignment mode"
220
+ where the aligner recursively verifies every transitive descendant
221
+ of a spec, but the aligner agent and discover tool have no such
222
+ capability. The doc described aspirational behavior and will mislead
223
+ every agent that reads it into expecting features that do not exist.
224
+
225
+ Misalignment that blocks the pipeline: a status: misaligned flag on a
226
+ spec causes the orchestrator to refuse to plan or build against it.
227
+ A contributor who intentionally diverged a child spec from its parent
228
+ for good reasons is now unable to proceed until they undo the
229
+ divergence or get the aligner to approve it. The status field became
230
+ a gate instead of an informational signal.
231
+
232
+ An aligner that flags misalignment on the parent spec rather than
233
+ the leaf. The root spec says "no X." A child spec says "always X."
234
+ The aligner marks the root as misaligned. Now the root — which set
235
+ the original rule — carries a flag suggesting it is the one that
236
+ drifted. The flag belongs on the child that deviated from the
237
+ ancestor's constraint.
238
+
239
+ ## References
240
+
241
+ - `.aide/intent.aide` -- Root spec establishing that canonical docs must describe actual behavior, not aspirational behavior, and that cascading intent must flow faithfully from root to leaf.
242
+ - `.claude/agents/aide/aide-qa.md` -- Current QA agent definition showing the one-line "walk the intent tree" instruction pattern and QA's code-vs-spec scope, which the aligner must not duplicate.
243
+ - `.claude/agents/aide/aide-architect.md` -- Architect agent showing the same one-line tree-walking instruction pattern and how agents currently receive discover context.
244
+ - `.claude/agents/aide/aide-implementor.md` -- Implementor agent confirming the tree-walking instruction is a single sentence across all agents, not the multi-paragraph duplication the spec warns against.
245
+ - `.claude/agents/aide/aide-spec-writer.md` -- Spec writer agent showing how discover is referenced for inherited context, confirming agents already use discover but each carries its own instruction to do so.
246
+ - `.aide/docs/aide-spec.md` -- Canonical AIDE methodology doc defining the intent tree, inheritance model, and file type semantics that the aligner and alignment doc must be consistent with.
@@ -0,0 +1,15 @@
1
+ # /aide:align — Alignment Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-aligner` agent.
4
+
5
+ Verify spec-vs-spec alignment across the intent tree. This is NOT QA — QA checks code against a spec; alignment checks whether a spec's outcomes are consistent with every ancestor spec's outcomes. When a child spec contradicts, undermines, or silently omits an ancestor outcome, the aligner detects the drift and produces a `todo.aide` at the misaligned node with concrete realignment items. It never rewrites spec outcomes — it flags only.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Call `aide_discover` on the target path to get the full ancestor chain
10
+ - [ ] Read each spec in the ancestor chain top-down via `aide_read` — load intent and outcomes at every level
11
+ - [ ] Compare each child's `outcomes.desired` and `outcomes.undesired` against every ancestor's outcomes — look for contradictions, undermining, and critical omissions
12
+ - [ ] For misaligned specs: set `status: misaligned` on the leaf spec's frontmatter and produce `todo.aide` at the leaf with items naming the specific conflict (e.g., "Leaf desired outcome #N conflicts with ancestor [path] undesired outcome #M")
13
+ - [ ] For aligned specs: set `status: aligned` on the spec's frontmatter
14
+ - [ ] Report results with verdict (ALIGNED/MISALIGNED), count of specs checked, count of misalignments found, paths of any `todo.aide` files created, and recommended next step (`/aide:spec` to revise misaligned specs)
15
+ - [ ] Do NOT rewrite spec outcomes — flag only
@@ -0,0 +1,17 @@
1
+ # /aide:build — Build Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-implementor` agent.
4
+
5
+ Execute the architect's implementation plan. This is the implementor phase in build mode — the session that turns `plan.aide` into working, tested code without making architectural decisions mid-session.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Read `plan.aide` in the target module. This is the primary input — it names files, sequencing, contracts, and which existing helpers to reuse
10
+ - [ ] Read the intent spec (`.aide` or `intent.aide`) for the target module. The plan tells you what to build; the spec tells you what counts as correct
11
+ - [ ] Execute the plan steps top-to-bottom. Check each checkbox in `plan.aide` as you complete it. Do not reorder steps, skip steps, or add steps. If a step is ambiguous, stop and escalate back to the architect via `/aide:plan` rather than inventing an answer
12
+ - [ ] Write the code. No architectural improvisation — if a decision is not in the plan or the spec, it is out of scope for this session
13
+ - [ ] Write tests covering every behavior the spec's `outcomes.desired` names, plus regression coverage for anything in `outcomes.undesired`
14
+ - [ ] Run the tests until green
15
+ - [ ] Run the type checker (`tsc --noEmit` or the project's equivalent)
16
+ - [ ] Run `aide_validate` to check for spec issues introduced during the build
17
+ - [ ] Hand off to `/aide:qa` — the QA agent will compare actual output against the spec's `outcomes` block
@@ -0,0 +1,20 @@
1
+ # /aide:fix — Fix Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-implementor` agent.
4
+
5
+ Work one unchecked item from the `todo.aide` checklist. This is the implementor phase in fix mode — the same agent that runs `/aide:build`, invoked with a narrower scope and a stricter one-session-per-item protocol. See [todo.aide spec](../../.aide/docs/todo-aide.md) for the file format.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Read the intent spec (`.aide` or `intent.aide`) in the target module
10
+ - [ ] Read `todo.aide` and pick the next unchecked item. Do not pick ahead, do not bundle. Read the item's `Misalignment` tag to understand where intent was lost
11
+ - [ ] Fix exactly ONE issue. Do not fix adjacent issues discovered during the session — add them to the `todo.aide` checklist instead, unchecked, for future sessions
12
+ - [ ] Base the fix on the spec, not on the one-line issue description. The description points at the problem; the spec is the source of truth for what correct looks like
13
+ - [ ] Run the generation command (or equivalent) to produce fresh output after the fix
14
+ - [ ] Compare the new output against the baseline from before the fix:
15
+ - Is the targeted issue resolved?
16
+ - Did anything else regress? The fix may have moved unrelated output further from the spec
17
+ - [ ] Run tests and the type checker to catch structural regressions
18
+ - [ ] Check the item off in `todo.aide` only if both the targeted fix landed and no regression was introduced. Otherwise revert, leave the item unchecked, and end the session
19
+ - [ ] Commit the fix in its own commit — one checkbox, one commit, one diff
20
+ - [ ] End the session. The next item starts in a fresh session with clean context — do not continue working additional items in the same session
@@ -0,0 +1,171 @@
1
+ # /aide:init — Interactive Project Bootstrap
2
+
3
+ > **Agent:** You are the orchestrator for this command. Do NOT delegate to a subagent.
4
+
5
+ > **CRITICAL — read this before doing anything:**
6
+ > This is a step-by-step wizard. You show ONE thing at a time, ask ONE question using the `AskUserQuestion` tool with structured options, then STOP and wait.
7
+ >
8
+ > **Rules:**
9
+ > - Never show a summary table of all categories
10
+ > - Never offer "all" as an option
11
+ > - Never present more than one category at a time
12
+ > - Every pause point MUST use the `AskUserQuestion` tool with defined options — never ask the user to respond conversationally
13
+ > - After every `AskUserQuestion`, STOP. Do not continue until the user responds.
14
+ > - Your first message should be SHORT — just the framework detection + AskUserQuestion
15
+
16
+ Bootstrap AIDE into this project by calling `aide_init` and walking the user through each step interactively. The tool returns structured JSON — you interpret it and drive the conversation.
17
+
18
+ ## Two-call pattern
19
+
20
+ The tool uses a **two-call pattern** for progressive disclosure. The first call (no `category`) returns a lightweight metadata-only summary (no file content). After the user confirms a category, call again with `category=X` to get the actual content to write.
21
+
22
+ ## Wizard flow
23
+
24
+ Work through these steps in order. Each step is ONE interaction — you do the action, present a brief description, then call `AskUserQuestion` with structured options and STOP.
25
+
26
+ ---
27
+
28
+ ### Step 1: Detect framework
29
+
30
+ Call `aide_init` with no arguments (or with a `framework` override if the user specified one). Store the full response — you'll use it across all subsequent steps.
31
+
32
+ Present a brief line about the detected framework, then call `AskUserQuestion`:
33
+
34
+ ```
35
+ question: "I detected {framework}. Is that correct?"
36
+ header: "Framework"
37
+ options:
38
+ - label: "Yes, {framework}" / description: "Continue with the detected framework"
39
+ - label: "Cursor" / description: "Target Cursor instead"
40
+ - label: "Windsurf" / description: "Target Windsurf instead"
41
+ - label: "Copilot" / description: "Target Copilot instead"
42
+ ```
43
+
44
+ (Omit the detected framework from the alternative options. Always include "Yes" as the first option.)
45
+
46
+ STOP. Wait for user response.
47
+
48
+ ---
49
+
50
+ ### Step 2–N: Walk through categories one at a time
51
+
52
+ The categories are processed in this order: `methodology`, `commands`, `agents`, `skills`.
53
+
54
+ For each category that has at least one `would-create` step, present ONLY that category with a brief description of what it contains and the file count, then call `AskUserQuestion`:
55
+
56
+ ```
57
+ question: "{Category} — {count} files in {path}. Set it up?"
58
+ header: "{Category}"
59
+ options:
60
+ - label: "Yes, create them" / description: "Create the {count} files for {category}"
61
+ - label: "Skip" / description: "Skip {category} for now"
62
+ ```
63
+
64
+ STOP. Wait for user response.
65
+
66
+ **If the user selects "Yes":**
67
+ 1. Call `aide_init` with `category` set to that category name
68
+ 2. Apply the `would-create` steps using the **Write tool** for each file individually
69
+ 3. Create parent directories as needed (`mkdir -p`)
70
+ 4. Skip `exists` and `would-skip` steps
71
+ 5. Briefly confirm what was created (e.g., "Done — created 8 files in .aide/docs/")
72
+
73
+ Then move to the NEXT category. Present it the same way and call `AskUserQuestion`.
74
+
75
+ **If the user selects "Skip":** Move to the next category immediately.
76
+
77
+ **If a category is all `exists`:** Skip it silently — don't ask about it.
78
+
79
+ **Important:** Always use the Write tool to create files one at a time. Do NOT batch-write files via Bash scripts, Node scripts, or shell loops. If the tool response was large and got persisted to a JSON file on disk, use the Read tool to load it, then Write each file individually.
80
+
81
+ ---
82
+
83
+ ### Brain vault step
84
+
85
+ **The brain is required — there is no skip option.**
86
+
87
+ Present any `brainHints` from the initial response as named options in `AskUserQuestion`:
88
+
89
+ ```
90
+ question: "AIDE needs a brain vault for research and retros. Where is yours?"
91
+ header: "Brain"
92
+ options (built dynamically from brainHints):
93
+ - label: "Use {hint.path}" / description: "{hint.reason} ({hint.type} hint)"
94
+ - label: "Use {hint2.path}" / description: "{hint2.reason} ({hint2.type} hint)"
95
+ (... up to 3 hints. User can always select "Other" to type a custom path.)
96
+ ```
97
+
98
+ If there are no hints, use:
99
+ ```
100
+ options:
101
+ - label: "Create new vault" / description: "I'll ask you for a path to create a new vault"
102
+ - label: "Connect existing" / description: "I have an existing Obsidian vault to connect"
103
+ ```
104
+
105
+ STOP. Wait for user response.
106
+
107
+ Once the path is resolved:
108
+ - If `status: "would-create"`, create the vault directories: `research/`, `process/retro/`, `coding-playbook/`
109
+ - If `status: "exists"`, tell the user it's already set up
110
+
111
+ ---
112
+
113
+ ### MCP config step
114
+
115
+ Read the project's MCP config file (`.mcp.json` or equivalent) first. Each mcp step has a `prescription` with `key` and `entry`.
116
+
117
+ Present what servers already exist and what would be added, then call `AskUserQuestion`:
118
+
119
+ ```
120
+ question: "Your .mcp.json has {existing servers}. I need to add {new servers}. Merge them in?"
121
+ header: "MCP"
122
+ options:
123
+ - label: "Yes, merge" / description: "Add the AIDE server entries alongside your existing config"
124
+ - label: "Skip" / description: "Don't modify MCP config"
125
+ ```
126
+
127
+ STOP. Wait for user response.
128
+
129
+ On confirmation, merge each prescription's `entry` under its `key` in the `mcpServers` object and write the updated config. If the file doesn't exist, create it with `{ "mcpServers": { ... } }`. **Never overwrite the entire config** — always read, merge, write.
130
+
131
+ If a step has `configMalformed: true`:
132
+
133
+ ```
134
+ question: "Your .mcp.json has a JSON syntax error. How should I handle it?"
135
+ header: "MCP"
136
+ options:
137
+ - label: "Show contents" / description: "Show me the raw file so I can fix it manually"
138
+ - label: "Create fresh" / description: "Create a new .mcp.json with just the AIDE entries"
139
+ ```
140
+
141
+ ---
142
+
143
+ ### IDE config step
144
+
145
+ These are optional. Use `AskUserQuestion` with `multiSelect: true`:
146
+
147
+ ```
148
+ question: "Want any IDE integrations? These are optional."
149
+ header: "IDE"
150
+ multiSelect: true
151
+ options:
152
+ - label: "Zed" / description: "Add .aide file type association to Zed settings"
153
+ - label: "VS Code" / description: "Install aide-markdown extension for VS Code"
154
+ - label: "Neither" / description: "Skip IDE configuration"
155
+ ```
156
+
157
+ STOP. Wait for user response.
158
+
159
+ Only apply what they select.
160
+
161
+ ---
162
+
163
+ ### Final step: Summary
164
+
165
+ After all categories are done, give a brief summary:
166
+ - Files created (count by category)
167
+ - MCP entries merged
168
+ - Brain vault location
169
+ - IDE configuration applied (if any)
170
+
171
+ Suggest next steps: "Run `aide_discover` to see existing specs, or `/aide` to start a new pipeline."
@@ -0,0 +1,25 @@
1
+ # /aide:plan — Plan Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-architect` agent.
4
+
5
+ Translate the intent spec into a step-by-step implementation plan. Output is a `plan.aide` file next to the `.aide` spec — checkboxed steps the implementor executes without making architectural decisions. See [plan.aide spec](../../.aide/docs/plan-aide.md) for the file format.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Read the complete intent spec (`.aide` or `intent.aide`) in the target module — frontmatter AND body sections must be filled. If body sections are empty, stop and escalate back to `/aide:synthesize`
10
+ - [ ] Pull the coding playbook from the brain using the `study-playbook` skill — naming conventions, folder structure, patterns to follow and anti-patterns to avoid
11
+ - [ ] Scan the target module and its neighbors to understand what already exists — existing helpers to reuse, existing patterns to match, folders already in place
12
+ - [ ] Write `plan.aide` next to the `.aide` spec with:
13
+ - **Frontmatter:** `intent` — one-line summary of what this plan delivers
14
+ - **`## Plan`** — checkboxed steps the implementor executes top-to-bottom:
15
+ - Which files to create and where they live
16
+ - Which existing helpers to reuse instead of writing new ones
17
+ - Function boundaries and the contract between each step
18
+ - Sequencing — what must exist before the next step can start
19
+ - Tests to write for each behavior the spec's `outcomes.desired` names
20
+ - **`## Decisions`** — architectural choices made: why X over Y, naming rationale, tradeoffs
21
+ - [ ] No code in the plan — no function bodies, no worked examples, no copy-paste snippets. The plan describes decisions; the implementor writes the code and loads conventions directly from the playbook via each step's `Read:` list
22
+ - [ ] Every step must be traceable back to a line in the `.aide` spec or a rule in the coding playbook. If a step has no source, cut it or find the rule that justifies it
23
+ - [ ] If the spec is ambiguous, stop and escalate back to the spec writer (via the orchestrator) rather than inventing an answer
24
+ - [ ] **PAUSE for user approval.** Present the plan and do not proceed until the user approves it. Iterate if the user requests changes
25
+ - [ ] Hand the approved plan to the implementor via `/aide:build`
@@ -0,0 +1,25 @@
1
+ # /aide:qa — QA Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-qa` agent.
4
+
5
+ Verify actual output against the intent spec. This is the QA agent phase — the session that compares the spec's `outcomes` block against actual implementation and produces a `todo.aide` re-alignment document. See [todo.aide spec](../../.aide/docs/todo-aide.md) for the file format.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Read the intent spec (`.aide` or `intent.aide`) in the target module
10
+ - [ ] Focus on the `outcomes` block specifically:
11
+ - Does the actual output satisfy every item in `outcomes.desired`?
12
+ - Does the actual output trip any item in `outcomes.undesired`?
13
+ - [ ] Check for hidden failures — outputs that pass tests but violate intent, missing edge cases the spec names, anti-patterns the spec warned against
14
+ - [ ] Use judgement. If an output sounds wrong, reads wrong, or misses the point of the intent paragraph, flag it even when no specific outcome rule is named
15
+ - [ ] Produce a `todo.aide` next to the spec. Use `aide_scaffold` with type `todo` if none exists yet. Format:
16
+ - **Frontmatter:** `intent` (which outcomes are violated), `misalignment` (array of pipeline stages where intent was lost — `spec-gap`, `research-gap`, `strategy-gap`, `plan-gap`, `implementation-drift`, `test-gap`)
17
+ - **`## Issues`** — each issue gets:
18
+ - A checkbox
19
+ - A file path and line reference where the problem appears
20
+ - A one-line description of what's wrong
21
+ - `Traces to:` which `outcomes` field (desired or undesired) it violates
22
+ - `Misalignment:` which pipeline stage lost the intent for this specific issue
23
+ - **`## Retro`** — what would have caught this earlier? Which stage needs strengthening?
24
+ - [ ] Do NOT propose solutions. The checklist says *what's wrong and where* — the implementor, invoked via `/aide:fix`, decides *how*
25
+ - [ ] Hand off to `/aide:fix` — the implementor will work the checklist one item per session
@@ -0,0 +1,29 @@
1
+ # /aide:refactor — Refactor Phase
2
+
3
+ > **Agent:** This command is orchestrated by the `/aide` orchestrator, which delegates to the `aide-auditor` agent (one per `.aide` section) and then to `aide-implementor` agents for execution.
4
+
5
+ Audit existing code against the coding playbook and refactor to close convention drift. This is a post-QA phase — it runs on code that already works and already passed QA. The goal is conformance, not new functionality.
6
+
7
+ **This command requires a path argument.** It does NOT perform full-app refactoring in one pass. Scope it to a directory (e.g., `src/tools/score/`) and it will audit every `.aide`-defined section within that path.
8
+
9
+ ## Flow
10
+
11
+ 1. **Discover sections** — run `aide_discover` with the given path to find all `.aide` specs in the subtree
12
+ 2. **Audit each section** — spawn one `aide-auditor` agent per `.aide` spec found. Each auditor:
13
+ - Reads the implementation
14
+ - Consults the coding playbook via `study-playbook`
15
+ - Compares against progressive disclosure conventions
16
+ - Produces `plan.aide` with refactoring steps
17
+ 3. **Pause for approval** — present all plans to the user. Do not proceed until approved
18
+ 4. **Execute refactoring** — for each approved `plan.aide`, delegate to `aide-implementor` agents (one per numbered step, same as build phase)
19
+ 5. **Re-validate** — delegate to `aide-qa` per section to verify the refactoring didn't break spec conformance
20
+
21
+ ## Checklist
22
+
23
+ - [ ] Require a path argument — refuse to run without one
24
+ - [ ] Run `aide_discover` scoped to the provided path
25
+ - [ ] For each `.aide` spec found, spawn one `aide-auditor` agent
26
+ - [ ] Collect all `plan.aide` outputs and present to user for review
27
+ - [ ] After approval, execute each plan using `aide-implementor` agents (one per numbered step)
28
+ - [ ] After all plans are executed, run `aide-qa` per section to verify spec outcomes still hold
29
+ - [ ] Report completion with a summary of drift items found, fixed, and verified
@@ -0,0 +1,21 @@
1
+ # /aide:research — Research Phase (Optional)
2
+
3
+ > **Agent:** This command is executed by the `aide-domain-expert` agent.
4
+
5
+ Fill the brain with durable domain knowledge the synthesizer can later draw from. Run this phase only when the module requires domain expertise the team does not already have — skip it when the domain is already understood.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Confirm research is actually needed. If the user or the brain already has the domain knowledge, stop and go directly to `/aide:synthesize`
10
+ - [ ] Identify the domain being researched — name it specifically enough that the brain can file the output under a stable topic
11
+ - [ ] Check the brain first for existing research on the topic. If coverage is already sufficient, stop — do not re-fetch what the brain already holds
12
+ - [ ] Gather sources: vault notes, transcripts, external articles, web search, MCP memory stores
13
+ - [ ] Synthesize findings and persist them to the brain **filed by domain** (e.g., `research/email-marketing/`, `research/local-seo/`), not by project. Domain knowledge is reusable across projects
14
+ - [ ] If no external brain is available, write findings to a co-located `research.aide` file next to the intent spec as a fallback. This is not ideal — recommend enabling an external memory store
15
+ - [ ] Each persisted note should include:
16
+ - Sources with ratings and dates
17
+ - Data points with attribution
18
+ - Patterns observed across sources
19
+ - Conflicts resolved (where sources disagreed, which direction chosen and why)
20
+ - [ ] Stop when coverage is sufficient for the synthesizer to fill the `.aide` body sections, not when all sources are exhausted
21
+ - [ ] Hand off to `/aide:synthesize` — the strategist (fresh session) will read your research and fill the spec's body sections
@@ -0,0 +1,24 @@
1
+ # /aide:spec — Spec Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-spec-writer` agent.
4
+
5
+ Produce the `.aide` intent spec **frontmatter only**. This is the spec-writing phase — the session that distills the orchestrator's delegation context into a falsifiable intent contract. The orchestrator owns the user conversation and passes the gathered context in the delegation prompt. Body sections (Context, Strategy, examples) are filled later by the strategist in `/aide:synthesize` after research is complete.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Read the delegation context from the orchestrator. If insufficient to write specific outcomes (missing: what the module is for, who consumes its output, what success looks like, what failure looks like), return to the orchestrator listing what's missing
10
+ - [ ] Read the AIDE template before writing — copy the fenced template block from the canonical template doc into the new file
11
+ - [ ] Decide filename:
12
+ - Use `.aide` if no `research.aide` exists in the target folder
13
+ - Use `intent.aide` if `research.aide` exists in the same folder (co-located research is an escape hatch — prefer the brain)
14
+ - [ ] Fill the frontmatter ONLY:
15
+ - `scope` — the module path this spec governs
16
+ - `intent` — one paragraph, plain language, ten-second north star
17
+ - `outcomes.desired` — concrete, falsifiable success criteria
18
+ - `outcomes.undesired` — failure modes, especially the almost-right-but-wrong kind
19
+ - [ ] Leave body sections (`## Context`, `## Strategy`, `## Good examples`, `## Bad examples`) as empty placeholders — the strategist fills these in `/aide:synthesize`
20
+ - [ ] No code in the spec — no file paths, no type signatures, no function names
21
+ - [ ] Every `outcomes` entry must trace back to the `intent` paragraph. Cut any outcome that doesn't
22
+ - [ ] Present the frontmatter to the orchestrator for relay to the user
23
+ - [ ] Run `aide_validate` to check the spec for structural issues
24
+ - [ ] Hand off to `/aide:research` if domain knowledge is needed, or `/aide:synthesize` if the brain already has sufficient research
@@ -0,0 +1,20 @@
1
+ # /aide:synthesize — Synthesize Phase
2
+
3
+ > **Agent:** This command is executed by the `aide-strategist` agent.
4
+
5
+ Read the intent spec's frontmatter and the brain's research, then fill in the `.aide` body sections (Context, Strategy, Good examples, Bad examples). This is a fresh strategist session — it did not run the research phase and carries no prior context.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Read the target `.aide` file. Confirm frontmatter is complete (scope, intent, outcomes.desired, outcomes.undesired). If frontmatter is missing or incomplete, stop and escalate back to `/aide:spec`
10
+ - [ ] Identify the domain from the intent. Search the brain for research notes filed under that domain (e.g., `research/email-marketing/`, `research/local-seo/`)
11
+ - [ ] If no brain is available, check for a co-located `research.aide` in the same folder as the intent spec
12
+ - [ ] If neither brain research nor `research.aide` exists, stop — research must run first via `/aide:research`
13
+ - [ ] Read all relevant research notes. Cross-reference findings against the intent's `outcomes.desired` and `outcomes.undesired` — the research serves the intent, not the other way around
14
+ - [ ] Fill `## Context` — why this module exists, the domain-level problem, constraints that shape it. Write for a generalist engineer. No code. Do not restate context already carried by a parent `.aide`
15
+ - [ ] Fill `## Strategy` — distill research into decisions. Each paragraph names a concrete choice (tactic, threshold, structural decision) and the reasoning or data that justifies it. Cite sources inline. Write in decision form, not description form. No code
16
+ - [ ] Fill `## Good examples` — concrete domain output that illustrates success. Real output, not code. Pattern material for QA
17
+ - [ ] Fill `## Bad examples` — the almost-right failures. Output that looks valid but violates intent. Recognizable failure modes, not enumeration
18
+ - [ ] Verify every strategy decision traces back to an `outcomes.desired` or guards against an `outcomes.undesired`. Cut anything that doesn't serve the intent
19
+ - [ ] Run `aide_validate` to check the completed spec for structural issues
20
+ - [ ] Hand off to `/aide:plan` — the architect is the next phase
@@ -0,0 +1,18 @@
1
+ # /aide:update-playbook — Playbook Maintenance
2
+
3
+ > **Agent:** You are the orchestrator for this command. Do NOT delegate to a subagent.
4
+
5
+ Help the user add new conventions, modify existing ones, or reorganize sections in their coding playbook. Every invocation ends with a required drift-detection step that keeps the playbook hub's task routing table in sync with the actual section structure.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Ask the user what they want to change — new convention, modification to an existing one, section rename, section removal, or a general audit with no specific change
10
+ - [ ] Use the `study-playbook` skill to read the hub and identify the relevant section (or confirm no section yet exists for the new convention)
11
+ - [ ] Make the requested change: add the new content, edit the existing section, rename or remove the section as directed
12
+ - [ ] If a section was added, renamed, or removed, offer to reorganize adjacent sections under a new or updated domain grouping if it would improve navigability
13
+ - [ ] **Housekeeping step (required — do not skip):** Compare the playbook hub's task routing table against the actual sections that now exist:
14
+ - For each row in the routing table: does the section it points to still exist under that name? Flag stale rows where the target section was renamed or removed
15
+ - For each section now in the playbook: does the routing table have at least one row covering it? Flag new sections with no routing entry
16
+ - Offer to reconcile all drift found — add missing rows, remove or update stale rows, suggest domain regroupings where the table has shifted
17
+ - [ ] Apply any routing table changes the user approves
18
+ - [ ] Confirm the final state: what was changed in the playbook, what was changed in the routing table