agent-bober 0.15.0 → 0.17.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 (301) hide show
  1. package/.claude-plugin/marketplace.json +20 -0
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/CHANGELOG.md +30 -0
  4. package/README.md +127 -3
  5. package/agents/bober-architect.md +34 -0
  6. package/agents/bober-code-reviewer.md +2 -0
  7. package/agents/bober-curator.md +12 -0
  8. package/agents/bober-documenter.md +129 -0
  9. package/agents/bober-evaluator.md +46 -0
  10. package/agents/bober-generator.md +12 -0
  11. package/agents/bober-planner.md +8 -1
  12. package/dist/cli/commands/graph.js +3 -3
  13. package/dist/cli/commands/graph.js.map +1 -1
  14. package/dist/cli/commands/init.js +4 -0
  15. package/dist/cli/commands/init.js.map +1 -1
  16. package/dist/cli/commands/memory.d.ts +14 -0
  17. package/dist/cli/commands/memory.d.ts.map +1 -0
  18. package/dist/cli/commands/memory.js +132 -0
  19. package/dist/cli/commands/memory.js.map +1 -0
  20. package/dist/cli/index.js +6 -0
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/config/defaults.d.ts.map +1 -1
  23. package/dist/config/defaults.js +14 -3
  24. package/dist/config/defaults.js.map +1 -1
  25. package/dist/config/loader.d.ts.map +1 -1
  26. package/dist/config/loader.js +7 -0
  27. package/dist/config/loader.js.map +1 -1
  28. package/dist/config/role-providers.d.ts +29 -0
  29. package/dist/config/role-providers.d.ts.map +1 -0
  30. package/dist/config/role-providers.js +115 -0
  31. package/dist/config/role-providers.js.map +1 -0
  32. package/dist/config/schema.d.ts +383 -14
  33. package/dist/config/schema.d.ts.map +1 -1
  34. package/dist/config/schema.js +42 -0
  35. package/dist/config/schema.js.map +1 -1
  36. package/dist/contracts/eval-result.d.ts +112 -56
  37. package/dist/contracts/eval-result.d.ts.map +1 -1
  38. package/dist/contracts/eval-result.js +3 -0
  39. package/dist/contracts/eval-result.js.map +1 -1
  40. package/dist/contracts/sprint-contract.d.ts +30 -30
  41. package/dist/fleet/aggregator.d.ts +5 -0
  42. package/dist/fleet/aggregator.d.ts.map +1 -0
  43. package/dist/fleet/aggregator.js +39 -0
  44. package/dist/fleet/aggregator.js.map +1 -0
  45. package/dist/fleet/child-config.d.ts +12 -0
  46. package/dist/fleet/child-config.d.ts.map +1 -0
  47. package/dist/fleet/child-config.js +38 -0
  48. package/dist/fleet/child-config.js.map +1 -0
  49. package/dist/fleet/coordinator.d.ts +25 -0
  50. package/dist/fleet/coordinator.d.ts.map +1 -0
  51. package/dist/fleet/coordinator.js +40 -0
  52. package/dist/fleet/coordinator.js.map +1 -0
  53. package/dist/fleet/index.d.ts +40 -0
  54. package/dist/fleet/index.d.ts.map +1 -0
  55. package/dist/fleet/index.js +117 -0
  56. package/dist/fleet/index.js.map +1 -0
  57. package/dist/fleet/manifest.d.ts +51 -0
  58. package/dist/fleet/manifest.d.ts.map +1 -0
  59. package/dist/fleet/manifest.js +32 -0
  60. package/dist/fleet/manifest.js.map +1 -0
  61. package/dist/fleet/reporter.d.ts +32 -0
  62. package/dist/fleet/reporter.d.ts.map +1 -0
  63. package/dist/fleet/reporter.js +71 -0
  64. package/dist/fleet/reporter.js.map +1 -0
  65. package/dist/fleet/runner.d.ts +48 -0
  66. package/dist/fleet/runner.d.ts.map +1 -0
  67. package/dist/fleet/runner.js +104 -0
  68. package/dist/fleet/runner.js.map +1 -0
  69. package/dist/fleet/scaffolder.d.ts +12 -0
  70. package/dist/fleet/scaffolder.d.ts.map +1 -0
  71. package/dist/fleet/scaffolder.js +82 -0
  72. package/dist/fleet/scaffolder.js.map +1 -0
  73. package/dist/fleet/types.d.ts +21 -0
  74. package/dist/fleet/types.d.ts.map +1 -0
  75. package/dist/fleet/types.js +2 -0
  76. package/dist/fleet/types.js.map +1 -0
  77. package/dist/graph/cli.d.ts +6 -2
  78. package/dist/graph/cli.d.ts.map +1 -1
  79. package/dist/graph/cli.js +53 -12
  80. package/dist/graph/cli.js.map +1 -1
  81. package/dist/graph/pipeline-lifecycle.d.ts +9 -0
  82. package/dist/graph/pipeline-lifecycle.d.ts.map +1 -1
  83. package/dist/graph/pipeline-lifecycle.js +12 -0
  84. package/dist/graph/pipeline-lifecycle.js.map +1 -1
  85. package/dist/graph/preflight-injector.d.ts +14 -0
  86. package/dist/graph/preflight-injector.d.ts.map +1 -1
  87. package/dist/graph/preflight-injector.js +84 -4
  88. package/dist/graph/preflight-injector.js.map +1 -1
  89. package/dist/incident/types.d.ts +24 -24
  90. package/dist/mcp/tools/graph-schemas.d.ts +7 -7
  91. package/dist/mcp/tools/init.d.ts.map +1 -1
  92. package/dist/mcp/tools/init.js +2 -0
  93. package/dist/mcp/tools/init.js.map +1 -1
  94. package/dist/orchestrator/agent-loader.d.ts.map +1 -1
  95. package/dist/orchestrator/agent-loader.js +15 -1
  96. package/dist/orchestrator/agent-loader.js.map +1 -1
  97. package/dist/orchestrator/agentic-loop.d.ts +51 -0
  98. package/dist/orchestrator/agentic-loop.d.ts.map +1 -1
  99. package/dist/orchestrator/agentic-loop.js +123 -4
  100. package/dist/orchestrator/agentic-loop.js.map +1 -1
  101. package/dist/orchestrator/arch-lenses.d.ts +7 -0
  102. package/dist/orchestrator/arch-lenses.d.ts.map +1 -0
  103. package/dist/orchestrator/arch-lenses.js +22 -0
  104. package/dist/orchestrator/arch-lenses.js.map +1 -0
  105. package/dist/orchestrator/architect-agent.d.ts +16 -0
  106. package/dist/orchestrator/architect-agent.d.ts.map +1 -1
  107. package/dist/orchestrator/architect-agent.js +509 -1
  108. package/dist/orchestrator/architect-agent.js.map +1 -1
  109. package/dist/orchestrator/curator-agent.js +1 -1
  110. package/dist/orchestrator/curator-agent.js.map +1 -1
  111. package/dist/orchestrator/deploy/types.d.ts +2 -2
  112. package/dist/orchestrator/documenter-agent.d.ts +57 -0
  113. package/dist/orchestrator/documenter-agent.d.ts.map +1 -0
  114. package/dist/orchestrator/documenter-agent.js +195 -0
  115. package/dist/orchestrator/documenter-agent.js.map +1 -0
  116. package/dist/orchestrator/environment.d.ts +45 -0
  117. package/dist/orchestrator/environment.d.ts.map +1 -0
  118. package/dist/orchestrator/environment.js +151 -0
  119. package/dist/orchestrator/environment.js.map +1 -0
  120. package/dist/orchestrator/eval-lenses.d.ts +7 -0
  121. package/dist/orchestrator/eval-lenses.d.ts.map +1 -0
  122. package/dist/orchestrator/eval-lenses.js +19 -0
  123. package/dist/orchestrator/eval-lenses.js.map +1 -0
  124. package/dist/orchestrator/eval-persist.d.ts +25 -0
  125. package/dist/orchestrator/eval-persist.d.ts.map +1 -0
  126. package/dist/orchestrator/eval-persist.js +74 -0
  127. package/dist/orchestrator/eval-persist.js.map +1 -0
  128. package/dist/orchestrator/evaluator-agent.d.ts +23 -0
  129. package/dist/orchestrator/evaluator-agent.d.ts.map +1 -1
  130. package/dist/orchestrator/evaluator-agent.js +60 -3
  131. package/dist/orchestrator/evaluator-agent.js.map +1 -1
  132. package/dist/orchestrator/generator-agent.d.ts.map +1 -1
  133. package/dist/orchestrator/generator-agent.js +32 -0
  134. package/dist/orchestrator/generator-agent.js.map +1 -1
  135. package/dist/orchestrator/memory/distill.d.ts +60 -0
  136. package/dist/orchestrator/memory/distill.d.ts.map +1 -0
  137. package/dist/orchestrator/memory/distill.js +177 -0
  138. package/dist/orchestrator/memory/distill.js.map +1 -0
  139. package/dist/orchestrator/memory/eval-source.d.ts +20 -0
  140. package/dist/orchestrator/memory/eval-source.d.ts.map +1 -0
  141. package/dist/orchestrator/memory/eval-source.js +88 -0
  142. package/dist/orchestrator/memory/eval-source.js.map +1 -0
  143. package/dist/orchestrator/memory/retrieve.d.ts +45 -0
  144. package/dist/orchestrator/memory/retrieve.d.ts.map +1 -0
  145. package/dist/orchestrator/memory/retrieve.js +102 -0
  146. package/dist/orchestrator/memory/retrieve.js.map +1 -0
  147. package/dist/orchestrator/model-resolver.d.ts.map +1 -1
  148. package/dist/orchestrator/model-resolver.js +12 -0
  149. package/dist/orchestrator/model-resolver.js.map +1 -1
  150. package/dist/orchestrator/pipeline.d.ts +10 -0
  151. package/dist/orchestrator/pipeline.d.ts.map +1 -1
  152. package/dist/orchestrator/pipeline.js +111 -3
  153. package/dist/orchestrator/pipeline.js.map +1 -1
  154. package/dist/orchestrator/planner-agent.d.ts +22 -1
  155. package/dist/orchestrator/planner-agent.d.ts.map +1 -1
  156. package/dist/orchestrator/planner-agent.js +160 -4
  157. package/dist/orchestrator/planner-agent.js.map +1 -1
  158. package/dist/orchestrator/research-agent.js +2 -2
  159. package/dist/orchestrator/research-agent.js.map +1 -1
  160. package/dist/orchestrator/tools/handlers.d.ts +14 -0
  161. package/dist/orchestrator/tools/handlers.d.ts.map +1 -1
  162. package/dist/orchestrator/tools/handlers.js +29 -4
  163. package/dist/orchestrator/tools/handlers.js.map +1 -1
  164. package/dist/orchestrator/tools/schemas.js +5 -5
  165. package/dist/orchestrator/tools/schemas.js.map +1 -1
  166. package/dist/orchestrator/workflow/args-builder.d.ts +35 -0
  167. package/dist/orchestrator/workflow/args-builder.d.ts.map +1 -0
  168. package/dist/orchestrator/workflow/args-builder.js +142 -0
  169. package/dist/orchestrator/workflow/args-builder.js.map +1 -0
  170. package/dist/orchestrator/workflow/budget.d.ts +57 -0
  171. package/dist/orchestrator/workflow/budget.d.ts.map +1 -0
  172. package/dist/orchestrator/workflow/budget.js +80 -0
  173. package/dist/orchestrator/workflow/budget.js.map +1 -0
  174. package/dist/orchestrator/workflow/conformance.d.ts +27 -0
  175. package/dist/orchestrator/workflow/conformance.d.ts.map +1 -0
  176. package/dist/orchestrator/workflow/conformance.js +111 -0
  177. package/dist/orchestrator/workflow/conformance.js.map +1 -0
  178. package/dist/orchestrator/workflow/eligibility.d.ts +8 -0
  179. package/dist/orchestrator/workflow/eligibility.d.ts.map +1 -0
  180. package/dist/orchestrator/workflow/eligibility.js +10 -0
  181. package/dist/orchestrator/workflow/eligibility.js.map +1 -0
  182. package/dist/orchestrator/workflow/engine.d.ts +10 -0
  183. package/dist/orchestrator/workflow/engine.d.ts.map +1 -0
  184. package/dist/orchestrator/workflow/engine.js +2 -0
  185. package/dist/orchestrator/workflow/engine.js.map +1 -0
  186. package/dist/orchestrator/workflow/errors.d.ts +13 -0
  187. package/dist/orchestrator/workflow/errors.d.ts.map +1 -0
  188. package/dist/orchestrator/workflow/errors.js +26 -0
  189. package/dist/orchestrator/workflow/errors.js.map +1 -0
  190. package/dist/orchestrator/workflow/flusher.d.ts +19 -0
  191. package/dist/orchestrator/workflow/flusher.d.ts.map +1 -0
  192. package/dist/orchestrator/workflow/flusher.js +81 -0
  193. package/dist/orchestrator/workflow/flusher.js.map +1 -0
  194. package/dist/orchestrator/workflow/interpreter.d.ts +48 -0
  195. package/dist/orchestrator/workflow/interpreter.d.ts.map +1 -0
  196. package/dist/orchestrator/workflow/interpreter.js +92 -0
  197. package/dist/orchestrator/workflow/interpreter.js.map +1 -0
  198. package/dist/orchestrator/workflow/pure-sprint.d.ts +65 -0
  199. package/dist/orchestrator/workflow/pure-sprint.d.ts.map +1 -0
  200. package/dist/orchestrator/workflow/pure-sprint.js +82 -0
  201. package/dist/orchestrator/workflow/pure-sprint.js.map +1 -0
  202. package/dist/orchestrator/workflow/reconciler.d.ts +15 -0
  203. package/dist/orchestrator/workflow/reconciler.d.ts.map +1 -0
  204. package/dist/orchestrator/workflow/reconciler.js +65 -0
  205. package/dist/orchestrator/workflow/reconciler.js.map +1 -0
  206. package/dist/orchestrator/workflow/resume-cursor.d.ts +10 -0
  207. package/dist/orchestrator/workflow/resume-cursor.d.ts.map +1 -0
  208. package/dist/orchestrator/workflow/resume-cursor.js +25 -0
  209. package/dist/orchestrator/workflow/resume-cursor.js.map +1 -0
  210. package/dist/orchestrator/workflow/retry.d.ts +50 -0
  211. package/dist/orchestrator/workflow/retry.d.ts.map +1 -0
  212. package/dist/orchestrator/workflow/retry.js +100 -0
  213. package/dist/orchestrator/workflow/retry.js.map +1 -0
  214. package/dist/orchestrator/workflow/scheduler.d.ts +87 -0
  215. package/dist/orchestrator/workflow/scheduler.d.ts.map +1 -0
  216. package/dist/orchestrator/workflow/scheduler.js +158 -0
  217. package/dist/orchestrator/workflow/scheduler.js.map +1 -0
  218. package/dist/orchestrator/workflow/selector.d.ts +26 -0
  219. package/dist/orchestrator/workflow/selector.d.ts.map +1 -0
  220. package/dist/orchestrator/workflow/selector.js +54 -0
  221. package/dist/orchestrator/workflow/selector.js.map +1 -0
  222. package/dist/orchestrator/workflow/synthesizer.d.ts +52 -0
  223. package/dist/orchestrator/workflow/synthesizer.d.ts.map +1 -0
  224. package/dist/orchestrator/workflow/synthesizer.js +75 -0
  225. package/dist/orchestrator/workflow/synthesizer.js.map +1 -0
  226. package/dist/orchestrator/workflow/ts-engine.d.ts +13 -0
  227. package/dist/orchestrator/workflow/ts-engine.d.ts.map +1 -0
  228. package/dist/orchestrator/workflow/ts-engine.js +14 -0
  229. package/dist/orchestrator/workflow/ts-engine.js.map +1 -0
  230. package/dist/orchestrator/workflow/types.d.ts +55 -0
  231. package/dist/orchestrator/workflow/types.d.ts.map +1 -0
  232. package/dist/orchestrator/workflow/types.js +3 -0
  233. package/dist/orchestrator/workflow/types.js.map +1 -0
  234. package/dist/orchestrator/workflow/workflow-engine.d.ts +31 -0
  235. package/dist/orchestrator/workflow/workflow-engine.d.ts.map +1 -0
  236. package/dist/orchestrator/workflow/workflow-engine.js +70 -0
  237. package/dist/orchestrator/workflow/workflow-engine.js.map +1 -0
  238. package/dist/providers/anthropic.d.ts.map +1 -1
  239. package/dist/providers/anthropic.js +49 -6
  240. package/dist/providers/anthropic.js.map +1 -1
  241. package/dist/providers/claude-code.d.ts +44 -0
  242. package/dist/providers/claude-code.d.ts.map +1 -0
  243. package/dist/providers/claude-code.js +143 -0
  244. package/dist/providers/claude-code.js.map +1 -0
  245. package/dist/providers/factory.d.ts +16 -2
  246. package/dist/providers/factory.d.ts.map +1 -1
  247. package/dist/providers/factory.js +66 -12
  248. package/dist/providers/factory.js.map +1 -1
  249. package/dist/providers/google.d.ts.map +1 -1
  250. package/dist/providers/google.js +27 -3
  251. package/dist/providers/google.js.map +1 -1
  252. package/dist/providers/index.d.ts +3 -1
  253. package/dist/providers/index.d.ts.map +1 -1
  254. package/dist/providers/index.js +3 -1
  255. package/dist/providers/index.js.map +1 -1
  256. package/dist/providers/openai.d.ts.map +1 -1
  257. package/dist/providers/openai.js +24 -3
  258. package/dist/providers/openai.js.map +1 -1
  259. package/dist/providers/preflight.d.ts +22 -0
  260. package/dist/providers/preflight.d.ts.map +1 -0
  261. package/dist/providers/preflight.js +54 -0
  262. package/dist/providers/preflight.js.map +1 -0
  263. package/dist/providers/structured.d.ts +130 -0
  264. package/dist/providers/structured.d.ts.map +1 -0
  265. package/dist/providers/structured.js +205 -0
  266. package/dist/providers/structured.js.map +1 -0
  267. package/dist/providers/types.d.ts +28 -0
  268. package/dist/providers/types.d.ts.map +1 -1
  269. package/dist/state/history-rotation.d.ts +17 -0
  270. package/dist/state/history-rotation.d.ts.map +1 -0
  271. package/dist/state/history-rotation.js +84 -0
  272. package/dist/state/history-rotation.js.map +1 -0
  273. package/dist/state/history.d.ts +16 -4
  274. package/dist/state/history.d.ts.map +1 -1
  275. package/dist/state/history.js +62 -20
  276. package/dist/state/history.js.map +1 -1
  277. package/dist/state/index.d.ts +1 -1
  278. package/dist/state/index.d.ts.map +1 -1
  279. package/dist/state/index.js +1 -1
  280. package/dist/state/index.js.map +1 -1
  281. package/dist/state/memory.d.ts +60 -0
  282. package/dist/state/memory.d.ts.map +1 -0
  283. package/dist/state/memory.js +242 -0
  284. package/dist/state/memory.js.map +1 -0
  285. package/hooks/hooks.json +12 -2
  286. package/package.json +9 -5
  287. package/scripts/spike-claude-code-provider.mjs +66 -0
  288. package/scripts/spike-deepseek.mjs +63 -0
  289. package/scripts/sync-targets.json +12 -0
  290. package/scripts/update-all.mjs +255 -0
  291. package/skills/bober.architect/SKILL.md +13 -0
  292. package/skills/bober.architect/references/arch-lens-panel.md +126 -0
  293. package/skills/bober.eval/SKILL.md +9 -0
  294. package/skills/bober.eval/references/lens-panel.md +115 -0
  295. package/skills/bober.plan/SKILL.md +6 -0
  296. package/skills/bober.run/SKILL.md +23 -4
  297. package/skills/bober.run/references/lens-panel.md +115 -0
  298. package/skills/bober.sprint/SKILL.md +44 -2
  299. package/skills/bober.sprint/references/lens-panel.md +115 -0
  300. package/skills/shared/arch-lens-panel.md +126 -0
  301. package/skills/shared/lens-panel.md +115 -0
@@ -0,0 +1,255 @@
1
+ #!/usr/bin/env node
2
+ // ─────────────────────────────────────────────────────────────────────────
3
+ // update-all — propagate an agent-bober change to every consuming project.
4
+ //
5
+ // agent-bober is distributed two ways at once:
6
+ // 1. CLI/engine code → ONE copy, shared via npm symlink. `npm run build`
7
+ // recompiles src→dist and every symlinked project picks it up for free.
8
+ // 2. Skills/agents → COPIED into each project's .claude/ by `init`
9
+ // (skills are inlined: SKILL.md + sorted references concatenated into a
10
+ // single .claude/commands/<name>.md). These copies go stale on every
11
+ // skill edit and must be re-emitted per project.
12
+ //
13
+ // This script does both: build once, then re-inline skills + copy agents into
14
+ // every target listed in scripts/sync-targets.json. The inlining format is
15
+ // kept byte-identical to src/cli/commands/init.ts (installClaudeCommands) so a
16
+ // synced project is indistinguishable from a freshly `init`-ed one.
17
+ //
18
+ // Usage:
19
+ // node scripts/update-all.mjs # build + sync all targets
20
+ // node scripts/update-all.mjs --check # dry-run: report drift, write nothing
21
+ // node scripts/update-all.mjs --skills-only # skip the build
22
+ // node scripts/update-all.mjs --no-build # alias of --skills-only
23
+ // node scripts/update-all.mjs --discover # add initialized projects under discoverRoots to the registry
24
+ // node scripts/update-all.mjs /abs/path ... # sync ONLY these paths (ignore registry)
25
+ // ─────────────────────────────────────────────────────────────────────────
26
+
27
+ import { readFile, writeFile, readdir, mkdir, stat } from "node:fs/promises";
28
+ import { join, dirname, resolve } from "node:path";
29
+ import { fileURLToPath } from "node:url";
30
+ import { execSync } from "node:child_process";
31
+
32
+ const __dirname = dirname(fileURLToPath(import.meta.url));
33
+ const PKG_ROOT = resolve(__dirname, "..");
34
+ const SKILLS_ROOT = join(PKG_ROOT, "skills");
35
+ const AGENTS_ROOT = join(PKG_ROOT, "agents");
36
+ const TARGETS_FILE = join(__dirname, "sync-targets.json");
37
+
38
+ // Skill-dir → command-file map. MUST match installClaudeCommands in
39
+ // src/cli/commands/init.ts. Derived at runtime from skills/ so it can never
40
+ // drift: every skills/bober.X dir maps to bober-X.md.
41
+ async function buildSkillMap() {
42
+ const entries = await readdir(SKILLS_ROOT, { withFileTypes: true });
43
+ const map = {};
44
+ for (const e of entries) {
45
+ if (!e.isDirectory()) continue;
46
+ if (!e.name.startsWith("bober.")) continue;
47
+ // bober.code-review → bober-code-review.md
48
+ const cmd = e.name.replace(/\./g, "-") + ".md";
49
+ map[e.name] = cmd;
50
+ }
51
+ return map;
52
+ }
53
+
54
+ // Re-create the inlined command file for one skill, byte-identical to init.ts.
55
+ async function inlineSkill(skillDir) {
56
+ const srcSkill = join(SKILLS_ROOT, skillDir, "SKILL.md");
57
+ let content = await readFile(srcSkill, "utf-8");
58
+
59
+ const refsDir = join(SKILLS_ROOT, skillDir, "references");
60
+ try {
61
+ const refFiles = await readdir(refsDir);
62
+ for (const refFile of refFiles.sort()) {
63
+ if (!refFile.endsWith(".md")) continue;
64
+ const refContent = await readFile(join(refsDir, refFile), "utf-8");
65
+ content += `\n\n---\n\n<!-- Reference: ${refFile} -->\n\n${refContent}`;
66
+ }
67
+ } catch {
68
+ // No references directory — fine.
69
+ }
70
+ return content;
71
+ }
72
+
73
+ async function isDir(p) {
74
+ try {
75
+ return (await stat(p)).isDirectory();
76
+ } catch {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ async function fileEquals(path, expected) {
82
+ try {
83
+ return (await readFile(path, "utf-8")) === expected;
84
+ } catch {
85
+ return false; // missing → counts as changed
86
+ }
87
+ }
88
+
89
+ // Sync skills + agents into ONE project. Returns a per-target report.
90
+ async function syncTarget(projectRoot, { check }) {
91
+ const claudeDir = join(projectRoot, ".claude");
92
+ const commandsDir = join(claudeDir, "commands");
93
+ const agentsDir = join(claudeDir, "agents");
94
+
95
+ const report = { projectRoot, commandsChanged: [], agentsChanged: [], skipped: false };
96
+
97
+ // A target must already be a project (have a .claude/ or bober.config.json).
98
+ // We never create .claude from scratch here — that's init's job.
99
+ if (!(await isDir(claudeDir)) && !(await fileEquals(join(projectRoot, "bober.config.json"), "__never__"))) {
100
+ // bober.config.json may exist even if .claude doesn't; tolerate either.
101
+ if (!(await isDir(claudeDir))) {
102
+ const hasCfg = await readFile(join(projectRoot, "bober.config.json"), "utf-8").then(() => true).catch(() => false);
103
+ if (!hasCfg) {
104
+ report.skipped = true;
105
+ report.reason = "no .claude/ and no bober.config.json — not an agent-bober project";
106
+ return report;
107
+ }
108
+ }
109
+ }
110
+
111
+ const skillMap = await buildSkillMap();
112
+
113
+ // ── Commands (inlined skills) ──────────────────────────────────────
114
+ if (!check) await mkdir(commandsDir, { recursive: true });
115
+ for (const [skillDir, commandFile] of Object.entries(skillMap)) {
116
+ let content;
117
+ try {
118
+ content = await inlineSkill(skillDir);
119
+ } catch {
120
+ continue; // SKILL.md missing — skip, mirrors init's behaviour
121
+ }
122
+ const dest = join(commandsDir, commandFile);
123
+ if (!(await fileEquals(dest, content))) {
124
+ report.commandsChanged.push(commandFile);
125
+ if (!check) await writeFile(dest, content, "utf-8");
126
+ }
127
+ }
128
+
129
+ // ── Agents (verbatim) ──────────────────────────────────────────────
130
+ if (!check) await mkdir(agentsDir, { recursive: true });
131
+ let agentFiles = [];
132
+ try {
133
+ agentFiles = await readdir(AGENTS_ROOT);
134
+ } catch {
135
+ /* no agents dir in package — unusual but tolerate */
136
+ }
137
+ for (const agentFile of agentFiles) {
138
+ if (!agentFile.endsWith(".md")) continue;
139
+ const content = await readFile(join(AGENTS_ROOT, agentFile), "utf-8");
140
+ const dest = join(agentsDir, agentFile);
141
+ if (!(await fileEquals(dest, content))) {
142
+ report.agentsChanged.push(agentFile);
143
+ if (!check) await writeFile(dest, content, "utf-8");
144
+ }
145
+ }
146
+
147
+ return report;
148
+ }
149
+
150
+ // Walk discoverRoots and return any initialized project (has a bober-plan.md
151
+ // command — the marker that init ran there). Bounded depth to stay safe/fast.
152
+ async function discover(roots) {
153
+ const found = new Set();
154
+ async function walk(dir, depth) {
155
+ if (depth > 4) return;
156
+ let entries;
157
+ try {
158
+ entries = await readdir(dir, { withFileTypes: true });
159
+ } catch {
160
+ return;
161
+ }
162
+ // Initialized? marker file present.
163
+ const marker = join(dir, ".claude", "commands", "bober-plan.md");
164
+ if (await readFile(marker, "utf-8").then(() => true).catch(() => false)) {
165
+ found.add(dir);
166
+ }
167
+ for (const e of entries) {
168
+ if (!e.isDirectory()) continue;
169
+ if (e.name === "node_modules" || e.name === ".git" || e.name === "dist") continue;
170
+ await walk(join(dir, e.name), depth + 1);
171
+ }
172
+ }
173
+ for (const r of roots) await walk(r, 0);
174
+ return [...found];
175
+ }
176
+
177
+ async function loadRegistry() {
178
+ const raw = JSON.parse(await readFile(TARGETS_FILE, "utf-8"));
179
+ return raw;
180
+ }
181
+
182
+ async function main() {
183
+ const argv = process.argv.slice(2);
184
+ const flags = new Set(argv.filter((a) => a.startsWith("--")));
185
+ const pathArgs = argv.filter((a) => !a.startsWith("--"));
186
+ const check = flags.has("--check");
187
+ const skillsOnly = flags.has("--skills-only") || flags.has("--no-build");
188
+
189
+ // ── Optional: discovery mode (mutates the registry, then exits) ─────
190
+ if (flags.has("--discover")) {
191
+ const reg = await loadRegistry();
192
+ const discovered = await discover(reg.discoverRoots ?? []);
193
+ const before = new Set(reg.targets);
194
+ for (const d of discovered) before.add(d);
195
+ reg.targets = [...before].sort();
196
+ await writeFile(TARGETS_FILE, JSON.stringify(reg, null, 2) + "\n", "utf-8");
197
+ console.log(`Discovered ${discovered.length} initialized project(s); registry now has ${reg.targets.length}:`);
198
+ for (const t of reg.targets) console.log(` - ${t}`);
199
+ return;
200
+ }
201
+
202
+ // ── 1. Build the CLI (the shared half) ─────────────────────────────
203
+ if (!skillsOnly && !check) {
204
+ console.log("▸ Building CLI (src → dist)…");
205
+ execSync("npm run build", { cwd: PKG_ROOT, stdio: "inherit" });
206
+ console.log(" ✓ dist rebuilt — every symlinked project now runs current code.\n");
207
+ } else if (check) {
208
+ console.log("▸ --check: dry run, nothing will be written.\n");
209
+ } else {
210
+ console.log("▸ --skills-only: skipping build.\n");
211
+ }
212
+
213
+ // ── 2. Resolve targets ─────────────────────────────────────────────
214
+ let targets;
215
+ if (pathArgs.length > 0) {
216
+ targets = pathArgs.map((p) => resolve(p));
217
+ } else {
218
+ const reg = await loadRegistry();
219
+ targets = reg.targets ?? [];
220
+ }
221
+ if (targets.length === 0) {
222
+ console.error("No targets. Add paths to scripts/sync-targets.json or pass them as args (or run --discover).");
223
+ process.exit(1);
224
+ }
225
+
226
+ // ── 3. Sync skills + agents into each target ───────────────────────
227
+ console.log(`▸ Syncing skills + agents into ${targets.length} project(s):\n`);
228
+ let totalChanged = 0;
229
+ for (const t of targets) {
230
+ const r = await syncTarget(t, { check });
231
+ if (r.skipped) {
232
+ console.log(` ⊘ ${t}\n skipped: ${r.reason}`);
233
+ continue;
234
+ }
235
+ const n = r.commandsChanged.length + r.agentsChanged.length;
236
+ totalChanged += n;
237
+ if (n === 0) {
238
+ console.log(` ✓ ${t}\n already up to date`);
239
+ } else {
240
+ console.log(` ${check ? "✎" : "✓"} ${t}`);
241
+ if (r.commandsChanged.length) console.log(` commands ${check ? "would update" : "updated"}: ${r.commandsChanged.length} (${r.commandsChanged.slice(0, 5).join(", ")}${r.commandsChanged.length > 5 ? ", …" : ""})`);
242
+ if (r.agentsChanged.length) console.log(` agents ${check ? "would update" : "updated"}: ${r.agentsChanged.length} (${r.agentsChanged.join(", ")})`);
243
+ }
244
+ }
245
+
246
+ console.log(
247
+ `\n${check ? "Drift check complete" : "Sync complete"}: ${totalChanged} file(s) ${check ? "out of date" : "written"} across ${targets.length} project(s).`,
248
+ );
249
+ if (check && totalChanged > 0) process.exitCode = 1; // CI-friendly: drift → nonzero
250
+ }
251
+
252
+ main().catch((err) => {
253
+ console.error(err);
254
+ process.exit(1);
255
+ });
@@ -106,6 +106,13 @@ Wait for user response. If (B) or (C): respawn the subagent with the user's feed
106
106
 
107
107
  ## Step 6: Checkpoint 2 — Approach Selection
108
108
 
109
+ **Panel mode (gated, off by default):** Read `config.architect?.panel`. If `panel.enabled` is `true` AND `panel.lenses.length >= 2`, run the PANEL flow described in the inlined Lens Panel reference below (`<!-- Reference: arch-lens-panel.md -->`):
110
+ - First spawn a generate-approaches subagent (producing 2–3 candidate approaches that satisfy the Checkpoint 1 constraints).
111
+ - Then spawn one bober-architect subagent per lens in **MODE:lens-score:\<name\>** for each name in `panel.lenses`, bounded by `panel.maxConcurrent` concurrent spawns. Each scorer receives the same candidate set and scores them exclusively through its lens focus fragment (see `resolveArchLensFocus(lens)` in the reference).
112
+ - Call `synthesize()` (see `src/orchestrator/synthesizer.ts`) to aggregate per-lens scores and produce the ranked winner with dissent. Proceed with the highest-scoring approach as the selected approach.
113
+
114
+ OTHERWISE (panel disabled, or fewer than 2 lenses), spawn exactly ONE bober-architect subagent as described below — byte-identical to today's behaviour.
115
+
109
116
  Spawn a subagent with the approved Problem Statement included:
110
117
 
111
118
  ```
@@ -295,6 +302,12 @@ Handle (B)/(C) by respawning with feedback.
295
302
 
296
303
  ## Step 9: Checkpoint 5 — Final Assembly
297
304
 
305
+ **Panel mode (gated, off by default):** Read `config.architect?.panel`. If `panel.enabled` is `true` AND `panel.lenses.length >= 2`, run the PANEL flow described in the inlined Lens Panel reference below (`<!-- Reference: arch-lens-panel.md -->`):
306
+ - Spawn one bober-architect subagent per lens in **MODE:lens-review:\<name\>** for each name in `panel.lenses`, bounded by `panel.maxConcurrent` concurrent spawns. Each reviewer receives the assembled architecture document and ADRs and produces a PASS/FAIL verdict exclusively through its lens focus fragment.
307
+ - Call `reconcile()` (see `src/orchestrator/workflow/reconciler.ts`) to aggregate verdicts: strict majority (`passCount > failCount`), **fail-closed on tie** (tie → false). Record the reconciled verdict (including `lensVerdicts` array) in the assembly output.
308
+
309
+ OTHERWISE (panel disabled, or fewer than 2 lenses), spawn exactly ONE bober-architect subagent as described below — byte-identical to today's behaviour.
310
+
298
311
  Spawn a subagent to compile the complete architecture document:
299
312
 
300
313
  ```
@@ -0,0 +1,126 @@
1
+ # Arch Lens Panel — Canonical Protocol Reference
2
+
3
+ This document is the single source of truth for native architect panel orchestration in agent-bober.
4
+ It embeds the seven canonical arch lens focus fragments verbatim from
5
+ `src/orchestrator/arch-lenses.ts` (the `ARCH_LENS_CATALOG` literal) and documents the
6
+ CP2 synthesis panel and CP5 reconcile panel protocols.
7
+ The drift gate (`src/orchestrator/arch-lens-panel-parity.test.ts`) enforces byte-exact parity.
8
+
9
+ ---
10
+
11
+ ## Lens Focus Fragments
12
+
13
+ The following fragments are the exact strings returned by `resolveArchLensFocus(lens)` for each
14
+ built-in arch lens. They MUST remain byte-for-byte identical to the corresponding entries in
15
+ `ARCH_LENS_CATALOG` — the drift gate (`src/orchestrator/arch-lens-panel-parity.test.ts`) enforces this.
16
+
17
+ ### scalability
18
+
19
+ ```
20
+ Focus on whether the proposed architecture can handle projected load growth. Evaluate horizontal and vertical scaling paths, bottlenecks, stateful vs stateless components, and whether partitioning or sharding strategies are available when needed.
21
+ ```
22
+
23
+ ### security
24
+
25
+ ```
26
+ Focus on the threat surface introduced by this architecture. Evaluate trust boundaries, data flows across zones, authentication and authorisation enforcement points, secrets management, and exposure of internal services.
27
+ ```
28
+
29
+ ### cost
30
+
31
+ ```
32
+ Focus on the total cost of ownership implied by this architecture. Evaluate compute, storage, and egress costs at projected scale, licensing or SaaS subscription expenses, and the operational overhead of running, monitoring, and scaling the system.
33
+ ```
34
+
35
+ ### operability
36
+
37
+ ```
38
+ Focus on how easy it will be to operate this architecture in production. Evaluate observability (metrics, logs, traces), deployment complexity, rollout and rollback procedures, on-call burden, and the blast radius of common failure modes.
39
+ ```
40
+
41
+ ### maintainability
42
+
43
+ ```
44
+ Focus on how easy it will be to change and extend this architecture over time. Evaluate coupling between components, clarity of boundaries, documentation needs, onboarding friction for new contributors, and the risk of accruing technical debt.
45
+ ```
46
+
47
+ ### reversibility
48
+
49
+ ```
50
+ Focus on how difficult or costly it would be to undo or replace this architectural decision. Evaluate lock-in to vendors or proprietary technologies, data migration complexity, and whether a strangler-fig or incremental migration path exists if the approach needs to change.
51
+ ```
52
+
53
+ ### simplicity
54
+
55
+ ```
56
+ Focus on whether this is the simplest architecture that satisfies the Checkpoint 1 constraints. Challenge whether each component needs to exist, whether a native platform feature or an already-present dependency removes a proposed custom layer, whether two components should collapse into one, and whether any abstraction is speculative — added for a use case absent from the problem statement. Reward the smallest design that honours every hard constraint; penalise layers introduced for unproven future flexibility, but never at the expense of a stated constraint.
57
+ ```
58
+
59
+ > The `simplicity` lens enforces the top rung of the YAGNI ladder at design time: "does this
60
+ > component need to exist at all?". It is constraint-bounded by construction — it may never
61
+ > recommend dropping a layer that a Checkpoint 1 hard constraint requires. This keeps it
62
+ > consistent with the architect's IRON LAW (every decision must cite the constraint that
63
+ > eliminates the rejected alternative): a simplification that violates a constraint is not simpler,
64
+ > it is wrong.
65
+
66
+ ---
67
+
68
+ ## Native Architect Panel Protocol
69
+
70
+ ### CP2 Synthesis Panel
71
+
72
+ At Checkpoint 2 (candidate generation + scoring), the orchestrator runs the synthesis panel:
73
+
74
+ 1. **Generate candidates:** The architect produces 2–3 candidate approaches that satisfy the
75
+ Checkpoint 1 constraints.
76
+
77
+ 2. **Lens scorer fan-out (one per lens):** The orchestrator spawns one scorer subagent per
78
+ configured arch lens (scalability, security, cost, operability, maintainability, reversibility,
79
+ simplicity), bounded by `maxConcurrent`. Each scorer receives the same candidate set and is instructed to
80
+ score the candidates exclusively through its lens focus fragment (the exact string returned by
81
+ `resolveArchLensFocus(lens)` from `src/orchestrator/arch-lenses.ts`).
82
+
83
+ 3. **Synthesis:** `synthesize()` in `src/orchestrator/synthesizer.ts` aggregates the per-lens
84
+ scores and produces a ranked winner with dissent. The highest-scoring approach across lenses
85
+ becomes the recommended architecture; any lens that preferred a different candidate is recorded
86
+ as a dissenting voice in the synthesis output.
87
+
88
+ ### CP5 Reconcile Panel
89
+
90
+ At Checkpoint 5 (review pass), the orchestrator runs the reconcile panel:
91
+
92
+ 1. **Lens reviewer fan-out (one per lens):** The orchestrator spawns one reviewer subagent per
93
+ configured arch lens. Each reviewer receives the assembled architecture document and ADRs, and
94
+ is instructed to produce a PASS/FAIL verdict exclusively through its lens focus fragment.
95
+
96
+ 2. **Reconciliation — fail-closed on tie:** `reconcile()` in
97
+ `src/orchestrator/workflow/reconciler.ts` aggregates the per-lens verdicts using the following
98
+ semantics:
99
+
100
+ - **Inputs:** the array of per-lens `EvalResult` objects (`lensVerdicts`).
101
+ - **Require non-empty:** an empty array throws `"reconcile: lensVerdicts must be non-empty"`.
102
+ - **Vote count:** `passCount` = number of lenses where `passed === true`;
103
+ `failCount` = total − passCount.
104
+ - **Verdict:** `passed = passCount > failCount` (strict majority).
105
+ - **Fail-closed on tie:** when `passCount === failCount` the panel verdict is `false`.
106
+ - **Details:** union of all failing lens details, de-duplicated by `(criterion, message)` key.
107
+ - **Feedback:** failing lenses' feedback joined with `\n`; `"All lenses passed."` when all pass.
108
+ - **Summary:** `"Panel verdict: ${passCount}/${n} lenses passed"`.
109
+ - **Score:** `Math.round((100 * passCount) / n)`.
110
+ - **Evaluator tag:** `evaluator = "panel"`.
111
+
112
+ ### lensVerdicts Output Shape
113
+
114
+ After reconciliation the orchestrator writes a `lensVerdicts` array into the saved result.
115
+ The array shape is:
116
+
117
+ ```ts
118
+ lensVerdicts: Array<{
119
+ lens: string; // e.g. "scalability", "security", "cost", "operability", "maintainability", "reversibility", "simplicity"
120
+ passed: boolean; // individual lens verdict
121
+ summary: string; // per-lens summary from the scorer or reviewer subagent
122
+ }>
123
+ ```
124
+
125
+ This field is optional and backward-compatible: results produced before the panel feature
126
+ (or by non-panel architect runs) simply omit it.
@@ -61,6 +61,15 @@ Determine the iteration number: if prior eval results exist for this contract in
61
61
 
62
62
  ## Step 3: Spawn the Evaluator Subagent
63
63
 
64
+ **Panel mode (gated, off by default):** Read `config.evaluator.panel`. If `panel.enabled` is `true` AND `panel.lenses.length >= 2`, run the PANEL flow described in the inlined Lens Panel reference below (`<!-- Reference: lens-panel.md -->`):
65
+ - Spawn ONE bober-evaluator with **MODE:deterministic** — runs the configured strategy suite exactly once.
66
+ - Then spawn one bober-evaluator per lens with **MODE:lens:<name>** for each name in `panel.lenses`, bounded by `panel.maxConcurrent` concurrent spawns.
67
+ - Collect each lens verdict; majority-vote: `passed = passCount > failCount`, **FAIL-CLOSED on tie** (tie → false).
68
+ - Set `final.passed = deterministic.passed && reconciled.passed`.
69
+ - Save the eval-result with `evaluator: "panel"` and a `lensVerdicts: [{ lens, passed, summary }]` array.
70
+
71
+ OTHERWISE (panel disabled, or fewer than 2 lenses), spawn exactly ONE bober-evaluator with **MODE:full** exactly as described below — byte-identical to today's behaviour.
72
+
64
73
  Use the **Agent tool** to spawn an evaluator subagent.
65
74
 
66
75
  ```
@@ -0,0 +1,115 @@
1
+ # Lens Panel — Canonical Protocol Reference
2
+
3
+ This document is the single source of truth for native panel orchestration in agent-bober.
4
+ It embeds the five canonical lens focus fragments verbatim from
5
+ `src/orchestrator/eval-lenses.ts` (the `LENS_CATALOG` literal) and documents the
6
+ split fan-out, majority-vote/fail-closed reconciliation, and the `lensVerdicts` output shape.
7
+
8
+ ---
9
+
10
+ ## Lens Focus Fragments
11
+
12
+ The following fragments are the exact strings returned by `resolveLensFocus(lens)` for each
13
+ built-in lens. They MUST remain byte-for-byte identical to the corresponding entries in
14
+ `LENS_CATALOG` — the drift gate (`src/orchestrator/lens-panel-parity.test.ts`) enforces this.
15
+
16
+ ### correctness
17
+
18
+ ```
19
+ Focus on whether the implementation actually satisfies each success criterion verbatim. Check that all required behaviours exist, all edge cases are handled, and the contract's definitionOfDone is met.
20
+ ```
21
+
22
+ ### security
23
+
24
+ ```
25
+ Focus on injection vulnerabilities, authentication and authorisation gaps, secret handling, unsafe input validation, and any path traversal or privilege escalation risks.
26
+ ```
27
+
28
+ ### regression
29
+
30
+ ```
31
+ Focus on whether previously working behaviour still works after the changes. Verify that pre-existing tests pass, that no public API or config interface was broken, and that the sprint diff does not silently remove functionality.
32
+ ```
33
+
34
+ ### quality
35
+
36
+ ```
37
+ Focus on principles violations, dead code, misleading naming, smells, duplicated logic, and whether the implementation follows the project's established patterns and conventions.
38
+ ```
39
+
40
+ ### simplicity
41
+
42
+ ```
43
+ Focus exclusively on over-engineering in the production code: logic that reinvents the standard library, dependencies or hand-rolled code doing what a native platform feature already provides, abstractions with a single implementation, configuration nobody reads, dead flexibility, and code expressible in materially fewer lines. For each, name the location, what to cut, and what replaces it. Never flag tests, assertion-based self-checks, input validation at trust boundaries, error handling, security measures, or accessibility as deletable — minimalism governs production code, never the verification or safety discipline.
44
+ ```
45
+
46
+ > The `simplicity` lens is the complexity-only counterpart to `quality`. `quality` asks
47
+ > "does this follow our patterns and is it free of smells?"; `simplicity` asks "what can be
48
+ > deleted, replaced by stdlib/native, or shrunk?" — and is forbidden from ever recommending the
49
+ > removal of a test, a validation, or a safety measure. It pairs cleanly with the evaluator's
50
+ > test/verification Iron Law: minimalism governs what is built, never what is verified.
51
+
52
+ ---
53
+
54
+ ## Native Panel Protocol
55
+
56
+ ### Split Fan-out
57
+
58
+ When the native panel is active, the orchestrator spawns evaluators in two passes:
59
+
60
+ 1. **Deterministic evaluator (one instance):** runs the configured strategy suite exactly once
61
+ (build, typecheck, lint, unit-test, playwright, api-check, etc.). This produces the
62
+ deterministic verdict — objective, tool-based checks that do not depend on lens focus.
63
+
64
+ 2. **Qualitative evaluators (one per configured lens):** each evaluator receives the same
65
+ sprint diff and context but is instructed to judge the contract's success criteria
66
+ exclusively through its lens focus fragment. The strategy suite is **not** re-run for
67
+ these evaluators — they perform qualitative assessment only, using the results already
68
+ collected by the deterministic evaluator as supporting context.
69
+
70
+ This split ensures strategies execute once (no duplicate CI cost) while each lens evaluates
71
+ the diff independently.
72
+
73
+ ### Reconciliation — Majority Vote, Fail-Closed
74
+
75
+ The lens verdicts are reconciled by `reconcile()` in
76
+ `src/orchestrator/workflow/reconciler.ts` using the following semantics:
77
+
78
+ - **Inputs:** the array of per-lens `EvalResult` objects (`lensVerdicts`).
79
+ - **Require non-empty:** an empty array throws `"reconcile: lensVerdicts must be non-empty"`.
80
+ - **Vote count:** `passCount` = number of lenses where `passed === true`;
81
+ `failCount` = total − passCount.
82
+ - **Verdict:** `passed = passCount > failCount` (strict majority).
83
+ - **Fail-closed on tie:** when `passCount === failCount` the panel verdict is `false`.
84
+ - **Details:** union of all failing lens details, de-duplicated by `(criterion, message)` key.
85
+ - **Feedback:** failing lenses' feedback joined with `\n`; `"All lenses passed."` when all pass.
86
+ - **Summary:** `"Panel verdict: ${passCount}/${n} lenses passed"`.
87
+ - **Score:** `Math.round((100 * passCount) / n)`.
88
+ - **Evaluator tag:** `evaluator = "panel"`.
89
+ - **Timestamp:** echoed verbatim from the input argument (pure function, ADR-4).
90
+
91
+ ### Combine
92
+
93
+ The final sprint verdict combines both passes:
94
+
95
+ ```
96
+ final.passed = deterministic.passed && reconciled.passed
97
+ ```
98
+
99
+ Both must pass for the sprint to be accepted.
100
+
101
+ ### lensVerdicts Output Shape
102
+
103
+ After reconciliation the orchestrator writes a `lensVerdicts` array into the saved
104
+ `EvalResult` JSON and sets `evaluator = "panel"`. The array shape is:
105
+
106
+ ```ts
107
+ lensVerdicts: Array<{
108
+ lens: string; // e.g. "correctness", "security", "regression", "quality", "simplicity"
109
+ passed: boolean; // individual lens verdict
110
+ summary: string; // per-lens summary from the qualitative evaluator
111
+ }>
112
+ ```
113
+
114
+ This field is optional and backward-compatible: eval results produced before the panel
115
+ feature (or by non-panel evaluators) simply omit it.
@@ -77,6 +77,12 @@ Read the following files if they exist (skip those that do not):
77
77
  3. `package.json` — dependencies, scripts, project metadata
78
78
  4. `tsconfig.json` — TypeScript configuration
79
79
  5. Any files listed in `planner.contextFiles` from the config
80
+ 6. **Learn from past sprint outcomes (bounded memory):** Load the distilled lessons index via
81
+ `retrieveRelevantLessons(projectRoot, keywords, { topK })`, deriving `keywords` from the feature
82
+ title/description. This reads ONLY the bounded `.bober/memory/INDEX.md` and returns at most
83
+ `topK` deterministically-ranked lessons. **Do NOT read `.bober/history.jsonl` directly** — the raw
84
+ history is unbounded and is intentionally off-limits to the planner. Use the returned lessons to
85
+ avoid repeating past failure patterns when shaping sprints.
80
86
 
81
87
  Survey the project structure:
82
88
  - Use Glob with patterns appropriate to the stack to understand the file layout (e.g., `src/**/*.ts`, `contracts/**/*.sol`, `programs/**/*.rs`, `app/**/*`, `pages/**/*`)
@@ -52,7 +52,7 @@ ORCHESTRATOR (you — this session)
52
52
  │ │ └─ Add evaluator feedback to handoff
53
53
  │ │ └─ Go to 4b (spawn FRESH generator with feedback)
54
54
  │ │
55
- │ └─ 4e. If PASSED: update contract status, log, next sprint
55
+ │ └─ 4e. If PASSED: update contract status, log, spawn documenter (per-sprint docs), next sprint
56
56
 
57
57
  └─ 5. Final summary
58
58
  ```
@@ -443,6 +443,15 @@ When done, respond with EXACTLY this JSON structure (no other text):
443
443
 
444
444
  ### 3f. Spawn the Evaluator Subagent
445
445
 
446
+ **Panel mode (gated, off by default):** Read `config.evaluator.panel`. If `panel.enabled` is `true` AND `panel.lenses.length >= 2`, run the PANEL flow described in the inlined Lens Panel reference below (`<!-- Reference: lens-panel.md -->`):
447
+ - Spawn ONE bober-evaluator with **MODE:deterministic** — runs the configured strategy suite exactly once.
448
+ - Then spawn one bober-evaluator per lens with **MODE:lens:<name>** for each name in `panel.lenses`, bounded by `panel.maxConcurrent` concurrent spawns.
449
+ - Collect each lens verdict; majority-vote: `passed = passCount > failCount`, **FAIL-CLOSED on tie** (tie → false).
450
+ - Set `final.passed = deterministic.passed && reconciled.passed`.
451
+ - Save the eval-result with `evaluator: "panel"` and a `lensVerdicts: [{ lens, passed, summary }]` array.
452
+
453
+ OTHERWISE (panel disabled, or fewer than 2 lenses), spawn exactly ONE bober-evaluator with **MODE:full** exactly as described below — byte-identical to today's behaviour.
454
+
446
455
  Use the **Agent tool** to spawn an evaluator subagent.
447
456
 
448
457
  **How to call the Agent tool:**
@@ -547,20 +556,30 @@ When done, respond with EXACTLY this JSON structure (no other text):
547
556
  ```json
548
557
  {"event":"sprint-completed","contractId":"...","specId":"...","iteration":N,"timestamp":"..."}
549
558
  ```
550
- 4. **Check if the plan is now fully complete.** Read the PlanSpec's `sprints` array to get the total sprint count. Count how many of those contracts now have `status: "completed"`. If ALL sprints are completed (N/N):
559
+ 4. **Spawn the Documenter subagent — write docs now, per-sprint, while the change is fresh.** Do NOT defer documentation to a final sprint. Use the Agent tool with `subagent_type: bober-documenter` and `mode: auto`:
560
+ ```
561
+ You are the Bober Documenter subagent. Sprint <N> just PASSED evaluation and was marked complete. Write its documentation and update related docs while the change is fresh.
562
+
563
+ Read from disk: .bober/contracts/<contractId>.json, .bober/handoffs/gen-report-<contractId>-<iteration>.json, .bober/eval-results/eval-<contractId>-<iteration>.json, and .bober/principles.md if it exists.
564
+
565
+ Follow your agent instructions: determine what was built from the committed diff, write the sprint record to docs/sprints/<contractId>.md, find & update related existing docs (README, ADRs, CLAUDE.md, module docs) made stale by the change, and commit ONLY the doc files separately. Do NOT modify application code or tests. Respond with the JSON structure defined in your agent spec.
566
+ ```
567
+ After it returns: parse the JSON. If it crashed, do NOT fail the sprint (it already passed) — log `{"event":"sprint-docs-failed","contractId":"...","timestamp":"..."}` and continue. Carry any non-empty `concerns` into the milestone print.
568
+ 5. **Check if the plan is now fully complete.** Read the PlanSpec's `sprints` array to get the total sprint count. Count how many of those contracts now have `status: "completed"`. If ALL sprints are completed (N/N):
551
569
  - Update the PlanSpec: set `status` to `"completed"` and `completedAt` to current ISO-8601 timestamp. Save to `.bober/specs/<specId>.json`. **The `status` field MUST remain in the first 10 lines of the JSON** so future runs can skip it with a partial read.
552
570
  - Update `.bober/progress.md` — change the plan's status line to `completed (N/N sprints)`.
553
571
  - Log event: `{"event":"plan-completed","specId":"...","sprintsCompleted":N,"timestamp":"..."}`
554
- 5. Print milestone:
572
+ 6. Print milestone:
555
573
  ```
556
574
  === Sprint <N>/<total> PASSED ===
557
575
  Title: <title>
558
576
  Iteration: <M>
559
577
  Progress: [=====> ] <N>/<total> sprints complete
578
+ Docs: <sprintDocPath> (+ <count> related docs updated)
560
579
  Next: <next sprint title>
561
580
  ```
562
581
  If all sprints are done, print `=== PLAN COMPLETE ===` instead of "Next:".
563
- 6. Move to next sprint.
582
+ 7. Move to next sprint.
564
583
 
565
584
  **On FAIL with retries remaining:**
566
585
  1. Check if iteration < `evaluator.maxIterations` (default: 3).