@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.
- package/bin/afm +4 -0
- package/content/.coupling-baseline.tsv +1 -0
- package/content/.pending-commands.txt +2 -0
- package/content/CHANGELOG-archive.md +806 -0
- package/content/CHANGELOG.md +4256 -0
- package/content/PRINCIPLES.md +121 -0
- package/content/README-light.md +160 -0
- package/content/README.md +152 -0
- package/content/code-style/_any/file-size.md +62 -0
- package/content/code-style/_any/imports.md +68 -0
- package/content/code-style/_any/naming.md +72 -0
- package/content/code-style/_any/test-placement.md +57 -0
- package/content/code-style/nextjs-app-router/imports.md +50 -0
- package/content/code-style/nextjs-app-router/naming.md +50 -0
- package/content/code-style/prisma-postgres/error-boundary.md +55 -0
- package/content/code-style/prisma-postgres/imports.md +61 -0
- package/content/code-style/shadcn-ui/naming.md +48 -0
- package/content/code-style/stripe-billing/naming.md +76 -0
- package/content/code-style/trigger-dev-v4/imports.md +58 -0
- package/content/code-style/trigger-dev-v4/naming.md +49 -0
- package/content/code-style/trigger-dev-v4/test-placement.md +61 -0
- package/content/code-style/trpc-v11/error-boundary.md +51 -0
- package/content/code-style/trpc-v11/file-size.md +44 -0
- package/content/code-style/trpc-v11/naming.md +60 -0
- package/content/code-style/trpc-v11/test-placement.md +52 -0
- package/content/core/ach.md +265 -0
- package/content/core/afm.md +496 -0
- package/content/core/gotchas.md +18 -0
- package/content/core/prd.md +143 -0
- package/content/core/protocol.md +160 -0
- package/content/core/ust.md +65 -0
- package/content/guardrails/README.md +55 -0
- package/content/guardrails/dsl-com-ordem-obrigatoria.md +47 -0
- package/content/guardrails/exaustividade-de-union.md +48 -0
- package/content/guardrails/fronteira-de-import.md +57 -0
- package/content/hooks/README.md +72 -0
- package/content/interview/bootstrap.md +415 -0
- package/content/interview/promotion.md +117 -0
- package/content/interview/refactor.md +381 -0
- package/content/interview/triggers.md +109 -0
- package/content/modules/nextjs-app-router/ach.patch.md +44 -0
- package/content/modules/nextjs-app-router/gotchas.seed.md +78 -0
- package/content/modules/nextjs-app-router/rules.patch.md +35 -0
- package/content/modules/prisma-postgres/ach.patch.md +65 -0
- package/content/modules/prisma-postgres/rules.patch.md +28 -0
- package/content/modules/shadcn-ui/ach.patch.md +42 -0
- package/content/modules/stripe-billing/ach.patch.md +46 -0
- package/content/modules/stripe-billing/gotchas.seed.md +73 -0
- package/content/modules/stripe-billing/rules.patch.md +30 -0
- package/content/modules/trigger-dev-v4/ach.patch.md +64 -0
- package/content/modules/trigger-dev-v4/gotchas.seed.md +53 -0
- package/content/modules/trigger-dev-v4/rules.patch.md +35 -0
- package/content/modules/trpc-v11/ach.patch.md +56 -0
- package/content/modules/trpc-v11/rules.patch.md +34 -0
- package/content/modules/vireya-ui/ach.patch.md +85 -0
- package/content/modules/vireya-ui/gotchas.seed.md +98 -0
- package/content/modules/vireya-ui/rules.patch.md +36 -0
- package/content/ops/adr.md +54 -0
- package/content/ops/analyze.md +129 -0
- package/content/ops/clarify.md +86 -0
- package/content/ops/deliver.md +211 -0
- package/content/ops/diagnose.md +146 -0
- package/content/ops/evolve.md +317 -0
- package/content/ops/export-template.md +97 -0
- package/content/ops/generalize.md +120 -0
- package/content/ops/gotcha.md +46 -0
- package/content/ops/plan.md +61 -0
- package/content/ops/policy.md +63 -0
- package/content/ops/promote.md +72 -0
- package/content/ops/protocol.md +51 -0
- package/content/ops/reconcile.md +44 -0
- package/content/ops/reflect.md +180 -0
- package/content/ops/remediate.md +146 -0
- package/content/ops/restructure.md +145 -0
- package/content/ops/rule.md +165 -0
- package/content/ops/specify.md +62 -0
- package/content/ops/tasks.md +67 -0
- package/content/ops/update.md +223 -0
- package/content/ops/verify.md +69 -0
- package/content/patterns/adapter.md +46 -0
- package/content/patterns/facade.md +47 -0
- package/content/patterns/factory.md +46 -0
- package/content/patterns/null-object.md +55 -0
- package/content/patterns/result-vs-exception.md +52 -0
- package/content/patterns/strategy.md +45 -0
- package/content/patterns/template-method-vs-composition.md +50 -0
- package/content/questions/adr.questions.yaml +14 -0
- package/content/questions/analyze.questions.yaml +12 -0
- package/content/questions/bootstrap-mapping.questions.yaml +14 -0
- package/content/questions/bootstrap-rules.questions.yaml +10 -0
- package/content/questions/bootstrap-stack.questions.yaml +23 -0
- package/content/questions/clarify.questions.yaml +10 -0
- package/content/questions/code-style.questions.yaml +12 -0
- package/content/questions/confirm.questions.yaml +12 -0
- package/content/questions/deliver.questions.yaml +23 -0
- package/content/questions/evolve.questions.yaml +15 -0
- package/content/questions/export-template-apply.questions.yaml +11 -0
- package/content/questions/export-template.questions.yaml +23 -0
- package/content/questions/gates.questions.yaml +27 -0
- package/content/questions/generalize.questions.yaml +13 -0
- package/content/questions/gotcha.questions.yaml +11 -0
- package/content/questions/init-template.questions.yaml +10 -0
- package/content/questions/init.questions.yaml +28 -0
- package/content/questions/plan.questions.yaml +14 -0
- package/content/questions/refactor.questions.yaml +23 -0
- package/content/questions/reflect.questions.yaml +13 -0
- package/content/questions/remediate.questions.yaml +27 -0
- package/content/questions/restructure.questions.yaml +15 -0
- package/content/questions/rf-mapping.questions.yaml +12 -0
- package/content/questions/rule-scope.questions.yaml +12 -0
- package/content/questions/rule.questions.yaml +12 -0
- package/content/questions/specify.questions.yaml +23 -0
- package/content/questions/update-artifacts.questions.yaml +10 -0
- package/content/questions/update-strings.questions.yaml +14 -0
- package/content/questions/update.questions.yaml +10 -0
- package/content/questions/verify.questions.yaml +9 -0
- package/content/roles/executor.md +18 -0
- package/content/roles/explorer.md +22 -0
- package/content/roles/reviewer.md +23 -0
- package/content/rubrics/enum-vs-union-vs-branded.md +40 -0
- package/content/rubrics/episodic-vs-semantic-boundary.md +37 -0
- package/content/rubrics/error-classification.md +98 -0
- package/content/rubrics/failure-classification.md +113 -0
- package/content/rubrics/negative-filters.md +38 -0
- package/content/rubrics/solid-triggers.md +121 -0
- package/content/rubrics/template-vs-streaming-precedence.md +34 -0
- package/content/rubrics/validation-boundary.md +94 -0
- package/content/rubrics/when-to-create-dsl.md +65 -0
- package/content/rubrics/when-to-create-lib.md +49 -0
- package/content/rubrics/when-to-create-module.md +39 -0
- package/content/rubrics/when-to-evolve-methodology.md +62 -0
- package/content/skills/adr.md +42 -0
- package/content/skills/analyze.md +34 -0
- package/content/skills/clarify.md +34 -0
- package/content/skills/deliver.md +42 -0
- package/content/skills/diagnose.md +50 -0
- package/content/skills/evolve.md +67 -0
- package/content/skills/export-template.md +40 -0
- package/content/skills/generalize.md +47 -0
- package/content/skills/gotcha.md +40 -0
- package/content/skills/init.md +82 -0
- package/content/skills/plan.md +34 -0
- package/content/skills/policy.md +31 -0
- package/content/skills/promote.md +41 -0
- package/content/skills/protocol.md +42 -0
- package/content/skills/reconcile.md +49 -0
- package/content/skills/refactor.md +84 -0
- package/content/skills/reflect.md +53 -0
- package/content/skills/remediate.md +39 -0
- package/content/skills/restructure.md +52 -0
- package/content/skills/rule.md +44 -0
- package/content/skills/specify.md +34 -0
- package/content/skills/tasks.md +34 -0
- package/content/skills/update.md +56 -0
- package/content/skills/verify.md +31 -0
- package/content/templates/adr.template.md +51 -0
- package/content/templates/evolution-report.template.md +129 -0
- package/content/templates/feature-plan.template.md +86 -0
- package/content/templates/feature-research.template.md +57 -0
- package/content/templates/feature-spec.template.md +86 -0
- package/content/templates/feature-tasks.induced.template.md +67 -0
- package/content/templates/feature-tasks.template.md +60 -0
- package/content/templates/focus.template.md +30 -0
- package/content/templates/gotcha.template.md +31 -0
- package/content/templates/guardrail-runner.template.md +81 -0
- package/content/templates/guardrail.template.md +63 -0
- package/content/templates/learning.template.md +40 -0
- package/content/templates/procedure.template.md +47 -0
- package/content/templates/protocols/p1.md +29 -0
- package/content/templates/protocols/p2.md +28 -0
- package/content/templates/protocols/p3.md +47 -0
- package/content/templates/research.template.md +50 -0
- package/content/templates/session-handoff.template.md +58 -0
- package/content/templates/us.template.md +39 -0
- package/content/tools/gate/core-rules/PLUGIN-13-secrets.sh +36 -0
- package/content/tools/gate/core-rules/PLUGIN-21-code-language.sh +27 -0
- package/content/tools/gate/core-rules/PLUGIN-35-gate-complete.sh +19 -0
- package/content/tools/gate/core-rules/PLUGIN-36-absolute-path.sh +38 -0
- package/content/tools/gate/core-rules/PLUGIN-37-prose-language.sh +56 -0
- package/content/tools/gate/core-rules/PLUGIN-38-parser-marker.sh +82 -0
- package/content/tools/gate/core-rules/PLUGIN-39-frontmatter-ops.sh +325 -0
- package/content/tools/gate/core-rules/PLUGIN-40-dead-reference.sh +74 -0
- package/content/tools/gate/core-rules/README.md +55 -0
- package/content/tools/gate/guardrails.sh +740 -0
- package/content/tools/gate/lib/ratchet.sh +119 -0
- package/content/tools/gate/lib/scope.sh +85 -0
- package/content/tools/gate/ratchet.seed.tsv +1 -0
- package/content/tools/gate/rules/README.md +50 -0
- package/package.json +19 -5
- package/plugin/agy/hooks.json +29 -0
- package/plugin/agy/mcp_config.json +7 -0
- package/plugin/agy/plugin.json +6 -0
- package/plugin/agy/skills/afm-adr/SKILL.md +44 -0
- package/plugin/agy/skills/afm-analyze/SKILL.md +36 -0
- package/plugin/agy/skills/afm-clarify/SKILL.md +36 -0
- package/plugin/agy/skills/afm-deliver/SKILL.md +44 -0
- package/plugin/agy/skills/afm-diagnose/SKILL.md +50 -0
- package/plugin/agy/skills/afm-evolve/SKILL.md +69 -0
- package/plugin/agy/skills/afm-export-template/SKILL.md +42 -0
- package/plugin/agy/skills/afm-generalize/SKILL.md +49 -0
- package/plugin/agy/skills/afm-gotcha/SKILL.md +42 -0
- package/plugin/agy/skills/afm-init/SKILL.md +84 -0
- package/plugin/agy/skills/afm-plan/SKILL.md +36 -0
- package/plugin/agy/skills/afm-policy/SKILL.md +31 -0
- package/plugin/agy/skills/afm-promote/SKILL.md +41 -0
- package/plugin/agy/skills/afm-protocol/SKILL.md +42 -0
- package/plugin/agy/skills/afm-reconcile/SKILL.md +49 -0
- package/plugin/agy/skills/afm-refactor/SKILL.md +86 -0
- package/plugin/agy/skills/afm-reflect/SKILL.md +55 -0
- package/plugin/agy/skills/afm-remediate/SKILL.md +41 -0
- package/plugin/agy/skills/afm-restructure/SKILL.md +54 -0
- package/plugin/agy/skills/afm-rule/SKILL.md +46 -0
- package/plugin/agy/skills/afm-specify/SKILL.md +36 -0
- package/plugin/agy/skills/afm-tasks/SKILL.md +34 -0
- package/plugin/agy/skills/afm-update/SKILL.md +58 -0
- package/plugin/agy/skills/afm-verify/SKILL.md +33 -0
- package/plugin/claude-code/.claude-plugin/marketplace.json +15 -0
- package/plugin/claude-code/.claude-plugin/plugin.json +9 -0
- package/plugin/claude-code/.mcp.json +7 -0
- package/plugin/claude-code/agents/afm-executor.md +18 -0
- package/plugin/claude-code/agents/afm-explorer.md +20 -0
- package/plugin/claude-code/agents/afm-reviewer.md +21 -0
- package/plugin/claude-code/hooks/hooks.json +85 -0
- package/plugin/claude-code/skills/adr/SKILL.md +44 -0
- package/plugin/claude-code/skills/analyze/SKILL.md +36 -0
- package/plugin/claude-code/skills/clarify/SKILL.md +36 -0
- package/plugin/claude-code/skills/deliver/SKILL.md +44 -0
- package/plugin/claude-code/skills/diagnose/SKILL.md +50 -0
- package/plugin/claude-code/skills/evolve/SKILL.md +69 -0
- package/plugin/claude-code/skills/export-template/SKILL.md +42 -0
- package/plugin/claude-code/skills/generalize/SKILL.md +49 -0
- package/plugin/claude-code/skills/gotcha/SKILL.md +42 -0
- package/plugin/claude-code/skills/init/SKILL.md +84 -0
- package/plugin/claude-code/skills/plan/SKILL.md +36 -0
- package/plugin/claude-code/skills/policy/SKILL.md +31 -0
- package/plugin/claude-code/skills/promote/SKILL.md +41 -0
- package/plugin/claude-code/skills/protocol/SKILL.md +42 -0
- package/plugin/claude-code/skills/reconcile/SKILL.md +49 -0
- package/plugin/claude-code/skills/refactor/SKILL.md +86 -0
- package/plugin/claude-code/skills/reflect/SKILL.md +55 -0
- package/plugin/claude-code/skills/remediate/SKILL.md +41 -0
- package/plugin/claude-code/skills/restructure/SKILL.md +54 -0
- package/plugin/claude-code/skills/rule/SKILL.md +46 -0
- package/plugin/claude-code/skills/specify/SKILL.md +36 -0
- package/plugin/claude-code/skills/tasks/SKILL.md +34 -0
- package/plugin/claude-code/skills/update/SKILL.md +58 -0
- package/plugin/claude-code/skills/verify/SKILL.md +33 -0
- package/plugin/opencode/afm.js +173 -0
- package/plugin/opencode/agents/afm-executor.md +31 -0
- package/plugin/opencode/agents/afm-explorer.md +47 -0
- package/plugin/opencode/agents/afm-reviewer.md +48 -0
- package/plugin/opencode/skills/afm-adr/SKILL.md +44 -0
- package/plugin/opencode/skills/afm-analyze/SKILL.md +36 -0
- package/plugin/opencode/skills/afm-clarify/SKILL.md +36 -0
- package/plugin/opencode/skills/afm-deliver/SKILL.md +44 -0
- package/plugin/opencode/skills/afm-diagnose/SKILL.md +50 -0
- package/plugin/opencode/skills/afm-evolve/SKILL.md +69 -0
- package/plugin/opencode/skills/afm-export-template/SKILL.md +42 -0
- package/plugin/opencode/skills/afm-generalize/SKILL.md +49 -0
- package/plugin/opencode/skills/afm-gotcha/SKILL.md +42 -0
- package/plugin/opencode/skills/afm-init/SKILL.md +84 -0
- package/plugin/opencode/skills/afm-plan/SKILL.md +36 -0
- package/plugin/opencode/skills/afm-policy/SKILL.md +31 -0
- package/plugin/opencode/skills/afm-promote/SKILL.md +41 -0
- package/plugin/opencode/skills/afm-protocol/SKILL.md +42 -0
- package/plugin/opencode/skills/afm-reconcile/SKILL.md +49 -0
- package/plugin/opencode/skills/afm-refactor/SKILL.md +86 -0
- package/plugin/opencode/skills/afm-reflect/SKILL.md +55 -0
- package/plugin/opencode/skills/afm-remediate/SKILL.md +41 -0
- package/plugin/opencode/skills/afm-restructure/SKILL.md +54 -0
- package/plugin/opencode/skills/afm-rule/SKILL.md +46 -0
- package/plugin/opencode/skills/afm-specify/SKILL.md +36 -0
- package/plugin/opencode/skills/afm-tasks/SKILL.md +34 -0
- package/plugin/opencode/skills/afm-update/SKILL.md +58 -0
- package/plugin/opencode/skills/afm-verify/SKILL.md +33 -0
- package/README.md +0 -3
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose
|
|
3
|
+
description: |
|
|
4
|
+
Scans the health of the local docs on 7 axes. The axes are dead reference, stale marker, instance-to-plugin drift, broken ADR chain, dead rule trigger, inflation or orphan, and cross-doc contradiction. It reads only `<consumer>/docs/` and returns evidence as `command + file:line`. It proposes no edit.
|
|
5
|
+
Activates: `/afm:diagnose`, "diagnose the methodology", "what is broken in the docs?", "run the AFM health check".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# AFM — Diagnose (mechanical weakness-mining, read-only)
|
|
10
|
+
|
|
11
|
+
This is a mechanism skill of AFM. The canonical procedure is the op file that `afm path ops/diagnose.md` prints.
|
|
12
|
+
|
|
13
|
+
> **Carve-out (does not overlap existing ops):** `analyze` audits **one feature**. `diagnose` audits the **whole instance** of `/docs/`. `reflect` uses **behavioral** evidence, where the agent stumbled. `diagnose` is **static**, based on filesystem and git. `evolve` is the **orchestrator**. It combines `diagnose` (mechanical evidence) with `reflect` (behavioral evidence) into one proposal and one gate. `diagnose` is **read-only**. It never proposes an edit or opens a gate.
|
|
14
|
+
|
|
15
|
+
## When NOT to activate
|
|
16
|
+
|
|
17
|
+
This section disambiguates for a skill that already activated. It does not define activation, so it stays in the body, not in the resident listing.
|
|
18
|
+
|
|
19
|
+
Validation of ONE feature is `/afm:analyze`. Behavioral friction, where a doc misguided the agent at apply time, is `/afm:reflect`. Proposing or applying a fix is `/afm:evolve` (the full cycle, which includes diagnose).
|
|
20
|
+
|
|
21
|
+
## Pre-check
|
|
22
|
+
|
|
23
|
+
1. **Does `<consumer>/docs/.afm-version` exist?** If not, stop. Suggest `/afm:init` (greenfield) or `/afm:refactor` (brownfield) first.
|
|
24
|
+
2. **Does `afm preflight` exit 0?** A non-zero exit says why (docs not bootstrapped, content unresolved, pin mismatch). Report it to the user. Do not fall back silently.
|
|
25
|
+
|
|
26
|
+
## Procedure
|
|
27
|
+
|
|
28
|
+
Read the op (`afm path ops/diagnose.md`) end to end. Follow it literally.
|
|
29
|
+
|
|
30
|
+
The procedure has two phases. **Phase 0 — Scan** is gap-driven. Run `afm doctor --json`: it checks A1-A6, staleness and dead gotchas mechanically, and every finding carries a command plus `file:line`. You add A7 yourself. All 7 axes are checked, every time.
|
|
31
|
+
|
|
32
|
+
Axis A7, cross-doc contradiction, uses a paired read. That read applies an anti-false-positive layer test. An axis that cannot be covered becomes "not-covered: <reason>".
|
|
33
|
+
|
|
34
|
+
**Phase 1 — Diagnosis** has the ANALYZER role. **It must not propose an edit.** The signature is φ = `(symptom, causal-status-of-behavior, mechanism)`.
|
|
35
|
+
|
|
36
|
+
Phase 1 requires rival mechanisms, for example "agent non-compliant" versus "target legitimately removed". It applies an addressability filter and a self-sufficient severity matrix.
|
|
37
|
+
|
|
38
|
+
**Output** is an evidence bundle ordered by severity. Run à la carte, the skill prints the report to chat. It does not write to disk. It opens no gate. Under `evolve`, it feeds the proposal instead.
|
|
39
|
+
|
|
40
|
+
This scan has no cooldown. It is read-only and cheap. The cycle's cooldown belongs to the orchestrator.
|
|
41
|
+
|
|
42
|
+
## Invariant principles
|
|
43
|
+
|
|
44
|
+
Single canonical source: `PRINCIPLES.md` (`afm path PRINCIPLES.md`). Universals §1-8 apply. Especially relevant: #2 (discover-first — diagnose with evidence before any proposal). Also #3 (mechanize-or-demote — the checks must pass the test they audit). Also #5 (no finding without evidence external to the text).
|
|
45
|
+
|
|
46
|
+
**No new principle here.** `diagnose` is a composed materialization. The doctrine lives in the op file.
|
|
47
|
+
|
|
48
|
+
## Version
|
|
49
|
+
|
|
50
|
+
Content version: `afm version` prints it.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evolve
|
|
3
|
+
description: |
|
|
4
|
+
Runs the full self-evolution cycle over `<consumer>/docs/`. It combines diagnose and reflect, adds generalize, restructure, update and remediate on demand, and delivers one package through one gate (`afm ask evolve`). It conducts the mechanisms and never touches the plugin.
|
|
5
|
+
Activates: `/afm:evolve`, "audit the methodology", "the docs are a mess", "the rules no longer trigger", "clean up the docs", "reorganize the docs".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# AFM — Evolve (orchestrator for the self-evolution cycle)
|
|
10
|
+
|
|
11
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
12
|
+
|
|
13
|
+
This is an orchestrator skill of AFM. The canonical procedure is the op file that `afm path ops/evolve.md` prints.
|
|
14
|
+
|
|
15
|
+
> **Conductor, not executor** (same pattern as `deliver`). `evolve` owns 3 things that no mechanism owns alone: (1) the evidence-collection driver for the whole instance (combines `diagnose` + `reflect`), (2) the split into buckets plus the single gate, (3) the apply driver, post-conditions, and the log/lineage record. It reads and follows everything else from the mechanisms, through a suppression contract.
|
|
16
|
+
>
|
|
17
|
+
> **Carve-outs (it does not override existing ops):** `diagnose`/`reflect`/`generalize`/`restructure` are the **mechanisms** (each runs à la carte). `analyze` audits **one feature** (read-only). `reconcile` proposes **one single edit** at the end of a turn. `promote` **records** a finding meant for the plugin (it does not edit the plugin). `evolve` is the **cycle** that chains the mechanisms with one gate and one log — the level no other op covers.
|
|
18
|
+
|
|
19
|
+
## When NOT to activate
|
|
20
|
+
|
|
21
|
+
This section helps someone who already activated the skill decide if it fits. It is not an activation trigger, so it stays in the body, not in the resident listing.
|
|
22
|
+
|
|
23
|
+
Use a single mechanism instead when the need is narrow. A report is `/afm:diagnose`. Refining a doc that misled you is `/afm:reflect`. Merging gotchas is `/afm:generalize`.
|
|
24
|
+
|
|
25
|
+
A structure or staleness check is `/afm:restructure`. A version bump is `/afm:update`. `reconcile` proposes a one-off additive signal (new gotcha, rule, or ADR) directly.
|
|
26
|
+
|
|
27
|
+
A feature-level check is `/afm:analyze` or `/afm:deliver`. Recording a finding for the plugin is `/afm:promote`.
|
|
28
|
+
|
|
29
|
+
## Pre-check
|
|
30
|
+
|
|
31
|
+
1. **Does `<consumer>/docs/.afm-version` exist?** If not, stop. Suggest `/afm:init` (greenfield) or `/afm:refactor` (brownfield) first.
|
|
32
|
+
2. **Does `afm preflight` exit 0?** A non-zero exit says why (docs not bootstrapped, content unresolved, pin mismatch). Report it to the user. Do not fall back silently.
|
|
33
|
+
3. **Does `afm evolve gate-check` allow a cycle?** Pass `--symptom "<what the user said>"` when there is one. Exit 0 runs; exit 1 is the cooldown refusing (no new signal inside the window), so say so and stop; 3 and 4 mean not a project or undecided.
|
|
34
|
+
|
|
35
|
+
## Procedure
|
|
36
|
+
|
|
37
|
+
Read the op (`afm path ops/evolve.md`) end to end and follow it exactly. The op has 5 phases.
|
|
38
|
+
|
|
39
|
+
**Phase 1 — Evidence collection.** Combine two sources through the suppression contract. `diagnose` is the mechanical scan of the 7 axes (`afm doctor --json` plus the A7 reading), read-only. `reflect` is behavioral evidence of docs that misled the agent. Run `generalize`/`restructure` on demand, when their own trigger signal fires. An empty diagnosis counts as a valid result.
|
|
40
|
+
|
|
41
|
+
**Phase 2 — Proposal.** This phase plays the IMPROVER role. Apply the op's **shared proposal discipline**: retrieval before create, then a dry run before the gate. Split the proposals into 3 buckets.
|
|
42
|
+
|
|
43
|
+
A non-restorable change always goes through the gate. It never invents its own target. Decide here whether to downgrade, archive, or merge an artifact. Cap bucket (b) at 8 items per cycle (`afm evolve gate-check --critical <n> --high <n> --medium <n> --low <n>` computes what to ask and what to stage). Recurring failures come from `afm failures promotable`.
|
|
44
|
+
|
|
45
|
+
**Phase 3 — Single gate.** Ask item by item with `afm ask evolve --scope <item-slug>`, at most 4 questions per call. This gate is never skippable — there is no "go" shortcut.
|
|
46
|
+
|
|
47
|
+
**Phase 4 — Apply and post-conditions.** Re-run `afm doctor --json`, `afm index --check` and `afm detect --for <file>` over the touched docs, and confirm the content root is clean (`git status`, or a timestamp check with no git).
|
|
48
|
+
|
|
49
|
+
**Phase 5 — Log.** Record the cycle in `docs/evolution/NNN-<date>.md`. Suggest `promote` when a finding generalizes beyond this instance.
|
|
50
|
+
|
|
51
|
+
Consult the rubric `rubrics/when-to-evolve-methodology.md` (`afm path rubrics/when-to-evolve-methodology.md`) to decide between a full cycle, a single mechanism, or a one-off fix.
|
|
52
|
+
|
|
53
|
+
## Invariant principles
|
|
54
|
+
|
|
55
|
+
The single canonical source is `PRINCIPLES.md` (`afm path PRINCIPLES.md`). Universals §1-8 apply. #2 (discover-first) applies: diagnose with evidence before you propose. #3 (mechanize-or-downgrade) applies too: evolve's own signals must pass the same test evolve applies to others.
|
|
56
|
+
|
|
57
|
+
#8 (earned questions, recommendation-first) also applies to this skill.
|
|
58
|
+
|
|
59
|
+
#6 (autonomy-first with self-check) follows the pattern *produce → self-check → report*. The gate is the load-bearing residue. Bright lines for #7 plugin, deletion, and push still apply.
|
|
60
|
+
|
|
61
|
+
**No new principle here** — evolve is a composed materialization. The doctrine lives in the op and the rubric.
|
|
62
|
+
|
|
63
|
+
## Continuous doctrine
|
|
64
|
+
|
|
65
|
+
The `reconcile` skill owns passive mode, and it is always on. Reconcile may **suggest** `/afm:evolve` when it detects a Class B signal. That signal is a lived contradiction between docs, or perceived inflation at apply time. Only the user can invoke the full cycle.
|
|
66
|
+
|
|
67
|
+
## Version
|
|
68
|
+
|
|
69
|
+
Content version: `afm version` prints it.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: export-template
|
|
3
|
+
description: |
|
|
4
|
+
Converts a bootstrapped project into an architectural template. It deletes the product files, keeps ach, afm, gotchas and adr, and writes the `docs/.template` marker. It touches `docs/` only.
|
|
5
|
+
Activates: `/afm:export-template`, "export as template", "turn this project into a starter".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Export-template
|
|
9
|
+
|
|
10
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
11
|
+
|
|
12
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/export-template`. The CLI owns the plan,
|
|
13
|
+
the diff and the marker. This skill keeps the judgment.
|
|
14
|
+
|
|
15
|
+
## When NOT to activate
|
|
16
|
+
|
|
17
|
+
This is a criterion for a skill already active, not an activation trigger. If the project is already a
|
|
18
|
+
template (`docs/.template` exists), the op is idempotent but asks first.
|
|
19
|
+
|
|
20
|
+
## Pre-check
|
|
21
|
+
|
|
22
|
+
`afm template export --dry-run` does it: a project with no `docs/.afm-version` is not bootstrapped yet, so
|
|
23
|
+
stop and suggest `/afm:init` (greenfield) or `/afm:refactor` (brownfield) first.
|
|
24
|
+
|
|
25
|
+
## Procedure (judgment only)
|
|
26
|
+
|
|
27
|
+
1. Collect the template name and version as free text. A blank answer stays `[TBD]`; never derive the name
|
|
28
|
+
from the folder.
|
|
29
|
+
2. Ask what to keep: `afm ask export-template`. Put every coherence warning of the dry run to the operator.
|
|
30
|
+
3. Induce the reusable task template from the latest all-green feature BEFORE `docs/features/` goes.
|
|
31
|
+
4. Show the full diff with `afm template export --dry-run ...`, then ask `afm ask export-template-apply`.
|
|
32
|
+
Deleting files is a bright line: it is never applied without that confirmation.
|
|
33
|
+
5. Apply with the same flags and `--yes`, and suggest the commit message the command prints.
|
|
34
|
+
|
|
35
|
+
## Invariant principles
|
|
36
|
+
|
|
37
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply.
|
|
38
|
+
|
|
39
|
+
Especially #5 (do not invent metadata when the operator leaves it blank: use `[TBD]` in the JSON). Also #6
|
|
40
|
+
(autonomy-first, but deleting files is a bright line): confirm the diff before you delete.
|
|
41
|
+
|
|
42
|
+
Passive mode (`/afm:reconcile`) is always on. This skill focuses only on the active conversion to a template.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generalize
|
|
3
|
+
description: |
|
|
4
|
+
Merges two or more similar gotchas into one abstract rule, from episodic to semantic. Merged entries become tombstones and nothing is deleted.
|
|
5
|
+
Activates: `/afm:generalize`, "these gotchas are all the same thing", "merge these rules", "I have 3 gotchas that say the same thing".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# AFM — Generalize (semantic consolidation of gotchas)
|
|
10
|
+
|
|
11
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
12
|
+
|
|
13
|
+
Mechanism skill of AFM. The canonical procedure is the op file that `afm path ops/generalize.md` prints.
|
|
14
|
+
|
|
15
|
+
> **Carve-out (does not overlap existing ops):** `promote` **registers** a finding meant for the plugin. It does not write to the plugin. `generalize` merges **inside the instance** (N gotchas become 1 rule in the same `/docs/`). `reconcile` **adds** a new gotcha. `generalize` **merges** gotchas that already exist. `reflect` refines **one** doc. `generalize` consolidates **many**. `evolve` is the **orchestrator** and it composes this skill when `diagnose` flags inflation from redundant gotchas.
|
|
16
|
+
|
|
17
|
+
## When NOT to activate
|
|
18
|
+
|
|
19
|
+
This is a disambiguation criterion for someone who already activated the skill, not an activation trigger. That is why it lives in the body, not in the resident listing.
|
|
20
|
+
|
|
21
|
+
Sending ONE learning to the plugin is `/afm:promote`. ADDING a new gotcha or rule is `reconcile` -> `/afm:gotcha`/`/afm:rule` (`generalize` only merges what already exists). Refining the clarity of ONE doc is `/afm:reflect`. With fewer than 2 similar candidates, there is no generalization to do.
|
|
22
|
+
|
|
23
|
+
## Pre-check
|
|
24
|
+
|
|
25
|
+
1. **Does `<consumer>/docs/.afm-version` exist?** If not, stop and suggest `/afm:init` (greenfield) or `/afm:refactor` (brownfield) first.
|
|
26
|
+
2. **Does `afm preflight` exit 0?** A non-zero exit says why (docs not bootstrapped, content unresolved, pin mismatch). Report it to the user. Do not fall back silently.
|
|
27
|
+
3. **Is there a batch of >=2** similar gotchas/reflections? If not, report "nothing to generalize (no batch)" and stop. Generalizing from 1 case is forbidden (#5).
|
|
28
|
+
|
|
29
|
+
## Procedure
|
|
30
|
+
|
|
31
|
+
Read the op (`afm path ops/generalize.md`) end to end. Follow it literally.
|
|
32
|
+
|
|
33
|
+
**1. Identify the batch:** cluster by shared abstract cause, >=2 cases. Ask "would one more general instruction have prevented all N?" A larger batch yields a more abstract rule.
|
|
34
|
+
|
|
35
|
+
**2. MetaReflect:** draft the generalized, non-case-specific rule. The original cases become examples. Follow the **shared proposal discipline** from `evolve.md` (`afm path ops/evolve.md`) instead of duplicating it. Reduce, do not create a parallel path.
|
|
36
|
+
|
|
37
|
+
**3. ShowsImprovement + backtracking:** check if the rule covers all N cases. A hard rule needs an executable 0/1 trigger. Otherwise it becomes a § 1.3 principle. If it cannot cover all cases without turning vague, back out and keep the cases separate.
|
|
38
|
+
|
|
39
|
+
-> **4. Own gate** (item (b), unavoidable and earned, through `afm ask generalize`; suppressed under `evolve`. On approval: write the rule via `rule.md` (`afm rule new <slug>`) and **archive the merged entries as tombstones**. Never delete) -> **5. Record** the result in `docs/evolution/NNN-<date>.md`. Suggest `promote` if the finding matters beyond this instance.
|
|
40
|
+
|
|
41
|
+
## Invariant principles
|
|
42
|
+
|
|
43
|
+
Single canonical source: `PRINCIPLES.md` (`afm path PRINCIPLES.md`). Universals §1-8 apply here, especially #1 (episodic `gotchas.md` -> semantic `afm.md`). Also #3: a merged rule becomes hard only with an executable 0/1 trigger, the ShowsImprovement step of MetaReflection. Also #5: do not invent an abstraction without a real batch.
|
|
44
|
+
|
|
45
|
+
Also #6/#8: self-verify before an earned gate. Deletion is a bright line. Use tombstones instead. **No new principle here** — `generalize` is a composed materialization. The doctrine lives in the op file.
|
|
46
|
+
|
|
47
|
+
## Version
|
|
48
|
+
|
|
49
|
+
Content version: `afm version` prints it.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gotcha
|
|
3
|
+
description: |
|
|
4
|
+
Writes a counterintuitive surprise to `<consumer>/docs/gotchas/`. The entry gate is mandatory: the issue must have bitten twice, or it must be documented behavior of an external SDK or runtime.
|
|
5
|
+
Activates: `/afm:gotcha`, "register a gotcha", "this has confused me before", "note this surprise for the next person".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Gotcha
|
|
9
|
+
|
|
10
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
11
|
+
|
|
12
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/gotcha`. The CLI owns the entry
|
|
13
|
+
gate, the number, the frontmatter the trigger index reads and the index. This skill keeps only the judgment.
|
|
14
|
+
|
|
15
|
+
## When NOT to activate
|
|
16
|
+
|
|
17
|
+
This is a disambiguation for a skill that already activated. An architectural decision belongs to
|
|
18
|
+
`/afm:adr`. A rule with an executable trigger belongs to `/afm:rule`. A recurring failure with an external
|
|
19
|
+
signal belongs to `/afm:remediate`.
|
|
20
|
+
|
|
21
|
+
## Pre-check
|
|
22
|
+
|
|
23
|
+
`afm preflight`. Exit 3 means there is no instance: stop and suggest `/afm:init` or `/afm:refactor` first.
|
|
24
|
+
|
|
25
|
+
## Procedure (judgment only)
|
|
26
|
+
|
|
27
|
+
1. Validate the entry rule BEFORE you collect content: `afm ask gotcha`. `neither` stops: reject a gotcha
|
|
28
|
+
without a 2x incidence or an external doc.
|
|
29
|
+
2. Collect the area, trigger, behavior, solution and references as free text. Decide how it fires: an
|
|
30
|
+
`event` when no file shape can fire it, a `file-shape` only with a narrow glob. A guessed trigger is worse
|
|
31
|
+
than one that never fires.
|
|
32
|
+
3. Run `afm gotcha new <slug> --basis <bitten-twice|documented-sdk> ...` and report the path (#6). A later
|
|
33
|
+
re-bite is `afm gotcha bite <id>`.
|
|
34
|
+
|
|
35
|
+
## Invariant principles
|
|
36
|
+
|
|
37
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply. Two matter most here: #5 (do not
|
|
38
|
+
invent a gotcha without a real case; the 2x entry check is a strong gate) and #6 (autonomy-first: save the
|
|
39
|
+
result and report it).
|
|
40
|
+
|
|
41
|
+
Passive mode (`/afm:reconcile`) is always on and can propose `/afm:gotcha` when it detects the signal "the
|
|
42
|
+
same runtime surprise blocked work twice." This skill covers only active registration.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init
|
|
3
|
+
description: |
|
|
4
|
+
Bootstraps AFM in a greenfield project. The CLI materializes `<consumer>/docs/` mechanically; the skill runs the interview for what only the operator knows, asking closed questions through `afm ask`. It detects the `docs/.template` marker and branches to the from-template path. It activates ONLY on explicit invocation and never from project state.
|
|
5
|
+
Activates: `/afm:init`, "build the AFM doc", "bootstrap AFM".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Init (greenfield bootstrap)
|
|
9
|
+
|
|
10
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
11
|
+
|
|
12
|
+
This skill of `afm` handles **greenfield bootstrap** and the from-template branch. It has a single
|
|
13
|
+
responsibility. It does not route ops (each op is its own skill).
|
|
14
|
+
|
|
15
|
+
The interview script is `afm path interview/bootstrap`. This skill is a router. It **never invents a
|
|
16
|
+
procedure. It always reads the source first.** The layout of the shipped content is `afm path README`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## When NOT to activate
|
|
21
|
+
|
|
22
|
+
This is a disambiguation criterion for a skill that already activated. It is not an activation trigger.
|
|
23
|
+
|
|
24
|
+
If the project already has `docs/.afm-version`, use the atomic skills instead. To move to a new version, use
|
|
25
|
+
`/afm:update`. A brownfield codebase with no docs needs `/afm:refactor` instead.
|
|
26
|
+
|
|
27
|
+
## Pre-check (before any action)
|
|
28
|
+
|
|
29
|
+
1. **`afm preflight`.** Exit 3 means there is no `docs/.afm-version`: continue. Any other exit means the
|
|
30
|
+
project is already bootstrapped. **Do not run bootstrap again.** The atomic skills stay available
|
|
31
|
+
(`/afm:gotcha`, `/afm:adr`, `/afm:rule`, `/afm:promote`, `/afm:specify`, `/afm:plan`, `/afm:tasks`, `/afm:clarify`,
|
|
32
|
+
`/afm:analyze`, `/afm:export-template`), and passive mode (`/afm:reconcile`) stays always-on.
|
|
33
|
+
2. **Does `docs/.template` exist?** Yes means the project comes from a template: ask `afm ask init-template`
|
|
34
|
+
whether to run the from-template branch, a subset focused on the product (default `Product only`). `Full
|
|
35
|
+
interview` goes to pre-check 3.
|
|
36
|
+
3. **Does the project have significant pre-existing code?** A populated source root and a manifest with real
|
|
37
|
+
dependencies, or a git log with more than 20 commits. If so this is NOT the right path: stop and suggest
|
|
38
|
+
`/afm:refactor`: *"This project already has code. Greenfield bootstrap would make you pretend it is new.
|
|
39
|
+
`/afm:refactor` infers the docs from the existing code. Want to run it?"* `afm refactor --mechanical
|
|
40
|
+
--dry-run` states the verdict with its reasons.
|
|
41
|
+
4. **Is the shipped content resolved?** `afm preflight` exit 4 means it is not. Tell the operator. Do not
|
|
42
|
+
guess the content and do not fail silently.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Procedure (greenfield bootstrap)
|
|
47
|
+
|
|
48
|
+
For projects without `docs/.afm-version`:
|
|
49
|
+
|
|
50
|
+
1. Read `afm path interview/bootstrap` end to end.
|
|
51
|
+
2. Ask the closed decisions the mechanical pass needs: `afm ask init`. Then run `afm init --mechanical`
|
|
52
|
+
(preview with `--dry-run`, or `--answers <file>` for a headless run). It creates `docs/` and `docs/adr/`,
|
|
53
|
+
fills the skeletons with the measured rule constants and `[TBD]` where the code answers nothing, copies
|
|
54
|
+
every rubric and pattern, writes `AGENTS.md` plus the harness stubs, and writes `docs/.afm-version` last.
|
|
55
|
+
3. **Run the 7-step interview literally.** One question per turn. Free text only for open descriptions. For
|
|
56
|
+
everything with closed options, ask through `afm ask <op>` with the recommendation first (invariant
|
|
57
|
+
principle #8). Validate each answer with `afm ask confirm`. Fill each step into the matching
|
|
58
|
+
`docs/<file>.md`, replacing `{{placeholders}}` with the operator's answers and leaving unknown answers as
|
|
59
|
+
`[TBD]` (invariant principle #4).
|
|
60
|
+
4. Apply opt-in modules. For each stack the operator confirms, read `afm path modules/<stack>/ach.patch` and
|
|
61
|
+
`afm path modules/<stack>/rules.patch` and merge them into `docs/ach.md` and `docs/afm.md`. A
|
|
62
|
+
`gotchas.seed` is a **commented reference** only: the project's `docs/gotchas/` starts empty.
|
|
63
|
+
5. Generate the indexes (`afm index --materialize`) and print a summary: list every `[TBD]` and ask which ones
|
|
64
|
+
to fill in now.
|
|
65
|
+
|
|
66
|
+
**Branch from-template** (if pre-check 2 found `docs/.template`): run a subset of the steps. The subset is
|
|
67
|
+
0 + 3 + 6 short + 7 adapted. Skip steps 1, 2, 4 and 5, because the template already has them. The full
|
|
68
|
+
procedure is in `afm path interview/bootstrap` § Alternate branch. `.afm-version` gets an inheritance line.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Invariant principles
|
|
73
|
+
|
|
74
|
+
Single canonical source: `afm path PRINCIPLES`. For this skill (greenfield), the 8 universals apply (§1-8).
|
|
75
|
+
#9 (retroactive ADR, load-bearing) does NOT apply to init. Bootstrap forbids a retroactive ADR.
|
|
76
|
+
|
|
77
|
+
## Continuous doctrine
|
|
78
|
+
|
|
79
|
+
Passive mode (`/afm:reconcile`) is the responsibility of the `reconcile` skill. It stays always-on in any AFM
|
|
80
|
+
project session. This skill covers only the active bootstrap procedure.
|
|
81
|
+
|
|
82
|
+
## Version
|
|
83
|
+
|
|
84
|
+
`afm version` prints the version in use. History: `afm path CHANGELOG`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan
|
|
3
|
+
description: |
|
|
4
|
+
Fills `plan.md` for the active feature. It reads the stack from `ach.md` and infers the affected components from the code. It records each decision with its rejected alternatives. It soft-blocks on an open `[NEEDS CLARIFICATION:]` in the spec.
|
|
5
|
+
Activates: `/afm:plan [<feature>]`, "plan feature", "draft plan for feature X".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Plan
|
|
9
|
+
|
|
10
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
11
|
+
|
|
12
|
+
An atomic skill. The procedure lives in the op: read it with `afm path ops/plan.md`, end to end, and follow it literally.
|
|
13
|
+
|
|
14
|
+
## When NOT to activate
|
|
15
|
+
|
|
16
|
+
There is no `spec.md` yet: run `/afm:specify` first. An end-to-end delivery is `deliver`, which composes this op.
|
|
17
|
+
|
|
18
|
+
## Pre-check
|
|
19
|
+
|
|
20
|
+
Run `afm preflight` (exit 3: stop and suggest `/afm:init` or `/afm:refactor`). Run `afm feature status <NNN> --json`: a non-empty `blockers` means open `[NEEDS CLARIFICATION:]` markers in the spec, and the op asks the `open-markers` question (`afm ask plan`) before it goes on.
|
|
21
|
+
|
|
22
|
+
## Procedure
|
|
23
|
+
|
|
24
|
+
Read the stack from `docs/ach.md` and never reopen it. Infer the components, decisions, contracts and complexity from the code scan, and ask only for what the scan cannot resolve. Create the plan with `afm new feature-plan --feature NNN-slug` and fill it, including the first real `for_paths`. List the hard rules of `docs/afm.md` § 3 that apply, each binary. Suggest an ADR (`afm adr new <slug>`) for a load-bearing decision. Autonomy-first: write and report.
|
|
25
|
+
|
|
26
|
+
## Invariant principles
|
|
27
|
+
|
|
28
|
+
Single canonical source: `afm path PRINCIPLES.md`. Universals §1-8 apply. In particular #2 (discover-first: scan before you ask), #5 (do not invent contracts or a stack) and #8 (a question carries a recommendation).
|
|
29
|
+
|
|
30
|
+
## Continuous doctrine
|
|
31
|
+
|
|
32
|
+
Passive mode is the always-on `reconcile` skill. This skill covers only the planning.
|
|
33
|
+
|
|
34
|
+
## Version
|
|
35
|
+
|
|
36
|
+
`afm version`. History: `afm path CHANGELOG.md`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: policy
|
|
3
|
+
description: |
|
|
4
|
+
Reports what the organisation policy bundle imposes in this project. It answers which rules apply, which gotchas apply, whether the bundle can block, and what the reader may not edit here. It reads only and writes to neither bundle.
|
|
5
|
+
Activates: `/afm:policy`, "what does the organisation impose here", "which rules come from outside this repository", "why can I not edit this rule".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Policy (report the organisation layer)
|
|
9
|
+
|
|
10
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/policy`.
|
|
11
|
+
|
|
12
|
+
## When not to activate
|
|
13
|
+
|
|
14
|
+
Never to CHANGE the policy. This skill reads. The organisation bundle belongs to whoever owns it, and no
|
|
15
|
+
operation in this plugin writes to it.
|
|
16
|
+
|
|
17
|
+
## Pre-check
|
|
18
|
+
|
|
19
|
+
`afm preflight`. Exit 3 means there is no instance: stop. No organisation policy configured is a valid state
|
|
20
|
+
that `afm policy report` says plainly, and a bundle with no `policy.md` is not a policy bundle: report it
|
|
21
|
+
and stop.
|
|
22
|
+
|
|
23
|
+
## Procedure (judgment only)
|
|
24
|
+
|
|
25
|
+
Run `afm policy report` and read it by family. Say plainly that a policy bundle injects context and blocks
|
|
26
|
+
nothing, and name what the reader may not edit here and who owns it. Never report a policy rule as
|
|
27
|
+
enforced.
|
|
28
|
+
|
|
29
|
+
## Invariant principles
|
|
30
|
+
|
|
31
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: promote
|
|
3
|
+
description: |
|
|
4
|
+
Records an instance learning that applies to every AFM project. It stores the finding in the project's machine state, classifies the target, and formats it as an issue body. It needs reproducible mechanical evidence. It never edits the plugin.
|
|
5
|
+
Activates: `/afm:promote`, "this applies to any project", "this rule should be in the template", "this gotcha should be in the template".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Promote
|
|
9
|
+
|
|
10
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/promote`.
|
|
11
|
+
|
|
12
|
+
## When NOT to activate
|
|
13
|
+
|
|
14
|
+
This disambiguation applies once this skill has already activated. Project-specific learning stays in
|
|
15
|
+
`<consumer>/docs/`. Use `/afm:generalize` to consolidate gotchas INSIDE the instance. Use `/afm:update` to
|
|
16
|
+
bring the plugin INTO the instance (the opposite direction).
|
|
17
|
+
|
|
18
|
+
## Pre-check
|
|
19
|
+
|
|
20
|
+
`afm preflight`. Exit 3 means there is no instance: stop and suggest `/afm:init` or `/afm:refactor` first.
|
|
21
|
+
|
|
22
|
+
## Procedure (judgment only)
|
|
23
|
+
|
|
24
|
+
1. Read `afm path interview/promotion` and apply the gate for reproducible mechanical evidence: the command
|
|
25
|
+
that proves the defect or the learning, with its output before and expected after. No command means an
|
|
26
|
+
observation in the report, not a finding.
|
|
27
|
+
2. Walk the classification (project entity, one stack, a convention, a pattern, or universal) to set the
|
|
28
|
+
`target`. A learning that names a project entity stays in `docs/`.
|
|
29
|
+
3. Record it: `afm findings record --target <target> --title "<title>" --evidence "<command> → <output>"
|
|
30
|
+
--note "<why it applies to any instance>"`. Report and stop.
|
|
31
|
+
|
|
32
|
+
## Invariant principles
|
|
33
|
+
|
|
34
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply. That includes #5: never record a
|
|
35
|
+
project-specific learning, and never one without a real case; the list grows on demand.
|
|
36
|
+
|
|
37
|
+
It also includes #6/#7: the plugin boundary is **absolute**. This op records a finding and never applies a
|
|
38
|
+
change.
|
|
39
|
+
|
|
40
|
+
Passive mode (`/afm:reconcile`) is always on and can propose `/afm:promote` when it detects a signal that a
|
|
41
|
+
learning generalizes to any project.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: protocol
|
|
3
|
+
description: |
|
|
4
|
+
Declares or reports the autonomy protocol of the project. The protocol parametrizes the PLAN threshold, the retry cap and the learning cadence. Three presets exist: p1 autonomous, p2 assisted, p3 planned-autonomous. It writes `protocol:` to `docs/_focus.md`, and with no argument it only reports.
|
|
5
|
+
Activates: `/afm:protocol [<name>]`, "what protocol am I using", "switch to assisted", "decide on your own for this delivery", "stop asking me so much".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Protocol (declared autonomy posture)
|
|
9
|
+
|
|
10
|
+
Skill of `afm`. The canonical procedure is the op `afm path ops/protocol`. Field and preset definitions are
|
|
11
|
+
in `afm path core/protocol`.
|
|
12
|
+
|
|
13
|
+
> **A protocol is data, not a new execution path.** It parametrizes operations that already exist. A project
|
|
14
|
+
> with no `protocol:` declared uses the defaults, which reproduce pre-v4 behavior.
|
|
15
|
+
|
|
16
|
+
## When NOT to activate
|
|
17
|
+
|
|
18
|
+
This is a disambiguation for a skill that already activated. Running a delivery is `/afm:deliver` (it
|
|
19
|
+
**reads** the current protocol, it does not set it). Changing a hard rule is `/afm:rule`. Adjusting the work
|
|
20
|
+
focus without touching posture is a direct edit to `docs/_focus.md`. A mid-delivery "go ahead" is an
|
|
21
|
+
**ephemeral gate override**, not a protocol change, and it does not activate this skill.
|
|
22
|
+
|
|
23
|
+
## Pre-check
|
|
24
|
+
|
|
25
|
+
1. `afm preflight`. Exit 3 means there is no instance: stop and suggest `/afm:init` or `/afm:refactor`.
|
|
26
|
+
2. **`p1` becomes current only through explicit invocation in this session.** Never infer it from natural
|
|
27
|
+
language and never inherit it from `git pull`. Granting the loosest posture is a human act, not a
|
|
28
|
+
repository act: a person runs `afm protocol p1 --i-mean-it`.
|
|
29
|
+
|
|
30
|
+
## Procedure (judgment only)
|
|
31
|
+
|
|
32
|
+
Run `afm protocol` to report, or `afm protocol <p1|p2|p3>` to switch. Then explain the **behavior delta** the
|
|
33
|
+
command printed, because switching protocols without knowing what changes means switching contracts blind.
|
|
34
|
+
Outside the three presets, the file must already exist: never invent one.
|
|
35
|
+
|
|
36
|
+
## Invariant principles
|
|
37
|
+
|
|
38
|
+
Single canonical source: `afm path PRINCIPLES`. See especially #4 and #5.
|
|
39
|
+
|
|
40
|
+
#4: `[TBD]` beats invention. An instance with no declared posture does not receive an assumed one.
|
|
41
|
+
|
|
42
|
+
#5: Do not invent a preset without a real case.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reconcile
|
|
3
|
+
description: |
|
|
4
|
+
Always-on passive mode. It watches the signals in `interview/triggers.md` and proposes one edit to `docs/` at the end of the turn. It never applies the edit on its own and needs no command. It stays active in any project with `docs/.afm-version`, next to any other skill and to normal code work.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AFM — Reconcile (passive mode, always-on)
|
|
8
|
+
|
|
9
|
+
The always-on skill. It loads the continuous doctrine and the passive-mode procedure, and it is the only skill that activates by default in any AFM project session. Every other skill needs explicit invocation or specific natural language.
|
|
10
|
+
|
|
11
|
+
## When NOT to activate
|
|
12
|
+
|
|
13
|
+
A project without `docs/.afm-version`: stay silent until bootstrap. Do not interfere with a bootstrap session (`/afm:init`) or a refactor session (`/afm:refactor`); they create `.afm-version`, and reconcile starts after that.
|
|
14
|
+
|
|
15
|
+
## Pre-check
|
|
16
|
+
|
|
17
|
+
`afm preflight` exits 0 when the project is bootstrapped: reconcile is active, so load the signal table and the procedure and watch the whole session. Exit 3 means it is not: stay silent and propose nothing.
|
|
18
|
+
|
|
19
|
+
## Doctrine
|
|
20
|
+
|
|
21
|
+
One criterion decides where something belongs (universal principle #1, source in `afm path PRINCIPLES.md`):
|
|
22
|
+
|
|
23
|
+
> *"If another developer, or another agent without my memory, needs to know this to avoid breaking something, it is a doc, not memory."*
|
|
24
|
+
|
|
25
|
+
`docs/` holds rules, decisions, gotchas, architecture, persona, flows and cross-module contracts. The agent's memory holds only the user's style and durable preferences ("small PRs, not big bundles") and personal context (role, years of experience, current focus).
|
|
26
|
+
|
|
27
|
+
`docs/` is a living source, **not a frozen bootstrap artifact**: it evolves through the whole session by passive reconcile. The signal table is `afm path interview/triggers.md`. The procedure is the op: read it with `afm path ops/reconcile.md`.
|
|
28
|
+
|
|
29
|
+
## Procedure (always-on)
|
|
30
|
+
|
|
31
|
+
In any session of a project with `docs/.afm-version`:
|
|
32
|
+
|
|
33
|
+
1. Load `afm path interview/triggers.md`: the signals, the affected docs and the ready-made phrasing.
|
|
34
|
+
2. Load the op `afm path ops/reconcile.md`: the literal passive-mode procedure.
|
|
35
|
+
3. Monitor the work in progress (code, debugging, refactor, feature, doc edit). When a signal fires (a new structural decision, a runtime surprise twice, a correction with a reusable rule, a new component), **propose an edit** to the right `docs/` file at the end of the turn.
|
|
36
|
+
4. **Never auto-apply** (principle #6: autonomy-first applies inside an invoked op or an approved feature; a passive signal is not approved scope).
|
|
37
|
+
5. When a proposal becomes a concrete action, suggest the matching op: `/afm:adr`, `/afm:gotcha`, `/afm:rule`, `/afm:promote`, `/afm:specify`, and more.
|
|
38
|
+
|
|
39
|
+
## Critical anti-patterns
|
|
40
|
+
|
|
41
|
+
Never apply an edit without proposing it first, never save a project rule in memory, never invent a gotcha without a 2x trigger, never promote to the template before the operator confirms, and never interrupt code work with a long proposal: use one short line at the end of the turn. The full list is in the op.
|
|
42
|
+
|
|
43
|
+
## Invariant principles
|
|
44
|
+
|
|
45
|
+
Single canonical source: `afm path PRINCIPLES.md`. Universals §1-8 apply, in particular #1 (the one criterion for memory against doc), #5 (no gotcha or rule without a case) and #6 (reconcile PROPOSES at the end of the turn).
|
|
46
|
+
|
|
47
|
+
## Version
|
|
48
|
+
|
|
49
|
+
`afm version`. History: `afm path CHANGELOG.md`.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor
|
|
3
|
+
description: |
|
|
4
|
+
Adopts AFM retroactively in a brownfield codebase. The CLI reads the code, the git log and the existing rules and materializes `<consumer>/docs/` with `[TBD]` in the gaps; the skill then asks the gap questions through `afm ask`. New rules are forward-only in `afm.md § 3.1`. It activates ONLY on explicit invocation and never from project state.
|
|
5
|
+
Activates: `/afm:refactor`, "adopt AFM here", "build the doc retroactively", "infer docs from the code".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Refactor (brownfield retroactive)
|
|
9
|
+
|
|
10
|
+
> **Questions in this host.** `afm ask <op>` prompts only in a terminal, and the Bash tool has none: it exits 2. Run `afm ask <op> --json` instead and put each pending question to the operator with `AskUserQuestion`: its `header`, `prompt` and `options` as they come, the recommended option first, `multiSelect` as given. Then record each choice with `afm answer <op> <id> <label>` (one label per selected option). Run `afm ask <op>` again: `all questions answered` means the op may go on.
|
|
11
|
+
|
|
12
|
+
This skill of `afm` handles **retroactive AFM adoption in a brownfield codebase**. Single responsibility. It
|
|
13
|
+
does not route ops (each op is its own skill).
|
|
14
|
+
|
|
15
|
+
The roadmap is `afm path interview/refactor`. This skill is a router. It **never invents procedure and always
|
|
16
|
+
reads the source first**. The layout of the shipped content is `afm path README`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## When NOT to activate
|
|
21
|
+
|
|
22
|
+
This is a disambiguation check for a skill already active. It is not an activation trigger.
|
|
23
|
+
|
|
24
|
+
The project already has `docs/.afm-version`: use `/afm:update` to raise the version, refactor refuses. A
|
|
25
|
+
project with `docs/.template` needs `/afm:init` (from-template branch).
|
|
26
|
+
|
|
27
|
+
## Pre-check (before any action)
|
|
28
|
+
|
|
29
|
+
1. **`afm preflight`.** Exit 3 means there is no `docs/.afm-version`: continue. Any other exit means the
|
|
30
|
+
project is already bootstrapped: **refactor does not run.** The atomic skills stay available (`/afm:gotcha`,
|
|
31
|
+
`/afm:adr`, `/afm:rule`, `/afm:promote`, `/afm:specify`, `/afm:plan`, `/afm:tasks`, `/afm:clarify`, `/afm:analyze`,
|
|
32
|
+
`/afm:export-template`), and passive mode (`/afm:reconcile`) is already always-on. **If the
|
|
33
|
+
goal was to raise the instance to a newer version** (`.afm-version` drift), use `/afm:update`: refactor
|
|
34
|
+
creates an instance, update updates an existing one.
|
|
35
|
+
2. **Does `docs/.template` exist?** Yes means the project comes from a template, and refactor is not the right
|
|
36
|
+
path. Suggest `/afm:init` (it detects the marker and branches to the from-template flow).
|
|
37
|
+
3. **Is this real brownfield?** `afm refactor --mechanical --dry-run` checks it and states the reasons: a
|
|
38
|
+
manifest with real dependencies, a populated source root, a git history of more than 20 commits. Any
|
|
39
|
+
false means this is not brownfield: suggest `/afm:init` (*"This project does not yet seem to have a relevant
|
|
40
|
+
codebase. `/afm:init` does the greenfield bootstrap. Want to run that?"*).
|
|
41
|
+
4. **Is the shipped content resolved?** `afm preflight` exit 4 means it is not. Report it. Do not guess the
|
|
42
|
+
content and do not fall back silently.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Procedure (brownfield refactor)
|
|
47
|
+
|
|
48
|
+
For brownfield projects without `docs/.afm-version`:
|
|
49
|
+
|
|
50
|
+
1. Read `afm path interview/refactor` end to end.
|
|
51
|
+
2. Ask the closed decisions the mechanical pass needs (`afm ask init`), announce the plan in one line and
|
|
52
|
+
proceed directly: **no gate** (invoking `/afm:refactor` already approves this, per invariant principle #6).
|
|
53
|
+
3. **Run the 4 parts literally:**
|
|
54
|
+
- **Part A**: `afm refactor --mechanical` runs the autonomous code archaeology (stack scan, folder tree,
|
|
55
|
+
entity scan, CI and hooks scan, hard-rule audit, retroactive ADR candidates) and prints the report. No
|
|
56
|
+
turns with the operator. Read the README and the history yourself for the prose-only facts.
|
|
57
|
+
- **Part B**: the same command materialized the skeleton of `docs/{prd,ach,afm,ust,gotchas}`; fill the
|
|
58
|
+
drafts from the report with `[TBD]` in the gaps and report a summary plus paths. Review happens through
|
|
59
|
+
`git diff`. No review gate applies.
|
|
60
|
+
- **Part C**: run a short interview, one question per turn, closed ones through `afm ask <op>`
|
|
61
|
+
recommendation-first (invariant principle #8). Cover the pain point, the persona and the README summary
|
|
62
|
+
validation, retroactive ADRs (with a load-bearing guardrail, invariant principle #9), confirmed gotchas,
|
|
63
|
+
DoD + pre-push and code-style seeds.
|
|
64
|
+
- **Part D**: write `afm.md § 3.1` with forward-only rules based on the audit. Check `docs/.afm-version` and
|
|
65
|
+
`AGENTS.md`.
|
|
66
|
+
4. Apply the opt-in modules detected in A.1. For each stack, merge `afm path modules/<stack>/ach.patch` and
|
|
67
|
+
`afm path modules/<stack>/rules.patch` into the draft. A `gotchas.seed` becomes a commented block in the
|
|
68
|
+
gotchas doc. Only the entries the operator confirms in C.9.5 become active.
|
|
69
|
+
5. Print a closing summary plus a suggested commit (see the roadmap § Closing).
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Invariant principles
|
|
74
|
+
|
|
75
|
+
Single canonical source: `afm path PRINCIPLES`. For this skill (brownfield), **all** apply: the 8 universals
|
|
76
|
+
§1-8 plus the addition §9 (a retroactive ADR is load-bearing-only). #9 separates refactor from init. Init
|
|
77
|
+
forbids retroactive ADRs.
|
|
78
|
+
|
|
79
|
+
## Continuous doctrine
|
|
80
|
+
|
|
81
|
+
Passive mode (`/afm:reconcile`) is the responsibility of the `reconcile` skill. It is always-on in any AFM
|
|
82
|
+
project session. This skill covers only the active refactor procedure.
|
|
83
|
+
|
|
84
|
+
## Version
|
|
85
|
+
|
|
86
|
+
`afm version` prints the version in use. History: `afm path CHANGELOG`.
|