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.
- docs/agents.mdAGENTS.md
- web/llms.txtllms.txt
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
- Very specific: line 12
If you only want to *call* emem (not edit its source), here is zero to a signed answer in three calls:
- Very specific: line 27
Cite it: Verify the receipt offline at /verify or via POST /v1/verify_receipt.
- Very specific: line 101
No
unsafe: Every crate carries #![forbid(unsafe_code)] at the top. - Very specific: line 102
No
unwrap()on user-facing paths: Use ? with structured errors. - Very specific: line 105
Don't widen
pub: Keep crate boundaries tight. - Distinctive: line 107
Comments: only when the *why* is non-obvious (a hidden constraint, a workaround for a specific bug, a subtle invariant).
- Very specific: line 120
Commit messages are sentence-case, ≤72 chars on the subject line.
- Very specific: line 124
Never: add a Co-Authored-By: Claude trailer or any AI attribution trailer.
- Very specific: line 128
Don't commit on the user's behalf without an explicit instruction.
≈ “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.
Files
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:
- Ask.
POST /v1/ask {"question":"what is the NDVI near Mount Fuji?"}(MCP toolemem_ask, oremem_intent/POST /v1/intentfor 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") toemem_intentwithdid_change, or toemem_diff. This is the fastest path. - Or take control.
POST /v1/locate {"place":"Mount Fuji"}→ acell64, thenPOST /v1/recall {"cell":"<cell64>"}(auto-materialises on a miss). - Cite it. Verify the receipt offline at
/verifyor viaPOST /v1/verify_receipt; hand other agents anemem:fact:token fromemem_memory_token(oremem_memory_bundlefor 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.servicescripts/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_fetchUnit 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 gateBoth 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; theMaterializeMiss/CidNotFoundtypes 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_receiptor the canonical-CBOR layout incrates/emem-fact/src/requires a corresponding update todocs/protocol.md(the byte-by-byte preimage example) and to the in-browser verifier atweb/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 mode0600for 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.htmlGA injection: the consent banner is GDPR-compliant by design; don't simplify it without re-readingdocs/operators/operating.md§ Privacy/GA.
Where to find things
| concern | path |
| HTTP/MCP router, route registrations | crates/emem-api-rest/src/lib.rs |
| Inline materializers | crates/emem-api-rest/src/lib.rs (search ^async fn materialize_) |
| Open-data connectors | crates/emem-fetch/src/*.rs (27 data modules + 7 utility) |
| Receipt signing + preimage | crates/emem-storage/src/server.rs::sign_receipt |
| Canonical CBOR + FactCid | crates/emem-fact/src/{cbor,cid}.rs |
| Cell64 / tslot / alphabet | crates/emem-codec/src/ |
| Merkle log + per-fact proofs | crates/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 primitives | crates/emem-primitives/src/*.rs |
| Hunter and corpus-audit classifiers for /v1/ask | crates/emem-api-rest/src/ask_foundation.rs |
| Physics solvers (heat / wave / NDVI AR(2)) | crates/emem-api-rest/src/physics.rs |
/humans interactive console | web/humans.html |
| Static web surface | web/ (served via include_str! from api-rest) |
| Demos | crates/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
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.

