mentedb
CLAUDE.md126 starsChanged 42 days agoApache-2.0View on GitHub
MenteDB is a purpose built Rust database engine for AI agent memory. It includes custom storage (WAL, record cache, compact record file), HNSW vector indexing, CSR/CSC graph, a custom query language (MQL), context assembly with U curve attention layout, and 7 unique cognitive features (stream cognition, write time inference, trajectory tracking, phantom memories, interference detection, pain signals, speculative pre assembly). The SDKs are excluded from the Cargo workspace and build independently. Always run these before committing: The server binary is…
In this repositoryOne other file it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Always run these before committing:
- Distinctive: line 63
All heuristics and thresholds must be in Config structs, never hardcoded magic numbers
- Very specific: line 64
Use MenteResult<T> for error handling, no unwrap() in library code
- Distinctive: line 65
Commit messages: conventional style (feat:, fix:, chore:), single line, no emojis
- Distinctive: line 66
No emojis or em/en dashes in prose anywhere (docs, README, comments).
- Distinctive: line 81
Add external database dependencies (this IS the database engine)
- Distinctive: line 82
Remove cognitive features or weaken their configurability
≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.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
MenteDB Development Instructions
Project overview
MenteDB is a purpose built Rust database engine for AI agent memory. It includes custom storage (WAL, record cache, compact record file), HNSW vector indexing, CSR/CSC graph, a custom query language (MQL), context assembly with U curve attention layout, and 7 unique cognitive features (stream cognition, write time inference, trajectory tracking, phantom memories, interference detection, pain signals, speculative pre assembly).
Workspace structure
crates/
mentedb-core/ Core types, config, error, MVCC, multi agent
mentedb-storage/ Record file, WAL, record cache, migration, backup/restore
mentedb-index/ HNSW vector index, bitmap, temporal, salience
mentedb-graph/ CSR/CSC graph, traversal, belief propagation
mentedb-query/ MQL lexer, parser, planner
mentedb-context/ U curve attention layout, delta tracker, serializers
mentedb-cognitive/ Stream cognition, write inference, trajectory, phantoms, interference, pain, speculative
mentedb-consolidation/ Decay, archival, extraction, compression, GDPR forget
mentedb-embedding/ Provider trait, hash/HTTP providers, LRU cache
mentedb-server/ Axum REST API, JWT auth, rate limiting, WebSocket
mentedb/ Unified facade (MenteDb struct)
sdks/
python/ PyO3 bindings + pure Python client
typescript/ napi-rs bindings + TypeScript client
python/integrations/langchain/ LangChain memory, retriever, chat history
python/integrations/crewai/ CrewAI memory and tool adapterThe SDKs are excluded from the Cargo workspace and build independently.
Build, test, and lint
Always run these before committing:
cargo fmt --all
cargo clippy --workspace -- -D warnings
cargo test --workspaceThe server binary is mentedb-server and runs on axum with JWT auth, rate limiting, and WebSocket support.
Key types
MemoryNode: The fundamental storage unit (id, content, memory_type, embedding, metadata, timestamps)MemoryEdge: Typed relationship between memories (caused, contradicts, relates_to, obsoletes, etc.)MenteDb: The unified facade that coordinates all subsystemsMenteConfig: Top level config with sub configs for every subsystemMenteError/MenteResult<T>: Error handling throughout
Architecture notes
- Storage packs records into 512 byte blocks (about 5 KB per memory), with a byte bounded CLOCK record cache and a WAL with LZ4 + CRC32
- HNSW index is built from scratch (not a binding), configurable M and ef parameters
- Graph uses CSR/CSC hybrid with delta log and compact() to merge
- MQL is a custom query language parsed by hand written recursive descent parser
- Context assembly uses U curve attention layout (primacy/recency bias) with delta aware serving
- 7 cognitive features are unique to MenteDB and do not exist in any other database engine
Conventions
- Rust edition 2024, Apache 2.0 license
- All heuristics and thresholds must be in Config structs, never hardcoded magic numbers
- Use
MenteResult<T>for error handling, nounwrap()in library code - Commit messages: conventional style (feat:, fix:, chore:), single line, no emojis
- No emojis or em/en dashes in prose anywhere (docs, README, comments). Use commas instead.
- Trait based design:
EmbeddingProvider, storage backends, etc.
Key files
crates/mentedb/src/lib.rs: UnifiedMenteDbfacade (open, store, recall, relate, forget, close)crates/mentedb-core/src/config.rs: All configuration (MenteConfig and sub configs)crates/mentedb-core/src/error.rs: MenteError enumcrates/mentedb-cognitive/src/: 7 cognitive feature modulescrates/mentedb-server/src/main.rs: Axum server entry point.github/workflows/ci.yml: CI pipeline (check, test, fmt, clippy).github/workflows/release-plz.ymlandpublish-sdks.yml: Release pipeline (crates.io, then PyPI, npm, Docker)
Do not
- Add external database dependencies (this IS the database engine)
- Remove cognitive features or weaken their configurability
- Hardcode language specific patterns, use config structs
- Modify SDK Cargo.toml files to join the root workspace
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.

