@c4a/context-cli 0.5.41-beta.7 → 0.6.0-alpha.6

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 (263) hide show
  1. package/README.md +115 -123
  2. package/babel.cjs +257 -0
  3. package/cli.js +64438 -96584
  4. package/docs/quickstart.md +85 -0
  5. package/package.json +3 -1
  6. package/plugin/.claude-plugin/plugin.json.template +1 -1
  7. package/plugin/.codex-plugin/plugin.json.template +5 -5
  8. package/plugin/.cursor-plugin/plugin.json.template +1 -1
  9. package/plugin/README.md +105 -86
  10. package/plugin/README_CN.md +92 -85
  11. package/plugin/commands/continue.md +34 -0
  12. package/plugin/commands/init.md +13 -130
  13. package/plugin/skills/skill-continue-workflow/SKILL.md +172 -0
  14. package/plugin/skills/skill-init-workspace/SKILL.md +74 -0
  15. package/plugin/skills/skill-package-output/SKILL.md +167 -0
  16. package/plugin/skills/skill-prose-align/SKILL.md +296 -0
  17. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  18. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  19. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  20. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  21. package/plugin/skills/skill-prose-compile/SKILL.md +265 -0
  22. package/plugin/skills/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  23. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  24. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  25. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  26. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  27. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  28. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  29. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  30. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  31. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  32. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  33. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  34. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  35. package/plugin/skills/skill-review-gate/SKILL.md +98 -0
  36. package/plugin/skills/skill-source-scope/SKILL.md +406 -0
  37. package/plugin/skills/skill-source-scope/references/capture-source.md +180 -0
  38. package/plugins/.agents/plugins/marketplace.json +20 -0
  39. package/plugins/.claude-plugin/marketplace.json +13 -0
  40. package/plugins/.cursor-plugin/marketplace.json +17 -0
  41. package/plugins/README.md +150 -0
  42. package/plugins/README_CN.md +136 -0
  43. package/plugins/VERSION +1 -0
  44. package/plugins/assets/icon.svg +3 -0
  45. package/plugins/assets/logo.svg +3 -0
  46. package/plugins/assets/workflow-en.png +0 -0
  47. package/plugins/assets/workflow.png +0 -0
  48. package/plugins/claude/.claude-plugin/plugin.json +16 -0
  49. package/plugins/claude/.generated +1 -0
  50. package/plugins/claude/CLAUDE.md +5 -0
  51. package/plugins/claude/README.md +5 -0
  52. package/plugins/claude/commands/continue.md +34 -0
  53. package/plugins/claude/commands/init.md +21 -0
  54. package/plugins/claude/skills/skill-continue-workflow/SKILL.md +172 -0
  55. package/plugins/claude/skills/skill-init-workspace/SKILL.md +74 -0
  56. package/plugins/claude/skills/skill-package-output/SKILL.md +167 -0
  57. package/plugins/claude/skills/skill-prose-align/SKILL.md +296 -0
  58. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  59. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  60. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  61. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  62. package/plugins/claude/skills/skill-prose-compile/SKILL.md +265 -0
  63. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  64. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  65. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  66. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  67. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  68. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  69. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  70. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  71. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  72. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  73. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  74. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  75. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  76. package/plugins/claude/skills/skill-review-gate/SKILL.md +98 -0
  77. package/plugins/claude/skills/skill-source-scope/SKILL.md +406 -0
  78. package/plugins/claude/skills/skill-source-scope/references/capture-source.md +180 -0
  79. package/plugins/codex/.codex-plugin/plugin.json +38 -0
  80. package/plugins/codex/.generated +1 -0
  81. package/plugins/codex/AGENTS.md +5 -0
  82. package/plugins/codex/README.md +5 -0
  83. package/plugins/codex/assets/icon.svg +3 -0
  84. package/plugins/codex/assets/logo.svg +3 -0
  85. package/plugins/codex/assets/workflow-en.png +0 -0
  86. package/plugins/codex/assets/workflow.png +0 -0
  87. package/plugins/codex/skills/continue/SKILL.md +47 -0
  88. package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +172 -0
  89. package/plugins/codex/skills/continue/references/internal-procedures/skill-init-workspace.md +74 -0
  90. package/plugins/codex/skills/continue/references/internal-procedures/skill-package-output.md +167 -0
  91. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  92. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  93. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  94. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  95. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +296 -0
  96. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  97. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  98. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  99. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  100. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  101. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  102. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  103. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  104. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  105. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  106. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  107. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  108. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  109. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +265 -0
  110. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +98 -0
  111. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md +180 -0
  112. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +406 -0
  113. package/plugins/codex/skills/init/SKILL.md +34 -0
  114. package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +172 -0
  115. package/plugins/codex/skills/init/references/internal-procedures/skill-init-workspace.md +74 -0
  116. package/plugins/codex/skills/init/references/internal-procedures/skill-package-output.md +167 -0
  117. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  118. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  119. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  120. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  121. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +296 -0
  122. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  123. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  124. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  125. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  126. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  127. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  128. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  129. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  130. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  131. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  132. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  133. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  134. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  135. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +265 -0
  136. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +98 -0
  137. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md +180 -0
  138. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +406 -0
  139. package/plugins/cursor/.cursor-plugin/plugin.json +29 -0
  140. package/plugins/cursor/.generated +1 -0
  141. package/plugins/cursor/AGENTS.md +5 -0
  142. package/plugins/cursor/README.md +13 -0
  143. package/plugins/cursor/assets/icon.svg +3 -0
  144. package/plugins/cursor/assets/logo.svg +3 -0
  145. package/plugins/cursor/assets/workflow-en.png +0 -0
  146. package/plugins/cursor/assets/workflow.png +0 -0
  147. package/plugins/cursor/commands/context-continue.md +38 -0
  148. package/plugins/cursor/commands/context-init.md +25 -0
  149. package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +172 -0
  150. package/plugins/cursor/skills/skill-init-workspace/SKILL.md +74 -0
  151. package/plugins/cursor/skills/skill-package-output/SKILL.md +167 -0
  152. package/plugins/cursor/skills/skill-prose-align/SKILL.md +296 -0
  153. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  154. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  155. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  156. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  157. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +265 -0
  158. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  159. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  160. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  161. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  162. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  163. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  164. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  165. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  166. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  167. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  168. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  169. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  170. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  171. package/plugins/cursor/skills/skill-review-gate/SKILL.md +98 -0
  172. package/plugins/cursor/skills/skill-source-scope/SKILL.md +406 -0
  173. package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +180 -0
  174. package/plugins/skills/context-continue/SKILL.md +47 -0
  175. package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +172 -0
  176. package/plugins/skills/context-continue/references/internal-procedures/skill-init-workspace.md +74 -0
  177. package/plugins/skills/context-continue/references/internal-procedures/skill-package-output.md +167 -0
  178. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  179. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  180. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  181. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  182. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +296 -0
  183. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  184. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  185. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  186. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  187. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  188. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  189. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  190. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  191. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  192. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  193. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  194. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  195. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  196. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +265 -0
  197. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +98 -0
  198. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +180 -0
  199. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +406 -0
  200. package/plugins/skills/context-init/SKILL.md +34 -0
  201. package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +172 -0
  202. package/plugins/skills/context-init/references/internal-procedures/skill-init-workspace.md +74 -0
  203. package/plugins/skills/context-init/references/internal-procedures/skill-package-output.md +167 -0
  204. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +91 -0
  205. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +30 -0
  206. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +235 -0
  207. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +243 -0
  208. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +296 -0
  209. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +132 -0
  210. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +52 -0
  211. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +48 -0
  212. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +85 -0
  213. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +73 -0
  214. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +413 -0
  215. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +123 -0
  216. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +81 -0
  217. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +55 -0
  218. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +93 -0
  219. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +79 -0
  220. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +111 -0
  221. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +194 -0
  222. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +265 -0
  223. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +98 -0
  224. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +180 -0
  225. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +406 -0
  226. package/scripts/build-plugin.ts +70 -123
  227. package/plugin/commands/align.md +0 -71
  228. package/plugin/commands/capture.md +0 -113
  229. package/plugin/commands/compile.md +0 -112
  230. package/plugin/commands/context.md +0 -36
  231. package/plugin/commands/drop.md +0 -38
  232. package/plugin/commands/extract.md +0 -18
  233. package/plugin/commands/ops.md +0 -47
  234. package/plugin/commands/purge.md +0 -22
  235. package/plugin/commands/query.md +0 -22
  236. package/plugin/commands/status.md +0 -25
  237. package/plugin/skills/skill-align-workflow/SKILL.md +0 -110
  238. package/plugin/skills/skill-align-workflow/references/candidate-resolution.md +0 -60
  239. package/plugin/skills/skill-align-workflow/references/density-profile.md +0 -16
  240. package/plugin/skills/skill-align-workflow/references/gates.md +0 -162
  241. package/plugin/skills/skill-compile-close/SKILL.md +0 -127
  242. package/plugin/skills/skill-compile-draft/SKILL.md +0 -175
  243. package/plugin/skills/skill-compile-draft/references/action-domain-gates.md +0 -34
  244. package/plugin/skills/skill-compile-draft/references/notes.md +0 -34
  245. package/plugin/skills/skill-compile-draft/references/refresh-and-update.md +0 -71
  246. package/plugin/skills/skill-compile-draft/references/structural-challenges.md +0 -76
  247. package/plugin/skills/skill-compile-judge/SKILL.md +0 -112
  248. package/plugin/skills/skill-context-query/SKILL.md +0 -236
  249. package/plugin/skills/skill-drop/SKILL.md +0 -189
  250. package/plugin/skills/skill-semantic-reconcile/SKILL.md +0 -136
  251. package/plugin/skills/skill-semantic-reconcile/references/leakage-and-ownership.md +0 -31
  252. package/plugin/skills/skill-semantic-reconcile/references/mode-semantics.md +0 -41
  253. package/plugin/skills/skill-semantic-reconcile/references/scope-review-and-omit.md +0 -60
  254. package/plugin/skills/skill-semantic-reconcile/references/temporal-and-evidence.md +0 -58
  255. package/plugin/skills/skill-semantic-reconcile/references/user-confirmation.md +0 -71
  256. package/scripts/build-aspect-runtime.ts +0 -45
  257. package/templates/aspect-runtime/aspectRunnerSdk.js +0 -776
  258. package/templates/aspects/README.md +0 -517
  259. package/templates/aspects/code/README.md +0 -48
  260. package/templates/aspects/code/aspect.yaml +0 -21
  261. package/templates/aspects/design-system/README.md +0 -26
  262. package/templates/aspects/graphql/README.md +0 -24
  263. package/templates/aspects/openapi/README.md +0 -24
@@ -0,0 +1,243 @@
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
+ For `node.title` and `node.summary`, follow the workspace/source language
155
+ surfaced by the current view or the user's instruction. In Chinese workspaces,
156
+ translate descriptive scaffold words such as architecture, strategy, lifecycle,
157
+ overview, scheduling, high availability, and warning into Chinese while
158
+ preserving product names, code identifiers, CLI flags, slugs, source_ref tokens,
159
+ and citation tokens exactly when needed. Do not copy an English source title
160
+ into `node.title` merely because the source is English.
161
+
162
+ 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.
163
+
164
+ For large or batched payloads, use
165
+ `structure-planning/references/density-profile.md` and
166
+ `structure-planning/references/candidate-resolution.md` as judgment aids.
167
+ They do not create additional workflow stages or alternate payloads.
168
+
169
+ ### Step 5 — Build The Payload Requested By `next_action`
170
+
171
+ Use `context run align:<type>:<source>:<collection> --view schema --format json` to
172
+ shape the payload. Treat that schema as the authoring contract.
173
+
174
+ Produce one `context.structure.v1` document with semantic Nodes, planned
175
+ Sections, typed edges, unresolved items, lifecycle state, sources, and evidence
176
+ snapshot hash. Section identities are part of the structure gate: choose stable
177
+ section ids such as `overview`, `behavior`, `constraints`, or a source-backed
178
+ domain-specific name when the evidence supports it.
179
+
180
+ Use only CLI-provided `source_refs[]` for section and edge evidence. Do not
181
+ invent heading/range/window selectors inside the structure. Treat source heading
182
+ changes as section-planning signals: sibling sub-headings under a shared parent
183
+ may stay in one Section when they form one coherent semantic topic; headings
184
+ with no shared parent should usually split unless you intentionally want one
185
+ Section to span them. If a semantic section would require non-contiguous or
186
+ cross-source evidence, split it during align or return the issue to the
187
+ structure gate. Current compile writes approved knowledge by mirroring source
188
+ spans; it does not use rewritten multi-ref sections to compress unrelated
189
+ evidence.
190
+
191
+ When the cited source sentence itself is uncertain, preserve that uncertainty on
192
+ the edge with `confidence: possible` or `confidence: hypothesis`. This is only
193
+ for source-authored uncertainty such as "可能", "疑似", "may", or "might". If
194
+ you are unsure whether the source supports the relation, do not add an uncertain
195
+ edge; move the relation to `unresolved[]`.
196
+
197
+ No-write/navigation-only/placeholder-only material should become `unresolved`
198
+ at align time when it has retrieval or graph value but lacks source-backed
199
+ section evidence. Do not turn relation-only navigation into a factual Section.
200
+ Do not submit `sections: []` for an ordinary source-bound view. Use
201
+ `sections: []` only for a generated parent index view, and only when it has
202
+ `generated: parent_index` plus source-backed `contains` edges to child views.
203
+ If the relationship matters but evidence or a target node is missing, keep it
204
+ unresolved instead of writing a dangling edge.
205
+
206
+ Emit `depends_on` edges only when cited source refs explicitly say one Node
207
+ consumes, requires, calls, is configured by, or is downstream of another Node as
208
+ a prerequisite, capability provider, upstream input, runtime dependency, or
209
+ data-flow source. Direction is consumer/downstream -> provider/upstream. Do not
210
+ create `depends_on` for parent/child containment, `Related`/`See also` lists,
211
+ sibling co-occurrence, shared table membership, name similarity, or a plain
212
+ mention without a dependency predicate. `edges[].source_refs[]` must include the
213
+ source ref that states the dependency; if the relationship matters but evidence
214
+ is missing, leave the edge unresolved instead of guessing.
215
+
216
+ 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.
217
+
218
+ There is no parallel candidate-body authoring path. Emit only the
219
+ `context.structure.v1` payload accepted by the current schema view.
220
+
221
+ ### Step 6 — Validate And Submit
222
+
223
+ Before staging, run `context run align:<type>:<source>:<collection> --validate --input - --format json` with the `context.structure.v1` payload. If validate returns blocking diagnostics, repair the exact paths it reports and rerun validate. After validation, show the structure to the user with the structure summary and `structure_report.path`. If validation returns `confirmation_blockers[]` or `will_block_confirmation`, repair those blockers before asking the user to confirm. If you stage a draft structure first, the stage result is still a human review gate: show the returned report/summary and ask the user to inspect it before confirming. 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`.
224
+
225
+ After stage succeeds, do not rerun the same write command to confirm success.
226
+ Use `context status --format json` or the returned result for read-only
227
+ confirmation; then continue with the returned `next_action.command`, normally
228
+ `context run compile:<type>:<source>:<collection> --view read-plan --format json`.
229
+
230
+ If any write is rejected, follow the returned `next_action` and `reason_code`.
231
+ Do not retry by guessing direct/batched stages, forcing route bypasses, or
232
+ editing CLI-managed files.
233
+
234
+ ### Step 7 — Self-verify
235
+
236
+ - [ ] All writes followed top-level `next_action.command`. If not, return to **Step 1**.
237
+ - [ ] Evidence was read through returned `next_action.command`, `next_command`, or current CLI schema/view commands only. If not, return to **Step 2**.
238
+ - [ ] Node classification used the semantic gates in `structure-planning/references/gates.md`. If not, return to **Step 4**.
239
+ - [ ] URL/reference ownership followed CLI diagnostics, not static prompt rules. If not, return to **Step 5**.
240
+ - [ ] The requested align payload passed `context run align:<type>:<source>:<collection> --validate --input - --format json` before stage. If not, return to **Step 6**.
241
+ - [ ] 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**.
242
+
243
+ </procedures>
@@ -0,0 +1,265 @@
1
+ ---
2
+ name: skill-prose-compile
3
+ description: >
4
+ Internal procedure invoked by the public Context continuation entry; not a user command.
5
+ Uses confirmed Context document structure to create source-bound draft prose
6
+ candidates through `context.compile-actions.v1`, without reading raw
7
+ snapshots directly.
8
+ tools:
9
+ - Bash
10
+ ---
11
+
12
+ # skill-prose-compile
13
+
14
+ Compile confirmed document structure into reviewable draft knowledge.
15
+
16
+ ## TL;DR
17
+
18
+ - Use this after `context status` reports `structure-ready` or
19
+ `needs-prose-compile`, or when the user explicitly asks to compile confirmed
20
+ prose structure into draft pages.
21
+ - The input is already confirmed `context.structure.v1`; do not redesign node
22
+ ownership, page paths, or relationships here. Return to prose align if those
23
+ are wrong.
24
+ - Read compile context through CLI views only: `read-plan`, `node-context`, and
25
+ `schema`. Use align evidence views only when the compile view or validation
26
+ output gives a specific source ref that needs exact text.
27
+ - Emit `context.compile-actions.v1`; the CLI mirrors source spans, derives
28
+ `content_mode`, writes review candidates, and enforces source-bound evidence.
29
+ - The `summary` field in each action is the Agent-authored behavior half only:
30
+ compact source-backed recall text for the cited section. The CLI separately
31
+ renders the reachability half from confirmed typed edges into review metadata;
32
+ do not invent edge summaries or relation fields in the action payload.
33
+ - Default to omitted `content` so the CLI mirrors the cited source span.
34
+ Do not write explicit `content`. If the evidence cannot be represented as a
35
+ faithful mirrored continuous span, split the section or return to prose align
36
+ for a confirmed structure change.
37
+ - Before choosing section kind, summary, skip/update, weak-evidence handling, or
38
+ structure repair, read the current procedure references listed by the CLI as
39
+ `semantic_reference_files`. These are the migrated compile judgment rules, not
40
+ summaries.
41
+ - Do not produce or validate compile actions from this entry file alone. If the
42
+ relevant `semantic_reference_files` have not been read in the current turn,
43
+ stop and read them first.
44
+
45
+ <reference>
46
+
47
+ ## User-Facing Gates
48
+
49
+ Use semantic labels, not SDK function names:
50
+
51
+ | Gate | Say this | Do not say this first |
52
+ |---|---|---|
53
+ | Compile context | "I will inspect the confirmed structure and each node's planned evidence before drafting sections." | `node-context`, `context.compile-actions.v1` |
54
+ | Source-bound draft | "I will mirror supported source spans into reviewable draft pages and attach summary/kind metadata." | `compileProse` |
55
+ | Non-mirror evidence | "This section cannot be compiled as-is because the evidence is not one faithful source mirror; we need to split or revise the structure." | "The agent can rewrite this automatically." |
56
+ | Structure mismatch | "This compile cannot proceed because the confirmed structure no longer matches the evidence; we need to return to structure confirmation." | Editing `knowledge/` or `unapproved/` directly |
57
+
58
+ ## Runtime Discipline
59
+
60
+ - Follow `context status`, `routing.next_commands`, compile view
61
+ `next_action`, and validation diagnostics. Treat CLI commands as the source
62
+ of truth.
63
+ - Use only the returned `next_action.command` for the next required write.
64
+ Treat `allowed_actions[]` as permission for read-only insertions; it is not a
65
+ menu of alternate write paths.
66
+ - Treat `agent_hints[]` as temporary diagnostics. If an agent hint conflicts
67
+ with a status route, compile view `next_action`, or validation result, follow
68
+ the top-level route.
69
+ - Do not use direct file tools, shell scripts, `jq`, `sed`, `cat`, `head`,
70
+ `tail`, Python, or Node.js to inspect `sources/`, `unapproved/`,
71
+ `knowledge/`, `dist/`, or CLI-managed `.tmp` as a substitute for Context
72
+ views.
73
+ - Run one write at a time. Do not parallelize compile stage, review apply,
74
+ close, or build writes.
75
+ - Compile does not get a second, looser rule set. If a rule conflicts with the
76
+ current CLI schema or diagnostics, follow the CLI and repair the payload.
77
+ - Write digest/hash flags are stale guards. Use values returned by the CLI; do
78
+ not parse stdout fragments or host tool-result files to reconstruct them.
79
+ - If a payload is too large for a heredoc, stage it under
80
+ `.tmp/agent-payloads/<run-id>/...` in the workspace root and redirect stdin
81
+ from that file. Never reuse fixed `/tmp/c4a-*` names, and never place agent
82
+ scratch payloads under CLI-managed `.tmp/context-cli/`, `sources/`,
83
+ `unapproved/`, `knowledge/`, `dist/`, review output, or package output
84
+ directories.
85
+
86
+ ## Compile Views
87
+
88
+ Recommended read order:
89
+
90
+ ```bash
91
+ context run compile:<type>:<source>:<collection> --view read-plan --format json
92
+ context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
93
+ context run compile:<type>:<source>:<collection> --view schema --format json
94
+ ```
95
+
96
+ Use CLI-returned `available_view_refs`, `planned_sections`, `local_sources`, and
97
+ `next_action.command`. Do not reconstruct the structure by opening
98
+ `unapproved/structure.yaml` or `knowledge/structure.yaml` directly.
99
+
100
+ ## Procedure References
101
+
102
+ These are current compile rules for source-bound drafting, judgment, semantic
103
+ repair, and close handoff.
104
+
105
+ | Decision | Reference |
106
+ |---|---|
107
+ | Compile action drafting, section kind, coverage, summaries, content intent | [references/internal-procedures/compile-actions.md](references/internal-procedures/compile-actions.md) |
108
+ | Action/domain compile gates | [references/internal-procedures/compile-actions/references/action-domain-gates.md](references/internal-procedures/compile-actions/references/action-domain-gates.md) |
109
+ | Notes, refresh/update, and structural challenges | [references/internal-procedures/compile-actions/references/notes.md](references/internal-procedures/compile-actions/references/notes.md), [references/internal-procedures/compile-actions/references/refresh-and-update.md](references/internal-procedures/compile-actions/references/refresh-and-update.md), [references/internal-procedures/compile-actions/references/structural-challenges.md](references/internal-procedures/compile-actions/references/structural-challenges.md) |
110
+ | Support, duplicate, replacement, conflict, weak evidence, and relation judgment | [references/internal-procedures/compile-judgment.md](references/internal-procedures/compile-judgment.md), [references/internal-procedures/semantic-judgment.md](references/internal-procedures/semantic-judgment.md) |
111
+ | Leakage, ownership, temporal evidence, disposition, omit, and user confirmation | [references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md](references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md), [references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md](references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md), [references/internal-procedures/semantic-judgment/references/disposition-semantics.md](references/internal-procedures/semantic-judgment/references/disposition-semantics.md), [references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md](references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md), [references/internal-procedures/semantic-judgment/references/user-confirmation.md](references/internal-procedures/semantic-judgment/references/user-confirmation.md) |
112
+ | Close gate and current close output boundaries | [references/internal-procedures/close-gate.md](references/internal-procedures/close-gate.md) |
113
+
114
+ ## Compile Contract
115
+
116
+ The compile action payload uses `schema_version: context.compile-actions.v1`.
117
+ Compile may:
118
+
119
+ - mirror source spans as `verbatim`;
120
+ - emit `skip` decisions when no source-backed body should be written. `skip`
121
+ does not produce a placeholder candidate; generated parent-index pages use
122
+ the parent-index compile path, not an action payload placeholder.
123
+
124
+ Relationships and cross references do not go into verbatim body. In current
125
+ output they stay in `structure.yaml` typed edges; this workflow does not render
126
+ relationship reference blocks.
127
+
128
+ </reference>
129
+
130
+ <procedures>
131
+
132
+ ### Step 1 — Open Compile Context
133
+
134
+ Run:
135
+
136
+ ```bash
137
+ context run compile:<type>:<source>:<collection> --view read-plan --format json
138
+ ```
139
+
140
+ Use the returned node list, source overview, and next action. If the CLI says
141
+ the structure is missing, unconfirmed, stale, frozen against the wrong
142
+ snapshot, or invalid, return to prose align or source capture as indicated.
143
+
144
+ ### Step 2 — Inspect One Node
145
+
146
+ For each node that should become draft knowledge, run:
147
+
148
+ ```bash
149
+ context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
150
+ context run compile:<type>:<source>:<collection> --view schema --format json
151
+ ```
152
+
153
+ Read the compile references listed by `semantic_reference_files` before
154
+ classifying section kind, summary, support, skip/update, weak evidence, or
155
+ structure repair.
156
+
157
+ Do not treat those references as optional background. They are the current
158
+ compile drafting, judgment, and semantic-repair procedures.
159
+
160
+ When exact evidence text is needed, use the CLI-returned source ref with the
161
+ current evidence view. Do not open snapshot files directly.
162
+
163
+ ### Step 3 — Draft And Validate Actions
164
+
165
+ Create a `context.compile-actions.v1` payload for the selected view. Prefer
166
+ omitted `content` with `source_refs[]` so the CLI mirrors source spans.
167
+ If the source evidence is non-contiguous or contains separable examples,
168
+ configuration blocks, lists, or procedures, split the compile actions when the
169
+ confirmed structure supports that split. If the structure is too coarse, return
170
+ to prose align and ask the user to confirm a section split instead of writing
171
+ summarized body text. Explicit `content` / `content_intent` is not part of the
172
+ current compile contract.
173
+
174
+ For small payloads, use stdin/heredoc. For larger payloads, write a scratch file
175
+ under `.tmp/agent-payloads/<run-id>/` and pass it through `--input`. Scratch
176
+ files are disposable agent working files; they are never compile state and must
177
+ not be read back as a substitute for CLI views.
178
+
179
+ Validate:
180
+
181
+ ```bash
182
+ context run compile:<type>:<source>:<collection> --validate --input <compile-actions.yaml> --format json
183
+ ```
184
+
185
+ Repair diagnostics by routing them to the right decision:
186
+
187
+ - source ref or planned-section mismatch -> reread node-context, or return to
188
+ structure confirmation if ownership is wrong;
189
+ - unsupported kind or op -> use the schema view and current compile references;
190
+ - explicit content -> omit `content` and mirror source, or return to align for
191
+ a section split;
192
+ - weak evidence, duplicate, conflict, omit, or scope issue -> use the compile
193
+ judgment / semantic judgment references and ask the user when required;
194
+ - frozen structure mismatch -> rerun status and return to align/capture as
195
+ directed.
196
+
197
+ Use typed diagnostics as the repair contract:
198
+
199
+ - `reason_code`, `path`, and `missing[]` identify what to fix;
200
+ - warnings are not write blockers unless the response marks them blocking or
201
+ the next action says so;
202
+ - weak evidence, duplicate, conflict, temporal, leakage, ownership, and scope
203
+ issues are semantic review issues, not formatting problems;
204
+ - raw/source-ref pointer diagnostics are evidence checks, not content-quality
205
+ judges.
206
+
207
+ When validation returns a new `next_action.command`, follow that exact command.
208
+ When it returns blocking diagnostics without a write command, repair and
209
+ validate again. Do not stage a compile payload just because the YAML shape looks
210
+ valid.
211
+
212
+ ### Step 4 — Stage Draft Candidates
213
+
214
+ Stage only after validation has no errors:
215
+
216
+ ```bash
217
+ context run compile:<type>:<source>:<collection> --stage --input <compile-actions.yaml> --format json
218
+ ```
219
+
220
+ After staging, return to `context status`. If status reaches
221
+ `compile-ready-for-review`, delegate review to
222
+ `../skill-review-gate/SKILL.md`.
223
+
224
+ ### Step 5 — Close Handoff
225
+
226
+ After review apply, return to `context status`. If status says
227
+ `compile-close-needed`, run deterministic close:
228
+
229
+ ```bash
230
+ context close --format json
231
+ ```
232
+
233
+ Close derives `knowledge/structure.yaml` and edge projection from approved
234
+ knowledge, then runs the final verify gate. It must not rewrite approved
235
+ verbatim body. References, changelog, package index, and section fingerprint
236
+ rebuilds are not current close output.
237
+
238
+ Then route to package output when status reaches `ready-to-build`.
239
+
240
+ ### Step 6 — Self-verify Checklist
241
+
242
+ - [ ] Compile started from confirmed structure, not a new structure proposal.
243
+ - [ ] Node context and schema came from compile phase views.
244
+ - [ ] Compile references were read before choosing kind/summary/support.
245
+ - [ ] Actions mirror source by default and do not invent body text.
246
+ - [ ] No explicit reader-visible `content` was written by the Agent.
247
+ - [ ] Relationships are expressed as structure edges, not inserted into
248
+ verbatim text.
249
+ - [ ] No direct edits were made to `sources/`, `.tmp`, `unapproved/`,
250
+ `knowledge/`, review HTML, or `dist/`.
251
+
252
+ ### Final Report
253
+
254
+ Report in the user's language. Include only:
255
+
256
+ - view refs compiled in this round;
257
+ - candidate ids staged and whether they contain verbatim or empty sections;
258
+ - validation warnings that still matter for review;
259
+ - whether review, close, verify, or build is the next status route.
260
+
261
+ Do not report internal payload digests, source-ref hashes, internal workspace
262
+ paths, absolute paths, scratch file paths, or raw CLI JSON unless the user asks
263
+ for debug output.
264
+
265
+ </procedures>
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: close-gate
3
+ description: >
4
+ Internal procedure invoked by the current compile/continue flow; not a user
5
+ slash command. Runs after review apply. Triggers `context close --format json`,
6
+ which derives knowledge/structure.yaml, projects approved edges, and runs the
7
+ final verify gate. Agent intervention is limited to interpreting CLI output
8
+ and routing verify errors back to source capture, align structure, compile
9
+ actions, or review as appropriate. The skill never hand-edits rendered
10
+ knowledge.
11
+ tools:
12
+ - Bash
13
+ ---
14
+
15
+ # close-gate — approved structure projection + final verify
16
+
17
+ Close a compile run. The CLI does the work; the skill reads the
18
+ CLI's output and routes any failure back to the correct upstream
19
+ command. It does not hand-edit rendered knowledge.
20
+
21
+ ## TL;DR — Non-negotiables
22
+
23
+ - CLI-driven. `context close --format json` derives `knowledge/structure.yaml`,
24
+ projects approved edges, and verifies the final workspace including edge
25
+ source refs. Use the command's stdout + exit code; that's the close's full
26
+ output.
27
+ - **Agent NEVER edits rendered knowledge from the close stage.** The CLI is the
28
+ sole writer for approved structure projection. If verify reports an error
29
+ here, route it back, not around:
30
+ - Content / Section issues → re-run the current compile gate for the affected
31
+ node after fixing compile actions.
32
+ - Structural issues → return to the align structure gate and reconfirm.
33
+ - Source/evidence issues → recapture the affected source, then rerun align or
34
+ compile as status instructs.
35
+ - Exit 0 → summarise approved node count, approved edge count, structural edge
36
+ contract status, and verify status. References, changelog, package index,
37
+ section fingerprints, and full incremental cache rebuilds are not current
38
+ close output.
39
+ - Exit 2 → report the full issue list verbatim + point at the right re-entry command above. Do not hand-open the affected rendered article.
40
+ - Materialized knowledge means approved Markdown plus its approved
41
+ `knowledge/structure.yaml` projection. A compile skip action records reviewed
42
+ evidence, but it does not by itself materialize an arbitrary finalized Node.
43
+ - Never re-run compile actions from close to paper over verify failures. Draft
44
+ failures belong in the compile loop.
45
+ - Do not use Python, Node.js, shell scripts, `ls`, `find`, `rg`, `cat`, or similar ad-hoc commands to inspect `sources/`, `unapproved/`, `knowledge/`, or `dist/` files.
46
+ - Current close can self-heal stale or malformed `knowledge/structure.yaml`
47
+ projection by deriving it again from approved Markdown and approved edge
48
+ sources. It must not rewrite verbatim section body.
49
+ - LLM-assisted repair (`--fix-with-llm`) is not a current close action.
50
+ - Output language: summary prose matches the user's language; CLI output, issue codes, file paths stay as printed.
51
+ - Current align state is internal CLI state, not a file protocol. The CLI owns
52
+ this lifecycle — the agent must not move, delete, or archive workspace output
53
+ files by hand.
54
+ - Semantic decisions are applied and recorded before close. Compile-close does
55
+ not judge or rewrite semantic decisions; it only verifies the already-applied
56
+ workspace and rebuilds approved structure projection.
57
+
58
+ <reference>
59
+
60
+ ## Stages inside `context close --format json`
61
+
62
+ Close is one in-process command with one exit code:
63
+
64
+ 1. **Approved knowledge scan** — reads approved Markdown only through CLI
65
+ project readers.
66
+ 2. **Structure projection** — writes deterministic `knowledge/structure.yaml`
67
+ with nodes, approved edge projection, input hash, and structural edge
68
+ contract status.
69
+ 3. **Workspace verify** — runs the final verify gate. Any error prevents close
70
+ readiness.
71
+ 4. **Status receipt** — reports whether close is ready and which upstream gate
72
+ owns any failure.
73
+
74
+ ## Outcome routing
75
+
76
+ | Outcome | Agent action |
77
+ |---|---|
78
+ | Ready, verify pass | Summarise approved nodes, approved edges, structural edge contract, and verify status. Stop. |
79
+ | Ready, verify warnings only | Summarise warning codes and state that build may proceed when warnings are allowed by status/build gate. |
80
+ | Verify error in approved section content/evidence | Surface the issue list and route back to compile actions or source recapture as indicated by status. Do not edit approved Markdown. |
81
+ | Verify error in approved structure projection | Run `context close --format json` once more only when status says the projection is close-repairable; otherwise return to align structure. |
82
+ | Source/evidence stale or missing | Route to source capture/refresh, then rerun align/compile as status instructs. |
83
+
84
+ The close stage never edits rendered knowledge on the agent side. Every verify
85
+ error routes back to the correct upstream gate (source capture, align
86
+ structure, compile actions, or review), never sideways into a hand Edit. Use
87
+ the CLI issue code and hint printed by `context close --format json` for the
88
+ error→command mapping.
89
+
90
+ References, changelog, section fingerprints, and package index rebuilds are not
91
+ current close outputs.
92
+
93
+ </reference>
94
+
95
+ <procedures>
96
+
97
+ ### Step 1 — Invoke close
98
+
99
+ Run `context close --format json`. The caller may have already invoked it;
100
+ check for existing output before re-running.
101
+
102
+ ### Step 2 — Interpret
103
+
104
+ Use stdout + stderr. The exit code selects the path via [Outcome routing](#outcome-routing).
105
+
106
+ ### Step 3 — Route errors to the correct upstream command
107
+
108
+ For each error in the CLI's report, classify via [Outcome routing](#outcome-routing) and name the re-entry command in your report. Do NOT hand-edit rendered knowledge — that violates the CLI-sole-writer principle and masks the real upstream fix. Specifically:
109
+
110
+ - Section / content issue → rerun the current compile gate for that node.
111
+ - Structure issue → return to align structure and user confirmation.
112
+ - Source/evidence issue → recapture the affected source, then rerun align or
113
+ compile as status instructs.
114
+
115
+ One pass. If the CLI reports multiple errors, list them all and let the user choose the order; do not loop the close stage itself.
116
+
117
+ ### Step 4 — Report
118
+
119
+ Summarise in the user's language:
120
+
121
+ - Approved node count.
122
+ - Approved edge count and structural edge contract status.
123
+ - Verify result: pass / pass-with-unverifiable-evidence / fail, with issue
124
+ codes verbatim.
125
+
126
+ Stop. Do not auto-invoke follow-on commands.
127
+
128
+ ### Step 5 — Final guardrails
129
+
130
+ Run close once, surface every error with its re-entry command, and never inspect or edit rendered knowledge outside the CLI.
131
+
132
+ </procedures>