
Tempera
io.github.anvansterPublished by GitHub account anvansterv0.4.29Updated Oct 24, 2026
Persistent episodic memory for AI coding: capture, retrieve, brief, dream cycle, cross-project.
Overview
Gives Claude Code a persistent episodic memory that captures coding sessions, retrieves similar past episodes, and ranks them by learned usefulness.
- What you can do
- Tempera stores coding sessions as episodes, indexes them for semantic search, and surfaces relevant past solutions when a similar task appears. Tools cover session warmup (tempera_session_start, tempera_brief, tempera_retrieve, tempera_template), logging corrections and missed questions, capturing sessions and giving helpfulness feedback, plus diagnostics and maintenance such as status, stats, propagation and review. A budgeted nightly dream cycle runs reflection, pattern detection, contradiction probing and template extraction, and claims can be scoped so transferable knowledge surfaces across projects.
- When to use it
- Useful for developers who work with Claude Code on recurring tasks and want past fixes, corrections and reasoning steps recalled instead of re-solved each session. Best suited to multi-session or multi-project work where accumulated, feedback-ranked memory is worth the setup.
- Requirements
- Runs locally as an MCP server over stdio, installed from the npm package @astudioplus/tempera-mcp (the README also documents a Rust build and cargo install). Needs a local runtime and disk space under ~/.tempera/; the BGE-Small embedding model (~128MB) downloads from HuggingFace on first use, so internet access is needed once. ANTHROPIC_API_KEY is used for LLM-based intent extraction, and the dream cycle makes paid model calls.
Installation
In SourceWeft
- Open Tempera in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Tempera - Persistent Memory for Claude Code
Tempera gives Claude Code a persistent memory that learns from experience. Instead of starting fresh each session, Claude can recall past solutions, learn what works, and get smarter over time.
Why Tempera?
The Problem: Claude Code forgets everything between sessions. You solve the same problems repeatedly, and Claude can't learn from past successes or failures.
The Solution: Tempera captures coding sessions as "episodes", indexes them for semantic search, and uses reinforcement learning to surface the most valuable memories when relevant.
How It Works
The Learning Loop
What Makes It "Learn"
Over time, frequently helpful knowledge rises to the top, while stale or unhelpful memories fade away — and the system itself accumulates a per-project picture of where it tends to be wrong.
The bigger surfaces (v0.6 onward)
Beyond the basic capture/retrieve loop, Tempera ships several higher-order surfaces. Each is opt-in but all flow through the same MCP tools — Claude can use them without any custom client code.
- Grounded capture (v0.6): Every captured claim carries a
falsifiabilityscore, acategory, and aValidityScope(Forever / Language / Crate / Domain / Workaround / Project). Decay rates are per-scope — universal truths never expire, project-specific conventions fade in months, workarounds expire when the underlying issue closes. - Dream cycle (v0.7): A budgeted nightly pipeline that runs
verify_advance → decay → reflect → patterns → contradict → templates. Reflections turn high-signal days into prose; patterns surface themes that keep recurring; contradict probes pairs of frequently-retrieved episodes for factual disagreements; templates extract reusable step sequences from successful task clusters. - Self-improvement (v0.8): Calibration tracks the ratio of declared vs. verified successes per (task, project). Mistakes log records corrections the agent made. Should-have-asked log records questions it realized it should have asked first. Ask-backs are clarifying questions the system itself drafts via Haiku when a capture ends in failure with vague intent — queued for the next session in that project.
- Brief surface (v0.9): One MCP call joins all of the above against the file set the agent is about to touch.
tempera_brief(files, task_type?, domain?)returns pending ask-backs, the matching reasoning template, top correction categories for those files, should-have-asked triggers, and a calibration warning if the agent's track record on this kind of task is shaky. - Cross-project learning (v0.10):
tempera_retrieveandtempera_briefboth acceptcross_project=true. Transferable claims (anything not project-scoped) surface across projects; Project-scoped knowledge stays bound to its codebase. Legacy captures default to non-transferable until reclassified.
Installation
Build from Source
Install from crates.io
First Run - Model Download
On first use, Tempera downloads the BGE-Small embedding model (~128MB) for semantic search. This happens automatically and only once:
The model is cached globally at ~/.tempera/models/ and shared across all projects.
Setup with Claude Code
1. Add the MCP Server
The --scope user flag makes it available across all your projects.
2. Restart Claude Code
Exit and restart Claude Code to load the new MCP server.
3. Verify
Run /mcp in Claude Code. You should see tempera with 12 tools.
MCP Tools
Once connected, Claude has access to these 12 tools, grouped by purpose:
Session warmup (call at task start)
During task
End of task
Diagnostics + maintenance
Standard warmup pattern
Key Lifecycle Behaviors
Start of session: Call tempera_session_start first to consume any pending ask-back, then tempera_brief once the file set is known.
End of task: Capture successful sessions with tempera_capture — don't wait to be asked. Capture also drafts an ask-back via Haiku if the outcome was Failure/Partial with vague intent, so the next session in this project sees the gap.
Session chaining: Episodes captured within 2 hours of each other in the same project are automatically linked. Multi-step tasks share utility and context.
Cross-project routing: New captures get a ValidityScope suggestion from the intent-extraction LLM (v0.10.3). Project-scoped claims stay bound to one codebase; Language / Crate / Domain / Workaround / Forever claims surface across projects when retrieval opts in.
tempera_retrieve Modes
Example Conversation
CLI Commands
The CLI mirrors the MCP tool surface so you can drive everything Claude does from a shell.
Basics
The brief surface (v0.9)
Session warmup (v0.8.5)
Self-improvement surfaces (v0.8)
Reasoning templates (v0.8.3)
Calibration (v0.8.1)
Dream cycle (v0.7)
Verification (v0.6.1)
Maintenance + analytics
Data Storage
Tempera stores everything locally in ~/.tempera/ (shared across all projects). One memory pool serves every project; the project filter is applied at query time.
SQLite tables (in jobs.sqlite)
Everything that needs SQL lives here. Each store opens the DB on first use and runs its migration; migrations are in migrations/ and run in order.
All projects share the same pool. Cross-project routing is controlled by each episode's ValidityScope (see below) — not by separate storage.
Configuration
All knobs live in ~/.tempera/config.toml. The defaults are tuned to be useful out of the box; you only need to touch this if you want to change retrieval ranking, dream-cycle behavior, or per-phase budgets.
Retrieval + ranking
Capture + verification
Dream cycle (v0.7)
Storage + maintenance
Decay rates are scope-aware (per the ValidityScope on each episode's claim):
Under the Hood
Multi-hop Bellman Propagation
Value from helpful episodes spreads through the similarity graph in multiple hops:
Session Chaining
Episodes captured within 2 hours of each other in the same project are automatically linked:
The Dream Cycle (v0.7)
A budgeted background pipeline that runs nightly (or on demand). Each phase shares a CostBudget; free phases ignore it, paid phases check try_spend() before each LLM call.
- verify_advance: bumps episodes from
MergedtoStableNoRevertafterstable_threshold_days. - decay: scope-aware utility decay (see table above).
- reflect: Haiku triage gates Sonnet authorship; high-signal days get a reflection page.
- patterns: agglomerative clustering on reflection embeddings → cross-day themes.
- contradict: pairs frequently-retrieved BKM episodes and asks Haiku whether they disagree on a factual claim; surfaces a Wilson 95% CI on the contradiction rate.
- templates: groups successful verified episodes by
(task_type, domain), extracts reusable step sequences via Sonnet.
Worst case per full cycle: roughly $0.50 with default settings.
Scoring Formula
Retrieval ranking combines three signals with normalized weights:
Default in hybrid mode: 85% similarity (RRF-normalized over vector + BM25), 15% utility, 0% recency. The VerificationState of each episode multiplies into salience — well-verified successes weigh more.
Cross-project routing (v0.10)
Every claim carries a ValidityScope that determines:
- Decay rate (table above).
- Transferability:
is_transferable()returns true for everything exceptProject { name }. The retrieve and brief surfaces use this to decide what surfaces when the agent opts intocross_project=true.
Legacy episodes captured before v0.6.4 don't have a scope set, so they stay project-bound by default. New captures (v0.10.3+) get a scope suggested automatically by the intent-extraction LLM call — using a colon-encoded format like language:rust, crate:[email protected], domain:async-rust, workaround:repo#123, or project. The default when in doubt is project, keeping the system conservative.
Maintenance
Run periodically to keep memory healthy:
The dream cycle is the load-bearing piece for long-running memory hygiene. It uses Haiku for cheap gating and Sonnet for authorship — the default $0.50 cap is the worst case across every phase.
Environment Variables
Troubleshooting
MCP server not loading
- Check path:
ls /path/to/tempera-mcp - Check config:
cat ~/.claude.json - Restart Claude Code completely
- Run
/mcpto verify
Embeddings slow on first run
The BGE-Small model (~128MB) downloads on first use from HuggingFace. This requires internet access. After download, the model is cached at ~/.tempera/models/ and works offline.
Vector search not finding anything
Run tempera index to create/update the vector database.
Model download fails
If behind a firewall or proxy, ensure access to huggingface.co. The model files are downloaded via HTTPS.
tempera_brief returns "nothing to surface"
This is normal early on — the brief joins against signal data (mistakes, asks, templates, calibration) that accrues over time. Specifically:
- The mistakes / should-have-asked sections only fire when the files you pass overlap with previously-logged rows.
- The template section only fires when at least 3 successful verified episodes share the
(task_type, domain)pair (templates accrue during the dream cycle). - The calibration warning needs ≥5 declared-success captures in the bucket before it surfaces.
Fall back to tempera_retrieve for episode-level recall.
tempera retrieve --cross-project finds nothing
Episodes captured before v0.6.4 don't have a ValidityScope set, and v0.10's cross-project filter treats unscoped claims as project-bound (conservative default). Either (a) capture new episodes with v0.10.3+, which auto-suggests a scope, or (b) manually classify legacy episodes via the MCP validity_scope parameter on capture.
License
Apache 2.0
Contributing
Contributions welcome! Please open an issue or PR.
Source: README.md at commit 3e6f0e5
Tools
0Version history
1- v0.4.29LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts