Skip to content

Get started

This page takes an empty repository through Torve's whole loop:

  1. The starter: a gate manifest and a configuration.
  2. A design document.
  3. A minted task contract.
  4. A sandboxed run with no model in it.
  5. A landing.
  6. A seat with a real agent.

Every file below loads as written. Every command up to the last section was run against Torve 0.3.0, in a fresh repository with torve installed from PyPI, and the last section was checked with torve doctor.

You need Linux, git, Docker, and Python 3.13 or 3.14. Torve 0.3 is an alpha. One operator has run it, against one adopting repository, with Claude Code as the agent seat.

Install and start

pip install torve                # or: uv tool install torve
cd your-repository
torve init --starter
git add .torve .claude/skills/torve/SKILL.md .agents/skills/torve/SKILL.md && git commit -m "torve starter"
torve gates run --base main
 ✓   scope                pass      blocking
 ✓   secrets              pass      blocking
 ∅   no-test-tampering    skipped   blocking
exit 0

That is a complete CI install: one step running torve gates run --base origin/main, whose exit code is the outcome. The rest of this page says what the starter wrote and takes it the rest of the way.

torve init writes what the code derives:

  • a JSON Schema for every file Torve reads, under .torve/schemas/;
  • .torve/.gitignore for what Torve alone writes;
  • .wt/, where task worktrees live, added to .git/info/exclude;
  • a stub skill under every skill root, .claude/skills/torve/SKILL.md and .agents/skills/torve/SKILL.md, so a session in the repository finds torve.

--starter also writes a gate manifest, a configuration, and the role profiles under .torve/agents/ (implement, review, revert), each only when the file does not exist yet. An existing file is named in the output and left alone. Plain torve init writes neither; without a manifest, torve gates run stops with configuration error: no gate manifest at .torve/gates.yaml.

The gate manifest

.torve/gates.yaml, as the starter writes it:

# yaml-language-server: $schema=schemas/gates.json
schema_version: 1

gates:
  - name: scope
    run: "@scope"
    state: blocking
    origin: structural
  - name: secrets
    run: "@secrets"
    state: blocking
    origin: structural
  - name: no-test-tampering
    run: "@no-test-tampering"
    state: blocking
    origin: structural
  # Your test gate. Gates run inside the sandbox image (`runtime.image` in
  # config.yaml), so the command needs the toolchain that image carries.
  # - name: tests
  #   run: "python3 -m unittest discover -s tests -t ."
  #   state: blocking
  #   origin: structural

How the entries work:

  • run. An @name runs a builtin; anything else is a shell command.
  • state. blocking decides the exit code. shadow runs and reports without deciding it.
  • origin. Says why the gate exists: structural, or a citation of the document that decided it.

Uncomment the tests entry, with your own test command, once the sandbox image can run it.

A shell gate may name {base}: the runner replaces it with the merge-base the battery computed, so the command judges what the attempt changed. The repository's pre-commit hooks become a gate that way, red where the pull request's check would be red, once the gates image carries pre-commit and the hooks' environments:

  - name: pre-commit
    run: "pre-commit run --from-ref {base} --to-ref HEAD --show-diff-on-failure"
    state: blocking
    origin: structural

no-test-tampering reads a task contract, so with no task it reports skipped, never a silent green.

The run also warns TwinlessGateWarning. A gate can name a sabotage: twin, which is the evidence that the gate is able to fail. For a builtin, the twin is the family of the same name in torve gates check. For a shell gate, it is a test path. Once any entry names a twin, every entry must, so add them all at once or leave them all out.

The configuration

.torve/config.yaml, as the starter writes it:

# yaml-language-server: $schema=schemas/config.json
schema_version: 1

runtime:
  adapter: docker
  image: python:3.13-slim

store:
  adapter: mock

What these settings mean:

  • runtime.image. The sandbox a task runs in, and the gates and acceptance commands run inside it too. The image needs your test toolchain. python:3.13-slim has no pytest, which is why the commented test gate uses unittest.
  • store: mock. Keeps run state in-process. It is enough for torve run; a served manager needs Postgres, as Operating the engine says.

Docker inside a sandbox

runtime.docker decides whether a sandbox gets a Docker daemon of its own:

  • "" — none. The default.
  • socket — the host daemon's socket is mounted into every sandbox of the run, attempt and gates alike. Host-equivalent capability, granted knowingly per repository.
  • nested — a privileged side container runs its own daemon and each sandbox of a role in runtime.nested.roles joins its network namespace and reaches the daemon at tcp://127.0.0.1:2375. A task's containers, ports and volumes are its own, and nothing it starts outlives it.

Sealed broker mode refuses nested, and so does the review role — a judge never starts containers. The sandbox image must carry the Docker CLI: the published base does, so pull it rather than a stock language image, or derive from it for what it lacks.

runtime:
  adapter: docker
  image: ghcr.io/morzecrew/sandbox-base:{torve}   # carries the docker CLI; a stock image does not
  docker: nested
  nested:
    image: docker:29.7.2-dind   # the pinned dind image the side container runs
    cache_volume: torve-dind    # base name of the slot's /var/lib/docker volume
    registry_mirrors: []        # mirrors dockerd is started with
    roles: [gates]              # whose sandboxes get the daemon; review is refused
    ready_s: 60                 # how long `docker info` may take to answer
  • nested.image. The side container's image, a pinned dind image. It should match the Docker CLI the sandbox image carries.
  • nested.cache_volume. The base name of the volume holding the side daemon's /var/lib/docker; the worker slot is appended, so what a task pulled stays pulled for that slot and two workers never share a daemon's state.
  • nested.registry_mirrors. Registry mirrors passed to dockerd as --registry-mirror=<url>.
  • nested.roles. The roles whose sandboxes get the daemon, defaulting to [gates]. Adding implement lets an attempt run what its gates will run.
  • nested.ready_s. How long the sandbox's creation waits for the side daemon's docker info before failing as a runtime error, defaulting to 60.

torve doctor checks the configuration and the environment, including that every configured seat's provider is one this repository may reach.

A first document

Work starts from an accepted design document. torve spec new "A greeting module" --owner you creates .torve/specs/S-0001/ with document.yaml and decisions.yaml. Fill them in and add phasing.yaml:

.torve/specs/S-0001/document.yaml
# yaml-language-server: $schema=../../schemas/document.json
id: S-0001
title: A greeting module
kind: design
change:
  type: feat
  scope: greet
status: accepted
implementation: none
depends_on: []
informed_by: []
supersedes: []
superseded_by: null
owner: you
schema_version: 4
summary: |
  A `greet(name)` function returns a greeting.
motivation: The demo needs one small, testable change.
current_state: Nothing greets.
goals: '`greet("Ada")` returns `"Hello, Ada"`.'
non_goals: Localisation.
design:
  - key: the-function
    md: '`greet.py` holds `greet(name: str) -> str`.'
tests: '`tests/test_greet.py` asserts the greeting.'
docs: ''
out_of_scope: ''
risks: None worth naming.
.torve/specs/S-0001/decisions.yaml
# yaml-language-server: $schema=../../schemas/decisions.json
decisions:
  - id: D-1
    grade: ASSUMED
    text: The greeting is `Hello, <name>`, with no trailing punctuation
    paths: [greet.py, tests/test_greet.py]
    consequence: callers format the sentence themselves
.torve/specs/S-0001/phasing.yaml
# yaml-language-server: $schema=../../schemas/phasing.json
phasing:
  - phase: 1
    title: A greeting function
    intent: Add `greet` and its test. Settles D-1.
    scope: [greet.py, tests/test_greet.py]
    acceptance:
      - python3 -m unittest tests.test_greet
    character: routine

The fields that drive planning:

  • The decision's grade. Says what an agent may do when reality disagrees with the row. LOCKED halts, ASSUMED departs and logs, and OPEN decides and logs.
  • The phase's scope. The only paths a task may change; the scope gate holds it to them.
  • The phase's acceptance. The commands a task must pass.

torve spec check validates the corpus. Commit the document: torve plan reads only what is committed.

Mint and run a task

torve plan S-0001               # preview: one task, T-0001
torve plan S-0001 --no-dry-run  # writes .torve/tasks/T-0001/contract.yaml

The fake agent replays a scripted scenario inside the sandbox, so the whole loop runs before any model is involved. Save it outside the repository, as ../greet-scenario.yaml: torve merge refuses to fast-forward a checkout with untracked files.

attempts:
  - writes:
      greet.py: |
        def greet(name: str) -> str:
            return f"Hello, {name}"
      tests/test_greet.py: |
        import unittest

        from greet import greet


        class TestGreet(unittest.TestCase):
            def test_greet(self):
                self.assertEqual(greet("Ada"), "Hello, Ada")
torve run T-0001 --agent fake --scenario ../greet-scenario.yaml
T-0001: ready after 1 attempt(s)
size ok envelope: n=0, below the observation floor of 5 — no reading yet — ...
  claimed -> running: attempt 1 dispatched
  running -> gated: agent exited 0; gates running
  gated -> reviewed: gates green; review not configured
  reviewed -> ready: committed dea1b9d321; pushed=False; pr deferred; ...

Without --scenario, the fake agent writes one marker file outside the task's scope. The scope gate convicts every attempt, and the task escalates at the attempt ceiling. That is a quick way to watch a gate refuse work.

An escalated task keeps its worktree and run state until torve reap --escalated clears them.

torve merge T-0001 lands the candidate on the base branch. The base has not moved, so it fast-forwards; the checkout must be clean, or the lane refuses with exit 4. Two commits appear, both made by torve run on torve/T-0001:

  • torve(T-0001): A greeting function — attempt 1 green, the task's commit;
  • torve(T-0001): landing of attempt 1, which records the landing under .torve/specs/S-0001/execution/.

A real agent

A seat joins three files to a model. These steps set up a Claude Code seat.

1. Pull the image. Every release publishes the base and each seat image under ghcr.io/morzecrew/, public and tagged with its version. A harness manifest names one with {torve}, which the configuration writes as the installed torve's version at load — docker pulls the tag on the first run and an upgrade moves engine alone, so a repository copies no definition into .torve/sandbox/ for an image it only pulls.

2. Write the harness, provider and seat files. Two files describe the harness and the provider. Then add the seat and the broker to config.yaml.

.torve/harnesses/claude.yaml
# yaml-language-server: $schema=../schemas/harness.json
adapter: subscription
image: ghcr.io/morzecrew/claude-sandbox:{torve}
equip_root: ~/.claude/skills
kinds: [skill, plugin, mcp, hook, agent]
env:
  CLAUDE_PERMISSION_MODE: bypassPermissions
api: [anthropic]
.torve/providers/anthropic.yaml
# yaml-language-server: $schema=../schemas/provider.json
name: anthropic
key_env: CLAUDE_CODE_OAUTH_TOKEN

routes:
  anthropic:
    base_url: https://api.anthropic.com

models:
  claude-opus-5-5:
    context_window: 200000
    max_tokens: 32000
.torve/config.yaml (added)
tiers:
  executor:
    harness: claude
    model: claude-opus-5-5
    provider: anthropic

broker:
  adapter: local

providers:
  default: [anthropic]

Each block does one thing:

  • providers.default. Lists every provider a run may reach. A provider outside it is refused at dispatch.
  • key_env. Names the variable that holds the credential, never the value. With broker.adapter: local, the runner keeps the key and the sandbox reaches the provider through a loopback route the broker serves, so no key enters the sandbox.

3. Run it.

export CLAUDE_CODE_OAUTH_TOKEN=...   # from `claude setup-token`
torve doctor                         # every line should read ✓; it does not check the key
torve run <task>

torve doctor names the harness, the profile, the model and the provider of every seat. When the broker is on, it says so.

What next

Operating the engine covers the rest:

  • the resident manager, torve manager serve, and served nights;
  • what an escalation names, and why one pauses new work;
  • landing a document as one pull request.

The manager needs the Postgres store: pip install 'torve[postgres,migrate]', TORVE_PG_DSN naming the database, torve migrate --all, and store.adapter: postgres.

This repository's own .torve/ is a complete working configuration.