@yemi33/minions 0.1.2364 → 0.1.2366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dashboard.js CHANGED
@@ -14125,14 +14125,50 @@ What would you like to discuss or change? When you're happy, say "approve" and I
14125
14125
 
14126
14126
  { method: 'POST', path: '/api/pull-requests/delete', desc: 'Remove a PR from tracking (sets userDeleted tombstone so pollers do not re-add it)', params: 'id, project?', handler: async (req, res) => {
14127
14127
  const body = await readBody(req);
14128
- const { id } = body;
14128
+ const { id, project: requestedProjectName } = body;
14129
14129
  if (!id) return jsonReply(res, 400, { error: 'id required' });
14130
14130
  reloadConfig();
14131
14131
  // Search all project PR files and central file
14132
- const prPaths = [
14133
- ...shared.getProjects(CONFIG).map(p => shared.projectPrPath(p)),
14134
- path.join(MINIONS_DIR, 'pull-requests.json'),
14135
- ];
14132
+ const projects = shared.getProjects(CONFIG);
14133
+ const projectByName = new Map(projects.map(project => [project.name, project]));
14134
+ const store = require('./engine/pull-requests-store');
14135
+ const storedPrs = store.readAllPullRequests() || [];
14136
+ const prScopes = new Map([
14137
+ ...projects.map(project => [project.name, { prPath: shared.projectPrPath(project), project }]),
14138
+ ['central', { prPath: path.join(MINIONS_DIR, 'pull-requests.json'), project: null }],
14139
+ ]);
14140
+ const canonicalRequest = shared.parseCanonicalPrId(id);
14141
+ const requestedIdentities = new Set();
14142
+ if (canonicalRequest) {
14143
+ const compatibleProject = canonicalRequest.scope.startsWith('ado:')
14144
+ ? projects.find(project => shared.isAdoPrScopeCompatible(canonicalRequest.scope, project))
14145
+ : null;
14146
+ requestedIdentities.add(shared.getPrIdentityKey(id, compatibleProject || null));
14147
+ } else {
14148
+ for (const pr of storedPrs) {
14149
+ if (pr?.id !== id) continue;
14150
+ if (requestedProjectName && pr._scope !== requestedProjectName) continue;
14151
+ const ownerProject = pr._scope && pr._scope !== 'central'
14152
+ ? projectByName.get(pr._scope) || null
14153
+ : null;
14154
+ const identity = shared.getPrIdentityKey(pr, ownerProject);
14155
+ if (identity) requestedIdentities.add(identity);
14156
+ }
14157
+ }
14158
+ if (requestedIdentities.size > 1) {
14159
+ return jsonReply(res, 409, { error: 'Legacy PR id is ambiguous; specify project' });
14160
+ }
14161
+ if (requestedIdentities.size === 0) {
14162
+ return jsonReply(res, 404, { error: 'PR not found' });
14163
+ }
14164
+ for (const pr of storedPrs) {
14165
+ const scope = pr?._scope || 'central';
14166
+ const ownerProject = scope !== 'central' ? projectByName.get(scope) || null : null;
14167
+ if (!requestedIdentities.has(shared.getPrIdentityKey(pr, ownerProject))) continue;
14168
+ if (!prScopes.has(scope)) {
14169
+ prScopes.set(scope, { prPath: store._filePathForScope(scope), project: ownerProject });
14170
+ }
14171
+ }
14136
14172
  let found = false;
14137
14173
  // Issue #803: tombstone EVERY scope that has a copy of this PR id, not
14138
14174
  // just the first one found. When enrollPrFromCanonicalId (issue #802)
@@ -14141,14 +14177,16 @@ What would you like to discuss or change? When you're happy, say "approve" and I
14141
14177
  // the other scope's copy fully untouched — queries.js#getPullRequests
14142
14178
  // then de-dupes by picking that untouched duplicate as the "winner"
14143
14179
  // and silently resurrects the "deleted" PR on the next read.
14144
- for (const prPath of prPaths) {
14180
+ for (const { prPath, project } of prScopes.values()) {
14145
14181
  // Issue #384: use a tombstone (userDeleted:true) instead of splice so
14146
14182
  // the next poller cycle cannot re-add the PR. The entry stays in the
14147
14183
  // file but is filtered from API responses and skipped by pollers.
14148
14184
  shared.mutatePullRequests(prPath, (prs) => {
14149
14185
  if (!Array.isArray(prs)) return prs;
14150
- const pr = prs.find(p => p.id === id);
14151
- if (pr) {
14186
+ const matches = prs.filter(pr =>
14187
+ requestedIdentities.has(shared.getPrIdentityKey(pr, project))
14188
+ );
14189
+ for (const pr of matches) {
14152
14190
  pr.userDeleted = true;
14153
14191
  pr.userDeletedAt = shared.ts();
14154
14192
  found = true;
@@ -15156,13 +15194,17 @@ if (require.main === module) {
15156
15194
  // engine reads, port binding) is captured rather than dying silently.
15157
15195
  _installCrashHandlers();
15158
15196
 
15159
- // Every copilot the dashboard spawns Command Center, doc-chat, and the CC
15160
- // worker pool (`copilot --acp`) inherits this process's COPILOT_HOME. Point
15161
- // it at the seeded, MCP-filtered home so those `direct:true` copilot calls
15162
- // load the filtered config instead of the operator's full `~/.copilot` stack
15163
- // (which would pop a Microsoft auth window per call). Mirrors the engine's
15164
- // boot-time set. See shared.ensureAgentCopilotHome. Fail-open.
15165
- try { process.env.COPILOT_HOME = shared.ensureAgentCopilotHome(MINIONS_DIR, CONFIG?.engine); } catch {}
15197
+ // Deliberately do NOT set process.env.COPILOT_HOME here. Command Center,
15198
+ // doc-chat, and the CC worker pool (`copilot --acp`) all spawn `copilot`
15199
+ // as this process's children, so they should inherit the operator's real
15200
+ // `~/.copilot` home (including their model preference in settings.json)
15201
+ // exactly like an interactive `copilot` CLI session would that's the
15202
+ // documented CLI contract. An earlier revision forced these onto an
15203
+ // isolated, MCP-filtered home to dodge MCP-server auth popups, but that
15204
+ // broke CC's settings inheritance and reintroduced a staleness/reseed bug;
15205
+ // reverted (W-mre75l6x00024f49). Per-dispatch agent isolation is unaffected
15206
+ // — the engine process still seeds its own COPILOT_HOME at boot and
15207
+ // re-stamps it per spawn via `_applyAgentCopilotHome` (engine.js).
15166
15208
 
15167
15209
  // Kick off first npm check on startup, then re-check every 4 hours.
15168
15210
  // Guarded here so that requiring dashboard as a module (unit tests, _withDashServer)
package/docs/README.md CHANGED
@@ -7,14 +7,28 @@ A navigable index of every Markdown file under `docs/`. Entries are grouped by a
7
7
  Hands-on stories and distribution guides for people running or evaluating Minions.
8
8
 
9
9
  - [blog-first-successful-dispatch.md](blog-first-successful-dispatch.md) — Narrative walkthrough of the first end-to-end agent dispatch and the seven failed spawn attempts that preceded it.
10
- - [distribution.md](distribution.md) — How Minions is published (this repo: `@opg-microsoft/minions` to GitHub Packages; paired peer `yemi33/minions` to npm) and the bidirectional sync contract — automated opg → yemi33 backport workflow + manual yemi33 → opg sync PRs.
10
+ - [documentation-audit-2026-07-09.md](documentation-audit-2026-07-09.md) — Verified user-facing documentation audit covering runtime, CLI, storage, routing, and broken-link corrections.
11
+ - [distribution.md](distribution.md) — How Minions is published (this repo: `@opg-microsoft/minions` to GitHub Packages; paired peer `@yemi33/minions` to npm) and the bidirectional sync contract — automated opg → yemi33 backport workflow + manual yemi33 → opg sync PRs.
12
+ - [onboarding.md](onboarding.md) — Condensed first-30-minutes walkthrough for a new operator.
13
+ - [tutorials/README.md](tutorials/README.md) — Progressive tutorial track from installation through advanced automation and operations.
14
+
15
+ ### Tutorial track
16
+
17
+ - [tutorials/01-install-and-connect.md](tutorials/01-install-and-connect.md) — Install Minions, verify a runtime, link a project, and start the dashboard.
18
+ - [tutorials/02-first-task.md](tutorials/02-first-task.md) — Dispatch and inspect a bounded first task.
19
+ - [tutorials/03-plan-driven-feature.md](tutorials/03-plan-driven-feature.md) — Review, approve, execute, and verify a dependency-aware plan.
20
+ - [tutorials/04-runtimes-and-harness.md](tutorials/04-runtimes-and-harness.md) — Select runtimes and verify project skill, command, and MCP propagation.
21
+ - [tutorials/05-schedules-and-watches.md](tutorials/05-schedules-and-watches.md) — Combine time-based schedules with state-based watches.
22
+ - [tutorials/06-managed-services.md](tutorials/06-managed-services.md) — Leave an engine-owned development service running with health checks.
23
+ - [tutorials/07-cross-repo-plan.md](tutorials/07-cross-repo-plan.md) — Coordinate one plan across multiple linked repositories.
24
+ - [tutorials/08-operations-and-recovery.md](tutorials/08-operations-and-recovery.md) — Diagnose pending, failed, orphaned, and stopped work safely.
11
25
 
12
26
  ## Contributor-facing
13
27
 
14
28
  Architecture, design proposals, and lifecycle references for people working on the engine, dashboard, or playbooks.
15
29
 
16
30
  - [branch-derivation.md](branch-derivation.md) — Engine-side branch fallback (`work/<wi-id>`) vs. agent-authored long form, the structured-vs-loose PR-pointer extractors, and the canonical PR-fix duplication incident.
17
- - [command-center.md](command-center.md) — Command Center (CC) chat panel: persistent Sonnet sessions, `--resume` semantics, system-prompt invalidation, and per-tab session storage.
31
+ - [command-center.md](command-center.md) — Command Center (CC) chat panel: configured-runtime sessions, resume semantics, system-prompt invalidation, and per-tab session storage.
18
32
  - [specs/agent-rename.md](specs/agent-rename.md) — Design spec for **agent rename & name decoupling** — the prerequisite for the Role/Agent Library. Formalizes the stable opaque agent id, makes charters name-agnostic, and adds `POST /api/agents/rename` (display name + emoji). Feature-flagged (`agent-rename`) and fully backward-compatible.
19
33
  - [specs/agent-configurability.md](specs/agent-configurability.md) — Design spec for the user-configurable Role / Agent Library, feature-flagged behind `agent-library` and fully backward-compatible. Builds on `agent-rename.md`. Role = the reusable durable charter; agent = a thin instance (identity + variable expertise + role pointer). Phase 0 renames `skills`→`expertise`; Phase 1 exposes/edits role charters + per-agent expertise; Phase 2 adds role/agent CRUD with builtin delete-protection.
20
34
  - [completion-reports.md](completion-reports.md) — Canonical schema for the per-spawn completion JSON: trust nonce, `failure_class` enum, `noop` semantics, `retryable` / `needs_rerun` shape, and the artifacts array.
@@ -26,7 +40,7 @@ Architecture, design proposals, and lifecycle references for people working on t
26
40
  - [cross-repo-plans.md](cross-repo-plans.md) — Cross-repo plans: a single plan whose work items ship into two or more configured projects — per-item `project` field, per-project work-item fan-out, and one verify work item per touched repo.
27
41
  - [dead-code-audit-retractions.md](dead-code-audit-retractions.md) — Retracted dead-code-audit findings (false positives) that future audits MUST read before re-citing.
28
42
  - [deprecated-process.md](deprecated-process.md) — Schema for `docs/deprecated.json` and the weekly `cleanup-deprecated` audit walk that retires entries past their removal signal.
29
- - [design-state-storage.md](design-state-storage.md) — Design proposal evaluating five database options for replacing Minions' file-based JSON state; recommends `node:sqlite` as the medium-term target (accepted; implementation tracked in CHANGELOG.md Phases 0–9).
43
+ - [design-state-storage.md](design-state-storage.md) — Design proposal evaluating five database options for replacing Minions' file-based JSON state; recommends `node:sqlite` (accepted; implementation tracked in CHANGELOG.md Phases 0–10).
30
44
  - [harness-mode.md](harness-mode.md) — Tri-Agent Harness Mode (`harness_mode: "tri_agent"` on scheduled tasks): Planner → Generator → Evaluator loop that iterates a shared on-disk artifact until a rubric passes or the iteration cap fires.
31
45
  - [harness-propagation.md](harness-propagation.md) — How user-level and project-local harness assets (skills, slash-commands, MCP config, `CLAUDE.md` / `AGENTS.md`) propagate into an agent's worktree via `--add-dir`, the `harnessPropagateProjectLocal` flag, and the project-local-on-main worktree-visibility footgun.
32
46
  - [harness-transparency.md](harness-transparency.md) — The `harnessUsed` self-report contract: capture (agent reports the skills / MCPs / commands / docs it used) → ground (engine cross-checks against `_harnessPropagated` and annotates `grounded:true\|false`, never dropping) → surface (PR comment, final agent note, work-item modal).
@@ -54,7 +68,7 @@ Architecture, design proposals, and lifecycle references for people working on t
54
68
  - [slim-ux/architecture-suggestions.md](slim-ux/architecture-suggestions.md) — Slim-UX follow-up architecture suggestions paired with `concepts.md`.
55
69
  - [team-memory.md](team-memory.md) — Per-agent memory layer (`knowledge/agents/<id>.md`) and the consolidation/routing rules that populate it from `notes/inbox/`.
56
70
  - [timeouts-and-liveness.md](timeouts-and-liveness.md) — What kills (or doesn't kill) a live tracked agent: the wall-clock vs steering kill invariants, spawn-phase watchdog gates, steering safety nets, and stale-orphan detection ladder.
57
- - [watches.md](watches.md) — Persistent monitoring jobs (`engine/watches.json`): target-type registry, conditions, follow-up actions, and the `watches.d/` plugin folder.
71
+ - [watches.md](watches.md) — Persistent monitoring jobs: target-type registry, conditions, follow-up actions, and the `watches.d/` plugin folder.
58
72
  - [workspace-manifests.md](workspace-manifests.md) — Declarative per-agent permission scoping: `allowed_tools` / `allowed_repos` / `allowed_external_urls` / `memory_scope`, dispatch-time repo gate, and runtime `--allowedTools` narrowing.
59
73
  - [worktree-lifecycle.md](worktree-lifecycle.md) — Worktree pool recycling, the live-dispatch guard that prevents wiping an agent's unpushed work, the dirty/divergent quarantine path, and the Windows EPERM/EBUSY file-lock retry footgun.
60
74
 
@@ -62,15 +76,13 @@ Architecture, design proposals, and lifecycle references for people working on t
62
76
 
63
77
  Operational runbooks for engine operators and fleet maintainers.
64
78
 
65
- - [notes.md](notes.md) — Consolidated team knowledge: patterns, conventions, bugs, and build findings accumulated from agent inbox notes. Read by the engine and injected into agent prompts as shared context.
66
79
  - [auto-discovery.md](auto-discovery.md) — Auto-discovery and execution pipeline: the per-tick orchestration loop and the four work-discovery sources.
67
80
  - [diagnostics-memory.md](diagnostics-memory.md) — Operator runbook for the in-process memory + perf observability surface: `/api/diagnostics/memory[/history]`, `/api/diagnostics/heap-snapshot` guard-token capture, `MEMORY_BASELINE` log emissions, `--cpu-prof`/`--heap-prof` capture, and the `test/perf/soak.test.js` heap-growth regression gate.
68
81
  - [diagnostics-crash-reports.md](diagnostics-crash-reports.md) — Proactive Node crash-diagnostics reports (`--report-on-fatalerror --report-on-signal --diagnostic-dir=...`) for the engine.js process on Windows: where reports land, config/opt-out, and retention.
69
82
  - [engine-restart.md](engine-restart.md) — How agents survive an engine restart: state persistence, the 20-minute startup grace period, and orphan reattachment via PID files and `live-output.log`.
70
83
  - [human-vs-automated.md](human-vs-automated.md) — Quick reference table of which features humans start, run, decide, and recover, and the two human approval gates.
71
84
  - [kb-sweep.md](kb-sweep.md) — Knowledge-base sweep runbook: how `engine/kb-sweep.js` consolidates `notes/inbox/` into `knowledge/` and survives `minions restart`.
72
- - [onboarding.md](onboarding.md) — First-30-minutes walkthrough for a new operator: install, init, dispatch a first work item, watch it land.
73
- - [preflight.md](preflight.md) — `minions doctor` and the lighter per-CLI `minions preflight` checks: what each non-self-explanatory row (permission bypass, runtime detection, drive-root, etc.) is asserting.
85
+ - [preflight.md](preflight.md) — `minions doctor` and the internal initialization/startup preflight: what each non-self-explanatory row (permission bypass, runtime detection, drive-root, etc.) is asserting.
74
86
  - [security.md](security.md) — Threat model: single-user/loopback deployment assumptions, dashboard Origin gate, data-flow trust boundaries, secret handling, and known residual risks (CSRF sweep, prompt injection, log-redactor audit).
75
87
 
76
88
  ---
@@ -1,8 +1,8 @@
1
1
  # Command Center
2
2
 
3
- The Command Center (CC) is the dashboard's conversational chat panel. It opens from the **CC** button in the top-right header and lets you drive the engine — dispatching work items, saving notes, approving plans, and asking questions about minions state — through a persistent Claude/Copilot session with full repo awareness.
3
+ The Command Center (CC) is the dashboard's conversational chat panel. It opens from the **CC** button in the top-right header and lets you drive the engine — dispatching work items, saving notes, approving plans, and asking questions about Minions state — through a persistent session on the configured CC runtime.
4
4
 
5
- CC is intentionally a thin wrapper around the runtime CLI: state changes happen via `Bash`-tool `curl` calls to the dashboard's own REST API, not via parsed delimiter blocks. The end-to-end flow is `dashboard/js/command-center.js` `_ccDoSend()` → `POST /api/command-center` (or `/api/command-center/stream`) in `dashboard.js` (`handleCommandCenter`) → `engine/llm.js` `callLLM({ direct: true })` → claude/copilot CLI session persisted in `engine/cc-sessions.json`. Per-turn API mutations are correlated via the `X-CC-Turn-Id` header and surfaced as standalone `role='action'` chips rendered outside the assistant bubble (`_ccActionResultLine` + `addMsg('action', ...)`).
5
+ CC is intentionally a thin wrapper around the runtime CLI: state changes happen via tool-driven calls to the dashboard's own REST API, not via parsed delimiter blocks. The end-to-end flow is `dashboard/js/command-center.js` `_ccDoSend()` → `POST /api/command-center` (or `/api/command-center/stream`) in `dashboard.js` (`handleCommandCenter`) → `engine/llm.js` `callLLM({ direct: true })` → runtime session persisted in `engine/state.db` (`cc_sessions`; `engine/cc-sessions.json` is a passive mirror). Per-turn API mutations are correlated via the `X-CC-Turn-Id` header and surfaced as standalone `role='action'` chips rendered outside the assistant bubble (`_ccActionResultLine` + `addMsg('action', ...)`).
6
6
 
7
7
  For canonical detail (system prompt, session lifecycle, turn-ID surfacing pipeline, doc-chat integration, and CC API contract), read [`CLAUDE.md`](../CLAUDE.md) — see the **CC API Contract** and **Sessions** sections — and the source in [`dashboard/js/command-center.js`](../dashboard/js/command-center.js), [`dashboard.js`](../dashboard.js) (`handleCommandCenter`), and [`prompts/cc-system.md`](../prompts/cc-system.md).
8
8
 
package/docs/constants.md CHANGED
@@ -6,7 +6,7 @@ All cross-cutting status / type / condition values are defined in [`engine/share
6
6
  WI_STATUS = { PENDING, DISPATCHED, DONE, FAILED, PAUSED, QUEUED, DECOMPOSED, CANCELLED }
7
7
  DONE_STATUSES = Set([WI_STATUS.DONE, 'in-pr', 'implemented', 'complete']) // legacy aliases on read only
8
8
  WORK_TYPE = { IMPLEMENT, IMPLEMENT_LARGE, FIX, REVIEW, VERIFY, PLAN, PLAN_TO_PRD,
9
- DECOMPOSE, MEETING, EXPLORE, ASK, TEST, DOCS, SETUP }
9
+ DECOMPOSE, MEETING, EXPLORE, ASK, TEST, DOCS, SETUP, BUILD_FIX_COMPLEX }
10
10
  PLAN_STATUS = { ACTIVE, AWAITING_APPROVAL, APPROVED, PAUSED, REJECTED, COMPLETED, REVISION_REQUESTED }
11
11
  PRD_ITEM_STATUS = { MISSING, UPDATED, DONE }; PRD_MATERIALIZABLE = Set([MISSING, UPDATED])
12
12
  PR_STATUS = { ACTIVE, MERGED, ABANDONED, CLOSED, LINKED }; PR_POLLABLE_STATUSES = Set([ACTIVE, LINKED])
@@ -0,0 +1,43 @@
1
+ # Documentation Audit: 2026-07-09
2
+
3
+ Scope: `README.md`, `CLAUDE.md`, `docs/**/*.md`, `playbooks/*.md`,
4
+ `agents/*/charter.md`, and `prompts/*.md`.
5
+
6
+ The audit prioritized user-facing claims that can cause an operator to install
7
+ the wrong runtime, use a nonexistent command, inspect a passive state mirror as
8
+ canonical data, or misunderstand routing and dashboard behavior.
9
+
10
+ ## Corrected findings
11
+
12
+ | Stale claim | Correction | Source of truth |
13
+ |---|---|---|
14
+ | Node.js 18+ was sufficient | Node.js 22.5+ is required for `node:sqlite` | `package.json:68` |
15
+ | Agent dispatch was described as Claude-only | Copilot is the default fleet runtime; Claude and Codex remain supported | `engine/shared.js:3520`, `engine/runtimes/index.js` |
16
+ | Root and per-project JSON trackers were described as primary state | Migrated runtime state is primary in `engine/state.db`; JSON trackers are passive mirrors | `engine/dispatch-store.js:49-68`, `CLAUDE.md` "State storage" |
17
+ | `minions preflight` was documented as a public command | `minions doctor` is public; lighter checks run internally during initialization and startup | `bin/minions.js:1207-1264`, `engine/cli.js:232-255` |
18
+ | Git repository host default was documented as ADO | The fallback host is GitHub | `engine/projects.js:504`, `engine/projects.js:564` |
19
+ | `WORK_TYPE` documentation omitted complex build fixes | Added `BUILD_FIX_COMPLEX` | `engine/shared.js:4370-4396`, `routing.md:10-28` |
20
+ | Command Center sessions were described as a JSON-file store | Sessions are stored in SQLite; the JSON file is a mirror | `engine/shared.js:1830`, `engine/db/migrations/011-remaining-state.js` |
21
+ | Watches were described as checking every three ticks and persisting to JSON | The default cadence is 18 ticks; persistence routes through the SQL watch store | `engine/shared.js` `watchPollEvery`, `engine/watches-store.js` |
22
+ | Two local documentation links targeted files that are not shipped | Removed the runtime `notes.md` link and the stale managed-spawn plan link | `docs/README.md`, `docs/managed-spawn.md` |
23
+
24
+ ## New tutorial coverage
25
+
26
+ The tutorial track under [`docs/tutorials/`](tutorials/README.md) now covers:
27
+
28
+ 1. installation and project linking;
29
+ 2. a first bounded dispatch;
30
+ 3. plan-to-PRD implementation and verification;
31
+ 4. runtime and harness configuration;
32
+ 5. schedules and watches;
33
+ 6. managed development services;
34
+ 7. cross-repository plans;
35
+ 8. operations and recovery.
36
+
37
+ ## Follow-up policy
38
+
39
+ Reference docs remain intentionally detailed. Tutorials should link to those
40
+ references rather than duplicate full schemas. Future sweeps should continue to
41
+ verify CLI examples against `bin/minions.js` and `engine/cli.js`, dashboard
42
+ routes against `dashboard.js`, work types against `routing.md`, and state
43
+ storage claims against the SQL store modules.
@@ -10,8 +10,8 @@ When the engine restarts, it loses its in-memory process handles (`activeProcess
10
10
 
11
11
  | State | Storage | Survives Restart |
12
12
  |-------|---------|-----------------|
13
- | Dispatch queue (pending/active/completed) | `engine/dispatch.json` | Yes |
14
- | Agent status (working/idle/error) | Derived from `engine/dispatch.json` | Yes |
13
+ | Dispatch queue (pending/active/completed) | `engine/state.db` (`dispatches`; `engine/dispatch.json` is a passive mirror) | Yes |
14
+ | Agent status (working/idle/error) | Derived from `engine/state.db` | Yes |
15
15
  | Agent live output | `agents/*/live-output.log` | Yes (mtime used for orphan cleanup) |
16
16
  | Process handles (`ChildProcess`) | In-memory Map | **No** |
17
17
  | Cooldown timestamps | In-memory Map | **No** (repopulated from `engine/cooldowns.json`) |
@@ -1,7 +1,7 @@
1
1
  # Managed-spawn primitive
2
2
 
3
3
  > Engine-owned long-running services with sidecar declaration, healthcheck-gated dispatch SUCCESS, and dashboard discovery.
4
- > Plan: [`plans/plan-w-mp7k1r760003b5dd-2026-05-15.md`](../plans/plan-w-mp7k1r760003b5dd-2026-05-15.md) · Module: [`engine/managed-spawn.js`](../engine/managed-spawn.js) · Dashboard panel: `/engine` → "Managed Processes".
4
+ > Module: [`engine/managed-spawn.js`](../engine/managed-spawn.js) · Dashboard panel: `/engine` → "Managed Processes".
5
5
 
6
6
  ## Why this exists
7
7
 
@@ -1,246 +1,124 @@
1
- # Minions Onboarding Your First 30 Minutes
1
+ # Minions Onboarding: Your First 30 Minutes
2
2
 
3
- A fast, hands-on walkthrough for new contributors. Follow the eight steps below in order. Each step is independent enough that you can stop, take a break, and resume without losing state.
3
+ This condensed operator walkthrough gets one repository from installation to a
4
+ completed first dispatch. For deeper, progressive exercises, use the
5
+ [full tutorial track](tutorials/README.md).
4
6
 
5
- > **Prerequisites:** Node.js 22.5+ (required by `package.json#engines` for the `node:sqlite` runtime backing the state DB), Git, and a working Claude Code CLI (`npm install -g @anthropic-ai/claude-code`) authenticated against your Anthropic API key or Claude Max subscription. See the top-level [README.md](../README.md#prerequisites) for the full list.
7
+ ## Prerequisites
6
8
 
7
- > **Screenshots:** This walkthrough is intentionally text-only on the first pass. If you want annotated dashboard screenshots, run the [`capture-demos`](../README.md#dashboard) skill after Step 5; it drives Playwright over the running dashboard and writes images you can drop alongside each section.
9
+ - Node.js 22.5 or newer
10
+ - Git
11
+ - One supported runtime CLI with working authentication
12
+ - A local Git repository you are comfortable allowing an agent to change
8
13
 
9
- ---
14
+ Minions defaults to GitHub Copilot CLI. Claude Code and Codex are also
15
+ supported.
10
16
 
11
- ## Step 1 Clone the repo
12
-
13
- You only need to clone if you intend to modify Minions itself. End users normally `npm install -g @yemi33/minions` instead, but a checkout is the right starting point for contributors.
14
-
15
- ```bash
16
- git clone https://github.com/yemi33/minions.git ~/minions-dev
17
- cd ~/minions-dev
18
- npm install # installs dev tooling (Playwright, ESLint) only; the engine itself has zero runtime deps (Node built-ins)
19
- ```
20
-
21
- You should now have:
22
-
23
- - `engine.js` — the orchestrator entry point
24
- - `dashboard.js` — the HTTP/UI server (binds `:7331`)
25
- - `minions.js` — the CLI shim that maps `minions <cmd>` to the right script
26
- - `playbooks/`, `agents/`, `prompts/`, `docs/` — content the engine renders into agent prompts
27
- - `test/` — `unit.test.js`, the integration suite, and Playwright specs
28
-
29
- If you cloned to somewhere other than `~/.minions`, the CLI will still work — `minions init` writes runtime state under `~/.minions/` regardless of where the source lives. The `node` scripts under your checkout will use the checkout as the runtime root when invoked directly (e.g. `node ./engine.js start`).
30
-
31
- ---
32
-
33
- ## Step 2 — Run `minions doctor`
34
-
35
- `minions doctor` runs the same preflight checks the engine runs at startup. It is safe to run any time and never mutates state.
17
+ ## 1. Install and initialize
36
18
 
37
19
  ```bash
20
+ npm install -g @yemi33/minions
21
+ minions init
38
22
  minions doctor
39
23
  ```
40
24
 
41
- A healthy Mac/Linux run looks roughly like:
25
+ Resolve every doctor `FAIL` before continuing. To select another runtime:
42
26
 
27
+ ```bash
28
+ minions config set-cli claude
29
+ # or: minions config set-cli codex
43
30
  ```
44
- Runtime:
45
-
46
- ✓ node: v20.11.1 (>= 18 required)
47
- ✓ git: git version 2.45.0
48
- ✓ claude CLI: 1.0.x found on PATH
49
-
50
- Authentication:
51
-
52
- ✓ ANTHROPIC_API_KEY: set
53
- ✓ gh auth: logged in as <you>
54
31
 
55
- Filesystem:
32
+ `minions init` creates `~/.minions/`. Primary migrated runtime state lives in
33
+ `engine/state.db` (SQLite, WAL mode). Files such as `engine/dispatch.json` and
34
+ `engine/metrics.json` are passive diagnostic mirrors; `engine/control.json`
35
+ remains a live JSON control file.
56
36
 
57
- ~/.minions writable
58
- ✓ engine/ writable
37
+ ## 2. Link a project
59
38
 
60
- All checks passed.
39
+ ```bash
40
+ minions add C:\code\sample-project
41
+ minions list
61
42
  ```
62
43
 
63
- What to look for:
64
-
65
- - `✓` (green) means OK. `!` is a warning the engine can usually work around. `✗` (critical) will block dispatch — fix it before continuing.
66
- - The most common failure is `claude CLI: not found` — re-install with `npm install -g @anthropic-ai/claude-code` and re-run.
67
- - On Windows, runtime resolution prefers native `claude.exe` over the POSIX bash shim; if you see runtime-resolution warnings, `gh auth status` and `where.exe claude` are good first stops.
68
-
69
- If `doctor` reports any `✗`, stop and resolve it. The remaining steps assume a clean preflight.
70
-
71
- ---
44
+ Use the corresponding local path on macOS or Linux. Confirm the detected
45
+ repository host, remote, main branch, and project description. Write the
46
+ description as a responsibility, such as "Billing API and webhook ingestion,"
47
+ because agents use it when routing project-agnostic work.
72
48
 
73
- ## Step 3 Bootstrap state with `minions init`
74
-
75
- `minions init` scaffolds `~/.minions/` with a default config, five agent charters, default playbooks, an empty knowledge base, and the engine state files.
49
+ ## 3. Start the engine and dashboard
76
50
 
77
51
  ```bash
78
- minions init
52
+ minions start --open
79
53
  ```
80
54
 
81
- After init you will have (under `~/.minions/`):
55
+ `start` is idempotent and starts both services. If the browser does not open:
82
56
 
83
- - `config.json` — projects, agents, schedules
84
- - `agents/<name>/charter.md` — the personality + boundaries for each of the five default agents (`ripley`, `dallas`, `lambert`, `rebecca`, `ralph`)
85
- - `engine/dispatch.json`, `engine/control.json`, `engine/metrics.json` — empty queues, ready for first dispatch
86
- - `pinned.md`, `notes.md` — empty team-memory surfaces
87
- - `playbooks/`, `prompts/`, `routing.md` — agent prompt scaffolding
57
+ ```bash
58
+ minions dash
59
+ ```
88
60
 
89
- `init` is safe to re-run; existing customizations to `config.json`, charters, notes, knowledge, and routing are preserved. To force overwrites after a major version bump, use `minions init --force`.
61
+ The dashboard normally binds to port 7331 and records the actual port if it has
62
+ to scan for a free one.
90
63
 
91
- ---
64
+ The main pages are **Home**, **Work**, **PRs**, **Plans**, **Inbox**, **Tools**,
65
+ **Schedule**, **Watches**, **Pipelines**, **Meetings**, **QA**, and **Engine**.
66
+ Settings are available from the application controls.
92
67
 
93
- ## Step 4 Link your first project with `minions add`
68
+ ## 4. Dispatch one bounded task
94
69
 
95
- A "project" tells Minions which repo to discover work for and where to spawn worktrees. The CLI auto-detects host (GitHub/ADO), org, repo name, and main branch from the directory's git remote.
70
+ Use a small task with an obvious result:
96
71
 
97
72
  ```bash
98
- minions add ~/code/your-repo
73
+ minions work "Add a Development section to README.md that names the existing test command"
74
+ minions dispatch
75
+ minions queue
99
76
  ```
100
77
 
101
- You will be prompted to confirm or override the auto-detected fields, plus a one-line description. The description is **important** agents read it during routing to decide whether a work item belongs to your repo. Keep it specific (e.g. "Internal billing API and webhook ingestion service") rather than generic ("Backend code").
78
+ For explicit project selection, create the item from **Work** or Command Center
79
+ and choose your project rather than Auto.
102
80
 
103
- After `minions add` returns, `~/.minions/config.json` has a new `projects[]` entry, and `~/.minions/projects/<name>/` holds the per-project `work-items.json` + `pull-requests.json` trackers.
81
+ Watch the assigned agent from **Home**, then open its **Live Output**. A
82
+ mutating dispatch receives an isolated worktree, the matching playbook, project
83
+ context, and the configured runtime.
104
84
 
105
- To link several at once interactively, run `minions scan` (default: scans `~` to depth 3 for git repos and lets you multi-select).
106
-
107
- ---
108
-
109
- ## Step 5 — Start engine + dashboard with `minions restart`
110
-
111
- `minions restart` starts (or restarts) both the engine daemon and the dashboard server. Use `restart` rather than `start` whenever you have edited engine code or playbooks — it ensures the daemon picks up your changes.
85
+ ## 5. Inspect completion
112
86
 
113
87
  ```bash
114
- minions restart
88
+ minions status
89
+ minions queue
115
90
  ```
116
91
 
117
- You should see logs like `Engine started (pid=…)` and `Dashboard listening on http://localhost:7331`. Open the dashboard:
92
+ Open the item on **Work** to inspect its output, branch, artifacts, and linked
93
+ pull request. If the item remains pending, read `_pendingReason`. If it fails,
94
+ inspect the failure class before retrying:
118
95
 
119
96
  ```bash
120
- minions dash # opens http://localhost:7331 in your default browser
97
+ minions wi show <work-item-id>
98
+ minions wi retry <work-item-id>
121
99
  ```
122
100
 
123
- A quick tour of the panels you will use most often during onboarding:
124
-
125
- | Panel | What it shows | When to use it |
126
- |---|---|---|
127
- | **Projects bar** (top) | All linked projects with descriptions | Confirm Step 4 worked |
128
- | **Minions Members** | Five agent cards with status, current task, last result | Watch dispatches happen in real time |
129
- | **Live Output** (per agent) | Streaming `live-output.log` | Tail an agent while it runs — refreshes every 3 s |
130
- | **Command Center** (CC button, top-right) | Conversational chat with Claude over your full Minions state | Ask questions, queue work, draft plans |
131
- | **Work Items** | Paginated table of all work, filterable by project/status | Inspect / retry / archive |
132
- | **Plans & PRD** | Plan markdown drafts and approved PRDs | Approve, discuss-and-revise, or reject plans |
133
- | **Pull Requests** | Cached PR status (build, review, merge) | Track the PRs your agents create |
134
- | **Engine** | Dispatch queue, engine log, LLM call performance | Diagnose timing / token issues |
135
-
136
- The engine ticks every 10 seconds. If the dashboard says "Engine: stopped", run `minions restart` again — the dashboard auto-restarts a dead engine on its next health check, but a manual restart is faster.
137
-
138
- ---
139
-
140
- ## Step 6 — Your first dispatch via the Command Center
101
+ Correct authentication, configuration, workspace-manifest, or checkout
102
+ failures before retrying.
141
103
 
142
- The fastest way to give Minions a task is the Command Center (CC).
104
+ ## 6. Try a plan
143
105
 
144
- 1. Click the **CC** button in the top-right of the dashboard.
145
- 2. In the slide-out chat, type a one-line description, e.g.:
146
- ```
147
- Add a brief comment to README.md explaining what minions doctor does
148
- ```
149
- 3. CC will propose an action (usually `POST /api/work-items` or `POST /api/plan`). Confirm.
106
+ In Command Center:
150
107
 
151
- Within one tick (≤10 s), the engine will:
152
-
153
- 1. Pick an idle agent that matches the work type (per `routing.md`).
154
- 2. Create a git worktree for that agent under `<your-repo>/.worktrees/<work-item-id>/`.
155
- 3. Render the appropriate playbook (`playbooks/implement.md` for an implement task) with your project context, charter, pinned notes, and recent team notes.
156
- 4. Spawn `engine/spawn-agent.js`, which invokes the Claude CLI with the rendered prompt.
157
-
158
- Watch the **Minions Members** card for that agent flip to "working", and click into the **Live Output** tab to tail the streaming agent log.
159
-
160
- You can do the same thing from the CLI: `minions work "Add a brief comment to README.md…"`.
161
-
162
- ---
163
-
164
- ## Step 7 — Your first plan via `/plan`
165
-
166
- For multi-step work, use a plan instead of a one-shot work item. In the Command Center, type:
167
-
168
- ```
169
- /plan Audit our README and propose three concrete improvements with examples
108
+ ```text
109
+ /plan Add a health endpoint, tests, and operator documentation to SampleProject.
110
+ Keep the changes as separately testable items with explicit dependencies.
170
111
  ```
171
112
 
172
- CC will queue a `plan` work item. The plan agent writes a markdown draft to `~/.minions/plans/<project>-<date>.md`, then chains automatically to a `plan-to-prd` agent that produces a structured PRD JSON in `~/.minions/prd/`. The PRD lands with `status: "awaiting-approval"`.
173
-
174
- Open **Plans & PRD** in the dashboard. You will see the new plan with three buttons:
175
-
176
- - **Approve** — materializes one work item per PRD entry, with `depends_on` honored.
177
- - **Discuss & Revise** — opens a doc-chat modal where you can iterate on the plan with Claude.
178
- - **Reject** — closes the plan with a reason.
179
-
180
- After approving, agents start picking up the materialized work items on the next tick. When all PRD items complete, the engine auto-dispatches a `verify` task that builds + tests the changes and writes a manual testing guide. Archiving (after verify) is a manual dashboard action — see [docs/plan-lifecycle.md](plan-lifecycle.md) for the full pipeline.
181
-
182
- ---
183
-
184
- ## Step 8 — Your first PR review
185
-
186
- When an `implement` agent finishes a work item, it pushes a branch and opens a PR. The engine polls PR status every `prPollStatusEvery` ticks (≈12 minutes by default) and dispatches a `review` agent automatically.
187
-
188
- To watch the cycle end-to-end on your first task:
189
-
190
- 1. Open **Pull Requests** in the dashboard. Find the PR your agent just opened.
191
- 2. Wait for the next status poll (or run `minions dispatch` to wake the daemon immediately). The PR's `reviewStatus` will flip from `pending` to `waiting`, then a review agent will spawn.
192
- 3. Click the agent card to watch the live review. The reviewer reads the diff, runs targeted checks, then posts a comment that starts with `VERDICT: APPROVE` or `VERDICT: REQUEST_CHANGES`.
193
- 4. If the verdict is `REQUEST_CHANGES`, the engine queues a `fix` task for the original author with a feedback note. The cycle repeats until approved or capped by the eval-loop config.
194
-
195
- You can also trigger reviews manually by commenting on the PR — see [docs/pr-review-fix-loop.md](pr-review-fix-loop.md).
196
-
197
- > **Note on self-approval:** Minions agents share a single GitHub identity, so `gh pr review --approve` is blocked by GitHub's self-approval rule. Reviewers post a `VERDICT:` **comment** instead, and the engine treats that comment as authoritative.
198
-
199
- ---
200
-
201
- ## Debugging — Where to look when something goes wrong
202
-
203
- When an agent gets stuck, hangs, or produces unexpected output, these files are your first stops. They live under `~/.minions/` (or wherever your runtime root is).
204
-
205
- | File | What it tells you |
206
- |---|---|
207
- | `agents/<id>/live-output.log` | Real-time streaming output from the agent's Claude CLI session — same content the dashboard's Live Output tab shows. Tail this with `tail -f ~/.minions/agents/<id>/live-output.log`. |
208
- | `agents/<id>/last-prompt.txt` | The most recent rendered prompt the agent received (playbook + system prompt + injected context). Inspect this to see exactly what the agent was asked to do, including pinned notes, team notes, charter, and dispatch context. If your install does not surface this file yet, the live equivalents are `engine/tmp/prompt-<dispatch-id>.md` (while the agent is running) and `engine/contexts/<dispatch-id>.md` (when the prompt was sidecarred because it exceeded `maxDispatchPromptBytes`). |
209
- | `agents/<id>/output.log` | The agent's final output after completion (post-mortem read; `live-output.log` is the during-run read). |
210
- | `agents/<id>/history.md` | Last 20 tasks for that agent with timestamps, results, projects, and branches. Useful when a single agent is misbehaving over multiple tasks. |
211
- | `engine/log.json` | Audit trail of engine actions (last 2500 entries, rotated to 2000). Filter with `jq` for a specific agent or work item. |
212
- | `engine/dispatch.json` | Pending / active / completed dispatch queue. If an agent appears idle on the dashboard but the queue says `active`, the engine likely lost process tracking — try `minions restart`. |
213
- | `engine/metrics.json` | Per-agent token usage, runtime, error counts. Useful for spotting agents that are silently retrying. |
214
- | `notes/inbox/` | Raw findings agents drop after each task. Look here for the latest learnings before the consolidator merges them into `notes.md`. |
215
- | `pinned.md` and `notes.md` | Team memory that gets injected into every agent prompt. If an agent keeps making the same mistake, pin a correction here. |
216
-
217
- Other quick debugging knobs:
218
-
219
- - `minions status` — text snapshot of agents, projects, dispatch queue, and quality metrics.
220
- - `minions queue` — focused view of the dispatch queue (pending, active, completed).
221
- - `minions kill` — kills all active agents and resets their dispatches to `pending`. Use when an agent is wedged.
222
- - `minions cleanup` — manually run the temp-file / worktree / zombie sweep that normally runs every 10 ticks.
223
-
224
- For deeper dives: [docs/engine-restart.md](engine-restart.md), [docs/auto-discovery.md](auto-discovery.md), and [docs/self-improvement.md](self-improvement.md).
225
-
226
- ---
227
-
228
- ## What's next
229
-
230
- You have:
231
-
232
- - Linked a project, started the engine, opened the dashboard.
233
- - Dispatched a one-shot task via Command Center.
234
- - Authored a plan, approved it, and watched the PRD materialize into work items.
235
- - Watched an agent open and review a PR.
236
- - Located the files you need to debug a stuck agent.
237
-
238
- From here, sensible next reads are:
113
+ Review the generated PRD on **Plans**. Use **Discuss & Revise** until its
114
+ acceptance criteria and dependencies are concrete, then approve it. Approval
115
+ materializes work items. When all items complete, Minions creates a verification
116
+ item. Archiving remains a manual action after you review the final result.
239
117
 
240
- - [README.md](../README.md) the full feature catalog and CLI reference.
241
- - [CLAUDE.md](../CLAUDE.md) — engineering conventions, tick cycle, locking rules. Read this before editing engine code.
242
- - [docs/plan-lifecycle.md](plan-lifecycle.md) — plan → PRD → implement → verify → archive in detail.
243
- - [docs/command-center.md](command-center.md) — full CC capabilities, including doc-chat and plan steering.
244
- - [docs/pr-review-fix-loop.md](pr-review-fix-loop.md) — how the review/fix cycle is bounded and steered.
118
+ ## Where to go next
245
119
 
246
- Welcome to the team.
120
+ - [Tutorial 2: Ship Your First Task](tutorials/02-first-task.md)
121
+ - [Tutorial 3: Build a Feature from a Plan](tutorials/03-plan-driven-feature.md)
122
+ - [Tutorial 8: Operate and Recover Minions](tutorials/08-operations-and-recovery.md)
123
+ - [Plan Lifecycle](plan-lifecycle.md)
124
+ - [Command Center](command-center.md)
package/docs/preflight.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Preflight & Doctor
2
2
 
3
- `minions doctor` (and the lighter `minions preflight` that runs on every CLI
4
- invocation) inspects the local environment for the conditions Minions needs
5
- to dispatch agents reliably. Every row is one of: `OK`, `WARN`, `FAIL`.
3
+ `minions doctor` is the user-facing environment check. A lighter internal
4
+ preflight also runs during `minions init` and engine startup. Together they
5
+ inspect the conditions Minions needs to dispatch agents reliably. Every row is
6
+ one of: `OK`, `WARN`, `FAIL`.
6
7
 
7
8
  This page documents the rows that are not self-explanatory from their message.
8
9