2026-03-25 12:07:39 +00:00
|
|
|
<!-- last-reviewed: d13f1a6997a3f5a2c9a51fea3fb18ab75f161d7b -->
|
2026-03-21 12:44:23 +00:00
|
|
|
# Planner Agent
|
|
|
|
|
|
2026-03-21 18:28:38 +00:00
|
|
|
**Role**: Strategic planning using a Prerequisite Tree (Theory of Constraints),
|
|
|
|
|
executed directly from cron via tmux + Claude.
|
|
|
|
|
Phase 0 (preflight): pull latest code, load persistent memory and prerequisite
|
2026-03-22 12:07:31 +00:00
|
|
|
tree from `planner/MEMORY.md` and `planner/prerequisite-tree.md`. Also reads
|
|
|
|
|
all available formulas: factory formulas (`$FACTORY_ROOT/formulas/*.toml`) and
|
|
|
|
|
project-specific formulas (`$PROJECT_REPO_ROOT/formulas/*.toml`). Phase 1
|
2026-03-21 18:28:38 +00:00
|
|
|
(prediction-triage): triage `prediction/unreviewed` issues filed by the
|
2026-03-25 17:16:13 +00:00
|
|
|
Predictor — for each prediction: action (create issue, relabel to
|
|
|
|
|
prediction/actioned, close) or dismiss (comment reason, relabel to
|
|
|
|
|
prediction/dismissed, close). No fence-sitting — dismissed predictions get
|
|
|
|
|
re-filed by the predictor with stronger evidence if still valid. Phase 2
|
2026-03-21 18:28:38 +00:00
|
|
|
(update-prerequisite-tree): scan repo state + open/closed issues, mark resolved
|
2026-03-23 12:47:32 +00:00
|
|
|
prerequisites, discover new ones, update the tree. **Also scans comments on
|
|
|
|
|
referenced issues for bounce/stuck signals** (BOUNCED, ESCALATED, LABEL_CHURN)
|
|
|
|
|
to detect issues ping-ponging between backlog and underspecified. Phase 3
|
2026-03-21 18:28:38 +00:00
|
|
|
(file-at-constraints): identify the top 3 unresolved prerequisites that block
|
2026-03-23 12:47:32 +00:00
|
|
|
the most downstream objectives — file issues as either `backlog` (code changes,
|
|
|
|
|
dev-agent) or `action` (run existing formula, action-agent). **Stuck issues
|
|
|
|
|
(detected BOUNCED/LABEL_CHURN) are dispatched to the `groom-backlog` formula
|
|
|
|
|
in breakdown mode instead of being re-promoted** — this breaks the ping-pong
|
|
|
|
|
loop by splitting them into dev-agent-sized sub-issues.
|
2026-03-22 12:36:19 +00:00
|
|
|
Phase 4 (journal-and-memory): write updated prerequisite tree + daily journal
|
2026-03-22 12:07:31 +00:00
|
|
|
entry (committed to git) and update `planner/MEMORY.md` (committed to git).
|
2026-03-22 12:36:19 +00:00
|
|
|
Phase 5 (commit-and-pr): one commit with all file changes, push, create PR.
|
2026-03-22 12:07:31 +00:00
|
|
|
AGENTS.md maintenance is handled by the Gardener.
|
|
|
|
|
|
|
|
|
|
**Artifacts use `$PROJECT_REPO_ROOT`**: All planner artifacts (journal,
|
|
|
|
|
prerequisite tree, memory, vault state) live under `$PROJECT_REPO_ROOT/planner/`
|
|
|
|
|
and `$PROJECT_REPO_ROOT/vault/`, not `$FACTORY_ROOT`. Each project manages its
|
|
|
|
|
own planner state independently.
|
2026-03-21 12:44:23 +00:00
|
|
|
|
2026-03-21 16:02:29 +00:00
|
|
|
**Trigger**: `planner-run.sh` runs daily via cron (accepts an optional project
|
2026-03-25 00:07:52 +00:00
|
|
|
TOML argument, defaults to `projects/disinto.toml`). Sources `lib/guard.sh` and
|
|
|
|
|
calls `check_active planner` first — skips if `$FACTORY_ROOT/state/.planner-active`
|
|
|
|
|
is absent. Then creates a tmux session with `claude --model opus`, injects
|
|
|
|
|
`formulas/run-planner.toml` as context, monitors the phase file, and cleans up
|
|
|
|
|
on completion or timeout. No action issues — the planner is a nervous system
|
|
|
|
|
component, not work.
|
2026-03-21 12:44:23 +00:00
|
|
|
|
|
|
|
|
**Key files**:
|
|
|
|
|
- `planner/planner-run.sh` — Cron wrapper + orchestrator: lock, memory guard,
|
|
|
|
|
sources disinto project config, creates tmux session, injects formula prompt,
|
|
|
|
|
monitors phase file, handles crash recovery, cleans up
|
2026-03-21 18:28:38 +00:00
|
|
|
- `formulas/run-planner.toml` — Execution spec: six steps (preflight,
|
|
|
|
|
prediction-triage, update-prerequisite-tree, file-at-constraints,
|
|
|
|
|
journal-and-memory, commit-and-pr) with `needs` dependencies. Claude
|
|
|
|
|
executes all steps in a single interactive session with tool access
|
2026-03-23 12:47:32 +00:00
|
|
|
- `formulas/groom-backlog.toml` — Dual-mode formula: grooming (default) or
|
|
|
|
|
breakdown (dispatched by planner for bounced/stuck issues — splits the issue
|
|
|
|
|
into dev-agent-sized sub-issues, removes `underspecified` label)
|
2026-03-21 18:28:38 +00:00
|
|
|
- `planner/prerequisite-tree.md` — Prerequisite tree: versioned constraint
|
|
|
|
|
map linking VISION.md objectives to their prerequisites. Planner owns the
|
|
|
|
|
tree, humans steer by editing VISION.md. Tree grows organically as the
|
|
|
|
|
planner discovers new prerequisites during runs
|
2026-03-21 12:44:23 +00:00
|
|
|
- `planner/MEMORY.md` — Persistent memory across runs (committed to git)
|
|
|
|
|
- `planner/journal/*.md` — Daily raw logs from each planner run (committed to git)
|
|
|
|
|
|
2026-03-21 18:28:38 +00:00
|
|
|
**Constraint focus**: The planner uses Theory of Constraints to avoid premature
|
|
|
|
|
issue filing. Only the top 3 unresolved prerequisites that block the most
|
|
|
|
|
downstream objectives get filed as issues. Everything else exists in the
|
|
|
|
|
prerequisite tree but NOT as issues. This prevents the "spray issues across
|
|
|
|
|
all milestones" pattern that produced premature work in planner v1/v2.
|
2026-03-21 12:44:23 +00:00
|
|
|
|
|
|
|
|
**Environment variables consumed**:
|
fix: Replace Codeberg dependency with local Forgejo instance (#611)
- Add setup_forge() to bin/disinto: provisions Forgejo via Docker,
creates admin + bot users (dev-bot, review-bot), generates API
tokens, creates repo, and pushes code — all automated
- Rename env vars: CODEBERG_TOKEN→FORGE_TOKEN, REVIEW_BOT_TOKEN→
FORGE_REVIEW_TOKEN, CODEBERG_REPO→FORGE_REPO, CODEBERG_API→
FORGE_API, CODEBERG_WEB→FORGE_WEB, CODEBERG_BOT_USERNAMES→
FORGE_BOT_USERNAMES (with backwards-compat fallbacks)
- Rename API helpers: codeberg_api()→forge_api(), codeberg_api_all()
→forge_api_all() (with compat aliases)
- Add forge_url field to project TOML; load-project.sh derives
FORGE_API/FORGE_WEB from forge_url + repo
- Update parse_repo_slug() to accept any host URL, not just codeberg
- Forgejo data stored under ~/.disinto/forgejo/ (not in factory repo)
- Update all 58 files: agent scripts, formulas, docs, site HTML
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:57:12 +00:00
|
|
|
- `FORGE_TOKEN`, `FORGE_REPO`, `FORGE_API`, `PROJECT_NAME`, `PROJECT_REPO_ROOT`
|
2026-03-21 12:44:23 +00:00
|
|
|
- `PRIMARY_BRANCH`, `CLAUDE_MODEL` (set to opus by planner-run.sh)
|
|
|
|
|
- `MATRIX_TOKEN`, `MATRIX_ROOM_ID`, `MATRIX_HOMESERVER`
|