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

emem

AGENTS.md91 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 code style.

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

Show its rules and text

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

14 rules. About 0 are common, 2 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    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 through POST /v1/verify_receipt.

    line 33
  3. Very specific:

    Wait for the publish workflow (.github/workflows/publish.yml) to finish with success.

    line 67
  4. Very specific:

    Do not use scripts/redeploy.sh on the production host.

    line 73
  5. Very specific:

    Every action in .github/workflows/ is pinned to a full commit SHA with its tag in a trailing comment (@<sha> # v4.4.0).

    line 107
  6. Distinctive:

    Never run it while a build runs: it deletes the old toolchain's rlibs under the compile.

    line 121
  7. Very specific:

    Run clippy with --all-targets.

    line 123
  8. Very specific:

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

    line 129
  9. Very specific:

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

    line 130
  10. Very specific:

    Don't widen pub: Keep crate boundaries tight.

    line 133
  11. Distinctive:

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

    line 135
  12. Very specific:

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

    line 148
  13. Very specific:

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

    line 152
  14. Very specific:

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

    line 156

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 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 {"q":"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. These are a self-description of emem, a corpus audit, a hunter sweep over a region, or a point answer. A corpus audit redirects to the coverage endpoints and has no receipt. The hunter sweep and the point answer carry a signed receipt. Ask answers a point question with the current value, or with a reading of the date the question names ("14 December 2022", or a relative time such as "last month", read as dates in UTC); when it holds no reading of that date it says cannot_tell rather than answer from another date. direct_answer carries the verdict, the band and the limits, and context.context_id continues the thread. 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 through 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.6, MSRV 1.91. emem-guard is the verdict server for AI inference checkpoints, such as Anthropic Inference hooks and 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 + 8 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 with include_str!.

Build

# Full workspace, debug
cargo build --workspace

# Release binary, for a local or self-hosted node
cargo build --release --bin emem-server

Production (emem.dev) does not run a binary built on the host. It runs a container under the system unit /etc/systemd/system/emem-server.service, which starts the image with docker run. To deploy:

  1. Push the commit to main.
  2. Wait for the publish workflow (.github/workflows/publish.yml) to finish with success. It builds and pushes the image.
  3. Run /home/ubuntu/emem-ops/pending_deploy.sh <new7> <good7>. Both arguments are 7-character commit shas: the new one, and the last good one to roll back to.

Do not use scripts/redeploy.sh on the production host. It builds on the host and restarts a user unit that production no longer uses. It is only for a node that runs the binary directly.

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/. Five crates have those today: emem-airgap, emem-fact (round-trip), emem-fetch (live COG fetch), emem-primitives and emem-trace.

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 on Linux. Only the test job runs on Linux and macOS. There is also an MSRV 1.91 build job. Do not ship a commit that fails either. CI rejects it, and the next agent then has to find out why.

Every action in .github/workflows/ is pinned to a full commit SHA with its tag in a trailing comment (@<sha> # v4.4.0). A tag can be moved to other code; a SHA cannot. To bump one, resolve the new tag with git ls-remote --tags https://github.com/<owner>/<action> (take the peeled ^{} line for an annotated tag) and change the SHA and the comment together.

Two hard-won specifics:

  • CI installs Rust from the stable branch of dtolnay/rust-toolchain. That action is pinned to a commit like every other action, and the commit installs the stable that is current when the job runs. So the clippy gate tracks CURRENT stable, not the MSRV. Run rustup update stable first, or lints that are new in stable pass locally and fail in CI one at a time. Never run it while a build runs: it deletes the old toolchain's rlibs under the compile.
  • Run clippy with --all-targets. A plain --lib test run never compiles the integration-test and demo-bin targets, and CI finds what you missed there.

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. A change to crates/emem-storage/src/server.rs::sign_receipt or to the canonical-CBOR layout in crates/emem-fact/src/ needs two more updates. Update docs/protocol.md (the byte-by-byte preimage example). Update 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 + 8 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 (10 manifest digests, GET /v1/manifests)crates/emem-core/data/*.json + src/
MCP tool registry (120 tools)crates/emem-mcp/src/lib.rs
Read primitivescrates/emem-primitives/src/*.rs
Reference offline verifiers (kept out of the plugin, which ships no code)tools/verifiers/
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 with 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.