agentleFS
Vortx-AIVortx-AI/emem/AGENTS.md

emem

AGENTS.md64 starsChanged 7 months agoApache-2.0View on GitHub

This file is the README for coding agents working on the emem source. Per the agents.md convention (OpenAI Codex, 2025; Linux Foundation AAIF, Dec 2025): build commands, test rules, code style, and what's off-limits during autonomous runs. End users of the protocol should read docs/agents.md and skills.md instead; those describe how to use emem from an agent. If you only want to call emem (not edit its source), here is zero to a signed answer in three calls: 1. Ask.…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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.

The file

We split this AGENTS.md into the rules it gives an agent

9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    If you only want to *call* emem (not edit its source), here is zero to a signed answer in three calls:

    line 12
  2. Very specific:

    Cite it: Verify the receipt offline at /verify or via POST /v1/verify_receipt.

    line 27
  3. Very specific:

    No unsafe: Every crate carries #![forbid(unsafe_code)] at the top.

    line 101
  4. Very specific:

    No unwrap() on user-facing paths: Use ? with structured errors.

    line 102
  5. Very specific:

    Don't widen pub: Keep crate boundaries tight.

    line 105
  6. Distinctive:

    Comments: only when the *why* is non-obvious (a hidden constraint, a workaround for a specific bug, a subtle invariant).

    line 107
  7. Very specific:

    Commit messages are sentence-case, ≤72 chars on the subject line.

    line 120
  8. Very specific:

    Never: add a Co-Authored-By: Claude trailer or any AI attribution trailer.

    line 124
  9. Very specific:

    Don't commit on the user's behalf without an explicit instruction.

    line 128

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file is the README for coding agents working on the emem source. Per the agents.md convention (OpenAI Codex, 2025; Linux Foundation AAIF, Dec 2025): build commands, test rules, code style, and what's off-limits during autonomous runs. End users of the protocol should read docs/agents.md and skills.md instead; those describe how to use emem from an agent.

First 5 minutes (using emem as an agent)

If you only want to call emem (not edit its source), here is zero to a signed answer in three calls:

  1. Ask. POST /v1/ask {"question":"what is the NDVI near Mount Fuji?"} (MCP tool emem_ask, or emem_intent / POST /v1/intent for a structured single-shot). The classifier routes the question to one of four paths: a self-description of emem, a corpus audit (a redirect to the coverage endpoints, with no receipt), a hunter sweep over a region, or a point answer. The hunter sweep and the point answer carry a signed receipt. Ask answers point questions with a current value, so send a change question ("how has X changed") to emem_intent with did_change, or to emem_diff. This is the fastest path.
  2. Or take control. POST /v1/locate {"place":"Mount Fuji"} → a cell64, then POST /v1/recall {"cell":"<cell64>"} (auto-materialises on a miss).
  3. Cite it. Verify the receipt offline at /verify or via POST /v1/verify_receipt; hand other agents an emem:fact: token from emem_memory_token (or emem_memory_bundle for several).

Newer "connect & evolve" surfaces (typed temporal edges, the contradiction-fed refinement loop) are walked end-to-end in examples/connect-and-evolve.md. Full usage guide: docs/agents.md. The rest of this file is for agents editing the source.

Repo shape

Rust workspace, 19 crates, version 2.4.2, MSRV 1.91. emem-guard is the verdict server for AI inference checkpoints (Anthropic Inference hooks, Claude Code hooks); it is a separate binary and shares no code path with the responder. The bulk of the code lives in crates/emem-api-rest/src/lib.rs (HTTP/MCP router plus every inline materializer) and crates/emem-fetch/src/*.rs (27 data connectors + 7 utility modules). Earlier versions ran Clay, Prithvi, Galileo and JEPA-v2 on a GPU sidecar; facts they signed still verify. Web surface in web/ is plain HTML, no build step, included via include_str!.

Build

# Full workspace, debug
cargo build --workspace

# Production binary (what /home/ubuntu/.config/systemd/user/emem-server.service runs)
cargo build --release --bin emem-server

# After release rebuild on systems that need port 443 binding:
sudo setcap 'cap_net_bind_service=+ep' target/release/emem-server
systemctl --user restart emem-server.service

scripts/redeploy.sh does build + setcap + restart in one shot.

Test

# Unit + bin + crate-level integration, no network
cargo test --workspace --lib --bins --tests

# Network-gated tests live in crates/emem-fetch/tests/live_cog_fetch.rs
# and skip automatically when offline. There is NO `live` cargo feature.
# Don't write `--features live`, that flag doesn't exist.
cargo test --workspace --test live_cog_fetch

Unit tests live inline in src/ next to the code they cover (#[cfg(test)] mod tests). Crate-level integration tests live under crates/<crate>/tests/. Only two crates have those today: emem-fact (round-trip) and emem-fetch (live COG fetch).

Lint + format

cargo fmt --all                                                  # local
cargo fmt --all --check                                          # CI gate
cargo clippy --workspace --all-targets -- -D warnings            # CI gate

Both gates run in .github/workflows/ci.yml against Linux + macOS, plus an MSRV 1.91 build job. Don't ship a commit that fails either: the CI will reject it and the next agent will have to figure out why.

Two hard-won specifics. CI pins dtolnay/rust-toolchain@stable, so the clippy gate tracks CURRENT stable, not the MSRV: run rustup update stable first (never while a build is running; it deletes the old toolchain's rlibs out from under an in-flight compile) or new-in-stable lints will pass locally and fail in CI one at a time. And run clippy with --all-targets: a plain --lib test run never compiles the integration-test and demo-bin targets, which is exactly where CI finds what you missed.

Code style

  • No unsafe. Every crate carries #![forbid(unsafe_code)] at the top.
  • No unwrap() on user-facing paths. Use ? with structured errors; the MaterializeMiss / CidNotFound types are designed to surface honest gaps without panicking. unwrap() is fine inside tests.
  • Don't widen pub. Keep crate boundaries tight. New public API needs a justification in the commit message.
  • Comments: only when the why is non-obvious (a hidden constraint, a workaround for a specific bug, a subtle invariant). Don't explain what the code does; well-named identifiers do that. Don't reference the current task or PR; those belong in the PR description.
  • Receipts and CIDs are load-bearing. Any change to crates/emem-storage/src/server.rs::sign_receipt or the canonical-CBOR layout in crates/emem-fact/src/ requires a corresponding update to docs/protocol.md (the byte-by-byte preimage example) and to the in-browser verifier at web/humans.html (the BLAKE3 + Ed25519 path). These three places must always agree.

Commit + PR conventions

Commit messages are sentence-case, ≤72 chars on the subject line. Body explains the why and any non-obvious wire/protocol implications. Tag with the version prefix when relevant (0.0.8: …).

Never add a Co-Authored-By: Claude trailer or any AI attribution trailer. The user has stated this preference in /home/ubuntu/.claude/projects/-home-ubuntu-emem/memory/feedback_no_claude_coauthor.md.

Don't commit on the user's behalf without an explicit instruction. Don't force-push to main. Don't --no-verify past pre-commit hooks; if a hook fails, fix the underlying issue.

Off-limits during autonomous runs

  • var/emem/identity.secret.b32: the responder's Ed25519 secret. Never read, copy, or commit this file. It is mode 0600 for a reason.
  • var/emem/sled/: the live attestation log. Never delete or rewrite; agent-replayable bugs are debugged from this log.
  • crates/emem-codec/src/alphabet.rs: the cell64 alphabet builder. Changing this rotates every cell64 in the corpus. Don't touch without a registry CID rotation plan.
  • web/index.html GA injection: the consent banner is GDPR-compliant by design; don't simplify it without re-reading docs/operators/operating.md § Privacy/GA.

Where to find things

concernpath
HTTP/MCP router, route registrationscrates/emem-api-rest/src/lib.rs
Inline materializerscrates/emem-api-rest/src/lib.rs (search ^async fn materialize_)
Open-data connectorscrates/emem-fetch/src/*.rs (27 data modules + 7 utility)
Receipt signing + preimagecrates/emem-storage/src/server.rs::sign_receipt
Canonical CBOR + FactCidcrates/emem-fact/src/{cbor,cid}.rs
Cell64 / tslot / alphabetcrates/emem-codec/src/
Merkle log + per-fact proofscrates/emem-storage/src/{merkle_log,server}.rs
Registries (8 manifests)crates/emem-core/data/*.json + src/
MCP tool registry (114 tools)crates/emem-mcp/src/lib.rs
Read primitivescrates/emem-primitives/src/*.rs
Hunter and corpus-audit classifiers for /v1/askcrates/emem-api-rest/src/ask_foundation.rs
Physics solvers (heat / wave / NDVI AR(2))crates/emem-api-rest/src/physics.rs
/humans interactive consoleweb/humans.html
Static web surfaceweb/ (served via include_str! from api-rest)
Demoscrates/emem-cli/src/bin/emem-{demo,livedemo,realdemo}.rs

Where to read more

  • docs/developers/architecture.md: what shape the protocol takes
  • docs/protocol.md: wire format, preimages, encodings
  • docs/whitepaper-v2.md: math + design rationale (v1 archived at docs/whitepaper-v1.md)
  • docs/operators/operating.md: deployment, env vars, TLS, CSP
  • docs/developers/developing.md: dev workflow + test invariants
  • docs/agents.md: consumer-agent guide (how to USE emem)
  • web/skills.md: composed recipes for agent integrations
  • plugins/emem/: the Claude Code plugin, MCP server plus nineteen skills, installable with /plugin marketplace add Vortx-AI/emem

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.