@yemi33/minions 0.1.2364 → 0.1.2365

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
@@ -15156,13 +15156,17 @@ if (require.main === module) {
15156
15156
  // engine reads, port binding) is captured rather than dying silently.
15157
15157
  _installCrashHandlers();
15158
15158
 
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 {}
15159
+ // Deliberately do NOT set process.env.COPILOT_HOME here. Command Center,
15160
+ // doc-chat, and the CC worker pool (`copilot --acp`) all spawn `copilot`
15161
+ // as this process's children, so they should inherit the operator's real
15162
+ // `~/.copilot` home (including their model preference in settings.json)
15163
+ // exactly like an interactive `copilot` CLI session would that's the
15164
+ // documented CLI contract. An earlier revision forced these onto an
15165
+ // isolated, MCP-filtered home to dodge MCP-server auth popups, but that
15166
+ // broke CC's settings inheritance and reintroduced a staleness/reseed bug;
15167
+ // reverted (W-mre75l6x00024f49). Per-dispatch agent isolation is unaffected
15168
+ // — the engine process still seeds its own COPILOT_HOME at boot and
15169
+ // re-stamps it per spawn via `_applyAgentCopilotHome` (engine.js).
15166
15170
 
15167
15171
  // Kick off first npm check on startup, then re-check every 4 hours.
15168
15172
  // 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
 
@@ -0,0 +1,87 @@
1
+ # Tutorial 1: Install and Connect a Project
2
+
3
+ You will install Minions, verify the default Copilot runtime, link one Git
4
+ repository, and start the engine and dashboard.
5
+
6
+ ## Prerequisites
7
+
8
+ - Node.js 22.5 or newer
9
+ - Git
10
+ - GitHub Copilot CLI, Claude Code, or Codex CLI with working authentication
11
+ - A local Git repository with an `origin` remote
12
+
13
+ Minions defaults to GitHub Copilot CLI. Install it if you have not selected a
14
+ different runtime:
15
+
16
+ ```bash
17
+ npm install -g @github/copilot
18
+ ```
19
+
20
+ ## 1. Install and initialize
21
+
22
+ ```bash
23
+ npm install -g @yemi33/minions
24
+ minions init
25
+ ```
26
+
27
+ Initialization creates the operator home at `~/.minions/`, including agent
28
+ charters, playbooks, routing, prompts, and the SQLite state database.
29
+
30
+ ## 2. Verify the host
31
+
32
+ ```bash
33
+ minions doctor
34
+ ```
35
+
36
+ Resolve every `FAIL` before dispatching. Warnings are non-blocking but should be
37
+ read: a permission-flag warning can mean that the selected CLI will stop for an
38
+ interactive prompt during a headless dispatch.
39
+
40
+ To choose another runtime:
41
+
42
+ ```bash
43
+ minions config set-cli claude
44
+ # or
45
+ minions config set-cli codex
46
+ ```
47
+
48
+ Run `minions doctor` again after switching.
49
+
50
+ ## 3. Link a repository
51
+
52
+ ```bash
53
+ minions add C:\code\sample-project
54
+ ```
55
+
56
+ On macOS or Linux, use the corresponding path such as
57
+ `~/code/sample-project`. Confirm the detected host, repository, main branch,
58
+ and description. The description helps agents route project-agnostic work, so
59
+ describe the repository's responsibility rather than its implementation
60
+ language.
61
+
62
+ Confirm the result:
63
+
64
+ ```bash
65
+ minions list
66
+ ```
67
+
68
+ ## 4. Start Minions
69
+
70
+ ```bash
71
+ minions start --open
72
+ ```
73
+
74
+ `start` is idempotent and starts both the engine and dashboard. If browser
75
+ launch is blocked, run `minions dash`.
76
+
77
+ ## Checkpoint
78
+
79
+ ```bash
80
+ minions status
81
+ ```
82
+
83
+ You should see the engine running, your project listed, and no failed
84
+ dispatches. In the dashboard, verify that the project appears in the project
85
+ picker and that the agent cards are idle.
86
+
87
+ Next: [ship your first task](02-first-task.md).
@@ -0,0 +1,73 @@
1
+ # Tutorial 2: Ship Your First Task
2
+
3
+ You will queue a small documentation change, observe routing and live output,
4
+ and inspect the resulting work item and pull request.
5
+
6
+ ## 1. Choose a bounded task
7
+
8
+ Start with a task that has one clear result and a cheap validation step:
9
+
10
+ ```bash
11
+ minions work "Add a short Development section to README.md that names the existing test command"
12
+ ```
13
+
14
+ For precise project selection, use the dashboard's **Work** page or Command
15
+ Center and select the linked project instead of Auto. A project-scoped task is
16
+ better than auto-routing while learning the lifecycle.
17
+
18
+ ## 2. Wake and inspect the queue
19
+
20
+ The engine checks for work on its normal tick. You can wake it immediately:
21
+
22
+ ```bash
23
+ minions dispatch
24
+ minions queue
25
+ ```
26
+
27
+ The item normally moves from `pending` to `dispatched`. If it remains pending,
28
+ open its detail view and read `_pendingReason`; common reasons are an unmet
29
+ dependency, no available agent, cooldown, or concurrency limits.
30
+
31
+ ## 3. Follow the agent
32
+
33
+ In the dashboard:
34
+
35
+ 1. Open **Home** and select the working agent.
36
+ 2. Watch **Live Output** for repository exploration, edits, and checks.
37
+ 3. Open **Work** and select the item to inspect its branch, output, and
38
+ artifacts.
39
+
40
+ The engine chooses an agent from `routing.md`, creates an isolated worktree for
41
+ mutating work, renders the work-type playbook, and invokes the configured
42
+ runtime adapter.
43
+
44
+ ## 4. Inspect the outcome
45
+
46
+ ```bash
47
+ minions status
48
+ minions queue
49
+ ```
50
+
51
+ A successful code-changing task should finish with a branch and pull request.
52
+ If the runtime reports success without the required artifact, the work item can
53
+ still be flagged for lifecycle follow-up.
54
+
55
+ If the item fails, read its failure class and output before retrying:
56
+
57
+ ```bash
58
+ minions wi show <work-item-id>
59
+ minions wi retry <work-item-id>
60
+ ```
61
+
62
+ Do not retry authentication, invalid configuration, or workspace-permission
63
+ failures without correcting the cause first.
64
+
65
+ ## Checkpoint
66
+
67
+ You have observed the full path:
68
+
69
+ ```text
70
+ work item -> routing -> worktree -> runtime -> checks -> branch/PR -> completion
71
+ ```
72
+
73
+ Next: [build a feature from a plan](03-plan-driven-feature.md).
@@ -0,0 +1,73 @@
1
+ # Tutorial 3: Build a Feature from a Plan
2
+
3
+ Use a plan when the outcome spans several independently verifiable changes.
4
+ You will create a plan, review its PRD, approve it, and follow dependency-aware
5
+ implementation through verification.
6
+
7
+ ## 1. Draft the request
8
+
9
+ Open Command Center and enter:
10
+
11
+ ```text
12
+ /plan Add a health endpoint to SampleProject, document it, and add automated
13
+ tests. Keep implementation, tests, and documentation as separate items with
14
+ explicit dependencies.
15
+ ```
16
+
17
+ The plan agent writes Markdown under `plans/`. The plan-to-PRD step then creates
18
+ structured items under `prd/` with acceptance criteria and `depends_on`
19
+ relationships.
20
+
21
+ You can also provide plan text from the CLI:
22
+
23
+ ```bash
24
+ minions plan "Add a health endpoint, tests, and operator documentation" SampleProject
25
+ ```
26
+
27
+ ## 2. Review before approval
28
+
29
+ Open **Plans** and inspect:
30
+
31
+ - every item has a concrete deliverable;
32
+ - acceptance criteria can be tested;
33
+ - dependencies use item IDs and are acyclic;
34
+ - each item names the correct project;
35
+ - rejected or out-of-scope ideas are explicit.
36
+
37
+ Use **Discuss & Revise** for corrections. Approval is the human gate that
38
+ materializes work items, so do not approve a vague PRD and expect routing to
39
+ repair it.
40
+
41
+ ## 3. Approve and observe dependency gating
42
+
43
+ Approve the plan, then inspect **Work**. Independent items can dispatch in
44
+ parallel. Dependent items stay pending until their prerequisites are done.
45
+
46
+ At spawn time, Minions resolves completed dependencies to their pull-request
47
+ branches and merges those branches into the dependent item's worktree. This
48
+ lets later items build on code that has not reached the main branch yet.
49
+
50
+ ## 4. Follow verification
51
+
52
+ When all implementation items finish, Minions creates a `verify` work item.
53
+ Verification builds and tests the combined result and must attach a pull
54
+ request when its contract requires one. A completed plan remains visible until
55
+ you archive it manually.
56
+
57
+ Archive only after reviewing the verify result:
58
+
59
+ ```bash
60
+ minions plans list
61
+ minions plans archive <plan-or-prd-id>
62
+ ```
63
+
64
+ Archived PRDs remain retained in place; the source plan Markdown moves to
65
+ `plans/archive/`.
66
+
67
+ ## Checkpoint
68
+
69
+ You should have an approved PRD, materialized work items, dependency-aware
70
+ branches, and a final verification result. See
71
+ [Plan Lifecycle](../plan-lifecycle.md) for status and archive details.
72
+
73
+ Next: [configure runtimes and project tools](04-runtimes-and-harness.md).
@@ -0,0 +1,77 @@
1
+ # Tutorial 4: Choose Runtimes and Propagate Project Tools
2
+
3
+ Minions can dispatch with Copilot CLI, Claude Code, or Codex. This tutorial
4
+ switches the fleet runtime, separates Command Center from agent settings, and
5
+ checks which skills, commands, and MCP configurations reach a worktree.
6
+
7
+ ## 1. Inspect the current fleet
8
+
9
+ ```bash
10
+ minions status
11
+ minions doctor --harness
12
+ ```
13
+
14
+ The harness report is read-only. It lists runtime asset directories, skill
15
+ roots, slash-command roots, and MCP configuration paths.
16
+
17
+ ## 2. Select a fleet runtime
18
+
19
+ ```bash
20
+ minions config set-cli copilot --model gpt-5.4
21
+ minions restart
22
+ ```
23
+
24
+ Use a model ID supported by your installed CLI. Omit `--model` to let the CLI
25
+ choose its default. To clear a persisted model while switching:
26
+
27
+ ```bash
28
+ minions restart --cli claude --model ""
29
+ ```
30
+
31
+ Fleet resolution is:
32
+
33
+ ```text
34
+ agent.cli -> engine.defaultCli -> copilot
35
+ agent.model -> engine.defaultModel -> runtime default
36
+ ```
37
+
38
+ Command Center has independent `engine.ccCli` and `engine.ccModel` overrides.
39
+ Changing CC does not silently switch dispatched agents.
40
+
41
+ ## 3. Add a project-local skill
42
+
43
+ In the linked repository's main checkout, create a committed skill under:
44
+
45
+ ```text
46
+ .claude/skills/<skill-name>/SKILL.md
47
+ ```
48
+
49
+ Describe when the skill applies and provide the exact existing project command
50
+ to run. Commit the skill if every worktree should receive it. Uncommitted
51
+ project-local assets can be propagated from the live checkout when
52
+ `engine.harnessPropagateProjectLocal` is enabled, but committed assets are more
53
+ reproducible.
54
+
55
+ ## 4. Verify propagation
56
+
57
+ ```bash
58
+ minions doctor --harness
59
+ ```
60
+
61
+ Dispatch a small task that clearly matches the skill. The completion report's
62
+ `harnessUsed` section distinguishes assets that were available from those the
63
+ agent reports actually using.
64
+
65
+ For a known-empty execution environment, enable `hermeticHarness` for an agent
66
+ or the fleet. This removes user asset directories and project harness
67
+ propagation; use it for reproducibility tests, not as an MCP process-launch
68
+ control.
69
+
70
+ ## Checkpoint
71
+
72
+ The selected runtime passes doctor, your project asset appears in the harness
73
+ survey, and a matching dispatch reports whether it used that asset.
74
+
75
+ Reference: [Runtime Adapters](../runtime-adapters.md),
76
+ [Harness Propagation](../harness-propagation.md), and
77
+ [Harness Transparency](../harness-transparency.md).
@@ -0,0 +1,71 @@
1
+ # Tutorial 5: Automate Recurring Work and Follow-Ups
2
+
3
+ Schedules create work at a time; watches react to state changes. You will create
4
+ one of each and verify them without waiting for the clock.
5
+
6
+ ## 1. Explore the live schemas
7
+
8
+ ```bash
9
+ minions schedule --help
10
+ minions watch --help
11
+ minions watch target-types
12
+ minions watch action-types
13
+ ```
14
+
15
+ Use the dashboard forms for your first records. They validate against the same
16
+ server-side schemas as the CLI JSON commands.
17
+
18
+ ## 2. Create a schedule
19
+
20
+ Open **Schedule**, create a disabled schedule named `weekly-doc-check`, select
21
+ your sample project, and use a task such as:
22
+
23
+ ```text
24
+ Review README.md for commands that no longer match the CLI. Correct only
25
+ verified stale claims and report the source lines used.
26
+ ```
27
+
28
+ Use the natural-language parser or cron builder to choose a weekly time. Save
29
+ the schedule disabled, then use **Run now** to test it.
30
+
31
+ From the CLI:
32
+
33
+ ```bash
34
+ minions schedule list
35
+ minions schedule run-now <schedule-id>
36
+ ```
37
+
38
+ Confirm that a work item appears before enabling the recurring schedule.
39
+
40
+ ## 3. Create a watch
41
+
42
+ Open **Watches** and create a watch for the test work item:
43
+
44
+ - target type: `work-item`
45
+ - target: the work-item ID
46
+ - condition: `completed`
47
+ - owner: `human`
48
+ - stop after: `0`
49
+
50
+ For an absolute condition such as `completed`, `stopAfter: 0` means fire once
51
+ and expire. For change conditions, zero means continue indefinitely.
52
+
53
+ Choose the default inbox notification first. Follow-up actions can dispatch
54
+ work, call a webhook, trigger a pipeline, run a skill, or invoke CC triage, but
55
+ they should be added only after the condition itself is proven.
56
+
57
+ ## 4. Observe the trigger
58
+
59
+ ```bash
60
+ minions watch list
61
+ minions watch show <watch-id>
62
+ ```
63
+
64
+ Watches are evaluated on their polling cadence, not every engine tick. After
65
+ the work item completes, confirm the watch records a trigger and an inbox note.
66
+
67
+ ## Checkpoint
68
+
69
+ You have tested time-based creation and condition-based reaction independently.
70
+ See [Watches](../watches.md) for predicates, plugins, templating, guards, and
71
+ action chains.
@@ -0,0 +1,85 @@
1
+ # Tutorial 6: Keep a Development Service Running
2
+
3
+ Use managed spawn when later agents need a dev server, emulator, or daemon to
4
+ survive the creating agent's exit. The engine owns the process, checks health,
5
+ and exposes it to later dispatches.
6
+
7
+ ## 1. Prove the service manually
8
+
9
+ In the worktree that will host the service:
10
+
11
+ 1. Install its existing dependencies.
12
+ 2. Run the real start command for at least five seconds.
13
+ 3. Probe the intended health endpoint and verify the expected status.
14
+ 4. Stop the test process.
15
+
16
+ Do not derive a managed-spawn spec from package names or guessed monorepo
17
+ filters. A command that exits immediately will not become reliable because the
18
+ engine starts it.
19
+
20
+ ## 2. Dispatch a managed-spawn work item
21
+
22
+ Create a project-scoped work item through the API so the opt-in metadata is
23
+ explicit. Save a temporary `managed-work-item.json`:
24
+
25
+ ```json
26
+ {
27
+ "title": "Start the sample development service",
28
+ "description": "Start the existing development service and leave it available for downstream validation.",
29
+ "project": "SampleProject",
30
+ "type": "implement",
31
+ "meta": {
32
+ "managed_spawn": true,
33
+ "managed_spawn_ttl_minutes": 120
34
+ }
35
+ }
36
+ ```
37
+
38
+ Submit it, then delete the temporary file:
39
+
40
+ ```bash
41
+ minions api POST /api/work-items --body-file managed-work-item.json
42
+ ```
43
+
44
+ The rendered playbook tells the agent where to write
45
+ `agents/<id>/managed-spawn.json` and includes the current executable allowlist
46
+ and schema. The declared `cwd` must be an absolute path that exists when the
47
+ agent exits; the agent should derive it from its current worktree.
48
+
49
+ ## 3. Require a healthcheck
50
+
51
+ For a web service, use an HTTP healthcheck:
52
+
53
+ ```json
54
+ {
55
+ "type": "http",
56
+ "url": "http://localhost:3000/health",
57
+ "expect_status": 200,
58
+ "interval_s": 1,
59
+ "timeout_s": 60
60
+ }
61
+ ```
62
+
63
+ For an emulator or non-HTTP daemon, use a command healthcheck that exits zero
64
+ and matches a stable readiness signal.
65
+
66
+ ## 4. Inspect and use the service
67
+
68
+ Open **Engine** and find **Managed Processes**, or query:
69
+
70
+ ```bash
71
+ minions api GET /api/managed-processes
72
+ ```
73
+
74
+ Confirm the process is healthy, its log path is populated, and its expiration
75
+ time is correct. Dispatch a second work item in the same project and verify
76
+ that the live managed-process context is included in its prompt.
77
+
78
+ Use `meta.keep_processes` instead when the agent itself must retain an ad-hoc
79
+ child with no health endpoint. Prefer managed spawn for named services.
80
+
81
+ ## Checkpoint
82
+
83
+ The service remains healthy after the creating agent exits and is visible to a
84
+ later dispatch. Read [Managed Spawn](../managed-spawn.md) for the full sidecar,
85
+ allowlist, restart, log-stream, and partial-failure contracts.
@@ -0,0 +1,56 @@
1
+ # Tutorial 7: Coordinate a Cross-Repository Change
2
+
3
+ Cross-repository plans keep one product outcome together while materializing
4
+ each item into the project that owns its code.
5
+
6
+ ## 1. Link and name both projects
7
+
8
+ ```bash
9
+ minions add C:\code\sample-api
10
+ minions add C:\code\sample-web
11
+ minions list
12
+ ```
13
+
14
+ Give each project a distinct responsibility in its description. Cross-repo
15
+ routing is much easier to review when `sample-api` and `sample-web` do not both
16
+ say only "application code."
17
+
18
+ ## 2. Request a cross-repo plan
19
+
20
+ In Command Center:
21
+
22
+ ```text
23
+ /plan Add an API capability in sample-api and consume it from sample-web.
24
+ Create separately testable items, assign every item to one project, and make
25
+ the web integration depend on the API contract item.
26
+ ```
27
+
28
+ The plan must declare both target projects, and every PRD item must have a valid
29
+ `project` value matching a configured project name.
30
+
31
+ ## 3. Review the dependency boundary
32
+
33
+ Before approval, confirm:
34
+
35
+ - shared contracts are explicit acceptance criteria;
36
+ - each item edits only one repository;
37
+ - cross-repo `depends_on` records sequencing intent;
38
+ - each repository has its own verification responsibility.
39
+
40
+ Cross-repo dependencies are advisory for merge coordination. They do not make
41
+ separate repositories share a Git history or automatically merge one repo's
42
+ branch into another.
43
+
44
+ ## 4. Approve and observe fan-out
45
+
46
+ Approval materializes items into each project's work-item store. Minions creates
47
+ one verify work item per touched project after implementation completes.
48
+ Inspect both project filters in **Work** and **Plans** rather than assuming the
49
+ central plan card shows every repository-specific detail.
50
+
51
+ ## Checkpoint
52
+
53
+ Both projects have correctly scoped work items and independent verification
54
+ results, while the source plan remains one reviewable artifact.
55
+
56
+ Reference: [Cross-Repo Plans](../cross-repo-plans.md).
@@ -0,0 +1,76 @@
1
+ # Tutorial 8: Operate and Recover Minions
2
+
3
+ This tutorial builds a repeatable triage order for engine, dispatch, runtime,
4
+ and worktree failures.
5
+
6
+ ## 1. Start with supported summaries
7
+
8
+ ```bash
9
+ minions status
10
+ minions queue
11
+ minions sources
12
+ ```
13
+
14
+ Use the dashboard **Engine** page for dispatch logs, metrics, managed processes,
15
+ and worktree state. Read JSON sidecars only as diagnostics; migrated runtime
16
+ state is canonical in `engine/state.db`.
17
+
18
+ ## 2. Classify before acting
19
+
20
+ For a pending item, inspect `_pendingReason`. For a failed item, inspect its
21
+ failure class and final output. Correct non-retryable causes such as
22
+ authentication, invalid manifests, bad managed-spawn schemas, or dirty live
23
+ checkouts before retrying.
24
+
25
+ ```bash
26
+ minions wi show <work-item-id>
27
+ minions wi retry <work-item-id>
28
+ ```
29
+
30
+ ## 3. Restart safely
31
+
32
+ `minions start` is idempotent. Use `minions restart` after changing engine
33
+ configuration or playbooks:
34
+
35
+ ```bash
36
+ minions restart
37
+ minions status
38
+ ```
39
+
40
+ Agents are independent child processes. A restart loses in-memory process
41
+ handles, so Minions uses persisted dispatch state, PID data, live-output
42
+ activity, and a restart grace period to recover or classify orphans. Do not
43
+ delete worktrees or dispatch rows to force recovery.
44
+
45
+ ## 4. Use targeted recovery commands
46
+
47
+ ```bash
48
+ minions dispatch # wake the daemon; does not run a second tick loop
49
+ minions cleanup # run the supported cleanup path
50
+ minions kill # kill active agents and reset dispatches to pending
51
+ ```
52
+
53
+ Use `kill` only when agents are genuinely wedged. Quiet output is not enough:
54
+ tracked agents are allowed to be silent during long builds and tests.
55
+
56
+ ## 5. Protect against process-level outages
57
+
58
+ For unattended installations, inspect and optionally install the external
59
+ watchdog:
60
+
61
+ ```bash
62
+ minions watchdog status
63
+ minions watchdog install --interval=5
64
+ ```
65
+
66
+ The watchdog complements the in-process supervisor by probing and recovering
67
+ the engine through the operating system scheduler.
68
+
69
+ ## Checkpoint
70
+
71
+ You can distinguish pending, failed, orphaned, and stopped states and can choose
72
+ the least destructive supported action for each.
73
+
74
+ References: [Engine Restart](../engine-restart.md),
75
+ [Timeouts and Liveness](../timeouts-and-liveness.md), and
76
+ [Worktree Lifecycle](../worktree-lifecycle.md).
@@ -0,0 +1,29 @@
1
+ # Minions Tutorial Track
2
+
3
+ These tutorials build on one another. Complete the first two before jumping to
4
+ an advanced topic. Each tutorial ends with an observable result rather than
5
+ only describing configuration.
6
+
7
+ | Tutorial | Outcome | Time |
8
+ |---|---|---:|
9
+ | [1. Install and connect a project](01-install-and-connect.md) | A healthy engine, dashboard, and linked repository | 15 min |
10
+ | [2. Ship your first task](02-first-task.md) | One scoped work item dispatched and tracked to completion | 15 min |
11
+ | [3. Build a feature from a plan](03-plan-driven-feature.md) | An approved PRD with dependency-aware implementation and verification | 25 min |
12
+ | [4. Choose runtimes and propagate project tools](04-runtimes-and-harness.md) | A configured fleet with verified skills, commands, and MCP visibility | 20 min |
13
+ | [5. Automate recurring work and follow-ups](05-schedules-and-watches.md) | A schedule and a condition-based watch | 25 min |
14
+ | [6. Keep a development service running](06-managed-services.md) | An engine-owned, health-checked development service | 25 min |
15
+ | [7. Coordinate a cross-repository change](07-cross-repo-plan.md) | One plan fanned out safely across multiple projects | 30 min |
16
+ | [8. Operate and recover Minions](08-operations-and-recovery.md) | A practical status, restart, retry, and diagnostics workflow | 20 min |
17
+
18
+ ## How to use the tutorials
19
+
20
+ - Use a disposable repository for the first task if you do not want an agent to
21
+ open a real pull request.
22
+ - Keep the dashboard open while following CLI steps. It is the easiest place to
23
+ see routing, pending reasons, live output, and artifacts together.
24
+ - Treat JSON files under `engine/` and `projects/` as diagnostic mirrors.
25
+ `engine/state.db` is the primary store for migrated runtime state.
26
+ - Use the linked reference docs when you need the full schema or lifecycle.
27
+ Tutorials intentionally focus on a successful path.
28
+
29
+ For a shorter setup-only path, use [the first-30-minutes guide](../onboarding.md).
package/docs/watches.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Watches
2
2
 
3
- Persistent monitoring jobs that fire inbox notifications and follow-up actions when a target hits a condition. Watches survive engine restarts and are checked every 3 ticks (~3 minutes by default).
3
+ Persistent monitoring jobs that fire inbox notifications and follow-up actions when a target hits a condition. Watches survive engine restarts and are checked every 18 ticks (~3 minutes at the default 10-second tick).
4
4
 
5
5
  ## What a Watch Is
6
6
 
7
- A watch is a small JSON record persisted to `engine/watches.json`. It binds:
7
+ A watch is a record persisted in `engine/state.db`; `engine/watches.json` is a passive diagnostic mirror. It binds:
8
8
 
9
9
  | Field | Purpose |
10
10
  |--------------|-------------------------------------------------------------------------|
@@ -20,7 +20,7 @@ A watch is a small JSON record persisted to `engine/watches.json`. It binds:
20
20
  | `requires` | Optional guard: array of predicate objects evaluated against `state` / `entity` / `prevState`; trigger is suppressed when any guard fails (false-or-error). Used to gate a watch on "PR is mergeable AND build passing" etc. |
21
21
  | `status` | `WATCH_STATUS.ACTIVE` \| `PAUSED` \| `TRIGGERED` \| `EXPIRED` |
22
22
 
23
- `createWatch()` allocates a `watch-<uid>` id, defaults the fields above, and persists atomically via `mutateJsonFileLocked` *(source: `engine/watches.js:184-248`)*.
23
+ `createWatch()` allocates a `watch-<uid>` id, defaults the fields above, and persists through the watch store *(source: `engine/watches.js` and `engine/watches-store.js`)*.
24
24
 
25
25
  ## Lifecycle (`WATCH_STATUS`)
26
26
 
@@ -94,7 +94,7 @@ The eight built-ins are registered at module load *(source: `engine/watches.js`
94
94
 
95
95
  | `targetType` | Target value | Conditions | Notes |
96
96
  |---------------|--------------------------------------|----------------------------------------------------------------------------|-------|
97
- | `pr` | PR number, canonical id, or display id | `merged`, `build-fail`, `build-pass`, `status-change`, `any`, `new-comments`, `vote-change`, `head-commit-change`, `mergeable-flipped`, `ready-for-merge`, `behind-master`, `draft-flipped` | Reads from `pull-requests.json` for any project; `new-comments` watches `humanFeedback.lastProcessedCommentDate`; `behind-master` requires `engine.watchesIncludeBehindBy: true` so the GH poller populates `pr.behindBy` |
97
+ | `pr` | PR number, canonical id, or display id | `merged`, `build-fail`, `build-pass`, `status-change`, `any`, `new-comments`, `vote-change`, `head-commit-change`, `mergeable-flipped`, `ready-for-merge`, `behind-master`, `draft-flipped` | Reads project PR state; `new-comments` watches `humanFeedback.lastProcessedCommentDate`; `behind-master` requires `engine.watchesIncludeBehindBy: true` so the GH poller populates `pr.behindBy` |
98
98
  | `work-item` | Work item id | `completed`, `failed`, `status-change`, `any`, `stalled`, `retry-limit-reached`, `dependency-met` | `completed` matches `DONE_STATUSES`; `failed` matches `WI_STATUS.FAILED`; `stalled` fires after N unchanged captures (default 12 ≈ 60 min); `retry-limit-reached` fires when `_retryCount >= ENGINE_DEFAULTS.maxRetries` |
99
99
  | `meeting` | Meeting id | `concluded`, `status-change`, `any` | `concluded` fires on terminal status (`completed`, `archived`) |
100
100
  | `plan` | PRD JSON filename or plan id | `approved`, `rejected`, `completed`, `status-change`, `any`, `all-items-done`, `item-failed-n-times` | Looked up by `_source` (PRD file), `_sourcePlan` (.md), or `id`; uses `PLAN_STATUS` |
@@ -145,7 +145,7 @@ Resolution is `path.join(shared.MINIONS_DIR, 'watches.d')` so it works in both d
145
145
  }
146
146
  ```
147
147
 
148
- `checkWatches` walks every active watch and, inside a single `mutateJsonFileLocked` callback *(source: `engine/watches.js:410-561`)*:
148
+ `checkWatches` walks every active watch and persists updates through the watch store:
149
149
 
150
150
  1. Skips paused/expired watches and any watch checked within its `interval`.
151
151
  2. Captures a baseline `_lastState` on first check (so change conditions have something to diff).
@@ -166,7 +166,7 @@ I/O happens **outside the lock**: notifications via `writeToInbox`, follow-up ac
166
166
  | Action type | What it does |
167
167
  |------------------------|-----------------------------------------------------------------------------------------------|
168
168
  | `notify` | Explicit inbox write; lets you customize `owner`/`body` instead of the default trigger string |
169
- | `dispatch-work-item` | Append a new WI to the project (or central) `work-items.json` with `createdBy: "watch:<id>"` |
169
+ | `dispatch-work-item` | Add a new project or central work item with `createdBy: "watch:<id>"` |
170
170
  | `run-skill` | Wrapper around `dispatch-work-item` that asks the agent to run a specific `.claude` skill |
171
171
  | `webhook` | `http`/`https` request to an arbitrary URL (10s safety timeout, JSON or string body) |
172
172
  | `minions-api` | Loopback call to the in-process dashboard at `http://127.0.0.1:${shared.readDashboardPortFile(MINIONS_DIR)?.port \|\| 7331}` (reads the bound-port beacon file, not the `MINIONS_PORT` env, so it still resolves after an `EADDRINUSE` port scan) — `endpoint` must start with `/api/`; sets `X-Minions-Internal: 1`; returns `{ok, status, summary, response}` for chain-step templating |
package/engine/shared.js CHANGED
@@ -6327,16 +6327,18 @@ function resolveAgentTempBaseDir(project, engine, minionsDir) {
6327
6327
 
6328
6328
  // Seed the agent COPILOT_HOME's mcp-config (copy of `~/.copilot/mcp-config.json`
6329
6329
  // MINUS `engine.copilotAgentDisabledMcpServers`) and return the home path. This
6330
- // is the single source of truth for "what MCP servers may a minions-spawned
6331
- // copilot load." It is applied to EVERY copilot spawn path — agent dispatches
6332
- // (engine), internal `llm.callLLM` calls (engine), and CC / doc-chat / the CC
6333
- // worker pool (dashboard) — by setting `process.env.COPILOT_HOME` at the boot of
6334
- // both processes, so every copilot CHILD inherits the filtered config. copilot
6335
- // SPAWNS every server in its config and authenticates it (`--disable-mcp-server`
6336
- // only hides tools), so any auth-requiring server pops a Microsoft window per
6337
- // spawn filtering the config is the only effective control. Idempotent: writes
6338
- // only when the content changes (safe under concurrent callers). The operator's
6339
- // real `~/.copilot` (interactive copilot) is never touched. Fail-open.
6330
+ // is the source of truth for "what MCP servers may an agent-dispatch copilot
6331
+ // load." It is applied to the engine-process copilot spawn paths ONLY — agent
6332
+ // dispatches (`_applyAgentCopilotHome`) and the engine process's own internal
6333
+ // `llm.callLLM` calls — by setting `process.env.COPILOT_HOME` at engine boot
6334
+ // and re-stamping it per dispatch, so those copilot CHILDREN inherit the
6335
+ // filtered config. copilot SPAWNS every server in its config and
6336
+ // authenticates it (`--disable-mcp-server` only hides tools), so any
6337
+ // auth-requiring server pops a Microsoft window per spawn filtering the
6338
+ // config is the only effective control. Idempotent: writes only when the
6339
+ // content changes (safe under concurrent callers). The operator's real
6340
+ // `~/.copilot` (interactive copilot, and now also Command Center / doc-chat /
6341
+ // the CC worker pool, per W-mre75l6x00024f49) is never touched. Fail-open.
6340
6342
  function ensureAgentCopilotHome(minionsDir, engine) {
6341
6343
  const home = resolveAgentCopilotHome(minionsDir);
6342
6344
  try {
package/engine.js CHANGED
@@ -11811,8 +11811,11 @@ if (require.main === module) {
11811
11811
  // `llm.callLLM` calls (consolidation, classification, meetings, …) — inherits
11812
11812
  // this process's COPILOT_HOME, so point it at the seeded, MCP-filtered home.
11813
11813
  // Without this, those `direct:true` copilot calls load the operator's full
11814
- // `~/.copilot` stack and pop a Microsoft auth window per call. The dashboard
11815
- // sets the same at its own boot for CC / doc-chat / the CC worker pool.
11814
+ // `~/.copilot` stack and pop a Microsoft auth window per call. This isolation
11815
+ // is engine-process-only: the dashboard process deliberately does NOT set
11816
+ // COPILOT_HOME at its own boot, so Command Center / doc-chat / the CC worker
11817
+ // pool inherit the operator's real `~/.copilot` home instead (reverted in
11818
+ // W-mre75l6x00024f49; see dashboard.js boot for rationale).
11816
11819
  // See shared.ensureAgentCopilotHome. Fail-open.
11817
11820
  try { process.env.COPILOT_HOME = shared.ensureAgentCopilotHome(MINIONS_DIR, getConfig()?.engine); } catch {}
11818
11821
  const { handleCommand } = require('./engine/cli');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2364",
3
+ "version": "0.1.2365",
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"