Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,10 @@ python knowledge/tools/check_wiki_lint.py

自动知识回流也遵循同一条边界:本仓库发布的
`infermatrix_copilot.sdk.v1.KnowledgeCurator` 是 catalog、受信 prompt、proposal
shape/ID/page/source 校验、append-only apply 与两道 validator rollback 的唯一实现;
ReviewBot 只把 evidence 和 model JSON 接到该 API,并继续拥有 dedicated clone、
ledger/retry、Git commit、fork push、PR 与 schedule。SDK 不 clone、不调 model、
shape/ID/page/source 校验、append-only apply 与两道 validator rollback 的公共入口;
实现位于 `infermatrix_copilot.knowledge_service.curation`,SDK v1 只保留兼容导出。
ReviewBot 把 evidence 和 model JSON 接到该 API,并继续拥有 dedicated clone、
ledger/retry、Git commit、本地补丁导出与 schedule。SDK 不 clone、不调 model、
不发布,也不会写 wheel 内的 knowledge 副本。

## 快速上手 4 · CI 修复(imcifix)
Expand Down
23 changes: 23 additions & 0 deletions doc/architecture/SPEC/knowledge_service/curation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# knowledge_service/curation.py — provider curation contract

<!-- verified-against: 2026-09-26 -->

`KnowledgeCurator` implements provider-owned catalog, bounded evidence prompt,
proposal validation, append-only apply, fixed validator execution, and byte-exact
rollback for an explicit work checkout. It imports only SDK contract models and
standard-library services; it never imports a CLI/MCP transport, calls a model,
clones a repository, pushes, or publishes a PR. The public
`sdk.v1.knowledge` module re-exports the class and `KnowledgeValidatorError`
without owning a second implementation.

Catalog targets are contained, non-symlink owner rule pages. Evidence is fenced
and byte-bounded. Proposal validation binds every accepted rule to its source,
page digest, and batch identity. Apply holds both an in-process mutex and an
interprocess file lock, rechecks page digests and rule ID uniqueness, and runs
the two fixed knowledge validators. Any failed validator restores the exact
original bytes of every target page.

The host owns evidence collection, model calls, retries, local commits and
proposal export. Curation writes only the explicit checkout and never wheel
resources. Installed-wheel imports and temp-checkout apply/rollback tests must
remain valid.
9 changes: 5 additions & 4 deletions doc/architecture/SPEC/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
`flock` 串行化;等待后的 SHA 复核让第二个 stale writer 失败,不会覆盖首个结果。
- **知识 orchestration 留在宿主**:SDK 不 clone、调用 model、管理 ledger、commit、
push、开 PR 或 schedule。ReviewBot 必须向 `KnowledgeCurator` 传 dedicated work
checkout,并继续拥有重试、artifact 与 fork publication;SDK 也绝不写 packaged
checkout,并继续拥有重试、artifact 与本地补丁导出;SDK 也绝不写 packaged
knowledge tree。
- SDK、Direct、Quality API 版本常量为 `1.0.0`;Strict 为 `1.2.0`
(1.1 新增 `finding_dispositions`;1.2 新增 `findings`),Knowledge 为 `1.1.0`
- SDK、Quality API 版本常量为 `1.0.0`;Direct 为 `1.1.0`,Strict 为 `1.3.0`
(1.1 新增 `finding_dispositions`;1.2 新增 `findings`;1.3 新增显式 recheck),Knowledge 为 `1.1.0`
(1.1 向后兼容地新增 `catalog_entries()` / `KnowledgeCatalogEntry` 与容量预检),
distribution 为 `0.2.0`;`Capabilities.knowledge_api_version` 与
`supports_knowledge_curation` 组成 ReviewBot 的 paired-release 握手,避免只按
Expand All @@ -99,7 +99,8 @@

`sdk.v1.models` 为纯 stdlib 模型;`direct` import-time 只依赖模型与资源解析,
函数调用时才向下进入 `direct_routing`;`strict` 构造时才向下进入
`Settings`/`CopilotMCP`。`knowledge` 只依赖 stdlib、公开模型和显式 work checkout,
headless `app.RunService`。`sdk.v1.knowledge` 是兼容导出,实际实现位于
`knowledge_service.curation`;后者只依赖 stdlib、公开模型和显式 work checkout,
并以 subprocess 运行上述两个固定 validator。任何 server 都不得被 SDK package
initializer 反向 import,provider domain 也不得反向依赖 ReviewBot。

Expand Down
1 change: 1 addition & 0 deletions src/infermatrix_copilot/knowledge_service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Provider-owned knowledge catalog, proposal, and apply logic."""
Loading
Loading