@tenkara/afm-linux-arm64 0.0.0-stage → 4.0.0-alpha.6

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 (276) hide show
  1. package/bin/afm +4 -0
  2. package/content/.coupling-baseline.tsv +1 -0
  3. package/content/.pending-commands.txt +2 -0
  4. package/content/CHANGELOG-archive.md +806 -0
  5. package/content/CHANGELOG.md +4256 -0
  6. package/content/PRINCIPLES.md +121 -0
  7. package/content/README-light.md +160 -0
  8. package/content/README.md +152 -0
  9. package/content/code-style/_any/file-size.md +62 -0
  10. package/content/code-style/_any/imports.md +68 -0
  11. package/content/code-style/_any/naming.md +72 -0
  12. package/content/code-style/_any/test-placement.md +57 -0
  13. package/content/code-style/nextjs-app-router/imports.md +50 -0
  14. package/content/code-style/nextjs-app-router/naming.md +50 -0
  15. package/content/code-style/prisma-postgres/error-boundary.md +55 -0
  16. package/content/code-style/prisma-postgres/imports.md +61 -0
  17. package/content/code-style/shadcn-ui/naming.md +48 -0
  18. package/content/code-style/stripe-billing/naming.md +76 -0
  19. package/content/code-style/trigger-dev-v4/imports.md +58 -0
  20. package/content/code-style/trigger-dev-v4/naming.md +49 -0
  21. package/content/code-style/trigger-dev-v4/test-placement.md +61 -0
  22. package/content/code-style/trpc-v11/error-boundary.md +51 -0
  23. package/content/code-style/trpc-v11/file-size.md +44 -0
  24. package/content/code-style/trpc-v11/naming.md +60 -0
  25. package/content/code-style/trpc-v11/test-placement.md +52 -0
  26. package/content/core/ach.md +265 -0
  27. package/content/core/afm.md +496 -0
  28. package/content/core/gotchas.md +18 -0
  29. package/content/core/prd.md +143 -0
  30. package/content/core/protocol.md +160 -0
  31. package/content/core/ust.md +65 -0
  32. package/content/guardrails/README.md +55 -0
  33. package/content/guardrails/dsl-com-ordem-obrigatoria.md +47 -0
  34. package/content/guardrails/exaustividade-de-union.md +48 -0
  35. package/content/guardrails/fronteira-de-import.md +57 -0
  36. package/content/hooks/README.md +72 -0
  37. package/content/interview/bootstrap.md +415 -0
  38. package/content/interview/promotion.md +117 -0
  39. package/content/interview/refactor.md +381 -0
  40. package/content/interview/triggers.md +109 -0
  41. package/content/modules/nextjs-app-router/ach.patch.md +44 -0
  42. package/content/modules/nextjs-app-router/gotchas.seed.md +78 -0
  43. package/content/modules/nextjs-app-router/rules.patch.md +35 -0
  44. package/content/modules/prisma-postgres/ach.patch.md +65 -0
  45. package/content/modules/prisma-postgres/rules.patch.md +28 -0
  46. package/content/modules/shadcn-ui/ach.patch.md +42 -0
  47. package/content/modules/stripe-billing/ach.patch.md +46 -0
  48. package/content/modules/stripe-billing/gotchas.seed.md +73 -0
  49. package/content/modules/stripe-billing/rules.patch.md +30 -0
  50. package/content/modules/trigger-dev-v4/ach.patch.md +64 -0
  51. package/content/modules/trigger-dev-v4/gotchas.seed.md +53 -0
  52. package/content/modules/trigger-dev-v4/rules.patch.md +35 -0
  53. package/content/modules/trpc-v11/ach.patch.md +56 -0
  54. package/content/modules/trpc-v11/rules.patch.md +34 -0
  55. package/content/modules/vireya-ui/ach.patch.md +85 -0
  56. package/content/modules/vireya-ui/gotchas.seed.md +98 -0
  57. package/content/modules/vireya-ui/rules.patch.md +36 -0
  58. package/content/ops/adr.md +54 -0
  59. package/content/ops/analyze.md +129 -0
  60. package/content/ops/clarify.md +86 -0
  61. package/content/ops/deliver.md +211 -0
  62. package/content/ops/diagnose.md +146 -0
  63. package/content/ops/evolve.md +317 -0
  64. package/content/ops/export-template.md +97 -0
  65. package/content/ops/generalize.md +120 -0
  66. package/content/ops/gotcha.md +46 -0
  67. package/content/ops/plan.md +61 -0
  68. package/content/ops/policy.md +63 -0
  69. package/content/ops/promote.md +72 -0
  70. package/content/ops/protocol.md +51 -0
  71. package/content/ops/reconcile.md +44 -0
  72. package/content/ops/reflect.md +180 -0
  73. package/content/ops/remediate.md +146 -0
  74. package/content/ops/restructure.md +145 -0
  75. package/content/ops/rule.md +165 -0
  76. package/content/ops/specify.md +62 -0
  77. package/content/ops/tasks.md +67 -0
  78. package/content/ops/update.md +223 -0
  79. package/content/ops/verify.md +69 -0
  80. package/content/patterns/adapter.md +46 -0
  81. package/content/patterns/facade.md +47 -0
  82. package/content/patterns/factory.md +46 -0
  83. package/content/patterns/null-object.md +55 -0
  84. package/content/patterns/result-vs-exception.md +52 -0
  85. package/content/patterns/strategy.md +45 -0
  86. package/content/patterns/template-method-vs-composition.md +50 -0
  87. package/content/questions/adr.questions.yaml +14 -0
  88. package/content/questions/analyze.questions.yaml +12 -0
  89. package/content/questions/bootstrap-mapping.questions.yaml +14 -0
  90. package/content/questions/bootstrap-rules.questions.yaml +10 -0
  91. package/content/questions/bootstrap-stack.questions.yaml +23 -0
  92. package/content/questions/clarify.questions.yaml +10 -0
  93. package/content/questions/code-style.questions.yaml +12 -0
  94. package/content/questions/confirm.questions.yaml +12 -0
  95. package/content/questions/deliver.questions.yaml +23 -0
  96. package/content/questions/evolve.questions.yaml +15 -0
  97. package/content/questions/export-template-apply.questions.yaml +11 -0
  98. package/content/questions/export-template.questions.yaml +23 -0
  99. package/content/questions/gates.questions.yaml +27 -0
  100. package/content/questions/generalize.questions.yaml +13 -0
  101. package/content/questions/gotcha.questions.yaml +11 -0
  102. package/content/questions/init-template.questions.yaml +10 -0
  103. package/content/questions/init.questions.yaml +28 -0
  104. package/content/questions/plan.questions.yaml +14 -0
  105. package/content/questions/refactor.questions.yaml +23 -0
  106. package/content/questions/reflect.questions.yaml +13 -0
  107. package/content/questions/remediate.questions.yaml +27 -0
  108. package/content/questions/restructure.questions.yaml +15 -0
  109. package/content/questions/rf-mapping.questions.yaml +12 -0
  110. package/content/questions/rule-scope.questions.yaml +12 -0
  111. package/content/questions/rule.questions.yaml +12 -0
  112. package/content/questions/specify.questions.yaml +23 -0
  113. package/content/questions/update-artifacts.questions.yaml +10 -0
  114. package/content/questions/update-strings.questions.yaml +14 -0
  115. package/content/questions/update.questions.yaml +10 -0
  116. package/content/questions/verify.questions.yaml +9 -0
  117. package/content/roles/executor.md +18 -0
  118. package/content/roles/explorer.md +22 -0
  119. package/content/roles/reviewer.md +23 -0
  120. package/content/rubrics/enum-vs-union-vs-branded.md +40 -0
  121. package/content/rubrics/episodic-vs-semantic-boundary.md +37 -0
  122. package/content/rubrics/error-classification.md +98 -0
  123. package/content/rubrics/failure-classification.md +113 -0
  124. package/content/rubrics/negative-filters.md +38 -0
  125. package/content/rubrics/solid-triggers.md +121 -0
  126. package/content/rubrics/template-vs-streaming-precedence.md +34 -0
  127. package/content/rubrics/validation-boundary.md +94 -0
  128. package/content/rubrics/when-to-create-dsl.md +65 -0
  129. package/content/rubrics/when-to-create-lib.md +49 -0
  130. package/content/rubrics/when-to-create-module.md +39 -0
  131. package/content/rubrics/when-to-evolve-methodology.md +62 -0
  132. package/content/skills/adr.md +42 -0
  133. package/content/skills/analyze.md +34 -0
  134. package/content/skills/clarify.md +34 -0
  135. package/content/skills/deliver.md +42 -0
  136. package/content/skills/diagnose.md +50 -0
  137. package/content/skills/evolve.md +67 -0
  138. package/content/skills/export-template.md +40 -0
  139. package/content/skills/generalize.md +47 -0
  140. package/content/skills/gotcha.md +40 -0
  141. package/content/skills/init.md +82 -0
  142. package/content/skills/plan.md +34 -0
  143. package/content/skills/policy.md +31 -0
  144. package/content/skills/promote.md +41 -0
  145. package/content/skills/protocol.md +42 -0
  146. package/content/skills/reconcile.md +49 -0
  147. package/content/skills/refactor.md +84 -0
  148. package/content/skills/reflect.md +53 -0
  149. package/content/skills/remediate.md +39 -0
  150. package/content/skills/restructure.md +52 -0
  151. package/content/skills/rule.md +44 -0
  152. package/content/skills/specify.md +34 -0
  153. package/content/skills/tasks.md +34 -0
  154. package/content/skills/update.md +56 -0
  155. package/content/skills/verify.md +31 -0
  156. package/content/templates/adr.template.md +51 -0
  157. package/content/templates/evolution-report.template.md +129 -0
  158. package/content/templates/feature-plan.template.md +86 -0
  159. package/content/templates/feature-research.template.md +57 -0
  160. package/content/templates/feature-spec.template.md +86 -0
  161. package/content/templates/feature-tasks.induced.template.md +67 -0
  162. package/content/templates/feature-tasks.template.md +60 -0
  163. package/content/templates/focus.template.md +30 -0
  164. package/content/templates/gotcha.template.md +31 -0
  165. package/content/templates/guardrail-runner.template.md +81 -0
  166. package/content/templates/guardrail.template.md +63 -0
  167. package/content/templates/learning.template.md +40 -0
  168. package/content/templates/procedure.template.md +47 -0
  169. package/content/templates/protocols/p1.md +29 -0
  170. package/content/templates/protocols/p2.md +28 -0
  171. package/content/templates/protocols/p3.md +47 -0
  172. package/content/templates/research.template.md +50 -0
  173. package/content/templates/session-handoff.template.md +58 -0
  174. package/content/templates/us.template.md +39 -0
  175. package/content/tools/gate/core-rules/PLUGIN-13-secrets.sh +36 -0
  176. package/content/tools/gate/core-rules/PLUGIN-21-code-language.sh +27 -0
  177. package/content/tools/gate/core-rules/PLUGIN-35-gate-complete.sh +19 -0
  178. package/content/tools/gate/core-rules/PLUGIN-36-absolute-path.sh +38 -0
  179. package/content/tools/gate/core-rules/PLUGIN-37-prose-language.sh +56 -0
  180. package/content/tools/gate/core-rules/PLUGIN-38-parser-marker.sh +82 -0
  181. package/content/tools/gate/core-rules/PLUGIN-39-frontmatter-ops.sh +325 -0
  182. package/content/tools/gate/core-rules/PLUGIN-40-dead-reference.sh +74 -0
  183. package/content/tools/gate/core-rules/README.md +55 -0
  184. package/content/tools/gate/guardrails.sh +740 -0
  185. package/content/tools/gate/lib/ratchet.sh +119 -0
  186. package/content/tools/gate/lib/scope.sh +85 -0
  187. package/content/tools/gate/ratchet.seed.tsv +1 -0
  188. package/content/tools/gate/rules/README.md +50 -0
  189. package/package.json +19 -5
  190. package/plugin/agy/hooks.json +29 -0
  191. package/plugin/agy/mcp_config.json +7 -0
  192. package/plugin/agy/plugin.json +6 -0
  193. package/plugin/agy/skills/afm-adr/SKILL.md +44 -0
  194. package/plugin/agy/skills/afm-analyze/SKILL.md +36 -0
  195. package/plugin/agy/skills/afm-clarify/SKILL.md +36 -0
  196. package/plugin/agy/skills/afm-deliver/SKILL.md +44 -0
  197. package/plugin/agy/skills/afm-diagnose/SKILL.md +50 -0
  198. package/plugin/agy/skills/afm-evolve/SKILL.md +69 -0
  199. package/plugin/agy/skills/afm-export-template/SKILL.md +42 -0
  200. package/plugin/agy/skills/afm-generalize/SKILL.md +49 -0
  201. package/plugin/agy/skills/afm-gotcha/SKILL.md +42 -0
  202. package/plugin/agy/skills/afm-init/SKILL.md +84 -0
  203. package/plugin/agy/skills/afm-plan/SKILL.md +36 -0
  204. package/plugin/agy/skills/afm-policy/SKILL.md +31 -0
  205. package/plugin/agy/skills/afm-promote/SKILL.md +41 -0
  206. package/plugin/agy/skills/afm-protocol/SKILL.md +42 -0
  207. package/plugin/agy/skills/afm-reconcile/SKILL.md +49 -0
  208. package/plugin/agy/skills/afm-refactor/SKILL.md +86 -0
  209. package/plugin/agy/skills/afm-reflect/SKILL.md +55 -0
  210. package/plugin/agy/skills/afm-remediate/SKILL.md +41 -0
  211. package/plugin/agy/skills/afm-restructure/SKILL.md +54 -0
  212. package/plugin/agy/skills/afm-rule/SKILL.md +46 -0
  213. package/plugin/agy/skills/afm-specify/SKILL.md +36 -0
  214. package/plugin/agy/skills/afm-tasks/SKILL.md +34 -0
  215. package/plugin/agy/skills/afm-update/SKILL.md +58 -0
  216. package/plugin/agy/skills/afm-verify/SKILL.md +33 -0
  217. package/plugin/claude-code/.claude-plugin/marketplace.json +15 -0
  218. package/plugin/claude-code/.claude-plugin/plugin.json +9 -0
  219. package/plugin/claude-code/.mcp.json +7 -0
  220. package/plugin/claude-code/agents/afm-executor.md +18 -0
  221. package/plugin/claude-code/agents/afm-explorer.md +20 -0
  222. package/plugin/claude-code/agents/afm-reviewer.md +21 -0
  223. package/plugin/claude-code/hooks/hooks.json +85 -0
  224. package/plugin/claude-code/skills/adr/SKILL.md +44 -0
  225. package/plugin/claude-code/skills/analyze/SKILL.md +36 -0
  226. package/plugin/claude-code/skills/clarify/SKILL.md +36 -0
  227. package/plugin/claude-code/skills/deliver/SKILL.md +44 -0
  228. package/plugin/claude-code/skills/diagnose/SKILL.md +50 -0
  229. package/plugin/claude-code/skills/evolve/SKILL.md +69 -0
  230. package/plugin/claude-code/skills/export-template/SKILL.md +42 -0
  231. package/plugin/claude-code/skills/generalize/SKILL.md +49 -0
  232. package/plugin/claude-code/skills/gotcha/SKILL.md +42 -0
  233. package/plugin/claude-code/skills/init/SKILL.md +84 -0
  234. package/plugin/claude-code/skills/plan/SKILL.md +36 -0
  235. package/plugin/claude-code/skills/policy/SKILL.md +31 -0
  236. package/plugin/claude-code/skills/promote/SKILL.md +41 -0
  237. package/plugin/claude-code/skills/protocol/SKILL.md +42 -0
  238. package/plugin/claude-code/skills/reconcile/SKILL.md +49 -0
  239. package/plugin/claude-code/skills/refactor/SKILL.md +86 -0
  240. package/plugin/claude-code/skills/reflect/SKILL.md +55 -0
  241. package/plugin/claude-code/skills/remediate/SKILL.md +41 -0
  242. package/plugin/claude-code/skills/restructure/SKILL.md +54 -0
  243. package/plugin/claude-code/skills/rule/SKILL.md +46 -0
  244. package/plugin/claude-code/skills/specify/SKILL.md +36 -0
  245. package/plugin/claude-code/skills/tasks/SKILL.md +34 -0
  246. package/plugin/claude-code/skills/update/SKILL.md +58 -0
  247. package/plugin/claude-code/skills/verify/SKILL.md +33 -0
  248. package/plugin/opencode/afm.js +173 -0
  249. package/plugin/opencode/agents/afm-executor.md +31 -0
  250. package/plugin/opencode/agents/afm-explorer.md +47 -0
  251. package/plugin/opencode/agents/afm-reviewer.md +48 -0
  252. package/plugin/opencode/skills/afm-adr/SKILL.md +44 -0
  253. package/plugin/opencode/skills/afm-analyze/SKILL.md +36 -0
  254. package/plugin/opencode/skills/afm-clarify/SKILL.md +36 -0
  255. package/plugin/opencode/skills/afm-deliver/SKILL.md +44 -0
  256. package/plugin/opencode/skills/afm-diagnose/SKILL.md +50 -0
  257. package/plugin/opencode/skills/afm-evolve/SKILL.md +69 -0
  258. package/plugin/opencode/skills/afm-export-template/SKILL.md +42 -0
  259. package/plugin/opencode/skills/afm-generalize/SKILL.md +49 -0
  260. package/plugin/opencode/skills/afm-gotcha/SKILL.md +42 -0
  261. package/plugin/opencode/skills/afm-init/SKILL.md +84 -0
  262. package/plugin/opencode/skills/afm-plan/SKILL.md +36 -0
  263. package/plugin/opencode/skills/afm-policy/SKILL.md +31 -0
  264. package/plugin/opencode/skills/afm-promote/SKILL.md +41 -0
  265. package/plugin/opencode/skills/afm-protocol/SKILL.md +42 -0
  266. package/plugin/opencode/skills/afm-reconcile/SKILL.md +49 -0
  267. package/plugin/opencode/skills/afm-refactor/SKILL.md +86 -0
  268. package/plugin/opencode/skills/afm-reflect/SKILL.md +55 -0
  269. package/plugin/opencode/skills/afm-remediate/SKILL.md +41 -0
  270. package/plugin/opencode/skills/afm-restructure/SKILL.md +54 -0
  271. package/plugin/opencode/skills/afm-rule/SKILL.md +46 -0
  272. package/plugin/opencode/skills/afm-specify/SKILL.md +36 -0
  273. package/plugin/opencode/skills/afm-tasks/SKILL.md +34 -0
  274. package/plugin/opencode/skills/afm-update/SKILL.md +58 -0
  275. package/plugin/opencode/skills/afm-verify/SKILL.md +33 -0
  276. package/README.md +0 -3
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: update
3
+ description: |
4
+ Syncs `<consumer>/docs/` with the current plugin version. It materializes the consumer-facing deltas between the pinned version and the shipped version, then moves the pin. It reads the plugin and never edits it.
5
+ Activates: `afm update`, "bump the methodology version", "sync docs with the new plugin", "my `.afm-version` is behind".
6
+ ---
7
+
8
+ # AFM — Update (sync instance-plugin)
9
+
10
+ This is the sync skill of `afm`. The canonical procedure is the op `afm path ops/update`. The CLI runs the
11
+ codemod registry, proves each op and moves the pin. This skill keeps the judgment.
12
+
13
+ > **Carve-out (does not overlap existing ops):** `afm init` and `afm refactor` **create** the instance
14
+ > (bootstrap). `update` brings an **existing** instance forward, the path that `afm refactor` refuses.
15
+ > `afm diagnose` only **detects** drift on axis A3 (read-only). `update` **resolves** it. `afm promote`
16
+ > **records** a finding meant for the plugin. `update` reads the plugin and materializes it into the
17
+ > instance, and neither touches the shipped content: an absolute boundary (#7). `afm evolve` is the
18
+ > **cycle** that composes `update` on axis A3.
19
+
20
+ ## When NOT to activate
21
+
22
+ This is a disambiguation for a skill that already activated. Use `afm init` or `afm refactor` if no instance
23
+ is bootstrapped yet. Skip `update` if the pinned version already equals the shipped version (no drift). Use
24
+ `afm promote` to carry a learning from the instance TO the plugin (the opposite direction). Use
25
+ `afm diagnose` to only CHECK for drift. Use `afm evolve` for the full cycle.
26
+
27
+ ## Pre-check
28
+
29
+ `afm update --dry-run` does it: exit 3 means no instance (suggest `afm init` or `afm refactor`), exit 4 means
30
+ the shipped content does not resolve (report it, do not fall back silently), and "already up to date" ends
31
+ the run. A pin **ahead** of the binary is an anomaly: report it, never roll it back.
32
+
33
+ ## Procedure (judgment only)
34
+
35
+ 1. Read the dry run as one package and show it as evidence. Ask `afm ask update`. Under `afm evolve` this gate
36
+ is suppressed.
37
+ 2. Run `afm update`. It moves the pin only at the end, and keeps it where it was when a codemod fails.
38
+ 3. Exit 6 means agent tasks are pending: do each one inside its scope (`afm lint --fix <path>` fixes the
39
+ frontmatter findings), then run `afm update` again. `afm update --accept <path>` closes a sync on a file
40
+ you merged by hand. An opt-in delta is reported and never applied. Exit 5 (a major crossing) is
41
+ `afm migrate`.
42
+ 4. **Language migration** (when the instance is not English): read `prd.md` § 11.1 FIRST and derive the
43
+ excluded scope from it, and only then read a file. `[TBD]` there stops the step and asks
44
+ `afm ask update-strings`. It never picks a language. The artifacts question is
45
+ `afm ask update-artifacts`.
46
+ 5. Post-conditions: `afm index --check` returns 0 and the plugin boundary stays clean. Report in chat what
47
+ migrated and what stayed pending. Under `afm evolve`, feed it to `docs/evolution/`.
48
+
49
+ ## Invariant principles
50
+
51
+ Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply. Follow #2 (discover-first): the proof of
52
+ need is the grep that shows what is missing. Follow #4/#5: materialize only what the plugin already provides
53
+ ready-made, and never invent missing product content. Follow #6 (autonomy-first with a gate). Bright line
54
+ #7 applies: only **read** the plugin, and write only to the instance.
55
+
56
+ **No new principle here.** `update` is composed materialization. The doctrine lives in the op file.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: verify
3
+ description: |
4
+ Stamps a human verification on one doc under `docs/`. It writes the OKF `verified` field and is the only writer of that field. Use it when a person states they reviewed a document.
5
+ Activates: `afm verify <path>`, "I reviewed this rule", "mark this gotcha as verified", "sign off on this ADR".
6
+ ---
7
+
8
+ # AFM — Verify (stamp a human review)
9
+
10
+ Atomic skill of `afm`. The canonical procedure is the op `afm path ops/verify`.
11
+
12
+ ## When not to activate
13
+
14
+ Never on ordinary work, and never on your own output. This skill records that a PERSON read a document. An
15
+ agent stamping its own writing produces a lie the trust tier cannot detect.
16
+
17
+ ## Pre-check
18
+
19
+ 1. `afm preflight`. Exit 3 means there is no instance: stop.
20
+ 2. **Did a person state they reviewed the file?** If not, stop and ask: `afm ask verify`. Inference is not
21
+ review.
22
+ 3. The file must carry a frontmatter block, or there is no contract to stamp.
23
+
24
+ ## Procedure (judgment only)
25
+
26
+ Run `afm verify <path under docs/>` (add `--as <id>` when no git user name is set). The command refuses an
27
+ agent actor. Report the tier that resulted and what it means.
28
+
29
+ ## Invariant principles
30
+
31
+ Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply. #5 is load-bearing here.
@@ -0,0 +1,51 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: ADR-NNNN — {{short title on the decision, not on the problem}}.'
4
+ load: cold
5
+ renders_to: 'docs/adr/*.md'
6
+ frontmatter_for_output: |
7
+ type: adr
8
+ description: '<one sentence: the decision and why it matters>'
9
+ load: warm
10
+ status: proposed # proposed | accepted | superseded | deprecated. Set from step 2's
11
+ # `afm ask adr` answer; `afm adr --supersedes` sets superseded.
12
+ date: YYYY-MM-DD # The day the decision was written down.
13
+ decided_by: '<who>' # '[TBD]' when nobody said.
14
+ supersedes: ADR-NNNN # ONLY when this decision replaces an earlier one. Omit otherwise.
15
+ superseded_by: ADR-NNNN # ONLY when status is superseded by a later decision. Omit otherwise.
16
+ relates_to: [ADR-NNNN] # ONLY when it depends on or refines other ADRs. Omit otherwise.
17
+ trigger_path: '{{glob}}' # ONLY when this decision constrains one path or family of paths.
18
+ # Most decisions bind none: omit the key rather than guess one.
19
+ ---
20
+
21
+ # ADR-NNNN — {{short title on the decision, not on the problem}}
22
+
23
+ ## Context
24
+
25
+ {{What was happening, what problem appeared, which constraints (time, scope, security, cost) limit the decision. 3-5 sentences. Cite the concrete symptom that forced the decision. Do not invent a retroactive motivation.}}
26
+
27
+ ## Decision
28
+
29
+ {{What was decided, in one header sentence.}}
30
+
31
+ {{Operational details. What changes in the code, in which file, with which contract. Use a concrete, absolute path and a snippet when useful.}}
32
+
33
+ ## Alternatives considered
34
+
35
+ - **{{alternative A}}** — why it was NOT chosen (cost / risk / simplicity).
36
+ - **{{alternative B}}** — why it was NOT chosen.
37
+
38
+ <!-- guidance -->
39
+ (List 1-3 alternatives. If you considered none, write "Direct decision — no alternatives evaluated because {{reason}}".)
40
+ <!-- /guidance -->
41
+
42
+ ## Consequence
43
+
44
+ {{What becomes easy now. What becomes hard now. Accepted technical debt. A gotcha other developers will hit (link to `gotchas.md` if it applies).}}
45
+
46
+ ## References
47
+
48
+ - Commit: `{{sha}}`
49
+ - Related US/RF: US-NNN / RF-NN
50
+ - Canonical doc: `/docs/{{file}}.md` §X
51
+ - External issue / PR: {{link}}
@@ -0,0 +1,129 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Evolution cycle {{NNNN}} — {{data YYYY-MM-DD}}.'
4
+ load: cold
5
+ renders_to: 'docs/evolution/YYYY-MM-DD-NNN.md'
6
+ frontmatter_for_output: |
7
+ type: evolution-report
8
+ description: '<one sentence: what this cycle found and changed>'
9
+ load: cold
10
+ mechanism: evolve | reflect | restructure | generalize # WHICH mechanism wrote this report
11
+ date: 'YYYY-MM-DD'
12
+ cycle_trigger: '<explicit invocation or the symptom stated by the user: cite it>'
13
+ new_signal: '<which Class A delta or symptom released the cooldown>'
14
+ ---
15
+
16
+ # Evolution cycle {{NNN}} — {{date YYYY-MM-DD}}
17
+
18
+ <!-- guidance -->
19
+ > **File name: `YYYY-MM-DD-NNN.md`, date first.** The cadence counter picks the last report by
20
+ > sorting these names, and an ordinal-first name sorts by ordinal before date — a low ordinal on
21
+ > a recent date rewinds the window in silence. `NNN` is now only a same-day tiebreak.
22
+ >
23
+ > **`mechanism:` (frontmatter) is mandatory and it is not decoration.** `reflect`, `evolve` and `restructure`
24
+ > all write into this one directory, and each one's cadence window is "since MY last report".
25
+ > Without the field the windows collapse into one, and the cheap mechanism starves the expensive
26
+ > one: measured on 2026-08-30, five reports, all five `reflect`, and `evolve` had never run.
27
+
28
+ > **In this file:** Vital signs · Findings (φ signature) · Evolution package · ADRs created in this cycle · Attempt memory (anti-oscillation) · Mechanical post-conditions · Suggested promotion
29
+
30
+ > This is a report of one `afm evolve` cycle (auto-evolution of **this project's local documentation** — the materialized instance of the methodology in `docs/`, never the plugin). It is the **auditable lineage** and the **memory of past attempts** for future cycles. It is not the evolved artifact itself (the edits live in the touched local docs). It is the record of the diagnosis and the gate decisions.
31
+ <!-- /guidance -->
32
+
33
+ ---
34
+
35
+ ## Vital signs
36
+
37
+ | Signal | Before | After (measured in dry-run / post-apply) |
38
+ | --- | --- | --- |
39
+ | Dead refs (A1) | {{n}} | {{n}} |
40
+ | `[TBD]`/`[NEEDS CLARIFICATION:]` markers above threshold (A2) | {{n}} | {{n}} |
41
+ | Version drift (A3) | {{instance X vs plugin Y / ok}} | {{...}} |
42
+ | Broken ADR chain (A4) | {{n}} | {{n}} |
43
+ | Non-parseable § 3 triggers (A5) | {{n}} | {{n}} |
44
+ | Inflation — core docs above threshold (A6) | {{which / ok}} | {{...}} |
45
+
46
+ ---
47
+
48
+ ## Findings (φ signature)
49
+
50
+ <!-- guidance -->
51
+ > Each finding is `(symptom, behavior causal status, mechanism)` plus evidence (`command` + `file:line`) and severity. Non-addressable findings go in the observations section, with no proposal.
52
+ <!-- /guidance -->
53
+
54
+ | ID | Symptom (evidence) | Causal status | Mechanism | Severity | Addressable? |
55
+ | --- | --- | --- | --- | --- | --- |
56
+ | D01 | {{what the command flagged + file:line}} | {{does this imply a methodology behavior?}} | {{miswritten trigger / obsolete rule / orphan doc / agent non-conformance}} | {{CRITICAL/HIGH/MEDIUM/LOW}} | {{yes / no → observation}} |
57
+
58
+ ### Observations (non-addressable findings — no proposal)
59
+
60
+ - {{example: "user did not answer the `[TBD]` items in §X for >180 days — human behavior, not a doc problem. No edit fixes this"}}.
61
+
62
+ ---
63
+
64
+ ## Evolution package
65
+
66
+ ### Bucket (a) — auto-applicable (restorative, non-semantic)
67
+
68
+ <!-- guidance -->
69
+ > Only fixes that **restore what the doc already states**, proven by git or the file system. Never touch a `*Verification:*` command in § 3, or a path the hooks parse.
70
+ <!-- /guidance -->
71
+
72
+ | ID | Surface | Edit | Mechanical proof | Gate decision |
73
+ | --- | --- | --- | --- | --- |
74
+ | A01 | {{file}} | {{corrected path ref / corrected ADR link}} | {{git log --follow / ADR-NNNN exists}} | {{approved / refused}} |
75
+
76
+ ### Bucket (b) — load-bearing (earned gate questions)
77
+
78
+ <!-- guidance -->
79
+ > A 4-field audit record per item. Downgrading or removing a hard rule, and any deletion, need item-by-item approval. This is unavoidable, even without a "go" — evolve has no "go".
80
+ <!-- /guidance -->
81
+
82
+ | ID | Targeted pattern | Edited surface | Expected effect | Regression risk / what to preserve | What breaks if this is wrong | Flip-flop? | Decision |
83
+ | --- | --- | --- | --- | --- | --- | --- | --- |
84
+ | B01 | {{finding D0N}} | {{file:section}} | {{...}} | {{passing behaviors to preserve}} | {{load-bearing consequence}} | {{⚠ cycle NNNN / —}} | {{approved / refused}} |
85
+
86
+ ### Bucket (c) — cosmetic/deferrable
87
+
88
+ - {{note — becomes `[TBD]` or waits for reconcile. Not edited in this cycle}}.
89
+
90
+ ### Overflow staged (above the cap of 8 items/cycle)
91
+
92
+ - {{items that did not fit — carried to the next cycle}}.
93
+
94
+ ---
95
+
96
+ ## ADRs created in this cycle
97
+
98
+ <!-- guidance -->
99
+ > Itemized in the gate (Phase 3). Not materialized after the gate without approval.
100
+ <!-- /guidance -->
101
+
102
+ - {{ADR-NNNN — title — status proposed/approved}}.
103
+
104
+ ---
105
+
106
+ ## Attempt memory (anti-oscillation)
107
+
108
+ <!-- guidance -->
109
+ > Future cycles read this. Re-proposing a refused or reverted item needs **new evidence**. Touching a surface with an opposite history carries a flip-flop flag.
110
+ <!-- /guidance -->
111
+
112
+ ### Refused in this cycle
113
+ - {{ID — proposal — reason the user refused it}}.
114
+
115
+ ### Approved-then-reverted (by mechanical post-condition)
116
+ - {{ID — edit — why it was reverted (hook format broke / plugin got dirty) — flagged dependent items}}.
117
+
118
+ ---
119
+
120
+ ## Mechanical post-conditions
121
+
122
+ - [ ] `afm doctor --json`, `afm index --check` and `afm detect --for <file>` over the touched docs kept the format the hooks parse.
123
+ - [ ] The content root (`afm path`) is clean: `git -C <content-root> status --porcelain` is empty, or, with no git there, no file under it is newer than T0 (no edit leaked into the bundled content).
124
+
125
+ ---
126
+
127
+ ## Suggested promotion
128
+
129
+ - {{finding that generalizes to any instance → suggest `afm promote` (its own gate, evolve only suggests it). Or "none"}}.
@@ -0,0 +1,86 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Feature {{NNN}} — Plan.'
4
+ load: cold
5
+ renders_to: 'docs/features/*/plan.md'
6
+ frontmatter_for_output: |
7
+ type: feature-plan
8
+ description: '<one sentence: the approach this plan commits to>'
9
+ load: cold
10
+ status: planned # draft | clarified | planned | in_progress | done | cancelled — the folder's
11
+ # ONE lifecycle value; `planned` once this plan exists, in step with spec.md
12
+ for_paths: # § 2's affected components, as globs — this is where the list
13
+ - '{{glob}}' # spec.md seeded empty gets its first real entries
14
+ us: US-{{NNN}} # carried from spec.md. Omit when spec.md omits it.
15
+ rf: RF-{{NN}} # carried from spec.md. Omit when spec.md omits it.
16
+ ---
17
+
18
+ # Feature {{NNN}} — Plan
19
+
20
+ > **Inferred stack:** {{read from /docs/ach.md § 1, do not reopen the discussion}}
21
+
22
+ ## 1. Approach in 3 sentences
23
+
24
+ {{What to build, in which layer, linked to which component-types from `ach.md` § 3.}}
25
+
26
+ ## 2. Affected components
27
+
28
+ | Component-type | File / module | New or edit | Why |
29
+ | --- | --- | --- | --- |
30
+ | {{Procedure-like}} | `{{src-path}}/server/routers/{{x}}.ts` | edit | adds endpoint Y |
31
+ | {{Domain-like}} | `{{src-path}}/domain/{{x}}.ts` | new | business rule Z |
32
+
33
+ ## 3. Data model (delta)
34
+
35
+ {{Mini ASCII ER diagram if there is a new entity. For new fields only, list field + type + reason. If nothing changes, write "no delta".}}
36
+
37
+ ## 4. Architectural decisions
38
+
39
+ {{Each decision that would deserve an ADR goes here FIRST. If it becomes load-bearing later, materialize an ADR (see `ops/adr.md`). Bullet list:}}
40
+
41
+ - **Decision:** {{X}}. **Rejected alternative:** {{Y}}. **Why:** {{concrete reason — cost, risk, simplicity}}.
42
+
43
+ ## 5. Contracts (external boundaries)
44
+
45
+ {{For each new boundary — request/response shape, error codes, status. Keep it inline. Promote to `./contracts/` only when there are more than 3 boundaries OR the schema comes from tooling.}}
46
+
47
+ ### Boundary {{name}}
48
+
49
+ ```ts
50
+ // input
51
+ { field: type }
52
+
53
+ // output (success)
54
+ { field: type }
55
+
56
+ // errors (codes)
57
+ "NOT_FOUND" | "INVALID_INPUT" | "..."
58
+ ```
59
+
60
+ ## 6. Complexity tracking
61
+
62
+ {{Log each complexity that exceeds the "obviously simple" baseline, with a justification. An empty table is a valid answer — it means the baseline stayed simple.}}
63
+
64
+ | Accepted complexity | Rejected simple alternative | Why it was not simple |
65
+ | --- | --- | --- |
66
+ | {{ex: in-memory cache + TTL}} | {{no cache}} | {{p95 would be 800ms vs 80ms}} |
67
+
68
+ ## 7. Validation against invariants
69
+
70
+ - [ ] Does not violate the hard rules in `afm.md` § 3 (list the ones that apply, by number, e.g. "rule 11 — structural change confirmed with the user at {{turn}}").
71
+ - [ ] Follows the universal principles in `PRINCIPLES.md`.
72
+ - [ ] `[NEEDS CLARIFICATION:]` is at zero OR listed in § 9 with a resolution plan.
73
+
74
+ ## 8. Risks
75
+
76
+ - {{1-3 risks, each with a concrete mitigation}}.
77
+
78
+ ## 9. Open questions
79
+
80
+ - [NEEDS CLARIFICATION: {{question}}]
81
+
82
+ ---
83
+
84
+ <!-- guidance -->
85
+ *The plan does NOT contain a granular task list (that goes in `tasks.md`). The plan does NOT choose the stack — it reads the stack from `ach.md`. If the relevant `ach.md` layer is `[TBD]`, flag it here and block tasks until it is resolved.*
86
+ <!-- /guidance -->
@@ -0,0 +1,57 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Research — Feature {{NNN}} — {{title}}.'
4
+ load: cold
5
+ renders_to: 'docs/features/*/research.md'
6
+ frontmatter_for_output: |
7
+ type: feature-research
8
+ description: '<one sentence: what this research investigates>'
9
+ load: cold
10
+ status: open # open | closed — `closed` once the findings were applied to spec.md or plan.md
11
+ consumed_by: '<the artifact that cites this research; omit until one does>'
12
+ ---
13
+
14
+ # Research — Feature {{NNN}} — {{title}}
15
+
16
+ > **Triggered by:** {{original marker from spec/plan OR "free investigation: <topic>"}}
17
+
18
+ <!-- guidance -->
19
+ {{For each topic investigated, repeat the block below. Put multiple topics in the same file if they went to the subagent in the same round.}}
20
+ <!-- /guidance -->
21
+
22
+ ## {{topic 1 — concrete question}}
23
+
24
+ **Decision (proposed):** {{X}}
25
+
26
+ **Rationale:**
27
+ - {{bullet 1 with concrete evidence — number, benchmark, documented case}}
28
+ - {{bullet 2}}
29
+ - {{bullet 3}}
30
+
31
+ **Alternatives considered:**
32
+ - **{{alt A}}** — rejected because {{concrete reason — cost, risk, simplicity, compat}}.
33
+ - **{{alt B}}** — rejected because {{reason}}.
34
+
35
+ **Sources:**
36
+ - {{real URL or ref}}
37
+ - {{real URL or ref}}
38
+
39
+ ---
40
+
41
+ ## {{topic 2}}
42
+
43
+ <!-- guidance -->
44
+ (Same as the previous block if more topics exist.)
45
+ <!-- /guidance -->
46
+
47
+ ---
48
+
49
+ <!-- guidance -->
50
+ *Research is input. It is not a decision. To add it to the project, follow these steps.*
51
+
52
+ *1. Edit the feature's `spec.md` or `plan.md`. Cite this research as the source.*
53
+
54
+ *2. If the decision is load-bearing (a change would break something visible), make it an ADR with `afm adr`.*
55
+
56
+ *3. After you add it, set this file's frontmatter `status` from `open` to `closed`.*
57
+ <!-- /guidance -->
@@ -0,0 +1,86 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Feature {{NNN}} — {{objective title}}.'
4
+ load: cold
5
+ renders_to: 'docs/features/*/spec.md'
6
+ frontmatter_for_output: |
7
+ type: feature-spec
8
+ description: '<one sentence: what this feature does and why>'
9
+ load: cold
10
+ status: draft # draft | clarified | planned | in_progress | done | cancelled — the ONE
11
+ # lifecycle signal of the folder; the body carries no Status line. The
12
+ # same value rides in plan.md and tasks.md once they exist.
13
+ for_paths: # the globs this feature touches — the whole trigger `afm-index.sh
14
+ # --for` matches through. Empty until plan.md § 2 names them; an
15
+ # absent key is honest, a list guessed ahead of the plan is not.
16
+ - '{{glob}}'
17
+ us: US-{{NNN}} # the linked US (step 5). Omit the key entirely when none is linked yet.
18
+ rf: RF-{{NN}} # only when the feature also answers a roadmap RF. Omit otherwise.
19
+ ---
20
+
21
+ # Feature {{NNN}} — {{objective title}}
22
+
23
+ <!-- guidance -->
24
+ > **Spec:** the what and the why. No technology decision.
25
+ > The linked US and the lifecycle `status` live in the frontmatter, never in the body.
26
+ <!-- /guidance -->
27
+
28
+ ## 1. Problem (from PRD/UST)
29
+
30
+ {{Restate the user job and the pain this feature solves, in 2-3 sentences. Name the persona from PRD § 3.}}
31
+
32
+ ## 2. Observable success criteria
33
+
34
+ - [ ] {{verifiable from outside — example: "user X can export a report to PDF in <3 clicks"}}
35
+ - [ ] {{metric, if any — example: "average time < 2s at p95"}}
36
+
37
+ ## 3. Scenarios (Gherkin, inherited from the US)
38
+
39
+ ```gherkin
40
+ Scenario: {{happy path name}}
41
+ Given {{precondition}}
42
+ When {{user action}}
43
+ Then {{observable result}}
44
+ And {{verifiable side effect}}
45
+ ```
46
+
47
+ ```gherkin
48
+ Scenario: {{most likely error scenario}}
49
+ Given {{precondition}}
50
+ When {{action in invalid state}}
51
+ Then {{expected typed error}}
52
+ And {{no DB side effect}}
53
+ ```
54
+
55
+ ## 4. Out of scope
56
+
57
+ - {{things explicitly NOT included — this prevents scope creep and protects future decisions}}
58
+
59
+ ## 5. Assumptions / Open questions
60
+
61
+ - [NEEDS CLARIFICATION: {{concrete unanswered question — someone must resolve this before plan}}]
62
+ - {{assumption that changes the design if it is wrong}}
63
+
64
+ ## 6. Dependencies
65
+
66
+ - US-NNN (must be `done` first — or mark as a blocker)
67
+ - Feature {{MMM}} (shares entity X, contract Y)
68
+
69
+ ## 7. Clarifications
70
+
71
+ <!-- guidance -->
72
+ {{Optional section, filled in by `afm clarify`. Each session gets a subheading `### Session YYYY-MM-DD`. Each Q/A becomes a bullet. The section stays empty until the first `clarify` run.}}
73
+
74
+ <!-- Example after the first session:
75
+ ### Session 2026-05-10
76
+ - Q: Is the PDF generated server-side or client-side? → A: Server-side (cache + signed URL)
77
+ - Q: Delivery by direct download or pre-signed URL? → A: Pre-signed URL, TTL 1h
78
+ -->
79
+ <!-- /guidance -->
80
+
81
+ ---
82
+
83
+ <!-- guidance -->
84
+ *The spec must NOT contain: stack decisions, function names, DB schema, task order. Those belong in `plan.md`.*
85
+ *The marker `[NEEDS CLARIFICATION:]` differs from `[TBD]`. Use the first for a gap that blocks execution (resolved through `afm clarify`). Use the second for a decision the user knowingly defers.*
86
+ <!-- /guidance -->
@@ -0,0 +1,67 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Induced tasks — parameterized template.'
4
+ load: cold
5
+ renders_to: 'docs/templates/feature-tasks.induced.md'
6
+ frontmatter_for_output: |
7
+ type: feature-tasks
8
+ description: '<one sentence: what this task list delivers>'
9
+ load: cold
10
+ status: planned # draft | clarified | planned | in_progress | done | cancelled
11
+ for_paths:
12
+ - '{{glob}}'
13
+ us: US-{{NNN}} # Omit when no US is linked.
14
+ rf: RF-{{NN}} # Omit when no RF is linked.
15
+ ---
16
+
17
+ # Induced tasks — parameterized template
18
+
19
+ <!-- guidance -->
20
+ > **Source:** induced by `afm export-template` from a feature that is **delivered and 100% green** (`tasks.md` with all tasks `- [X]` — gate `L_eval=1` of AWM). The concrete values of the original feature are parameterized as `{variables}`.
21
+ > **Ancestor:** Agent Workflow Memory (arXiv:2409.07429) — induce a reusable workflow from a successful trajectory, and parameterize the concrete values. Voyager (arXiv:2305.16291) — composing from the library beats regenerating from scratch.
22
+ > **Use:** the next consumer of this template starts here (fills in the variables) instead of generating tasks from scratch. It keeps the TDD convention of `feature-tasks.template.md`. Each task is a cycle of `core/afm.md § 2`.
23
+ <!-- /guidance -->
24
+
25
+ ## Variables
26
+
27
+ | Variable | What it is | Example (from the induced feature) |
28
+ | --- | --- | --- |
29
+ | `{product-name}` | product/project name | — |
30
+ | `{domain}` | module/domain of the feature | `billing`, `auth` |
31
+ | `{entity}` | central entity touched | `Subscription`, `Session` |
32
+ | `{boundary-procedure}` | boundary procedure/handler | `subscriptionCreate` |
33
+
34
+ ## Phase 1 — Setup
35
+
36
+ - [ ] T001 [P] Create the file `{{src-path}}/domain/{domain}.ts` with exported signature `domain_{domain}`.
37
+ - [ ] T002 [P] Create the test fixture in `{{src-path}}/domain/{domain}.fixtures.ts`.
38
+
39
+ ## Phase 2 — Foundation (write failing tests first)
40
+
41
+ - [ ] T003 — RED: write test `domain_{domain} returns <result> given <input>` in `{{src-path}}/domain/{domain}.test.ts` (US-NNN scenario 1).
42
+ - [ ] T004 — GREEN: add the minimal implementation of `domain_{domain}` that passes T003.
43
+ - [ ] T005 — REFACTOR: extract a helper if DRY reaches 3 callers (rule 8).
44
+
45
+ ## Phase 3 — Boundary
46
+
47
+ - [ ] T006 — RED: write a test for procedure `{boundary-procedure}` that calls `domain_{domain}` (US-NNN scenario 1).
48
+ - [ ] T007 — GREEN: add the minimal procedure.
49
+ - [ ] T008 [P] — RED: write a test for the error path of an invalid `{entity}` (US-NNN scenario 2).
50
+ - [ ] T009 — GREEN: add Zod validation at the boundary (rule 16).
51
+
52
+ ## Phase 4 — Reconciliation (8.5)
53
+
54
+ <!-- guidance -->
55
+ > **Version bump.** In a delivery of more than one commit, the version bump is a **precondition of every commit that touches the installable surface**. It is not a task of this phase: a final-phase bump leaves the earlier commits failing the gate.
56
+ <!-- /guidance -->
57
+
58
+ - [ ] T010 — Update `ach.md § 3` if a new component (`{domain}`/`{entity}`) was added.
59
+ - [ ] T011 — Add an ADR if an architectural decision was made (see `ops/adr.md`).
60
+ - [ ] T012 — Update the US status in `ust.md` to `done`.
61
+ - [ ] T013 — Move the spec status to `done` (the `status` frontmatter key of `spec.md`, `plan.md` and `tasks.md`).
62
+
63
+ ---
64
+
65
+ <!-- guidance -->
66
+ *Fill in the variables for this feature. The rest of the TDD structure came from a validated delivery. Every task must reference US-NNN/RF-NN in its commit and must run as a cycle of `core/afm.md § 2`. Do not skip RED (rule 1).*
67
+ <!-- /guidance -->
@@ -0,0 +1,60 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Feature {{NNN}} — Tasks.'
4
+ load: cold
5
+ renders_to: 'docs/features/*/tasks.md'
6
+ frontmatter_for_output: |
7
+ type: feature-tasks
8
+ description: '<one sentence: what this task list delivers>'
9
+ load: cold
10
+ status: planned # draft | clarified | planned | in_progress | done | cancelled — the folder's
11
+ # ONE lifecycle value: `in_progress` with the first task, `done` in the
12
+ # same last task (Phase 4, T013) that moves spec.md and plan.md
13
+ for_paths: # carried from plan.md § 2, unchanged
14
+ - '{{glob}}'
15
+ us: US-{{NNN}} # carried from spec.md. Omit when spec.md omits it.
16
+ rf: RF-{{NN}} # carried from spec.md. Omit when spec.md omits it.
17
+ ---
18
+
19
+ # Feature {{NNN}} — Tasks
20
+
21
+ <!-- guidance -->
22
+ > **Convention:** Tasks follow TDD order. `[P]` marks a task you can run in parallel, with no dependency on the task right before it. Each task is one cycle of `core/afm.md` § 2 (RED → GREEN → REFACTOR → COMMIT).
23
+ > **Prerequisite:** `plan.md` has no open `[NEEDS CLARIFICATION:]` marker.
24
+ <!-- /guidance -->
25
+
26
+ ## Phase 1 — Setup
27
+
28
+ - [ ] T001 [P] {{ex: create empty file `{{src-path}}/domain/x.ts` with an exported signature}}
29
+ - [ ] T002 [P] {{ex: create test fixture in `{{src-path}}/domain/x.fixtures.ts`}}
30
+
31
+ ## Phase 2 — Foundation (failing tests first)
32
+
33
+ - [ ] T003 — RED: test `domain_x returns Y given Z` in `{{src-path}}/domain/x.test.ts` (US-NNN scenario 1)
34
+ - [ ] T004 — GREEN: minimal implementation of `domain_x` that passes T003
35
+ - [ ] T005 — REFACTOR: extract `parseInput` if DRY has 3+ callers (rule 8)
36
+
37
+ ## Phase 3 — Boundary
38
+
39
+ - [ ] T006 — RED: test the `xCreate` procedure that calls `domain_x` (US-NNN scenario 1)
40
+ - [ ] T007 — GREEN: minimal procedure
41
+ - [ ] T008 [P] — RED: test the `INVALID_INPUT` error path (US-NNN scenario 2)
42
+ - [ ] T009 — GREEN: Zod validation at the boundary (rule 16)
43
+
44
+ ## Phase 4 — Reconciliation (8.5)
45
+
46
+ <!-- guidance -->
47
+ > **Version bump.** In a delivery of more than one commit, the version bump is a **precondition of every commit that touches the installable surface**. It is not a task of this phase: a final-phase bump leaves the earlier commits failing the gate.
48
+ <!-- /guidance -->
49
+
50
+ - [ ] T010 — Update `ach.md` § 3 if a new component landed
51
+ - [ ] T011 — Add an ADR if an architectural decision materialized (see `ops/adr.md`)
52
+ - [ ] T012 — Update the US status in `ust.md` to `done`
53
+ - [ ] T013 — Move the spec status to `done` (the `status` frontmatter key of `spec.md`, `plan.md` and `tasks.md`)
54
+
55
+ ---
56
+
57
+ <!-- guidance -->
58
+ *Every task references US-NNN or RF-NN in the commit (rule in `core/afm.md` § 2, step 7 COMMIT).*
59
+ *Every task runs as a `core/afm.md` § 2 cycle. Never skip RED (rule 1 — TDD).*
60
+ <!-- /guidance -->
@@ -0,0 +1,30 @@
1
+ ---
2
+ type: template
3
+ description: 'Template rendered during materialization: Current focus.'
4
+ load: cold
5
+ renders_to: 'docs/_focus.md'
6
+ frontmatter_for_output: |
7
+ type: state
8
+ description: 'Where the work is now: the focus, the last steps, the next step and the blockers.'
9
+ load: hot
10
+ ---
11
+
12
+ # Current focus
13
+
14
+ <!-- guidance -->
15
+ > This is **MUTABLE** work state (slot-state, `type: state`). The agent **OVERWRITES** it when the focus changes (`reconcile` proposes it; no hook writes the body). It does not grow by append (hard rule 20). This exempts it from rule 17, the anti-context-collapse rule. It is NOT normative knowledge. It does not enter the A1-A7 axes of `diagnose`. It answers only "where am I now". The `afm.md § 2 LER` step reads it. The SessionStart hook injects it with its age ("last updated N days ago", from the last commit or the file's mtime) and flags it as possibly stale after 7 days. It is one page only (KISS). There is no `_slots/` folder and no consolidator.
16
+ <!-- /guidance -->
17
+
18
+ ```
19
+ protocol: {{p1|p2|p3, or omit for the core/protocol.md § 2 defaults}}
20
+ cadence: reflect={{N}} evolve={{N}}
21
+ ```
22
+
23
+ <!-- guidance -->
24
+ > The two lines above are **declarations read by a hook**, not prose. `protocol:` sets the posture (`core/protocol.md § 7`). `cadence:` overrides `REFLECT_EVERY`/`EVOLVE_EVERY` (§ 2). `reflect=off` turns off the `Stop` block. Both lines are optional. When absent, the defaults apply.
25
+ <!-- /guidance -->
26
+
27
+ - **Now:** {{the task/feature in focus}}
28
+ - **Last steps:** {{what was just done}}
29
+ - **Next steps:** {{the next concrete step}}
30
+ - **Blockers:** {{what blocks progress, if anything}}