all-hands-cli 0.1.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 (305) hide show
  1. package/.allhands/README.md +75 -0
  2. package/.allhands/agents/compounder.yaml +15 -0
  3. package/.allhands/agents/coordinator.yaml +17 -0
  4. package/.allhands/agents/documentor.yaml +15 -0
  5. package/.allhands/agents/e2e-test-planner.yaml +17 -0
  6. package/.allhands/agents/emergent.yaml +22 -0
  7. package/.allhands/agents/executor.yaml +14 -0
  8. package/.allhands/agents/ideation.yaml +11 -0
  9. package/.allhands/agents/initiative-steering.yaml +19 -0
  10. package/.allhands/agents/judge.yaml +13 -0
  11. package/.allhands/agents/planner.yaml +19 -0
  12. package/.allhands/agents/pr-reviewer.yaml +15 -0
  13. package/.allhands/docs.json +5 -0
  14. package/.allhands/docs.local.json +26 -0
  15. package/.allhands/flows/COMPOUNDING.md +203 -0
  16. package/.allhands/flows/COORDINATION.md +89 -0
  17. package/.allhands/flows/CORE.md +87 -0
  18. package/.allhands/flows/DOCUMENTATION.md +218 -0
  19. package/.allhands/flows/E2E_TEST_PLAN_BUILDING.md +140 -0
  20. package/.allhands/flows/EMERGENT_PLANNING.md +57 -0
  21. package/.allhands/flows/IDEATION_SCOPING.md +154 -0
  22. package/.allhands/flows/INITIATIVE_STEERING.md +110 -0
  23. package/.allhands/flows/JUDGE_REVIEWING.md +79 -0
  24. package/.allhands/flows/PROMPT_TASK_EXECUTION.md +68 -0
  25. package/.allhands/flows/PR_REVIEWING.md +43 -0
  26. package/.allhands/flows/SPEC_PLANNING.md +216 -0
  27. package/.allhands/flows/harness/WRITING_HARNESS_FLOWS.md +27 -0
  28. package/.allhands/flows/harness/WRITING_HARNESS_KNOWLEDGE.md +27 -0
  29. package/.allhands/flows/harness/WRITING_HARNESS_ORCHESTRATION.md +27 -0
  30. package/.allhands/flows/harness/WRITING_HARNESS_SKILLS.md +27 -0
  31. package/.allhands/flows/harness/WRITING_HARNESS_TOOLS.md +27 -0
  32. package/.allhands/flows/harness/WRITING_HARNESS_VALIDATION_TOOLING.md +27 -0
  33. package/.allhands/flows/shared/CODEBASE_UNDERSTANDING.md +72 -0
  34. package/.allhands/flows/shared/CREATE_HARNESS_SPEC.md +48 -0
  35. package/.allhands/flows/shared/CREATE_SPEC.md +41 -0
  36. package/.allhands/flows/shared/CREATE_VALIDATION_TOOLING_SPEC.md +70 -0
  37. package/.allhands/flows/shared/DOCUMENTATION_DISCOVERY.md +123 -0
  38. package/.allhands/flows/shared/DOCUMENTATION_WRITER.md +101 -0
  39. package/.allhands/flows/shared/EMERGENT_REFINEMENT_ANALYSIS.md +76 -0
  40. package/.allhands/flows/shared/EXTERNAL_TECH_GUIDANCE.md +97 -0
  41. package/.allhands/flows/shared/IDEATION_CODEBASE_GROUNDING.md +49 -0
  42. package/.allhands/flows/shared/PLAN_DEEPENING.md +152 -0
  43. package/.allhands/flows/shared/PROMPT_TASKS_CURATION.md +113 -0
  44. package/.allhands/flows/shared/PROMPT_VALIDATION_REVIEW.MD +99 -0
  45. package/.allhands/flows/shared/QUICK_PREMORTEM.md +70 -0
  46. package/.allhands/flows/shared/RESEARCH_GUIDANCE.md +38 -0
  47. package/.allhands/flows/shared/REVIEW_OPTIONS_BREAKDOWN.md +68 -0
  48. package/.allhands/flows/shared/SKILL_EXTRACTION.md +84 -0
  49. package/.allhands/flows/shared/SPEC_FLOW_ANALYSIS.md +119 -0
  50. package/.allhands/flows/shared/TDD_WORKFLOW.md +109 -0
  51. package/.allhands/flows/shared/UTILIZE_VALIDATION_TOOLING.md +84 -0
  52. package/.allhands/flows/shared/WRITING_HARNESS_FLOWS.md +11 -0
  53. package/.allhands/flows/shared/WRITING_HARNESS_MCP_TOOLS.md +84 -0
  54. package/.allhands/flows/shared/jury/ARCHITECTURE_REVIEW.md +91 -0
  55. package/.allhands/flows/shared/jury/BEST_PRACTICES_REVIEW.md +80 -0
  56. package/.allhands/flows/shared/jury/CLAIM_VERIFICATION_REVIEW.md +101 -0
  57. package/.allhands/flows/shared/jury/EXPECTATIONS_FIT_REVIEW.md +78 -0
  58. package/.allhands/flows/shared/jury/MAINTAINABILITY_REVIEW.md +110 -0
  59. package/.allhands/flows/shared/jury/PROMPTS_EXPECTATIONS_FIT.md +74 -0
  60. package/.allhands/flows/shared/jury/PROMPTS_FLOW_ANALYSIS.md +92 -0
  61. package/.allhands/flows/shared/jury/PROMPTS_YAGNI.md +78 -0
  62. package/.allhands/flows/shared/jury/PROMPT_PREMORTEM.md +125 -0
  63. package/.allhands/flows/shared/jury/SECURITY_REVIEW.md +86 -0
  64. package/.allhands/flows/shared/jury/YAGNI_REVIEW.md +82 -0
  65. package/.allhands/flows/wip/DEBUG_INVESTIGATION.md +162 -0
  66. package/.allhands/flows/wip/MEMORY_RECALL.md +62 -0
  67. package/.allhands/harness/ah +131 -0
  68. package/.allhands/harness/package-lock.json +5292 -0
  69. package/.allhands/harness/package.json +52 -0
  70. package/.allhands/harness/src/__tests__/e2e/commands.test.ts +307 -0
  71. package/.allhands/harness/src/__tests__/e2e/event-loop.test.ts +539 -0
  72. package/.allhands/harness/src/__tests__/e2e/hooks.test.ts +427 -0
  73. package/.allhands/harness/src/__tests__/e2e/new-initiative-routing.test.ts +137 -0
  74. package/.allhands/harness/src/__tests__/e2e/run-e2e.ts +109 -0
  75. package/.allhands/harness/src/__tests__/e2e/specs-type.test.ts +210 -0
  76. package/.allhands/harness/src/__tests__/e2e/validation-hooks.test.ts +669 -0
  77. package/.allhands/harness/src/__tests__/e2e/validation-path-consistency.test.ts +354 -0
  78. package/.allhands/harness/src/__tests__/e2e/validation.test.ts +528 -0
  79. package/.allhands/harness/src/__tests__/harness/assertions.ts +318 -0
  80. package/.allhands/harness/src/__tests__/harness/cli-runner.ts +359 -0
  81. package/.allhands/harness/src/__tests__/harness/fixture.ts +384 -0
  82. package/.allhands/harness/src/__tests__/harness/hook-runner.ts +411 -0
  83. package/.allhands/harness/src/__tests__/harness/index.ts +122 -0
  84. package/.allhands/harness/src/cli.ts +36 -0
  85. package/.allhands/harness/src/commands/complexity.ts +177 -0
  86. package/.allhands/harness/src/commands/context7.ts +202 -0
  87. package/.allhands/harness/src/commands/docs.ts +557 -0
  88. package/.allhands/harness/src/commands/hooks.ts +24 -0
  89. package/.allhands/harness/src/commands/index.ts +51 -0
  90. package/.allhands/harness/src/commands/knowledge.ts +382 -0
  91. package/.allhands/harness/src/commands/memories.ts +302 -0
  92. package/.allhands/harness/src/commands/notify.ts +61 -0
  93. package/.allhands/harness/src/commands/oracle.ts +158 -0
  94. package/.allhands/harness/src/commands/perplexity.ts +220 -0
  95. package/.allhands/harness/src/commands/planning.ts +245 -0
  96. package/.allhands/harness/src/commands/schema.ts +73 -0
  97. package/.allhands/harness/src/commands/skills.ts +128 -0
  98. package/.allhands/harness/src/commands/solutions.ts +353 -0
  99. package/.allhands/harness/src/commands/spawn.ts +158 -0
  100. package/.allhands/harness/src/commands/specs.ts +532 -0
  101. package/.allhands/harness/src/commands/tavily.ts +226 -0
  102. package/.allhands/harness/src/commands/tools.ts +579 -0
  103. package/.allhands/harness/src/commands/trace.ts +327 -0
  104. package/.allhands/harness/src/commands/tui.ts +960 -0
  105. package/.allhands/harness/src/commands/validate.ts +143 -0
  106. package/.allhands/harness/src/commands/validation-tools.ts +108 -0
  107. package/.allhands/harness/src/hooks/context.ts +1442 -0
  108. package/.allhands/harness/src/hooks/enforcement.ts +170 -0
  109. package/.allhands/harness/src/hooks/index.ts +54 -0
  110. package/.allhands/harness/src/hooks/lifecycle.ts +229 -0
  111. package/.allhands/harness/src/hooks/notification.ts +104 -0
  112. package/.allhands/harness/src/hooks/observability.ts +551 -0
  113. package/.allhands/harness/src/hooks/session.ts +88 -0
  114. package/.allhands/harness/src/hooks/shared.ts +815 -0
  115. package/.allhands/harness/src/hooks/transcript-parser.ts +208 -0
  116. package/.allhands/harness/src/hooks/validation.ts +617 -0
  117. package/.allhands/harness/src/lib/__tests__/ctags.test.ts +244 -0
  118. package/.allhands/harness/src/lib/__tests__/docs-validation.test.ts +344 -0
  119. package/.allhands/harness/src/lib/__tests__/mcp-runtime.test.ts +190 -0
  120. package/.allhands/harness/src/lib/__tests__/schema.test.ts +861 -0
  121. package/.allhands/harness/src/lib/base-command.ts +198 -0
  122. package/.allhands/harness/src/lib/cli-daemon.ts +343 -0
  123. package/.allhands/harness/src/lib/compaction.ts +313 -0
  124. package/.allhands/harness/src/lib/ctags.ts +497 -0
  125. package/.allhands/harness/src/lib/docs-validation.ts +907 -0
  126. package/.allhands/harness/src/lib/event-loop.ts +662 -0
  127. package/.allhands/harness/src/lib/flows.ts +155 -0
  128. package/.allhands/harness/src/lib/git.ts +276 -0
  129. package/.allhands/harness/src/lib/knowledge-worker.ts +72 -0
  130. package/.allhands/harness/src/lib/knowledge.ts +810 -0
  131. package/.allhands/harness/src/lib/llm.ts +255 -0
  132. package/.allhands/harness/src/lib/mcp-client.ts +432 -0
  133. package/.allhands/harness/src/lib/mcp-daemon.ts +486 -0
  134. package/.allhands/harness/src/lib/mcp-runtime.ts +418 -0
  135. package/.allhands/harness/src/lib/notification.ts +115 -0
  136. package/.allhands/harness/src/lib/opencode/index.ts +70 -0
  137. package/.allhands/harness/src/lib/opencode/profiles.ts +300 -0
  138. package/.allhands/harness/src/lib/opencode/prompts/codesearch.md +98 -0
  139. package/.allhands/harness/src/lib/opencode/prompts/knowledge-aggregator.md +67 -0
  140. package/.allhands/harness/src/lib/opencode/runner.ts +281 -0
  141. package/.allhands/harness/src/lib/oracle.ts +926 -0
  142. package/.allhands/harness/src/lib/planning-utils.ts +150 -0
  143. package/.allhands/harness/src/lib/planning.ts +605 -0
  144. package/.allhands/harness/src/lib/pr-review.ts +225 -0
  145. package/.allhands/harness/src/lib/prompts.ts +522 -0
  146. package/.allhands/harness/src/lib/schema.ts +418 -0
  147. package/.allhands/harness/src/lib/schemas/agent-profile.ts +141 -0
  148. package/.allhands/harness/src/lib/schemas/template-vars.ts +138 -0
  149. package/.allhands/harness/src/lib/session.ts +164 -0
  150. package/.allhands/harness/src/lib/specs.ts +348 -0
  151. package/.allhands/harness/src/lib/tldr.ts +829 -0
  152. package/.allhands/harness/src/lib/tmux.ts +1051 -0
  153. package/.allhands/harness/src/lib/trace-store.ts +714 -0
  154. package/.allhands/harness/src/mcp/__tests__/index.test.ts +46 -0
  155. package/.allhands/harness/src/mcp/_template.ts +47 -0
  156. package/.allhands/harness/src/mcp/filesystem.ts +33 -0
  157. package/.allhands/harness/src/mcp/index.ts +69 -0
  158. package/.allhands/harness/src/mcp/playwright.ts +34 -0
  159. package/.allhands/harness/src/mcp/xcodebuild.ts +29 -0
  160. package/.allhands/harness/src/schemas/docs.schema.json +44 -0
  161. package/.allhands/harness/src/schemas/settings.schema.json +214 -0
  162. package/.allhands/harness/src/tui/actions.ts +227 -0
  163. package/.allhands/harness/src/tui/file-viewer-modal.ts +270 -0
  164. package/.allhands/harness/src/tui/index.ts +1574 -0
  165. package/.allhands/harness/src/tui/modal.ts +232 -0
  166. package/.allhands/harness/src/tui/prompts-pane.ts +186 -0
  167. package/.allhands/harness/src/tui/status-pane.ts +434 -0
  168. package/.allhands/harness/tsconfig.json +22 -0
  169. package/.allhands/harness/vitest.config.ts +13 -0
  170. package/.allhands/pillars.md +33 -0
  171. package/.allhands/principles.md +88 -0
  172. package/.allhands/schemas/alignment.yaml +51 -0
  173. package/.allhands/schemas/documentation.yaml +10 -0
  174. package/.allhands/schemas/prompt.yaml +92 -0
  175. package/.allhands/schemas/skill.yaml +34 -0
  176. package/.allhands/schemas/solution.yaml +131 -0
  177. package/.allhands/schemas/spec.yaml +67 -0
  178. package/.allhands/schemas/validation-suite.yaml +49 -0
  179. package/.allhands/schemas/workflow.yaml +51 -0
  180. package/.allhands/settings.json +57 -0
  181. package/.allhands/skills/claude-code-patterns/SKILL.md +60 -0
  182. package/.allhands/skills/claude-code-patterns/docs/context-hygiene.md +19 -0
  183. package/.allhands/skills/harness-maintenance/SKILL.md +449 -0
  184. package/.allhands/skills/harness-maintenance/references/core-architecture.md +187 -0
  185. package/.allhands/skills/harness-maintenance/references/harness-skills.md +87 -0
  186. package/.allhands/skills/harness-maintenance/references/knowledge-compounding.md +78 -0
  187. package/.allhands/skills/harness-maintenance/references/tools-commands-mcp-hooks.md +115 -0
  188. package/.allhands/skills/harness-maintenance/references/validation-tooling.md +77 -0
  189. package/.allhands/skills/harness-maintenance/references/writing-flows.md +84 -0
  190. package/.allhands/validation/browser-automation.md +109 -0
  191. package/.allhands/validation/xcode-automation.md +195 -0
  192. package/.allhands/workflows/documentation.md +86 -0
  193. package/.allhands/workflows/investigation.md +81 -0
  194. package/.allhands/workflows/milestone.md +91 -0
  195. package/.allhands/workflows/optimization.md +85 -0
  196. package/.allhands/workflows/refactor.md +99 -0
  197. package/.allhands/workflows/triage.md +81 -0
  198. package/.claude/README.md +1 -0
  199. package/.claude/agents/explorer.md +10 -0
  200. package/.claude/agents/researcher.md +11 -0
  201. package/.claude/agents/task-runner.md +8 -0
  202. package/.claude/settings.json +231 -0
  203. package/.env.ai.example +7 -0
  204. package/.github/workflows/npm-publish.yml +69 -0
  205. package/.internal.json +45 -0
  206. package/.tldr/config.json +11 -0
  207. package/.tldrignore +90 -0
  208. package/CLAUDE.md +6 -0
  209. package/README.md +98 -0
  210. package/bin/sync-cli.js +7552 -0
  211. package/concerns.md +7 -0
  212. package/docs/README.md +41 -0
  213. package/docs/agents/README.md +24 -0
  214. package/docs/agents/agent-configuration-system.md +86 -0
  215. package/docs/agents/execution-agents.md +50 -0
  216. package/docs/agents/knowledge-agents.md +61 -0
  217. package/docs/agents/orchestration-agent.md +57 -0
  218. package/docs/agents/planning-agents.md +84 -0
  219. package/docs/agents/quality-review-agents.md +67 -0
  220. package/docs/agents/workflow-agent-orchestration.md +69 -0
  221. package/docs/flows/README.md +44 -0
  222. package/docs/flows/compounding.md +126 -0
  223. package/docs/flows/coordination.md +72 -0
  224. package/docs/flows/core-harness-integration.md +63 -0
  225. package/docs/flows/documentation-orchestration.md +98 -0
  226. package/docs/flows/e2e-test-plan-building.md +83 -0
  227. package/docs/flows/emergent-refinement.md +104 -0
  228. package/docs/flows/flow-authoring-and-mcp-tools.md +89 -0
  229. package/docs/flows/judge-reviewing.md +112 -0
  230. package/docs/flows/plan-deepening-and-research.md +107 -0
  231. package/docs/flows/plan-review-jury.md +114 -0
  232. package/docs/flows/pr-reviewing.md +54 -0
  233. package/docs/flows/prompt-task-execution.md +119 -0
  234. package/docs/flows/spec-planning.md +162 -0
  235. package/docs/flows/type-specific-scoping-flows.md +49 -0
  236. package/docs/flows/validation-and-skills-integration.md +145 -0
  237. package/docs/flows/wip/wip-flows.md +102 -0
  238. package/docs/harness/README.md +23 -0
  239. package/docs/harness/agent-profiles.md +84 -0
  240. package/docs/harness/cli/README.md +24 -0
  241. package/docs/harness/cli/cli-entry-and-command-discovery.md +91 -0
  242. package/docs/harness/cli/docs-command.md +87 -0
  243. package/docs/harness/cli/knowledge-command.md +91 -0
  244. package/docs/harness/cli/minor-cli-commands.md +65 -0
  245. package/docs/harness/cli/oracle-command.md +113 -0
  246. package/docs/harness/cli/planning-command.md +95 -0
  247. package/docs/harness/cli/schema-and-validation-commands.md +154 -0
  248. package/docs/harness/cli/search-commands.md +97 -0
  249. package/docs/harness/cli/spawn-command.md +136 -0
  250. package/docs/harness/cli/specs-command.md +102 -0
  251. package/docs/harness/cli/tools-command.md +122 -0
  252. package/docs/harness/cli/trace-command.md +122 -0
  253. package/docs/harness/cli-daemon.md +92 -0
  254. package/docs/harness/event-loop.md +184 -0
  255. package/docs/harness/hooks/README.md +15 -0
  256. package/docs/harness/hooks/context-hooks.md +96 -0
  257. package/docs/harness/hooks/lifecycle-and-observability-hooks.md +135 -0
  258. package/docs/harness/hooks/validation-hooks.md +97 -0
  259. package/docs/harness/test-harness.md +149 -0
  260. package/docs/harness/tui.md +176 -0
  261. package/docs/memories.md +20 -0
  262. package/docs/solutions/agentic-issues/premature-agent-deletion-tui-action-dependency-20260130.md +49 -0
  263. package/docs/solutions/agentic-issues/ref-anchor-scope-mismatch-skill-references-20260131.md +55 -0
  264. package/docs/solutions/agentic-issues/tautological-tests-routing-20260131.md +52 -0
  265. package/docs/solutions/integration_issue/blocktool-output-format-mismatch-hook-runner-20260130.md +52 -0
  266. package/docs/solutions/integration_issue/dual-validation-path-divergence-schema-20260130.md +66 -0
  267. package/docs/solutions/security-issues/unsanitized-domain-path-join-20260131.md +52 -0
  268. package/docs/solutions/test-failures/event-loop-mock-ordering-checkAgentWindows-20260130.md +63 -0
  269. package/docs/sync-cli/README.md +19 -0
  270. package/docs/sync-cli/cli-entrypoint-and-commands.md +39 -0
  271. package/docs/sync-cli/commands/README.md +11 -0
  272. package/docs/sync-cli/commands/pull-manifest-command.md +36 -0
  273. package/docs/sync-cli/commands/push-command.md +84 -0
  274. package/docs/sync-cli/commands/sync-command.md +71 -0
  275. package/docs/sync-cli/systems/README.md +14 -0
  276. package/docs/sync-cli/systems/git-and-github-integration.md +49 -0
  277. package/docs/sync-cli/systems/interactive-ui.md +43 -0
  278. package/docs/sync-cli/systems/manifest-and-distribution.md +51 -0
  279. package/docs/sync-cli/systems/path-resolution.md +42 -0
  280. package/package.json +46 -0
  281. package/scripts/install-shim.sh +40 -0
  282. package/scripts/pre-pack.sh +25 -0
  283. package/specs/harness-maintenance-skill.spec.md +138 -0
  284. package/specs/roadmap/git-spec-lifecycle-management.spec.md +113 -0
  285. package/specs/sync-init-flag.spec.md +117 -0
  286. package/specs/unified-workflow-orchestration.spec.md +250 -0
  287. package/specs/validation-tooling-practice.spec.md +98 -0
  288. package/specs/workflow-domain-configuration.spec.md +265 -0
  289. package/src/commands/pull-manifest.ts +31 -0
  290. package/src/commands/push.ts +344 -0
  291. package/src/commands/sync.ts +289 -0
  292. package/src/lib/constants.ts +10 -0
  293. package/src/lib/dotfiles.ts +36 -0
  294. package/src/lib/fs-utils.ts +18 -0
  295. package/src/lib/gh.ts +40 -0
  296. package/src/lib/git.ts +63 -0
  297. package/src/lib/gitignore.ts +167 -0
  298. package/src/lib/manifest.ts +121 -0
  299. package/src/lib/marker-sync.ts +39 -0
  300. package/src/lib/paths.ts +38 -0
  301. package/src/lib/target-lines.ts +66 -0
  302. package/src/lib/ui.ts +78 -0
  303. package/src/sync-cli.ts +120 -0
  304. package/target-lines.json +23 -0
  305. package/tsconfig.json +20 -0
@@ -0,0 +1,87 @@
1
+ <goal>
2
+ Core harness integration for all agents. Per **Context is Precious**
3
+ </goal>
4
+
5
+
6
+ ## Flow Delegation
7
+
8
+ Per **Context is Precious**, when a flow instructs you to delegate a sub-flow to a subtask (e.g., "tell them to read", "spawn subtask to read"):
9
+ - Tell the subtask to read the flow file — do NOT read it yourself first
10
+ - The sub-flow's content is intended for the subtask's context, not yours
11
+ - You only need to know what the subtask will accomplish, not how the sub-flow instructs it
12
+
13
+ **MUST use `ah knowledge docs search <descriptive_query>` for code search tied to crucial project knowledge for any codebase discovery needs**
14
+
15
+ **You MUST use `tldr` tooling when retrieving codebase / file context using the following rules:**
16
+
17
+ ## Must start with:
18
+ - `tldr semantic search <descriptive_query_of_functionality>`
19
+
20
+ ## Must follow up with:
21
+
22
+ ```bash
23
+ # Core analysis
24
+ tldr tree [path] # File tree
25
+ tldr structure [path] --lang <lang> # Code structure (codemaps)
26
+ tldr search <pattern> [path] # Search files
27
+ tldr extract <file> # Full file info
28
+ tldr context <entry> --project . # LLM-ready context
29
+
30
+ # Flow analysis
31
+ tldr cfg <file> <function> # Control flow graph
32
+ tldr dfg <file> <function> # Data flow graph
33
+ tldr slice <file> <func> <line> # Program slice
34
+ tldr calls [path] # Cross-file call graph
35
+
36
+ # Codebase analysis
37
+ tldr impact <func> [path] # Who calls this function? (reverse call graph)
38
+ tldr dead [path] # Find unreachable/dead code
39
+ tldr arch [path] # Detect architectural layers
40
+
41
+ # Import analysis
42
+ tldr imports <file> # Parse imports from a file
43
+ tldr importers <module> [path] # Find all files that import a module
44
+
45
+ # Quality & testing (NEW)
46
+ tldr diagnostics <file|path> # Type check + lint (pyright/ruff)
47
+ ```
48
+
49
+ ## When to Use
50
+
51
+ - **Before reading files**: Run `tldr structure .` to see what exists
52
+ - **Finding code**: Use `tldr search "pattern"` instead of grep for structured results
53
+ - **Understanding functions**: Use `tldr cfg` for complexity, `tldr dfg` for data flow
54
+ - **Debugging**: Use `tldr slice file.py func 42` to find what affects line 42
55
+ - **Context for tasks**: Use `tldr context entry_point` to get relevant code
56
+ - **Impact analysis**: Use `tldr impact func_name` before refactoring to see what would break
57
+ - **Dead code**: Use `tldr dead src/` to find unused functions for cleanup
58
+ - **Architecture**: Use `tldr arch src/` to understand layer structure
59
+ - **Import tracking**: Use `tldr imports file.py` to see what a file imports
60
+ - **Reverse imports**: Use `tldr importers module_name src/` to find who imports a module
61
+ - **Before tests**: Use `tldr diagnostics .` to catch type errors before running tests
62
+
63
+ ## Languages
64
+
65
+ Supports: `python`, `typescript`, `go`, `rust`
66
+
67
+ ## Example Workflow
68
+
69
+ ```bash
70
+ # 1. See project structure
71
+ tldr tree src/ --ext .py
72
+
73
+ # 2. Find relevant code
74
+ tldr search "process_data" src/
75
+
76
+ # 3. Get context for a function
77
+ tldr context process_data --project src/ --depth 2
78
+
79
+ # 4. Understand control flow
80
+ tldr cfg src/processor.py process_data
81
+
82
+ # 5. Before refactoring - check impact
83
+ tldr impact process_data src/ --depth 3
84
+
85
+ # 6. Find dead code to clean up
86
+ tldr dead src/ --entry main cli
87
+ ```
@@ -0,0 +1,218 @@
1
+ <goal>
2
+ Orchestrate documentation creation and maintenance. Per **Knowledge Compounding**, docs expose engineering knowledge via file references and LSP symbols for semantic discovery. Per **Context is Precious**, delegate discovery and writing to sub-agents.
3
+
4
+ Engineering knowledge comes from prompts, commit messages, and alignment docs when available (Incremental mode), otherwise inferred from the code itself (Fill-the-Gaps mode).
5
+
6
+ **Execute immediately** - detect mode and proceed. Do not ask for clarification unless domain confirmation is needed.
7
+ </goal>
8
+
9
+ <constraints>
10
+ - MUST verify clean working tree before proceeding (see Pre-flight Check)
11
+ - MUST confirm domains with user before spawning discovery agents
12
+ - MUST run `ah docs validate --json` at start of both modes to identify gaps
13
+ - MUST run `ah knowledge docs reindex` on completion
14
+ - NEVER spawn more than 10 writer agents per run
15
+ - NEVER write command/installation guides - those belong in README.md files
16
+ - NEVER write code snippets or examples - use `[ref:file:Symbol]` file references instead
17
+ - NEVER write to `docs/solutions/` or `docs/memories.md` - those are owned by the Compounding flow
18
+ </constraints>
19
+
20
+ ## Pre-flight Check
21
+
22
+ Before any documentation work, verify the git working tree is clean:
23
+
24
+ ```bash
25
+ git status --porcelain
26
+ ```
27
+
28
+ If output is non-empty, **abort with error**:
29
+ > "Uncommitted changes detected. Documentation requires a clean working tree because file references use git commit hashes. Please commit or stash your changes before running documentation."
30
+
31
+ **Why this matters:**
32
+ - File references use `[ref:file:symbol:hash]` format where hash comes from git
33
+ - Uncommitted files have no git hash → finalize fails
34
+ - Modified files get stale hashes → refs become invalid immediately after commit
35
+
36
+ ## Mode Detection
37
+
38
+ Check the message for template variables passed by the documentor agent:
39
+
40
+ ```
41
+ ├─ ALIGNMENT_PATH + PROMPTS_FOLDER provided? → Incremental Mode (feature branch)
42
+ └─ Variables empty or not provided? → Fill-the-Gaps Mode (cold start or refresh)
43
+ ```
44
+
45
+ The documentor agent passes `SPEC_PATH`, `ALIGNMENT_PATH`, and `PROMPTS_FOLDER` when invoked from a spec context. Empty values mean no spec is selected.
46
+
47
+ **Default behavior**: If no message/prompt is provided and no context variables are set, proceed directly with Fill-the-Gaps mode. Do not ask the user what to do - just start documenting.
48
+
49
+ ## Config Resolution
50
+
51
+ Documentation config uses a **local-first** resolution — the same pattern as `.claude/settings.local.json`:
52
+
53
+ ```
54
+ .allhands/docs.local.json → exists? use it (repo-specific, never distributed)
55
+ .allhands/docs.json → fallback (ships to target repos on --init)
56
+ ```
57
+
58
+ Read whichever file resolves. All subsequent reads and writes in this flow use that resolved path. When persisting detected domains or exclusions, write back to the same file that was read.
59
+
60
+ ---
61
+
62
+ ## Fill-the-Gaps Mode
63
+
64
+ Full documentation effort for new repos or out-of-sync docs.
65
+
66
+ ### Initialization
67
+
68
+ 1. **Initial Validation** - Run `ah docs validate --json` to identify:
69
+ - Invalid refs (gaps in documentation)
70
+ - Stale refs (out-of-sync with code)
71
+ - Missing frontmatter
72
+
73
+ 2. **Domain Detection**
74
+ - Resolve docs config per **Config Resolution** above (optional — projects don't need either file)
75
+ - Load `domains` and `exclude` glob patterns from the resolved config
76
+ - If domains not declared, infer:
77
+ - Run `tldr structure .` or `ah complexity .` on project root
78
+ - Check for monorepo markers: `pnpm-workspace.yaml`, `lerna.json`, `turbo.json`, `nx.json`
79
+ - If monorepo: each workspace package is a domain, plus root-level coordination docs
80
+ - Otherwise: identify main product areas from directory structure
81
+ - Present detected domains to user for confirmation
82
+ - Persist confirmed domains (and any existing `exclude` patterns) back to the resolved config file. Always write this file, whether user adjusted or accepted defaults — it codifies the domain map for future incremental runs.
83
+
84
+ 3. **Proceed to Core Flow** with:
85
+ ```yaml
86
+ mode: "fill-gaps"
87
+ domains: [<confirmed domains>]
88
+ exclude: [<glob patterns from resolved config>] # may be empty
89
+ validation_issues: <from initial validation>
90
+ existing_docs: []
91
+ session_knowledge: null
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Incremental Mode
97
+
98
+ Feature branch documentation with session knowledge.
99
+
100
+ ### Initialization
101
+
102
+ 1. **Context Gathering**
103
+ - Read alignment doc at `ALIGNMENT_PATH` for milestone context and key decisions
104
+ - Read prompt files in `PROMPTS_FOLDER` for task details and learnings
105
+ - Resolve docs config per **Config Resolution** above for `exclude` glob patterns
106
+ - Run `git diff $(git merge-base HEAD main)..HEAD --name-only` for changed files
107
+ - Filter changed files against `exclude` patterns — excluded files are not documented even if changed
108
+
109
+ 2. **Initial Validation** - Run `ah docs validate --json` to identify current staleness
110
+
111
+ 3. **Impact Analysis**
112
+ - Run `ah knowledge docs search` with changed file paths (post-exclusion) to find related docs
113
+ - Categorize changes:
114
+ - **Edit**: existing docs reference changed code
115
+ - **Create**: new functionality without doc coverage
116
+ - **Stale**: validation found outdated refs
117
+
118
+ 4. **Proceed to Core Flow** with:
119
+ ```yaml
120
+ mode: "incremental"
121
+ domains: [<affected domains only>]
122
+ exclude: [<glob patterns from resolved config>] # may be empty
123
+ validation_issues: <from initial validation>
124
+ existing_docs: [<docs needing edits>]
125
+ session_knowledge:
126
+ commit_messages: "<relevant commits>"
127
+ alignment_summary: "<key decisions>"
128
+ prompt_learnings: "<deviations and discoveries>"
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Core Flow
134
+
135
+ Shared pipeline for both modes after initialization.
136
+
137
+ ### 1. Discovery Phase
138
+
139
+ Per **Context is Precious**, spawn discovery sub-agents:
140
+
141
+ - One sub-agent per domain
142
+ - Instruct each to read `.allhands/flows/shared/DOCUMENTATION_DISCOVERY.md`
143
+ - Provide each:
144
+ ```yaml
145
+ domain: "<domain-name>"
146
+ source_paths: ["<path/to/domain>"] # or changed files in incremental
147
+ exclude: ["<glob>", ...] # from docs.json, may be empty
148
+ mode: "<fill-gaps|incremental>"
149
+ session_context: "<summary from alignment doc>" # incremental only
150
+ ```
151
+ - Await all discovery results
152
+
153
+ ### 2. Aggregate and Plan
154
+
155
+ - Merge approach lists from all discovery agents
156
+ - Filter out approaches with `existing_coverage: "full"`
157
+ - Group approaches into writer assignments:
158
+ - Each writer handles **5-15 approaches** (one domain or related subset)
159
+ - Group by domain and subdirectory
160
+ - Use `ah knowledge docs search` to verify no redundant coverage
161
+ - Target 5-10 writers total; if discovery returned too many approaches, push back
162
+
163
+ ### 3. Writing Phase
164
+
165
+ - Spawn writer sub-agents per assignment (each handles **multiple approaches**)
166
+ - Instruct each to read `.allhands/flows/shared/DOCUMENTATION_WRITER.md`
167
+ - Provide each:
168
+ ```yaml
169
+ domain: "<domain-name>"
170
+ approaches: # Multiple approaches per writer
171
+ - { name: "<approach>", group: "<subdir or null>", files: [...], symbols: [...] }
172
+ doc_directory: "docs/<domain>/"
173
+ existing_docs: [<paths to edit>] # from initialization
174
+ session_knowledge: <from initialization> # null in fill-gaps
175
+ ```
176
+ - Use `group` field to determine file paths:
177
+ - `group: "cli"` → `docs/<domain>/cli/<approach>.md`
178
+ - `group: null` → `docs/<domain>/<approach>.md`
179
+
180
+ ### 4. Post-Processing
181
+
182
+ #### README Generation
183
+
184
+ Per **Knowledge Compounding**, write README.md files that expose cross-domain relationships for semantic discovery. The orchestrator writes these directly — writers lack cross-domain context.
185
+
186
+ - Write `docs/README.md` — top-level overview:
187
+ - List all domains with one-line descriptions
188
+ - Explain cross-domain relationships (e.g., type pipeline from backend → frontend)
189
+ - Link to domain READMEs via backtick paths (e.g., `docs/<domain>/README.md`)
190
+ - Write `docs/<domain>/README.md` for each domain:
191
+ - Overview of the domain's purpose and scope
192
+ - List approaches grouped by subdirectory
193
+ - Cross-references to related domains
194
+ - Link to approach docs via backtick paths (e.g., `docs/<domain>/<approach>.md`)
195
+ - Write `docs/<domain>/<group>/README.md` for each subdirectory with 3+ docs:
196
+ - Brief overview of the group's scope
197
+ - List contained approach docs
198
+
199
+ README.md files MUST use plain backtick relative paths (e.g., `docs/harness/README.md`) instead of `[ref:...]` references when linking to other docs. Per **Knowledge Compounding**, the knowledge index would recursively include referenced docs inside READMEs, inflating search results with duplicate content.
200
+
201
+ All README.md files MUST have frontmatter with `description` (per `ah schema documentation`) for semantic indexing.
202
+
203
+ #### Finalize and Validate
204
+
205
+ - Run `ah docs finalize` (finalizes all docs in docs/)
206
+ - Run `ah docs validate --json`
207
+ - If issues exist:
208
+ - Spawn writer sub-agents to fix (provide stale/invalid refs)
209
+ - Re-run finalize and validate until clean
210
+ - Run `ah knowledge docs reindex`
211
+
212
+ ---
213
+
214
+ ## Completion
215
+
216
+ - Verify `ah docs validate` returns clean
217
+ - Run `ah knowledge docs reindex`
218
+ - Report summary: docs created, edited, domains covered
@@ -0,0 +1,140 @@
1
+ <goal>
2
+ Build an E2E test plan that convinces the engineer of milestone implementation efficacy. Per **Agentic Validation Tooling**, engineers are excluded from prompt-by-prompt validation - this plan provides comprehensive proof the milestone works as expected through deterministic tests, infrastructure setup, and manual verification flows.
3
+ </goal>
4
+
5
+ <inputs>
6
+ - Alignment doc path
7
+ - E2E test plan output path
8
+ </inputs>
9
+
10
+ <outputs>
11
+ - E2E test plan document at specified output path (with `last_commit` frontmatter for incremental updates)
12
+ </outputs>
13
+
14
+ <constraints>
15
+ - MUST derive infrastructure setup from implementation artifacts (commits, summaries, code, existing docs)
16
+ - MUST prioritize manual verification flows over reiterating already-run automated tests
17
+ - NEVER duplicate step-by-step test cases that deterministic suites already cover
18
+ </constraints>
19
+
20
+ ## Update Mode (if test plan exists)
21
+
22
+ If the E2E test plan already exists:
23
+ - Read existing test plan and extract `last_commit` from frontmatter
24
+ - Run `git log --oneline <last_commit>..HEAD` to see commits since last update
25
+ - Run `git diff <last_commit>..HEAD --stat` to see affected files
26
+ - Compare alignment doc prompt summaries against test plan's covered prompts
27
+ - Focus context gathering on delta changes only
28
+ - Append new scenarios rather than rewriting existing coverage
29
+
30
+ ## Context Gathering
31
+
32
+ - Read the alignment doc for goal, objectives, acceptance criteria, and prompt execution summaries
33
+ - Review changed files from base branch (avoid information overload on full diffs)
34
+ - Run `ah validation-tools list` to identify available validation suites — the `tools` field in suite output helps identify which tooling is available for both stochastic and deterministic dimensions
35
+ - Examine implementation artifacts for infrastructure setup information:
36
+ - Commit messages describing setup/configuration changes
37
+ - Prompt summaries mentioning services, dependencies, or environment setup
38
+ - Existing documentation (recognize it may be outdated if implementation changed it)
39
+ - Code comments, READMEs, and configuration files
40
+
41
+ ## E2E Test Plan Structure
42
+
43
+ Per **Context is Precious**, structure the plan as progressive sections - each building on the previous.
44
+
45
+ ### Section 1: Deterministic Test Summary
46
+
47
+ This section corresponds to the **Deterministic Integration** dimension of referenced validation suites. Commands here should be drawn from suite Deterministic Integration sections where suites are referenced.
48
+
49
+ Per **Context is Precious**, present as a concise command list with inline comments:
50
+
51
+ ```bash
52
+ # API endpoint tests (CRUD, validation, 404s)
53
+ cd backend && pytest -v
54
+
55
+ # Component tests (Vitest + SolidJS)
56
+ cd frontend && npm test
57
+
58
+ # Playwright E2E (task flows, filtering, search)
59
+ cd frontend && npm run test:e2e
60
+ ```
61
+
62
+ - Comment above each command, separated by blank lines
63
+ - Group related commands if logical (e.g., backend, frontend, E2E)
64
+ - NO detailed breakdowns, file listings, or coverage percentages
65
+ - Engineer can run individual commands or chain them all
66
+
67
+ ### Section 2: Infrastructure Setup
68
+
69
+ Per **Knowledge Compounding**, derive setup from implementation artifacts (commits, summaries, code, existing docs).
70
+
71
+ ```bash
72
+ # Install dependencies
73
+ npm install && cd backend && pip install -r requirements.txt
74
+
75
+ # Set up environment (copy and configure)
76
+ cp .env.example .env
77
+
78
+ # Start database (if applicable)
79
+ docker-compose up -d postgres
80
+
81
+ # Start backend service
82
+ cd backend && python main.py
83
+
84
+ # Start frontend dev server
85
+ cd frontend && npm run dev
86
+ ```
87
+
88
+ - Comment above each command, separated by blank lines
89
+ - Cover: dependencies, environment, database, services, dev servers
90
+ - Include cloud branch tooling if available (e.g., Supabase branches, preview deployments)
91
+
92
+ **Variant Awareness**: Per **Quality Engineering**, if implementation introduced disposable variants (A/B implementations, backend alternatives, experimental features):
93
+ - Document how to switch between variants (feature flags, env vars, infrastructure flags)
94
+ - Show setup commands for each variant that needs testing
95
+ - Example: `BACKEND=flask npm run dev` vs `BACKEND=fastapi npm run dev`
96
+
97
+ This section validates documentation quality - if setup cannot be derived from implementation artifacts, it signals inadequate documentation. The subsequent documentation phase will face the same challenge.
98
+
99
+ ### Section 3: AI-Coordinated Validation (Conditional)
100
+
101
+ This section corresponds to the **Stochastic Validation** dimension. Agent-driven validation tasks here should reference suite Stochastic Validation playbooks for structured exploration patterns.
102
+
103
+ **Only include if validation tooling supports agentic testing.** Types of tooling that qualify:
104
+ - UI automation (Playwright MCP, agent-browser, simulator automation, browser MCPs)
105
+ - Load testing tools (k6, artillery, locust with agent coordination)
106
+ - Performance profiling (flamegraphs, memory profilers, bundle analyzers)
107
+ - Database inspection/scripting (query tools, migration validators, data generators)
108
+ - API testing tools (curl automation, Postman/Insomnia MCPs)
109
+
110
+ Provide example prompts engineers can give to agent sessions:
111
+ - "Use Playwright MCP to complete checkout with expired card, then retry with valid payment"
112
+ - "Run load test against /api/tasks with 100 concurrent users, report p95 latency"
113
+ - "Profile the task list render with 1000 items, identify components over 16ms"
114
+ - "Inspect database after bulk import, verify foreign key integrity and index usage"
115
+
116
+ Purpose: Engineers spin up agents to test flows based on concerns they describe - agent coordinates the tooling.
117
+
118
+ If no such tooling exists for this project, skip this section entirely and note which tooling categories would be valuable.
119
+
120
+ ### Section 4: Manual E2E Flows
121
+
122
+ The core "convince the engineer" section with real product behavior:
123
+ - Define explicit user flows to walk through with spun-up infrastructure
124
+ - Cover happy paths, edge cases, and regression scenarios
125
+ - Include tooling for inspection (profiling, network inspection, logs)
126
+ - Reference specific UI paths, API endpoints, CLI commands to exercise
127
+ - Cover domains that automated testing cannot adequately verify
128
+
129
+ This section provides broad product coverage through direct engineer interaction - the final proof that implementation meets expectations.
130
+
131
+ ## Completion
132
+
133
+ Write the E2E test plan to the output path with frontmatter:
134
+ ```yaml
135
+ ---
136
+ last_commit: <current HEAD SHA>
137
+ covered_prompts: [<prompt numbers included>]
138
+ updated: <ISO date>
139
+ ---
140
+ ```
@@ -0,0 +1,57 @@
1
+ <goal>
2
+ Plan hypotheses as prompt files for executors to implement. Per **Quality Engineering**, this agent discovers which improvements are valuable — separation of concerns keeps planning and execution independent, each bounded in context. A two-phase model ensures core goals are solidified before exploring tangential improvements.
3
+ </goal>
4
+
5
+ <constraints>
6
+ - MUST NOT execute any implementation — only create prompt files
7
+ - MUST set `type: emergent` in prompt frontmatter — both phases use the same type
8
+ - MUST create non-overlapping hypotheses that don't conflict with prior prompts
9
+ - NEVER terminate with 0 prompts — per **Knowledge Compounding**, each round compounds work
10
+ - NEVER pursue tangential exploration while `core_consolidation: pending`
11
+ - MUST respect `max_tangential_hypotheses` cap from workflow domain config
12
+ </constraints>
13
+
14
+ ## Context Gathering
15
+
16
+ - Read the alignment doc for: goals, prior prompt summaries, unresolved questions, learnings
17
+ - Read `core_consolidation` from alignment doc frontmatter (default: `pending` if missing)
18
+ - Read the workflow domain config at `WORKFLOW_DOMAIN_PATH` for `max_tangential_hypotheses`
19
+ - Identify gaps between current state (completed work) and desired state (spec goals + success criteria)
20
+ - Run `ah memories search "<hypothesis terms>"` for relevant prior insights
21
+
22
+ ## Phase Determination
23
+
24
+ Per **Quality Engineering**, core goals must be convincingly met before exploring adjacent work.
25
+
26
+ **Phase 1 — Core Consolidation** (`core_consolidation: pending`):
27
+ - Focus hypotheses exclusively on verifying, solidifying, and compounding the implementation to meet core initiative goals
28
+ - Assess gaps between current implementation state (prompt summaries, completed work) and the alignment doc's stated goals and expectations
29
+ - Do NOT pursue tangential exploration — all hypotheses must directly address spec goals, acceptance criteria, or known gaps
30
+ - After each hypothesis round, assess whether all core goals are convincingly met based on: alignment doc goals, prompt summaries, implementation state
31
+
32
+ **Phase 2 — Tangential Exploration** (`core_consolidation: complete`):
33
+ - Hypotheses extend the implementation with ideas adjacent to but not explicitly requested in initial goals
34
+ - Feature ideas, consolidation, future-proofing, edge case coverage
35
+ - Track tangential hypothesis count across rounds — enforce `max_tangential_hypotheses` cap from the workflow domain config
36
+ - If cap is reached, stop — no further emergent work
37
+
38
+ **Transition**: When core consolidation is convincingly met, set `core_consolidation: complete` in the alignment doc frontmatter. This is a judgment call based on alignment doc goals, prompt summaries, and implementation state. Subsequent runs enter Phase 2.
39
+
40
+ ## Hypothesis Formation
41
+
42
+ - Select hypothesis domains from provided `HYPOTHESIS_DOMAINS` list, diversifying from prior work
43
+ - Formulate each hypothesis: implementation approach → intended outcome
44
+ - Verify uniqueness via `ah knowledge docs search <query>` against existing prompts
45
+ - Phase 1: hypotheses target core goal gaps and verification
46
+ - Phase 2: hypotheses explore adjacent improvements and novel experiments (behind feature flags)
47
+
48
+ ## Prompt Creation
49
+
50
+ - Read `.allhands/flows/shared/UTILIZE_VALIDATION_TOOLING.md` to discover validation suites for hypothesis domains
51
+ - Read `.allhands/flows/shared/PROMPT_TASKS_CURATION.md` for prompt structure and guidance
52
+ - Create 1-N prompt files in the prompts folder:
53
+ - Set `type: emergent` in frontmatter
54
+ - Target 2-5 tasks per prompt, each a non-overlapping hypothesis
55
+ - Add discovered validation suites to `validation_suites` frontmatter
56
+ - If Phase 2: note feature flag requirement in tasks
57
+ - Stop — executors pick up prompts via the loop
@@ -0,0 +1,154 @@
1
+ <goal>
2
+ Exploratory co-creation that surfaces the problem and solution space. Per **Ideation First**, the engineer controls depth and direction. Per **Frontier Models are Capable**, the agent brings its own research, proposals, and critical analysis — not just question-asking. The domain config provides domain-specific substance; this flow provides the generative conversation structure.
3
+ </goal>
4
+
5
+ <constraints>
6
+ - MUST read the workflow domain config at `WORKFLOW_DOMAIN_PATH` before any interview
7
+ - MUST ask all questions listed in the domain config's `required_ideation_questions`, unless the answer is already clear from codebase exploration
8
+ - MUST ask ONE question at a time
9
+ - NEVER batch all questions together
10
+ - MUST ground in codebase reality before asking the engineer codebase-answerable questions
11
+ - MUST bring its own proposals and alternatives — never be a passive interviewer
12
+ - NEVER ask questions answerable from codebase exploration
13
+ </constraints>
14
+
15
+ ## Active Spec Revision Mode
16
+
17
+ **Check first**: If `SPEC_PATH` is non-empty and the file exists at that path, enter **revision mode** instead of the normal flow below.
18
+
19
+ ### Revision Mode
20
+
21
+ 1. Read the existing spec file at `SPEC_PATH`
22
+ 2. Read the workflow domain config at `WORKFLOW_DOMAIN_PATH`
23
+ 3. Present the existing spec content to the engineer as grounding:
24
+ - Summarize the current spec scope, goals, and key decisions
25
+ - State: "This spec already exists. I'll focus on what you want to change or add."
26
+ 4. Conduct a focused revision interview:
27
+ - Ask what aspects of the spec need changing, extending, or refining
28
+ - Reference existing spec content — do not ask about things already covered unless the engineer wants to revise them
29
+ - Apply domain config's `required_ideation_questions` only where they surface gaps in the revision context
30
+ - ONE question at a time, as with normal ideation
31
+ 5. After the engineer signals readiness:
32
+ - Revise the existing spec file in place — update and append, do not replace wholesale
33
+ - Preserve unchanged sections; modify only what the revision touches
34
+ 6. **After spec revision is written**: reset planning artifacts since existing plans are now stale:
35
+ ```bash
36
+ ah planning reset
37
+ ```
38
+ This deletes all prompts and the alignment doc, and resets status to `planning` stage.
39
+ 7. Report to the engineer: "Spec revised. Planning artifacts cleared — the planning flow will re-trigger to produce new prompts aligned with the updated spec."
40
+ 8. **Stop** — do not continue to the normal Initiation flow below.
41
+
42
+ ---
43
+
44
+ **If `SPEC_PATH` is empty or the file does not exist**: proceed with the normal flow below.
45
+
46
+ ## Initiation
47
+
48
+ - Run `ah specs list --domains-only` for roadmap visibility (may return empty)
49
+ - If specific spec name not provided:
50
+ - List available domains to the engineer
51
+ - Ask which initiative domain this spec belongs to (can be new)
52
+ - Infer spec name from the engineer's initial ideation prompt
53
+ - Ask the engineer for their initial ideation prompt
54
+
55
+ ## Context Gathering
56
+
57
+ - Read the workflow domain config file at `WORKFLOW_DOMAIN_PATH`
58
+ - Ground using `ah knowledge docs search` across ROADMAP then DOCS indexes (in that order)
59
+ - Run `ah specs list --roadmap --domain <domain_name>` for domain milestone visibility
60
+ - Read dependent milestone specs
61
+ - Spawn 1-3 subtasks: tell them to read `.allhands/flows/shared/CODEBASE_UNDERSTANDING.md` to deeply understand codebase reality
62
+ - Spawn 0-2 research subtasks: tell them to read `.allhands/flows/shared/RESEARCH_GUIDANCE.md` for high-level tech solution approaches
63
+ - Spawn additional research subtasks as new concepts emerge during interview
64
+
65
+ ## Exploratory Interview
66
+
67
+ The interview has two phases. The boundary between them is organic — divergence naturally gives way to convergence as the solution space clarifies.
68
+
69
+ ### Divergent Phase: Expanding the Solution Space
70
+
71
+ Open the space. The goal is to understand the problem deeply and surface every viable direction before narrowing.
72
+
73
+ - Ask all `required_ideation_questions` from the domain config frontmatter, one at a time
74
+ - Per **Ideation First**, reflect back understanding before moving on — probe vague responses, skip questions already answered
75
+ - Apply the domain config's Domain Knowledge sections as they become relevant:
76
+ - If category deep dives are defined: work through relevant categories based on scope
77
+ - Follow probe guidance for depth calibration
78
+ - Spawn research subtasks as new concepts emerge
79
+ - **Propose alternative approaches** grounded in codebase understanding and research results — present options the engineer hasn't considered
80
+ - **Surface non-obvious considerations** — tradeoffs, limitations, second-order effects, assumptions that might not hold under pressure
81
+ - **Challenge assumptions** where codebase evidence or research contradicts them — respectfully, with evidence
82
+
83
+ ### Convergent Phase: Narrowing Toward Intent
84
+
85
+ Collapse the space. The goal is to synthesize explored directions into a coherent solution intent.
86
+
87
+ - Synthesize the explored solution space into candidate directions
88
+ - Present feasibility feedback grounded in exploration results
89
+ - If the domain config includes guiding principles synthesis guidance: synthesize and validate with engineer
90
+ - Respect output section structure from the domain config for content synthesis
91
+ - Converge on the direction the engineer wants to pursue
92
+
93
+ ## Core Ideation Behaviors
94
+
95
+ These behaviors apply throughout the entire interview, regardless of domain. Domain configs may layer domain-specific signals on top.
96
+
97
+ ### Knowledge Gap Detection
98
+
99
+ Watch for these universal signals requiring deeper probing:
100
+
101
+ | Signal | Action |
102
+ |--------|--------|
103
+ | Hedging language ("I think...", "Maybe...") | Probe deeper — offer to research |
104
+ | Passive agreement ("That sounds good") | Verify they understand implications, not just deferring |
105
+ | Oversimplification ("Just simple/basic X") | Challenge — define what simple means concretely |
106
+ | Buzzwords without context | Ask what they think it does and why it fits |
107
+ | Conflicting requirements | Surface the conflict explicitly — ask which takes priority |
108
+
109
+ If the domain config defines additional gap detection signals, apply those too.
110
+
111
+ ### Conviction Spectrum
112
+
113
+ Capture how strongly the engineer feels about each direction. This preserves intent fidelity through downstream flows:
114
+
115
+ | Engineer Input | Spec Language | Downstream Effect |
116
+ |----------------|---------------|-------------------|
117
+ | Strong preference | "Engineer desires X" / "Engineer expects X" | Planning respects as constraint |
118
+ | Flexible | "Engineer likes X but open to alternatives" | Planning can propose alternatives |
119
+ | Just an idea | "Engineer proposes X, open-ended for architect" | Planning researches freely |
120
+ | No opinion | Captured in Open Questions | Planning decides |
121
+
122
+ ### Open Questions
123
+
124
+ Not everything resolves during ideation. Open questions are a first-class output, not a failure of the interview.
125
+
126
+ - **Close yourself**: Answerable from codebase exploration or gathered context — don't burden the engineer
127
+ - **Resolve together**: Tradeoffs where engineer input genuinely matters — present options with evidence
128
+ - **Leave open for planning**: Needs deep research, architect expertise, or engineer explicitly delegates
129
+ - **Actively offer the choice**: "Do you want to decide this now, or leave it for planning?"
130
+
131
+ ### Roadmap-Aware Assumptions
132
+
133
+ When the spec depends on functionality from unimplemented roadmap items, use "Assuming X exists..." or "Assuming any of X, Y, Z exist..." to express the dependency. Never cross-reference unimplemented milestone specs directly.
134
+
135
+ ## Transition to Spec Creation
136
+
137
+ - Propose transitioning when the conversation reaches natural saturation — when new questions yield diminishing insight
138
+ - Frame it as a summary: "Here's what's well-understood, here's what's still open — want to explore further or leave the open items for planning?"
139
+ - If the domain config defines completeness criteria, use them as internal guidance for what "well-understood" means — but don't present them as a gate
140
+ - The engineer decides when to move on
141
+
142
+ ## Spec Creation
143
+
144
+ - Synthesize answers into spec content using the domain config's output section structure
145
+ - Write `initial_workflow_domain: <domain_name>` to spec frontmatter (from the config's `name` field)
146
+ - Set `type: <domain_type>` in spec frontmatter (from the config's `type` field)
147
+ - If the domain config includes "Building on Unimplemented Milestones" guidance: use "Assuming X exists..." pattern for dependencies
148
+ - Follow `.allhands/flows/shared/CREATE_SPEC.md` to write, create, and optionally activate the spec
149
+
150
+ ### Optional: Spec Flow Analysis
151
+
152
+ - If the domain config's Ideation Guidance mentions spec flow analysis: offer it for complex features
153
+ - Ask: "Would you like me to analyze this spec for user flow coverage and gaps?"
154
+ - If yes: read `.allhands/flows/shared/SPEC_FLOW_ANALYSIS.md` and follow instructions