@c4a/context-cli 0.6.1-beta.1 → 0.6.1-beta.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 (233) hide show
  1. package/README.md +32 -7
  2. package/README.zh-CN.md +17 -3
  3. package/cli.js +57906 -40477
  4. package/docs/quickstart.md +16 -5
  5. package/package.json +3 -2
  6. package/plugins/README.md +55 -118
  7. package/plugins/README_CN.md +46 -102
  8. package/plugins/VERSION +1 -1
  9. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  10. package/plugins/claude/commands/continue.md +42 -10
  11. package/plugins/claude/commands/init.md +20 -10
  12. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  13. package/plugins/codex/skills/continue/SKILL.md +42 -11
  14. package/plugins/codex/skills/init/SKILL.md +20 -11
  15. package/plugins/cursor/.cursor-plugin/plugin.json +2 -3
  16. package/plugins/cursor/README.md +2 -2
  17. package/plugins/cursor/commands/context-continue.md +42 -10
  18. package/plugins/cursor/commands/context-init.md +20 -10
  19. package/plugins/skills/context-continue/SKILL.md +42 -11
  20. package/plugins/skills/context-init/SKILL.md +20 -11
  21. package/providers/context/actions/align-next.yaml +5 -0
  22. package/providers/context/actions/apply-managed-review.yaml +5 -0
  23. package/providers/context/actions/apply-structure-confirmation.yaml +5 -0
  24. package/providers/context/actions/build-next.yaml +5 -0
  25. package/providers/context/actions/capture-next.yaml +5 -0
  26. package/providers/context/actions/close-approved-knowledge.yaml +5 -0
  27. package/providers/context/actions/compile-next.yaml +5 -0
  28. package/providers/context/actions/configure-code-extraction.yaml +5 -0
  29. package/providers/context/actions/configure-document-capture.yaml +5 -0
  30. package/providers/context/actions/configure-package-output.yaml +5 -0
  31. package/providers/context/actions/configure-prose-lifecycle.yaml +5 -0
  32. package/providers/context/actions/ensure-repository-sources.yaml +5 -0
  33. package/providers/context/actions/extract-next.yaml +5 -0
  34. package/providers/context/actions/inspect-document-classification.yaml +5 -0
  35. package/providers/context/actions/inspect-review.yaml +5 -0
  36. package/providers/context/actions/inspect-structure.yaml +5 -0
  37. package/providers/context/actions/maintain-evidence.yaml +6 -0
  38. package/providers/context/actions/materialize-context-view.yaml +8 -0
  39. package/providers/context/actions/register-source-batch.yaml +7 -0
  40. package/providers/context/actions/repair-project-entry.yaml +5 -0
  41. package/providers/context/actions/repair-verification.yaml +5 -0
  42. package/providers/context/actions/repair-workspace-state.yaml +5 -0
  43. package/providers/context/codes.yaml +38 -0
  44. package/providers/context/graphs/workspace.yaml +469 -0
  45. package/providers/context/manifest.json +610 -0
  46. package/providers/context/provider.yaml +12 -0
  47. package/providers/context/resources/diagnostics/verification.md +21 -0
  48. package/providers/context/resources/diagnostics/workspace-state.md +27 -0
  49. package/providers/context/resources/dialogue/code-extraction.md +34 -0
  50. package/providers/context/resources/dialogue/document-capture.md +29 -0
  51. package/providers/context/resources/dialogue/document-classification.md +32 -0
  52. package/providers/context/resources/dialogue/evidence-maintenance.md +26 -0
  53. package/providers/context/resources/dialogue/human-gates.md +34 -0
  54. package/providers/context/resources/dialogue/knowledge-review.md +27 -0
  55. package/providers/context/resources/dialogue/package-output.md +32 -0
  56. package/providers/context/resources/dialogue/source-boundary.md +29 -0
  57. package/providers/context/resources/dialogue/structure-confirmation.md +44 -0
  58. package/providers/context/resources/manuals/guides/package-outputs.md +250 -0
  59. package/providers/context/resources/manuals/reference/package-templates.md +372 -0
  60. package/providers/context/resources/manuals/reference/project-api.md +664 -0
  61. package/providers/context/resources/manuals/reference/template-variables.md +247 -0
  62. package/providers/context/resources/procedures/close-and-build.md +19 -0
  63. package/providers/context/resources/procedures/code-extraction.md +30 -0
  64. package/providers/context/resources/procedures/document-capture.md +31 -0
  65. package/providers/context/resources/procedures/document-classification.md +19 -0
  66. package/providers/context/resources/procedures/evidence-maintenance.md +20 -0
  67. package/providers/context/resources/procedures/knowledge-review.md +24 -0
  68. package/providers/context/resources/procedures/package-output.md +31 -0
  69. package/providers/context/resources/procedures/project-configuration.md +21 -0
  70. package/providers/context/resources/procedures/prose-align.md +23 -0
  71. package/providers/context/resources/procedures/prose-compile.md +20 -0
  72. package/providers/context/resources/procedures/source-boundary.md +37 -0
  73. package/{plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md → providers/context/resources/procedures/source-capture-detailed.md} +28 -19
  74. package/providers/context/resources/procedures/verify-and-repair.md +19 -0
  75. package/{plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references → providers/context/resources/semantic/align}/candidate-resolution.md +13 -0
  76. package/{plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references → providers/context/resources/semantic/align}/density-profile.md +11 -0
  77. 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
  78. package/{plugins/cursor/skills/skill-prose-align/references/internal-procedures → providers/context/resources/semantic/align}/structure-planning.md +58 -11
  79. package/providers/context/resources/semantic/compile/index.md +31 -0
  80. package/providers/context/resources/views/package-current.yaml +6 -0
  81. package/providers/context/resources/views/review-current.yaml +6 -0
  82. package/providers/context/resources/views/source-current.yaml +6 -0
  83. package/providers/context/resources/views/structure-current.yaml +6 -0
  84. package/providers/context/resources/views/verification-current.yaml +6 -0
  85. package/providers/context/resources/views/workspace-current.yaml +6 -0
  86. package/providers/context/schemas/evidence-maintenance-input.schema.json +30 -0
  87. package/providers/context/schemas/source-batch-input.schema.json +189 -0
  88. package/providers/context/scripts/render-context-view.mjs +21 -0
  89. package/plugins/claude/skills/skill-continue-workflow/SKILL.md +0 -235
  90. package/plugins/claude/skills/skill-init-workspace/SKILL.md +0 -74
  91. package/plugins/claude/skills/skill-package-output/SKILL.md +0 -180
  92. package/plugins/claude/skills/skill-prose-align/SKILL.md +0 -322
  93. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  94. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  95. package/plugins/claude/skills/skill-prose-compile/SKILL.md +0 -287
  96. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  97. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  98. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  99. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  100. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  101. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  102. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  103. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  104. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  105. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  106. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  107. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  108. package/plugins/claude/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  109. package/plugins/claude/skills/skill-review-gate/SKILL.md +0 -138
  110. package/plugins/claude/skills/skill-source-scope/SKILL.md +0 -525
  111. package/plugins/claude/skills/skill-source-scope/references/capture-source.md +0 -201
  112. package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +0 -235
  113. package/plugins/codex/skills/continue/references/internal-procedures/skill-init-workspace.md +0 -74
  114. package/plugins/codex/skills/continue/references/internal-procedures/skill-package-output.md +0 -180
  115. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  116. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  117. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  118. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  119. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +0 -322
  120. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  121. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  122. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  123. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  124. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  125. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  126. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  127. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  128. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  129. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  130. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  131. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  132. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  133. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +0 -287
  134. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +0 -138
  135. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md +0 -201
  136. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +0 -525
  137. package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +0 -235
  138. package/plugins/codex/skills/init/references/internal-procedures/skill-init-workspace.md +0 -74
  139. package/plugins/codex/skills/init/references/internal-procedures/skill-package-output.md +0 -180
  140. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  141. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  142. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  143. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +0 -322
  144. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  145. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  146. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  147. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  148. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  149. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  150. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  151. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  152. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  153. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  154. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  155. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  156. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  157. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +0 -287
  158. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +0 -138
  159. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +0 -525
  160. package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +0 -235
  161. package/plugins/cursor/skills/skill-init-workspace/SKILL.md +0 -74
  162. package/plugins/cursor/skills/skill-package-output/SKILL.md +0 -180
  163. package/plugins/cursor/skills/skill-prose-align/SKILL.md +0 -322
  164. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  165. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  166. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  167. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +0 -287
  168. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  169. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  170. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  171. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  172. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  173. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  174. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  175. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  176. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  177. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  178. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  179. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  180. package/plugins/cursor/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  181. package/plugins/cursor/skills/skill-review-gate/SKILL.md +0 -138
  182. package/plugins/cursor/skills/skill-source-scope/SKILL.md +0 -525
  183. package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +0 -201
  184. package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +0 -235
  185. package/plugins/skills/context-continue/references/internal-procedures/skill-init-workspace.md +0 -74
  186. package/plugins/skills/context-continue/references/internal-procedures/skill-package-output.md +0 -180
  187. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  188. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  189. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  190. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  191. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +0 -322
  192. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  193. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  194. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  195. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  196. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  197. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  198. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  199. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  200. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  201. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  202. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  203. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  204. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  205. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +0 -287
  206. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +0 -138
  207. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +0 -201
  208. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +0 -525
  209. package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +0 -235
  210. package/plugins/skills/context-init/references/internal-procedures/skill-init-workspace.md +0 -74
  211. package/plugins/skills/context-init/references/internal-procedures/skill-package-output.md +0 -180
  212. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  213. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  214. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -263
  215. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +0 -282
  216. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +0 -322
  217. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  218. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  219. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  220. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  221. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  222. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  223. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  224. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  225. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  226. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  227. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  228. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  229. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  230. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +0 -287
  231. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +0 -138
  232. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +0 -201
  233. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +0 -525
@@ -0,0 +1,664 @@
1
+ ---
2
+ id: context.sdk.project-api
3
+ kind: procedure
4
+ mediaType: text/markdown
5
+ ---
6
+
7
+ # Project API
8
+
9
+ Import from `@c4a/context` in `src/index.ts`.
10
+
11
+ ## `defineProject`
12
+
13
+ ```ts
14
+ import { defineProject } from "@c4a/context";
15
+
16
+ export default defineProject({
17
+ sources: [],
18
+ phases: [],
19
+ packages: [],
20
+ });
21
+ ```
22
+
23
+ The project file is executable TypeScript, but the preferred style is a small
24
+ declaration list. Put heavy logic in imported transform files.
25
+
26
+ ## Sources
27
+
28
+ A source is a stable knowledge boundary, not only a display label. Repo, file,
29
+ and Lark sources use a date batch plus a concrete module name; multiple code or
30
+ document modules may share the date. The flattened selector `YYYYMMDD/module`
31
+ is the source identity used by phases, snapshot paths, and source refs.
32
+ Codegraph NodeRef/ViewRef and knowledge paths use the stable module name without
33
+ the date:
34
+
35
+ ```text
36
+ knowledge/<collection>/<slug>.md
37
+ knowledge/<collection>/<containment>/<slug>.md # only for an intentional hierarchy
38
+ knowledge/codegraph/<module>/symbol/<slug>.md
39
+ repo:<date>/<module>#symbol:...
40
+ file:<date>/<module>/<document>#span:...
41
+ lark:<date>/<module>/<document>#span:...
42
+ capture:file:<date>/<module>
43
+ align:lark:<date>/<module>:architecture
44
+ dist/<source-name>-kb/...
45
+ ```
46
+
47
+ Choose the module boundary before extraction. In a monorepo, register each
48
+ confirmed package/subdirectory under the same date batch. A repo root that
49
+ resolves to multiple modules is for inspection; it is not an extraction unit.
50
+ Approved codegraph paths use the stable module name; the date remains only in
51
+ source selectors, phase ids, and evidence refs:
52
+
53
+ ```text
54
+ knowledge/codegraph/module-a/...
55
+ knowledge/codegraph/module-b/...
56
+ ```
57
+
58
+ For prose Views, omit `containment` when the page is an independent collection
59
+ entry. The CLI then derives `knowledge/<collection>/<slug>.md`. Set
60
+ `containment` only when the approved structure intentionally places the page
61
+ under a parent path; it is not a required source/module wrapper.
62
+
63
+ The registry stores this as one date entry containing several `modules` entries,
64
+ and materializes each module at `sources/repo/<date>/<module>`.
65
+ Repo module names are project-wide codegraph identities and therefore cannot be
66
+ reused under another date batch. Refresh an existing module through its original
67
+ date/module selector.
68
+ When a repo module and the Context workspace share the same Git root, the CLI
69
+ normalizes even an absolute `--local` input into a path relative to the
70
+ workspace and stores the package directory as `subpath`. Materialized repo
71
+ links always use relative symlink targets. This keeps the registry and links
72
+ valid when the whole checkout moves. Cross-repository absolute checkout roots
73
+ remain absolute because no shared movable root can be assumed.
74
+ The date entry must be a valid calendar date in `YYYYMMDD` form. Use
75
+ `context source ensure <date>` or `context source inspect <date>` for the whole
76
+ batch, and `<date>/<module>` when targeting one module.
77
+
78
+ ```yaml
79
+ sources:
80
+ - name: "20260712"
81
+ modules:
82
+ - name: module-a
83
+ local: ../monorepo
84
+ subpath: packages/module-a
85
+ git:
86
+ remote: https://git.example.com/product/monorepo.git
87
+ ref: <full-commit-sha>
88
+ - name: module-b
89
+ local: ../monorepo
90
+ subpath: packages/module-b
91
+ git:
92
+ remote: https://git.example.com/product/monorepo.git
93
+ ref: <full-commit-sha>
94
+ ```
95
+
96
+ File and Lark registries use the same outer shape. Their modules hold local
97
+ document boundaries or remote document identities:
98
+
99
+ ```yaml
100
+ sources:
101
+ - name: "20260712"
102
+ modules:
103
+ - name: local-manual
104
+ local: ../manual
105
+ - name: api-guide
106
+ local: ../api-guide
107
+ ```
108
+
109
+ ### Batch source registration
110
+
111
+ Use one command when a user confirms several source modules together:
112
+
113
+ ```bash
114
+ context source add batch [YYYYMMDD] --input <sources.yaml|json|-> --format json
115
+ ```
116
+
117
+ The payload is a non-empty `sources` array. Every item requires `type`. Repo
118
+ also requires `module` and accepts `local`/`remote`/`ref`. File requires `local`
119
+ and accepts `include`; Lark accepts exactly one of `url`, `docToken`, or
120
+ `wikiToken` plus optional `title`. File/Lark `module` is optional and is derived
121
+ with the same lowercase path-safe rule as the single-source commands. Resolved
122
+ module identities must be unique across the batch.
123
+
124
+ Source mutations share a project write lock, and every registry file is
125
+ replaced atomically. Never run separate `source add` processes in parallel. A
126
+ batch executes items in order; if a runtime item fails, its error lists the
127
+ completed items and the same payload may be rerun idempotently.
128
+
129
+ ```yaml
130
+ sources:
131
+ - name: "20260712"
132
+ modules:
133
+ - name: user-manual
134
+ url: https://example.larksuite.com/wiki/example-a
135
+ - name: migration-guide
136
+ url: https://example.larksuite.com/wiki/example-b
137
+ ```
138
+
139
+ ### `source(name)`
140
+
141
+ Reference one registered source by name. The reference is type-neutral in
142
+ project code; each phase resolves it through the registry and checks whether it
143
+ is a repo, file, or lark source:
144
+
145
+ ```ts
146
+ import { source } from "@c4a/context";
147
+
148
+ const productDocs = source("product-docs");
149
+ ```
150
+
151
+ ### `source(namespace, module)`
152
+
153
+ Reference one registered repo module. Use the date batch and module name
154
+ returned by `context source add repo`:
155
+
156
+ ```ts
157
+ const moduleA = source("20260712", "module-a");
158
+ const moduleB = source("20260712", "module-b");
159
+ ```
160
+
161
+ These references resolve to `20260712/module-a` and `20260712/module-b`;
162
+ extraction and verification remain independent.
163
+
164
+ ### `source(namespace, module, { type })`
165
+
166
+ Reference one file or Lark module under a date batch:
167
+
168
+ ```ts
169
+ const localManual = source("20260712", "local-manual", { type: "file" });
170
+ const userManual = source("20260712", "user-manual", { type: "lark" });
171
+ ```
172
+
173
+ These references produce module-scoped phase ids and manifest entries without
174
+ treating the date as one document identity. Captured document files remain
175
+ siblings under `sources/file|lark/<date>/` and share the date-level
176
+ `manifest.json`; the logical `date/module` identity does not create another
177
+ directory level.
178
+
179
+ For a confirmed multi-document request, declare one capture phase per module.
180
+ While any module is uncaptured, `context status --format json` selects either
181
+ the `route.capture.configuration-required` Route with
182
+ `workflow.current.configuration`, or the `route.capture.pending-target` Route
183
+ with the next declared command in `workflow.current.commands`.
184
+
185
+ Each command item declares its effect and availability. The current route's
186
+ `gate` identifies the decision and authority boundary. Write commands are bound
187
+ to the workflow revision; after one succeeds, rerun status instead of reusing
188
+ the old command.
189
+
190
+ ### `allSources("repo")`
191
+
192
+ Reference all repo sources as one collection:
193
+
194
+ ```ts
195
+ import { allSources } from "@c4a/context";
196
+
197
+ const repoSources = allSources("repo");
198
+ ```
199
+
200
+ Use `allSources("repo")` only when the project should list every registered
201
+ repo module. Prefer a specific `source("date", "module")` for extraction phases.
202
+
203
+ ## Phases
204
+
205
+ Phases declare reads and writes. The runtime can inspect them, dry-run them, and
206
+ record per-phase logs.
207
+
208
+ The API exposes the current declared workflow only. Declare file/lark sources,
209
+ capture phases, prose structure gates, source-bound compile phases, code
210
+ extraction phases, review gates, close/build, and packages explicitly. The CLI
211
+ then routes work through `context status`, `context run <phase-id>`, `context
212
+ review html/apply`, `context close`, `context verify`, and `context build`.
213
+
214
+ ### Status declaration coverage
215
+
216
+ `context status --format json --view full` includes a `declarationGraph` and
217
+ `configurationGaps` for document workflows. Each row reports capture, align,
218
+ compile, and Review coverage for a canonical source plus collection. Gaps are
219
+ non-blocking before structure confirmation. Once a structure is confirmed,
220
+ compile routing is exact: phase selection uses canonical source plus collection,
221
+ and candidate progress remains bound to the current `structure_digest`. A
222
+ compile phase from another collection is never used as fallback.
223
+
224
+ Captured align targets that do not yet have an active confirmed structure are
225
+ reported in `pendingStructureTargets`. They remain unfinished even when the
226
+ currently active structures have been closed, verified, and built. Missing
227
+ compile or Review declarations route to `needs-prose-configuration`; once the
228
+ declarations are complete, status returns the exact align investigation command
229
+ for the next target. A built package does not freeze the workspace or require a
230
+ new workspace for later sources.
231
+
232
+ `context status --format json` defaults to the compact workflow route, target,
233
+ progress, counts, and aggregated diagnostics. Use `--view full` only when
234
+ source, phase, package, and lifecycle inventories are needed for debugging.
235
+
236
+ ### Current-conversation managed execution
237
+
238
+ `context status --managed --format json` exposes
239
+ `executionMode: { mode: "managed", scope: "current-conversation" }` and resolves
240
+ eligible human gates into immediate commands. The flag is deliberately absent
241
+ from `defineProject`: callers start each workflow evaluation loop with managed
242
+ status, then execute the returned revision-bound command unchanged. Returned
243
+ commands carry a compact current-conversation marker instead of repeating every
244
+ authority. A later process or conversation gets ordinary human-gated behavior
245
+ by default.
246
+
247
+ Managed Review is atomic and scope-validated:
248
+
249
+ ```bash
250
+ context review approve-all <collection> --managed --format json
251
+ context review approve-all --all --managed --format json
252
+ ```
253
+
254
+ Managed structure confirmation and Review use only the revision-bound commands
255
+ returned by `workflow.current`. Source boundaries and unread source bodies,
256
+ external operations, payload validation, deterministic close, and verification
257
+ errors are never bypassed.
258
+
259
+ For consecutive mechanical routes, the Agent may run:
260
+
261
+ ```bash
262
+ context run --managed --until blocked-or-complete --format json
263
+ ```
264
+
265
+ This is a bounded host loop over the same revisioned routes. It stops before
266
+ read-only interpretation, project configuration, unresolved authority,
267
+ diagnostics, or a non-unique command plan; it does not add another workflow
268
+ entry or make semantic decisions.
269
+
270
+ ### `captureFile`
271
+
272
+ Capture a registered file source into a committed normalized document snapshot.
273
+ Default file capture treats `.md` files as document bodies. For MDX
274
+ documentation sites that use `_meta.json` route metadata, declare the processor
275
+ in `src/index.ts`:
276
+
277
+ ```ts
278
+ captureFile({ source: docs, processor: mdxJsonDocs() });
279
+ ```
280
+
281
+ With that processor, `.md` and `.mdx` are document bodies. Included
282
+ `_meta.json` files are captured as route metadata assets, surfaced in
283
+ `read-plan` / `source-index`, and mechanically projected into
284
+ `__context_route_metadata.md` so route facts can be cited as evidence. The route
285
+ projection records the canonical extensionless route form instead of treating a
286
+ local `.html` URL as the source of truth.
287
+
288
+ MDX component text is extracted separately: string props such as `title`,
289
+ `label`, `description`, `href`, `to`, and component children are projected into
290
+ `__context_mdx_component_text.md` as generated evidence. The original `.mdx`
291
+ file remains in the snapshot unchanged. If a documentation page renders body
292
+ text only at runtime from application code or remote data, configure that
293
+ documentation site as an explicit source boundary instead of hand-writing route
294
+ or body facts.
295
+
296
+ ```ts
297
+ captureFile({ source: docs });
298
+ ```
299
+
300
+ Phase id:
301
+
302
+ ```text
303
+ capture:file:<source-name>
304
+ ```
305
+
306
+ Register the source first with
307
+ `context source add file [YYYYMMDD] --module <module> --local <path>`.
308
+ The first registration requires `--local`; the registry may later keep `local`
309
+ only as a refresh hint while committed snapshots remain verifiable. Multiple
310
+ file modules may share one date. When `--module` is omitted, the CLI derives it
311
+ from the local file or directory name.
312
+
313
+ ### `captureLark`
314
+
315
+ Capture a registered Lark / Feishu document source into a committed normalized
316
+ Markdown snapshot:
317
+
318
+ ```ts
319
+ captureLark({ source: handbook });
320
+ ```
321
+
322
+ Phase id:
323
+
324
+ ```text
325
+ capture:lark:<source-name>
326
+ ```
327
+
328
+ Register each source with
329
+ `context source add lark [YYYYMMDD] --module <module>` and exactly one identity
330
+ flag: `--url`, `--doc-token`, or `--wiki-token`. Multiple documents may share
331
+ one date batch; when `--module` is omitted, the CLI derives an opaque,
332
+ credential-safe module id. Capture reads the
333
+ remote document through the CLI runner, writes normalized snapshot files under
334
+ `sources/lark/<date>/` as sibling document files tracked by one date-level `manifest.json`, and does not write access credentials into the
335
+ workspace.
336
+
337
+ Use a typed document reference in project declarations:
338
+
339
+ ```ts
340
+ const handbook = source("20260712", "user-manual", { type: "lark" });
341
+ const localDocs = source("20260712", "local-manual", { type: "file" });
342
+ ```
343
+
344
+ ### `alignProse`
345
+
346
+ Open the prose structure gate for document evidence:
347
+
348
+ ```ts
349
+ alignProse({
350
+ source: docs,
351
+ collection: "architecture",
352
+ });
353
+ ```
354
+
355
+ `collection` is an internal knowledge classification, not a package directory.
356
+ Package build maps `codegraph`/`business`/`product` to `wikis/`,
357
+ `architecture`/`sop`/`faq`/`decision`/`incident` to `guides/`,
358
+ `standards`/`test` to `rules/`, and `feats` to `feats/`. The complete output
359
+ contract is documented in [Package Outputs](../guides/package-outputs.md).
360
+
361
+ When `source("name")` is type-neutral, the SDK may declare
362
+ `align:source:<source-name>:architecture`; the CLI resolves it to
363
+ `align:file:<source-name>:architecture` or `align:lark:<source-name>:architecture` after
364
+ reading the registry.
365
+
366
+ Align is a gated workflow. It produces and validates a structure draft, not
367
+ final approved body:
368
+
369
+ ```bash
370
+ context run align:file:<source-name>:architecture --view read-plan --format json
371
+ context run align:file:<source-name>:architecture --view source-index --compact --format json
372
+ context run align:file:<source-name>:architecture --view span-detail --span <source-ref> --format json
373
+ context run align:file:<source-name>:architecture --view span-text --span <source-ref> --format json
374
+ context run align:file:<source-name>:architecture --view existing-knowledge --query <title-or-stable-ref> --format json
375
+ context run align:file:<source-name>:architecture --view schema --format json
376
+ context run align:file:<source-name>:architecture --view semantic-rules --format json
377
+ context run align:file:<source-name>:architecture --validate --input <structure.yaml> --format json
378
+ context run align:file:<source-name>:architecture --view diagnostics --input <structure.yaml> --format json
379
+ context run align:file:<source-name>:architecture --view structure-summary --input <structure.yaml> --format json
380
+ context run align:file:<source-name>:architecture --stage --input <structure.yaml> --format json
381
+ ```
382
+
383
+ `--validate`, `--stage`, and `--confirm` are mutually exclusive operations. An
384
+ `--input` without an operation is rejected unless the selected view explicitly
385
+ consumes that input. Deterministic boundary repairs run internally before the
386
+ result is returned. Successful validation returns a stage command with the
387
+ same file path. JSON run output keeps `next_action` first;
388
+ schema and full reports stay behind explicit Views, while `--verbose` restores
389
+ the full phase result and repeated contracts. Long diagnostics return a compact
390
+ first page plus an exact diagnostics continuation command.
391
+
392
+ `existing-knowledge` is the authoring-time lookup for approved identities. It
393
+ returns stable NodeRefs, ViewRefs, titles, tags, collections, and section counts
394
+ without exposing workspace storage paths. `--query` performs deterministic
395
+ case-insensitive exact/prefix/substring matching; `--collection`,
396
+ `--node-type`, `--page-size`, and the returned continuation command narrow or
397
+ page the same View. Use it after reading source evidence and before introducing
398
+ a new Node identity. Structure validation remains the final duplicate gate.
399
+
400
+ Align and compile evidence results include `semantic_rules`. Its `required`
401
+ array is the rule subset selected for the current judgment, with a selection
402
+ reason and content digest for each rule. `handle`, `digest`, and
403
+ `rules_version` are stable cache checks: reuse a loaded ruleset only while its
404
+ content remains in the active context and both handle and digest still match.
405
+ After context compaction, resume the paginated `semantic-rules` View for the
406
+ returned required subset; a handle alone does not imply that the rule text is
407
+ still available.
408
+
409
+ Document evidence boundaries are deterministic rather than semantic.
410
+ `source-index` and `chunks` mark Markdown AST blocks with
411
+ `boundary_role: "markdown-ast-block"` and `section_candidate: true`.
412
+ `span-text`/`span-detail` mark each returned page as
413
+ `range_role: "transport-page"` and `section_candidate: false`; pagination line
414
+ ranges are never structure boundaries. Structure validation blocks repeated
415
+ fixed-width line grids that cut through AST blocks and reports sections that
416
+ cross multiple heading paths, without classifying document topics.
417
+
418
+ After capture, the capture phase itself exposes collection-neutral `read-plan`,
419
+ `source-index`, `span-detail`, `span-text`, and other read-only evidence views.
420
+ Status selects `route.document.classification-required` until every captured
421
+ target has an evidence-backed, user-confirmed align declaration. Align then
422
+ adds `schema` and `structure-summary` for structure work. Agents should not
423
+ inspect `sources/` or `.tmp` directly.
424
+
425
+ Compile `read-plan`, `blockers`, and `diagnostics` Views are workspace-read-only
426
+ and may run concurrently. Compile `--validate`, compile `--stage`, structure
427
+ confirmation, Review apply, and close are serial operations.
428
+
429
+ Structure payloads use `schema_version: "context.structure.v1"` and canonical
430
+ `file:` / `lark:` `#span` source refs. A one-file-to-one-page plan is represented
431
+ as ordinary `nodes[]` and `views[]` in the structure. It does not bypass
432
+ structure confirmation or compile. Continuity applies to each Section, while one View/Page may
433
+ contain multiple independently retrievable continuous Sections. Deterministic
434
+ boundary splitting is applied internally during validate/stage; it is not a
435
+ separate Agent-authored payload or approval step.
436
+
437
+ ### `compileProse`
438
+
439
+ Compile confirmed prose structure into reviewable source-bound draft pages:
440
+
441
+ ```ts
442
+ compileProse({
443
+ source: docs,
444
+ collection: "architecture",
445
+ });
446
+ ```
447
+
448
+ When `source("name")` is type-neutral, the SDK may declare
449
+ `compile:source:<source-name>:architecture`; the CLI resolves it to
450
+ `compile:file:<source-name>:architecture` or `compile:lark:<source-name>:architecture` after
451
+ reading the registry.
452
+
453
+ Phase id:
454
+
455
+ ```text
456
+ compile:file:<source-name>:architecture
457
+ compile:lark:<source-name>:architecture
458
+ ```
459
+
460
+ Compile requires confirmed `unapproved/structure.yaml`. It freezes the current
461
+ structure for the compile round; if the user wants to change nodes, section
462
+ ownership, or relationships, return to the align/structure gate.
463
+
464
+ Common commands:
465
+
466
+ ```bash
467
+ context run compile:file:<source-name>:architecture --view read-plan --format json
468
+ context run compile:file:<source-name>:architecture --validate --format json
469
+ context run compile:file:<source-name>:architecture --stage --format json
470
+ context run compile:file:<source-name>:architecture --view diagnostics --format json
471
+ ```
472
+
473
+ Compile validates the complete confirmed source/collection slot before writing
474
+ any candidate, then materializes the slot atomically. Section bodies are
475
+ source-mirrored from the confirmed spans; the Agent does not create a separate
476
+ compile-actions payload. Each canonical source plus collection remains an
477
+ independent structure slot. When other captured align targets remain pending,
478
+ status routes to those slots before opening one collection-level Review
479
+ payload. `context close` is blocked while a planned View is unprepared, still
480
+ draft, or rejected without a structure revision.
481
+
482
+ Relationships stay in `structure.yaml` typed edges in current output; compile
483
+ does not infer relationships or inject relation markers into verbatim body.
484
+
485
+ ### `extractTs`
486
+
487
+ Extract exported TypeScript / TSX symbols into draft candidates:
488
+
489
+ ```ts
490
+ extractTs({
491
+ source: componentLib,
492
+ collection: "codegraph",
493
+ });
494
+ ```
495
+
496
+ Options:
497
+
498
+ | Field | Meaning |
499
+ |---|---|
500
+ | `source` | `source("date", "module")` for one repo module |
501
+ | `collection` | Code extraction uses `"codegraph"` |
502
+ | `include` | Optional glob list inside the selected source; default is `["src/**/*.{ts,tsx}"]` |
503
+ | `mode` | `"exports"` (default) traces public exports from automatic or configured entries; `"scan"` uses every file matched by `include` as an entry root |
504
+ | `entries` | Optional source-relative entry files for `"exports"` mode. They override `package.json` entry detection and live only in the Context project configuration |
505
+ | `exportedOnly` | Defaults to `true` in `"exports"` mode and `false` in `"scan"` mode |
506
+ | `transform` | Optional markdown transform function or functions |
507
+
508
+ `source` is the only package/module boundary. `include` narrows files inside
509
+ that source; it does not select a second module. Standard packages can omit
510
+ `entries` and use `package.json` `exports`, `main`, or `bin` detection. For a
511
+ non-standard package, configure `entries` in the Context project instead of
512
+ editing the source repository:
513
+
514
+ ```ts
515
+ extractTs({
516
+ source: componentLib,
517
+ collection: "codegraph",
518
+ include: ["src/**/*.ts"],
519
+ entries: ["src/api.ts"],
520
+ });
521
+ ```
522
+
523
+ When the intended knowledge scope is every declaration in the selected files
524
+ rather than a public export graph, use `mode: "scan"`. Scan mode does not accept
525
+ `entries`; `include` supplies its file roots.
526
+
527
+ Entry failures use the stable machine code `NO_ENTRY_DETECTED`. This includes
528
+ `entries: []`, exports mode with no detected/configured entry, and scan mode
529
+ with no files matched by `include`; these cases never succeed silently.
530
+
531
+ TypeScript extraction reads the selected module's `tsconfig.json` or
532
+ `jsconfig.json`. JSONC comments/trailing commas, local or installed `extends`,
533
+ `compilerOptions.baseUrl`, and `compilerOptions.paths` are used for export
534
+ tracing and internal dependency relations, so aliases such as `@/*` resolve to
535
+ their source files.
536
+
537
+ In monorepos, make each package/subdirectory a module boundary. Register the
538
+ chosen package path with `context source add repo [YYYYMMDD] --module <module> --local <package-dir>` and
539
+ reference it with `source("<date>", "<module>")`.
540
+ Do not use `include` to choose a
541
+ package from a larger monorepo source.
542
+
543
+ Use `context source inspect <date>/<module>` to list detected module/package
544
+ boundaries before choosing the source. Use `context run <phase-id> --dry-run
545
+ --format json` to check the resolved modules, file counts, symbol counts, and
546
+ candidate estimate before writing `unapproved/entities.jsonl`. The dry-run
547
+ preview also includes `knowledgeTree` and `knowledgePathExamples`, which show
548
+ where approved Markdown will land after review apply.
549
+ Its module and total summaries distinguish `discoveredFiles`, `analyzedFiles`,
550
+ `skippedFiles`, `symbols`, and `relations`. Module summaries also expose the
551
+ resolved `entryFiles`, exported/internal symbol counts, and a structural
552
+ `candidateKinds` count. These fields describe extractor output only; the CLI
553
+ does not infer which symbols are meaningful to a particular product or
554
+ audience. Modules with skipped files include the deterministic traversal
555
+ reason, such as files not reachable from exports-mode entries.
556
+
557
+ Phase id shape:
558
+
559
+ ```text
560
+ extract:<source-name-or-repo>:codegraph
561
+ ```
562
+
563
+ Codegraph extraction has two execution policies:
564
+
565
+ - `context run <phase-id>` is the Agent/user default. The first run sends every
566
+ code symbol to Review. Later runs preserve unchanged approved symbols and send
567
+ only `add`, `update`, and `remove` deltas to Review. After every phase result,
568
+ the Agent re-evaluates `context status --format json`; only
569
+ `workflow.current` decides whether Review is now required.
570
+ - `context run <phase-id> --auto-promote` is the explicit CI/CD path. It is valid
571
+ only for `phase.extract.ts` codegraph phases, applies deterministic code deltas
572
+ without Review, refreshes deterministic close when approved knowledge changed,
573
+ then runs project verification. Close or verification errors make the command
574
+ fail; JSON output reports applied/materialized/removed counts plus a `close`
575
+ state of `refreshed`, `current`, or `not-required`. Package build remains a
576
+ separate pipeline step; existing package outputs are reported stale.
577
+
578
+ This policy never auto-promotes architecture, business, decision, test, or
579
+ other semantic knowledge. Agents must not infer a human gate from a phase-local
580
+ result. Human gates and their inspection/resolution Actions are exposed only by
581
+ `workflow.current`.
582
+
583
+ Approved codegraph sections use the local evidence form
584
+ `src-N#symbol:<file>:<symbol>:<kind>@<digest>`. The file segment makes reverse
585
+ lookup exact when multiple files contain the same symbol name, kind, and digest;
586
+ the complete ref remains opaque to agents. New pages keep only top-level
587
+ `candidate_fingerprint` and do not emit `code_origin`.
588
+
589
+ ### `reviewValidity`
590
+
591
+ Declare the review step for a collection:
592
+
593
+ ```ts
594
+ reviewValidity({ collection: "codegraph" });
595
+ ```
596
+
597
+ Declare one review gate for all current draft collections:
598
+
599
+ ```ts
600
+ reviewValidity({ scope: "all" });
601
+ ```
602
+
603
+ Phase id:
604
+
605
+ ```text
606
+ review:codegraph:validity
607
+ review:all:validity
608
+ ```
609
+
610
+ The review HTML and apply flow are CLI-owned.
611
+
612
+ This phase marks a human review gate when current candidates exist. Agents
613
+ should run `context review html <collection> --open --format json` or `context
614
+ review html --all --open --format json`, confirm the returned `opened` field,
615
+ and wait for the user-copied payload. They should not run the phase as an
616
+ automatic approval step or synthesize a payload themselves.
617
+
618
+ The only batch-wide exception is explicit current-conversation fully managed
619
+ authority. In that mode, follow the `context status --managed` route to
620
+ `context review approve-all ... --managed`; the CLI validates the exact current
621
+ scope before applying one default-approved decision.
622
+
623
+ The gate is batch-scoped: prose waits for every planned View across all active
624
+ structure slots and every declared `pendingStructureTargets` item in the round;
625
+ codegraph waits for every pending extract phase in the confirmed module round.
626
+ Candidate count/hash therefore describes the complete current batch rather than
627
+ one page, source slot, or module. Deterministic close later merges all active
628
+ slots into `knowledge/structure.yaml`.
629
+
630
+ `status.structureBatch` lists unclassified, configuration-required, pending,
631
+ and active structure slots together with the execution policy for the round.
632
+
633
+ If the user explicitly asks for an automated or quick approval/rejection path,
634
+ use the scoped quick commands instead of hand-writing a payload:
635
+
636
+ ```bash
637
+ context review approve <candidate-id> --collection <collection>
638
+ context review reject <candidate-id> --all
639
+ ```
640
+
641
+ These commands still compute the current review scope and apply the same
642
+ candidate-id gate as the copied payload flow. They are not a replacement for the
643
+ default human review gate.
644
+
645
+ ### `customPhase`
646
+
647
+ Use only when the typed factories cannot express a project-specific workflow:
648
+
649
+ ```ts
650
+ const sample = source("20260712", "sample");
651
+
652
+ customPhase("custom:20260712/sample:review", async (ctx) => {
653
+ await ctx.ensureSources({ source: sample });
654
+ await ctx.extract.ts(extractTs({ source: sample, collection: "codegraph" }));
655
+ await ctx.review.html(reviewValidity({ collection: "codegraph" }));
656
+ });
657
+ ```
658
+
659
+ Custom phases are an escape hatch. Prefer built-in factories for source,
660
+ extract, review, and package workflows. The supported runtime helpers are:
661
+
662
+ - `ctx.ensureSources(...)` for repo source readiness.
663
+ - `ctx.extract.ts(...)` for declared TypeScript extraction.
664
+ - `ctx.review.html(...)` for the human review HTML gate.