
Contextful
io.github.Inferensys由 GitHub 帳號 Inferensys 發布v0.1.0更新於 Oct 24, 2026
Efficient context management: code search, evidence packs, and memory for coding agents.
概覽
Contextful 是供編碼助理使用的本機上下文管理與搜尋伺服器,可產生排序、附引用且受 token 預算限制的上下文包並保存專案記憶。
- 可以做什麼
- 產生依相關度排序、附引用且受 token 預算限制的上下文包,取代大量讀檔與搜尋呼叫。搜尋程式碼、文件、符號與記憶,並可依邊類型追蹤檔案、符號、模組與設定之間的路徑。分析符號或檔案的影響範圍與反向依賴,並結合 git 歷史說明變更原因。以證據為依據寫入與召回專案經驗,證據失效時標記為過時。
- 適用情境
- 當你使用 Codex、Claude Code、Cursor、Windsurf 等支援 MCP 的編碼助理,且希望在大型專案中減少重複讀檔與 token 消耗時適用。若你需要跨工作階段保留專案決策與經驗,也可考慮。
- 執行需求
- 需在本機以 npm 套件 @inferensys/contextful 執行(透過 npx 啟動 stdio 伺服器),並需要 Node.js 環境。首次使用須對工作區執行初始化與索引,會建立本機 SQLite 儲存與 .contextful 設定檔。僅支援桌面環境。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Contextful,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Contextful
⚠️ This is in early alpha. The API, features, and integrations are not stable. Expect breaking changes. Feedback & contributions are very welcome!
Local Context Management + Search Engine + Memory for Agentic AI.
Contextful is a runtime contextual layer and local search engine for agents that gives them one fast way to find, compress, cite, and remember project context.
Available as a CLI-first tool with an MCP runtime bridge and generated agent instructions, it integrates seamlessly with Codex, Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, Cline, Roo Code, Continue, and Zed.
[Contextful screenshot]Instead of making an agent read 40 files every session, Contextful indexes the project once and returns a ranked, cited, token-budgeted context pack.
Why?
Context has always been a bottleneck for agentic AI. Large context window models (for example, 1M tokens) are:
- Expensive and require significantly more compute & processing time.
- More likely to lose key information as the context window fills up.
- Most projects have millions of lines of code, but agents can only fit in limited tokens per context window.
The current solution is to make the agent guess which files to read, then pay the token cost to read them every session. This is slow, expensive, and lossy.
Apart from this, agents have no way to store or share learnings across sessions. Every time they start, they forget everything and have to re-read the same context again.
[Contextful screenshot]I started developing Contextful to keep the context window smaller by enabling efficient knowledge retrieval. If we index the project and return a ranked, cited, token-budgeted context pack, we can:
- 100x more efficient token usage: stop paying tokens to re-read the same files.
- Fewer tool calls: one context pack can replace dozens of grep, glob, and read-file calls.
- No lost context between sessions: agents can store session learnings in an evidence-backed memory ledger.
- Shareable project knowledge: lessons and context packs survive context compaction and future sessions.
Key Features
1. Context Management
The default local store is SQLite with FTS-backed search and typed graph tables. V1 ships with:
- SQLite as the default local store.
- FTS5 lexical/BM25 search.
- Typed graph tables:
nodes,edges,node_props,edge_props. - A hot adjacency cache for common graph relations.
- Deterministic structural fingerprints inspired by Code2Vec-style secondary reranking signals.
The next storage upgrades are optional semantic vectors through sqlite-vec, LanceDB, or local HNSW, and compressed adjacency lists with Roaring bitmaps or CSR arrays for larger repositories.
2. Search Engine
[Contextful screenshot]Contextful analyzes the query, classifies intent, and combines lexical search, symbols, docs, graph relationships, and memory hits to retrieve the right evidence. The goal is Google-level project search for agents: vague queries like "resources for auth onboarding" should still land on the right code, docs, and prior lessons.
3. Memory Ledger
Agents can store lessons, decisions, and useful project facts, but not as loose "remember this" notes. Every memory requires evidence refs from files, symbols, commits, or prior context packs. When the evidence changes, Contextful marks the memory stale.
4. Contextful Execution
Contextful is an MCP server, local indexer, and small CLI:
- MCP server: the agent interface.
- Local daemon / watcher: indexing, rebuilds, freshness, and future benchmarks.
- CLI (
cxf): human setup, indexing, search, memory writes, and local smoke tests.
MCP is the right interface because tools, resources, and prompts are exactly what MCP standardizes. The agent asks for context; Contextful returns compact evidence.
Install
Run as an MCP server:
CLI
The primary binary is cxf; contextful is also provided as a readable alias.
Core MCP Tools
Keep the agent surface small:
context_pack(query, budget, scope)- the killer tool. Returns a ranked, cited, token-budgeted bundle instead of forcing 40 random file reads.search_code(query, mode, filters)- powerful code, docs, symbol, and memory search.trace_path(from, to, edge_types)- graph traversal across files, symbols, modules, and config.impact_analysis(symbol_or_file)- reverse dependencies and likely tests.why_changed(symbol_or_file)- current evidence plus git history.recall_memory(query, scope)- search session learnings and durable project lessons.write_lesson(claim, evidence_refs, scope)- store an evidence-backed memory.
MCP Client Setup
Use this stdio server command in any MCP-aware coding tool:
Codex:
CLI-First Agent Flow
Use cxf init once per workspace. It indexes the project and writes .contextful/AGENT_INSTRUCTIONS.md, a compact skill-style guide that tells agents when to call context_pack, when to search more narrowly, and when memory writes are allowed.
Use cxf search when a human wants to test the same evidence pack an agent will receive:
The MCP server remains the agent interface. The CLI is for setup, inspection, and repeatable local tests.
Privacy
V1 is local-only. It does not call external embedding APIs, upload source code, edit source files, auto-fix code, or install dependencies inside the target workspace.
Evidence Refs
Memory writes require evidence references returned by search or context packs:
file:src/auth.ts:10-40symbol:src/auth.ts#AuthService:12pack:ctx_...
Invalid or stale evidence is rejected or marked stale.
來源:README.md,提交 59bcd22
工具
0版本歷史
1- v0.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分