Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 50 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ jobs:
# the hashes). `invoice-to-accounting` ships Python + TypeScript + Rust;
# the other agents are Python, and run-smokes.sh skips a stack an agent
# does not have before it ever consults REQUIRE, so adding a language is
# a wrapper plus an agent file and needs no edit here.
# a wrapper plus an agent file and needs no edit here. Since #178 each
# agent also ships an installable `pack/`, and the pack lane asserts it
# installs that same plan.
# An untested example in the flagship repo is wrong at exactly the
# moment somebody is evaluating, so the promise is a job, not a README
# claim — the SAME entry point a developer runs locally before pushing
Expand All @@ -314,15 +316,38 @@ jobs:
maturin develop --release -m crates/areev-py/Cargo.toml
- name: Build the Node binding (napi)
run: cd crates/areev-js && npm ci && npm run build
# The pack lane needs the binary (the language stacks do not). It
# installs each agent's `pack/` into a scratch memory and asserts it
# carries the plan the stacks mint — which is what goes stale when a
# seeder changes and `export-packs.sh` was not re-run.
- name: Build the areev binary (for the pack lane)
run: cargo build -p areev
# Both acts of every agent, in all three stacks, plus the
# cross-language plan-hash comparison. CARGO_TARGET_DIR points the
# detached Rust stack at the cached workspace target so its path deps
# do not recompile from scratch.
- name: Every agent, every language — smoke + improve
# cross-language plan-hash comparison and the pack lane.
# CARGO_TARGET_DIR points the detached Rust stack at the cached
# workspace target so its path deps do not recompile from scratch.
- name: Every agent, every language — smoke + improve + pack
run: |
. .venv/bin/activate
CARGO_TARGET_DIR="$PWD/target" REQUIRE="python typescript rust" \
CARGO_TARGET_DIR="$PWD/target" REQUIRE="python typescript rust pack" \
examples/agents/run-smokes.sh
# The grain-connector example is the keyless proof that a trigger can
# run code that lives in the memory (#185) — pin, sandbox, capability,
# cursor, dedup, run start, with no host connector script. It needs the
# sandbox binary, which no other example does.
- name: Build the sandbox (for the grain-connector example)
run: cargo build --manifest-path areev-sandbox/Cargo.toml
- name: A connector that is a grain, end to end
run: |
AREEV_SANDBOX="$PWD/areev-sandbox/target/debug/areev-sandbox" \
examples/grain-connector/run.sh
# And the other half of the same tier: a pack binding the blessed
# http.call blob, one permitted call and one refused by the broker
# (#179). Loopback only — the "upstream" is a stub in the example.
- name: The blessed http.call blob, permitted and refused
run: |
AREEV_SANDBOX="$PWD/areev-sandbox/target/debug/areev-sandbox" \
examples/blessed-tools/run.sh

tls:
# The non-default native-TLS feature (the recorded rustls exception):
Expand Down Expand Up @@ -393,18 +418,35 @@ jobs:
# (it carries wasmi). `cargo test --workspace` never touches it, so it needs
# its own job or a change here can break it silently — the same reason
# areev-js has one.
#
# The blessed tools (areev-tools) ride along: their tests ARE sandbox tests
# (`tests/blessed_tools.rs` runs the committed blobs under the real engine),
# and the manifest check asserts that what dist/blessed.json publishes is the
# address of the file beside it — a pack pins that address, so a drifted
# manifest is a pack pinning bytes nobody reviewed.
sandbox:
name: sandbox (wasm tier C)
name: sandbox (wasm tier C) + blessed tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: build
run: cargo build --manifest-path areev-sandbox/Cargo.toml
- name: test
- name: the published addresses are the addresses of the committed blobs
run: python3 areev-tools/manifest.py --check
- name: test (includes the blessed blobs, run under the real engine)
run: cargo test --manifest-path areev-sandbox/Cargo.toml
- name: clippy
run: cargo clippy --manifest-path areev-sandbox/Cargo.toml --all-targets -- -D warnings
# The SOURCE still has to compile and lint — a blob nobody can rebuild is
# a blob nobody can revise, which is the whole point of putting connector
# code in the memory (#179, #185).
- name: the tool sources still build for wasm32
run: cd areev-tools && cargo build --release --target wasm32-unknown-unknown
- name: clippy (tool sources)
run: cd areev-tools && cargo clippy --release --target wasm32-unknown-unknown -- -D warnings

# The version lives in five places and only one of them is inherited
# (`version.workspace`). maturin reads pyproject.toml, npm reads
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ examples/agents/*/rust/Cargo.lock
__pycache__/
*.pyc

# The coverage trace. The `coverage` CI job produces one at the repo root and
# `scripts/coverage.py` turns it into the small committed artifact
# (docs/coverage.json) that the README chart reads — the 5 MB trace itself is
# never the repo's to carry.
lcov.info

# cargo-mutants output
mutants.out/
mutants.out.old/
Expand Down
70 changes: 70 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,76 @@ field no grain carries is now `CAL-W018` — the same "absence is UNKNOWN, and
the answer says so" rule the #207 amendment above applies to `WHERE`, applied
to the grouping path.

### A connector is a grain, a pack is how it arrives, and three blobs are shared

**Decision (2026-09-09, issues #185/#178/#179):** three changes that only make
sense together — the code an agent runs, how it is installed, and what it does
not have to be written from scratch.

**A trigger may name its connector by content address** (`connector_tool`,
#185). Until now the one piece of code most likely to be wrong — cursors,
pagination, a provider's quirks — was the one piece that lived *outside* the
memory, as a `--connector-cmd` host script: it did not travel in a bundle,
`tool provenance` could not chase it, and the loop could not propose a
`code_revision` against it. A trigger now names a Tool **Definition** (never a
`cas://` blob directly: the runtime, the limits and the `capabilities`
declaration live on the Definition, and a second place to write them would be a
second place for them to disagree), and the evaluator resolves it through
`areev_run::pin_from_definition` — the same reader `RunManifest::resolve` uses,
because a connector running under different rules than a node binding the same
grain would be a second implementation of the pin, and the one that drifts
silently is the heartbeat nobody watches.

The authorization does not travel with the code. `--allow-executor` on the
evaluating host is what runs it, exactly as on the run path; `TRG-E012` refuses
by name before a broker starts. `connector` (the name) stays required beside
it, because the run id is derived from `(trigger, connector, dedup value)` and
revising the code must not renumber the runs.

**A pack is the installable unit** (`areev pack validate|install|export`,
#178). Everyone deploying an agent was writing the same installer: blobs into
the CAS, each `executor_uri` rewritten to the address the bytes turned out to
have, grains seeded in dependency order, plan hashes checked. Two properties
make it more than a script. References are **symbolic** — `blob:<name>`,
`grain:<id>` — because an address is a measurement of bytes and not something
an author can write down, which also means editing a connector's wasm changes
the plan's hash. And `expected_hash` is **refused, not warned**, with nothing
written: a plan that installed at a different address than the deployment
expected has changed what runs, and every trigger pointing at the old hash is
now pointing elsewhere (triggers do not follow heads). Install is validate plus
a destination — every grain is built and addressed with no store at all, since
content addressing is a pure function of the serialized grain — so a CI check
and a deployment cannot disagree about what a pack contains.

**Three blessed `wasm32-areev-io` blobs ship in the repository** (`http.call`,
`mcp.call`, `a2a.call`, #179), content-addressed, with their addresses
published in `areev-tools/dist/blessed.json`. The point is not convenience: a
tool gateway that decides *where a request may go* is code that everyone
installing it has to trust, and `http.call` makes no such decision — it hands
the request to the broker and the answer back, verbatim, both ways. Where it
may go, which method, which credential, which headers are the Definition's
`capabilities` and the host's grant: data, in the memory, replicated with the
tool, auditable without reading any code. The gateway becomes configuration.
Two Definitions may name the same blob with different declarations, which is
the shape a fleet wants — one address to pin, one blob to review, a per-service
policy the memory states out loud.

They are `no_std`, dependency-free and small (`http.call` is 2.6 KB) because a
blessed blob is reviewed as bytes; their JSON handling is a *slicer* that
copies a caller's `arguments` object into the request byte for byte rather than
a parser that round-trips it. `areev-tools/` is a standalone workspace for the
same reason `areev-sandbox` and `areev-js` are, and the blobs are tested where
the engine is: `areev-sandbox/tests/blessed_tools.rs` runs the **committed
bytes** under real wasmi against a loopback broker stand-in, asserting the
import gate holds — a tool that declared no network does not get `areev::fetch`
linked at all.

**What this deliberately does not do.** No registry, no resolver, no version
ranges: a pack names blobs by address and grains by the address they build to,
and "which pack is installed" is answered by asking the memory what it holds. A
package manager would put a mutable name in front of an immutable address,
which is the one thing this data model exists not to do.

### Portability and provenance over lock-in

Grains are content-addressed, immutable, and hash-linked; the format reserves
Expand Down
138 changes: 138 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,116 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
varies per generation while a park and its answer reach the same child; and
a bubble round advances `effect_seq` rather than `attempt`, so parking never
spends the node's retry budget.
- **A trigger can name its connector by content address** (#185). A polling
connector was a host command (`--connector-cmd`), which put the code most
likely to be wrong — cursors, pagination, a provider's quirks — outside the
memory: it did not travel in a bundle, `areev tool provenance` could not
chase it, and the loop could not propose a `code_revision` against it. A
Trigger now carries **`connector_tool`**, a reference to a Tool Definition
whose `executor_uri` is the blob:

```bash
areev trigger add --type polling --workflow <PLAN> --observer gmail \
--connector-tool <DEFINITION> --interval 900 --dedup-key /message_id \
--because "the AP desk watches this mailbox"

areev trigger run --allow-executor <64 hex> --sandbox-cmd areev-sandbox
```

A Definition rather than a `cas://` blob directly, because the runtime, the
limits and the `capabilities` declaration that decides where the code may
reach live on the Definition — a second place to write them would be a second
place for them to disagree. The evaluator reads it through the *same*
`pin_from_definition` `RunManifest::resolve` uses, and dispatches through the
same `CodeExecutor`, so the sandbox argv, the capability registration and the
cleared environment are one implementation rather than a second that drifts
on the surface nobody watches.

**The authorization does not travel with the code.** `--allow-executor` on
the evaluating host is what runs it; without it the poll refuses with the new
**`TRG-E012`**, naming the address to pin, before a broker is started and
before anything is spent. The same code covers a Definition carrying no
`executor_uri`, a declared runtime with no `--sandbox-cmd`, and a
blob-reading module on an evaluator wired no memory locator. `connector` (the
name) stays required beside `connector_tool`: the run id is derived from
`(trigger, connector, dedup value)`, so revising the code must not renumber
the runs. Both bindings take the same pin on `trigger_run`/`trigger_deliver`
(`allow_executor`, `sandbox_cmd`, `executor_cache`, `executor_timeout_secs`),
each reading its `$AREEV_RUN_*` variable, because a heartbeat is a cron line.
`trigger show` now prints the connector and, when it is a grain, says so.
`examples/grain-connector/` runs the whole path keyless and offline.

*Breaking for direct constructors:* `areev_trigger::Evaluator` gained a
`connector_code` field. A host that runs host-command connectors only passes
`None` — and a trigger naming a connector Definition then refuses rather than
falling through to `--connector-cmd`, because a fallback would run a
different program than the declaration names.

- **`areev pack validate | install | export`** (#178) — a pack is an
installable agent: a manifest, the grains it seeds, and the code blobs those
grains name. It replaces the installer everyone was writing (blobs into the
CAS, `executor_uri` rewritten to the address the bytes turned out to have,
grains seeded in order, plan hashes checked) with one verb, and self-hosters
get the same door a managed deployment does.

```bash
areev pack validate ./pack # opens no memory at all
areev pack install ./pack --db agent.db # refuses on a hash mismatch
areev pack export --db agent.db --ns ops --out ./pack
```

References are **symbolic** — `"blob:<name>"` and `"grain:<id>"` — because an
address is a measurement of bytes, not something an author can write down;
install stores the blob, learns its address, rewrites the Definition,
addresses *that*, and rewrites the plan that binds it. `expected_hash` is
**refused, not warned**, with nothing written: a plan installed at a
different address than the deployment expects has changed what runs, and
every trigger pointing at the old hash is now pointing elsewhere. Grains are
built and addressed with no store at all (content addressing is a pure
function of the serialized grain), so `validate` speaks for `install` and can
run in CI on a pull request. Export writes either reviewable grain JSON
(refusing to write anything it cannot rebuild to the same address) or a
bundle plus a manifest of what it must contain. Saved queries and templates
travel too — a pack without them installs a trigger whose `context_query`
names nothing. `docs/pack.md` is the reference; every agent under
`examples/agents/` now ships a `pack/`, and `run-smokes.sh` asserts each one
installs the same plan its language stacks mint.

- **Blessed shared tools: `http.call`, `mcp.call`, `a2a.call`** (#179) — three
`wasm32-areev-io` blobs shipped in this repository with documented content
addresses (`areev-tools/dist/blessed.json`, `docs/blessed-tools.md`). A pack
binds one by address, declares where it may reach, and gets an outbound leg
with no code of its own.

The point is not convenience. A tool gateway that decides *where a request
may go* is code everyone installing it must trust; `http.call` makes no such
decision — it hands the request to the broker and the answer back, verbatim,
in both directions. Where it may go, which method, which credential and which
headers are the Definition's `capabilities` and the host's grant: data, in
the memory, replicated with the tool, auditable without reading any code.
Two Definitions may name the same blob with different declarations, which is
exactly the shape a fleet wants. `mcp.call` and `a2a.call` add one JSON-RPC
envelope and one unwrap, copying the caller's `arguments` **byte for byte**
rather than round-tripping it.

They are `no_std` with no dependencies (`http.call` is 2,598 bytes), built
from `areev-tools/` — a standalone workspace, like `areev-sandbox` — and
tested where the engine is: `areev-sandbox/tests/blessed_tools.rs` runs the
committed bytes under real wasmi against a loopback broker stand-in, and
asserts the import gate holds (a tool that declared no network does not get
`areev::fetch` linked at all). CI checks that every published address is the
address of the file beside it.

- **`examples/agents/sanctions-screening` seeds deterministically.** Its
evalset Fact — the gate Rule E1 pins on the `screen` tool — was stamped with
the wall clock, so the tool's hash, and therefore the desk's plan hash,
differed on every seed. A plan hash that moves cannot be pinned by a pack,
quoted in a README, or pointed at by a trigger, and nothing caught it because
the cross-stack hash comparison needs two stacks and this desk has one. The
seeder now pins `created_at` like every other grain it writes. Pinning it
surfaced a second bug, fixed below rather than worked around: a dated evalset
is exactly what `cold_grains` was mis-flagging as a retire candidate.


- **The benchmark harnesses can run against a Postgres memory** (#200).
`AREEV_BENCH_DB` (or `receipts/run.py --db`) names the memory — a file path
Expand Down Expand Up @@ -240,6 +350,34 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Fixed

- **`areev tool provenance` reports the runs that executed a tool.** The doc
said it chained code "to the runs that executed it"; the command answered
`runs_touching: 0` for a Definition a run had just executed. The walk behind
it is a PROVENANCE walk — `derived_from` up, the reverse index down — and a
journal's result grain supersedes its intent while neither supersedes the
Definition, so there was no edge to find. What connects a run to the code it
ran is §8.4's `spec_hash`, and `runs_touching` now reads it backwards for a
Tool Definition (`Areev::runs_executing`, exposed on its own too). A bounded
scan rather than an index read, because `spec_hash` is a field and not a
`related_to` link — and skipped entirely unless the target IS a Definition,
so no other caller pays for it. Pinned by a conformance case on both
backends; `examples/blessed-tools/` asserts both runs, the refused one
included, because a request the broker turned down is still a run that
touched that code.

- **`cold_grains` no longer proposes retiring a Rule E1 gate.** An evalset a
live Tool Definition pins is read by the gate at review time, never through
recall, so it aged past the grace window and was flagged as a retire
candidate — the one grain that must not be retired, since removing it removes
the gate a `code_revision` has to pass. Recall counts measure whether a fact
informs *answers*; that fact's job is to judge *code*. Facts pinned as
`evalset_hash` by a live Definition are now excluded, and deliberately only
those: a general "any hash a live grain mentions" sweep would also swallow
the evidence a pending recommendation cites, and since this analyzer's own
findings cite the fact they flag, every cold finding would suppress itself on
the next run. `examples/agents/sanctions-screening` drops the config widening
it needed and asserts the clean result instead.

- **An `ASSEMBLE` source can carry its own pipeline, and no longer drops a
nested assembly's grains.** Sources had no pipeline at all, so a source
could not be ranked, bounded or summarised in place. Separately,
Expand Down
Loading