How major7apps/pensyve works
Pensyve is an offline-first, cross-framework memory runtime for AI agents. Agents record episodes or explicit facts; the runtime stores episodic, semantic, and procedural memories, consolidates them, and retrieves ranked context for later sessions. Users reach the core through an in-process Python binding, remote REST/MCP interfaces and SDKs, or framework adapters. The core also supports SQLite/Postgres, embeddings, graph-assisted retrieval, forgetting, and feedback. README capabilities inform the map; several subsystem links use documented behavior because their source was not sampled.
Main entry points: engine.rs Recall engine · types.rs Memory types · main.rs HTTP gateway · index.ts TS and Go SDKs
Components 23
Agent interfaces
- Framework adapters
integrations - Python SDK
pensyve-python/python/pensyve - Native binding
pensyve-python/src/lib.rs - TS and Go SDKs
pensyve-ts/src/index.ts - CLI
pensyve-cli/src/main.rs
Service access
- MCP server
pensyve-mcp/src/main.rs - MCP tools
pensyve-mcp-tools/src/server.rs - HTTP gateway
pensyve-mcp-gateway/src/main.rs - REST API
pensyve-mcp-gateway/src/rest.rs
Memory lifecycle
- Episode capture
pensyve-core/src/observation.rs - Fact extraction
pensyve-core/src/extraction/mod.rs - Memory types
pensyve-core/src/types.rs - Consolidation
pensyve-core/src/consolidation/mod.rs - Procedural learning
pensyve-core/src/procedural.rs - Forgetting
pensyve-core/src/decay.rs
Recall engine
- Recall engine
pensyve-core/src/retrieval/engine.rs - Query routing
pensyve-core/src/retrieval/query_classifier.rs - Grouped recall
pensyve-core/src/recall_grouped.rs
State and models
- SQLite store
pensyve-core/src/storage/sqlite.rs - Postgres store
pensyve-core/src/storage/postgres.rs - Embedding model
pensyve-core/src/embedding.rs - Knowledge graph
pensyve-core/src/graph.rs
Other components
- AI agent
Connections 28
- AI agent → Framework adapters: uses adapter
- Framework adapters → TS and Go SDKs: captures and calls
- AI agent → Python SDK: records and recalls
- Python SDK → Native binding: calls in-process
- AI agent → TS and Go SDKs: calls API
- AI agent → CLI: runs commands
- CLI → Recall engine: requests recall
- TS and Go SDKs → HTTP gateway: sends requests
- HTTP gateway → REST API: dispatches REST
- HTTP gateway → MCP tools: serves MCP
- MCP server → MCP tools: exposes tools
- MCP tools → Memory types: records and manages
- Native binding → Memory types: records and recalls
- Memory types → Episode capture: forms episodes
- Episode capture → Fact extraction: extracts facts
- Fact extraction → Memory types: produces memories
- Memory types → SQLite store: persists memories
- Memory types → Procedural learning: tracks outcomes
- Consolidation → SQLite store: promotes and updates
- Consolidation → Forgetting: applies decay
- Recall engine → Query routing: classifies query
- Recall engine → SQLite store: gathers candidates
- Recall engine → Embedding model: embeds query
- Recall engine → Knowledge graph: uses graph signal
- Recall engine → Procedural learning: retrieves learned actions
- Grouped recall → Recall engine: requests recall
- Recall engine → AI agent: returns ranked context
- Postgres store → Recall engine: stores production memories