Skip to main content

ravl

Reflect · Act · Verify · Learn — a small library and protocol for loops that run once, check their own result, and leave guidance for their next run. For outcomes that recur: each run should cost less and fail less than the one before.

Pre-release, version 0.4.1. The runner covers build steps 1 to 9 of specifications/first-loop.md: one loop, run from the command line, moving between LLM-driven and code-driven execution. Decisions 0012 to 0019 are implemented and still proposed. Read the model first.

Install and run

uv tool install ravl-cli                               # one installation per host; the command is `ravl`
uv tool upgrade ravl-cli                               # later, to update it
ravl config                                            # shows the agent programs it found; choose one
ravl new my-loop                                       # writes my-loop/ravl.md
$EDITOR my-loop/ravl.md                                # intent, and criteria with checks
ravl run my-loop                                       # one run: Reflect, Act, Verify, Learn
ravl list                                              # every loop below here, with its state

The package is named ravl-cli on PyPI because PyPI refused ravl as too similar to an existing project. The command and the Python package it installs are both ravl.

ravl run needs an LLM for Act and Learn, and for Act it must be an agent: a program that can change files and run commands. ravl has no agent of its own. It ships backends for agent programs you may already have, each of which uses its own sign-in:

Backend Program State
claude Claude Code run end to end
codex Codex CLI written from the program's help text; not yet run against a signed-in Codex

ravl config shows which of them are on PATH and whether a sign-in was found. It starts no program and reads no credential. ravl config set claude --model sonnet writes the choice to ~/.config/ravl/config.toml. ravl never chooses one by itself.

[llm]
backend = "claude"
model = "sonnet"

[llm.learn]            # optional: another model for one phase
model = "haiku"

For any other agent, name a command in place of a backend. It reads a prompt on standard input and writes its reply on standard output; RAVL_PHASE tells it which phase it is in. contrib/backends/claude-code is an example.

[llm]
command = ["/path/to/an/agent-adapter"]

In Act the agent runs with its approval prompts off, because nobody is present to answer them. ravl does not confine a run yet. Until it does, run loops you have not read inside a sandbox of your own.

A specification is one file. A criterion with a check block is decided by the block's exit status; no LLM takes part in Verify.

# Nightly export

## Intent

`export.csv` in this directory holds yesterday's orders, one per line.

## Verifier

- `export.csv` was written during this run.
  ```check
  test export.csv -nt "$RAVL_RUN_DIR/started"

### Turning an existing scheduled job into a loop

Put the command the scheduler ran into an `act` block and point the scheduler at
`ravl run <dir>`. The implementation runs on every run with no LLM. When it stops
meeting the verifier, the failure is classified once; a solution failure gets up to two
LLM-driven repair attempts, and then the owner is asked. While the loop waits, the
implementation still runs, so a cause removed by hand is noticed on the next run.

```markdown
## Act

```act
/usr/local/bin/export-orders --yesterday > export.csv

Verifier

  • The export ran to completion in this run.
    test -e "$RAVL_RUN_DIR/act-ok"
    
  • export.csv has at least one order.
    test "$(wc -l < export.csv)" -ge 1
    

What a run does:

| Situation at Reflect | Act | LLM calls |
|---|---|---|
| Every check passes | nothing | 0 |
| A check fails; loop is LLM-driven | the agent does the work once | Act and Learn |
| A check fails; loop is code-driven | generated `act.py` runs | 0, or Learn if Verify then fails |
| Same failure as last run and Learn set a hold | nothing; the open question stands | 0 |

After three consecutive LLM-driven passes Learn asks for a program that performs Act,
checks it (parses, declared dependencies on the whitelist, no recorded execution
constraint violated) and switches the loop to code-driven. A solution failure of that
code switches it back. `ravl set <dir> lock | never-lock | learned` overrides this.
[`examples/decision-report`](https://github.com/KevinT/ravl/tree/main/examples/decision-report) is the first loop, with its runs
and learnings committed: three LLM-driven runs, then code-driven runs with no LLM call.

Tests: `uv run pytest`.

## Start here

| Question | Read |
|---|---|
| What is this a part of, and what are its trust boundaries? | [`.about/purpose.md`](https://github.com/KevinT/ravl/blob/main/.about/purpose.md) |
| How do I reason about a loop? | [`.about/mental-models/ravl-loop/model.md`](https://github.com/KevinT/ravl/blob/main/.about/mental-models/ravl-loop/model.md) |
| What must the library never do? | [`.about/principles.md`](https://github.com/KevinT/ravl/blob/main/.about/principles.md) |
| Where does it sit on the alignment stack, and what is that? | [`.about/situates.md`](https://github.com/KevinT/ravl/blob/main/.about/situates.md) |
| Why was it decided this way? | [`.about/decisions/`](https://github.com/KevinT/ravl/blob/main/.about/decisions/README.md) |
| What gets built first, and what is the kill criterion? | [`specifications/first-loop.md`](https://github.com/KevinT/ravl/blob/main/specifications/first-loop.md) |
| What is carried from RavlGPT, adapted, or left behind? | [`specifications/reference/ravlgpt-guardrails.md`](https://github.com/KevinT/ravl/blob/main/specifications/reference/ravlgpt-guardrails.md) |
| How is it installed and run? | [`0012-one-install-per-host-and-the-command-line-first`](https://github.com/KevinT/ravl/blob/main/.about/decisions/0012-one-install-per-host-and-the-command-line-first.md) (proposed), from [`distribution.md`](https://github.com/KevinT/ravl/blob/main/specifications/speculative/proposals/distribution.md) |
| I am an agent working in this repo | [`AGENTS.md`](https://github.com/KevinT/ravl/blob/main/AGENTS.md) |

## Repository layout

.about/ purpose, principles, position on the stack, the mental model, decisions src/ravl/ the library and the ravl command tests/ phase contract, learning store, read rule, verification, constraints examples/ public, invented loops with their runs and learnings src/ravl/backends/ adapters for agent programs, run as a separate process; not core contrib/backends/ an example of a custom command adapter specifications/ what is being built next first-loop.md the first loop and the build order for the runner reference/ guardrails for consulting RavlGPT speculative/ proposals not yet decided; promoted to .about/decisions/ when resolved


## Lineage

`ravl` re-derives the concepts first developed in
[KevinT/RavlGPT](https://github.com/KevinT/RavlGPT). That repository is kept whole as
evidence; no code is ported from it
([`0000-rebuild-from-concepts-not-from-code`](https://github.com/KevinT/ravl/blob/main/.about/decisions/0000-rebuild-from-concepts-not-from-code.md)).

## Licence

[Mozilla Public License 2.0](https://github.com/KevinT/ravl/tree/main/LICENSE).

Metadata

Release files for ravl-cli 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ravl-cli 0.4.1
File Size Uploaded Provenance Actions
ravl_cli-0.4.1.tar.gz 53.2 kB Without provenance Details for ravl_cli-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ravl-cli 0.4.1
File Interpreter ABI Platform Actions
ravl_cli-0.4.1-py3-none-any.whl Python 3 none any Details for ravl_cli-0.4.1-py3-none-any.whl

Total release size: 100.3 kB

Release files / ravl_cli-0.4.1.tar.gz

Download URL ravl_cli-0.4.1.tar.gz
Size 53.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c889df1ff83d0229df1e55bad2e674f22291254f3b0e93725321d9b188ff9c1e
BLAKE2b-256 checksum
How to use checksums
47510aced2b658d48f8ade07417c1768d4baf0b0193b3b340f2301a285acc405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ravl_cli-0.4.1-py3-none-any.whl

Download URL ravl_cli-0.4.1-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07eeecbfe29be24b8241f98605a3260a59f68e4f47b762280f6cfe65783016db
BLAKE2b-256 checksum
How to use checksums
08ac464e4934804112d7519e35b769e8030380d28fcfaef77bbf6d73aa6ed0ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ravl-cli 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page