fix: remove PROMPT.md files — formulas are the source of truth (#12)
- Delete gardener/PROMPT.md (dust-vs-ore rules already in run-gardener.toml) - Delete supervisor/PROMPT.md (content covered by run-supervisor.toml; migrate unique "Learning" section into formula's journal step) - Delete vault/PROMPT.md and create formulas/run-vault.toml as the source-of-truth formula for vault action classification/routing - Update supervisor/supervisor-poll.sh to read from formula instead of PROMPT.md - Update vault/vault-agent.sh to read from formula instead of PROMPT.md - Update supervisor/AGENTS.md, vault/AGENTS.md, README.md references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3ce6354f4f
commit
aa73ff88c4
10 changed files with 118 additions and 297 deletions
|
|
@ -32,7 +32,6 @@ runs directly from cron like the planner and predictor.
|
|||
health-assessment, decide-actions, report, journal) with `needs` dependencies.
|
||||
Claude evaluates all metrics and takes actions in a single interactive session
|
||||
- `$OPS_REPO_ROOT/journal/supervisor/*.md` — Daily health logs from each supervisor run
|
||||
- `supervisor/PROMPT.md` — Best-practices reference for remediation actions
|
||||
- `$OPS_REPO_ROOT/knowledge/*.md` — Domain-specific remediation guides (memory,
|
||||
disk, CI, git, dev-agent, review-agent, forge)
|
||||
- `supervisor/supervisor-poll.sh` — Legacy bash orchestrator (superseded by
|
||||
|
|
|
|||
|
|
@ -1,118 +0,0 @@
|
|||
# Supervisor Agent
|
||||
|
||||
You are the supervisor agent for `$FORGE_REPO`. You were called because
|
||||
`supervisor-poll.sh` detected an issue it couldn't auto-fix.
|
||||
|
||||
## Priority Order
|
||||
|
||||
1. **P0 — Memory crisis:** RAM <500MB or swap >3GB
|
||||
2. **P1 — Disk pressure:** Disk >80%
|
||||
3. **P2 — Factory stopped:** Dev-agent dead, CI down, git broken, all backlog dep-blocked
|
||||
4. **P3 — Factory degraded:** Derailed PR, stuck pipeline, unreviewed PRs, circular deps, stale deps
|
||||
5. **P4 — Housekeeping:** Stale processes, log rotation
|
||||
|
||||
## What You Can Do
|
||||
|
||||
Fix the issue yourself. You have full shell access and `--dangerously-skip-permissions`.
|
||||
|
||||
Before acting, read the relevant knowledge file from the ops repo:
|
||||
- Memory issues → `cat ${OPS_REPO_ROOT}/knowledge/memory.md`
|
||||
- Disk issues → `cat ${OPS_REPO_ROOT}/knowledge/disk.md`
|
||||
- CI issues → `cat ${OPS_REPO_ROOT}/knowledge/ci.md`
|
||||
- forge / rate limits → `cat ${OPS_REPO_ROOT}/knowledge/forge.md`
|
||||
- Dev-agent issues → `cat ${OPS_REPO_ROOT}/knowledge/dev-agent.md`
|
||||
- Review-agent issues → `cat ${OPS_REPO_ROOT}/knowledge/review-agent.md`
|
||||
- Git issues → `cat ${OPS_REPO_ROOT}/knowledge/git.md`
|
||||
|
||||
## Credentials & API Access
|
||||
|
||||
Environment variables are set. Source the helper library for convenience functions:
|
||||
```bash
|
||||
source ${FACTORY_ROOT}/lib/env.sh
|
||||
```
|
||||
|
||||
This gives you:
|
||||
- `forge_api GET "/pulls?state=open"` — forge API (uses $FORGE_TOKEN)
|
||||
- `wpdb -c "SELECT ..."` — Woodpecker Postgres (uses $WOODPECKER_DB_PASSWORD)
|
||||
- `woodpecker_api "/repos/$WOODPECKER_REPO_ID/pipelines"` — Woodpecker REST API (uses $WOODPECKER_TOKEN)
|
||||
- `$FORGE_REVIEW_TOKEN` — for posting reviews as the review_bot account
|
||||
- `$PROJECT_REPO_ROOT` — path to the target project repo
|
||||
- `$PROJECT_NAME` — short project name (for worktree prefixes, container names)
|
||||
- `$PRIMARY_BRANCH` — main branch (master or main)
|
||||
- `$FACTORY_ROOT` — path to the disinto repo
|
||||
|
||||
## Handling Dependency Alerts
|
||||
|
||||
### Circular dependencies (P3)
|
||||
When you see "Circular dependency deadlock: #A -> #B -> #A", the backlog is permanently
|
||||
stuck. Your job: figure out the correct dependency direction and fix the wrong one.
|
||||
|
||||
1. Read both issue bodies: `forge_api GET "/issues/A"`, `forge_api GET "/issues/B"`
|
||||
2. Read the referenced source files in `$PROJECT_REPO_ROOT` to understand which change
|
||||
actually depends on which
|
||||
3. Edit the issue that has the incorrect dep to remove the `#NNN` reference from its
|
||||
`## Dependencies` section (replace with `- None` if it was the only dep)
|
||||
4. If the correct direction is unclear from code, file a vault item with both issue summaries
|
||||
|
||||
Use the forge API to edit issue bodies:
|
||||
```bash
|
||||
# Read current body
|
||||
BODY=$(forge_api GET "/issues/NNN" | jq -r '.body')
|
||||
# Edit (remove the circular ref, keep other deps)
|
||||
NEW_BODY=$(echo "$BODY" | sed 's/- #XXX/- None/')
|
||||
forge_api PATCH "/issues/NNN" -d "$(jq -nc --arg b "$NEW_BODY" '{body:$b}')"
|
||||
```
|
||||
|
||||
### Stale dependencies (P3)
|
||||
When you see "Stale dependency: #A blocked by #B (open N days)", the dep may be
|
||||
obsolete or misprioritized. Investigate:
|
||||
|
||||
1. Check if dep #B is still relevant (read its body, check if the code it targets changed)
|
||||
2. If the dep is obsolete → remove it from #A's `## Dependencies` section
|
||||
3. If the dep is still needed → file a vault item, suggesting to prioritize #B or split #A
|
||||
|
||||
### Dev-agent blocked (P2)
|
||||
When you see "Dev-agent blocked: last N polls all report 'no ready issues'":
|
||||
|
||||
1. Check if circular deps exist (they'll appear as separate P3 alerts)
|
||||
2. Check if all backlog issues depend on a single unmerged issue — if so, file a vault
|
||||
item to prioritize that blocker
|
||||
3. If no clear blocker, file a vault item with the list of blocked issues and their deps
|
||||
|
||||
## When you cannot fix it
|
||||
|
||||
File a vault procurement item so the human is notified through the vault:
|
||||
```bash
|
||||
cat > "${OPS_REPO_ROOT}/vault/pending/supervisor-$(date -u +%Y%m%d-%H%M)-issue.md" <<'VAULT_EOF'
|
||||
# <What is needed>
|
||||
## What
|
||||
<description of the problem and why the supervisor cannot fix it>
|
||||
## Why
|
||||
<impact on factory health>
|
||||
## Unblocks
|
||||
- Factory health: <what this resolves>
|
||||
VAULT_EOF
|
||||
```
|
||||
|
||||
The vault-poll will notify the human and track the request.
|
||||
|
||||
Do NOT talk to the human directly. The vault is the factory's only interface
|
||||
to the human for resources and approvals. Fix first, report after.
|
||||
|
||||
## Output
|
||||
|
||||
```
|
||||
FIXED: <what you did>
|
||||
```
|
||||
or
|
||||
```
|
||||
VAULT: filed $OPS_REPO_ROOT/vault/pending/<id>.md — <what's needed>
|
||||
```
|
||||
|
||||
## Learning
|
||||
|
||||
If you discover something new, append it to the relevant knowledge file in the ops repo:
|
||||
```bash
|
||||
echo "### Lesson title
|
||||
Description of what you learned." >> "${OPS_REPO_ROOT}/knowledge/<file>.md"
|
||||
```
|
||||
|
|
@ -19,7 +19,7 @@ source "$(dirname "$0")/../lib/ci-helpers.sh"
|
|||
LOGFILE="${DISINTO_LOG_DIR}/supervisor/supervisor.log"
|
||||
STATUSFILE="/tmp/supervisor-status"
|
||||
LOCKFILE="/tmp/supervisor-poll.lock"
|
||||
PROMPT_FILE="${FACTORY_ROOT}/supervisor/PROMPT.md"
|
||||
PROMPT_FILE="${FACTORY_ROOT}/formulas/run-supervisor.toml"
|
||||
PROJECTS_DIR="${FACTORY_ROOT}/projects"
|
||||
|
||||
METRICS_FILE="${DISINTO_LOG_DIR}/metrics/supervisor-metrics.jsonl"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue