72 lines
3.7 KiB
Markdown
72 lines
3.7 KiB
Markdown
> Core 中立版(Increment 6a 改写,原 deferHard verbatim)。编号与条目结构严格不变(C-2 不变量);实例术语按 `core/adapters/TERMINOLOGY.md` 绑定。
|
||||
|
|
# Shared Rule — Round-Boundary Context Compaction
|
|||
|
|
|
|||
|
|
> **Canonical source of truth.** This file is the single authoritative copy of
|
|||
|
|
> the round-boundary compaction rule. It is injected **directly** (via
|
|||
|
|
> `<!-- inject -->`) by two skills:
|
|||
|
|
>
|
|||
|
|
> - `review-code/SKILL.md`
|
|||
|
|
> - `review-artifact/SKILL.md`
|
|||
|
|
>
|
|||
|
|
> Both inject tags are resolved by `injectShared`
|
|||
|
|
> (`<harness-package>/src/tool/skill.ts`) at skill-load time. Do not place this
|
|||
|
|
> inject inside a file that is *itself* injected (a nested inject) —
|
|||
|
|
> `injectShared` is single-pass and does not resolve nested inject tags; they
|
|||
|
|
> survive as literal `<!-- inject -->` comments and the procedure is silently
|
|||
|
|
> lost.
|
|||
|
|
>
|
|||
|
|
> **When editing:** update this file only. Every consumer picks up the change
|
|||
|
|
> automatically at load time — do not copy the text into any skill.
|
|||
|
|
>
|
|||
|
|
> This is a reference document, not a skill (no `SKILL.md` frontmatter), so the
|
|||
|
|
> skill loader does not register it. It exists purely so maintainers have one
|
|||
|
|
> place to edit.
|
|||
|
|
|
|||
|
|
## Why a canonical copy exists
|
|||
|
|
|
|||
|
|
Every multi-round review skill (`review-artifact`, `review-code`) needs the model to
|
|||
|
|
read this rule inline at the point it dispatches rounds — a cross-file
|
|||
|
|
reference would not be loaded into the model's context. So the text is
|
|||
|
|
injected directly into both skills at load time. The injection is intentional;
|
|||
|
|
this file exists to keep the two consumers on identical wording without a
|
|||
|
|
copy-paste mirror.
|
|||
|
|
|
|||
|
|
## Canonical text
|
|||
|
|
|
|||
|
|
The block below is what each consumer receives at the inject site. The guard
|
|||
|
|
referenced is the agent-initiated `compact` tool's minimum-turns guard,
|
|||
|
|
configured at `compaction.agent.min_turns_since_compaction` (default **3**).
|
|||
|
|
|
|||
|
|
> **Context compaction (round ≥ 2)**: The Orchestrator is the only long-lived
|
|||
|
|
> context across rounds; per-round dimension outputs, synthesis, and
|
|||
|
|
> convergence tracking must not accumulate unbounded. Once Phase B has posted
|
|||
|
|
> the commit status (all round state persisted in the synthesis comment + commit status)
|
|||
|
|
> and before dispatching the next
|
|||
|
|
> round in Phase A, the Orchestrator MUST run `compact` to summarize the
|
|||
|
|
> conversation through the current round, then re-read
|
|||
|
|
> the latest synthesis comment via `工单评论 API(见 TERMINOLOGY)` to restore
|
|||
|
|
> `current_round` and convergence tracking. The
|
|||
|
|
> Synthesizer's return summary (verdict, per-dimension results, re-audit
|
|||
|
|
> targets) is carried in the compacted conversation; if it was lost, re-read
|
|||
|
|
> the synthesis comment's fenced JSON block as fallback before proceeding.
|
|||
|
|
> Skip on round 1
|
|||
|
|
> (single-pass reviews never loop). Each round then starts from a bounded
|
|||
|
|
> context anchored on file state, not conversation memory.
|
|||
|
|
>
|
|||
|
|
> This round-boundary compaction is mandatory, but it is NOT exempt from the
|
|||
|
|
> `compact` tool's `min_turns_since_compaction` guard
|
|||
|
|
> (`compaction.agent.min_turns_since_compaction`, default 3): no such exemption
|
|||
|
|
> exists in the tool implementation. If the tool rejects with
|
|||
|
|
> `insufficient_turns`, accept the rejection and continue into the next round
|
|||
|
|
> without compacting — do NOT retry or work around the guard. A round with too
|
|||
|
|
> few turns since the last compaction simply keeps its context; the synthesis
|
|||
|
|
> comment + commit status still bound what accumulates.
|
|||
|
|
|
|||
|
|
## Canonical note line
|
|||
|
|
|
|||
|
|
There is no `*(Shared rule …)*` italic note line in any consumer — the inject
|
|||
|
|
directive resolves to this file's full content (this header included) at load
|
|||
|
|
time. Older revisions of this document described a two-step "copy the
|
|||
|
|
canonical text into each mirror" sync procedure; that procedure no longer
|
|||
|
|
exists and must not be reintroduced.
|