@yemi33/minions 0.1.1883 → 0.1.1885

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/README.md CHANGED
@@ -6,6 +6,8 @@ Zero dependencies — uses only Node.js built-in modules.
6
6
 
7
7
  Inspired by and initially scaffolded from [Brady Gaster's Squad](https://bradygaster.github.io/squad/).
8
8
 
9
+ 📚 **Documentation:** see [docs/README.md](docs/README.md) for the full audience-grouped docs index.
10
+
9
11
  ## Prerequisites
10
12
 
11
13
  - **Node.js** 18+ (LTS recommended)
@@ -40,6 +42,41 @@ git clone https://github.com/yemi33/minions.git ~/.minions
40
42
  node ~/.minions/minions.js init
41
43
  ```
42
44
 
45
+ ## CLI Reference
46
+
47
+ | Command | Description |
48
+ |---------|-------------|
49
+ | `minions init` | Bootstrap `~/.minions/` with default agents and config |
50
+ | `minions update` | Update to latest version (npm update + apply) |
51
+ | `minions version` | Show installed vs package version |
52
+ | `minions doctor` | Check prerequisites and runtime health |
53
+ | `minions scan [dir] [depth]` | Scan for git repos and multi-select to add (default: ~, depth 3) |
54
+ | `minions add <dir>` | Link a single project (auto-detects settings from git, prompts to confirm) |
55
+ | `minions remove <dir-or-name> [--keep-data \| --purge --force]` | Unlink a project: cancels pending work items, drains dispatch + kills active agents, cleans worktrees, disables linked schedules, archives `projects/<name>/` to `projects/.archived/<name>-YYYYMMDD/`. Use `--keep-data` to leave the data dir in place, or `--purge --force` to delete it. |
56
+ | `minions list` | List all linked projects with descriptions |
57
+ | `minions restart` | Start engine and dashboard together (recommended after reboot) |
58
+ | `minions start` | Start engine daemon (ticks every 60s, auto-syncs MCP servers) |
59
+ | `minions stop` | Stop the engine |
60
+ | `minions status` | Show agents, projects, dispatch queue, quality metrics |
61
+ | `minions pause` / `resume` | Pause/resume dispatching |
62
+ | `minions dispatch` | Force a dispatch cycle |
63
+ | `minions discover` | Dry-run work discovery |
64
+ | `minions queue` | Show dispatch queue (pending, active, completed) |
65
+ | `minions sources` | Show work source status per project |
66
+ | `minions work <title> [opts]` | Add to central work queue |
67
+ | `minions spawn <agent> <prompt>` | Manually spawn an agent |
68
+ | `minions plan <file\|text> [proj]` | Run a plan |
69
+ | `minions kill` | Kill all active agents and reset their dispatches to pending |
70
+ | `minions complete <dispatch-id>` | Manually mark a dispatch as completed |
71
+ | `minions config set-cli <R> [--model M]` | Persist the default runtime/model without starting the engine |
72
+ | `minions mcp-sync` | Sync MCP servers from `~/.claude.json` |
73
+ | `minions cleanup` | Run cleanup manually (temp files, worktrees, zombies) |
74
+ | `minions dash` | Open dashboard (starts if not already running, port 7331) |
75
+ | `minions nuke --confirm` | Factory reset runtime state and reset config to defaults |
76
+ | `minions uninstall --confirm` | Remove Minions state and uninstall the npm package |
77
+
78
+ You can also run scripts directly: `node ~/.minions/engine.js start`, `node ~/.minions/dashboard.js`, etc.
79
+
43
80
  ## Upgrading
44
81
 
45
82
  ```bash
@@ -64,6 +101,8 @@ minions init --force
64
101
 
65
102
  ## Quick Start
66
103
 
104
+ > **New contributor?** Walk through [docs/onboarding.md](docs/onboarding.md) first — an 8-step, first-30-minutes guide from clone → doctor → init → add → dashboard tour → first dispatch → first plan → first PR review, with debugging pointers.
105
+
67
106
  ```bash
68
107
  # 1. Init + scan — finds all git repos on your machine, multi-select to add
69
108
  minions init
@@ -120,41 +159,6 @@ To give the minions its first task, open the dashboard Command Center and add a
120
159
  minions work "Explore the codebase and document the architecture"
121
160
  ```
122
161
 
123
- ## CLI Reference
124
-
125
- | Command | Description |
126
- |---------|-------------|
127
- | `minions init` | Bootstrap `~/.minions/` with default agents and config |
128
- | `minions update` | Update to latest version (npm update + apply) |
129
- | `minions version` | Show installed vs package version |
130
- | `minions doctor` | Check prerequisites and runtime health |
131
- | `minions scan [dir] [depth]` | Scan for git repos and multi-select to add (default: ~, depth 3) |
132
- | `minions add <dir>` | Link a single project (auto-detects settings from git, prompts to confirm) |
133
- | `minions remove <dir-or-name> [--keep-data \| --purge --force]` | Unlink a project: cancels pending work items, drains dispatch + kills active agents, cleans worktrees, disables linked schedules, archives `projects/<name>/` to `projects/.archived/<name>-YYYYMMDD/`. Use `--keep-data` to leave the data dir in place, or `--purge --force` to delete it. |
134
- | `minions list` | List all linked projects with descriptions |
135
- | `minions restart` | Start engine and dashboard together (recommended after reboot) |
136
- | `minions start` | Start engine daemon (ticks every 60s, auto-syncs MCP servers) |
137
- | `minions stop` | Stop the engine |
138
- | `minions status` | Show agents, projects, dispatch queue, quality metrics |
139
- | `minions pause` / `resume` | Pause/resume dispatching |
140
- | `minions dispatch` | Force a dispatch cycle |
141
- | `minions discover` | Dry-run work discovery |
142
- | `minions queue` | Show dispatch queue (pending, active, completed) |
143
- | `minions sources` | Show work source status per project |
144
- | `minions work <title> [opts]` | Add to central work queue |
145
- | `minions spawn <agent> <prompt>` | Manually spawn an agent |
146
- | `minions plan <file\|text> [proj]` | Run a plan |
147
- | `minions kill` | Kill all active agents and reset their dispatches to pending |
148
- | `minions complete <dispatch-id>` | Manually mark a dispatch as completed |
149
- | `minions config set-cli <R> [--model M]` | Persist the default runtime/model without starting the engine |
150
- | `minions mcp-sync` | Sync MCP servers from `~/.claude.json` |
151
- | `minions cleanup` | Run cleanup manually (temp files, worktrees, zombies) |
152
- | `minions dash` | Open dashboard (starts if not already running, port 7331) |
153
- | `minions nuke --confirm` | Factory reset runtime state and reset config to defaults |
154
- | `minions uninstall --confirm` | Remove Minions state and uninstall the npm package |
155
-
156
- You can also run scripts directly: `node ~/.minions/engine.js start`, `node ~/.minions/dashboard.js`, etc.
157
-
158
162
  ## Architecture
159
163
 
160
164
  ```
@@ -214,7 +218,7 @@ You can also run scripts directly: `node ~/.minions/engine.js start`, `node ~/.m
214
218
 
215
219
  - **Auto-discovers work** from plans (`plans/*.json`), pull requests, and work queues across all linked projects
216
220
  - **Plan pipeline** — `/plan` spawns a plan agent, chains to plan-to-prd, produces `plans/{project}-{date}.json` with `status: "awaiting-approval"`. Supports shared-branch and parallel strategies.
217
- - **Human approval gate** — plans require approval before materializing as work items. Dashboard provides Approve / Discuss & Revise / Reject. Discussion launches an interactive Claude Code session.
221
+ - **Human approval gate** — plans require approval before materializing as work items. Dashboard provides Approve / Discuss & Revise / Reject. Discussion launches an interactive Command Center session via the configured runtime CLI (`config.engine.ccCli`).
218
222
  - **Dispatches AI agents** (Claude CLI) with full project context, git worktrees, and MCP server access
219
223
  - **Routes intelligently** — fixes first, then reviews, then implementation, matched to agent strengths
220
224
  - **LLM-powered consolidation** — Claude Haiku summarizes notes (threshold: 5 files). Regex fallback. Source references required.
@@ -649,34 +653,43 @@ To move to a new machine: `npm install -g @yemi33/minions && minions init --forc
649
653
  minions.js <- Unified CLI entry point (npm package)
650
654
  minions.js <- Project management: init, add, remove, list
651
655
  engine.js <- Engine daemon + orchestrator
652
- engine/
653
- shared.js <- Shared utilities: IO, process spawning, config helpers
654
- queries.js <- Read-only state queries (used by engine + dashboard)
655
- cli.js <- CLI command handlers (start, stop, status, plan, etc.)
656
- lifecycle.js <- Post-completion hooks, plan chaining, PR sync, metrics
657
- consolidation.js <- Haiku-powered inbox consolidation, knowledge base
658
- ado.js <- ADO token management, PR polling, PR reconciliation
659
- llm.js <- callLLM() with session resume, trackEngineUsage()
660
- spawn-agent.js <- Agent spawn wrapper (resolves claude cli.js)
661
- preflight.js <- Prerequisite checks (Node, Git, Claude CLI, API key)
662
- scheduler.js <- Cron-style scheduled task discovery
663
- pipeline.js <- Multi-stage pipeline orchestration
664
- meeting.js <- Meeting creation, rounds, conclusion
665
- cleanup.js <- Worktree + temp file cleanup
666
- timeout.js <- Agent timeout and orphan detection
667
- cooldown.js <- Dispatch cooldown with exponential backoff
668
- github.js <- GitHub PR polling, comment polling, reconciliation
669
- routing.js <- Agent routing and temp agent management
670
- dispatch.js <- Dispatch queue mutations (add, complete, retry)
671
- ado-mcp-wrapper.js <- ADO MCP authentication wrapper
672
- check-status.js <- Quick status check without full engine load
673
- control.json <- running/paused/stopped (runtime, generated)
674
- dispatch.json <- pending/active/completed queue (runtime, generated)
675
- log.json <- Audit trail, capped at 2500 (runtime, generated)
676
- metrics.json <- Per-agent quality metrics (runtime, generated)
677
- cooldowns.json <- Dispatch cooldown tracking (runtime, generated)
678
- schedule-runs.json <- Last-run timestamps for scheduled tasks (runtime, generated)
679
- pipeline-runs.json <- Pipeline run history per pipeline (runtime, generated)
656
+ engine/ <- See CLAUDE.md "Key Modules" table for per-file roles
657
+ # Core orchestration
658
+ shared.js queries.js cli.js
659
+ lifecycle.js dispatch.js cooldown.js
660
+ timeout.js steering.js recovery.js
661
+ pre-dispatch-eval.js
662
+ # Discovery, routing, playbooks
663
+ routing.js playbook.js cleanup.js
664
+ # Knowledge / consolidation
665
+ consolidation.js kb-sweep.js
666
+ # LLM + runtime adapters
667
+ llm.js model-discovery.js spawn-agent.js
668
+ runtimes/ <- Per-runtime CLI adapters (claude, copilot, etc.)
669
+ # Lifecycle helpers
670
+ preflight.js restart-health.js scheduler.js
671
+ pipeline.js meeting.js
672
+ # Project + feature management
673
+ projects.js project-discovery.js features.js
674
+ watches.js watch-actions.js
675
+ # Repo-host integrations
676
+ github.js issues.js
677
+ ado.js ado-token.js ado-mcp-wrapper.js
678
+ ado-status.js check-status.js
679
+ # Notifications
680
+ teams.js teams-cards.js
681
+ # Runtime state (generated, gitignored)
682
+ control.json <- running/paused/stopped
683
+ dispatch.json <- pending/active/completed queue
684
+ log.json <- audit trail, capped at 2500
685
+ metrics.json <- per-agent quality + runtime metrics
686
+ cooldowns.json <- dispatch cooldown tracking
687
+ schedule-runs.json <- last-run timestamps for scheduled tasks
688
+ pipeline-runs.json <- pipeline run history per pipeline
689
+ watches.json <- persistent watch jobs
690
+ completions/ <- per-dispatch agent completion JSON reports
691
+ <runtime>-caps.json <- adapter capability cache (claude-caps.json, copilot-caps.json, …)
692
+ <runtime>-models.json <- adapter model catalog cache
680
693
  dashboard.js <- Web dashboard server
681
694
  dashboard/
682
695
  layout.html <- Page layout shell with sidebar navigation
@@ -730,6 +743,7 @@ To move to a new machine: `npm install -g @yemi33/minions && minions init --forc
730
743
  inbox/ <- Agent findings drop-box (generated)
731
744
  archive/ <- Processed inbox files (generated)
732
745
  docs/
746
+ README.md <- Docs index (grouped by audience)
733
747
  auto-discovery.md <- Auto-discovery pipeline docs
734
748
  self-improvement.md <- Self-improvement loop docs
735
749
  plan-lifecycle.md <- Full plan pipeline: plan → PRD → implement → verify
@@ -39,8 +39,7 @@
39
39
 
40
40
  ## How I Work
41
41
 
42
- - Read Ripley's exploration findings from `{{team_root}}/notes/inbox/ripley-findings-*.md`
43
- - Read Dallas's build summary from `{{team_root}}/notes/inbox/dallas-build-*.md`
42
+ - Read recent teammate findings under `{{team_root}}/notes/inbox/` — filenames follow the engine-injected "Write Learnings" contract in each agent's dispatch prompt, so defer to that contract rather than matching ad-hoc filename globs here
44
43
  - Cross-reference against all `docs/`, agent `CLAUDE.md` files, and prototype instructions
45
44
  - Be exhaustive on missing features — better to over-document than under-document
46
45
  - Output the JSON to `{{team_root}}/prd/<plan-slug>.json` (the engine's `materializePlansAsWorkItems()` reads from that directory)
@@ -22,7 +22,7 @@
22
22
  - Always read `CLAUDE.md` files (root + per-agent) before anything else
23
23
  - Map the repo structure: `agents/`, `modules/`, `.devtools/`, `docs/`, `eval/`
24
24
  - Look for prototype instructions in: `docs/`, `agents/*/CLAUDE.md`, `README.md`, inline comments
25
- - Document findings in `notes/inbox/ripley-findings-{timestamp}.md` (relative to squad team root)
25
+ - Document findings in the inbox file the dispatch prompt assigns under "Write Learnings" — that section is the single source of truth for the path and filename; do not re-derive it here
26
26
  - Never guess — if something is unclear, note it explicitly for human review
27
27
 
28
28
  ## Boundaries
package/docs/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Minions Documentation Index
2
+
3
+ A navigable index of every Markdown file under `docs/`. Entries are grouped by audience.
4
+
5
+ ## User-facing
6
+
7
+ Hands-on stories and distribution guides for people running or evaluating Minions.
8
+
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 as the `@yemi33/minions` npm package and what the two-repo (origin / personal) sync strips.
11
+
12
+ ## Contributor-facing
13
+
14
+ Architecture, design proposals, and lifecycle references for people working on the engine, dashboard, or playbooks.
15
+
16
+ - [command-center.md](command-center.md) — Command Center (CC) chat panel: persistent Sonnet sessions, `--resume` semantics, system-prompt invalidation, and per-tab session storage.
17
+ - [copilot-cli-schema.md](copilot-cli-schema.md) — Behavior and schema reference for the GitHub Copilot CLI adapter (capability flags, stdin vs `-p`, model discovery, effort levels).
18
+ - [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.
19
+ - [plan-lifecycle.md](plan-lifecycle.md) — Full plan pipeline from `/plan` through PRD materialization, dispatch with dependency gating, verify task, and human archive.
20
+ - [pr-review-fix-loop.md](pr-review-fix-loop.md) — How the engine moves a PR from creation through review, fix dispatch, and re-review, including stale-status guards.
21
+ - [rfc-completion-json.md](rfc-completion-json.md) — RFC for replacing stdout regex-scraping with a structured `completion.json` control-plane protocol.
22
+ - [self-improvement.md](self-improvement.md) — The six self-improvement mechanisms (learnings inbox, per-agent history, review feedback, quality metrics, etc.) that form Minions' continuous feedback loop.
23
+
24
+ ## Operations
25
+
26
+ Operational runbooks for engine operators, fleet maintainers, and Teams integrators.
27
+
28
+ - [auto-discovery.md](auto-discovery.md) — Auto-discovery and execution pipeline: the per-tick orchestration loop and the four work-discovery sources.
29
+ - [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`.
30
+ - [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.
31
+ - [teams-production.md](teams-production.md) — Three deployment options (Azure App Service, Container Apps, self-hosted VM) for migrating the Teams bot from a Dev Tunnel to a stable HTTPS endpoint.
32
+ - [teams-setup.md](teams-setup.md) — End-to-end guide for connecting Minions to Microsoft Teams via Azure Bot Framework and a Dev Tunnel.
33
+
34
+ ---
35
+
36
+ **Adding a new doc?** Drop the file in `docs/` and add a one-line entry above under the right audience group. Keep entries alphabetical within each group.
@@ -1,5 +1,7 @@
1
1
  # Distribution & Publishing
2
2
 
3
+ > **ARCHIVED 2026-05-12.** This document describes a defunct two-repo "personal vs. origin" architecture (`yemishin_microsoft/minions` → `yemi33/minions`) and a manual `/sync-to-personal` workflow that no longer exists. The current model is single-repo: `yemi33/minions` publishes itself to npm via `.github/workflows/publish.yml` on every push to `master`. The doc also incorrectly claims package contents are gated by a `files` field in `package.json` — they are actually gated by `.npmignore`. Kept for historical reference; do not follow these steps.
4
+
3
5
  Minions is distributed as an npm package (`@yemi33/minions`) from a sanitized copy of the main repo.
4
6
 
5
7
  ## Two-Repo Architecture
@@ -1,5 +1,7 @@
1
1
  # Auto-Discovery & Execution Pipeline
2
2
 
3
+ > Last verified: 2026-05-12 against `engine.js` `tickInner()` (lines 4439-4750).
4
+
3
5
  How the minions engine finds work and dispatches agents automatically.
4
6
 
5
7
  ## The Tick Loop
@@ -8,16 +10,27 @@ The engine runs a tick every 60 seconds (configurable via `config.json` → `eng
8
10
 
9
11
  ```
10
12
  tick()
11
- 1. checkTimeouts() Enforce runtime limits and stale-orphan cleanup
12
- 2. consolidateInbox() Merge learnings into notes.md (Haiku-powered)
13
- 2.5 runCleanup() Periodic cleanup (every 10 ticks ≈ 10min)
14
- 2.6 pollPrStatus() Poll ADO + GitHub for build, review, merge status (wall-clock cadence from prPollStatusEvery × tickInterval, default ≈ 12min)
15
- 2.7 pollPrHumanComments() Poll PR threads for human @minions comments (wall-clock cadence from prPollCommentsEvery × tickInterval, default ≈ 12min)
16
- 3. discoverWork() Scan ALL linked projects for new tasks
17
- 4. updateSnapshot() Write identity/now.md
18
- 5. dispatch Spawn agents for pending items (up to maxConcurrent)
13
+ 1. checkTimeouts() Enforce runtime limits and stale-orphan cleanup
14
+ 1a. checkSteering() Drain steering messages queued by the dashboard
15
+ 1b. checkIdleThreshold() Notify on excessive agent idleness
16
+ 1c. meetingTimeouts() Advance round-based meetings whose timer fired
17
+ 2. consolidateInbox() Merge learnings into notes.md (Haiku-powered)
18
+ 2.5 runCleanup() Periodic cleanup (every 10 ticks 10min)
19
+ 2.55 checkWatches() Persistent watch jobs (every 3 tick-equivalents)
20
+ 2.6 pollPrStatus() Poll ADO + GitHub for build, review, merge status (wall-clock cadence from prPollStatusEvery × tickInterval, default ≈ 12min)
21
+ processPendingRebases() Run any rebase work queued from the previous tick
22
+ syncPrdFromPrs() Backfill PRD item status from active PRs
23
+ checkPlanCompletion() Mark plans completed when all features done/in-pr
24
+ 2.7 pollPrHumanComments() Poll PR threads for human @minions comments (wall-clock cadence from prPollCommentsEvery × tickInterval, default ≈ 12min)
25
+ reconcilePrs() (ADO+GH) Reconciliation sweep (runs regardless of poll flags)
26
+ 2.9 stallRecovery() Auto-retry failed items blocking pending deps (every 20 ticks)
27
+ 3. discoverWork() Scan ALL linked projects for new tasks
28
+ 4. updateSnapshot() Write identity/now.md
29
+ 5. dispatch Spawn agents for pending items (up to maxConcurrent)
19
30
  ```
20
31
 
32
+ > When `control.state === 'stopping'`, only steps 1–1c run; discovery and dispatch are skipped while live agents drain.
33
+
21
34
  ## Work Discovery
22
35
 
23
36
  `discoverWork()` iterates every project in `config.projects[]` and runs four core discovery sources: pull requests, per-project work items, central work items, and pipeline/scheduled tasks. Results are prioritized: fixes > reviews > implements > work-items.
@@ -1,159 +1,7 @@
1
1
  # Command Center
2
2
 
3
- The Command Center (CC) is the minions's conversational AI brain. It powers the dashboard's chat panel, document editing modals, and plan steeringall through a single persistent Sonnet session with full minions 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 Claude/Copilot session with full repo awareness.
4
4
 
5
- ## Access
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', ...)`).
6
6
 
7
- Click the **CC** button in the top-right header of the dashboard. A slide-out chat drawer opens on the right side.
8
-
9
- ## Persistent Sessions
10
-
11
- CC maintains a true multi-turn session using Claude CLI's `--resume` flag. Unlike a typical stateless API call, each message resumes the same conversation — Claude retains full history including tool calls, intermediate reasoning, and file contents from prior turns.
12
-
13
- **Session lifecycle:**
14
- - **Created** on first message (or after the system prompt changes, or when you click **New Session**)
15
- - **Resumed** on subsequent messages via `--resume <sessionId>`
16
- - **Invalidated** only when the CC system prompt changes — detected by hashing `CC_STATIC_SYSTEM_PROMPT` into `_ccPromptHash` and comparing on each call. CC chat sessions do **not** auto-expire by TTL or turn count; `ENGINE_DEFAULTS.ccMaxTurns` (default 50) is a per-call tool-use cap inside the Claude CLI, not a session lifetime cap.
17
- - **Persisted** to `engine/cc-session.json` (legacy global session) and `engine/cc-sessions.json` (per-tab sessions) — both survive dashboard restarts and engine cleanup ticks
18
- - **Frontend messages** saved to `localStorage` — survive page refresh
19
- - **Removed** only when the user explicitly closes a tab via the **×** button on the tab strip — that fires `DELETE /api/cc-sessions/:id` to evict the persisted session
20
-
21
- Click **New Session** in the drawer header to start fresh; click the **×** on a tab to remove it permanently.
22
-
23
- ### Fresh State Each Turn
24
-
25
- The system prompt is baked into the session at creation (persona, rules, action format, tool access). Dynamic minions state is injected as a preamble in each user message, so CC always sees current data even in a resumed session.
26
-
27
- ```
28
- Turn 1: system prompt (static) + [Current Minions State] + user message
29
- Turn 2+: [Updated Minions State] + user message (system prompt already in session)
30
- ```
31
-
32
- ## What It Knows
33
-
34
- Full minions context is injected every turn:
35
-
36
- | Context | Details |
37
- |---------|---------|
38
- | Agents | Statuses, current tasks, full charters (expertise/roles) |
39
- | Routing | Who's preferred/fallback for each work type |
40
- | Config | Tick interval, max concurrent, timeouts, max turns |
41
- | Work items | Active, pending, failed across all projects with failure reasons |
42
- | Pull requests | Status, review status, build status, branch, URL |
43
- | Plans | Full `.md` plan contents + PRD JSON summaries + archived plans |
44
- | PRD items | All items with status, priority, dependencies |
45
- | Dispatch | Active agents + last 15 completions with result summaries |
46
- | Skills | All reusable agent workflows with triggers |
47
- | Knowledge base | Recent entries (architecture, conventions, build reports, reviews) |
48
- | Team notes | Recent consolidated notes |
49
-
50
- ## Tool Access
51
-
52
- CC can use tools to look beyond the pre-loaded context:
53
-
54
- - **Bash** — Run shell commands (git, build tools, scripts)
55
- - **Read** — Open any file (agent output logs, code, config, plans)
56
- - **Write** — Create or overwrite files
57
- - **Edit** — Make targeted edits to existing files
58
- - **Glob** — Find files by pattern (e.g., `agents/*/output.log`)
59
- - **Grep** — Search file contents (find functions, search agent outputs)
60
- - **WebFetch/WebSearch** — Look up external resources
61
-
62
- ## Unified Brain
63
-
64
- All LLM-powered features in the dashboard route through the same CC session:
65
-
66
- | Feature | Endpoint | How It Works |
67
- |---------|----------|-------------|
68
- | **CC chat panel** | `POST /api/command-center` | Direct CC interaction |
69
- | **Doc chat modal** | `POST /api/doc-chat` | Routes through CC via `ccDocCall()` |
70
- | **Doc steer** | `POST /api/steer-document` | Routes through CC via `ccDocCall()` |
71
- | **Plan revision** | `POST /api/plans/revise` | Routes through CC via `ccDocCall()` |
72
-
73
- This means:
74
- - A question in the doc chat modal shares context with the CC panel
75
- - CC remembers what you discussed in a document editing session
76
- - Doc modals can cross-reference other minions knowledge, PRs, work items
77
- - All turns accumulate in the same session
78
-
79
- ## Actions
80
-
81
- When you ask CC to *do* something, it includes structured action blocks in its response.
82
-
83
- | Action | What It Does | Example Prompt |
84
- |--------|-------------|----------------|
85
- | `dispatch` | Create a work item | "Have dallas fix the login bug" |
86
- | `note` | Save a decision/reminder | "Remember we need to migrate to v3" |
87
- | `plan` | Create an implementation plan | "Plan the GitHub integration feature" |
88
- | `cancel` | Stop a running agent | "Cancel whatever ripley is doing" |
89
- | `retry` | Retry failed work items | "Retry the three failed tasks" |
90
- | `pause-plan` | Pause a PRD | "Pause the officeagent PRD" |
91
- | `approve-plan` | Approve a PRD | "Approve the new plan" |
92
- | `edit-prd-item` | Edit a PRD item | "Change P003's priority to high" |
93
- | `remove-prd-item` | Remove a PRD item | "Remove P011 from the plan" |
94
- | `delete-work-item` | Delete a work item | "Delete work item W025" |
95
-
96
- For endpoints without a named action, CC may emit a local API fallback action with `endpoint`, `method`, and `params`. The server only invokes safe local `/api/...` paths, validates the requested method against the route index when available, sends GET params as query strings, and rejects streaming/recursive CC/doc-chat endpoints.
97
-
98
- ## Error Handling
99
-
100
- - **Frontend timeout**: 10-minute `AbortSignal` on the fetch — prevents infinite "thinking" spinner
101
- - **Backend timeout**: 5-minute kill timer on the claude process
102
- - **Resume failure**: If `--resume` fails (corrupted/deleted session), automatically retries with a fresh session
103
- - **Concurrency guard**: Only one CC call at a time — concurrent requests get a 429 "CC is busy" response
104
- - **Phase indicators**: Thinking indicator shows progressive phases ("Thinking..." → "Analyzing..." → "Timing out soon...")
105
-
106
- ## Architecture
107
-
108
- ```
109
- User message (CC panel, doc modal, or steer)
110
-
111
-
112
- POST /api/command-center (or /api/doc-chat, /api/steer-document)
113
-
114
- ├── Validate session (prompt-hash check — invalidate if `_ccPromptHash` drifted)
115
- ├── Build dynamic state preamble (buildCCStatePreamble)
116
- ├── callLLM() with sessionId (resume) or without (new)
117
- │ model: sonnet
118
- │ maxTurns: 25 (CC) or 10 (doc-plan) or 1 (doc-other)
119
- │ allowedTools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, WebSearch
120
- │ timeout: 600s (CC) or 300s (doc-plan) or 60s (doc-other)
121
-
122
-
123
- engine/llm.js callLLM({ direct: true }) (bypasses engine/spawn-agent.js — CC + doc-chat only)
124
-
125
- ├── Resolves claude CLI binary path from engine/claude-caps.json
126
- ├── If --resume: pass -p --resume <id> (no system prompt file)
127
- ├── If new: pass -p --system-prompt-file <file>
128
-
129
-
130
- claude CLI (persistent session on disk)
131
-
132
-
133
- Parse response
134
- ├── Extract sessionId from stream-json result
135
- ├── Extract ===ACTIONS=== block (CC)
136
- ├── Extract ---DOCUMENT--- block (doc chat/steer)
137
- ├── Update cc-session.json
138
-
139
-
140
- Frontend
141
- ├── Render chat message
142
- ├── Execute actions / apply doc edits
143
- ├── Save sessionId + messages to localStorage
144
- ```
145
-
146
- ## Key Files
147
-
148
- | File | Role |
149
- |------|------|
150
- | `engine/llm.js` | `callLLM()` / `callLLMStreaming()` — single LLM function with optional `sessionId` for resume; `direct: true` spawns claude CLI directly (used by CC + doc-chat) |
151
- | `engine/spawn-agent.js` | Agent dispatch wrapper — resolves claude CLI path and invokes it. **Not used by CC/doc-chat** (direct spawn path). |
152
- | `engine/shared.js` | `parseStreamJsonOutput()` extracts `sessionId` from result |
153
- | `engine/cc-session.json` | Persisted session state (sessionId, turnCount, timestamps) |
154
- | `dashboard.js` | CC endpoint, `buildCCStatePreamble()`, `ccDocCall()`, `parseCCActions()` |
155
- | `dashboard/js/` | Frontend: localStorage persistence, session indicator, New Session button |
156
-
157
- ## Command Bar
158
-
159
- The command bar at the top of the dashboard routes all input to the CC panel. Typing in the command bar opens the CC drawer and sends the message as a CC turn.
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). This pointer file exists so the docs index has an entry for "Command Center"; the implementation details are deliberately not duplicated here because they drift.