@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,287 +0,0 @@
1
- ---
2
- name: skill-prose-compile
3
- description: >
4
- Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Uses confirmed Context document structure to create source-bound draft prose
6
- candidates through `context.compile-actions.v1`, without reading raw
7
- snapshots directly.
8
- tools:
9
- - Bash
10
- ---
11
-
12
- # skill-prose-compile
13
-
14
- Compile confirmed document structure into reviewable draft knowledge.
15
-
16
- ## TL;DR
17
-
18
- - Use this after `context status` reports `structure-ready` or
19
- `needs-prose-compile`, or when the user explicitly asks to compile confirmed
20
- prose structure into draft pages.
21
- - The input is already confirmed `context.structure.v1`; do not redesign node
22
- ownership, page paths, or relationships here. Return to prose align if those
23
- are wrong.
24
- - Read compile context through CLI views only: `blockers`, `read-plan`,
25
- `node-context`, and `schema`. Start with `blockers` for large or recently
26
- repaired structures; if it returns section blockers, return to prose align
27
- instead of drafting compile actions. Use align evidence views only when the
28
- compile view or validation output gives a specific source ref that needs exact
29
- text.
30
- - Emit `context.compile-actions.v1`; the CLI mirrors source spans, derives
31
- `content_mode`, writes review candidates, and enforces source-bound evidence.
32
- - The `summary` field in each action is the Agent-authored behavior half only:
33
- compact source-backed recall text for the cited section. The CLI separately
34
- renders the reachability half from confirmed typed edges into review metadata;
35
- do not invent edge summaries or relation fields in the action payload.
36
- - Default to omitted `content` so the CLI mirrors the cited source span.
37
- Do not write explicit `content`. If the evidence cannot be represented as a
38
- faithful mirrored continuous span, split the section or return to prose align
39
- for a confirmed structure change.
40
- - Before semantic judgment, use the CLI `semantic-rules` View to page through
41
- only `semantic_rules.required`; selection `reason` explains why each rule is
42
- needed for the current node.
43
- - Do not produce or validate compile actions from this entry file alone. A
44
- ruleset already present in the active context may be reused only when both its
45
- `handle` and `digest` match. If the context was compacted, the digest changed,
46
- or the rule content is no longer present, resume the CLI rule-page sequence.
47
-
48
- <reference>
49
-
50
- ## User-Facing Gates
51
-
52
- Use semantic labels, not SDK function names:
53
-
54
- | Gate | Say this | Do not say this first |
55
- |---|---|---|
56
- | Compile context | "I will inspect the confirmed structure and each node's planned evidence before drafting sections." | `node-context`, `context.compile-actions.v1` |
57
- | Source-bound draft | "I will mirror supported source spans into reviewable draft pages and attach summary/kind metadata." | `compileProse` |
58
- | 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." |
59
- | 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 |
60
-
61
- ## Runtime Discipline
62
-
63
- `skill-continue-workflow` owns global state routing; this Skill owns only the
64
- compile phase selected by that route. Use CLI context/rule/diagnostic Views and
65
- their exact continuation commands. Hints are subordinate to `next_action`.
66
- Never inspect CLI-managed state files as a substitute for a View.
67
- - Compile `read-plan`, `blockers`, `node-context`, and `schema` Views are
68
- workspace-read-only and may be fetched in parallel. `--validate`, `--stage`,
69
- structure confirmation, Review apply, and close remain serial mutations.
70
- - One planned Section produces one compile action. When evidence contains
71
- independently retrievable units, split them into sibling Sections in align;
72
- do not split one planned Section into several compile actions.
73
- - One write still means one View, not one human Review. Stage every View in the
74
- same confirmed structure sequentially, follow `continue_compile_batch`, and
75
- open Review only after the CLI reports that the whole batch is prepared.
76
- - Compile does not get a second, looser rule set. If a rule conflicts with the
77
- current CLI schema or diagnostics, follow the CLI and repair the payload.
78
- - Write digest/hash flags are stale guards. Use values returned by the CLI; do
79
- not parse stdout fragments or host tool-result files to reconstruct them.
80
- - If a payload is too large for a heredoc, stage it under
81
- `.tmp/agent-payloads/<run-id>/...` in the workspace root and redirect stdin
82
- from that file. Never reuse fixed `/tmp/c4a-*` names, and never place agent
83
- scratch payloads under CLI-managed `.tmp/context-cli/`, `sources/`,
84
- `unapproved/`, `knowledge/`, `dist/`, review output, or package output
85
- directories.
86
-
87
- ## Compile Views
88
-
89
- Recommended read order:
90
-
91
- ```bash
92
- context run compile:<type>:<source>:<collection> --view blockers --format json
93
- context run compile:<type>:<source>:<collection> --view read-plan --format json
94
- context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
95
- context run compile:<type>:<source>:<collection> --view schema --format json
96
- ```
97
-
98
- Use CLI-returned `available_view_refs`, `planned_sections`, `local_sources`, and
99
- `next_action.command`. If `blockers.section_blockers[]` is non-empty, repair the
100
- structure through align first; do not inspect every node or hand-split compile
101
- actions. Do not reconstruct the structure by opening `unapproved/structure.yaml`
102
- or `knowledge/structure.yaml` directly.
103
-
104
- ## Procedure References
105
-
106
- These are current compile rules for source-bound drafting, judgment, semantic
107
- repair, and close handoff.
108
-
109
- | Decision | Reference |
110
- |---|---|
111
- | Compile action drafting, section kind, coverage, summaries, content intent | [skill-prose-compile/references/internal-procedures/compile-actions.md](skill-prose-compile/references/internal-procedures/compile-actions.md) |
112
- | Action/domain compile gates | [skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md](skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md) |
113
- | Notes, refresh/update, and structural challenges | [skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md](skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md), [skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md](skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md), [skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md](skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md) |
114
- | Support, duplicate, replacement, conflict, weak evidence, and relation judgment | [skill-prose-compile/references/internal-procedures/compile-judgment.md](skill-prose-compile/references/internal-procedures/compile-judgment.md), [skill-prose-compile/references/internal-procedures/semantic-judgment.md](skill-prose-compile/references/internal-procedures/semantic-judgment.md) |
115
- | Leakage, ownership, temporal evidence, disposition, omit, and user confirmation | [skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md](skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md), [skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md](skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md), [skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md](skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md), [skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md](skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md), [skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md](skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md) |
116
- | Close gate and current close output boundaries | [skill-prose-compile/references/internal-procedures/close-gate.md](skill-prose-compile/references/internal-procedures/close-gate.md) |
117
-
118
- ## Compile Contract
119
-
120
- The compile action payload uses `schema_version: context.compile-actions.v1`.
121
- Compile may:
122
-
123
- - mirror source spans as `verbatim`;
124
- - emit `skip` decisions when no source-backed body should be written. `skip`
125
- does not produce a placeholder candidate; generated parent-index pages use
126
- the parent-index compile path, not an action payload placeholder.
127
-
128
- Relationships and cross references do not go into verbatim body. In current
129
- output they stay in `structure.yaml` typed edges; this workflow does not render
130
- relationship reference blocks.
131
-
132
- </reference>
133
-
134
- <procedures>
135
-
136
- ### Step 1 — Open Compile Context
137
-
138
- Run:
139
-
140
- ```bash
141
- context run compile:<type>:<source>:<collection> --view blockers --format json
142
- context run compile:<type>:<source>:<collection> --view read-plan --format json
143
- ```
144
-
145
- Use the returned blockers, node list, source overview, and next action. If the
146
- blockers view reports section blockers, return to prose align and repair the
147
- confirmed structure before compile. If the CLI says the structure is missing,
148
- unconfirmed, stale, frozen against the wrong snapshot, or invalid, return to
149
- prose align or source capture as indicated.
150
-
151
- ### Step 2 — Inspect One Node
152
-
153
- For each node that should become draft knowledge, run:
154
-
155
- ```bash
156
- context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
157
- context run compile:<type>:<source>:<collection> --view schema --format json
158
- context run compile:<type>:<source>:<collection> --view semantic-rules --source <view-ref> --format json
159
- ```
160
-
161
- Follow the semantic-rules `next_action.command` pages before classifying section
162
- kind, summary, support, skip/update, weak evidence, or structure repair. Do not
163
- load rules outside the returned required set.
164
-
165
- Do not treat those references as optional background. They are the current
166
- compile drafting, judgment, and semantic-repair procedures.
167
-
168
- When exact evidence text is needed, use the CLI-returned source ref with the
169
- current evidence view. Do not open snapshot files directly.
170
-
171
- ### Step 3 — Draft And Validate Actions
172
-
173
- Create a `context.compile-actions.v1` payload for the selected view. Prefer
174
- omitted `content` with `source_refs[]` so the CLI mirrors source spans.
175
- If the source evidence is non-contiguous or contains separable examples,
176
- configuration blocks, lists, or procedures, split the compile actions when the
177
- confirmed structure supports that split. If the structure is too coarse, return
178
- to prose align and ask the user to confirm a section split instead of writing
179
- summarized body text. Explicit `content` / `content_intent` is not part of the
180
- current compile contract.
181
-
182
- For small payloads, use stdin/heredoc. For larger payloads, write a scratch file
183
- under `.tmp/agent-payloads/<run-id>/` and pass it through `--input`. Scratch
184
- files are disposable agent working files; they are never compile state and must
185
- not be read back as a substitute for CLI views.
186
-
187
- Validate:
188
-
189
- ```bash
190
- context run compile:<type>:<source>:<collection> --validate --input <compile-actions.yaml> --format json
191
- ```
192
-
193
- Repair diagnostics by routing them to the right decision:
194
-
195
- - source ref or planned-section mismatch -> reread node-context, or return to
196
- structure confirmation if ownership is wrong;
197
- - unsupported kind or op -> use the schema view and current compile references;
198
- - explicit content -> omit `content` and mirror source, or return to align for
199
- a section split;
200
- - weak evidence, duplicate, conflict, omit, or scope issue -> use the compile
201
- judgment / semantic judgment references and ask the user when required;
202
- - frozen structure mismatch -> rerun status and return to align/capture as
203
- directed.
204
-
205
- Use typed diagnostics as the repair contract:
206
-
207
- - `reason_code`, `path`, and `missing[]` identify what to fix;
208
- - warnings are not write blockers unless the response marks them blocking or
209
- the next action says so;
210
- - weak evidence, duplicate, conflict, temporal, leakage, ownership, and scope
211
- issues are semantic review issues, not formatting problems;
212
- - raw/source-ref pointer diagnostics are evidence checks, not content-quality
213
- judges.
214
-
215
- When validation returns a new `next_action.command`, follow that exact command.
216
- When it returns blocking diagnostics without a write command, repair and
217
- validate again. Do not stage a compile payload just because the YAML shape looks
218
- valid.
219
-
220
- ### Step 4 — Stage Draft Candidates
221
-
222
- Stage only after validation has no errors:
223
-
224
- ```bash
225
- context run compile:<type>:<source>:<collection> --stage --input <compile-actions.yaml> --format json
226
- ```
227
-
228
- After staging, follow `next_action` exactly:
229
-
230
- - `continue_compile_batch` with `human_gate=false`: move to the returned next
231
- View and repeat **Step 2–4**. Do not open Review yet.
232
- - `review_candidates` with `human_gate=true`: every planned View in this
233
- confirmed structure slot is prepared; return to `context status`. If
234
- `pendingStructureTargets` is non-empty, complete those slots first. Delegate
235
- one collection-level Review to
236
- `skill-review-gate.md` only when status
237
- reports the complete multi-slot round ready.
238
- - Use `status.structureBatch` as the complete slot overview. Its evidence Views
239
- are parallel-safe, its structure mutations are serial, and Review opens once
240
- after all declared slots are prepared.
241
-
242
- The CLI blocks Review and close while confirmed Views remain unprepared. Do not
243
- turn sequential View writes into sequential user approvals.
244
-
245
- ### Step 5 — Close Handoff
246
-
247
- After the single collection-level batch review apply, return to `context status`. If status says
248
- `compile-close-needed`, run deterministic close:
249
-
250
- ```bash
251
- context close --format json
252
- ```
253
-
254
- Close derives `knowledge/structure.yaml` and edge projection from approved
255
- knowledge, then runs the final verify gate. It must not rewrite approved
256
- verbatim body. References, changelog, package index, and section fingerprint
257
- rebuilds are not current close output.
258
-
259
- Then route to package output when status reaches `ready-to-build`.
260
-
261
- ### Step 6 — Self-verify Checklist
262
-
263
- - [ ] Compile started from confirmed structure, not a new structure proposal.
264
- - [ ] Node context and schema came from compile phase views.
265
- - [ ] Compile references were read before choosing kind/summary/support.
266
- - [ ] Actions mirror source by default and do not invent body text.
267
- - [ ] No explicit reader-visible `content` was written by the Agent.
268
- - [ ] Relationships are expressed as structure edges, not inserted into
269
- verbatim text.
270
- - [ ] No direct edits were made to `sources/`, `.tmp`, `unapproved/`,
271
- `knowledge/`, review HTML, or `dist/`.
272
- - [ ] Every planned View was staged before opening the one batch Review.
273
-
274
- ### Final Report
275
-
276
- Report in the user's language. Include only:
277
-
278
- - view refs compiled in this round;
279
- - candidate ids staged and whether they contain verbatim or empty sections;
280
- - validation warnings that still matter for review;
281
- - whether review, close, verify, or build is the next status route.
282
-
283
- Do not report internal payload digests, source-ref hashes, internal workspace
284
- paths, absolute paths, scratch file paths, or raw CLI JSON unless the user asks
285
- for debug output.
286
-
287
- </procedures>
@@ -1,138 +0,0 @@
1
- ---
2
- name: skill-review-gate
3
- description: >
4
- Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Opens the review UI, waits for user decisions, applies copied review decision Payloads,
6
- and prevents agent-authored approval/rejection decisions unless the user
7
- explicitly requests the scoped quick-decision path.
8
- tools:
9
- - Bash
10
- ---
11
-
12
- # skill-review-gate
13
-
14
- Run the human review gate. The user decides approval or rejection.
15
-
16
- ## TL;DR
17
-
18
- - The agent never approves or rejects candidates on the user's behalf.
19
- - Exception: when the current conversation explicitly authorizes fully managed
20
- operation and status routes a managed Review, run the exact
21
- `context review approve-all <collection> --managed --format json` (or
22
- `--all`) command. Do not open HTML, synthesize a Payload, or persist this
23
- authority in project configuration.
24
- - Enter this skill only when the preceding command returns
25
- `next_action.human_gate=true`. A no-delta codegraph run returns false and does
26
- not need Review.
27
- - For prose, enter only after every View in the confirmed compile batch is
28
- prepared. For codegraph, enter only after all pending extract phases in the
29
- confirmed module round are complete. The CLI blocks partial-batch Review.
30
- - Use `context review html <collection> --open --format json` for visual review.
31
- - `<collection>` is an internal production collection such as `architecture`,
32
- `sop`, `decision`, or `standards`; it is not an OKF package root such as
33
- `wikis`, `guides`, or `rules`.
34
- - Always surface the CLI-printed `file_url`. If browser opening fails or the
35
- host cannot make a path clickable, also provide `absolute_path`.
36
- - Apply only the review decision Payload copied by the user from the review UI.
37
- - Do not parse `unapproved/entities.jsonl`, `.tmp`, or HTML internals with
38
- scripts to synthesize decisions.
39
- - If the user explicitly asks for quick or automated approval/rejection, use
40
- `context review approve <candidate-id> --collection <collection>` /
41
- `context review reject <candidate-id> --collection <collection>` or `--all`;
42
- these commands still enforce the current scoped candidate-id gate.
43
- - `context run <extract-phase-id> --auto-promote` is a separate, explicit
44
- codegraph-only CI/CD policy. It may apply code add/update/remove deltas and
45
- refresh deterministic close, and verify them without this gate; it never
46
- applies to semantic knowledge. Package build remains an explicit later step.
47
-
48
- <procedures>
49
-
50
- ### Step 0 — Resolve Managed Review
51
-
52
- If `context status --managed --format json` returns a managed-session Review
53
- command, execute that atomic `approve-all` command and return to managed status.
54
- Candidate scope, ids, fingerprints, structure digests, and source refs remain
55
- fully validated; any mismatch is an error, not permission to bypass the gate.
56
- Without explicit current-conversation managed authorization, continue with the
57
- normal HTML workflow below.
58
-
59
- ### Step 1 — Open Review
60
-
61
- For the internal collection reported by status, run:
62
-
63
- ```bash
64
- context review html <collection> --open --format json
65
- ```
66
-
67
- Inspect the returned `opened` field. When it is `true`, tell the user the page
68
- was opened. When it is `false`, do not claim it opened; report `open_error` and
69
- provide `file_url` as the primary clickable link plus `absolute_path` as a
70
- copyable fallback. Do not drop `--open`, and do not assume a fixed review
71
- filename; review scope is collection or `--all`.
72
- Do not substitute OKF package roots (`wikis`, `guides`, `rules`) for this
73
- argument; review scope is the internal collection namespace.
74
-
75
- Explain that this page is the human gate between draft candidates and approved
76
- knowledge. Approved entries become Markdown under `knowledge/`; rejected entries
77
- stay in the committed ledger and are not written as knowledge pages. The agent
78
- must not choose these states.
79
-
80
- ### Step 2 — Wait For Payload
81
-
82
- Ask the user to review candidates in the HTML page, open Payload, copy the
83
- compact review decision Payload, and paste it into the agent chat. Uniform
84
- decisions produce one JSON line; exceptions add JSONL lines. The Payload records the
85
- user's decisions, usually as a default decision plus exceptions, so it should
86
- not be expanded into pretty JSON unless the user asks.
87
-
88
- The user should not need to create a payload file manually. Do not continue
89
- until the user supplies that payload.
90
-
91
- If the user instead explicitly asks the agent to use the quick approval or
92
- rejection path, do not synthesize a decision Payload. Run the scoped quick command with the
93
- candidate id shown by review/list/status and either `--collection <collection>`
94
- or `--all`.
95
-
96
- ### Step 3 — Apply Payload
97
-
98
- After the user pastes the payload into chat, the agent writes it to a normal
99
- temporary file under the current workspace `.tmp/` directory and runs:
100
-
101
- ```bash
102
- context review apply <payload-file>
103
- ```
104
-
105
- Do not accept or emit alternate `{ "decisions": [...] }` JSON. Use only
106
- `context.review.decisions.v1` JSONL.
107
- Do not use unsupported scratch, workflow, compile, or `.context/config.yaml`
108
- commands to store this payload.
109
-
110
- ### Step 4 — Return To Status
111
-
112
- Run `context status` after apply. If it reports package output choice, return to
113
- `skill-continue-workflow.md`.
114
-
115
- If status instead reports `approved-source-ref-ambiguous` for a pre-file-aware
116
- codegraph ref, explain that the user's decisions remain approved. Rerun its
117
- declared extraction phase to refresh the symbol index, then run:
118
-
119
- ```bash
120
- context review migrate-codegraph-refs
121
- context verify
122
- ```
123
-
124
- Do not reopen Review, synthesize another payload, delete approved pages, or
125
- filter conflicting symbols. If the ref is already file-aware, report a
126
- duplicate extract-index defect rather than running the metadata migration.
127
-
128
- ### Step 5 — Self-verify Checklist
129
-
130
- - [ ] Every decision came from the user's copied payload, an explicitly scoped
131
- quick command, or the current conversation's managed `approve-all` command.
132
- If not, stop and discard the agent-authored decision.
133
- - [ ] Payload was applied through `context review apply`. If not, return to
134
- **Step 3**.
135
- - [ ] No direct edits were made to `knowledge/` or `unapproved/`. If not, report
136
- the protocol error.
137
-
138
- </procedures>
@@ -1,201 +0,0 @@
1
- ---
2
- name: capture-source
3
- description: >
4
- Capture local Markdown or Lark/Feishu document sources through registered
5
- Context sources and declared capture phases. Use the local `context` CLI for
6
- workspace writes.
7
- tools:
8
- - Bash
9
- ---
10
-
11
- # Capture
12
-
13
- Current capture discipline for document sources. The executable path is source
14
- registration plus the declared capture phase flow:
15
-
16
- - local Markdown/MDX file source: `context source add file [YYYYMMDD] --module <module> --local <path>`
17
- followed by `context run capture:file:YYYYMMDD/<module> --format json`;
18
- - Lark/Feishu source: `context source add lark [YYYYMMDD] --module <module> ...`
19
- followed by `context run capture:lark:YYYYMMDD/<module> --format json`;
20
- - refresh: rerun the same declared capture phase after status or the user asks
21
- for recapture.
22
-
23
- Use only commands surfaced by the current status output or capture phase.
24
- For a user-confirmed multi-document batch, `context status --format json`
25
- returns every uncaptured module in `routing.command_plan`. Run the complete
26
- list in order; a successful module is omitted from the next status result.
27
- When the user explicitly asks to capture, ingest, fetch, read, or include exact
28
- file/Lark paths or URLs, that request is the read permission for those sources;
29
- do not repeat the question after registration. A mere mention, possible-source
30
- discussion, or register-only request is not permission, and an explicit refusal
31
- always wins.
32
- Register several file/Lark/repo sources with `context source add batch [date]
33
- --input <yaml|json|->`; do not launch multiple `source add` processes in
34
- parallel. Repo batch items require `module`; file/Lark items may omit it and use
35
- the module returned by the CLI. A write-lock error means another Context mutation is active: wait for
36
- it to finish and retry rather than editing registry files.
37
-
38
- ---
39
-
40
- ## Workflow
41
-
42
- Capture is entirely CLI-driven — your role is to register the right source,
43
- declare the matching capture phase, run the current `context run capture:*`
44
- command, and relay its output. Never hand-write captured source snapshots: the
45
- CLI owns normalisation (NFC, BOM strip, line endings) and the `content_hash`
46
- contract, so any manual edit breaks idempotency.
47
-
48
- ### Code capture diagnostics
49
-
50
- Do not run hand-written dependency preflight commands before code extraction or
51
- document capture. The CLI owns configured runner/plugin resolution and returns
52
- structured `agent_hints[]` when a runner or remote-document helper is missing or
53
- misconfigured.
54
-
55
- If code extraction capture fails with install or runner hints, surface the CLI's `agent_hints[]` command exactly as printed. Ask the user once whether to run that command on their behalf when it touches shared state. If approved, run the exact command from `agent_hints[0].command`, then retry the same capture command. If declined, leave the command visible so the user can run it manually. Do not inline extraction packages, do not hand-write code snapshots, and do not continue with partial capture.
56
-
57
- Invocation note: document capture and code extraction do not run through `npx`.
58
- Use the installed `context` CLI and the declared phase command returned by
59
- `context status` or the phase view. When external helpers are missing, surface
60
- the CLI's structured install hints instead of substituting your own package
61
- manager or version.
62
-
63
- ### Route by source boundary
64
-
65
- Before choosing a local Markdown capture route, honor the surrounding task context. Driver documents such as run instructions, handbooks, READMEs, plans, feedback issues, corpus/index/manifests, and batch lists are not Context sources unless the user explicitly asks to ingest them. Capture only ingest targets that are already explicit in the user request; if they are missing, ask one clarification instead of capturing the driver document.
66
-
67
- - One or more local `.md` / `.mdx` files or a local documentation folder to ingest →
68
- register one file source with the user-confirmed boundary:
69
- `context source add file [YYYYMMDD] --module <module> --local <file-or-folder>`.
70
- The CLI returns the `YYYYMMDD/module` identity to use in project phases. More
71
- than one file module may share the date. For an explicit
72
- batch inside a broader folder, preserve the user's include list on source
73
- registration. Default file capture handles `.md`. If the CLI reports
74
- document-site files such as `.mdx`, `_meta.json`, sidebars, or docs config,
75
- stop and confirm whether the selected boundary is a documentation site before
76
- changing capture configuration. For MDX documentation sites that use
77
- `_meta.json`, declare `mdxJsonDocs()` on `captureFile` in `src/index.ts`;
78
- keep `_meta.json` only when it is route metadata for the selected document
79
- folder. The CLI captures it as metadata and generates
80
- `__context_route_metadata.md` as mechanical route evidence; it also extracts
81
- static MDX component props/children into `__context_mdx_component_text.md`
82
- when components carry user-facing text. Declare
83
- `captureFile({ source: source("<date>", "<module>", { type: "file" }), processor: mdxJsonDocs() })`, then
84
- run `context run capture:file:<date>/<module> --format json`. If the selected MDX page
85
- is empty or only mounts runtime-rendered content, tell the user that capture
86
- found a document-site shell and ask for the rendered-site or data-source
87
- boundary instead of inventing body text.
88
- - A Lark/Feishu URL, doc token, or wiki token → register one Lark source:
89
- `context source add lark [YYYYMMDD] --module <module> --url <url>` or the
90
- matching token flag. Register every requested document under the same date;
91
- do not ask for `YYYYMMDD-2`. Declare
92
- `captureLark({ source: source("<date>", "<module>", { type: "lark" }) })`,
93
- then run `context run capture:lark:<date>/<module> --format json`.
94
- - Mixed local document and Lark document batches are separate sources unless
95
- the current CLI explicitly offers a combined source contract. Do not write an
96
- Agent-side URL/file loop.
97
- - Refresh or recapture request for an already registered file/Lark source →
98
- rerun the same declared capture phase. The CLI appends a new snapshot only
99
- when content changes and never overwrites prior snapshots.
100
- - Code package extraction is not document capture. Route code source selection
101
- through `skill-source-scope` extraction preview and the declared extract
102
- phase. Do not invent a document capture path for code.
103
- - Conversation notes, decisions, and revision intents are not document capture
104
- sources in the current workflow unless the CLI status or project-specific
105
- phase exposes an explicit note source contract. If absent, record the user
106
- guidance in the conversation and use it as pre-align hints, not as a snapshot
107
- write.
108
-
109
- Do not discover files with `find` / `ls` when the user already supplied paths.
110
- If the include set is large, summarize it and ask for confirmation before
111
- registration; do not read file bodies before capture permission is clear.
112
-
113
- ### Output Handling
114
-
115
- Report the CLI output verbatim. If the CLI reports `N sources changed`, suggest the right next step:
116
-
117
- - Run `context status --format json` and use its `state`, `routing`, and
118
- `command_plan`; if status returns `needs-capture-phase`, first perform the
119
- exact `routing.configuration` edit and rerun status.
120
- - While status remains `needs-capture`, execute every returned capture command
121
- for the already confirmed batch before asking another naming, collection, or
122
- read-permission question.
123
- - If status reports `captured-ready-to-investigate`, suggest the returned
124
- `context run align:<type>:<source>:<collection> --view read-plan --format json`
125
- command and hand off to `skill-prose-align`.
126
- - If status reports `needs-structure` or `structure-ready`, follow the returned
127
- align/compile command instead of naming a generic slash command.
128
- - If status reports `compile-ready-for-review`, route to the review gate.
129
- - If the source was code-only and status reports pending code projection,
130
- follow the CLI-owned extract/compile route returned by status.
131
-
132
- Never suggest prose compile or hand-built document knowledge for a code-only
133
- source. Code sources become active knowledge only through the declared
134
- extraction/review route returned by `context status`.
135
-
136
- If capture is rejected because another phase or write gate is active, do not
137
- discard it automatically. Explain the active state from `context status`, follow
138
- that phase when it is the intended task, and ask the user before discarding
139
- in-progress work when a current project command exists. If the user expected a
140
- different repository/workspace, change to the confirmed workspace root before
141
- retrying capture.
142
-
143
- ## Final Report
144
-
145
- Report in the user's conversation language. Translate section headings into the user's language instead of copying the English labels below verbatim. Optimize for human readability: use document titles instead of source ids, package names instead of internal source id strings, and human-readable kind labels ("local markdown", "Feishu doc", "code package") instead of internal tokens. Do not surface content hashes, snapshot digests, internal payload identifiers, or absolute file paths.
146
-
147
- Stable structure:
148
-
149
- 1. Completion headline. Single line with the action verb plus core counts: how
150
- many sources were captured this round, broken down by `new` / `updated` /
151
- `unchanged`. Capture data from the current `context run capture:* --format
152
- json` result summary, or per-source statuses when no aggregate is returned.
153
- 2. Per-source list grouped by status. Show each captured source under one of three groups (`new` / `updated` / `unchanged`); within each group list the document title (`source.title`), kind label, and a short delta indicator for updated sources (for example added/removed line counts when the CLI returns them; otherwise "content changed"). Cache-hit code packages belong in `unchanged`. Omit groups that are empty.
154
- 3. Pending phase signals. When `context status --format json` reports follow-up
155
- work tied to this capture (sources pending align, sources pending compile,
156
- refreshed sources pending recompile, code sources pending projection),
157
- summarize each as a single line naming the work and which sources are
158
- affected. Omit the section entirely when there is no pending follow-up.
159
- 4. Next step. Single command suggestion driven by status: the returned
160
- `context run align:<type>:<source>:<collection> ...` command when structure work is
161
- pending, the returned `context run compile:<type>:<source>:<collection> ...`
162
- command when prose compile work is pending, or the CLI-owned code projection
163
- command when code projection is pending. If nothing is pending, say so
164
- explicitly.
165
-
166
- Do not include raw CLI diagnostics, agent_hints content, schema names, or phase
167
- payload identifiers in the report. Those belong in earlier troubleshooting
168
- output, not in the completion summary.
169
-
170
- ## Reference
171
-
172
- ### Missing Dependency Recovery
173
-
174
- If the CLI returns `agent_hints[]` for a missing code runner or plugin package, stop and surface the hint. Ask the user once for permission to run `agent_hints[0].command` (the CLI has already picked the correct package manager — `npm install -g` or `bun install -g` — based on how `context` itself was installed). If approved, run that exact command via `Bash` and then retry the same capture; if declined, leave the command visible for manual install. Never substitute a different package manager or version.
175
-
176
- If the CLI prints a missing-dependency error like `lark-cli not installed`, walk the user through installation:
177
-
178
- 1. Ask once up-front whether to proceed with install. If no → stop and tell the user to install manually from the tool's official README, then re-run.
179
- 2. `WebFetch` the tool's official README (for `lark-cli` that's `https://github.com/larksuite/cli/blob/main/README.md#quick-start-ai-agent`).
180
- 3. For each command the README prescribes for the user's platform, show the command then call `Bash`. The host's per-tool permission prompt is the user's confirmation surface; don't add extra y/n questions between commands.
181
- 4. Stop on any failure; surface stderr verbatim.
182
- 5. After success, tell the user to rerun the current Context command that
183
- failed.
184
-
185
- ### Language Policy
186
-
187
- Your prose to the user follows the user's conversation language. CLI commands, flag names, URLs, env-var names, binary names, source-ids stay English.
188
-
189
- ### Invariants
190
-
191
- - Captured source snapshots are immutable post-write — the CLI only ever appends new snapshots.
192
- - The source registry is authoritative; derived index files are not Agent phase
193
- inputs.
194
- - Local `.md` / `.mdx` source identity follows the captured file's stable origin path, not its H1/title. If the user edits the title but captures the same path again, the CLI appends a new snapshot to the same `local:*` source.
195
- - In `--format json`, code capture runner cache state is authoritative in `result.runner.cacheMode`: `prepared` means a workspace runner was prepared, `cached` means workspace cache hit, and `bypass` means `--no-runner-cache` used a temporary runner directory instead of the workspace runner cache.
196
- - Code extraction runner evidence is derived by the CLI from emitted source files. Do not ask users to configure `evidence.mode`; rerun capture after fixing the runner emit output.
197
- - Code extraction snapshots ship with `evidence.mode: none`; symbols/files/edges are indexed inside the code bucket. Do not ask users to inspect or repair a code `.evidence` manifest.
198
- - Code extraction/projection is separate from document capture. Materialize code
199
- knowledge through the declared extract/code projection flow before prose align
200
- attaches documentation to code Nodes.
201
- - On duplicate capture of the same URL: identical `content_hash` → CLI skips with `unchanged`; different hash → CLI appends a new snapshot.