@c4a/context-cli 0.5.29-beta.18 → 0.5.29-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/cli.js +3995 -2165
- package/package.json +1 -1
- package/plugin/README.md +4 -3
- package/plugin/README_CN.md +4 -3
- package/plugin/commands/align.md +28 -4
- package/plugin/commands/capture.md +5 -3
- package/plugin/commands/compile.md +27 -14
- package/plugin/commands/query.md +1 -0
- package/plugin/skills/skill-align-workflow/SKILL.md +32 -10
- package/plugin/skills/skill-align-workflow/references/gates.md +81 -41
- package/plugin/skills/skill-compile-close/SKILL.md +4 -1
- package/plugin/skills/skill-compile-draft/SKILL.md +108 -279
- package/plugin/skills/skill-compile-draft/references/action-domain-gates.md +34 -0
- package/plugin/skills/skill-compile-draft/references/notes.md +34 -0
- package/plugin/skills/skill-compile-draft/references/refresh-and-update.md +71 -0
- package/plugin/skills/skill-compile-draft/references/structural-challenges.md +76 -0
- package/plugin/skills/skill-compile-judge/SKILL.md +1 -1
- package/plugin/skills/skill-context-query/SKILL.md +141 -94
- package/plugin/skills/skill-drop/SKILL.md +2 -3
- package/plugin/skills/skill-semantic-reconcile/SKILL.md +70 -185
- package/plugin/skills/skill-semantic-reconcile/references/leakage-and-ownership.md +31 -0
- package/plugin/skills/skill-semantic-reconcile/references/mode-semantics.md +41 -0
- package/plugin/skills/skill-semantic-reconcile/references/scope-review-and-omit.md +60 -0
- package/plugin/skills/skill-semantic-reconcile/references/temporal-and-evidence.md +66 -0
- package/plugin/skills/skill-semantic-reconcile/references/user-confirmation.md +71 -0
|
@@ -32,7 +32,8 @@ command. It does not hand-edit rendered knowledge.
|
|
|
32
32
|
- Source issues (`dropped-source-reference`) → user runs `/context:drop <id>` to complete the drop
|
|
33
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; then stop.
|
|
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 warning choice: `ready_with_debt` means close succeeded and unresolved coverage remains visible. You may either continue with the warning recorded, or run an uncovered-only repair/skip round. If all unresolved candidates are intentionally excluded for the same reason, use `context compile --coverage-skip-unresolved --coverage-disposition-node <slug> --
|
|
35
|
+
- Coverage warning choice: `ready_with_debt` means close succeeded and unresolved coverage remains visible. You may either continue with the warning recorded, or run an uncovered-only repair/skip round. If all unresolved candidates are intentionally excluded for the same reason, use `context compile --coverage-skip-unresolved --coverage-disposition-node <slug> --reason "<reason>"`; otherwise inspect `context schema coverage-disposition`.
|
|
36
|
+
- 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.
|
|
36
37
|
- Never re-run `context compile --draft` from close to paper over verify failures. Draft failures belong in the draft loop.
|
|
37
38
|
- 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.
|
|
38
39
|
- Derivable files self-heal: missing `_index.md` or `changelog.md` is rebuilt inside `compile --close` before the append, locator-only source moves are refreshed, non-canonical but hash-valid `source_ref` locators are canonicalized, and high-signal coverage candidates already backed by active Sections are marked covered. No pre-check needed.
|
|
@@ -64,6 +65,7 @@ Close is one in-process command with one exit code:
|
|
|
64
65
|
| 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. |
|
|
65
66
|
| Exit 0, warnings only | Summarise + list warnings verbatim. For coverage warnings, name both choices: continue with `ready_with_debt`, or run an uncovered-only repair/skip round through `context compile --coverage-skip-unresolved` or `context schema coverage-disposition`. Stop. |
|
|
66
67
|
| 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
|
+
| 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. |
|
|
67
69
|
| 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. |
|
|
68
70
|
| Exit 2, `dropped-source-reference` | Surface the source-id; point the user at `/context:drop <id>` to complete the drop cleanup. |
|
|
69
71
|
|
|
@@ -99,6 +101,7 @@ Use stdout + stderr. The exit code selects the path via [Outcome routing](#outco
|
|
|
99
101
|
For each error in the CLI's report, classify via [Outcome routing](#outcome-routing) and name the re-entry command in your report. Do NOT hand-edit rendered knowledge — that violates the CLI-sole-writer principle and masks the real upstream fix. Specifically:
|
|
100
102
|
|
|
101
103
|
- Section / content issue → user re-runs `/context:compile` (draft loop produces new Section actions; the CLI re-writes).
|
|
104
|
+
- `compile-close-finalized-node-missing-knowledge` → content Nodes go back through `/context:compile`; navigation-only or placeholder-only Nodes go back through `/context:align` so they become explicit no-write placeholders.
|
|
102
105
|
- Structural issue → user runs `/context:align` (revise the plan; re-compile afterwards).
|
|
103
106
|
- `dropped-source-reference` → user runs `/context:drop <id>` to finish drop cleanup.
|
|
104
107
|
|
|
@@ -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 `
|
|
7
|
+
kind via the priority chain, writes `content` + optional `summary` + `source_refs[]`,
|
|
8
8
|
and emits a compile draft JSON document. The CLI
|
|
9
9
|
validates the actions via `context compile --draft <slug> --input - --plan`.
|
|
10
10
|
Activates when `/context:compile` iterates across the confirmed align plan.
|
|
@@ -14,215 +14,98 @@ tools:
|
|
|
14
14
|
|
|
15
15
|
# skill-compile-draft — write Section actions for one Node
|
|
16
16
|
|
|
17
|
-
Classify raw evidence for one Node into `add / update / supersede /
|
|
18
|
-
deprecate / skip` actions; emit JSON; the CLI performs every write.
|
|
17
|
+
Classify raw evidence for one Node into `add` / `skip` (and on refresh: `update` / `supersede` / `deprecate`) actions; emit JSON; the CLI performs every write.
|
|
19
18
|
|
|
20
19
|
## TL;DR — Non-negotiables
|
|
21
20
|
|
|
22
21
|
- One Node per invocation — `target_node` 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.
|
|
23
22
|
- Agent emits JSON only; no markdown, no direct workspace file writes. The caller passes the JSON to `context compile --draft <slug> --input - --plan --prepare`; the CLI stores workflow payloads. `--save-input` is only for an explicit debug scratch copy.
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- Do not use Python, Node.js, shell scripts, `ls`, `find`, `rg`, `cat`, or similar ad-hoc commands to inspect or preprocess `WORKSPACE_DIR`, `.context`, NodeContext scratch files, or `/tmp` workflow artifacts.
|
|
27
|
-
- If `incremental.status` is `full-context`, draft from the full fallback and preserve the `unknown_inputs[]` reasons in any abort/retry explanation.
|
|
28
|
-
- The CLI may deterministically skip unchanged output or update locator-only evidence before writing. Do not force rewrites to bypass fingerprint skip.
|
|
29
|
-
- `incremental.locator_only_changes[]` entries have `agent_action: "none"` and `handled_by: "compile-close"`; do not emit draft actions for those Sections unless the same Section also has a real `changed_blocks[]` content change.
|
|
30
|
-
- Actions are candidate write actions, not final semantic decisions. If raw appears similar to existing knowledge, add only a `reconcile_hint`; the semantic reconcile procedure may ignore it.
|
|
31
|
-
- For `node.type: "action"`, use `node.action_gate` as the compile boundary. Actor, goal/outcome, repeatability, answerability, trigger, step, and phase claims must come from cited `raw_snippets[]` or structured `action_gate.inference_sources`; if `trigger_blocks` is empty, do not invent a trigger.
|
|
32
|
-
- For `node.type: "domain"`, treat `node.domain_gate` as grouping metadata only. It can explain why child Nodes belong under the Domain, but it is not evidence for a Section unless the same fact appears in citation-eligible raw snippets.
|
|
33
|
-
- Note snippets are captured conversation material. `raw_snippets[].note_intent`, `anchored_to[]`, and `revision_kind` are prioritization hints only: they may suggest update / supersede / complement / skip, but they never authorize a write without semantic review.
|
|
23
|
+
- Evidence boundary: treat `raw_snippets[]` as complete. Only `raw_snippet_indexes.citation_eligible` may be cited; `context_only` and secondary-shared snippets are background. `request_full_text` may expose full visible evidence text for inspection, including primary evidence, but it does not change citation eligibility. If a secondary-shared or `context_only` block holds facts that need 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/` to recover a token. Instead: for the digest of any workflow payload use `context workflow show --payload <name> --digest-only --format text` (prints just the digest); for substructure use explicit compact views such as `context compile --source-refs <slug> --format json`, `context workflow show --payload node-context --view source-refs --unwrap --format json`, or `context workflow show --payload prepare --view issues --unwrap --format json`; for write commands that take `--payload-digest`, omit the flag entirely and let the CLI auto-resolve the latest payload for the current workflow scope.
|
|
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`.
|
|
34
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.
|
|
35
|
-
- Pick `kind`
|
|
26
|
+
- Pick `kind` by the [Section Kind Canon](#section-kind-canon), also exposed as `section_kind_priority` in `context schema compile-draft`. 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.
|
|
36
27
|
- `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.
|
|
37
28
|
- Every write action cites raw via `source_refs[]`, choosing values from `raw_snippets[].source_ref`. Use a single-element array for one citation. Treat each source ref as an opaque citation token; never fabricate, parse, dereference, or cite navigation-only blocks as evidence for a content Section.
|
|
38
|
-
- Use
|
|
39
|
-
-
|
|
40
|
-
- For `example` Sections, if the cited raw snippet contains command / config / code fences, include the short summary and the relevant fenced block together in `body`; do not collapse copyable examples into prose-only summaries unless semantic review asks the user and the user accepts that compression.
|
|
41
|
-
- Preserve documentation/reference URL blocks. If a cited raw block is primarily links (官网 / docs / reference / related links), create a small `description` Section such as "相关链接" and keep every URL in `body`; do not drop link-only evidence just because it is not prose.
|
|
42
|
-
- For `add`, `update`, and `supersede.new`, omit optional fields when empty; never emit `detail: null`.
|
|
29
|
+
- 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` only when content is long; omit it when content is short. 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.
|
|
30
|
+
- Preserve documentation/reference URL blocks. If a citation-eligible raw block is primarily links (官网 / docs / reference / related links), create a small `description` Section such as "相关链接" and keep every URL in `content`; do not drop link-only evidence just because it is not prose. If the URL block is only `context_only`, keep it as background and emit an ownership/structure challenge instead of citing it.
|
|
43
31
|
- `refers_to_nodes[]` only carries slugs present in the context's glossary, existing Sections, or the current align plan; never invent one.
|
|
44
|
-
- `
|
|
45
|
-
- If a note or raw snippet was reviewed and should intentionally not write active knowledge, emit `skip` with `source_refs[]` from that exact snippet. This lets semantic review record `reviewed_no_write`; a bare skip is only for deterministic no-op cases such as unchanged input or navigation-only context.
|
|
32
|
+
- `skip` is the honest default when raw adds nothing. Bare `skip` (no `source_refs[]`) is only for deterministic no-ops such as unchanged input or pure navigation. When a snippet was reviewed and intentionally not written, emit `skip` with `source_refs[]` from that snippet so semantic review can record `reviewed_no_write`.
|
|
46
33
|
- 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.
|
|
47
34
|
- FAQ collections attach to the most specific finalized Node (Entity → Action → Domain fallback); never create a standalone FAQ container.
|
|
48
|
-
- Output language:
|
|
49
|
-
- Stable output: keep action order aligned with evidence order
|
|
35
|
+
- Output language: Node-facing summaries and user-facing draft explanations follow `NodeContext.generation_policy.language` when present; otherwise match the raw material. 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.
|
|
36
|
+
- Stable output: keep action order aligned with evidence order — that ordering is the only stability concern the CLI cannot enforce. The CLI rejects unknown fields (timestamps, random ids, host/scratch paths) and canonicalises stored payloads; fixed rules and schema come from this skill, so only the current NodeContext should vary between repeated Node draft calls.
|
|
37
|
+
|
|
38
|
+
## Edge cases — consult references when:
|
|
39
|
+
|
|
40
|
+
| Condition | Reference |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `node.type` is `action` or `domain` | [references/action-domain-gates.md](references/action-domain-gates.md); use `node.action_gate` (including `trigger_blocks`) and treat `node.domain_gate` as grouping metadata |
|
|
43
|
+
| any `raw_snippets[].source_type` is `"note"` | [references/notes.md](references/notes.md) |
|
|
44
|
+
| `existing.sections[]` non-empty, **or** `incremental.status` is `unchanged` / `full-context`, **or** `incremental.locator_only_changes[]` non-empty | [references/refresh-and-update.md](references/refresh-and-update.md) |
|
|
45
|
+
| evidence implies missing Action / wrong parent / `depends_on` gap / ownership upgrade from `context_only` or secondary-shared | [references/structural-challenges.md](references/structural-challenges.md) |
|
|
46
|
+
|
|
47
|
+
If none of the above hold, you are on the main path (first compile of an entity Node with default `changed-only` incremental status). The procedure below covers that path end-to-end.
|
|
50
48
|
|
|
51
49
|
<reference>
|
|
52
50
|
|
|
53
51
|
## Input — `NodeContext`
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
"node": {
|
|
58
|
-
"slug": "...", "type": "entity|action|domain",
|
|
59
|
-
"tags": [...], "title": "...",
|
|
60
|
-
"sources": ["..."], "aliases": ["..."], "summary": "...",
|
|
61
|
-
"planned_sections": ["spec", "..."],
|
|
62
|
-
"action_gate": {
|
|
63
|
-
"actor_blocks": ["2f4b8c1e9a03"],
|
|
64
|
-
"trigger_blocks": [],
|
|
65
|
-
"goal_blocks": ["c0d4e5f61728"],
|
|
66
|
-
"step_blocks": ["8b9a0c1d2e3f"],
|
|
67
|
-
"outcome_blocks": ["4e2d1c0b9a88"],
|
|
68
|
-
"repeatability_or_plan_blocks": ["9d1e2f3a4b5c"],
|
|
69
|
-
"inference_sources": {
|
|
70
|
-
"actor": { "source_type": "explicit-block", "evidence_blocks": ["2f4b8c1e9a03"], "rationale": "..." },
|
|
71
|
-
"outcome_or_goal": { "source_type": "explicit-block", "evidence_blocks": ["c0d4e5f61728"], "rationale": "..." },
|
|
72
|
-
"repeatability_or_plan": { "source_type": "explicit-block", "evidence_blocks": ["9d1e2f3a4b5c"], "rationale": "..." },
|
|
73
|
-
"answerability": { "source_type": "ref-node", "ref_nodes": ["..."], "rationale": "..." }
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"domain_gate": {
|
|
77
|
-
"scope_blocks": ["7a6f4c9d2e10"],
|
|
78
|
-
"child_refs": ["..."],
|
|
79
|
-
"grouping_reason": "..."
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"generation_policy": {
|
|
83
|
-
"language": "Chinese",
|
|
84
|
-
"source": "workspace.language",
|
|
85
|
-
"applies_to": ["node.title", "node.summary", "section.content", "section.detail", "user_facing_report"],
|
|
86
|
-
"instruction": "Generate knowledge titles, summaries, Section content/detail, and user-facing reports in Chinese; preserve product names, code identifiers, CLI flags, block_id/source_ref tokens, slugs, and quoted evidence exactly when needed."
|
|
87
|
-
},
|
|
88
|
-
"existing": { // present if the Node already exists
|
|
89
|
-
"sections": [
|
|
90
|
-
{ "id": "section-1", "kind": "description", "content": "...",
|
|
91
|
-
"detail": "...", "status": "active|deprecated",
|
|
92
|
-
"confidence": "...", "source_ref": "src-1#anchor L10-14@7a6f4c9d2e10",
|
|
93
|
-
"refers_to_nodes": [...] }
|
|
94
|
-
]
|
|
95
|
-
},
|
|
96
|
-
// Default NodeContext does not expose raw file paths. Copy raw_snippets[].source_ref
|
|
97
|
-
// into draft source_refs[]; copy CLI-provided block_id only for ownership challenges.
|
|
98
|
-
"mentions": [ { "line": 12, "quote": "...", "source_id": "local:billing", "block_locator_id": "h2-api" } ],
|
|
99
|
-
"raw_snippets": [ { "line": 10,
|
|
100
|
-
"line_range": [10, 18],
|
|
101
|
-
"source_ref": "src-1#api L10-18@7a6f4c9d2e10",
|
|
102
|
-
"quote": "...context block...",
|
|
103
|
-
"mention_quote": "...",
|
|
104
|
-
"source_type": "local|feishu|note",
|
|
105
|
-
"source_id": "local:billing",
|
|
106
|
-
"note_intent": "revision|decision|brainstorm",
|
|
107
|
-
"anchored_to": [{ "node_slug": "...", "section_id": "section-1" }],
|
|
108
|
-
"revision_kind": "replace|clarify|...",
|
|
109
|
-
"block_locator_id": "h2-api",
|
|
110
|
-
"block_hash": "sha256:...",
|
|
111
|
-
"change_status": "changed" } ],
|
|
112
|
-
"incremental": {
|
|
113
|
-
"mode": "changed-only",
|
|
114
|
-
"status": "changed-only|full-context|unchanged",
|
|
115
|
-
"reason": "source_block_changed|unknown-input|first-compile",
|
|
116
|
-
"changed_blocks": [ { "status": "changed", "source_id": "local:billing", "block_locator_id": "h2-api" } ],
|
|
117
|
-
"locator_only_changes": [ { "source_id": "local:billing", "agent_action": "none", "handled_by": "compile-close", "affected_sections": ["section-3"] } ],
|
|
118
|
-
"unknown_inputs": [ { "scope": "compile-changes", "reason": "section-fingerprints-missing" } ]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
```
|
|
53
|
+
Canonical shape: `context schema node-context --format yaml` (or `--format json`). The CLI is the source of truth for fields, enums, and produced-by paths.
|
|
122
54
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
selected by `context compile --scan-changes`.
|
|
126
|
-
|
|
127
|
-
`source_id` is the source registry id
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
`
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
from cited raw or the matching structured `inference_sources` entry. If
|
|
141
|
-
`answerability` depends on `ref_nodes`, use `refers_to_nodes[]` or a local link
|
|
142
|
-
hint instead of describing another Node's internals.
|
|
143
|
-
`node.domain_gate` is present only for finalized Domain Nodes. It is grouping
|
|
144
|
-
metadata for scope and children; do not turn `grouping_reason` into a Section
|
|
145
|
-
unless citation-eligible raw snippets state the same claim.
|
|
146
|
-
|
|
147
|
-
## Output — Compile Draft JSON
|
|
148
|
-
|
|
149
|
-
```jsonc
|
|
150
|
-
{
|
|
151
|
-
"schema_version": "compile.draft.v2",
|
|
152
|
-
"target_node": "<matches node.slug>",
|
|
153
|
-
"actions": [
|
|
154
|
-
{ "op": "add", "kind": "spec",
|
|
155
|
-
"body": "...",
|
|
156
|
-
"rewrite": false,
|
|
157
|
-
"refers_to_nodes": ["..."],
|
|
158
|
-
"source_refs": ["src-1#api L10-14@7a6f4c9d2e10"]
|
|
159
|
-
},
|
|
160
|
-
{ "op": "update", "target_section_id": "section-3",
|
|
161
|
-
"body": "...",
|
|
162
|
-
"refers_to_nodes": null,
|
|
163
|
-
"source_refs": ["src-1#api L18-21@c0d4e5f61728"] },
|
|
164
|
-
{ "op": "supersede", "target_section_id": "section-5",
|
|
165
|
-
"reason": "raw published a new retention value",
|
|
166
|
-
"new": { "kind": "spec", "body": "...",
|
|
167
|
-
"refers_to_nodes": ["..."],
|
|
168
|
-
"source_refs": ["src-1#limits L30-34@9d1e2f3a4b5c"] } },
|
|
169
|
-
{ "op": "deprecate", "target_section_id": "section-2", "reason": "..." },
|
|
170
|
-
{ "op": "skip", "reason": "no new evidence in raw snippets" },
|
|
171
|
-
{ "op": "skip", "reason": "reviewed; intentionally not written",
|
|
172
|
-
"source_refs": ["src-1#note L4-8@7a6f4c9d2e10"] },
|
|
173
|
-
{ "op": "structure_challenge",
|
|
174
|
-
"challenge_id": "ch_0001",
|
|
175
|
-
"kind": "missing_action_node",
|
|
176
|
-
"node_slug": "<matches node.slug>",
|
|
177
|
-
"action_tag": "rollout-runbook",
|
|
178
|
-
"summary": "The cited evidence is a repeatable procedure.",
|
|
179
|
-
"source_ref": "src-1#ops L40-55@c0d4e5f61728",
|
|
180
|
-
"reason": "Align must review structure before compile writes process prose." },
|
|
181
|
-
{ "op": "structure_challenge",
|
|
182
|
-
"challenge_id": "ch_0002",
|
|
183
|
-
"kind": "wrong_shared_block_split",
|
|
184
|
-
"node_slug": "<matches node.slug>",
|
|
185
|
-
"unresolved_target": "rollout-runbook",
|
|
186
|
-
"reason": "The finalized shared block split leaves this Node with only secondary, non-citable evidence." },
|
|
187
|
-
{ "op": "pending_ownership_challenge",
|
|
188
|
-
"challenge_id": "och_0001",
|
|
189
|
-
"node_slug": "<matches node.slug>",
|
|
190
|
-
"block_id": "2f4b8c1e9a03",
|
|
191
|
-
"requested_role": "shared",
|
|
192
|
-
"reason": "A visible context_only or secondary shared block contains facts that need citation." }
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
```
|
|
55
|
+
Boundary recap (rules not captured by the schema enums):
|
|
56
|
+
|
|
57
|
+
- `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-changes`. These two arrays are the evidence floor — never reach outside them.
|
|
58
|
+
- `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[]`.
|
|
59
|
+
- `source_id` is the source registry id (e.g. `local:billing`); `src-N` aliases only appear inside `source_ref` strings — copy `raw_snippets[].source_ref` verbatim into draft `source_refs[]`.
|
|
60
|
+
|
|
61
|
+
## Output — Compile Draft JSON (main path)
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
Main-path ops are **`add`** and **`skip`**. A typical new Section action is `{ op: "add", kind: "<chain-picked>", content: "...", source_refs: ["src-1#... L10-14@..."] }`; 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_refs[]` from the cited snippet.
|
|
66
|
+
|
|
67
|
+
`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.
|
|
68
|
+
|
|
69
|
+
`source_refs[]` values are copied verbatim from `raw_snippets[].source_ref`; a single citation is still a single-element array. When one Section summarises contiguous multi-block evidence, list only the source refs the `content` actually consumes. 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`.
|
|
70
|
+
|
|
71
|
+
## Section Kind Canon
|
|
196
72
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
one Section summarizes contiguous multi-block evidence, list every relevant
|
|
203
|
-
source ref in order under `source_refs[]`.
|
|
204
|
-
`structure_challenge` and `pending_ownership_challenge` do not write Sections;
|
|
205
|
-
the CLI stores them as workflow payloads and close exposes them as debt until
|
|
206
|
-
align resolution handles them. Supported structure challenge kinds include
|
|
207
|
-
`missing_action_node`, `extra_action_node`, `wrong_shared_block_split`,
|
|
208
|
-
`missing_depends_on_edge`, and `wrong_parent`.
|
|
209
|
-
|
|
210
|
-
Optional `reconcile_hint` shape for any action:
|
|
211
|
-
|
|
212
|
-
```jsonc
|
|
213
|
-
{
|
|
214
|
-
"reconcile_hint": {
|
|
215
|
-
"suggested_relation": "exact_duplicate|near_duplicate|complement|conflicts|keep_separate",
|
|
216
|
-
"suggested_action": "duplicate_skip|merge_update|keep_separate|ask_user",
|
|
217
|
-
"similar_section_id": "section-3",
|
|
218
|
-
"confidence": 0.72,
|
|
219
|
-
"reason": "The new snippet is close to the existing sandbox isolation Section."
|
|
220
|
-
}
|
|
221
|
-
}
|
|
73
|
+
Walk this priority chain and stop at the first form that fits:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
example -> comparison -> faq -> incident -> changelog ->
|
|
77
|
+
decision -> spec -> warning -> principle -> description
|
|
222
78
|
```
|
|
223
79
|
|
|
224
|
-
|
|
225
|
-
|
|
80
|
+
| kind | Use when | `content` should contain | Positive / negative boundary |
|
|
81
|
+
|---|---|---|---|
|
|
82
|
+
| `example` | fenced code, config, or command sample | what the sample does plus the full snippet when useful | `<AppProvider />` sample or `bun run build`; plain "wrap with AppProvider" is `description` |
|
|
83
|
+
| `comparison` | at least two subjects across at least two dimensions | compared subjects, dimensions, and table/matrix | `X vs Y vs Z` table; "two options have tradeoffs" is `description`; "choose X over Y" is `decision` |
|
|
84
|
+
| `faq` | one explicit question-answer pair | question plus answer | Q/A block; an "X FAQ collection" is several `faq` Sections on X, not a container Node |
|
|
85
|
+
| `incident` | happened event with time, impact, and root cause / handling | time, severity/impact, root cause, timeline/actions | dated outage postmortem; "risk may happen" is `warning` |
|
|
86
|
+
| `changelog` | version/date plus change description | version, change type, migration notes if present | `v1.2.0 added X`; "X supports Y" without version is `spec` or `description` |
|
|
87
|
+
| `decision` | text surfaces at least two alternatives plus a reason | selected option, alternatives, reason, impact | "choose async rather than sync because..."; bare "use X because..." is `spec` |
|
|
88
|
+
| `spec` | verifiable behavior, threshold, default, limit, or check method | object, condition, value/constraint | retry max 3; vague "consider concurrency" is `principle` or `description` |
|
|
89
|
+
| `warning` | factual risk, caveat, or negative consequence | trigger condition and consequence | "without warmup first 30s timeout"; "don't change config" without consequence is too vague |
|
|
90
|
+
| `principle` | stable design invariant / philosophy with no check method and no choice action | invariant and reason | "single way to write UI"; retry max 3 is `spec`; "choose X over Y" is `decision` |
|
|
91
|
+
| `description` | fallback definition, overview, or plain narrative | definition, purpose, scope, distinction | only after the nine kinds above fail; do not use it to hide lists, rules, tables, samples, risks, or decisions |
|
|
92
|
+
|
|
93
|
+
Mount matrix:
|
|
94
|
+
|
|
95
|
+
| kind | domain | entity | action |
|
|
96
|
+
|---|:---:|:---:|:---:|
|
|
97
|
+
| `description` | yes | yes | yes |
|
|
98
|
+
| `spec` | no | yes | yes |
|
|
99
|
+
| `warning` | yes | yes | yes |
|
|
100
|
+
| `principle` | yes | yes | no |
|
|
101
|
+
| `decision` | yes | yes | yes |
|
|
102
|
+
| `incident` | no | yes | yes |
|
|
103
|
+
| `example` | no | yes | no |
|
|
104
|
+
| `changelog` | no | yes | no |
|
|
105
|
+
| `comparison` | no | yes | no |
|
|
106
|
+
| `faq` | yes | yes | yes |
|
|
107
|
+
|
|
108
|
+
When the strongest kind is not mountable on this Node type, choose the next legal kind that the evidence truly supports, or `skip` with a structural challenge reason. Do not force `description` just because it mounts everywhere.
|
|
226
109
|
|
|
227
110
|
## Confidence rubric
|
|
228
111
|
|
|
@@ -242,36 +125,16 @@ Don't game the rubric. Compile-close flags Nodes dominated by `speculative` Sect
|
|
|
242
125
|
`description` is the kind for narrative claims that do not match any other form. Before locking in `kind: description` for a snippet, run three classification checks against the cited block:
|
|
243
126
|
|
|
244
127
|
1. **Atomicity**: single narrative, or multi-step / multi-row / multi-config? Multi → split into the right kinds — each step into its own `spec` / `warning`, each row into a `comparison` Section, each config block into `example` (sample) or `spec` (constraint with a check method).
|
|
245
|
-
2. **Kind-precision**: does a higher-priority kind fit better? A comparison table belongs in `comparison`; a
|
|
128
|
+
2. **Kind-precision**: does a higher-priority kind fit better? A code / config / command block belongs in `example`; a comparison table belongs in `comparison`; a Q+A pair belongs in `faq`; a real incident with timeline belongs in `incident`; a versioned change record belongs in `changelog`; a multi-option choice (≥ 2 surfaced candidates + rationale) belongs in `decision`; a verifiable rule with a check method belongs in `spec`; explicit risks belong in `warning`; a stable design rule or core mechanism without surfaced alternatives or check method belongs in `principle`.
|
|
246
129
|
3. **Action threshold**: multi-step fragments that clear the Action bar → emit `op: skip` with a note "evidence warrants sub-Action; re-align needed"; do not create Nodes from this skill.
|
|
247
130
|
|
|
248
|
-
A Node whose raw is genuinely narrative — definitions, summaries, plain prose without enumerations or normative wording — legitimately ends with description-dominant output. The smell fires the other way: when raw contained enumerations, normative rules, or code blocks, and the draft collapsed them to `description`. Redraft from Step 2 in that case, not from a percentage threshold.
|
|
249
|
-
|
|
250
|
-
Navigation-only exception: if a Node's evidence is only a child list, relation navigation, sibling link, parent pointer, or placeholder wording, emit `skip`. The Node remains useful through align graph edges, `## Contains` / `## Related`, and metadata; a navigation-only snippet is not evidence for a `description` claim. The Node `summary` is metadata for context and listings, not a Section or a required lead paragraph.
|
|
131
|
+
A Node whose raw is genuinely narrative — definitions, summaries, plain prose without enumerations or normative wording — legitimately ends with description-dominant output. The smell fires the other way: when raw contained enumerations, normative rules, or code blocks, and the draft collapsed them to `description`. Redraft from Step 2 in that case, not from a percentage threshold. Navigation-only evidence is handled separately by the TL;DR navigation rule and Step 2 — the gates above are not the right place to second-guess that path.
|
|
251
132
|
|
|
252
133
|
## Glossary and `refers_to_nodes`
|
|
253
134
|
|
|
254
|
-
When raw mentions a name that overlaps the workspace glossary, put
|
|
255
|
-
that name's slug in `refers_to_nodes[]` for the Section that discusses
|
|
256
|
-
it — do NOT substitute it into the prose. This preserves explicit
|
|
257
|
-
cross-Node references for query answers and citations without rewriting
|
|
258
|
-
the claim. Slugs come from existing Sections, the context glossary, or Nodes already declared by the current align plan; never invent one. A
|
|
259
|
-
Section can reference multiple Nodes (common on `comparison` /
|
|
260
|
-
`decision`).
|
|
261
|
-
If the CLI returns `compile-missing-refers-to-node`, treat it as advisory:
|
|
262
|
-
add the suggested slug only when the Section actually depends on that Node;
|
|
263
|
-
otherwise leave the draft unchanged and rely on the cited `source_ref`.
|
|
135
|
+
When raw mentions a name that overlaps the workspace glossary, put that name's slug in `refers_to_nodes[]` for the Section that discusses it — do NOT substitute it into the prose. This preserves explicit cross-Node references for query answers and citations without rewriting the claim. Slugs come from existing Sections, the context glossary, or Nodes already declared by the current align plan; never invent one. A Section can reference multiple Nodes (common on `comparison` / `decision`).
|
|
264
136
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
| Situation | op |
|
|
268
|
-
|---|---|
|
|
269
|
-
| Same meaning, fixing typo / tightening prose / adding detail | `update` — same `section-N` stays active |
|
|
270
|
-
| New rule replaces old rule (values / policy / spec changed) | `supersede` — old flips to `deprecated`; new gets fresh `section-N+k` |
|
|
271
|
-
| Old rule removed without replacement | `deprecate` (with `reason`) |
|
|
272
|
-
|
|
273
|
-
`supersede` preserves the audit trail so readers see the prior
|
|
274
|
-
policy — critical for specs / decisions / principles.
|
|
137
|
+
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`.
|
|
275
138
|
|
|
276
139
|
## FAQ attachment priority
|
|
277
140
|
|
|
@@ -282,9 +145,7 @@ policy — critical for specs / decisions / principles.
|
|
|
282
145
|
| About an action / flow | That Action |
|
|
283
146
|
| Cross-topic / generic workspace FAQ | Domain (fallback only) |
|
|
284
147
|
|
|
285
|
-
Never manufacture a FAQ container Node. If a FAQ cluster grows too large, a
|
|
286
|
-
sub-Entity is the correct escape hatch; flag it in `decisions.notes`
|
|
287
|
-
for a re-align pass.
|
|
148
|
+
Never manufacture a FAQ container Node. If a FAQ cluster grows too large, a sub-Entity is the correct escape hatch; flag it in `decisions.notes` for a re-align pass.
|
|
288
149
|
|
|
289
150
|
</reference>
|
|
290
151
|
|
|
@@ -292,18 +153,11 @@ for a re-align pass.
|
|
|
292
153
|
|
|
293
154
|
### Step 1 — Sanity-check the context
|
|
294
155
|
|
|
295
|
-
Confirm `node.slug` is set; abort if not. Note `node.type` — it caps legal kinds per the CLI Section mount matrix.
|
|
296
|
-
If `incremental.status` is `unchanged`, emit one `skip` action. If it is `full-context`, continue with the full context but keep the fallback reason visible in any user-facing explanation.
|
|
297
|
-
Estimate coverage from the provided `raw_snippets[]` before writing actions. Treat "the first quote is supported" as only a validation result, not a completion signal.
|
|
156
|
+
Confirm `node.slug` is set; abort if not. Note `node.type` — it caps legal kinds per the CLI Section mount matrix.
|
|
298
157
|
|
|
299
|
-
|
|
158
|
+
Check edge case conditions from the routing table at the top of this skill. If any apply, read the relevant reference **before** continuing. The references explain how their conditions modify Step 1 / Step 2 / Step 3.
|
|
300
159
|
|
|
301
|
-
|
|
302
|
-
- `actor_blocks`, `goal_blocks`, `outcome_blocks`, and `repeatability_or_plan_blocks` can support concise `description` / `spec` Sections when the same source refs are citation-eligible.
|
|
303
|
-
- Empty `trigger_blocks` means no trigger was finalized; write goal or applicability if supported, but do not add a trigger sentence.
|
|
304
|
-
- `inference_sources.answerability.ref_nodes` should become `refers_to_nodes[]` when the current Section depends on those Nodes; do not summarize those Nodes' facts here.
|
|
305
|
-
|
|
306
|
-
If `node.type` is `domain`, inspect `node.domain_gate` only to understand scope and child grouping. It does not authorize new Section facts by itself.
|
|
160
|
+
Estimate coverage from the provided `raw_snippets[]` before writing actions. Treat "the first quote is supported" as only a validation result, not a completion signal.
|
|
307
161
|
|
|
308
162
|
Coverage self-check:
|
|
309
163
|
|
|
@@ -317,67 +171,42 @@ Coverage self-check:
|
|
|
317
171
|
|
|
318
172
|
For each `raw_snippets[]` entry:
|
|
319
173
|
|
|
320
|
-
1. If
|
|
321
|
-
2.
|
|
322
|
-
3.
|
|
323
|
-
4.
|
|
324
|
-
5. If you land on `description`, walk the [Description anti-abuse gates](#description-anti-abuse-gates). Any gate fires → split or `skip`.
|
|
174
|
+
1. If the snippet only contains navigation or placeholder evidence (`Parent` / `Children` / `Related` / `Relations`, sibling links, "no detailed content", etc.), emit `skip`. Do not create a Section whose content is just "Children: ..." or "Related: ..." and do not summarize facts that are not present in the snippet.
|
|
175
|
+
2. Walk the Section kind priority chain from [Section Kind Canon](#section-kind-canon); stop at the first kind whose trigger fires.
|
|
176
|
+
3. Verify the kind against the mount matrix for `node.type`. Mismatch → pick the next legal kind down the chain, or emit `skip` with a reason pointing at a better Node. Never "fall through to description" just to place evidence.
|
|
177
|
+
4. If you land on `description`, walk the [Description anti-abuse gates](#description-anti-abuse-gates). Any gate fires → split or `skip`.
|
|
325
178
|
|
|
326
179
|
For dense documents, group nearby snippets by their `block_locator_id` heading prefix and write one action per coherent fact group. Repeated `#` headings inside one source are often internal chapters of the current Node; keep them as Sections unless the raw evidence establishes a separate durable Node identity.
|
|
327
180
|
|
|
328
|
-
### Step 3 —
|
|
329
|
-
|
|
330
|
-
For each existing Section:
|
|
181
|
+
### Step 3 — Build actions
|
|
331
182
|
|
|
332
|
-
|
|
333
|
-
- Raw clarifies or rephrases without changing meaning → `update`.
|
|
334
|
-
- Raw changes meaning (new spec value, reversed decision) → `supersede`.
|
|
335
|
-
- Raw removes supporting evidence → `deprecate` with `reason`.
|
|
183
|
+
For each classified snippet:
|
|
336
184
|
|
|
337
|
-
|
|
185
|
+
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.
|
|
186
|
+
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.
|
|
187
|
+
- 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.
|
|
188
|
+
- `source_support` is a lexical diagnostic, not the final semantic judge. Do not stuff raw text into `content` just to raise matched-term counts.
|
|
189
|
+
- 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.
|
|
190
|
+
- 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.
|
|
191
|
+
3. If `content` is longer than 200 characters, add `summary`. Summary is LLM-authored reader/query aid: one plain paragraph, no Markdown, about `content.length / 10`, minimum 10 characters, recommended maximum 120. The CLI warns on missing or odd summaries; it does not auto-generate them.
|
|
192
|
+
4. If the cited block contains documentation/reference URLs, preserve them in `content`. Link-only blocks are still useful knowledge; use `kind: description` with a concise "相关链接" identity when no more specific kind applies.
|
|
193
|
+
5. Omit `confidence` for ordinary confirmed claims. Assign `confidence` per the [Confidence rubric](#confidence-rubric) only when the evidence is not confirmed.
|
|
194
|
+
6. Fill `refers_to_nodes[]` per [Glossary and refers_to_nodes](#glossary-and-refers_to_nodes).
|
|
195
|
+
7. Cite evidence with `source_refs[]`, picking values from `raw_snippets[].source_ref`. When one Section summarizes contiguous multi-block evidence, list only the source refs consumed by that Section content; the CLI 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_refs[]` only when the skip represents reviewed no-write material; omit evidence for purely deterministic no-ops such as unchanged input. Never submit singular `source_ref` or quoted-evidence fields; the CLI rejects them.
|
|
338
196
|
|
|
339
|
-
|
|
197
|
+
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`.
|
|
340
198
|
|
|
341
|
-
|
|
342
|
-
2. Keep `body` 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. Use `rewrite: false` when preserving raw expression is the least surprising representation.
|
|
343
|
-
3. If the cited block contains documentation/reference URLs, preserve them in `body`. Link-only blocks are still useful knowledge; use `kind: description` with a concise "相关链接" identity when no more specific kind applies.
|
|
344
|
-
4. Omit `confidence` for ordinary confirmed claims. Assign `confidence` per the [Confidence rubric](#confidence-rubric) only when the evidence is not confirmed.
|
|
345
|
-
5. Fill `refers_to_nodes[]` per [Glossary and refers_to_nodes](#glossary-and-refers_to_nodes).
|
|
346
|
-
6. Cite evidence with `source_refs[]`, picking values from `raw_snippets[].source_ref`. When one Section summarizes contiguous multi-block evidence, list every relevant source ref in order under `source_refs[]`; the CLI verifies that the refs can collapse to one canonical citation token. 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_refs[]` only when the skip represents reviewed no-write material; omit evidence for purely deterministic no-ops such as unchanged input. Never submit singular `source_ref` or quoted-evidence fields; the CLI rejects them.
|
|
347
|
-
7. If evidence implies a missing Action, missing `depends_on`, wrong parent, or
|
|
348
|
-
needed ownership upgrade from `context_only`, emit the corresponding
|
|
349
|
-
challenge action instead of forcing the content into a Section.
|
|
350
|
-
`pending_ownership_challenge.requested_role` is `owned` or `shared`.
|
|
351
|
-
|
|
352
|
-
Rendered knowledge uses a CLI-derived short claim as the visible blockquote and
|
|
353
|
-
renders longer supporting material from `body` as collapsed Details when needed.
|
|
354
|
-
A reader should be able to understand the Section from the short claim first;
|
|
355
|
-
long supporting material is active knowledge, not a hidden evidence copy.
|
|
356
|
-
|
|
357
|
-
### Step 5 — Emit the JSON
|
|
199
|
+
### Step 4 — Emit the JSON
|
|
358
200
|
|
|
359
201
|
Emit one compile draft JSON document for the caller to pass to `context compile --draft <slug> --input - --plan --prepare`. No markdown wrapper, no leading prose, no trailing commentary.
|
|
360
202
|
|
|
361
|
-
### Step
|
|
362
|
-
|
|
363
|
-
- [ ] `target_node` equals `node.slug`
|
|
364
|
-
- [ ] Every `
|
|
365
|
-
- [ ]
|
|
366
|
-
- [ ]
|
|
367
|
-
- [ ]
|
|
368
|
-
- [ ]
|
|
369
|
-
- [ ] No action contains `detail` or `content` — use `body` instead.
|
|
370
|
-
- [ ] No `description` action that would fail the anti-abuse gates — if any, **Step 2**.
|
|
371
|
-
- [ ] Every citation-eligible raw URL block is either preserved in a Section or intentionally skipped with evidence and reason; if not, **Step 4**.
|
|
372
|
-
- [ ] Dense raw material was not collapsed into one broad Section. If `raw_snippets[]` spans many locator areas and only one write action exists, return to **Step 2** unless the remaining snippets are duplicates, navigation-only, or already covered by existing Sections.
|
|
373
|
-
- [ ] Every `update` / `supersede` / `deprecate` targets a known `section-N` — if not, **Step 3**.
|
|
374
|
-
- [ ] `refers_to_nodes[]` only contains slugs from `existing` / glossary / current align plan — if not, **Step 4**.
|
|
375
|
-
- [ ] When the Node ended description-dominant, verify raw was genuinely narrative (no enumerations, no normative wording, no code/config blocks). If raw contained any of those forms and they were collapsed to `description`, redo classification from **Step 2**. Do not invent unsupported precision Sections for ratio reasons.
|
|
376
|
-
- [ ] When raw adds nothing, exactly one `op: skip` with a reason; not `actions: []`.
|
|
377
|
-
- [ ] When raw only has navigation/placeholder evidence, use `skip`; do not add a low-value Section from `Parent` / `Children` / `Related` / `Relations` lines.
|
|
378
|
-
- [ ] When `skip` means "reviewed but intentionally not written", it includes `source_refs[]` from the relevant note/raw snippet so review can persist no-write status.
|
|
379
|
-
- [ ] Changed-only context was not expanded by direct workspace reads — if any were used, restart from the CLI-provided NodeContext.
|
|
380
|
-
- [ ] No Read / Glob / Grep / Write was used against `WORKSPACE_DIR` — if any, restart from the CLI-provided NodeContext.
|
|
381
|
-
- [ ] No ad-hoc script or shell file traversal was used against `WORKSPACE_DIR`, `.context`, or `/tmp` workflow artifacts — if any, restart from the CLI-provided NodeContext.
|
|
203
|
+
### Step 5 — Self-verify
|
|
204
|
+
|
|
205
|
+
- [ ] Every action's `target_node` equals `node.slug`, with a legal `kind × node.type` combination and `content` + optional `summary` + `source_refs[]` only (no singular `source_ref`, no `body` / `detail` / `raw`, no quoted-evidence or extractive-contract fields, no new terms absent from the cited raw). If not, return to **Step 2** for kind/mount-matrix issues, otherwise **Step 3**.
|
|
206
|
+
- [ ] Every `description` action survives the [Description anti-abuse gates](#description-anti-abuse-gates). If not, **Step 2** to split or `skip`.
|
|
207
|
+
- [ ] Coverage matches evidence density: dense raw with one broad action returns to **Step 2** unless remaining snippets are duplicates / navigation / placeholders / already covered. Citation-eligible URL blocks are either preserved or `skip`-with-evidence.
|
|
208
|
+
- [ ] `skip` semantics: bare `skip` only for deterministic no-op (unchanged input or pure navigation); reviewed-no-write `skip` carries `source_refs[]` from the cited snippet. When raw adds nothing, exactly one `op: skip` with a reason — not `actions: []`. If not, **Step 3**.
|
|
209
|
+
- [ ] If any edge case condition applies (action/domain Node, note snippets, existing Sections, non-changed-only incremental, or structural defect), the relevant reference's Self-verify items were also satisfied.
|
|
210
|
+
- [ ] NodeContext was the only evidence source — no Read / Glob / Grep / Write / ad-hoc script or shell file traversal against `WORKSPACE_DIR`, `.context`, `/tmp` workflow artifacts, or CLI `--format json` stdout. If any was used, restart from the CLI-provided NodeContext.
|
|
382
211
|
|
|
383
212
|
</procedures>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Action and Domain gates
|
|
2
|
+
|
|
3
|
+
Consult this reference when **`node.type` is `action` or `domain`**. For `entity` Nodes, ignore this file and follow the main SKILL.md procedure.
|
|
4
|
+
|
|
5
|
+
## Action Nodes (`node.type === "action"`)
|
|
6
|
+
|
|
7
|
+
Treat `node.action_gate` as the compile boundary for procedural claims. An Action Node exists because align found both scale and process evidence: at least two meaningful Sections or a child Action, plus steps/phases/trigger-handling-result/role collaboration/repeatable plan evidence. Actor, goal/outcome, repeatability, answerability, trigger, step, and phase claims **must** come from cited `raw_snippets[]` or the structured `action_gate.inference_sources` entries.
|
|
8
|
+
|
|
9
|
+
| Gate block | What it authorizes |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `step_blocks` / `phase_blocks` / cited step snippets | `spec` or `example` Sections for procedure content |
|
|
12
|
+
| `actor_blocks`, `goal_blocks`, `outcome_blocks`, `repeatability_or_plan_blocks` | concise `description` / `spec` Sections when the same source refs are citation-eligible |
|
|
13
|
+
| Empty `trigger_blocks` | **No trigger Section.** Write goal or applicability if supported, but do not fabricate a trigger sentence. |
|
|
14
|
+
| `inference_sources.answerability.ref_nodes` | Becomes `refers_to_nodes[]` when the current Section depends on those Nodes; do **not** summarize those Nodes' facts inside this Node. |
|
|
15
|
+
|
|
16
|
+
If `action_gate` is absent on a Node whose `type` is `action`, treat it as a structural defect — emit a `structure_challenge` (see `references/structural-challenges.md`) instead of inventing process semantics.
|
|
17
|
+
|
|
18
|
+
If the current evidence can only support one thin Section or only a parallel option/config list, do not stretch it into procedure prose. Emit `skip` or `structure_challenge` so align can downgrade it to the owning Entity/Domain Section.
|
|
19
|
+
|
|
20
|
+
## Domain Nodes (`node.type === "domain"`)
|
|
21
|
+
|
|
22
|
+
Treat `node.domain_gate` as **grouping metadata only**. It explains scope and child grouping; it does **not** authorize new Section facts by itself.
|
|
23
|
+
|
|
24
|
+
- `scope_blocks` may help orient your Section coverage of the Domain's range but are not write authority.
|
|
25
|
+
- `child_refs` belong to the align graph, not to active Sections — do not turn the list into a Section.
|
|
26
|
+
- `grouping_reason` is align-time reasoning. Do **not** turn it into a `description` Section unless citation-eligible raw snippets state the same claim.
|
|
27
|
+
|
|
28
|
+
Recall the mount matrix limit: Domain Nodes allow only `description`, `warning`, `principle`, `decision`, `faq`. A spec / example / comparison / incident / changelog landing here is a kind/type mismatch — drop down the priority chain or `skip`.
|
|
29
|
+
|
|
30
|
+
## How this slots into the main procedure
|
|
31
|
+
|
|
32
|
+
- **Step 1 — Sanity-check**: after the standard `node.slug` / mount-matrix check, run the action_gate / domain_gate inspection above.
|
|
33
|
+
- **Step 2 — Classify**: respect the gate's authorization boundary when picking kinds.
|
|
34
|
+
- **Step 5 — Self-verify**: confirm no Section was written from evidence the gate disallowed.
|