# moorcheh-ai/memanto architecture

> Architecture diagram of the GitHub repository moorcheh-ai/memanto, 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/moorcheh-ai/memanto
- Repository: https://github.com/moorcheh-ai/memanto

## Overview

Memanto is a companion memory agent for managing shared agent memory: capturing and curating knowledge, reconciling conflicts, applying forgetting policies, briefing agents, and moving data between systems. Its main user workflow runs through the CLI and local service/API; optional framework integrations expose Memanto to agent runtimes. The README documents several product capabilities whose detailed wiring is not shown in the sampled source, so those branches are represented at subsystem level and uncertain links are omitted.

Main entry points: [`memanto/app/main.py`](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/main.py) (Service API), [`memanto/app/ui/routes/ui_router.py`](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/ui/routes/ui_router.py) (Local Dashboard), [`integrations/langfuse/langfuse_memanto/handler.py`](https://github.com/moorcheh-ai/memanto/blob/main/integrations/langfuse/langfuse_memanto/handler.py) (Langfuse Capture), [`memanto/cli/main.py`](https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/main.py) (Memanto CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["Memanto CLI<br/>[main.py]"]
  node_api["Service API<br/>[main.py]"]
  node_dashboard["Local Dashboard<br/>[ui_router.py]"]
  node_memory_routes["Memory Routes<br/>[memory.py]"]
  node_session_routes["Session Routes<br/>[sessions.py]"]
end

subgraph group_memory["Memory Management"]
  node_memory_read["Memory Recall"]
  node_memory_write["Memory Writes"]
  node_extraction["Conversation Extraction"]
  node_policy["Expiry Policies"]
  node_namespace["Agent Namespaces"]
  node_backend[("Moorcheh Backend<br/>[moorcheh.py]")]
end

subgraph group_operations["Curation Operations"]
  node_daily_analysis["Daily Analysis"]
  node_conflicts["Conflict Handling<br/>[agent_service.py]"]
  node_schedule["Daily Scheduler"]
end

subgraph group_portability["Portability"]
  node_export["Memory Export"]
  node_okf["OKF Export"]
  node_migration["Provider Migration<br/>[runner.py]"]
end

subgraph group_integrations["Agent Integrations"]
  node_connect["Agent Connections<br/>[engine.py]"]
  node_mcp["MCP Tools<br/>[server.py]"]
  node_langfuse["Langfuse Capture<br/>[handler.py]"]
  node_framework_adapters["Framework Adapters"]
end

node_user(("Operator"))
node_agents(("Agent Fleet"))

node_user -->|"runs commands"| node_cli
node_user -->|"manages memory"| node_dashboard
node_agents -->|"uses service"| node_api
node_api -->|"mounts routes"| node_memory_routes
node_api -->|"mounts routes"| node_session_routes
node_api -->|"mounts dashboard"| node_dashboard
node_agents -.->|"calls tools"| node_mcp
node_langfuse -.->|"writes captured spans"| node_memory_write
node_user -->|"installs integrations"| node_connect
node_user -->|"enables schedule"| node_schedule
node_user -->|"imports data"| node_migration
node_user -->|"exports estate"| node_export

click node_cli "https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/main.py"
click node_api "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/main.py"
click node_dashboard "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/ui/routes/ui_router.py"
click node_memory_routes "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/routes/memory.py"
click node_session_routes "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/routes/sessions.py"
click node_memory_read "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_read_service.py"
click node_memory_write "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_write_service.py"
click node_extraction "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/conversation_memory_extraction_service.py"
click node_policy "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_policy_service.py"
click node_namespace "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/namespace_service.py"
click node_backend "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/clients/moorcheh.py"
click node_daily_analysis "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/daily_analysis_service.py"
click node_conflicts "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/agent_service.py"
click node_schedule "https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/schedule_manager.py"
click node_export "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_export_service.py"
click node_okf "https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/okf_export_service.py"
click node_migration "https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/migrate/runner.py"
click node_connect "https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/connect/engine.py"
click node_mcp "https://github.com/moorcheh-ai/memanto/blob/main/integrations/mcp/memanto_mcp/server.py"
click node_langfuse "https://github.com/moorcheh-ai/memanto/blob/main/integrations/langfuse/langfuse_memanto/handler.py"
click node_framework_adapters "https://github.com/moorcheh-ai/memanto/tree/main/integrations"

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_api,node_dashboard,node_memory_routes,node_session_routes toneBlue
class node_memory_read,node_memory_write,node_extraction,node_policy,node_namespace,node_backend toneAmber
class node_daily_analysis,node_conflicts,node_schedule toneMint
class node_export,node_okf,node_migration toneRose
class node_connect,node_mcp,node_langfuse,node_framework_adapters,node_user,node_agents toneIndigo
```

## Components

### User Interfaces

- [Memanto CLI](https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/main.py): `memanto/cli/main.py`
- [Service API](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/main.py): `memanto/app/main.py`
- [Local Dashboard](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/ui/routes/ui_router.py): `memanto/app/ui/routes/ui_router.py`
- [Memory Routes](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/routes/memory.py): `memanto/app/routes/memory.py`
- [Session Routes](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/routes/sessions.py): `memanto/app/routes/sessions.py`

### Memory Management

- [Memory Recall](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_read_service.py): `memanto/app/services/memory_read_service.py`
- [Memory Writes](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_write_service.py): `memanto/app/services/memory_write_service.py`
- [Conversation Extraction](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/conversation_memory_extraction_service.py): `memanto/app/services/conversation_memory_extraction_service.py`
- [Expiry Policies](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_policy_service.py): `memanto/app/services/memory_policy_service.py`
- [Agent Namespaces](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/namespace_service.py): `memanto/app/services/namespace_service.py`
- [Moorcheh Backend](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/clients/moorcheh.py): `memanto/app/clients/moorcheh.py`

### Curation Operations

- [Daily Analysis](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/daily_analysis_service.py): `memanto/app/services/daily_analysis_service.py`
- [Conflict Handling](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/agent_service.py): `memanto/app/services/agent_service.py`
- [Daily Scheduler](https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/schedule_manager.py): `memanto/cli/schedule_manager.py`

### Portability

- [Memory Export](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/memory_export_service.py): `memanto/app/services/memory_export_service.py`
- [OKF Export](https://github.com/moorcheh-ai/memanto/blob/main/memanto/app/services/okf_export_service.py): `memanto/app/services/okf_export_service.py`
- [Provider Migration](https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/migrate/runner.py): `memanto/cli/migrate/runner.py`

### Agent Integrations

- [Agent Connections](https://github.com/moorcheh-ai/memanto/blob/main/memanto/cli/connect/engine.py): `memanto/cli/connect/engine.py`
- [MCP Tools](https://github.com/moorcheh-ai/memanto/blob/main/integrations/mcp/memanto_mcp/server.py): `integrations/mcp/memanto_mcp/server.py`
- [Langfuse Capture](https://github.com/moorcheh-ai/memanto/blob/main/integrations/langfuse/langfuse_memanto/handler.py): `integrations/langfuse/langfuse_memanto/handler.py`
- [Framework Adapters](https://github.com/moorcheh-ai/memanto/tree/main/integrations): `integrations`

### Other components

- **Operator**
- **Agent Fleet**

## Connections

- Operator → Memanto CLI: runs commands
- Operator → Local Dashboard: manages memory
- Agent Fleet → Service API: uses service
- Service API → Memory Routes: mounts routes
- Service API → Session Routes: mounts routes
- Service API → Local Dashboard: mounts dashboard
- Agent Fleet → MCP Tools: calls tools
- Langfuse Capture → Memory Writes: writes captured spans
- Operator → Agent Connections: installs integrations
- Operator → Daily Scheduler: enables schedule
- Operator → Provider Migration: imports data
- Operator → Memory Export: exports estate
