---
id: gh-agentmemory-architecture
name: "agentmemory-architecture"
url: https://skills.yangsir.net/skill/gh-agentmemory-architecture
author: rohitg00
domain: ai-agent-memory-knowledge
tags: ["agent-memory", "architecture", "knowledge-management", "information-retrieval", "ai-agents"]
install_count: 11700
rating: 4.50 (120 reviews)
github: https://github.com/rohitg00/agentmemory/tree/main/plugin/skills/agentmemory-architecture
---

# agentmemory-architecture

> 此技能详细阐述了 agentmemory 的架构、iii 引擎原语、存储模型、端口及可视化工具。它解释了记忆如何被存储、检索和管理，包括混合检索机制和记忆生命周期。开发者可利用此技能深入理解 agentmemory 的内部运作，从而更好地进行系统扩展、故障排查或优化记忆策略，确保 AI 智能体能高效地管理和利用知识。

**Stats**: 11,700 installs · 4.5/5 (120 reviews)

## Before / After 对比

### 快速理解 AI 智能体记忆架构

**Before**:

在没有这个技能之前，开发者需要花费大量时间手动查阅代码、文档碎片或进行反复实验，才能理解 agentmemory 的复杂内部机制，导致学习曲线陡峭，系统扩展和问题排查效率低下。

**After**:

该 Skill 提供清晰的架构概览和运作原理，使开发者能够迅速掌握 agentmemory 的记忆存储、检索和管理方式，显著缩短学习时间，加速开发和故障诊断过程。

| Metric | Before | After | Change |
|---|---|---|---|
| 架构理解时间 | 8小时 | 1小时 | -87% |

## Readme

agentmemory is a memory server for coding agents. It runs locally, captures observations, indexes them for hybrid retrieval, and serves them back over REST and MCP. Worker Compose runs the pinned iii engine with AgentMemory and the registry `state` and `http` workers. The state worker uses a file-backed KV store by default, with Redis available by configuration; it is not SQLite.

## iii primitives

Everything is a function, a trigger, or worker state on the iii engine. There is no separate plugin system; the worker registers functions (`mem::*`) and HTTP triggers (`api::*`) and the engine routes calls. agentmemory does not bypass iii; new capability is a new function plus a trigger.

## Retrieval model

Recall combines BM25 keyword search with configured vector similarity and graph expansion. A clean installation has no embedding provider and uses BM25 without an API key. Set `EMBEDDING_PROVIDER=local` to enable on-device embeddings, which download a model once. A remote embedding provider runs only when `EMBEDDING_PROVIDER` names it. LLM summaries, consolidation and reflection run only when `AGENTMEMORY_LLM_PROVIDER` selects a provider or `AGENTMEMORY_ALLOW_AGENT_SDK=true` turns on the Claude Agent SDK fallback; a key in the environment alone does not turn them on. Per-observation LLM compression also needs `AGENTMEMORY_AUTO_COMPRESS=true`.

## Data boundary

Captured prompts, tool inputs and outputs, and memories stay in the local store. They leave the machine only through options the user turns on: a selected LLM provider, the Agent SDK fallback (`AGENTMEMORY_ALLOW_AGENT_SDK=true`), a remote embedding provider, a Redis state backend, or mesh sync to peer servers the user registers.

## Storage and lifecycle

Memories carry content, concepts, files, importance, and timestamps, grouped into sessions and optionally linked to commits. A lifecycle of capture, compress, consolidate, and forget keeps the store useful over time rather than letting it grow unbounded.

## Ports

REST defaults to port `3111`, the viewer to `3113`, and the internal engine WebSocket to `49134`. Use `--port <N>` or `--instance <N>` to select another local runtime.

## Viewer

A real-time web viewer at `http://localhost:3113` shows memory building as sessions run, with authenticated SSE updates over the REST port. Useful for demos and for confirming capture is working.

## See also

- agentmemory-mcp-tools and agentmemory-rest-api for the surfaces.
- agentmemory-hooks for automatic capture.
- agentmemory-config for ports and feature flags.


---
*Source: https://skills.yangsir.net/skill/gh-agentmemory-architecture*
*Markdown mirror: https://skills.yangsir.net/api/skill/gh-agentmemory-architecture/markdown*