@yemi33/minions 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +819 -0
  2. package/LICENSE +21 -0
  3. package/README.md +598 -0
  4. package/agents/dallas/charter.md +56 -0
  5. package/agents/lambert/charter.md +67 -0
  6. package/agents/ralph/charter.md +45 -0
  7. package/agents/rebecca/charter.md +57 -0
  8. package/agents/ripley/charter.md +47 -0
  9. package/bin/minions.js +467 -0
  10. package/config.template.json +28 -0
  11. package/dashboard.html +4822 -0
  12. package/dashboard.js +2623 -0
  13. package/docs/auto-discovery.md +416 -0
  14. package/docs/blog-first-successful-dispatch.md +128 -0
  15. package/docs/command-center.md +156 -0
  16. package/docs/demo/01-dashboard-overview.gif +0 -0
  17. package/docs/demo/02-command-center.gif +0 -0
  18. package/docs/demo/03-work-items.gif +0 -0
  19. package/docs/demo/04-plan-docchat.gif +0 -0
  20. package/docs/demo/05-prd-progress.gif +0 -0
  21. package/docs/demo/06-inbox-metrics.gif +0 -0
  22. package/docs/deprecated.json +83 -0
  23. package/docs/distribution.md +96 -0
  24. package/docs/engine-restart.md +92 -0
  25. package/docs/human-vs-automated.md +108 -0
  26. package/docs/index.html +221 -0
  27. package/docs/plan-lifecycle.md +140 -0
  28. package/docs/self-improvement.md +344 -0
  29. package/engine/ado-mcp-wrapper.js +42 -0
  30. package/engine/ado.js +383 -0
  31. package/engine/check-status.js +23 -0
  32. package/engine/cli.js +754 -0
  33. package/engine/consolidation.js +417 -0
  34. package/engine/github.js +331 -0
  35. package/engine/lifecycle.js +1113 -0
  36. package/engine/llm.js +116 -0
  37. package/engine/queries.js +677 -0
  38. package/engine/shared.js +397 -0
  39. package/engine/spawn-agent.js +151 -0
  40. package/engine.js +3227 -0
  41. package/minions.js +556 -0
  42. package/package.json +48 -0
  43. package/playbooks/ask.md +49 -0
  44. package/playbooks/build-and-test.md +155 -0
  45. package/playbooks/explore.md +64 -0
  46. package/playbooks/fix.md +57 -0
  47. package/playbooks/implement-shared.md +68 -0
  48. package/playbooks/implement.md +95 -0
  49. package/playbooks/plan-to-prd.md +104 -0
  50. package/playbooks/plan.md +99 -0
  51. package/playbooks/review.md +68 -0
  52. package/playbooks/test.md +75 -0
  53. package/playbooks/verify.md +190 -0
  54. package/playbooks/work-item.md +74 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yemi33
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,598 @@
1
+ # Minions — Autonomous AI Development Team
2
+
3
+ A multi-project AI dev team that runs from `~/.minions/`. Five autonomous agents share a single engine, dashboard, knowledge base, and MCP toolchain — working across any number of linked repos with self-improving workflows.
4
+
5
+ Zero dependencies — uses only Node.js built-in modules.
6
+
7
+ Inspired by and initially scaffolded from [Brady Gaster's Minions](https://bradygaster.github.io/minions/).
8
+
9
+ ## Prerequisites
10
+
11
+ - **Node.js** 18+ (LTS recommended)
12
+ - **Claude Code CLI** — install with `npm install -g @anthropic-ai/claude-code`
13
+ - **Anthropic API key** or Claude Max subscription (agents spawn Claude Code sessions)
14
+ - **Git** — agents create worktrees for all code changes
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ # Install globally from npm
20
+ npm install -g @yemi33/minions
21
+
22
+ # Bootstrap ~/.minions/ with default config and agents
23
+ minions init
24
+
25
+ # Link your first project (interactive — auto-detects from git remote)
26
+ minions add ~/my-project
27
+ ```
28
+
29
+ Or try without installing:
30
+
31
+ ```bash
32
+ npx @yemi33/minions init
33
+ ```
34
+
35
+ No dependencies — Minions uses only Node.js built-in modules.
36
+
37
+ **Alternative: clone directly**
38
+ ```bash
39
+ git clone https://github.com/yemi33/minions.git ~/.minions
40
+ node ~/.minions/minions.js init
41
+ ```
42
+
43
+ ## Upgrading
44
+
45
+ ```bash
46
+ # Check if an update is available
47
+ minions version
48
+
49
+ # Update the npm package and apply changes
50
+ npm update -g @yemi33/minions
51
+ minions init --force
52
+ ```
53
+
54
+ **What gets updated:** Engine code (`.js`, `.html`), new playbooks, new agent charters, new docs, `CHANGELOG.md`.
55
+
56
+ **What's preserved:** Your `config.json`, agent history, notes, knowledge base, routing, skills, and any `.md` files you've customized (charters, playbooks). If a new playbook or charter is added in an update, it's installed automatically without touching your existing ones.
57
+
58
+ Upgrades now skip the interactive repo scan automatically. If you want to re-run discovery later, run `minions scan`. To skip scanning during the very first install, pass `--skip-scan` and link projects manually when ready.
59
+
60
+ **What's shown:** A summary of files updated, added, and preserved, plus a pointer to the changelog.
61
+
62
+ ### Migrating from legacy `squad`
63
+
64
+ If you previously used `squad`, run:
65
+
66
+ ```bash
67
+ minions init --force
68
+ ```
69
+
70
+ `minions` will auto-detect legacy installs (`~/.squad`, `.squad-root`, and `SQUAD_HOME`), migrate state into `~/.minions`, rename legacy runtime markers (`.squad-version` → `.minions-version`), and record the action in `~/.minions/migration.log`.
71
+
72
+ ## Quick Start
73
+
74
+ ```bash
75
+ # 1. Init + scan — finds all git repos on your machine, multi-select to add
76
+ minions init
77
+ # → creates config, agents, engine defaults
78
+ # → scans ~ for git repos (auto-detects host, org, branch)
79
+ # → shows numbered list, pick with "1,3,5-7" or "all"
80
+
81
+ # 2. Start the engine (runs in foreground, ticks every 60s)
82
+ minions start
83
+
84
+ # 3. Open the dashboard (separate terminal)
85
+ minions dash
86
+ # → http://localhost:7331
87
+ ```
88
+
89
+ You can also add/scan repos later:
90
+ ```bash
91
+ minions scan # Re-scan and add more repos
92
+ minions scan ~/code 4 # Scan specific dir, depth 4
93
+ minions add ~/repo # Add a single repo interactively
94
+ ```
95
+
96
+ ## Setup via Claude Code
97
+
98
+ If you use Claude Code as your daily driver, you can set up Minions by prompting Claude directly:
99
+
100
+ **First-time setup:**
101
+ ```
102
+ Install minions with `npm install -g @yemi33/minions`, run `minions init`,
103
+ then link my project at ~/my-project with `minions add ~/my-project` —
104
+ answer the interactive prompts using what you can auto-detect from the repo.
105
+ ```
106
+
107
+ **Give the minions work:**
108
+ ```
109
+ Add a work item to my minions: "Explore the codebase and document the architecture"
110
+ — run `minions work "Explore the codebase and document the architecture"`
111
+ ```
112
+
113
+ **Check status:**
114
+ ```
115
+ Run `minions status` and tell me what my minions is doing
116
+ ```
117
+
118
+ ### What happens on first run
119
+
120
+ 1. The engine starts ticking every 60 seconds
121
+ 2. It scans each linked project for work: PRs needing review, plan items, queued work items
122
+ 3. If it finds work and an agent is idle, it spawns a Claude Code session with the right playbook
123
+ 4. You can watch progress on the dashboard or via `minions status`
124
+
125
+ To give the minions its first task, open the dashboard Command Center and add a work item, or use the CLI:
126
+ ```bash
127
+ minions work "Explore the codebase and document the architecture"
128
+ ```
129
+
130
+ ## CLI Reference
131
+
132
+ | Command | Description |
133
+ |---------|-------------|
134
+ | `minions init` | Bootstrap `~/.minions/` with default agents and config (`--skip-scan` to skip repo scan) |
135
+ | `minions init --force` | Upgrade engine code + add new files (preserves customizations) |
136
+ | `minions version` | Show installed vs package version |
137
+ | `minions scan [dir] [depth]` | Scan for git repos and multi-select to add (default: ~, depth 3) |
138
+ | `minions add <dir>` | Link a single project (auto-detects settings from git, prompts to confirm) |
139
+ | `minions remove <dir>` | Unlink a project |
140
+ | `minions list` | List all linked projects with descriptions |
141
+ | `minions start` | Start engine daemon (ticks every 60s, auto-syncs MCP servers) |
142
+ | `minions stop` | Stop the engine |
143
+ | `minions status` | Show agents, projects, dispatch queue, quality metrics |
144
+ | `minions pause` / `resume` | Pause/resume dispatching |
145
+ | `minions dispatch` | Force a dispatch cycle |
146
+ | `minions discover` | Dry-run work discovery |
147
+ | `minions work <title> [opts]` | Add to central work queue |
148
+ | `minions spawn <agent> <prompt>` | Manually spawn an agent |
149
+ | `minions plan <file\|text> [proj]` | Run a plan |
150
+ | `minions cleanup` | Run cleanup manually (temp files, worktrees, zombies) |
151
+ | `minions dash` | Start web dashboard (default port 7331) |
152
+
153
+ You can also run scripts directly: `node ~/.minions/engine.js start`, `node ~/.minions/dashboard.js`, etc.
154
+
155
+ ## Architecture
156
+
157
+ ```
158
+ ┌───────────────────────────────┐
159
+ │ ~/.minions/ (central) │
160
+ │ │
161
+ │ engine.js ← tick 60s │
162
+ │ dashboard.js ← :7331 │
163
+ │ config.json ← projects │
164
+ │ agents/ ← 5 agents │
165
+ │ playbooks/ ← templates │
166
+ │ plans/ ← approved plans│
167
+ │ knowledge/ ← KB store │
168
+ │ skills/ ← workflows │
169
+ │ notes/ ← knowledge │
170
+ └──────┬────────────────────────┘
171
+ │ discovers work + dispatches agents
172
+ ┌────────────┼────────────────┐
173
+ ▼ ▼ ▼
174
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
175
+ │ Project A │ │ Project B │ │ Project C │
176
+ │ projects/A │ │ projects/B │ │ projects/C │
177
+ │ work-items │ │ work-items │ │ work-items │
178
+ │ pull-reqs │ │ pull-reqs │ │ pull-reqs │
179
+ │ .claude/ │ │ .claude/ │ │ .claude/ │
180
+ │ skills/ │ │ skills/ │ │ skills/ │
181
+ └──────────────┘ └──────────────┘ └──────────────┘
182
+ ```
183
+
184
+ ## What It Does
185
+
186
+ - **Auto-discovers work** from plans (`plans/*.json`), pull requests, and work queues across all linked projects
187
+ - **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.
188
+ - **Human approval gate** — plans require approval before materializing as work items. Dashboard provides Approve / Discuss & Revise / Reject. Discussion launches an interactive Claude Code session.
189
+ - **Dispatches AI agents** (Claude CLI) with full project context, git worktrees, and MCP server access
190
+ - **Routes intelligently** — fixes first, then reviews, then implementation, matched to agent strengths
191
+ - **LLM-powered consolidation** — Haiku summarizes notes (threshold: 5 files). Regex fallback. Source references required.
192
+ - **Knowledge base** — `knowledge/` with categories: architecture, conventions, project-notes, build-reports, reviews. Full notes preserved. Dashboard browsable with inline Q&A.
193
+ - **Token tracking** — per-agent and per-day usage. Dashboard Token Usage panel.
194
+ - **Engine watchdog** — dashboard auto-restarts dead engine.
195
+ - **Agent re-attachment** — on restart, finds surviving agent processes via PID files.
196
+ - **Learns from itself** — agents write findings, engine consolidates into institutional knowledge
197
+ - **Tracks quality** — approval rates, error rates, and task metrics per agent
198
+ - **Shares workflows** — agents create reusable skills (Claude Code-compatible) that all other agents can follow
199
+ - **Supports cross-repo tasks** — a single work item can span multiple repositories
200
+ - **Fan-out dispatch** — broad tasks can be split across all idle agents in parallel, each assigned a project
201
+ - **Auto-syncs PRs** — engine scans agent output for PR URLs and updates project trackers automatically. PR reconciliation sweep catches any missed PRs from ADO.
202
+ - **Human feedback on PRs** — comment on any ADO PR to trigger agent fix tasks. `@minions` keyword required when multiple humans are commenting; optional when you're the only reviewer.
203
+ - **Dependency-aware spawning** — when a work item depends on others, the engine merges dependency PR branches into the worktree before the agent starts
204
+ - **Plan verification** — when all PRD items complete, engine auto-dispatches a verify task that builds all repos, starts the webapp, and writes a manual testing guide
205
+ - **PRD modification** — edit plans via doc-chat in the modal, then "Generate PRD" to regenerate. Dashboard supports regenerating, retrying failed items, and syncing edits to pending work items.
206
+ - **Auto-extracts skills** — agents write ` ```skill ` blocks in output; engine auto-extracts them
207
+ - **Heartbeat monitoring** — detects dead/hung agents via output file activity, not just timeouts
208
+ - **Auto-cleanup** — stale temp files, orphaned worktrees, zombie processes cleaned every 10 minutes
209
+
210
+ ## Dashboard
211
+
212
+ The web dashboard at `http://localhost:7331` provides:
213
+
214
+ - **Projects bar** — all linked projects with descriptions (hover for full text)
215
+ - **Command Center** — add work items, notes, plans (multi-project via `#project` tags). "make a plan for..." auto-detection, "remember" keyword, `--parallel`/`--shared` flags, arrow key history, Past Commands modal.
216
+ - **Minions Members** — agent cards with status and result summary, click for charter/history/output detail panel
217
+ - **Live Output tab** — real-time streaming output for working agents (auto-refreshes every 3s)
218
+ - **Work Items** — paginated table with status, source, type, priority, assigned agent, linked PRs, fan-out badges, and retry button for failed items
219
+ - **Plans** — plan approval UI with Approve / Discuss & Revise / Reject. Click to open in doc-chat modal for natural language editing; "Generate PRD" button appears after edits.
220
+ - **Knowledge Base** — browsable by category with inline Q&A (Haiku-powered)
221
+ - **PRD Progress** — dependency graph view, per-item retry button, "Edit PRD" and "Regenerate" actions. Failed items show green retry button.
222
+ - **Token Usage** — per-agent and per-day token tracking, plus engine LLM usage (command-center, doc-chat, consolidation)
223
+ - **Pull Requests** — paginated PR tracker sorted by date, with review/build/merge status
224
+ - **Skills** — agent-created reusable workflows (minions-wide + project-specific), click to view full content
225
+ - **Notes Inbox + Team Notes** — learnings and team rules, editable from dashboard modal
226
+ - **Dispatch Queue + Engine Log** — active/pending work and audit trail
227
+ - **Agent Metrics** — tasks completed, errors, PRs created/approved/rejected, approval rates
228
+ - **Document modals** — inline Q&A with Haiku on any document modal
229
+
230
+ ## Project Config
231
+
232
+ When you run `minions add <dir>`, it prompts for project details and saves them to `config.json`. Each project entry looks like:
233
+
234
+ ```json
235
+ {
236
+ "name": "MyProject",
237
+ "description": "What this repo is for — agents read this to decide where to work",
238
+ "localPath": "C:/Users/you/MyProject",
239
+ "repoHost": "github",
240
+ "repositoryId": "",
241
+ "adoOrg": "your-github-org",
242
+ "adoProject": "",
243
+ "repoName": "MyProject",
244
+ "mainBranch": "main",
245
+ "workSources": {
246
+ "pullRequests": { "enabled": true, "path": ".minions/pull-requests.json" },
247
+ "workItems": { "enabled": true, "path": ".minions/work-items.json" }
248
+ }
249
+ }
250
+ ```
251
+
252
+ **Key fields:**
253
+ - `description` — critical for auto-routing. Agents read this to decide which repo to work in.
254
+ - `repoHost` — `"ado"` (Azure DevOps) or `"github"`. Controls which MCP tools agents use for PR creation, review comments, and status checks. Defaults to `"ado"`.
255
+ - `repositoryId` — required for ADO (the repo GUID), optional for GitHub.
256
+ - `adoOrg` — ADO organization or GitHub org/user.
257
+ - `adoProject` — ADO project name (leave blank for GitHub).
258
+ - `workSources` — toggle which work sources the engine scans for each project.
259
+
260
+ Per-project runtime state is stored centrally at `~/.minions/projects/<project-name>/work-items.json` and `~/.minions/projects/<project-name>/pull-requests.json`.
261
+
262
+ ### Auto-Discovery
263
+
264
+ When you run `minions add`, the tool automatically detects what it can from the repo:
265
+
266
+ | What | How |
267
+ |------|-----|
268
+ | Main branch | `git symbolic-ref` |
269
+ | Repo host | Git remote URL (github.com → `github`, visualstudio.com/dev.azure.com → `ado`) |
270
+ | Org / project / repo | Parsed from git remote URL |
271
+ | Description | First non-heading line from `CLAUDE.md` or `README.md` |
272
+ | Project name | `name` field from `package.json` |
273
+
274
+ All detected values are shown as defaults in the interactive prompts — just press Enter to accept or type to override.
275
+
276
+ ### Project Conventions (CLAUDE.md)
277
+
278
+ When dispatching agents, the engine reads each project's `CLAUDE.md` and injects it into the agent's system prompt as "Project Conventions". This means agents automatically follow repo-specific rules (logging, build commands, coding style, etc.) without needing to discover them each time. Each project can have different conventions.
279
+
280
+ ## MCP Server Integration
281
+
282
+ Agents need MCP tools to interact with your repo host (create PRs, post review comments, etc.). Agents inherit MCP servers directly from `~/.claude.json` as Claude Code processes — add servers there and they're immediately available to all agents on next spawn.
283
+
284
+ **Example:** If you use Azure DevOps, configure the `azure-ado` MCP server in your Claude Code settings. If you use GitHub, configure the `github` MCP server. Agents will discover and use whichever tools are available.
285
+
286
+ Manually refresh with `minions mcp-sync`.
287
+
288
+ ### Azure DevOps Users
289
+
290
+ For the best experience with ADO repos, install the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) and use the [Azure DevOps MCP server](https://github.com/microsoft/azure-devops-mcp). This gives agents full access to PRs, work items, repos, and pipelines via MCP tools — no `gh` CLI needed.
291
+
292
+ ```bash
293
+ # Install Azure CLI
294
+ winget install Microsoft.AzureCLI # Windows
295
+ brew install azure-cli # macOS
296
+ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash # Linux
297
+
298
+ # Login and set defaults
299
+ az login
300
+ az devops configure --defaults organization=https://dev.azure.com/YOUR_ORG project=YOUR_PROJECT
301
+ ```
302
+
303
+ Then add the ADO MCP server to your Claude Code settings (`~/.claude.json`). The engine will auto-sync it to all agents on next start.
304
+
305
+ ## Work Items
306
+
307
+ All work items use the shared `playbooks/work-item.md` template, which provides consistent branch naming, worktree workflow, PR creation steps, and status tracking.
308
+
309
+ **Per-project** — scoped to one repo. Select a project in the Command Center dropdown.
310
+
311
+ **Central (auto-route)** — agent gets all project descriptions and decides where to work. Use "Auto (agent decides)" in the dropdown, or `minions work "title"`. Can span multiple repos.
312
+
313
+ ### Fan-Out (Parallel Multi-Agent)
314
+
315
+ Set Scope to "Fan-out (all agents)" in the Command Center, or add `"scope": "fan-out"` to the work item JSON.
316
+
317
+ The engine dispatches the task to **all idle agents simultaneously**, assigning each a project (round-robin). Each agent focuses on their assigned project and writes findings to the inbox.
318
+
319
+ ```
320
+ "Explore all codebases and write architecture doc" scope: fan-out
321
+
322
+ ├─→ Ripley → Project A
323
+ ├─→ Lambert → Project B
324
+ ├─→ Rebecca → Project C
325
+ └─→ Ralph → Project A (round-robin wraps)
326
+ ```
327
+
328
+ ### Failed Work Items
329
+
330
+ When an agent fails (timeout, crash, error), the engine marks the work item as `failed` with a reason. The dashboard shows a **Retry** button that resets it to `pending` for re-dispatch.
331
+
332
+ ## Auto-Discovery Pipeline
333
+
334
+ The engine discovers work from 5 sources, in priority order:
335
+
336
+ | Priority | Source | Dispatch Type |
337
+ |----------|--------|---------------|
338
+ | 1 | PRs with changes-requested | `fix` |
339
+ | 2 | PRs with human `@minions` feedback | `fix` |
340
+ | 3 | PRs with build failures | `fix` |
341
+ | 4 | PRs pending review | `review` |
342
+ | 5 | PRs needing build/test verification | `test` |
343
+ | 6 | Plan items (`plans/*.json`, approved) | `implement` |
344
+ | 7 | Per-project work items | item's `type` |
345
+ | 8 | Central work items | item's `type` |
346
+
347
+ Each item passes through: dedup (checks pending, active, AND recently completed), cooldown, and agent availability gates. See `docs/auto-discovery.md` for the full pipeline.
348
+
349
+ ## Agent Execution
350
+
351
+ ### Spawn Chain
352
+
353
+ ```
354
+ engine.js
355
+ → spawn node spawn-agent.js <prompt.md> <sysprompt.md> <args...>
356
+ → spawn-agent.js resolves claude-code cli.js path
357
+ → spawn node cli.js -p --system-prompt <content> <args...>
358
+ → prompt piped via stdin (avoids shell metacharacter issues)
359
+ ```
360
+
361
+ No bash or shell involved — Node spawns Node directly. Prompts with special characters (parentheses, backticks, etc.) are safe.
362
+
363
+ ### What Each Agent Gets
364
+
365
+ - **System prompt** — lean (~2-4KB) identity + rules only
366
+ - **Task prompt** — rendered playbook with `{{variables}}` filled from config, plus bulk context (charter, history, project context, active PR/dispatch context, team notes). Skills/KB are referenced by path and loaded on-demand.
367
+ - **Working directory** — project root (agent creates worktrees as needed)
368
+ - **MCP servers** — inherited from `~/.claude.json` (no extra config needed)
369
+ - **Full tool access** — all built-in tools plus all MCP tools
370
+ - **Permission mode** — `bypassPermissions` (no interactive prompts)
371
+ - **Output format** — `stream-json` (real-time streaming for live dashboard + heartbeat)
372
+
373
+ ### Post-Completion
374
+
375
+ When an agent finishes:
376
+ 1. Output saved to `agents/<name>/output.log`
377
+ 2. Agent status derived from `engine/dispatch.json` (done/error/working)
378
+ 3. Work item status updated (done/failed, with auto-retry up to 3x)
379
+ 4. PRs auto-synced from output → correct project's `pull-requests.json` (per-URL matching)
380
+ 5. "No PR" detection — implement/fix tasks that complete without creating a PR get flagged (`noPr: true`)
381
+ 6. Plan completion check — if all PRD items done, creates verification task + archives plan
382
+ 7. Agent history updated (last 20 tasks)
383
+ 8. Quality metrics updated (tokens, cost, approval rates)
384
+ 9. Review feedback created for PR authors (if review task)
385
+ 10. Learnings checked in `notes/inbox/`
386
+ 11. Skills auto-extracted from ` ```skill ` blocks in output
387
+ 12. Temp files cleaned up
388
+
389
+ ## Team
390
+
391
+ | Agent | Role | Best for |
392
+ |-------|------|----------|
393
+ | Ripley | Lead / Explorer | Code review, architecture, exploration |
394
+ | Dallas | Engineer | Features, tests, UI |
395
+ | Lambert | Analyst | PRD generation, docs |
396
+ | Rebecca | Architect | Complex systems, CI/infra |
397
+ | Ralph | Engineer | Features, bug fixes |
398
+
399
+ Routing rules in `routing.md`. Charters in `agents/{name}/charter.md`. Both are editable — customize agents and routing to fit your team's needs.
400
+
401
+ ## Playbooks
402
+
403
+ | Playbook | Purpose |
404
+ |----------|---------|
405
+ | `work-item.md` | Shared template for all work items (central + per-project) |
406
+ | `implement.md` | Build a PRD item in a git worktree, create PR |
407
+ | `review.md` | Review a PR, post findings to repo host |
408
+ | `fix.md` | Fix review feedback on existing PR branch |
409
+ | `explore.md` | Read-only codebase exploration |
410
+ | `test.md` | Run tests and report results |
411
+ | `build-and-test.md` | Build project and run test suite |
412
+ | `plan-to-prd.md` | Convert a plan into PRD gap items |
413
+ | `plan.md` | Generate a plan from user request |
414
+ | `implement-shared.md` | Implement on a shared branch (multiple agents) |
415
+ | `ask.md` | Answer a question about the codebase |
416
+ | `verify.md` | Plan completion: build all repos, start webapp, write testing guide |
417
+
418
+ All playbooks use `{{template_variables}}` filled from project config. The `work-item.md` playbook uses `{{scope_section}}` to inject project-specific or multi-project context. Playbooks are fully customizable — edit them to match your workflow.
419
+
420
+ ## Health Monitoring
421
+
422
+ ### Heartbeat Check (every tick)
423
+
424
+ Uses `live-output.log` file modification time as a heartbeat:
425
+ - **Process alive + recent output** → healthy, keep running
426
+ - **Process alive + in blocking tool call** → extended timeout (matches tool's timeout + grace period)
427
+ - **Process alive + silent >5min** → hung, kill and mark failed
428
+ - **No process + silent >5min** → orphaned (engine restarted), mark failed
429
+
430
+ Agents can run for hours as long as they're producing output. The `heartbeatTimeout` (default 5min) only triggers on silence. When an agent is in a blocking tool call (e.g., `TaskOutput` with `block:true`, `Bash` with long timeout), the engine detects this from the live output and extends the timeout automatically.
431
+
432
+ ### Automated Cleanup (every 10 ticks)
433
+
434
+ | What | Condition |
435
+ |------|-----------|
436
+ | Temp prompt/sysprompt files | >1 hour old |
437
+ | `live-output.log` for idle agents | >1 hour old |
438
+ | Git worktrees for merged/abandoned PRs | PR status is `merged`/`abandoned`/`completed` |
439
+ | Orphaned worktrees | >24 hours old, no active dispatch references them |
440
+ | Zombie processes | In memory but no matching dispatch |
441
+
442
+ Manual cleanup: `minions cleanup`
443
+
444
+ ## Self-Improvement Loop
445
+
446
+ Six mechanisms that make the minions get better over time:
447
+
448
+ ### 1. Learnings Inbox → notes.md
449
+ Agents write findings to `notes/inbox/`. Engine consolidates at 5+ files using Haiku LLM summarization (regex fallback) into `notes.md` — categorized with source references. Auto-prunes at 50KB. Injected into every future playbook.
450
+
451
+ ### 6. Knowledge Base
452
+ `knowledge/` stores full notes by category: architecture, conventions, project-notes, build-reports, reviews. Browsable in dashboard with inline Q&A (Haiku-powered).
453
+
454
+ ### 2. Per-Agent History
455
+ `agents/{name}/history.md` tracks last 20 tasks with timestamps, results, projects, and branches. Injected into the agent's system prompt so it remembers past work.
456
+
457
+ ### 3. Review Feedback Loop
458
+ When a reviewer flags issues, the engine creates `feedback-<author>-from-<reviewer>.md` in the inbox. The PR author sees the feedback in their next task.
459
+
460
+ ### 4. Quality Metrics
461
+ `engine/metrics.json` tracks per agent: tasks completed, errors, PRs created/approved/rejected, reviews done. Visible in CLI (`status`) and dashboard with color-coded approval rates.
462
+
463
+ ### 5. Skills
464
+ Agents save repeatable workflows to `skills/<name>.md` with Claude Code-compatible frontmatter. Engine builds an index injected into all prompts. Skills can also be stored per-project at `<project>/.claude/skills/<name>/SKILL.md` (requires a PR). Visible in the dashboard Skills section.
465
+
466
+ See `docs/self-improvement.md` for the full breakdown.
467
+
468
+ ## Configuration Reference
469
+
470
+ Engine behavior is controlled via `config.json`. Key settings:
471
+
472
+ ```json
473
+ {
474
+ "engine": {
475
+ "tickInterval": 60000,
476
+ "maxConcurrent": 3,
477
+ "agentTimeout": 18000000,
478
+ "heartbeatTimeout": 300000,
479
+ "maxTurns": 100,
480
+ "inboxConsolidateThreshold": 5,
481
+ "worktreeCreateTimeout": 300000,
482
+ "worktreeCreateRetries": 1
483
+ }
484
+ }
485
+ ```
486
+
487
+ | Setting | Default | Description |
488
+ |---------|---------|-------------|
489
+ | `tickInterval` | 60000 (1min) | Milliseconds between engine ticks |
490
+ | `maxConcurrent` | 3 | Max agents running simultaneously |
491
+ | `agentTimeout` | 18000000 (5h) | Max total agent runtime |
492
+ | `heartbeatTimeout` | 300000 (5min) | Kill agents silent longer than this |
493
+ | `maxTurns` | 100 | Max Claude CLI turns per agent session |
494
+ | `inboxConsolidateThreshold` | 5 | Inbox files needed before consolidation |
495
+ | `worktreeCreateTimeout` | 300000 (5min) | Timeout for each `git worktree add` attempt |
496
+ | `worktreeCreateRetries` | 1 | Retry count for transient `git worktree add` failures (0-3) |
497
+ | `worktreeRoot` | `../worktrees` | Where git worktrees are created |
498
+ | `idleAlertMinutes` | 15 | Alert after no dispatch for this many minutes |
499
+ | `restartGracePeriod` | 1200000 (20min) | Grace period for agent re-attachment after engine restart |
500
+
501
+ ## Node.js Upgrade Caution
502
+
503
+ The engine and all spawned agents use the Node binary that started the engine (`process.execPath`). After upgrading Node, restart the engine:
504
+
505
+ ```bash
506
+ minions stop
507
+ minions start
508
+ ```
509
+
510
+ ## Portability
511
+
512
+ **Portable (works on any machine):** Engine code, dashboard, playbooks, charters, docs, `config.template.json`.
513
+
514
+ **Machine-specific (reconfigure per machine):**
515
+ - `config.json` — contains absolute paths to project directories. Re-link via `minions add <dir>`.
516
+
517
+ **Generated at runtime:** routing, notes, knowledge, skills, plans, PRDs, work items, dispatch queue, metrics — all created by the engine as agents work.
518
+
519
+ To move to a new machine: `npm install -g @yemi33/minions && minions init --force`, then re-run `minions add` for each project.
520
+
521
+ ## File Layout
522
+
523
+ ```
524
+ ~/.minions/
525
+ bin/
526
+ minions.js <- Unified CLI entry point (npm package)
527
+ minions.js <- Project management: init, add, remove, list
528
+ engine.js <- Engine daemon + orchestrator
529
+ engine/
530
+ shared.js <- Shared utilities: IO, process spawning, config helpers
531
+ queries.js <- Read-only state queries (used by engine + dashboard)
532
+ cli.js <- CLI command handlers (start, stop, status, plan, etc.)
533
+ lifecycle.js <- Post-completion hooks, plan chaining, PR sync, metrics
534
+ consolidation.js <- Haiku-powered inbox consolidation, knowledge base
535
+ ado.js <- ADO token management, PR polling, PR reconciliation
536
+ llm.js <- callLLM() with session resume, trackEngineUsage()
537
+ spawn-agent.js <- Agent spawn wrapper (resolves claude cli.js)
538
+ ado-mcp-wrapper.js <- ADO MCP authentication wrapper
539
+ check-status.js <- Quick status check without full engine load
540
+ control.json <- running/paused/stopped (runtime, generated)
541
+ dispatch.json <- pending/active/completed queue (runtime, generated)
542
+ log.json <- Audit trail, capped at 500 (runtime, generated)
543
+ metrics.json <- Per-agent quality metrics (runtime, generated)
544
+ cooldowns.json <- Dispatch cooldown tracking (runtime, generated)
545
+ dashboard.js <- Web dashboard server
546
+ dashboard.html <- Dashboard UI (single-file)
547
+ config.json <- projects[], agents, engine, claude settings (generated by minions init)
548
+ config.template.json <- Template for new installs
549
+ package.json <- npm package definition
550
+ plans/ <- Approved plans: plans/{project}-{date}.json (generated)
551
+ prd/ <- PRD archives and verification guides (generated)
552
+ knowledge/ <- KB: architecture, conventions, project-notes, build-reports, reviews (generated)
553
+ routing.md <- Dispatch rules table (generated, editable)
554
+ notes.md <- Team rules + consolidated learnings (generated)
555
+ work-items.json <- Central work queue (generated)
556
+ playbooks/
557
+ work-item.md <- Shared work item template
558
+ implement.md <- Build a PRD item
559
+ review.md <- Review a PR
560
+ fix.md <- Fix review feedback
561
+ explore.md <- Codebase exploration
562
+ test.md <- Run tests
563
+ build-and-test.md <- Build project and run test suite
564
+ plan-to-prd.md <- Convert plan to PRD gap items
565
+ plan.md <- Generate a plan from user request
566
+ implement-shared.md <- Implement on a shared branch
567
+ ask.md <- Answer a question about the codebase
568
+ verify.md <- Plan verification: build, test, start webapp, testing guide
569
+ skills/ <- Agent-created reusable workflows (generated)
570
+ agents/
571
+ {name}/
572
+ charter.md <- Agent identity and boundaries (editable)
573
+ history.md <- Task history, last 20 (runtime, generated)
574
+ live-output.log <- Streaming output while working (runtime, generated)
575
+ output.log <- Final output after completion (runtime, generated)
576
+ identity/
577
+ now.md <- Engine-generated state snapshot (runtime, generated)
578
+ notes/
579
+ inbox/ <- Agent findings drop-box (generated)
580
+ archive/ <- Processed inbox files (generated)
581
+ docs/
582
+ auto-discovery.md <- Auto-discovery pipeline docs
583
+ self-improvement.md <- Self-improvement loop docs
584
+ plan-lifecycle.md <- Full plan pipeline: plan → PRD → implement → verify
585
+ command-center.md <- Command Center usage and features
586
+ engine-restart.md <- Engine restart and recovery procedures
587
+
588
+ Each linked project keeps locally:
589
+ <project>/.claude/
590
+ skills/ <- Project-specific skills (requires PR)
591
+
592
+ Per-project engine state remains centralized:
593
+ ~/.minions/projects/<project-name>/
594
+ work-items.json <- Per-project work queue
595
+ pull-requests.json <- PR tracker
596
+ ```
597
+
598
+
@@ -0,0 +1,56 @@
1
+ # Dallas — Engineer
2
+
3
+ > Ships working code. Reads the instructions once, then executes — no over-engineering.
4
+
5
+ ## Identity
6
+
7
+ - **Name:** Dallas
8
+ - **Role:** Engineer
9
+ - **Expertise:** TypeScript/Node.js, agent architecture, monorepo builds (Yarn + lage), Docker, Claude SDK integration
10
+ - **Style:** Pragmatic. Implements what's specified. Minimal, clean code. Follows existing patterns.
11
+
12
+ ## What I Own
13
+
14
+ - Prototype implementation — building exactly what the codebase instructions specify
15
+ - Following agent architecture patterns from `agents/*/CLAUDE.md` and `docs/`
16
+ - Wiring up `src/registry.ts`, agent entry points, prompts, skills, and sub-agents per pattern
17
+ - TypeScript builds, test scaffolding, Docker integration
18
+
19
+ ## How I Work
20
+
21
+ - Wait for Ripley's exploration findings before writing any code
22
+ - Read the specific CLAUDE.md for the agent/area I'm building
23
+ - Follow the common agent pattern: `registry.ts` → main agent file → `src/prompts/{version}/`
24
+ - Use PowerShell for build commands on Windows if applicable
25
+ - Follow the project's logging and coding conventions (check CLAUDE.md)
26
+ - Write tests in `**/tests/**/*.test.ts` following existing Jest patterns
27
+
28
+ ## Build Commands (PowerShell only)
29
+
30
+ ```powershell
31
+ yarn build # Build packages + Docker image
32
+ yarn test # Run all tests
33
+ yarn lint # ESLint
34
+ # Check project's CLAUDE.md for build/test commands
35
+ ```
36
+
37
+ ## Boundaries
38
+
39
+ **I handle:** Prototype implementation, code scaffolding, TypeScript/Node.js, build config, Docker integration.
40
+
41
+ **I don't handle:** Codebase exploration (Ripley), product requirements (Lambert).
42
+
43
+ **When I'm unsure:** I read the relevant CLAUDE.md or docs/ file first, then proceed.
44
+
45
+ ## Model
46
+
47
+ - **Preferred:** auto
48
+
49
+ ## Voice
50
+
51
+ Ships clean code that follows the patterns already in the repo. Gets annoyed by reinventing wheels when a module already does it. Will call out if Ripley's findings are incomplete before starting.
52
+
53
+ ## Directives
54
+
55
+ **Before starting any work, read `.minions/notes.md` for team rules and constraints.**
56
+