cruxible
AGENTS.md17 starsChanged 14 days agoApache-2.0View on GitHub
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository. GitHub: https://github.com/cruxible-ai/cruxible Cruxible is hard state for AI agents: typed, governed, durable state that humans and agents share. Values are Claims about Subjects under ClaimTypes; every change is a proposal checked deterministically, accepted under an approval policy with signed approvals, and recorded in a Git ledger whose generations have reproducible coordinates. Procedures and Lines automate work over that state. No LLM runs inside Cruxible. User documentation…
- Installs packages
- Commits and pushes
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 35,196 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 repository5 other files it gives its agents.
- adopt-kitSkill
- automate-stateSkill
- create-stateSkill
- review-stateSkill
- surveySkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
14 rules. About 1 is common, 8 are distinctive, and 5 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
Do NOT include Co-Authored-By lines in commit messages.
- Distinctive: line 63
When implementing multi-fix plans, commit each logical fix as it's completed (source + tests together).
- Distinctive: line 71
Plan from state: Before planning, starting, resuming or reporting on work, read the relevant project-state items.
- Distinctive: line 74
Record agreements when they are made: When the maintainer agrees a plan, batch, scope or acceptance criterion, record it as (or revise it …
- Distinctive: line 86
Disagreement is a finding: When code, memory or a conversation disagrees with state, stop and reconcile: surface the discrepancy to the …
- Very specific: line 97
Read the existing project workspace's project-state/README.md and current accepted items first.
- Common: line 100
Use the public typed SDK and existing credentials: revise existing Claims, prepare, submit, inspect the exact changeset, satisfy the …
- Distinctive: line 103
Never patch ledger files or projection databases directly.
- Very specific: line 108
Keep receipts/timings in the existing .cruxible/project-state/ checkpoint area.
- Distinctive: line 114
Before the final reply, check: code outcome recorded, acceptance/readback verified, views refreshed.
- Very specific: line 149
Run uv lock (the lock records both workspace versions), then uv lock --check and uv run python scripts/check_version_lockstep.py
- Distinctive: line 254
A cache must be cheaper to validate than to rebuild: If proving an entry still holds means re-checking every input it ever read, it is not …
- Distinctive: line 265
Say it in the change: Every new loop over a whole population (all Claims, all generations, all bodies) states its trigger, its growth and …
- Very specific: line 325
All errors inherit from CoreError in errors.py.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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.md
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
Project Overview
GitHub: https://github.com/cruxible-ai/cruxible
Cruxible is hard state for AI agents: typed, governed, durable state that humans and agents share. Values are Claims about Subjects under ClaimTypes; every change is a proposal checked deterministically, accepted under an approval policy with signed approvals, and recorded in a Git ledger whose generations have reproducible coordinates. Procedures and Lines automate work over that state. No LLM runs inside Cruxible.
User documentation lives in docs/ (start at docs/index.md); the Python SDK
reference is packages/cruxible-client/README.md; agent skills are in
skills/.
Commands
# Install dependencies (both workspace packages, all extras)
uv sync --all-packages --all-extras
# Run the full suite in parallel (pytest-xdist; CI and scripts/ci_parity.sh run it this way).
# --dist loadfile keeps each file on one worker, so module-scoped fixtures build once.
uv run pytest -n auto --dist loadfile
# Run a selection serially
uv run pytest tests/test_claims -v
# Provider-runtime tests need a cruxible-providers checkout, as in CI; without
# CRUXIBLE_PROVIDERS_CHECKOUT they skip (see CONTRIBUTING.md)
export CRUXIBLE_PROVIDERS_CHECKOUT=../cruxible-providers
uv pip install "$CRUXIBLE_PROVIDERS_CHECKOUT/packages/cruxible-provider-runtime"
# Run Docker image tests (requires Docker)
CRUXIBLE_RUN_DOCKER_TESTS=1 uv run pytest tests/test_image -m docker
# Lint, format, type check
uv run ruff check src packages/cruxible-client/src tests
uv run ruff format src packages/cruxible-client/src tests
uv run mypy src packages/cruxible-client/src
# Regenerate a pinned surface after an intentional change, then review the diff
uv run python scripts/update_playbill_served_surface.py
uv run python scripts/update_client_contract_snapshot.py
uv run python scripts/update_http_surface_snapshot.py
uv run python scripts/update_authoring_wire_catalog.py
# Everything CI runs, locally, before a push
scripts/ci_parity.sh
# Run the daemon and CLI from the checkout
uv run cruxible server start --socket ~/.cruxible/run/daemon.sock
uv run cruxible initGit Conventions
- Do NOT include
Co-Authored-Bylines in commit messages. - When implementing multi-fix plans, commit each logical fix as it's completed (source + tests together). Don't defer all commits to the end — partial staging across shared files is error-prone. After all commits, prepare a review guide covering the full set.
Strict project-state adherence
Project state is the record of what was agreed and what is done. Conversation history, transcripts and agent memory are not: they drift, compact and get misread. Treat state as authoritative and keep it ahead of the work.
- Plan from state. Before planning, starting, resuming or reporting on work, read the relevant project-state items. Answer "what's left", "did we do X" and "are we done" from accepted state, naming the items, never from memory.
- Record agreements when they are made. When the maintainer agrees a plan, batch, scope or acceptance criterion, record it as (or revise it into) a project-state item in the same working session, before implementation starts. A plan that exists only in a conversation is not agreed.
- No silent re-scoping. Narrowing, splitting, redefining, deferring or dropping an agreed item requires telling the maintainer explicitly, getting a ruling, and recording that ruling in state. Never keep an item's name while changing what it delivers; new scope is a new item, and the original stays open until it is closed by a recorded ruling.
- Done means the recorded criteria are met. Report an item or program as done only when every acceptance criterion recorded for it is met at an accepted coordinate. Otherwise list what remains, by item.
- Disagreement is a finding. When code, memory or a conversation disagrees with state, stop and reconcile: surface the discrepancy to the maintainer and correct whichever side is wrong. Do not proceed on the unrecorded version.
Project-state completion requirement
A meaningful implementation, merge, deployment, review outcome, or maintainer scope ruling is not complete until its existing project-state item is reconciled. Do this without waiting for a reminder. Batch one coherent checkpoint at the end of the work; do not write after every tool call or create telemetry-only updates.
- Read the existing project workspace's
project-state/README.mdand current accepted items first. Linked worktrees reuse that instance and workspace; do not initialize a competing project instance or invent a second roadmap. - Use the public typed SDK and existing credentials: revise existing Claims, prepare, submit, inspect the exact changeset, satisfy the instance's approval policy, accept, and verify the changed values at the receipt's coordinate. Never patch ledger files or projection databases directly.
- Record the exact code range and validation, remaining failures, and task ownership. Keep implemented, merged, pushed, deployed, adopted, and released distinct. Preserve unrelated work and release/scope rulings.
- Refresh existing gitignored governed views after acceptance and check sync.
Keep receipts/timings in the existing
.cruxible/project-state/checkpoint area. Do not put operational scripts, payloads, or review guides indocs/. - Measure connection, reads, prepare, submit, review/approval, acceptance and readback separately; record omissions, retries and workflow friction. Carry the previous completed timing observation in the next meaningful checkpoint, without a recursive measurement-only write.
- Before the final reply, check: code outcome recorded, acceptance/readback verified, views refreshed. If access or compatibility blocks the update, report the specific blocker and retained pending intent/proposal rather than claiming state is current. Do not silently upgrade a daemon to fix SDK skew.
This completion requirement does not authorize unrelated state changes, expanded release scope, or sending messages to other agents or people.
Versioning
Version lives in these places — keep them in sync:
pyproject.toml(version = "X.Y.Z")src/cruxible_core/__init__.py(__version__ = "X.Y.Z")packages/cruxible-client/pyproject.tomland the core pin on itpackages/cruxible-client/src/cruxible_client/__init__.py(__version__)server.json(the MCP registry listing: top-level and packageversion)
scripts/check_version_lockstep.py checks all of them. The MCP server name
includes the version (cruxible vX.Y.Z) so agents and users can confirm which
build is running.
When to bump:
- Patch (0.2.x): Bug fixes, doc/prompt wording changes, test additions
- Minor (0.x.0): New features (tools, evaluate checks, config capabilities), breaking prompt changes
- Major (x.0.0): Breaking API changes (tool signatures, config schema, storage format)
Recorded ruling — maintainer, 2026-08-06 (dd-compat-sacrificeable-for-product). The 0.4.x
line may break 0.3 compatibility; staging within 0.4.x is allowed. This carves out the rows
above for 0.4.x: a config-schema or storage-format change that would otherwise be MAJOR ships
inside the minor. Provenance integrity is not compatibility and may never be sacrificed —
stored digests are never recomputed under a different rule, and receipts stay verifiable
forever, including by the frozen verifiers of retired formats.
Release process:
- Bump the version in every place listed above
- Run
uv lock(the lock records both workspace versions), thenuv lock --checkanduv run python scripts/check_version_lockstep.py - Commit:
Bump to vX.Y.Z - Tag:
git tag vX.Y.Z - Push:
git push && git push --tags; on the tag,publish.ymlverifies the lockstep and publishes both PyPI packages, andpublish-runtime-image.ymlbuilds and pushes the runtime image. Neither creates a GitHub release; write one by hand if the release needs notes
Architecture
One daemon, three clients
The daemon (cruxible server start, server/) is the only process that
touches accepted state. It serves an HTTP API over a Unix socket or TCP. The
CLI (cli/), the MCP server (mcp/) and the Python SDK
(packages/cruxible-client/) are all clients of that API.
CLI (cli/) ─┐
MCP server (mcp/) ├─HTTP─▶ routes (server/routes/) ─▶ runtime facade (runtime/playbill_api.py)
SDK (packages/cruxible-client) ┘ ─▶ service/<domain>/ ─▶ domain packages- HTTP (
server/): FastAPI routes with bearer-token auth (off by default on a Unix socket, required on TCP), the state-root lock, credentials, and the host registry. - Runtime facade (
runtime/playbill_api.py): translates wire contracts and delegates to the service layer;runtime/instance.py(PlaybillInstance) manages one instance's managed root. - Service layer (
service/<domain>/): the single home for served orchestration (authoring, claims, evidence, proposals, procedures, discovery and reads, floor, kits). Never duplicate orchestration in a route, a handler or a CLI command. - CLI (
cli/commands/): Click commands that call the daemon through the SDK'sCruxibleClient. - MCP (
mcp/): FastMCP tools named after their CLI paths (cruxible_proposal_approve), each a daemon client call;curation.pydefines the default and full profiles. - SDK (
packages/cruxible-client/): typed contracts (cruxible_client.contracts), the HTTP transport (CruxibleClient), and the agent-facingCruxibleSDK with World, authoring drafts and handles.
Client-side work stays on the client and sends the daemon bytes, never paths: source compilation, file-evidence observation, projection-block stamps, floor writes, and approval signing with a principal's private key.
Accepted state
Each instance's managed root under the daemon state root
(<state-root>/instances/<id>/) holds:
instance.json # instance descriptor
ledger.git/ # accepted generations, proposals, and their Git notes
cas/ # content-addressed bodies
exhaust/ # journals, triggers, proposal evidence, operational stores
projections/ # rebuildable served indexes
credentials/ # daemon signing custody
leases/ # local writer leasesThe signed generation ledger is authority; every accepted generation has a
coordinate (Git OID, semantic root, generation root, compiler digest).
Indexes, the workspace floor and projection blocks are derived and
rebuildable. The compiler (compiler/) is the pinned, versioned
interpretation of the ledger; adopting a new compiler revision is a governed
proposal.
Semantic families
Domain packages own the artifact kinds and their acceptance laws: claims/
(Subjects, ClaimTypes, Claims, attestations), evidence/ (Captures and
CaptureContracts), documents/, query/ (named queries), procedures/
(graph-format-6 Procedures, Blueprints, Lines, measurements), providers/
(ProviderInterfaces, Providers, installation and the built-in
workspace.file), triggers/, governance/ (principals, approval policy,
genesis seeds), curation/, coverage/ and floor/. consumers/ runs the
daemon's background workers (floor delivery, the next findings worker, and
enabled Lines), driven by Triggers and accepted generations. Curation is not
served in 0.5.0: curation/ is dormant in the tree, and authoring a Trigger
or Runbook step aimed at curation.detect refuses as not served.
Two write lanes
Values change through the write verbs (set, add, retire, write), which
lower into an ordinary authoring change set and accept it when the approval
policy and the caller's tier allow. Definitions go through authoring
(authoring submit, staged intents). ClaimTypes keep their own claim-type
group, because changing vocabulary disposes dependent Claims.
Cost model
A write, a background tick or a read pays for the change it handles, not for the size of the instance. A merge that adds work growing with all Claims, Subjects, Captures, generations, journal records or stored bodies on a per-write, per-generation, per-tick or per-request path is a defect, even when the result is correct.
- Derived state updates from what changed. Queues, findings, statuses, projections and block sync update from the change records that already exist: an accepted generation's changed paths (its diff against the parent), journal and trigger sequence cursors, attestation-store heads, and Capture digests. A full rebuild runs only on cold start, after a format change, or as an explicit repair.
- Immutable artifacts are parsed and hashed once. Claims, Captures and other content-addressed artifacts are cached per process by content id (blob oid or digest). An unchanged artifact is never re-read, re-validated or re-digested on a later pass.
- A cache must be cheaper to validate than to rebuild. If proving an entry still holds means re-checking every input it ever read, it is not a cache: index entries by their inputs and invalidate the entries a change touches.
- Reads answer from maintained state.
orient,get,queryandnextserve from indexes and worker findings; a full live fold on every call is only the fallback for an explicit historical--ator a cold instance. nextis incremental. Thenextworker'sfactspart keeps each Claim's facts and next's rows per key from generation paths, door events, CAS landings, re-observations and onenext.expiredeadline; reads at the head serve them (deriving in memory what the worker has not followed), and_oracle_claim_rowsis only the fallback and the tests' reference.- Say it in the change. Every new loop over a whole population (all Claims, all generations, all bodies) states its trigger, its growth and why no change record can drive it, in the commit message and the report. Reviewers block on per-event work that grows with the instance unless that reason holds.
- Measure at two sizes. Tests on a few dozen Claims cannot show this; check
new per-event paths on a small and a large instance and compare the work done,
not just the answer. CI's scale guard,
tests/test_scale, counts this work for each write, tick and read route at two instance sizes; a route that grows today carries a strict xfail naming where, and a fix removes that xfail.
Integrity and isolation
On-disk checks protect against accidents, not against agents. Hashes, read-back
verification, the evidence sweep and the landing log's damage records catch
crashes, partial writes, bit rot and stray edits: a body found missing or
corrupt is recorded as a sequenced change, and reads then treat it as
unavailable (never as an error that fails a whole next or orient), while a
direct byte read still refuses. Reads take presence from the landing index and
never stat or hash bodies on the clean path. None of this is a security
boundary: any process running as the daemon's user can rewrite its files.
Security against agents comes from process isolation (agents never get the
state root; the daemon owns it) plus the API: authenticated transport,
permission tiers and signed governance authority. Do not add per-read file
checks to defend against same-user tampering, and size test instrumentation for
honest product code.
Key design decisions
- Zero LLM dependencies. Deterministic runtime; agents supply judgment through MCP, the CLI and the SDK, and providers supply contracted computation.
- Pydantic for contracts and receipts. Canonical values reject ambiguous encodings; new surfaces are typed models and discriminated unions, never loose dicts.
- Git plus signed ledgers for governed authority. SQLite indexes and operational stores never replace the accepted tree.
- Frozen format tags. Stored and served format tags keep their
playbill-*-vNspelling, because digests and signatures cover them; public names say Cruxible.
Permission tiers
Four cumulative tiers (ADMIN ⊃ GRAPH_WRITE ⊃ GOVERNED_WRITE ⊃ READ_ONLY),
defined as PermissionMode in runtime/permissions.py, with the tier of
every MCP tool in TOOL_PERMISSIONS:
| Tier | Env value | Allows |
READ_ONLY | read_only | Reads, queries, coverage, work queues |
GOVERNED_WRITE | governed_write | Also authoring, proposals, value writes, attestations, Line enablement |
GRAPH_WRITE | graph_write | Also approving and activating proposals |
ADMIN | admin (default) | Also credentials, hosts, principals, compiler upgrades, provider installs, ledger mirrors |
A bearer credential carries a tier; --capability-ceiling (or CRUXIBLE_MODE)
caps the daemon, and CRUXIBLE_MODE caps an MCP server. Principals (governed
signing keys) are separate from credentials: they attribute acts and sign
approvals. Audit logging uses structlog to stderr.
Error handling
All errors inherit from CoreError in errors.py. Wire and execution refusals
are typed in cruxible_client.contracts.errors, with codes
cruxible.<family>.<name>, and every refusal names its repair.
Test organization
Tests mirror domain ownership under tests/test_<domain>/ (test_claims,
test_procedures, test_ledger, ...), plus test_client, test_server,
test_cli and test_mcp; shared fixtures live in tests/core_support/.
tests/test_architecture and tests/test_guardrails pin boundaries, public
snapshots, contract catalogs, the reference docs and the public vocabulary.
Golden journal-corpus tests under tests/goldens/ are intentionally expensive
and should only run when a change touches what they pin. tests/test_scale
is the scale guard: one module that builds a small and a ten-times larger world
once per worker and fails when a route's counted work grows with the instance.
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.

