@c4a/context-cli 0.6.0-beta.7 → 0.6.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +130 -132
  3. package/README.zh-CN.md +158 -0
  4. package/cli.js +14978 -15477
  5. package/package.json +18 -3
  6. package/plugins/README.md +8 -0
  7. package/plugins/README_CN.md +6 -0
  8. package/plugins/VERSION +1 -1
  9. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  10. package/plugins/claude/skills/skill-continue-workflow/SKILL.md +39 -3
  11. package/plugins/claude/skills/skill-package-output/SKILL.md +16 -3
  12. package/plugins/claude/skills/skill-prose-align/SKILL.md +26 -31
  13. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  14. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  15. package/plugins/claude/skills/skill-prose-compile/SKILL.md +26 -27
  16. package/plugins/claude/skills/skill-review-gate/SKILL.md +17 -6
  17. package/plugins/claude/skills/skill-source-scope/SKILL.md +10 -9
  18. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  19. package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +39 -3
  20. package/plugins/codex/skills/continue/references/internal-procedures/skill-package-output.md +16 -3
  21. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  22. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  23. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +26 -31
  24. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +26 -27
  25. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +17 -6
  26. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +10 -9
  27. package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +39 -3
  28. package/plugins/codex/skills/init/references/internal-procedures/skill-package-output.md +16 -3
  29. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  30. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  31. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +26 -31
  32. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +26 -27
  33. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +17 -6
  34. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +10 -9
  35. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  36. package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +39 -3
  37. package/plugins/cursor/skills/skill-package-output/SKILL.md +16 -3
  38. package/plugins/cursor/skills/skill-prose-align/SKILL.md +26 -31
  39. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  40. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  41. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +26 -27
  42. package/plugins/cursor/skills/skill-review-gate/SKILL.md +17 -6
  43. package/plugins/cursor/skills/skill-source-scope/SKILL.md +10 -9
  44. package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +39 -3
  45. package/plugins/skills/context-continue/references/internal-procedures/skill-package-output.md +16 -3
  46. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  47. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  48. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +26 -31
  49. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +26 -27
  50. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +17 -6
  51. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +10 -9
  52. package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +39 -3
  53. package/plugins/skills/context-init/references/internal-procedures/skill-package-output.md +16 -3
  54. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  55. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  56. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +26 -31
  57. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +26 -27
  58. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +17 -6
  59. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +10 -9
  60. package/plugin/.claude-plugin/plugin.json.template +0 -16
  61. package/plugin/.codex-plugin/plugin.json.template +0 -38
  62. package/plugin/.cursor-plugin/plugin.json.template +0 -29
  63. package/plugin/README.md +0 -150
  64. package/plugin/README_CN.md +0 -136
  65. package/plugin/assets/icon.svg +0 -3
  66. package/plugin/assets/logo.svg +0 -3
  67. package/plugin/assets/workflow-en.png +0 -0
  68. package/plugin/assets/workflow.png +0 -0
  69. package/plugin/commands/continue.md +0 -34
  70. package/plugin/commands/init.md +0 -21
  71. package/plugin/skills/skill-continue-workflow/SKILL.md +0 -199
  72. package/plugin/skills/skill-init-workspace/SKILL.md +0 -74
  73. package/plugin/skills/skill-package-output/SKILL.md +0 -167
  74. package/plugin/skills/skill-prose-align/SKILL.md +0 -327
  75. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  76. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  77. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -269
  78. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +0 -276
  79. package/plugin/skills/skill-prose-compile/SKILL.md +0 -288
  80. package/plugin/skills/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  81. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  82. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  83. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  84. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  85. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  86. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  87. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  88. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  89. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  90. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  91. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  92. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  93. package/plugin/skills/skill-review-gate/SKILL.md +0 -127
  94. package/plugin/skills/skill-source-scope/SKILL.md +0 -524
  95. package/plugin/skills/skill-source-scope/references/capture-source.md +0 -201
  96. package/plugins/assets/icon.svg +0 -3
  97. package/plugins/assets/workflow-en.png +0 -0
  98. package/plugins/assets/workflow.png +0 -0
  99. package/plugins/codex/assets/workflow-en.png +0 -0
  100. package/plugins/codex/assets/workflow.png +0 -0
  101. package/plugins/cursor/assets/icon.svg +0 -3
  102. package/plugins/cursor/assets/workflow-en.png +0 -0
  103. package/plugins/cursor/assets/workflow.png +0 -0
  104. package/scripts/build-plugin.ts +0 -658
@@ -1,288 +0,0 @@
1
- ---
2
- name: skill-prose-compile
3
- description: >
4
- Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Uses confirmed Context document structure to create source-bound draft prose
6
- candidates through `context.compile-actions.v1`, without reading raw
7
- snapshots directly.
8
- tools:
9
- - Bash
10
- ---
11
-
12
- # skill-prose-compile
13
-
14
- Compile confirmed document structure into reviewable draft knowledge.
15
-
16
- ## TL;DR
17
-
18
- - Use this after `context status` reports `structure-ready` or
19
- `needs-prose-compile`, or when the user explicitly asks to compile confirmed
20
- prose structure into draft pages.
21
- - The input is already confirmed `context.structure.v1`; do not redesign node
22
- ownership, page paths, or relationships here. Return to prose align if those
23
- are wrong.
24
- - Read compile context through CLI views only: `blockers`, `read-plan`,
25
- `node-context`, and `schema`. Start with `blockers` for large or recently
26
- repaired structures; if it returns section blockers, return to prose align
27
- instead of drafting compile actions. Use align evidence views only when the
28
- compile view or validation output gives a specific source ref that needs exact
29
- text.
30
- - Emit `context.compile-actions.v1`; the CLI mirrors source spans, derives
31
- `content_mode`, writes review candidates, and enforces source-bound evidence.
32
- - The `summary` field in each action is the Agent-authored behavior half only:
33
- compact source-backed recall text for the cited section. The CLI separately
34
- renders the reachability half from confirmed typed edges into review metadata;
35
- do not invent edge summaries or relation fields in the action payload.
36
- - Default to omitted `content` so the CLI mirrors the cited source span.
37
- Do not write explicit `content`. If the evidence cannot be represented as a
38
- faithful mirrored continuous span, split the section or return to prose align
39
- for a confirmed structure change.
40
- - Before choosing section kind, summary, skip/update, weak-evidence handling, or
41
- structure repair, read only the procedure references in the CLI
42
- `semantic_rules.required` set. The CLI selects core and conditional rules for
43
- the current node and explains each selection with `reason`.
44
- - Do not produce or validate compile actions from this entry file alone. A
45
- ruleset already present in the active context may be reused only when both its
46
- `handle` and `digest` match. If the context was compacted, the digest changed,
47
- or the rule content is no longer present, read `semantic_rules.required`.
48
-
49
- <reference>
50
-
51
- ## User-Facing Gates
52
-
53
- Use semantic labels, not SDK function names:
54
-
55
- | Gate | Say this | Do not say this first |
56
- |---|---|---|
57
- | Compile context | "I will inspect the confirmed structure and each node's planned evidence before drafting sections." | `node-context`, `context.compile-actions.v1` |
58
- | Source-bound draft | "I will mirror supported source spans into reviewable draft pages and attach summary/kind metadata." | `compileProse` |
59
- | Non-mirror evidence | "This section cannot be compiled as-is because the evidence is not one faithful source mirror; we need to split or revise the structure." | "The agent can rewrite this automatically." |
60
- | Structure mismatch | "This compile cannot proceed because the confirmed structure no longer matches the evidence; we need to return to structure confirmation." | Editing `knowledge/` or `unapproved/` directly |
61
-
62
- ## Runtime Discipline
63
-
64
- - Follow `context status`, `routing.command_plan`, compile view
65
- `next_action`, and validation diagnostics. Treat CLI commands as the source
66
- of truth.
67
- - Use only the returned `next_action.command` for the next required write.
68
- Treat `allowed_actions[]` as permission for read-only insertions; it is not a
69
- menu of alternate write paths.
70
- - Treat `agent_hints[]` as temporary diagnostics. If an agent hint conflicts
71
- with a status route, compile view `next_action`, or validation result, follow
72
- the top-level route.
73
- - Do not use direct file tools, shell scripts, `jq`, `sed`, `cat`, `head`,
74
- `tail`, Python, or Node.js to inspect `sources/`, `unapproved/`,
75
- `knowledge/`, `dist/`, or CLI-managed `.tmp` as a substitute for Context
76
- views.
77
- - Run one write at a time. Do not parallelize compile stage, review apply,
78
- close, or build writes.
79
- - One write still means one View, not one human Review. Stage every View in the
80
- same confirmed structure sequentially, follow `continue_compile_batch`, and
81
- open Review only after the CLI reports that the whole batch is prepared.
82
- - Compile does not get a second, looser rule set. If a rule conflicts with the
83
- current CLI schema or diagnostics, follow the CLI and repair the payload.
84
- - Write digest/hash flags are stale guards. Use values returned by the CLI; do
85
- not parse stdout fragments or host tool-result files to reconstruct them.
86
- - If a payload is too large for a heredoc, stage it under
87
- `.tmp/agent-payloads/<run-id>/...` in the workspace root and redirect stdin
88
- from that file. Never reuse fixed `/tmp/c4a-*` names, and never place agent
89
- scratch payloads under CLI-managed `.tmp/context-cli/`, `sources/`,
90
- `unapproved/`, `knowledge/`, `dist/`, review output, or package output
91
- directories.
92
-
93
- ## Compile Views
94
-
95
- Recommended read order:
96
-
97
- ```bash
98
- context run compile:<type>:<source>:<collection> --view blockers --format json
99
- context run compile:<type>:<source>:<collection> --view read-plan --format json
100
- context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
101
- context run compile:<type>:<source>:<collection> --view schema --format json
102
- ```
103
-
104
- Use CLI-returned `available_view_refs`, `planned_sections`, `local_sources`, and
105
- `next_action.command`. If `blockers.section_blockers[]` is non-empty, repair the
106
- structure through align first; do not inspect every node or hand-split compile
107
- actions. Do not reconstruct the structure by opening `unapproved/structure.yaml`
108
- or `knowledge/structure.yaml` directly.
109
-
110
- ## Procedure References
111
-
112
- These are current compile rules for source-bound drafting, judgment, semantic
113
- repair, and close handoff.
114
-
115
- | Decision | Reference |
116
- |---|---|
117
- | Compile action drafting, section kind, coverage, summaries, content intent | [references/internal-procedures/compile-actions.md](references/internal-procedures/compile-actions.md) |
118
- | Action/domain compile gates | [references/internal-procedures/compile-actions/references/action-domain-gates.md](references/internal-procedures/compile-actions/references/action-domain-gates.md) |
119
- | Notes, refresh/update, and structural challenges | [references/internal-procedures/compile-actions/references/notes.md](references/internal-procedures/compile-actions/references/notes.md), [references/internal-procedures/compile-actions/references/refresh-and-update.md](references/internal-procedures/compile-actions/references/refresh-and-update.md), [references/internal-procedures/compile-actions/references/structural-challenges.md](references/internal-procedures/compile-actions/references/structural-challenges.md) |
120
- | Support, duplicate, replacement, conflict, weak evidence, and relation judgment | [references/internal-procedures/compile-judgment.md](references/internal-procedures/compile-judgment.md), [references/internal-procedures/semantic-judgment.md](references/internal-procedures/semantic-judgment.md) |
121
- | Leakage, ownership, temporal evidence, disposition, omit, and user confirmation | [references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md](references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md), [references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md](references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md), [references/internal-procedures/semantic-judgment/references/disposition-semantics.md](references/internal-procedures/semantic-judgment/references/disposition-semantics.md), [references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md](references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md), [references/internal-procedures/semantic-judgment/references/user-confirmation.md](references/internal-procedures/semantic-judgment/references/user-confirmation.md) |
122
- | Close gate and current close output boundaries | [references/internal-procedures/close-gate.md](references/internal-procedures/close-gate.md) |
123
-
124
- ## Compile Contract
125
-
126
- The compile action payload uses `schema_version: context.compile-actions.v1`.
127
- Compile may:
128
-
129
- - mirror source spans as `verbatim`;
130
- - emit `skip` decisions when no source-backed body should be written. `skip`
131
- does not produce a placeholder candidate; generated parent-index pages use
132
- the parent-index compile path, not an action payload placeholder.
133
-
134
- Relationships and cross references do not go into verbatim body. In current
135
- output they stay in `structure.yaml` typed edges; this workflow does not render
136
- relationship reference blocks.
137
-
138
- </reference>
139
-
140
- <procedures>
141
-
142
- ### Step 1 — Open Compile Context
143
-
144
- Run:
145
-
146
- ```bash
147
- context run compile:<type>:<source>:<collection> --view blockers --format json
148
- context run compile:<type>:<source>:<collection> --view read-plan --format json
149
- ```
150
-
151
- Use the returned blockers, node list, source overview, and next action. If the
152
- blockers view reports section blockers, return to prose align and repair the
153
- confirmed structure before compile. If the CLI says the structure is missing,
154
- unconfirmed, stale, frozen against the wrong snapshot, or invalid, return to
155
- prose align or source capture as indicated.
156
-
157
- ### Step 2 — Inspect One Node
158
-
159
- For each node that should become draft knowledge, run:
160
-
161
- ```bash
162
- context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
163
- context run compile:<type>:<source>:<collection> --view schema --format json
164
- ```
165
-
166
- Read only the compile references listed by `semantic_rules.required` before
167
- classifying section kind, summary, support, skip/update, weak evidence, or
168
- structure repair. Do not load the full rule inventory unless the CLI explicitly
169
- returns it as required.
170
-
171
- Do not treat those references as optional background. They are the current
172
- compile drafting, judgment, and semantic-repair procedures.
173
-
174
- When exact evidence text is needed, use the CLI-returned source ref with the
175
- current evidence view. Do not open snapshot files directly.
176
-
177
- ### Step 3 — Draft And Validate Actions
178
-
179
- Create a `context.compile-actions.v1` payload for the selected view. Prefer
180
- omitted `content` with `source_refs[]` so the CLI mirrors source spans.
181
- If the source evidence is non-contiguous or contains separable examples,
182
- configuration blocks, lists, or procedures, split the compile actions when the
183
- confirmed structure supports that split. If the structure is too coarse, return
184
- to prose align and ask the user to confirm a section split instead of writing
185
- summarized body text. Explicit `content` / `content_intent` is not part of the
186
- current compile contract.
187
-
188
- For small payloads, use stdin/heredoc. For larger payloads, write a scratch file
189
- under `.tmp/agent-payloads/<run-id>/` and pass it through `--input`. Scratch
190
- files are disposable agent working files; they are never compile state and must
191
- not be read back as a substitute for CLI views.
192
-
193
- Validate:
194
-
195
- ```bash
196
- context run compile:<type>:<source>:<collection> --validate --input <compile-actions.yaml> --format json
197
- ```
198
-
199
- Repair diagnostics by routing them to the right decision:
200
-
201
- - source ref or planned-section mismatch -> reread node-context, or return to
202
- structure confirmation if ownership is wrong;
203
- - unsupported kind or op -> use the schema view and current compile references;
204
- - explicit content -> omit `content` and mirror source, or return to align for
205
- a section split;
206
- - weak evidence, duplicate, conflict, omit, or scope issue -> use the compile
207
- judgment / semantic judgment references and ask the user when required;
208
- - frozen structure mismatch -> rerun status and return to align/capture as
209
- directed.
210
-
211
- Use typed diagnostics as the repair contract:
212
-
213
- - `reason_code`, `path`, and `missing[]` identify what to fix;
214
- - warnings are not write blockers unless the response marks them blocking or
215
- the next action says so;
216
- - weak evidence, duplicate, conflict, temporal, leakage, ownership, and scope
217
- issues are semantic review issues, not formatting problems;
218
- - raw/source-ref pointer diagnostics are evidence checks, not content-quality
219
- judges.
220
-
221
- When validation returns a new `next_action.command`, follow that exact command.
222
- When it returns blocking diagnostics without a write command, repair and
223
- validate again. Do not stage a compile payload just because the YAML shape looks
224
- valid.
225
-
226
- ### Step 4 — Stage Draft Candidates
227
-
228
- Stage only after validation has no errors:
229
-
230
- ```bash
231
- context run compile:<type>:<source>:<collection> --stage --input <compile-actions.yaml> --format json
232
- ```
233
-
234
- After staging, follow `next_action` exactly:
235
-
236
- - `continue_compile_batch` with `human_gate=false`: move to the returned next
237
- View and repeat **Step 2–4**. Do not open Review yet.
238
- - `review_candidates` with `human_gate=true`: every planned View in this
239
- confirmed structure is prepared; return to `context status`, then delegate
240
- one collection-level Review to
241
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-review-gate/SKILL.md`.
242
-
243
- The CLI blocks Review and close while confirmed Views remain unprepared. Do not
244
- turn sequential View writes into sequential user approvals.
245
-
246
- ### Step 5 — Close Handoff
247
-
248
- After the single batch review apply, return to `context status`. If status says
249
- `compile-close-needed`, run deterministic close:
250
-
251
- ```bash
252
- context close --format json
253
- ```
254
-
255
- Close derives `knowledge/structure.yaml` and edge projection from approved
256
- knowledge, then runs the final verify gate. It must not rewrite approved
257
- verbatim body. References, changelog, package index, and section fingerprint
258
- rebuilds are not current close output.
259
-
260
- Then route to package output when status reaches `ready-to-build`.
261
-
262
- ### Step 6 — Self-verify Checklist
263
-
264
- - [ ] Compile started from confirmed structure, not a new structure proposal.
265
- - [ ] Node context and schema came from compile phase views.
266
- - [ ] Compile references were read before choosing kind/summary/support.
267
- - [ ] Actions mirror source by default and do not invent body text.
268
- - [ ] No explicit reader-visible `content` was written by the Agent.
269
- - [ ] Relationships are expressed as structure edges, not inserted into
270
- verbatim text.
271
- - [ ] No direct edits were made to `sources/`, `.tmp`, `unapproved/`,
272
- `knowledge/`, review HTML, or `dist/`.
273
- - [ ] Every planned View was staged before opening the one batch Review.
274
-
275
- ### Final Report
276
-
277
- Report in the user's language. Include only:
278
-
279
- - view refs compiled in this round;
280
- - candidate ids staged and whether they contain verbatim or empty sections;
281
- - validation warnings that still matter for review;
282
- - whether review, close, verify, or build is the next status route.
283
-
284
- Do not report internal payload digests, source-ref hashes, internal workspace
285
- paths, absolute paths, scratch file paths, or raw CLI JSON unless the user asks
286
- for debug output.
287
-
288
- </procedures>
@@ -1,132 +0,0 @@
1
- ---
2
- name: close-gate
3
- description: >
4
- Internal procedure invoked by the current compile/continue flow; not a user
5
- slash command. Runs after review apply. Triggers `context close --format json`,
6
- which derives knowledge/structure.yaml, projects approved edges, and runs the
7
- final verify gate. Agent intervention is limited to interpreting CLI output
8
- and routing verify errors back to source capture, align structure, compile
9
- actions, or review as appropriate. The skill never hand-edits rendered
10
- knowledge.
11
- tools:
12
- - Bash
13
- ---
14
-
15
- # close-gate — approved structure projection + final verify
16
-
17
- Close a compile run. The CLI does the work; the skill reads the
18
- CLI's output and routes any failure back to the correct upstream
19
- command. It does not hand-edit rendered knowledge.
20
-
21
- ## TL;DR — Non-negotiables
22
-
23
- - CLI-driven. `context close --format json` derives `knowledge/structure.yaml`,
24
- projects approved edges, and verifies the final workspace including edge
25
- source refs. Use the command's stdout + exit code; that's the close's full
26
- output.
27
- - **Agent NEVER edits rendered knowledge from the close stage.** The CLI is the
28
- sole writer for approved structure projection. If verify reports an error
29
- here, route it back, not around:
30
- - Content / Section issues → re-run the current compile gate for the affected
31
- node after fixing compile actions.
32
- - Structural issues → return to the align structure gate and reconfirm.
33
- - Source/evidence issues → recapture the affected source, then rerun align or
34
- compile as status instructs.
35
- - Exit 0 → summarise approved node count, approved edge count, structural edge
36
- contract status, and verify status. References, changelog, package index,
37
- section fingerprints, and full incremental cache rebuilds are not current
38
- close output.
39
- - Exit 2 → report the full issue list verbatim + point at the right re-entry command above. Do not hand-open the affected rendered article.
40
- - Materialized knowledge means approved Markdown plus its approved
41
- `knowledge/structure.yaml` projection. A compile skip action records reviewed
42
- evidence, but it does not by itself materialize an arbitrary finalized Node.
43
- - Never re-run compile actions from close to paper over verify failures. Draft
44
- failures belong in the compile loop.
45
- - Do not use Python, Node.js, shell scripts, `ls`, `find`, `rg`, `cat`, or similar ad-hoc commands to inspect `sources/`, `unapproved/`, `knowledge/`, or `dist/` files.
46
- - Current close can self-heal stale or malformed `knowledge/structure.yaml`
47
- projection by deriving it again from approved Markdown and approved edge
48
- sources. It must not rewrite verbatim section body.
49
- - LLM-assisted repair (`--fix-with-llm`) is not a current close action.
50
- - Output language: summary prose matches the user's language; CLI output, issue codes, file paths stay as printed.
51
- - Current align state is internal CLI state, not a file protocol. The CLI owns
52
- this lifecycle — the agent must not move, delete, or archive workspace output
53
- files by hand.
54
- - Semantic decisions are applied and recorded before close. Compile-close does
55
- not judge or rewrite semantic decisions; it only verifies the already-applied
56
- workspace and rebuilds approved structure projection.
57
-
58
- <reference>
59
-
60
- ## Stages inside `context close --format json`
61
-
62
- Close is one in-process command with one exit code:
63
-
64
- 1. **Approved knowledge scan** — reads approved Markdown only through CLI
65
- project readers.
66
- 2. **Structure projection** — writes deterministic `knowledge/structure.yaml`
67
- with nodes, approved edge projection, input hash, and structural edge
68
- contract status.
69
- 3. **Workspace verify** — runs the final verify gate. Any error prevents close
70
- readiness.
71
- 4. **Status receipt** — reports whether close is ready and which upstream gate
72
- owns any failure.
73
-
74
- ## Outcome routing
75
-
76
- | Outcome | Agent action |
77
- |---|---|
78
- | Ready, verify pass | Summarise approved nodes, approved edges, structural edge contract, and verify status. Stop. |
79
- | Ready, verify warnings only | Summarise warning codes and state that build may proceed when warnings are allowed by status/build gate. |
80
- | Verify error in approved section content/evidence | Surface the issue list and route back to compile actions or source recapture as indicated by status. Do not edit approved Markdown. |
81
- | Verify error in approved structure projection | Run `context close --format json` once more only when status says the projection is close-repairable; otherwise return to align structure. |
82
- | Source/evidence stale or missing | Route to source capture/refresh, then rerun align/compile as status instructs. |
83
-
84
- The close stage never edits rendered knowledge on the agent side. Every verify
85
- error routes back to the correct upstream gate (source capture, align
86
- structure, compile actions, or review), never sideways into a hand Edit. Use
87
- the CLI issue code and hint printed by `context close --format json` for the
88
- error→command mapping.
89
-
90
- References, changelog, section fingerprints, and package index rebuilds are not
91
- current close outputs.
92
-
93
- </reference>
94
-
95
- <procedures>
96
-
97
- ### Step 1 — Invoke close
98
-
99
- Run `context close --format json`. The caller may have already invoked it;
100
- check for existing output before re-running.
101
-
102
- ### Step 2 — Interpret
103
-
104
- Use stdout + stderr. The exit code selects the path via [Outcome routing](#outcome-routing).
105
-
106
- ### Step 3 — Route errors to the correct upstream command
107
-
108
- 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:
109
-
110
- - Section / content issue → rerun the current compile gate for that node.
111
- - Structure issue → return to align structure and user confirmation.
112
- - Source/evidence issue → recapture the affected source, then rerun align or
113
- compile as status instructs.
114
-
115
- One pass. If the CLI reports multiple errors, list them all and let the user choose the order; do not loop the close stage itself.
116
-
117
- ### Step 4 — Report
118
-
119
- Summarise in the user's language:
120
-
121
- - Approved node count.
122
- - Approved edge count and structural edge contract status.
123
- - Verify result: pass / pass-with-unverifiable-evidence / fail, with issue
124
- codes verbatim.
125
-
126
- Stop. Do not auto-invoke follow-on commands.
127
-
128
- ### Step 5 — Final guardrails
129
-
130
- Run close once, surface every error with its re-entry command, and never inspect or edit rendered knowledge outside the CLI.
131
-
132
- </procedures>
@@ -1,52 +0,0 @@
1
- # Action and Domain gates
2
-
3
- Consult this reference when **`node.node_type` is `action` or `domain`**. For
4
- `entity` Nodes, ignore this file and follow the main SKILL.md procedure.
5
-
6
- ## Action Nodes (`node.node_type === "action"`)
7
-
8
- Treat the confirmed node type and planned sections as the compile boundary for
9
- procedural claims. An Action Node exists because align confirmed process
10
- evidence: steps/phases, trigger -> handling -> result, role collaboration, or a
11
- repeatable plan. Actor, goal/outcome, repeatability, answerability, trigger,
12
- step, and phase claims **must** come from the selected planned section
13
- `source_refs[]`; do not invent process semantics from the title alone.
14
-
15
- | Evidence pattern | What it authorizes |
16
- |---|---|
17
- | Planned section source refs contain ordered steps, phases, or repeatable handling | `spec` or `example` Sections for procedure content. |
18
- | Planned section source refs explicitly name actor, goal, outcome, or repeatability | Concise `description` / `spec` Sections using those same refs. |
19
- | No source ref states a trigger | **No trigger Section.** Write goal or applicability if supported, but do not fabricate a trigger sentence. |
20
- | Existing structure edge or unresolved relation indicates another Node is required for answerability | Mention only what the current source refs support; keep the relation in structure, not in compile action fields or verbatim body. |
21
-
22
- If the planned sections for an `action` node do not contain source-backed
23
- process evidence, treat that as a structural defect and return to align using
24
- [structural-challenges.md](structural-challenges.md). Do not invent an action
25
- body just because the node type is `action`.
26
-
27
- If the current evidence can only support one thin Section or only a parallel
28
- option/config list, do not stretch it into procedure prose. Emit `skip` for the
29
- unsupported planned section, or return to align so the node can be revised. The
30
- CLI does not auto-downgrade an Action or choose replacement Entity tags.
31
-
32
- ## Domain Nodes (`node.node_type === "domain"`)
33
-
34
- Treat Domain nodes as grouping surfaces. The domain's scope and child grouping
35
- are expressed by confirmed `edges[]` and by source-backed planned sections; they
36
- do **not** authorize new reader-facing facts by themselves.
37
-
38
- - Source refs on planned sections may orient coverage of the Domain's range, but
39
- only those refs can support reader-facing text.
40
- - Child relations belong to `structure.yaml` typed edges, not active Sections;
41
- do not turn a child list into a Section.
42
- - Align-time grouping rationale is not evidence. Do **not** turn it into a
43
- `description` Section unless the planned source refs state the same claim.
44
-
45
- 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`.
46
-
47
- ## How this slots into the main procedure
48
-
49
- - **Step 1 — Sanity-check**: after the standard `node.id` / mount-matrix check,
50
- run the action/domain inspection above.
51
- - **Step 2 — Classify**: respect the gate's authorization boundary when picking kinds.
52
- - **Step 5 — Self-verify**: confirm no Section was written from evidence the gate disallowed.
@@ -1,48 +0,0 @@
1
- # Note snippets
2
-
3
- Consult this reference only when the current CLI exposes note evidence in a
4
- source-bound phase view. Note evidence carries conversation material
5
- (revisions, decisions, brainstorms) rather than primary source documents.
6
-
7
- ## TL;DR
8
-
9
- Note snippets are **prioritization hints, not write authority**. `note_intent`, `anchored_to[]`, and `revision_kind` may suggest update / replacement / complement / skip, but they never authorize a write without semantic review.
10
-
11
- ## How to route a note snippet
12
-
13
- When a source evidence entry has `source_type: "note"`:
14
-
15
- 1. **Compare against the anchor first.** If `anchored_to[]` names this Node or one of its Sections, treat that target as the candidate for `update` / replacement review / `add` (as a complement) / `skip`. **Do not create a new Node** from the note title here — that is an align-time concern.
16
-
17
- 2. **Use `note_intent` and `revision_kind` to bias the action**:
18
-
19
- | `note_intent` | typical action |
20
- |---|---|
21
- | `revision` | `update` when meaning stays the same; otherwise replacement review against the anchored Section |
22
- | `decision` | `add` a `decision` Section when no equivalent exists; otherwise `update` |
23
- | `brainstorm` | usually `skip` unless the brainstorm explicitly confirms a fact the Node should record |
24
-
25
- `revision_kind` (`replace` / `clarify` / ...) refines the choice within `revision`.
26
-
27
- 3. **No-write reviewed-no-write case.** If the note says "don't modify active
28
- knowledge yet" or the correct outcome is no-write after review, emit `skip`
29
- with the note's current `source_refs[]` when the CLI exposes them. This lets
30
- semantic review record `reviewed_no_write` instead of treating the skip as an
31
- unreviewed no-op.
32
-
33
- 4. **Bare skip is not allowed for notes.** A bare `skip` (no evidence) is only
34
- for deterministic no-op cases such as unchanged input or pure navigation.
35
- Notes always carry an anchor and an intent; the skip must cite the note's
36
- explicit source ref when the current CLI exposes one.
37
-
38
- ## Where this lives in the main procedure
39
-
40
- - **Step 2 — Classify**: run the note-first comparison **before** the generic kind priority chain. If the note resolves to `update` / replacement review / `skip` (reviewed), record the current action or user/structure route and move on; do not also process the same note through the generic chain.
41
- - **Step 5 — Self-verify**: every note snippet was either consumed by an
42
- anchored action or carried into a `skip` with `source_refs[]` when the current
43
- CLI exposes citeable refs.
44
-
45
- Notes never become compile challenge actions on their own. If a note describes a
46
- structural problem (missing Action, wrong parent, etc.), capture or cite the
47
- underlying source evidence and return to the structure gate described in
48
- `references/structural-challenges.md`.
@@ -1,85 +0,0 @@
1
- # Refresh and update
2
-
3
- Consult this reference when **any** of the following holds:
4
-
5
- - `existing.sections[]` is non-empty (Node already has active knowledge; this is a refresh, not a first compile).
6
- - `incremental.status` is `unchanged` or `full-context` (non-default incremental signals).
7
- - `incremental.locator_only_changes[]` is non-empty (locator-only deltas without content changes).
8
-
9
- For first compile of a fresh Node with `incremental.status === "changed-only"`, skip this file.
10
-
11
- ## Incremental status handling
12
-
13
- | `incremental.status` | What to do |
14
- |---|---|
15
- | `changed-only` (default) | Normal path — main SKILL.md procedure applies as written. |
16
- | `unchanged` | Emit exactly one `skip` action with a brief reason. Do not iterate snippets. |
17
- | `full-context` | Draft from the full fallback. **Preserve `unknown_inputs[]` reasons** in any abort/retry explanation so the caller sees why the fallback was needed. |
18
-
19
- The CLI may deterministically skip unchanged output or update locator-only evidence before writing. **Do not force artificial content changes to bypass fingerprint skip** — those skips are part of the protocol, not a problem to route around.
20
-
21
- ## Locator-only changes
22
-
23
- `incremental.locator_only_changes[]` entries always carry `agent_action: "none"` and `handled_by: "compile-close"`. **Do not emit a draft action for those Sections** unless the same Section also appears in `changed_blocks[]` with a real content change.
24
-
25
- ## Reconciling with `existing.sections[]`
26
-
27
- When `existing.sections[]` is non-empty, every section id you read here is a
28
- potential same-section `update` target or a signal that the structure/user gate
29
- must decide a higher-risk replacement or withdrawal. Walk the existing Sections
30
- in order and decide:
31
-
32
- | Raw evidence vs existing Section | op |
33
- |---|---|
34
- | Raw still supports the existing claim unchanged | Emit nothing (or one summarising `skip`) |
35
- | Raw clarifies or rephrases without changing meaning | `update` — same `section-N` stays active |
36
- | Raw changes meaning (new spec value, reversed decision) | Stop and route to user/structure review; do not emulate a replacement with `update` |
37
- | Raw removes the supporting evidence | Stop and route to user/structure review; do not hide the previous active section with a compile no-write |
38
-
39
- ### Replacement vs `update` semantics
40
-
41
- Replacement preserves the audit trail so readers can see that the prior policy
42
- changed — **critical for specs / decisions / principles**. Use `update` only
43
- for typo / wording fixes / detail additions that do not change meaning. When
44
- meaning changes or support disappears, do not write a compile action until the
45
- user/structure gate has chosen the intended disposition.
46
-
47
- ### Current output mechanics
48
-
49
- - `update` keeps the same planned section identity. In the current
50
- `context.compile-actions.v1` shape, emit `op: "update"` with `section_id`,
51
- `kind` when needed, `summary` when useful, and current `source_refs[]`. Omit
52
- `content` so the CLI mirrors the new cited source span. If the intended update
53
- requires translation, compression, or reorganization, stop and return to the
54
- structure/user gate instead of writing reader-visible content in compile.
55
- - Fresh replacement content is a new structure/review decision, not a current
56
- compile write shape. Preserve the semantic judgment in the user report or
57
- unresolved structure discussion and route back to the appropriate gate; do
58
- not invent unsupported target fields.
59
-
60
- ## Output shape (current update path)
61
-
62
- ```jsonc
63
- {
64
- "schema_version": "context.compile-actions.v1",
65
- "view_ref": "architecture:entity/example",
66
- "actions": [
67
- {
68
- "op": "update",
69
- "section_id": "retention-policy",
70
- "kind": "spec",
71
- "summary": "...",
72
- "source_refs": ["file:docs/example.md#span:retention L10-14@<span-hash>"]
73
- }
74
- ]
75
- }
76
- ```
77
-
78
- ## How this slots into the main procedure
79
-
80
- - **Step 1 — Sanity-check**: when `existing.sections[]` is non-empty, read every section id and status before classifying snippets. When `incremental.status` is `unchanged`, short-circuit with one `skip`.
81
- - **Step 2 — Classify**: still walk the kind priority chain for each citation-eligible snippet; the reconciliation table above governs which `op` to emit for snippets that map to an existing Section.
82
- - **Step 5 — Self-verify**: every `update` targets a known planned section id
83
- from the confirmed structure. If a replacement or withdrawal judgment has no
84
- accepted compile action shape, stop and route back through review/align
85
- instead of emitting unsupported fields.