@c4a/context-cli 0.5.29-alpha.2 → 0.5.29-beta.17
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 +71 -34
- package/cli.js +43511 -20153
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json.template +1 -1
- package/plugin/.codex-plugin/plugin.json.template +8 -5
- package/plugin/.cursor-plugin/plugin.json.template +29 -0
- package/plugin/README.md +127 -0
- package/plugin/README_CN.md +125 -0
- package/plugin/assets/icon.svg +3 -0
- package/plugin/assets/logo.svg +3 -0
- package/plugin/assets/workflow-en.png +0 -0
- package/plugin/assets/workflow.png +0 -0
- package/plugin/commands/align.md +50 -42
- package/plugin/commands/capture.md +27 -11
- package/plugin/commands/compile.md +91 -36
- package/plugin/commands/context.md +7 -4
- package/plugin/commands/drop.md +14 -6
- package/plugin/commands/extract.md +3 -3
- package/plugin/commands/init.md +48 -9
- package/plugin/commands/purge.md +6 -6
- package/plugin/commands/query.md +11 -3
- package/plugin/commands/status.md +4 -2
- package/plugin/skills/skill-align-workflow/SKILL.md +61 -0
- package/plugin/skills/skill-align-workflow/references/candidate-resolution.md +60 -0
- package/plugin/skills/skill-align-workflow/references/density-profile.md +23 -0
- package/plugin/skills/skill-align-workflow/references/gates.md +95 -0
- package/plugin/skills/skill-compile-close/SKILL.md +127 -0
- package/plugin/skills/skill-compile-draft/SKILL.md +409 -0
- package/plugin/skills/skill-context-query/SKILL.md +184 -0
- package/plugin/skills/skill-drop/SKILL.md +190 -0
- package/plugin/skills/skill-semantic-reconcile/SKILL.md +251 -0
- package/scripts/build-plugin.ts +674 -45
- package/templates/aspects/code/aspect.yaml +21 -0
- package/templates/aspects/code/prompt.md +33 -18
- package/templates/aspects/design-system/prompt.md +2 -3
- package/templates/aspects/graphql/prompt.md +2 -2
- package/templates/aspects/openapi/prompt.md +2 -2
- package/plugin/.claude-plugin/plugin.json +0 -16
- package/plugin/.codex-plugin/plugin.json +0 -35
- package/plugin/commands/capture-aspect.md +0 -17
- package/plugin/commands/capture-code.md +0 -25
- package/plugin/skills/align-finalize/SKILL.md +0 -137
- package/plugin/skills/align-propose/SKILL.md +0 -163
- package/plugin/skills/align-scan/SKILL.md +0 -161
- package/plugin/skills/align-scan/references/data-model.md +0 -343
- package/plugin/skills/align-scan/references/user-question-contract.md +0 -159
- package/plugin/skills/compile-close/SKILL.md +0 -122
- package/plugin/skills/compile-draft/SKILL.md +0 -252
- package/plugin/skills/context-query/SKILL.md +0 -166
- package/plugin/skills/drop/SKILL.md +0 -170
- package/plugin/skills/semantic-reconcile/SKILL.md +0 -129
|
@@ -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,251 @@
|
|
|
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
|
+
- Auto mode, long-running authorization, or permission to proceed is not user confirmation. Never use it as a reason to write `decided_by: user`.
|
|
35
|
+
- 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.
|
|
36
|
+
- 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.
|
|
37
|
+
- 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.
|
|
38
|
+
|
|
39
|
+
<reference>
|
|
40
|
+
|
|
41
|
+
## Decision Shape
|
|
42
|
+
|
|
43
|
+
When accepting a prepared `default_decision`, this compact form is valid. Repeat
|
|
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.
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
schema_version: "1.0"
|
|
49
|
+
decisions:
|
|
50
|
+
- item_id: claim-001
|
|
51
|
+
accept_default: true
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For a changed action or a hand-authored decision, emit the full shape:
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
schema_version: "1.0"
|
|
58
|
+
decisions:
|
|
59
|
+
- item_id: claim-001
|
|
60
|
+
relation: near_duplicate
|
|
61
|
+
action: merge_update
|
|
62
|
+
target:
|
|
63
|
+
node: payment-runtime
|
|
64
|
+
section_id: section-3
|
|
65
|
+
proposed:
|
|
66
|
+
content: "Runtime isolation uses sandboxing to avoid state pollution."
|
|
67
|
+
confidence: confirmed
|
|
68
|
+
source_ref: "src-2#runtime L12-14@ab12cd34ef56"
|
|
69
|
+
rationale: "The new evidence clarifies the same claim."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Action Rules
|
|
73
|
+
|
|
74
|
+
| action | Required fields | Validation |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `duplicate_skip` | `target` | Exact duplicate or already-applied no-op only. |
|
|
77
|
+
| `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. |
|
|
78
|
+
| `supersede` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | New Section claim must be supported by cited evidence. |
|
|
79
|
+
| `reanchor` | `target`, `proposed.source_ref`, `proposed.confidence` | Use only when target content is still supported by the new source. |
|
|
80
|
+
| `remove_unsupported` | `target` | Use when no active source supports the target claim in this mode. |
|
|
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@ab12cd34ef56"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Final executable decisions must not carry `user_confirmation.required: true`.
|
|
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.
|
|
198
|
+
|
|
199
|
+
</reference>
|
|
200
|
+
|
|
201
|
+
<procedures>
|
|
202
|
+
|
|
203
|
+
### Step 1 — Consume Prepared Context
|
|
204
|
+
|
|
205
|
+
Use the caller-provided `context reconcile prepare` output. For each item,
|
|
206
|
+
compare `proposed`, `candidates`, `previous_decisions`, and `evidence`.
|
|
207
|
+
|
|
208
|
+
### Step 2 — Reuse Stable Priors
|
|
209
|
+
|
|
210
|
+
If `previous_decisions[]` shows the same boundary and the prepared item still
|
|
211
|
+
matches, emit the same final action. If the target changed, treat the previous
|
|
212
|
+
decision as a prior only and continue judging.
|
|
213
|
+
|
|
214
|
+
### Step 3 — Decide Relation And Action
|
|
215
|
+
|
|
216
|
+
Classify each item:
|
|
217
|
+
|
|
218
|
+
- Exact same claim already active -> `exact_duplicate` + `duplicate_skip`.
|
|
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.
|
|
228
|
+
|
|
229
|
+
### Step 4 — Emit Decisions
|
|
230
|
+
|
|
231
|
+
Emit only executable final decisions plus unresolved `ask_user` questions.
|
|
232
|
+
Do not include prose outside the document.
|
|
233
|
+
|
|
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.
|
|
240
|
+
|
|
241
|
+
### Step 5 — Self-verify
|
|
242
|
+
|
|
243
|
+
- [ ] Every decision uses canonical relation/action values. If not, **Step 3**.
|
|
244
|
+
- [ ] No `no-op` action appears. If not, **Step 3**.
|
|
245
|
+
- [ ] Every write action has the required fields from [Action Rules](#action-rules). If not, **Step 4**.
|
|
246
|
+
- [ ] No automatic `omit` appears. If any item is being skipped without proof, run Scope Review or ask the user.
|
|
247
|
+
- [ ] Prepared `proposed.detail` is preserved on executable write decisions. If not, **Step 4**.
|
|
248
|
+
- [ ] `decided_by: user` appears only after the user explicitly confirmed a review question. If not, remove it and ask the user.
|
|
249
|
+
- [ ] No workspace files were read or written directly. If violated, restart from **Step 1**.
|
|
250
|
+
|
|
251
|
+
</procedures>
|