2026-03-26 18:14:35 +00:00
<!-- last - reviewed: f32707ba659de278a3af434e3549fb8a8dce9d3a -->
2026-03-17 18:53:15 +00:00
# Disinto — Agent Instructions
## What this repo is
2026-03-26 10:36:27 +01:00
Disinto is an autonomous code factory. It manages eight agents (dev, review,
gardener, supervisor, planner, predictor, action, vault) that pick up issues from forge,
2026-03-18 03:41:46 +00:00
implement them, review PRs, plan from the vision, gate dangerous actions, and
2026-03-26 10:36:27 +01:00
keep the system healthy — all via cron and `claude -p` .
2026-03-17 18:53:15 +00:00
See `README.md` for the full architecture and `BOOTSTRAP.md` for setup.
## Directory layout
```
fix: {project}-ops repo — separate operations from code (#757) (#767)
Fixes #757
## Changes
Separate operations from code into {project}-ops repo pattern. Added OPS_REPO_ROOT infrastructure (env.sh, load-project.sh, formula-session.sh with ensure_ops_repo helper). Updated all 8 agent scripts and 7 formulas to read/write vault items, journals, evidence, prerequisites, RESOURCES.md, and knowledge from the ops repo. Added setup_ops_repo() to disinto init for automatic ops repo creation and seeding. Removed migrated data from code repo (vault data dirs, planner journal/memory/prerequisites, supervisor journal/best-practices, evidence, RESOURCES.md). Updated all documentation. 55 files changed, ShellCheck clean, all 38 phase tests pass.
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/disinto/pulls/767
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-26 19:55:12 +01:00
disinto/ (code repo)
2026-03-20 00:35:05 +00:00
├── dev/ dev-poll.sh, dev-agent.sh, phase-handler.sh — issue implementation
2026-03-17 18:53:15 +00:00
├── review/ review-poll.sh, review-pr.sh — PR review
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 — direct cron executor for run-gardener formula
2026-03-20 18:00:21 +00:00
├── predictor/ predictor-run.sh — daily cron executor for run-predictor formula
2026-03-20 13:40:09 +00:00
├── planner/ planner-run.sh — direct cron executor for run-planner formula
2026-03-21 00:22:37 +00:00
├── supervisor/ supervisor-run.sh — formula-driven health monitoring (cron wrapper)
│ preflight.sh — pre-flight data collection for supervisor formula
│ supervisor-poll.sh — legacy bash orchestrator (superseded)
2026-03-21 18:49:31 +00:00
├── vault/ vault-poll.sh, vault-agent.sh, vault-fire.sh — action gating + procurement
2026-03-19 07:25:25 +00:00
├── action/ action-poll.sh, action-agent.sh — operational task execution
2026-03-27 19:06:31 +00:00
├── lib/ env.sh, agent-session.sh, ci-helpers.sh, ci-debug.sh, load-project.sh, parse-deps.sh, guard.sh, mirrors.sh, pr-lifecycle.sh, issue-lifecycle.sh, worktree.sh, build-graph.py
2026-03-22 16:06:31 +00:00
├── projects/ *.toml.example — templates; * .toml — local per-box config (gitignored)
2026-03-20 16:50:58 +00:00
├── formulas/ Issue templates (TOML specs for multi-step agent tasks)
2026-03-19 07:05:40 +00:00
└── docs/ Protocol docs (PHASE-PROTOCOL.md, EVIDENCE-ARCHITECTURE.md)
fix: {project}-ops repo — separate operations from code (#757) (#767)
Fixes #757
## Changes
Separate operations from code into {project}-ops repo pattern. Added OPS_REPO_ROOT infrastructure (env.sh, load-project.sh, formula-session.sh with ensure_ops_repo helper). Updated all 8 agent scripts and 7 formulas to read/write vault items, journals, evidence, prerequisites, RESOURCES.md, and knowledge from the ops repo. Added setup_ops_repo() to disinto init for automatic ops repo creation and seeding. Removed migrated data from code repo (vault data dirs, planner journal/memory/prerequisites, supervisor journal/best-practices, evidence, RESOURCES.md). Updated all documentation. 55 files changed, ShellCheck clean, all 38 phase tests pass.
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/disinto/pulls/767
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-26 19:55:12 +01:00
disinto-ops/ (ops repo — {project}-ops)
├── vault/
│ ├── pending/ vault items awaiting approval
│ ├── approved/ approved vault items
│ ├── fired/ executed vault items
│ └── rejected/ rejected vault items
├── journal/
│ ├── planner/ daily planning logs
│ └── supervisor/ operational health logs
├── knowledge/ shared agent knowledge + best practices
├── evidence/ engagement data, experiment results
├── portfolio.md addressables + observables
├── prerequisites.md dependency graph
└── RESOURCES.md accounts, tokens (refs), infra inventory
2026-03-17 18:53:15 +00:00
```
2026-03-20 16:50:58 +00:00
> **Terminology note:** "Formulas" in this repo are TOML issue templates in `formulas/` that
> orchestrate multi-step agent tasks (e.g., `run-gardener.toml`, `run-planner.toml`). This is
> distinct from "processes" described in `docs/EVIDENCE-ARCHITECTURE.md`, which are measurement
> and mutation pipelines that read external platforms and write structured evidence to git.
2026-03-17 18:53:15 +00:00
## Tech stack
- **Shell**: bash (all agents are bash scripts)
- **AI**: `claude -p` (one-shot) or `claude` (interactive/tmux sessions)
- **CI**: Woodpecker CI (queried via REST API + Postgres)
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
- **VCS**: Forgejo (git + Gitea-compatible REST API)
fix: Remove Matrix integration — notifications move to forge + OpenClaw (#732)
Remove all Matrix/Dendrite infrastructure:
- Delete lib/matrix_listener.sh (long-poll daemon), lib/matrix_listener.service
(systemd unit), lib/hooks/on-stop-matrix.sh (response streaming hook)
- Remove matrix_send() and matrix_send_ctx() from lib/env.sh
- Remove MATRIX_HOMESERVER auto-detection, MATRIX_THREAD_MAP from lib/env.sh
- Remove [matrix] section parsing from lib/load-project.sh
- Remove Matrix hook installation from lib/agent-session.sh
- Remove notify/notify_ctx helpers and Matrix thread tracking from
dev/dev-agent.sh and action/action-agent.sh
- Remove all matrix_send calls from dev-poll.sh, phase-handler.sh,
action-poll.sh, vault-poll.sh, vault-fire.sh, vault-reject.sh,
review-poll.sh, review-pr.sh, supervisor-poll.sh, formula-session.sh
- Remove Matrix listener startup from docker/agents/entrypoint.sh
- Remove append_dendrite_compose() and setup_matrix() from bin/disinto
- Remove --matrix flag from disinto init
- Clean Matrix references from .env.example, projects/*.toml.example,
formulas/*.toml, AGENTS.md, BOOTSTRAP.md, README.md, RESOURCES.md,
PHASE-PROTOCOL.md, and all agent AGENTS.md/PROMPT.md files
Status visibility now via Codeberg PR/issue activity. Human interaction
via vault items through forge. Proactive alerts via OpenClaw heartbeats.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:53:56 +00:00
- **Notifications**: Forge activity (PR/issue comments), OpenClaw heartbeats
2026-03-17 18:53:15 +00:00
## Coding conventions
- All scripts start with `#!/usr/bin/env bash` and `set -euo pipefail`
- Source shared environment: `source "$(dirname "$0")/../lib/env.sh"`
- Log to `$LOGFILE` using the `log()` function from env.sh or defined locally
2026-03-26 16:41:27 +00:00
- Never hardcode secrets — agent secrets come from `.env.enc` , vault secrets from `.env.vault.enc` (or `.env` /`.env.vault` fallback)
2026-03-21 09:54:21 +00:00
- Never embed secrets in issue bodies, PR descriptions, or comments — use env var references (e.g. `$BASE_RPC_URL` )
2026-03-17 18:53:15 +00:00
- ShellCheck must pass (CI runs `shellcheck` on all `.sh` files)
- Avoid duplicate code — shared helpers go in `lib/`
## How to lint and test
```bash
# ShellCheck all scripts
2026-03-18 22:15:43 +00:00
git ls-files '*.sh' | xargs shellcheck
2026-03-17 18:53:15 +00:00
# Run phase protocol test
bash dev/phase-test.sh
```
---
2026-03-18 03:41:46 +00:00
## Agents
2026-03-21 12:44:23 +00:00
| Agent | Directory | Role | Guide |
|-------|-----------|------|-------|
| Dev | `dev/` | Issue implementation | [dev/AGENTS.md ](dev/AGENTS.md ) |
| Review | `review/` | PR review | [review/AGENTS.md ](review/AGENTS.md ) |
| Gardener | `gardener/` | Backlog grooming | [gardener/AGENTS.md ](gardener/AGENTS.md ) |
| Supervisor | `supervisor/` | Health monitoring | [supervisor/AGENTS.md ](supervisor/AGENTS.md ) |
| Planner | `planner/` | Strategic planning | [planner/AGENTS.md ](planner/AGENTS.md ) |
| Predictor | `predictor/` | Infrastructure pattern detection | [predictor/AGENTS.md ](predictor/AGENTS.md ) |
| Action | `action/` | Operational task execution | [action/AGENTS.md ](action/AGENTS.md ) |
2026-03-21 18:49:31 +00:00
| Vault | `vault/` | Action gating + resource procurement | [vault/AGENTS.md ](vault/AGENTS.md ) |
2026-03-19 07:25:25 +00:00
2026-03-21 12:44:23 +00:00
See [lib/AGENTS.md ](lib/AGENTS.md ) for the full shared helper reference.
2026-03-18 03:41:46 +00:00
---
## Issue lifecycle and label conventions
2026-03-21 12:44:23 +00:00
Issues flow: `backlog` → `in-progress` → PR → CI → review → merge → `closed` .
2026-03-18 03:41:46 +00:00
### Labels
| Label | Meaning | Set by |
|---|---|---|
| `backlog` | Issue is queued for implementation. Dev-poll picks the first ready one. | Planner, gardener, humans |
2026-03-22 13:41:57 +00:00
| `priority` | Queue tier above plain backlog. Issues with both `priority` and `backlog` are picked before plain `backlog` issues. FIFO within each tier. | Planner, humans |
2026-03-18 03:41:46 +00:00
| `in-progress` | Dev-agent is actively working on this issue. Only one issue per project is in-progress at a time. | dev-agent.sh (claims issue) |
2026-03-21 04:18:43 +00:00
| `blocked` | Issue is stuck — agent session failed, crashed, timed out, or CI exhausted. Diagnostic comment on the issue has details. Also used for unmet dependencies. | dev-agent.sh, action-agent.sh, dev-poll.sh (on failure) |
2026-03-18 03:41:46 +00:00
| `tech-debt` | Pre-existing issue flagged by AI reviewer, not introduced by a PR. | review-pr.sh (auto-created follow-ups) |
2026-03-18 03:51:26 +00:00
| `underspecified` | Dev-agent refused the issue as too large or vague. | dev-poll.sh (on preflight `too_large` ), dev-agent.sh (on mid-run `too_large` refusal) |
2026-03-18 03:41:46 +00:00
| `vision` | Goal anchors — high-level objectives from VISION.md. | Planner, humans |
2026-03-20 18:00:21 +00:00
| `prediction/unreviewed` | Unprocessed prediction filed by predictor. | predictor-run.sh |
2026-03-25 17:16:13 +00:00
| `prediction/dismissed` | Prediction triaged as DISMISS — planner disagrees, closed with reason. | Planner (triage-predictions step) |
2026-03-20 09:36:37 +00:00
| `prediction/actioned` | Prediction promoted or dismissed by planner. | Planner (triage-predictions step) |
| `action` | Operational task for the action-agent to execute via formula. | Planner, humans |
2026-03-18 03:41:46 +00:00
### Dependency conventions
Issues declare dependencies in their body using a `## Dependencies` or
2026-03-21 12:44:23 +00:00
`## Depends on` section listing `#N` references. The dev-poll scheduler uses
`lib/parse-deps.sh` to extract these and only picks issues whose dependencies
are all closed.
2026-03-18 03:41:46 +00:00
### Single-threaded pipeline
Each project processes one issue at a time. Dev-poll will not start new work
while an open PR is waiting for CI or review. This keeps context clear and
prevents merge conflicts between concurrent changes.
---
2026-03-26 15:56:10 +00:00
## Addressables
Concrete artifacts the factory has produced or is building. The gardener
maintains this table during grooming — see `formulas/run-gardener.toml` .
| Artifact | Location | Observable? |
|----------|----------|-------------|
| Website | disinto.ai | No |
| Repo | codeberg.org/johba/disinto | Partial |
| Skill | ClawHub (in progress) | No |
| GitHub org | github.com/Disinto | No |
## Observables
Addressables with measurement wired — the factory can read structured
feedback from these. The gardener promotes addressables here once an
evidence process is connected.
None yet.
---
2026-03-21 11:55:15 +00:00
## Architecture Decisions
Humans write these. Agents read and enforce them.
| ID | Decision | Rationale |
|---|---|---|
| AD-001 | Nervous system runs from cron, not action issues. | Planner, predictor, gardener, supervisor run directly via `*-run.sh` . They create work, they don't become work. (See PR #474 revert.) |
| AD-002 | Single-threaded pipeline per project. | One dev issue at a time. No new work while a PR awaits CI or review. Prevents merge conflicts and keeps context clear. |
| AD-003 | The runtime creates and destroys, the formula preserves. | Runtime manages worktrees/sessions/temp. Formulas commit knowledge to git before signaling done. |
| AD-004 | Event-driven > polling > fixed delays. | Never `waitForTimeout` or hardcoded sleep. Use phase files, webhooks, or poll loops with backoff. |
2026-03-26 16:41:27 +00:00
| AD-005 | Secrets via env var indirection, never in issue bodies. | Issue bodies become code. Agent secrets go in `.env.enc` , vault secrets in `.env.vault.enc` (both SOPS-encrypted). Referenced as `$VAR_NAME` . Vault-runner gets only vault secrets; agents get only agent secrets. |
2026-03-26 16:59:57 +00:00
| AD-006 | External actions go through vault dispatch, never direct. | Agents build addressables; only the vault exercises them (publishes, deploys, posts). Tokens for external systems (`GITHUB_TOKEN` , `CLAWHUB_TOKEN` , deploy keys) live only in `.env.vault.enc` and are injected into the ephemeral vault-runner container. `lib/env.sh` unsets them so agents never hold them. PRs with direct external actions without vault dispatch get REQUEST_CHANGES. |
2026-03-21 11:55:15 +00:00
**Who enforces what:**
- **Gardener** checks open backlog issues against ADs during grooming; closes violations with a comment referencing the AD number.
- **Planner** plans within the architecture; does not create issues that violate ADs.
- **Dev-agent** reads AGENTS.md before implementing; refuses work that violates ADs.
---
2026-03-21 12:44:23 +00:00
## Phase-Signaling Protocol
2026-03-17 18:53:15 +00:00
2026-03-21 12:44:23 +00:00
When running as a persistent tmux session, Claude must signal the orchestrator
at each phase boundary by writing to a phase file (e.g.
`/tmp/dev-session-{project}-{issue}.phase` ).
2026-03-17 18:53:15 +00:00
2026-03-21 12:44:23 +00:00
Key phases: `PHASE:awaiting_ci` → `PHASE:awaiting_review` → `PHASE:done` .
2026-03-21 19:39:04 +00:00
Also: `PHASE:escalate` (needs human input), `PHASE:failed` .
2026-03-17 18:53:15 +00:00
2026-03-21 12:44:23 +00:00
See [docs/PHASE-PROTOCOL.md ](docs/PHASE-PROTOCOL.md ) for the complete spec
including the orchestrator reaction matrix, sequence diagram, and crash recovery.