agent-os
AGENTS.md237 starsChanged 7 months agoApache-2.0View on GitHub
AgentOS is a deterministic, event-sourced computing substrate for AI agents. AIR (Agent Intermediate Representation) is the typed control-plane IR governing schemas, modules, effects, secrets, and manifests. Future protocol notes: - spec/20-gc.md — GC/reachability contract draft; deletion GC is not implemented yet. Reference shelves: - spec/schemas/ (JSON Schemas) - spec/defs/ (built-ins: Timer/Blob/HTTP/LLM/Workspace/Introspect plus SDK support schemas) World: Single-threaded deterministic kernel state. Replay checkpoint/snapshot + journal frames + receipts = identical state. Workspaces: Versioned tree registry (sys/Workspace@1). Tree ops (workspace.*) are internal…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,843 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- shell/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 56
Only workflow modules may emit effects.
- Very specific: line 143
When asked how many lines of code, use cloc $(git ls-files)
- Very specific: line 144
If the user complains that the computer goes to sleep tell him to use caffeinate -i
- Distinctive: line 155
When architecture/spec behavior changes:
- Very specific: line 156
Update relevant files in spec/.
- Distinctive: line 157
Update this file (AGENTS.md / CLAUDE.md symlink) for top-level guidance.
- Distinctive: line 158
Keep this file aligned with active runtime semantics (post-plan workflow model).
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agents
This file provides guidance to coding agents when working with code in this repository.
What This Is
AgentOS is a deterministic, event-sourced computing substrate for AI agents.
AIR (Agent Intermediate Representation) is the typed control-plane IR governing schemas, modules, effects, secrets, and manifests.
Reading the Specs (index)
- spec/01-overview.md — Core concepts and mental model.
- spec/02-architecture.md — Runtime components, storage layout, governance phases.
- spec/03-air.md — CRITICAL AIR v1 spec (post-plan active model).
- spec/04-workflows.md — Workflow module semantics and orchestration patterns.
- spec/05-effects.md — Effects, async execution, durable open work, and continuation admission.
- spec/06-backends.md — Backend contracts, SQLite/Kafka journals, local/object-store CAS, and recovery.
Future protocol notes:
- spec/20-gc.md — GC/reachability contract draft; deletion GC is not implemented yet.
Reference shelves:
- spec/schemas/ (JSON Schemas)
- spec/defs/ (built-ins: Timer/Blob/HTTP/LLM/Workspace/Introspect plus SDK support schemas)
Core Architecture (TL;DR)
World: Single-threaded deterministic kernel state. Replay checkpoint/snapshot + journal frames + receipts = identical state.
Workspaces: Versioned tree registry (sys/Workspace@1). Tree ops (workspace.*) are internal effects used by aos ws plus aos push/aos pull.
Active layers:
- Workflow modules (WASM,
module_kind: workflow): deterministic state machines on workflow ABI; own orchestration/state transitions. - Pure modules (
module_kind: pure): side-effect-free compute helpers. - Kernel (
aos-kernel): synchronous authoritative world execution, governance, manifests, effect authorization, snapshots, replay, and open-work state. - Unified node (
aos-node): owns hot worlds, serializes per-world execution, stages completed slices, durably flushes journal frames, serves hot control reads, and publishes opened async effects only after durable append. - Executors/Adapters: async edge execution for external work; stream frames and receipts re-enter only as world input through owner admission.
Governance path:
- propose -> shadow -> approve -> apply -> execute -> receipt -> audit
Shadow reports bounded observed effects/in-flight state and ledger deltas. Primary state is unchanged until apply.
Runtime shape (v0.19+):
aos-cliis the executable surface;aos node upstarts the unified node through the hiddennode-serveentrypoint.aos-nodeis library-only and contains runtime/control/backend implementation.- There are no separate
aos-node-local,aos-node-hosted, oraos-hostproduct crates. - Direct HTTP/control acceptance is the default ingress path.
- Reads are hot in-process reads from active worlds, not projection/materializer reads.
- SQLite is the default journal backend; Kafka is an explicit journal backend, not the system architecture.
- Discovery/checkpoints are world-based. Journal partitioning is backend metadata only.
- Acceptance returns backend-neutral
accept_token/sequence semantics, not Kafka-shaped submission offsets.
Critical boundaries (v1/v0.19):
- Only workflow modules may emit effects.
- Emitted effects must be declared in
abi.workflow.effects_emitted. - Emitted effects must pass declared-effect and origin-scope authorization before dispatch.
- Open external work is recorded before execution starts.
- Opened async effects are published only after their containing frame has durably flushed.
- Executors never mutate world state directly; stream frames and receipts re-enter through world input.
- Domain ingress wiring is
routing.subscriptions. - Receipt continuation routing is manifest-independent and uses pending intent identity.
- Strict quiescence blocks apply while in-flight runtime work exists.
Key Principles
- Determinism by default (replay-identical state)
- Explicit effects (no ambient I/O)
- Receipts everywhere (signed, auditable)
- Minimal trusted base
- Content-addressed, portable worlds
Implementation Notes
Testing invariant: "Replay-or-die" — replay from genesis must produce byte-identical snapshots.
Key implementation notes:
- Loader accepts authoring sugar + canonical JSON, validates against schemas, emits canonical CBOR.
- Validator enforces module ABI contracts, routing semantics, and effect allowlists.
- Effect manager canonicalizes params, authorizes effect origins, records open work, and validates admitted continuations/receipts.
- Event and receipt ingress are schema-validated and canonicalized once; journal stores canonical CBOR.
- Manifest changes are journaled as
Manifestrecords; replay applies them in order. - Node execution center:
aos-node/src/worker/owns hot-world scheduling, slice staging, durable flush, replay/open, and checkpoint publication. - Async execution edge:
aos-node/src/execution/starts timers/external effects after durable flush; adapters live inaos-effect-adapters. - Backend seams:
aos-node/src/model/backends.rsdefines journal, checkpoint, world inventory, and blob contracts; implementations live underaos-node/src/infra/. - Control surface:
aos-node/src/control/serves hot active-world reads and direct acceptance. Do not rebuild projection/materializer paths for default reads. - Module build/cache: workflows compiled via
aos-wasm-build, cached under.aos/cache/{modules|wasmtime}. - Rust-authored AIR uses SDK derives plus
aos_wasm_sdk::aos_air_world!; check generated package AIR withaos air checkwhenair/generated/is committed. - Workspace sync uses optional
aos.world.jsonworkspace entries plusaos push/aos pull; filesystem names are segment-encoded with~-hex when needed.
Project Structure (Rust workspace, edition 2024)
Crates keep deterministic core small and effectful code at the edges:
aos-air-types— AIR data types, schemas, manifests, effects, and semantic validation.aos-air-exec— Pure AIR expression/value evaluator.aos-cbor— Canonical CBOR + SHA-256 helpers.aos-kernel— Deterministic synchronous world kernel: manifests, governance, effect authorization, internal effects, open work, journal tail, snapshots, replay, and workflow runtime state.aos-wasm-abi—no_stdenvelopes shared by workflow/pure WASM components.aos-wasm— Deterministic Wasmtime wrapper for module execution.aos-wasm-sdk— Workflow helper library forwasm32-unknown-unknown.aos-wasm-build— Deterministic workflow compiler + module cache.aos-effect-types—no_stdbuilt-in effect parameter/receipt payload types.aos-effects— Effect intent, receipt, stream frame, capability grant, normalization, and shared traits.aos-effect-adapters— Async adapter registry and implementations for HTTP, LLM, blob, timer, vault, and host/session effects.aos-node— Unified node library: worker runtime, hot control facade, direct HTTP/control acceptance, async effect runtime, replay/checkpoints, SQLite/Kafka journal backends, blobstore, vault, and node startup config.aos-cli— Primaryaosbinary: CLI parsing, profiles, workspace commands, authoring flows, control client, andaos nodeorchestration.aos-authoring— Authored-world build/upload/sync helpers, manifest loading, module placeholder resolution, and local state utilities.aos-llm— Shared LLM client/provider abstraction used by adapters and agent tooling.aos-agent—aos.agent/*contract types, helper reducers, and workflow binaries for agent sessions.aos-agent-eval— Prompt/tool eval runner for agent session workflows.aos-harness-py— Python bindings for runtime/world harnesses; use the repo.venv.aos-smoke— CLI runners for numbered demos incrates/aos-smoke/fixtures/.fabric-protocol— Fabric request, response, event, and OpenAPI types; noaos-*dependencies.fabric-client— Fabric controller/host HTTP client and NDJSON exec stream helpers.fabric-controller— Fabric controller API, SQLite state, scheduling, host registration, and proxying.fabric-host— Fabric host daemon and smolvm-backed session provider.fabric-cli— Development CLI binary namedfabric.
Fabric lives in this AOS workspace as generic host/session edge infrastructure. AOS-specific
translation stays in aos-effect-adapters; Fabric crates must not depend on aos-node,
aos-kernel, or aos-effect-adapters. The smolvm source dependency is the third_party/smolvm
submodule, while local generated runtime bundles live under ignored third_party/.cache/ and
third_party/smolvm-release/.
Test Strategy (Concise, Deterministic)
- Unit tests live next to code: place
mod testsat the bottom with#[cfg(test)]. - Integration tests go under
tests/when crossing crate boundaries, doing I/O, or running kernel/effect flows. - Naming:
function_under_test_condition_expected(). - Determinism: no wall-clock/randomness; use deterministic fixtures.
- Errors: assert on typed errors/kinds, not strings.
- Parallel-safe by default.
- Doctests should compile and run.
- Store CBOR/journal goldens under
tests/data/and diff byte-for-byte. - Replay-or-die: run once, journal, replay from genesis, assert byte-identical snapshots.
- Async tests: prefer
#[tokio::test(flavor = "current_thread")]when determinism matters. - Runtime/backend integration tests often require
--features e2e-testsonaos-node,aos-effect-adapters, oraos-kernel.
Other Notes
- When asked how many lines of code, use
cloc $(git ls-files) - If the user complains that the computer goes to sleep tell him to use
caffeinate -i - Python work in this monorepo should use the shared repo env at
.venv, not per-project virtualenvs. - Bootstrap/update that env with
./setup-python.sh; it installs the localaos-harness-pypackage viamaturin develop.
Examples Ladder
- See
crates/aos-smoke/fixtures/README.mdfor numbered demos.
Keeping Documentation Updated
When architecture/spec behavior changes:
- Update relevant files in
spec/. - Update this file (AGENTS.md / CLAUDE.md symlink) for top-level guidance.
- Keep this file aligned with active runtime semantics (post-plan workflow model).
Specs are source-of-truth; this file is a practical index.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

