LLM-agnostic memory layer for AI agents. Works with ChatGPT, Claude, Gemini, DeepSeek, Llama — any LLM.
No embeddings. No vector DB. Just fast, structured, temporal memory that any LLM can consume as plain text context.
AI agents need memory to be useful. They need to remember what they did, what worked, what failed, and what decisions they made. Most memory solutions force you into vector databases and embeddings — adding latency, complexity, and cost.
Memtrace takes a different approach: operational, temporal memory built on a time-series database. Every action is temporal. Every query is time-windowed. The feedback loop — Memory, Decision, Action, Log, Repeat — works naturally with time-series data.
Memtrace stores memories as time-series events in Arc, a high-performance time-series database. Each memory has a type (episodic, decision, entity, session), tags, importance score, and metadata. Queries are time-windowed by default — "what happened in the last 2 hours?" is a first-class operation.
The session context endpoint is the killer feature: it queries memories for a session, groups them by type, and returns LLM-ready markdown that you inject directly into any prompt. No parsing, no transformation — just paste it into your system prompt.
Read the full Architecture doc for details on the data model, deduplication, write batching, and shared memory.
- Architecture — How Memtrace works under the hood
- API Reference — Complete REST API documentation
- Configuration — All config options, environment variables, and deployment
- MCP Server — Model Context Protocol server for Claude Code, Cursor, and more
- OpenAPI Spec — OpenAPI 3.0 specification for all REST endpoints
An AI agent that runs for hours or days — browsing the web, writing code, managing infrastructure. It needs to remember what it already tried, what failed, and what decisions it made so it doesn't repeat mistakes or contradict itself.
Example: A coding agent that refactors a large codebase across multiple sessions, remembering which files it already changed, which tests broke, and what strategies worked.
AI support agents handling conversations across channels. Each agent remembers the full customer history — previous tickets, resolutions, preferences — without re-reading everything from scratch. Multiple agents share context about the same customer in real time.
Example: A call center with 50 AI agents sharing a memory pool. When a customer calls back, any agent instantly knows what happened last time.
AI agents that crawl, summarize, and analyze data over time. They need to track what they've already read, what patterns they've found, and what conclusions they've drawn — building knowledge incrementally instead of starting from zero.
Example: A market research agent that monitors competitor pricing daily, remembering trends and flagging anomalies against its own historical observations.
AI agents that watch infrastructure, respond to alerts, and take remediation actions. They need to remember what they already investigated, which runbooks they executed, and what the outcomes were — especially during incident response.
Example: An on-call agent that correlates a 3 AM alert with a similar incident it handled last Tuesday, remembers the fix that worked, and applies it automatically.
AI agents that create, schedule, and manage content across platforms. They remember what topics performed well, what's already been posted, and what the audience engaged with — avoiding repetition and learning from results.
Example: A social media agent that posted about Go generics yesterday and decides to cover a different topic today based on engagement memory.
Teams of specialized agents working on the same goal — one researches, one writes, one reviews, one publishes. They share a memory space so each agent can see what the others have done and make decisions accordingly.
Example: A content pipeline where a research agent stores findings, a writing agent reads them to draft articles, and an editor agent reviews against the shared decision log.
AI agents that manage prospect pipelines, personalize outreach, and track interactions over time. They remember every touchpoint, what messaging resonated, and when to follow up.
Example: An SDR agent that remembers a prospect mentioned a conference last month, and uses that context to personalize the follow-up email.
Long-running ETL or data enrichment agents that process millions of records in batches. They need to track what's been processed, what failed, and where to resume — with deduplication built in.
Example: A data enrichment agent that processes 100K company records over 3 days, remembering which ones are done, which APIs timed out, and which need retry.
- Go 1.25+
- A running Arc instance
git clone https://github.com/Basekick-Labs/memtrace.git
cd memtrace
make buildcp memtrace.toml memtrace.local.toml
# Edit memtrace.local.toml with your Arc URL./memtraceOn first run, Memtrace prints your admin API key. Save it — it's shown only once.
FIRST RUN: Save your admin API key (shown only once)
API Key: mtk_...
# Store a memory
curl -X POST http://localhost:9100/api/v1/memories \
-H "x-api-key: mtk_..." \
-H "Content-Type: application/json" \
-d '{
"agent_id": "my_agent",
"content": "Crawled https://example.com — found 3 product pages",
"memory_type": "episodic",
"event_type": "page_crawled",
"tags": ["crawling", "products"],
"importance": 0.7
}'
# Recall recent memories
curl "http://localhost:9100/api/v1/memories?agent_id=my_agent&since=2h" \
-H "x-api-key: mtk_..."
# Get LLM-ready session context
curl -X POST http://localhost:9100/api/v1/sessions/sess_abc/context \
-H "x-api-key: mtk_..." \
-H "Content-Type: application/json" \
-d '{"since": "4h", "include_types": ["episodic", "decision"]}'Memtrace ships an MCP server for integration with Claude Code, Claude Desktop, Cursor, Windsurf, Cline, Zed, and other MCP-compatible tools.
make build-mcpConfigure in Claude Code (.mcp.json):
{
"mcpServers": {
"memtrace": {
"command": "/path/to/memtrace-mcp",
"env": {
"MEMTRACE_URL": "http://localhost:9100",
"MEMTRACE_API_KEY": "mtk_..."
}
}
}
}7 tools are available: memtrace_remember, memtrace_recall, memtrace_search, memtrace_decide, memtrace_session_create, memtrace_session_context, memtrace_agent_register. See the MCP docs for full details.
pip install memtrace-sdkfrom memtrace import Memtrace
client = Memtrace("http://localhost:9100", "mtk_...")
# Quick add
client.remember("my_agent", "Posted tweet about Go generics")
# Recall recent
memories = client.recall("my_agent", since="48h")
# Log a decision
client.decide("my_agent", "post_to_twitter", "feed had interesting content")
# Full API
client.add_memory(AddMemoryRequest(...))
client.list_memories(ListOptions(...))
client.search_memories(SearchQuery(...))
client.create_session(CreateSessionRequest(...))
client.get_session_context(session_id, ContextOptions(...))Async support: from memtrace import AsyncMemtrace. See the Python SDK README for full docs.
npm install @memtrace/sdkimport { Memtrace } from '@memtrace/sdk'
const client = new Memtrace('http://localhost:9100', 'mtk_...')
// Quick add
await client.remember('my_agent', 'Posted tweet about Go generics')
// Recall recent
const memories = await client.recall('my_agent', '48h')
// Log a decision
await client.decide('my_agent', 'post_to_twitter', 'feed had interesting content')
// Full API
await client.addMemory({ ... })
await client.listMemories({ ... })
await client.searchMemories({ ... })
await client.createSession({ ... })
await client.getSessionContext(sessionId, { ... })Zero runtime dependencies, native fetch (Node.js 18+). See the TypeScript SDK README for full docs.
import "github.com/Basekick-Labs/memtrace/pkg/sdk"
client := sdk.New("http://localhost:9100", "mtk_...")
// Quick add
client.Remember(ctx, "my_agent", "Posted tweet about Go generics")
// Recall recent
memories, _ := client.Recall(ctx, "my_agent", "48h")
// Log a decision
client.Decide(ctx, "my_agent", "post_to_twitter", "feed had interesting content")
// Full API
client.AddMemory(ctx, &sdk.AddMemoryRequest{...})
client.ListMemories(ctx, &sdk.ListOptions{...})
client.SearchMemories(ctx, &sdk.SearchQuery{...})
client.CreateSession(ctx, &sdk.CreateSessionRequest{...})
client.GetSessionContext(ctx, sessionID, &sdk.ContextOptions{...})pip install openai-agents-memtracefrom agents import Agent, Runner
from memtrace import AsyncMemtrace
from openai_agents_memtrace import create_memtrace_tools, MemtraceSession
client = AsyncMemtrace("http://localhost:9100", "mtk_...")
tools = create_memtrace_tools(client, agent_id="my_agent")
session = await MemtraceSession.create(client, agent_id="my_agent")
agent = Agent(
name="My Agent",
instructions="Use memtrace_remember to store info, memtrace_recall to retrieve it.",
tools=tools,
)
result = await Runner.run(agent, "Hello", session=session)4 tools: memtrace_remember, memtrace_recall, memtrace_search, memtrace_decide. See the OpenAI Agents integration README for full docs.
Complete cookbook showing the core memory loop with the Anthropic Claude API:
from memtrace import Memtrace, ContextOptions
mt = Memtrace("http://localhost:9100", "mtk_...")
# Get LLM-ready context and inject into Claude's system prompt
ctx = mt.get_session_context(session_id, ContextOptions(since="4h"))
response = anthropic.messages.create(
model="claude-sonnet-4-20250514",
system=f"You are an agent.\n\n{ctx.context}",
tools=MEMTRACE_TOOLS, # remember, recall, search, decide
messages=[...],
)Two runnable scripts: single-agent memory loop and multi-agent shared memory. See the Claude cookbook for full examples.
The same cookbook pattern using the OpenAI Python SDK and function calling:
from openai import OpenAI
from memtrace import Memtrace, ContextOptions
mt = Memtrace("http://localhost:9100", "mtk_...")
# Get LLM-ready context and inject into the system prompt
ctx = mt.get_session_context(session_id, ContextOptions(since="4h"))
response = openai.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": f"You are an agent.\n\n{ctx.context}"},
...
],
tools=MEMTRACE_TOOLS, # remember, recall, search, decide
)Two runnable scripts: single-agent memory loop and multi-agent shared memory. See the OpenAI cookbook for full examples.
Open source. See LICENSE for details.
