@c4a/context-cli 0.6.1 → 0.6.3

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 (246) hide show
  1. package/README.md +77 -12
  2. package/README.zh-CN.md +202 -0
  3. package/cli.js +74066 -45247
  4. package/docs/context-debug-event-v1.schema.json +29 -0
  5. package/docs/context-debug-replay-v1.schema.json +33 -0
  6. package/docs/debug-tracing.md +86 -0
  7. package/docs/quickstart.md +23 -5
  8. package/package.json +8 -3
  9. package/plugins/README.md +60 -118
  10. package/plugins/README_CN.md +51 -102
  11. package/plugins/VERSION +1 -1
  12. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  13. package/plugins/claude/commands/continue.md +61 -10
  14. package/plugins/claude/commands/init.md +26 -11
  15. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  16. package/plugins/codex/skills/continue/SKILL.md +61 -11
  17. package/plugins/codex/skills/init/SKILL.md +28 -14
  18. package/plugins/cursor/.cursor-plugin/plugin.json +2 -3
  19. package/plugins/cursor/README.md +2 -2
  20. package/plugins/cursor/commands/context-continue.md +61 -10
  21. package/plugins/cursor/commands/context-init.md +26 -11
  22. package/plugins/skills/context-continue/SKILL.md +61 -11
  23. package/plugins/skills/context-init/SKILL.md +28 -14
  24. package/providers/context/actions/accept-package-templates.yaml +5 -0
  25. package/providers/context/actions/align-next.yaml +6 -0
  26. package/providers/context/actions/apply-managed-review.yaml +5 -0
  27. package/providers/context/actions/apply-structure-confirmation.yaml +5 -0
  28. package/providers/context/actions/build-next.yaml +5 -0
  29. package/providers/context/actions/capture-next.yaml +5 -0
  30. package/providers/context/actions/close-approved-knowledge.yaml +5 -0
  31. package/providers/context/actions/compile-next.yaml +5 -0
  32. package/providers/context/actions/configure-code-extraction.yaml +5 -0
  33. package/providers/context/actions/configure-document-capture.yaml +5 -0
  34. package/providers/context/actions/configure-package-output.yaml +5 -0
  35. package/providers/context/actions/configure-prose-lifecycle.yaml +5 -0
  36. package/providers/context/actions/extract-next.yaml +5 -0
  37. package/providers/context/actions/inspect-document-classification.yaml +5 -0
  38. package/providers/context/actions/inspect-repository-recovery.yaml +6 -0
  39. package/providers/context/actions/inspect-review.yaml +5 -0
  40. package/providers/context/actions/inspect-structure.yaml +5 -0
  41. package/providers/context/actions/maintain-evidence.yaml +6 -0
  42. package/providers/context/actions/materialize-context-view.yaml +8 -0
  43. package/providers/context/actions/reconcile-review-identities.yaml +5 -0
  44. package/providers/context/actions/register-source-batch.yaml +7 -0
  45. package/providers/context/actions/repair-project-entry.yaml +5 -0
  46. package/providers/context/actions/repair-verification.yaml +5 -0
  47. package/providers/context/actions/repair-workspace-state.yaml +5 -0
  48. package/providers/context/actions/restore-repository-sources.yaml +7 -0
  49. package/providers/context/codes.yaml +41 -0
  50. package/providers/context/graphs/workspace.yaml +536 -0
  51. package/providers/context/manifest.json +700 -0
  52. package/providers/context/provider.yaml +12 -0
  53. package/providers/context/resources/diagnostics/projection-stale.md +13 -0
  54. package/providers/context/resources/diagnostics/verification.md +21 -0
  55. package/providers/context/resources/diagnostics/workspace-state.md +27 -0
  56. package/providers/context/resources/dialogue/code-extraction.md +34 -0
  57. package/providers/context/resources/dialogue/document-capture.md +29 -0
  58. package/providers/context/resources/dialogue/document-classification.md +33 -0
  59. package/providers/context/resources/dialogue/evidence-maintenance.md +26 -0
  60. package/providers/context/resources/dialogue/human-gates.md +34 -0
  61. package/providers/context/resources/dialogue/knowledge-review.md +27 -0
  62. package/providers/context/resources/dialogue/package-output.md +30 -0
  63. package/providers/context/resources/dialogue/repository-source-recovery.md +23 -0
  64. package/providers/context/resources/dialogue/source-boundary.md +29 -0
  65. package/providers/context/resources/dialogue/structure-confirmation.md +44 -0
  66. package/providers/context/resources/manuals/guides/lark-resources.md +121 -0
  67. package/providers/context/resources/manuals/guides/package-outputs.md +267 -0
  68. package/providers/context/resources/manuals/reference/package-templates.md +378 -0
  69. package/providers/context/resources/manuals/reference/project-api.md +825 -0
  70. package/providers/context/resources/manuals/reference/template-variables.md +248 -0
  71. package/providers/context/resources/procedures/close-and-build.md +23 -0
  72. package/providers/context/resources/procedures/code-extraction.md +50 -0
  73. package/providers/context/resources/procedures/document-capture.md +49 -0
  74. package/providers/context/resources/procedures/document-classification.md +22 -0
  75. package/providers/context/resources/procedures/evidence-maintenance.md +20 -0
  76. package/providers/context/resources/procedures/knowledge-review.md +34 -0
  77. package/providers/context/resources/procedures/package-output.md +37 -0
  78. package/providers/context/resources/procedures/project-configuration.md +21 -0
  79. package/providers/context/resources/procedures/prose-align.md +68 -0
  80. package/providers/context/resources/procedures/prose-compile.md +23 -0
  81. package/providers/context/resources/procedures/repository-source-recovery.md +43 -0
  82. package/providers/context/resources/procedures/source-boundary.md +48 -0
  83. package/{plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md → providers/context/resources/procedures/source-capture-detailed.md} +54 -19
  84. package/providers/context/resources/procedures/verify-and-repair.md +31 -0
  85. package/{plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references → providers/context/resources/semantic/align}/candidate-resolution.md +17 -2
  86. package/{plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references → providers/context/resources/semantic/align}/density-profile.md +11 -0
  87. package/{plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references → providers/context/resources/semantic/align}/gates.md +13 -0
  88. package/{plugins/cursor/skills/skill-prose-align/references/internal-procedures → providers/context/resources/semantic/align}/structure-planning.md +62 -12
  89. package/providers/context/resources/semantic/compile/index.md +31 -0
  90. package/providers/context/resources/views/package-current.yaml +6 -0
  91. package/providers/context/resources/views/review-current.yaml +6 -0
  92. package/providers/context/resources/views/source-boundary.yaml +6 -0
  93. package/providers/context/resources/views/source-current.yaml +6 -0
  94. package/providers/context/resources/views/structure-current.yaml +6 -0
  95. package/providers/context/resources/views/verification-current.yaml +6 -0
  96. package/providers/context/resources/views/workspace-current.yaml +6 -0
  97. package/providers/context/schemas/evidence-maintenance-input.schema.json +30 -0
  98. package/providers/context/schemas/prose-structure-batch.schema.json +35 -0
  99. package/providers/context/schemas/repository-source-recovery.schema.json +40 -0
  100. package/providers/context/schemas/source-batch-input.schema.json +189 -0
  101. package/providers/context/scripts/render-context-view.mjs +21 -0
  102. package/plugins/claude/skills/skill-continue-workflow/SKILL.md +0 -235
  103. package/plugins/claude/skills/skill-init-workspace/SKILL.md +0 -74
  104. package/plugins/claude/skills/skill-package-output/SKILL.md +0 -180
  105. package/plugins/claude/skills/skill-prose-align/SKILL.md +0 -322
  106. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  107. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  108. package/plugins/claude/skills/skill-prose-compile/SKILL.md +0 -287
  109. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  110. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  111. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  112. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  113. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  114. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  115. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  116. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  117. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  118. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  119. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  120. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  121. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  122. package/plugins/claude/skills/skill-review-gate/SKILL.md +0 -138
  123. package/plugins/claude/skills/skill-source-scope/SKILL.md +0 -525
  124. package/plugins/claude/skills/skill-source-scope/references/capture-source.md +0 -201
  125. package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +0 -235
  126. package/plugins/codex/skills/continue/references/internal-procedures/skill-init-workspace.md +0 -74
  127. package/plugins/codex/skills/continue/references/internal-procedures/skill-package-output.md +0 -180
  128. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  129. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  130. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  131. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  132. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +0 -322
  133. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  134. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  135. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  136. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  137. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  138. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  139. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  140. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  141. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  142. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  143. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  144. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  145. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  146. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +0 -287
  147. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +0 -138
  148. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +0 -525
  149. package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +0 -235
  150. package/plugins/codex/skills/init/references/internal-procedures/skill-init-workspace.md +0 -74
  151. package/plugins/codex/skills/init/references/internal-procedures/skill-package-output.md +0 -180
  152. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  153. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  154. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  155. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +0 -322
  156. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  157. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  158. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  159. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  160. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  161. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  162. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  163. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  164. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  165. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  166. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  167. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  168. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  169. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +0 -287
  170. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +0 -138
  171. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md +0 -201
  172. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +0 -525
  173. package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +0 -235
  174. package/plugins/cursor/skills/skill-init-workspace/SKILL.md +0 -74
  175. package/plugins/cursor/skills/skill-package-output/SKILL.md +0 -180
  176. package/plugins/cursor/skills/skill-prose-align/SKILL.md +0 -322
  177. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  178. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  179. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  180. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +0 -287
  181. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  182. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  183. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  184. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  185. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  186. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  187. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  188. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  189. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  190. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  191. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  192. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  193. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  194. package/plugins/cursor/skills/skill-review-gate/SKILL.md +0 -138
  195. package/plugins/cursor/skills/skill-source-scope/SKILL.md +0 -525
  196. package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +0 -201
  197. package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +0 -235
  198. package/plugins/skills/context-continue/references/internal-procedures/skill-init-workspace.md +0 -74
  199. package/plugins/skills/context-continue/references/internal-procedures/skill-package-output.md +0 -180
  200. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  201. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  202. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  203. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  204. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +0 -322
  205. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  206. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  207. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  208. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  209. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  210. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  211. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  212. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  213. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  214. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  215. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  216. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  217. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  218. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +0 -287
  219. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +0 -138
  220. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +0 -201
  221. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +0 -525
  222. package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +0 -235
  223. package/plugins/skills/context-init/references/internal-procedures/skill-init-workspace.md +0 -74
  224. package/plugins/skills/context-init/references/internal-procedures/skill-package-output.md +0 -180
  225. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  226. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  227. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  228. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  229. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +0 -322
  230. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  231. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  232. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  233. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  234. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  235. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  236. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  237. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  238. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  239. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  240. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  241. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  242. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  243. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +0 -287
  244. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +0 -138
  245. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +0 -201
  246. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +0 -525
@@ -1,282 +0,0 @@
1
- ---
2
- name: structure-planning
3
- description: "Internal procedure for the current align gate. Reads CLI-guided align evidence, applies semantic Node classification gates, and emits context.structure.v1 payloads for CLI validation/stage."
4
- ---
5
-
6
- # Structure Planning Procedure
7
-
8
- ## TL;DR
9
-
10
- Run `context run align:<type>:<source>:<collection> --view read-plan --format json`, follow the top-level `next_action.command` to read the CLI-selected evidence path, produce a `context.structure.v1` structure payload, and continue following top-level `next_action`. The CLI owns route, validation, repair commands, and stage guards; this skill owns only semantic classification and source-bound structure judgment.
11
-
12
- <reference>
13
-
14
- ## Canonical Data
15
-
16
- - The current phase view result is authoritative. Branch on `next_action.kind`,
17
- execute `next_action.command`, and treat listed views as detail reads rather
18
- than a checklist.
19
- - `allowed_actions[]` describes capabilities on the current view result; it is
20
- not a menu of alternate write paths and does not override `next_action`.
21
- - `agent_hints[]`, when present, are diagnostics. Do not prefer them over
22
- top-level `next_action`.
23
- - Schema names and enum values come from
24
- `context run align:<type>:<source>:<collection> --view schema --format json`. Use
25
- that schema as the authoring contract for `context.structure.v1`.
26
- - Existing approved knowledge and `knowledge/structure.yaml` are the lookup
27
- registry exposed through current CLI/status/query views. Do not read
28
- `knowledge/**` or create a separate registry file.
29
- - Code projection Nodes are reusable knowledge handles. When document evidence belongs on a code symbol, reuse the code slug instead of creating a parallel document Node.
30
- - Validation diagnostics are the mechanical structure ownership source of
31
- truth. Non-content spans such as navigation references, placeholders, front
32
- matter, marker quotes, embed tags, and embedded assets should not become
33
- reader-facing Sections unless the evidence itself is the cited knowledge.
34
- - When relation hints are present, inspect them before finalizing graph
35
- structure. Use existing/current matches for typed `edges[]`; keep unresolved
36
- target ref/title hints deferred in `unresolved[]` and do not write dangling
37
- parent, child, or edge refs. Ordinary source-bound views require at least one
38
- source-backed planned section. The only empty-section exception is a generated
39
- parent index view: it must use `generated: parent_index`, `sections: []`, and
40
- source-backed `contains` edges to child views. For navigation-only /
41
- placeholder-only sources, keep useful source/page identities as `unresolved[]`
42
- notes until there is source-backed section evidence, a supported edge target,
43
- a valid parent-index container, or a later compile `skip` decision. If a
44
- placeholder/relation source is skipped entirely, leave its relation clues in
45
- `unresolved[]` only when they still matter; otherwise omit them.
46
- - `views[]` and diagnostics distinguish citable evidence from supporting context. Do not promote supporting/context-only material into cited Sections unless a later ownership correction makes it citation-eligible.
47
- - Keep cache-friendly prompt order: fixed protocol/schema first, existing knowledge lookup second, source evidence views third, current semantic payload last. Preserve CLI JSON order and do not add timestamps, random ids, scratch paths, or host paths to generated payloads.
48
- - Structure digests and snapshot hashes are stale guards. Follow returned
49
- `next_action.command` and do not invent digest values.
50
- - Node type, tag, fake-Entity, `domain`, and `action` gates are in `structure-planning/references/gates.md`.
51
- - Coarse reading density and neutral signal rules are in `structure-planning/references/density-profile.md`.
52
- - Candidate anomaly handling, stable references, duplicate handling, and
53
- conflict handling are in
54
- `structure-planning/references/candidate-resolution.md`.
55
-
56
- </reference>
57
-
58
- <procedures>
59
-
60
- Use this only inside the current align gate.
61
-
62
- ### Step 1 — Start From The Envelope
63
-
64
- Run `context run align:<type>:<source>:<collection> --view read-plan --format json`.
65
- Confirm the response is the current prose align view result, then identify
66
- `next_action`, available views, source metadata, and diagnostics.
67
-
68
- If the host truncates a view result but the preview includes top-level
69
- `next_action.command`, run that command. If `next_action` is not visible, rerun
70
- the current view command; do not recover host tool-result files.
71
-
72
- If no current phase view result is present, stop and surface the CLI output; do
73
- not reconstruct an align route from prior prompt memory.
74
-
75
- ### Step 2 — Follow The Evidence Read Path
76
-
77
- Run the returned `next_action.command`. For structural align work this is
78
- normally `read-plan`; after that, follow the evidence view's `next_action.command`
79
- or `next_command`.
80
-
81
- `read-plan` is the navigation surface. It chooses whether the next evidence read
82
- is `source-index`, `span-detail`, `span-text`, or another current evidence view.
83
- Read those views and then author the requested
84
- `context.structure.v1` payload yourself. Never pipe evidence text into validate.
85
-
86
- If an evidence view is truncated, `page.has_more: true`, or the CLI returns a
87
- `next_command`, run that command before authoring.
88
-
89
- Read evidence through semantic CLI views, not shell parsing. Follow `page.next_command` for pagination. If the command contains `--read-cursor`, treat it as opaque continuation state and run it exactly; do not replace it with hand-written `--source`, `--heading`, `--window`, or `--range` selectors. Use `--source`, `--heading`, `--window`, `--range`, and `--token-budget` as view filters only. `--unwrap` removes workflow metadata; it does not expand a compact view into full detail.
90
-
91
- If an evidence view returns `page.has_more`, `truncated: true`, or a
92
- view-specific incomplete-read diagnostic, treat that response as a partial
93
- read. Do not decide source-wide ownership or dense planned Sections from
94
- headings alone; continue the current detail view only when `page.next_command`
95
- is explicitly needed, otherwise return to the CLI-designated navigation view.
96
-
97
- ### Step 3 — Reuse Existing Knowledge
98
-
99
- Query existing knowledge for reusable names before proposing new term/service/system/action Nodes. Exact title/slug/alias hits should usually become references to the existing Node, not duplicate candidates.
100
-
101
- When a code projection Node already represents the object, reuse its slug for prose evidence and plan only prose-owned Sections for the current source evidence.
102
-
103
- ### Step 4 — Route Collection, Then Classify Semantic Structure
104
-
105
- Before choosing Node type or Section kind, route each evidence unit to its
106
- internal collection. The phase `<collection>` is only the entry profile for the
107
- current run; it is not a cap on what this structure may contain. A mixed source
108
- can produce multiple `views[]` in one confirmed structure when source evidence
109
- supports them.
110
-
111
- Use collection routing first:
112
-
113
- - product intent, user story, requirement, roadmap, or product scenario ->
114
- `product`;
115
- - architecture, service/module/system design, runtime dependency, code-adjacent
116
- prose -> `architecture`; if an existing code projection already owns the
117
- object, reuse its NodeRef/ViewRef instead of creating a `codegraph` prose
118
- view;
119
- - SOP, runbook, operation drill, workflow, or how-to procedure -> `sop`;
120
- - FAQ, question/answer, support notes -> `faq` only when the evidence is an
121
- independent FAQ page or cross-cutting support knowledge; a single Q&A or
122
- scattered support note stays as a `faq` Section under the owning view;
123
- - standards, policy, rules, conventions, reusable constraints -> `standards`;
124
- - decision record, trade-off, migration conclusion -> `decision` only when it
125
- is an independent decision record with owner/date/lifecycle or cross-cutting
126
- decision scope; one-off conclusions stay as `decision` Sections under the
127
- owning view;
128
- - incident, postmortem, outage, fault timeline, action item -> `incident` only
129
- when it has incident identity, timeline, follow-up, or tracking lifecycle;
130
- isolated warnings/failures/action items stay as `incident` or `warning`
131
- Sections under the owning view;
132
- - test plan, validation scenario, acceptance case -> `test`;
133
-
134
- Do not route prose align views to `codegraph` or `feats`: `codegraph` is
135
- produced by code extraction / AST projection, and `feats` is reserved for the
136
- dedicated feature workflow. For section-vs-collection overlap, keep a local
137
- `faq`, `decision`, or `incident` as a Section kind under the owning view unless
138
- the source is independently queryable across the package and has its own
139
- lifecycle, ownership, timeline, or cross-cutting scope.
140
-
141
- After collection routing, apply `structure-planning/references/gates.md` before
142
- authoring Nodes: classify Node type in order (`action` scale + process evidence,
143
- then concrete/term `entity`, then child-bearing `domain`), reject fake Entities
144
- only when at least two suspicious signals match, keep `term` separate from
145
- concrete tags, and provide required gate evidence.
146
-
147
- Preserve shared-source intent when the same source span legitimately supports
148
- multiple views. Do not copy the span text into multiple rewritten bodies; cite
149
- the same CLI `source_ref` in each supported view and let structure-summary mark
150
- the shared evidence.
151
-
152
- Source titles and headings are ordinary evidence, not structural authority. Choose titles and summaries that fit the final Node type and the CLI-provided generation policy.
153
-
154
- Plan source material as Sections first. A source heading only becomes a child
155
- Node/View when the cited evidence names a concrete independent subject, an
156
- atomic term, a gated Action, or a child-bearing Domain. A `contains` edge only
157
- states hierarchy; it does not prove that a thin child page has standalone
158
- retrieval value.
159
-
160
- Avoid same-source fragmentation. If one parent would contain many single-section
161
- child Entities from the same source document, keep them as Sections unless each
162
- child has an independent product/code object, atomic term, Action, or Domain
163
- identity. Also avoid copying the parent `system` / `application` scope tag onto
164
- local child aspects; tag a child by what it independently is.
165
-
166
- Do not promote a source fragment into a child page solely because it has a
167
- heading or a recognized section kind. Judge every proposed child with the same
168
- source-backed criteria: independent subject identity, sufficient context, and
169
- standalone retrieval value. The CLI may warn about repeated same-source thin
170
- children, but page granularity remains an evidence-backed structure decision
171
- for the review report rather than a content-type-specific hard gate.
172
-
173
- For `node.title` and `node.summary`, follow the workspace/source language
174
- surfaced by the current view or the user's instruction. In Chinese workspaces,
175
- translate descriptive scaffold words such as architecture, strategy, lifecycle,
176
- overview, scheduling, high availability, and warning into Chinese while
177
- preserving product names, code identifiers, CLI flags, slugs, source_ref tokens,
178
- and citation tokens exactly when needed. Do not copy an English source title
179
- into `node.title` merely because the source is English.
180
-
181
- Do not classify a broad architecture/system/方案 source as `domain` just because the title sounds like a scope. If it has writable Sections but no resolvable current/existing child Nodes, use an `entity` tag such as `system` or `application`; reserve `domain` for grouping child Nodes through typed `edges[]` with supported child targets.
182
-
183
- For large or batched payloads, use
184
- `structure-planning/references/density-profile.md` and
185
- `structure-planning/references/candidate-resolution.md` as judgment aids.
186
- They do not create additional workflow stages or alternate payloads.
187
-
188
- ### Step 5 — Build The Payload Requested By `next_action`
189
-
190
- Use `context run align:<type>:<source>:<collection> --view schema --format json` to
191
- shape the payload. Treat that schema as the authoring contract.
192
-
193
- Produce one `context.structure.v1` document with semantic Nodes, planned
194
- Sections, typed edges, unresolved items, lifecycle state, sources, and evidence
195
- snapshot hash. Section identities are part of the structure gate: choose stable
196
- section ids such as `overview`, `behavior`, `constraints`, or a source-backed
197
- domain-specific name when the evidence supports it.
198
-
199
- Use only CLI-provided `source_refs[]` for section and edge evidence. Continuity
200
- is a per-Section constraint, not a per-View constraint: one View may contain
201
- many independently retrievable Sections, each with its own continuous mirror.
202
- Do not invent heading/range/window selectors inside the structure. Treat source
203
- heading changes as section-planning signals: sibling sub-headings under a shared parent
204
- may stay in one Section when they form one coherent semantic topic; headings
205
- with no shared parent should usually split unless you intentionally want one
206
- Section to span them. If a semantic section would require non-contiguous or
207
- cross-source evidence, split it during align or return the issue to the
208
- structure gate. Current compile writes approved knowledge by mirroring source
209
- spans; it does not use rewritten multi-ref sections to compress unrelated
210
- evidence.
211
-
212
- Validate will surface source mirror blockers before confirmation. Treat
213
- `section.source_mirror_split_required`,
214
- `section.source_mirror_repair_required`, and
215
- `section.source_mirror_source_refs_missing` as structure problems, not compile
216
- drafting problems. Use the returned `repair.suggested_splits[]` when present;
217
- otherwise repair source refs from CLI evidence views or move unsupported
218
- material to `unresolved[]`.
219
-
220
- For pure suggested-split repairs, prefer the CLI repair view before hand-editing:
221
- `context run align:<type>:<source>:<collection> --repair suggested-splits --input <structure.yaml> --format json`.
222
- It splits non-contiguous Section mirrors and can expand a broad cross-heading
223
- Section into Markdown structural groups within the same View. Apply the
224
- non-blocking repair hint when the groups should be independently retrievable;
225
- otherwise keep the Section and explain the grouping in structure review.
226
- Oversized Views still require the Agent to apply the returned child-View and contains-edge suggestions while
227
- classifying every child Node from evidence. The repair command does not resolve
228
- orphan ownership, unsupported evidence, or competing semantic groupings.
229
-
230
- When the cited source sentence itself is uncertain, preserve that uncertainty on
231
- the edge with `confidence: possible` or `confidence: hypothesis`. This is only
232
- for source-authored uncertainty such as "可能", "疑似", "may", or "might". If
233
- you are unsure whether the source supports the relation, do not add an uncertain
234
- edge; move the relation to `unresolved[]`.
235
-
236
- No-write/navigation-only/placeholder-only material should become `unresolved`
237
- at align time when it has retrieval or graph value but lacks source-backed
238
- section evidence. Do not turn relation-only navigation into a factual Section.
239
- Do not submit `sections: []` for an ordinary source-bound view. Use
240
- `sections: []` only for a generated parent index view, and only when it has
241
- `generated: parent_index` plus source-backed `contains` edges to child views.
242
- If the relationship matters but evidence or a target node is missing, keep it
243
- unresolved instead of writing a dangling edge.
244
-
245
- Emit `depends_on` edges only when cited source refs explicitly say one Node
246
- consumes, requires, calls, is configured by, or is downstream of another Node as
247
- a prerequisite, capability provider, upstream input, runtime dependency, or
248
- data-flow source. Direction is consumer/downstream -> provider/upstream. Do not
249
- create `depends_on` for parent/child containment, `Related`/`See also` lists,
250
- sibling co-occurrence, shared table membership, name similarity, or a plain
251
- mention without a dependency predicate. `edges[].source_refs[]` must include the
252
- source ref that states the dependency; if the relationship matters but evidence
253
- is missing, leave the edge unresolved instead of guessing.
254
-
255
- Prefer the strongest source-backed `section_kind` using the current schema's `section_kind_priority` and `section_kind_triggers`; avoid planning an entire dense source as `description` when the evidence clearly contains fenced examples, comparison tables, Q&A, decisions, specs, warnings, or principles. Use `example` for fenced command/config/code or literal sample blocks, not ordinary scenario prose. Use `incident` only for dated or timestamped failure evidence with impact scope plus root cause, mitigation, or handling record. Use `decision` only when the source surfaces two or more alternatives or options plus the chosen path and rationale. Treat kind precision as a drafting quality preference, not a reason to block an otherwise source-backed write. Keep only raw-backed semantic decisions in the payload; leave mechanical repair and patch routing to CLI diagnostics.
256
-
257
- There is no parallel candidate-body authoring path. Emit only the
258
- `context.structure.v1` payload accepted by the current schema view.
259
-
260
- ### Step 6 — Validate And Submit
261
-
262
- Before staging, run `context run align:<type>:<source>:<collection> --validate --input - --format json` with the `context.structure.v1` payload. If validate returns `repair_confirmation_blockers`, follow its repair route and rerun validate without asking for preliminary approval. `--repair suggested-splits` handles non-contiguous source mirror Sections. For oversized Views, apply the returned child-View and contains-edge suggestions while classifying child Nodes from evidence. Resolve other blockers from evidence; ask the user only when evidence supports multiple incompatible semantic choices, and state that this is not final review. Stage only after `confirmation_ready=true`. The stage result opens the final HTML report and is the human review gate: show the structure to the user through `structure_report.file_url`, `structure_report.absolute_path`, and the compact summary before asking for confirmation. Only write `lifecycle.state: confirmed` only after explicit confirmation; then run `context run align:<type>:<source>:<collection> --confirm --format json` or pass an explicit file with `--confirm --input <structure.yaml> --format json`.
263
-
264
- After stage succeeds, do not rerun the same write command to confirm success.
265
- Use `context status --format json` or the returned result for read-only
266
- confirmation; then continue with the returned `next_action.command`, normally
267
- `context run compile:<type>:<source>:<collection> --view read-plan --format json`.
268
-
269
- If any write is rejected, follow the returned `next_action` and `reason_code`.
270
- Do not retry by guessing direct/batched stages, forcing route bypasses, or
271
- editing CLI-managed files.
272
-
273
- ### Step 7 — Self-verify
274
-
275
- - [ ] All writes followed top-level `next_action.command`. If not, return to **Step 1**.
276
- - [ ] Evidence was read through returned `next_action.command`, `next_command`, or current CLI schema/view commands only. If not, return to **Step 2**.
277
- - [ ] Node classification used the semantic gates in `structure-planning/references/gates.md`. If not, return to **Step 4**.
278
- - [ ] URL/reference ownership followed CLI diagnostics, not static prompt rules. If not, return to **Step 5**.
279
- - [ ] The requested align payload passed `context run align:<type>:<source>:<collection> --validate --input - --format json` before stage. If not, return to **Step 6**.
280
- - [ ] No `sources/`, `unapproved/`, `knowledge/`, `dist/`, `.tmp`, host tool-results, or CLI-managed files were read or written with generic tools. If violated, restart from **Step 1**.
281
-
282
- </procedures>
@@ -1,322 +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
- - When status is `captured-ready-to-classify`, run every returned capture-phase
20
- evidence command before editing `src/index.ts`. Use the collection-neutral
21
- title tree, span index, and exact text to propose a mainline collection; wait
22
- for user confirmation, then declare matching align/compile/review phases.
23
- - The first product output is a structure draft, not final page body.
24
- - Read source material only through CLI evidence views: `read-plan`,
25
- `source-index`, `span-detail`, `span-text`, `schema`, and
26
- `structure-summary`. Additional views are diagnostic surfaces; use the route
27
- and view set returned by the CLI.
28
- - Write and validate `context.structure.v1` into `unapproved/structure.yaml`.
29
- Stop for user confirmation before compile.
30
- - Before semantic judgment, use the CLI `semantic-rules` View to page through
31
- only `semantic_rules.required`. Use each selection `reason` to keep unrelated
32
- rules out of the current judgment.
33
- - Plan source evidence as Sections before promoting any heading to a Node/View.
34
- Promotion depends on source-backed standalone retrieval identity, not on a
35
- hard-coded section kind or collection name.
36
- - Do not produce or validate a structure payload from this entry file alone. A
37
- ruleset already present in the active context may be reused only when both its
38
- `handle` and `digest` match. If the context was compacted, the digest changed,
39
- or the rule content is no longer present, resume the CLI rule-page sequence.
40
- - When status reaches `structure-ready` or `needs-prose-compile`, hand off to
41
- `skill-prose-compile.md`.
42
- - Compile, review, close, verify, and build remain separate gates.
43
-
44
- <reference>
45
-
46
- ## User-Facing Gates
47
-
48
- Use semantic labels, not SDK function names:
49
-
50
- | Gate | Say this | Do not say this first |
51
- |---|---|---|
52
- | Collection classification | "I have inspected the captured evidence. Based on these source characteristics, I recommend this knowledge category; please confirm before I configure compilation." | Guessing from a filename, URL, or SDK collection enum before investigation |
53
- | Material investigation | "I will read the evidence index and source spans through Context, then propose a structure draft." | `alignProse`, `source-index`, `context.structure.v1` |
54
- | Structure confirmation | "Confirming this structure freezes page paths, section ownership, and relationships for this compile round." | `unapproved/structure.yaml` as a raw parameter |
55
- | Compile handoff | "The structure is confirmed; I will switch to source-bound compile for draft pages." | Continuing to edit structure in compile |
56
-
57
- ## Runtime Discipline
58
-
59
- `skill-continue-workflow` owns global state routing; this Skill owns only the
60
- align phase selected by that route. Use CLI evidence/rule/diagnostic Views,
61
- follow their exact continuation commands, and treat hints as subordinate to
62
- `next_action`. Evidence reads may be parallel; stage, confirm, Review apply,
63
- close, and build writes remain serial. Never reconstruct digest values or
64
- inspect CLI-managed state files as a substitute for a View.
65
- - If a payload is too large for a heredoc, stage it under
66
- `.tmp/agent-payloads/<run-id>/...` in the workspace root and redirect stdin
67
- from that file. Never reuse fixed `/tmp/c4a-*` names, and never place agent
68
- scratch payloads under CLI-managed `.tmp/context-cli/`, `sources/`,
69
- `unapproved/`, `knowledge/`, `dist/`, or package output directories.
70
- - If a validation or view response includes `reason_code`, `path`, `missing[]`,
71
- `diagnostics`, `repair_hints`, or `agent_hints`, treat those fields as the
72
- repair contract. Do not recover by replaying a stale manual route, editing
73
- rendered files, or guessing schema aliases.
74
-
75
- ## Evidence Views
76
-
77
- Recommended read order:
78
-
79
- ```bash
80
- context run align:<type>:<source>:<collection> --view read-plan --format json
81
- context run align:<type>:<source>:<collection> --view source-index --compact --format json
82
- context run align:<type>:<source>:<collection> --view span-detail --span <source-ref> --format json
83
- context run align:<type>:<source>:<collection> --view span-text --span <source-ref> --format json
84
- context run align:<type>:<source>:<collection> --view schema --format json
85
- context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
86
- ```
87
-
88
- Use CLI-returned `next_command` values for pagination. Do not reconstruct
89
- documents with ad hoc `cat`, `grep`, or scripts against `sources/` or `.tmp`.
90
-
91
- ## Structure Contract
92
-
93
- The structure draft uses `schema_version: context.structure.v1` and lives at
94
- `unapproved/structure.yaml` after staging. It contains:
95
-
96
- - lifecycle state such as validated/confirmed and frozen snapshot metadata;
97
- - concept `nodes[]` with stable `node_ref`, `node_type`, title/summary, and
98
- ownership;
99
- - materialized `views[]` with `view_ref`, collection, path, section plans, and
100
- evidence refs;
101
- - typed edges using the closed set defined by the CLI;
102
- - unresolved items when evidence is weak, conflicting, or the target node is
103
- missing.
104
-
105
- Confirmed structure is a human gate. Validation passing is not the same as
106
- confirmation. Do not write `lifecycle.state: confirmed`, `confirmed_by`,
107
- `confirmed_at`, or `structure_digest` until the user has explicitly confirmed
108
- the structure proposal in the conversation.
109
-
110
- When the current conversation explicitly authorizes fully managed operation,
111
- use the CLI-returned `--stage --managed` command after successful validation.
112
- The CLI records `confirmed_by: managed-session`; validation errors and unresolved
113
- evidence still block confirmation. Never persist managed mode in `defineProject`
114
- or reuse it in another conversation.
115
-
116
- ## Procedure References
117
-
118
- These are current structure planning rules. They define the source-bound
119
- semantic gates for Node planning, section ownership, and relationship handling.
120
-
121
- | Decision | Reference |
122
- |---|---|
123
- | Structure planning, Node ownership, density, candidate resolution | [skill-prose-align/references/internal-procedures/structure-planning.md](skill-prose-align/references/internal-procedures/structure-planning.md) |
124
- | Node type, title, tags, fake entity, action/domain gates, edge gates | [skill-prose-align/references/internal-procedures/structure-planning/references/gates.md](skill-prose-align/references/internal-procedures/structure-planning/references/gates.md) |
125
- | Source density and coarse reading judgment | [skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md](skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md) |
126
- | Candidate anomalies, stable ids, paths, duplicates, and conflicts | [skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md](skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md) |
127
-
128
- </reference>
129
-
130
- <procedures>
131
-
132
- ### Step 1 — Open Material Investigation
133
-
134
- Run:
135
-
136
- ```bash
137
- context run align:<type>:<source>:<collection> --view read-plan --format json
138
- ```
139
-
140
- Use the returned views, budgets, snapshot hash, and next actions. If the CLI
141
- reports a missing or stale snapshot, route back to source capture/refresh. Do
142
- not read the snapshot file yourself.
143
-
144
- ### Step 2 — Read Evidence Through The Index
145
-
146
- Read a compact index before requesting exact spans:
147
-
148
- ```bash
149
- context run align:<type>:<source>:<collection> --view source-index --compact --format json
150
- ```
151
-
152
- For exact evidence, copy CLI-returned source refs or next commands:
153
-
154
- ```bash
155
- context run align:<type>:<source>:<collection> --view span-detail --span <source-ref> --format json
156
- context run align:<type>:<source>:<collection> --view span-text --span <source-ref> --format json
157
- ```
158
-
159
- Keep a short note of what evidence supports each proposed node, section, and
160
- edge. If the evidence is weak or conflicting, keep it as unresolved instead of
161
- turning it into a fact.
162
-
163
- Before drafting structure, read:
164
-
165
- - [skill-prose-align/references/internal-procedures/structure-planning.md](skill-prose-align/references/internal-procedures/structure-planning.md)
166
- - [skill-prose-align/references/internal-procedures/structure-planning/references/gates.md](skill-prose-align/references/internal-procedures/structure-planning/references/gates.md)
167
- - [skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md](skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md)
168
- - [skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md](skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md)
169
-
170
- Do not treat this as optional background. These files contain the current
171
- semantic gates for source-bound structure planning. A structure payload drafted
172
- without the applicable references is incomplete, even if the CLI schema accepts
173
- its shape.
174
-
175
- ### Step 3 — Draft And Validate Structure
176
-
177
- Request the schema:
178
-
179
- ```bash
180
- context run align:<type>:<source>:<collection> --view schema --format json
181
- ```
182
-
183
- Create a `context.structure.v1` YAML file. The draft may include a one-page-per
184
- source shape, but that is represented as ordinary nodes and sections; it does
185
- not bypass structure confirmation.
186
-
187
- For small payloads, use stdin/heredoc. For larger payloads, write a scratch file
188
- under `.tmp/agent-payloads/<run-id>/` and pass it through `--input`. Scratch
189
- files are disposable agent working files; they are never phase state and
190
- must not be read back as a substitute for CLI views.
191
-
192
- Validate:
193
-
194
- ```bash
195
- context run align:<type>:<source>:<collection> --validate --input <structure.yaml> --format json
196
- ```
197
-
198
- Validation returns a compact summary and writes a temporary HTML report under
199
- `.tmp/context-runtime/reports/`. A validation report with
200
- `confirmation_ready=false` is an Agent repair artifact, not a user review gate:
201
- do not ask the user to approve it. The staged report produced after
202
- `confirmation_ready=true` is the final review surface; use its
203
- `structure_report.file_url` as the primary user-facing link and include
204
- `structure_report.absolute_path` as a copyable fallback.
205
- If the user needs a focused view, run:
206
-
207
- ```bash
208
- context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
209
- ```
210
-
211
- The explicit `structure-summary` View returns the full summary for focused
212
- debugging. For user confirmation, prioritize the default first-screen fields:
213
- `review_notice`, `structure_report`, and `structure_summary_compact`. A valid
214
- user-facing confirmation prompt must include the report `file_url`, the absolute
215
- path fallback, and a compact summary of collections/views/unresolved/diagnostics.
216
- Do not ask the user to confirm from counts alone.
217
-
218
- Repair diagnostics by routing them to the right decision:
219
-
220
- - source ref or snapshot mismatch -> reread evidence views or refresh capture;
221
- - unsupported node/section/edge -> remove it or mark unresolved;
222
- - duplicate/conflict -> ask the user which structure should win;
223
- - illegal edge type, missing target node, or edge without source refs -> fix the
224
- structure or keep the relation unresolved;
225
- - stale structure -> regenerate from the current snapshot hash.
226
-
227
- When validation returns `repair_confirmation_blockers`, follow its exact repair
228
- route without stopping for human confirmation. `--repair suggested-splits`
229
- mechanically splits non-contiguous source mirror Sections; write its
230
- `repaired_payload` to a scratch YAML file and validate again. For oversized
231
- Views, use the returned child-View and contains-edge suggestions, but classify
232
- each child Node from evidence instead of mechanically inheriting the parent
233
- type. Repair other diagnostics from evidence and validate again. Ask the user only when evidence
234
- supports multiple incompatible semantic choices, and label that question as a
235
- structure-design choice rather than final review. Do not stage until
236
- `confirmation_ready=true`.
237
-
238
- ### Step 4 — Review Structure Before Confirmation
239
-
240
- After validation reports `confirmation_ready=true`, stage the draft. The stage
241
- command opens the final report. Then show the user:
242
-
243
- - node list and planned paths;
244
- - section ownership;
245
- - typed edges and unresolved relation candidates;
246
- - expected compile order;
247
- - downstream impact: these choices freeze paths, section ownership, and
248
- relationships for this compile round.
249
- - the `structure_report.file_url` generated by validate or `--view
250
- structure-summary`;
251
- - the `structure_report.absolute_path` fallback in case the host cannot click
252
- file URLs.
253
-
254
- If the CLI stage result includes `next_action.human_gate: true`, treat it as a
255
- hard stop for structure review. Do not ask for a blind "confirm structure"
256
- reply. Surface the report `file_url`, absolute path, and enough structured
257
- summary for the user to inspect what will be confirmed.
258
-
259
- Do not turn `confirmation_blockers` into a preliminary approval round. A
260
- validator-required page split, continuous-source split, ref repair, or
261
- structure-spine connection is work to resolve before staging. If a genuinely
262
- ambiguous semantic choice needs the user, ask only that choice and then resume
263
- repair; it does not replace the final report-based confirmation.
264
-
265
- Use the host's multi-choice question tool when available. If unavailable, use a
266
- short Markdown fallback. Good options are:
267
-
268
- - Confirm this structure and continue to compile.
269
- - Revise the structure with additional guidance.
270
- - Go back to source scope or capture because the evidence set is wrong.
271
-
272
- Only after confirmation, run the CLI confirmation command, normally:
273
-
274
- ```bash
275
- context run align:<type>:<source>:<collection> --confirm --format json
276
- ```
277
-
278
- If confirming a structure file other than `unapproved/structure.yaml`, pass it
279
- with `--input <structure.yaml>`. A draft stage in `unapproved/structure.yaml` is
280
- not confirmation. Do not edit `unapproved/structure.yaml` after confirmation to
281
- change meaning; return to this gate instead.
282
-
283
- ### Step 5 — Handoff To Compile
284
-
285
- After the user confirms the structure and the CLI reports `structure-ready` or
286
- `needs-prose-compile`, stop this procedure and follow:
287
-
288
- ```text
289
- skill-prose-compile.md
290
- ```
291
-
292
- Do not keep editing structure while compiling. If compile diagnostics show the
293
- planned structure is wrong, return to this align gate and ask the user to
294
- confirm the corrected structure.
295
-
296
- ### Step 6 — Self-verify Checklist
297
-
298
- - [ ] Evidence came only from Context evidence views.
299
- - [ ] `context.structure.v1` was validated before user confirmation.
300
- - [ ] User confirmed the structure before compile.
301
- - [ ] Compile was delegated to `skill-prose-compile`; this procedure did not
302
- write draft page body.
303
- - [ ] Relationships are expressed as structure edges or unresolved items.
304
- - [ ] No direct edits were made to `sources/`, `.tmp`, `unapproved/`,
305
- `knowledge/`, review HTML, or `dist/`.
306
-
307
- ### Final Report
308
-
309
- Report in the user's language. Include only:
310
-
311
- - evidence views actually read;
312
- - proposed and confirmed node count, section count, edge count, and unresolved
313
- count;
314
- - user confirmation outcome;
315
- - validation warnings that still matter for compile;
316
- - next route reported by status or the align phase.
317
-
318
- Do not report payload digests, snapshot hashes, source-ref hashes, absolute
319
- paths, or scratch file paths unless the CLI explicitly asks the user to repair
320
- one.
321
-
322
- </procedures>