@yemi33/minions 0.1.2379 → 0.1.2381

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 (100) hide show
  1. package/bin/minions.js +19 -9
  2. package/dashboard/js/refresh.js +3 -4
  3. package/dashboard/js/render-other.js +43 -23
  4. package/dashboard/js/render-prd.js +1 -1
  5. package/dashboard/js/render-work-items.js +13 -6
  6. package/dashboard/js/settings.js +40 -17
  7. package/dashboard.js +435 -768
  8. package/docs/architecture-review-2026-07-09.md +2 -4
  9. package/docs/auto-discovery.md +36 -49
  10. package/docs/blog-first-successful-dispatch.md +1 -1
  11. package/docs/branch-derivation.md +2 -2
  12. package/docs/command-center.md +1 -1
  13. package/docs/completion-reports.md +14 -4
  14. package/docs/constellation-bridge.md +59 -10
  15. package/docs/constellation-style-telemetry.md +6 -6
  16. package/docs/cooldown-merge-semantics.md +4 -0
  17. package/docs/copilot-cli-schema.md +3 -3
  18. package/docs/cross-repo-plans.md +17 -17
  19. package/docs/deprecated.json +2 -2
  20. package/docs/design-state-storage.md +1 -1
  21. package/docs/documentation-audit-2026-07-09.md +2 -2
  22. package/docs/engine-restart.md +20 -8
  23. package/docs/harness-mode.md +1 -1
  24. package/docs/live-checkout-mode.md +45 -26
  25. package/docs/managed-spawn.md +4 -4
  26. package/docs/onboarding.md +1 -2
  27. package/docs/pr-comment-followup.md +3 -3
  28. package/docs/pr-review-fix-loop.md +1 -1
  29. package/docs/proposals/repo-pool-for-live-checkout.md +1 -2
  30. package/docs/qa-runbook-lifecycle.md +4 -4
  31. package/docs/qa-runbooks.md +2 -2
  32. package/docs/rfc-completion-json.md +4 -1
  33. package/docs/runtime-adapters.md +1 -1
  34. package/docs/self-improvement.md +4 -5
  35. package/docs/shared-lifecycle-module-map.md +3 -1
  36. package/docs/slim-ux/architecture-suggestions.md +5 -6
  37. package/docs/slim-ux/concepts.md +23 -25
  38. package/docs/watches.md +7 -7
  39. package/docs/workspace-manifests.md +1 -1
  40. package/docs/worktree-lifecycle.md +1 -1
  41. package/engine/abandoned-pr-reconciliation.js +4 -5
  42. package/engine/ado-status.js +5 -5
  43. package/engine/ado.js +20 -25
  44. package/engine/agent-worker-pool.js +58 -1
  45. package/engine/bridge.js +260 -5
  46. package/engine/cleanup.js +48 -131
  47. package/engine/cli.js +125 -83
  48. package/engine/cooldown.js +9 -16
  49. package/engine/db/index.js +22 -9
  50. package/engine/db/migrations/009-qa.js +1 -1
  51. package/engine/db/migrations/020-qa-session-scopes.js +23 -0
  52. package/engine/db/migrations/021-archived-work-items.js +72 -0
  53. package/engine/db/migrations/022-global-cc-session.js +31 -0
  54. package/engine/db/migrations/023-engine-state.js +30 -0
  55. package/engine/db/migrations/024-prd-ghost-collisions.js +53 -0
  56. package/engine/db/migrations/025-malformed-work-item-phantoms.js +33 -0
  57. package/engine/dispatch-store.js +2 -7
  58. package/engine/dispatch.js +39 -44
  59. package/engine/github.js +20 -27
  60. package/engine/lifecycle.js +279 -354
  61. package/engine/live-checkout.js +193 -149
  62. package/engine/llm.js +1 -1
  63. package/engine/logs-store.js +2 -2
  64. package/engine/managed-spawn.js +2 -23
  65. package/engine/meeting.js +6 -6
  66. package/engine/metrics-store.js +2 -2
  67. package/engine/note-link-backfill.js +6 -11
  68. package/engine/pipeline.js +18 -36
  69. package/engine/playbook.js +13 -16
  70. package/engine/prd-store.js +73 -54
  71. package/engine/preflight.js +2 -5
  72. package/engine/projects.js +15 -62
  73. package/engine/pull-requests-store.js +0 -17
  74. package/engine/qa-runbooks.js +2 -2
  75. package/engine/qa-runs.js +1 -8
  76. package/engine/qa-sessions.js +41 -64
  77. package/engine/queries.js +120 -219
  78. package/engine/routing.js +4 -6
  79. package/engine/scheduler.js +0 -4
  80. package/engine/shared-branch-pr-reconcile.js +2 -3
  81. package/engine/shared.js +268 -699
  82. package/engine/small-state-store.js +89 -10
  83. package/engine/state-operations.js +16 -4
  84. package/engine/stdio-timestamps.js +1 -1
  85. package/engine/timeout.js +5 -12
  86. package/engine/watch-actions.js +20 -22
  87. package/engine/watches-store.js +1 -1
  88. package/engine/watches.js +6 -10
  89. package/engine/work-item-validation.js +52 -0
  90. package/engine/work-items-store.js +127 -29
  91. package/engine/worktree-gc.js +2 -2
  92. package/engine/worktree-pool.js +8 -18
  93. package/engine.js +197 -358
  94. package/minions.js +2 -2
  95. package/package.json +1 -1
  96. package/playbooks/plan-to-prd.md +2 -2
  97. package/playbooks/shared-rules.md +3 -3
  98. package/playbooks/templates/followup-dispatch.md +1 -1
  99. package/playbooks/verify.md +1 -1
  100. package/prompts/cc-system.md +9 -9
package/minions.js CHANGED
@@ -162,7 +162,7 @@ async function addProject(targetDir) {
162
162
  process.exit(1);
163
163
  }
164
164
 
165
- shared.ensureProjectStateFiles(projectEntry);
165
+ shared.initializeProjectState(projectEntry);
166
166
  config.projects.push(projectEntry);
167
167
  saveConfig(config);
168
168
 
@@ -383,7 +383,7 @@ async function scanAndAdd({ root, depth } = {}) {
383
383
  repoHost: repo.host, repositoryId: repo.repositoryId, org: repo.org, project: repo.project,
384
384
  repoName: repo.repoName, mainBranch: repo.mainBranch, prUrlBase: repo.prUrlBase,
385
385
  });
386
- shared.ensureProjectStateFiles(projectEntry);
386
+ shared.initializeProjectState(projectEntry);
387
387
  config.projects.push(projectEntry);
388
388
  console.log(` + ${name} (${repo.path})`);
389
389
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2379",
3
+ "version": "0.1.2381",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"
@@ -135,7 +135,7 @@ Rules for items:
135
135
  { "id": "P-bbb2", "name": "UI client", "project": "web-dashboard", ... }
136
136
  ]
137
137
  ```
138
- The engine routes each item to that project's `work-items.json`. The verify task at plan completion picks the project with the most completed items and runs cross-repo verification from there. See the **Cross-repo plans** section below for the full output contract when `{{target_projects}}` is set.
138
+ The engine routes each item to that project's SQL work-item scope. The verify task at plan completion picks the project with the most completed items and runs cross-repo verification from there. See the **Cross-repo plans** section below for the full output contract when `{{target_projects}}` is set.
139
139
  - `depends_on` lists IDs of items that must be done first
140
140
  - Keep descriptions actionable — name the files, functions, patterns, or integration points the implementing agent should touch whenever the plan makes them clear
141
141
  - Include `acceptance_criteria` so reviewers know when it's done
@@ -149,7 +149,7 @@ This dispatch is rendering against a **cross-repo plan** — the engine extracte
149
149
  Apply these rules on top of (and where they conflict, instead of) the single-project guidance above:
150
150
 
151
151
  1. **Omit the top-level `"project"` field** on the PRD JSON — or set it to `""`. The PRD is not anchored to a single project. The dashboard reads `i.projects[]` per item (P-e8d49105) to render the cross-repo rollup; the top-level `project` only makes sense when the whole plan lives in one repo.
152
- 2. **Every `missing_features` item MUST have an explicit `project`** chosen from `{{target_projects}}`. Do NOT leave `project` unset, do NOT fall back to `{{project_name}}` (it is unset for cross-repo dispatches), and do NOT invent a project not in the list — the engine routes each item to that project's `work-items.json` and an item with an unrecognized project will not materialize. Example:
152
+ 2. **Every `missing_features` item MUST have an explicit `project`** chosen from `{{target_projects}}`. Do NOT leave `project` unset, do NOT fall back to `{{project_name}}` (it is unset for cross-repo dispatches), and do NOT invent a project not in the list — the engine routes each item to that project's SQL scope and an item with an unrecognized project will not materialize. Example:
153
153
  ```json
154
154
  "missing_features": [
155
155
  { "id": "P-aaa1", "name": "API endpoint", "project": "<first project from {{target_projects}}>", ... },
@@ -257,7 +257,7 @@ single API call that creates a thread pre-resolved. So on GitHub:
257
257
  When asked to check build status, CI results, or review state for a PR:
258
258
 
259
259
  **Preferred — read cached state (refreshed every `prPollStatusEvery` ticks, default ~12 min when engine is running):**
260
- Find the PR in `projects/<project-name>/pull-requests.json` by `prNumber`. Key fields:
260
+ Read `GET http://localhost:{{dashboard_port}}/api/pull-requests` and find the project-scoped record by `prNumber`. Key fields:
261
261
  - `buildStatus` — `passing` | `failing` | `running` | `none`
262
262
  - `buildFailReason` — failing check/pipeline name when `buildStatus` is `failing`; inspect live CI logs yourself for details
263
263
  - `reviewStatus` — `approved` | `changes-requested` | `waiting` | `pending`
@@ -324,7 +324,7 @@ Only GitHub/Copilot authentication guidance applies to GitHub repository work.
324
324
  When asked to check build status, CI results, or review state for a PR:
325
325
 
326
326
  **Preferred — read cached state (refreshed every `prPollStatusEvery` ticks, default ~12 min when engine is running):**
327
- Find the PR in `projects/<project-name>/pull-requests.json` by `prNumber`. Key fields:
327
+ Read `GET http://localhost:{{dashboard_port}}/api/pull-requests` and find the project-scoped record by `prNumber`. Key fields:
328
328
  - `buildStatus` — `passing` | `failing` | `running` | `none`
329
329
  - `buildFailReason` — failing check/pipeline name when `buildStatus` is `failing`; inspect live CI logs yourself for details
330
330
  - `reviewStatus` — `approved` | `changes-requested` | `waiting` | `pending`
@@ -333,7 +333,7 @@ Find the PR in `projects/<project-name>/pull-requests.json` by `prNumber`. Key f
333
333
 
334
334
  **Live status (when engine isn't running or you need up-to-the-moment results):**
335
335
  ```bash
336
- node engine/ado-status.js <prNumber> # reads cached pull-requests.json
336
+ node engine/ado-status.js <prNumber> # reads the cached SQL PR store
337
337
  node engine/ado-status.js <prNumber> --live # fresh ADO API call
338
338
  node engine/ado-status.js <prNumber> --live --project MyProject
339
339
  ```
@@ -137,7 +137,7 @@ auditable record of what you fanned out to:
137
137
  ```
138
138
 
139
139
  The engine logs each entry at `info` and warns if the array references a WI id
140
- that doesn't exist in any project's `work-items.json` (mismatch between what
140
+ that doesn't exist in any project's SQL scope (mismatch between what
141
141
  you claim and what the API actually created — usually a sign that the dispatch
142
142
  was reverted or the response was misread).
143
143
 
@@ -53,7 +53,7 @@ Use the template at `{{team_root}}/playbooks/templates/verify-guide.md` and clea
53
53
 
54
54
  For each project with aggregate verification changes, create or update one draft/review PR that combines the plan branches into a single reviewable diff. Reuse an existing `e2e/{{plan_slug}}` branch/PR when present. Include the plan summary, merged PRs, testing guide, and build/test status. Do not auto-complete or merge these PRs.
55
55
 
56
- Track each E2E PR in the project's `.minions/pull-requests.json` if it is not already tracked.
56
+ Include each E2E PR in the structured completion report so the engine enrolls it in the project PR store. If manual enrollment is needed, use `POST /api/pull-requests/link`; never edit runtime state directly.
57
57
 
58
58
  ## Cross-PR Compatibility Audit
59
59
 
@@ -32,12 +32,12 @@ A literal `</UNTRUSTED-INPUT>` substring is impossible inside a fence — the fe
32
32
 
33
33
  ## Guardrails
34
34
  {{cc_protected_paths}}
35
- CAN modify: notes, plans, knowledge, work items, pull-requests.json, routing.md, charters, skills, playbooks, project repos.
35
+ CAN modify: notes, plans, knowledge, work items and PR records through dashboard APIs, routing.md, charters, skills, playbooks, project repos.
36
36
 
37
37
  **Never use the `AskUserQuestion` tool.** This conversation runs headless — the dashboard has no UI to surface the question and no way to feed an answer back, so every invocation hangs the turn. If you need clarification, ask in plain text in your reply; the user can answer in the next message.
38
38
 
39
39
  ## Filesystem
40
- Minions state lives in `{{minions_dir}}/`. Key paths: `config.json` (config), `routing.md` (dispatch rules), `projects/{name}/work-items.json` & `pull-requests.json` (per-project), `agents/{id}/` (charters, output), `plans/` & `prd/` (plans), `knowledge/` (KB), `notes/inbox/` (inbox), `engine/dispatch.json` (queue), `playbooks/` (templates). Use tools to read specifics.
40
+ Minions runtime state lives in `{{minions_dir}}/engine/state.db` and is accessed through dashboard APIs. Key file-backed paths: `config.json` (config), `routing.md` (dispatch rules), `agents/{id}/` (charters/output), `plans/` (plan Markdown), `knowledge/` (KB), `notes/inbox/` (inbox), and `playbooks/` (templates). Use `GET /api/routes` to discover state APIs.
41
41
 
42
42
  ## Your skills
43
43
 
@@ -92,7 +92,7 @@ When genuinely in doubt about the size, delegate — agents have isolated worktr
92
92
  ### HARD STOP — never edit files yourself in a live/hybrid project
93
93
  This overrides everything above, **including the direct-handling override**. For any project whose effective checkout mode is `live` (or `hybrid` for a code-authoring work-item type — `implement`/`fix`/`docs`/`decompose`), you MUST NOT use `Edit`/`Write`/`Bash` (or any tool) to mutate files inside that project's `localPath`, **regardless of task size** — not even a Small 1-line change, and not even when the human explicitly says to do it yourself. The Step-3 "do it yourself" allowance and the Step-1 direct-handling override do **not** apply to writes inside a live/hybrid checkout.
94
94
 
95
- Why: live-mode projects have no worktree isolation — the engine runs agents in-place inside `localPath`, caps dispatch to one mutating operation at a time, and refuses to dispatch on a dirty tree (`live-checkout-dirty`, non-retryable). A stray CC edit leaves the checkout dirty in a way the dispatch bookkeeping does not track, and that dirty state then **blocks every subsequent live-mode dispatch** on the project until a human manually cleans it up. It is NOT covered by the engine's dispatch-time auto-stash/auto-reset recovery those only run as part of an actual dispatch preflight, never for stray CC edits.
95
+ Why: live-mode projects have no worktree isolation — the engine runs agents in-place inside `localPath` and caps dispatch to one mutating operation at a time. A stray CC edit is outside dispatch ownership: with dirty recovery disabled it causes a `live-checkout-dirty` refusal that blocks live work, while the default auto-stash policy can silently park that edit before the next dispatch, so the requested change is no longer present for the agent to validate or commit. Auto-stash/reset is a dispatch recovery mechanism, not ownership bookkeeping for CC edits.
96
96
 
97
97
  Instead, when a change is needed in a live/hybrid project, **dispatch a normal work item** (`POST /api/work-items`, `type: "implement"` or `"fix"` as usual) and let the engine own the live-checkout dispatch path (dirty-tree refusal, single-mutating-dispatch cap, auto-stash/auto-reset). Do not try to shortcut it with your own edit.
98
98
 
@@ -333,23 +333,23 @@ The `X-CC-Turn-Id` header is the audit trail — the handler stamps it onto the
333
333
  Every configured project has an effective **checkout mode** — surfaced in your state snapshot next to the project as `[worktree]`, `[live]`, or `[hybrid (live-validation: <type>)]`. It controls where dispatched agents run:
334
334
 
335
335
  - **`worktree`** (default) — each dispatch gets its own isolated `git worktree`. Agents run fully in parallel; nothing touches the operator's working tree. Use for normal repos.
336
- - **`live`** — agents run **in-place** inside the project's `localPath` (no worktree). The engine caps this to **one mutating dispatch at a time** per project and **refuses on a dirty tree**. Use only when worktrees are unworkable (e.g. Android `repo`, submodules, deep Windows paths, emulators that bind the real checkout).
337
- - **`hybrid`** — `live` **plus** a `liveValidation: { type, autoDispatch }` block. Coding work items (`implement`/`fix`/`docs`/`decompose`) author in **isolated worktrees** (full parallelism), while **only** work items whose type matches `liveValidation.type` (e.g. `build-and-test`) run **in-place on the live checkout**. This is the best of both: parallel code authoring + a real on-disk build/validation that can't run in a worktree. `type` accepts a single string (e.g. `"build-and-test"`) or an array of strings (e.g. `["implement","fix"]`) to route multiple work-item types to the live checkout at once.
336
+ - **`live`** — agents run **in-place** inside the project's `localPath` (no worktree). The engine caps this to **one mutating dispatch at a time** per project. Dirty-tree behavior follows the configured auto-stash/reset policy (auto-stash defaults on); with recovery disabled, the item remains pending until the tree is clean. Use only when worktrees are unworkable.
337
+ - **`hybrid`** — `live` **plus** a `liveValidation: { type, autoDispatch }` block. Work items not listed in `type` use isolated worktrees; listed live-capable canonical work-item types run in-place. The normal validation type is `test`. `build-and-test` is a playbook name, not a work-item type. `type` accepts one string or an array. When `autoDispatch:true`, `test` must be included; the engine creates one PR-targeted `test` WI with the `build-and-test` playbook after each eligible coding WI completes.
338
338
 
339
- **CC never writes into a live/hybrid checkout itself.** Because `live` (and the code-authoring surface of `hybrid`) runs in-place with no worktree isolation, a one-off CC edit inside such a project's `localPath` leaves the tree dirty and blocks every future live-mode dispatch (the engine refuses on a dirty tree, `live-checkout-dirty`, non-retryable — and it does not track or auto-recover stray CC edits). So for any needed change in a `live`/`hybrid` project you **dispatch a work item** and let the engine own the live-checkout path; you never `Edit`/`Write`/`Bash`-mutate files there yourself, regardless of task size or a direct-handling override. Read-only inspection remains fine. This is the same rule stated up top under "HARD STOP — never edit files yourself in a live/hybrid project"; the two sections agree by design.
339
+ **CC never writes into a live/hybrid checkout itself.** A one-off CC edit leaves untracked operator dirt that the next dispatch may unexpectedly stash or may block on when recovery is disabled. For any needed change, **dispatch a work item** and let the engine own the live-checkout path; never `Edit`/`Write`/`Bash`-mutate files there yourself. Read-only inspection remains fine.
340
340
 
341
341
  **When to recommend hybrid:** the project's build/test/validation genuinely cannot run in an isolated worktree (it needs the real checkout — submodules, a `repo`-managed tree, an emulator/dev-server bound to `localPath`, deep-path tooling), **but** you still want coding agents to work in parallel rather than serialize through the single live checkout. If the *whole* workflow must run on the real tree, use plain `live`. If nothing needs the real tree, stay on `worktree`.
342
342
 
343
343
  **Configuring it** (via the projects array on `POST /api/settings` — never hand-edit `config.json`):
344
344
  ```bash
345
- # Switch a project to hybrid mode (live checkout + deferred build-and-test validation)
345
+ # Switch a project to hybrid mode (live checkout + deferred test validation)
346
346
  curl -s -X POST http://localhost:{{dashboard_port}}/api/settings \
347
347
  -H 'Content-Type: application/json' -H 'X-CC-Turn-Id: {{cc_turn_id}}' \
348
- -d '{"projects":[{"name":"<project>","checkoutMode":"live","liveValidation":{"type":"build-and-test","autoDispatch":true}}]}'
348
+ -d '{"projects":[{"name":"<project>","checkoutMode":"live","liveValidation":{"type":"test","autoDispatch":true}}]}'
349
349
  # Clear hybrid (back to plain live): pass "liveValidation": null
350
350
  # Clear live entirely (back to worktree): pass "checkoutMode": "worktree" (also clear liveValidation)
351
351
  ```
352
- The server validates: `liveValidation` requires `checkoutMode:"live"` (400 otherwise) and a non-empty `type`. With `autoDispatch:true`, the engine auto-creates a `<type>` validation WI on the live checkout after each coding WI completes with a PR. **Always confirm the mode switch with the user before applying it** — it changes how every future dispatch on that project runs.
352
+ The server validates: `liveValidation` requires `checkoutMode:"live"`, canonical live-capable work-item type(s), and a boolean `autoDispatch`; automatic validation additionally requires `test` in `type`. **Always confirm the mode switch with the user before applying it** — it changes how future dispatches run.
353
353
 
354
354
  ## GitHub auth
355
355