[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"pack-detail-agent-memory-layer-en":3,"seo:pack:agent-memory-layer:en":78},{"code":4,"message":5,"data":6},200,"操作成功",{"pack":7},{"slug":8,"icon":9,"tone":10,"status":11,"status_label":12,"title":13,"description":14,"items":15,"install_cmd":77},"agent-memory-layer","🧠","#F59E0B","stable","Stable","Memory Layer for Agents","Mem0, Zep, Cognee, and the patterns to make agents remember across sessions — without baking everything into the prompt.",[16,28,38,45,52,60,70],{"id":17,"uuid":18,"slug":19,"title":20,"description":21,"author_name":22,"view_count":23,"vote_count":24,"lang_type":25,"type":26,"type_label":27},703,"96da1f40-1823-4d87-a84f-7d8269edeb24","mem0-memory-layer-ai-applications-96da1f40","Mem0 — Memory Layer for AI Applications","Add persistent, personalized memory to AI agents and assistants. Mem0 stores user preferences, past interactions, and learned context across sessions.","Mem0",916,0,"en","skill","Skill",{"id":29,"uuid":30,"slug":31,"title":32,"description":33,"author_name":34,"view_count":35,"vote_count":24,"lang_type":25,"type":36,"type_label":37},852,"a3fe5165-33ca-11f1-9bc6-00163e2b0d79","codebase-memory-mcp-code-intelligence-ai-agents-a3fe5165","Codebase Memory MCP — Code Intelligence for AI Agents","High-performance code intelligence MCP server. Indexes repos in milliseconds via tree-sitter AST, supports 66 languages, sub-ms graph queries. MIT, 1,300+ stars.","MCP Hub",340,"mcp","MCP",{"id":39,"uuid":40,"slug":41,"title":42,"description":43,"author_name":34,"view_count":44,"vote_count":24,"lang_type":25,"type":36,"type_label":37},715,"554c4dc2-663c-489a-b57f-814948e9f714","memory-mcp-persistent-ai-agent-knowledge-graph-554c4dc2","Memory MCP — Persistent AI Agent Knowledge Graph","MCP server that gives AI agents persistent memory using a local knowledge graph. Stores entities, relationships, and observations across sessions for Claude Code.",295,{"id":46,"uuid":47,"slug":48,"title":49,"description":50,"author_name":34,"view_count":51,"vote_count":24,"lang_type":25,"type":26,"type_label":27},743,"ffde39a9-bd16-4c41-8168-aacfb05b7622","zep-long-term-memory-ai-agents-assistants-ffde39a9","Zep — Long-Term Memory for AI Agents and Assistants","Production memory layer for AI assistants. Zep stores conversation history, extracts facts, builds knowledge graphs, and provides temporal-aware retrieval for LLMs.",309,{"id":53,"uuid":54,"slug":55,"title":56,"description":57,"author_name":58,"view_count":59,"vote_count":24,"lang_type":25,"type":26,"type_label":27},334,"b6ad223f-51da-4179-863c-5f9b3c7d08ef","cognee-memory-engine-ai-agents-b6ad223f","Cognee — Memory Engine for AI Agents","Cognee adds persistent structured memory to any AI agent in 6 lines of code. 14.8K+ stars. Knowledge graphs, vector stores, LLM integration. Apache 2.0.","Skill Factory",224,{"id":61,"uuid":62,"slug":63,"title":64,"description":65,"author_name":66,"view_count":67,"vote_count":24,"lang_type":25,"type":68,"type_label":69},829,"b52189f9-e04a-4425-89db-e16fa7e81eec","ai-agent-memory-patterns-build-agents-remember-b52189f9","AI Agent Memory Patterns — Build Agents That Remember","Design patterns for adding persistent memory to AI agents. Covers conversation memory, entity extraction, knowledge graphs, tiered memory, and memory management strategies.","Agent Toolkit",328,"prompt","Prompt",{"id":71,"uuid":72,"slug":73,"title":74,"description":75,"author_name":22,"view_count":76,"vote_count":24,"lang_type":25,"type":26,"type_label":27},402,"b61fca8c-edd9-4ffa-bdc3-f21ce6715af9","mem0-memory-layer-ai-agents-b61fca8c","Mem0 — Memory Layer for AI Agents","Add persistent, personalized memory to any AI agent. Learns user preferences, adapts context, reduces tokens. 51K+ stars, used by 100K+ devs.",416,"tokrepo install pack\u002Fagent-memory-layer",{"pageType":79,"pageKey":8,"locale":25,"title":80,"metaDescription":81,"h1":13,"tldr":82,"bodyMarkdown":83,"faq":84,"schema":100,"internalLinks":109,"citations":122,"wordCount":135,"generatedAt":136},"pack","Agent Memory Layer: Mem0, Zep, Cognee patterns for 2026","Mem0, Zep, Cognee — the memory layer agents use to remember across sessions. Plus four implementation patterns. Install in one TokRepo command.","Three production memory libraries (Mem0, Zep, Cognee) plus four patterns that stop you stuffing the prompt with everything you ever knew. One-command install via TokRepo.","## What's in this pack\n\nThis pack collects the **seven memory-layer assets** that show up in every agent that needs to remember things between sessions without re-pasting them into the prompt every time. Three are the canonical libraries. Four are pattern templates that wrap them — patterns Anthropic and OpenAI both surface in their long-running-agent guides.\n\n| # | Asset | Type | What it gives you |\n|---|---|---|---|\n| 1 | Mem0 | library | Auto-extract & update user facts, drop-in API |\n| 2 | Zep | service | Temporal knowledge graph, long-term memory |\n| 3 | Cognee | library | Graph + vector hybrid memory pipeline |\n| 4 | Episodic-summary pattern | template | Compress long sessions into summary memories |\n| 5 | Working-memory scratchpad | template | Inter-step state without prompt bloat |\n| 6 | User-fact extractor | template | Pull stable facts from chat into a memory store |\n| 7 | Cross-session recall | template | \"What did we decide last week?\" pattern |\n\n## Why this matters\n\nThe default Claude \u002F GPT-4 \u002F Gemini setup has zero memory. Every conversation starts fresh. Most apps fake memory by stuffing previous turns into the system prompt — that works for a while, then your context window blows up, your bill triples, and the model loses the plot. Memory layers solve this by storing facts outside the prompt and only injecting the relevant ones per turn.\n\nThe three libraries each pick a different bet:\n\n- **Mem0** is the easiest. One `mem0.add(messages, user_id=...)` call and the library extracts what's worth remembering. Best for chatbot-style apps with a clear user identity.\n- **Zep** is the production option. Runs as a service, gives you a temporal knowledge graph (memories with timestamps and relationships), and supports multi-tenant. Best when you need audit trails or memory shared across an org.\n- **Cognee** is the graph-native bet. It models memory as a knowledge graph from day one — useful if your domain is research, code, or anything with strong entity relationships.\n\nThe four patterns aren't libraries — they're prompt templates and small adapters that work with any of the three. They're the difference between \"I installed Mem0\" and \"memory actually works in my app.\"\n\n## Install in one command\n\n```bash\n# Install the entire pack\ntokrepo install pack\u002Fagent-memory-layer\n\n# Or install one library at a time\ntokrepo install mem0\ntokrepo install zep\ntokrepo install cognee\n```\n\nThe TokRepo CLI normalizes file placement: Claude Code subagents into `.claude\u002Fagents\u002F`, Cursor rules into `.cursor\u002Frules\u002F`, AGENTS.md entries for Codex CLI. The library installs are pip\u002Fnpm — TokRepo just wires them into your AI tool's config so the agent knows the memory layer exists.\n\n## Common pitfalls\n\n- **Don't store everything.** Memory cost scales with what you write, not what you retrieve. Use a fact extractor (pattern #6) to filter — only durable facts about the user\u002Fproject belong in long-term memory.\n- **Don't skip the recency bias.** Pure vector recall pulls semantically-similar but stale memories. Zep's temporal graph and Mem0's update-in-place both fix this; if you roll your own, weight by recency or you'll keep retrieving 6-month-old context.\n- **Don't share user IDs across tenants.** All three libraries support per-user namespaces. Use them. Memory leakage between users is a much worse incident than no memory at all.\n- **Token budget the recall step.** Even with a memory layer, you can blow your context window if you set `top_k=50` for retrieval. Start at `top_k=5` and tune up only if recall is missing.\n- **Reconcile on conflict.** If the user says \"I'm vegetarian\" in March and \"I'm vegan\" in May, you need an update strategy. Mem0 handles this automatically; Zep gives you the conflict surface; Cognee leaves it to you.\n\n## Common misconceptions\n\n**\"RAG and memory are the same thing.\"** They're not. RAG retrieves from a static corpus (docs, codebase). Memory writes new entries based on what the user\u002Fagent said and retrieves them later. RAG is read-only; memory is read-write. The patterns in pack\u002Frag-pipelines are different from this pack on purpose.\n\n**\"I can just use the conversation history.\"** For a 5-turn session, sure. For an app where the same user comes back next week, no — you'd have to feed every prior turn into the prompt forever. Memory extracts the facts and discards the chat.\n\n**\"Mem0 vs Zep is a hard choice.\"** Most teams use Mem0 first because it's a 5-minute setup, then graduate to Zep when they need multi-tenant or audit. The two are similar enough that migration is a weekend, not a quarter.",[85,88,91,94,97],{"q":86,"a":87},"Is Mem0 free?","The Mem0 OSS library is MIT-licensed and free to self-host. They also have a managed cloud option with usage-based pricing if you don't want to run the embedding\u002Fvector store yourself. Zep has the same OSS + cloud model. Cognee is fully OSS with no managed option as of mid-2026 — you run it yourself.",{"q":89,"a":90},"Will this work in Cursor \u002F Codex CLI \u002F Windsurf?","The libraries are language-level (Python \u002F Node) so they work with any agent framework, not just Claude Code. The TokRepo CLI installs the right config files for each AI tool. Codex CLI users should pair the memory layer with AGENTS.md instructions; Cursor users embed it in the rule set.",{"q":92,"a":93},"How does Mem0 compare to Zep?","Mem0 is library-first — you import it and call .add()\u002F.search() inline. Zep is service-first — you run a server (Docker), it owns the graph, and your app calls the API. Mem0 wins on time-to-first-memory; Zep wins on multi-tenant, audit, and explicit relationship modeling. Pick Mem0 for prototypes, Zep when you have ops support.",{"q":95,"a":96},"What's the difference vs the RAG Pipelines pack?","RAG retrieves from a fixed corpus (your docs, your codebase). Memory writes new facts as the agent runs and retrieves them later. RAG is read-only; memory is read-write and accumulates. Most production agents need both: RAG for static knowledge, memory for the user-specific stuff.",{"q":98,"a":99},"When should I NOT add a memory layer?","When sessions are stateless and short — single-shot tasks like 'summarize this PDF' don't benefit from memory and the layer adds latency. Also skip it for purely factual lookup (use RAG instead). Memory layers are worth their cost when the same user comes back, the agent is multi-step, or both.",{"@context":101,"@type":102,"name":13,"description":103,"numberOfItems":104,"publisher":105},"https:\u002F\u002Fschema.org","CollectionPage","Mem0, Zep, Cognee, and the patterns to make agents remember across sessions.",7,{"@type":106,"name":107,"url":108},"Organization","TokRepo","https:\u002F\u002Ftokrepo.com",[110,114,118],{"url":111,"anchor":112,"reason":113},"\u002Fen\u002Fpacks\u002Frag-pipelines","RAG Pipelines","memory and retrieval are sister concerns",{"url":115,"anchor":116,"reason":117},"\u002Fen\u002Fpacks\u002Fmulti-agent-frameworks","Multi-Agent Frameworks","shared memory across agents",{"url":119,"anchor":120,"reason":121},"\u002Fen\u002Ftools\u002Fclaude-code","Claude Code","primary host for these memory adapters",[123,127,131],{"claim":124,"source_name":125,"source_url":126},"Mem0 is an open-source memory layer for LLMs that auto-extracts and updates user-specific facts","mem0ai\u002Fmem0 on GitHub","https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0",{"claim":128,"source_name":129,"source_url":130},"Zep is a long-term memory service with temporal knowledge graphs","getzep\u002Fzep on GitHub","https:\u002F\u002Fgithub.com\u002Fgetzep\u002Fzep",{"claim":132,"source_name":133,"source_url":134},"Cognee builds memory pipelines for AI applications using graph + vector hybrid stores","topoteretes\u002Fcognee on GitHub","https:\u002F\u002Fgithub.com\u002Ftopoteretes\u002Fcognee",760,"2026-05-02T15:00:00Z"]