feat(aristo): add Aristo WAL verification + CI

Layers Aretta's Aristo verification onto upstream turso so the WAL correctness
properties can be canon-verified.

- #[aristo::intent] annotations at the load-bearing WAL enforcement sites in
  core/storage/wal.rs and core/storage/pager.rs, bound to the aretta-books
  canon corpus. .aristo/ durable state (canon-matches.toml) + aristo.toml.
  core depends on aristo 0.4 from crates.io.
- aristo.toml `[instance] url` pins this repo's data-plane (verify + canon
  match) to https://turso.aretta.ai; ARETTA_API_URL still overrides and
  auth/login is unaffected.
- CONTRIBUTING.md: how to author, verify, and instrument intents.
- CI via aretta-ai/aristo-action@v1: aristo.yml lite PR gate (audit/lint;
  version unpinned -> latest aristo) and aristo-verify.yml heavy canon
  verification (manual dispatch).
- .gitignore the regenerable/runtime .aristo state per aristo 0.4 conventions
  (index.toml + the per-annotation .aristo/doc/ are gitignored, not committed).

Follow-up: the per-annotation docs (.aristo/doc/) and the `doc` CI check are
omitted here to keep the diff small. To enable them: run `aristo doc` to
regenerate .aristo/doc/, drop the `.aristo/doc/` line from .gitignore, and add
`doc` back to aristo.yml's `checks:`.

Co-authored-by: Adwait Godbole <32107329+adwait@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sushant Dinesh
2026-06-30 05:48:54 +00:00
parent 557e2f529f
commit d9609538ee
10 changed files with 348 additions and 0 deletions

View File

@@ -421,6 +421,63 @@ And launch an Antithesis test run with:
scripts/antithesis/launch.sh
```
## Annotating intent with Aristo
Turso uses [Aristo](https://github.com/aretta-ai/aristo) to capture design intent that the code alone doesn't spell out — invariants a refactor could silently break — as `#[aristo::intent("...")]` annotations attached to the code. They're optional; reach for one only when a property is invisible from the signature and not already guarded by a test. For example, on the WAL trait in `core/storage/wal.rs`:
```rust
#[aristo::intent(
"An append-only log that records page-level changes before they are \
applied to the database, so a system crash can be recovered by \
replaying the log.",
verify = "neural",
id = "wal_records_changes_before_apply",
)]
pub trait Wal: Debug + Send + Sync { ... }
```
The macros are a workspace dependency, so annotated code builds normally. To author and lint annotations, install the CLI:
```console
cargo install aristo-cli # provides the `aristo` command
aristo lint # lint annotation prose (also runs in CI on every PR)
```
Annotations with `verify = "neural"` are machine-checked by an agent. The skills
that drive this are not committed to this repository — they are generated by the
CLI and tied to its version — so install them into your local agent on demand:
```console
aristo install-skills --agent claude-code --user # installs into ~/.claude/skills/, not the repo
```
Then, from Claude Code, run `/aristo-verify`. The skill produces a verdict for each
annotation pending verification and writes the proofs under `.aristo/proofs/`. To
validate those proofs and apply them to the annotation index, run:
```console
aristo verify --apply-verdicts
```
To run deep verification, run this prompt with `claude`:
```
Run Aristo canon match
```
Some intents assert invariants over internal state the public API doesn't expose. Rather than widen the API for tests, mark that state with the `aristo::instrument` macros (`#[derive(Inspect)]`, `#[expose_pub]`, `yield_point!`) behind a Cargo feature, so the verification harness can read it while normal builds compile it out entirely. See the `/aristo-instrumenting` skill for when and how.
### Using Aristo, day to day
Write intents *as you write the code* — one at a time, in the same change, while the rationale is fresh; a batched "annotate it later" pass recovers the *what* but not the *why*. `aristo status` shows where a module stands and `aristo nudge` suggests the next action. Inside an AI agent (see [Developing with AI coding agents](#developing-with-ai-coding-agents)) the loop runs through the installed skills rather than the bare CLI:
* `/aristo-status` — read the board (what's annotated, verified, awaiting review).
* `/aristo-authoring` — write good intents while you're in the code.
* `/aristo-verify` — verify the annotations your change touched.
* `/aristo-intent-suggestions` and `/aristo-authored-review` — review what was authored.
Only the durable, trust-gating artifacts are committed: `aristo.toml`, the annotations themselves, `.aristo/proofs/*.proof`, and `.aristo/doc/`. The annotation index (`.aristo/index.toml`) is a regenerable, gitignored cache — every read command rebuilds it from source, so there's nothing to stage.
## Adding Third Party Dependencies
When you want to add third party dependencies, please follow these steps: