@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,327 +0,0 @@
1
- ---
2
- name: skill-prose-align
3
- description: >
4
- Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Uses Context document evidence views to propose, validate, and confirm
6
- `unapproved/structure.yaml` without reading raw snapshots directly.
7
- tools:
8
- - Bash
9
- ---
10
-
11
- # skill-prose-align
12
-
13
- Turn captured document evidence into confirmed structure.
14
-
15
- ## TL;DR
16
-
17
- - Use this after document capture, or when the user asks to split, merge,
18
- reorganize, classify, or relate document evidence.
19
- - The first product output is a structure draft, not final page body.
20
- - Read source material only through CLI evidence views: `read-plan`,
21
- `source-index`, `span-detail`, `span-text`, `schema`, and
22
- `structure-summary`. Additional views are diagnostic surfaces; use the route
23
- and view set returned by the CLI.
24
- - Write and validate `context.structure.v1` into `unapproved/structure.yaml`.
25
- Stop for user confirmation before compile.
26
- - Before classifying nodes, section plans, edges, support strength, duplicates,
27
- conflicts, ownership, or unresolved items, read only the procedure references
28
- in the CLI `semantic_rules.required` set. Use each returned `reason` to keep
29
- unrelated rules out of the current judgment.
30
- - Plan source evidence as Sections before promoting any heading to a Node/View.
31
- Local FAQ, decision, incident, warning, or reference fragments normally stay
32
- under the owning View unless source evidence proves independent retrieval
33
- identity.
34
- - Do not produce or validate a structure payload from this entry file alone. A
35
- ruleset already present in the active context may be reused only when both its
36
- `handle` and `digest` match. If the context was compacted, the digest changed,
37
- or the rule content is no longer present, read `semantic_rules.required`.
38
- - When status reaches `structure-ready` or `needs-prose-compile`, hand off to
39
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-prose-compile/SKILL.md`.
40
- - Compile, review, close, verify, and build remain separate gates.
41
-
42
- <reference>
43
-
44
- ## User-Facing Gates
45
-
46
- Use semantic labels, not SDK function names:
47
-
48
- | Gate | Say this | Do not say this first |
49
- |---|---|---|
50
- | Material investigation | "I will read the evidence index and source spans through Context, then propose a structure draft." | `alignProse`, `source-index`, `context.structure.v1` |
51
- | Structure confirmation | "Confirming this structure freezes page paths, section ownership, and relationships for this compile round." | `unapproved/structure.yaml` as a raw parameter |
52
- | Compile handoff | "The structure is confirmed; I will switch to source-bound compile for draft pages." | Continuing to edit structure in compile |
53
-
54
- ## Runtime Discipline
55
-
56
- Use these rules in the current phase-runner flow:
57
-
58
- - Follow the top-level state, `routing.command_plan`, CLI `next_action`, and
59
- CLI-returned `next_command` values for every write. Treat `allowed_actions[]`
60
- as permission for read-only insertions; it is not a menu of alternate write
61
- paths.
62
- - Use `views[].command` / `next_command` for evidence reads, prioritizing the
63
- CLI-designated expected view when present.
64
- - Treat `agent_hints[]` as temporary diagnostics. If an agent hint conflicts
65
- with a top-level `next_action` or status route, follow the top-level route.
66
- - Do not use direct file tools, shell scripts, `jq`, `sed`, `cat`, `head`,
67
- `tail`, Python, or Node.js to inspect `sources/`, `unapproved/`,
68
- `knowledge/`, `dist/`, or CLI-managed `.tmp` as a substitute for Context
69
- views.
70
- - Write digest/hash flags are stale guards. Use the value returned by the CLI;
71
- do not parse stdout fragments or host tool-result files to reconstruct one.
72
- - Delegated execution is only valid when the user explicitly authorizes it in
73
- this conversation. Do not infer it from "continue", "继续", or general trust.
74
- - Run one write at a time. Do not parallelize align stage, compile stage, review
75
- apply, close, or build writes.
76
- - If a payload is too large for a heredoc, stage it under
77
- `.tmp/agent-payloads/<run-id>/...` in the workspace root and redirect stdin
78
- from that file. Never reuse fixed `/tmp/c4a-*` names, and never place agent
79
- scratch payloads under CLI-managed `.tmp/context-cli/`, `sources/`,
80
- `unapproved/`, `knowledge/`, `dist/`, or package output directories.
81
- - If a validation or view response includes `reason_code`, `path`, `missing[]`,
82
- `diagnostics`, `repair_hints`, or `agent_hints`, treat those fields as the
83
- repair contract. Do not recover by replaying a stale manual route, editing
84
- rendered files, or guessing schema aliases.
85
-
86
- ## Evidence Views
87
-
88
- Recommended read order:
89
-
90
- ```bash
91
- context run align:<type>:<source>:<collection> --view read-plan --format json
92
- context run align:<type>:<source>:<collection> --view source-index --compact --format json
93
- context run align:<type>:<source>:<collection> --view span-detail --span <source-ref> --format json
94
- context run align:<type>:<source>:<collection> --view span-text --span <source-ref> --format json
95
- context run align:<type>:<source>:<collection> --view schema --format json
96
- context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
97
- ```
98
-
99
- Use CLI-returned `next_command` values for pagination. Do not reconstruct
100
- documents with ad hoc `cat`, `grep`, or scripts against `sources/` or `.tmp`.
101
-
102
- ## Structure Contract
103
-
104
- The structure draft uses `schema_version: context.structure.v1` and lives at
105
- `unapproved/structure.yaml` after staging. It contains:
106
-
107
- - lifecycle state such as validated/confirmed and frozen snapshot metadata;
108
- - concept `nodes[]` with stable `node_ref`, `node_type`, title/summary, and
109
- ownership;
110
- - materialized `views[]` with `view_ref`, collection, path, section plans, and
111
- evidence refs;
112
- - typed edges using the closed set defined by the CLI;
113
- - unresolved items when evidence is weak, conflicting, or the target node is
114
- missing.
115
-
116
- Confirmed structure is a human gate. Validation passing is not the same as
117
- confirmation. Do not write `lifecycle.state: confirmed`, `confirmed_by`,
118
- `confirmed_at`, or `structure_digest` until the user has explicitly confirmed
119
- the structure proposal in the conversation.
120
-
121
- ## Procedure References
122
-
123
- These are current structure planning rules. They define the source-bound
124
- semantic gates for Node planning, section ownership, and relationship handling.
125
-
126
- | Decision | Reference |
127
- |---|---|
128
- | Structure planning, Node ownership, density, candidate resolution | [references/internal-procedures/structure-planning.md](references/internal-procedures/structure-planning.md) |
129
- | Node type, title, tags, fake entity, action/domain gates, edge gates | [references/internal-procedures/structure-planning/references/gates.md](references/internal-procedures/structure-planning/references/gates.md) |
130
- | Source density and coarse reading judgment | [references/internal-procedures/structure-planning/references/density-profile.md](references/internal-procedures/structure-planning/references/density-profile.md) |
131
- | Candidate anomalies, stable ids, paths, duplicates, and conflicts | [references/internal-procedures/structure-planning/references/candidate-resolution.md](references/internal-procedures/structure-planning/references/candidate-resolution.md) |
132
-
133
- </reference>
134
-
135
- <procedures>
136
-
137
- ### Step 1 — Open Material Investigation
138
-
139
- Run:
140
-
141
- ```bash
142
- context run align:<type>:<source>:<collection> --view read-plan --format json
143
- ```
144
-
145
- Use the returned views, budgets, snapshot hash, and next actions. If the CLI
146
- reports a missing or stale snapshot, route back to source capture/refresh. Do
147
- not read the snapshot file yourself.
148
-
149
- ### Step 2 — Read Evidence Through The Index
150
-
151
- Read a compact index before requesting exact spans:
152
-
153
- ```bash
154
- context run align:<type>:<source>:<collection> --view source-index --compact --format json
155
- ```
156
-
157
- For exact evidence, copy CLI-returned source refs or next commands:
158
-
159
- ```bash
160
- context run align:<type>:<source>:<collection> --view span-detail --span <source-ref> --format json
161
- context run align:<type>:<source>:<collection> --view span-text --span <source-ref> --format json
162
- ```
163
-
164
- Keep a short note of what evidence supports each proposed node, section, and
165
- edge. If the evidence is weak or conflicting, keep it as unresolved instead of
166
- turning it into a fact.
167
-
168
- Before drafting structure, read:
169
-
170
- - [references/internal-procedures/structure-planning.md](references/internal-procedures/structure-planning.md)
171
- - [references/internal-procedures/structure-planning/references/gates.md](references/internal-procedures/structure-planning/references/gates.md)
172
- - [references/internal-procedures/structure-planning/references/density-profile.md](references/internal-procedures/structure-planning/references/density-profile.md)
173
- - [references/internal-procedures/structure-planning/references/candidate-resolution.md](references/internal-procedures/structure-planning/references/candidate-resolution.md)
174
-
175
- Do not treat this as optional background. These files contain the current
176
- semantic gates for source-bound structure planning. A structure payload drafted
177
- without the applicable references is incomplete, even if the CLI schema accepts
178
- its shape.
179
-
180
- ### Step 3 — Draft And Validate Structure
181
-
182
- Request the schema:
183
-
184
- ```bash
185
- context run align:<type>:<source>:<collection> --view schema --format json
186
- ```
187
-
188
- Create a `context.structure.v1` YAML file. The draft may include a one-page-per
189
- source shape, but that is represented as ordinary nodes and sections; it does
190
- not bypass structure confirmation.
191
-
192
- For small payloads, use stdin/heredoc. For larger payloads, write a scratch file
193
- under `.tmp/agent-payloads/<run-id>/` and pass it through `--input`. Scratch
194
- files are disposable agent working files; they are never phase state and
195
- must not be read back as a substitute for CLI views.
196
-
197
- Validate:
198
-
199
- ```bash
200
- context run align:<type>:<source>:<collection> --validate --input <structure.yaml> --format json
201
- ```
202
-
203
- Validation returns `structure_summary` and writes a temporary HTML report under
204
- `.tmp/context-runtime/reports/`. A validation report with
205
- `confirmation_ready=false` is an Agent repair artifact, not a user review gate:
206
- do not ask the user to approve it. The staged report produced after
207
- `confirmation_ready=true` is the final review surface; use its
208
- `structure_report.file_url` as the primary user-facing link and include
209
- `structure_report.absolute_path` as a copyable fallback.
210
- If the user needs a focused view, run:
211
-
212
- ```bash
213
- context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
214
- ```
215
-
216
- The CLI response may include a large full `structure_summary` for debugging and
217
- report rendering. For user confirmation, prioritize the first-screen fields:
218
- `review_notice`, `structure_report`, and `structure_summary_compact`. A valid
219
- user-facing confirmation prompt must include the report `file_url`, the absolute
220
- path fallback, and a compact summary of collections/views/unresolved/diagnostics.
221
- Do not ask the user to confirm from counts alone.
222
-
223
- Repair diagnostics by routing them to the right decision:
224
-
225
- - source ref or snapshot mismatch -> reread evidence views or refresh capture;
226
- - unsupported node/section/edge -> remove it or mark unresolved;
227
- - duplicate/conflict -> ask the user which structure should win;
228
- - illegal edge type, missing target node, or edge without source refs -> fix the
229
- structure or keep the relation unresolved;
230
- - stale structure -> regenerate from the current snapshot hash.
231
-
232
- When validation returns `repair_confirmation_blockers`, follow its exact repair
233
- route without stopping for human confirmation. `--repair suggested-splits`
234
- mechanically splits non-contiguous source mirror Sections; write its
235
- `repaired_payload` to a scratch YAML file and validate again. For oversized
236
- Views, use the returned child-View and contains-edge suggestions, but classify
237
- each child Node from evidence instead of mechanically inheriting the parent
238
- type. Repair other diagnostics from evidence and validate again. Ask the user only when evidence
239
- supports multiple incompatible semantic choices, and label that question as a
240
- structure-design choice rather than final review. Do not stage until
241
- `confirmation_ready=true`.
242
-
243
- ### Step 4 — Review Structure Before Confirmation
244
-
245
- After validation reports `confirmation_ready=true`, stage the draft. The stage
246
- command opens the final report. Then show the user:
247
-
248
- - node list and planned paths;
249
- - section ownership;
250
- - typed edges and unresolved relation candidates;
251
- - expected compile order;
252
- - downstream impact: these choices freeze paths, section ownership, and
253
- relationships for this compile round.
254
- - the `structure_report.file_url` generated by validate or `--view
255
- structure-summary`;
256
- - the `structure_report.absolute_path` fallback in case the host cannot click
257
- file URLs.
258
-
259
- If the CLI stage result includes `next_action.human_gate: true`, treat it as a
260
- hard stop for structure review. Do not ask for a blind "confirm structure"
261
- reply. Surface the report `file_url`, absolute path, and enough structured
262
- summary for the user to inspect what will be confirmed.
263
-
264
- Do not turn `confirmation_blockers` into a preliminary approval round. A
265
- validator-required page split, continuous-source split, ref repair, or
266
- structure-spine connection is work to resolve before staging. If a genuinely
267
- ambiguous semantic choice needs the user, ask only that choice and then resume
268
- repair; it does not replace the final report-based confirmation.
269
-
270
- Use the host's multi-choice question tool when available. If unavailable, use a
271
- short Markdown fallback. Good options are:
272
-
273
- - Confirm this structure and continue to compile.
274
- - Revise the structure with additional guidance.
275
- - Go back to source scope or capture because the evidence set is wrong.
276
-
277
- Only after confirmation, run the CLI confirmation command, normally:
278
-
279
- ```bash
280
- context run align:<type>:<source>:<collection> --confirm --format json
281
- ```
282
-
283
- If confirming a structure file other than `unapproved/structure.yaml`, pass it
284
- with `--input <structure.yaml>`. A draft stage in `unapproved/structure.yaml` is
285
- not confirmation. Do not edit `unapproved/structure.yaml` after confirmation to
286
- change meaning; return to this gate instead.
287
-
288
- ### Step 5 — Handoff To Compile
289
-
290
- After the user confirms the structure and the CLI reports `structure-ready` or
291
- `needs-prose-compile`, stop this procedure and follow:
292
-
293
- ```text
294
- ${CLAUDE_PLUGIN_ROOT}/skills/skill-prose-compile/SKILL.md
295
- ```
296
-
297
- Do not keep editing structure while compiling. If compile diagnostics show the
298
- planned structure is wrong, return to this align gate and ask the user to
299
- confirm the corrected structure.
300
-
301
- ### Step 6 — Self-verify Checklist
302
-
303
- - [ ] Evidence came only from Context evidence views.
304
- - [ ] `context.structure.v1` was validated before user confirmation.
305
- - [ ] User confirmed the structure before compile.
306
- - [ ] Compile was delegated to `skill-prose-compile`; this procedure did not
307
- write draft page body.
308
- - [ ] Relationships are expressed as structure edges or unresolved items.
309
- - [ ] No direct edits were made to `sources/`, `.tmp`, `unapproved/`,
310
- `knowledge/`, review HTML, or `dist/`.
311
-
312
- ### Final Report
313
-
314
- Report in the user's language. Include only:
315
-
316
- - evidence views actually read;
317
- - proposed and confirmed node count, section count, edge count, and unresolved
318
- count;
319
- - user confirmation outcome;
320
- - validation warnings that still matter for compile;
321
- - next route reported by status or the align phase.
322
-
323
- Do not report payload digests, snapshot hashes, source-ref hashes, absolute
324
- paths, or scratch file paths unless the CLI explicitly asks the user to repair
325
- one.
326
-
327
- </procedures>
@@ -1,91 +0,0 @@
1
- # Candidate Resolution Rules
2
-
3
- Use these rules after reading the current align evidence views and before
4
- authoring `context.structure.v1`. They define how current anomaly diagnostics
5
- map to supported structure outcomes.
6
-
7
- ## Anomaly Signals
8
-
9
- Anomaly diagnostics are mechanical warnings. Do not ignore them and do not treat
10
- them as recommendations.
11
-
12
- For each anomaly, choose one current outcome and record the reasoning in the
13
- structure payload or user-facing explanation:
14
-
15
- | Outcome | Use When |
16
- |---|---|
17
- | Accept the correction | The anomaly points to a real structure fix. Apply a concrete node, section, edge, or ownership correction supported by source refs. |
18
- | Dismiss with rationale | The warning is mechanically true but semantically harmless. Keep the structure and state why in the confirmation summary. |
19
- | Keep unresolved | The warning changes structure but source evidence is insufficient. Add an `unresolved[]` item instead of guessing. |
20
-
21
- Known anomaly kinds:
22
-
23
- | Kind | Meaning | Required handling |
24
- |---|---|---|
25
- | Missing evidence | A proposed node, section, or edge has no source-backed evidence. | Add source refs, remove it, or keep the issue unresolved. |
26
- | Structure churn | A node was renamed, split, merged, replaced, or rejected during investigation. | Confirm the final id/title/target with the user or keep the ambiguity unresolved. |
27
- | Duplicate evidence | The same source ref appears more than once for the same semantic role. | Deduplicate it or explain why the repeated ref supports different roles. |
28
- | Broad review needed | The CLI collapsed many anomalies or reports aggregate risk. | Review the affected structure broadly; do not finalize solely from ordering. |
29
-
30
- ## Stable References
31
-
32
- Use stable `node_ref`, `view_ref`, and `section_ref` values from the current
33
- `context.structure.v1` payload for in-payload references. A NodeRef should be
34
- safe, lower-case, and path-shaped, such as `entity/rspack` or
35
- `domain/build-tooling`. `slug` and `path` are derived fields in the current
36
- flow; do not invent alternate reference aliases.
37
-
38
- When an edge or section points at knowledge:
39
-
40
- - use the schema ref that matches the target layer:
41
- `node_ref` for a conceptual Node, `view_ref` for a collection view, and
42
- `section_ref` for a planned section;
43
- - ensure the target NodeRef, ViewRef, or SectionRef exists in the current
44
- structure or approved knowledge;
45
- - keep relation hints unresolved when the target does not exist;
46
- - follow CLI diagnostics if a ref is unknown or stale.
47
-
48
- Do not create alternate alias fields or non-schema candidate ledger fields.
49
- They are not part of the current structure contract.
50
-
51
- ## Visible Labels And Audit Rationale
52
-
53
- Humans need to understand merge, reject, rename, and replacement choices
54
- without decoding temporary ids. Keep that discipline in the current structure
55
- flow through current fields:
56
-
57
- - use `title` and `summary` to name the final node in user-facing language;
58
- - explain renamed/split/merged candidates in the confirmation summary, not by
59
- adding non-schema label fields;
60
- - when a relation or rename cannot be settled from evidence, put the visible
61
- title/target clue in `unresolved[]`;
62
- - when asking the user, phrase the choice with business labels ("Rspack build
63
- tool page" vs "Webpack page"), not with source refs or internal section ids.
64
-
65
- NodeRef is the stable conceptual identity. ViewRef is the collection-specific
66
- view identity and is the durable approved-page identity. SectionRef is the
67
- stable planned-section identity under a ViewRef. Package paths are derived from
68
- the approved ViewRef plus containment/slug; do not treat paths as an alternate
69
- identity contract. Visible labels help humans review the choice, but they do
70
- not authorize a different NodeRef, ViewRef, edge, or section ownership without
71
- source-backed evidence and user confirmation.
72
-
73
- ## Duplicate And Conflict Handling
74
-
75
- - Exact duplicate structure -> keep one node/section/edge and explain the
76
- duplicate in the confirmation summary.
77
- - Same topic but different evidence boundary -> keep separate sections only
78
- when each section has a distinct source-backed role.
79
- - Conflicting facts -> ask the user or keep an `unresolved[]` item. Do not
80
- pick a winner from title order or source order.
81
- - Replacement or rename -> ask the user when it changes NodeRef, ViewRef,
82
- containment, slug, or the derived approved path. These are durable user-facing
83
- identities, not disposable labels.
84
-
85
- ## Self-verify
86
-
87
- - [ ] Every accepted node, section, and edge has source-backed support.
88
- - [ ] Every unresolved relation or conflict is explicit in `unresolved[]`.
89
- - [ ] No non-schema candidate ledger fields or alias fields appear in the payload.
90
- - [ ] NodeRef, ViewRef, and SectionRef values, not temporary labels or paths,
91
- are used for current references.
@@ -1,30 +0,0 @@
1
- # Evidence Density Selection
2
-
3
- Use density as a private reading and section-planning strategy. It is not a
4
- separate payload, not a quality score, and not a workflow stage. Persist only
5
- current `context.structure.v1` fields such as `nodes[]`, `sections[]`,
6
- `source_refs[]`, `edges[]`, and `unresolved[]`.
7
-
8
- Apply this reference when a captured source is long, dense, fragmented, or hard
9
- to split into stable planned sections. Use the current CLI evidence views
10
- (`read-plan`, `source-index`, `span-detail`, `span-text`) to inspect material;
11
- do not invent a separate coarse-read artifact.
12
-
13
- | Profile | Use When | Agent Behavior |
14
- |---|---|---|
15
- | `macro` | A long source has many headings, sections, or broad topic shifts. | Create section proposals around major headings and preserve document-level anchors so later passes do not flatten scope. |
16
- | `meso` | Default for normal product, design, or operational documents with several related sections. | Produce section proposals for meaningful local units and preserve evidence anchors. |
17
- | `micro` | The source is fragmented, note-like, or dense with short independent claims. | Keep section proposals narrow and avoid bundling unrelated blocks into one candidate. |
18
- | `single_pass` | The source is short enough that one read can safely discover all relevant structure. | Keep anchors minimal and avoid over-segmentation, but still validate the resulting structure. |
19
-
20
- Treat Markdown heading changes as section-planning hints, not hard boundaries.
21
- Sibling sub-headings under a shared parent can remain in one planned section
22
- when they form one coherent semantic topic for that parent. Headings with no
23
- shared parent should usually split unless you intentionally want one section to
24
- span them. When a dense source has many headings, split by heading first, then
25
- merge adjacent or sibling groups only when the merged section is still one
26
- coherent fact group.
27
-
28
- Do not let density alone choose `node_type`, `tags`, `section.kind`, or body
29
- content. Action/domain gates are decided from source evidence and the current
30
- schema, not from density metadata.