A daemon on a Linux host that watches issues on enrolled GitHub repositories through a GitHub App. For each new issue it decides whether it may act (trust gate), how big the work is (triage) and runs a jess coding agent in a podman sandbox under a budget. The output is a pull request, or a partial pull request plus a comment with findings and a request for approval when the budget ran out. Approval is the approved label on the issue.
issues.opened arrives and is stored byte-exact. A trusted requester (Owner, Member or Collaborator association) goes to Received and is triaged: a model call sizes the issue Small or Large. Small is queued under the auto budget; Large waits for approval with its rationale posted as a comment. An untrusted requester goes to Gated, silently, until the approved label is added. Approval, from a label or from the operator, queues the case under the approved budget. The dispatcher starts attempts for queued cases within a concurrency limit; each attempt runs to a pull request, a budget exhaustion or a failure, and the outcome drives the case's next state. A budget exhaustion with committed work opens a partial pull request; the case still waits for approval, and the approved attempt resumes the same branch and the same pull request.
This build wires the trust gate, triage state machine, scheduler, comment outbox, operator API and CLI. The sandboxed agent runner that actually executes attempts is a placeholder here: every started attempt ends immediately with Failed{Infra} until the agent plan (Plan E) lands. /metrics serves two live gauges on this build, autophage_cases{state} and autophage_queue_depth, both read from the store on every scrape; the counters and the wall-clock histogram are registered but stay at zero until the runner in the agent plan increments them.
Two binaries built on perch:
autophaged: the daemon. Serves the operator API under/api, the GitHub webhook at/webhook/githuband Prometheus metrics at/metrics.autophage: the CLI client.
make build
./autophaged & # starts on 127.0.0.1:8080
./autophage auth login # mint + store a token
./autophage status # authenticated callgo.mod pins github.com/guygrigsby/jess (v0.1.0, the MCP adapter and ledger) and github.com/guygrigsby/llm (v0.6.2, the aperture adapter) to published tags, so a plain make build works from a clone with no sibling checkouts. Bumping either is a go get plus go mod tidy; the release steps for a new tag are in the runbook's step 1.
autophage status: cases by state, running attempts, queue depth.autophage cases [--state] [--repository] [--limit]: list cases, newest first.autophage case owner/repo#N: one case with its triage, approvals, attempts and transitions.autophage run owner/repo#N: manually start an existing issue.autophage stop attempt-id: stop a running attempt.autophage why attempt-id: the jess ledger chain for an attempt's run.autophage auth login/auth logout,autophage whoami: token management.AUTOPHAGE_ADDR(a URL such ashttps://aph.guy.ts.net, orhost:port) sets the daemon the CLI talks to, ahead of the config file'slisten;--addroverrides it.auth loginmints only from loopback, so log in on the daemon's host or over an ssh tunnel, then use the token against the remote address.
Copy config.example.toml to ~/.config/autophage/config.toml. The webhook secret never lives in the file: it comes from AUTOPHAGE_GITHUB_WEBHOOK_SECRET. Models need no key: the Aperture gateway is on the tailnet and authenticates the host.
See docs/runbooks/deploy.md for the full first-deployment runbook (Postgres setup, the GitHub App, Funnel, systemd). Summary below.
With push-to-deploy on (ADR 0009, runbook step 9b), every green push to main is a CI point release and the deploy host installs it from the repo's release webhook, restarting when idle. The manual steps below are the first deploy only.
Postgres runs natively (one database holds autophage's tables and jess's ledger tables). Write ~/.config/autophage/env (mode 0600, values from your secret store) with:
AUTOPHAGE_GITHUB_WEBHOOK_SECRET=...
Model calls go to Aperture, the gateway on the tailnet, so no model key is configured anywhere. The deploy host must resolve Aperture's tailnet name. Tiers with route set in [model.*] (triage and repair by default) pick their model per use from Aperture's live registry via agent-select (cost or operator-declared quality), local models on trig first, and fall back to the configured id (ADR 0010, 0011).
Then:
make install-systemd # writes the user unit, enables and starts it
make redeploy-systemd # rebuild, reinstall, restart in placeExpose the webhook publicly with Tailscale Funnel and nothing else:
tailscale funnel --bg --set-path /webhook/github http://127.0.0.1:8080/webhook/githubServe /metrics to the tailnet, path-scoped so nothing else is exposed with it:
tailscale serve --bg --set-path /metrics http://127.0.0.1:8080/metrics/metrics is reachable over the tailnet only, never through Funnel. Nothing under /api may ever be served through a proxy: a proxy makes every request look like it came from 127.0.0.1, which is the whole of the mint endpoint's authorization. The daemon refuses a mint carrying a proxy's headers, but the path must not be exposed in the first place.
make install-launchd, make redeploy (or make redeploy-launchd), make service-restart, make uninstall-launchd. make dev runs the daemon with hot reload.
make help lists everything. The important ones: build, test, check (the quality gate), dev and the deploy targets above.
- Design, domain model, contracts, context map.
- Deployment runbook: first live deployment, step by step.
- ADRs in
docs/adr/: 0001 jess as agent harness, 0002 sandbox posture, 0003 trust gate and approval label, 0004 GitHub App webhooks and deployment, 0005 budgeted attempt with triage, 0006 OpenRouter as model provider (superseded by 0008 Aperture as model gateway), 0007 Dependabot bumps as an upkeep context, 0008 Aperture as model gateway, 0009 push-to-deploy via release webhook, 0010 model choice via agent-select, 0011 lean agent-select.