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
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ Agent 按该入口已有的目录地图和落盘规范,自行选择 owner、

## 默认 MCP 工具

- `review(target, repo?, mode?, post?)`:Direct 返回审查知识入口、首轮简明
checklist、60 秒宿主对话进度合同和单评论完成门禁;显式指定
- `review(target, repo?, mode?, post?, title?, body?, changed_files?)`:Direct
在宿主先固定快照并发出进度后,按 PR title/body 直接返回至多 3 个精确
`knowledge_routes`,每项内嵌裁剪后的 `quick_map`;changed files 只校验
范围,不再打开整篇规则或从 `AGENTS.md`、索引和 catalog 逐层导航。它同时
返回按 docs/code 区分的命令与验证预算、首轮简明 checklist、60 秒宿主对话进度合同
和单评论完成门禁;显式指定
`mode="strict"` 时运行旧 Eco 审查工作流。进度只显示在当前对话,不会发布
GitHub 初稿评论。
- `validate_direct_review(subtraction_signal, subtraction?, minimality_proof?,
Expand All @@ -129,7 +133,7 @@ Agent 按该入口已有的目录地图和落盘规范,自行选择 owner、

| 模式 | 适合场景 | 说明 |
|---|---|---|
| Direct(默认) | 日常 PR 和本地审查 | Agent 自己完成一次审查;MCP 提供知识入口、首轮 checklist 和触发式减法检查 |
| Direct(默认) | 日常 PR 和本地审查 | Agent 先报告固定快照状态,再只读 title/body 命中的精确规则,随后并行审查源码和验证;MCP 提供首轮 checklist 和触发式减法检查 |
| Strict | 需要旧版完整审查工作流 | Strict 只是旧 Eco 的新名称,继续使用原 playbook、模型和运行状态 |
| Autonomous | 需要独立执行器 | 使用单独配置的模型和工作流 |

Expand Down
16 changes: 9 additions & 7 deletions doc/EXTENDING-KNOWLEDGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ symptom appeared.
|---|---|---|
| A rule that must change the **next** run (trigger → do → don't → how to verify) | `rules.md` in the nearest owner dir | The default product of a retrospective. Always-on (see §2) — keep it tight. |
| A **stable** data-flow / responsibility / boundary description | `architecture.md` | No title-only stubs. |
| A longer method that isn't a hard gate | a page in `guides/` | Pulled on demand, so depth is welcome here. |
| A longer method that isn't a hard gate | a feature page in the owner root; work-topic collections may use `guides/` | Component/model owners stay flat; all deeper pages are pulled on demand. |
| **Complex reproducible history** a rule can't carry | `incidents/YYYY-MM-DD-short-name.md` | Optional. Only when the repro chain / evidence still has independent lookup value. |

**Retrospective rule of thumb:** the default output of "复盘 / record a lesson" is a
Expand All @@ -88,16 +88,16 @@ Wiring lives in `src/infermatrix_copilot/engine/agent_runtime/knowledge.py` +
- the adapter's `briefing_docs` — for vllm-omni: `repos/vllm-omni/rules.md` +
`repos/vllm-omni/_index.md`;
- `performance_briefing_docs` for strong models (compact review patterns).
- **On demand** — the `doc_search` / `doc_read` tools reach every deeper `guides/`,
`incidents/`, `components/`, and `models/` page in `general/` **plus the active
- **On demand** — the `doc_search` / `doc_read` tools recursively reach every
deeper Markdown page in `general/` **plus the active
adapter's `repo_subdir` only** (other repos' slices are refused; path traversal
is blocked; `doc_read` windows 24k chars and pages with an offset).
- **MCP** — the same repo-scoped `doc_search` / `doc_read` are exposed read-only
over MCP, so a host model can query the wiki without starting a run.

**Practical implication for authors:** `rules.md` and `_index.md` are *budget* —
they load on every task. Keep them to triggers + gates + navigation. Push
narrative, long repros, and step-by-step method into `guides/` / `incidents/`,
narrative, long repros, and step-by-step method into on-demand feature pages or `incidents/`,
which are pulled only when a run actually needs them.

To register a **new repo's** slice, point its adapter manifest at it
Expand Down Expand Up @@ -213,7 +213,7 @@ sources: []

| 用户提到 | 必读 | 硬约束 |
|---|---|---|
| <trigger phrase> | [<guide>](guides/<guide>.md) | <what MUST/ MUST-NOT happen + how to verify> |
| <trigger phrase> | [<method>](<method>.md) | <what MUST/ MUST-NOT happen + how to verify> |

## 规则(每条给稳定 ID)

Expand Down Expand Up @@ -262,7 +262,7 @@ Model variant (same frontmatter, `type: architecture`):
## 怎样验证功能、精度和性能
```

### 3.6 An ordinary `guides/` page
### 3.6 An ordinary method page

```markdown
---
Expand All @@ -286,7 +286,9 @@ sources: []
- <the check that proves it worked>
```

Then add a row for it in the sibling `guides/_index.md`.
For a component/model, put the page directly in the owner root and link it from
the owner's `_index.md`. Work-topic collections may place it in `guides/` and
register it in `guides/_index.md`.

### 3.7 An `incidents/` page (validator-checked fields)

Expand Down
17 changes: 9 additions & 8 deletions doc/KNOWLEDGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ capabilities, push policy) is human-authored and stays — the code depends on i
- **Briefing (always-on):** the general slice `settings.knowledge_general_docs`
+ the adapter's repo-specific `briefing_docs`
(`repos/<repo>/rules.md` + `_index.md`), each capped.
- **On demand:** the cross-platform `doc_search` / `doc_read` tools reach every
deeper guide, incident, component, and model page in the shared `general/`
- **On demand:** the cross-platform `doc_search` / `doc_read` tools recursively
reach every deeper Markdown page in the shared `general/`
slice plus the active adapter's `knowledge.repo_subdir`. Other repos' slices
are refused. Search is implemented in Python (no host `grep` dependency), and
title/frontmatter/heading hits rank first.
Expand All @@ -82,12 +82,13 @@ capabilities, push policy) is human-authored and stays — the code depends on i
Edit `knowledge/` in place like any other tracked content; every change goes
through normal PR review plus the tree's own gates:

1. Read `doc/PLAN-knowledge-reorg.md`, `knowledge/CONTRIBUTING.md`, and exactly
one linked contribution topic. Preserve the plan's owner-scoped inventory,
union-first curation, and raw/synthesized split.
2. Route content by role and owner: rules for auditable invariants, guides for
procedures, architecture for stable boundaries, and the existing raw layer
for complex evidence. Do not create a catch-all review page.
1. Read `knowledge/CONTRIBUTING.md`, `knowledge/SCHEMA.md`, and exactly one
linked contribution topic. The reorganization plan is historical, not an
active directory contract.
2. Route content by role and owner: rules for auditable invariants, direct
feature pages for component/model procedures, architecture for stable
boundaries, and the existing raw layer for complex evidence. Do not create
a catch-all review page or a `guides/` layer under a source owner.
3. Treat `knowledge/SCHEMA.md` only as an additive metadata overlay. Evaluation
cases, hidden labels, predictions, judgments, and generated reports stay in
`eval/` and outside always-on briefing documents.
Expand Down
4 changes: 4 additions & 0 deletions doc/PLAN-knowledge-reorg.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Knowledge reorganization v2 — vendored, code-mirrored, detail-preserving

> Historical migration plan. Its `_archive/`-never-delete rule is superseded by
> `knowledge/SCHEMA.md`: merge unique live content into the surviving owner,
> delete the duplicate, and use Git history for recovery.

## Context
The copilot's knowledge base is currently a git submodule `knowledge/` = `zuiho-kai/claude-workflow-starter` @ `f2dc824`, consumed unmodified. The author has **authorized copying the content** into this repo, so the submodule indirection (and everything it forced: upstream PRs, pin bumps, lockstep commits, cryptographic authorization) is dropped. The tree becomes ordinary tracked files we edit directly, delivered as normal copilot PRs.

Expand Down
2 changes: 1 addition & 1 deletion doc/knowledge-templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ comment, register the page in the nearest `_index.md`, then validate.
| [`rules.md`](rules.md) | an always-on gate page | nearest owner dir |
| [`architecture-component.md`](architecture-component.md) | a shared-module architecture page | `repos/<repo>/components/<module>/architecture.md` |
| [`architecture-model.md`](architecture-model.md) | a model architecture page | `repos/<repo>/models/<model>/architecture.md` |
| [`guide.md`](guide.md) | a method/how-to page | a `guides/` dir |
| [`guide.md`](guide.md) | a method/how-to page | component/model owner root; work-topic collections may use `guides/` |
| [`incident.md`](incident.md) | a retro / historical write-up | an `incidents/` dir — **rename to `YYYY-MM-DD-short-name.md`** |

## Copy + register + validate
Expand Down
6 changes: 3 additions & 3 deletions doc/knowledge-templates/guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- TEMPLATE: a method / how-to page for a guides/ dir. Depth is welcome here
(pulled on demand, not always-on). Add a row for it in the sibling
guides/_index.md, then delete this comment. -->
<!-- TEMPLATE: an on-demand method page. Put component/model methods directly
in the owner root; work-topic collections may use guides/. Register the
page in its nearest _index.md, then delete this comment. -->
---
title: "<Guide title>"
created: <YYYY-MM-DD>
Expand Down
2 changes: 1 addition & 1 deletion doc/knowledge-templates/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sources: []

| 用户提到 | 必读 | 硬约束 |
|---|---|---|
| <trigger phrase> | [<guide>](guides/<guide>.md) | <what MUST / MUST-NOT happen + how to verify> |
| <trigger phrase> | [<method>](<method>.md) | <what MUST / MUST-NOT happen + how to verify> |

## 规则

Expand Down
58 changes: 48 additions & 10 deletions docs/codex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ The plugin also adds the `imreview` skill, so the short form is:
Codex calls `review`, receives the local `knowledge/AGENTS.md` path plus a
compact first-review checklist, and follows that document's routing map itself.
The MCP does not guess which owner applies and does not inject complete rule
pages. Within 60 seconds, Codex reports the pinned head SHA, current CI,
mergeability, and preliminary findings in the host conversation, then continues
the same review without posting an interim GitHub comment. Before the only final review comment, Codex calls
pages. After pinning the snapshot, Codex immediately reports the pinned head SHA,
current CI, mergeability, and preliminary findings in the host conversation.
It does this before reading knowledge, searching source, or running tests and
does not wait for CI completion or resolved mergeability. Codex then calls
Direct once with the collected title, body, and changed files, uses the embedded
`quick_map` in each exact route without opening the full rule page, and runs
knowledge/source and validation tracks concurrently. It reuses one in-review
evidence packet and runs an import/version
compatibility preflight before pytest. Validation results are bound to the head
SHA and an environment fingerprint. The progress update is not an interim
GitHub comment. Before the only final review comment, Codex calls
`validate_direct_review`. A normal small fix uses `subtraction_signal="none"`
without a minimality proof. Only a diff that adds or expands a helper, class,
fallback, compatibility branch, or public behavior uses `"triggered"` and
Expand All @@ -45,7 +53,31 @@ The tool response is intentionally small:
```json
{
"mode": "direct",
"knowledge_entry": "C:\\...\\InferMatrixCopilot\\knowledge\\AGENTS.md",
"knowledge_entry": "C:\\...\\knowledge\\repos\\vllm-omni\\components\\serving\\rules.md",
"knowledge_routes": [
{
"owner": "serving",
"path": "C:\\...\\knowledge\\repos\\vllm-omni\\components\\serving\\rules.md",
"reason": "title/body: endpoint, request",
"quick_map": "## Direct 代码快速入口\n...",
"read_required": false
}
],
"navigation_policy": {
"progress_before_knowledge": true,
"use_embedded_quick_maps": true,
"open_route_file_only_for_concrete_ambiguity": true,
"max_routes": 3,
"stop_after_routes": true
},
"execution_budget": {
"profile": "code",
"knowledge_file_reads": 0,
"validation_commands": 4,
"total_command_calls": 20,
"hard_ceiling": true,
"extension_command_calls": 4
},
"first_review_checklist": ["...", "Run subtraction only when the diff has a subtraction signal ..."],
"progress_update": {
"deadline_seconds": 60,
Expand Down Expand Up @@ -92,9 +124,14 @@ confirm that `infermatrix-copilot` is connected.

## What the default MCP exposes

- `review(target, repo?, mode="direct", post=false)`: Direct ignores `repo`
and returns `knowledge/AGENTS.md`, the first-review checklist, the 60-second
host-conversation update contract, and the single-comment completion contract.
- `review(target, repo?, mode="direct", post=false, title="", body="",
changed_files=[])`: after the host progress update, Direct uses title/body to
return at most three exact owner/model routes with compact embedded
`quick_map` excerpts. Changed files only validate scope. The host does not
open full rule files unless a concrete ambiguity blocks source review and
treats the returned docs/code `execution_budget` as a hard ceiling. A single
bounded extension is reserved for one stated unresolved P1/high-risk
contract.
Strict maps to the previous Eco workflow.
- `validate_direct_review(subtraction_signal, subtraction?, minimality_proof?,
final_comment_count=1)`: `none` completes an ordinary small fix without a
Expand All @@ -108,9 +145,10 @@ confirm that `infermatrix-copilot` is connected.
- `doc_search(query, repo?)`: finds deeper model/component rules.
- `doc_read(path, repo?)`: reads a selected knowledge page.

Direct mode does not run another model, choose a knowledge owner, edit knowledge
inside the MCP, post comments, or push code. The completion validator checks
review structure; Codex still owns the truth of the cited code evidence.
Direct mode does not run another model, edit knowledge, post comments, or push
code. Its deterministic router selects bounded knowledge owners from the PR
description; Codex still owns scope validation and the truth of cited code
evidence. The completion validator checks review structure.

## Optional autonomous BYOK workflow

Expand Down
4 changes: 3 additions & 1 deletion docs/knowledge-maintainer.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@
2. 创建 `_index.md`,写清源码路径、职责边界、测试入口和依赖关系。
3. 有稳定架构信息时创建 `architecture.md`。
4. 第一条真实规则出现时才创建 `rules.md`,不要提交空页面。
5. 在父级 `components/_index.md` 或 `models/_index.md` 增加入口。
5. 新增 component 时在 `components/_index.md` 增加入口;新增 model 时不用维护
父级长表,目录会由 `models/` 文件系统清单自动发现。新增别名或 registry key
时才更新 `models/catalog.md`。

模块与模型的区别:

Expand Down
8 changes: 5 additions & 3 deletions docs/samples/add-new-model-owner.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ sources: [<源码路径、设计文档或 PR URL>]
- 验收:<可检查的完成标准> ^[<PR、源码路径或设计文档>]
```

## 文件 4:登记模型入口
## 文件 4:需要别名时才更新 catalog

在 `knowledge/repos/vllm-omni/models/_index.md` 的模型表格增加:
`models/` 目录本身就是模型清单,不修改父级 `_index.md`。只有正式名称之外还需要
别名或 registry key 路由时,才在
`knowledge/repos/vllm-omni/models/catalog.md` 增加对应关系。

```markdown
| <模型正式名称和常见别名> | [<模型正式名称>](<model-slug>/_index.md) | <一句话适用范围> |
| <别名或 registry key> | <model-slug> | <源码目录或定位信号> |
```

## 提交前复制
Expand Down
39 changes: 32 additions & 7 deletions integrations/cursor/imreview.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
Use the InferMatrixCopilot MCP server to review the target supplied with this
command. If no target is supplied, review the current PR or working tree.

Call `review` with `mode="direct"`, read the returned `knowledge_entry`, follow
its routing instructions, inspect the live target, and return only
evidence-backed findings with file and line references.
First pin one snapshot and collect title, body, changed files, head SHA, CI, and
mergeability. Immediately report the pinned head SHA, current CI status,
mergeability, and any early findings in the host conversation before reading
knowledge, searching source, or running tests. Within 60 seconds, do this. Then
call `review` once with
`mode="direct"` plus `title`, `body`, and `changed_files`. Use the embedded
`quick_map` in each returned `knowledge_routes` item. Do not open the full route
file unless a concrete ambiguity blocks source review, and do not walk
`AGENTS.md`, `CLAUDE.md`, repository indexes, or model catalogs. Inspect the
live target and return only evidence-backed findings with file and line
references.
Follow the returned `execution_budget`. Extend it once only when a concrete
unresolved P1/high-risk contract remains, and state that question before
extending.

Within 60 seconds, first update the host conversation with the pinned head SHA,
current CI status, mergeability, and any early findings. Mark early findings as
preliminary and continue the review. This update is not a GitHub comment; do not
post an interim review.
After the progress update, run independent knowledge/source and validation
tracks concurrently. Keep one in-review evidence packet and reuse
files, bounded `rg` searches, callers, tests, repo-map, routing, and findings.
Treat CI as status unless its first failure overlaps the frozen diff or blocks
the verdict; do not open unrelated CI logs. For docs-only changes, skip the
dependency preflight and pytest, and use diff hygiene plus bounded checks of the
referenced live contract.
Before pytest, run a short import/version compatibility preflight. Bind every
validation command and result to the head SHA and an environment fingerprint;
reuse an environment only when its dependency fingerprint matches. After the
preflight passes, run targeted tests and low-cost static checks alongside the
source review.
Stop when every changed semantic path has a supported finding or an explicit
no-issue conclusion; do not add searches only for confidence.

Do not wait for CI completion or resolved mergeability before the progress
update. Mark early findings as preliminary and continue the review. This update
is not a GitHub comment; do not post an interim review.

Before finalizing, classify `subtraction_signal`. Use `none` without a
minimality proof when the diff does not add or expand a helper, class, fallback,
Expand Down
Loading
Loading