@adia-ai/adia-ui-forge 0.1.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +3 -6
- package/CHANGELOG.md +27 -34
- package/README.md +35 -40
- package/agents/a2ui-engineer.md +22 -53
- package/agents/component-author.md +29 -0
- package/agents/framework-verifier.md +26 -0
- package/agents/release-engineer.md +21 -81
- package/agents/routing-corpus.json +293 -64
- package/bin/demo-postwrite-pattern-gate +94 -0
- package/bin/forge-lint +17 -2
- package/bin/sidecar-prewrite-guard +104 -0
- package/commands/deploy.md +9 -0
- package/commands/dogfood.md +10 -0
- package/commands/gen-review.md +9 -0
- package/commands/release.md +10 -0
- package/hooks/hooks.json +15 -0
- package/package.json +3 -6
- package/references/contracts/a2ui-mcp-surface.md +35 -0
- package/references/contracts/migration-guide-format.md +34 -0
- package/references/shared/content-trust.md +19 -74
- package/skills/adia-a2ui/SKILL.md +99 -0
- package/skills/{adia-ui-a2ui → adia-a2ui}/evals/routing-corpus.json +10 -10
- package/skills/adia-a2ui/references/anti-patterns.md +27 -0
- package/skills/adia-a2ui/references/chunk-authoring.md +71 -0
- package/skills/adia-a2ui/references/corpus-discipline.md +68 -0
- package/skills/adia-a2ui/references/eval-diagnostics.md +86 -0
- package/skills/adia-a2ui/references/format-extension-decisions.md +66 -0
- package/skills/adia-a2ui/references/leverage-rules.md +52 -0
- package/skills/adia-a2ui/references/mcp-pipeline-ops.md +83 -0
- package/skills/adia-a2ui/references/mcp-tool-reference.md +59 -0
- package/skills/adia-a2ui/references/pipeline-overview.md +115 -0
- package/skills/adia-a2ui/references/semantic-fail-lifting.md +74 -0
- package/skills/adia-a2ui/references/strategy-engines.md +109 -0
- package/skills/adia-a2ui/references/zettel-calibration.md +104 -0
- package/skills/adia-author/SKILL.md +112 -0
- package/skills/adia-author/evals/routing-corpus.json +222 -0
- package/skills/{adia-ui-authoring → adia-author}/references/anti-patterns.md +33 -4
- package/skills/{adia-ui-authoring → adia-author}/references/authoring-cycle.md +9 -11
- package/skills/adia-author/references/canonical-pattern-index.md +243 -0
- package/skills/{adia-ui-authoring → adia-author}/references/code-style.md +19 -21
- package/skills/adia-author/references/common-gotchas.md +129 -0
- package/skills/adia-author/references/composite-demo-protocol.md +271 -0
- package/skills/{adia-ui-authoring → adia-author}/references/css-patterns.md +19 -6
- package/skills/{adia-ui-authoring → adia-author}/references/lifecycle-patterns.md +1 -0
- package/skills/{adia-ui-authoring → adia-author}/references/llm-bridge.md +3 -5
- package/skills/{adia-ui-authoring → adia-author}/references/module-promotion.md +20 -38
- package/skills/{adia-ui-authoring → adia-author}/references/primitive-audit.md +2 -4
- package/skills/{adia-ui-authoring → adia-author}/references/shell-patterns.md +12 -18
- package/skills/{adia-ui-authoring → adia-author}/references/token-contract.md +5 -7
- package/skills/{adia-ui-authoring → adia-author}/references/worked-example.md +3 -3
- package/skills/{adia-ui-authoring → adia-author}/references/yaml-contract.md +3 -3
- package/skills/{adia-ui-authoring → adia-author}/scripts/build-canonical-pattern-index.mjs +3 -3
- package/skills/adia-deploy/SKILL.md +128 -0
- package/skills/{adia-ui-ops → adia-deploy}/references/deploy-playbooks.md +47 -30
- package/skills/adia-dogfood/SKILL.md +124 -0
- package/skills/adia-dogfood/references/admin-shell-anatomy.md +77 -0
- package/skills/adia-dogfood/references/app-shell-pitfalls.md +66 -0
- package/skills/adia-dogfood/references/card-anatomy-sweep.md +66 -0
- package/skills/adia-dogfood/references/html-attr-sweep.md +63 -0
- package/skills/adia-dogfood/references/native-leak-annotations.md +73 -0
- package/skills/adia-dogfood/references/visual-probe-triage.md +80 -0
- package/skills/{adia-ui-dogfood → adia-dogfood}/scripts/analyze.mjs +30 -14
- package/skills/adia-gen-review/SKILL.md +127 -0
- package/skills/adia-gen-review/references/corpus-html-patterns.md +279 -0
- package/skills/adia-gen-review/references/loop-protocol.md +216 -0
- package/skills/adia-gen-review/references/rubric-cosmetic.md +100 -0
- package/skills/adia-gen-review/references/rubric-decompose.md +101 -0
- package/skills/adia-gen-review/references/rubric-score.md +214 -0
- package/skills/{adia-ui-gen-review → adia-gen-review}/references/scores.schema.json +2 -2
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-coverage-audit.mjs +4 -4
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-decompose.mjs +10 -6
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-status.mjs +5 -5
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/validate-cycle-scores.mjs +5 -5
- package/skills/adia-llm-internals/SKILL.md +77 -0
- package/skills/{adia-ui-llm → adia-llm-internals}/references/adapter-contract.md +4 -2
- package/skills/{adia-ui-llm → adia-llm-internals}/references/add-a-provider.md +4 -5
- package/skills/{adia-ui-llm → adia-llm-internals}/references/bridge-facade.md +10 -3
- package/skills/{adia-ui-llm → adia-llm-internals}/references/browser-proxy-boundary.md +1 -1
- package/skills/{adia-ui-llm → adia-llm-internals}/references/model-registry.md +5 -3
- package/skills/{adia-ui-llm → adia-llm-internals}/references/streaming-sse.md +2 -2
- package/skills/adia-release/SKILL.md +72 -0
- package/skills/adia-release/references/changelog-discipline.md +119 -0
- package/skills/adia-release/references/cut-procedure.md +247 -0
- package/skills/adia-release/references/gates-catalog.md +222 -0
- package/skills/adia-release/references/independent-package-release.md +52 -0
- package/skills/adia-release/references/migration-guide-authoring.md +86 -0
- package/skills/adia-release/references/notes-authoring.md +90 -0
- package/skills/adia-release/references/recovery-paths.md +106 -0
- package/skills/{adia-ui-release → adia-release}/scripts/bump.mjs +27 -2
- package/skills/{adia-ui-release → adia-release}/scripts/dispatch-publish.mjs +4 -1
- package/skills/{adia-ui-release → adia-release}/scripts/insert-stub.mjs +1 -1
- package/skills/{adia-ui-release → adia-release}/scripts/package-paths.mjs +6 -0
- package/skills/{adia-ui-release → adia-release}/scripts/promote-unreleased.mjs +1 -1
- package/skills/{adia-ui-release → adia-release}/scripts/release-pack.mjs +13 -21
- package/skills/{adia-ui-release → adia-release}/scripts/tag-lockstep.mjs +5 -1
- package/skills/adia-site-docs/SKILL.md +68 -0
- package/skills/adia-site-docs/evals/audit-report.md +30 -0
- package/skills/adia-site-docs/evals/routing-corpus.json +176 -0
- package/skills/adia-site-docs/intent.md +72 -0
- package/agents/README.md +0 -209
- package/agents/author.md +0 -56
- package/agents/repo-steward.md +0 -56
- package/agents/spec-architect.md +0 -53
- package/agents/tech-lead.md +0 -57
- package/agents/verifier.md +0 -55
- package/bin/lib/audit-axes.mjs +0 -555
- package/bin/lib/dry-run-irreversible.mjs +0 -236
- package/bin/lib/run-skill-evals.mjs +0 -487
- package/bin/lib/teach-router.mjs +0 -250
- package/commands/adia-forge-a2ui.md +0 -10
- package/commands/adia-forge-author.md +0 -10
- package/commands/adia-forge-dogfood.md +0 -8
- package/commands/adia-forge-llm.md +0 -8
- package/commands/adia-forge-orient.md +0 -10
- package/commands/adia-forge-release.md +0 -8
- package/commands/adia-forge-review.md +0 -10
- package/references/shared/pev-rationale.md +0 -64
- package/references/shared/skill-conventions.md +0 -133
- package/skills/adia-ui-a2ui/CHANGELOG.md +0 -32
- package/skills/adia-ui-a2ui/SKILL.md +0 -243
- package/skills/adia-ui-a2ui/evals/adversarial-corpus.json +0 -75
- package/skills/adia-ui-a2ui/evals/teach-routing-cases.json +0 -100
- package/skills/adia-ui-a2ui/references/anti-patterns.md +0 -24
- package/skills/adia-ui-a2ui/references/chunk-authoring.md +0 -88
- package/skills/adia-ui-a2ui/references/corpus-discipline.md +0 -56
- package/skills/adia-ui-a2ui/references/eval-diagnostics.md +0 -127
- package/skills/adia-ui-a2ui/references/fragment-graph.md +0 -91
- package/skills/adia-ui-a2ui/references/mcp-pipeline-ops.md +0 -106
- package/skills/adia-ui-a2ui/references/mcp-tool-reference.md +0 -398
- package/skills/adia-ui-a2ui/references/pipeline-overview.md +0 -175
- package/skills/adia-ui-a2ui/references/semantic-fail-lifting.md +0 -120
- package/skills/adia-ui-a2ui/references/strategy-engines.md +0 -111
- package/skills/adia-ui-a2ui/references/teach-protocol.md +0 -220
- package/skills/adia-ui-a2ui/references/zettel-calibration.md +0 -93
- package/skills/adia-ui-a2ui/scripts/audit-a2ui-roster.mjs +0 -96
- package/skills/adia-ui-a2ui/scripts/teach-route.mjs +0 -157
- package/skills/adia-ui-a2ui/skill.json +0 -38
- package/skills/adia-ui-authoring/CHANGELOG.md +0 -32
- package/skills/adia-ui-authoring/SKILL.md +0 -256
- package/skills/adia-ui-authoring/assets/case-studies/admin-shell-decomposition.md +0 -101
- package/skills/adia-ui-authoring/assets/case-studies/maxtokens-32768-discovery.md +0 -109
- package/skills/adia-ui-authoring/assets/case-studies/theme-panel-promotion.md +0 -113
- package/skills/adia-ui-authoring/evals/adversarial-design-plan-gates.json +0 -138
- package/skills/adia-ui-authoring/evals/routing-corpus.json +0 -245
- package/skills/adia-ui-authoring/references/canonical-pattern-index.md +0 -179
- package/skills/adia-ui-authoring/references/common-gotchas.md +0 -93
- package/skills/adia-ui-authoring/references/composite-demo-protocol.md +0 -1084
- package/skills/adia-ui-authoring/references/teach-protocol.md +0 -428
- package/skills/adia-ui-authoring/scripts/audit-authoring-roster.mjs +0 -148
- package/skills/adia-ui-authoring/skill.json +0 -45
- package/skills/adia-ui-dogfood/CHANGELOG.md +0 -17
- package/skills/adia-ui-dogfood/README.md +0 -62
- package/skills/adia-ui-dogfood/SKILL.md +0 -866
- package/skills/adia-ui-dogfood/skill.json +0 -40
- package/skills/adia-ui-forge/SKILL.md +0 -88
- package/skills/adia-ui-forge/evals/routing-corpus.json +0 -30
- package/skills/adia-ui-gen-review/CHANGELOG.md +0 -108
- package/skills/adia-ui-gen-review/SKILL.md +0 -266
- package/skills/adia-ui-gen-review/references/loop-protocol.md +0 -712
- package/skills/adia-ui-gen-review/references/rubric-cosmetic.md +0 -144
- package/skills/adia-ui-gen-review/references/rubric-decompose.md +0 -117
- package/skills/adia-ui-gen-review/references/rubric-score.md +0 -249
- package/skills/adia-ui-gen-review/references/teach-protocol.md +0 -214
- package/skills/adia-ui-gen-review/skill.json +0 -23
- package/skills/adia-ui-llm/CHANGELOG.md +0 -25
- package/skills/adia-ui-llm/SKILL.md +0 -165
- package/skills/adia-ui-llm/evals/adversarial-corpus.json +0 -75
- package/skills/adia-ui-llm/evals/routing-corpus.json +0 -30
- package/skills/adia-ui-llm/evals/teach-routing-cases.json +0 -73
- package/skills/adia-ui-llm/references/teach-protocol.md +0 -78
- package/skills/adia-ui-llm/scripts/audit-llm-roster.mjs +0 -93
- package/skills/adia-ui-llm/scripts/teach-route.mjs +0 -119
- package/skills/adia-ui-llm/skill.json +0 -33
- package/skills/adia-ui-ops/CHANGELOG.md +0 -291
- package/skills/adia-ui-ops/SKILL.md +0 -401
- package/skills/adia-ui-ops/references/INDEX.md +0 -158
- package/skills/adia-ui-ops/references/audit-cadence.md +0 -263
- package/skills/adia-ui-ops/references/audit-patterns/archive-link-sweep.md +0 -96
- package/skills/adia-ui-ops/references/audit-patterns/audit-history-ledger.md +0 -162
- package/skills/adia-ui-ops/references/audit-patterns/browser-bundle-node-imports.md +0 -154
- package/skills/adia-ui-ops/references/audit-patterns/changelog-unreleased-bloat.md +0 -75
- package/skills/adia-ui-ops/references/audit-patterns/coverage-gaps.md +0 -187
- package/skills/adia-ui-ops/references/audit-patterns/entry-file-coverage.md +0 -122
- package/skills/adia-ui-ops/references/audit-patterns/format-hygiene.md +0 -217
- package/skills/adia-ui-ops/references/audit-patterns/lockstep-versioning.md +0 -113
- package/skills/adia-ui-ops/references/audit-patterns/memory-fragmentation.md +0 -180
- package/skills/adia-ui-ops/references/audit-patterns/orphan-detection.md +0 -202
- package/skills/adia-ui-ops/references/audit-patterns/pointer-validation.md +0 -180
- package/skills/adia-ui-ops/references/audit-patterns/redundancy-detection.md +0 -210
- package/skills/adia-ui-ops/references/audit-patterns/spec-dating-sweep.md +0 -91
- package/skills/adia-ui-ops/references/audit-patterns/stale-content.md +0 -182
- package/skills/adia-ui-ops/references/audit-patterns/staleness-tooling.md +0 -156
- package/skills/adia-ui-ops/references/audit-patterns/token-waste-detection.md +0 -196
- package/skills/adia-ui-ops/references/doc-types/adr-pattern.md +0 -210
- package/skills/adia-ui-ops/references/doc-types/architecture-md.md +0 -190
- package/skills/adia-ui-ops/references/doc-types/changelog.md +0 -183
- package/skills/adia-ui-ops/references/doc-types/decisions-log.md +0 -146
- package/skills/adia-ui-ops/references/doc-types/plan-roadmap.md +0 -182
- package/skills/adia-ui-ops/references/doc-types/postmortem-pattern.md +0 -206
- package/skills/adia-ui-ops/references/genres/prose-and-writing.md +0 -149
- package/skills/adia-ui-ops/references/guidance/context-budget.md +0 -137
- package/skills/adia-ui-ops/references/guidance/llm-doc-writing.md +0 -116
- package/skills/adia-ui-ops/references/guidance/reliability-dial.md +0 -186
- package/skills/adia-ui-ops/references/recipes/adr-introduction.md +0 -211
- package/skills/adia-ui-ops/references/recipes/audit-existing-repo.md +0 -234
- package/skills/adia-ui-ops/references/recipes/cold-start-harvest.md +0 -263
- package/skills/adia-ui-ops/references/recipes/concurrent-learnings-merge.md +0 -158
- package/skills/adia-ui-ops/references/recipes/continuous-learning-loop.md +0 -169
- package/skills/adia-ui-ops/references/recipes/external-reference-verification.md +0 -158
- package/skills/adia-ui-ops/references/recipes/findings-index-readout.md +0 -126
- package/skills/adia-ui-ops/references/recipes/greenfield-setup.md +0 -252
- package/skills/adia-ui-ops/references/recipes/harvest-repo-brain.md +0 -169
- package/skills/adia-ui-ops/references/recipes/import-repo-brain-harvest.md +0 -153
- package/skills/adia-ui-ops/references/recipes/memory-organization.md +0 -182
- package/skills/adia-ui-ops/references/recipes/recommend-then-validate.md +0 -199
- package/skills/adia-ui-ops/references/recipes/self-healing-hooks.md +0 -366
- package/skills/adia-ui-ops/references/recipes/skill-stewardship-loop.md +0 -113
- package/skills/adia-ui-ops/references/standards/agents-md-spec.md +0 -138
- package/skills/adia-ui-ops/references/standards/claude-md-convention.md +0 -123
- package/skills/adia-ui-ops/references/standards/cross-tool-matrix.md +0 -85
- package/skills/adia-ui-ops/references/standards/readme-conventions.md +0 -232
- package/skills/adia-ui-ops/references/teach-protocol.md +0 -215
- package/skills/adia-ui-ops/scripts/audit-ops-roster.mjs +0 -104
- package/skills/adia-ui-ops/skill.json +0 -65
- package/skills/adia-ui-release/CHANGELOG.md +0 -66
- package/skills/adia-ui-release/SKILL.md +0 -323
- package/skills/adia-ui-release/assets/case-studies/2026-05-20-batch-push-v0.6.14-v0.6.15.md +0 -144
- package/skills/adia-ui-release/assets/case-studies/2026-05-20-corpus-drift-remediation-v0.6.15.md +0 -155
- package/skills/adia-ui-release/assets/case-studies/2026-05-20-version-skip-correction-v0.6.12.md +0 -114
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-author-from-scratch-v0.6.18.md +0 -139
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-feedback37-retraction-v0.6.21.md +0 -124
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-fn1-enrichment-pass-v0.6.19.md +0 -125
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-stale-test-detection-v0.6.20.md +0 -142
- package/skills/adia-ui-release/assets/case-studies/2026-05-23-freshness-gate-recovery-v0.6.32.md +0 -97
- package/skills/adia-ui-release/assets/case-studies/2026-05-26-catalog-drift-recurring-v0.6.40.md +0 -147
- package/skills/adia-ui-release/assets/templates/stub-changelog.template.md +0 -22
- package/skills/adia-ui-release/evals/evals.json +0 -164
- package/skills/adia-ui-release/references/changelog-discipline.md +0 -250
- package/skills/adia-ui-release/references/cycle-happy-path.md +0 -520
- package/skills/adia-ui-release/references/exe-deploy.md +0 -149
- package/skills/adia-ui-release/references/gates-catalog.md +0 -778
- package/skills/adia-ui-release/references/independent-package-release.md +0 -129
- package/skills/adia-ui-release/references/ledger-discipline.md +0 -232
- package/skills/adia-ui-release/references/migration-guide-authoring.md +0 -174
- package/skills/adia-ui-release/references/multi-agent-baseline.md +0 -207
- package/skills/adia-ui-release/references/notes-authoring.md +0 -212
- package/skills/adia-ui-release/references/recovery-paths.md +0 -262
- package/skills/adia-ui-release/references/rollup-notes.md +0 -208
- package/skills/adia-ui-release/references/teach-protocol.md +0 -468
- package/skills/adia-ui-release/scripts/audit-gate-roster.mjs +0 -196
- package/skills/adia-ui-release/scripts/make-ledger.mjs +0 -200
- package/skills/adia-ui-release/skill.json +0 -77
- package/skills/dogfood-sweep/CHANGELOG.md +0 -37
- package/skills/dogfood-sweep/README.md +0 -105
- package/skills/dogfood-sweep/SKILL.md +0 -1000
- package/skills/dogfood-sweep/analyze.mjs +0 -600
- package/skills/dogfood-sweep/skill.json +0 -31
- /package/skills/{adia-ui-authoring → adia-author}/references/api-contract.md +0 -0
- /package/skills/{adia-ui-release → adia-release}/scripts/assert-monorepo-root.mjs +0 -0
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2026-04-27
|
|
3
|
-
coverage: canonical
|
|
4
|
-
peers:
|
|
5
|
-
- greenfield-setup.md
|
|
6
|
-
- audit-existing-repo.md
|
|
7
|
-
- concurrent-learnings-merge.md
|
|
8
|
-
- recommend-then-validate.md
|
|
9
|
-
- ../audit-patterns/redundancy-detection.md
|
|
10
|
-
- ../audit-patterns/staleness-tooling.md
|
|
11
|
-
- ../doc-types/adr-pattern.md
|
|
12
|
-
primary_sources:
|
|
13
|
-
- https://code.claude.com/docs/en/best-practices
|
|
14
|
-
status: research-verified
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Cold-start harvest (importing existing learnings into `ops-repo`)
|
|
18
|
-
|
|
19
|
-
> **The premise.** Existing repos already have buried learnings: a fat `CLAUDE.md` from 2024, ADRs trapped in PR descriptions, post-mortems in Slack screenshots, an old `NOTES.md` in root, multiple competing convention docs. The destructive default — *delete it all and start fresh* — loses signal. The trusting default — *import everything* — imports stale and contradictory content. Cold-start harvest is the opinionated middle path: **inventory, triage, archive-the-junk, rehome-the-good, supersede-the-conflicts, preserve-the-archaeology**.
|
|
20
|
-
|
|
21
|
-
## How this differs from `greenfield-setup.md`
|
|
22
|
-
|
|
23
|
-
| | Greenfield | Cold-start harvest |
|
|
24
|
-
|---|---|---|
|
|
25
|
-
| Existing docs | None | Many, varying age and quality |
|
|
26
|
-
| Conflicts | Impossible | Likely; resolution is the hard part |
|
|
27
|
-
| Default disposition | Create canonical artifacts | Triage existing artifacts; *then* create canonical |
|
|
28
|
-
| Time | Hours | Days (with iteration) |
|
|
29
|
-
| Bounding | Linear procedure | Heuristic-bounded — don't try to harvest everything |
|
|
30
|
-
|
|
31
|
-
If your repo is genuinely new, use `greenfield-setup.md`. If it's older than ~3 months and has any documentation at all, use this recipe.
|
|
32
|
-
|
|
33
|
-
## Where the buried learnings live (inventory targets)
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# Likely-stale top-level files
|
|
37
|
-
find . -maxdepth 3 -type f \( \
|
|
38
|
-
-name '*NOTES*' -o -name '*WIP*' -o -name '*PLAN*' -o \
|
|
39
|
-
-name '*OLD*' -o -name '*LEGACY*' -o -name '*BACKUP*' -o \
|
|
40
|
-
-name 'STYLEGUIDE*' -o -name 'CONVENTIONS*' \
|
|
41
|
-
\)
|
|
42
|
-
|
|
43
|
-
# Markdown not in canonical locations
|
|
44
|
-
find . -name '*.md' -type f \
|
|
45
|
-
-not -path './.brain/adrs/*' \
|
|
46
|
-
-not -path './.brain/postmortems/*' \
|
|
47
|
-
-not -path './.brain/runbooks/*' \
|
|
48
|
-
-not -path './.brain/architecture/*' \
|
|
49
|
-
-not -path './.brain/archive/*' \
|
|
50
|
-
-not -path './node_modules/*' \
|
|
51
|
-
-not -path './.git/*'
|
|
52
|
-
|
|
53
|
-
# Commits that look like recorded decisions
|
|
54
|
-
git log --all --grep='decided\|migrate\|switch from\|chose\|deprecate' \
|
|
55
|
-
--pretty=format:'%h %s' | head -50
|
|
56
|
-
|
|
57
|
-
# PR bodies with ADR-shaped content (requires gh CLI)
|
|
58
|
-
gh pr list --state all --limit 200 --json number,title,body --jq '
|
|
59
|
-
.[] | select(.body | test("## (Status|Decision|Consequences)"; "i"))
|
|
60
|
-
| {n: .number, t: .title}'
|
|
61
|
-
|
|
62
|
-
# Issues labeled as incidents / postmortems
|
|
63
|
-
gh issue list --state all --label 'incident,post-mortem,postmortem' --limit 100
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## The triage matrix
|
|
67
|
-
|
|
68
|
-
For each found artifact, classify:
|
|
69
|
-
|
|
70
|
-
| Disposition | Meaning | Default action |
|
|
71
|
-
|---|---|---|
|
|
72
|
-
| **`keep`** | Already in the right place, current, correct | Leave alone; date-stamp if needed |
|
|
73
|
-
| **`rehome`** | Good content, wrong location | Move to canonical location with provenance |
|
|
74
|
-
| **`archive`** | Out of date but historically valuable | Move to `.brain/archive/` with provenance |
|
|
75
|
-
| **`supersede`** | Conflicts with another artifact | Write resolving ADR; mark both `Superseded` |
|
|
76
|
-
| **`reconcile`** | Two artifacts both partially correct, partially wrong | Most expensive: extract truths, write merged canonical, archive originals |
|
|
77
|
-
| **`delete`** | Never had value (e.g., `*-copy.md`, generated junk) | Move to archive, not delete (preserve the audit trail) |
|
|
78
|
-
|
|
79
|
-
### Triage rules of thumb
|
|
80
|
-
|
|
81
|
-
| Found | Likely disposition |
|
|
82
|
-
|---|---|
|
|
83
|
-
| Current fat `CLAUDE.md` and no `AGENTS.md` | `rehome`: rename to AGENTS.md, generalize wording, demote CLAUDE.md to symlink/pointer |
|
|
84
|
-
| `STYLEGUIDE.md` overlapping with AGENTS.md "Conventions" | `reconcile`: pick canonical, demote other |
|
|
85
|
-
| `NOTES.md` in root | Read carefully. ADR-shaped sections → extract to `.brain/adrs/` (`rehome`); rest → `archive` |
|
|
86
|
-
| `WIP_PLAN.md` | Almost always `archive`. If active work, extract goals into `docs/PLAN.md` |
|
|
87
|
-
| `docs/legacy/`, `docs/old/`, `docs/_old_/` | `archive` to `.brain/archive/legacy-import-<date>/` |
|
|
88
|
-
| `*_BACKUP*.md`, `*-copy*.md` | `archive` (don't delete; weird ones may have unique content) |
|
|
89
|
-
| GitHub issues with `incident` / `post-mortem` label | Read each. Substantive ones → `rehome` to `.brain/postmortems/` with provenance link to original issue |
|
|
90
|
-
| PR descriptions with ADR-shaped content | `rehome`: extract to `.brain/adrs/` with provenance pointer to original PR |
|
|
91
|
-
| Two `Accepted` ADRs about the same subject (after rehoming) | `supersede`: human reviews, writes resolving ADR |
|
|
92
|
-
|
|
93
|
-
## The 7 phases
|
|
94
|
-
|
|
95
|
-
### Phase 1 — Inventory (mechanical)
|
|
96
|
-
|
|
97
|
-
Run the inventory commands above. Collect into a single `.brain/cold-start-inventory.md` (transient — deleted after phase 7):
|
|
98
|
-
|
|
99
|
-
```markdown
|
|
100
|
-
# Cold-start inventory — 2026-04-27
|
|
101
|
-
|
|
102
|
-
| Path | Last modified | Size | Triage |
|
|
103
|
-
|---|---|---|---|
|
|
104
|
-
| ./CLAUDE.md | 2024-09-12 | 240 lines | rehome → AGENTS.md |
|
|
105
|
-
| ./NOTES.md | 2023-11-04 | 60 lines | archive (extract `### Postgres decision` → ADR first) |
|
|
106
|
-
| ./STYLEGUIDE.md | 2024-03-01 | 90 lines | reconcile with `CONTRIBUTING.md` |
|
|
107
|
-
| ./docs/old/architecture-v1.md | 2022-06-15 | 410 lines | archive |
|
|
108
|
-
| PR #144 body | (closed 2024-08-22) | — | rehome decision section → .brain/adrs/2024-08-22-graphql-rejection.md |
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
This file is the working artifact. Update it as triage progresses.
|
|
112
|
-
|
|
113
|
-
### Phase 2 — Triage (human-reviewed)
|
|
114
|
-
|
|
115
|
-
Walk the inventory in time-bounded sessions. **Set a budget**: 4 hours. Stop when budget exhausted; the rest waits for next iteration. Don't try to harvest everything in one pass.
|
|
116
|
-
|
|
117
|
-
Triage signals to escalate:
|
|
118
|
-
- Anything that says "DO NOT MODIFY" or "SOURCE OF TRUTH" — flag for explicit confirmation before any action
|
|
119
|
-
- Anything containing what looks like secrets (API keys, internal hostnames) — flag, don't process automatically
|
|
120
|
-
- Anything in a language other than the repo's primary language — out of automated scope; flag for human review
|
|
121
|
-
|
|
122
|
-
### Phase 3 — Bulk-archive obvious junk (PR)
|
|
123
|
-
|
|
124
|
-
Anything matching the bulk-archive heuristics (legacy folders, *_BACKUP, untouched > 2 years AND unreferenced from any entry file) gets a single PR:
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
docs: cold-start harvest — bulk-archive 23 stale artifacts
|
|
128
|
-
|
|
129
|
-
Moved to .brain/archive/legacy-import-2026-04-27/:
|
|
130
|
-
- CLAUDE-OLD.md (last modified 2023-04)
|
|
131
|
-
- NOTES_2023.md
|
|
132
|
-
- docs/old/* (12 files)
|
|
133
|
-
- ...
|
|
134
|
-
|
|
135
|
-
No content lost — preserved with provenance.
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Each archived file gets a `_Harvested from <original-path> on 2026-04-27 (cold-start harvest, untouched since <date>)_` line at the top.
|
|
139
|
-
|
|
140
|
-
### Phase 4 — Rehome obviously-good content (per-artifact PRs)
|
|
141
|
-
|
|
142
|
-
For each `rehome` disposition: separate PR, single artifact at a time.
|
|
143
|
-
|
|
144
|
-
Example: `CLAUDE.md` (fat, current-ish) → `AGENTS.md`:
|
|
145
|
-
|
|
146
|
-
1. `git mv CLAUDE.md AGENTS.md`
|
|
147
|
-
2. Edit: replace "Claude Code" / "Claude" with "LLM coding agents (Claude Code, Codex, Devin, Cursor, Windsurf, Copilot, …)"
|
|
148
|
-
3. Add `_Last reviewed: 2026-04-27_` line + `_Harvested from CLAUDE.md (cold-start)_`
|
|
149
|
-
4. Create new thin `CLAUDE.md` (or symlink) per `claude-md-convention.md`
|
|
150
|
-
5. PR with title `docs: harvest — rehome CLAUDE.md → AGENTS.md`
|
|
151
|
-
|
|
152
|
-
For ADRs extracted from PR descriptions: each new ADR includes:
|
|
153
|
-
|
|
154
|
-
```markdown
|
|
155
|
-
---
|
|
156
|
-
date: 2026-04-27 # harvest date
|
|
157
|
-
status: accepted
|
|
158
|
-
harvested_from: PR #144 (closed 2024-08-22)
|
|
159
|
-
original_decision_date: 2024-08-22
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
# 2024-08-22-1500-graphql-rejection
|
|
163
|
-
|
|
164
|
-
_Harvested from PR #144 (https://github.com/example/repo/pull/144) on 2026-04-27 during cold-start harvest. Original decision was made 2024-08-22; this ADR file backfills the artifact._
|
|
165
|
-
|
|
166
|
-
## Status
|
|
167
|
-
Accepted
|
|
168
|
-
|
|
169
|
-
## Context
|
|
170
|
-
[from PR description]
|
|
171
|
-
...
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Provenance is non-negotiable — future audits need to distinguish original artifacts from imported ones.
|
|
175
|
-
|
|
176
|
-
### Phase 5 — Conflict resolution (ADR-by-ADR, human approval)
|
|
177
|
-
|
|
178
|
-
After phases 3-4, run the redundancy-detection trip-wire from v1.0 against the rehomed state. Findings will surface:
|
|
179
|
-
|
|
180
|
-
- Two ADRs with overlapping subject matter
|
|
181
|
-
- AGENTS.md sections with internal contradiction
|
|
182
|
-
- Conflicting style claims across CONTRIBUTING.md and AGENTS.md
|
|
183
|
-
|
|
184
|
-
For each conflict: follow the **supersession protocol** from `concurrent-learnings-merge.md`:
|
|
185
|
-
|
|
186
|
-
1. Surface the conflict
|
|
187
|
-
2. Human picks resolution
|
|
188
|
-
3. Write a new superseding ADR with full citation
|
|
189
|
-
4. Mark originals as `Superseded by <new-ADR>` (do not delete or edit content beyond the status field)
|
|
190
|
-
|
|
191
|
-
**This phase cannot be auto-applied even at `lax` strictness.** Supersession is a content decision affecting what future agents believe. The recipe forces `recommend-then-validate` with explicit human approval per supersession PR.
|
|
192
|
-
|
|
193
|
-
### Phase 6 — Provenance pass
|
|
194
|
-
|
|
195
|
-
Every harvested artifact must carry a provenance line:
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
_Harvested from <original-path-or-source> on 2026-04-27 (cold-start harvest)._
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Run a sanity check: every file in `.brain/` modified during the harvest period either has a `_Last reviewed:_` line or a `_Harvested from..._` line. Files missing provenance get flagged.
|
|
202
|
-
|
|
203
|
-
### Phase 7 — Re-audit
|
|
204
|
-
|
|
205
|
-
Run the full audit (`audit-existing-repo.md`) against the post-harvest state. Confirm:
|
|
206
|
-
|
|
207
|
-
- Promise 1 (less-wasteful): no orphans; CLAUDE.md is symlink/pointer to AGENTS.md
|
|
208
|
-
- Promise 2 (token-optimized): AGENTS.md ≤200 lines
|
|
209
|
-
- Promise 3 (less-stale): all docs dated; no broken cross-refs
|
|
210
|
-
- Promise 4 (self-healing): hooks installed (per `self-healing-hooks.md`)
|
|
211
|
-
- Promise 5 (continuously-learning): `.brain/adrs/` populated with both new and harvested ADRs; supersession chain intact
|
|
212
|
-
|
|
213
|
-
If the post-audit shows any `critical` findings, return to phase 5. Iterate until clean.
|
|
214
|
-
|
|
215
|
-
After phase 7 passes: delete `.brain/cold-start-inventory.md` (it's transient working state, not preserved memory).
|
|
216
|
-
|
|
217
|
-
## The non-negotiables
|
|
218
|
-
|
|
219
|
-
1. **No deletes.** Every disposition is `archive` (move to `.brain/archive/`) or `rehome` (move with provenance). Even the "delete" disposition in the triage matrix is implemented as archive. Future archaeology may need the original.
|
|
220
|
-
2. **No silent supersession.** When two artifacts conflict, the resolution writes a NEW ADR; the originals are *marked* `Superseded`, not edited beyond the status field.
|
|
221
|
-
3. **Provenance for everything imported.** No exceptions.
|
|
222
|
-
4. **Time-bounded passes.** A 6-hour cold-start session is fine; a 6-week project is not. Iterate weekly until clean rather than blocking indefinitely.
|
|
223
|
-
5. **Human-in-the-loop for every supersession.** Apply-mode never resolves a content conflict.
|
|
224
|
-
|
|
225
|
-
## Cost-bounding heuristic
|
|
226
|
-
|
|
227
|
-
Repos vary wildly in legacy-doc surface. A pragmatic floor:
|
|
228
|
-
|
|
229
|
-
- **20-doc rule**: triage the 20 most-recently-modified candidate artifacts first. If they cover the substantive learnings, stop. The rest go to bulk-archive without per-artifact triage.
|
|
230
|
-
- **6-month rule**: artifacts unmodified for 6 months get default-archived unless they're explicitly referenced from an active entry file.
|
|
231
|
-
- **2-year rule**: artifacts unmodified for 2 years AND unreferenced get bulk-archived without review.
|
|
232
|
-
- **Half-day budget per session**. If triage takes longer, split into multiple sessions across days.
|
|
233
|
-
|
|
234
|
-
These rules are conservative — they preserve learnings rather than compressing them. They also don't try to be exhaustive on the first pass.
|
|
235
|
-
|
|
236
|
-
## Cross-system imports (out of scope)
|
|
237
|
-
|
|
238
|
-
This recipe assumes everything you want to harvest lives **in the repo today**. Not in scope:
|
|
239
|
-
|
|
240
|
-
- **Slack post-mortems** — the recipe can't fetch them. Two paths: (a) one-time manual import (effort scales with volume); (b) maintain `.brain/postmortems/external-index.md` linking to authoritative external locations
|
|
241
|
-
- **Notion / Confluence pages** — same
|
|
242
|
-
- **GitHub issues from a different repo** — same
|
|
243
|
-
- **Scattered Slack DMs / email** — never going to be harvested; the institutional knowledge that lives only there will need to be re-derived through the iterate pattern
|
|
244
|
-
|
|
245
|
-
For external sources, document the *pointer*, not the content. The ops-repo's stance: institutional memory that isn't in the repo isn't reliably consultable by an LLM agent, but a pointer is better than nothing.
|
|
246
|
-
|
|
247
|
-
## Anti-patterns
|
|
248
|
-
|
|
249
|
-
- **Bulk-importing without triage.** Imports the staleness alongside the truth. Future audits surface conflicts you could have avoided.
|
|
250
|
-
- **Skipping provenance lines** to save effort. You will regret this in 6 months when an audit asks "is this still current?" and there's no way to tell.
|
|
251
|
-
- **Auto-superseding conflicts.** Forbidden. Humans pick.
|
|
252
|
-
- **Trying to harvest everything in one pass.** Half-day budget rule. Iterate.
|
|
253
|
-
- **Treating archived artifacts as deleted.** They're preserved; future agents may consult them. The archive is part of the brain.
|
|
254
|
-
- **Forgetting to delete the cold-start-inventory.md** after phase 7. It's working state, not memory.
|
|
255
|
-
|
|
256
|
-
## Cross-references
|
|
257
|
-
|
|
258
|
-
- Concurrent learnings merge (related; ongoing operations after cold-start): `concurrent-learnings-merge.md`
|
|
259
|
-
- Greenfield setup (the alternative path for new repos): `greenfield-setup.md`
|
|
260
|
-
- Audit existing repo (the post-harvest verification step): `audit-existing-repo.md`
|
|
261
|
-
- Redundancy detection (where conflict findings come from): `../audit-patterns/redundancy-detection.md`
|
|
262
|
-
- ADR pattern (supersession protocol): `../doc-types/adr-pattern.md`
|
|
263
|
-
- Recommend-then-validate (the gating mechanism for supersession PRs): `recommend-then-validate.md`
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2026-04-27
|
|
3
|
-
coverage: canonical
|
|
4
|
-
peers:
|
|
5
|
-
- cold-start-harvest.md
|
|
6
|
-
- self-healing-hooks.md
|
|
7
|
-
- recommend-then-validate.md
|
|
8
|
-
- ../audit-patterns/redundancy-detection.md
|
|
9
|
-
- ../doc-types/adr-pattern.md
|
|
10
|
-
primary_sources:
|
|
11
|
-
- https://github.com/changesets/changesets — Atlassian-originated changeset pattern (the borrowed convention)
|
|
12
|
-
- https://github.com/googleapis/release-please — alternative changeset/release tool
|
|
13
|
-
status: research-verified
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Concurrent learnings merge ("sync-and-reason")
|
|
17
|
-
|
|
18
|
-
> **The premise.** When multiple users (or agents) log learnings to the same `ops-repo` folders, **textual merges hide semantic conflicts.** Person A's PR adds "Tests: Vitest" to AGENTS.md; Person B's PR adds "Tests: Jest" in a different region of the same file. Git accepts both. The repo now contradicts itself, and no merge tool will tell you. This recipe makes the semantic conflicts *visible*.
|
|
19
|
-
|
|
20
|
-
## What's already trivially mergeable (and what isn't)
|
|
21
|
-
|
|
22
|
-
| Artifact | Merge story | Conflict risk |
|
|
23
|
-
|---|---|---|
|
|
24
|
-
| ADRs (`.brain/adrs/<file>.md`) | One file per decision | **Only the next-number race** (two PRs both want `0042-`) |
|
|
25
|
-
| Postmortems (`.brain/postmortems/YYYY-MM-DD-*.md`) | Date-prefixed, one per incident | Same-day collision → suffix `-2` |
|
|
26
|
-
| Audit-history ledger (`.brain/audit-history/<date>.json`) | Append-only, dated | None — can't conflict |
|
|
27
|
-
| **AGENTS.md** (single file) | Standard git merge | **Semantic conflict undetected** |
|
|
28
|
-
| **CHANGELOG.md** (single file) | Standard git merge | **Same problem** — and solved by the changesets ecosystem |
|
|
29
|
-
| Runbooks, postmortems, ADRs being *edited* (rare; they should be immutable) | Standard git merge | Should not be common; immutability is the design |
|
|
30
|
-
|
|
31
|
-
The hard cases are **single-file artifacts that multiple PRs want to extend simultaneously**, and **conflicting decisions** in artifacts git can't see as conflicts.
|
|
32
|
-
|
|
33
|
-
## Three conventions that solve it
|
|
34
|
-
|
|
35
|
-
### Convention 1 — Timestamp-prefixed ADR filenames
|
|
36
|
-
|
|
37
|
-
Replace `.brain/adrs/0042-postgres-choice.md` with **`.brain/adrs/2026-04-27-1342-postgres-choice.md`**.
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
.brain/adrs/
|
|
41
|
-
├── 2026-04-12-1342-use-postgres.md
|
|
42
|
-
├── 2026-04-15-0930-deprecate-redis.md
|
|
43
|
-
├── 2026-04-27-1100-rest-not-graphql.md
|
|
44
|
-
└── README.md # auto-generated index; assigns ADR-N labels by chronological position
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The next-number race disappears. ADR-N labels for human reading get computed at index-generation time from chronological order, recorded in `README.md`. The numeric identity ("ADR-42") survives in the *index*, not the filename.
|
|
48
|
-
|
|
49
|
-
Backwards-compat: existing repos with sequential ADRs don't need to renumber. The convention applies to new ADRs going forward.
|
|
50
|
-
|
|
51
|
-
### Convention 2 — AGENTS.md changeset pattern
|
|
52
|
-
|
|
53
|
-
Borrowed directly from [`changesets/changesets`](https://github.com/changesets/changesets) (the Atlassian/Atlaskit tool used by every monorepo of consequence).
|
|
54
|
-
|
|
55
|
-
**The rule:** PRs that want to modify AGENTS.md don't edit AGENTS.md. They drop a file:
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
.brain/changesets/2026-04-27-vitest-replaces-jest.md
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```markdown
|
|
62
|
-
---
|
|
63
|
-
date: 2026-04-27
|
|
64
|
-
author: alice@example.com
|
|
65
|
-
target_section: conventions
|
|
66
|
-
operation: replace # add | replace | remove
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## Replace in "Conventions" section:
|
|
70
|
-
|
|
71
|
-
- "Tests: Jest" → "Tests: Vitest"
|
|
72
|
-
|
|
73
|
-
## Why
|
|
74
|
-
|
|
75
|
-
Migrated from Jest to Vitest in PR #389 (commit a3b4c5d). The "Jest" line in
|
|
76
|
-
AGENTS.md is now wrong; this changeset corrects it.
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
A **merge-time consolidation job** (run as a GitHub Action on every push to main, or on a scheduled cadence):
|
|
80
|
-
|
|
81
|
-
1. Reads all `.brain/changesets/*.md` files in chronological order.
|
|
82
|
-
2. **Validates:** do any changesets target the same `target_section` with conflicting `operation`s?
|
|
83
|
-
- Two `add` to "Conventions" with semantically-overlapping content → CONFLICT
|
|
84
|
-
- One `add "use Vitest"` + one `add "use Jest"` for "Tests" → CONFLICT
|
|
85
|
-
- One `replace X→Y` + one `replace X→Z` → CONFLICT
|
|
86
|
-
3. **If conflicts:** emit findings, halt consolidation, require human resolution. PR a "consolidation blocker" with the conflict report.
|
|
87
|
-
4. **If clean:** apply each changeset to AGENTS.md in chronological order; delete the changeset files; commit `[ops-repo] Consolidate N changesets to AGENTS.md`.
|
|
88
|
-
|
|
89
|
-
The conflict-detection step is the load-bearing one. It's where "Vitest vs Jest" gets caught — *before* both land. Use the LLM-on-diff pattern from `staleness-tooling.md` as the conflict-detector.
|
|
90
|
-
|
|
91
|
-
Same pattern for CHANGELOG.md additions (and `release-please`-style consolidation if release-cadence is the trigger).
|
|
92
|
-
|
|
93
|
-
### Convention 3 — Post-merge redundancy scan as a scheduled trip-wire
|
|
94
|
-
|
|
95
|
-
Already exists per `self-healing-hooks.md` (the weekly scheduled audit). The weekly job runs `redundancy-detection.md`'s checks across the merged state and opens an issue when contradictions are found.
|
|
96
|
-
|
|
97
|
-
This is the *backstop* for cases where the changeset pattern wasn't used (e.g., direct edits to AGENTS.md by repo maintainers, or runbook edits). It catches:
|
|
98
|
-
|
|
99
|
-
- AGENTS.md sections with internal contradiction
|
|
100
|
-
- Two ADRs with overlapping subject matter (both `Accepted`, both addressing the same decision)
|
|
101
|
-
- Repeated facts across docs (Promise 1 redundancy detection)
|
|
102
|
-
|
|
103
|
-
Output: a `CONFLICT-DETECTED` finding in the audit history ledger and an open GitHub issue tagged `ops-repo`.
|
|
104
|
-
|
|
105
|
-
## The supersession protocol (when conflict IS found)
|
|
106
|
-
|
|
107
|
-
The recipe **does not** auto-resolve conflicts. Resolution is a content decision that affects what future agents believe. Process:
|
|
108
|
-
|
|
109
|
-
1. **Detect** — redundancy-scan or changeset-validator finds the conflict.
|
|
110
|
-
2. **Surface** — emit a `CONFLICT-DETECTED` finding with both source paths and the contradiction quoted.
|
|
111
|
-
3. **Prompt** — the audit's PR includes a template asking the human reviewer:
|
|
112
|
-
- Which decision is current?
|
|
113
|
-
- Was the older one superseded silently? (If yes, the older one needs `Status: Superseded`.)
|
|
114
|
-
- Or should both be archived in favor of a fresh decision?
|
|
115
|
-
4. **Human picks resolution.**
|
|
116
|
-
5. **Write a new superseding ADR** (`.brain/adrs/<timestamp>-resolve-X-vs-Y.md`) with:
|
|
117
|
-
- Full citation of both originals
|
|
118
|
-
- Resolution decision + reasoning
|
|
119
|
-
- References both originals in `Supersedes:` field
|
|
120
|
-
6. **Mark originals** as `Status: Superseded by <new-ADR>`. Do not delete or edit beyond the status field — preservation is the invariant per `adr-pattern.md`.
|
|
121
|
-
7. **Update AGENTS.md** (via a new changeset) to reflect the resolved fact.
|
|
122
|
-
|
|
123
|
-
This protocol stays human-in-the-loop. Per the v1.1 Yegge alignment: *artifacts compound, not agents.*
|
|
124
|
-
|
|
125
|
-
## Configuration
|
|
126
|
-
|
|
127
|
-
`.brain/config.toml`:
|
|
128
|
-
|
|
129
|
-
```toml
|
|
130
|
-
[ops-repo.merge]
|
|
131
|
-
adr_naming = "timestamp" # "timestamp" | "sequential" | "hybrid"
|
|
132
|
-
agents_md_changesets = true # require .brain/changesets/ for AGENTS.md edits
|
|
133
|
-
changeset_consolidation = "merge" # "merge" (on merge to main) | "manual" | "release"
|
|
134
|
-
|
|
135
|
-
[ops-repo.merge.conflict_detection]
|
|
136
|
-
llm_on_diff = true # use LLM-on-diff for semantic conflict detection
|
|
137
|
-
llm_on_diff_threshold = "medium" # severity floor for opening blocker PR
|
|
138
|
-
|
|
139
|
-
[ops-repo.merge.supersession]
|
|
140
|
-
require_human_approval = true # cannot be set to false; documented as hard rule
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Anti-patterns
|
|
144
|
-
|
|
145
|
-
- **Auto-resolving semantic conflicts.** The recipe explicitly forbids this. Conflict resolution is a content decision; humans must own it.
|
|
146
|
-
- **Editing AGENTS.md directly when changesets are enabled.** The merge-time job will detect the orphan edits and warn, but discipline matters.
|
|
147
|
-
- **Letting changesets accumulate without consolidation.** Once `.brain/changesets/` has >5 files unconsolidated, the audit emits a finding. Consolidate at least weekly.
|
|
148
|
-
- **Renumbering ADRs after-the-fact** (sequential scheme). Breaks every link to the old number. If you must use sequential, lock the number at PR-merge time, not PR-creation time.
|
|
149
|
-
- **Treating textual merge success as semantic merge success.** Git is a content-addressable store, not a semantic-conflict resolver.
|
|
150
|
-
|
|
151
|
-
## Cross-references
|
|
152
|
-
|
|
153
|
-
- Cold-start harvest (related but distinct: importing existing learnings): `cold-start-harvest.md`
|
|
154
|
-
- Redundancy detection (the conflict-detection trip-wire): `../audit-patterns/redundancy-detection.md`
|
|
155
|
-
- Self-healing hooks (where the scheduled scan runs): `self-healing-hooks.md`
|
|
156
|
-
- Recommend-then-validate (consumer of conflict findings): `recommend-then-validate.md`
|
|
157
|
-
- ADR pattern (supersession invariants): `../doc-types/adr-pattern.md`
|
|
158
|
-
- Audit history ledger (where conflicts get recorded): `../audit-patterns/audit-history-ledger.md`
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2026-04-27
|
|
3
|
-
coverage: canonical
|
|
4
|
-
peers:
|
|
5
|
-
- self-healing-hooks.md
|
|
6
|
-
- ../doc-types/adr-pattern.md
|
|
7
|
-
- ../doc-types/postmortem-pattern.md
|
|
8
|
-
- ../guidance/llm-doc-writing.md
|
|
9
|
-
primary_sources:
|
|
10
|
-
- https://code.claude.com/docs/en/best-practices — Anthropic's iterate pattern
|
|
11
|
-
- https://www.humanlayer.dev/blog/writing-a-good-claude-md
|
|
12
|
-
- https://sre.google/workbook/postmortem-culture/
|
|
13
|
-
status: research-verified
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Continuously-learning loop (delivers Promise 5)
|
|
17
|
-
|
|
18
|
-
> **The premise.** A repo that doesn't learn from each session reverts to its baseline competence every Monday. The continuously-learning loop captures three classes of insight — *agent corrections*, *architectural decisions*, *incident lessons* — at the moment they happen, into structured memory that compounds.
|
|
19
|
-
|
|
20
|
-
## What "continuously-learning" means concretely
|
|
21
|
-
|
|
22
|
-
A continuously-learning repo:
|
|
23
|
-
|
|
24
|
-
1. **AGENTS.md gets smarter every week.** When the agent makes a mistake, the user (or the agent itself) adds a correction. Over weeks, the file converges on what's load-bearing for that repo.
|
|
25
|
-
2. **Architectural decisions get captured at decision time** as ADRs in `.brain/adrs/`, not retroactively reconstructed from PR descriptions six months later.
|
|
26
|
-
3. **Incidents get post-mortems within 1 week.** Blameless. The post-mortem is linked from AGENTS.md's "Memory primitives" section so future agents know to check it.
|
|
27
|
-
4. **The decision log compounds.** A repo with 100 ADRs has more institutional memory than one with 10, *as long as the index stays current and the AGENTS.md pointer stays accurate*.
|
|
28
|
-
|
|
29
|
-
If any of these flows are broken, the repo isn't learning — it's just sitting on a snapshot.
|
|
30
|
-
|
|
31
|
-
## Three flows
|
|
32
|
-
|
|
33
|
-
### Flow 1 — The Anthropic iterate pattern (AGENTS.md corrections)
|
|
34
|
-
|
|
35
|
-
Source: [Anthropic Claude Code best practices](https://code.claude.com/docs/en/best-practices) and [HumanLayer's "Writing a good CLAUDE.md"](https://www.humanlayer.dev/blog/writing-a-good-claude-md).
|
|
36
|
-
|
|
37
|
-
**The mechanism.** When Claude / any LLM coding agent makes a mistake during a session, the user (or the agent itself) adds a one-line correction to AGENTS.md *during that same session*. Examples:
|
|
38
|
-
|
|
39
|
-
```markdown
|
|
40
|
-
# AGENTS.md (...)
|
|
41
|
-
|
|
42
|
-
## Conventions
|
|
43
|
-
|
|
44
|
-
- Tests: use Vitest, not Jest. (Reminder added 2026-04-27 after agent
|
|
45
|
-
reached for Jest config three sessions in a row.)
|
|
46
|
-
- Imports: ESM only. No `require()` in source files.
|
|
47
|
-
- Migration files in `db/migrations/` are append-only — never edit existing
|
|
48
|
-
ones; create a new migration. (Added 2026-03-15 after agent edited
|
|
49
|
-
20260301-create-users.sql.)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The dated parenthetical is critical — it lets the user *delete* the correction six months later when it's clearly load-bearing rather than a one-off.
|
|
53
|
-
|
|
54
|
-
**The audit check.** A healthy AGENTS.md shows evidence of iteration: dated correction notes, recently-added bullet points, occasional pruning. A frozen AGENTS.md (last commit 8 months ago) is a sign the loop isn't running.
|
|
55
|
-
|
|
56
|
-
**The trip-wire (soft).** AGENTS.md modified within the last 90 days for any active repo. If not, the audit emits an advisory finding: "AGENTS.md hasn't been updated in 8 months; either the repo is stable or the iterate-pattern isn't running."
|
|
57
|
-
|
|
58
|
-
**Pitfall.** Teams that *only* add to AGENTS.md and never delete from it grow it past the 200-line ceiling within a year. The token-waste-detection trip-wire (Promise 2) catches this.
|
|
59
|
-
|
|
60
|
-
### Flow 2 — ADR-on-architectural-change
|
|
61
|
-
|
|
62
|
-
**The mechanism.** When a PR introduces an architectural change (new service, framework swap, schema rewrite, performance migration, dependency choice), the PR template requires an ADR to land alongside the code.
|
|
63
|
-
|
|
64
|
-
#### `.github/pull_request_template.md` (excerpt)
|
|
65
|
-
|
|
66
|
-
```markdown
|
|
67
|
-
## What
|
|
68
|
-
|
|
69
|
-
[summary]
|
|
70
|
-
|
|
71
|
-
## Why
|
|
72
|
-
|
|
73
|
-
[motivation]
|
|
74
|
-
|
|
75
|
-
## Architectural impact
|
|
76
|
-
|
|
77
|
-
- [ ] No architectural change (no ADR needed)
|
|
78
|
-
- [ ] Architectural change — ADR added at: `.brain/adrs/NNNN-*.md`
|
|
79
|
-
- [ ] Architectural change — ADR exemption granted by: [name]
|
|
80
|
-
Reason: [why no ADR]
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**The auto-detection.** A pre-merge CI job can flag PRs that touch likely-architectural surfaces (`docs/ARCHITECTURE.md`, top-level config files, `package.json` major-version bumps, new top-level directories) without an accompanying ADR.
|
|
84
|
-
|
|
85
|
-
```yaml
|
|
86
|
-
# .github/workflows/adr-required.yml (excerpt)
|
|
87
|
-
- name: Architectural-impact ADR check
|
|
88
|
-
run: |
|
|
89
|
-
base=origin/${{ github.base_ref }}
|
|
90
|
-
arch_files_changed=$(git diff --name-only $base...HEAD -- \
|
|
91
|
-
'docs/ARCHITECTURE.md' 'package.json' 'pyproject.toml' \
|
|
92
|
-
':(top)*.config.*' ':(top)*.toml' ':(top)Dockerfile*' || true)
|
|
93
|
-
new_adrs=$(git diff --name-only $base...HEAD -- '.brain/adrs/*.md' | grep -c '^' || echo 0)
|
|
94
|
-
if [ -n "$arch_files_changed" ] && [ "$new_adrs" -eq 0 ]; then
|
|
95
|
-
echo "::warning::PR changes likely-architectural files but adds no ADR. Verify exemption box is ticked."
|
|
96
|
-
fi
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**The trip-wire.** `.brain/adrs/` should grow over time at a rate consistent with the repo's architectural-change rate. A 5-year-old repo with 2 ADRs is suspicious — either the team's not capturing decisions or they're capturing them somewhere else (PR descriptions, Slack, code comments). The audit flags repos with `<1 ADR per year of repo age` for `>1 year` repos.
|
|
100
|
-
|
|
101
|
-
### Flow 3 — Postmortem-on-incident
|
|
102
|
-
|
|
103
|
-
**The mechanism.** Within 1 week of a SEV-1 or SEV-2 incident, a blameless post-mortem lands in `.brain/postmortems/YYYY-MM-DD-name.md`. See `../doc-types/postmortem-pattern.md` for the template.
|
|
104
|
-
|
|
105
|
-
The flow itself runs *outside* the repo (incident response, retrospective meeting, write-up) — but the *artifact* lands in the repo and gets indexed.
|
|
106
|
-
|
|
107
|
-
**The trip-wire.** If the repo has had production incidents (heuristic: search `git log` for `revert`, `hotfix`, `incident`, `outage`, `rollback`) but `.brain/postmortems/` is empty, the audit flags it. False positives are fine — the prompt to write a post-mortem is the value.
|
|
108
|
-
|
|
109
|
-
## How AGENTS.md should expose the memory primitives
|
|
110
|
-
|
|
111
|
-
The "Memory primitives" section of AGENTS.md tells the agent *when to read* each memory type. Without this, the agent doesn't know to consult ADRs before architectural changes or post-mortems before debugging.
|
|
112
|
-
|
|
113
|
-
```markdown
|
|
114
|
-
## Memory primitives
|
|
115
|
-
|
|
116
|
-
- **Before architectural changes**, read `.brain/adrs/` newest-first. If
|
|
117
|
-
your proposed change conflicts with an `Accepted` ADR, write a new ADR
|
|
118
|
-
superseding it; don't silently override.
|
|
119
|
-
|
|
120
|
-
- **When debugging a production issue**, search `.brain/postmortems/` for
|
|
121
|
-
prior occurrences. Many "new" bugs are repeats.
|
|
122
|
-
|
|
123
|
-
- **When you make a mistake the user has to correct**, ask: "Should I add
|
|
124
|
-
this to AGENTS.md so I don't repeat it?" Most of the time the answer
|
|
125
|
-
is yes. Add a one-line correction with a dated parenthetical.
|
|
126
|
-
|
|
127
|
-
- **When a runbook is needed for a recurring operation**, file it in
|
|
128
|
-
`.brain/runbooks/` rather than embedding it in AGENTS.md.
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
This section is what makes the loop *closed* — without it, the artifacts exist in the repo but the agent doesn't know to consult them.
|
|
132
|
-
|
|
133
|
-
## The compounding effect (why this matters more over time)
|
|
134
|
-
|
|
135
|
-
Year 1: AGENTS.md is small, ADRs are 5-10, post-mortems are 1-2.
|
|
136
|
-
|
|
137
|
-
Year 3: AGENTS.md is still ~150 lines (because the iterate pattern includes pruning), ADRs are 30-40 (mostly historical, some active), post-mortems are 8-15. The repo has *learned* what its actual gotchas are.
|
|
138
|
-
|
|
139
|
-
Year 5: An LLM agent dropped into this repo for the first time has access to 5 years of explicit institutional memory in a navigable format. That's the compound interest.
|
|
140
|
-
|
|
141
|
-
The opposite case: AGENTS.md was written once 5 years ago, never updated. ADRs don't exist. Post-mortems live in Slack. An agent dropped into this repo has no advantage over an agent dropped into any random repo.
|
|
142
|
-
|
|
143
|
-
## Verification — what the audit checks
|
|
144
|
-
|
|
145
|
-
| Flow | Check | Severity if missing |
|
|
146
|
-
|---|---|---|
|
|
147
|
-
| Iterate AGENTS.md | AGENTS.md last-modified date < 90 days for active repos (heuristic: repo has commits in last 90 days) | Advisory |
|
|
148
|
-
| ADR-on-architectural-change | `.brain/adrs/` exists and contains ≥1 ADR per year of repo age (rough heuristic) | Medium |
|
|
149
|
-
| ADR PR template | `.github/pull_request_template.md` includes architectural-impact checkbox | Low |
|
|
150
|
-
| Postmortem-on-incident | If `git log` has incident-shaped commits, `.brain/postmortems/` is non-empty | Medium |
|
|
151
|
-
| AGENTS.md "Memory primitives" section | Section exists and points to ADRs + postmortems | High (closes the loop) |
|
|
152
|
-
|
|
153
|
-
A repo can pass all the *self-healing* checks (Promise 4) and still fail *continuously-learning* (Promise 5) — they're orthogonal. The hooks keep the surface clean; the loop makes it grow smarter.
|
|
154
|
-
|
|
155
|
-
## Common anti-patterns
|
|
156
|
-
|
|
157
|
-
- **AGENTS.md is in `Proposed` status forever** — corrections never get accepted into the canonical file. Loop is broken at the merge step.
|
|
158
|
-
- **ADRs in PR descriptions** — they don't compound; nobody can find them. Move into `.brain/adrs/`.
|
|
159
|
-
- **Post-mortems in private docs (Notion, Confluence)** — unreachable from the agent. Either move to `.brain/postmortems/` or link aggressively from AGENTS.md.
|
|
160
|
-
- **Memory primitives section missing from AGENTS.md** — artifacts exist, agent never reads them. Single most common loop break.
|
|
161
|
-
- **Post-mortems blame individuals** — chills future post-mortem candor. Audit the *language*, not just existence.
|
|
162
|
-
|
|
163
|
-
## Cross-references
|
|
164
|
-
|
|
165
|
-
- Self-healing hooks (Promise 4 — keeps the surface clean): `self-healing-hooks.md`
|
|
166
|
-
- ADR pattern: `../doc-types/adr-pattern.md`
|
|
167
|
-
- Post-mortem pattern: `../doc-types/postmortem-pattern.md`
|
|
168
|
-
- LLM-doc-writing guidance (length / iteration): `../guidance/llm-doc-writing.md`
|
|
169
|
-
- AGENTS.md spec: `../standards/agents-md-spec.md`
|