# leninejunior/engrene-memory-bridge architecture

> Architecture diagram of the GitHub repository leninejunior/engrene-memory-bridge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leninejunior/engrene-memory-bridge
- Repository: https://github.com/leninejunior/engrene-memory-bridge

## Overview

Engrene Memory Bridge is a local-first memory service for AI coding agents. Agents or developers resume prior context, search sessions and decisions, record new activity, and consolidate a handoff; the CLI is the primary command dispatcher. Memory is stored locally, with optional semantic indexing. Separate interfaces include shared agent wrappers, an MCP server, and a web dashboard. The README also documents Obsidian sync, Compound Engineering rule sync, skill installation, capture, redaction, and encryption; some of these implementations were not sampled, so their internal wiring is not inferred.

Main entry points: [`src/cli/bin.ts`](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/cli/bin.ts) (CLI dispatcher), [`src/core/store.ts`](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/store.ts) (Memory records), [`src/ui/server.ts`](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/ui/server.ts) (Web dashboard), [`src/core/context.ts`](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/context.ts) (Resume context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Agent interfaces"]
  node_cli["CLI dispatcher<br/>[bin.ts]"]
  node_wrappers["Agent wrappers<br/>[common.ts]"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_dashboard["Web dashboard<br/>[server.ts]"]
  node_ui_client["Dashboard client<br/>[app.js]"]
end

subgraph group_memory["Memory lifecycle"]
  node_context["Resume context<br/>[context.ts]"]
  node_search["Hybrid search<br/>[search.ts]"]
  node_consolidate["Handoff builder<br/>[consolidate.ts]"]
  node_capture["Session capture<br/>[capture.ts]"]
  node_store["Memory records<br/>[store.ts]"]
  node_vector[("Semantic index<br/>[vector.ts]")]
end

subgraph group_integrations["Integrations"]
  node_obsidian_sync["Obsidian sync<br/>[obsidian.ts]"]
  node_ce_sync["CE rule sync<br/>[ce.ts]"]
  node_installer["Skill installer<br/>[install.ts]"]
end

subgraph group_operations["Local operations"]
  node_config["Workspace config<br/>[config.ts]"]
  node_redaction["Secret redaction<br/>[redaction.ts]"]
  node_crypto["Memory encryption<br/>[crypto.ts]"]
  node_doctor["Health checks<br/>[doctor.ts]"]
end

node_developer(("Developer"))
node_agents(("AI agents"))
node_obsidian_app["Obsidian vault"]
node_mcp_clients(("MCP clients"))

node_developer -->|"runs commands"| node_cli
node_agents -->|"requests context"| node_wrappers
node_wrappers -->|"dispatches commands"| node_cli
node_cli -->|"builds resume"| node_context
node_cli -->|"runs search"| node_search
node_cli -->|"records sessions"| node_store
node_cli -->|"builds handoff"| node_consolidate
node_cli -->|"starts server"| node_mcp
node_cli -->|"runs sync"| node_obsidian_sync
node_cli -->|"syncs rules"| node_ce_sync
node_cli -->|"installs skill"| node_installer
node_cli -->|"checks health"| node_doctor
node_mcp_clients -->|"sends tool calls"| node_mcp
node_mcp -->|"renders resume"| node_context
node_mcp -->|"rebuilds handoff"| node_consolidate
node_dashboard -->|"serves interface"| node_ui_client
node_ui_client -->|"calls API"| node_dashboard
node_dashboard -->|"builds snapshot"| node_context
node_dashboard -->|"reads and writes"| node_store
node_dashboard -->|"indexes records"| node_vector
node_dashboard -->|"checks health"| node_doctor
node_context -->|"reads records"| node_store
node_search -->|"reads memory"| node_store
node_search -->|"queries index"| node_vector
node_consolidate -->|"uses snapshot"| node_context
node_obsidian_app -->|"provides vault notes"| node_obsidian_sync
node_obsidian_sync -->|"imports and exports"| node_store
node_obsidian_sync -->|"indexes decisions"| node_vector
node_capture -->|"captures observations"| node_store
node_config -->|"configures workspace"| node_store
node_redaction -->|"protects recorded text"| node_store
node_crypto -.->|"protects memory"| node_store

click node_cli "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/cli/bin.ts"
click node_wrappers "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/wrappers/common.ts"
click node_mcp "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/mcp/server.ts"
click node_dashboard "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/ui/server.ts"
click node_ui_client "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/ui/public/app.js"
click node_context "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/context.ts"
click node_search "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/search.ts"
click node_consolidate "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/consolidate.ts"
click node_capture "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/capture.ts"
click node_store "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/store.ts"
click node_vector "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/vector.ts"
click node_config "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/config.ts"
click node_redaction "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/redaction.ts"
click node_crypto "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/crypto.ts"
click node_doctor "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/doctor.ts"
click node_obsidian_sync "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/obsidian.ts"
click node_ce_sync "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/ce.ts"
click node_installer "https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/cli/install.ts"

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_wrappers,node_mcp,node_dashboard,node_ui_client,node_mcp_clients toneBlue
class node_context,node_search,node_consolidate,node_capture,node_store,node_vector toneAmber
class node_obsidian_sync,node_ce_sync,node_installer toneMint
class node_config,node_redaction,node_crypto,node_doctor toneRose
class node_developer,node_agents,node_obsidian_app toneIndigo
```

## Components

### Agent interfaces

- [CLI dispatcher](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/cli/bin.ts): `src/cli/bin.ts`
- [Agent wrappers](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/wrappers/common.ts): `src/wrappers/common.ts`
- [MCP server](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/mcp/server.ts): `src/mcp/server.ts`
- [Web dashboard](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/ui/server.ts): `src/ui/server.ts`
- [Dashboard client](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/ui/public/app.js): `src/ui/public/app.js`

### Memory lifecycle

- [Resume context](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/context.ts): `src/core/context.ts`
- [Hybrid search](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/search.ts): `src/core/search.ts`
- [Handoff builder](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/consolidate.ts): `src/core/consolidate.ts`
- [Session capture](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/capture.ts): `src/core/capture.ts`
- [Memory records](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/store.ts): `src/core/store.ts`
- [Semantic index](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/vector.ts): `src/core/vector.ts`

### Integrations

- [Obsidian sync](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/obsidian.ts): `src/core/obsidian.ts`
- [CE rule sync](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/ce.ts): `src/core/ce.ts`
- [Skill installer](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/cli/install.ts): `src/cli/install.ts`

### Local operations

- [Workspace config](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/config.ts): `src/core/config.ts`
- [Secret redaction](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/redaction.ts): `src/core/redaction.ts`
- [Memory encryption](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/crypto.ts): `src/core/crypto.ts`
- [Health checks](https://github.com/leninejunior/engrene-memory-bridge/blob/main/src/core/doctor.ts): `src/core/doctor.ts`

### Other components

- **Developer**
- **AI agents**
- **Obsidian vault**
- **MCP clients**

## Connections

- Developer → CLI dispatcher: runs commands
- AI agents → Agent wrappers: requests context
- Agent wrappers → CLI dispatcher: dispatches commands
- CLI dispatcher → Resume context: builds resume
- CLI dispatcher → Hybrid search: runs search
- CLI dispatcher → Memory records: records sessions
- CLI dispatcher → Handoff builder: builds handoff
- CLI dispatcher → MCP server: starts server
- CLI dispatcher → Obsidian sync: runs sync
- CLI dispatcher → CE rule sync: syncs rules
- CLI dispatcher → Skill installer: installs skill
- CLI dispatcher → Health checks: checks health
- MCP clients → MCP server: sends tool calls
- MCP server → Resume context: renders resume
- MCP server → Handoff builder: rebuilds handoff
- Web dashboard → Dashboard client: serves interface
- Dashboard client → Web dashboard: calls API
- Web dashboard → Resume context: builds snapshot
- Web dashboard → Memory records: reads and writes
- Web dashboard → Semantic index: indexes records
- Web dashboard → Health checks: checks health
- Resume context → Memory records: reads records
- Hybrid search → Memory records: reads memory
- Hybrid search → Semantic index: queries index
- Handoff builder → Resume context: uses snapshot
- Obsidian vault → Obsidian sync: provides vault notes
- Obsidian sync → Memory records: imports and exports
- Obsidian sync → Semantic index: indexes decisions
- Session capture → Memory records: captures observations
- Workspace config → Memory records: configures workspace
- Secret redaction → Memory records: protects recorded text
- Memory encryption → Memory records: protects memory
