@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,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: rubric
|
|
3
|
+
description: Decides when code earns its own library directory.
|
|
4
|
+
load: warm
|
|
5
|
+
fires_on: file-shape
|
|
6
|
+
trigger_min_lines: 150
|
|
7
|
+
trigger_max_consumers: 1
|
|
8
|
+
fires_when: 'a file passes 150 lines of logic and at most one other file imports it'
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Rubric — when to create `{{src-path}}/lib/<x>/`
|
|
12
|
+
|
|
13
|
+
## Binary decision
|
|
14
|
+
|
|
15
|
+
**Create a lib when ANY of these is true:**
|
|
16
|
+
|
|
17
|
+
- ✅ You already have **3 callers** of the same inline helper (confirmed Rule of Three).
|
|
18
|
+
- ✅ It is a **nameable external integration** (Stripe, S3, Resend, Slack, GitHub). It becomes `lib/<provider>/`.
|
|
19
|
+
- ✅ It has **more than ~150 lines** of pure logic coupled to one consumer. Extract it to reduce reading load.
|
|
20
|
+
|
|
21
|
+
**Do NOT create a lib when:**
|
|
22
|
+
|
|
23
|
+
- ❌ You have 1 caller. Keep it inline. Wait for the second caller.
|
|
24
|
+
- ❌ It mixes I/O with the ORM. Put it in `infra/` or inline in the procedure.
|
|
25
|
+
- ❌ The helper has fewer than 10 lines and 2 callers. Simple duplication wins (KISS beats DRY here).
|
|
26
|
+
- ❌ The reason is "I will need it later". This is YAGNI. Keep it inline until you need it.
|
|
27
|
+
|
|
28
|
+
## Why these rules exist
|
|
29
|
+
|
|
30
|
+
- **3 callers means a real pattern, not a coincidence.** Two callers can be a false convergence.
|
|
31
|
+
- **An external integration deserves its own name** (`stripe_createCustomer`, not `createCustomer`). The reader then knows at once that this is a network call. This lowers the cognitive cost of scanning the code.
|
|
32
|
+
- **At 150 lines, "read the whole file" costs more than "follow the call to the helper."** Below that size, inline code is cheaper.
|
|
33
|
+
- The reader pays this cost either way. Extraction just moves it to the cheaper side.
|
|
34
|
+
|
|
35
|
+
## Where to place it when you create it
|
|
36
|
+
|
|
37
|
+
Decide in this order:
|
|
38
|
+
|
|
39
|
+
1. **Is it a pure lib with no dependency on the app framework?** Use `{{src-path}}/lib/<x>/`. It must be publishable, with zero ORM, web framework, or orchestrator code.
|
|
40
|
+
2. **Does it hold business logic for module X?** Use `{{src-path}}/server/modules/<X>/domain/`.
|
|
41
|
+
3. **Does it serve 3 or more modules?** Use `{{src-path}}/domain/shared/`.
|
|
42
|
+
4. **Is it a wrapper for an external client (a singleton with config)?** Use `{{src-path}}/server/infra/`.
|
|
43
|
+
|
|
44
|
+
## Bad examples
|
|
45
|
+
|
|
46
|
+
- ❌ `{{src-path}}/lib/utils/format-date.ts` with 1 caller. Keep it inline in the page that needs it.
|
|
47
|
+
- ❌ `{{src-path}}/lib/auth/get-user.ts` that imports the ORM. Move it to `{{src-path}}/server/modules/auth/`. It is not a pure lib.
|
|
48
|
+
- ❌ `{{src-path}}/lib/email-and-notifications/` mixes two responsibilities. Split it into `{{src-path}}/lib/email/` and `{{src-path}}/lib/slack/`.
|
|
49
|
+
- ❌ `{{src-path}}/lib/stripe/` with `class StripeManager { 12 methods }`. Split it into `{{src-path}}/lib/stripe/checkout.ts`, `{{src-path}}/lib/stripe/portal.ts`, and so on, using named functions such as `stripe_createCheckoutSession`.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: rubric
|
|
3
|
+
description: Decides when a feature earns a top-level module.
|
|
4
|
+
load: warm
|
|
5
|
+
fires_on: file-shape
|
|
6
|
+
trigger_new_module: 'modules'
|
|
7
|
+
fires_when: 'the file would be the first one in a new top-level module directory'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Rubric — when to create a top-level module in `{{src-path}}/server/modules/`
|
|
11
|
+
|
|
12
|
+
## Binary decision
|
|
13
|
+
|
|
14
|
+
**Create a new module when ALL of these are true:**
|
|
15
|
+
|
|
16
|
+
- ✅ It has its **own entity** (a new model, not a field on an existing model).
|
|
17
|
+
- ✅ It already has **2 or more planned procedures** (not one isolated procedure).
|
|
18
|
+
- ✅ It has its **own state with a lifecycle** (not just a static lookup table).
|
|
19
|
+
|
|
20
|
+
**Otherwise it is a sub-feature of an existing module.** Example: `notifications` that serves only `auth` belongs at `{{src-path}}/server/modules/auth/notifications/`, not as a top-level module.
|
|
21
|
+
|
|
22
|
+
## Why these rules exist
|
|
23
|
+
|
|
24
|
+
- **Its own entity** defines the module's natural boundary. Without an entity, it is just a feature of another module (a field, extra behavior).
|
|
25
|
+
- **2 or more procedures** confirms the module has enough usage surface. One isolated procedure does not justify its own directory, router, and domain.
|
|
26
|
+
- **Lifecycle** separates "a domain with state" from "static configuration." A plan (FREE/PRO) is an enum plus a lookup table. It is not a `plans/` module. It is part of `billings/`.
|
|
27
|
+
|
|
28
|
+
## Review questions before you create a module
|
|
29
|
+
|
|
30
|
+
1. Does this concept already exist in a current module? If yes, it is a sub-feature.
|
|
31
|
+
2. Will it share `domain/`, `infra/`, or types with another module? If yes, consider `{{src-path}}/domain/shared/` instead of a new module.
|
|
32
|
+
3. Will it stay untouched for more than 6 months? If yes, and it does not grow, it may be a helper, not a module.
|
|
33
|
+
|
|
34
|
+
## Anti-examples
|
|
35
|
+
|
|
36
|
+
- ❌ Do not create `modules/notifications/` when only `auth` sends notifications. Use `modules/auth/notifications/`.
|
|
37
|
+
- ❌ Do not create `modules/plans/` to hold the `PLAN_CONFIG` constant. Use `modules/billings/plan-config.ts`.
|
|
38
|
+
- ❌ Do not create `modules/utils/` to collect cross-module helpers. No `utils` module exists. Put helpers in `lib/` or inline.
|
|
39
|
+
- ❌ Do not create `modules/admin/` early "because an admin panel is coming later." This is YAGNI. Wait for the first admin procedure to appear.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: rubric
|
|
3
|
+
description: Chooses between the full cycle, one mechanism and a point fix.
|
|
4
|
+
load: warm
|
|
5
|
+
fires_on: op-call
|
|
6
|
+
called_by: ["evolve", "reflect"]
|
|
7
|
+
fires_when: 'a methodology finding needs a path: cycle, one mechanism, or a point fix'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Rubric — the `evolve` cycle vs. a single mechanism vs. a point fix
|
|
11
|
+
|
|
12
|
+
> **What "evolution" means here:** it means refining the **local documentation of this project** (the methodology instance materialized in `<consumer>/docs/`). It makes that doc leaner, clearer, current, and efficient. It is **never** AFM itself (the bundled content). For the plugin, you only **suggest** a change, through `afm promote`. Every mention of "methodology" or "methodology health" below means the local doc.
|
|
13
|
+
|
|
14
|
+
> This is a **3-way decision**. Does the finding call for (1) the **full cycle** of `afm evolve` (an orchestrator: gather evidence → propose → one gate → apply → record), (2) **one mechanism à la carte** (`afm diagnose`, `afm reflect`, `afm generalize`, `afm restructure`), or (3) **a point fix** that `reconcile` proposes directly through an atomic skill (`afm gotcha`, `afm rule`, `afm adr`)? Cost decreases in that order. The cycle costs the most: it composes several mechanisms, one consolidated gate, and a record in `docs/evolution/`. A single mechanism is scoped to one axis. A point fix is cheap. Do not run the cycle for what one mechanism can fix. Do not run a mechanism for what one edit can fix.
|
|
15
|
+
|
|
16
|
+
## The 3 paths
|
|
17
|
+
|
|
18
|
+
### 1. The `evolve` cycle — use it when BOTH of these are true:
|
|
19
|
+
|
|
20
|
+
- ✅ **The problem affects the whole instance, not one isolated axis.** You see several health findings. Or the findings cross categories: dead references **and** a rule that misled someone **and** inflation spread across files. This is a *health sweep*. It benefits from one consolidated gate and one lineage record.
|
|
21
|
+
- ✅ **You have observable evidence that something is below 100%.** The evidence can be mechanical (from `diagnose`). It can be behavioral (from `reflect`). It can be a symptom the user states directly, such as "these docs are a mess." Without a signal, do not run the cycle. A healthy instance gains almost nothing from it. The cooldown refuses to run it.
|
|
22
|
+
|
|
23
|
+
> **Second entry point — ex-post, from inside `reflect`.** The two criteria above are normally applied ex-ante, before acting, to pick a path. `reflect.md § 5` applies the same two criteria ex-post — after the mechanism already ran, over the findings it already collected in its own §§ 1-2 — to discover that what it found exceeds its own scope. Same criteria, no new test, no restatement. It only proposes; the user still invokes `afm evolve`. See `ops/reflect.md § 5`.
|
|
24
|
+
|
|
25
|
+
### 2. A single mechanism à la carte — use it when you know exactly which lens you need:
|
|
26
|
+
|
|
27
|
+
- 🔍 **`afm diagnose`** — only the **health report** (a mechanical scan of the 7 axes, read-only). Use it to answer "how healthy is the methodology here?" without proposing or applying anything.
|
|
28
|
+
- 🪞 **`afm reflect`** — use it when **one specific doc misled you** at apply time (an ambiguous rule, a section that gave no guidance). It refines instructiveness, based on behavioral evidence from the session.
|
|
29
|
+
- 🧬 **`afm generalize`** — use it when **2 or more similar gotchas** have piled up and should merge into one abstract rule (episodic to semantic). This is anti-inflation at the root.
|
|
30
|
+
- 🗂️ **`afm restructure`** — use it for **staleness**, where a doc no longer matches the code. Use it also for **findability and partitioning**: information in the wrong place, or a doc that outgrew its shape.
|
|
31
|
+
|
|
32
|
+
> A single mechanism still **self-checks and gates** what it proposes. `reflect`, `generalize`, and `restructure` each have their own gate. `diagnose` is read-only. What sets a single mechanism apart from the cycle is **scope**. It uses one lens, not the full sweep. It skips the overhead of composing every mechanism plus a cycle record.
|
|
33
|
+
|
|
34
|
+
### 3. A point fix (reconcile → an atomic skill) — use it when the change is additive and local:
|
|
35
|
+
|
|
36
|
+
- ❌ **You learned a new fact, decision, or gotcha.** Use `afm adr` for an architecture decision. Use `afm rule` for a rule from one correction. Use `afm gotcha` for a surprise that has bitten you 2 or more times. `reconcile` already covers this at the end of the turn. Opening a mechanism or the cycle is overhead here.
|
|
37
|
+
|
|
38
|
+
Distinction: `reconcile`, `gotcha`, and `rule` **add** knowledge. `reflect`, `generalize`, and `restructure` **refine, consolidate, or reorganize** knowledge that already exists.
|
|
39
|
+
- ❌ **You need to validate ONE feature.** For coverage or consistency across spec, plan, and tasks, use `afm analyze` (read-only, per feature).
|
|
40
|
+
- ❌ **You need to deliver a feature.** Use `afm deliver`.
|
|
41
|
+
- ❌ **You need to promote a lesson to the plugin.** Use `afm promote`.
|
|
42
|
+
|
|
43
|
+
## Why these rules exist
|
|
44
|
+
|
|
45
|
+
- **An observable signal is mandatory** for paths 1 and 2. A claimed systemic problem with no evidence turns the agent into an auditor of text using only text — a self-reference loop. This is forbidden. Mechanical evidence (`diagnose`) and behavioral evidence (`reflect`) are the two valid kinds of evidence — the two sides of the Self-Harness φ. Both count.
|
|
46
|
+
- **Signal beats ritual** (Self-Harness / Autogenesis). In healthy docs, the cycle returns almost nothing. An evidence-based trigger beats a fixed budget or calendar. The `evolve` cooldown refuses to run the cycle without a new signal. A single mechanism, being scoped and — for `diagnose` — read-only, carries no cooldown.
|
|
47
|
+
- **Scope decides the path** (cycle vs. mechanism). If you know the lens, use the mechanism. If the problem is a multi-category sweep that deserves one consolidated gate, use the cycle. Do not compose every mechanism (`evolve`) to fix a single axis.
|
|
48
|
+
- **An empty diagnosis is a valid result.** If the scan or reflection finds nothing, it reports "100%" and stops. It must **never** invent a problem to justify having run.
|
|
49
|
+
- **Doc size is a signal to consolidate, never a signal to cut** (ACE vs. Configuring). A core doc above about 500 lines (the `afm doctor` A6 inflation threshold) routes to a **consolidation review**. `afm generalize` merges redundancy. `afm restructure` partitions by temperature. Neither ever cuts content based on line count alone.
|
|
50
|
+
|
|
51
|
+
ACE prunes redundancy, not lines. Brevity bias discards load-bearing detail. The line count triggers a review. It never dictates a deletion.
|
|
52
|
+
|
|
53
|
+
## Counterexamples
|
|
54
|
+
|
|
55
|
+
- ❌ **Running `afm evolve` weekly by ritual.** Run it on a signal, never on a calendar.
|
|
56
|
+
- ❌ **Opening the cycle to log one new gotcha.** This is additive and local. `afm gotcha` (or `reconcile` proposing it) is enough.
|
|
57
|
+
- ❌ **Running the full cycle just to check health.** Use `afm diagnose` instead (read-only, no gate).
|
|
58
|
+
- ❌ **Claiming "this doc looks inflated" without a `wc -l` or a grep for duplication.** Without observable evidence, this is not a finding (see rule 5 above).
|
|
59
|
+
- ❌ **Running `generalize` from 1 gotcha.** Without a batch of 2 or more, there is no generalization — only an invented abstraction with no evidence.
|
|
60
|
+
- ❌ **Using `reflect` to soften a rule because it embarrassed you.** A violation does not mean the rule is wrong. "The agent was non-compliant" is a mandatory rival hypothesis.
|
|
61
|
+
- ❌ **Using `restructure` to force tiering on a small doc.** Partitioning by temperature is opt-in. Use it only when a doc has actually grown large (YAGNI).
|
|
62
|
+
- ❌ **Running the cycle again when nothing has changed.** The cooldown blocks the cycle. Running a mechanism with no new signal is theater.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adr
|
|
3
|
+
description: |
|
|
4
|
+
Writes an Architecture Decision Record to `<consumer>/docs/adr/NNNN-slug.md`. It records context, decision, alternatives and consequence. In a refactored project, write a retroactive ADR only when it is load-bearing.
|
|
5
|
+
Activates: `afm adr`, "create ADR", "architectural decision", "record this architecture choice".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — ADR
|
|
9
|
+
|
|
10
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/adr`. The CLI owns the number, the
|
|
11
|
+
template, the frontmatter, the supersede link and the index. This skill keeps only the judgment.
|
|
12
|
+
|
|
13
|
+
## When NOT to activate
|
|
14
|
+
|
|
15
|
+
This is a disambiguation for a skill that already activated. It does not control activation itself. A
|
|
16
|
+
counterintuitive surprise belongs in `afm gotcha`. A rule with an executable trigger belongs in `afm rule`.
|
|
17
|
+
|
|
18
|
+
## Pre-check
|
|
19
|
+
|
|
20
|
+
`afm preflight`. Exit 3 means there is no instance: stop and suggest `afm init` (greenfield) or
|
|
21
|
+
`afm refactor` (brownfield) first. Exit 4 means the shipped content does not resolve: report it, do not
|
|
22
|
+
fall back silently.
|
|
23
|
+
|
|
24
|
+
## Procedure (judgment only)
|
|
25
|
+
|
|
26
|
+
1. Ask the status: `afm ask adr`. Collect the title, context, decision, alternatives, consequence and refs
|
|
27
|
+
as free text, because these fields carry intent.
|
|
28
|
+
2. Run `afm adr new <slug> --title "<title>" --description "<one sentence>"`, with `--supersedes N` when
|
|
29
|
+
the decision replaces ADR N.
|
|
30
|
+
3. Fill the sections of the printed file with what the operator said, and leave the rest `[TBD]`. Report the
|
|
31
|
+
path (#6).
|
|
32
|
+
|
|
33
|
+
The "Additional step in a refactored project" in the op applies ONLY when `afm refactor` adopted the
|
|
34
|
+
project (signal: `afm.md` § 3.1 forward-only exists). A greenfield project forbids a retroactive ADR.
|
|
35
|
+
|
|
36
|
+
## Invariant principles
|
|
37
|
+
|
|
38
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply. Additional #9 (a retroactive ADR is
|
|
39
|
+
load-bearing-only) applies ONLY in a refactored project.
|
|
40
|
+
|
|
41
|
+
Passive mode (`afm reconcile`) is always on and can propose `afm adr` when it detects a "novel structural
|
|
42
|
+
decision" signal. This skill covers only the active creation.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: analyze
|
|
3
|
+
description: |
|
|
4
|
+
Cross-checks one feature against the instance. It compares `docs/features/NNN-*/{spec,plan,tasks}.md` with prd, ust, ach, afm § 3 and PRINCIPLES. It reports findings by severity in chat and writes no file.
|
|
5
|
+
Activates: `afm analyze [<feature>]`, "audit feature", "check coverage", "validate consistency before implementation".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Analyze
|
|
9
|
+
|
|
10
|
+
An atomic skill. The procedure lives in the op: read it with `afm path ops/analyze.md`, end to end, and follow it exactly.
|
|
11
|
+
|
|
12
|
+
## When NOT to activate
|
|
13
|
+
|
|
14
|
+
Use `afm clarify` to resolve markers interactively. Use `afm deliver` for end-to-end delivery: it runs analyze underneath, in gating mode. Use `afm diagnose` for the health of the whole doc set.
|
|
15
|
+
|
|
16
|
+
## Pre-check
|
|
17
|
+
|
|
18
|
+
Run `afm preflight` (exit 3: no `docs/.afm-version`, stop and suggest `afm init` or `afm refactor`).
|
|
19
|
+
|
|
20
|
+
## Procedure
|
|
21
|
+
|
|
22
|
+
Start from the mechanical findings: `afm feature lint <NNN> --json` covers the passes A, C, D, E and the structure of `tasks.md`. Add the judgment on top (constitution violations, duplication, the semantic side of inconsistency and ambiguity), build the coverage table, assign severities by the matrix, and report in chat with metrics. Close with the `remediation` question (`afm ask analyze`). Gating mode sorts findings into buckets instead of reporting.
|
|
23
|
+
|
|
24
|
+
## Invariant principles
|
|
25
|
+
|
|
26
|
+
Single canonical source: `afm path PRINCIPLES.md`. Universals §1-8 apply, especially #2 (detection is an autonomous scan, not a question), #5 (no finding without evidence) and #6 (analyze is read-only: it reports in chat, writes no file, and remediates only on request).
|
|
27
|
+
|
|
28
|
+
## Continuous doctrine
|
|
29
|
+
|
|
30
|
+
Passive mode is the always-on `reconcile` skill. This skill covers only active auditing.
|
|
31
|
+
|
|
32
|
+
## Version
|
|
33
|
+
|
|
34
|
+
`afm version`. History: `afm path CHANGELOG.md`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clarify
|
|
3
|
+
description: |
|
|
4
|
+
Scans one feature for ambiguity. It asks the irreducible questions, recommendation first, and writes the answers to `spec.md § 7 Clarifications`.
|
|
5
|
+
Activates: `afm clarify [<feature>]`, "resolve markers", "clear up ambiguity in feature X", "clarify the spec".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Clarify
|
|
9
|
+
|
|
10
|
+
An atomic skill. The procedure lives in the op: read it with `afm path ops/clarify.md`, end to end, and follow it literally.
|
|
11
|
+
|
|
12
|
+
## When NOT to activate
|
|
13
|
+
|
|
14
|
+
Use `afm analyze` for a read-only, multi-artifact validation that does not resolve markers. Use `afm deliver` for end-to-end delivery: it calls clarify underneath when needed.
|
|
15
|
+
|
|
16
|
+
## Pre-check
|
|
17
|
+
|
|
18
|
+
Run `afm preflight` (exit 3: no `docs/.afm-version`, stop and suggest `afm init` or `afm refactor`). `afm feature status <NNN> --json` lists the open markers of a feature in `blockers`.
|
|
19
|
+
|
|
20
|
+
## Procedure
|
|
21
|
+
|
|
22
|
+
Judgment only: a 9-category scan of the spec, a prioritized queue (at most 5 questions), auto-resolution from the code and docs before any question, then one recommendation-first question per turn. The questions come from the spec, so they are dynamic; the one fixed decision (`underspecified`) is in `afm ask clarify`. Integrate each answer into `spec.md` at once, remove the marker, and finish with the coverage summary.
|
|
23
|
+
|
|
24
|
+
## Invariant principles
|
|
25
|
+
|
|
26
|
+
Single canonical source: `afm path PRINCIPLES.md`. Universals §1-8 apply. #2 is discover-first: resolve each question yourself through the scan or the docs, then ask. #4 says `[TBD]` beats invention, and a recommendation is a rejectable hypothesis, not a guess. #6 is autonomy-first: write the integration into spec § 7 and report. #8 is recommendation-first questions.
|
|
27
|
+
|
|
28
|
+
## Continuous doctrine
|
|
29
|
+
|
|
30
|
+
Passive mode is the always-on `reconcile` skill. This skill covers only the active resolution of ambiguity.
|
|
31
|
+
|
|
32
|
+
## Version
|
|
33
|
+
|
|
34
|
+
`afm version`. History: `afm path CHANGELOG.md`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deliver
|
|
3
|
+
description: |
|
|
4
|
+
Delivers one feature from discovery to reconciliation. It takes one recorded approval (`afm approve`), writes spec, plan and tasks, then runs each task as RED, GREEN, REFACTOR, COMMIT. It resumes from the correct phase when those files exist. Orchestrator: it composes specify, plan, tasks, clarify, analyze and reconcile. External research is not an AFM op; it routes to nasca.
|
|
5
|
+
Activates: `afm deliver [<feature>]`, "build feature X", "implement X end to end", "the tasks already exist, run them", "continue the delivery of feature N".
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AFM — Deliver (orchestrated autonomous delivery)
|
|
9
|
+
|
|
10
|
+
The **orchestrator** of the delivery loop. One request takes "build feature X" from discovery to a delivered feature. The procedure lives in the op: read it with `afm path ops/deliver.md`, end to end, and follow it literally. It does not duplicate the sub-steps: it reads and follows `specify`, `plan`, `tasks`, `clarify`, `analyze` and `reconcile` through a suppression contract.
|
|
11
|
+
|
|
12
|
+
## When NOT to activate
|
|
13
|
+
|
|
14
|
+
An isolated step ("just open the spec", "just generate the tasks") is the matching atomic skill. A trivial change goes straight to the `afm.md § 2` loop.
|
|
15
|
+
|
|
16
|
+
## Pre-check
|
|
17
|
+
|
|
18
|
+
Run `afm preflight`. Exit 0 continues. Exit 3 means no `docs/.afm-version`: stop and suggest `afm init` (greenfield) or `afm refactor` (brownfield). Exit 4 or 5: report the line it printed. Do not fall back silently.
|
|
19
|
+
|
|
20
|
+
## Procedure
|
|
21
|
+
|
|
22
|
+
The CLI holds the state; the skill keeps only the judgment. Drive the loop with `afm feature status <NNN> --json`, which returns the phase to resume at, the next task and the blockers.
|
|
23
|
+
|
|
24
|
+
- **Discovery:** scan scoped to the feature, external unknowns through the nasca research flow (`nasca-research`, or `nasca-campaign` for a deep study; ask the operator if nasca is missing), unknowns sorted into resolved-by-scan, researchable and irreducible. One batched, recommendation-first round, capped by the protocol (`afm protocol`).
|
|
25
|
+
- **Draft:** spec, plan and tasks, verified with `afm feature lint <NNN>` plus the judgment passes of `analyze`.
|
|
26
|
+
- **Gate:** the earned questions plus the `outcome` question (`afm ask deliver`), then `afm approve <NNN>`. An explicit "go" skips the questions, never the record.
|
|
27
|
+
- **Execute:** each task is one `core/afm.md` § 2 cycle, checked with `afm gate --staged`, then `afm task done <NNN> <Txxx>`. Halt on a non-`[P]` failure after the capped retry.
|
|
28
|
+
- **Reconcile:** § 8.5 plus a passive sweep.
|
|
29
|
+
|
|
30
|
+
If artifacts already exist, resume from the correct phase, including "tasks already exist, run from the first `[ ]`".
|
|
31
|
+
|
|
32
|
+
## Invariant principles
|
|
33
|
+
|
|
34
|
+
Single canonical source: `afm path PRINCIPLES.md`. Universals §1-8 apply. The backbone is **#2** (discover-first: resolve unknowns by scan and research, ask only the irreducible part, never guess product or criteria) and **#6** (autonomy-first: approval at checkpoint granularity, the consolidated plan IS the proposal).
|
|
35
|
+
|
|
36
|
+
## Continuous doctrine
|
|
37
|
+
|
|
38
|
+
Passive mode is the always-on `reconcile` skill. It runs in parallel with `deliver` and takes the closing turn of Phase 4.
|
|
39
|
+
|
|
40
|
+
## Version
|
|
41
|
+
|
|
42
|
+
`afm version`. History: `afm path CHANGELOG.md`.
|
|
@@ -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,67 @@
|
|
|
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
|
+
This is an orchestrator skill of AFM. The canonical procedure is the op file that `afm path ops/evolve.md` prints.
|
|
12
|
+
|
|
13
|
+
> **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.
|
|
14
|
+
>
|
|
15
|
+
> **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.
|
|
16
|
+
|
|
17
|
+
## When NOT to activate
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
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`.
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
A feature-level check is `afm analyze` or `afm deliver`. Recording a finding for the plugin is `afm promote`.
|
|
26
|
+
|
|
27
|
+
## Pre-check
|
|
28
|
+
|
|
29
|
+
1. **Does `<consumer>/docs/.afm-version` exist?** If not, stop. Suggest `afm init` (greenfield) or `afm refactor` (brownfield) first.
|
|
30
|
+
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.
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
## Procedure
|
|
34
|
+
|
|
35
|
+
Read the op (`afm path ops/evolve.md`) end to end and follow it exactly. The op has 5 phases.
|
|
36
|
+
|
|
37
|
+
**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.
|
|
38
|
+
|
|
39
|
+
**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.
|
|
40
|
+
|
|
41
|
+
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`.
|
|
42
|
+
|
|
43
|
+
**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.
|
|
44
|
+
|
|
45
|
+
**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).
|
|
46
|
+
|
|
47
|
+
**Phase 5 — Log.** Record the cycle in `docs/evolution/NNN-<date>.md`. Suggest `promote` when a finding generalizes beyond this instance.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
## Invariant principles
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
#8 (earned questions, recommendation-first) also applies to this skill.
|
|
56
|
+
|
|
57
|
+
#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.
|
|
58
|
+
|
|
59
|
+
**No new principle here** — evolve is a composed materialization. The doctrine lives in the op and the rubric.
|
|
60
|
+
|
|
61
|
+
## Continuous doctrine
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
## Version
|
|
66
|
+
|
|
67
|
+
Content version: `afm version` prints it.
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/export-template`. The CLI owns the plan,
|
|
11
|
+
the diff and the marker. This skill keeps the judgment.
|
|
12
|
+
|
|
13
|
+
## When NOT to activate
|
|
14
|
+
|
|
15
|
+
This is a criterion for a skill already active, not an activation trigger. If the project is already a
|
|
16
|
+
template (`docs/.template` exists), the op is idempotent but asks first.
|
|
17
|
+
|
|
18
|
+
## Pre-check
|
|
19
|
+
|
|
20
|
+
`afm template export --dry-run` does it: a project with no `docs/.afm-version` is not bootstrapped yet, so
|
|
21
|
+
stop and suggest `afm init` (greenfield) or `afm refactor` (brownfield) first.
|
|
22
|
+
|
|
23
|
+
## Procedure (judgment only)
|
|
24
|
+
|
|
25
|
+
1. Collect the template name and version as free text. A blank answer stays `[TBD]`; never derive the name
|
|
26
|
+
from the folder.
|
|
27
|
+
2. Ask what to keep: `afm ask export-template`. Put every coherence warning of the dry run to the operator.
|
|
28
|
+
3. Induce the reusable task template from the latest all-green feature BEFORE `docs/features/` goes.
|
|
29
|
+
4. Show the full diff with `afm template export --dry-run ...`, then ask `afm ask export-template-apply`.
|
|
30
|
+
Deleting files is a bright line: it is never applied without that confirmation.
|
|
31
|
+
5. Apply with the same flags and `--yes`, and suggest the commit message the command prints.
|
|
32
|
+
|
|
33
|
+
## Invariant principles
|
|
34
|
+
|
|
35
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply.
|
|
36
|
+
|
|
37
|
+
Especially #5 (do not invent metadata when the operator leaves it blank: use `[TBD]` in the JSON). Also #6
|
|
38
|
+
(autonomy-first, but deleting files is a bright line): confirm the diff before you delete.
|
|
39
|
+
|
|
40
|
+
Passive mode (`afm reconcile`) is always on. This skill focuses only on the active conversion to a template.
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
Mechanism skill of AFM. The canonical procedure is the op file that `afm path ops/generalize.md` prints.
|
|
12
|
+
|
|
13
|
+
> **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.
|
|
14
|
+
|
|
15
|
+
## When NOT to activate
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
## Pre-check
|
|
22
|
+
|
|
23
|
+
1. **Does `<consumer>/docs/.afm-version` exist?** If not, stop and 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
|
+
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).
|
|
26
|
+
|
|
27
|
+
## Procedure
|
|
28
|
+
|
|
29
|
+
Read the op (`afm path ops/generalize.md`) end to end. Follow it literally.
|
|
30
|
+
|
|
31
|
+
**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.
|
|
32
|
+
|
|
33
|
+
**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.
|
|
34
|
+
|
|
35
|
+
**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.
|
|
36
|
+
|
|
37
|
+
-> **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.
|
|
38
|
+
|
|
39
|
+
## Invariant principles
|
|
40
|
+
|
|
41
|
+
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.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
## Version
|
|
46
|
+
|
|
47
|
+
Content version: `afm version` prints it.
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
Atomic skill of `afm`. The canonical procedure is the op `afm path ops/gotcha`. The CLI owns the entry
|
|
11
|
+
gate, the number, the frontmatter the trigger index reads and the index. This skill keeps only the judgment.
|
|
12
|
+
|
|
13
|
+
## When NOT to activate
|
|
14
|
+
|
|
15
|
+
This is a disambiguation for a skill that already activated. An architectural decision belongs to
|
|
16
|
+
`afm adr`. A rule with an executable trigger belongs to `afm rule`. A recurring failure with an external
|
|
17
|
+
signal belongs to `afm remediate`.
|
|
18
|
+
|
|
19
|
+
## Pre-check
|
|
20
|
+
|
|
21
|
+
`afm preflight`. Exit 3 means there is no instance: stop and suggest `afm init` or `afm refactor` first.
|
|
22
|
+
|
|
23
|
+
## Procedure (judgment only)
|
|
24
|
+
|
|
25
|
+
1. Validate the entry rule BEFORE you collect content: `afm ask gotcha`. `neither` stops: reject a gotcha
|
|
26
|
+
without a 2x incidence or an external doc.
|
|
27
|
+
2. Collect the area, trigger, behavior, solution and references as free text. Decide how it fires: an
|
|
28
|
+
`event` when no file shape can fire it, a `file-shape` only with a narrow glob. A guessed trigger is worse
|
|
29
|
+
than one that never fires.
|
|
30
|
+
3. Run `afm gotcha new <slug> --basis <bitten-twice|documented-sdk> ...` and report the path (#6). A later
|
|
31
|
+
re-bite is `afm gotcha bite <id>`.
|
|
32
|
+
|
|
33
|
+
## Invariant principles
|
|
34
|
+
|
|
35
|
+
Single canonical source: `afm path PRINCIPLES`. Universals §1-8 apply. Two matter most here: #5 (do not
|
|
36
|
+
invent a gotcha without a real case; the 2x entry check is a strong gate) and #6 (autonomy-first: save the
|
|
37
|
+
result and report it).
|
|
38
|
+
|
|
39
|
+
Passive mode (`afm reconcile`) is always on and can propose `afm gotcha` when it detects the signal "the
|
|
40
|
+
same runtime surprise blocked work twice." This skill covers only active registration.
|