agent-concepts 0.4.0 → 0.5.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.
Files changed (34) hide show
  1. package/README.md +62 -57
  2. package/concepts/bc-code-review/body/SKILL.md +3 -1
  3. package/concepts/bc-council-find-bugs/body/SKILL.md +1 -1
  4. package/concepts/bc-council-mode/body/SKILL.md +5 -3
  5. package/concepts/bc-council-mode/body/references/pass-contracts.md +1 -1
  6. package/concepts/bc-diagnosing-bugs/body/SKILL.md +3 -1
  7. package/concepts/bc-dispatching-parallel-agents/body/SKILL.md +5 -1
  8. package/concepts/{bc-delegate-investigation → bc-durable-subagents}/body/SKILL.md +11 -41
  9. package/concepts/{bc-delegate-investigation → bc-durable-subagents}/body/pi.md +3 -1
  10. package/concepts/bc-executing-plans/body/SKILL.md +3 -1
  11. package/concepts/bc-find-bugs/body/SKILL.md +2 -0
  12. package/concepts/bc-finishing-development-branch/body/SKILL.md +3 -1
  13. package/concepts/bc-handoff/body/SKILL.md +1 -1
  14. package/concepts/bc-optimize-code/body/SKILL.md +3 -1
  15. package/concepts/bc-pipeline-to-done/body/SKILL.md +7 -3
  16. package/concepts/bc-pipeline-to-done/body/execute-issue.md +1 -1
  17. package/concepts/bc-prompting-agents/body/SKILL.md +1 -1
  18. package/concepts/bc-prototype/body/SKILL.md +2 -0
  19. package/concepts/bc-safe-runs/body/SKILL.md +32 -0
  20. package/concepts/bc-security-audit/body/SKILL.md +2 -0
  21. package/concepts/bc-setup-project/body/MIGRATIONS.md +457 -0
  22. package/concepts/bc-setup-project/body/SKILL.md +1 -1
  23. package/concepts/bc-setup-project/body/scaffold.py +17 -5
  24. package/concepts/bc-subagent-driven-development/body/SKILL.md +5 -1
  25. package/concepts/bc-swarm/body/SKILL.md +50 -0
  26. package/concepts/bc-tdd/body/SKILL.md +3 -1
  27. package/concepts/bc-tdd/body/refactoring.md +3 -1
  28. package/concepts/bc-using-git-worktrees/body/SKILL.md +3 -1
  29. package/concepts/bc-work-sync/body/SKILL.md +2 -0
  30. package/concepts/bc-writing-plans/body/SKILL.md +3 -1
  31. package/package.json +11 -3
  32. package/skills/bc-delegate-investigation/SKILL.md +6 -0
  33. package/skills/bc-ui-design/SKILL.md +6 -0
  34. /package/concepts/{bc-delegate-investigation → bc-durable-subagents}/body/examples/pi-settings-snippet.json +0 -0
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: bc-safe-runs
3
+ description: Storage-safe test runs, scratch folders and worktree removal. Use before running tests, making scratch folders, running a full suite, creating a worktree, launching workers or reviewers, or removing a worktree or branch; its packet line goes into every worker or reviewer task.
4
+ ---
5
+
6
+ # Safe runs
7
+
8
+ Rules for running code without filling the disk or losing work. They derive from the `agent-kernel` concept's Storage safety and Verification sections, which state the same rules when the kernel is loaded. If `~/.config/agent-concepts/overlays/bc-safe-runs.md` exists, read it: it names this machine's guarded test runner and storage health check. The project's own instructions take precedence over it.
9
+
10
+ ## Test runs
11
+
12
+ - Run pytest through the guarded test runner the project's or machine's instructions name, with the selected interpreter for uv/venv projects. If none is configured, run plain `pytest` in the project's environment. Never supply a custom `--basetemp`, including through `PYTEST_ADDOPTS` or project addopts. Why: the guarded runner owns temporary storage and its retention; a custom `--basetemp` bypasses it.
13
+ - Tests and test helpers you write or change delete every temporary file and folder they create (temp dirs, browser profiles, fixtures in the OS temp dir), including on failure; use pytest's `tmp_path` for test fixtures. After the run, compare the project's temp-dir footprint before and after (count or size of its prefix) and fix any leak. Why: in one project tests left about 14,000 folders (2.5 GB) in a 7.7 GB RAM-backed `/tmp`, filling it and crashing two agent runs mid-task.
14
+ - Run targeted tests while working. Workers and reviewers never run the full suite or full gate, even when a project page says to: the session that integrates runs it once per integrated tree (and once per base where a workflow needs a baseline) and records the command, result and exact tree identity; everyone else reuses that record, and reviewers repro findings with targeted tests. Why: each full run costs minutes, and parallel agents multiply the cost without adding evidence.
15
+
16
+ ## Scratch folders
17
+
18
+ Make scratch folders (prototypes, throwaway projects, build output, logs; not durable run folders) with `mktemp -d` and no path argument, which uses `$TMPDIR`, or in a git-ignored folder inside your worktree. Never type `/tmp/` into a command, a `CARGO_TARGET_DIR` or a worker's task unless the user named that exact path. Delete the scratch folder before you finish. Why: `/tmp` may be a small RAM-backed disk that also holds agent runner state; one Rust build there took 5.7 GB of 7.7 GB and three agent runs died without a log line.
19
+
20
+ ## Storage health check
21
+
22
+ Before a full suite, creating a worktree, a parallel review or launching two or more workers, run the storage health check the machine's instructions name. Stop and report on critical or unknown health, or if the configured check cannot run. If no check is configured, skip it and say so in one line of the report. On Btrfs judge free space with that check (or `btrfs filesystem usage`), not `df`. Why: free bytes can hide metadata exhaustion, and parallel work multiplies disk use.
23
+
24
+ ## Packet line
25
+
26
+ Children do not load this skill on their own. Copy this line into every worker or reviewer task:
27
+
28
+ > Run pytest through the guarded test runner the project's or machine's instructions name (otherwise plain `pytest`), with the selected interpreter for uv/venv projects; use `tmp_path` for fixtures and clean up even on failure; never a custom `--basetemp`; make scratch folders with `mktemp -d`, never under `/tmp`, and delete them before finishing; run targeted tests only, never the full suite or gate.
29
+
30
+ ## Removing a worktree or branch
31
+
32
+ Before removing a worktree or deleting its branch, prove its commits are in `HEAD`: its tip is an ancestor of `HEAD` (`git merge-base --is-ancestor <tip> HEAD`), or every commit is patch-equivalent in `HEAD`: `git cherry HEAD <tip>` succeeds and prints only `-` lines (empty output alone is not proof without ancestry). Record the tip, the landed `HEAD` and the proof (in the run manifest when there is one) before cleanup. Keep anything dirty, unmerged or unclear. Remove with `git worktree remove`, never `--force`. The full recipe, including resolved conflict picks and branch deletion, is in the `bc-using-git-worktrees` skill, section Cleanup. Why: deletion without proof loses work, and integration without cleanup leaks disk.
@@ -105,6 +105,8 @@ See [validation and reporting](VALIDATION-AND-REPORTING.md) for evidence handlin
105
105
  confirmed findings, blocked hypotheses, rejections, hardening and coverage gaps.
106
106
  Validation checks consistency, not truth or independent verification.
107
107
 
108
+ Before the first reviewer launch, load `bc-durable-subagents`; its manifest and reviewer artifacts go in the audit run folder approved by the Output gate below. Else: before launching, verify the approved run folder survives a reboot, write `manifest.md` there (key → artifact path → reviewer → model + thinking → task), state the folder path in chat, and give each reviewer its own artifact.
109
+
108
110
  ## Output gate (full audit only)
109
111
 
110
112
  Use only `.security-audit/run-N/` inside the target repository, with N the next
@@ -0,0 +1,457 @@
1
+ # One-time migrations
2
+
3
+ This file holds procedures for an existing initialized vault. It is a human-facing reference, not
4
+ an injected agent instruction. The scaffold remains additive: it creates the new form for a new
5
+ vault and reports a manual upgrade note for an existing one, but it does not rewrite live files.
6
+
7
+ ## Which migrations may apply?
8
+
9
+ Read `.bc-agent/.scaffold-version` for the agent-concepts version used to create the project.
10
+ Sections that arrived after that version may apply; projects without a stamp predate stamping.
11
+ Each section's own check still decides whether its steps are needed. `unknown` means the
12
+ version was unavailable, so check each section.
13
+
14
+ ## Visible layout
15
+
16
+ Arrived in: 0.1.0
17
+
18
+ Running the current scaffold with `--archetype code`, `ops` or `hybrid` on a project that already
19
+ has the earlier vault layout writes nothing: it names the earlier-layout paths it found under
20
+ `.bc-agent/` and exits non-zero. The paths it looks for are `tasks`, `decisions`, `research`,
21
+ `scratch`, `out-of-scope`, `home.md`, `components`, `findings`, `open-questions`, `plans`,
22
+ `conventions/planning-workflow.md`, `templates/plan.md` and `project`, and for code and ops also
23
+ `index.md` (hybrid generates it as its teach catalog). A `.bc-agent/project/overview.md` from an
24
+ earlier hybrid scaffold holds a separate teach glossary; hybrid now shares the root `glossary.md`,
25
+ so its terms move there when the project is migrated. `open-questions` is detected because the
26
+ visible layout has no open-questions folder: open questions become work-item steps, planned work
27
+ items or lines in `work/0-ideas.md`. Why: creating the visible homes
28
+ beside the old ones would leave two glossaries, two decision homes and two status mechanisms.
29
+
30
+ `--allow-earlier-layout` restores the additive behaviour: the scaffold creates the missing
31
+ visible-layout files, leaves every existing file byte-identical (including a custom
32
+ `.bc-agent/AGENTS.md`), and prints the same paths as an upgrade note. It also notes when
33
+ `.bc-agent/AGENTS.md` has no "Where things go" table.
34
+
35
+ ### Migrate mode
36
+
37
+ `scaffold.py --migrate` moves one project to the visible layout (work package W4 of
38
+ the visible-layout plan (work item `018-bc-init-agent-visible-layout`)). The agent
39
+ procedure, including the rule for each judgment class, is in the skill body under
40
+ "Migrate an existing project"; this section records what the script does and does not do.
41
+
42
+ - Without `--apply` it writes nothing and prints the plan. With `--apply` it performs the plan,
43
+ stages it and does not commit.
44
+ - It refuses, writing nothing, when the root is not a git repository root, the working tree is not
45
+ clean, there is no `.bc-agent/`, `.bc-agent/AGENTS.md` already has a "Where things go" table, the
46
+ archetype is learning or knowledge, or a destination already exists as a different file.
47
+ `--archetype` must be explicit: nothing in an earlier vault records it reliably.
48
+ - Moves (`git mv`, content unchanged except links): vault `decisions/` and root `docs/adr/` to
49
+ `docs/decisions/`, vault `research/` to `docs/research/`, and for ops and hybrid vault
50
+ `components/` to `docs/components/`. Two files that would land on the same path, or a file whose
51
+ identical copy is already at the destination, are listed for judgment instead.
52
+ - Creates the missing visible-layout files; replaces only `.bc-agent/AGENTS.md`; lists other
53
+ generated files the project already has under "kept, review by hand".
54
+ - Deletes only `.gitkeep` files in moved folders, `scratch/` and `out-of-scope/` holding nothing
55
+ else, and `conventions/planning-workflow.md` and `templates/plan.md` when they equal the current
56
+ generator's text for any date. Earlier generator versions differ, so in practice those two
57
+ usually land in the judgment list.
58
+ - Rewrites relative Markdown links (inline and reference definitions, outside code fences and
59
+ inline code) in every tracked `.md` file whose target moved, and links inside moved files.
60
+ A folder link is rewritten only when the whole folder moved. Link labels are not changed.
61
+ - Rewrites every `[[wikilink]]` (outside code) whose target moves into a relative Markdown link
62
+ from the containing file's new place: `[[name|label]]` keeps the label, `[[name#Heading]]` gets a
63
+ GitHub-style anchor, a Markdown embed becomes a plain link and a moved image embed becomes
64
+ `![](path)`. Targets resolve as Obsidian does: bare name by basename (case-insensitive, `.md`
65
+ optional) anywhere in the repository, path form by path suffix. Why: the Obsidian settings are
66
+ retired, and plain links resolve in any viewer and for agents (plan decision 32).
67
+ - Reports and leaves: unresolved Markdown links, a bare wikilink name matching more than one file
68
+ when one of them moves, wikilinks in moved files that name files that stay (they resolve only
69
+ inside an Obsidian vault), wikilinks to files that stay, and literal old paths in other tracked
70
+ text files.
71
+ - After apply and commit, `--migrate` refuses (the table exists), and the ordinary scaffold no
72
+ longer names the moved folders as earlier layout; folders still awaiting judgment are named.
73
+
74
+ A 2026-11-12 trial on clones of one code and one ops project (not the projects themselves) moved a
75
+ `docs/adr/` with 29 link rewrites, and showed that an Obsidian-linked ops vault has about a hundred
76
+ wikilinks to moved files; a rerun on a fresh clone of that ops project rewrote 108 wikilinks in 27
77
+ files, none ambiguous, all resolving, and left 32 wikilinks from moved files to files that stay.
78
+
79
+ ### Search, promotion and project agents after migration (owner decisions 2026-11-12)
80
+
81
+ Arrived in: 0.1.0
82
+
83
+ A project already migrated to the visible layout needs these follow-ups, done by hand on the machine
84
+ that holds the synced qmd collections file:
85
+
86
+ - **Register for search.** Print the entries from the project's own table and compare them with
87
+ the collections file:
88
+
89
+ ```bash
90
+ python3 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/wiki_lint.py" "<repo>/.bc-agent" --qmd-entry <slug>
91
+ ```
92
+
93
+ If the project already has a `<slug>` collection rooted at `.bc-agent/`, keep it (the setup
94
+ command will not re-point an existing name at a new path) and append only the printed
95
+ `<slug>-project` block; drop stale contexts from the old entry that name vault folders the
96
+ migration moved (`/decisions`, `/bc-research`, `/project`, `/components`, ...), since their files
97
+ now live in `<slug>-project`. Otherwise append both blocks. Then run the setup command (see the
98
+ `bc-qmd` concept). `wiki_lint.py "<repo>/.bc-agent"` then reports `qmd registration: registered`.
99
+ - **Project agents row.** Edit the one table row in `.bc-agent/AGENTS.md` from
100
+ `` | project-agents | — | not yet decided; ask the owner before creating project-specific agents | ``
101
+ to
102
+ `` | project-agents | `.agents/agents/` | created on first need; one `local-<name>.md` file per agent, beside `.agents/skills/` | ``.
103
+ Nothing else changes; the folder is created when the first agent is.
104
+ - **Promotion: nothing to do.** Promotion is retired for the visible layout, and the runner exits
105
+ 0 with "promotion is not applicable" for such a project. A per-project promotion timer or a
106
+ `wiki-promotion-vaults.txt` entry for it can be removed at leisure; leaving it costs one no-op
107
+ run per night. Keep the lint-list entry.
108
+
109
+ ## Migrate existing `map.md` files to graph-visible links
110
+
111
+ Arrived in: 0.1.0
112
+
113
+ ### Why this is a separate migration
114
+
115
+ The current `scaffold.py` template emits real relative Markdown links, but its additive write rule
116
+ leaves every existing `map.md` untouched. `upgrade_notes()` reports the missing generated link as a
117
+ manual merge hint. This procedure applies that one-time change to the eight vaults listed by the
118
+ machine-local lint configuration.
119
+
120
+ The source of vault paths is:
121
+
122
+ ```bash
123
+ vault_list="$HOME/.config/agent-concepts/wiki-lint-vaults.txt"
124
+ test -r "$vault_list"
125
+ grep -Ev '^[[:space:]]*(#|$)' "$vault_list"
126
+ ```
127
+
128
+ That file is machine-local. Work through its current non-comment entries; do not copy vault paths
129
+ from another machine or add a path merely because it appears in a different local list.
130
+
131
+ ### Rule: link only targets inside the vault
132
+
133
+ For each bullet in `map.md`, inspect the first backtick-delimited path. Convert an entry only when
134
+ that path resolves to an existing page **inside the vault root**. Use the same vault-relative path
135
+ as both the label and the link target:
136
+
137
+ ```markdown
138
+ - `project/overview.md`
139
+ ```
140
+
141
+ becomes:
142
+
143
+ ```markdown
144
+ - [project/overview.md](project/overview.md)
145
+ ```
146
+
147
+ Do not convert every backtick in the file; code examples and prose are not map edges. Leave a path
148
+ that points outside the vault as an inline-code span, even when the corresponding file exists at
149
+ the repository root. `wiki_lint.resolve_link()` recognises pages in the vault graph; converting an
150
+ outside path literally creates a broken-link finding, while a corrected parent-relative link still
151
+ cannot add an edge to this vault.
152
+
153
+ Both Homeflix maps have 15 out-of-vault source-tree rows. Leave those rows inline code. The six
154
+ non-Homeflix maps (Music, Scripts, project B, CV, bc-codebase-design, and sql) have in-vault targets
155
+ that can become links.
156
+
157
+ ### Per-vault procedure
158
+
159
+ Repeat this sequence for every entry in `wiki-lint-vaults.txt`. Each entry is a separate Git
160
+ working tree. Replace the example value below with the selected entry; do not run the procedure
161
+ while the repository has unrelated changes.
162
+
163
+ ```bash
164
+ export AGENT_CONCEPTS="$HOME/path/to/agent-concepts"
165
+ vault="$HOME/path/to/your/project/.bc-agent" # replace with one lint-list entry
166
+ repo_root="$(git -C "$vault" rev-parse --show-toplevel)"
167
+ vault_prefix="$(git -C "$vault" rev-parse --show-prefix)"
168
+ git -C "$repo_root" status --short --untracked-files=all
169
+ ```
170
+
171
+ A non-empty status is a stop: clean or commit the unrelated work before changing the map. The
172
+ promotion runner also requires the complete containing repository to be clean, not merely the
173
+ vault directory.
174
+
175
+ 1. Capture the pre-migration report. `wiki_lint.py --json` emits `broken_links`,
176
+ `ambiguous_links`, and `orphans`; exit status 1 is allowed when a report already contains a
177
+ detector finding, but an invalid vault or another status is an error.
178
+
179
+ ```bash
180
+ before="$(mktemp)"
181
+ before_status=0
182
+ python3 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/wiki_lint.py" \
183
+ "$vault" --json >"$before" || before_status=$?
184
+ (( before_status == 0 || before_status == 1 )) || exit "$before_status"
185
+ python3 - "$before" <<'PY'
186
+ import json
187
+ import sys
188
+ report = json.load(open(sys.argv[1], encoding="utf-8"))
189
+ for key in ("broken_links", "ambiguous_links", "orphans"):
190
+ print(f"{key}={len(report[key])}")
191
+ PY
192
+ ```
193
+
194
+ 2. Edit only the selected map:
195
+
196
+ ```bash
197
+ $EDITOR "$vault/map.md"
198
+ ```
199
+
200
+ For each map row, verify that the target resolves under `$vault` before changing its syntax.
201
+ Keep the existing section headings, labels, annotations, and duplicate rows. The migration is
202
+ a syntax change, not a map redesign.
203
+
204
+ 3. Review the exact diff and ensure no other working-tree file changed:
205
+
206
+ ```bash
207
+ git -C "$repo_root" diff --check -- "${vault_prefix}map.md"
208
+ git -C "$repo_root" diff -- "${vault_prefix}map.md"
209
+ git -C "$repo_root" status --short --untracked-files=all
210
+ ```
211
+
212
+ 4. Capture the post-migration report and compare it with the saved report:
213
+
214
+ ```bash
215
+ after="$(mktemp)"
216
+ after_status=0
217
+ python3 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/wiki_lint.py" \
218
+ "$vault" --json >"$after" || after_status=$?
219
+ (( after_status == 0 || after_status == 1 )) || exit "$after_status"
220
+ python3 - "$before" "$after" <<'PY'
221
+ import json
222
+ import sys
223
+ before = json.load(open(sys.argv[1], encoding="utf-8"))
224
+ after = json.load(open(sys.argv[2], encoding="utf-8"))
225
+ for key in ("broken_links", "ambiguous_links"):
226
+ old, new = len(before[key]), len(after[key])
227
+ if new != old:
228
+ raise SystemExit(f"{key} changed: {old} -> {new}")
229
+ old_orphans, new_orphans = len(before["orphans"]), len(after["orphans"])
230
+ if new_orphans > old_orphans:
231
+ raise SystemExit(f"orphans increased: {old_orphans} -> {new_orphans}")
232
+ print(f"broken_links={len(after['broken_links'])}")
233
+ print(f"ambiguous_links={len(after['ambiguous_links'])}")
234
+ print(f"orphans={old_orphans} -> {new_orphans}")
235
+ PY
236
+ ```
237
+
238
+ The surveyed expectation is **0 new broken and 0 new ambiguous** in the six standard vaults.
239
+ The invariant is that broken and ambiguous counts stay at their pre-migration values (0 in
240
+ every surveyed vault). For the six standard maps, the plan's expected orphan changes are:
241
+
242
+ | Vault | Orphans before → after |
243
+ |---|---:|
244
+ | Scripts | 7 → 3 |
245
+ | CV | 12 → 8 |
246
+ | sql | 17 → 13 |
247
+ | Music | 12 → 9 |
248
+ | bc-codebase-design | 21 → 18 |
249
+ | project B | 15 → 13 |
250
+
251
+ Both Homeflix maps carry 15 out-of-vault source-tree rows that stay inline code. Do not force
252
+ an orphan reduction there; a rise in broken links means an outside target was converted by
253
+ mistake. If any invariant fails, restore the map, inspect the target classification, and rerun
254
+ the report before continuing.
255
+
256
+ 5. Commit the map change in that repository only. Confirm the staged path before committing:
257
+
258
+ ```bash
259
+ git -C "$repo_root" add -- "${vault_prefix}map.md"
260
+ git -C "$repo_root" diff --cached --name-only
261
+ git -C "$repo_root" commit -m "wiki: make map links graph-visible"
262
+ git -C "$repo_root" status --short --untracked-files=all
263
+ ```
264
+
265
+ The final status must be clean before the next scheduled promotion. Do not stage or commit
266
+ unrelated work. The promotion runner refuses a dirty repository, so leaving an uncommitted map
267
+ edit in place blocks that vault on the next scheduled pass.
268
+
269
+ ### Completion check
270
+
271
+ Repeat the per-vault report and commit sequence for all eight current lint-list entries. The
272
+ migration is complete only when every selected repository has a clean working tree and its
273
+ post-migration report preserves the broken/ambiguous invariant. Future vaults receive graph-visible
274
+ maps directly from `scaffold.py`; this procedure is only for existing additive installations.
275
+
276
+ ## Work index
277
+
278
+ Arrived in: 0.1.0
279
+
280
+ Since 2026-11-16 the visible-layout scaffold also writes `.bc-agent/scripts/work_index.py`, a
281
+ `work/README.md` with a generated empty index, a `Stages:` line and a `Stage:` rule in the Work
282
+ items section of `.bc-agent/AGENTS.md`, "run the index" in three Keep-it-current rows, and a
283
+ `Stage:` line in the work-item template. To adopt it in an existing visible-layout project:
284
+
285
+ 1. First run the scaffold with `--dry-run`: an additive re-run recreates any scaffold file the
286
+ project deleted on purpose. Then re-run (`scaffold.py --root <project> --archetype <archetype>`).
287
+ It creates the script and `work/README.md` when missing and leaves existing files alone. To
288
+ refresh just the script, run `cp "$AGENT_CONCEPTS/concepts/bc-setup-project/body/work_index.py" .bc-agent/scripts/`.
289
+ `--force` also refreshes it, along with every other `.bc-agent/` file.
290
+ 2. In `.bc-agent/AGENTS.md`, add the project's stages in order on a `Stages:` line in the Work
291
+ items section (default `now, next, later, unscheduled`), the `Stage:` rule and the
292
+ Keep-it-current additions from a fresh scaffold; add `Stage:` under `Done when:` in
293
+ `.bc-agent/templates/work-item.md`.
294
+ 3. Give every item in `work/1-planned/` and `work/2-active/` a `Stage:` line directly under
295
+ `Done when:`, then run `python3 .bc-agent/scripts/work_index.py`. It fails, naming the item,
296
+ while any open item has a missing or unknown stage. An existing `work/README.md` needs the
297
+ `<!-- work-index:start -->` and `<!-- work-index:end -->` markers added where the table goes.
298
+ 4. Add `python3 .bc-agent/scripts/work_index.py --check` to the project's lint or CI, so a stale
299
+ table fails the build.
300
+
301
+ The `bc-work-sync` skill proposes these steps in its plan when a project lacks them.
302
+
303
+ ## Blocked by
304
+
305
+ Arrived in: 0.1.0
306
+
307
+ Since 2026-11-22 every open work item in a visible-layout project names what it waits for on a
308
+ `Blocked by:` line under `Stage:`: full item names, comma-separated, or `nothing`. The script
309
+ rejects a missing line, an unknown or dropped blocker, a self-block and a cycle, and orders the
310
+ table topologically (active, then ready, then most open items unblocked, then stage, then name),
311
+ with `#`, `Waits on` and `Unblocks` columns. The generated `.bc-agent/AGENTS.md` gains four rules
312
+ (every open item has a `Blocked by:` line; a building block gets its own item; look for overlap
313
+ before creating an item; one item, one deliverable). To adopt it in an existing visible-layout
314
+ project:
315
+
316
+ 1. Copy the script: `cp "$AGENT_CONCEPTS/concepts/bc-setup-project/body/work_index.py" .bc-agent/scripts/`.
317
+ Its tests live in the concept (`tests/test_work_index.py`); a project that keeps its own copy
318
+ of tests for the script updates them in the same change.
319
+ 2. Add `Blocked by: <full names of the items this waits for, such as 012-search-ranking, or "nothing">`
320
+ under `Stage:` in `.bc-agent/templates/work-item.md`.
321
+ 3. In the Work items section of `.bc-agent/AGENTS.md`, copy the four rules from a fresh scaffold,
322
+ and say in the `Stage:` rule that the table is ordered by `Blocked by:` with the stage as the
323
+ tiebreak. Update any prose in `work/README.md` that says the table is ordered by stage.
324
+ 4. Give every item in `work/1-planned/` and `work/2-active/` a real `Blocked by:` line: read each
325
+ item and name the items whose result it needs, or `nothing`. Do not write `nothing` everywhere
326
+ to get the script to pass; the order is only as true as these lines. Where two items wait on
327
+ one step of a third, split that step into its own item first.
328
+ 5. Run `python3 .bc-agent/scripts/work_index.py`. It fails, naming the item, until every open item
329
+ has a valid line; then `--check` passes.
330
+
331
+ The `bc-work-sync` skill reports open items with no `Blocked by:` line and blockers naming unknown
332
+ or dropped items.
333
+
334
+ ## Owner order
335
+
336
+ Arrived in: 0.1.0
337
+
338
+ Since 2026-11-22 `work_index.py` reads an optional `work/order.md`: the owner's ranking of open
339
+ items, top first, one numbered line each (`1. 012-search-ranking`); other lines are ignored.
340
+ The table has three tiers: active items, then planned items an active item is (transitively)
341
+ blocked by, then other planned items. Within a tier, listed items come in list order, before
342
+ unlisted ones; an item still never comes before an open item it is blocked by. Done and dropped
343
+ names (month folders included) are skipped unless an open item has the name; an unknown or
344
+ repeated name is an error. The tiers apply with or without the file, so blockers of active items
345
+ can move up even in a project with no `order.md`. To adopt it in an existing project:
346
+
347
+ 1. Copy the script: `cp "$AGENT_CONCEPTS/concepts/bc-setup-project/body/work_index.py" .bc-agent/scripts/`.
348
+ 2. Optionally copy the `work/order.md` rule from a fresh scaffold's `.bc-agent/AGENTS.md` into the
349
+ Work items section, and replace any older summary of the table order in the `Stage:` and
350
+ `Blocked by:` rules and in `work/README.md` with the fresh scaffold's wording (three tiers;
351
+ regenerate after changing `order.md`).
352
+ 3. Run `python3 .bc-agent/scripts/work_index.py`, then `--check`.
353
+
354
+ Since 2026-11-23 `--check` also fails while `order.md` leaves out an open item or lists an item
355
+ above one it waits on, and the fresh scaffold adds the rule "Never reorder `work/order.md`; place
356
+ what you add". A project with an `order.md` re-copies the script (step 1) and the rule (step 2);
357
+ a project without one is unaffected.
358
+
359
+ ## Design README
360
+
361
+ Arrived in: 0.1.0
362
+
363
+ Since 2026-11-21 the code, ops and hybrid scaffold also writes `docs/design/README.md`, the entry
364
+ page of the project's design framework (how the product looks and behaves now; its method is the
365
+ `bc-design` skill's `design-framework.md`), and a line in `.bc-agent/map.md` routing design, UI and
366
+ CLI wording work to it. Learning and knowledge vaults do not get it. To adopt it in an existing
367
+ project, one project at a time on its next scaffold run:
368
+
369
+ 1. Re-run the scaffold (`--dry-run` first, as above). It creates `docs/design/README.md` when
370
+ missing and never overwrites an existing one.
371
+ 2. The existing `.bc-agent/map.md` is left alone, and the scaffold prints an upgrade note while it
372
+ lacks the line. Copy the line from a fresh scaffold's map into the "Outside this folder" section.
373
+ 3. If the project already keeps design pages elsewhere, list them under Pages in the README rather
374
+ than moving them, unless the owner asks for the move.
375
+
376
+ ## Guardrails README
377
+
378
+ Arrived in: 0.1.0
379
+
380
+ Since 2026-11-25 the code, ops and hybrid scaffold also writes `docs/guardrails/README.md`, the
381
+ page listing the project's speed, size, memory and structure limits and their checks (its method is
382
+ the `bc-performance-guardrails` skill), and a line in `.bc-agent/map.md` routing guardrail work to it. Learning and
383
+ knowledge vaults do not get it, and no measuring script is scaffolded. Existing projects are not
384
+ swept: the `bc-performance-guardrails` skill copies the page text the first time guardrail work comes up. A
385
+ scaffold re-run also creates it when missing (never overwriting one) and prints an upgrade note
386
+ while the map lacks the line; copy the line from a fresh scaffold's map into "Outside this folder".
387
+
388
+ ## Source line
389
+
390
+ Arrived in: 0.1.0
391
+
392
+ Since 2026-11-22 the work-item template has an optional `Source:` line under `Issue:`, naming the
393
+ skill or review that produced the item (for example `bc-plan-to-pipeline` or
394
+ `bc-improve-codebase-architecture`). The scaffold does not rewrite an existing template; to adopt it,
395
+ copy the line from a fresh scaffold's `.bc-agent/templates/work-item.md`. Existing items need no
396
+ change: the line is optional.
397
+
398
+ ## Work data
399
+
400
+ Arrived in: 0.3.0
401
+
402
+ Since 2026-11-25 `work_index.py --json` prints every work item's data for a dashboard (fields in
403
+ the skill's [work-data.md](work-data.md)), the scaffold also writes
404
+ `.bc-agent/scripts/work_spent.py`, which estimates an item's time, tokens and cost from the agent
405
+ tools' session files, and the Work items rules in `.bc-agent/AGENTS.md` tell agents to write four
406
+ lines: `Held by:` while an agent works on an item, `Review:` and `Gate:` in a step's Notes, and
407
+ `Spent:` at the end of a finished item's Outcome. To adopt it in an existing project:
408
+
409
+ 1. Copy both scripts: `cp "$AGENT_CONCEPTS"/concepts/bc-setup-project/body/{work_index,work_spent}.py .bc-agent/scripts/`.
410
+ A scaffold re-run (`--dry-run` first) creates `work_spent.py` when missing but leaves an existing
411
+ `work_index.py` alone; `--force` refreshes both, along with every other `.bc-agent/` file.
412
+ 2. In `.bc-agent/AGENTS.md`, copy the `Held by:`, `Review:`/`Gate:` and `Spent:` rules from the
413
+ Work items section of a fresh scaffold, and its "Begin agreed work", "Finish a step" and
414
+ "Finish or drop an item" rows. Without them agents keep working as before and the lines are
415
+ simply not written.
416
+
417
+ Existing items need no change. All four lines are optional: an item without them gets `null` for
418
+ `held_by` and `spent` and empty `review` and `gate` lists in the JSON, and `--check` does not
419
+ warn. Items get a `history` from git with no change at all. Only a malformed line, or a `Held by:`
420
+ line left in a done item, gives a `--check` warning.
421
+
422
+ ## Needs owner line
423
+
424
+ Arrived in: 0.4.0
425
+
426
+ Since 2026-11-26 the Work items rules in `.bc-agent/AGENTS.md` and the work-item template have an
427
+ optional `Needs owner: <what the owner must decide or do, and when>` line, for an item that will
428
+ need an owner decision or action before or during its build; it is removed once settled.
429
+ `work_index.py --json` reports it as `header.needs_owner`. To adopt it in an existing project:
430
+
431
+ 1. In `.bc-agent/AGENTS.md`, copy the `Needs owner:` rule from the Work items section of a fresh
432
+ scaffold, below the `Kind:` rule.
433
+ 2. Copy the `Needs owner:` line from a fresh scaffold's `.bc-agent/templates/work-item.md` into the
434
+ project's template, below `Kind:`.
435
+ 3. Copy the script: `cp "$AGENT_CONCEPTS"/concepts/bc-setup-project/body/work_index.py .bc-agent/scripts/`.
436
+ 4. Add the line to any open item that already needs an owner decision or action.
437
+
438
+ Without step 3 the line is still written and read from the item file; only the JSON lacks it.
439
+
440
+ ## Changes UI line
441
+
442
+ Arrived in: 0.4.0
443
+
444
+ Since 2026-11-26 the Work items rules in `.bc-agent/AGENTS.md` and the work-item template have an
445
+ optional `Changes UI: <what the user will see change>` line, for an item whose build changes what
446
+ users see or operate (screens, controls, labels, keys, layout, styling); it is kept current when
447
+ the plan changes. `work_index.py --json` reports it as `header.changes_ui`. To adopt it in an
448
+ existing project:
449
+
450
+ 1. In `.bc-agent/AGENTS.md`, copy the `Changes UI:` rule from the Work items section of a fresh
451
+ scaffold, below the `Needs owner:` rule.
452
+ 2. Copy the `Changes UI:` line from a fresh scaffold's `.bc-agent/templates/work-item.md` into the
453
+ project's template, below `Needs owner:`.
454
+ 3. Copy the script: `cp "$AGENT_CONCEPTS"/concepts/bc-setup-project/body/work_index.py .bc-agent/scripts/`.
455
+ 4. Add the line to any open item whose build changes what users see.
456
+
457
+ Without step 3 the line is still written and read from the item file; only the JSON lacks it.
@@ -101,7 +101,7 @@ Archetypes:
101
101
  For code, ops and hybrid, ask whether the project has a product-level specification. Create `docs/PRD.md` only on yes; a feature's requirements belong in its work item, and `ARCHITECTURE.md` is created when the project first needs one. Why: an empty placeholder looks like knowledge and is not; the table already names both homes.
102
102
 
103
103
  5. **Safe to re-run / plug into an existing project.** The script is **additive and idempotent**: it creates only the files that are missing, leaves every existing file untouched (an existing root `AGENTS.md` is preserved verbatim and flagged for a manual pointer-merge), and **never deletes anything** (the one exception is the explicit migration below). Re-running changes nothing. Use `--dry-run` when previewing an existing or messy project. Existing files are overwritten only when explicitly forced (`--force` for files under `.bc-agent/`, `--force-root` for the root `AGENTS.md`) — don't use those unless the user asks. Nothing else is ever overwritten, not even with `--force`: root `glossary.md`, `work/` and `docs/` hold the project's own content.
104
- For code, ops and hybrid, when earlier-layout paths exist under `.bc-agent/` (`tasks/`, `decisions/`, `research/`, `components/`, `plans/`, `conventions/planning-workflow.md` and similar), the script writes nothing, names the paths it found and exits non-zero. Why: two sets of homes for the same knowledge would both look current. Tell the user that moving the project to the visible layout is a separate, explicit migration (see **Migrate an existing project** below). Only if the user wants the new files beside the old ones anyway, re-run with `--allow-earlier-layout`: it creates the missing files, leaves every existing file untouched and repeats the note. If the script prints **Upgrade notes for existing files left untouched**, treat them as follow-up work for the current agent: inspect the named files and merge the smallest safe pointer by hand rather than assuming the scaffold alone upgraded old instructions.
104
+ For code, ops and hybrid, when earlier-layout paths exist under `.bc-agent/` (`tasks/`, `decisions/`, `research/`, `components/`, `plans/`, `conventions/planning-workflow.md` and similar), the script writes nothing, names the paths it found and exits non-zero. Why: two sets of homes for the same knowledge would both look current. Tell the user that moving the project to the visible layout is a separate, explicit migration (see **Migrate an existing project** below). Only if the user wants the new files beside the old ones anyway, re-run with `--allow-earlier-layout`: it creates the missing files, leaves every existing file untouched and repeats the note. The shipped [migration guide](MIGRATIONS.md) describes manual upgrade steps. If the script prints **Upgrade notes for existing files left untouched**, treat them as follow-up work for the current agent: inspect the named files and merge the smallest safe pointer by hand rather than assuming the scaffold alone upgraded old instructions.
105
105
 
106
106
  6. **Scaffold.** Run the bundled script (it lives next to this file):
107
107
  ```
@@ -35,6 +35,7 @@ from __future__ import annotations
35
35
 
36
36
  import argparse
37
37
  import datetime as _dt
38
+ import json
38
39
  import os
39
40
  import re
40
41
  import subprocess
@@ -2053,6 +2054,7 @@ def upgrade_notes(root: Path, archetype: str) -> list[str]:
2053
2054
  """Manual merge hints for existing files that were intentionally left untouched."""
2054
2055
  vault = root / ".bc-agent"
2055
2056
  notes: list[str] = []
2057
+ migrations = Path(__file__).resolve().with_name("MIGRATIONS.md")
2056
2058
  if archetype in VISIBLE_ARCHETYPES:
2057
2059
  map_path = vault / "map.md"
2058
2060
  if map_path.exists() and any(
@@ -2061,19 +2063,19 @@ def upgrade_notes(root: Path, archetype: str) -> list[str]:
2061
2063
  notes.append("`.bc-agent/map.md` should use real Markdown links for in-vault targets")
2062
2064
  if map_path.exists() and "`docs/design/README.md`" not in map_path.read_text(errors="ignore"):
2063
2065
  notes.append("`.bc-agent/map.md` has no line routing design, UI or CLI wording work to "
2064
- "`docs/design/README.md` (see MIGRATIONS.md#design-readme)")
2066
+ f"`docs/design/README.md` (see {migrations}#design-readme)")
2065
2067
  if map_path.exists() and "`docs/guardrails/README.md`" not in map_path.read_text(errors="ignore"):
2066
2068
  notes.append("`.bc-agent/map.md` has no line routing speed, size, memory or structure limit "
2067
- "work to `docs/guardrails/README.md` (see MIGRATIONS.md#guardrails-readme)")
2069
+ f"work to `docs/guardrails/README.md` (see {migrations}#guardrails-readme)")
2068
2070
  legacy = earlier_layout_paths(root, archetype)
2069
2071
  if legacy:
2070
2072
  notes.append(
2071
2073
  "earlier-layout paths exist under .bc-agent (" + ", ".join(legacy) + "); "
2072
2074
  "they were left in place and nothing was moved — migrating them to the visible "
2073
- "layout is a separate, explicit step (see MIGRATIONS.md)")
2075
+ f"layout is a separate, explicit step (see {migrations})")
2074
2076
  agents_path = vault / "AGENTS.md"
2075
2077
  if agents_path.exists() and not re.search(r"^Stages:", agents_path.read_text(errors="ignore"), re.M):
2076
- notes.append("`.bc-agent/AGENTS.md` has no `Stages:` line; work_index.py falls back to now, next, later, unscheduled (see MIGRATIONS.md#work-index).")
2078
+ notes.append(f"`.bc-agent/AGENTS.md` has no `Stages:` line; work_index.py falls back to now, next, later, unscheduled (see {migrations}#work-index).")
2077
2079
  try:
2078
2080
  has_table = agents_path.exists() and bool(parse_where_things_go(agents_path.read_text(errors="ignore")))
2079
2081
  except ValueError:
@@ -2676,7 +2678,7 @@ def main() -> int:
2676
2678
  if legacy:
2677
2679
  print("ERROR: earlier-layout paths exist under .bc-agent (" + ", ".join(legacy) + "); "
2678
2680
  "nothing was written.")
2679
- print("Migrating them to the visible layout is a separate, explicit step (see MIGRATIONS.md). "
2681
+ print(f"Migrating them to the visible layout is a separate, explicit step (see {Path(__file__).resolve().with_name('MIGRATIONS.md')}). "
2680
2682
  "Re-run with --allow-earlier-layout to create the missing visible-layout files beside "
2681
2683
  "them, leaving every existing file untouched.")
2682
2684
  return 1
@@ -2686,6 +2688,16 @@ def main() -> int:
2686
2688
  overwritten: list[Path] = []
2687
2689
  skipped: list[Path] = [] # existed, left untouched
2688
2690
  planned = targets(root, slug, args.date, args.archetype)
2691
+ # The marker is created only with a new vault and is never a forced target.
2692
+ if not vault.exists() and not (args.force or args.allow_earlier_layout):
2693
+ try:
2694
+ package = json.loads((Path(__file__).resolve().parents[3] / 'package.json').read_text())
2695
+ version = package['version']
2696
+ if not isinstance(version, str) or not version:
2697
+ version = 'unknown'
2698
+ except (OSError, ValueError, KeyError, TypeError):
2699
+ version = 'unknown'
2700
+ planned.append((vault / '.scaffold-version', f'agent-concepts {version}\n', False))
2689
2701
  if not _preflight_targets(root, planned):
2690
2702
  return 1
2691
2703
 
@@ -7,7 +7,11 @@ description: Use when executing a written implementation plan in the current ses
7
7
 
8
8
  A controller executes a plan by giving each task to a fresh implementer agent, then running spec-compliance and code-quality review before moving on.
9
9
 
10
- At preflight, run the machine's storage health check if one exists, and stop and report on critical or unknown health or if the configured check cannot run. If no storage health check is configured, skip it and note that in one line in the report. At completion, prove each worker's commits are in `HEAD` (ancestor or patch-equivalent) and record that proof before removing worktrees or branches. Every implementer/reviewer packet says: run pytest through the guarded test runner the project's or machine's instructions name (otherwise plain `pytest`, with `tmp_path` for test fixtures and cleanup even on failure; never custom `--basetemp`); make scratch folders with `mktemp -d`, never under `/tmp`; run targeted tests only and reuse the shared full-suite evidence. The `agent-kernel` concept's Storage safety section holds the temp-file and scratch-folder rules, when loaded. Why: fresh agents cannot infer shared storage ownership.
10
+ Load `bc-safe-runs`. Else: guarded test runner (fallback `pytest`; no custom `--basetemp`), `mktemp -d` outside `/tmp`, targeted tests; configured storage check before full suites, worktrees, fan-out: stop if critical or unknown, or if the check cannot run.
11
+
12
+ Load `bc-durable-subagents` before the first launch. Else: before launching, write a run folder that survives a reboot and `manifest.md` (key → artifact path → role → model + thinking → task), state its path in chat, and have each child append to its own artifact.
13
+
14
+ At completion, prove each worker's commits are in `HEAD` (ancestor or patch-equivalent) and record that proof before removing worktrees or branches. Put the `bc-safe-runs` packet line in every worker or reviewer task. Workers run targeted tests only and reuse the shared full-suite evidence. Why: fresh agents cannot infer shared storage ownership.
11
15
 
12
16
  ## Use when
13
17