@c4a/context-cli 0.5.29-beta.18 → 0.5.29-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/cli.js +3995 -2165
- package/package.json +1 -1
- package/plugin/README.md +4 -3
- package/plugin/README_CN.md +4 -3
- package/plugin/commands/align.md +28 -4
- package/plugin/commands/capture.md +5 -3
- package/plugin/commands/compile.md +27 -14
- package/plugin/commands/query.md +1 -0
- package/plugin/skills/skill-align-workflow/SKILL.md +32 -10
- package/plugin/skills/skill-align-workflow/references/gates.md +81 -41
- package/plugin/skills/skill-compile-close/SKILL.md +4 -1
- package/plugin/skills/skill-compile-draft/SKILL.md +108 -279
- package/plugin/skills/skill-compile-draft/references/action-domain-gates.md +34 -0
- package/plugin/skills/skill-compile-draft/references/notes.md +34 -0
- package/plugin/skills/skill-compile-draft/references/refresh-and-update.md +71 -0
- package/plugin/skills/skill-compile-draft/references/structural-challenges.md +76 -0
- package/plugin/skills/skill-compile-judge/SKILL.md +1 -1
- package/plugin/skills/skill-context-query/SKILL.md +141 -94
- package/plugin/skills/skill-drop/SKILL.md +2 -3
- package/plugin/skills/skill-semantic-reconcile/SKILL.md +70 -185
- package/plugin/skills/skill-semantic-reconcile/references/leakage-and-ownership.md +31 -0
- package/plugin/skills/skill-semantic-reconcile/references/mode-semantics.md +41 -0
- package/plugin/skills/skill-semantic-reconcile/references/scope-review-and-omit.md +60 -0
- package/plugin/skills/skill-semantic-reconcile/references/temporal-and-evidence.md +66 -0
- package/plugin/skills/skill-semantic-reconcile/references/user-confirmation.md +71 -0
|
@@ -1,48 +1,53 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: skill-semantic-reconcile
|
|
3
3
|
description: >
|
|
4
|
-
Packaged skill
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`context reconcile
|
|
8
|
-
|
|
4
|
+
Packaged skill used by `/context:drop`, refresh/non-compile reconcile flows,
|
|
5
|
+
and compile scope-review fallback; not a user slash command. Ordinary compile
|
|
6
|
+
prepare judgment uses `skill-compile-judge`. This skill consumes only
|
|
7
|
+
`context reconcile prepare` output, judges semantic relation/action for each item,
|
|
8
|
+
and emits a schema_version 1.0 semantic decision document for `context reconcile review`;
|
|
9
|
+
apply consumes the current workflow's ready review artifact.
|
|
9
10
|
tools:
|
|
10
11
|
- Bash
|
|
11
12
|
---
|
|
12
13
|
|
|
13
14
|
# skill-semantic-reconcile — decide Section reconciliation
|
|
14
15
|
|
|
15
|
-
Judge duplicate, merge, conflict, reanchor, and unsupported cases
|
|
16
|
-
|
|
16
|
+
Judge duplicate, merge, conflict, reanchor, and unsupported cases for refresh,
|
|
17
|
+
drop, non-compile reconcile, or compile scope-review fallback. Emit decisions
|
|
18
|
+
only; the CLI performs every write.
|
|
17
19
|
|
|
18
20
|
## TL;DR — Non-negotiables
|
|
19
21
|
|
|
20
|
-
- Input is
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
- `
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
- Input is the full `context reconcile prepare` payload. If the caller handed you a compact prepare summary or `--view issues` payload, load the full payload first with `context workflow show --payload prepare --unwrap --format json` (add `--digest` only as an explicit stale guard). Never `grep` / `sed` / `jq` / `cat` / `head` workflow scratch files or `--format json` stdout to recover prepare fields, and do not Read / Glob / Grep / Write workspace `raw/` / `knowledge/` / `archive/` / `decisions/` — the prepare payload and review output are the only inputs.
|
|
23
|
+
- Ordinary compile prepare judgment belongs to `skill-compile-judge`. Use this skill for refresh/drop/non-compile reconcile, or when compile review asks for scope/omit/user-confirmation reasoning that is outside the judge handoff.
|
|
24
|
+
- Output: one YAML or JSON document conforming to `context schema semantic-decisions --format yaml`. The schema defines canonical `relation` and `action` enums and the per-action required fields; do not memorise the enum list from this skill.
|
|
25
|
+
- Accept a prepared `default_decision` with the compact form `{ item_id, accept_default: true }` (optionally `decided_by` / `rationale`); the CLI hydrates `target` / `proposed`. Empty `decisions: []` means "no items in prepare," not "accept all defaults." Without `--accept-safe-defaults`, emit one compact accept entry per safe default you intend to accept. With `--accept-safe-defaults`, the CLI auto-accepts mechanically safe no-candidate supported writes and reviewed-no-write skips, so emit only the manual decisions that still need judgment.
|
|
26
|
+
- Every `merge_update` / `supersede` / `keep_separate` / `split_then_reanchor` write must be supported by **one** valid `proposed.source_ref` covering the final content. Preserve raw evidence's domain terms, numbers, code literals, and named entities; do not introduce acronyms, translations, or aliases the cited evidence does not define. Do not cite a title, `Relations` / `Parent` / `Children` / `Related` navigation line as the sole support for a substantive claim.
|
|
27
|
+
- Unresolved conflicts and low-confidence support → `action: ask_user`. Never expose `src-N`, Section ids, or source refs as the user-facing choice; they belong only in the structured payload.
|
|
28
|
+
- `decided_by: user` only after a specific recent user message answering the specific question for the specific item. Auto mode, blanket "continue," and long-running permissions are **not** user confirmation. Never mark yourself.
|
|
29
|
+
- `decided_by: delegated_agent` is CLI-owned. Do not emit it manually; it appears only when the current compile workflow was created with user-authorized `--delegated`.
|
|
30
|
+
- `omit` is never an automatic decision. If an item looks redundant or low-value, follow the Scope Review pass in [references/scope-review-and-omit.md](references/scope-review-and-omit.md); only a user-confirmed no-write outcome may become `action: omit` with `decided_by: user`.
|
|
31
|
+
- `apply` consumes the ready review artifact for the current workflow scope: run plain `context reconcile apply`. There is no input file; do not extract `apply_document` with scripts.
|
|
32
|
+
- Stable output: preserve prepared item order; the CLI rejects unknown fields (timestamps, random ids, storage paths, host absolute paths) and canonicalises stored payloads. Fixed rules and schema come from this skill; only the prepared context varies between repeated review calls.
|
|
33
|
+
|
|
34
|
+
## Edge cases — consult references when:
|
|
35
|
+
|
|
36
|
+
| Condition | Reference |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `prepare.mode` is `drop` or `refresh` (covers `remove_unsupported` mode semantics, `reanchor`, `split_then_reanchor`) | [references/mode-semantics.md](references/mode-semantics.md) |
|
|
39
|
+
| review returned `support_confirmation`, `omit_confirmation`, `scope_review_required`, or any `ask_user` you need to upgrade to an executable decision | [references/user-confirmation.md](references/user-confirmation.md) |
|
|
40
|
+
| review returned `agent_hints[]` with `code: "context-only-leakage-high"` | [references/leakage-and-ownership.md](references/leakage-and-ownership.md) |
|
|
41
|
+
| items carry `temporal_prior` / `source_captured_at` / `temporal_disposition`, `source_support.evidence_block_*`, or prepared long `proposed.content` / `proposed.summary` | [references/temporal-and-evidence.md](references/temporal-and-evidence.md) |
|
|
42
|
+
| considering `action: omit`, or items look redundant / low-value / scope-wrong | [references/scope-review-and-omit.md](references/scope-review-and-omit.md) |
|
|
43
|
+
|
|
44
|
+
If none of the above hold, you are on this skill's main path: refresh/drop/non-compile reconcile, or compile scope-review fallback with no special review-time signals. Ordinary compile prepare relation/support judgment remains `skill-compile-judge`.
|
|
38
45
|
|
|
39
46
|
<reference>
|
|
40
47
|
|
|
41
48
|
## Decision Shape
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
one entry per accepted `item_id`; an empty `decisions: []` document is only a
|
|
45
|
-
no-op when prepare returned zero items and does not accept defaults.
|
|
50
|
+
Accept a prepared `default_decision` with the compact form:
|
|
46
51
|
|
|
47
52
|
```yaml
|
|
48
53
|
schema_version: "1.0"
|
|
@@ -51,7 +56,7 @@ decisions:
|
|
|
51
56
|
accept_default: true
|
|
52
57
|
```
|
|
53
58
|
|
|
54
|
-
For a changed action or
|
|
59
|
+
For a changed action or hand-authored decision, emit the full shape with the action's required fields (see Action Rules below):
|
|
55
60
|
|
|
56
61
|
```yaml
|
|
57
62
|
schema_version: "1.0"
|
|
@@ -69,132 +74,21 @@ decisions:
|
|
|
69
74
|
rationale: "The new evidence clarifies the same claim."
|
|
70
75
|
```
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
`decided_by` is a top-level decision field, not a `proposed` sub-field. Final executable decisions must not carry `user_confirmation.required: true` — that flag belongs only on `action: ask_user` items still awaiting input.
|
|
78
|
+
|
|
79
|
+
## Action Rules — main path
|
|
80
|
+
|
|
81
|
+
Edge-case actions (`reanchor`, `split_then_reanchor`, `remove_unsupported`, `omit`) and their required fields live in the matching reference; consult them when triggered.
|
|
73
82
|
|
|
74
83
|
| action | Required fields | Validation |
|
|
75
84
|
|---|---|---|
|
|
76
85
|
| `duplicate_skip` | `target` | Exact duplicate or already-applied no-op only. |
|
|
77
|
-
| `merge_update` | `target`, `proposed.content`, `proposed.source_ref`, `proposed.
|
|
78
|
-
| `supersede` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `keep_separate` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | New orthogonal claim must be supported by cited evidence. Weak support is allowed only after explicit user confirmation (`decided_by: user`). |
|
|
82
|
-
| `split_then_reanchor` | `target`, `proposed.sections[]` with each Section carrying `kind`, `content`, `source_ref`, and `detail` when present in prepare | Each split Section must be independently supported by its cited evidence. |
|
|
83
|
-
| `omit` | `target`, `rationale`, `decided_by: user` | User-confirmed no-write result after broader scope review and user confirmation. Never emit as an automatic decision. Do not use for conflicts, unsupported evidence, reanchor/drop cases, or schema/source_ref failures. |
|
|
84
|
-
| `ask_user` | `user_confirmation.required: true` | Use only when business meaning or support cannot be decided from prepared evidence. |
|
|
85
|
-
|
|
86
|
-
For `merge_update`, `supersede`, `keep_separate`, and
|
|
87
|
-
`split_then_reanchor`, the final Section content must be supported by the cited
|
|
88
|
-
evidence in `proposed.source_ref` / `proposed.source_refs`. Final executable decisions must
|
|
89
|
-
include `proposed.source_ref`; review can hydrate a missing `source_ref` from
|
|
90
|
-
the current prepare item only when the decision is still the same prepared
|
|
91
|
-
claim. If you changed the content, kind, or evidence selection, rerun
|
|
92
|
-
`context reconcile prepare` instead of reusing an old prepare file. Content
|
|
93
|
-
should retain the raw evidence's key domain terms,
|
|
94
|
-
numbers, code literals, and named entities. Do not introduce acronyms,
|
|
95
|
-
abbreviations, translations, or aliases that the cited evidence does not
|
|
96
|
-
contain or define; use the raw wording, split the claim, or ask the user instead.
|
|
97
|
-
Do not turn sparse raw evidence into a broad summary, and do not cite a title, `Relations`, `Parent`,
|
|
98
|
-
`Children`, or `Related` navigation line as the only support for a substantive
|
|
99
|
-
claim.
|
|
100
|
-
|
|
101
|
-
Preserve prepared `proposed.detail` exactly when it is present. `detail` carries
|
|
102
|
-
long-form prose, examples, and code blocks; dropping it silently loses
|
|
103
|
-
knowledge. If you intentionally want to remove detail from an existing Section,
|
|
104
|
-
emit `detail: null` only on an update-style decision where that clearing is the
|
|
105
|
-
chosen outcome.
|
|
106
|
-
|
|
107
|
-
If review returns `example_detail_preservation`, the cited example evidence
|
|
108
|
-
contains a command / config / code fence that was not preserved in
|
|
109
|
-
`proposed.detail`. Prefer regenerating the decision with the relevant fenced
|
|
110
|
-
block in `proposed.detail`; only keep a prose-only example summary after asking
|
|
111
|
-
the user and marking the final decision `decided_by: user`. Auto mode or
|
|
112
|
-
permission to continue is not that confirmation.
|
|
113
|
-
|
|
114
|
-
The support gate exists to prevent orphan claims and false evidence links, not
|
|
115
|
-
to optimize retrieval. Prefer preserving a precise raw-backed claim over
|
|
116
|
-
rewriting content into a smoother summary. If a useful reader summary would
|
|
117
|
-
combine adjacent evidence, first broaden `proposed.source_ref` so the cited
|
|
118
|
-
range covers every sentence. If one range cannot honestly support the final
|
|
119
|
-
claim, split the claim or ask the user instead of forcing it into an incorrect
|
|
120
|
-
`source_ref`.
|
|
121
|
-
|
|
122
|
-
Prepared items may include `source_support.evidence_block_source_ref`,
|
|
123
|
-
`source_support.evidence_block_line_range`, and
|
|
124
|
-
`source_support.evidence_block_locator_id`, plus optional
|
|
125
|
-
`source_support.evidence_block_candidates[]`. These are repair hints for
|
|
126
|
-
evidence boundaries, not automatic permission to broaden. Use the block-level
|
|
127
|
-
`source_ref` only when that whole block honestly supports the final claim, then
|
|
128
|
-
rerun `context reconcile review`; review revalidates the changed range against
|
|
129
|
-
the workspace raw before apply. If a proposed summary actually combines several
|
|
130
|
-
candidate blocks and no single range honestly supports every sentence, split it
|
|
131
|
-
into separately supported claims instead of keeping one unsupported summary.
|
|
132
|
-
|
|
133
|
-
Prepared compile items may include `temporal_prior`, proposed
|
|
134
|
-
`source_captured_at`, and candidate `source_captured_at` /
|
|
135
|
-
`last_reconciled_at` / `temporal_disposition`. Treat these as review priors
|
|
136
|
-
only. They can explain why an older candidate may be stale relative to the new
|
|
137
|
-
evidence, but they do not change `default_decision` and they are never enough
|
|
138
|
-
to auto-supersede or auto-merge. If you accept or override a temporal prior,
|
|
139
|
-
state the business reason in `rationale`; do not copy temporal fields into the
|
|
140
|
-
executable `proposed` patch.
|
|
141
|
-
|
|
142
|
-
Weak support means hard facts match but the ordinary lexical overlap is low.
|
|
143
|
-
It is acceptable only for a user-confirmed `keep_separate` summary. It is not
|
|
144
|
-
acceptable for `merge_update`, `supersede`, `reanchor`, or
|
|
145
|
-
`split_then_reanchor`, because those actions overwrite, replace, or move an
|
|
146
|
-
existing evidence boundary. When review asks `support_confirmation`, present
|
|
147
|
-
the business claim and cited evidence to the user. If questions share the same
|
|
148
|
-
review `group_key`, you may ask one compact grouped question; otherwise ask
|
|
149
|
-
separately. If confirmed, regenerate the same executable decision with
|
|
150
|
-
`decided_by: user`; if not confirmed, choose stricter evidence or leave an
|
|
151
|
-
`ask_user` item unresolved and stop before apply. User confirmation only
|
|
152
|
-
permits weak support; it does not permit unsupported evidence or missing hard
|
|
153
|
-
facts. Auto mode or permission to continue is not user confirmation.
|
|
154
|
-
|
|
155
|
-
`decided_by` is a top-level decision field, not a `proposed` field:
|
|
156
|
-
|
|
157
|
-
```yaml
|
|
158
|
-
schema_version: "1.0"
|
|
159
|
-
decisions:
|
|
160
|
-
- item_id: claim-008
|
|
161
|
-
relation: complement
|
|
162
|
-
action: keep_separate
|
|
163
|
-
decided_by: user
|
|
164
|
-
target:
|
|
165
|
-
node: runtime-kit
|
|
166
|
-
proposed:
|
|
167
|
-
kind: example
|
|
168
|
-
content: "The host app maps remote modules through the runtime config."
|
|
169
|
-
source_ref: "src-1#example L32-40@7a6f4c9d2e10"
|
|
170
|
-
```
|
|
86
|
+
| `merge_update` | `target`, `proposed.content`, `proposed.source_ref`, `proposed.summary` when present in prepare | Final content must be supported by cited evidence; `proposed.kind`, when present, must match target kind. |
|
|
87
|
+
| `supersede` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.summary` when present in prepare | New Section claim must be supported by cited evidence. |
|
|
88
|
+
| `keep_separate` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.summary` when present in prepare | New orthogonal claim must be supported by cited evidence. Weak support is allowed only after explicit user confirmation (`decided_by: user`). |
|
|
89
|
+
| `ask_user` | `user_confirmation.required: true` | Use when business meaning or support cannot be decided from prepared evidence. |
|
|
171
90
|
|
|
172
|
-
|
|
173
|
-
Use that flag only on `action: ask_user` items that still require user input.
|
|
174
|
-
|
|
175
|
-
If you are tempted to omit an item, do not emit `omit` immediately. First run a
|
|
176
|
-
Scope Review pass over the full prepared context and the current draft
|
|
177
|
-
decisions:
|
|
178
|
-
|
|
179
|
-
- If the item is covered by another decision in the same batch, convert it to a
|
|
180
|
-
precise executable action such as `duplicate_skip` and explain the covered-by
|
|
181
|
-
item in `rationale`.
|
|
182
|
-
- If the item should be merged into another write action, revise that write
|
|
183
|
-
action instead of dropping the item silently.
|
|
184
|
-
- If the item is low-value/non-knowledge but you cannot prove that from the
|
|
185
|
-
prepared context, emit `ask_user` with `question_type: omit_confirmation` and
|
|
186
|
-
a business-language prompt.
|
|
187
|
-
- If several items look low-value or the Node boundary/draft scope looks wrong,
|
|
188
|
-
emit `ask_user` with `question_type: scope_review_required` and stop before
|
|
189
|
-
apply.
|
|
190
|
-
- Only after the user confirms a no-write outcome may you emit `action: omit`
|
|
191
|
-
with `decided_by: user`. `omit` is not recorded in the semantic ledger.
|
|
192
|
-
|
|
193
|
-
`remove_unsupported` has mode-specific write behavior. In compile/refresh
|
|
194
|
-
apply it deprecates the target Section so the unsupported claim remains visible
|
|
195
|
-
as inactive history. In drop apply it physically removes the Section from active
|
|
196
|
-
knowledge after the CLI-managed archive captures the pre-drop snapshot. Use the
|
|
197
|
-
same action only when this mode-specific outcome is intended.
|
|
91
|
+
Source-support gate: if the proposed claim cannot honestly point at one range covering every sentence, split the claim or ask the user instead of forcing it into an incorrect `source_ref`. If a useful reader summary would combine adjacent evidence, first broaden `proposed.source_ref` so the cited range covers every sentence; if that broadening would require unrelated content, split. See [references/temporal-and-evidence.md](references/temporal-and-evidence.md) for evidence-block repair hints.
|
|
198
92
|
|
|
199
93
|
</reference>
|
|
200
94
|
|
|
@@ -202,50 +96,41 @@ same action only when this mode-specific outcome is intended.
|
|
|
202
96
|
|
|
203
97
|
### Step 1 — Consume Prepared Context
|
|
204
98
|
|
|
205
|
-
Use the caller-provided `context reconcile prepare`
|
|
206
|
-
|
|
99
|
+
Use the caller-provided `context reconcile prepare` payload. For each item, compare `proposed`, `candidates`, `previous_decisions`, and `evidence`.
|
|
100
|
+
|
|
101
|
+
If `prepare.mode` is `drop` or `refresh`, or any item carries the special signals listed in the routing table above, read the relevant reference **before** classifying — those references explain how the corresponding conditions modify Step 2.
|
|
102
|
+
|
|
103
|
+
If prepare returns `items: []`, no decision is needed; the caller may skip review/apply or pass `decisions: []` as an explicit no-op.
|
|
207
104
|
|
|
208
|
-
|
|
105
|
+
If `previous_decisions[]` shows the same boundary and the prepared item still matches, emit the same final action. If the target changed, treat the previous decision as a prior only and continue judging.
|
|
209
106
|
|
|
210
|
-
|
|
211
|
-
matches, emit the same final action. If the target changed, treat the previous
|
|
212
|
-
decision as a prior only and continue judging.
|
|
107
|
+
### Step 2 — Decide Relation And Action
|
|
213
108
|
|
|
214
|
-
|
|
109
|
+
Classify each item against the prepared evidence:
|
|
215
110
|
|
|
216
|
-
|
|
111
|
+
- Exact same claim already active → `exact_duplicate` + `duplicate_skip`.
|
|
112
|
+
- Same claim with a raw-supported correction or refinement from one supporting source → `strong_equivalent` or `near_duplicate` + `merge_update`.
|
|
113
|
+
- Additional but separate boundary → `complement` + `keep_separate`.
|
|
114
|
+
- New material replaces old rule → `supersedes` + `supersede`.
|
|
115
|
+
- Direct contradiction → `conflicts` + `ask_user`.
|
|
116
|
+
- Evidence is close but not enough → `ask_user`; for `keep_separate`, review may turn this into `support_confirmation` (see [references/user-confirmation.md](references/user-confirmation.md)).
|
|
117
|
+
- Item appears redundant or not worth writing → run the Scope Review pass in [references/scope-review-and-omit.md](references/scope-review-and-omit.md); never auto-`omit`.
|
|
217
118
|
|
|
218
|
-
-
|
|
219
|
-
- Same claim with a raw-supported correction or refinement from one supporting source -> `strong_equivalent` or `near_duplicate` + `merge_update`.
|
|
220
|
-
- Additional but separate boundary -> `complement` + `keep_separate`.
|
|
221
|
-
- Item appears redundant or not worth writing -> run Scope Review first; if still unresolved, `ask_user` (`omit_confirmation` or `scope_review_required`). Use `omit` only after user confirmation.
|
|
222
|
-
- New material replaces old rule -> `supersedes` + `supersede`.
|
|
223
|
-
- Direct contradiction -> `conflicts` + `ask_user`.
|
|
224
|
-
- Drop item still fully supported elsewhere -> `reanchor` + `reanchor`.
|
|
225
|
-
- Drop item partly supported -> `reanchor` + `split_then_reanchor`.
|
|
226
|
-
- No surviving support -> `unsupported` + `remove_unsupported`.
|
|
227
|
-
- Evidence is close but not enough -> `ask_user`; for `keep_separate`, review may turn this into `support_confirmation` and require explicit user confirmation before apply.
|
|
119
|
+
Drop-mode-only branches (`reanchor`, `split_then_reanchor`, `remove_unsupported`) live in [references/mode-semantics.md](references/mode-semantics.md).
|
|
228
120
|
|
|
229
|
-
### Step
|
|
121
|
+
### Step 3 — Emit Decisions
|
|
230
122
|
|
|
231
|
-
Emit only executable final decisions plus unresolved `ask_user` questions.
|
|
232
|
-
Do not include prose outside the document.
|
|
123
|
+
Emit one document with `schema_version: "1.0"` and `decisions[]`. Include only executable final decisions plus unresolved `ask_user` questions. Do not include prose outside the document.
|
|
233
124
|
|
|
234
|
-
If the latest review rejected the batch with `context-only-leakage-high`, do
|
|
235
|
-
not convert it into a generic `ask_user`. Regenerate the affected decision using
|
|
236
|
-
one of the review hint's explicit repair options and cited item ids, then rerun
|
|
237
|
-
`context reconcile review`. A context-only block may provide background only; it
|
|
238
|
-
must not become the support basis for a written Section unless ownership is
|
|
239
|
-
challenged and upgraded by the workflow.
|
|
125
|
+
If the latest review rejected the batch with `context-only-leakage-high`, do not convert it into a generic `ask_user`. Follow [references/leakage-and-ownership.md](references/leakage-and-ownership.md): regenerate the affected decision using one of the review hint's explicit repair options and cited item ids, then rerun `context reconcile review`.
|
|
240
126
|
|
|
241
|
-
### Step
|
|
127
|
+
### Step 4 — Self-verify
|
|
242
128
|
|
|
243
|
-
- [ ] Every decision uses canonical relation/action values
|
|
244
|
-
- [ ]
|
|
245
|
-
- [ ]
|
|
246
|
-
- [ ] No
|
|
247
|
-
- [ ]
|
|
248
|
-
- [ ]
|
|
249
|
-
- [ ] No workspace files were read or written directly. If violated, restart from **Step 1**.
|
|
129
|
+
- [ ] Every decision uses canonical `relation` / `action` values per `context schema semantic-decisions`. If not, return to **Step 2**.
|
|
130
|
+
- [ ] Every write action carries the required fields from Action Rules (or, for edge-case actions, the rules in the matching reference). If not, **Step 3**.
|
|
131
|
+
- [ ] `decided_by: user` corresponds to a specific recent user message answering this specific question for this specific item. If not, downgrade to `ask_user`.
|
|
132
|
+
- [ ] No `action: omit` was emitted without `decided_by: user` and a business `rationale`. If any, run Scope Review per [references/scope-review-and-omit.md](references/scope-review-and-omit.md).
|
|
133
|
+
- [ ] If any edge case condition applies (drop/refresh mode, review confirmation request, leakage, temporal/evidence signals, omit), the relevant reference's Self-verify items were also satisfied.
|
|
134
|
+
- [ ] No workspace files were read or written directly; no `--format json` stdout was sliced with shell tools. If violated, restart from **Step 1**.
|
|
250
135
|
|
|
251
136
|
</procedures>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Context-only leakage and ownership upgrades
|
|
2
|
+
|
|
3
|
+
Consult this reference when `context reconcile review` returns `agent_hints[]` with `code: "context-only-leakage-high"`. For runs without that hint, ignore this file.
|
|
4
|
+
|
|
5
|
+
## What the hint means
|
|
6
|
+
|
|
7
|
+
A decision's `proposed.source_ref` cites a block that is **`context_only`** for this Node, or a **secondary-shared** block (the Node is in `owners[]` but not `primary_owner`). Those blocks may inform context but cannot be the support basis for a written Section — that breaks the ownership boundary set during align finalize.
|
|
8
|
+
|
|
9
|
+
`context-only-leakage-high` is a **hard rejection**. Do not convert it into a generic `ask_user` and do not retry the same decision unchanged.
|
|
10
|
+
|
|
11
|
+
## Three repair options
|
|
12
|
+
|
|
13
|
+
The review hint names which one applies per item. Pick exactly one:
|
|
14
|
+
|
|
15
|
+
| Hint repair option | When | What to emit |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `rewrite_with_owned_basis` | An owned or shared-primary citation block in the same prepare item supports the same claim | Regenerate the decision citing the owned/primary block; resubmit to `context reconcile review`. |
|
|
18
|
+
| `skip_for_node` | No citation-eligible owned/primary evidence exists in this prepare batch, and the claim is not load-bearing for the Node | Emit `action: ask_user` with `question_type: skip_for_node_confirmation` and the cited evidence; only after user confirms, emit `duplicate_skip` or `omit` (`decided_by: user`). |
|
|
19
|
+
| `pending_ownership_challenge` | The context-only/secondary-shared block contains facts the Node legitimately needs; align must upgrade ownership | Stop the reconcile loop; emit the challenge through the compile draft side (see `plugin/skills/skill-compile-draft/references/structural-challenges.md`) and let the align workflow resolve the split. |
|
|
20
|
+
|
|
21
|
+
## What not to do
|
|
22
|
+
|
|
23
|
+
- Do not paraphrase the offending block into different wording while still citing it — the CLI hashes the cited block, not the prose, so paraphrasing does not lift the leakage flag.
|
|
24
|
+
- Do not promote the block through `request_full_text` — that command exposes visible evidence text for inspection but does not change citation eligibility.
|
|
25
|
+
- Do not silently `duplicate_skip` to make the warning disappear; the hint may indicate a real evidence gap.
|
|
26
|
+
- Do not regenerate the decision with a different `target` to dodge the rule.
|
|
27
|
+
|
|
28
|
+
## How this slots into the main procedure
|
|
29
|
+
|
|
30
|
+
- **Step 4 — Emit**: when review returns `context-only-leakage-high`, treat the affected items as not-yet-decided. Apply the chosen repair option per item, then rerun `context reconcile review` before considering apply.
|
|
31
|
+
- **Step 5 — Self-verify**: no `proposed.source_ref` points at a block whose ownership role for the target Node is `context_only` or secondary-shared. The CLI re-checks at apply time, but catching it here saves a round trip.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Mode-specific semantics
|
|
2
|
+
|
|
3
|
+
Consult this reference when **`prepare.mode` is `drop` or `refresh`**. For the default `compile` mode, ignore this file and follow the main SKILL.md procedure.
|
|
4
|
+
|
|
5
|
+
## Available actions per mode
|
|
6
|
+
|
|
7
|
+
| Action | `compile` | `refresh` | `drop` | `restore` |
|
|
8
|
+
|---|---|---|---|---|
|
|
9
|
+
| `duplicate_skip` / `merge_update` / `supersede` / `keep_separate` / `ask_user` | ✓ | ✓ | (rare) | ✓ |
|
|
10
|
+
| `reanchor` | — | — | **drop-only** | — |
|
|
11
|
+
| `split_then_reanchor` | — | — | **drop-only** | — |
|
|
12
|
+
| `remove_unsupported` | ✓ deprecate | ✓ deprecate | **physical remove** | — |
|
|
13
|
+
|
|
14
|
+
## `remove_unsupported` — mode-dependent write behavior
|
|
15
|
+
|
|
16
|
+
The action is the same, the on-disk effect is not.
|
|
17
|
+
|
|
18
|
+
| Mode | What happens on apply |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `compile` / `refresh` | Target Section's `status` flips to `deprecated`; the unsupported claim stays visible as inactive history. |
|
|
21
|
+
| `drop` | The Section is physically removed from active knowledge after the CLI-managed archive captures the pre-drop snapshot. |
|
|
22
|
+
|
|
23
|
+
Only emit `remove_unsupported` when this mode's outcome is the intended one. A claim that should remain visible-but-stale belongs in `compile`/`refresh`; a claim that the workspace must lose belongs in `drop`.
|
|
24
|
+
|
|
25
|
+
## `reanchor` and `split_then_reanchor` — drop-only
|
|
26
|
+
|
|
27
|
+
These appear only in drop prepare items. They handle "a Section that the drop would remove still has supporting evidence in another source."
|
|
28
|
+
|
|
29
|
+
| Item shape | Decision |
|
|
30
|
+
|---|---|
|
|
31
|
+
| Drop item still **fully** supported by surviving source | `reanchor` + `reanchor` — repoint `proposed.source_ref` at the surviving evidence, keep target unchanged. |
|
|
32
|
+
| Drop item **partly** supported (one fact survives, another does not) | `reanchor` + `split_then_reanchor` — split into `proposed.sections[]`, each with independent `kind` / `content` / optional `summary` / `source_ref`. |
|
|
33
|
+
| No surviving support | `unsupported` + `remove_unsupported` (physical remove on drop apply). |
|
|
34
|
+
|
|
35
|
+
`split_then_reanchor` requires each split Section to be independently supported by its own cited evidence. The CLI rejects splits where any sub-Section's `source_ref` does not cover its `content`.
|
|
36
|
+
|
|
37
|
+
## How this slots into the main procedure
|
|
38
|
+
|
|
39
|
+
- **Step 1 — Consume Prepared Context**: read `prepare.mode` first. If `drop` or `refresh`, the Step 3 classification table extends with the mode-specific rows above.
|
|
40
|
+
- **Step 3 — Decide Relation And Action**: for drop items, use the `reanchor` / `split_then_reanchor` / `remove_unsupported` branches from the table here rather than forcing the items into compile-mode actions.
|
|
41
|
+
- **Step 5 — Self-verify**: confirm no compile-mode action was emitted on a drop item (and vice versa) — the CLI rejects with a clear hint, but catching it here saves a round trip.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Scope Review and `omit` discipline
|
|
2
|
+
|
|
3
|
+
Consult this reference when **you are tempted to emit `action: omit`**, or when an item looks redundant / low-value / non-knowledge. For runs without such items, ignore this file.
|
|
4
|
+
|
|
5
|
+
## Core rule
|
|
6
|
+
|
|
7
|
+
`omit` is **never an automatic decision**. It records a no-write outcome **after** broader scope review and **after** explicit user confirmation. Emitting `omit` without both is a protocol violation.
|
|
8
|
+
|
|
9
|
+
`omit` is also **not the right tool** for:
|
|
10
|
+
|
|
11
|
+
- Conflicts → use `ask_user`.
|
|
12
|
+
- Unsupported evidence → use `unsupported` + `remove_unsupported` (mode-aware; see `references/mode-semantics.md`).
|
|
13
|
+
- Reanchor/drop cases → use `reanchor` or `split_then_reanchor`.
|
|
14
|
+
- Schema / source_ref failures → fix the decision, do not omit.
|
|
15
|
+
|
|
16
|
+
`omit` is **not recorded in the semantic ledger**. There is no audit trail; this is why the confirmation gate exists.
|
|
17
|
+
|
|
18
|
+
## Scope Review pass
|
|
19
|
+
|
|
20
|
+
Before emitting `omit` or `ask_user` with `question_type: omit_confirmation`, run this pass over the full prepared context and the current draft decisions:
|
|
21
|
+
|
|
22
|
+
1. **Covered-by check** — is the item already covered by another decision in the same batch?
|
|
23
|
+
- Yes → convert it to a precise executable action such as `duplicate_skip` and explain the covered-by item in `rationale`. Do not omit.
|
|
24
|
+
|
|
25
|
+
2. **Mergeable check** — should this item's content be merged into another write action?
|
|
26
|
+
- Yes → revise the other write action to incorporate this evidence. Drop the standalone item only after the merged action survives review. Do not omit silently.
|
|
27
|
+
|
|
28
|
+
3. **Provable low-value check** — can you prove from the prepared context that the item is low-value / non-knowledge?
|
|
29
|
+
- Yes (prepared context contains the proof) → emit `ask_user` with `question_type: omit_confirmation` and a business-language prompt.
|
|
30
|
+
- No (you only have a hunch) → emit `ask_user` with `question_type: omit_confirmation` and present the claim + evidence so the user can judge.
|
|
31
|
+
|
|
32
|
+
4. **Scope-wide miscope check** — do several items look low-value, or does the Node boundary / draft scope look wrong?
|
|
33
|
+
- Yes → emit `ask_user` with `question_type: scope_review_required` and **stop before apply**. Do not paper over a scope problem with a series of `omit` decisions.
|
|
34
|
+
|
|
35
|
+
5. **User-confirmed no-write** — only after the user has explicitly answered the `omit_confirmation` or `scope_review_required` question saying "do not write," may you emit:
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
- item_id: claim-007
|
|
39
|
+
relation: keep_separate # or whatever the prepared relation was
|
|
40
|
+
action: omit
|
|
41
|
+
target:
|
|
42
|
+
node: ...
|
|
43
|
+
decided_by: user
|
|
44
|
+
rationale: "<business reason from the user reply>"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`decided_by: user` must reflect a specific recent user message answering this specific question (see `references/user-confirmation.md`).
|
|
48
|
+
|
|
49
|
+
## Common anti-patterns
|
|
50
|
+
|
|
51
|
+
- Emitting `omit` because the item "looks redundant" without running Scope Review.
|
|
52
|
+
- Emitting `omit` because review returned `ask_user` and you want to clear the queue.
|
|
53
|
+
- Treating auto mode / earlier "continue" as user confirmation.
|
|
54
|
+
- Using `omit` to dodge a `remove_unsupported` decision in drop mode (the physical-remove behavior is the **point** of drop).
|
|
55
|
+
|
|
56
|
+
## How this slots into the main procedure
|
|
57
|
+
|
|
58
|
+
- **Step 3 — Decide**: when tempted to skip an item, treat that temptation as a signal to run Scope Review **before** writing the decision.
|
|
59
|
+
- **Step 4 — Emit**: only emit `omit` when a specific user reply confirms the no-write outcome; otherwise emit `ask_user`.
|
|
60
|
+
- **Step 5 — Self-verify**: no `action: omit` appears without `decided_by: user` and a `rationale` that names the business reason.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Temporal priors and evidence boundary signals
|
|
2
|
+
|
|
3
|
+
Consult this reference when prepare items carry **any** of:
|
|
4
|
+
|
|
5
|
+
- `temporal_prior` / `proposed.source_captured_at` / candidate `source_captured_at` / `last_reconciled_at` / `temporal_disposition`
|
|
6
|
+
- `source_support.evidence_block_candidates[]` or `source_support.evidence_block_*` repair hints
|
|
7
|
+
- prepared long `proposed.content` / `proposed.summary`, especially with command / config / code fence content
|
|
8
|
+
|
|
9
|
+
For prepare items that have none of the above, ignore this file.
|
|
10
|
+
|
|
11
|
+
## Temporal priors — review-only signals
|
|
12
|
+
|
|
13
|
+
Compile prepare items may include:
|
|
14
|
+
|
|
15
|
+
- `proposed.source_captured_at` — when the new evidence was captured.
|
|
16
|
+
- Each candidate's `source_captured_at`, `last_reconciled_at`, and `temporal_disposition` (`stale` / `recent` / `concurrent`).
|
|
17
|
+
- A top-level `temporal_prior` summary.
|
|
18
|
+
|
|
19
|
+
Treat these as **priors that explain context, never as license to act**:
|
|
20
|
+
|
|
21
|
+
- They can justify why an older candidate may be stale relative to new evidence.
|
|
22
|
+
- They **do not** change `default_decision`.
|
|
23
|
+
- They are **never** enough on their own to auto-supersede or auto-merge.
|
|
24
|
+
|
|
25
|
+
If you accept or override a temporal prior, state the business reason in `rationale`. **Do not copy temporal fields into the executable `proposed` patch** — the CLI strips them.
|
|
26
|
+
|
|
27
|
+
## Evidence boundary repair hints
|
|
28
|
+
|
|
29
|
+
When `source_support.verdict` is `weak` or `unsupported` and the prepare item contains:
|
|
30
|
+
|
|
31
|
+
- `source_support.evidence_block_source_ref` — the canonical block-level source_ref the cited claim falls in.
|
|
32
|
+
- `source_support.evidence_block_line_range` — the block's line range.
|
|
33
|
+
- `source_support.evidence_block_locator_id` — the block's locator id.
|
|
34
|
+
- `source_support.evidence_block_candidates[]` — adjacent candidate blocks (optional).
|
|
35
|
+
|
|
36
|
+
These are **repair hints**, not automatic broadening permission. Rules:
|
|
37
|
+
|
|
38
|
+
1. Use the block-level `source_ref` **only when the whole block honestly supports the final claim**. Rerun `context reconcile review` after broadening — review revalidates the new range against workspace raw before apply.
|
|
39
|
+
2. If the proposed summary actually combines several candidate blocks and **no single range honestly supports every sentence**, split the claim into separately supported decisions instead of forcing one unsupported summary through.
|
|
40
|
+
3. Do not invent ranges that include unrelated content just to get the verdict to pass.
|
|
41
|
+
|
|
42
|
+
The support gate exists to prevent orphan claims and false evidence links, not to optimize retrieval. Prefer preserving a precise raw-backed claim over rewriting content into a smoother summary.
|
|
43
|
+
|
|
44
|
+
## Long `proposed.content` / `proposed.summary` preservation
|
|
45
|
+
|
|
46
|
+
When the prepare item carries long `proposed.content` or a `proposed.summary`, treat both as load-bearing:
|
|
47
|
+
|
|
48
|
+
- `content` carries the active Section knowledge, including long-form prose, examples, URLs, tables, commands, config, and code blocks.
|
|
49
|
+
- `summary` is the short reader/query aid for long content.
|
|
50
|
+
- Dropping either field silently loses knowledge or query UX.
|
|
51
|
+
- Preserve prepared `content` and `summary` on executable write decisions (`merge_update`, `supersede.new`, `keep_separate`, `split_then_reanchor` sub-Sections) unless the decision intentionally rewrites the user-facing content.
|
|
52
|
+
- The only legitimate way to clear `summary` is an update-style decision that explicitly emits `summary: null` as the chosen outcome.
|
|
53
|
+
|
|
54
|
+
## Example content preservation repair
|
|
55
|
+
|
|
56
|
+
If review reports that a cited example evidence contains a command / config / code fence missing from `proposed.content`, repair:
|
|
57
|
+
|
|
58
|
+
- **Preferred**: regenerate the decision with the relevant fenced block included in `proposed.content` (preserve language, fences, and exact code).
|
|
59
|
+
- **Fallback only after user confirmation**: keep a prose-only example summary, mark the final decision `decided_by: user` per `references/user-confirmation.md`. Auto mode is not user confirmation.
|
|
60
|
+
|
|
61
|
+
## How this slots into the main procedure
|
|
62
|
+
|
|
63
|
+
- **Step 1 — Consume**: scan prepare items for the signal fields above; flag affected items for the relevant repair path.
|
|
64
|
+
- **Step 3 — Decide**: temporal priors inform `rationale` but never the action choice; evidence-block hints may justify broadening the cited range.
|
|
65
|
+
- **Step 4 — Emit**: rerun `context reconcile review` after broadening ranges or restoring missing example content; only then proceed to apply.
|
|
66
|
+
- **Step 5 — Self-verify**: no executable write strips prepared `content` or `summary`; no temporal field leaks into `proposed`; every broadened `source_ref` has been re-reviewed.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# User confirmation paths
|
|
2
|
+
|
|
3
|
+
Consult this reference when `context reconcile review` returns any of:
|
|
4
|
+
|
|
5
|
+
- `support_confirmation` (weak support questions)
|
|
6
|
+
- `omit_confirmation` (no-write outcome under Scope Review)
|
|
7
|
+
- `scope_review_required` (item set looks miscoped)
|
|
8
|
+
- any other `ask_user` question that needs user input before apply
|
|
9
|
+
|
|
10
|
+
For runs where review emits no questions, ignore this file.
|
|
11
|
+
|
|
12
|
+
## What counts as "user confirmation"
|
|
13
|
+
|
|
14
|
+
Only **explicit user reply to a question your agent asked**. The following are **not** confirmation:
|
|
15
|
+
|
|
16
|
+
- Auto mode being active
|
|
17
|
+
- Delegated mode being active (`--delegated` lets the CLI make scoped low-risk review decisions; it is not user confirmation for a specific question)
|
|
18
|
+
- A blanket "continue" / "yes go ahead" earlier in the session
|
|
19
|
+
- Permission to run shell commands
|
|
20
|
+
- A previous decision applied with `decided_by: user` for a different item
|
|
21
|
+
|
|
22
|
+
If you cannot point at a specific user message answering the specific question for this specific item, **do not emit `decided_by: user`**.
|
|
23
|
+
|
|
24
|
+
## Weak support handling
|
|
25
|
+
|
|
26
|
+
A prepare item is "weakly supported" when hard facts match between `proposed` and `evidence`, but lexical overlap is low. `context reconcile review` flags these and may return `support_confirmation`.
|
|
27
|
+
|
|
28
|
+
Rules:
|
|
29
|
+
|
|
30
|
+
- Weak support is **only** acceptable on `keep_separate`. It is **not** acceptable on `merge_update`, `supersede`, `reanchor`, or `split_then_reanchor` — those overwrite, replace, or move an existing evidence boundary and need stronger backing.
|
|
31
|
+
- When review asks `support_confirmation`, present the business claim and cited evidence to the user in business language. Do not expose `src-N` / Section ids / source refs as the user-facing choice.
|
|
32
|
+
- If the user confirms, regenerate the same executable decision with `decided_by: user` and rerun review. If they decline, choose stricter evidence, broaden the cited range honestly, or leave the item as `ask_user` and stop before apply.
|
|
33
|
+
|
|
34
|
+
## Grouping `support_confirmation`
|
|
35
|
+
|
|
36
|
+
When review provides the **same `group_key`** on several questions that are all ordinary summary / compression checks, group them into one compact confirmation:
|
|
37
|
+
|
|
38
|
+
- One question to the user listing all grouped claims and their cited evidence.
|
|
39
|
+
- If confirmed, emit `decided_by: user` on each grouped decision.
|
|
40
|
+
|
|
41
|
+
**Do not group**:
|
|
42
|
+
|
|
43
|
+
- Questions that introduce new facts (the user is making a fact-level call, not a wording call).
|
|
44
|
+
- Questions where one item has missing hard facts that the others have.
|
|
45
|
+
- Questions whose evidence boundaries differ (different sources / different blocks).
|
|
46
|
+
|
|
47
|
+
When in doubt, ask separately.
|
|
48
|
+
|
|
49
|
+
## `omit_confirmation` and `scope_review_required`
|
|
50
|
+
|
|
51
|
+
These are escape hatches from the omit gate. See `references/scope-review-and-omit.md` for when to emit them.
|
|
52
|
+
|
|
53
|
+
When review returns either as an unresolved `ask_user` item, ask the user, capture the answer, and act:
|
|
54
|
+
|
|
55
|
+
- User confirms no-write → final decision is `action: omit` with `decided_by: user` and a business `rationale`. `omit` is not recorded in the semantic ledger.
|
|
56
|
+
- User declines → revise the item to a concrete write action or to `ask_user` with a sharper question.
|
|
57
|
+
|
|
58
|
+
## Final-decision invariants
|
|
59
|
+
|
|
60
|
+
After user confirmation:
|
|
61
|
+
|
|
62
|
+
- `decided_by` is a **top-level** decision field, not a `proposed` sub-field.
|
|
63
|
+
- Final executable decisions must not carry `user_confirmation.required: true`. That flag belongs only on `action: ask_user` items that still need input.
|
|
64
|
+
- User confirmation permits weak support and omit. It does **not** permit unsupported evidence, missing hard facts, or contradictory claims — those still need stricter evidence or stay `ask_user`.
|
|
65
|
+
- `decided_by: delegated_agent` is reserved for CLI-generated decisions inside a delegated compile workflow. Do not emit it from this skill.
|
|
66
|
+
|
|
67
|
+
## How this slots into the main procedure
|
|
68
|
+
|
|
69
|
+
- **Step 3 — Decide**: keep `support_confirmation` / `omit_confirmation` / `scope_review_required` candidates as `ask_user` with the right `question_type` until the user replies.
|
|
70
|
+
- **Step 4 — Emit**: only after a user reply may you upgrade an `ask_user` to an executable decision with `decided_by: user`.
|
|
71
|
+
- **Step 5 — Self-verify**: every `decided_by: user` corresponds to a specific recent user message; if not, downgrade back to `ask_user`.
|