@c4a/context-cli 0.5.29-alpha.1 → 0.5.29-beta.16

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.
Files changed (49) hide show
  1. package/README.md +71 -34
  2. package/cli.js +39951 -15792
  3. package/package.json +1 -1
  4. package/plugin/.claude-plugin/plugin.json.template +1 -1
  5. package/plugin/.codex-plugin/plugin.json.template +8 -5
  6. package/plugin/.cursor-plugin/plugin.json.template +29 -0
  7. package/plugin/README.md +99 -0
  8. package/plugin/README_CN.md +97 -0
  9. package/plugin/assets/icon.svg +3 -0
  10. package/plugin/assets/logo.svg +3 -0
  11. package/plugin/commands/align.md +44 -44
  12. package/plugin/commands/capture.md +28 -12
  13. package/plugin/commands/compile.md +97 -34
  14. package/plugin/commands/context.md +7 -4
  15. package/plugin/commands/drop.md +14 -6
  16. package/plugin/commands/extract.md +4 -4
  17. package/plugin/commands/init.md +49 -10
  18. package/plugin/commands/purge.md +8 -4
  19. package/plugin/commands/query.md +11 -3
  20. package/plugin/commands/status.md +4 -2
  21. package/plugin/skills/skill-align-workflow/SKILL.md +55 -0
  22. package/plugin/skills/skill-align-workflow/references/candidate-resolution.md +60 -0
  23. package/plugin/skills/skill-align-workflow/references/density-profile.md +23 -0
  24. package/plugin/skills/skill-align-workflow/references/gates.md +95 -0
  25. package/plugin/skills/skill-compile-close/SKILL.md +127 -0
  26. package/plugin/skills/skill-compile-draft/SKILL.md +409 -0
  27. package/plugin/skills/skill-context-query/SKILL.md +184 -0
  28. package/plugin/skills/skill-drop/SKILL.md +190 -0
  29. package/plugin/skills/skill-semantic-reconcile/SKILL.md +249 -0
  30. package/scripts/build-plugin.ts +674 -45
  31. package/templates/aspects/code/aspect.yaml +21 -0
  32. package/templates/aspects/code/prompt.md +33 -18
  33. package/templates/aspects/design-system/prompt.md +2 -3
  34. package/templates/aspects/graphql/prompt.md +2 -2
  35. package/templates/aspects/openapi/prompt.md +2 -2
  36. package/plugin/.claude-plugin/plugin.json +0 -16
  37. package/plugin/.codex-plugin/plugin.json +0 -35
  38. package/plugin/commands/capture-aspect.md +0 -17
  39. package/plugin/commands/capture-code.md +0 -25
  40. package/plugin/skills/align-finalize/SKILL.md +0 -137
  41. package/plugin/skills/align-propose/SKILL.md +0 -142
  42. package/plugin/skills/align-scan/SKILL.md +0 -161
  43. package/plugin/skills/align-scan/references/data-model.md +0 -343
  44. package/plugin/skills/align-scan/references/user-question-contract.md +0 -155
  45. package/plugin/skills/compile-close/SKILL.md +0 -122
  46. package/plugin/skills/compile-draft/SKILL.md +0 -246
  47. package/plugin/skills/context-query/SKILL.md +0 -166
  48. package/plugin/skills/drop/SKILL.md +0 -163
  49. package/plugin/skills/semantic-reconcile/SKILL.md +0 -106
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: skill-drop
3
+ description: >
4
+ Packaged skill invoked by `/context:drop`; not a user slash command. Source retraction through CLI-owned planning and application. The agent
5
+ calls `context drop --plan` for a structured impact plan, presents the
6
+ user-facing summary for confirmation, runs semantic reconciliation when the
7
+ plan archives affected Sections, then calls `context drop --apply-plan` so
8
+ the CLI archives raw and removed knowledge, cleans active knowledge, applies
9
+ source alias reindexing, source stamp, changelog append, consumes the current
10
+ ready immutable review when semantic decisions are required, writes the
11
+ semantic ledger, and runs verify.
12
+ Activates when `/context:drop` is invoked with a source-id or URL.
13
+ tools:
14
+ - Bash
15
+ ---
16
+
17
+ # skill-drop — retract a source without losing the audit trail
18
+
19
+ Ask the CLI for a structured cleanup plan, confirm the user-visible impact,
20
+ run semantic reconciliation on affected knowledge items when required, then ask
21
+ the CLI to apply the plan. Do not inspect or mutate workspace files directly.
22
+
23
+ ## TL;DR — Non-negotiables
24
+
25
+ - Plan + semantic prepare/review + apply are CLI-owned. The agent only presents the plan, asks semantic questions when required, and waits for confirmation.
26
+ - Drop removes affected raw / unsupported knowledge from the active workspace and keeps a CLI-managed restorable archive for audit.
27
+ - Do not Read / Glob / Grep / Write workspace storage; all impact analysis and mutation must go through `context drop --plan`, `context reconcile prepare --mode drop`, `context reconcile review`, and `context drop --apply-plan`.
28
+ - Do not use Python, Node.js, shell scripts, `ls`, `find`, `rg`, `cat`, or similar ad-hoc commands to inspect or preprocess workspace storage or temporary workflow artifacts.
29
+ - `context drop --plan <source-id|url> --format json` resolves source-id, computes affected topics / knowledge items, reports alias reindex impact, and stores the exact plan as the current workflow's `drop-plan` payload. `--save-output` is only for an explicit human-readable scratch copy; do not use it as a handoff.
30
+ - `context drop --apply-plan --reason "<text>" --yes` reads the current workflow `drop-plan` payload, archives affected active content, consumes the current workflow's ready immutable review when the plan archives Sections, removes unsupported Sections / empty Nodes from active knowledge, applies source alias reindexing, writes the source stamp, changelog append, semantic ledger when decisions exist, and verify. Do not pass plan or decisions files to drop apply.
31
+ - User confirmation required unless `--yes` was passed; abort on any non-`y` answer without writing. `--yes` does not skip semantic `ask_user` questions.
32
+ - Confirmation prose describes affected topics and claims, not source-ref mechanics.
33
+ - Source evidence, section, and verify rule meanings stay anchored to the CLI plan, reconcile, and verify outputs.
34
+ - Output language: impact plan + report match the user's language; CLI commands, flag names, source-ids, comment attributes stay English.
35
+
36
+ <reference>
37
+
38
+ ## Plan fields
39
+
40
+ The JSON plan has:
41
+
42
+ | Field | Meaning |
43
+ |---|---|
44
+ | `source_id` | Canonical source id resolved from user input |
45
+ | `resolved_from.kind` | `source-id` or `url` for the production Agent flow |
46
+ | `affected_nodes[]` | Topics whose source list contains the dropped source |
47
+ | `affected_nodes[].sections[]` | Knowledge items that require semantic reconciliation before the source is dropped |
48
+ | `affected_nodes[].reindex_sections[]` | Knowledge items whose internal source alias will be renumbered after the source is removed |
49
+ | `affected_nodes[].will_be_sourceless` | Topic has no remaining source ids after cleanup |
50
+ | `affected_nodes[].will_be_empty` | Topic has no remaining Section/body/children/contains after cleanup and may be archived even if another source id remains |
51
+ | `affected_graph_edges[]` | Explicit graph edges that will be removed if one endpoint is archived by apply |
52
+ | `references_will_be_pruned[]` | Surviving Sections whose `refers_to_nodes[]` will lose archived node slugs; the Section itself is not removed |
53
+ | `summary` | Counts for confirmation and changelog |
54
+
55
+ If a non-domain Node would keep an active source id but lose all of its own Sections while still carrying child Nodes, contains links, or body text, do not rely on verify to catch it after mutation. Produce a semantic reanchor/split decision that preserves a supported Section, or expect `drop --apply-plan` to reject before writing.
56
+
57
+ ## User-facing impact summary shape
58
+
59
+ ```
60
+ Affected: N topics · M knowledge items
61
+
62
+ <topic title>
63
+ "short claim preview" → remove from active knowledge and archive
64
+ "short claim preview" → keep, supported by another source document
65
+ <topic title>
66
+ "short claim preview" → remove from active knowledge and archive
67
+
68
+ Proceed? [y/N]
69
+ ```
70
+
71
+ Keep the internal node slug, Section id, and source-ref patch data in your
72
+ working notes for Step 4; show them only if the user asks for implementation
73
+ details.
74
+
75
+ ## CLI shapes
76
+
77
+ ```
78
+ context drop --plan <source-id|url> --format json
79
+ context reconcile prepare --mode drop --format json
80
+ context reconcile review --prepare-digest <prepare-digest> --decisions - --view status
81
+ context drop --apply-plan --reason "<text>" --yes
82
+ ```
83
+
84
+ The apply command writes a source-specific restorable archive,
85
+ moves affected raw out of the active source set, consumes the current workflow's ready immutable review for
86
+ reanchor / remove_unsupported / split_then_reanchor when affected Sections are archived, removes unsupported
87
+ Sections / empty Nodes from active knowledge, flips the source registry entry to
88
+ `status: dropped`, stamps `drop_reason`, `dropped_at`, and a semantic archive status,
89
+ appends a `[drop]` changelog line, records the semantic ledger when decisions exist,
90
+ and runs verify. It exits
91
+ non-zero if the source-id is unknown, already dropped, plan shape is invalid,
92
+ the plan is stale, semantic decisions are unresolved/invalid, or verify reports errors.
93
+ In drop mode, `remove_unsupported` means physical removal from active knowledge
94
+ after the archive captures the before snapshot; compile/refresh apply uses the
95
+ same action name for Section deprecation.
96
+
97
+ </reference>
98
+
99
+ <procedures>
100
+
101
+ ### Step 1 — Parse arguments
102
+
103
+ From `$ARGUMENTS`: `<source-id|url>` (required), `--reason <text>` (optional), `--yes` (optional). If the target is missing, stop and ask for the source id or URL. If the reason is missing but the user's wording gives a clear reason, infer a concise reason such as `用户主动撤回`; otherwise collect it before Step 4.
104
+
105
+ ### Step 2 — Ask CLI for a plan
106
+
107
+ Run `context drop --plan <source-id|url> --format json`.
108
+ The CLI stores the plan in the current workflow and prints the plan JSON for
109
+ the impact summary. Use `--save-output` only when the user explicitly wants a
110
+ readable copy; it is not a workflow input.
111
+ Do not inspect workspace files yourself. If the CLI reports source-not-found or
112
+ source-already-dropped, relay the error and stop.
113
+
114
+ ### Step 3 — Present the impact plan
115
+
116
+ Render the [User-facing impact summary shape](#user-facing-impact-summary-shape)
117
+ from the plan JSON in the user's language. Make clear that dropping a source
118
+ removes listed content from active knowledge but keeps it restorable until
119
+ `context purge`. Mention conditional graph edge cleanup when
120
+ `affected_graph_edges[]` is non-empty; these edges are removed only if the
121
+ endpoint leaves active knowledge after reconciliation. Include the reason that will be stamped; if
122
+ it is still unknown, ask for the reason before continuing. If `--yes`, log
123
+ "auto-confirmed per --yes" and continue. Otherwise wait for `y`; abort on
124
+ anything else without writing.
125
+
126
+ ### Step 4 — Reconcile affected knowledge
127
+
128
+ If the plan summary has `archive_sections: 0`, skip semantic reconcile and continue to Step 5. The apply path is review-free only for this no-op archive case.
129
+
130
+ Use the current workflow plan created by Step 2. Do not pass a plan file. Then run:
131
+
132
+ ```
133
+ context reconcile prepare --mode drop --format json
134
+ ```
135
+
136
+ Invoke the packaged semantic reconcile procedure with that prepare payload. Use
137
+ stdout `workflow_payload.digest` as `<prepare-digest>`.
138
+ Pass the semantic reconcile decision document directly to review, preferably
139
+ through stdin:
140
+
141
+ ```
142
+ context reconcile review --prepare-digest <prepare-digest> --decisions - --view status
143
+ ```
144
+
145
+ The review command persists the ready immutable review artifact for the current
146
+ drop workflow scope when `ready_to_apply: true`. Do not extract
147
+ `apply_document`, and do not pass the decisions file to drop apply.
148
+ If review returns any `questions[]`, ask the user and convert those decisions
149
+ from `ask_user` into one of `reanchor`, `remove_unsupported`, or
150
+ `split_then_reanchor` before continuing. Do not let `--yes` bypass this step.
151
+ Weak evidence support is not a drop safety bypass: `reanchor` and
152
+ `split_then_reanchor` still need clearly supported surviving evidence. If
153
+ review cannot confirm that support, choose `remove_unsupported` or stop for
154
+ user input instead of forcing a weak reanchor.
155
+
156
+ ### Step 5 — Apply the plan
157
+
158
+ Use the current workflow plan from Step 2. If Step 4 ran semantic review, make
159
+ sure the latest `context reconcile review` result returned `ready_to_apply:
160
+ true`; the CLI will load that ready review artifact itself. Then call:
161
+
162
+ ```
163
+ context drop --apply-plan --reason "<text>" --yes
164
+ ```
165
+
166
+ Do not call `context mdrive section ...` or `context mdrive node ...` for the
167
+ standard drop flow; `drop --apply-plan` owns cleanup, ledger write when
168
+ decisions exist, and verify. If the CLI rejects for missing ready review, rerun
169
+ Step 4 and then retry apply without changing the apply command shape.
170
+
171
+ ### Step 6 — Report
172
+
173
+ The apply command already verifies. Run `context source get <source-id>` and
174
+ report in the user's language: topics affected, knowledge items marked
175
+ archived/removed from active knowledge, source alias reindex count, archive
176
+ status, changelog timestamp.
177
+
178
+ ### Step 7 — Self-verify
179
+
180
+ - [ ] No Read / Glob / Grep / Write was used against workspace storage — if any was used, restart from **Step 2** with CLI-only flow.
181
+ - [ ] No ad-hoc script or shell file traversal was used against workspace storage or temporary workflow artifacts — if any was used, restart from **Step 2** with CLI-only flow.
182
+ - [ ] `context drop --plan` succeeded before asking the user — if not, **Step 2**.
183
+ - [ ] `context reconcile prepare --mode drop` read the current workflow drop-plan payload — if not, **Step 2**.
184
+ - [ ] `context reconcile review` returned zero `questions[]` before apply; if any question remains, ask the user and regenerate the decisions document.
185
+ - [ ] User confirmed unless `--yes` was passed — if not, abort without writing.
186
+ - [ ] `context drop --apply-plan` exited 0 — if not, surface the CLI error and stop.
187
+ - [ ] `context source get <source-id>` shows the source as dropped — if not, surface the mismatch.
188
+ - [ ] The reported source entry includes semantic archive status when the source was archived — if missing, surface the mismatch.
189
+
190
+ </procedures>
@@ -0,0 +1,249 @@
1
+ ---
2
+ name: skill-semantic-reconcile
3
+ description: >
4
+ Packaged skill invoked by `/context:compile` and `/context:drop`; not a user slash command. Consumes only
5
+ `context reconcile prepare` output, judges semantic relation/action for each
6
+ item, and emits a schema_version 1.0 semantic decision document for
7
+ `context reconcile review`; apply consumes the current workflow's ready review
8
+ artifact.
9
+ tools:
10
+ - Bash
11
+ ---
12
+
13
+ # skill-semantic-reconcile — decide Section reconciliation
14
+
15
+ Judge duplicate, merge, conflict, reanchor, and unsupported cases from the
16
+ CLI-prepared context. Emit decisions only; the CLI performs every write.
17
+
18
+ ## TL;DR — Non-negotiables
19
+
20
+ - Input is only the full `context reconcile prepare` payload. Do not Read, Glob, Grep, or Write workspace `raw/`, `knowledge/`, `archive/`, or `decisions/`.
21
+ - Compact prepare summaries and `--view issues` payloads are inspection aids, not enough for semantic decisions. If the caller provided compact `context compile --draft ... --prepare` stdout, use its `workflow_payload.digest` and `scope_id` to load the full payload with `context workflow show --payload prepare --scope <scope-id> --digest <digest> --unwrap --format json` before deciding.
22
+ - Do not use Python, Node.js, shell, or other ad-hoc scripts to preprocess, filter, summarize, or inspect ReconcileContext. Consume the prepared context and review output directly; temporary files are only CLI input/output handoff points.
23
+ - Output exactly one YAML or JSON document with `schema_version: "1.0"` and `decisions[]`.
24
+ - Source refs, Section kinds, mount rules, and verify terms follow the CLI schema, prepare payload, and verify output.
25
+ - Use canonical relations: `exact_duplicate`, `strong_equivalent`, `near_duplicate`, `complement`, `supersedes`, `conflicts`, `reanchor`, `unsupported`, `keep_separate`, `ask_user`.
26
+ - Use canonical actions: `duplicate_skip`, `merge_update`, `supersede`, `reanchor`, `remove_unsupported`, `keep_separate`, `split_then_reanchor`, `omit`, `ask_user`.
27
+ - If prepare returns `items: []`, no semantic decision is needed; the caller may skip review/apply or pass `decisions: []` as an explicit no-op. If items exist and one includes `default_decision`, accepting it still requires one compact decision object for that exact `item_id` with `accept_default: true` and optional `decided_by` / `rationale`; `context reconcile review` hydrates the prepared `target` and `proposed` fields. Do not send `decisions: []` to accept defaults. `--accept-safe-defaults` only auto-accepts mechanically safe no-candidate supported writes and reviewed-no-write skips; when review is required, accept an appropriate complement/keep_separate default with `{ item_id, accept_default: true }` instead of echoing the full object. If you change the action, include the fields required by the table below.
28
+ - Never use `omit` as an automatic escape hatch. If an item looks redundant, low-value, or non-knowledge, run the Scope Review pass below first. If it is still unclear, emit `ask_user`; only a user-confirmed no-write outcome may become `action: omit` with `decided_by: user`.
29
+ - `no-op` is not a decision action. For unchanged refresh items, emit no decision or `duplicate_skip`. For compile draft `skip` items that already carry a `source_ref`, the CLI may produce a safe reviewed-no-write default; accept it with `accept_default: true` or `--accept-safe-defaults` instead of asking the user.
30
+ - Never expose `src-N`, Section ids, or source refs as the user-facing choice. They may appear only in the structured payload.
31
+ - `merge_update` is legal only when the final Section content is supported by one valid `source_ref`; otherwise use `keep_separate`, `split_then_reanchor`, or `ask_user`.
32
+ - Unresolved conflicts and low-confidence support questions must be `action: ask_user`.
33
+ - `context reconcile review` may return `support_confirmation` for a weakly supported `keep_separate`. Ask the user. If review provides the same `group_key` on several ordinary summary/compression questions, group them into one compact confirmation; do not group missing hard facts, new facts, or different evidence boundaries. If the user confirms, emit the same final write actions with `decided_by: user`; do not apply an `ask_user` decision.
34
+ - If review returns `context-only-leakage-high`, stop before apply and follow its `agent_hints[]`: use `rewrite_with_owned_basis` only when owned or shared-primary citation evidence can support the same claim, `skip_for_node` when no citation-eligible basis exists and the claim is not core to that Node, or `pending_ownership_challenge` when a context-only or secondary shared block should be upgraded into owned/shared-primary evidence.
35
+ - The caller applies a ready review by running plain `context reconcile apply` against the current workflow scope. Apply has no input-file path; do not extract `apply_document` with scripts.
36
+ - Stable output: preserve prepared item order, keep decision object fields in the documented order, omit empty optional fields, and do not add current timestamps, random ids, storage paths, or host absolute paths. The fixed protocol and action table come first; only the prepared context should vary between repeated review calls.
37
+
38
+ <reference>
39
+
40
+ ## Decision Shape
41
+
42
+ When accepting a prepared `default_decision`, this compact form is valid. Repeat
43
+ one entry per accepted `item_id`; an empty `decisions: []` document is only a
44
+ no-op when prepare returned zero items and does not accept defaults.
45
+
46
+ ```yaml
47
+ schema_version: "1.0"
48
+ decisions:
49
+ - item_id: claim-001
50
+ accept_default: true
51
+ ```
52
+
53
+ For a changed action or a hand-authored decision, emit the full shape:
54
+
55
+ ```yaml
56
+ schema_version: "1.0"
57
+ decisions:
58
+ - item_id: claim-001
59
+ relation: near_duplicate
60
+ action: merge_update
61
+ target:
62
+ node: payment-runtime
63
+ section_id: section-3
64
+ proposed:
65
+ content: "Runtime isolation uses sandboxing to avoid state pollution."
66
+ confidence: confirmed
67
+ source_ref: "src-2#runtime L12-14@ab12cd34ef56"
68
+ rationale: "The new evidence clarifies the same claim."
69
+ ```
70
+
71
+ ## Action Rules
72
+
73
+ | action | Required fields | Validation |
74
+ |---|---|---|
75
+ | `duplicate_skip` | `target` | Exact duplicate or already-applied no-op only. |
76
+ | `merge_update` | `target`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | Final content must be supported by cited evidence; `proposed.kind`, when present, must match target kind. |
77
+ | `supersede` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | New Section claim must be supported by cited evidence. |
78
+ | `reanchor` | `target`, `proposed.source_ref`, `proposed.confidence` | Use only when target content is still supported by the new source. |
79
+ | `remove_unsupported` | `target` | Use when no active source supports the target claim in this mode. |
80
+ | `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`). |
81
+ | `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. |
82
+ | `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. |
83
+ | `ask_user` | `user_confirmation.required: true` | Use only when business meaning or support cannot be decided from prepared evidence. |
84
+
85
+ For `merge_update`, `supersede`, `keep_separate`, and
86
+ `split_then_reanchor`, the final Section content must be supported by the cited
87
+ evidence in `proposed.source_ref` / `proposed.source_refs`. Final executable decisions must
88
+ include `proposed.source_ref`; review can hydrate a missing `source_ref` from
89
+ the current prepare item only when the decision is still the same prepared
90
+ claim. If you changed the content, kind, or evidence selection, rerun
91
+ `context reconcile prepare` instead of reusing an old prepare file. Content
92
+ should retain the raw evidence's key domain terms,
93
+ numbers, code literals, and named entities. Do not introduce acronyms,
94
+ abbreviations, translations, or aliases that the cited evidence does not
95
+ contain or define; use the raw wording, split the claim, or ask the user instead.
96
+ Do not turn sparse raw evidence into a broad summary, and do not cite a title, `Relations`, `Parent`,
97
+ `Children`, or `Related` navigation line as the only support for a substantive
98
+ claim.
99
+
100
+ Preserve prepared `proposed.detail` exactly when it is present. `detail` carries
101
+ long-form prose, examples, and code blocks; dropping it silently loses
102
+ knowledge. If you intentionally want to remove detail from an existing Section,
103
+ emit `detail: null` only on an update-style decision where that clearing is the
104
+ chosen outcome.
105
+
106
+ If review returns `example_detail_preservation`, the cited example evidence
107
+ contains a command / config / code fence that was not preserved in
108
+ `proposed.detail`. Prefer regenerating the decision with the relevant fenced
109
+ block in `proposed.detail`; only keep a prose-only example summary after asking
110
+ the user and marking the final decision `decided_by: user`.
111
+
112
+ The support gate exists to prevent orphan claims and false evidence links, not
113
+ to optimize retrieval. Prefer preserving a precise raw-backed claim over
114
+ rewriting content into a smoother summary. If a useful reader summary would
115
+ combine adjacent evidence, first broaden `proposed.source_ref` so the cited
116
+ range covers every sentence. If one range cannot honestly support the final
117
+ claim, split the claim or ask the user instead of forcing it into an incorrect
118
+ `source_ref`.
119
+
120
+ Prepared items may include `source_support.evidence_block_source_ref`,
121
+ `source_support.evidence_block_line_range`, and
122
+ `source_support.evidence_block_locator_id`, plus optional
123
+ `source_support.evidence_block_candidates[]`. These are repair hints for
124
+ evidence boundaries, not automatic permission to broaden. Use the block-level
125
+ `source_ref` only when that whole block honestly supports the final claim, then
126
+ rerun `context reconcile review`; review revalidates the changed range against
127
+ the workspace raw before apply. If a proposed summary actually combines several
128
+ candidate blocks and no single range honestly supports every sentence, split it
129
+ into separately supported claims instead of keeping one unsupported summary.
130
+
131
+ Prepared compile items may include `temporal_prior`, proposed
132
+ `source_captured_at`, and candidate `source_captured_at` /
133
+ `last_reconciled_at` / `temporal_disposition`. Treat these as review priors
134
+ only. They can explain why an older candidate may be stale relative to the new
135
+ evidence, but they do not change `default_decision` and they are never enough
136
+ to auto-supersede or auto-merge. If you accept or override a temporal prior,
137
+ state the business reason in `rationale`; do not copy temporal fields into the
138
+ executable `proposed` patch.
139
+
140
+ Weak support means hard facts match but the ordinary lexical overlap is low.
141
+ It is acceptable only for a user-confirmed `keep_separate` summary. It is not
142
+ acceptable for `merge_update`, `supersede`, `reanchor`, or
143
+ `split_then_reanchor`, because those actions overwrite, replace, or move an
144
+ existing evidence boundary. When review asks `support_confirmation`, present
145
+ the business claim and cited evidence to the user. If questions share the same
146
+ review `group_key`, you may ask one compact grouped question; otherwise ask
147
+ separately. If confirmed, regenerate the same executable decision with
148
+ `decided_by: user`; if not confirmed, choose stricter evidence or leave an
149
+ `ask_user` item unresolved and stop before apply. User confirmation only
150
+ permits weak support; it does not permit unsupported evidence or missing hard
151
+ facts.
152
+
153
+ `decided_by` is a top-level decision field, not a `proposed` field:
154
+
155
+ ```yaml
156
+ schema_version: "1.0"
157
+ decisions:
158
+ - item_id: claim-008
159
+ relation: complement
160
+ action: keep_separate
161
+ decided_by: user
162
+ target:
163
+ node: runtime-kit
164
+ proposed:
165
+ kind: example
166
+ content: "The host app maps remote modules through the runtime config."
167
+ source_ref: "src-1#example L32-40@ab12cd34ef56"
168
+ ```
169
+
170
+ Final executable decisions must not carry `user_confirmation.required: true`.
171
+ Use that flag only on `action: ask_user` items that still require user input.
172
+
173
+ If you are tempted to omit an item, do not emit `omit` immediately. First run a
174
+ Scope Review pass over the full prepared context and the current draft
175
+ decisions:
176
+
177
+ - If the item is covered by another decision in the same batch, convert it to a
178
+ precise executable action such as `duplicate_skip` and explain the covered-by
179
+ item in `rationale`.
180
+ - If the item should be merged into another write action, revise that write
181
+ action instead of dropping the item silently.
182
+ - If the item is low-value/non-knowledge but you cannot prove that from the
183
+ prepared context, emit `ask_user` with `question_type: omit_confirmation` and
184
+ a business-language prompt.
185
+ - If several items look low-value or the Node boundary/draft scope looks wrong,
186
+ emit `ask_user` with `question_type: scope_review_required` and stop before
187
+ apply.
188
+ - Only after the user confirms a no-write outcome may you emit `action: omit`
189
+ with `decided_by: user`. `omit` is not recorded in the semantic ledger.
190
+
191
+ `remove_unsupported` has mode-specific write behavior. In compile/refresh
192
+ apply it deprecates the target Section so the unsupported claim remains visible
193
+ as inactive history. In drop apply it physically removes the Section from active
194
+ knowledge after the CLI-managed archive captures the pre-drop snapshot. Use the
195
+ same action only when this mode-specific outcome is intended.
196
+
197
+ </reference>
198
+
199
+ <procedures>
200
+
201
+ ### Step 1 — Consume Prepared Context
202
+
203
+ Use the caller-provided `context reconcile prepare` output. For each item,
204
+ compare `proposed`, `candidates`, `previous_decisions`, and `evidence`.
205
+
206
+ ### Step 2 — Reuse Stable Priors
207
+
208
+ If `previous_decisions[]` shows the same boundary and the prepared item still
209
+ matches, emit the same final action. If the target changed, treat the previous
210
+ decision as a prior only and continue judging.
211
+
212
+ ### Step 3 — Decide Relation And Action
213
+
214
+ Classify each item:
215
+
216
+ - Exact same claim already active -> `exact_duplicate` + `duplicate_skip`.
217
+ - Same claim with a raw-supported correction or refinement from one supporting source -> `strong_equivalent` or `near_duplicate` + `merge_update`.
218
+ - Additional but separate boundary -> `complement` + `keep_separate`.
219
+ - 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.
220
+ - New material replaces old rule -> `supersedes` + `supersede`.
221
+ - Direct contradiction -> `conflicts` + `ask_user`.
222
+ - Drop item still fully supported elsewhere -> `reanchor` + `reanchor`.
223
+ - Drop item partly supported -> `reanchor` + `split_then_reanchor`.
224
+ - No surviving support -> `unsupported` + `remove_unsupported`.
225
+ - 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.
226
+
227
+ ### Step 4 — Emit Decisions
228
+
229
+ Emit only executable final decisions plus unresolved `ask_user` questions.
230
+ Do not include prose outside the document.
231
+
232
+ If the latest review rejected the batch with `context-only-leakage-high`, do
233
+ not convert it into a generic `ask_user`. Regenerate the affected decision using
234
+ one of the review hint's explicit repair options and cited item ids, then rerun
235
+ `context reconcile review`. A context-only block may provide background only; it
236
+ must not become the support basis for a written Section unless ownership is
237
+ challenged and upgraded by the workflow.
238
+
239
+ ### Step 5 — Self-verify
240
+
241
+ - [ ] Every decision uses canonical relation/action values. If not, **Step 3**.
242
+ - [ ] No `no-op` action appears. If not, **Step 3**.
243
+ - [ ] Every write action has the required fields from [Action Rules](#action-rules). If not, **Step 4**.
244
+ - [ ] No automatic `omit` appears. If any item is being skipped without proof, run Scope Review or ask the user.
245
+ - [ ] Prepared `proposed.detail` is preserved on executable write decisions. If not, **Step 4**.
246
+ - [ ] `decided_by: user` appears only after the user explicitly confirmed a review question. If not, remove it and ask the user.
247
+ - [ ] No workspace files were read or written directly. If violated, restart from **Step 1**.
248
+
249
+ </procedures>