# memodb-io/acontext architecture

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

- Interactive diagram: https://gitdiagram.com/memodb-io/acontext
- Repository: https://github.com/memodb-io/acontext

## Overview

Acontext is an open-source skill-memory layer for AI agents: it captures session activity, learns from task outcomes, and exposes editable Markdown skills for later agent use. The README describes the learning and recall stages; the tree also shows SDKs, a Go API, a dashboard, and Claude Code/OpenClaw integrations. Dashboard and hook excerpts establish selected UI-to-action and hook-to-helper calls. Core learning internals and some integrations were not sampled, so those connections are documented or marked unverified rather than inferred as direct calls.

Main entry points: [`dashboard/app/project/[id]/actions.ts`](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/actions.ts) (Dashboard actions), [`src/server/api/go/internal/router/router.go`](https://github.com/memodb-io/acontext/blob/main/src/server/api/go/internal/router/router.go) (Acontext API), [`src/packages/claude-code/src/hook-handler.ts`](https://github.com/memodb-io/acontext/blob/main/src/packages/claude-code/src/hook-handler.ts) (Claude Code hook), [`src/server/core`](https://github.com/memodb-io/acontext/tree/main/src/server/core) (Distillation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and learn"]
  node_messages["Session messages"]
  node_task_outcome["Task outcome"]
  node_distillation["Distillation"]
  node_skill_agent["Skill agent"]
  node_skill_files["Markdown skills"]
end

subgraph group_platform["API and SDKs"]
  node_learning_spaces["Learning spaces<br/>[learning_spaces.py]"]
  node_sdk["Python and TS SDKs<br/>[client.py]"]
  node_api["Acontext API<br/>[router.go]"]
  node_storage[("API persistence<br/>[gorm.go]")]
end

subgraph group_dashboard["Project dashboard"]
  node_project_ui["Project dashboard"]
  node_session_ui["Session management"]
  node_learning_ui["Learning-space UI"]
  node_skills_ui["Agent skills UI"]
  node_disk_ui["Disk and artifacts"]
  node_logs_ui["Trace logs"]
  node_dashboard_actions["Dashboard actions<br/>[actions.ts]"]
  node_dashboard_api["Dashboard API client<br/>[server.ts]"]
end

subgraph group_integrations["Agent integrations"]
  node_claude_hook["Claude Code hook<br/>[hook-handler.ts]"]
  node_claude_bridge["Acontext bridge<br/>[bridge.ts]"]
  node_openclaw["OpenClaw integration<br/>[index.ts]"]
end

subgraph group_content["Product content"]
  node_landing["Product and guides<br/>[page.tsx]"]
end

node_agent(("Agent"))
node_developer(("Developer"))

node_agent -->|"sends messages"| node_messages
node_messages -->|"informs outcome"| node_task_outcome
node_task_outcome -->|"triggers learning"| node_distillation
node_distillation -->|"provides findings"| node_skill_agent
node_skill_agent -->|"updates skills"| node_skill_files
node_sdk -.->|"offers operations"| node_learning_spaces
node_developer -->|"uses"| node_sdk
node_learning_spaces -.->|"calls API"| node_api
node_api -.->|"persists data"| node_storage
node_developer -.->|"manages project"| node_project_ui
node_project_ui -->|"loads statistics"| node_dashboard_actions
node_session_ui -->|"creates sessions"| node_dashboard_actions
node_learning_ui -->|"loads users"| node_dashboard_actions
node_skills_ui -->|"uses project actions"| node_dashboard_actions
node_disk_ui -->|"uses project actions"| node_dashboard_actions
node_logs_ui -->|"fetches traces"| node_dashboard_actions
node_dashboard_actions -->|"requests data"| node_dashboard_api
node_dashboard_api -->|"sends API requests"| node_api
node_claude_hook -->|"records activity"| node_claude_bridge
node_claude_hook -.->|"captures transcript"| node_agent
node_openclaw -.->|"integrates with"| node_api
node_landing -.->|"explains product"| node_developer
node_skill_files -->|"provides recall tools"| node_agent

click node_distillation "https://github.com/memodb-io/acontext/tree/main/src/server/core"
click node_skill_agent "https://github.com/memodb-io/acontext/tree/main/src/server/core"
click node_skill_files "https://github.com/memodb-io/acontext/tree/main/src/server/core"
click node_learning_spaces "https://github.com/memodb-io/acontext/blob/main/src/client/acontext-py/src/acontext/resources/learning_spaces.py"
click node_sdk "https://github.com/memodb-io/acontext/blob/main/src/client/acontext-py/src/acontext/client.py"
click node_api "https://github.com/memodb-io/acontext/blob/main/src/server/api/go/internal/router/router.go"
click node_storage "https://github.com/memodb-io/acontext/blob/main/src/server/api/go/internal/infra/db/gorm.go"
click node_project_ui "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/project-page-client.tsx"
click node_session_ui "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/session/session-page-client.tsx"
click node_learning_ui "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/learning-spaces/learning-spaces-page-client.tsx"
click node_skills_ui "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/agent-skills/agent-skills-page-client.tsx"
click node_disk_ui "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/disk/disk-page-client.tsx"
click node_logs_ui "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/logs/logs-page-client.tsx"
click node_dashboard_actions "https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/actions.ts"
click node_dashboard_api "https://github.com/memodb-io/acontext/blob/main/dashboard/lib/acontext/server.ts"
click node_claude_hook "https://github.com/memodb-io/acontext/blob/main/src/packages/claude-code/src/hook-handler.ts"
click node_claude_bridge "https://github.com/memodb-io/acontext/blob/main/src/packages/claude-code/src/bridge.ts"
click node_openclaw "https://github.com/memodb-io/acontext/blob/main/src/packages/openclaw/index.ts"
click node_landing "https://github.com/memodb-io/acontext/blob/main/landingpage/src/app/(frontend)/page.tsx"

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_messages,node_task_outcome,node_distillation,node_skill_agent,node_skill_files toneBlue
class node_learning_spaces,node_sdk,node_api,node_storage toneAmber
class node_project_ui,node_session_ui,node_learning_ui,node_skills_ui,node_disk_ui,node_logs_ui,node_dashboard_actions,node_dashboard_api toneMint
class node_claude_hook,node_claude_bridge,node_openclaw toneRose
class node_landing,node_agent,node_developer toneIndigo
```

## Components

### Capture and learn

- **Session messages**
- **Task outcome**
- [Distillation](https://github.com/memodb-io/acontext/tree/main/src/server/core): `src/server/core`
- [Skill agent](https://github.com/memodb-io/acontext/tree/main/src/server/core): `src/server/core`
- [Markdown skills](https://github.com/memodb-io/acontext/tree/main/src/server/core): `src/server/core`

### API and SDKs

- [Learning spaces](https://github.com/memodb-io/acontext/blob/main/src/client/acontext-py/src/acontext/resources/learning_spaces.py): `src/client/acontext-py/src/acontext/resources/learning_spaces.py`
- [Python and TS SDKs](https://github.com/memodb-io/acontext/blob/main/src/client/acontext-py/src/acontext/client.py): `src/client/acontext-py/src/acontext/client.py`
- [Acontext API](https://github.com/memodb-io/acontext/blob/main/src/server/api/go/internal/router/router.go): `src/server/api/go/internal/router/router.go`
- [API persistence](https://github.com/memodb-io/acontext/blob/main/src/server/api/go/internal/infra/db/gorm.go): `src/server/api/go/internal/infra/db/gorm.go`

### Project dashboard

- [Project dashboard](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/project-page-client.tsx): `dashboard/app/project/[id]/project-page-client.tsx`
- [Session management](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/session/session-page-client.tsx): `dashboard/app/project/[id]/session/session-page-client.tsx`
- [Learning-space UI](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/learning-spaces/learning-spaces-page-client.tsx): `dashboard/app/project/[id]/learning-spaces/learning-spaces-page-client.tsx`
- [Agent skills UI](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/agent-skills/agent-skills-page-client.tsx): `dashboard/app/project/[id]/agent-skills/agent-skills-page-client.tsx`
- [Disk and artifacts](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/disk/disk-page-client.tsx): `dashboard/app/project/[id]/disk/disk-page-client.tsx`
- [Trace logs](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/logs/logs-page-client.tsx): `dashboard/app/project/[id]/logs/logs-page-client.tsx`
- [Dashboard actions](https://github.com/memodb-io/acontext/blob/main/dashboard/app/project/%5Bid%5D/actions.ts): `dashboard/app/project/[id]/actions.ts`
- [Dashboard API client](https://github.com/memodb-io/acontext/blob/main/dashboard/lib/acontext/server.ts): `dashboard/lib/acontext/server.ts`

### Agent integrations

- [Claude Code hook](https://github.com/memodb-io/acontext/blob/main/src/packages/claude-code/src/hook-handler.ts): `src/packages/claude-code/src/hook-handler.ts`
- [Acontext bridge](https://github.com/memodb-io/acontext/blob/main/src/packages/claude-code/src/bridge.ts): `src/packages/claude-code/src/bridge.ts`
- [OpenClaw integration](https://github.com/memodb-io/acontext/blob/main/src/packages/openclaw/index.ts): `src/packages/openclaw/index.ts`

### Product content

- [Product and guides](https://github.com/memodb-io/acontext/blob/main/landingpage/src/app/(frontend)/page.tsx): `landingpage/src/app/(frontend)/page.tsx`

### Other components

- **Agent**
- **Developer**

## Connections

- Agent → Session messages: sends messages (evidence: `README.md`)
- Session messages → Task outcome: informs outcome (evidence: `README.md`)
- Task outcome → Distillation: triggers learning (evidence: `README.md`)
- Distillation → Skill agent: provides findings (evidence: `README.md`)
- Skill agent → Markdown skills: updates skills (evidence: `README.md`)
- Python and TS SDKs → Learning spaces: offers operations
- Developer → Python and TS SDKs: uses (evidence: `README.md`)
- Learning spaces → Acontext API: calls API
- Acontext API → API persistence: persists data
- Developer → Project dashboard: manages project
- Project dashboard → Dashboard actions: loads statistics (evidence: `dashboard/app/project/[id]/project-page-client.tsx`)
- Session management → Dashboard actions: creates sessions (evidence: `dashboard/app/project/[id]/session/session-page-client.tsx`)
- Learning-space UI → Dashboard actions: loads users (evidence: `dashboard/app/project/[id]/learning-spaces/learning-spaces-page-client.tsx`)
- Agent skills UI → Dashboard actions: uses project actions (evidence: `dashboard/app/project/[id]/agent-skills/agent-skills-page-client.tsx`)
- Disk and artifacts → Dashboard actions: uses project actions (evidence: `dashboard/app/project/[id]/disk/disk-page-client.tsx`)
- Trace logs → Dashboard actions: fetches traces (evidence: `dashboard/app/project/[id]/logs/logs-page-client.tsx`)
- Dashboard actions → Dashboard API client: requests data (evidence: `dashboard/app/project/[id]/actions.ts`)
- Dashboard API client → Acontext API: sends API requests (evidence: `dashboard/lib/acontext/server.ts`)
- Claude Code hook → Acontext bridge: records activity (evidence: `src/packages/claude-code/src/hook-handler.ts`)
- Claude Code hook → Agent: captures transcript
- OpenClaw integration → Acontext API: integrates with
- Product and guides → Developer: explains product
- Markdown skills → Agent: provides recall tools (evidence: `README.md`)
