This file teaches Cursor, Windsurf, Claude Code, GitHub Copilot, and Google Antigravity about the shape of this repository. Keep the following files in sync when making changes to rules:
.cursorrules(Cursor).windsurfrules(Windsurf).github/copilot-instructions.md(GitHub Copilot)AGENTS.md(Cross-tool foundation / Claude Code)GEMINI.md(Google Antigravity-specific rules).antigravityrules(Antigravity boundaries)
ActantDB is a hash-chained event ledger for AI agents. Every action an
agent takes — a model call, a tool call, a memory write, a guard
verdict — lands as a typed, append-only event in SQLite (default) or
Postgres. Consumers wrap their existing agent framework (Mastra,
LangGraph, raw SDK calls) with withActant() from @actantdb/mastra
and get a complete, replayable trace for free.
- TypeScript packages live in
packages/. Each package publishes as@actantdb/<name>and uses ESM only. Node ≥ 22.5 (we usenode:sqlite). - Rust crates live in
crates/. The HTTP+WS server binary isactant-server(built asactantdb-server); the CLI binary isactant-cli(built asactantdb). - The single source of truth for every public type is
crates/actant-contracts/. Generated TypeScript bindings land inpackages/actant-types/src/generated/. - Specs live in
specs/. Every active spec has a## Verificationsection enforced bytests/spec_NN_verification.rsin the relevant crate. - Agent Guidelines live in
agents/. Every agent markdown file must contain all required layout sections.
- No new public type outside
actant-contracts. If you need to add a struct that crosses a crate boundary or appears in the public API, editcrates/actant-contracts/src/lib.rsfirst. - Never hand-edit
packages/actant-types/src/generated/*. Those files are produced bycargo run -p actant-contracts --bin actant-contracts -- codegen-ts. If the generated TypeScript is wrong, fix the Rust contract and regenerate. - The default install path is
npm install @actantdb/all. Do not add Rust toolchain steps, Docker, or exposed ports to consumer-facing READMEs. Server mode is opt-in; embedded mode runs in Node out of the box. - Every agent action is a typed event in a hash-chained ledger.
When you're unsure about an event payload, look at
@actantdb/typesfirst, thencrates/actant-contracts/src/lib.rs. Theprev_chain_hashfield on every row is load-bearing — don't skip it.
- The product written as one word is lowercase
actantdb. - The CLI binary is
actantdb. - The umbrella npm package is
@actantdb/all. - Crates are named
actant-*(kebab-case), Rust types areActant*. - SQL identifiers use
snake_case, IDs areTEXT, timestamps are ISO-8601 strings.
- For codebase questions, first run
graphify query "<question>"whengraphify-out/graph.jsonexists. Usegraphify path "<A>" "<B>"for relationships andgraphify explain "<concept>"for focused concepts. - If
graphify-out/wiki/index.mdexists, use it for broad navigation instead of raw source browsing. - Read
graphify-out/GRAPH_REPORT.mdonly for broad architecture review or when query/path/explain do not surface enough context. - After modifying code, run
graphify update .to keep the graph current (AST-only, no API cost).
- Codex hooks live in
.codex/hooks.jsonand delegate to.codex/hooks/actantdb-context.sh. - Project skills live in
.agent/skills/; workflows live in.agent/workflows/. - Git hooks live in
.githooks/and should be active throughgit config core.hooksPath .githooks.
- Rust check (fast):
just checkorcargo check -p <crate> --all-targets - Rust tests (per crate):
cargo test -p <crate> <test_name> - TypeScript build:
pnpm -r build - TypeScript tests:
pnpm -r testorpnpm --filter @actantdb/<pkg> test - Regenerate TS types from contracts:
cargo run -p actant-contracts --bin actant-contracts -- codegen-ts - Smoke test (required green on every PR):
pnpm smoke - Verify Specs compliance:
just verify-specs - Verify Agent compliance:
just verify-agents - Full CI check:
just ci
- Do not run
cargo test --workspacelocally — the build artefacts can crash low-disk machines. Usecargo test -p <crate>instead. - Do not add Rust toolchain steps to the default install instructions in any README a consumer reads.
- Do not introduce a new public type without first editing
actant-contractsand regenerating bindings in the same PR. - Do not hand-edit anything under
packages/actant-types/src/generated/. - Do not treat the wedge framing as v1 and the substrate as
future — both are present and active. See
PIVOT.md.
- Repo orientation:
CLAUDE.md,PIVOT.md,README.md. - What landed when:
CHANGELOG.md. - Outstanding work:
GAPS.md,DEVX_GAPS.md,GATES.md. - Per-spec verification status:
SPECS_STATUS.md. - Architecture:
specs/00-overview.mdand friends.