# toarchkumar/mnemo architecture

> Architecture diagram of the GitHub repository toarchkumar/mnemo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/toarchkumar/mnemo
- Repository: https://github.com/toarchkumar/mnemo

## Overview

MNemo is a local-first encrypted memory engine for coding agents. The main workflow is: a developer onboards a repository, an agent saves session memories through the CLI or MCP server, text is embedded and stored in the shared brain, and later sessions recall memories by meaning and keywords. Separate capabilities support keyed history, agent coordination, inspection/export, and cross-language app bindings. The README documents these product flows; several implementation details are unsampled, so the graph omits uncertain internal call relationships.

Main entry points: [`mnemo/src/store/mod.rs`](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/mod.rs) (Memory store), [`mnemo/src/bin/mnemo.rs`](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo.rs) (CLI commands), [`mnemo/src/mcp.rs`](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/mcp.rs) (MCP server), [`mnemo/src/bin/mnemo/onboard.rs`](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/onboard.rs) (Repository onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Agent entry points"]
  node_cli["CLI commands<br/>[mnemo.rs]"]
  node_onboard["Repository onboarding<br/>[onboard.rs]"]
  node_hooks["Session hooks<br/>[hook.rs]"]
  node_mcp["MCP server<br/>[mcp.rs]"]
  node_context["MCP context<br/>[context.rs]"]
end

subgraph group_memory["Memory workflows"]
  node_embed["Text embedding<br/>[embed.rs]"]
  node_builtin["Built-in embedder<br/>[builtin.rs]"]
  node_memorymodel["Memory model<br/>[memory.rs]"]
  node_transcript["Session transcripts<br/>[transcript.rs]"]
  node_coordination["Agent coordination<br/>[coordination.rs]"]
  node_findings["Review findings<br/>[findings.rs]"]
  node_inspection["Read-only inspection<br/>[inspect.rs]"]
  node_export["Memory export<br/>[export.rs]"]
end

subgraph group_storage["Encrypted engine"]
  node_store[("Memory store<br/>[mod.rs]")]
  node_index["Semantic index<br/>[index.rs]"]
  node_format["File format<br/>[format.rs]"]
  node_crypto["Encryption<br/>[crypto.rs]"]
  node_pager["Encrypted pager<br/>[pager.rs]"]
  node_wal["Write-ahead log<br/>[wal.rs]"]
  node_cache["Result cache<br/>[result_cache.rs]"]
  node_keys["Key management<br/>[mod.rs]"]
end

subgraph group_apps["App integrations"]
  node_python["Python binding<br/>[lib.rs]"]
  node_swift["Swift binding<br/>[MnemoStore.swift]"]
  node_kotlin["Kotlin binding<br/>[MnemoStore.kt]"]
  node_node["Node binding<br/>[lib.rs]"]
end

node_developer(("Developer"))
node_agent(("Coding agent"))

node_developer -->|"runs commands"| node_cli
node_developer -->|"sets up"| node_onboard
node_onboard -->|"installs"| node_hooks
node_onboard -->|"wires client"| node_mcp
node_agent -->|"starts and ends"| node_hooks
node_agent -->|"uses tools"| node_mcp
node_mcp -->|"serves context"| node_context
node_cli -->|"accesses brain"| node_store
node_mcp -->|"reads and writes"| node_store
node_hooks -->|"saves sessions"| node_store
node_store -->|"embeds text"| node_embed
node_builtin -.->|"implements"| node_embed
node_store -->|"stores memories"| node_memorymodel
node_store -->|"indexes vectors"| node_index
node_store -->|"saves turns"| node_transcript
node_store -->|"coordinates agents"| node_coordination
node_store -->|"tracks findings"| node_findings
node_cli -->|"opens inspection"| node_inspection
node_inspection -->|"reads brain"| node_store
node_cli -->|"exports backup"| node_export
node_export -->|"reads memories"| node_store
node_store -->|"reads and writes pages"| node_pager
node_pager -->|"seals pages"| node_crypto
node_store -->|"uses file layout"| node_format
node_store -->|"commits through WAL"| node_wal
node_store -->|"caches results"| node_cache
node_keys -->|"resolves secrets"| node_crypto
node_python -->|"exposes engine"| node_store
node_swift -->|"exposes engine"| node_store
node_kotlin -->|"exposes engine"| node_store
node_node -.->|"exposes engine"| node_store

click node_cli "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo.rs"
click node_onboard "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/onboard.rs"
click node_hooks "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/hook.rs"
click node_mcp "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/mcp.rs"
click node_context "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/mcp/context.rs"
click node_embed "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/embed.rs"
click node_builtin "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/builtin.rs"
click node_memorymodel "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/memory.rs"
click node_transcript "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/transcript.rs"
click node_coordination "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/coordination.rs"
click node_findings "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/findings.rs"
click node_inspection "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/inspect.rs"
click node_export "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/export.rs"
click node_store "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/mod.rs"
click node_index "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/index.rs"
click node_format "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/format.rs"
click node_crypto "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/crypto.rs"
click node_pager "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/pager.rs"
click node_wal "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/wal.rs"
click node_cache "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/result_cache.rs"
click node_keys "https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/keys/mod.rs"
click node_python "https://github.com/toarchkumar/mnemo/blob/main/mnemo-python/src/lib.rs"
click node_swift "https://github.com/toarchkumar/mnemo/blob/main/mnemo/bindings/swift/Sources/Mnemo/MnemoStore.swift"
click node_kotlin "https://github.com/toarchkumar/mnemo/blob/main/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStore.kt"
click node_node "https://github.com/toarchkumar/mnemo/blob/main/mnemo/bindings/node/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_onboard,node_hooks,node_mcp,node_context toneBlue
class node_embed,node_builtin,node_memorymodel,node_transcript,node_coordination,node_findings,node_inspection,node_export toneAmber
class node_store,node_index,node_format,node_crypto,node_pager,node_wal,node_cache,node_keys toneMint
class node_python,node_swift,node_kotlin,node_node toneRose
class node_developer,node_agent toneIndigo
```

## Components

### Agent entry points

- [CLI commands](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo.rs): `mnemo/src/bin/mnemo.rs`
- [Repository onboarding](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/onboard.rs): `mnemo/src/bin/mnemo/onboard.rs`
- [Session hooks](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/hook.rs): `mnemo/src/bin/mnemo/hook.rs`
- [MCP server](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/mcp.rs): `mnemo/src/mcp.rs`
- [MCP context](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/mcp/context.rs): `mnemo/src/mcp/context.rs`

### Memory workflows

- [Text embedding](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/embed.rs): `mnemo/src/embed.rs`
- [Built-in embedder](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/builtin.rs): `mnemo/src/builtin.rs`
- [Memory model](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/memory.rs): `mnemo/src/memory.rs`
- [Session transcripts](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/transcript.rs): `mnemo/src/transcript.rs`
- [Agent coordination](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/coordination.rs): `mnemo/src/store/coordination.rs`
- [Review findings](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/findings.rs): `mnemo/src/store/findings.rs`
- [Read-only inspection](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/inspect.rs): `mnemo/src/bin/mnemo/inspect.rs`
- [Memory export](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/bin/mnemo/export.rs): `mnemo/src/bin/mnemo/export.rs`

### Encrypted engine

- [Memory store](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/store/mod.rs): `mnemo/src/store/mod.rs`
- [Semantic index](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/index.rs): `mnemo/src/index.rs`
- [File format](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/format.rs): `mnemo/src/format.rs`
- [Encryption](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/crypto.rs): `mnemo/src/crypto.rs`
- [Encrypted pager](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/pager.rs): `mnemo/src/pager.rs`
- [Write-ahead log](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/wal.rs): `mnemo/src/wal.rs`
- [Result cache](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/result_cache.rs): `mnemo/src/result_cache.rs`
- [Key management](https://github.com/toarchkumar/mnemo/blob/main/mnemo/src/keys/mod.rs): `mnemo/src/keys/mod.rs`

### App integrations

- [Python binding](https://github.com/toarchkumar/mnemo/blob/main/mnemo-python/src/lib.rs): `mnemo-python/src/lib.rs`
- [Swift binding](https://github.com/toarchkumar/mnemo/blob/main/mnemo/bindings/swift/Sources/Mnemo/MnemoStore.swift): `mnemo/bindings/swift/Sources/Mnemo/MnemoStore.swift`
- [Kotlin binding](https://github.com/toarchkumar/mnemo/blob/main/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStore.kt): `mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStore.kt`
- [Node binding](https://github.com/toarchkumar/mnemo/blob/main/mnemo/bindings/node/src/lib.rs): `mnemo/bindings/node/src/lib.rs`

### Other components

- **Developer**
- **Coding agent**

## Connections

- Developer → CLI commands: runs commands
- Developer → Repository onboarding: sets up
- Repository onboarding → Session hooks: installs (evidence: `mnemo/src/bin/mnemo/onboard.rs`)
- Repository onboarding → MCP server: wires client (evidence: `mnemo/src/bin/mnemo/onboard.rs`)
- Coding agent → Session hooks: starts and ends
- Coding agent → MCP server: uses tools
- MCP server → MCP context: serves context (evidence: `mnemo/src/mcp/context.rs`)
- CLI commands → Memory store: accesses brain
- MCP server → Memory store: reads and writes
- Session hooks → Memory store: saves sessions
- Memory store → Text embedding: embeds text (evidence: `mnemo/src/embed.rs`)
- Built-in embedder → Text embedding: implements
- Memory store → Memory model: stores memories (evidence: `mnemo/src/store/mod.rs`)
- Memory store → Semantic index: indexes vectors (evidence: `mnemo/src/store/mod.rs`)
- Memory store → Session transcripts: saves turns (evidence: `mnemo/src/store/mod.rs`)
- Memory store → Agent coordination: coordinates agents (evidence: `mnemo/src/store/mod.rs`)
- Memory store → Review findings: tracks findings (evidence: `mnemo/src/store/mod.rs`)
- CLI commands → Read-only inspection: opens inspection (evidence: `mnemo/src/bin/mnemo.rs`)
- Read-only inspection → Memory store: reads brain
- CLI commands → Memory export: exports backup (evidence: `mnemo/src/bin/mnemo.rs`)
- Memory export → Memory store: reads memories
- Memory store → Encrypted pager: reads and writes pages (evidence: `mnemo/src/store/mod.rs`)
- Encrypted pager → Encryption: seals pages (evidence: `mnemo/src/pager.rs`)
- Memory store → File format: uses file layout (evidence: `mnemo/src/store/mod.rs`)
- Memory store → Write-ahead log: commits through WAL (evidence: `mnemo/src/store/mod.rs`)
- Memory store → Result cache: caches results (evidence: `mnemo/src/lib.rs`)
- Key management → Encryption: resolves secrets (evidence: `mnemo/src/keys/mod.rs`)
- Python binding → Memory store: exposes engine
- Swift binding → Memory store: exposes engine
- Kotlin binding → Memory store: exposes engine
- Node binding → Memory store: exposes engine
