{"slug": "agentkeeper-solved-the-goldfish-memory-problem-in-ai-agents-v1-1-out-now", "title": "Agentkeeper solved the Goldfish Memory problem in AI Agents.v1.1 out now", "summary": "AgentKeeper released version 1.1 of its AI agent infrastructure, solving the \"Goldfish Memory\" problem by providing cognitive continuity across model switches, crashes, and restarts. The update introduces protected principles and constraints that survive compression cycles, TTL-based fact expiration for compliance, and an MCP server enabling any MCP-aware client to access the agent's cognitive layer without integration code.", "body_md": "**Cognitive continuity infrastructure for long-lived AI agents.**\n\nYour agent survives model switches, crashes, context-window limits, and restarts — with the same identity, memory, and priorities it had before.\n\nAgents don't fail because they forget facts. They fail because they lose **cognitive continuity** — their state, priorities, and identity drift the moment the model changes, the context window fills, or the process restarts.\n\nAgentKeeper treats this as a systems problem, not a memory problem.\n\n```\npip install agentkeeper-ai\n```\n\nZero required dependencies. No external infrastructure. Storage defaults to local SQLite.\n\n```\npip install 'agentkeeper-ai[anthropic]'   # Claude\npip install 'agentkeeper-ai[openai]'      # GPT + OpenAI embeddings\npip install 'agentkeeper-ai[gemini]'      # Gemini\npip install 'agentkeeper-ai[semantic]'    # Local embeddings (sentence-transformers)\npip install 'agentkeeper-ai[mcp]'         # MCP server (Claude Desktop, Cursor, Codex)\npip install 'agentkeeper-ai[encrypted]'   # Encrypted storage at rest\npip install 'agentkeeper-ai[all]'         # Everything\n```\n\nPrinciples and constraints are **protected** — exempt from every compression pass, injected into every reconstructed context, regardless of token budget. They survive decay, consolidation, contradiction arbitration, model switches, and process restarts.\n\n``` python\nimport agentkeeper\n\nagent = agentkeeper.create(agent_id=\"aria\", provider=\"anthropic\")\nagent.set_identity(\n    name=\"Aria\",\n    role=\"EU insurance broker copilot\",\n    principles=[\"never share PII without explicit consent\"],\n    constraints=[\"EU data residency only\"],\n)\nagent.principle(\"always confirm budget changes in writing\")\nagent.fact(\"client: Acme Corporation\", importance=0.95)\nagent.event(\"contract signed\", when=\"2026-05-15\")\nagent.save()\n\n# 100 compression cycles later — identity intact.\n```\n\nThe cognitive state is reconstructed in the format each model expects. XML for Claude, labelled sections for GPT-4, narrative prose for Gemini, terse tokens for Ollama. One agent, four runtimes, zero rewrites.\n\n```\nagent = agentkeeper.load(\"aria\", provider=\"anthropic\")\nresponse = agent.ask(\"What do we know about Acme?\")\n\nagent.switch_provider(\"openai\").save()\nresponse = agent.ask(\"Same question, different model.\")\n# Memory and identity are intact. Format has changed. Nothing broke.\n```\n\nFacts and graph triples accept a TTL. When it lapses, `purge_expired()`\n\nremoves them. No manual cleanup. Compliant by default.\n\n```\nagent.fact(\"session token: abc123\", ttl=\"1h\")\nagent.fact(\"audit log reference: Q1-2026\", ttl=\"90d\")\nagent.link(\"Acme\", \"signed_contract\", \"ThinkLanceAI\", ttl=\"2y\")\n\nagent.purge_expired()  # removes what's lapsed, keeps what's protected\n```\n\nFacts are prose. Triples are structure. Both live in the same agent, with their own retention and TTL policy.\n\n```\nagent.link(\"Acme\", \"owns\", \"Globex\")\nagent.link(\"Globex\", \"located_in\", \"BE\")\nagent.link(\"Alice\", \"works_at\", \"Acme\", confidence=0.9)\n\nrelated = agent.find_related(\"Acme\", max_hops=2, direction=\"out\")\n# {\"Globex\": 1, \"BE\": 2, \"Alice\": 1}\n```\n\nAgentKeeper ships an MCP server. Any MCP-aware client — Claude Desktop, Cursor, Claude Code — gets full access to the agent's cognitive layer without writing a line of integration code.\n\n```\nagentkeeper-mcp --agent-id aria --provider anthropic\n```\n\n`claude_desktop_config.json`\n\n:\n\n```\n{\n  \"mcpServers\": {\n    \"aria\": {\n      \"command\": \"agentkeeper-mcp\",\n      \"args\": [\"--agent-id\", \"aria\", \"--provider\", \"anthropic\"]\n    }\n  }\n}\n```\n\nAvailable tools over MCP: `add_fact`\n\n, `recall`\n\n, `set_identity`\n\n, `link`\n\n, `find_related`\n\n, `compress`\n\n, `health`\n\n, `gdpr_export`\n\n, `purge_expired`\n\n, `checkpoint`\n\n, `restore`\n\n, `list_checkpoints`\n\n.\n\nFreeze the full cognitive state into an immutable, content-hashed\nsnapshot. Restore it after a crash, a context-window overflow, a model\nswitch, or a process restart. Attach an opaque `execution_state`\n\npayload\n(current file, pending task, todos) — AgentKeeper stores and returns it\nverbatim; it never interprets or runs it.\n\n```\nsnap = agent.checkpoint(\n    label=\"before refactor\",\n    execution_state={\n        \"current_file\": \"auth.py\",\n        \"pending_task\": \"finish RS256 migration\",\n    },\n)\n\n# crash, restart, switch model — the process memory is gone\nagent = agentkeeper.load(\"aria\").restore(snap.snapshot_id)\n# identity, facts, graph, and execution_state are back\n\nagentkeeper.diff(snap_a, snap_b)   # factual diff: facts added/removed/modified\nagent.list_checkpoints()           # every snapshot, oldest first\n```\n\nReconstruction is deterministic — the same snapshot always rebuilds the\nsame cognitive state, verified by a content hash. *Behaviour* is not\nguaranteed: AgentKeeper restores the agent's state, not the model's next\ndecision. The crash-recovery demo runs with no API key:\n\n```\npython examples/crash_recovery.py\n┌──────────────────────────────────────────────────────────────┐\n       │                  AgentKeeper Public API                       │\n       │  agent.remember() · agent.recall() · agent.ask()             │\n       │  agent.compress() · agent.link() · agent.find_related()      │\n       │  agent.set_identity() · agent.purge_expired() · agent.save() │\n       └────────────────────────────┬─────────────────────────────────┘\n                                    │\n       ┌────────────────────────────▼─────────────────────────────────┐\n       │           Cognitive Reconstruction Engine (CRE)              │\n       │  Identity injection · importance ranking · semantic boost    │\n       │  Token budget · profile-driven rendering                     │\n       └─┬───────────┬────────────┬────────────┬──────────────────────┘\n         │           │            │            │\n   ┌─────▼─────┐ ┌──▼─────────┐ ┌▼──────────┐ ┌▼──────────────┐\n   │ Memory    │ │ Semantic   │ │ Cognitive │ │ Cross-Model   │\n   │ Hierarchy │ │ Recall     │ │ Compress  │ │ Translation   │\n   │           │ │            │ │           │ │               │\n   │ working   │ │ embeddings │ │ decay     │ │ XML (Claude)  │\n   │ episodic  │ │ vector idx │ │ consol.   │ │ sections (GPT)│\n   │ semantic  │ │ sqlite-vec │ │ contradic │ │ narrative (G.)│\n   │ archival  │ │            │ │           │ │ minimal (Oll.)│\n   └───────────┘ └────────────┘ └───────────┘ └───────────────┘\n         │                                            │\n   ┌─────▼────────────────────────────────────────────▼────────────┐\n   │  Graph Layer             Storage (pluggable)                   │\n   │  Triple, TTL, BFS        SQLite · Encrypted SQLite · Postgres* │\n   │  agent.link()            AGENTKEEPER_DB, AGENTKEEPER_ENC_KEY   │\n   └───────────────────────────────────────────────────────────────┘\n                                    │\n              ┌─────────────────────▼───────────────────┐\n              │  MCP Server · LangChain · CrewAI         │\n              │  agentkeeper-mcp · langchain_system_prompt│\n              └──────────────────────────────────────────┘\n```\n\n*Postgres stub available; full implementation in v1.2.\n\n```\nagent.fact(\"budget: 50k EUR\", importance=0.9)          # stable semantic fact\nagent.event(\"contract signed\", when=\"2026-05-15\")      # episodic, time-anchored\nagent.principle(\"never share PII\")                     # protected, survives all compression\nagent.remember(\"favourite colour: blue\")               # tier inferred automatically\nresults = agent.recall(\"money allocated to the project\", top_k=5)\nfor fact, score in results:\n    print(f\"{score:.2f}  {fact.content}\")\n```\n\nPluggable backends: local `sentence-transformers`\n\n(default, free, offline), OpenAI, or your own. Persistent index via `sqlite-vec`\n\n— survives process restarts without rebuild.\n\n```\nreport = agent.compress()\n# CompressionReport(\n#   decayed_facts=12,\n#   consolidation={'clusters_found': 3, 'facts_removed': 7},\n#   contradictions={'pairs_found': 2, 'resolutions': 2},\n#   facts_before=120, facts_after=102,\n# )\n```\n\nThree independent passes: **decay** (exponential half-life on unused facts), **consolidation** (embedding-based clustering, optional LLM synthesiser), **contradiction arbitration** (key-value divergence + polarity detection, deterministic winner). Protected facts are immortal.\n\n```\nagent.link(\"Acme\", \"owns\", \"Globex\", confidence=1.0)\nagent.link(\"Acme\", \"signed_contract\", \"ThinkLanceAI\", ttl=\"2y\")\n\n# BFS traversal\nrelated = agent.find_related(\"Acme\", max_hops=2, direction=\"out\")\n\n# Introspect triples\nfor triple in agent.triples:\n    print(triple)  # Triple('Acme' -[owns]-> 'Globex', conf=1.00)\nagent.fact(\"session token: abc123\", ttl=\"1h\")\nagent.fact(\"temp context: negotiation\", ttl=\"30d\")\nagent.link(\"Project Phoenix\", \"uses_provider\", \"Anthropic\", ttl=\"P90D\")\n\nagent.purge_expired()  # returns count of removed items\npython\nfrom agentkeeper.storage.encrypted_sqlite import EncryptedSQLiteStorage\n\nkey = EncryptedSQLiteStorage.generate_key()\nstorage = EncryptedSQLiteStorage(encryption_key=key)\n# or via env: AGENTKEEPER_ENCRYPTION_KEY=...\n```\n\nAES-128-CBC + HMAC-SHA256 at rest. Progressive migration — plain SQLite rows are upgraded on next save.\n\n``` python\nimport asyncio, agentkeeper\n\nasync def main():\n    agent = agentkeeper.create_async(agent_id=\"aria\", provider=\"anthropic\")\n    agent.set_identity(name=\"Aria\", role=\"copilot\")\n    agent.fact(\"budget: 50k EUR\", importance=0.95)\n\n    answers = await asyncio.gather(\n        agent.ask(\"status?\", provider=\"anthropic\"),\n        agent.ask(\"status?\", provider=\"openai\"),\n    )\n\nasyncio.run(main())\n```\n\nSync and async agents share the same storage. Save with one, load with the other.\n\n``` python\nfrom agentkeeper.integrations.langchain import LangChainCognitiveProvider\nfrom langchain_core.prompts import ChatPromptTemplate\n\nprovider = LangChainCognitiveProvider(agent, model=\"gpt-4o\")\nprompt = ChatPromptTemplate.from_messages([\n    (\"system\", provider(message=\"What's our budget?\")),\n    (\"human\", \"{input}\"),\n])\npython\nfrom agentkeeper import CognitiveProfile, PromptFormat, register_profile\n\nregister_profile(CognitiveProfile(\n    provider=\"my-llm\",\n    format=PromptFormat.SECTIONS,\n    effective_context_tokens=10_000,\n))\nexport = agent.gdpr_export()   # all facts, triples, identity — JSON-serialisable\nagent.purge_expired()          # remove anything whose TTL has elapsed\nagent.forget(fact_id)          # remove a single fact by id\nagentkeeper.delete(\"aria\")     # permanently remove an agent from storage\nsnapshot = agent.health()\n# {\n#   \"total_facts\": 42,\n#   \"critical_facts\": 3,\n#   \"protected_facts\": 5,\n#   \"contradicted_facts\": 1,\n#   \"stale_facts\": 4,\n#   \"importance_stats\": {\"mean\": 0.71, \"min\": 0.10, \"max\": 0.95},\n#   \"tier_distribution\": {\"semantic\": 28, \"episodic\": 10, ...},\n#   \"graph\": {\"total_triples\": 8, \"protected_triples\": 2},\n#   \"identity\": {\"name\": \"Aria\", \"principles_count\": 3, ...}\n# }\n```\n\n**Type-safe**—`py.typed`\n\nshipped, mypy-strict compatible.**Typed exceptions**—`AgentKeeperError`\n\nroot, subclasses for every failure mode.**Structured logging**— namespaced under`agentkeeper.*`\n\n, opt-in,`NullHandler`\n\ndefault.**Retries**— exponential backoff + jitter via`with_retry`\n\n/`with_async_retry`\n\n.**Tested**— 491 tests, CI on Python 3.10 / 3.11 / 3.12.** Zero breaking changes from v0.1**—`agent.remember(content, critical=True)`\n\nstill works.\n\n| Variable | Default | Purpose |\n|---|---|---|\n`OPENAI_API_KEY` |\n— | OpenAI provider |\n`ANTHROPIC_API_KEY` |\n— | Anthropic provider |\n`GEMINI_API_KEY` |\n— | Gemini provider |\n`OLLAMA_HOST` |\n`http://localhost:11434` |\nOllama server |\n`AGENTKEEPER_DB` |\n`agentkeeper.db` |\nSQLite path |\n`AGENTKEEPER_ENCRYPTION_KEY` |\n— | Fernet key for encrypted storage |\n`AGENTKEEPER_EMBEDDING_PROVIDER` |\nauto | `sentence-transformers` › `openai` › `mock` |\n\n```\npip install agentkeeper-ai\npython examples/demo.py\n```\n\nThe demo runs entirely on `provider=\"mock\"`\n\nand `AGENTKEEPER_EMBEDDING_PROVIDER=mock`\n\n. No keys. No network. Shows identity hardening, compression, cross-model translation, and async — in one file.\n\n**v1.1**✅ — TTL, graph layer, encrypted storage, MCP server, LangChain + CrewAI integrations, persistent`sqlite-vec`\n\nindex, GDPR export, health snapshot, cognitive checkpoints (snapshot / restore / diff), 491 tests.**v1.2**— Postgres storage backend (full implementation), TypeScript SDK.** v1.3**— AgentKeeper Cloud (managed sync). OSS stays feature-complete.\n\nIssues, ideas, and PRs welcome. See [CONTRIBUTING.md](/Thinklanceai/agentkeeper/blob/main/CONTRIBUTING.md).\n\nMIT. See [LICENSE](/Thinklanceai/agentkeeper/blob/main/LICENSE).\n\n[ ThinkLanceAI](https://thinklanceai.com) — Tom Anciaux Berner — cognitive infrastructure for AI systems.\n\n`tom@thinklanceai.com`", "url": "https://wpnews.pro/news/agentkeeper-solved-the-goldfish-memory-problem-in-ai-agents-v1-1-out-now", "canonical_source": "https://github.com/Thinklanceai/agentkeeper", "published_at": "2026-05-29 09:06:28+00:00", "updated_at": "2026-05-29 09:17:20.279408+00:00", "lang": "en", "topics": ["ai-agents", "ai-infrastructure", "ai-tools", "ai-products", "artificial-intelligence"], "entities": ["Agentkeeper", "Claude", "GPT", "OpenAI", "Gemini", "SQLite", "MCP", "Aria"], "alternates": {"html": "https://wpnews.pro/news/agentkeeper-solved-the-goldfish-memory-problem-in-ai-agents-v1-1-out-now", "markdown": "https://wpnews.pro/news/agentkeeper-solved-the-goldfish-memory-problem-in-ai-agents-v1-1-out-now.md", "text": "https://wpnews.pro/news/agentkeeper-solved-the-goldfish-memory-problem-in-ai-agents-v1-1-out-now.txt", "jsonld": "https://wpnews.pro/news/agentkeeper-solved-the-goldfish-memory-problem-in-ai-agents-v1-1-out-now.jsonld"}}