{"slug": "how-to-give-your-ai-coding-agent-infinite-memory", "title": "How to Give Your AI Coding Agent Infinite Memory", "summary": "A developer has created an open-source system that gives AI coding agents persistent memory by indexing past conversation transcripts locally. The setup uses a FastMCP server connected to an SQLite FTS5 database, allowing agents to query historical decisions in under 10 milliseconds with minimal token overhead. The implementation, designed for Google Antigravity, filters raw transcripts to preserve key reasoning and decisions, enabling agents to retrieve exact past trade-offs on demand.", "body_md": "AI coding agents are stateless. Once a session closes, the context window resets, and the agent forgets every architectural trade-off, rejected alternative, and subtle debugging edge case you worked through.\n\nCramming 100k-token transcripts into prompt context causes latency spikes, attention dilution, and cost bloat. Naive automated summaries strip away the exact chronological rationale and specific trade-offs you actually need.\n\nDon't stuff context. Index your past trajectories locally and let the agent query them on demand.\n\nThink of it as giving your agent an active retrieval reflex instead of asking it to carry its entire life history in working memory. By connecting a lightweight FastMCP server to an embedded SQLite FTS5 database, the agent can search its own historical conversations in sub-10ms and pull exact past decisions using fewer than 120 tokens.\n\n```\n~/.gemini/antigravity/brain/\n            │\n  [<session-id>/transcript.jsonl]\n            │\n            ▼\n┌───────────────────────────────────────┐\n│ Incremental MTime Parser              │\n│ (Filters noise, diffs & shell stdout) │\n└───────────────────┬───────────────────┘\n                    │\n                    ▼\n┌───────────────────────────────────────┐\n│ SQLite + FTS5 BM25 Engine             │\n│ (conversations.db — local keyword FTS)│\n└───────────────────┬───────────────────┘\n                    │\n                    ▼\n┌───────────────────────────────────────┐\n│ FastMCP Server (stdio transport)      │\n│ (Exposes search tools to the agent)   │\n└───────────────────┬───────────────────┘\n                    │\n                    ▼\n          [ Antigravity Agent ]\n```\n\nIn Google Antigravity, place the server in your **global configuration** (`~/.gemini/config/mcp_config.json`), rather than the scoped workspace config (`.agents/mcp_config.json`).\n\nRaw agent transcripts (`transcript.jsonl`) contain megabytes of raw terminal output, file overwrite diffs, and status pings. Blindly indexing this breaks BM25 search relevance.\n\nThe ingestion parser applies three strict filters:\n\n`USER_INPUT` (steering/prompts) and `PLANNER_RESPONSE` (reasoning/decisions). Discards binary payloads, file scrapes, and transient tool poll steps.`stdout` outputs. Indexes only the tool name and target file reference (e.g., `write_to_file: target.py`).` MAX_CONTENT_CHARS = 10_000`) on individual messages to prevent catastrophic index bloat.\nStore records in a local SQLite virtual table using FTS5, Porter stemming, and Unicode-61 tokenization. An `mtime` cache tracks file modification timestamps so incremental re-indexing across dozens of sessions takes less than 20 milliseconds.\n\nThe FastMCP server exposes two primary tools over `stdio`:\n\n`search_antigravity_conversations(query=\"...\")`: Returns BM25-ranked matches with conversation IDs, timestamps, and highlighted snippets.`get_antigravity_step(conversation_id, step_index)`: Pulls the surrounding dialogue window for full contextual fidelity.\nWhen the agent hits friction, needs historical context, or conducts a post-mortem on earlier decisions, it calls the MCP tool directly:\n\n```\nsearch_antigravity_conversations(query=\"Observer Stance negative assertions\")\n```\n\nInstead of guessing or re-reading giant raw files, SQLite returns the exact turn where the decision was made:\n\n```\n[Match 1 | Session: 8f2a-e1... | Date: 2026-09-02 14:18]\nRole: PLANNER_RESPONSE\nSnippet: \"...decided to cut redundant negative assertions from Chapter 1. \nThe observer stance works best when physical actions imply boundaries \nrather than explicitly stating what didn't happen...\"\n```\n\nThe complete implementation is open source on GitHub:\n\nStop starting from scratch every time you open a terminal. Let your agent inspect the tape.", "url": "https://wpnews.pro/news/how-to-give-your-ai-coding-agent-infinite-memory", "canonical_source": "https://dev.to/julianbrown/how-to-give-your-ai-coding-agent-infinite-memory-4ehp", "published_at": "2026-09-07 13:34:59+00:00", "updated_at": "2026-09-07 13:57:17.270983+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-infrastructure", "machine-learning"], "entities": ["Google Antigravity", "FastMCP", "SQLite", "FTS5", "BM25"], "alternates": {"html": "https://wpnews.pro/news/how-to-give-your-ai-coding-agent-infinite-memory", "markdown": "https://wpnews.pro/news/how-to-give-your-ai-coding-agent-infinite-memory.md", "text": "https://wpnews.pro/news/how-to-give-your-ai-coding-agent-infinite-memory.txt", "jsonld": "https://wpnews.pro/news/how-to-give-your-ai-coding-agent-infinite-memory.jsonld"}}