Revision-aware, cross-session memory for AI agents.
Thred is a durable memory layer for agents working across Cursor, Claude Code, Codex, and OpenCode. It turns long, fragmented chat histories into verifiable memory — decisions, facts, preferences, source evidence, revisions, and resumable coding handoffs.
Get started → thred.fun · MIT License
Cross-session agent work breaks down when the relevant information is spread across dozens of conversations. Long-running projects can span 30–40 sessions and more than 115K tokens per question. A useful memory layer has to do more than retrieve semantically similar text:
- combine facts from many sessions while retaining chronology;
- represent facts that changed or were overwritten;
- show where an answer came from; and
- return
NOT_FOUNDwhen the answer is not supported by the history.
Copy-pasting the last session into the next prompt works for a short handoff, but not across dozens of sessions: the context window fills up, older facts get missed, and agents confuse superseded decisions with current ones. Thred fixes that with atomic, provenance-backed facts, explicit revision history, and honest abstention when the evidence isn't there.
Thred exposes a small MCP toolset — use the same memory from any agent client:
| Tool | What it does |
|---|---|
thread_remember |
Saves a durable, evidence-backed fact, decision, lesson, architecture choice, or preference. |
thread_context |
Retrieves verified long-term context relevant to a question. |
thread_history |
Shows the chronological revision history for a fact or entity. |
thread_inspect |
Traverses a memory’s provenance and graph relationships. |
Save "we chose PostgreSQL" in one session. Update to "we chose Neon Postgres" in another. Ask what’s true now — or why it changed — in a third. Nothing gets silently erased.
Create an agent key at thred.fun, then add this to Cursor, Claude Code, Codex, or OpenCode:
{
"mcpServers": {
"thred": {
"command": "npx",
"args": ["-y", "@thred_nick_01/thred-mcp"],
"env": {
"THRED_API_KEY": "thrd_sk_…",
"THRED_API_URL": "https://api.thred.fun"
}
}
}
}Use the same key across clients to share one workspace memory.
npm install
npm run db:generate --workspace=@repo/db
npm run db:migrate --workspace=@repo/db
npm run devPrerequisites: Node.js 18+, PostgreSQL, HydraDB API key, and Groq or OpenAI.
| Variable | Required for | Notes |
|---|---|---|
DATABASE_URL |
API, frontend, evaluations | PostgreSQL connection string. |
HYDRA_DB_API_KEY |
API, memory engine, evaluations | HydraDB access token. |
OPENAI_API_KEY or GROQ_API_KEY |
Extraction and evaluations | Configure at least one provider. |
BETTER_AUTH_SECRET |
Web authentication | Signing/encryption secret. |
BETTER_AUTH_URL, FRONTEND_ORIGIN |
Web authentication | Local defaults point to http://localhost:3000. |
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET |
Google sign-in | Required only when Google auth is enabled. |
PORT, NEXT_PUBLIC_API_URL |
Local development | Optional API port and frontend API URL overrides. |
For MCP clients, configure THRED_API_KEY; THRED_API_URL defaults to the
production API.
- Agent sessions are processed into atomic, evidence-backed claims.
- Claims are stored with workspace, session, source-message, entity, and file provenance.
- When a claim changes, Thred writes an explicit
SUPERSEDESlink to the prior claim. - At query time, hybrid retrieval and graph context surface candidate evidence.
- A temporal resolver returns current or historical facts as requested.
- Insufficient evidence →
NOT_FOUND, not a guess.
Built on HydraDB for graph-backed storage with hybrid retrieval — so revision history and provenance are first-class, not bolted onto a vector store.
Evaluated against a hashed-vector RAG baseline on LongMemEval, LongMemEval V2, and BEAM.
| Evaluation | Vector-RAG | Thred | What it demonstrates |
|---|---|---|---|
| LongMemEval V2 scale case | 100.0% | 100.0% | Correct temporal answer across 44 sessions / ~128K tokens; zero evaluation errors. |
Full reports in apps/evals/reports.
npm run test --workspace=@repo/evals
npm run test --workspace=@repo/memory-extractor
npm run test --workspace=@repo/memory-engineTypeScript · Node.js · Express · Next.js · React · MCP · HydraDB · Prisma/PostgreSQL · OpenAI/Groq