Skip to content

Knowledge base

Memory and Context Engineering

Context engineering is the work of curating the tokens a model sees at each step, and agent memory is what carries that context across sessions. Most agent failures are context failures, so this curation is the main lever an engineer has over agent quality.

Written by

Updated:

Agentic Engineering 5

Our position. We treat the context window as the scarcest resource an agent has and manage it actively. Start bare (opens in a new tab), load only what the task needs, and save what must survive to Markdown files instead of letting the window fill up.

Context is the set of tokens the model sees when it decides what to do next. The work splits into a few questions. How do you keep the window small and high-signal? Which explicit artifacts, such as ADRs, schemas and bounded contexts, replace the implicit knowledge a human brings for free? How does context fail through pollution and starvation? An agent can retrieve knowledge just in time instead of front-loading it. State can outlive a session through notes, memory layers and knowledge graphs. Once versioned like code, context is generated, tested and revised like any other engineering material.

Start here

Resources

Memory Systems

  • Acontext (opens in a new tab) - Open-source memory layer for AI agents that stores LLM messages, tracks state, and extracts SOPs from successful runs as reusable agent skills.
  • Agentic Context Engine (ACE) (opens in a new tab) - Apache 2.0 Python framework that lets agents learn from experience by extracting strategies into a persistent Skillbook; no fine-tuning or vector databases.
  • Basic Memory (opens in a new tab) - Persistent memory layer that lets AI conversations carry project context across sessions instead of re-explaining each time.
  • Beads (opens in a new tab) - Memory upgrade for coding agents using a zero-setup distributed database.
  • ChunkHound (opens in a new tab) - Local-first codebase intelligence tool that searches and analyzes code across 30+ languages with semantic and regex queries.
  • Claude History MCP (opens in a new tab) - MCP server that indexes Claude Code conversation history so agents can search and reference past sessions and decisions.
  • Code Context Engine (opens in a new tab) - MIT local-first codebase indexer (Python, Tree-sitter, sqlite-vec) that lets agents search code instead of re-reading files, exposed over MCP; reports 94% token savings.
  • Cognee MCP (opens in a new tab) - MCP server exposing Cognee’s memory and knowledge-graph layer to agents in a few lines of code.
  • Hindsight (opens in a new tab) - MIT agent memory system on a Retain, Recall, Reflect model that organizes memories into facts, experiences, and mental models, with multi-strategy retrieval over PostgreSQL.
  • Letta (opens in a new tab) - Open-source framework for building stateful agents with long-term memory, formerly MemGPT.
  • MCP Memory (opens in a new tab) - Official MCP reference server for memory storage and retrieval.
  • Mem0 (opens in a new tab) - Universal memory layer for AI agents with long-term retention across sessions.
  • Mem0 CLI (opens in a new tab) - CLI for Mem0’s universal memory layer, used to add, recall, and search agent memories from the terminal without writing code.
  • Memorix (opens in a new tab) - Open-source cross-agent memory layer over MCP that shares persistent context across Cursor, Claude Code, Codex, and others, with git-based indexing and reasoning capture.
  • Serena MCP (opens in a new tab) - MCP toolkit that gives coding agents semantic code retrieval and editing, acting as an IDE for the agent.
  • SimpleMem (opens in a new tab) - Lifelong memory layer for LLM agents with semantic lossless compression and lookup across text, image, audio, and video; exposes text memory via MCP.
  • Sirchmunk (opens in a new tab) - Embedding-free search and reasoning layer that runs over raw data without vector databases, with FAST and DEEP (Monte Carlo) modes and an MCP server.
  • Supermemory (opens in a new tab) - MIT memory and context engine for AI agents that automatically extracts facts, maintains user profiles, and resolves contradictions, with hybrid RAG and multi-modal ingestion.
  • TrustGraph (opens in a new tab) - Graph-native runtime for storing, enriching, and retrieving structured knowledge with a multi-model database, prebuilt DocumentRAG/GraphRAG/OntologyRAG pipelines, portable context cores, 3D visualization, and MCP integration.
  • Zep (opens in a new tab) - Context engineering service for AI agents with a unified context graph, Graph RAG, and automated context assembly across frameworks, returning context in around 200ms.

Context Retrieval

  • CocoIndex (opens in a new tab) - Incremental data framework that keeps code call graphs, symbol tables, and semantic indexes fresh for agents by reprocessing only the changed delta.
  • Context7 (opens in a new tab) - MCP server and CLI (opens in a new tab) that pulls version-specific library docs and code examples into the prompt to stop hallucinated or outdated API calls.
  • Crawl4AI (opens in a new tab) - Open-source LLM-friendly web crawler that turns pages into clean Markdown for RAG, agents, and pipelines, with CSS, LLM, and schema extraction.
  • Firecrawl MCP (opens in a new tab) - Official Firecrawl MCP server adding web scraping and search to Cursor, Claude Code, and other LLM clients.
  • Haystack (opens in a new tab) - Open-source framework from deepset for building RAG, search, and agent pipelines over documents.
  • LlamaIndex (opens in a new tab) - Data framework that connects custom data sources to LLMs with indexing and retrieval for RAG and agents.
  • MinerU (opens in a new tab) - High-accuracy engine that parses PDFs, Office files, and images into LLM-ready Markdown or JSON for RAG and agent workflows, with an MCP server.
  • QMD (opens in a new tab) - Local on-device CLI and MCP search engine for markdown notes and transcripts, combining BM25, vector search, and LLM reranking with path-attached context metadata.
  • RAGFlow (opens in a new tab) - Open-source RAG engine built on deep document understanding, with layout-aware chunking and citation-grounded retrieval.
  • Ref Tools MCP (opens in a new tab) - MCP server that searches public and private library docs for coding agents to cut wasted context and library-API mistakes.

Knowledge Graphs

  • Agent Lattice (lat.md) (opens in a new tab) - Markdown-based knowledge graph for a codebase that uses wiki-style links to connect doc sections to source symbols, with a CLI for validation, search, and navigation.
  • Code Review Graph (opens in a new tab) - MIT local-first code knowledge graph (Python, Tree-sitter, SQLite) that maps a codebase so AI assistants read only relevant files during reviews, with 30 MCP tools.
  • CodeGraph (opens in a new tab) - Pre-indexed local code knowledge graph that gives Claude Code, Codex, Cursor, and other agents semantic code intelligence; claims ~35% cost reduction.
  • Cognee AI (opens in a new tab) - Open-source memory SDK that builds knowledge graphs over an agent’s data, decisions, and workflows so it can recall and connect context.
  • Create Context Graph (opens in a new tab) - Interactive CLI that scaffolds AI agent apps backed by Neo4j knowledge graphs across 22 domains and 8 frameworks, with SaaS connectors and three-tier memory.
  • Graft (opens in a new tab) - MIT code knowledge graph of markdown nodes and typed links built with tree-sitter, no embeddings; wires into coding agents via MCP.
  • Graphiti (opens in a new tab) - Library that builds real-time knowledge graphs as a memory layer for AI agents.
  • Hyper-Extract (opens in a new tab) - Apache 2.0 Python CLI that turns unstructured text into eight knowledge-structure types using GraphRAG, LightRAG, and other methods, with 80+ domain templates.
  • MemPalace (opens in a new tab) - Local-first memory system organized as a hierarchical palace backed by ChromaDB and SQLite, with temporal validity, AAAK lossy compression, and an MCP server.
  • OntoBricks (opens in a new tab) - Turns Unity Catalog tables into a materialized knowledge graph via LLM-drafted OWL ontologies, R2RML mapping, and SHACL validation, queryable by agents over MCP; non-OSI license, exploration-only.
  • gbrain (opens in a new tab) - Self-wiring agent brain that pairs hybrid search with a knowledge graph, extracting typed links without LLM calls; local PGLite-backed CLI plus MCP server.

Knowledge OS / Second Brain

  • Airweave (opens in a new tab) - Open-source context retrieval layer that connects 100+ apps, databases, and document stores into searchable knowledge bases for AI agents, with hybrid search and automated sync.
  • Product OS Workspace Template (opens in a new tab) - Personal Claude Code workspace template for product managers, with file-based organization and both a blank starter and a worked example.
  • Proof (opens in a new tab) - Online markdown document editor for AI agents and humans to co-edit with live presence, comments, and per-character provenance; installs into Claude Code and Codex.
  • Team OS Example Repo (opens in a new tab) - Template repository modeling a fictional 10-person product team’s shared knowledge base in Git so new AI sessions start with full team context.
  • Tolaria (opens in a new tab) - (tolaria.md (opens in a new tab)) Open-source Tauri/React desktop app (macOS, Linux) for managing markdown knowledge bases as agent memory, with AGENTS.md support and a bundled MCP server for AI agents.
  • massCode (opens in a new tab) - AGPL-3.0 local-first Electron snippet manager (TypeScript, Vue) that stores code snippets and markdown notes as plain .md files on disk for git and cloud sync.

Vector & Graph Databases

Embedding Models

In this section

  • Persistent agent memory

    Persistent agent memory is state an agent writes outside its context window and reads back in a later session, as notes, memory files or knowledge graphs. The hard part is forgetting: memory that only grows ends up holding nothing useful.

  • Just-in-time retrieval

    Search on demand or index up front? The trade-offs for coding agents, Cognition's measurements on both approaches, and a catalog of retrieval tools.

  • Context as a versioned artifact

    For teams with dozens of skills and rules: giving each one an owner, testing context with tiered evals, and the supply-chain risks of sharing it.