contextweaver

io.github.dgenio由 GitHub 帳號 dgenio 發布v0.18.2更新於 Oct 24, 2026

MCP gateway: bounded tool shortlists + artifact-backed result firewall. Deterministic, no model.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

一個在本機執行、具確定性的 MCP 閘道實驗,可從 OpenAPI、MCP tools/list 或原生目錄擷取代理的能力範圍,並透過比對找出漂移

可以做什麼
從 OpenAPI 文件、已擷取的 MCP tools/list 回應或原生目錄產生具確定性的能力快照,不需要模型帳號或閘道。檢查並驗證快照的結構、排序、邏輯 ID 唯一性與標準摘要。比對基準與候選快照,區分新增、移除的能力與既有能力的變更,並區分契約變更與僅文件變更。將 required、type、enum 等欄位的變更標示為可能破壞相容,供人工審查。
適用情境
當 API 或 MCP 工具介面變動較頻繁,一般 Git diff、設定審查與測試已不足以讓能力變更一目了然,且希望在部署前保留提交的產物與語意漂移報告時值得一試。README 本身建議:工具介面很小且很少變動,或需要代理迴圈、工具執行器、IAM 層或生產環境協調器時,不要加入它。
執行需求
需要本機 Python 環境;README 說明支援 Python 3.10–3.14,可用 pip 安裝此套件或直接執行模組。輸入為本機 OpenAPI 文件、已儲存的 MCP tools/list JSON 回應或原生目錄檔案。不需要模型帳號、API 金鑰、閘道或工具執行器。
安裝前請注意
專案自稱為 alpha 階段的產品實驗,使用者價值假設尚未證實,且仍在 1.0 之前,依賴歷史執行階段 API 前應先查看變更記錄。可能破壞相容的標示刻意保守,並非完整的 JSON-Schema 相容性檢查器。verify 只檢查快照契約,不代表部署核准、安全認證、身分驗證或實作正確性。README 要求不要在公開報告中包含憑證、客戶資料、專有結構描述或私有提示詞。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 contextweaver,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

contextweaver

[CI] [PyPI version] [Python versions] [License: Apache-2.0] [OpenSSF Scorecard] [Docs] [GitHub Discussions]

Capture an agent's effective capability surface, commit it, and see semantically meaningful changes before deployment.

ContextWeaver is currently testing a deliberately narrow product hypothesis: capability snapshot + semantic drift.

Given an OpenAPI document, a captured MCP tools/list response, or a native ContextWeaver catalog, the D1 experiment produces a deterministic normalized snapshot that you can inspect, verify, and compare with a later candidate. It does not require a model account, a gateway, a tool executor, or the Weaver Stack.

Status: alpha, and specifically a product experiment. The implementation works and is tested; the user-value hypothesis is not yet proven. The project is actively measuring whether independent users keep this workflow after trying it on real projects.

Try the capability-drift experiment

Clone the repository and install that checkout so the maintained example fixtures and the code under evaluation are guaranteed to match:

Commands below use python3, matching the repository's documented default (docs/agent-context/workflows.md). On Windows installations that expose Python through the launcher, replace python3 with py -3; if your environment already exposes the intended interpreter as python, use that consistently.

bash
git clone --depth 1 https://github.com/dgenio/contextweaver.gitcd contextweaverpython3 -m pip install .

Run the maintained OpenAPI example:

bash
python3 -m contextweaver.d1 snapshot examples/d1/openapi_before.json --source-type openapi --output ./cw-before.jsonpython3 -m contextweaver.d1 snapshot examples/d1/openapi_after.json --source-type openapi --output ./cw-after.jsonpython3 -m contextweaver.d1 inspect ./cw-after.jsonpython3 -m contextweaver.d1 verify ./cw-after.jsonpython3 -m contextweaver.d1 diff ./cw-before.json ./cw-after.json

The candidate fixture intentionally:

  • makes customer_id required on the existing listInvoices capability;
  • changes its description;
  • adds a new getInvoice capability.

The diff separates capability additions/removals from changes to an existing logical capability and reports the structured paths that changed. Contract changes are separated from documentation-only changes. Changes involving fields such as required, type, or enum are flagged as potentially breaking for review.

That flag is intentionally conservative: ContextWeaver does not claim to be a complete JSON-Schema compatibility checker.

Full walkthrough: Capability drift experiment.

Use it on your own source

OpenAPI

bash
python3 -m contextweaver.d1 snapshot ./openapi.yaml --source-type openapi --output ./capabilities.jsonpython3 -m contextweaver.d1 verify ./capabilities.json

After the API changes:

bash
python3 -m contextweaver.d1 snapshot ./openapi.yaml --source-type openapi --output ./capabilities-candidate.jsonpython3 -m contextweaver.d1 diff ./capabilities.json ./capabilities-candidate.json

Captured MCP tools

If you already have an MCP tools/list response saved as JSON:

bash
python3 -m contextweaver.d1 snapshot ./tools-list.json \  --source-type mcp \  --output ./capabilities.json

For MCP, D1 compares tools by their upstream logical name so an input-schema edit appears as a change to the same capability rather than an unexplained remove/add pair. The historical schema-sensitive routing ID is retained separately as normalized_id for inspection.

Capturing a live MCP server is a separate operation. snapshot, inspect, diff, and verify do not execute discovered capabilities.

Native ContextWeaver catalog

bash
python3 -m contextweaver.d1 snapshot ./catalog.json \  --source-type native \  --output ./capabilities.json

What verify means

verify checks the D1 snapshot contract: structure, deterministic ordering, logical-ID uniqueness, and the canonical capability digest.

It is not:

  • deployment approval;
  • security certification;
  • authentication or authorization;
  • a guarantee that a tool implementation is correct;
  • routing-quality evaluation;
  • production runtime attestation.

When not to use ContextWeaver D1

A negative answer is useful evidence for this project. Do not add ContextWeaver just because capability snapshots sound tidy.

Use something simpler when:

  • ordinary Git diff, config review, and tests already make your capability changes obvious;
  • your tool/API surface is tiny and rarely changes;
  • provider-native tool search is the only problem you are trying to solve;
  • you need an agent loop, tool executor, IAM layer, or production orchestrator;
  • maintaining another committed artifact costs more than the review/debugging problem it removes.

If you try D1 and conclude that Git/tests are cheaper, that is a valid product result — please say so.

What is being tested

The current survival experiment asks a stronger question than whether the code works:

Do capability snapshots and semantic drift reports improve a real review/manual/risk process enough that independent users keep them?

The project distinguishes:

text
qualified exposure  -> understood the problem  -> chose to evaluate  -> attempted setup  -> reached first useful output  -> used on a real project  -> retained independently / removed

Stars, forks, downloads, a successful demo, and maintainer-created integrations are not treated as retained adoption.

The controlling product decision is tracked in #758, and the distribution quality gate is #855. Unassisted first success and retention are tracked in #658 and genuine adoption in #551.

What about routing, context compilation, and the MCP gateway?

ContextWeaver already contains substantial historical runtime functionality. That code still exists and currently shipped behavior should remain truthful and safe, but existing implementation is not evidence that the project should keep expanding it.

Two broader hypotheses are explicitly evidence-first:

  • D2 — bounded / phase-aware context compilation: conditional. It must show consequential value beyond contemporary provider/runtime-native mechanisms.
  • D3 — custom deterministic tool selection: a falsification track. It must beat modern provider-native tool search/deferred loading or a simple retrieval baseline on something target users actually care about.

During the D1 experiment, the project is not expanding routing sophistication, runtime bundle machinery, memory/session surfaces, framework breadth, gateway scope, vector stores, or model-assisted enrichment without a concrete external blocker or approved falsification experiment.

If you are maintaining an existing integration that uses those historical surfaces, the relevant documentation remains available:

Evidence and claims

The D1 implementation supports scoped engineering claims such as deterministic snapshot construction under the documented source/adapter contract and structured semantic-diff output. It does not yet support the stronger claim that users need or retain the product.

The historical token-reduction headline is intentionally not used to sell D1. The current evidence-integrity work for those older benchmark claims is tracked in #841.

See Claims & evidence for the claim registry and Capability drift experiment for the exact D1 contract and limitations.

Python API stability

D1 is intentionally exposed through:

bash
python3 -m contextweaver.d1 ...

rather than being promoted immediately into the historical top-level CLI or a large new public Python API. That is deliberate. The experiment should earn a permanent surface through real retained use before the project takes on another compatibility obligation.

Part of the Weaver Stack — optionally

ContextWeaver can be used standalone. It has no hard dependency on the sibling Weaver projects.

The wider Weaver Stack contains adjacent experiments/components for planning, execution boundaries, guardrails, lessons, and evaluation. That ecosystem is not required to evaluate D1, and Stack coherence is not a reason to preserve a ContextWeaver feature that does not justify itself independently.

See the Ecosystem map only if you actually need those adjacent responsibilities.

Install and compatibility

bash
pip install contextweaver

Python 3.10–3.14 are covered by the repository CI matrix.

Current package version: 0.18.2

ProjectRelease
ContextWeaver (this repo, v0.18.2)current package release

The repository is pre-1.0. Prefer the latest supported patch release for bug and security fixes, and check the changelog before relying on historical runtime APIs.

Current roadmap

The roadmap is intentionally a product-decision sequence, not a feature queue.

MilestoneStatusMeaning
v0.18.1 — D1 survival experiment baseline✅ completeOffline snapshot/inspect/diff/verify exists; user value remains unverified.
v0.18.2✅ current (v0.18.2)D1 survival experiment and release-path recovery
D1 distribution gate🔬 evidence firstMake the front door understandable, recruit qualified evaluators, measure first success and retention.
D1 decision⏸ next decisionContinue, shrink further, or kill based on retained value after competent distribution.
D2 / D3🧪 conditionalRun only if D1 evidence or independent problem discovery justifies bounded falsification experiments.

A green CI run does not advance this roadmap by itself.

Contributing

The most valuable contributions during the survival experiment are narrow and evidence-linked:

  • a real D1 evaluator blocker;
  • a semantic-diff case that is currently misleading or silently lost;
  • deterministic normalization correctness;
  • security/release maintenance for behavior the package still ships;
  • negative evidence showing a simpler alternative wins.

Please do not add a framework adapter, routing policy, storage backend, runtime phase, or ecosystem integration solely for completeness.

See CONTRIBUTING.md and AGENTS.md for repository engineering conventions.

Security

See SECURITY.md for supported-version and vulnerability-reporting guidance. Do not include credentials, customer data, proprietary schemas, or private prompts in public adoption/evaluation reports.

Documentation

License

Apache-2.0. See LICENSE.

來源:README.md,提交 d1ceb47

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.18.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分