agent-concepts 0.0.0-stage → 0.4.1

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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +773 -2
  3. package/concepts/bc-brainstorming/body/SKILL.md +43 -0
  4. package/concepts/bc-code-review/body/SKILL.md +120 -0
  5. package/concepts/bc-codebase-design/body/SKILL.md +54 -0
  6. package/concepts/bc-codebase-docs/body/SKILL.md +150 -0
  7. package/concepts/bc-council-audit-security/body/SKILL.md +72 -0
  8. package/concepts/bc-council-chain/body/SKILL.md +71 -0
  9. package/concepts/bc-council-challenge-plan/body/SKILL.md +78 -0
  10. package/concepts/bc-council-find-bugs/body/SKILL.md +70 -0
  11. package/concepts/bc-council-improve-architecture/body/SKILL.md +52 -0
  12. package/concepts/bc-council-mode/body/SKILL.md +56 -0
  13. package/concepts/bc-council-mode/body/examples/agents/README.md +11 -0
  14. package/concepts/bc-council-mode/body/examples/agents/council-change.md +14 -0
  15. package/concepts/bc-council-mode/body/examples/agents/council-compat.md +14 -0
  16. package/concepts/bc-council-mode/body/examples/agents/council-risk.md +14 -0
  17. package/concepts/bc-council-mode/body/references/pass-contracts.md +133 -0
  18. package/concepts/bc-delegate-investigation/body/SKILL.md +119 -0
  19. package/concepts/bc-delegate-investigation/body/examples/pi-settings-snippet.json +8 -0
  20. package/concepts/bc-delegate-investigation/body/pi.md +170 -0
  21. package/concepts/bc-design/body/SKILL.md +49 -0
  22. package/concepts/bc-design/body/design-framework.md +39 -0
  23. package/concepts/bc-design/body/existing-app.md +9 -0
  24. package/concepts/bc-design/body/new-work.md +22 -0
  25. package/concepts/bc-design/body/principles.md +34 -0
  26. package/concepts/bc-design/body/surfaces.md +13 -0
  27. package/concepts/bc-diagnosing-bugs/body/SKILL.md +83 -0
  28. package/concepts/bc-dispatching-parallel-agents/body/SKILL.md +63 -0
  29. package/concepts/bc-domain-modeling/body/SKILL.md +40 -0
  30. package/concepts/bc-executing-plans/body/SKILL.md +50 -0
  31. package/concepts/bc-explain-visually/body/SKILL.md +167 -0
  32. package/concepts/bc-find-bugs/body/SKILL.md +90 -0
  33. package/concepts/bc-finishing-development-branch/body/SKILL.md +73 -0
  34. package/concepts/bc-grilling/body/SKILL.md +22 -0
  35. package/concepts/bc-handoff/body/SKILL.md +104 -0
  36. package/concepts/bc-handoff/body/pickup.md +107 -0
  37. package/concepts/bc-handoff/body/writing.md +217 -0
  38. package/concepts/bc-improve-codebase-architecture/body/SKILL.md +101 -0
  39. package/concepts/bc-json-canvas/body/SKILL.md +40 -0
  40. package/concepts/bc-json-canvas/body/references/EXAMPLES.md +71 -0
  41. package/concepts/bc-json-canvas/body/references/SPEC.md +55 -0
  42. package/concepts/bc-json-canvas/body/references/VALIDATION.md +26 -0
  43. package/concepts/bc-minimal-solution-ladder/body/SKILL.md +120 -0
  44. package/concepts/bc-obsidian-bases/body/SKILL.md +59 -0
  45. package/concepts/bc-obsidian-bases/body/references/EXAMPLES.md +80 -0
  46. package/concepts/bc-obsidian-bases/body/references/FUNCTIONS.md +49 -0
  47. package/concepts/bc-obsidian-bases/body/references/SYNTAX.md +82 -0
  48. package/concepts/bc-obsidian-bases/body/references/TROUBLESHOOTING.md +41 -0
  49. package/concepts/bc-obsidian-markdown/body/SKILL.md +47 -0
  50. package/concepts/bc-obsidian-markdown/body/references/CALLOUTS.md +40 -0
  51. package/concepts/bc-obsidian-markdown/body/references/EMBEDS.md +35 -0
  52. package/concepts/bc-obsidian-markdown/body/references/PROPERTIES.md +37 -0
  53. package/concepts/bc-optimize-code/body/SKILL.md +41 -0
  54. package/concepts/bc-performance-guardrails/body/SKILL.md +53 -0
  55. package/concepts/bc-performance-guardrails/body/measuring.md +29 -0
  56. package/concepts/bc-performance-guardrails/body/targets.md +20 -0
  57. package/concepts/bc-pipeline-to-done/body/SKILL.md +205 -0
  58. package/concepts/bc-pipeline-to-done/body/agents/bc-drain-auditor.md +19 -0
  59. package/concepts/bc-pipeline-to-done/body/agents/bc-drain-reviewer.md +19 -0
  60. package/concepts/bc-pipeline-to-done/body/agents/bc-drain-worker.md +19 -0
  61. package/concepts/bc-pipeline-to-done/body/execute-issue.md +71 -0
  62. package/concepts/bc-pipeline-to-done/body/recovery-bundle.md +79 -0
  63. package/concepts/bc-pipeline-to-done/body/review-contract.md +105 -0
  64. package/concepts/bc-pipeline-to-done/body/roles.md +13 -0
  65. package/concepts/bc-pipeline-to-done/body/scripts/publish-check.py +172 -0
  66. package/concepts/bc-pipeline-to-done/body/source-issues.md +86 -0
  67. package/concepts/bc-pipeline-to-done/body/source-work-items.md +76 -0
  68. package/concepts/bc-plain-language/body/SKILL.md +134 -0
  69. package/concepts/bc-plan-slicing/body/SKILL.md +56 -0
  70. package/concepts/bc-plan-to-pipeline/body/SKILL.md +89 -0
  71. package/concepts/bc-prd-drafting/body/SKILL.md +43 -0
  72. package/concepts/bc-prompting-agents/body/SKILL.md +278 -0
  73. package/concepts/bc-prototype/body/SKILL.md +40 -0
  74. package/concepts/bc-qmd/body/SKILL.md +64 -0
  75. package/concepts/bc-research/body/SKILL.md +26 -0
  76. package/concepts/bc-security-audit/body/AI-AND-LLM.md +25 -0
  77. package/concepts/bc-security-audit/body/ATTACK-CLASSES.md +35 -0
  78. package/concepts/bc-security-audit/body/DESKTOP-MOBILE-AND-LOCAL-IPC.md +28 -0
  79. package/concepts/bc-security-audit/body/RECONNAISSANCE.md +49 -0
  80. package/concepts/bc-security-audit/body/SKILL.md +117 -0
  81. package/concepts/bc-security-audit/body/SUPPLY-CHAIN-AND-RELEASE.md +28 -0
  82. package/concepts/bc-security-audit/body/VALIDATION-AND-REPORTING.md +124 -0
  83. package/concepts/bc-security-audit/body/WEB-PROTOCOL-AND-AUTH.md +27 -0
  84. package/concepts/bc-security-audit/body/validate_audit.py +151 -0
  85. package/concepts/bc-self-improve/body/SKILL.md +104 -0
  86. package/concepts/bc-seo/body/CITATIONS.md +23 -0
  87. package/concepts/bc-seo/body/IMAGE-SEO.md +350 -0
  88. package/concepts/bc-seo/body/SKILL.md +453 -0
  89. package/concepts/bc-setup-project/body/SKILL.md +252 -0
  90. package/concepts/bc-setup-project/body/scaffold.py +2751 -0
  91. package/concepts/bc-setup-project/body/starter-items.md +157 -0
  92. package/concepts/bc-setup-project/body/work-data.md +114 -0
  93. package/concepts/bc-setup-project/body/work_index.py +626 -0
  94. package/concepts/bc-setup-project/body/work_spent.py +220 -0
  95. package/concepts/bc-subagent-driven-development/body/SKILL.md +61 -0
  96. package/concepts/bc-tdd/body/SKILL.md +184 -0
  97. package/concepts/bc-tdd/body/formal.md +77 -0
  98. package/concepts/bc-tdd/body/mocking.md +49 -0
  99. package/concepts/bc-tdd/body/properties.md +59 -0
  100. package/concepts/bc-tdd/body/refactoring.md +12 -0
  101. package/concepts/bc-tdd/body/scripts/confirm-red.py +136 -0
  102. package/concepts/bc-tdd/body/tests.md +59 -0
  103. package/concepts/bc-teach/body/GLOSSARY-FORMAT.md +36 -0
  104. package/concepts/bc-teach/body/LEARNING-RECORD-FORMAT.md +60 -0
  105. package/concepts/bc-teach/body/MISSION-FORMAT.md +34 -0
  106. package/concepts/bc-teach/body/RESOURCES-FORMAT.md +53 -0
  107. package/concepts/bc-teach/body/REVIEW-FORMAT.md +48 -0
  108. package/concepts/bc-teach/body/SKILL.md +281 -0
  109. package/concepts/bc-teach/body/WIKI-FORMAT.md +58 -0
  110. package/concepts/bc-teach/body/scripts/due.py +65 -0
  111. package/concepts/bc-to-spec/body/SKILL.md +21 -0
  112. package/concepts/bc-to-tickets/body/SKILL.md +21 -0
  113. package/concepts/bc-triage/body/AGENT-BRIEF.md +38 -0
  114. package/concepts/bc-triage/body/OUT-OF-SCOPE.md +51 -0
  115. package/concepts/bc-triage/body/SKILL.md +81 -0
  116. package/concepts/bc-unslop/body/SKILL.md +269 -0
  117. package/concepts/bc-using-git-worktrees/body/SKILL.md +91 -0
  118. package/concepts/bc-wiki-maintain/body/SKILL.md +361 -0
  119. package/concepts/bc-wiki-maintain/body/runner/README.md +552 -0
  120. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-lint.service +24 -0
  121. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-lint.timer +15 -0
  122. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain-all.service +29 -0
  123. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain-all.timer +16 -0
  124. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain.service +28 -0
  125. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain.timer +12 -0
  126. package/concepts/bc-wiki-maintain/body/runner/bc-wiki-notify@.service +15 -0
  127. package/concepts/bc-wiki-maintain/body/runner/notify-failure.sh +92 -0
  128. package/concepts/bc-wiki-maintain/body/runner/run-lint.sh +69 -0
  129. package/concepts/bc-wiki-maintain/body/runner/run-promotion-all.sh +103 -0
  130. package/concepts/bc-wiki-maintain/body/runner/run-promotion.sh +270 -0
  131. package/concepts/bc-wiki-maintain/body/wiki_lint.py +958 -0
  132. package/concepts/bc-wiki-maintain/body/wiki_search.py +206 -0
  133. package/concepts/bc-work-sync/body/PLAN.md +46 -0
  134. package/concepts/bc-work-sync/body/SKILL.md +71 -0
  135. package/concepts/bc-writing-plans/body/SKILL.md +79 -0
  136. package/package.json +130 -4
  137. package/packages/agent-kernel-pi/AGENT-KERNEL.md +109 -0
  138. package/packages/agent-kernel-pi/index.js +8 -0
  139. package/packages/agent-kernel-pi/package.json +12 -0
@@ -0,0 +1,552 @@
1
+ # Scheduled runner
2
+
3
+ This directory contains a **user-scope** systemd timer template for one vault. It is a
4
+ reviewable template: these files do not install, enable, or start anything.
5
+
6
+ The timer runs `bc-wiki-maintain.service` daily at 03:30 local time, with a random
7
+ 15-minute delay. The service is `Type=oneshot`, writes stdout/stderr to the journal,
8
+ and fails visibly when detection, the agent, or the dedicated commit fails. systemd
9
+ is intentional here: `journalctl --user` and `systemctl --user status` make silent
10
+ scheduler failures observable.
11
+
12
+ ## Failure notifications
13
+
14
+ All runner services set `OnFailure=bc-wiki-notify@%n.service`. When any service exits nonzero,
15
+ systemd starts the `bc-wiki-notify@.service` template with the failed unit name as `%i`. The
16
+ runner-local `notify-failure.sh` resolves that unit's `VAULT_ROOT` when it has one, or its
17
+ `VAULT_LIST` for the list-driven service, reads a short error from its user journal, and sends a
18
+ critical desktop notification with `notify-send`. If the vault/list or journal cannot be inspected,
19
+ the message says so; if `notify-send` is missing or fails, the notifier exits nonzero instead of
20
+ silently succeeding.
21
+
22
+ A healthy no-op does not fire the notifier: the promotion runner exits 0 for
23
+ `PROMOTION_REQUIRED=0` before invoking Pi, and the lint runner exits 0 when all detectors pass.
24
+ The notifier is only a failure path; it does not replace the journal or `systemctl --user`
25
+ status checks.
26
+
27
+ Install the notifier template alongside whichever runner service(s) you use. It runs
28
+ `notify-failure.sh` from the installed skill (`~/.agents/skills/bc-wiki-maintain/runner/`), so it
29
+ needs no checkout of this repository; edit its `ExecStart=` only if the skill lives elsewhere:
30
+
31
+ ```bash
32
+ wiki_skill_dir="$HOME/.agents/skills/bc-wiki-maintain"
33
+ unit_dir="$HOME/.config/systemd/user"
34
+ install -Dm644 "$wiki_skill_dir/runner/bc-wiki-notify@.service" \
35
+ "$unit_dir/bc-wiki-notify@.service"
36
+ systemd-analyze --user verify "$unit_dir/bc-wiki-notify@.service"
37
+ ```
38
+
39
+ Copy the notifier template, the matching runner service, and its timer before running
40
+ `systemctl --user daemon-reload`. Do not symlink the templates, so local edits survive updates.
41
+ Every runner service names it in `OnFailure=`; without it a failed run notifies nobody.
42
+
43
+ ## Lint all configured vaults (detection only)
44
+
45
+ The separate `bc-wiki-lint.service` runs `run-lint.sh` against a list of vault roots. It is
46
+ **detection only**: it never invokes Pi or another agent, edits files, writes Git state, or
47
+ commits. Each vault gets a human-readable header and the normal `wiki_lint.py` report. The
48
+ runner continues after a missing vault or detector failure so one bad path cannot hide the other
49
+ reports, then exits nonzero if any path failed. Orphans, missing index entries, stale references,
50
+ and unpromoted-log findings are advisory; only a detector nonzero result (currently broken or
51
+ ambiguous links) fails the overall run.
52
+
53
+ The list file contains one path per line. Blank lines and lines beginning with `#` are ignored;
54
+ leading `~` and `~/` expand to `$HOME`. Use absolute paths or paths whose meaning is stable from
55
+ the service working directory:
56
+
57
+ ```text
58
+ # Project vaults to inspect
59
+ ~/path/to/project-a/.bc-agent
60
+ ~/path/to/project-b/.agent
61
+ /absolute/path/to/project-c/agent/wiki
62
+ ```
63
+
64
+ Install the lint-only timer after editing the copied service's two placeholders:
65
+
66
+ ```bash
67
+ export AGENT_CONCEPTS="$HOME/path/to/agent-concepts"
68
+ unit_dir="$HOME/.config/systemd/user"
69
+ list_file="$HOME/.config/agent-concepts/wiki-lint-vaults.txt"
70
+ mkdir -p "$(dirname "$list_file")"
71
+ $EDITOR "$list_file"
72
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-lint.service" \
73
+ "$unit_dir/bc-wiki-lint.service"
74
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-lint.timer" \
75
+ "$unit_dir/bc-wiki-lint.timer"
76
+ $EDITOR "$unit_dir/bc-wiki-lint.service" # set AGENT_CONCEPTS and VAULT_LIST
77
+ systemd-analyze --user verify "$unit_dir/bc-wiki-lint.service"
78
+ systemd-analyze --user verify "$unit_dir/bc-wiki-lint.timer"
79
+ systemctl --user daemon-reload
80
+ systemctl --user enable --now bc-wiki-lint.timer
81
+ ```
82
+
83
+ The lint timer is scheduled at 04:15 with a 15-minute random delay, separate from the
84
+ promotion timer's 03:30 schedule. Check it with:
85
+
86
+ ```bash
87
+ systemctl --user status bc-wiki-lint.timer
88
+ systemctl --user status bc-wiki-lint.service
89
+ journalctl --user -u bc-wiki-lint.service --since today
90
+ ```
91
+
92
+ The journal shows one `=== wiki lint: ... ===` section per configured path and a final failure
93
+ count. A successful service means every listed directory ran the detector and every detector
94
+ returned zero; it does **not** mean the vaults have no advisory findings. To run the same check
95
+ manually without installing a timer:
96
+
97
+ ```bash
98
+ export AGENT_CONCEPTS="$HOME/path/to/agent-concepts"
99
+ export VAULT_LIST="$HOME/.config/agent-concepts/wiki-lint-vaults.txt"
100
+ "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/run-lint.sh"
101
+ ```
102
+
103
+ To disable only the lint-all timer:
104
+
105
+ ```bash
106
+ systemctl --user disable --now bc-wiki-lint.timer
107
+ ```
108
+
109
+ The lint-all runner is intentionally separate from the one-vault promotion runner below.
110
+
111
+ ## Promote all configured vaults (list-driven alternative)
112
+
113
+ `run-promotion-all.sh` reads a configured `VAULT_LIST`, prints one header per entry, and invokes
114
+ `run-promotion.sh` once for each directory. The child runner retains every
115
+ per-vault safety check and commit rule. A missing directory or failed child is reported and does
116
+ not stop later vaults; the all-vault runner exits nonzero when any vault fails and its final
117
+ summary lists each failing path on its own line.
118
+
119
+ Each child runs under `timeout --kill-after`, defaulting to 30 minutes with a 30-second grace
120
+ period, overridable with `PROMOTION_TIMEOUT` and `PROMOTION_KILL_AFTER`. One unit covers every
121
+ vault, so an agent that hangs would otherwise consume the whole `TimeoutStartSec` budget and the
122
+ vaults after it would never run — an exposure the one-vault units never had. `--kill-after` is
123
+ load-bearing rather than defensive: plain `timeout` sends SIGTERM and then waits indefinitely, so
124
+ a child that traps or ignores it is not bounded at all. The runner requires GNU `timeout`
125
+ (preferring `gnutimeout`, Ubuntu's name for it) and fails before any vault otherwise: uutils
126
+ `timeout`, the default on Ubuntu 26.04, signals only the direct child, so a timed-out agent's
127
+ descendants would keep running.
128
+
129
+ A timed-out vault is reported as a failure and the batch continues, but **it is not self-healing**.
130
+ The timeout can land mid-write, and `run-promotion.sh` refuses to start on a dirty tree, so that
131
+ vault fails closed on every subsequent run until a human inspects it and either commits or resets
132
+ the leftover changes. The runner says so on stderr when it times a vault out.
133
+
134
+ Use a separate list from `wiki-lint-vaults.txt`. Lint only reads vaults, while promotion invokes
135
+ an agent that writes and commits, so adding a vault to the lint list must not silently authorise a
136
+ scheduled write. The promotion list is machine-local and uses the same syntax as the lint list:
137
+
138
+ ```text
139
+ # Vaults explicitly authorised for scheduled promotion
140
+ ~/path/to/project-a/.bc-agent
141
+ ~/path/to/project-b/.bc-agent
142
+ /absolute/path/to/project-c/agent/wiki
143
+ ```
144
+
145
+ This list-driven timer is an **alternative** to the one-vault promotion timers, not an addition
146
+ to them. Disable the per-vault promotion timers before enabling this timer, so a vault cannot be
147
+ processed concurrently by two agents.
148
+
149
+ Install the all-vault timer after review; this only copies templates and does not install anything
150
+ by itself:
151
+
152
+ ```bash
153
+ export AGENT_CONCEPTS="$HOME/path/to/agent-concepts"
154
+ unit_dir="$HOME/.config/systemd/user"
155
+ list_file="$HOME/.config/agent-concepts/wiki-promotion-vaults.txt"
156
+ mkdir -p "$(dirname "$list_file")"
157
+ $EDITOR "$list_file"
158
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain-all.service" \
159
+ "$unit_dir/bc-wiki-maintain-all.service"
160
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain-all.timer" \
161
+ "$unit_dir/bc-wiki-maintain-all.timer"
162
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-notify@.service" \
163
+ "$unit_dir/bc-wiki-notify@.service"
164
+ $EDITOR "$unit_dir/bc-wiki-maintain-all.service" # set AGENT_CONCEPTS, VAULT_LIST, and PI_BIN
165
+ systemd-analyze --user verify "$unit_dir/bc-wiki-maintain-all.service"
166
+ systemd-analyze --user verify "$unit_dir/bc-wiki-maintain-all.timer"
167
+ systemd-analyze --user verify "$unit_dir/bc-wiki-notify@.service"
168
+ # Disable every installed bc-wiki-maintain-*.timer for the one-vault alternative first.
169
+ systemctl --user daemon-reload
170
+ systemctl --user enable --now bc-wiki-maintain-all.timer
171
+ ```
172
+
173
+ Check the all-vault run and its per-vault failure summary with:
174
+
175
+ ```bash
176
+ systemctl --user status bc-wiki-maintain-all.timer
177
+ systemctl --user status bc-wiki-maintain-all.service
178
+ journalctl --user -u bc-wiki-maintain-all.service --since today
179
+ ```
180
+
181
+ The all-vault service has no single `VAULT_ROOT`; when it fails, the runner's final journal
182
+ summary names every failed vault path so the notifier's short excerpt remains actionable.
183
+
184
+ Disable the list-driven timer without deleting its copied units:
185
+
186
+ ```bash
187
+ systemctl --user disable --now bc-wiki-maintain-all.timer
188
+ ```
189
+
190
+ ## Migrate from per-vault promotion timers to the batch timer
191
+
192
+ This is a one-time machine-local migration. The batch timer is an alternative to the per-vault
193
+ promotion timers, not an additional schedule. Keep `bc-wiki-lint.timer` enabled: it is
194
+ read-only detection and is independent of promotion.
195
+
196
+ ### Why the old promotion timers must be disabled first
197
+
198
+ The batch template runs at 02:30 with a 15-minute random delay and allows up to five hours for
199
+ serial vault runs. The one-vault template runs at 03:30 with the same delay. Those windows overlap.
200
+ Nothing mechanically prevents two agents from processing the same vault: `run-promotion.sh`'s
201
+ clean-tree check is a time-of-check/time-of-use check, not a lock, and a PID lock is deliberately
202
+ not part of this design. Disable every per-vault promotion timer before enabling the batch timer.
203
+
204
+ ### Ordered migration
205
+
206
+ Set the checkout and unit/list locations first. These are placeholders; use the values appropriate
207
+ for the machine where the templates will be installed.
208
+
209
+ ```bash
210
+ export AGENT_CONCEPTS="$HOME/path/to/agent-concepts"
211
+ unit_dir="$HOME/.config/systemd/user"
212
+ list_file="$HOME/.config/agent-concepts/wiki-promotion-vaults.txt"
213
+ ```
214
+
215
+ 1. **Enumerate before disabling.** Do not assume the four names from one installation. List every
216
+ installed timer whose unit name uses the promotion prefix:
217
+
218
+ ```bash
219
+ systemctl --user list-unit-files 'bc-wiki-maintain*.timer' --no-legend --no-pager
220
+ ```
221
+
222
+ One installation had `bc-wiki-maintain.timer`,
223
+ `bc-wiki-maintain-project-b.timer`, `bc-wiki-maintain-homeflix.timer`, and
224
+ `bc-wiki-maintain-homeflix-prod.timer`, alongside `bc-wiki-lint.timer`. That is an example,
225
+ not a portable inventory. The batch unit, if already present, is named
226
+ `bc-wiki-maintain-all.timer`; do not disable it as part of this step. Do not disable or pass
227
+ `bc-wiki-lint.timer` to the command below.
228
+
229
+ 2. **Disable the per-vault promotion timers.** The filter excludes the batch unit while retaining
230
+ the base unit and any slug-suffixed per-vault units found on this machine. It prints the selected
231
+ names before changing state:
232
+
233
+ ```bash
234
+ mapfile -t per_vault_timers < <(
235
+ systemctl --user list-unit-files 'bc-wiki-maintain*.timer' --no-legend --no-pager |
236
+ awk '$1 ~ /^bc-wiki-maintain(-[^.]*)?\.timer$/ && $1 != "bc-wiki-maintain-all.timer" { print $1 }'
237
+ )
238
+ ((${#per_vault_timers[@]} > 0)) || {
239
+ printf 'No per-vault promotion timers found; stop and inspect the inventory.\n' >&2
240
+ exit 1
241
+ }
242
+ printf 'Disabling per-vault promotion timers:\n'
243
+ printf ' %s\n' "${per_vault_timers[@]}"
244
+ systemctl --user disable --now "${per_vault_timers[@]}"
245
+ ```
246
+
247
+ Disabling a timer prevents its next trigger; it does not imply that an already-running service
248
+ has finished. Before enabling the batch, check for an active old promotion service and let it
249
+ finish or stop its corresponding service deliberately:
250
+
251
+ ```bash
252
+ systemctl --user list-units --type=service --state=running 'bc-wiki-maintain*.service' --no-legend --no-pager
253
+ ```
254
+
255
+ Leave `bc-wiki-lint.timer` untouched. Check it separately if it was already enabled:
256
+
257
+ ```bash
258
+ systemctl --user is-enabled bc-wiki-lint.timer
259
+ ```
260
+
261
+ 3. **Create the separate promotion list.** Use the machine-local lint list as a source of
262
+ candidate paths, but copy only the vaults you explicitly authorise for scheduled writes. Do not
263
+ use `cp` to clone the lint list: lint reads, while promotion invokes an agent that writes and
264
+ commits.
265
+
266
+ ```bash
267
+ mkdir -p "$(dirname "$list_file")"
268
+ $EDITOR "$HOME/.config/agent-concepts/wiki-lint-vaults.txt"
269
+ $EDITOR "$list_file"
270
+ ```
271
+
272
+ Put one approved vault root per line in `wiki-promotion-vaults.txt`; blank lines and `#`
273
+ comments are ignored, and `~`/`~/` entries are expanded by `run-promotion-all.sh`.
274
+
275
+ 4. **Install and verify the batch units.** Copy the batch service, timer, and the notifier it
276
+ references. Do not symlink the templates. Edit the copied service's `AGENT_CONCEPTS`,
277
+ `VAULT_LIST`, and `PI_BIN` values. The notifier needs no edit.
278
+
279
+ ```bash
280
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain-all.service" \
281
+ "$unit_dir/bc-wiki-maintain-all.service"
282
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-maintain-all.timer" \
283
+ "$unit_dir/bc-wiki-maintain-all.timer"
284
+ install -Dm644 "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/bc-wiki-notify@.service" \
285
+ "$unit_dir/bc-wiki-notify@.service"
286
+ $EDITOR "$unit_dir/bc-wiki-maintain-all.service"
287
+ systemd-analyze --user verify "$unit_dir/bc-wiki-maintain-all.service"
288
+ systemd-analyze --user verify "$unit_dir/bc-wiki-maintain-all.timer"
289
+ systemd-analyze --user verify "$unit_dir/bc-wiki-notify@.service"
290
+ ```
291
+
292
+ 5. **Enable the batch timer.** Only after the per-vault timers are disabled and the copied units
293
+ verify successfully:
294
+
295
+ ```bash
296
+ systemctl --user daemon-reload
297
+ systemctl --user enable --now bc-wiki-maintain-all.timer
298
+ ```
299
+
300
+ 6. **Confirm the resulting schedule and the untouched lint timer:**
301
+
302
+ ```bash
303
+ systemctl --user is-enabled bc-wiki-lint.timer
304
+ systemctl --user status --no-pager bc-wiki-maintain-all.timer
305
+ systemctl --user list-timers --all --no-pager
306
+ ```
307
+
308
+ The supplied batch timer is scheduled for 02:30 ±15 minutes and the supplied lint timer for
309
+ 04:15 ±15 minutes. A local unit copy may differ; trust the verified unit files and the timer
310
+ listing on that machine.
311
+
312
+ ### First-run supervised check
313
+
314
+ `run-promotion-all.sh` has no `--dry-run` flag. A first manual invocation is therefore a
315
+ **supervised one-shot**, not a read-only preview: it may invoke Pi and create one dedicated commit
316
+ per vault that has work. Set the same inputs as the copied service and run it before relying on the
317
+ schedule:
318
+
319
+ ```bash
320
+ export AGENT_CONCEPTS="$HOME/path/to/agent-concepts"
321
+ export VAULT_LIST="$HOME/.config/agent-concepts/wiki-promotion-vaults.txt"
322
+ export PI_BIN="$HOME/.local/bin/pi"
323
+ "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/run-promotion-all.sh"
324
+ ```
325
+
326
+ A healthy run prints one `=== wiki promotion: ... ===` header per list entry, continues through
327
+ no-op or successful child runs, ends with `failures=0` and `failing vaults: (none)`, and exits 0.
328
+ A failed or missing vault is named in its per-vault error, later entries still run, the final
329
+ summary lists the failing paths, and the batch exits nonzero. A manual run does not trigger
330
+ systemd's `OnFailure=` notifier; inspect stderr and the final summary directly.
331
+
332
+ ### Rollback to per-vault timers
333
+
334
+ Keep the batch and per-vault schedules mutually exclusive. To roll back, disable the batch timer,
335
+ restore or reinstall the copied one-vault service/timer pair for each desired vault using
336
+ [the one-vault install recipe below](#install-after-review), verify those copies, then re-enable
337
+ the per-vault timers:
338
+
339
+ ```bash
340
+ systemctl --user disable --now bc-wiki-maintain-all.timer
341
+ # Restore/reinstall the per-vault copies using the one-vault recipe above, then reload them:
342
+ systemctl --user daemon-reload
343
+ # Enumerate the restored per-vault copies:
344
+ mapfile -t per_vault_timers < <(
345
+ systemctl --user list-unit-files 'bc-wiki-maintain*.timer' --no-legend --no-pager |
346
+ awk '$1 ~ /^bc-wiki-maintain(-[^.]*)?\.timer$/ && $1 != "bc-wiki-maintain-all.timer" { print $1 }'
347
+ )
348
+ ((${#per_vault_timers[@]} > 0)) || {
349
+ printf 'No restored per-vault promotion timers found; stop and inspect the unit files.\n' >&2
350
+ exit 1
351
+ }
352
+ systemctl --user enable --now "${per_vault_timers[@]}"
353
+ systemctl --user is-enabled bc-wiki-lint.timer
354
+ ```
355
+
356
+ Leave `bc-wiki-maintain-all.service` and `.timer` installed but disabled if a later migration is
357
+ likely, or remove those copied files only after the batch timer is disabled and the rollback is
358
+ confirmed. Do not disable the lint timer during rollback.
359
+
360
+ ### Recover a vault that timed out
361
+
362
+ The batch runner prints that a timed-out vault **may now have uncommitted changes**. The timeout can
363
+ land mid-write; the next `run-promotion.sh` invocation refuses a dirty containing repository, so
364
+ the same vault fails closed on every later run until a human inspects it and either commits or
365
+ resets the leftover changes. The timeout's `--kill-after` bounds an uncooperative child, but it
366
+ does not undo partial writes.
367
+
368
+ Replace the example with the timed-out vault from the batch journal. These commands inspect the
369
+ whole containing repository because the per-vault runner requires the whole worktree to be clean:
370
+
371
+ ```bash
372
+ vault="$HOME/path/to/your/project/.bc-agent" # replace with the timed-out lint-list entry
373
+ repo_root="$(git -C "$vault" rev-parse --show-toplevel)"
374
+ vault_prefix="$(git -C "$vault" rev-parse --show-prefix)"
375
+ git -C "$repo_root" status --short --untracked-files=all
376
+ git -C "$repo_root" diff -- "$vault_prefix"
377
+ git -C "$repo_root" diff --cached -- "$vault_prefix"
378
+ git -C "$repo_root" ls-files --others --exclude-standard -- "$vault_prefix"
379
+ ```
380
+
381
+ If the changes are the intended additive Markdown promotion, review the diff and stage only the
382
+ reviewed vault files. Confirm the staged path list before creating the recovery commit:
383
+
384
+ ```bash
385
+ git -C "$repo_root" diff --check -- "$vault_prefix"
386
+ git -C "$repo_root" add -- "$vault_prefix"
387
+ git -C "$repo_root" diff --cached --name-status
388
+ git -C "$repo_root" commit -m "wiki: recover timed-out promotion"
389
+ git -C "$repo_root" status --short --untracked-files=all
390
+ ```
391
+
392
+ If the partial changes are not wanted, restore tracked files and inspect untracked files before
393
+ removing them. The `git clean` preview is mandatory: remove only files you confirm were left by the
394
+ aborted promotion, never unrelated user work.
395
+
396
+ ```bash
397
+ git -C "$repo_root" restore --source=HEAD --staged --worktree -- "$vault_prefix"
398
+ git -C "$repo_root" clean -nd -- "$vault_prefix"
399
+ # After reviewing the preview:
400
+ git -C "$repo_root" clean -fd -- "$vault_prefix"
401
+ git -C "$repo_root" status --short --untracked-files=all
402
+ ```
403
+
404
+ The final status must be clean before the next scheduled run. If unrelated changes exist elsewhere
405
+ in the containing repository, resolve those separately; the promotion runner will continue to
406
+ refuse the vault until the complete worktree is clean.
407
+
408
+ ## Install after review
409
+
410
+ Copy the unit templates from the installed skill's `runner/` directory. Leave the
411
+ wrapper with the skill: it finds the detector and `SKILL.md` beside `runner/`.
412
+
413
+ ```bash
414
+ wiki_skill_dir="$HOME/.agents/skills/bc-wiki-maintain"
415
+ unit_dir="$HOME/.config/systemd/user"
416
+ install -Dm644 "$wiki_skill_dir/runner/bc-wiki-maintain.service" \
417
+ "$unit_dir/bc-wiki-maintain.service"
418
+ install -Dm644 "$wiki_skill_dir/runner/bc-wiki-maintain.timer" \
419
+ "$unit_dir/bc-wiki-maintain.timer"
420
+ # Required: the service's OnFailure= points here. Without it a failed run notifies nobody.
421
+ install -Dm644 "$wiki_skill_dir/runner/bc-wiki-notify@.service" \
422
+ "$unit_dir/bc-wiki-notify@.service"
423
+ $EDITOR "$unit_dir/bc-wiki-maintain.service" # set the paths below
424
+ systemctl --user daemon-reload
425
+ systemctl --user enable --now bc-wiki-maintain.timer
426
+ ```
427
+
428
+ To add another vault, copy the service and timer to a new name (`bc-wiki-maintain-other.service`
429
+ and matching `.timer`), edit `WorkingDirectory` / `VAULT_ROOT` / `SyslogIdentifier`, and give
430
+ the timer a different `OnCalendar` so two promotion agents do not start at once. The notifier
431
+ template is instanced per failed unit, so one copy of it serves every vault. One unit per
432
+ vault: a dirty tree in one project must not skip the others. The wrapper already accepts
433
+ `.bc-agent/`, `.agent/`, or any other vault subdirectory.
434
+
435
+ The supplied unit uses `%h` (the systemd user home specifier) and placeholder paths:
436
+
437
+ - `WorkingDirectory=%h/path/to/your/project`
438
+ - `VAULT_ROOT=%h/path/to/your/project/.bc-agent`
439
+ - `PI_BIN=%h/.local/bin/pi`
440
+ - `ExecStart=%h/.agents/skills/bc-wiki-maintain/runner/run-promotion.sh`
441
+
442
+ If the skill or Pi binary is elsewhere, edit the copied service before
443
+ `daemon-reload` (or use a user drop-in). Keep `VAULT_ROOT` pointed at one vault;
444
+ the wrapper requires it as an explicit environment value and never guesses another
445
+ vault.
446
+
447
+ ## What the wrapper requires
448
+
449
+ `run-promotion.sh` is parameterized through these environment variables:
450
+
451
+ - `VAULT_ROOT` — the project-local vault to inspect. The pilot service sets this to
452
+ `%h/path/to/your/project/.bc-agent`.
453
+ - `PI_BIN` — optional Pi executable/path; defaults to `pi` when run manually.
454
+ - `DETECTION_SCRIPT` — optional override for the detection script.
455
+ - `PROMOTION_SKILL` — optional override for the loaded skill file.
456
+
457
+ The detection script receives the vault root as its sole positional argument and must
458
+ emit exactly one anchored pair of machine-readable lines, plus one `PROMOTION_HEADING`
459
+ line per unpromoted heading when promotion is required:
460
+
461
+ ```text
462
+ PROMOTION_REQUIRED=0
463
+ PROMOTION_RANGE=none
464
+ ```
465
+
466
+ or, when dated log headings need promotion:
467
+
468
+ ```text
469
+ PROMOTION_REQUIRED=1
470
+ PROMOTION_RANGE=2026-08-10..2026-08-14
471
+ PROMOTION_HEADING ## [2026-08-10] first
472
+ PROMOTION_HEADING ## [2026-08-14] last
473
+ ```
474
+
475
+ The range is computed from standard `## [YYYY-MM-DD] ...` headings: all log headings on
476
+ an initial pass, or headings added after the latest relevant dedicated promotion commit on later
477
+ passes. If any unpromoted heading is non-standard, the detector keeps promotion required and emits
478
+ `PROMOTION_RANGE=invalid`; the wrapper fails closed instead of guessing a range. It may emit a
479
+ human-readable report around the contract lines. Missing, duplicate, or malformed results fail closed.
480
+ `PROMOTION_REQUIRED=0` exits before Pi is checked or invoked.
481
+ When the report contains the line `Layout: visible` (a `bc-setup-project` visible-layout project),
482
+ the wrapper logs that promotion is not applicable and exits 0 before the clean-tree gate, any
483
+ model call or write, whatever the detector's own exit status. Promotion moved log entries into
484
+ vault pages; in the visible layout agents write to the role folders directly and `log.md` is a
485
+ plain journal, so the detector prints no `PROMOTION_` lines there. Exit 0 keeps a scheduled
486
+ run over many vaults from being marked failed; the lint timer still reports the project's findings.
487
+ The parent integration must preserve this contract when wiring the detection script.
488
+
489
+ Before detection, and again before promotion, the wrapper requires a clean Git
490
+ worktree. It also checks that the promotion agent did not commit unexpectedly, stage any
491
+ index changes, touch files outside the vault, or delete an existing file. If the agent
492
+ changed vault files, the wrapper refuses the dedicated commit unless
493
+ `wiki_lint.py --verify-classify` accepts a JSONL file covering every unpromoted heading, and
494
+ it refuses any new non-Markdown file left in the vault. That JSONL is a temp path exported as
495
+ `CLASSIFY_PATH`; it is not a vault page and is not committed. Its verdicts become the commit
496
+ body, so `git log -1` explains why each heading was promoted, skipped, or flagged. The file is
497
+ removed after a successful run and kept — with its path printed — after a failure. The wrapper
498
+ owns the dedicated commit and uses the detector's exact range; a failed safety check leaves
499
+ changes uncommitted for inspection rather than resetting them.
500
+
501
+ The verified headless command is Pi 0.84.2 with the installed Luna model:
502
+
503
+ ```bash
504
+ pi --print --no-session --approve \
505
+ --model openai-codex/gpt-5.6-luna:max --thinking max \
506
+ --skill "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/SKILL.md" \
507
+ "<promotion prompt>"
508
+ ```
509
+
510
+ A no-tools probe of this exact model/flag combination returned status 0 on this
511
+ machine. The real runner keeps tools enabled because the agent must read and edit the
512
+ vault; it passes additive-only, classify-every-heading, stale-vs-exclusive, and no-commit
513
+ rules in the prompt and then performs the commit itself.
514
+
515
+ ## Check a run
516
+
517
+ ```bash
518
+ systemctl --user status bc-wiki-maintain.timer
519
+ systemctl --user status bc-wiki-maintain.service
520
+ journalctl --user -u bc-wiki-maintain.service --since today
521
+ ```
522
+
523
+ A successful promotion ends with a dedicated commit. Review it before relying on the
524
+ new pages:
525
+
526
+ ```bash
527
+ cd "$HOME/path/to/your/project"
528
+ git show --stat --oneline HEAD
529
+ git show HEAD -- .bc-agent/
530
+ ```
531
+
532
+ Undo a bad promotion with Git's normal reversible operation:
533
+
534
+ ```bash
535
+ git revert HEAD
536
+ ```
537
+
538
+ ## Disable
539
+
540
+ Stop and disable the timer without deleting the units:
541
+
542
+ ```bash
543
+ systemctl --user disable --now bc-wiki-maintain.timer
544
+ ```
545
+
546
+ To remove the installed units after disabling:
547
+
548
+ ```bash
549
+ rm -f "$HOME/.config/systemd/user/bc-wiki-maintain.service" \
550
+ "$HOME/.config/systemd/user/bc-wiki-maintain.timer"
551
+ systemctl --user daemon-reload
552
+ ```
@@ -0,0 +1,24 @@
1
+ # TEMPLATE — edit the Environment= paths before installing.
2
+ # Copy this file; do not symlink it. Local paths should not be overwritten when
3
+ # this repository updates.
4
+
5
+ [Unit]
6
+ Description=Lint project wiki vaults
7
+ Documentation=man:systemd.service(5)
8
+ OnFailure=bc-wiki-notify@%n.service
9
+
10
+ [Service]
11
+ Type=oneshot
12
+ SyslogIdentifier=bc-wiki-lint
13
+ # EDIT: your checkout of the agent-concepts workspace.
14
+ WorkingDirectory=%h/path/to/agent-concepts
15
+ Environment=AGENT_CONCEPTS=%h/path/to/agent-concepts
16
+ # EDIT: one vault path per line; blank lines and # comments are ignored.
17
+ Environment=VAULT_LIST=%h/.config/agent-concepts/wiki-lint-vaults.txt
18
+ ExecStart=/usr/bin/bash -c 'exec "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/run-lint.sh"'
19
+ TimeoutStartSec=15min
20
+ StandardOutput=journal
21
+ StandardError=journal
22
+
23
+ # This service is detection-only: it does not invoke an agent, write Git state,
24
+ # or commit. A nonzero result means at least one detector or vault path failed.
@@ -0,0 +1,15 @@
1
+ # TEMPLATE — copy this file; do not symlink it. Edit the service paths before
2
+ # installing and enabling the timer.
3
+
4
+ [Unit]
5
+ Description=Scheduled lint for project wiki vaults
6
+
7
+ [Timer]
8
+ OnCalendar=*-*-* 04:15:00
9
+ RandomizedDelaySec=15min
10
+ Persistent=true
11
+ AccuracySec=1min
12
+ Unit=bc-wiki-lint.service
13
+
14
+ [Install]
15
+ WantedBy=timers.target
@@ -0,0 +1,29 @@
1
+ # TEMPLATE — edit the three Environment= paths below before installing.
2
+ # Copy this into ~/.config/systemd/user/ rather than symlinking it, so your local
3
+ # paths are not overwritten when this repository updates.
4
+
5
+ [Unit]
6
+ Description=Promote all configured project wikis
7
+ Documentation=man:systemd.service(5)
8
+ Wants=network-online.target
9
+ After=network-online.target
10
+ OnFailure=bc-wiki-notify@%n.service
11
+
12
+ [Service]
13
+ Type=oneshot
14
+ SyslogIdentifier=bc-wiki-maintain-all
15
+ # EDIT: your checkout of the agent-concepts workspace.
16
+ WorkingDirectory=%h/path/to/agent-concepts
17
+ Environment=AGENT_CONCEPTS=%h/path/to/agent-concepts
18
+ # Deliberately separate from the read-only lint list; this list authorises writes.
19
+ Environment=VAULT_LIST=%h/.config/agent-concepts/wiki-promotion-vaults.txt
20
+ # EDIT: the agent CLI used for the promotion passes.
21
+ Environment=PI_BIN=%h/.local/bin/pi
22
+ ExecStart=/usr/bin/bash -c 'exec "$AGENT_CONCEPTS/concepts/bc-wiki-maintain/body/runner/run-promotion-all.sh"'
23
+ # Eight serial runs at the single-vault 30min limit, plus an hour for overhead.
24
+ TimeoutStartSec=5h
25
+ StandardOutput=journal
26
+ StandardError=journal
27
+
28
+ # The wrapper continues after a vault-level failure and exits nonzero if any vault failed.
29
+ # Install this as an alternative to, not alongside, one-vault promotion services.
@@ -0,0 +1,16 @@
1
+ # TEMPLATE — copy this file; do not symlink it. Edit the service paths before
2
+ # installing and enabling the timer.
3
+
4
+ [Unit]
5
+ Description=Scheduled promotion for all configured project wiki vaults
6
+
7
+ [Timer]
8
+ # Distinct from the one-vault promotion timer at 03:30 and lint-all at 04:15.
9
+ OnCalendar=*-*-* 02:30:00
10
+ RandomizedDelaySec=15min
11
+ Persistent=true
12
+ AccuracySec=1min
13
+ Unit=bc-wiki-maintain-all.service
14
+
15
+ [Install]
16
+ WantedBy=timers.target
@@ -0,0 +1,28 @@
1
+ # TEMPLATE — edit the paths below before installing.
2
+ # Copy this into ~/.config/systemd/user/ rather than symlinking it, so your local
3
+ # paths are not overwritten when this repository updates.
4
+
5
+ [Unit]
6
+ Description=Promote project wiki memory
7
+ Documentation=man:systemd.service(5)
8
+ Wants=network-online.target
9
+ After=network-online.target
10
+ OnFailure=bc-wiki-notify@%n.service
11
+
12
+ [Service]
13
+ Type=oneshot
14
+ SyslogIdentifier=bc-wiki-maintain
15
+ # EDIT: the repository containing the vault (%h expands to your home directory).
16
+ WorkingDirectory=%h/path/to/your/project
17
+ # EDIT: the vault root. Use .agent or agent/wiki here if that is your layout.
18
+ Environment=VAULT_ROOT=%h/path/to/your/project/.bc-agent
19
+ # EDIT: the agent CLI used for the promotion pass.
20
+ Environment=PI_BIN=%h/.local/bin/pi
21
+ # EDIT if the installed skill is in a different directory.
22
+ ExecStart=%h/.agents/skills/bc-wiki-maintain/runner/run-promotion.sh
23
+ TimeoutStartSec=30min
24
+ StandardOutput=journal
25
+ StandardError=journal
26
+
27
+ # The wrapper refuses dirty trees and exits non-zero on detection, agent, or commit
28
+ # failures, so systemd records a failed run instead of silently accepting partial work.