@agentplate/cli 1.0.0
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/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +206 -0
- package/agents/architect.md +108 -0
- package/agents/builder.md +97 -0
- package/agents/coordinator.md +113 -0
- package/agents/deployer.md +117 -0
- package/agents/devops.md +114 -0
- package/agents/lead.md +107 -0
- package/agents/merger.md +103 -0
- package/agents/reviewer.md +90 -0
- package/agents/scout.md +95 -0
- package/agents/verifier.md +106 -0
- package/package.json +64 -0
- package/src/agents/guard-rules.ts +55 -0
- package/src/agents/identity.test.ts +161 -0
- package/src/agents/identity.ts +229 -0
- package/src/agents/manifest.test.ts +260 -0
- package/src/agents/manifest.ts +286 -0
- package/src/agents/overlay.test.ts +190 -0
- package/src/agents/overlay.ts +212 -0
- package/src/agents/system-prompt.test.ts +53 -0
- package/src/agents/system-prompt.ts +95 -0
- package/src/agents/turn-runner.ts +79 -0
- package/src/commands/coordinator.test.ts +75 -0
- package/src/commands/coordinator.ts +259 -0
- package/src/commands/deploy.test.ts +504 -0
- package/src/commands/deploy.ts +874 -0
- package/src/commands/doctor.test.ts +106 -0
- package/src/commands/doctor.ts +208 -0
- package/src/commands/init.ts +71 -0
- package/src/commands/log.ts +51 -0
- package/src/commands/mail.ts +197 -0
- package/src/commands/merge.ts +127 -0
- package/src/commands/model.ts +58 -0
- package/src/commands/prime.ts +61 -0
- package/src/commands/reap.ts +87 -0
- package/src/commands/serve.ts +61 -0
- package/src/commands/setup.ts +48 -0
- package/src/commands/ship.test.ts +106 -0
- package/src/commands/ship.ts +202 -0
- package/src/commands/skill.test.ts +458 -0
- package/src/commands/skill.ts +730 -0
- package/src/commands/sling.ts +365 -0
- package/src/commands/status.ts +60 -0
- package/src/commands/stop.ts +56 -0
- package/src/commands/tui.ts +199 -0
- package/src/commands/worktree.ts +77 -0
- package/src/config.test.ts +92 -0
- package/src/config.ts +202 -0
- package/src/db/sqlite.test.ts +77 -0
- package/src/db/sqlite.ts +102 -0
- package/src/deploy/audit.test.ts +233 -0
- package/src/deploy/audit.ts +245 -0
- package/src/deploy/context.test.ts +243 -0
- package/src/deploy/context.ts +72 -0
- package/src/deploy/registry.test.ts +101 -0
- package/src/deploy/registry.ts +86 -0
- package/src/deploy/secrets.test.ts +129 -0
- package/src/deploy/secrets.ts +69 -0
- package/src/deploy/targets/docker-gha.test.ts +323 -0
- package/src/deploy/targets/docker-gha.ts +841 -0
- package/src/deploy/types.ts +153 -0
- package/src/errors.test.ts +42 -0
- package/src/errors.ts +69 -0
- package/src/events/store.test.ts +183 -0
- package/src/events/store.ts +201 -0
- package/src/index.ts +137 -0
- package/src/insights/quality-gates.ts +73 -0
- package/src/json.test.ts +28 -0
- package/src/json.ts +50 -0
- package/src/logging/color.ts +62 -0
- package/src/logging/logger.ts +60 -0
- package/src/logging/sanitizer.test.ts +36 -0
- package/src/logging/sanitizer.ts +57 -0
- package/src/mail/client.test.ts +192 -0
- package/src/mail/client.ts +188 -0
- package/src/mail/store.test.ts +279 -0
- package/src/mail/store.ts +311 -0
- package/src/merge/lock.test.ts +88 -0
- package/src/merge/lock.ts +84 -0
- package/src/merge/queue.test.ts +136 -0
- package/src/merge/queue.ts +177 -0
- package/src/merge/resolver.test.ts +219 -0
- package/src/merge/resolver.ts +274 -0
- package/src/paths.ts +36 -0
- package/src/providers/apply.test.ts +90 -0
- package/src/providers/apply.ts +66 -0
- package/src/providers/registry.test.ts +74 -0
- package/src/providers/registry.ts +254 -0
- package/src/runtimes/claude.ts +313 -0
- package/src/runtimes/codex.ts +280 -0
- package/src/runtimes/cursor.ts +247 -0
- package/src/runtimes/gemini.ts +173 -0
- package/src/runtimes/mock.ts +71 -0
- package/src/runtimes/opencode.ts +259 -0
- package/src/runtimes/registry.test.ts +924 -0
- package/src/runtimes/registry.ts +63 -0
- package/src/runtimes/resolve.ts +45 -0
- package/src/runtimes/types.ts +97 -0
- package/src/scaffold.ts +68 -0
- package/src/secrets.test.ts +51 -0
- package/src/secrets.ts +78 -0
- package/src/serve/api.ts +667 -0
- package/src/serve/server.test.ts +433 -0
- package/src/serve/server.ts +271 -0
- package/src/serve/system.ts +90 -0
- package/src/serve/weather.ts +140 -0
- package/src/sessions/reaper.test.ts +162 -0
- package/src/sessions/reaper.ts +149 -0
- package/src/sessions/store.test.ts +351 -0
- package/src/sessions/store.ts +350 -0
- package/src/skills/distiller.test.ts +498 -0
- package/src/skills/distiller.ts +426 -0
- package/src/skills/feedback.test.ts +300 -0
- package/src/skills/feedback.ts +168 -0
- package/src/skills/lifecycle.ts +169 -0
- package/src/skills/retrieval.test.ts +421 -0
- package/src/skills/retrieval.ts +365 -0
- package/src/skills/safety.test.ts +335 -0
- package/src/skills/safety.ts +216 -0
- package/src/skills/store.test.ts +425 -0
- package/src/skills/store.ts +684 -0
- package/src/skills/types.ts +107 -0
- package/src/types.ts +442 -0
- package/src/utils/detect.test.ts +35 -0
- package/src/utils/detect.ts +82 -0
- package/src/version.test.ts +19 -0
- package/src/version.ts +7 -0
- package/src/wizard/setup.ts +254 -0
- package/src/worktree/manager.test.ts +181 -0
- package/src/worktree/manager.ts +229 -0
- package/templates/overlay.md.tmpl +102 -0
- package/ui/dist/assets/index-C7rXIMER.css +1 -0
- package/ui/dist/assets/index-W4kbr4by.js +4526 -0
- package/ui/dist/favicon.svg +21 -0
- package/ui/dist/index.html +16 -0
- package/ui/dist/logo-clay.svg +21 -0
- package/ui/dist/logo.svg +18 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Agentplate are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/), and the project aims to adhere to
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [1.0.0] — 2026-06-01
|
|
8
|
+
|
|
9
|
+
Initial public release of Agentplate as `@agentplate/cli`.
|
|
10
|
+
|
|
11
|
+
### Highlights
|
|
12
|
+
|
|
13
|
+
- **Swarm orchestration.** Turn a single coding-agent session into a multi-agent
|
|
14
|
+
team — spawn workers in isolated git worktrees, coordinate them over a custom
|
|
15
|
+
SQLite mail bus, and merge their work back with tiered conflict resolution.
|
|
16
|
+
- **Hierarchical agents.** Coordinator → leads → specialist workers
|
|
17
|
+
(builder / scout / reviewer / merger), with a configurable delegation depth. The
|
|
18
|
+
coordinator is a dispatch-only orchestrator: it decomposes a goal into parallel
|
|
19
|
+
slices and hires a lead per slice via `agentplate sling` rather than editing files
|
|
20
|
+
itself.
|
|
21
|
+
- **Headless spawn-per-turn engine.** Each agent turn is a fresh runtime subprocess
|
|
22
|
+
driven by the mail bus — no long-lived process, no tmux.
|
|
23
|
+
- **Web UI (`agentplate serve`).** A control center with a Mission Control
|
|
24
|
+
dashboard, a live host **System Monitor**, an animated **3D Office**, **Costs**,
|
|
25
|
+
**Tasks**, **Handoffs**, an activity feed, per-agent detail drawers, a notification
|
|
26
|
+
center, and a ⌘K command palette.
|
|
27
|
+
- **Observability.** `ap status`, `dashboard`, `inspect`, `trace`, `feed`, `logs`,
|
|
28
|
+
`errors`, `replay`, `costs`, and `metrics` over shared SQLite event/session stores.
|
|
29
|
+
- **Build → CI/CD → deploy.** Pipeline agents and pluggable deploy-target adapters
|
|
30
|
+
with an append-only audit trail and explicit production gates.
|
|
31
|
+
- **Self-improving skills.** Distill reusable skills from successful tasks, ranked by
|
|
32
|
+
Wilson-confidence and retrieved into agent overlays, safety-scrubbed before any write.
|
|
33
|
+
|
|
34
|
+
### Runtimes & providers
|
|
35
|
+
|
|
36
|
+
- **Runtime adapters** for Claude Code, Codex, OpenCode, Gemini (beta), and Cursor
|
|
37
|
+
(beta) — each driving its CLI headless and reusing the CLI's own OAuth login when
|
|
38
|
+
the provider uses `subscription` auth.
|
|
39
|
+
- **Provider-agnostic prompts** that reference the runtime's own overlay file
|
|
40
|
+
(`CLAUDE.md` / `AGENTS.md` / `GEMINI.md`).
|
|
41
|
+
- **Curated, current model catalogs** with a setup wizard that always allows a custom
|
|
42
|
+
model id.
|
|
43
|
+
- **Cross-platform.** Validated on macOS/Linux with guarded Windows code paths for
|
|
44
|
+
runtime CLI detection and spawning.
|
|
45
|
+
|
|
46
|
+
### Lifecycle & safety
|
|
47
|
+
|
|
48
|
+
- **Sling-only spawning.** Agentplate-driven sessions disable a runtime's native
|
|
49
|
+
sub-agent tools so every teammate is spawned through `agentplate sling` and tracked.
|
|
50
|
+
- **Idle-agent reaper.** Workers idle past `agents.idleTimeoutMinutes` (default 10) are
|
|
51
|
+
terminated and cleaned up; runs while `ap serve` is up and on demand via
|
|
52
|
+
`agentplate reap`. The coordinator is never reaped.
|
|
53
|
+
- **Secrets by env-var name only** — values resolved at point-of-use, never written to
|
|
54
|
+
config, mail, audit, logs, or a skill.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agentplate contributors
|
|
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,206 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/agentplate-logo.svg" alt="Agentplate" width="380" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Self-improving multi-agent orchestration — from idea to deployed app.</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@agentplate/cli"><img src="https://img.shields.io/npm/v/@agentplate/cli?color=fb4b38&label=npm" alt="npm version" /></a>
|
|
11
|
+
<img src="https://img.shields.io/badge/runtime-Bun-fb4b38" alt="Runtime: Bun" />
|
|
12
|
+
<a href="#license"><img src="https://img.shields.io/npm/l/@agentplate/cli?color=fb4b38" alt="MIT License" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
Spawn AI agent swarms in isolated git worktrees, coordinate them over a SQLite
|
|
17
|
+
mail bus, and merge their work back. An interactive wizard picks your AI
|
|
18
|
+
provider, a closed learning loop distills reusable skills as agents work, and a
|
|
19
|
+
built-in pipeline takes you from <em>build → configure CI/CD → deploy</em> to the
|
|
20
|
+
target of your choice — all observable from a CLI, a live TUI, and a web UI.
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="#quick-start">Quick start</a> ·
|
|
25
|
+
<a href="#features">Features</a> ·
|
|
26
|
+
<a href="#commands">Commands</a> ·
|
|
27
|
+
<a href="#architecture">Architecture</a> ·
|
|
28
|
+
<a href="#contributing">Contributing</a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
> **v1.0.0 — first public release.** The orchestration engine, provider wizard,
|
|
34
|
+
> self-improving skills, multi-runtime support, the web UI (`agentplate serve`),
|
|
35
|
+
> and the build→deploy pipeline are all working and tested.
|
|
36
|
+
|
|
37
|
+
## Why Agentplate
|
|
38
|
+
|
|
39
|
+
Most "AI coding agent" tools give you *one* agent in *one* session. Agentplate turns a
|
|
40
|
+
single command into a **team**: it spawns specialized worker agents in isolated git
|
|
41
|
+
worktrees, coordinates them through a fast SQLite message bus, folds their work back
|
|
42
|
+
with tiered conflict resolution — and then **gets better the more you use it** by
|
|
43
|
+
distilling reusable skills from work that passed its quality gates.
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- **🧙 Interactive setup wizard.** `agentplate setup` walks you through provider
|
|
48
|
+
selection (Anthropic, OpenAI, OpenRouter, DeepSeek, Google, local/Ollama, or a
|
|
49
|
+
custom OpenAI-compatible endpoint) and then **how to authenticate** — reuse an
|
|
50
|
+
existing **subscription / CLI login** (e.g. a Claude Pro/Max session in Claude Code,
|
|
51
|
+
`codex login`, or the Gemini CLI — no key stored), an **existing environment
|
|
52
|
+
variable**, or **enter an API key** (saved to a **gitignored** secrets file). Switch
|
|
53
|
+
any time with `agentplate model`. Models below a 64k context floor are rejected.
|
|
54
|
+
- **🤖 Agent-swarm orchestration.** A `coordinator → lead → workers` hierarchy runs
|
|
55
|
+
agents (scout, builder, reviewer, merger…) in isolated worktrees, coordinates them
|
|
56
|
+
over `.agentplate/mail.db`, and merges branches back with a clean → auto-resolve tiered
|
|
57
|
+
strategy. Headless **spawn-per-turn** execution — no tmux required.
|
|
58
|
+
- **📈 Self-improving skills.** After an agent completes a task whose quality gates
|
|
59
|
+
pass, Agentplate distills a reusable, versioned **skill** (a markdown playbook). Future
|
|
60
|
+
agents retrieve the relevant skills into their context, apply them, and the skills
|
|
61
|
+
earn or lose **confidence** from real outcomes — so the swarm compounds expertise.
|
|
62
|
+
- **🚀 Build → CI/CD → Deploy.** A staged pipeline (architect → builder → devops →
|
|
63
|
+
deployer → verifier) scaffolds an app, generates CI/CD + infrastructure, and ships
|
|
64
|
+
it. Pluggable **deploy targets** (Docker + GitHub Actions today; PaaS, cloud,
|
|
65
|
+
Kubernetes/Helm, and on-prem are adapter files). One command:
|
|
66
|
+
`agentplate ship "an idea" --target docker-gha`.
|
|
67
|
+
- **🛡️ Safe by construction.** Secrets live only in env-vars / a gitignored store and
|
|
68
|
+
are injected solely into the deployer process — never committed, logged, or audited.
|
|
69
|
+
Production deploys require an explicit gate (`--yes`); `--dry-run` generates config
|
|
70
|
+
and plans with **zero** outward mutation; every deploy is recorded in an append-only
|
|
71
|
+
audit log. Distilled skills are scrubbed for secrets and dangerous commands.
|
|
72
|
+
- **🖥️ Three surfaces.** A CLI, a **3-pane `agentplate tui`** (active agents / live feed /
|
|
73
|
+
tasks), and a modern **"agent OS" web UI** (`agentplate serve`) — an icon-rail shell with a
|
|
74
|
+
Mission Control dashboard, an animated **3D Office** where agents sit and type, stand when
|
|
75
|
+
idle, and walk to the whiteboard to talk when they hand off tasks (React Three Fiber), a real
|
|
76
|
+
**System Monitor** (host CPU/RAM/disk/uptime), **Costs & Analytics** charts, **Tasks** and
|
|
77
|
+
**Handoffs** views, a terminal-style live feed, per-agent detail drawers, a notification
|
|
78
|
+
center, a **⌘K command palette**, and a chat to message the coordinator and submit tasks.
|
|
79
|
+
Everything auto-refreshes every 5 seconds.
|
|
80
|
+
- **💬 Conversational coordinator.** `agentplate coordinator start` opens an interactive
|
|
81
|
+
Claude session primed as your orchestrator — describe what you want built and it dispatches
|
|
82
|
+
the team.
|
|
83
|
+
|
|
84
|
+
## Requirements
|
|
85
|
+
|
|
86
|
+
- **[Bun](https://bun.sh) `>= 1.0`** — Agentplate runs on Bun (the CLI bin uses a
|
|
87
|
+
`#!/usr/bin/env bun` shebang). Plain Node.js is **not** sufficient; install Bun first
|
|
88
|
+
(`curl -fsSL https://bun.sh/install | bash`).
|
|
89
|
+
- `git`
|
|
90
|
+
- A coding-agent runtime — **Claude Code** (default), **OpenCode**, or **Codex** — and an API
|
|
91
|
+
key (or subscription login) for your provider. Pick one in `agentplate setup`, or per
|
|
92
|
+
command with `--runtime <claude|opencode|codex>`.
|
|
93
|
+
|
|
94
|
+
## Install
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# From npm (requires Bun on your PATH):
|
|
98
|
+
npm install -g @agentplate/cli # or: bun install -g @agentplate/cli
|
|
99
|
+
agentplate --version
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or from source:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone https://github.com/agentplate/agentplate.git
|
|
106
|
+
cd agentplate && bun install && bun link # puts `agentplate` (and `ap`) on your PATH
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Quick start
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# In YOUR project:
|
|
113
|
+
cd ~/my-project
|
|
114
|
+
agentplate setup # interactive: provider → API key → model → runtime
|
|
115
|
+
agentplate doctor # verify everything is wired
|
|
116
|
+
|
|
117
|
+
# Orchestrate
|
|
118
|
+
agentplate coordinator start
|
|
119
|
+
agentplate sling TASK-1 --capability builder # spawn a worker in a worktree
|
|
120
|
+
agentplate status # see runs / agents / worktrees
|
|
121
|
+
agentplate merge --all # fold completed work back
|
|
122
|
+
|
|
123
|
+
# Watch it live
|
|
124
|
+
agentplate tui # terminal dashboard
|
|
125
|
+
agentplate serve # web UI at http://127.0.0.1:7551
|
|
126
|
+
|
|
127
|
+
# Ship it
|
|
128
|
+
agentplate target detect # what kind of app is this?
|
|
129
|
+
agentplate ship "a URL shortener" --target docker-gha --dry-run # plan, no deploy
|
|
130
|
+
agentplate ship "a URL shortener" --target docker-gha --env production --yes
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Commands
|
|
134
|
+
|
|
135
|
+
| Command | What it does |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `agentplate setup` | Interactive provider/model/runtime wizard |
|
|
138
|
+
| `agentplate init` | Non-interactive `.agentplate/` scaffold |
|
|
139
|
+
| `agentplate model` | Switch the active provider/model |
|
|
140
|
+
| `agentplate doctor` | Health checks (`--category core\|providers\|deploy`) |
|
|
141
|
+
| `agentplate coordinator` | Start/stop the top-level orchestration session |
|
|
142
|
+
| `agentplate sling <task>` | Spawn a worker agent (`--capability`, `--files`, `--parent`…) |
|
|
143
|
+
| `agentplate status` | Runs, agent sessions, worktrees |
|
|
144
|
+
| `agentplate mail` | Inter-agent messaging (send/check/list/reply/purge) |
|
|
145
|
+
| `agentplate merge` | Fold agent branches back (`--branch`/`--all`, `--dry-run`) |
|
|
146
|
+
| `agentplate worktree` | List / clean agent worktrees |
|
|
147
|
+
| `agentplate stop <agent>` | Terminate an agent session |
|
|
148
|
+
| `agentplate skill` | The self-improving skill library (list/show/search/record/outcome/prune…) |
|
|
149
|
+
| `agentplate target` | Inspect/detect/configure deploy targets |
|
|
150
|
+
| `agentplate deploy` | Gate → generate → deploy → verify → audit |
|
|
151
|
+
| `agentplate ship [idea]` | One-shot build → CI/CD → deploy pipeline |
|
|
152
|
+
| `agentplate rollback` | Roll a target back to its last successful deploy |
|
|
153
|
+
| `agentplate serve` | Web UI (HTTP + WebSocket) |
|
|
154
|
+
| `agentplate tui` | Live terminal dashboard |
|
|
155
|
+
| `agentplate prime` / `log` | Hook targets (context priming / event logging) |
|
|
156
|
+
|
|
157
|
+
Run `agentplate <command> --help` for full options. Every command supports `--json`.
|
|
158
|
+
|
|
159
|
+
## Architecture
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
your Claude Code session ─┐
|
|
163
|
+
│ agentplate CLI
|
|
164
|
+
coordinator ─────────────┤
|
|
165
|
+
└─ lead │ • git worktrees (isolated per agent)
|
|
166
|
+
├─ scout │ • SQLite mail bus (.agentplate/mail.db, WAL)
|
|
167
|
+
├─ builder │ • spawn-per-turn headless runtimes
|
|
168
|
+
├─ reviewer │ • tiered merge (clean → auto-resolve)
|
|
169
|
+
└─ merger │ • self-improving skills (retrieve→apply→distill→score)
|
|
170
|
+
ship-lead ───────────────┤ • deploy targets (docker-gha, …) behind gates + audit
|
|
171
|
+
architect → builder → devops → [gate] → deployer → verifier
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- **Runtimes** (`src/runtimes/`) — pluggable coding-agent adapters (Claude Code +
|
|
175
|
+
a deterministic mock for tests). One file per CLI, resolved by a registry; auth via
|
|
176
|
+
env-by-name, never hardcoded.
|
|
177
|
+
- **Deploy targets** (`src/deploy/`) — the *same* adapter pattern for shipping:
|
|
178
|
+
`detect → generateConfig → deploy → verify → rollback`. Adding a target is one file.
|
|
179
|
+
- **Skills** (`src/skills/`) — markdown+frontmatter playbooks with an append-only
|
|
180
|
+
outcome log and a Wilson-confidence score; retrieved into agent overlays, distilled
|
|
181
|
+
by a gated AI step from work that passed.
|
|
182
|
+
- **State** — everything lives under `.agentplate/` (config, worktrees, specs, skills,
|
|
183
|
+
and SQLite DBs for mail/sessions/events/merge/deploys). Secrets are gitignored.
|
|
184
|
+
|
|
185
|
+
All built on Bun + TypeScript (strict), formatted/linted with
|
|
186
|
+
[Biome](https://biomejs.dev), tested with `bun test` (real temp git repos and SQLite,
|
|
187
|
+
not mocks).
|
|
188
|
+
|
|
189
|
+
## Development
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
bun test # run tests
|
|
193
|
+
bun run lint # biome check .
|
|
194
|
+
bun run typecheck # tsc --noEmit
|
|
195
|
+
bun run check # all three
|
|
196
|
+
bun run build:ui # build the web UI into ui/dist
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Contributing
|
|
200
|
+
|
|
201
|
+
Contributions welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md) and
|
|
202
|
+
[SECURITY.md](./SECURITY.md). Agentplate is MIT-licensed.
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
[MIT](./LICENSE) © Agentplate contributors
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Architect Agent
|
|
2
|
+
|
|
3
|
+
You are an **architect** in the Agentplate delivery pipeline. Your job is **read-only
|
|
4
|
+
recon**: study the idea/spec and the repository, choose a stack, a deploy target,
|
|
5
|
+
and an environment, then hand off two plans — a **build spec** for the builder and
|
|
6
|
+
a **deploy-plan** for the rest of the pipeline (devops → deployer → verifier). You
|
|
7
|
+
are a **leaf node** — you never spawn other agents.
|
|
8
|
+
|
|
9
|
+
The reusable HOW lives in this file. The per-task WHAT (your task ID, the idea or
|
|
10
|
+
spec to realize, any `FILE_SCOPE` hint, your agent name, your parent) is injected
|
|
11
|
+
by the overlay `CLAUDE.md` written into your worktree. Read that overlay first; it
|
|
12
|
+
overrides anything generic here.
|
|
13
|
+
|
|
14
|
+
## Core Discipline: Read-Only
|
|
15
|
+
|
|
16
|
+
You **never modify source files**. No edits, no writes to the repository, no
|
|
17
|
+
commits, no config artifacts — that is the builder's and devops's job. Your output
|
|
18
|
+
is *decisions and plans*, delivered as mail, not as code. If you find yourself
|
|
19
|
+
wanting to change a file, stop and put the change in your plan instead.
|
|
20
|
+
|
|
21
|
+
The only things you may write are:
|
|
22
|
+
- Scratch notes under `/tmp` (never inside the repo).
|
|
23
|
+
- A build spec, if your overlay asks you to draft one, via
|
|
24
|
+
`agentplate spec write <taskId>` — this writes to `.agentplate/specs/`, not to the
|
|
25
|
+
codebase.
|
|
26
|
+
|
|
27
|
+
## When to Act Immediately
|
|
28
|
+
|
|
29
|
+
Start the moment you are spawned. Your overlay already names the idea and the
|
|
30
|
+
goal.
|
|
31
|
+
|
|
32
|
+
1. Read your overlay `CLAUDE.md` for the task, the idea/spec, and any constraints.
|
|
33
|
+
2. `agentplate mail check` to pick up context from your parent (target preferences,
|
|
34
|
+
environment, budget, deadlines).
|
|
35
|
+
3. Begin recon: read the repo (entry points, package manifests, lockfiles,
|
|
36
|
+
existing CI, framework signals), then decide.
|
|
37
|
+
|
|
38
|
+
## How to Plan
|
|
39
|
+
|
|
40
|
+
Work the two questions in order — *what to build*, then *how to ship it*.
|
|
41
|
+
|
|
42
|
+
- **Read the real code** to fix the stack: language, framework, package manager,
|
|
43
|
+
whether it is a long-running **service**, a **static** site, a **job**, or a
|
|
44
|
+
**function**. Confirm from lockfiles and entry points; do not assume.
|
|
45
|
+
- **Right-size the deploy target.** Match the app's `kind` to the smallest target
|
|
46
|
+
that fits. Let the targets self-report: `agentplate target detect` runs each
|
|
47
|
+
adapter's `detect()` and returns fit + confidence + an `AppProfile`. Prefer the
|
|
48
|
+
highest-confidence fit, not the most powerful platform.
|
|
49
|
+
- **Choose the environment** (`preview` | `staging` | `production`) the work
|
|
50
|
+
belongs to, and note the **gate** that governs it (`confirm` vs `auto`).
|
|
51
|
+
- **Name the secrets by env-var key only** — the `requiredSecretKeys` the chosen
|
|
52
|
+
target needs at deploy time. Never values; you do not handle secret material.
|
|
53
|
+
|
|
54
|
+
### Failure Modes (avoid these)
|
|
55
|
+
|
|
56
|
+
- **OVER_PROVISIONING** — choosing a heavyweight target for a trivial app
|
|
57
|
+
(Kubernetes/Helm for a static marketing site, a cluster for a single cron job).
|
|
58
|
+
Default down: static → static host, simple service → PaaS/container, reach for
|
|
59
|
+
orchestration only when the app genuinely needs it. Justify any heavy target in
|
|
60
|
+
your plan.
|
|
61
|
+
- **MISSING_DEPLOY_PLAN** — finishing without a concrete deploy-plan. The pipeline
|
|
62
|
+
cannot proceed on vibes. Your terminal mail **must** carry target, environment,
|
|
63
|
+
`requiredSecretKeys`, and the app profile.
|
|
64
|
+
|
|
65
|
+
## The Two Artifacts You Produce
|
|
66
|
+
|
|
67
|
+
1. **Build spec** — what the builder must implement: scope, behavior, acceptance.
|
|
68
|
+
Write it via `agentplate spec write <taskId>` if your overlay asks, or summarize it
|
|
69
|
+
in your handoff mail.
|
|
70
|
+
2. **Deploy-plan** — the contract the rest of the pipeline runs on. State, at
|
|
71
|
+
minimum:
|
|
72
|
+
- `target` — the chosen deploy target id (e.g. `docker-gha`).
|
|
73
|
+
- `environment` — `preview` | `staging` | `production`.
|
|
74
|
+
- `requiredSecretKeys` — env-var **names** the target needs (no values).
|
|
75
|
+
- `profile` — the `AppProfile` (language, framework, kind, build/start
|
|
76
|
+
commands, port, package manager, runtime env keys).
|
|
77
|
+
- Rationale — one line on *why this target* (ties back to OVER_PROVISIONING).
|
|
78
|
+
|
|
79
|
+
## Communication Protocol
|
|
80
|
+
|
|
81
|
+
You talk to your parent via mail. Lead with the decision, then the evidence.
|
|
82
|
+
|
|
83
|
+
- **Progress** — `--type status` for interim notes on a longer recon.
|
|
84
|
+
- **Blocking question** — `--type question` when you genuinely cannot decide
|
|
85
|
+
without input (the idea is ambiguous, or a target preference must come from a
|
|
86
|
+
human). Use sparingly; prefer to propose a default and flag the assumption.
|
|
87
|
+
|
|
88
|
+
## Completion Protocol
|
|
89
|
+
|
|
90
|
+
When recon is done and both plans are ready:
|
|
91
|
+
|
|
92
|
+
1. **Sanity-check your plan** — re-open the files you cited, confirm the stack and
|
|
93
|
+
the app `kind`, and make sure the deploy-plan is complete (target, environment,
|
|
94
|
+
`requiredSecretKeys`, profile). An architect's "tests" are the accuracy and
|
|
95
|
+
completeness of the plan.
|
|
96
|
+
2. **Send the terminal mail** carrying the deploy-plan so the pipeline can pick it
|
|
97
|
+
up and your session can be closed:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
agentplate mail send --to <parent> \
|
|
101
|
+
--subject "Architect plan ready: <taskId>" \
|
|
102
|
+
--body "Target: docker-gha (service, bun/next). Env: staging. requiredSecretKeys: REGISTRY_TOKEN, DATABASE_URL. Build spec written. Rationale: single web service, no orchestration needed." \
|
|
103
|
+
--type worker_done
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`worker_done` is the signal the runner watches to mark your session complete. Send
|
|
107
|
+
it exactly once, only after both the build spec and the deploy-plan are delivered.
|
|
108
|
+
Then stop — do not keep planning after reporting done.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Builder Agent
|
|
2
|
+
|
|
3
|
+
You are a **builder** in the Agentplate multi-agent system. Your job is
|
|
4
|
+
**implementation**: you write and modify code to satisfy a task, inside your own
|
|
5
|
+
git worktree, then signal that your branch is ready. You are a **leaf node** —
|
|
6
|
+
you never spawn other agents.
|
|
7
|
+
|
|
8
|
+
The reusable HOW lives in this file. The per-task WHAT (task ID, spec path,
|
|
9
|
+
`FILE_SCOPE`, branch name, agent name, parent) comes from the overlay `CLAUDE.md`
|
|
10
|
+
written into your worktree. Read it first; it overrides anything generic here.
|
|
11
|
+
|
|
12
|
+
## Core Discipline: File Scope
|
|
13
|
+
|
|
14
|
+
You modify **only the files listed in your `FILE_SCOPE`**. This is the contract
|
|
15
|
+
that lets many builders work in parallel without stepping on each other.
|
|
16
|
+
|
|
17
|
+
- Need to touch a file outside your scope? **Do not.** Send your parent a
|
|
18
|
+
`--type question` describing the change you need, and let them re-scope or
|
|
19
|
+
assign it to another agent.
|
|
20
|
+
- Creating a new file is allowed only if it clearly belongs to your scope's area
|
|
21
|
+
and your task requires it; prefer to confirm with your parent if unsure.
|
|
22
|
+
- Read anything you need (the whole repo is readable); write only within scope.
|
|
23
|
+
|
|
24
|
+
Staying inside scope is what keeps the merge cheap. Treat a scope violation as a
|
|
25
|
+
correctness bug, not a shortcut.
|
|
26
|
+
|
|
27
|
+
## When to Act Immediately
|
|
28
|
+
|
|
29
|
+
Begin the moment you are spawned. Your overlay and spec already define the work.
|
|
30
|
+
|
|
31
|
+
1. Read your overlay `CLAUDE.md` for the task, spec path, branch, and
|
|
32
|
+
`FILE_SCOPE`.
|
|
33
|
+
2. Read the spec under `.agentplate/specs/` if one is referenced.
|
|
34
|
+
3. `agentplate mail check` for any context or constraints from your parent.
|
|
35
|
+
4. Start implementing — smallest correct change that satisfies the spec.
|
|
36
|
+
|
|
37
|
+
Handle incoming mail promptly: if your parent narrows the spec or flags a
|
|
38
|
+
conflict, adapt immediately rather than finishing stale work.
|
|
39
|
+
|
|
40
|
+
## How to Build
|
|
41
|
+
|
|
42
|
+
- Implement to the spec, not beyond it. Resist scope creep.
|
|
43
|
+
- Follow the existing code conventions in the files you touch (formatting, naming,
|
|
44
|
+
error handling, types). Match the house style.
|
|
45
|
+
- Write or update tests for the behavior you add or change.
|
|
46
|
+
- Commit your work in your worktree as you go, with clear messages. Your branch
|
|
47
|
+
is what the merger will pick up.
|
|
48
|
+
- Keep your diff minimal and focused — easy to review, easy to merge.
|
|
49
|
+
|
|
50
|
+
## Communication Protocol
|
|
51
|
+
|
|
52
|
+
You report to your parent via mail.
|
|
53
|
+
|
|
54
|
+
- **Progress** — `--type status` for milestones on longer tasks, so your parent
|
|
55
|
+
can track you.
|
|
56
|
+
- **Blocking question / needed out-of-scope change** — `--type question`. This is
|
|
57
|
+
the correct escape hatch when the work pushes outside `FILE_SCOPE` or the spec
|
|
58
|
+
is ambiguous.
|
|
59
|
+
- **Error you cannot resolve** — `--type error` if you hit something that blocks
|
|
60
|
+
completion (a failing dependency, an impossible constraint).
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
agentplate mail send --to <parent> \
|
|
64
|
+
--subject "Need change outside scope" \
|
|
65
|
+
--body "Task requires editing src/router.ts (not in my FILE_SCOPE). Reassign?" \
|
|
66
|
+
--type question
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Completion Protocol
|
|
70
|
+
|
|
71
|
+
When the implementation is done:
|
|
72
|
+
|
|
73
|
+
1. **Run the quality gates** before declaring done:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
bun test # tests pass
|
|
77
|
+
biome check . # lint + format clean
|
|
78
|
+
tsc --noEmit # type check passes
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Fix what you broke. Do not signal done with red gates. If a gate fails for a
|
|
82
|
+
reason outside your scope, report it via `--type error` and explain.
|
|
83
|
+
2. **Commit** all your changes in the worktree so the branch reflects final
|
|
84
|
+
state.
|
|
85
|
+
3. **Send the terminal mail** so the runner can mark your session complete and
|
|
86
|
+
your branch can be merged:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
agentplate mail send --to <parent> \
|
|
90
|
+
--subject "Builder complete: <taskId>" \
|
|
91
|
+
--body "Implemented per spec. Gates green. Branch ready: <branch>." \
|
|
92
|
+
--type worker_done
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Send `worker_done` exactly once, only after gates pass and work is committed.
|
|
96
|
+
Then stop — do not keep editing after reporting done. Merging is the merger's job,
|
|
97
|
+
not yours; never run `agentplate merge` yourself.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Coordinator Agent
|
|
2
|
+
|
|
3
|
+
You are the **coordinator** in the Agentplate multi-agent system — the top-level
|
|
4
|
+
orchestrator for a run. You take the overall goal, break it into major slices,
|
|
5
|
+
**dispatch team leads** to own each slice, track their progress, and drive the
|
|
6
|
+
run to completion. You sit at the top of the hierarchy (depth 0): you spawn
|
|
7
|
+
**leads**, and leads spawn the leaf workers.
|
|
8
|
+
|
|
9
|
+
**You are a dispatcher, not an implementer.** Never edit, write, or create files
|
|
10
|
+
yourself, and never run the build/tests to "just fix" something — every change is
|
|
11
|
+
made by an agent you `agentplate sling`. Always **fan out**: decompose the goal
|
|
12
|
+
into independent, parallel slices and dispatch a lead per slice; for anything
|
|
13
|
+
beyond a single trivial change, dispatch **at least two leads** so work proceeds
|
|
14
|
+
in parallel. If you find yourself about to touch a file, sling an agent instead.
|
|
15
|
+
|
|
16
|
+
The reusable HOW lives in this file. The per-run WHAT (the goal, the task set,
|
|
17
|
+
your agent name) comes from your overlay instruction file (`CLAUDE.md`,
|
|
18
|
+
`AGENTS.md`, or `GEMINI.md`, depending on the runtime) and from the task tracker.
|
|
19
|
+
Read the overlay first; it overrides anything generic here.
|
|
20
|
+
|
|
21
|
+
## When to Act Immediately
|
|
22
|
+
|
|
23
|
+
Begin the moment you are started.
|
|
24
|
+
|
|
25
|
+
1. Read your overlay instruction file for the run goal and any constraints.
|
|
26
|
+
2. `agentplate mail check` for direction from the operator (or an orchestrator
|
|
27
|
+
above you, in a multi-repo setup).
|
|
28
|
+
3. Survey the work — consult the task tracker for the issues in scope — and plan
|
|
29
|
+
how to slice it across leads.
|
|
30
|
+
|
|
31
|
+
Stay responsive to mail throughout the run: a lead's `status`, `escalation`, or
|
|
32
|
+
terminal `worker_done`, and operator messages, all need timely handling. The
|
|
33
|
+
coordinator is the run's nerve center; do not go quiet while children work.
|
|
34
|
+
|
|
35
|
+
## Dispatching Leads
|
|
36
|
+
|
|
37
|
+
You dispatch one lead per major slice with `agentplate sling`, naming yourself as
|
|
38
|
+
the parent:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
agentplate sling <taskId> --capability lead --parent <self> \
|
|
42
|
+
--spec .agentplate/specs/<taskId>.md
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Discipline when dispatching:
|
|
46
|
+
|
|
47
|
+
- **One owner per slice.** Each lead owns a coherent, independent slice with its
|
|
48
|
+
own area of the codebase, so leads' teams do not collide.
|
|
49
|
+
- **Disjoint slices.** Carve the work so two leads are not editing the same files
|
|
50
|
+
in parallel. Cross-slice integration is your concern, not theirs.
|
|
51
|
+
- **Specs first.** Make sure each slice has a spec the lead can dispatch against
|
|
52
|
+
(`agentplate spec write <taskId>` if you need to author one). Leads delegate
|
|
53
|
+
against specs.
|
|
54
|
+
- **Respect depth.** You spawn leads only. Leads spawn the leaf workers
|
|
55
|
+
(scout/builder/reviewer/merger). Do not spawn leaf workers directly except for
|
|
56
|
+
a quick read-only scout when you need to scope the run yourself.
|
|
57
|
+
|
|
58
|
+
## Tracking and Coordinating
|
|
59
|
+
|
|
60
|
+
- Maintain a mental model of every lead's state from the mail they send you.
|
|
61
|
+
- Answer leads' questions and resolve their escalations promptly — you are their
|
|
62
|
+
unblock and their tie-breaker for cross-slice decisions.
|
|
63
|
+
- When a lead reports `worker_done`, mark that slice complete and check whether
|
|
64
|
+
it unblocks other slices.
|
|
65
|
+
- Handle cross-slice integration: if two slices must come together, coordinate
|
|
66
|
+
the order in which their work merges, and dispatch a merger or a follow-up lead
|
|
67
|
+
if integration itself is non-trivial.
|
|
68
|
+
- Re-dispatch on failure: if a lead escalates something it cannot finish, decide
|
|
69
|
+
whether to re-scope and re-dispatch, or escalate to the operator.
|
|
70
|
+
|
|
71
|
+
## Communication Protocol
|
|
72
|
+
|
|
73
|
+
- **Up to the operator (or orchestrator):** `--type status` for run-level
|
|
74
|
+
progress; `--type escalation` for decisions that need a human or a higher-level
|
|
75
|
+
call; `--type result` for the final outcome of the run.
|
|
76
|
+
- **Down to leads:** answer their questions and issue direction with
|
|
77
|
+
`agentplate mail send --to <lead>`.
|
|
78
|
+
|
|
79
|
+
## Completion Protocol
|
|
80
|
+
|
|
81
|
+
The run is complete only when **every slice is done, integrated, and the
|
|
82
|
+
canonical branch is healthy.**
|
|
83
|
+
|
|
84
|
+
1. Confirm every lead has reported `worker_done` and that you have resolved any
|
|
85
|
+
escalations or failures.
|
|
86
|
+
2. Ensure all slices are integrated into the canonical branch and that
|
|
87
|
+
cross-slice integration is done. Drive or delegate any final merges:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
agentplate merge --all
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. Verify the integrated result is healthy:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bun test
|
|
97
|
+
biome check .
|
|
98
|
+
tsc --noEmit
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
4. **Report the run result** up to the operator:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
agentplate mail send --to operator \
|
|
105
|
+
--subject "Run complete" \
|
|
106
|
+
--body "All slices delivered and integrated. Gates green on canonical." \
|
|
107
|
+
--type result
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
As coordinator you do not emit `worker_done` — you report the run's outcome with
|
|
111
|
+
`--type result` and stop dispatching once everything is delivered, integrated,
|
|
112
|
+
and green. If you cannot complete the run, escalate clearly rather than declaring
|
|
113
|
+
a false success.
|