
Tempera
io.github.anvanster由 GitHub 帳號 anvanster 發布v0.4.29更新於 Oct 24, 2026
Persistent episodic memory for AI coding: capture, retrieve, brief, dream cycle, cross-project.
概覽
為 Claude Code 提供持久的情節記憶,擷取編碼工作階段、檢索相似的過往片段,並依學到的有用程度排序。
- 可以做什麼
- Tempera 把編碼工作階段存成情節(episode),為其建立語意搜尋索引,並在遇到相似任務時呈現相關的過往解法。工具涵蓋工作階段暖機(tempera_session_start、tempera_brief、tempera_retrieve、tempera_template)、記錄修正與漏問的問題、擷取工作階段並提交有用性回饋,以及狀態、統計、傳播和整理等診斷與維護操作。每晚在預算內執行的 dream cycle 會進行反思、模式偵測、矛盾探查和範本擷取,宣告還能設定作用範圍,讓可移轉的知識跨專案出現。
- 適用情境
- 適合長期使用 Claude Code 處理重複性任務的開發者,希望每次工作階段都能召回過去的修正、糾正和推理步驟,而不是重新解一次。最適合多工作階段或多專案、且累積的、依回饋排序的記憶值得投入設定的情境。
- 執行需求
- 以本機 stdio MCP 伺服器執行,透過 npm 套件 @astudioplus/tempera-mcp 安裝(README 也記錄了 Rust 建置與 cargo install)。需要本機執行環境和 ~/.tempera/ 下的磁碟空間;BGE-Small 嵌入模型(約 128MB)首次使用時從 HuggingFace 下載,因此需要一次連網。ANTHROPIC_API_KEY 用於以 LLM 為基礎的意圖擷取,dream cycle 會產生付費模型呼叫。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Tempera,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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.
來源:README.md,提交 3e6f0e5
工具
0版本歷史
1- v0.4.29最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分