@c4a/context-cli 0.5.36-beta.1 → 0.5.38
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/cli.js +10094 -3891
- package/package.json +2 -1
- package/plugin/README.md +1 -1
- package/plugin/README_CN.md +1 -1
- package/plugin/commands/align.md +3 -0
- package/plugin/commands/capture.md +7 -5
- package/plugin/commands/compile.md +14 -4
- package/plugin/commands/init.md +11 -12
- package/plugin/commands/status.md +2 -0
- package/plugin/skills/skill-align-workflow/SKILL.md +4 -1
- package/plugin/skills/skill-compile-close/SKILL.md +5 -3
- package/plugin/skills/skill-compile-draft/SKILL.md +27 -12
- package/plugin/skills/skill-compile-draft/references/notes.md +3 -3
- package/plugin/skills/skill-compile-draft/references/refresh-and-update.md +5 -5
- package/plugin/skills/skill-compile-judge/SKILL.md +2 -1
- package/plugin/skills/skill-semantic-reconcile/SKILL.md +4 -4
- package/templates/aspect-runtime/aspectRunnerSdk.ts +749 -0
- package/templates/aspects/README.md +515 -0
- package/templates/aspects/code/aspect.yaml +2 -2
- package/templates/aspects/code/prompt.md +13 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c4a/context-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"context": "./cli.js"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"react": "^18.3.1",
|
|
13
13
|
"remark-gfm": "^4.0.1",
|
|
14
14
|
"remark-parse": "^11.0.0",
|
|
15
|
+
"typescript": "^5.5.4",
|
|
15
16
|
"unified": "^11.0.5",
|
|
16
17
|
"yaml": "^2.5.1"
|
|
17
18
|
},
|
package/plugin/README.md
CHANGED
|
@@ -67,7 +67,7 @@ From your project directory:
|
|
|
67
67
|
|
|
68
68
|
1. **Init** — `/context:init` creates the `.context/` workspace;
|
|
69
69
|
2. **Capture** — `/context:capture <url-or-path>` pulls in Feishu docs, local Markdown, code snapshots, and so on;
|
|
70
|
-
3. **Code projection** — for code snapshots, `/context:compile code <source-slug>` materializes package/category/symbol Nodes such as `pkg`, `pkg/components`, and `pkg/symbol/button`;
|
|
70
|
+
3. **Code projection** — for code snapshots, `/context:compile --aspect code <source-slug>` materializes package/category/symbol Nodes such as `pkg`, `pkg/components`, and `pkg/symbol/button`;
|
|
71
71
|
4. **Align** — `/context:align` places prose material onto the Node structure, including docs or examples that should attach to existing code symbol Nodes;
|
|
72
72
|
5. **Compile** — `/context:compile` lets the AI turn prose material into structured Sections;
|
|
73
73
|
6. **Query** — `/context:query <question>` answers from local knowledge, citing Node and Section; code workspaces can filter mixed evidence with `--evidence code|prose|all`;
|
package/plugin/README_CN.md
CHANGED
|
@@ -67,7 +67,7 @@ bun add -g @c4a/context-cli
|
|
|
67
67
|
|
|
68
68
|
1. **初始化** — `/context:init` 创建 `.context/` 工作目录;
|
|
69
69
|
2. **采集** — `/context:capture <url-or-path>` 拉取飞书文档、本地 Markdown、代码快照等原始资料;
|
|
70
|
-
3. **代码投影** — 对代码快照执行 `/context:compile code <source-slug>`,生成 `pkg`、`pkg/components`、`pkg/symbol/button` 这类 package/category/symbol Node;
|
|
70
|
+
3. **代码投影** — 对代码快照执行 `/context:compile --aspect code <source-slug>`,生成 `pkg`、`pkg/components`、`pkg/symbol/button` 这类 package/category/symbol Node;
|
|
71
71
|
4. **对齐** — `/context:align` 将文档原料归位至 Node 结构,包括挂靠到已有 code symbol Node 的手册、示例和经验;
|
|
72
72
|
5. **编译** — `/context:compile` 由 AI 将文档原料加工为结构化 Section;
|
|
73
73
|
6. **检索** — `/context:query <问题>` 在本地知识中查询答案,返回 Node 与 Section 级引用;代码工作区可用 `--evidence code|prose|all` 区分代码证据和文档证据;
|
package/plugin/commands/align.md
CHANGED
|
@@ -37,6 +37,8 @@ Run the expected view commands from the envelope. For additional reads, use only
|
|
|
37
37
|
|
|
38
38
|
When a view returns `page.next_command`, follow that command to continue the same semantic view. Use `--source`, `--heading`, `--window`, or `--token-budget` only as view filters; do not inspect workflow files, cache files, host tool-results, or stdout fragments with generic tools.
|
|
39
39
|
|
|
40
|
+
If a blocks view returns `align-blocks-read-incomplete`, `page.has_more`, or `truncated: true`, the response is a partial read. Do not finalize broad ownership or dense planned Sections from source-mapping/headings alone; follow `page.next_command` or the `how_to_explore[]` source full-read / expand-budget command first, then decide whether the remaining evidence needs sections or can stay context-only.
|
|
41
|
+
|
|
40
42
|
### Step 3 — Produce The Semantic Payload
|
|
41
43
|
|
|
42
44
|
Reuse existing knowledge before inventing new Nodes: use `context mdrive glossary match <name>` and `context mdrive node list --format json` for term/entity reuse.
|
|
@@ -46,6 +48,7 @@ Apply packaged `context:skill-align-workflow` Node classification gates and stru
|
|
|
46
48
|
Use CLI diagnostics instead of static prompt rules:
|
|
47
49
|
|
|
48
50
|
- `diagnostics.automatic_ownership_adjustments[]` explains mechanical external-reference demotions and the explicit ownership override shape.
|
|
51
|
+
- `pending-relation-refs` lists explicit Parent/Children/Related markdown links. Reuse existing target Nodes when present; keep unresolved target slug hints deferred instead of writing dangling `contains_parent`.
|
|
49
52
|
- Validation diagnostics identify contiguity, citation eligibility, ownership, and mount-matrix problems.
|
|
50
53
|
- `views[]` and `diagnostics` distinguish citable evidence from supporting context; do not infer citation eligibility from raw ownership prose.
|
|
51
54
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Capture URLs, local Markdown, source code, stdin path lists, inbox/refresh sources, or conversation notes as Context sources."
|
|
3
|
-
argument-hint: "[url | ./path.md [./more.md...] | --code [paths...] | --stdin | --inbox | --refresh | note]"
|
|
3
|
+
argument-hint: "[url | ./path.md [./more.md...] | --code [paths...] | --aspect <name...> | --stdin | --inbox | --refresh | note]"
|
|
4
4
|
allowed-tools: Bash(context:*, bun:*, brew:*, curl:*, sh:*, scoop:*, choco:*, lark-cli:*), WebFetch
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -30,6 +30,7 @@ Invocation note: code capture does not run through `npx`. `context capture --cod
|
|
|
30
30
|
- `$ARGUMENTS` contains `--refresh` → `context capture --refresh`. This refreshes active Feishu URL sources and local Markdown sources whose stored origin file still exists; code sources use `context capture --code`.
|
|
31
31
|
- User asks for code capture with explicit `--module` flags → run `context capture --code $ARGUMENTS`, preserving code flags such as `--module`, `--version`, `--version-from`, and `--no-runner-cache`.
|
|
32
32
|
- User asks to refresh/re-capture an already configured code source → run `context capture --code` unless the user explicitly wants to change package selection or version flags. The CLI reuses stored `capture_config`, appends a new snapshot only when code/version content changes, and never overwrites prior snapshots.
|
|
33
|
+
- User asks to run a configured custom aspect capture → run `context capture --aspect <name...> --format json`. Do not use `context capture --aspect code`; code capture remains `context capture --code` because it owns target path, `--module`, version, and runner-cache flags.
|
|
33
34
|
- User provides one or more code target paths, or asks for code capture without explicit `--module` flags → run `context capture --code $ARGUMENTS --format json` directly. The CLI preflights every target first; if any target is ambiguous it returns candidates without writing, otherwise it captures all selected code targets serially.
|
|
34
35
|
- If the CLI returns candidate packages, ask the user which package paths to capture.
|
|
35
36
|
- Then run `context capture --code <original-target-if-present>` with one repeated `--module <path>` for every selected package. The CLI derives and stores path filtering silently from that selection.
|
|
@@ -58,11 +59,12 @@ Do not pipe the heredoc through another command, and do not discover files with
|
|
|
58
59
|
Report the CLI output verbatim. If the CLI reports `N sources changed`, suggest the right next step:
|
|
59
60
|
|
|
60
61
|
- Run `context status --format json` and use its `next_step.command` / `workflow.next_step`.
|
|
62
|
+
- If JSON status reports `incremental.pending_align.status: "pending"` with `count > 0`, suggest `/context:align` even when a previous finalized align workflow or prose `workflow.next_step` says compile. Newly captured structure work must be routed through align before compile.
|
|
61
63
|
- If status says aligned knowledge is missing or alignment is required → suggest `/context:align`.
|
|
62
64
|
- If status says compile work is pending for Markdown / evidence-backed knowledge → suggest `/context:compile`. Mention `/context:align` only if the user wants to revise the structure.
|
|
63
|
-
- If the capture was code-only and status reports pending code projection, suggest the CLI-owned code route:
|
|
65
|
+
- If the capture was code-only and status reports pending code projection, suggest the CLI-owned code route: `context compile --aspect code <source-slug>`, followed by `context compile close` when the CLI asks for close.
|
|
64
66
|
|
|
65
|
-
Never suggest prose compile or hand-built code knowledge for a code-only source. Code snapshots become active knowledge only through `context compile code`, which materializes package/category/symbol Nodes deterministically.
|
|
67
|
+
Never suggest prose compile or hand-built code knowledge for a code-only source. Code snapshots become active knowledge only through `context compile --aspect code`, which materializes package/category/symbol Nodes deterministically.
|
|
66
68
|
|
|
67
69
|
If capture is rejected with `agent_hints[].code = "workflow-cross-family-rejected"`, do **not** run `context workflow abandon ...` automatically. First run or ask the user to run `context workflow status --format json` and explain that another workflow is active in this workspace. Continue that workflow when it is the intended task; ask the user before abandoning it when the user wants to discard that in-progress work. If the user expected a different repository/workspace, change to the confirmed workspace root before retrying capture.
|
|
68
70
|
|
|
@@ -75,7 +77,7 @@ Stable structure:
|
|
|
75
77
|
1. Completion headline. Single line with the action verb plus core counts: how many sources were captured this round, broken down by `new` / `updated` / `unchanged`. Capture data from `context capture ... --format json` `result.summary` (or per-source statuses when no aggregate is returned).
|
|
76
78
|
2. Per-source list grouped by status. Show each captured source under one of three groups (`new` / `updated` / `unchanged`); within each group list the document title (`source.title`), kind label, and a short delta indicator for updated sources (for example added/removed line counts when the CLI returns them; otherwise "content changed"). Cache-hit code packages belong in `unchanged`. Omit groups that are empty.
|
|
77
79
|
3. Pending workflow signals. When `context status --view summary --format json` reports follow-up work tied to this capture (sources pending align, sources pending compile, refreshed sources pending recompile, code sources pending projection), summarize each as a single line naming the work and which sources are affected. Omit the section entirely when there is no pending follow-up.
|
|
78
|
-
4. Next step. Single command suggestion driven by status: `/context:align` when structure work is pending, `/context:compile` when prose compile work is pending, `context compile code <slug>`
|
|
80
|
+
4. Next step. Single command suggestion driven by status: `/context:align` when structure work is pending, `/context:compile` when prose compile work is pending, `context compile --aspect code <slug>` when code projection is pending, or `context compile --aspect <name>` when a custom aspect projection is pending. If nothing is pending, say so explicitly.
|
|
79
81
|
|
|
80
82
|
Do not include raw CLI diagnostics, agent_hints content, schema names, or workflow payload identifiers in the report. Those belong in earlier troubleshooting output, not in the completion summary.
|
|
81
83
|
|
|
@@ -105,5 +107,5 @@ Your prose to the user follows the user's conversation language. CLI commands, f
|
|
|
105
107
|
- In `--format json`, code capture runner cache state is authoritative in `result.runner.cacheMode`: `prepared` means a workspace runner was prepared, `cached` means workspace cache hit, and `bypass` means `--no-runner-cache` used a temporary runner directory instead of the workspace runner cache.
|
|
106
108
|
- Aspect snapshots default to `evidence.mode: none`. Prose-like custom aspects must opt in with `evidence: { mode: block }` in `aspects/<name>/aspect.yaml` before they generate evidence manifests. Invalid `evidence.mode` values are reported as `evidence-policy-invalid`; they are not silently treated as `none`.
|
|
107
109
|
- Code aspect snapshots ship with `evidence.mode: none`; symbols/files/edges are indexed inside the code bucket. Do not ask users to inspect or repair a code `.evidence` manifest.
|
|
108
|
-
- Code aspect capture writes raw code snapshots first. Materialize them with `context compile code <slug>` (or no slug for all actionable code sources) before prose align needs to attach documentation to code Nodes.
|
|
110
|
+
- Code aspect capture writes raw code snapshots first. Materialize them with `context compile --aspect code <slug>` (or no slug for all actionable code sources) before prose align needs to attach documentation to code Nodes.
|
|
109
111
|
- On duplicate capture of the same URL: identical `content_hash` → CLI skips with `unchanged`; different hash → CLI appends a new snapshot.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Compile the confirmed align plan into source-linked knowledge through CLI-guided workflow steps."
|
|
3
|
-
argument-hint: "[--plan
|
|
3
|
+
argument-hint: "[--plan|--aspect code [slug]|--aspect <name>|--all]"
|
|
4
4
|
allowed-tools: Bash(context:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -18,7 +18,9 @@ Naming convention:
|
|
|
18
18
|
|
|
19
19
|
- **Default** — follow `context compile scan --format json` and the returned `next_action` until compile is closed or no work remains.
|
|
20
20
|
- **`--plan`** — validate per-Node draft changes without closing or writing active knowledge; stop after the planned changes are reported.
|
|
21
|
-
-
|
|
21
|
+
- **`--aspect code [selector]`** — run `context compile --aspect code [selector]`, report the CLI result, and stop unless the CLI asks for a follow-up close. The selector may be omitted to process all actionable code sources; when present, the CLI resolves source slug, package name, or module path.
|
|
22
|
+
- **`--aspect <name>`** — run deterministic custom aspect projection for one configured aspect. Use `context compile --aspect <name> --allow-large-deprecate` only when the CLI rejected a large deprecate and the user confirms the runner output is intentionally empty or reduced.
|
|
23
|
+
- **`--all`** — run `context compile --all` to materialize code projection first and then custom aspect projections in deterministic order.
|
|
22
24
|
- **Delegated** — add `--delegated` only when the user explicitly authorized delegated/automatic mode at the start of this conversation. Do not infer it from vague "continue" permission.
|
|
23
25
|
|
|
24
26
|
### Core Rules
|
|
@@ -42,15 +44,21 @@ Protocol discovery:
|
|
|
42
44
|
3. Run `context compile scan --format json` (or `context compile scan --delegated --format json` only for explicit delegated mode).
|
|
43
45
|
4. If the scan returns `stop_noop` or no changed work, report that compile stopped before draft and no files were written.
|
|
44
46
|
|
|
47
|
+
Run `context compile scan` only for this initial preflight unless the CLI explicitly returns it as the next command after a terminal/no-work state. During an active compile workflow, discover the next node from the current envelope (`next_action`, `views[]`, `workset_progress`) and follow returned commands; do not rerun scan between node cycles to probe for the next node.
|
|
48
|
+
|
|
45
49
|
## Main Loop
|
|
46
50
|
|
|
47
51
|
Repeat until the CLI returns `stop_noop`, `close_compile` succeeds, or a blocking user question remains.
|
|
48
52
|
|
|
53
|
+
Carry the latest envelope forward between iterations. After a successful node cycle, continue from its returned `next_action.command` / `workset_progress` rather than restarting at `context compile scan`.
|
|
54
|
+
|
|
49
55
|
### Step 1 — Read Expected Views
|
|
50
56
|
|
|
51
57
|
Run expected view commands from the envelope before writing. For compile evidence, prefer the CLI-returned source-ref/scaffold views. They may expose:
|
|
52
58
|
|
|
53
|
-
- `
|
|
59
|
+
- `source_refs_index_command` / `source_refs_command` — compact block-id evidence index for drafting; use `items[].block_id` in `source_block_ids[]`.
|
|
60
|
+
- `source_refs_detail_command` — detailed source refs with quote previews; open only when the compact index is not enough.
|
|
61
|
+
- `citable_source_refs[]` — detailed-view refs eligible for draft citations; prefer `block_id` values in `source_block_ids[]`.
|
|
54
62
|
- `supporting_context_refs[]` — background/framing only.
|
|
55
63
|
- `required_preserved_literals[]` — URL, code identifier, `source_ref`, or `block_id` literals that must stay visible in the generated content or repair report.
|
|
56
64
|
- diagnostics such as citation eligibility, source support, coverage, engagement, and advisory foldbacks.
|
|
@@ -78,6 +86,8 @@ Use typed diagnostics as the repair contract:
|
|
|
78
86
|
- `reason_code`, `path`, and `missing[]` identify what to fix.
|
|
79
87
|
- `diagnostics.auto_repaired[]` records mechanical repairs; warning severity must be surfaced in the final report.
|
|
80
88
|
- `diagnostics.warnings[]` with info/advisory severity are not write blockers unless `blocking: true` or the next action says so.
|
|
89
|
+
- `agent_recommended_action` classifies warning handling: `ignore` means continue unless the user asks for cleanup, `respond_optional` means repair only when semantically useful, and `respond_required` means resolve before the returned write action can succeed.
|
|
90
|
+
- `source_support` is advisory lexical diagnostics, not a keyword gate. Do not patch drafts only to satisfy term overlap. Blocking evidence checks should come from invalid source refs, changed evidence boundaries, URL preservation, split-by-evidence candidates, or explicit top-level `next_action`.
|
|
81
91
|
- stale prepare refresh returns `review_reconcile_decisions` with `reason_code: "prepare_refreshed"`; reread the new prepare result before reviewing.
|
|
82
92
|
|
|
83
93
|
Do not recover by replaying an old manual path, editing rendered files, or guessing schema aliases.
|
|
@@ -86,4 +96,4 @@ Do not recover by replaying an old manual path, editing rendered files, or guess
|
|
|
86
96
|
|
|
87
97
|
When `next_action.kind` is `close_compile`, execute `context compile close` through packaged `context:skill-compile-close` or the returned command. Never claim success unless close exits 0 and verify is green, except the explicit no-work path.
|
|
88
98
|
|
|
89
|
-
Report in the user's conversation language. Include semantic apply counts, close/verify status, warning-level `auto_repaired[]`, and before/after workspace totals. Do not surface internal workflow payload digests, source-ref hashes, archive paths, or absolute file paths unless a user-facing report view explicitly returns them.
|
|
99
|
+
Report in the user's conversation language. Include semantic apply counts, close/verify status, warning-level `auto_repaired[]`, `ready_with_debt` coverage/review-debt summaries when present, and before/after workspace totals. Do not surface internal workflow payload digests, source-ref hashes, archive paths, or absolute file paths unless a user-facing report view explicitly returns them.
|
package/plugin/commands/init.md
CHANGED
|
@@ -87,28 +87,27 @@ If the user request names specific aspects, map that directly:
|
|
|
87
87
|
- "all aspects" / "全部 aspect" → append `--with-all-aspects`
|
|
88
88
|
- "no aspects" / "不安装 aspect" / "minimal" → append `--no-aspects`
|
|
89
89
|
|
|
90
|
-
Otherwise ask **one**
|
|
90
|
+
Otherwise ask **one** short single-choice question. Keep the option count to three or fewer; host question tools reject longer option lists. Use the host's free-text `Other` escape hatch when the user needs a custom comma-separated aspect list.
|
|
91
91
|
|
|
92
92
|
```
|
|
93
|
-
Q. Which aspects should be installed?
|
|
94
|
-
A.
|
|
95
|
-
B.
|
|
96
|
-
C.
|
|
97
|
-
D. openapi — placeholder aspect template.
|
|
98
|
-
E. graphql — placeholder aspect template.
|
|
93
|
+
Q. Which aspects should be installed?
|
|
94
|
+
A. code — scripted local source-code capture. (Recommended)
|
|
95
|
+
B. all built-in aspects — code, design-system, openapi, graphql.
|
|
96
|
+
C. skip — install no aspects now; add later with `context init --with-aspects <name>`.
|
|
99
97
|
```
|
|
100
98
|
|
|
101
99
|
Hard rules when mapping into the host UI:
|
|
102
100
|
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
101
|
+
- Do not present separate options for every built-in aspect; that exceeds host option limits once `skip` is included.
|
|
102
|
+
- Put `code` first and mark it as recommended.
|
|
103
|
+
- Treat the host auto-injected `Other` as a free-text custom list such as `code,openapi`, not as "skip".
|
|
106
104
|
|
|
107
105
|
Map the answer:
|
|
108
106
|
|
|
107
|
+
- `code` selected → append `--with-aspects code`.
|
|
108
|
+
- `all built-in aspects` selected → append `--with-all-aspects`.
|
|
109
109
|
- `skip` selected → append `--no-aspects`.
|
|
110
|
-
-
|
|
111
|
-
- Host auto-injected `Other` selected → ignore it, fall back to the recommended default `--with-aspects code`.
|
|
110
|
+
- Host auto-injected `Other` selected → parse the user's comma-separated aspect names and append `--with-aspects <names>`. If the custom text is empty or invalid, ask once for clarification rather than silently installing all aspects.
|
|
112
111
|
|
|
113
112
|
Do not silently install all aspects when the user asked for a code-only workspace.
|
|
114
113
|
|
|
@@ -11,8 +11,10 @@ Run `context status` from the active workspace root only. `status` is intentiona
|
|
|
11
11
|
Surface the CLI's output verbatim — its trailing suggestions are already actionable. Do not invent additional suggestions; the CLI decides what to recommend based on the workspace state. Typical recommendations you will see:
|
|
12
12
|
|
|
13
13
|
- Run `/context:align` when there is active raw material but no align plan yet (compile's Stage 1 prerequisite).
|
|
14
|
+
- Run `/context:align` when JSON status reports `incremental.pending_align.status: "pending"` with `count > 0`. This structural signal takes precedence over a previous finalized align workflow's compile hint.
|
|
14
15
|
- Run `/context:compile` when align plan exists and raw is newer than the last compile.
|
|
15
16
|
- Run `/context:capture --code` when the repo is a git checkout but no source-code snapshot has been captured yet.
|
|
17
|
+
- Run `context compile --aspect code` when code projection is pending, or `context compile --aspect <name>` when a custom aspect projection is pending. JSON status includes `aspect_projection` and `code_projection` summaries for these deterministic paths.
|
|
16
18
|
|
|
17
19
|
Recent CLI output may include `incremental.cache_status`, `incremental.pending_align`, and `incremental.pending_compile`. Surface those fields verbatim. If the user asks what they mean, explain that they show the local incremental cache health and queued align/compile work; cache warnings are informational unless the CLI output includes a blocking error or an explicit next action.
|
|
18
20
|
|
|
@@ -20,6 +20,7 @@ Run `context align scan --format json`, read expected evidence views, produce se
|
|
|
20
20
|
- Existing knowledge is the lookup registry. Use `context mdrive glossary match <name>` and `context mdrive node list --format json`; do not read `knowledge/**` or create a separate registry file.
|
|
21
21
|
- Code projection Nodes are reusable knowledge handles. When document evidence belongs on a code symbol, reuse the code slug instead of creating a parallel document Node.
|
|
22
22
|
- `diagnostics.automatic_ownership_adjustments[]` and validation diagnostics are the mechanical external-reference ownership source of truth. Independent reference definitions, pure URLs, relation kind blocks, and multiline reference-only lists default to context_only; submit an explicit `block_ownership[]` owned/shared entry only when such a reference block is primary citation evidence.
|
|
23
|
+
- When `pending-relation-refs` is present, inspect it before finalizing graph structure. Use existing matches for `contains_parent_ref` or `domain_gate.child_refs`; keep unresolved target slug hints deferred and do not write dangling parent or edge refs.
|
|
23
24
|
- `views[]` and diagnostics distinguish citable evidence from supporting context. Do not promote supporting/context-only material into cited Sections unless a later ownership correction makes it citation-eligible.
|
|
24
25
|
- Keep cache-friendly prompt order: fixed protocol/schema first, existing knowledge lookup second, source evidence views third, current semantic payload last. Preserve CLI JSON order and do not add timestamps, random ids, scratch paths, or host paths to generated payloads.
|
|
25
26
|
- Node type, tag, fake-Entity, `domain`, and `action` gates are in `references/gates.md`.
|
|
@@ -44,6 +45,8 @@ Run `views[].command` entries marked `expected: true` before writing. Use additi
|
|
|
44
45
|
|
|
45
46
|
Read evidence through semantic CLI views, not shell parsing. Follow `page.next_command` for pagination. Use `--source`, `--heading`, `--window`, and `--token-budget` as view filters only. `--unwrap` removes workflow metadata; it does not expand a compact view into full detail.
|
|
46
47
|
|
|
48
|
+
If a blocks view returns `align-blocks-read-incomplete`, `page.has_more`, or `truncated: true`, treat that response as a partial read. Do not finalize source-wide ownership or dense planned Sections from source-mapping/headings alone; follow `page.next_command` or the `how_to_explore[]` source full-read / expand-budget command first, then decide whether to write, split, or leave evidence as context.
|
|
49
|
+
|
|
47
50
|
### Step 3 — Reuse Existing Knowledge
|
|
48
51
|
|
|
49
52
|
Query existing knowledge for reusable names before proposing new term/service/system/action Nodes. Exact title/slug/alias hits should usually become references to the existing Node, not duplicate candidates.
|
|
@@ -62,7 +65,7 @@ For large or batched payloads, use `references/density-profile.md` and `referenc
|
|
|
62
65
|
|
|
63
66
|
Use `next_action.input_schema` or the matching `context schema <name> --view minimal --format json` output to shape the payload.
|
|
64
67
|
|
|
65
|
-
For `submit_structure_decision`, produce one structure-decision document with finalized Nodes, document edges, planned Sections, and ownership. Keep only source-supported semantic decisions in the payload; leave mechanical repair and patch routing to CLI diagnostics.
|
|
68
|
+
For `submit_structure_decision`, produce one structure-decision document with finalized Nodes, document edges, planned Sections, and ownership. Planned Sections must carry the strongest source-backed `section_kind` that fits the current schema priority chain; do not plan an entire dense source as `description` when the evidence clearly contains examples, comparison tables, Q&A, decisions, specs, warnings, or principles. Keep only source-supported semantic decisions in the payload; leave mechanical repair and patch routing to CLI diagnostics.
|
|
66
69
|
|
|
67
70
|
For coarse-read, candidate-op, patch, ownership, or rescan actions, follow the command and schema in the returned `next_action`. Do not carry old candidate-table, decision-patch, or full-tree payload shapes forward.
|
|
68
71
|
|
|
@@ -30,9 +30,11 @@ command. It does not hand-edit rendered knowledge.
|
|
|
30
30
|
- Content / Section issues (`invalid-section-mount`, `body-ad-hoc-heading`, `dangling-source-alias`) → user re-runs `/context:compile` (draft loop fixes its own Section actions; the close stage does not patch)
|
|
31
31
|
- Structural issues (`contains-cycle`, `edge-dangling-node`, `duplicate-slug`, `invalid-node-type`, `domain-same-file-child`) → user runs `/context:align` to revise the plan
|
|
32
32
|
- Source issues (`dropped-source-reference`) → user runs `/context:drop <id>` to complete the drop
|
|
33
|
-
- Exit 0 → summarise node/section totals, verify, `recompiled`, `locator_updates`, `rebuilt`, fingerprint rebuild count, archive status / archived file count, and any `ready_with_debt` coverage warnings when printed
|
|
33
|
+
- Exit 0 → summarise node/section totals, verify, `recompiled`, `locator_updates`, `rebuilt`, fingerprint rebuild count, archive status / archived file count, and any `ready_with_debt` coverage warnings when printed. If the close receipt reports severely low coverage, surface the returned `--cover-uncovered-only` command as the recommended repair before treating the debt as accepted.
|
|
34
34
|
- Exit 2 → report the full issue list verbatim + point at the right re-entry command above. Do not hand-open the affected rendered article.
|
|
35
|
-
- Coverage warnings are CLI-owned diagnostics. `ready_with_debt` means close succeeded and unresolved coverage remains visible; report the warning and follow returned coverage view commands / `available_actions[]` only if the user chooses a repair or skip round.
|
|
35
|
+
- Coverage warnings are CLI-owned diagnostics. `ready_with_debt` means close succeeded and unresolved coverage remains visible. For severely low coverage, recommend one `--cover-uncovered-only` repair pass unless the user explicitly accepts the debt; otherwise report the warning and follow returned coverage view commands / `available_actions[]` only if the user chooses a repair or skip round.
|
|
36
|
+
- Coverage and engagement denominators count primary citable content evidence. URL/reference-only, marker, frontmatter, embed, navigation, and context-only evidence is excluded or bucketed as non-blocking bookkeeping by the CLI.
|
|
37
|
+
- User-accepted hard-fact risk is carried as `review_debt`; report it from close/status when present, but do not treat review-debt count as a close failure.
|
|
36
38
|
- Materialized knowledge means either a CLI-written knowledge article, or an explicit no-write placeholder from align: `planned_sections: []` plus source/context/graph support. A compile skip action records reviewed evidence, but it does not by itself materialize an arbitrary finalized Node.
|
|
37
39
|
- Never re-run `context compile draft` from close to paper over verify failures. Draft failures belong in the draft loop.
|
|
38
40
|
- Do not use Python, Node.js, shell scripts, `ls`, `find`, `rg`, `cat`, or similar ad-hoc commands to inspect `WORKSPACE_DIR`, `.context`, knowledge files, or `/tmp` workflow artifacts.
|
|
@@ -63,7 +65,7 @@ Close is one in-process command with one exit code:
|
|
|
63
65
|
| Outcome | Agent action |
|
|
64
66
|
|---|---|
|
|
65
67
|
| Exit 0, 0 issues | Summarise those counts in the user's language: Nodes touched; Sections added / updated / superseded / deprecated / skipped; `recompiled`; `locator_updates`; `rebuilt`; verify green. Stop. |
|
|
66
|
-
| Exit 0, warnings only | Summarise + list warnings verbatim. For coverage
|
|
68
|
+
| Exit 0, warnings only | Summarise + list warnings verbatim. For severely low coverage, recommend the CLI-returned `--cover-uncovered-only` repair command before final acceptance; for other coverage warnings, surface returned coverage view commands / `available_actions[]` instead of inventing a local decision matrix. |
|
|
67
69
|
| Exit 2, Section / content issue | Surface the full issue list; point the user at re-running `/context:compile` (the draft loop owns Section writes). Do NOT Edit the affected rendered article. |
|
|
68
70
|
| Exit 2, `compile-close-finalized-node-missing-knowledge` | If the missing Node has real citation evidence, point the user at `/context:compile` for that Node. If it is intentionally navigation-only or placeholder-only, point the user at `/context:align` to make it explicit no-write with `planned_sections: []` and context-only/ignored relation or placeholder blocks. |
|
|
69
71
|
| Exit 2, structural issue (cycle, duplicate slug, `invalid-node-type`, `domain-same-file-child`) | Surface the full issue list; point the user at `/context:align` to revise structure. Do not re-run compile. |
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
Packaged skill invoked by `/context:compile`; not a user slash command. For one Node at a time, reads
|
|
5
5
|
the CLI-provided `NodeContext` (planned metadata, raw snippets, and
|
|
6
6
|
existing Sections if any), classifies every raw fragment into a Section
|
|
7
|
-
kind via the priority chain, writes `content` + optional `summary` + `
|
|
7
|
+
kind via the priority chain, writes `content` + optional `summary` + `source_block_ids[]`,
|
|
8
8
|
and emits a compile draft JSON document for the caller to submit to the current envelope's
|
|
9
9
|
`next_action.command`.
|
|
10
10
|
Activates when `/context:compile` iterates across the confirmed align plan.
|
|
@@ -18,19 +18,21 @@ Classify raw evidence for one Node into `add` / `skip` (and on refresh: `update`
|
|
|
18
18
|
|
|
19
19
|
## TL;DR — Non-negotiables
|
|
20
20
|
|
|
21
|
-
- One Node per invocation — `
|
|
21
|
+
- One Node per invocation — `node_slug` MUST equal `node.slug`; no cross-Node writes. Finish the current Node's draft quality checks before the caller moves to another Node's review/apply loop.
|
|
22
22
|
- Agent emits JSON only; no markdown, no direct workspace file writes. The caller submits the JSON to the current envelope's `next_action.command`; the CLI validates and stores workflow payloads.
|
|
23
|
-
- Evidence boundary: treat the CLI-provided NodeContext and evidence views as complete. Cite only
|
|
23
|
+
- Evidence boundary: treat the CLI-provided NodeContext and evidence views as complete. Cite only block ids surfaced as citation-eligible in `source-refs-index` `items[]`, `citable_source_refs[]`, or `raw_snippet_indexes.citation_eligible`; treat `supporting_context_refs[]`, `context_only`, and secondary-shared snippets as background. `request_full_text` may expose visible text for inspection through the narrow text view (`context compile context <slug> --request-full-text <block_id> --view text --format json`), and it does not change citation eligibility. If supporting/context-only evidence is needed as a citation, emit `pending_ownership_challenge` or `structure_challenge` — see [references/structural-challenges.md](references/structural-challenges.md). Never `grep` / `sed` / `jq` / `cat` / `head` raw `--format json` stdout or workflow scratch files in `/tmp` or `.context/.cache/`; use semantic views and follow returned `next_command` / `how_to_explore[]`. For write commands that take `--payload-digest`, omit the flag unless the CLI explicitly asks for a stale guard.
|
|
24
24
|
- Actions are candidate write actions, not final semantic decisions; `context reconcile prepare` re-derives near-duplicate / conflict / merge relations from `candidates[]` on its own. Op naming is scoped by schema: compile-draft `actions[]` already targets Sections, so Section lifecycle ops are verb-only (`add`, `update`, `supersede`, `deprecate`, `skip`). Do not use align-style names such as `add_section`, `write_section`, or `propose_section`.
|
|
25
25
|
- Source support passing is not completion. Before emitting, estimate coverage from the provided `raw_snippets[]`: if there are 3+ citation-eligible snippets, a one-action draft is valid only when the later snippets are duplicates, navigation, placeholders, or continuations of the same fact. Small dense docs still need multiple actions when later snippets state distinct capabilities, constraints, examples, risks, FAQ, or usage notes. Large manuals/design docs should compile to several orthogonal actions in the same draft. Do not switch into "speed mode" because the first action validates; coverage is part of the draft task.
|
|
26
26
|
- Pick `kind` from the CLI's `context schema compile-draft` contract, especially `section_kind_priority` and the mount matrix. First matching form wins. A `decision` needs at least two surfaced alternatives plus a reason; bare "we use X because Y" is `spec`. Reach `description` only after every more specific kind fails.
|
|
27
27
|
- `node.planned_sections[]` is an align-time scaffold hint, not a hard completion gate. Prefer a planned kind when the evidence fits; if a source-backed stronger kind differs, emit it and let the CLI warning guide review.
|
|
28
28
|
- `kind × node.type` must satisfy the CLI Section mount matrix; mismatches get rejected at write time. When the strongest kind is blocked by mount matrix, fall to the next legal kind whose form actually fits — do not collapse to `description` just because it mounts everywhere, and do not invent thin precision (e.g. one-line `spec`) just to avoid `description` either. See [Description anti-abuse gates](#description-anti-abuse-gates) for the classification checks at the description boundary.
|
|
29
|
-
- Every write action cites raw via `
|
|
29
|
+
- Every write action cites raw via `source_block_ids[]` from `source-refs-index` `items[].block_id` or `citable_source_refs[].block_id`; the CLI expands it to canonical `source_refs[]` before saving. Use explicit `source_refs[]` only when the CLI gives no block id for the needed citation. Never mix both fields in one action, fabricate ids, or cite navigation-only blocks as evidence for a content Section.
|
|
30
|
+
- For large source-ref views, prefer the returned `source_refs_index_command` / `source_refs_command` / `--view source-refs-index` when you only need block ids; open `source_refs_detail_command` only when you need quote preview or explicit `source_refs[]`.
|
|
30
31
|
- Use `content` for the Section text the reader should see. It may be long and may contain URLs, tables, commands, config, or code fences. Add `summary` for long content or when it helps readers/query output; omit it when content is short. Summary quality checks are warning hints only, not schema or evidence failures. The CLI rejects retired fields (`body`, `detail`, `raw`, singular `source_ref`, quoted-evidence) with canonical repair hints — read those hints rather than memorising the blacklist. Omit optional fields when empty.
|
|
32
|
+
- Preserve user-facing Markdown structure from cited raw when it carries meaning: inline code/code fences, Markdown links and URLs, blockquotes, list nesting, tables, and emphasis around key terms. Summary remains plain text; content may keep raw Markdown when that is the clearest faithful Section text.
|
|
31
33
|
- Preserve literals required by the CLI. When source-refs or scaffold output lists `required_preserved_literals[]`, keep those URL, code identifier, `source_ref`, or `block_id` literals visible in the relevant `content`, `summary`, skip reason, or repair challenge. Do not rely on memorized URL rules; let CLI literal fields and citation diagnostics define what must be preserved.
|
|
32
34
|
- `refers_to_nodes[]` only carries slugs present in the context's glossary, existing Sections, or the current align plan; never invent one.
|
|
33
|
-
- `skip` is the honest default when raw adds nothing. Bare `skip` (no
|
|
35
|
+
- `skip` is the honest default when raw adds nothing. Bare `skip` (no evidence) is only for deterministic no-ops such as unchanged input, pure navigation, or context-only/background snippets. When a citation-eligible snippet was reviewed and intentionally not written, emit `skip` with `source_block_ids[]` from `source-refs-index` `items[].block_id` or `citable_source_refs[].block_id` so semantic review can record `reviewed_no_write`. Never attach `context_only` / supporting block ids to skip; raise a challenge if they should become citation evidence.
|
|
34
36
|
- Any Node may legitimately compile to no Sections when the provided snippets contain only navigation (`Parent` / `Children` / `Related` / `Relations`) or placeholder text that explicitly says no detailed content is available. Emit `skip`; do not turn align summaries, parent/child lists, sibling links, or placeholders into `description` Sections. The align graph and Node metadata preserve structure; active Sections need citation-eligible content.
|
|
35
37
|
- FAQ collections attach to the most specific finalized Node (Entity → Action → Domain fallback); never create a standalone FAQ container.
|
|
36
38
|
- Output language: Node-facing summaries and user-facing draft explanations follow `NodeContext.generation_policy.language` when present; otherwise match the raw material. Section `summary` may follow either the workspace language or the source-bound `content` language; do not rewrite it only to switch languages. Draft `content` is source-bound: prefer the cited source language when it differs from the workspace language, and do not translate quoted English facts into Chinese just to satisfy workspace language. Preserve product names, code identifiers, CLI flags, slugs, `block_id` / `source_ref` tokens, and exact quoted evidence as printed. Kind / confidence / identifier fields stay English.
|
|
@@ -57,17 +59,27 @@ Boundary recap (rules not captured by the schema enums):
|
|
|
57
59
|
|
|
58
60
|
- `mentions[]` are raw positions that named this Node; `raw_snippets[]` are the wider context blocks around those positions, or the changed raw blocks selected by `context compile scan`. These two arrays are the evidence floor — never reach outside them.
|
|
59
61
|
- `node.sources[]` are the only sources that may be cited as `src-N`. `node.context_sources[]` contribute `raw_snippets[]` for comparison or background only and must not be cited unless the CLI has also placed that source in `node.sources[]`.
|
|
60
|
-
- `source_id` is the source registry id (e.g. `local:billing`); `src-N` aliases only appear inside `source_ref` strings
|
|
62
|
+
- `source_id` is the source registry id (e.g. `local:billing`); `src-N` aliases only appear inside `source_ref` strings. Prefer `source-refs-index` `items[].block_id` or `citable_source_refs[].block_id` in draft `source_block_ids[]`; if you must use explicit `source_refs[]`, copy `raw_snippets[].source_ref` verbatim.
|
|
61
63
|
|
|
62
64
|
## Output — Compile Draft JSON (main path)
|
|
63
65
|
|
|
64
66
|
Canonical shape: `context schema compile-draft --format yaml` (or `--format json`). The CLI is the source of truth for fields, enums, and validation — do not memorise the shape from this file.
|
|
65
67
|
|
|
66
|
-
Main-path ops are **`add`** and **`skip`**. A typical new Section action is `{ op: "add", kind: "<chain-picked>", content: "...",
|
|
68
|
+
Main-path ops are **`add`** and **`skip`**. A typical new Section action is `{ op: "add", kind: "<chain-picked>", content: "...", source_block_ids: ["<block_id>"] }`; never spell that as `add_section` because the `actions[]` array already names the target object. A bare skip is `{ op: "skip", reason: "..." }`; a reviewed-no-write skip carries `source_block_ids[]` only from citation-eligible `source-refs-index` `items[].block_id` or `citable_source_refs[].block_id`.
|
|
69
|
+
|
|
70
|
+
Minimal valid draft envelope:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"schema_version": "compile.draft.v2",
|
|
75
|
+
"node_slug": "<matches node.slug>",
|
|
76
|
+
"actions": []
|
|
77
|
+
}
|
|
78
|
+
```
|
|
67
79
|
|
|
68
80
|
`update` / `supersede` / `deprecate` ops live in [references/refresh-and-update.md](references/refresh-and-update.md). `structure_challenge` / `pending_ownership_challenge` ops live in [references/structural-challenges.md](references/structural-challenges.md). Do not emit them from the main path.
|
|
69
81
|
|
|
70
|
-
`
|
|
82
|
+
`source_block_ids[]` is a mechanical shorthand over the same citation-eligible evidence; a single citation is still a single-element array. When one Section summarises contiguous multi-block evidence, list only the block ids the `content` actually consumes. If using explicit `source_refs[]`, copy them verbatim from `raw_snippets[].source_ref`. If the CLI reports `compile-source-refs-auto-narrowed`, it safely reduced an over-wide citation; removed refs are still uncovered, so add separate actions for distinct knowledge or leave them to an evidence-carrying `skip`. Preserve raw wording in `content` when it is already clear. Preserving a cited prose/bullet list as the Section's user-facing content is allowed when that list is the actual knowledge; the anti-pattern is copying raw text only as traceability or lexical-score padding. For `example` Sections that cite command / config / code fences, include the relevant fenced block in `content`.
|
|
71
83
|
|
|
72
84
|
## Section Kind Choice
|
|
73
85
|
|
|
@@ -95,6 +107,8 @@ When raw mentions a name that overlaps the workspace glossary, put that name's s
|
|
|
95
107
|
|
|
96
108
|
If the CLI returns `compile-missing-refers-to-node`, treat it as advisory: add the suggested slug only when the Section actually depends on that Node; otherwise leave the draft unchanged and rely on the cited `source_ref`.
|
|
97
109
|
|
|
110
|
+
If the CLI returns source-ref narrowing, candidate hard-fact, summary quality, or low-coverage advisories with `agent_recommended_action: ignore`, do not patch solely to satisfy the advisory. Patch only when the cited source actually loses meaning, a confirmed hard fact is unsupported, or the returned `next_action` asks for a draft patch.
|
|
111
|
+
|
|
98
112
|
## FAQ attachment priority
|
|
99
113
|
|
|
100
114
|
| FAQ topic | Attach to |
|
|
@@ -138,15 +152,16 @@ For each classified snippet:
|
|
|
138
152
|
1. Write `content` as the Section text the reader should see. It can include long prose, URLs, tables, command/config/code fences, or short raw wording. Keep one coherent, cited fact group per action.
|
|
139
153
|
2. Keep `content` faithful to the cited raw terms: do not introduce acronyms, abbreviations, translations, or aliases that do not appear in the cited raw snippet unless raw itself defines the equivalence or the user confirms it later during semantic review.
|
|
140
154
|
- Default to raw wording. Only make semantic-preserving edits for formatting, typo fixes, casing, entity/alias consistency, or sentence cleanup. If the raw text is already clear, `content` should equal the raw text.
|
|
141
|
-
-
|
|
155
|
+
- Preserve meaningful Markdown formatting from the cited raw: inline code markers, fenced blocks, Markdown link targets, blockquote markers, nested list structure, tables, and emphasis on key terms. Do not flatten these into plain prose unless the formatting is purely decorative.
|
|
156
|
+
- `source_support` is advisory lexical diagnostics, not the final semantic judge or a keyword gate. Do not stuff raw text into `content` just to raise matched-term counts, and do not patch a clear draft only to satisfy a lexical term mismatch.
|
|
142
157
|
- There is no separate default `evidence-echo` warning. Treat "echo" as an anti-pattern: raw copied only to show basis/evidence, while `source_ref` already provides traceability.
|
|
143
158
|
- For `description` / `spec`, a concise summary plus the cited bullet list is acceptable when the bullets are the useful user-facing knowledge. It becomes echo only when the copied text is not meant to be read as active knowledge.
|
|
144
159
|
- For `example` Sections that cite a code, config, or command fence, keep `content` centered on the cited fenced block. Put framing prose such as "basic configuration example" in `summary`, or cite a separate prose block in a separate action when that prose is itself source-backed knowledge.
|
|
145
|
-
3. For long `content`, add `summary` when it helps readers or query output. Summary is LLM-authored reader/query aid: one plain paragraph, no Markdown, and should stay compact. The CLI only reports advisory hints for missing summaries on long content, Markdown/multi-paragraph formatting, or clearly overlong summaries; it does not enforce a content-length ratio and does not treat summary quality as an evidence failure. `source_support`
|
|
160
|
+
3. For long `content`, add `summary` when it helps readers or query output. Summary is LLM-authored reader/query aid: one plain paragraph, no Markdown, and should stay compact. The CLI only reports advisory hints for missing summaries on long content, Markdown/multi-paragraph formatting, or clearly overlong summaries; it does not enforce a content-length ratio and does not treat summary quality as an evidence failure. Lexical `source_support` checks `content` (and legacy `detail` when present), not `summary`; keep summaries faithful to `content`, but do not copy raw-only keywords into `summary` for lexical scoring.
|
|
146
161
|
4. Preserve `required_preserved_literals[]` from the CLI evidence view. For link-heavy citation-eligible evidence, keep the listed URLs in `content` when the action writes knowledge; for supporting-only literals, keep them in the repair/challenge context instead of citing them.
|
|
147
162
|
5. Omit `confidence` for ordinary confirmed claims. Assign it only when the evidence is clearly verified, inferred, or speculative according to the schema enum.
|
|
148
163
|
6. Fill `refers_to_nodes[]` per [Glossary and refers_to_nodes](#glossary-and-refers_to_nodes).
|
|
149
|
-
7. Cite evidence with `
|
|
164
|
+
7. Cite evidence with `source_block_ids[]`, picking values from `source-refs-index` `items[].block_id` or `citable_source_refs[].block_id`. When one Section summarizes contiguous multi-block evidence, list only the block ids consumed by that Section content; the CLI expands and verifies that the refs can collapse to one canonical citation token and may auto-narrow over-wide citations. If the evidence is non-contiguous or contains separable claims, split the draft into separately cited actions instead of stretching one action across unrelated blocks. For `skip`, include `source_block_ids[]` only when the skip represents reviewed no-write material from citation-eligible evidence; omit evidence for purely deterministic no-ops, navigation, and context-only/background snippets. Never submit singular `source_ref`, mix `source_block_ids` with `source_refs`, or use quoted-evidence fields; the CLI rejects them.
|
|
150
165
|
|
|
151
166
|
Rendered knowledge starts with optional `c4a:summary`, then the active `content`. If `content` differs from the cited raw, the CLI may render a debug-only `c4a:raw` block for audit; agents must not emit `raw`.
|
|
152
167
|
|
|
@@ -154,6 +169,6 @@ Rendered knowledge starts with optional `c4a:summary`, then the active `content`
|
|
|
154
169
|
|
|
155
170
|
Emit one compile draft JSON document for the caller to submit to the current envelope's `next_action.command`. No markdown wrapper, no leading prose, no trailing commentary.
|
|
156
171
|
|
|
157
|
-
Before returning, ensure `
|
|
172
|
+
Before returning, ensure `schema_version` is `compile.draft.v2`, `node_slug` matches `node.slug`, fields conform to `context schema compile-draft`, `required_preserved_literals[]` are preserved or carried into an evidence-backed skip/repair challenge, and NodeContext was the only evidence source.
|
|
158
173
|
|
|
159
174
|
</procedures>
|
|
@@ -22,13 +22,13 @@ When a `raw_snippets[]` entry has `source_type: "note"`:
|
|
|
22
22
|
|
|
23
23
|
`revision_kind` (`replace` / `clarify` / ...) refines the choice within `revision`.
|
|
24
24
|
|
|
25
|
-
3. **No-write reviewed-no-write case.** If the note says "don't modify active knowledge yet" or the correct outcome is no-write after review, emit `skip` with `
|
|
25
|
+
3. **No-write reviewed-no-write case.** If the note says "don't modify active knowledge yet" or the correct outcome is no-write after review, emit `skip` with `source_block_ids[]` containing the note's citation-eligible block id. This lets semantic review record `reviewed_no_write` instead of treating the skip as an unreviewed no-op.
|
|
26
26
|
|
|
27
|
-
4. **Bare skip is not allowed for notes.** A bare `skip` (no
|
|
27
|
+
4. **Bare skip is not allowed for notes.** A bare `skip` (no evidence) is only for deterministic no-op cases such as unchanged input or pure navigation. Notes always carry an anchor and an intent; the skip must cite the note's block id or explicit source_ref.
|
|
28
28
|
|
|
29
29
|
## Where this lives in the main procedure
|
|
30
30
|
|
|
31
31
|
- **Step 2 — Classify**: run the note-first comparison **before** the generic kind priority chain. If the note resolves to `update` / `supersede` / `skip` (reviewed), record the action and move on; do not also process the same note through the generic chain.
|
|
32
|
-
- **Step 5 — Self-verify**: every note snippet was either consumed by an anchored action or carried into a `skip` with `
|
|
32
|
+
- **Step 5 — Self-verify**: every note snippet was either consumed by an anchored action or carried into a `skip` with `source_block_ids[]`.
|
|
33
33
|
|
|
34
34
|
Notes never become structure_challenge or pending_ownership_challenge on their own. If a note describes a structural problem (missing Action, wrong parent, etc.), capture the underlying evidence in raw form and emit the challenge from that — see `references/structural-challenges.md`.
|
|
@@ -41,9 +41,9 @@ When `existing.sections[]` is non-empty, every `section-N` id you read here is a
|
|
|
41
41
|
|
|
42
42
|
### `update` / `supersede.new` mechanics
|
|
43
43
|
|
|
44
|
-
- `update` keeps the same `section-N` id; provide new `content` (optional `summary`, optional new `
|
|
45
|
-
- `supersede.new` is a fresh Section; it needs `kind`, `content`, `
|
|
46
|
-
- `deprecate` only needs `target_section_id` and `reason`. Do not pass `content` or `source_refs[]`.
|
|
44
|
+
- `update` keeps the same `section-N` id; provide new `content` (optional `summary`, optional new `source_block_ids[]`) but do not include `kind` unless the kind itself is changing.
|
|
45
|
+
- `supersede.new` is a fresh Section; it needs `kind`, `content`, `source_block_ids[]`, and may carry `summary`, `refers_to_nodes[]`, and `confidence` per the same rules as `add`.
|
|
46
|
+
- `deprecate` only needs `target_section_id` and `reason`. Do not pass `content`, `source_block_ids[]`, or `source_refs[]`.
|
|
47
47
|
|
|
48
48
|
## Output schema (refresh ops)
|
|
49
49
|
|
|
@@ -53,12 +53,12 @@ When `existing.sections[]` is non-empty, every `section-N` id you read here is a
|
|
|
53
53
|
{ "op": "update", "target_section_id": "section-3",
|
|
54
54
|
"content": "...",
|
|
55
55
|
"refers_to_nodes": null,
|
|
56
|
-
"
|
|
56
|
+
"source_block_ids": ["c0d4e5f61728"] },
|
|
57
57
|
{ "op": "supersede", "target_section_id": "section-5",
|
|
58
58
|
"reason": "raw published a new retention value",
|
|
59
59
|
"new": { "kind": "spec", "content": "...",
|
|
60
60
|
"refers_to_nodes": ["..."],
|
|
61
|
-
"
|
|
61
|
+
"source_block_ids": ["9d1e2f3a4b5c"] } },
|
|
62
62
|
{ "op": "deprecate", "target_section_id": "section-2", "reason": "..." }
|
|
63
63
|
]
|
|
64
64
|
}
|
|
@@ -28,7 +28,8 @@ decisions only; the CLI reviews, applies, and writes every workspace change.
|
|
|
28
28
|
- Escape hatch: when an item has no candidates, `relation_verdict: new` with `compared_section_ids: []` and `compared_count: 0` is valid and expected.
|
|
29
29
|
- For `duplicate`, `supersede`, `conflict`, or `merge_into`, set `target_section_id` to the matched candidate Section id.
|
|
30
30
|
- Same `source_ref` can support different Section kinds only when the semantic role differs. Detect and explain same-source-ref multi-kind cases instead of treating them as automatic duplicates.
|
|
31
|
-
- A supported judge verdict may override low lexical `source_support`
|
|
31
|
+
- `source_support` is advisory lexical diagnostics, not a keyword gate. A supported judge verdict may override low lexical `source_support` when the cited raw evidence semantically covers the claim.
|
|
32
|
+
- Evidence-boundary errors, missing URLs, and split-by-evidence candidates remain blocking evidence issues. Do not patch drafts merely because `source_support.missing_hard_terms[]` contains a spelling, casing, punctuation, or paraphrase mismatch.
|
|
32
33
|
- Weak support is a warning-level verdict, not permission to invent missing facts. Unsupported support should normally pair with `conflict` or a later user question rather than a write decision.
|
|
33
34
|
|
|
34
35
|
<reference>
|
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
and compile scope-review fallback; not a user slash command. Ordinary compile
|
|
6
6
|
prepare judgment uses `skill-compile-judge`. This skill consumes only
|
|
7
7
|
`context reconcile prepare` output, judges semantic relation/action for each item,
|
|
8
|
-
and emits a
|
|
8
|
+
and emits a `semantic-decisions.v2` decision document for `context reconcile review`;
|
|
9
9
|
apply consumes the current workflow's ready review artifact.
|
|
10
10
|
tools:
|
|
11
11
|
- Bash
|
|
@@ -50,7 +50,7 @@ If none of the above hold, you are on this skill's main path: refresh/drop/non-c
|
|
|
50
50
|
Accept a prepared `default_decision` with the compact form:
|
|
51
51
|
|
|
52
52
|
```yaml
|
|
53
|
-
schema_version: "
|
|
53
|
+
schema_version: "semantic-decisions.v2"
|
|
54
54
|
decisions:
|
|
55
55
|
- item_id: claim-001
|
|
56
56
|
accept_default: true
|
|
@@ -59,7 +59,7 @@ decisions:
|
|
|
59
59
|
For a changed action or hand-authored decision, emit the full shape with the action's required fields (see Action Rules below):
|
|
60
60
|
|
|
61
61
|
```yaml
|
|
62
|
-
schema_version: "
|
|
62
|
+
schema_version: "semantic-decisions.v2"
|
|
63
63
|
decisions:
|
|
64
64
|
- item_id: claim-001
|
|
65
65
|
relation: near_duplicate
|
|
@@ -120,7 +120,7 @@ Drop-mode-only branches (`reanchor`, `split_then_reanchor`, `remove_unsupported`
|
|
|
120
120
|
|
|
121
121
|
### Step 3 — Emit Decisions
|
|
122
122
|
|
|
123
|
-
Emit one document with `schema_version: "
|
|
123
|
+
Emit one document with `schema_version: "semantic-decisions.v2"` and `decisions[]`. Include only executable final decisions plus unresolved `ask_user` questions. Do not include prose outside the document.
|
|
124
124
|
|
|
125
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 the review diagnostic's explicit repair options and cited item ids, then rerun `context reconcile review`.
|
|
126
126
|
|