@tyroneross/build-loop 0.30.3 → 0.35.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/.agents/plugins/marketplace.json +2 -2
- package/.claude-plugin/marketplace.json +4 -4
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +11 -2
- package/README.md +8 -7
- package/agents/advisor.md +111 -0
- package/agents/alignment-checker.md +11 -0
- package/agents/assessment-orchestrator.md +1 -1
- package/agents/build-orchestrator.md +28 -33
- package/agents/fact-checker.md +1 -1
- package/agents/fix-critique.md +1 -1
- package/agents/independent-auditor.md +1 -1
- package/agents/overfitting-reviewer.md +1 -1
- package/agents/plan-critic.md +8 -6
- package/agents/promotion-reviewer.md +1 -1
- package/agents/retrospective-synthesizer.md +20 -3
- package/agents/scope-auditor.md +1 -1
- package/agents/security-reviewer.md +1 -1
- package/agents/self-improvement-architect.md +1 -1
- package/commands/{handoff.md → compose-handoff.md} +4 -4
- package/commands/{optimize.md → optimize-run.md} +1 -1
- package/commands/{agent-rally-point.md → rally-point.md} +3 -3
- package/commands/{research.md → research-run.md} +1 -1
- package/commands/setup-memory.md +32 -0
- package/commands/{plan-verify.md → verify-plan.md} +1 -1
- package/docs/agent-surface-policy.md +38 -20
- package/docs/memory-setup.md +19 -14
- package/hooks/_resolve_python.sh +28 -0
- package/hooks/closeout.sh +58 -0
- package/hooks/git/pre-push +69 -6
- package/hooks/hooks.json +34 -13
- package/hooks/post-push-closeout.sh +73 -0
- package/hooks/session-start-closeout.sh +69 -0
- package/hooks/session-start-memory.sh +27 -0
- package/hooks/session-start-plugin-heal.sh +33 -0
- package/hooks/test_closeout.sh +124 -0
- package/package.json +7 -4
- package/plugin-artifacts/codex/.codex-plugin/plugin.json +41 -0
- package/plugin-artifacts/codex/AGENTS.md +507 -0
- package/plugin-artifacts/codex/BUILD-ARTIFACT.md +5 -0
- package/plugin-artifacts/codex/LICENSE +202 -0
- package/plugin-artifacts/codex/README.md +404 -0
- package/plugin-artifacts/codex/docs/agent-surface-policy.md +63 -0
- package/plugin-artifacts/codex/references/advisor-dispatch-ladder.md +62 -0
- package/plugin-artifacts/codex/references/agent-role-taxonomy.md +135 -0
- package/plugin-artifacts/codex/references/autonomous-and-per-commit-modes.md +161 -0
- package/plugin-artifacts/codex/references/autonomy-config.md +231 -0
- package/plugin-artifacts/codex/references/capability-routing.md +182 -0
- package/plugin-artifacts/codex/references/codex-subagents.md +106 -0
- package/plugin-artifacts/codex/references/coordination-file-template.md +181 -0
- package/plugin-artifacts/codex/references/coordination-rules.md +283 -0
- package/plugin-artifacts/codex/references/dogfood-reload-checkpoint.md +112 -0
- package/plugin-artifacts/codex/references/halt-and-ask-protocol.md +102 -0
- package/plugin-artifacts/codex/references/implementer-envelope-schema.md +302 -0
- package/plugin-artifacts/codex/references/intent-capability-pack.md +257 -0
- package/plugin-artifacts/codex/references/intent-exploration-prompts.md +96 -0
- package/plugin-artifacts/codex/references/leadership.md +72 -0
- package/plugin-artifacts/codex/references/memory-systems.md +238 -0
- package/plugin-artifacts/codex/references/memory.md +299 -0
- package/plugin-artifacts/codex/references/model-tier-mapping.md +257 -0
- package/plugin-artifacts/codex/references/modular-systems-pack.md +96 -0
- package/plugin-artifacts/codex/references/phase-1-assess.md +231 -0
- package/plugin-artifacts/codex/references/phase-2-plan.md +78 -0
- package/plugin-artifacts/codex/references/phase-3-execute.md +49 -0
- package/plugin-artifacts/codex/references/phase-4-review.md +322 -0
- package/plugin-artifacts/codex/references/phase-5-iterate.md +71 -0
- package/plugin-artifacts/codex/references/phase-6-learn.md +56 -0
- package/plugin-artifacts/codex/references/recent-design-structures.md +274 -0
- package/plugin-artifacts/codex/references/research-trigger-policy.md +140 -0
- package/plugin-artifacts/codex/references/runtime-smoke-triggers.md +42 -0
- package/plugin-artifacts/codex/references/self-review.md +234 -0
- package/plugin-artifacts/codex/references/single-writer-commit-protocol.md +90 -0
- package/plugin-artifacts/codex/references/task-capture-policy.md +68 -0
- package/plugin-artifacts/codex/references/ui-io-contract.md +116 -0
- package/plugin-artifacts/codex/references/ui-spotcheck-protocol.md +65 -0
- package/plugin-artifacts/codex/skills/build-loop/SKILL.md +372 -0
- package/plugin-artifacts/codex/skills/build-loop/detect-plugins.mjs +82 -0
- package/plugin-artifacts/codex/skills/build-loop/eval-guide.md +65 -0
- package/plugin-artifacts/codex/skills/build-loop/fallbacks.md +549 -0
- package/plugin-artifacts/codex/skills/build-loop/phases/fact-check.md +42 -0
- package/plugin-artifacts/codex/skills/build-loop/phases/ui-validation.md +267 -0
- package/plugin-artifacts/codex/skills/build-loop/references/advisor-dispatch-ladder.md +62 -0
- package/plugin-artifacts/codex/skills/build-loop/references/apple-native-planning.md +439 -0
- package/plugin-artifacts/codex/skills/build-loop/references/autonomous-and-per-commit-modes.md +161 -0
- package/plugin-artifacts/codex/skills/build-loop/references/capability-routing.md +182 -0
- package/plugin-artifacts/codex/skills/build-loop/references/codex-subagents.md +106 -0
- package/plugin-artifacts/codex/skills/build-loop/references/coordination.md +161 -0
- package/plugin-artifacts/codex/skills/build-loop/references/correction-aware-capture.md +177 -0
- package/plugin-artifacts/codex/skills/build-loop/references/independent-auditor.md +72 -0
- package/plugin-artifacts/codex/skills/build-loop/references/intent-capability-pack.md +257 -0
- package/plugin-artifacts/codex/skills/build-loop/references/intent-exploration-prompts.md +96 -0
- package/plugin-artifacts/codex/skills/build-loop/references/leadership.md +72 -0
- package/plugin-artifacts/codex/skills/build-loop/references/memory.md +299 -0
- package/plugin-artifacts/codex/skills/build-loop/references/modular-systems-pack.md +96 -0
- package/plugin-artifacts/codex/skills/build-loop/references/output-style.md +129 -0
- package/plugin-artifacts/codex/skills/build-loop/references/pay-it-forward-arch.md +98 -0
- package/plugin-artifacts/codex/skills/build-loop/references/phase-1-assess.md +231 -0
- package/plugin-artifacts/codex/skills/build-loop/references/phase-2-plan.md +78 -0
- package/plugin-artifacts/codex/skills/build-loop/references/phase-3-execute.md +49 -0
- package/plugin-artifacts/codex/skills/build-loop/references/phase-4-review.md +322 -0
- package/plugin-artifacts/codex/skills/build-loop/references/phase-5-iterate.md +71 -0
- package/plugin-artifacts/codex/skills/build-loop/references/phase-6-learn.md +56 -0
- package/plugin-artifacts/codex/skills/build-loop/references/recent-design-structures.md +274 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/ASSESSMENT.md +85 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/STANDALONE_TEST_RUN.md +149 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/01-simple-bugfix.md +32 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/02-ui-build-with-iteration.md +48 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/03-multi-failure-escalation.md +60 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/04-ui-build-ibr-absent.md +51 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/05-refactor-navgator-absent.md +71 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/06-recurring-bug-debugger-absent.md +52 -0
- package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/trace-comparison.md +202 -0
- package/plugin-artifacts/codex/skills/build-loop/references/self-recursive-dev.md +77 -0
- package/plugin-artifacts/codex/skills/build-loop/references/self-review.md +234 -0
- package/plugin-artifacts/codex/skills/build-loop/references/ui-io-contract.md +116 -0
- package/plugin-artifacts/codex/skills/build-loop/scanners/audit-design-rules.mjs +476 -0
- package/plugin-artifacts/codex/skills/build-loop/scanners/require-visual-evidence.mjs +239 -0
- package/plugin-artifacts/codex/skills/build-loop/templates/backlog-item.md +35 -0
- package/plugin-artifacts/codex/skills/build-loop/templates/codex-worker-prompt.md +100 -0
- package/plugin-artifacts/codex/skills/build-loop/templates/ui-subagent-prompt.md +179 -0
- package/plugin-artifacts/codex/skills/build-loop/templates/ux-fix-plan.md +40 -0
- package/scripts/_paths.py +59 -13
- package/scripts/build_codex_plugin_artifact.py +314 -0
- package/scripts/check_cache_sync.py +1 -1
- package/scripts/install_memory.py +11 -3
- package/scripts/prune_plugin_cache.py +225 -11
- package/scripts/sync_navgator_lessons.py +25 -0
- package/scripts/sync_plugin_cache.py +66 -36
- package/skills/agent-rally-point/SKILL.md +1 -1
- package/skills/agent-rally-watcher/SKILL.md +1 -1
- package/skills/build-loop/SKILL.md +11 -155
- package/skills/build-loop/references/advisor-dispatch-ladder.md +62 -0
- package/skills/build-loop/references/autonomous-and-per-commit-modes.md +161 -0
- package/skills/build-loop/references/capability-routing.md +4 -3
- package/skills/build-loop/references/codex-subagents.md +8 -0
- package/skills/build-loop/references/coordination.md +1 -1
- package/skills/build-loop/references/intent-capability-pack.md +88 -1
- package/skills/build-loop/references/memory.md +17 -2
- package/skills/build-loop/references/phase-1-assess.md +13 -0
- package/skills/build-loop/references/phase-2-plan.md +2 -1
- package/skills/build-loop/references/phase-3-execute.md +4 -2
- package/skills/build-loop/references/phase-4-review.md +12 -0
- package/skills/build-loop/references/phase-6-learn.md +1 -1
- package/skills/build-loop/references/self-review.md +4 -2
- package/skills/build-loop/templates/codex-worker-prompt.md +45 -34
- package/skills/handoff/SKILL.md +3 -3
- package/skills/loop-builder/SKILL.md +98 -0
- package/skills/loop-builder/presets/active-project-evidence.yaml +97 -0
- package/skills/loop-builder/presets/generic-artifact-loop.yaml +95 -0
- package/skills/loop-builder/presets/presentation-audit.yaml +96 -0
- package/skills/loop-builder/presets/research-synthesis.yaml +96 -0
- package/skills/loop-builder/presets/source-ingestion-raw-data-audit.yaml +96 -0
- package/skills/loop-builder/references/spec-format.md +80 -0
- package/skills/loop-builder/scripts/loop_builder.py +346 -0
- package/skills/model-tiering/SKILL.md +65 -40
- package/skills/optimize/SKILL.md +2 -2
- package/skills/plan-verify/SKILL.md +1 -1
- package/skills/plugin-builder/references/distribution.md +8 -0
- package/skills/research/SKILL.md +33 -6
- package/skills/runtime-parity-verification/SKILL.md +51 -0
- package/skills/spec-writing/SKILL.md +19 -0
- package/templates/memory/README.md +65 -0
- package/templates/memory/charter.md.template +46 -0
- package/templates/memory/manifest.json +24 -4
- package/codex-skills/debug-loop/SKILL.md +0 -18
- package/codex-skills/handoff/SKILL.md +0 -22
- package/codex-skills/knowledge/SKILL.md +0 -21
- package/codex-skills/optimize/SKILL.md +0 -18
- package/codex-skills/research/SKILL.md +0 -18
- /package/commands/{knowledge-review.md → review-knowledge.md} +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# Memory — Global and Project-Scoped (full protocol)
|
|
4
|
+
|
|
5
|
+
> Loaded from `skills/build-loop/SKILL.md` summary. Contains the full memory system: global vs project stores, routing rules, and read/write policies.
|
|
6
|
+
|
|
7
|
+
## Memory — Global and Project-Scoped
|
|
8
|
+
|
|
9
|
+
Build-loop maintains one canonical long-term memory store at `~/dev/git-folder/build-loop-memory/`. Every build reads canonical indexes/folders; writes go to exactly one lane based on scope.
|
|
10
|
+
|
|
11
|
+
### Recall-optimized memory discipline
|
|
12
|
+
|
|
13
|
+
Canonical reference: `build-loop-memory/references/2026-06-11-memory-discipline-prompt.md` (`version: 2026-06-11.1`). Apply it to every non-trivial memory-relevant read or write.
|
|
14
|
+
|
|
15
|
+
Operational contract:
|
|
16
|
+
|
|
17
|
+
- Recall first for significant repo work, debugging, planning, and any memory write. Read the store-root `INDEX.md` first, then project context such as `projects/<slug>/context/CONTEXT.md` and generated `CURRENT.*`, plus `constitution.md` / `MEMORY.md` where present. Search `indexes/INDEX.jsonl`, scan `chronology.jsonl`, read the matching lane, and verify any remembered file/flag/API/script still exists before relying on it.
|
|
18
|
+
- Write only durable facts that aid future recall: decisions + rationale, lessons, reusable references, gotchas, experiment results, product opportunities, and durable operational patterns. Do not write restated code, git-derivable facts, transient status, or handoff-only state.
|
|
19
|
+
- Before writing, search `indexes/INDEX.jsonl` for an existing slug/title, update instead of duplicating, then check `indexes/duplicates.jsonl` after indexing. Use title and `description` as the recall hooks.
|
|
20
|
+
- Do not hand-write project decisions. Use `scripts/write_decision/__main__.py`; it writes the decision lane and updates that lane's `INDEX.md` / update ledger. Generated master-index reachability is still incomplete for new `projects/<slug>/decisions/` files, so verify decisions through `memory_facade` or the decision lane until the scanner/map split is reconciled.
|
|
21
|
+
- Current reference gap: `memory_writer.py` has `research` as a project sublane but not `references`; `reference_capture` writes to `projects/<slug>/research/`, while `build-loop-memory/scripts/rebuild_memory_indexes.py` scans `references/` and not `research/`. For generated-index recall today, write `type: reference` content under `projects/<slug>/lessons/references/`, or update both writer and indexer to agree on `references` or `research`.
|
|
22
|
+
- After any memory write, run the relevant host index/check step when mutation is in scope and verify the entry is reachable from the proper recall surface: `INDEX.jsonl` for generated-index lanes, decision lane/index or `memory_facade` for decisions, or the host system's equivalent.
|
|
23
|
+
|
|
24
|
+
**Cross-project memory**: `build-loop-memory/lessons/` plus the sibling top-level lanes `design/`, `debugging/`, and `product/`
|
|
25
|
+
|
|
26
|
+
- Applies across every project this user builds.
|
|
27
|
+
- Examples: "Deployment to Vercel uses `vercel deploy --prebuilt` when `ENABLE_AUTH=true`"; "Neon is the default Postgres for Next.js 16 projects"; "TestFlight upload uses ASC API key from `~/.appstoreconnect/private_keys/`"; "User prefers zero-dep scripts over package additions".
|
|
28
|
+
- Structure: one file per fact/lesson/tool-discovery. Generated recall indexes live in `build-loop-memory/indexes/`.
|
|
29
|
+
- Types: `tool`, `deployment`, `library-choice`, `user-preference`, `pattern`.
|
|
30
|
+
|
|
31
|
+
**Project memory**: `build-loop-memory/projects/<slug>/` (slug derived via `scripts/_paths.derive_slug_from_cwd`)
|
|
32
|
+
|
|
33
|
+
- Applies only to the current project.
|
|
34
|
+
- Examples: "This app's design system lives in `src/styles/tokens.css`, not Tailwind"; "Routes under `/admin/` require `requireAdmin()` guard"; "The `custom_themes` table has a user_id VarChar bug from 2026-04-13 — see migration note".
|
|
35
|
+
- Same lane structure as top level: `decisions/`, `lessons/`, `debugging/`, `design/`, `product/`, and related domain folders.
|
|
36
|
+
- Types: `design`, `convention`, `gotcha`, `decision`, `contract`.
|
|
37
|
+
|
|
38
|
+
### Routing rule (always ask this question)
|
|
39
|
+
|
|
40
|
+
**"Would this apply to a different project?"**
|
|
41
|
+
|
|
42
|
+
- **Yes** → top-level canonical lane (`build-loop-memory/lessons/`, `design/`, `debugging/`, or `product/`). Deployment tools, library choices, general user preferences, reusable patterns.
|
|
43
|
+
- **No** → project canonical lane (`build-loop-memory/projects/<slug>/...`). Design tokens, internal APIs, project-specific gotchas, per-repo conventions.
|
|
44
|
+
- **Ambiguous** → ask the user once, then save. Don't guess.
|
|
45
|
+
|
|
46
|
+
### Artifact lanes & segmentation (issues / backlog / lessons)
|
|
47
|
+
|
|
48
|
+
Three work/knowledge artifact types, each with a clear WRITE → READ → TRACK lane. **Every lane is repo-segmented; the segmentation is mechanical, not discretionary** — so work on repo X never reads or writes repo Y's items.
|
|
49
|
+
|
|
50
|
+
| Artifact | Write (where) | Read / Track | Lifetime |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| **issues** | `<repo>/.build-loop/issues/<id>.md` — current-run bugs | Phase 5 Iterate drains them; repo-local so inherently scoped | short-lived (resolve → delete) |
|
|
53
|
+
| **backlog** | durable: `build-loop-memory/projects/<slug>/backlog.md` (slug folder = repo scope); active: `<repo>/.build-loop/backlog/<id>.md` | read before planning self-work; Phase 5 drains active items | long-lived |
|
|
54
|
+
| **backlog-archive** | `build-loop-memory/projects/<slug>/backlog-archive.md` | closed/moved/superseded items land here **with rationale + ref** — never deleted silently | durable |
|
|
55
|
+
| **lessons** | `projects/<slug>/lessons/` (project) OR top-level `lessons/` (cross-project, stored `_unscoped`) — via `memory_writer.py` | `context_bootstrap` recall scopes to `(slug OR _unscoped)` — never other projects | durable |
|
|
56
|
+
|
|
57
|
+
**Segmentation contract (binding):**
|
|
58
|
+
- The **slug folder** (`projects/<slug>/`) is the repo key; the **`repo` + `branch` frontmatter** on each issue/backlog item is the explicit scope tag (template: `templates/backlog-item.md`). Both must agree.
|
|
59
|
+
- When working repo X on branch B, **read and write only** items where `repo == X` (and `branch == B` or unscoped). A cross-repo item discovered mid-work is recorded in **its** repo's scope, **never** the current repo's tracker.
|
|
60
|
+
- **No shared/freeform cross-repo trackers.** (The retired `OPEN-ITEMS.md` was exactly this anti-pattern — one file that accreted rows from unrelated app repos into build-loop's scope. Replaced by the slug-segmented `projects/<slug>/backlog.md`.)
|
|
61
|
+
- Reads are already enforced: `context_bootstrap` queue reads are repo-local `.build-loop/`, and lessons recall passes the resolved `project` so the query scopes to `(project OR _unscoped)` — `project=None` (all-projects) is never used for current-work context.
|
|
62
|
+
|
|
63
|
+
### When to write memory
|
|
64
|
+
|
|
65
|
+
- User states a preference or convention: save immediately.
|
|
66
|
+
- A build surfaces a new tool/library/deployment pattern worth reusing: save after Review-F.
|
|
67
|
+
- A project-specific gotcha or decision emerges: save during Review-F Report.
|
|
68
|
+
- Do NOT save: ephemeral task details, things already derivable from code or git log, state that changes per build.
|
|
69
|
+
|
|
70
|
+
### When to read memory
|
|
71
|
+
|
|
72
|
+
- Always during Phase 1 ASSESS.
|
|
73
|
+
- Before deploying: check global deployment memory.
|
|
74
|
+
- Before UI work: check project design memory.
|
|
75
|
+
- Before adopting a new library: check global library-choice memory.
|
|
76
|
+
|
|
77
|
+
## Cross-session memory propagation + provenance schema (multi-process / multi-host)
|
|
78
|
+
|
|
79
|
+
Multiple build-loop sessions can run concurrently. Two scripts own the cross-session model end-to-end:
|
|
80
|
+
|
|
81
|
+
- `scripts/memory_writer.py` — canonical WRITER. Adds provenance frontmatter and appends to the index in one atomic operation.
|
|
82
|
+
- `scripts/memory_index.py` — append-only discovery log in the selected canonical lane.
|
|
83
|
+
- `scripts/memory_update_ledger.py` — global append-only audit/freshness log for the whole configured memory root.
|
|
84
|
+
|
|
85
|
+
### Provenance frontmatter (every memory file)
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
---
|
|
89
|
+
name: <slug>
|
|
90
|
+
description: <one-line summary>
|
|
91
|
+
type: tool | deployment | library-choice | user-preference | pattern | feedback | reference | design | convention | gotcha | decision | contract
|
|
92
|
+
source_repo: "<git remote url or null>"
|
|
93
|
+
source_workdir: "<abs path>"
|
|
94
|
+
source_run_id: "run_<UTC>_<hash>"
|
|
95
|
+
source_host: "claude_code | codex | gemini | other"
|
|
96
|
+
cross_repo_validated: false # flips to true once a DIFFERENT repo applies it
|
|
97
|
+
applied_in_repos: [] # appended entries: {repo, workdir, run_id, applied_at}
|
|
98
|
+
created_at: "ISO8601 UTC"
|
|
99
|
+
last_updated_at: "ISO8601 UTC"
|
|
100
|
+
---
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Writer side — use the canonical writer for normal memory writes
|
|
104
|
+
|
|
105
|
+
**Top-level (cross-project) write** — `--scope top-level` routes to `build-loop-memory/lessons/` (or a sibling lane when `--file <lane>/x.md` is used):
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py \
|
|
109
|
+
--scope top-level \
|
|
110
|
+
write \
|
|
111
|
+
--file "<rel-path>" \
|
|
112
|
+
--name "<slug>" \
|
|
113
|
+
--description "<one-line>" \
|
|
114
|
+
--type feedback \
|
|
115
|
+
--run-id "$RUN_ID" \
|
|
116
|
+
--workdir "$PWD" \
|
|
117
|
+
--host claude_code \
|
|
118
|
+
--body-file /tmp/memory-body.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Project-scoped write** — `--scope project --project <slug>` routes to `build-loop-memory/projects/<slug>/lessons/` (or a sublane when `--file <sublane>/x.md` is used):
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py \
|
|
125
|
+
--scope project --project "$PROJECT_SLUG" \
|
|
126
|
+
write \
|
|
127
|
+
--file "<rel-path>" \
|
|
128
|
+
--name "<slug>" \
|
|
129
|
+
--description "<one-line>" \
|
|
130
|
+
--type gotcha \
|
|
131
|
+
--run-id "$RUN_ID" \
|
|
132
|
+
--workdir "$PWD" \
|
|
133
|
+
--host claude_code \
|
|
134
|
+
--body-file /tmp/memory-body.md
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The writer auto-detects `source_repo` from the workdir's git remote, appends a row to the lane-local `INDEX.jsonl`, appends a row to the global update ledger at `indexes/updates.jsonl`, and (on update) preserves `created_at` + `applied_in_repos` so cross-repo validation history survives edits. Direct writes are repair/fallback work only: use them only when no canonical writer exists or the current task is explicitly a memory-system repair, then run the host index/check step and verify reachability.
|
|
138
|
+
|
|
139
|
+
### Reader side — surface peer writes via INDEX.jsonl
|
|
140
|
+
|
|
141
|
+
Between phases (or at every M2 heartbeat), tail since your last check:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_index.py tail \
|
|
145
|
+
--since "$LAST_INDEX_CHECK_TS" \
|
|
146
|
+
--exclude-run-id "$RUN_ID" \
|
|
147
|
+
--json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For each row:
|
|
151
|
+
1. Read the underlying memory file.
|
|
152
|
+
2. If `source_workdir` ≠ this `$PWD` AND `source_repo` ≠ this repo's git remote — tag `[CROSS-REPO — requires scrutiny]` in the phase brief.
|
|
153
|
+
3. Surface to the user with the memory's `description` field as the hook.
|
|
154
|
+
|
|
155
|
+
### Store side — global update ledger
|
|
156
|
+
|
|
157
|
+
Every canonical memory mutation should also append one JSONL row to:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
<memory-root>/indexes/updates.jsonl
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This is the store-wide ledger. It is not a replacement for lane-local `INDEX.jsonl`; the two logs have different jobs:
|
|
164
|
+
|
|
165
|
+
| Log | Scope | Primary job |
|
|
166
|
+
|---|---|---|
|
|
167
|
+
| `<lane>/INDEX.jsonl` | One memory lane | Peer discovery inside that lane |
|
|
168
|
+
| `indexes/updates.jsonl` | Whole memory root | Audit trail, freshness baseline, repair inventory |
|
|
169
|
+
|
|
170
|
+
Row schema:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"ts": "2026-06-01T12:00:00Z",
|
|
175
|
+
"schema_version": 1,
|
|
176
|
+
"event_id": "<sha256-prefix>",
|
|
177
|
+
"project": "build-loop",
|
|
178
|
+
"lane": "decisions",
|
|
179
|
+
"action": "write",
|
|
180
|
+
"path": "projects/build-loop/decisions/0001-example.md",
|
|
181
|
+
"writer": "write_decision.py",
|
|
182
|
+
"run_id": "run_...",
|
|
183
|
+
"source_repo": "<git remote or omitted>",
|
|
184
|
+
"source_workdir": "<absolute workdir or omitted>",
|
|
185
|
+
"source_commit": "<repo HEAD represented by this memory update>",
|
|
186
|
+
"source_host": "codex",
|
|
187
|
+
"memory_id": "0001",
|
|
188
|
+
"summary": "Short human hook",
|
|
189
|
+
"sha256": "<content hash when available>",
|
|
190
|
+
"metadata": {}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`memory_writer.py`, `write_decision.py`, and `append_milestone.py` emit this ledger row automatically. Direct writes to memory files should be treated as legacy or repair work because they bypass provenance, discovery, and freshness.
|
|
195
|
+
|
|
196
|
+
CLI:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_update_ledger.py tail \
|
|
200
|
+
--project "$PROJECT_SLUG" \
|
|
201
|
+
--limit 20 \
|
|
202
|
+
--json
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Trust gradient — mark-applied flow
|
|
206
|
+
|
|
207
|
+
When a memory written elsewhere is successfully applied in the current repo, record it:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py mark-applied \
|
|
211
|
+
--file "<rel-path>" \
|
|
212
|
+
--applying-repo "$THIS_REPO_REMOTE" \
|
|
213
|
+
--applying-workdir "$PWD" \
|
|
214
|
+
--applying-run-id "$RUN_ID"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Appends to `applied_in_repos[]` (deduped by `(repo, workdir)`) and flips `cross_repo_validated` to `true` once at least one applying repo differs from the source. Memories with `cross_repo_validated: true` AND `len(applied_in_repos) >= 2` have earned higher trust — independently verified to hold across distinct repos. Surface that distinction in Phase 1 Assess briefs as `[VALIDATED — applied in N repos]`.
|
|
218
|
+
|
|
219
|
+
### Migration — existing memory files
|
|
220
|
+
|
|
221
|
+
`memory_writer.py migrate` is an idempotent backfill that adds provenance frontmatter to existing memory files. Safe to re-run; skips any file that already has all required provenance keys.
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py migrate \
|
|
225
|
+
--run-id "$RUN_ID" \
|
|
226
|
+
--workdir "$PWD" \
|
|
227
|
+
--host claude_code \
|
|
228
|
+
--dry-run # inspect first; remove the flag to apply
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Run once after this version of build-loop is installed; the migration completes immediately for memory dirs of ordinary size (the user's global memory at ~80 files migrates in well under a second).
|
|
232
|
+
|
|
233
|
+
### Concurrency
|
|
234
|
+
|
|
235
|
+
- `memory_writer.py write` — atomic tmpfile + os.replace; the memory file IS the lock.
|
|
236
|
+
- `memory_index.py append` — `fcntl.flock(LOCK_EX)` on `INDEX.jsonl.lock`; multi-writer safe across hosts.
|
|
237
|
+
- `memory_update_ledger.py append` — `fcntl.flock(LOCK_EX)` on `updates.jsonl.lock`; append-only and multi-writer safe.
|
|
238
|
+
|
|
239
|
+
## Append-only milestones (anti-rewrite-drift)
|
|
240
|
+
|
|
241
|
+
### The problem this solves
|
|
242
|
+
|
|
243
|
+
"Current state" files that are rewritten in place rot: the writer overwrites without fully reading, summaries drift from reality, and no one can tell which run produced a given snapshot. The fix is append-only by construction — a log that can only grow forward.
|
|
244
|
+
|
|
245
|
+
### What gets appended and when
|
|
246
|
+
|
|
247
|
+
Every build-loop run appends a single milestone record at **Review-G** via `scripts/append_milestone.py`. Each record captures what shipped and the repo HEAD sha at write time.
|
|
248
|
+
|
|
249
|
+
The milestone (durable `milestones.jsonl` in build-loop-memory) is **distinct from** `state.json.runs[]`, which Phase 6 Learn scans for pain signals. The orchestrator's Review-G writes both; an **inline run or the closeout** writes neither unless it calls them explicitly. So at run-close, in addition to the milestone, record the run for Learn with `python3 scripts/append_run.py --workdir "$PWD" --run-id <id> --goal "..." --outcome <done|partial|blocked>` (append-only, idempotent on `run_id`; capture `--manual-intervention "<phase>:<note>"` for any step the user had to re-prompt). Without it, inline work never reaches the `runs[] >= 3` Learn threshold. See `references/phase-6-learn.md` §Detect.
|
|
250
|
+
|
|
251
|
+
JSONL contract (frozen — sibling staleness-check reads this):
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
<memory-root>/projects/<slug>/milestones.jsonl
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Each line:
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{"ts": "2026-05-30T12:00:00Z", "commit": "<sha>", "repo": "<dir-name>", "summary": "<what shipped>", "run_id": "<id|null>"}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### How to append
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/append_milestone.py \
|
|
267
|
+
--workdir "$PWD" \
|
|
268
|
+
--summary "feat: shipped auth + dashboard" \
|
|
269
|
+
--run-id "$RUN_ID" \
|
|
270
|
+
--json
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
`--commit` and `--project` override the defaults (git HEAD and slug derived from `--workdir`). `--memory-root` overrides the default `~/dev/git-folder/build-loop-memory`.
|
|
274
|
+
|
|
275
|
+
Output: `{"appended": true, "path": "...", "line": "..."}` on success; `{"appended": false, "reason": "..."}` on fail-soft (non-git workdir, unwritable root). Exit 0 in both cases.
|
|
276
|
+
|
|
277
|
+
Idempotency: if the last line already has the same `commit` AND `summary`, the call is a no-op. Safe to re-run on retry.
|
|
278
|
+
|
|
279
|
+
### The core principle: pointer not duplicate
|
|
280
|
+
|
|
281
|
+
The milestone log is the **durable, never-rewritten** record of project progress. Other memory files (`lessons/`, `decisions/`, etc.) remain the authoritative content store. The milestone is a pointer — "at this commit, this run shipped this" — not a duplicated copy of their content.
|
|
282
|
+
|
|
283
|
+
> The rewrite-in-place pattern is what rots. Append-only logs + pointers resist drift by construction: you can always `tail` to see the latest state, `grep` to find when something shipped, and the sibling staleness-check can compare the latest milestone commit against the current HEAD to detect stale memory instantly.
|
|
284
|
+
|
|
285
|
+
Decisions use the existing `decisions/` lane (also append-only files, one file per decision). The milestone log adds the run-level "what shipped" layer that `decisions/` doesn't track.
|
|
286
|
+
|
|
287
|
+
### Staleness detection
|
|
288
|
+
|
|
289
|
+
`memory_staleness_check.py` now prefers the latest `source_commit` in `indexes/updates.jsonl` for the current project, then falls back to the latest milestone's `commit` field. It compares that baseline against `git rev-parse HEAD` in the project workdir. If HEAD has moved past the last memory update by the configured commit threshold, the project's memory is potentially stale and Phase 1 Assess should flag it.
|
|
290
|
+
|
|
291
|
+
Impact:
|
|
292
|
+
|
|
293
|
+
- A decision, lesson, migration, mark-applied, or milestone can refresh the memory baseline when it records `source_commit`.
|
|
294
|
+
- Older memory stores without `indexes/updates.jsonl` keep working because milestone fallback is unchanged.
|
|
295
|
+
- A stale warning means "no durable memory update has been recorded for this project at or near HEAD"; it does not prove every individual memory file is stale.
|
|
296
|
+
|
|
297
|
+
### Concurrency
|
|
298
|
+
|
|
299
|
+
`fcntl.flock(LOCK_EX)` on `milestones.jsonl.lock` — same pattern as `memory_index.py`. Multi-writer safe.
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# Model Tier Mapping — Multi-Provider Substitution Reference
|
|
4
|
+
|
|
5
|
+
Build-loop is provider-agnostic at the tier level. Agent frontmatter uses Anthropic aliases (`fable`, `opus`, `sonnet`, `haiku`) by default because Claude Code is the primary host, but the **tier abstraction** (Frontier / Thinking / Code / Pattern) is what governs the role assignment. This reference documents how to swap providers cleanly.
|
|
6
|
+
|
|
7
|
+
## Canonical tier definitions
|
|
8
|
+
|
|
9
|
+
### Frontier tier
|
|
10
|
+
- **Role:** Planning synthesis AND verification verdicts. **Phase 2 Plan synthesis reaches Fable via the stakes-gated Advisor dispatch ladder** (`advisor` agent / peer host / already-Fable session; honestly-labeled inline-Opus fallback otherwise — `skills/build-loop/references/advisor-dispatch-ladder.md`); the Advisor v1 ladder is Phase 2 only, so Phase 1 Assess synthesis runs inline as today until v2. Plan content: frame goal, draft spec/ADRs, F-criteria, MECE partition. Verification-shaped agents whose verdicts gate downstream work: plan-critic, scope-auditor, independent-auditor, fix-critique, fact-checker, security-reviewer, overfitting-reviewer, promotion-reviewer.
|
|
11
|
+
- **Why this tier exists (above Thinking):** wrong plans dispatch N implementers into the wrong work, and wrong verdicts ship regressions. The user's standing priority is Accuracy > Speed > Cost; the compounding-risk surfaces pay the Frontier premium.
|
|
12
|
+
- **Benchmark contract:** clears the Thinking-tier contract AND benchmarks above the prior-generation Thinking-tier ceiling on at least one of SWE-bench Verified / ARC-AGI / GPQA Diamond.
|
|
13
|
+
- **Cost expectation:** highest. Use only on the planning + verification surface; never default for execution or coordination.
|
|
14
|
+
- **Anthropic default:** Fable 5 (`claude-fable-5`)
|
|
15
|
+
- **Verified equivalents (2026 Q2, advisory):** GPT-5.5 (`gpt-5.5`, OpenAI's frontier Codex model — complex coding, agentic, 1.1M ctx), GPT-5.4 (`gpt-5.4`, lower-cost frontier); future Claude generations above Opus
|
|
16
|
+
- **Local equivalents:** none — Frontier-class capability is not yet matched locally
|
|
17
|
+
|
|
18
|
+
### Thinking tier
|
|
19
|
+
- **Role:** Coordination + escalation. Routes work between subagents, ladders severity, runs causal-tree on stuck iterations, writes audit/learnings when no Frontier verdict is being rendered.
|
|
20
|
+
- **Benchmark contract:** SWE-bench Verified ≥78% AND competitive on ARC-AGI / GPQA Diamond / MMLU-Pro.
|
|
21
|
+
- **Cost expectation:** middle-high tier. Use for orchestration and the escalation target when execution hits ambiguity. Never default to Thinking for bounded execution.
|
|
22
|
+
- **Anthropic default:** Opus 4.8 (`claude-opus-4-8`; alias `opus` auto-tracks the latest Opus generation)
|
|
23
|
+
- **Verified equivalents (2026 Q2, advisory):** GPT-5.4 (`gpt-5.4`), Gemini 2.5 Pro
|
|
24
|
+
- **Local equivalents:** none yet — Thinking-tier work needs frontier-class context length and judgment; local models lag
|
|
25
|
+
|
|
26
|
+
### Code tier
|
|
27
|
+
- **Role:** Application. Apply a known rule, spec, or pattern to bounded input. Scoped implementation per a commit's owned-files. Adversarial critic vs rubric. Mechanical simplify. The "how" decisions when the "what" is already settled.
|
|
28
|
+
- **Benchmark contract:** SWE-bench Verified ≥75% AND tool-use accuracy ≥85% AND multi-turn coding rollout ≥80%.
|
|
29
|
+
- **Cost expectation:** ~3-5× cheaper than Thinking tier per token. The default for the bulk of build-loop work.
|
|
30
|
+
- **Anthropic default:** Sonnet 4.6 (`claude-sonnet-4-6`)
|
|
31
|
+
- **Verified equivalents:** Sonnet 4.7+ (when available), GPT-5.4 Mini (`gpt-5.4-mini` — fast coding + subagents)
|
|
32
|
+
- **Local equivalents:** qwen2.5-coder-32B-instruct (mid-quality), Codestral 22B (reasonable substitute for bounded refactor work)
|
|
33
|
+
|
|
34
|
+
### Pattern tier (a.k.a. Recognition)
|
|
35
|
+
- **Role:** Pure regex/syntactic match. Classify into known buckets. Log scan. Deterministic checklist verification. No judgment. No gradient — match-or-not.
|
|
36
|
+
- **Benchmark contract:** none formal. Empirical: doesn't hallucinate on bounded structured tasks; runs fast.
|
|
37
|
+
- **Cost expectation:** ~10-20× cheaper than Thinking tier. Use for high-volume mechanical sweeps.
|
|
38
|
+
- **Anthropic default:** Haiku 4.5 (`claude-haiku-4-5-20251001`)
|
|
39
|
+
- **Verified equivalents:** Haiku 4.6+ (when available), GPT-5 Nano (`gpt-5-nano` — fastest/cheapest, classify + summarize)
|
|
40
|
+
- **Local equivalents:** llama3.2-3b, qwen2.5-3b
|
|
41
|
+
|
|
42
|
+
## Substitution table (advisory, 2026 Q2)
|
|
43
|
+
|
|
44
|
+
| Provider | Frontier | Thinking | Code | Pattern |
|
|
45
|
+
|---|---|---|---|---|
|
|
46
|
+
| Anthropic (default) | Fable 5 (`fable`) | Opus 4.8 (`opus`) | Sonnet 4.6 (`sonnet`) | Haiku 4.5 (`haiku`) |
|
|
47
|
+
| OpenAI | `gpt-5.5` (Codex) | `gpt-5.4` | `gpt-5.4-mini` | `gpt-5-nano` |
|
|
48
|
+
| Google | next-gen Gemini Ultra (when it clears the contract) | `gemini-2.5-pro` | `gemini-2.5-flash` | `gemini-flash-lite` |
|
|
49
|
+
| Local (Ollama / MLX) | n/a — none meets contract yet | n/a — none meets contract yet | `qwen2.5-coder-32b` | `llama3.2-3b` |
|
|
50
|
+
|
|
51
|
+
⚠️ **Always verify benchmarks before swapping.** Table cells are best-effort as of build-loop's last update; model versions and rankings drift. Use `Skill("research")` or Context7 MCP to confirm current SWE-bench Verified scores before relying.
|
|
52
|
+
|
|
53
|
+
### Selectable model registry (the machine-readable source of truth)
|
|
54
|
+
|
|
55
|
+
The cells above are mirrored by `MODEL_REGISTRY` in `scripts/model_overrides.py`. List the selectable models per tier (and feed any tool) with:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python3 scripts/model_overrides.py --list-models # all tiers
|
|
59
|
+
python3 scripts/model_overrides.py --list-models --tier frontier --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The registry is **advisory**: override resolution still accepts any model id, so a brand-new model works the moment you put it in `modelOverrides` — it is simply flagged `registered: false` on the resolve envelope until it is added here. `TIER_DEFAULTS` (the Anthropic mapping) stays the fallback; registering a model makes it *selectable*, not the default.
|
|
63
|
+
|
|
64
|
+
## Three ways to swap
|
|
65
|
+
|
|
66
|
+
### 1. Edit agent frontmatter (one-time, per-host)
|
|
67
|
+
|
|
68
|
+
Each `agents/*.md` carries a `model:` field. Replace `opus` / `sonnet` / `haiku` with your provider's identifier. Example for OpenAI on a Codex host:
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
# agents/build-orchestrator.md
|
|
72
|
+
---
|
|
73
|
+
name: build-orchestrator
|
|
74
|
+
model: gpt-5.4 # was: opus (Thinking tier)
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
# agents/implementer.md
|
|
78
|
+
---
|
|
79
|
+
name: implementer
|
|
80
|
+
model: gpt-5.4-mini # was: sonnet (Code tier)
|
|
81
|
+
---
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This is durable but requires re-editing on every plugin update. Prefer #2 below.
|
|
85
|
+
|
|
86
|
+
### 2. Runtime override via `.build-loop/config.json` (recommended)
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"modelOverrides": {
|
|
91
|
+
"frontier": "gpt-5.5",
|
|
92
|
+
"thinking": "gpt-5.4",
|
|
93
|
+
"code": "gpt-5.4-mini",
|
|
94
|
+
"pattern": "gpt-5-nano"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Configs that predate the `frontier` tier resolve `frontier` → `fable` automatically (built-in tier default in `scripts/model_overrides.py`), so older repos keep working without edits.
|
|
100
|
+
|
|
101
|
+
The orchestrator resolves this before dispatching each subagent with
|
|
102
|
+
`scripts/model_overrides.py`. Frontmatter `model:` becomes the fallback when an
|
|
103
|
+
override is absent for that tier.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
python3 scripts/model_overrides.py \
|
|
107
|
+
--workdir "$PWD" \
|
|
108
|
+
--tier code \
|
|
109
|
+
--fallback sonnet \
|
|
110
|
+
--json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Resolution order is repo config first, then `.build-loop/state.json`
|
|
114
|
+
`config.modelOverrides`, then the supplied fallback. Use `--require` when a
|
|
115
|
+
tier must resolve to a concrete model before dispatch.
|
|
116
|
+
|
|
117
|
+
### 3. Per-dispatch override
|
|
118
|
+
|
|
119
|
+
When dispatching a subagent for a one-off task that needs a different tier:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Agent({
|
|
123
|
+
subagent_type: "build-loop:implementer",
|
|
124
|
+
model: "claude-opus-4-7", // override Sonnet → Opus for this dispatch
|
|
125
|
+
prompt: "..."
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This is what happens during escalation (e.g. "2 consecutive failures on the same chunk → escalate to Thinking tier per `model-tiering`").
|
|
130
|
+
|
|
131
|
+
## Tier-vs-task quick reference
|
|
132
|
+
|
|
133
|
+
When you see a task in build-loop, classify it before assigning a tier:
|
|
134
|
+
|
|
135
|
+
| Task | Reasoning shape | Tier |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| Frame goal, ADRs, scope, MECE-partition | Planning synthesis | Frontier |
|
|
138
|
+
| Plan-critic vs rubric | Verification synthesis | Frontier |
|
|
139
|
+
| Implement commit's owned files | Application | Code |
|
|
140
|
+
| Severity-rank findings (post-verdict routing) | Coordination synthesis | Thinking |
|
|
141
|
+
| Mock-data scan | Recognition | Pattern |
|
|
142
|
+
| Trace caller-paths (scope-auditor) | Verification synthesis | Frontier |
|
|
143
|
+
| Independent-auditor vs diff | Verification synthesis | Frontier |
|
|
144
|
+
| Audit / learnings write (no verdict being rendered) | Coordination synthesis | Thinking |
|
|
145
|
+
| Recurring-pattern detection | Recognition | Pattern |
|
|
146
|
+
|
|
147
|
+
The decision tree (from `model-tiering/SKILL.md`):
|
|
148
|
+
1. "Single-correct answer derivable from a rule applied to bounded input?" → Application / Code tier
|
|
149
|
+
2. Else "Pure pattern-match, no gradient?" → Recognition / Pattern tier
|
|
150
|
+
3. Else, Synthesis. Then: "Is this a planning decision (what to build) or a verification verdict (did it hold)?" → Frontier tier
|
|
151
|
+
4. Else (routing, escalation, audit-synthesis without a verdict) → Thinking tier
|
|
152
|
+
|
|
153
|
+
## Dual-mode A/B test design (preserved)
|
|
154
|
+
|
|
155
|
+
Build-loop intentionally supports two dispatch modes to enable continued A/B testing on tier-mix tradeoffs:
|
|
156
|
+
|
|
157
|
+
### Mode A — Top-level / fan-out (default)
|
|
158
|
+
- **Invocation:** `/build-loop:run` invoked as a Skill from user session
|
|
159
|
+
- **Tier mix:** Thinking orchestrator + up to 4 Code-tier implementer subagents in parallel + Code-tier critic + Thinking-tier severity ranking + Thinking-tier audit
|
|
160
|
+
- **Anthropic mapping:** Opus orchestrator + Sonnet implementer fan-out
|
|
161
|
+
- **Best for:** features with ≥3 truly parallel-safe chunks, large feature size (≥10 commits), repetitive patterns
|
|
162
|
+
|
|
163
|
+
### Mode B — Inline / single-context (preserved for A/B comparison + small features)
|
|
164
|
+
- **Invocation:** `Agent(subagent_type="build-loop:build-orchestrator", ...)` from any session
|
|
165
|
+
- **Tier mix:** Thinking-tier orchestrator handles ALL phases inline (no-sub-sub-agents rule kicks in)
|
|
166
|
+
- **Anthropic mapping:** all-Opus single context
|
|
167
|
+
- **Best for:** small/medium features (≤6 commits), cross-cutting refactors where catching all-the-callsites matters more than per-token cost, sequential dependency chains, comparison runs against Mode A
|
|
168
|
+
|
|
169
|
+
The orchestrator detects which mode it's in via the dispatch path (top-level message vs subagent invocation) and adapts behavior at `agents/build-orchestrator.md:529-530`. **Both modes share the same plan, the same Phase 1-4 logic, and the same Phase 6 Learn signals.** The only difference is whether implementer work fans out to Code-tier subagents (Mode A) or runs inline in the Thinking-tier orchestrator's context (Mode B).
|
|
170
|
+
|
|
171
|
+
This dual-mode design is **not deprecated** — it's the intentional architecture for tier-comparison telemetry. Future build-loop changes that affect dispatch must preserve both modes.
|
|
172
|
+
|
|
173
|
+
## Multi-model implications for the dispatch test
|
|
174
|
+
|
|
175
|
+
When swapping providers, the dispatch-pattern A/B test should be re-run because:
|
|
176
|
+
- **Wall-clock per tier varies by provider.** GPT-5 Codex may be faster or slower than Sonnet 4.6 at scoped code application.
|
|
177
|
+
- **Cost ratios shift.** Some providers price the Thinking tier closer to the Code tier (smaller multiplier); others price wider.
|
|
178
|
+
- **Cross-context-window effects.** Mode B's "single Opus context" wins partly come from full-file-system visibility; the same effect may differ on a model with a smaller context window.
|
|
179
|
+
- **Tool-use fidelity.** Mode A's parallel implementer fan-out depends on the Code tier reliably calling Read/Edit/Bash tools without hallucination. This varies materially across providers.
|
|
180
|
+
|
|
181
|
+
When introducing a new provider to a project, prefer Mode B for the first 2-3 builds to establish a quality baseline, then enable Mode A once the new Code-tier model has shown stable tool-use behavior.
|
|
182
|
+
|
|
183
|
+
## Dynamic tier assignment (guide, not a fixed rule)
|
|
184
|
+
|
|
185
|
+
The orchestrator **judges each subtask's complexity at dispatch time** and assigns the tier that fits. This is adaptive, not a fixed table.
|
|
186
|
+
|
|
187
|
+
**Priority order: accuracy > speed > cost.** Pick the tier that does the work CORRECTLY first — never trade accuracy for a cheaper or faster model. Among accuracy-equivalent options, prefer the faster path (spawn Opus subagents to accelerate complex work; fan out in parallel). Optimize cost only after accuracy and speed are both satisfied — cost is the last lever, never the first. This is why every subagent's output is verified (accuracy) and why Opus subagents are used freely on hard tasks (speed on complexity beats pinching tier cost).
|
|
188
|
+
|
|
189
|
+
**Tier assignment guide:**
|
|
190
|
+
|
|
191
|
+
| Task shape | Tier |
|
|
192
|
+
|---|---|
|
|
193
|
+
| Pure recognition, extraction, classification, mechanical sweep — "find X", "list/grep Y", "scan for Z", "extract these fields", "run detector + summarize its JSON", "does this match the pattern". No rule-application, no cross-file reasoning. | **Pattern / Haiku** |
|
|
194
|
+
| Apply a known rule or spec to bounded input. Scoped implementation per owned-files. The "how" when the "what" is settled. | **Code / Sonnet** — default workhorse; prefer Sonnet over Haiku when in doubt |
|
|
195
|
+
| Coordination, routing, ambiguous-spec interpretation, novel architecture decision mid-execution, causal-tree on stuck iterations, user-trust prose where no verification verdict is being rendered. | **Thinking / Opus** — orchestrator default, AND available to accelerate genuinely complex execution subtasks |
|
|
196
|
+
| Planning synthesis (frame goal, draft spec/ADRs, F-criteria, MECE partition) **when stakes-gated via the Advisor dispatch ladder** (`synthesisDensity > 5`, `riskSurfaceChange`, `stakes >= medium`, or `dispatch_tier: frontier`) OR verification verdicts (plan-critic, scope-auditor, independent-auditor, fix-critique, fact-checker, security-reviewer, overfitting-reviewer, promotion-reviewer). | **Frontier / Fable** — wrong plans and wrong verdicts compound; pays the premium. Plan synthesis reaches Fable through the `advisor` agent / peer host / already-Fable session; when no trigger fires or no dispatch path is reachable it runs inline on the orchestrator's model (Opus), labeled honestly — the floor equals today's behavior. See `skills/build-loop/references/advisor-dispatch-ladder.md`. |
|
|
197
|
+
|
|
198
|
+
**Prefer Sonnet.** Sonnet is the workhorse for the bulk of build-loop's work. Down-tier to Haiku only for tasks that are genuinely trivial/mechanical — pure pattern-match, no judgment, no gradient. When in doubt, use Sonnet.
|
|
199
|
+
|
|
200
|
+
**Opus subagents are allowed** to accelerate complex subtasks — cross-file reasoning, novel design, ambiguous specs, hard refactors. Opus is no longer reserved for the orchestrator alone. The orchestrator MAY spawn an Opus subagent when a subtask is complex enough that a stronger model would produce materially better or faster results. Use Opus to accelerate complex work, not only for top-level synthesis.
|
|
201
|
+
|
|
202
|
+
Both escalation directions are active on every dispatch decision: escalate up when complexity exceeds the assigned tier; down-tier when the task is genuinely below it.
|
|
203
|
+
|
|
204
|
+
For `model: inherit` agents (fact-checker, fix-critique, root-cause-investigator), the **caller** passes the appropriate tier — the agent inherits what the caller assigned.
|
|
205
|
+
|
|
206
|
+
### Verify every subagent (the safety net for dynamic tiering)
|
|
207
|
+
|
|
208
|
+
Because tiers are assigned adaptively, every subagent's output is **checked before it is accepted**. The cheaper the tier, the stronger the check. This per-subagent verification is what makes dynamic (and occasionally cheaper) assignment safe.
|
|
209
|
+
|
|
210
|
+
Verification ties to build-loop's existing mechanisms:
|
|
211
|
+
- **verify-scope / verify-landed** (Phase 3 commit step) — confirms the implementer only touched owned files and the commit landed cleanly.
|
|
212
|
+
- **independent-auditor** (Phase 4 Review-A) — adversarial LLM-grade read of the full build's output.
|
|
213
|
+
- **implementer return envelope** — every subagent returns a structured envelope; `status: blocked | partial` routes to Iterate before the output is accepted.
|
|
214
|
+
|
|
215
|
+
No subagent output is trusted unchecked. The verification chain is a first-class requirement, not a backstop.
|
|
216
|
+
|
|
217
|
+
### Fan-out / workflow agents
|
|
218
|
+
|
|
219
|
+
When fanning out bounded agents via the Workflow tool, a dynamic-workflow, or a rallyflow mini-loop, assign each agent by the same guide:
|
|
220
|
+
|
|
221
|
+
- **Recognition/extraction/scan-and-summarize** → Haiku (Pattern tier) — genuinely trivial mechanical work
|
|
222
|
+
- **Apply rules or reason across files** → **Sonnet** (Code tier) — default for fan-out agents
|
|
223
|
+
- **Cross-file, novel, or ambiguous subtask** → Opus (Thinking tier) — when the subtask warrants it
|
|
224
|
+
- **Single synthesis agent** (aggregates fan-out results, cross-agent judgment) → Opus only when synthesis dimensions exceed the Code-tier contract
|
|
225
|
+
|
|
226
|
+
Fan-out breadth multiplies token cost linearly — but the right fix is matching tier to task complexity, not defaulting every agent to the cheapest tier. Prefer Sonnet for fan-out agents; drop to Haiku only for the genuinely mechanical bounded ones.
|
|
227
|
+
|
|
228
|
+
Concrete dispatch pattern:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Agent({
|
|
232
|
+
subagent_type: "build-loop:implementer",
|
|
233
|
+
model: "haiku", // recognition task — scan for mock-data patterns
|
|
234
|
+
prompt: "Scan files X..Z for hardcoded test data. Return a JSON list of findings."
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
Agent({
|
|
238
|
+
subagent_type: "build-loop:implementer",
|
|
239
|
+
model: "sonnet", // default for rule-application / scoped implementation
|
|
240
|
+
prompt: "Implement the auth middleware per the spec in intent.md. Owned files: ..."
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
Agent({
|
|
244
|
+
subagent_type: "build-loop:implementer",
|
|
245
|
+
model: "opus", // complex subtask — cross-file refactor, ambiguous spec
|
|
246
|
+
prompt: "Refactor the session management layer across auth/* and middleware/*. ..."
|
|
247
|
+
})
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Round-3 evidence (2026-05-07) — preserved for context
|
|
251
|
+
|
|
252
|
+
| Mode | Wall-clock | Tokens | Notes |
|
|
253
|
+
|---|---|---|---|
|
|
254
|
+
| A (Opus + Sonnet fan-out, 4-parallel Wave 1) | ~11 min | ~600K total (~50/50 Thinking/Code) | parallel-commit race required orchestrator-side recovery (~3-4 min of 11-min total) |
|
|
255
|
+
| B (Opus inline, serial) | ~23 min | ~150K Thinking only | 0 iterations, caught a schema field bug A's scoped implementer missed |
|
|
256
|
+
|
|
257
|
+
A's wall-clock advantage on round 3 was real (parallel structure exists in the feature); cost ratio is ~4× (A burns more tokens). Both modes shipped working features.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# Modular Systems Pack
|
|
4
|
+
|
|
5
|
+
Use this pack on every non-trivial build. It makes modular, scalable structure the default while allowing a simpler or more integrated approach when that better serves the use case.
|
|
6
|
+
|
|
7
|
+
## Default
|
|
8
|
+
|
|
9
|
+
Build-loop should prefer systems that are:
|
|
10
|
+
|
|
11
|
+
- **Modular**: each module hides one important design decision behind a stable interface.
|
|
12
|
+
- **Scalable**: the design can grow in data volume, user volume, feature count, or team ownership without immediate redesign.
|
|
13
|
+
- **MECE**: task groups, file ownership, and agent scopes are mutually exclusive and collectively exhaustive.
|
|
14
|
+
- **Pyramid-structured**: plans, handoffs, reports, and repo organization lead with the governing thought, then supporting groups, then details.
|
|
15
|
+
|
|
16
|
+
This is a default, not dogma. The goal is durable user value, not extra architecture.
|
|
17
|
+
|
|
18
|
+
## Exception Rule
|
|
19
|
+
|
|
20
|
+
Do not add modularity for its own sake. Choose a simpler or more integrated approach when:
|
|
21
|
+
|
|
22
|
+
- The change is a one-off script, short-lived migration, or isolated fix.
|
|
23
|
+
- A new boundary would add indirection without reducing real complexity.
|
|
24
|
+
- A performance hot path needs a tightly integrated implementation.
|
|
25
|
+
- The repo is small and the added module structure would obscure the core workflow.
|
|
26
|
+
- The product need is intentionally limited and extra optionality would confuse users.
|
|
27
|
+
|
|
28
|
+
When taking an exception, record:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
MODULARITY EXCEPTION: <why simpler/integrated is better for this use case>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## MECE File And Agent Partition
|
|
35
|
+
|
|
36
|
+
Phase 2 Plan must partition work so every changed file has exactly one owner and every required responsibility has an owner.
|
|
37
|
+
|
|
38
|
+
For each task group, use this packet:
|
|
39
|
+
|
|
40
|
+
```md
|
|
41
|
+
Group: <name>
|
|
42
|
+
Dimension: <domain | layer | workflow | bounded context | adapter | test surface>
|
|
43
|
+
Owns files: <paths>
|
|
44
|
+
Does not own: <paths handled elsewhere>
|
|
45
|
+
Interface contract: <exports/events/API/schema it may change>
|
|
46
|
+
Integration checkpoint: <command or review step>
|
|
47
|
+
Intent link: <north-star or user-value rule this group supports>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
MECE checks:
|
|
51
|
+
|
|
52
|
+
- No overlap: a file or interface is not owned by two agents unless the plan defines a handoff point.
|
|
53
|
+
- No gaps: every required behavior, state, migration, test, and user-facing surface has an owner.
|
|
54
|
+
- One dimension per level: avoid mixing domains, layers, and workflows in the same grouping level.
|
|
55
|
+
- Stable interfaces: agents can change internals, but cross-group contracts are explicit.
|
|
56
|
+
- Integration checkpoint: every boundary has a test, build, visual check, schema check, or reviewer step.
|
|
57
|
+
|
|
58
|
+
## Modular Design Heuristics
|
|
59
|
+
|
|
60
|
+
- Hide volatile decisions behind small interfaces: data shape, provider choice, algorithm, storage, rendering strategy, or external API.
|
|
61
|
+
- Prefer high cohesion: code that changes for the same reason lives together.
|
|
62
|
+
- Prefer loose coupling: callers depend on published interfaces, not internal data structures or side effects.
|
|
63
|
+
- Design around business/domain capabilities when the system is large enough for domains to matter.
|
|
64
|
+
- Keep boundaries small enough to understand and large enough to own a useful capability.
|
|
65
|
+
- Separate deploy/runtime config from code when values vary by environment.
|
|
66
|
+
- Preserve directness when extra layers make the core workflow harder to read, test, or operate.
|
|
67
|
+
|
|
68
|
+
## Pyramid Structure
|
|
69
|
+
|
|
70
|
+
Use pyramid structure for plans, reports, repo notes, and agent handoffs:
|
|
71
|
+
|
|
72
|
+
1. Governing thought: the one decision, result, or recommendation.
|
|
73
|
+
2. MECE key lines: 3-5 non-overlapping supporting claims or work groups.
|
|
74
|
+
3. Evidence/details: commands, files, risks, interfaces, and validation.
|
|
75
|
+
|
|
76
|
+
For repo structure, this means names should communicate purpose, folders should group by one clear dimension, and cross-cutting utilities should stay genuinely shared rather than becoming a junk drawer.
|
|
77
|
+
|
|
78
|
+
## Review Gates
|
|
79
|
+
|
|
80
|
+
Critic and final review should flag:
|
|
81
|
+
|
|
82
|
+
- Avoidable tight coupling or weak cohesion.
|
|
83
|
+
- Hidden cross-file ownership overlap between agents.
|
|
84
|
+
- Missing owner for a required behavior, state, migration, test, or user-facing surface.
|
|
85
|
+
- Abstraction added without user, scalability, testability, security, or maintainability benefit.
|
|
86
|
+
- Simplification that collapses a boundary needed for accuracy, security, scale, testability, or future optionality.
|
|
87
|
+
- Missing `MODULARITY EXCEPTION` when the plan intentionally chooses an integrated shortcut.
|
|
88
|
+
|
|
89
|
+
## Source Basis
|
|
90
|
+
|
|
91
|
+
- Parnas, "On the Criteria to Be Used in Decomposing Systems into Modules" (CACM, 1972): https://cacm.acm.org/research/on-the-criteria-to-be-used-in-decomposing-systems-into-modules/
|
|
92
|
+
- AWS Well-Architected REL04-BP02, "Implement loosely coupled dependencies": https://docs.aws.amazon.com/wellarchitected/2024-06-27/framework/rel_prevent_interaction_failure_loosely_coupled_system.html
|
|
93
|
+
- Microsoft Azure Architecture Center, domain analysis for microservices: https://learn.microsoft.com/en-us/azure/architecture/microservices/model/domain-analysis
|
|
94
|
+
- Microsoft Azure Architecture Center, design principles for Azure applications: https://learn.microsoft.com/en-gb/azure/architecture/guide/design-principles/
|
|
95
|
+
- Twelve-Factor App config guidance: https://12factor.net/config
|
|
96
|
+
- MECE framework overview: https://www.casestar.io/guides/mece
|