2026-03-26 06:06:51 +00:00
|
|
|
<!-- last-reviewed: 043bf0f0217aef3f319b844f1a1277acd6327a1c -->
|
2026-03-21 12:44:23 +00:00
|
|
|
# Gardener Agent
|
|
|
|
|
|
|
|
|
|
**Role**: Backlog grooming — detect duplicate issues, missing acceptance
|
2026-03-21 18:07:37 +00:00
|
|
|
criteria, oversized issues, stale issues, and circular dependencies. Enforces
|
|
|
|
|
the quality gate: strips the `backlog` label from issues that lack acceptance
|
|
|
|
|
criteria checkboxes (`- [ ]`) or an `## Affected files` section. Invokes
|
2026-03-21 12:44:23 +00:00
|
|
|
Claude to fix or escalate to a human via Matrix.
|
|
|
|
|
|
2026-03-25 00:07:52 +00:00
|
|
|
**Trigger**: `gardener-run.sh` runs 4x/day via cron. Sources `lib/guard.sh` and
|
|
|
|
|
calls `check_active gardener` first — skips if `$FACTORY_ROOT/state/.gardener-active`
|
|
|
|
|
is absent. Then creates a tmux session with `claude --model sonnet`, injects
|
|
|
|
|
`formulas/run-gardener.toml` with escalation replies as context, monitors the
|
|
|
|
|
phase file, and cleans up on completion or timeout (2h max session). No action
|
|
|
|
|
issues — the gardener runs directly from cron like the planner, predictor, and
|
|
|
|
|
supervisor.
|
2026-03-21 12:44:23 +00:00
|
|
|
|
|
|
|
|
**Key files**:
|
fix: gardener migration — run-gardener.toml via direct cron, remove legacy scripts (#490)
Rewrite gardener-run.sh as direct cron runner (matching supervisor/planner/
predictor pattern): lock guard, memory check, worktree, tmux session with
Claude sonnet + formulas/run-gardener.toml, phase monitoring, cleanup.
- Delete gardener-poll.sh and gardener-agent.sh (superseded)
- Extract consume_escalation_reply() to lib/formula-session.sh (shared
by gardener and supervisor, eliminates duplicate blocks)
- Update AGENTS.md, gardener/AGENTS.md, lib/AGENTS.md, CI smoke test,
and cross-references
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:09:17 +00:00
|
|
|
- `gardener/gardener-run.sh` — Cron wrapper + orchestrator: lock, memory guard,
|
|
|
|
|
consumes escalation replies, sources disinto project config, creates tmux session,
|
2026-03-23 00:11:06 +00:00
|
|
|
injects formula prompt, monitors phase file via custom `_gardener_on_phase_change`
|
|
|
|
|
callback (passed to `run_formula_and_monitor`). Kills session on `PHASE:escalate`
|
|
|
|
|
to prevent zombies. Stays alive through CI/review/merge cycle after `PHASE:awaiting_ci`
|
|
|
|
|
— injects CI results and review feedback, re-signals `PHASE:awaiting_ci` after
|
|
|
|
|
fixes, signals `PHASE:awaiting_review` on CI pass. Executes pending-actions
|
|
|
|
|
manifest after PR merge.
|
2026-03-21 12:44:23 +00:00
|
|
|
- `formulas/run-gardener.toml` — Execution spec: preflight, grooming, dust-bundling, blocked-review, agents-update, commit-and-pr
|
2026-03-22 23:58:50 +00:00
|
|
|
- `gardener/pending-actions.json` — Manifest of deferred repo actions (label changes,
|
|
|
|
|
closures, comments, issue creation). Written during grooming steps, committed to the
|
|
|
|
|
PR, reviewed alongside AGENTS.md changes, executed by gardener-run.sh after merge.
|
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`
|
fix: gardener migration — run-gardener.toml via direct cron, remove legacy scripts (#490)
Rewrite gardener-run.sh as direct cron runner (matching supervisor/planner/
predictor pattern): lock guard, memory check, worktree, tmux session with
Claude sonnet + formulas/run-gardener.toml, phase monitoring, cleanup.
- Delete gardener-poll.sh and gardener-agent.sh (superseded)
- Extract consume_escalation_reply() to lib/formula-session.sh (shared
by gardener and supervisor, eliminates duplicate blocks)
- Update AGENTS.md, gardener/AGENTS.md, lib/AGENTS.md, CI smoke test,
and cross-references
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:09:17 +00:00
|
|
|
- `PRIMARY_BRANCH`, `CLAUDE_MODEL` (set to sonnet by gardener-run.sh)
|
2026-03-21 12:44:23 +00:00
|
|
|
- `MATRIX_TOKEN`, `MATRIX_ROOM_ID`, `MATRIX_HOMESERVER`
|
fix: gardener migration — run-gardener.toml via direct cron, remove legacy scripts (#490)
Rewrite gardener-run.sh as direct cron runner (matching supervisor/planner/
predictor pattern): lock guard, memory check, worktree, tmux session with
Claude sonnet + formulas/run-gardener.toml, phase monitoring, cleanup.
- Delete gardener-poll.sh and gardener-agent.sh (superseded)
- Extract consume_escalation_reply() to lib/formula-session.sh (shared
by gardener and supervisor, eliminates duplicate blocks)
- Update AGENTS.md, gardener/AGENTS.md, lib/AGENTS.md, CI smoke test,
and cross-references
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:09:17 +00:00
|
|
|
|
2026-03-25 00:07:52 +00:00
|
|
|
**Lifecycle**: gardener-run.sh (cron 0,6,12,18) → `check_active gardener` → lock + memory guard →
|
fix: gardener migration — run-gardener.toml via direct cron, remove legacy scripts (#490)
Rewrite gardener-run.sh as direct cron runner (matching supervisor/planner/
predictor pattern): lock guard, memory check, worktree, tmux session with
Claude sonnet + formulas/run-gardener.toml, phase monitoring, cleanup.
- Delete gardener-poll.sh and gardener-agent.sh (superseded)
- Extract consume_escalation_reply() to lib/formula-session.sh (shared
by gardener and supervisor, eliminates duplicate blocks)
- Update AGENTS.md, gardener/AGENTS.md, lib/AGENTS.md, CI smoke test,
and cross-references
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:09:17 +00:00
|
|
|
consume escalation replies → load formula + context → create tmux session →
|
2026-03-22 23:58:50 +00:00
|
|
|
Claude grooms backlog (writes proposed actions to manifest), bundles dust,
|
|
|
|
|
reviews blocked issues, updates AGENTS.md, commits manifest + docs to PR →
|
2026-03-23 00:11:06 +00:00
|
|
|
`PHASE:awaiting_ci` (stays alive) → CI pass → `PHASE:awaiting_review` →
|
|
|
|
|
review feedback → address + re-signal → merge → gardener-run.sh executes
|
|
|
|
|
manifest actions via API → `PHASE:done`. On `PHASE:escalate`: session killed
|
|
|
|
|
immediately.
|