Add Docker atomic deploy tooling, CI, Playwright smoke/visual suite, shared industrial theme, physics invariants, quality-mode wiring, and a worktree-isolated agent implementer MVP with hard safety limits. Co-authored-by: Cursor <cursoragent@cursor.com>
3.3 KiB
3.3 KiB
Implementer MVP (worktree-isolated)
Status: Implemented in agent/cli.mjs
Date: 2026-07-15
Safe, deterministic Implementer cycle that does not require an external LLM.
Patches run only inside a git worktree. The agent never merges to main, never deploys, and never pushes.
Commands
| Command | Purpose |
|---|---|
dry-run |
Plan only (baseline + propose) |
run-once |
Verify baseline only (no patches) |
implement [--task <path>] |
Full Implementer cycle |
start |
Same as implement, but requires AUTONOMOUS_AGENT_ENABLED=true |
status / stop / resume / pause / report |
Control plane |
# Recommended successful demo cycle
node agent/cli.mjs implement --task agent/tasks/demo-docs.json
# Or via helper script
bash scripts/agent-implement.sh --task agent/tasks/demo-docs.json
# Gated continuous entry (still one cycle in MVP)
AUTONOMOUS_AGENT_ENABLED=true node agent/cli.mjs start --task agent/tasks/demo-docs.json
Implementer cycle
- Watchdog — kill switch, single lock, disk, load, memory
- Plan — load task JSON (default:
agent/tasks/demo-docs.json) - Validate policy — allowlist only:
docs,tests,data-testid,a11y,small-ui,logging-scripts - Create worktree —
.agent/worktrees/<run-id>on branchagent/<run-id>/<task-slug> - Apply bounded patch — e.g. create
docs/AGENT_CYCLE_DEMO.md - Enforce limits — ≤12 files, ≤800 diff lines, ≤25 min cycle
- Verify —
npm test && npm run buildinside the worktree - Score + decide —
ACCEPT_CANDIDATEorREJECT - Report —
agent/reports/<run-id>.json(+latest.json)
On REJECT
- Remove worktree
- Delete local agent branch
- Keep the JSON report
On ACCEPT_CANDIDATE
- Keep worktree + branch
- Print manual review instructions
- Human must cherry-pick / merge into a feature branch if desired
Watchdog
| Check | Fail condition |
|---|---|
| Lock | agent/state/agent.lock held by a live PID (second agent refused) |
| Kill switch | agent/state/KILL present |
| Disk | df / usage > 85% |
| Load | loadavg 1m > nproc |
| Memory | MemAvailable < 1 GiB |
node agent/cli.mjs stop # write KILL
node agent/cli.mjs resume # clear KILL
node agent/cli.mjs status # lock + watchdog snapshot
Example task
agent/tasks/demo-docs.json — docs-only safe demo:
- Policy:
docs - Patch: create
docs/AGENT_CYCLE_DEMO.md - No source / physics / deploy /
.envchanges
Limits (also in LIMITS in cli.mjs)
| Limit | Value |
|---|---|
| max cycle | 25 min |
| max files | 12 |
| max diff lines | 800 |
| parallel agents | 1 |
Hard forbids: merge to main, production deploy, push, secret/.env access.
Manual review after ACCEPT
# Inspect
cat agent/reports/latest.json
git -C .agent/worktrees/<run-id> show HEAD
# Accept into your feature branch yourself (example)
git cherry-pick <agent-commit-sha>
# Or discard
git worktree remove --force .agent/worktrees/<run-id>
git branch -D agent/<run-id>/demo-docs
What this MVP does not do
- Call external LLMs
- Modify production nginx/docker/deploy
- Touch
.env - Auto-merge or auto-deploy
- Change demo physics (prefer docs-only demo task)