@c4a/context-cli 0.6.19 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +67 -6
  2. package/README.zh-CN.md +42 -5
  3. package/cli.js +77935 -44879
  4. package/indexers/bundles/context-code-indexer/SKILL.md +20 -0
  5. package/indexers/bundles/context-code-indexer/context-indexer.yaml +230 -0
  6. package/indexers/bundles/context-code-indexer/references/composers/contracts-and-chains.md +23 -0
  7. package/indexers/bundles/context-code-indexer/references/composers/cross-module-chain.md +22 -0
  8. package/indexers/bundles/context-code-indexer/references/composers/development-and-delivery.md +22 -0
  9. package/indexers/bundles/context-code-indexer/references/composers/event-flow.md +21 -0
  10. package/indexers/bundles/context-code-indexer/references/composers/examples-and-documentation.md +22 -0
  11. package/indexers/bundles/context-code-indexer/references/composers/persistence-boundary.md +21 -0
  12. package/indexers/bundles/context-code-indexer/references/composers/protocol-boundary.md +22 -0
  13. package/indexers/bundles/context-code-indexer/references/composers/public-contract.md +23 -0
  14. package/indexers/bundles/context-code-indexer/references/indexer.md +49 -0
  15. package/indexers/bundles/context-code-indexer/references/metrics.md +201 -0
  16. package/{providers/context/resources/semantic/code-index/templates/adapter.md → indexers/bundles/context-code-indexer/templates/adapter-integration.md} +16 -6
  17. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/api-service.md +9 -7
  18. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/background-runtime.md +3 -3
  19. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/cli-tool.md +6 -6
  20. package/indexers/bundles/context-code-indexer/templates/component-library.md +99 -0
  21. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/contract-source.md +4 -4
  22. package/{providers/context/resources/semantic/code-index/templates/cross-module-chain.md → indexers/bundles/context-code-indexer/templates/data-sync-reconciliation.md} +11 -12
  23. package/{providers/context/resources/semantic/code-index/templates/derived-source.md → indexers/bundles/context-code-indexer/templates/derived-generated-source.md} +11 -10
  24. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/domain-service.md +4 -4
  25. package/{providers/context/resources/semantic/code-index/templates/event-flow.md → indexers/bundles/context-code-indexer/templates/event-consumer.md} +5 -5
  26. package/{providers/context/resources/semantic/code-index/templates/protocol-boundary.md → indexers/bundles/context-code-indexer/templates/gateway-facade.md} +14 -13
  27. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/monorepo-container.md +11 -11
  28. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/plugin-extension.md +1 -1
  29. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/sdk-library.md +9 -9
  30. package/{providers/context/resources/semantic/code-index/templates/persistence-boundary.md → indexers/bundles/context-code-indexer/templates/storage-repository.md} +3 -3
  31. package/{providers/context/resources/semantic/code-index → indexers/bundles/context-code-indexer}/templates/web-application.md +5 -4
  32. package/indexers/bundles/context-code-indexer/tests/fixtures/chapters.json +226 -0
  33. package/indexers/bundles/context-code-indexer/tests/fixtures/composers.json +82 -0
  34. package/indexers/bundles/context-code-indexer/tests/fixtures/profiles.json +210 -0
  35. package/indexers/bundles/context-code-indexer/tests/fixtures/scenarios.json +122 -0
  36. package/indexers/bundles/context-markdown-indexer/SKILL.md +20 -0
  37. package/indexers/bundles/context-markdown-indexer/context-indexer.yaml +147 -0
  38. package/indexers/bundles/context-markdown-indexer/references/classification.md +63 -0
  39. package/indexers/bundles/context-markdown-indexer/references/editorial-policy.md +106 -0
  40. package/indexers/bundles/context-markdown-indexer/references/indexer.md +23 -0
  41. package/indexers/bundles/context-markdown-indexer/references/semantic-planning.md +146 -0
  42. package/indexers/bundles/context-markdown-indexer/references/structure-and-artifacts.md +109 -0
  43. package/indexers/bundles/context-markdown-indexer/tests/fixtures/anonymous.json +31 -0
  44. package/indexers/bundles/context-markdown-indexer/tests/fixtures/editorial.json +309 -0
  45. package/indexers/bundles/context-markdown-indexer/tests/fixtures/migration-equivalence.json +186 -0
  46. package/indexers/bundles/context-markdown-indexer/tests/fixtures/profiles.json +171 -0
  47. package/indexers/bundles/context-markdown-indexer/tests/fixtures/routing.json +151 -0
  48. package/indexers/capability-manifest.json +35 -0
  49. package/indexers/contracts/hard-rule-conformance.json +2644 -0
  50. package/indexers/contracts/operator-contract.json +35 -0
  51. package/indexers/contracts/profile-contract.json +10162 -0
  52. package/indexers/release-manifest.json +208 -0
  53. package/package.json +5 -4
  54. package/plugins/README.md +17 -109
  55. package/plugins/README_CN.md +11 -89
  56. package/plugins/VERSION +1 -1
  57. package/plugins/claude/.claude-plugin/plugin.json +3 -11
  58. package/plugins/claude/CLAUDE.md +1 -1
  59. package/plugins/claude/README.md +1 -1
  60. package/plugins/claude/commands/context.md +76 -1
  61. package/plugins/codex/.codex-plugin/plugin.json +6 -17
  62. package/plugins/codex/AGENTS.md +1 -1
  63. package/plugins/codex/README.md +1 -1
  64. package/plugins/codex/skills/context/SKILL.md +77 -13
  65. package/plugins/cursor/.cursor-plugin/plugin.json +4 -17
  66. package/plugins/cursor/AGENTS.md +1 -1
  67. package/plugins/cursor/README.md +3 -2
  68. package/plugins/cursor/commands/c4a-context.md +76 -3
  69. package/plugins/skills/{c4a-context → context}/SKILL.md +78 -14
  70. package/plugins/skills/context-code-indexer/SKILL.md +20 -0
  71. package/plugins/skills/context-code-indexer/context-indexer.yaml +230 -0
  72. package/plugins/skills/context-code-indexer/references/composers/contracts-and-chains.md +23 -0
  73. package/plugins/skills/context-code-indexer/references/composers/cross-module-chain.md +22 -0
  74. package/plugins/skills/context-code-indexer/references/composers/development-and-delivery.md +22 -0
  75. package/plugins/skills/context-code-indexer/references/composers/event-flow.md +21 -0
  76. package/plugins/skills/context-code-indexer/references/composers/examples-and-documentation.md +22 -0
  77. package/plugins/skills/context-code-indexer/references/composers/persistence-boundary.md +21 -0
  78. package/plugins/skills/context-code-indexer/references/composers/protocol-boundary.md +22 -0
  79. package/plugins/skills/context-code-indexer/references/composers/public-contract.md +23 -0
  80. package/plugins/skills/context-code-indexer/references/indexer.md +49 -0
  81. package/plugins/skills/context-code-indexer/references/metrics.md +201 -0
  82. package/plugins/skills/context-code-indexer/templates/adapter-integration.md +119 -0
  83. package/plugins/skills/context-code-indexer/templates/api-service.md +118 -0
  84. package/plugins/skills/context-code-indexer/templates/background-runtime.md +109 -0
  85. package/plugins/skills/context-code-indexer/templates/cli-tool.md +129 -0
  86. package/plugins/skills/context-code-indexer/templates/component-library.md +99 -0
  87. package/plugins/skills/context-code-indexer/templates/contract-source.md +73 -0
  88. package/plugins/skills/context-code-indexer/templates/data-sync-reconciliation.md +77 -0
  89. package/plugins/skills/context-code-indexer/templates/derived-generated-source.md +117 -0
  90. package/plugins/skills/context-code-indexer/templates/domain-service.md +109 -0
  91. package/plugins/skills/context-code-indexer/templates/event-consumer.md +62 -0
  92. package/plugins/skills/context-code-indexer/templates/gateway-facade.md +89 -0
  93. package/plugins/skills/context-code-indexer/templates/monorepo-container.md +124 -0
  94. package/plugins/skills/context-code-indexer/templates/plugin-extension.md +52 -0
  95. package/plugins/skills/context-code-indexer/templates/sdk-library.md +132 -0
  96. package/plugins/skills/context-code-indexer/templates/storage-repository.md +56 -0
  97. package/plugins/skills/context-code-indexer/templates/web-application.md +146 -0
  98. package/plugins/skills/context-code-indexer/tests/fixtures/chapters.json +226 -0
  99. package/plugins/skills/context-code-indexer/tests/fixtures/composers.json +82 -0
  100. package/plugins/skills/context-code-indexer/tests/fixtures/profiles.json +210 -0
  101. package/plugins/skills/context-code-indexer/tests/fixtures/scenarios.json +122 -0
  102. package/plugins/skills/context-markdown-indexer/SKILL.md +20 -0
  103. package/plugins/skills/context-markdown-indexer/context-indexer.yaml +147 -0
  104. package/plugins/skills/context-markdown-indexer/references/classification.md +63 -0
  105. package/plugins/skills/context-markdown-indexer/references/editorial-policy.md +106 -0
  106. package/plugins/skills/context-markdown-indexer/references/indexer.md +23 -0
  107. package/plugins/skills/context-markdown-indexer/references/semantic-planning.md +146 -0
  108. package/plugins/skills/context-markdown-indexer/references/structure-and-artifacts.md +109 -0
  109. package/plugins/skills/context-markdown-indexer/tests/fixtures/anonymous.json +31 -0
  110. package/plugins/skills/context-markdown-indexer/tests/fixtures/editorial.json +309 -0
  111. package/plugins/skills/context-markdown-indexer/tests/fixtures/migration-equivalence.json +186 -0
  112. package/plugins/skills/context-markdown-indexer/tests/fixtures/profiles.json +171 -0
  113. package/plugins/skills/context-markdown-indexer/tests/fixtures/routing.json +151 -0
  114. package/providers/context/actions/accept-main-index-run.yaml +7 -0
  115. package/providers/context/actions/accept-material-answer-run.yaml +7 -0
  116. package/providers/context/actions/accept-post-author-composer-run.yaml +7 -0
  117. package/providers/context/actions/actualize-material-answer-bindings.yaml +8 -0
  118. package/providers/context/actions/apply-indexer-project.yaml +7 -0
  119. package/providers/context/actions/audit-material-gap-state.yaml +8 -0
  120. package/providers/context/actions/audit-projected-artifact-fan-out.yaml +8 -0
  121. package/providers/context/actions/authorize-indexer-dependencies.yaml +7 -0
  122. package/providers/context/actions/authorize-indexer-program-execution.yaml +7 -0
  123. package/providers/context/actions/build-main-index-author-worksets.yaml +7 -0
  124. package/providers/context/actions/build-main-index-catalog-fallback.yaml +7 -0
  125. package/providers/context/actions/build-main-index-partition-worksets.yaml +7 -0
  126. package/providers/context/actions/build-material-question-workset.yaml +7 -0
  127. package/providers/context/actions/build-post-author-composer-worksets.yaml +7 -0
  128. package/providers/context/actions/build-question-target-inventory.yaml +7 -0
  129. package/providers/context/actions/build-subject-catalog.yaml +7 -0
  130. package/providers/context/actions/build-target-resolution-views.yaml +7 -0
  131. package/providers/context/actions/checkpoint-material-answer-review.yaml +8 -0
  132. package/providers/context/actions/checkpoint-material-gaps.yaml +8 -0
  133. package/providers/context/actions/close-indexer-approved-knowledge.yaml +8 -0
  134. package/providers/context/actions/compile-indexer-candidates.yaml +8 -0
  135. package/providers/context/actions/compose-indexer-post-author-fragments.yaml +7 -0
  136. package/providers/context/actions/configure-community-indexer-fallback.yaml +6 -0
  137. package/providers/context/actions/configure-indexer-providers.yaml +6 -0
  138. package/providers/context/actions/confirm-index-requirement-workset.yaml +8 -0
  139. package/providers/context/actions/confirm-subject-reidentification.yaml +8 -0
  140. package/providers/context/actions/converge-main-index-partition-run.yaml +7 -0
  141. package/providers/context/actions/discover-markdown-indexer-providers.yaml +6 -0
  142. package/providers/context/actions/evaluate-material-gaps.yaml +8 -0
  143. package/providers/context/actions/fail-main-index-run.yaml +7 -0
  144. package/providers/context/actions/fail-material-answer-run.yaml +7 -0
  145. package/providers/context/actions/fail-post-author-composer-run.yaml +7 -0
  146. package/providers/context/actions/inspect-index-candidate-review-readiness.yaml +8 -0
  147. package/providers/context/actions/inspect-index-profile-failure.yaml +7 -0
  148. package/providers/context/actions/inspect-indexer-dependencies.yaml +7 -0
  149. package/providers/context/actions/inspect-indexer-program-execution.yaml +7 -0
  150. package/providers/context/actions/inspect-indexer-project-proposal.yaml +7 -0
  151. package/providers/context/actions/inspect-markdown-provider-capture.yaml +7 -0
  152. package/providers/context/actions/inspect-material-answer-review.yaml +8 -0
  153. package/providers/context/actions/materialize-indexer-instructions.yaml +7 -0
  154. package/providers/context/actions/observe-indexer-project.yaml +7 -0
  155. package/providers/context/actions/observe-main-index-run-ledger.yaml +7 -0
  156. package/providers/context/actions/observe-material-answer-runs.yaml +7 -0
  157. package/providers/context/actions/observe-post-author-composer-worksets.yaml +7 -0
  158. package/providers/context/actions/override-index-profile-audit.yaml +7 -0
  159. package/providers/context/actions/prepare-indexer-customization-project.yaml +7 -0
  160. package/providers/context/actions/prepare-main-index-run-ledger.yaml +7 -0
  161. package/providers/context/actions/prepare-material-answer-runs.yaml +7 -0
  162. package/providers/context/actions/propose-indexer-customization.yaml +7 -0
  163. package/providers/context/actions/propose-overlay-question-amendment.yaml +7 -0
  164. package/providers/context/actions/rebind-indexer-selection-to-requirement.yaml +7 -0
  165. package/providers/context/actions/reconcile-indexer-results.yaml +7 -0
  166. package/providers/context/actions/record-index-profile-revision.yaml +7 -0
  167. package/providers/context/actions/report-index-profile-failure.yaml +7 -0
  168. package/providers/context/actions/report-indexer-incremental-impact.yaml +8 -0
  169. package/providers/context/actions/resolve-effective-composers.yaml +7 -0
  170. package/providers/context/actions/review-material-answer-candidate.yaml +8 -0
  171. package/providers/context/actions/revise-index-output.yaml +7 -0
  172. package/providers/context/actions/route-index-requirement-confirmation.yaml +8 -0
  173. package/providers/context/actions/route-indexer-provider-selection.yaml +7 -0
  174. package/providers/context/actions/run-indexer-agent-step.yaml +7 -0
  175. package/providers/context/actions/run-indexer-lifecycle.yaml +7 -0
  176. package/providers/context/actions/run-indexer-post-author-composer.yaml +7 -0
  177. package/providers/context/actions/run-material-answer-indexers.yaml +7 -0
  178. package/providers/context/actions/start-main-index-run.yaml +7 -0
  179. package/providers/context/actions/start-material-answer-run.yaml +7 -0
  180. package/providers/context/actions/start-post-author-composer-run.yaml +7 -0
  181. package/providers/context/actions/validate-indexer-contract-overlays.yaml +7 -0
  182. package/providers/context/actions/validate-indexer-customization.yaml +7 -0
  183. package/providers/context/actions/validate-indexer-selection-proposal.yaml +7 -0
  184. package/providers/context/actions/validate-main-index-run.yaml +7 -0
  185. package/providers/context/actions/validate-markdown-provider-selection.yaml +7 -0
  186. package/providers/context/actions/validate-subject-key-schemas.yaml +8 -0
  187. package/providers/context/codes.yaml +69 -23
  188. package/providers/context/graphs/indexer.yaml +1042 -0
  189. package/providers/context/graphs/workspace.yaml +37 -454
  190. package/providers/context/manifest.json +1245 -433
  191. package/providers/context/provider.yaml +3 -2
  192. package/providers/context/resources/diagnostics/projection-stale.md +0 -1
  193. package/providers/context/resources/manuals/reference/project-api.md +41 -40
  194. package/providers/context/resources/views/document-optimization-current.yaml +1 -1
  195. package/providers/context/resources/views/package-current.yaml +1 -1
  196. package/providers/context/resources/views/resolved-indexer-instructions.yaml +23 -0
  197. package/providers/context/resources/views/review-current.yaml +1 -1
  198. package/providers/context/resources/views/source-boundary.yaml +1 -1
  199. package/providers/context/resources/views/source-current.yaml +1 -1
  200. package/providers/context/resources/views/verification-current.yaml +1 -1
  201. package/providers/context/resources/views/workspace-current.yaml +1 -1
  202. package/providers/context/schemas/indexer-agent-step-input.schema.json +30 -0
  203. package/providers/context/schemas/indexer-agent-step-result.schema.json +47 -0
  204. package/providers/context/schemas/indexer-candidate-compile-input.schema.json +57 -0
  205. package/providers/context/schemas/indexer-candidate-compile-output.schema.json +38 -0
  206. package/providers/context/schemas/indexer-candidate-review-readiness-input.schema.json +46 -0
  207. package/providers/context/schemas/indexer-candidate-review-readiness-output.schema.json +104 -0
  208. package/providers/context/schemas/indexer-contract-overlay-validation-input.schema.json +48 -0
  209. package/providers/context/schemas/indexer-contract-overlay-validation-result.schema.json +63 -0
  210. package/providers/context/schemas/indexer-customization-project-preparation-result.schema.json +44 -0
  211. package/providers/context/schemas/indexer-customization-proposal-draft.schema.json +83 -0
  212. package/providers/context/schemas/indexer-customization-validation-result.schema.json +36 -0
  213. package/providers/context/schemas/indexer-dependency-authorization-input.schema.json +71 -0
  214. package/providers/context/schemas/indexer-dependency-authorization-result.schema.json +138 -0
  215. package/providers/context/schemas/indexer-incremental-impact-input.schema.json +31 -0
  216. package/providers/context/schemas/indexer-incremental-impact-output.schema.json +52 -0
  217. package/providers/context/schemas/indexer-lifecycle-continuation.schema.json +15 -0
  218. package/providers/context/schemas/indexer-main-lifecycle-input.schema.json +187 -0
  219. package/providers/context/schemas/indexer-main-lifecycle-output.schema.json +180 -0
  220. package/providers/context/schemas/indexer-markdown-provider-capture-input.schema.json +17 -0
  221. package/providers/context/schemas/indexer-markdown-provider-capture-output.schema.json +54 -0
  222. package/providers/context/schemas/indexer-markdown-provider-validation-input.schema.json +34 -0
  223. package/providers/context/schemas/indexer-markdown-provider-validation-output.schema.json +75 -0
  224. package/providers/context/schemas/indexer-material-answer-lifecycle-input.schema.json +90 -0
  225. package/providers/context/schemas/indexer-material-answer-lifecycle-output.schema.json +80 -0
  226. package/providers/context/schemas/indexer-material-answer-review-inspection-input.schema.json +32 -0
  227. package/providers/context/schemas/indexer-material-answer-review-inspection-output.schema.json +32 -0
  228. package/providers/context/schemas/indexer-material-answer-review-resolution-input.schema.json +19 -0
  229. package/providers/context/schemas/indexer-material-answer-review-resolution-output.schema.json +87 -0
  230. package/providers/context/schemas/indexer-material-gap-lifecycle-input.schema.json +86 -0
  231. package/providers/context/schemas/indexer-material-gap-lifecycle-output.schema.json +19 -0
  232. package/providers/context/schemas/indexer-materialize-request.schema.json +53 -0
  233. package/providers/context/schemas/indexer-materialized-resource.schema.json +57 -0
  234. package/providers/context/schemas/indexer-overlay-question-amendment.schema.json +13 -0
  235. package/providers/context/schemas/indexer-overlay-question-proposal-input.schema.json +40 -0
  236. package/providers/context/schemas/indexer-overlay-question-rebind-input.schema.json +35 -0
  237. package/providers/context/schemas/indexer-overlay-question-rebind-result.schema.json +25 -0
  238. package/providers/context/schemas/indexer-post-author-fragment-request.schema.json +26 -0
  239. package/providers/context/schemas/indexer-post-author-fragment-result.schema.json +18 -0
  240. package/providers/context/schemas/indexer-post-author-lifecycle-input.schema.json +94 -0
  241. package/providers/context/schemas/indexer-post-author-lifecycle-output.schema.json +72 -0
  242. package/providers/context/schemas/indexer-profile-failure-inspection-input.schema.json +13 -0
  243. package/providers/context/schemas/indexer-profile-failure-inspection-result.schema.json +19 -0
  244. package/providers/context/schemas/indexer-profile-failure-report-input.schema.json +22 -0
  245. package/providers/context/schemas/indexer-profile-failure-report-result.schema.json +49 -0
  246. package/providers/context/schemas/indexer-profile-override-decision.schema.json +20 -0
  247. package/providers/context/schemas/indexer-profile-override-result.schema.json +49 -0
  248. package/providers/context/schemas/indexer-profile-revision-agent-input.schema.json +18 -0
  249. package/providers/context/schemas/indexer-profile-revision-record-input.schema.json +31 -0
  250. package/providers/context/schemas/indexer-profile-revision-record-result.schema.json +45 -0
  251. package/providers/context/schemas/indexer-program-execution-authorization-input.schema.json +145 -0
  252. package/providers/context/schemas/indexer-program-execution-authorization-result.schema.json +60 -0
  253. package/providers/context/schemas/indexer-project-action-result.schema.json +19 -0
  254. package/providers/context/schemas/indexer-project-gate-input.schema.json +100 -0
  255. package/providers/context/schemas/indexer-project-observation-input.schema.json +16 -0
  256. package/providers/context/schemas/indexer-project-observation-result.schema.json +42 -0
  257. package/providers/context/schemas/indexer-provider-route-input.schema.json +55 -0
  258. package/providers/context/schemas/indexer-provider-route-report.schema.json +188 -0
  259. package/providers/context/schemas/indexer-requirement-confirmation-input.schema.json +27 -0
  260. package/providers/context/schemas/indexer-requirement-confirmation-output.schema.json +24 -0
  261. package/providers/context/schemas/indexer-result-reconciliation-input.schema.json +59 -0
  262. package/providers/context/schemas/indexer-result-reconciliation-output.schema.json +43 -0
  263. package/providers/context/schemas/indexer-selection-proposal-input.schema.json +12 -0
  264. package/providers/context/schemas/indexer-selection-proposal-validation.schema.json +23 -0
  265. package/providers/context/schemas/indexer-subject-reidentification-input.schema.json +37 -0
  266. package/providers/context/schemas/indexer-subject-reidentification-output.schema.json +31 -0
  267. package/providers/context/skills/configure-indexer-providers/SKILL.md +58 -0
  268. package/providers/context/skills/prepare-indexer-customization-project/SKILL.md +31 -0
  269. package/providers/context/skills/propose-indexer-customization/SKILL.md +40 -0
  270. package/providers/context/skills/revise-index-output/SKILL.md +12 -0
  271. package/providers/context/skills/run-indexer-agent-step/SKILL.md +20 -0
  272. package/providers/context/skills/run-indexer-lifecycle/SKILL.md +36 -0
  273. package/providers/context/skills/run-indexer-post-author-composer/SKILL.md +21 -0
  274. package/providers/context/actions/align-next.yaml +0 -6
  275. package/providers/context/actions/apply-code-index-guidance.yaml +0 -5
  276. package/providers/context/actions/apply-structure-confirmation.yaml +0 -5
  277. package/providers/context/actions/compile-next.yaml +0 -5
  278. package/providers/context/actions/configure-code-extraction.yaml +0 -5
  279. package/providers/context/actions/configure-prose-lifecycle.yaml +0 -5
  280. package/providers/context/actions/extract-next.yaml +0 -5
  281. package/providers/context/actions/inspect-code-extraction.yaml +0 -5
  282. package/providers/context/actions/inspect-document-classification.yaml +0 -5
  283. package/providers/context/actions/inspect-structure.yaml +0 -5
  284. package/providers/context/actions/migrate-codeindex.yaml +0 -5
  285. package/providers/context/actions/optimize-documents.yaml +0 -6
  286. package/providers/context/actions/preview-extraction-batch.yaml +0 -5
  287. package/providers/context/actions/revise-code-index-audit.yaml +0 -5
  288. package/providers/context/actions/submit-code-index-audit.yaml +0 -6
  289. package/providers/context/resources/dialogue/code-extraction.md +0 -87
  290. package/providers/context/resources/dialogue/document-classification.md +0 -33
  291. package/providers/context/resources/dialogue/structure-confirmation.md +0 -44
  292. package/providers/context/resources/dialogue/workflow-mode-after-capture.md +0 -25
  293. package/providers/context/resources/manuals/reference/code-extractors.md +0 -152
  294. package/providers/context/resources/procedures/code-extraction.md +0 -184
  295. package/providers/context/resources/procedures/code-index-audit.md +0 -83
  296. package/providers/context/resources/procedures/document-classification.md +0 -22
  297. package/providers/context/resources/procedures/document-optimization.md +0 -91
  298. package/providers/context/resources/procedures/prose-align.md +0 -68
  299. package/providers/context/resources/procedures/prose-compile.md +0 -23
  300. package/providers/context/resources/semantic/align/candidate-resolution.md +0 -106
  301. package/providers/context/resources/semantic/align/density-profile.md +0 -41
  302. package/providers/context/resources/semantic/align/gates.md +0 -276
  303. package/providers/context/resources/semantic/align/structure-planning.md +0 -337
  304. package/providers/context/resources/semantic/code-index/classification.md +0 -270
  305. package/providers/context/resources/semantic/compile/index.md +0 -31
  306. package/providers/context/resources/views/code-index-audit.yaml +0 -6
  307. package/providers/context/resources/views/extraction-preview.yaml +0 -6
  308. package/providers/context/resources/views/structure-current.yaml +0 -6
  309. package/providers/context/schemas/code-index-audit-decision.schema.json +0 -94
  310. package/providers/context/schemas/document-optimization-decisions.schema.json +0 -57
  311. package/providers/context/schemas/prose-structure-batch.schema.json +0 -35
@@ -1,152 +0,0 @@
1
- ---
2
- id: manual.reference.code-extractors
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Code Extractor Selection
8
-
9
- Use this manual only when the current code-extraction Route asks the Agent to
10
- choose or declare an extractor. The CLI reports repository facts; the Agent
11
- chooses how those facts become source-backed code knowledge.
12
-
13
- ## Inspect Before Declaring
14
-
15
- Run the single batch inspection command returned by the extraction-scope Gate.
16
- The result identifies every confirmed module, its recognized `manifests`,
17
- README locations, entry candidates, protocol locators, and lifecycle markers.
18
- Treat these as deterministic technology signals, not as product semantics:
19
-
20
- | Signal | Technology candidate |
21
- |---|---|
22
- | `package.json` | TypeScript, TSX, JavaScript, or JSX |
23
- | `go.mod` | Go |
24
- | `Cargo.toml` | Rust |
25
- | `pyproject.toml` or `setup.py` | Python |
26
- | `pom.xml` or `build.gradle` | Java or JVM |
27
- | multiple manifests | a mixed module that may need more than one extractor |
28
-
29
- Do not select `extractTs()` merely because a repository contains some
30
- TypeScript. Decide against the exact confirmed module and include boundary. A
31
- mixed module may compose multiple structural passes; parser selection is not an
32
- exclusive repository-wide switch.
33
-
34
- ## Selection Order
35
-
36
- Use the narrowest reusable capability that covers the confirmed source:
37
-
38
- 1. Use a Context-owned phase when its contract matches the source.
39
- 2. Otherwise use a reusable structural package inside `extractCustom()`.
40
- 3. If no reusable package covers the syntax or repository protocol, implement a
41
- project-owned adapter and keep it in the Context workspace.
42
-
43
- Current reusable capabilities are:
44
-
45
- | Source fact | Preferred capability | Lifecycle integration |
46
- |---|---|---|
47
- | TypeScript/TSX package or file scope | `extractTs()` | Context-owned phase |
48
- | Go declarations, imports, calls, and common HTTP routes | `@c4a/extract-go` | call from `extractCustom()` |
49
- | Rush workspace packages, tags, dependencies, entries, and owners | `@c4a/extract-rush` | call from `extractCustom()`; may complement a language extractor |
50
- | React Router route declarations | `extractReactRouterRoutes()` from `@c4a/extract-ts` | call from `extractCustom()`; complements TypeScript symbols |
51
- | Rust, Python, Java/JVM, or an unsupported framework/protocol | no assumed built-in parser | project-owned `extractCustom()` adapter |
52
-
53
- The custom extraction preview verifies this selection mechanically. Context
54
- detects applicable community capabilities from source manifests and stable path
55
- signals, then checks that candidate evidence covers every required entry,
56
- route, implementation boundary, workspace, or protocol probe. One aggregated
57
- module page is valid when it closes that structural coverage. A callback that
58
- only hashes a few filenames or renders configured prose does not satisfy the
59
- probe, even when its Markdown count is small.
60
-
61
- The probe does not assign business meaning and does not require one page per
62
- fact. The project adapter still owns grouping, titles, explanations, and
63
- cross-module semantics. If the source uses an unsupported language or protocol,
64
- report a capability gap instead of claiming that a known probe was consumed.
65
-
66
- An optional package does not create a new CLI phase. Add it as an explicit
67
- workspace dependency, then map its structural facts to candidates in the
68
- project callback. Do not add a parser package when its documented coverage does
69
- not match the inspected source.
70
-
71
- ## Read The Contract Before Extending
72
-
73
- Before editing `src/index.ts`, read the Route-selected Context lifecycle and
74
- extractor resources completely. They are the installed contract for
75
- Context-owned phases such as `extractTs()`; do not require a separate
76
- workspace copy of an implementation package and do not infer APIs from bundled
77
- JavaScript.
78
-
79
- Only a capability imported directly by a project-owned `extractCustom()`
80
- adapter requires its package README. Use this matrix to decide whether that
81
- optional capability is relevant, add only that dependency, then read the
82
- README from the resolved installed package before implementing the callback.
83
- Never assume that a transitive or dev-only package is present at a hard-coded
84
- `node_modules` path.
85
-
86
- A project-owned adapter may use an existing parser, compiler API, or command
87
- whose output is deterministic. It must return source-backed candidates through
88
- `extractCustom()`; it must not write lifecycle, knowledge, or Review files.
89
- Framework-specific classification and rendering remain in the project. The CLI
90
- and structural parser must not infer product meaning.
91
-
92
- ## Decision To Report
93
-
94
- Before the first extraction preview, state briefly:
95
-
96
- - the inspected module and manifest signals;
97
- - the selected Context phase or structural package;
98
- - whether coverage is complete or which facts remain project-owned; and
99
- - why another available extractor is not needed.
100
-
101
- After preview, use `inspection.structuralProbes` and each index unit's
102
- `structuralCoverage` as the exact audit result. An uncovered probe is a
103
- configuration problem, not a Review decision.
104
-
105
- If no current capability can parse the source reliably, stop at configuration
106
- and report the missing generic capability. Do not silently emit an empty
107
- codeindex or reuse an unrelated parser.
108
-
109
- ## Plan Before Parsing
110
-
111
- Classify the user-visible module before selecting language tooling or reading an
112
- archetype template: API/service, background runtime, SDK/library, interactive
113
- application, adapter, CLI/tool, monorepo container, derived source,
114
- authoritative contract source, or unknown.
115
- A hybrid module may declare several `moduleTypes` and several behavior `facets`;
116
- keep one primary `moduleType` for concise reports. Record inspected paths in
117
- `moduleTypeEvidence`, record every Markdown file actually read in `documents`, then read all matching Route-recommended files below
118
- `resources/semantic/code-index/templates/` and combine them into one plan.
119
- After that, choose exactly one closed output profile: `module-map`,
120
- `application-map`, `protocol-index`, `service-boundary`, `runtime-map`,
121
- `public-api-reference`, `command-map`, `adapter-contract`, `module-registry`,
122
- `cross-module-flow`, or `provenance-only`. The profile selects structural probes
123
- and advisory checks; an invented value is rejected.
124
-
125
- Each archetype resource is a working template for an Agent with limited prior
126
- context. It provides a minimum evidence pass, the reader questions the index
127
- must answer, suggested knowledge units, Markdown chapter blueprints,
128
- aggregation and relationship rules, composition examples, and stop conditions.
129
- The blueprints are illustrative: omit unsupported sections and merge overlap
130
- across selected templates instead of producing empty headings or duplicate
131
- pages. They shape content before the batch preview; they do not prescribe or
132
- override projected page counts.
133
-
134
- Extractor shape defines what can be emitted. `extractTs()` creates one page per
135
- selected symbol and permits one owning index unit per source. Use it for an
136
- intentional granular public reference. Use `extractCustom()` for module-level
137
- aggregation, registries, protocol indexes, cross-module flows, or multiple
138
- candidate owners over one source; each candidate declares its `module` and
139
- at least one evidence-scoped `section`; there is no page-level Markdown
140
- fallback. Each section's typed coverage and exact evidence is checked against
141
- the output profile during preview. Resolve repositories from
142
- the extractor context's `sources[].absolutePath`, never from a
143
- machine-specific checkout path. Cross-module flow output must also emit
144
- source-backed structured edges. Generated clients/models, mirrored sources, legacy
145
- implementations, and internal helpers should normally be excluded or recorded
146
- as provenance rather than expanded one symbol per page.
147
-
148
- If a repository uses service manifests or protocol registrations that the
149
- community inspector cannot interpret, keep that interpretation in a generic
150
- project-owned `inspect` adapter attached to `extractCustom()`. Return findings
151
- and capability gaps through the public Context contract; do not add internal
152
- framework names or directory rules to the CLI.
@@ -1,184 +0,0 @@
1
- ---
2
- id: procedure.code-extraction
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Code extraction
8
-
9
- Code extraction operates on user-confirmed repository modules and source
10
- patterns. A source registration identifies the repository or module; the
11
- extraction declaration defines the code scope inside it.
12
-
13
- Before declaring a phase, run the Route-selected batch inspection once for all
14
- confirmed modules. Read their manifests, module documentation, stable entries,
15
- and dependency/protocol locators. First record an evidence-backed classification
16
- for every module without reading an archetype template. A module has one primary
17
- `moduleType`, may declare additional `moduleTypes`, and may combine relevant
18
- `facets`. Only after classification, read every matching file from the Route's
19
- recommended `resources/semantic/code-index/templates/` directory and merge them
20
- into one deduplicated plan per user-visible module or aggregate.
21
-
22
- The target is a stable module map, public contract, protocol boundary, or
23
- runtime map—not a page for every function, variable, constant, or internal type.
24
- Use the Code Extractor Selection manual to choose `extractTs`, an optional
25
- structural package inside `extractCustom`, or a project-owned adapter. Read the
26
- selected package's public SDK/README before editing `src/index.ts`; never infer
27
- its API from bundled output. `moduleTypeEvidence` must identify the inspected
28
- paths that support the classification. An `unknown` unit or a unit with no
29
- classification evidence is an incomplete index plan.
30
- Record exact source-relative Markdown paths read during classification in
31
- `indexUnits[].documents`. Context inventories module Markdown independently:
32
- root README or documentation entry files require complete reading, while other
33
- related Markdown uses the reported Floor and Target coverage.
34
-
35
- For every custom extraction preview, Context probes source paths for known
36
- community structural capabilities: TypeScript symbols, React Router routes, Go
37
- symbols, Rush workspace structure, and source-owned protocol schemas. Every
38
- probe applicable to an index unit's output profile must be represented by the
39
- candidate evidence for that unit. A project adapter may aggregate and explain
40
- those facts in one high-value page, but it cannot replace a matched structural
41
- probe with a static template or a manually listed filename. Missing probe
42
- coverage is a `material-required` capability gap and uses the same
43
- non-delegatable capability Gate in ordinary and fully managed conversations.
44
-
45
- `include` filters files inside a selected source; it is not a package/module
46
- selector. Use source declarations to select repository modules. Use configured
47
- entry patterns when entry-led traversal is meaningful, or scan mode when the
48
- selected module intentionally has no package entry. Do not require source-code
49
- rewrites merely to create an extraction entry.
50
-
51
- Exports-only single-package TypeScript extraction has a compatible stable
52
- public-contract plan. Scan mode, repository collections, and custom extraction
53
- must declare their index units explicitly; an inferred plan is diagnostic only
54
- and cannot write candidates.
55
-
56
- Every index unit must expose one inventory contract. Built-in parsers produce
57
- it from AST and source traversal; a project adapter returns the same generic
58
- shape. The inventory separates eligible/analyzed files and non-empty LOC,
59
- discovered/read Markdown, discovered/analyzed/target/exported symbols, stable
60
- entries and profile-selected boundaries, plus excluded files and reasons. JSON,
61
- YAML, lockfiles and assets may be evidence but do not inflate source LOC.
62
- Evidence-only adapter output is explicitly `unscorable` and cannot pass the
63
- mechanical quality Gate as a complete module index.
64
-
65
- Extractor output shape must match the semantic plan. `extractTs()` projects one
66
- candidate page per selected symbol and assigns each source to one index unit;
67
- it is suitable for a deliberately granular public reference. Aggregated module
68
- maps, registries, protocol indexes, cross-module flows, or multiple units over
69
- one source require `extractCustom()` with explicit candidate ownership. For a
70
- monorepo, register independently visible children as separate sources before
71
- giving them separate `extractTs()` units.
72
-
73
- The Route runs one cache-writing batch preview after classification, template
74
- selection, and configuration, but before any candidate write. Report
75
- discovered files, AST-analyzed files, skipped files, symbols, and relations
76
- separately, together with each index unit's output owner, output profile,
77
- projected Markdown count, total bytes, largest sampled page, and risk flags.
78
- For custom phases, also report detected structural probes, covered and uncovered
79
- probe counts, representative evidence paths, and the affected output profile.
80
- Use resolved entry files, exported/internal counts, and symbol-kind counts as
81
- structural scope evidence only. Resolve TypeScript/JavaScript
82
- configuration and aliases through the extractor rather than guessing paths
83
- from imports.
84
-
85
- Template examples never determine the expected page count. Scale policy is
86
- applied only to the measured batch preview and is fixed per index unit: at most
87
- 100 pages continues normally,
88
- 101–300 pages continues with a warning, and more than 300 pages stops at the
89
- non-delegatable extraction-scale Gate. Fully managed authority cannot bypass
90
- that Gate. Ambiguous output ownership and `material-required` capability gaps
91
- also stop before candidate writes. Ambiguous ownership returns to project
92
- configuration without creating another human Gate. Revise all affected units
93
- together, re-check whether their classification or selected templates changed,
94
- rerun the batch preview, then process exactly one pending extraction target and
95
- evaluate again. Do not add a second classification Gate after the page-count
96
- Gate; a plan revision returns through the same configuration step.
97
-
98
- A batch-total page warning remains advisory. After extraction, independent
99
- mechanical dimensions enforce source analysis, target-boundary coverage,
100
- facts/explanation, evidence scope, implementation ratio, and page shape.
101
- Aggregate custom candidates are rendered only from evidence-scoped `sections`;
102
- free Markdown, empty optional sections, template instructions, and placeholders
103
- cannot become reader-facing knowledge. A required Section without evidence is a
104
- material/capability gap instead of an empty heading. Legal scale recovery
105
- includes narrowing `include`, excluding generated or mirrored directories,
106
- enabling `exportedOnly`, moving from a symbol catalog to an aggregated
107
- `extractCustom()` plan, or registering real child sources. Splitting one
108
- `extractTs()` source into overlapping units is not a valid workaround.
109
-
110
- Current previews are cached below `.tmp/context-runtime/extract/previews/` and
111
- formal extraction reuses their validated structural result. Cache identity is
112
- bound to source scope, phase/adapter declarations, project `src/`, dependency
113
- locks, and the preview protocol. Deleting
114
- `.tmp` only causes a fresh preview. Existing approved knowledge is not
115
- retroactively rejected solely because it is large.
116
-
117
- New workspaces write `knowledge/codeindex/**`. If an old workspace contains
118
- legacy `knowledge/codegraph/**`, follow the Route-returned
119
- `context migrate codeindex --format json` action. It rewrites formal collection
120
- identities and invalidates derived extraction/audit state without requiring
121
- `.tmp`. Never create a permanent dual-write or move the directory by hand.
122
-
123
- Do not open Review while another extraction target in the same batch remains.
124
- Unchanged approved or rejected symbols do not need another decision; new or
125
- changed candidates remain subject to the current Review policy.
126
-
127
- For TypeScript sources, Context also carries extractor-reported AST relations
128
- between selected symbols. A relation is projected only when both endpoints
129
- resolve uniquely inside the selected module; external, unselected, and
130
- ambiguous endpoints are counted as omissions instead of guessed. The extract
131
- receipt reports `relationships.detected`, `emitted`, and omission counts.
132
- Review materializes those source-backed relations with the approved symbol,
133
- and deterministic close refreshes the typed edge projection.
134
-
135
- Project-owned custom edges use `source-backed-explicit` rather than claiming
136
- AST derivation. They remain subject to the same evidence, endpoint, Review, and
137
- close projection checks.
138
-
139
- Zero edges remain a valid result. Read `close.relationshipCoverage` or the
140
- package inventory's `structure.relationship_coverage` to distinguish a current
141
- source-backed extraction that found no approved edges from an older or
142
- otherwise unknown relationship mode. Never infer missing edges from symbol
143
- co-occurrence, filenames, or package size.
144
-
145
- When the built-in TypeScript extractor cannot represent the code source, use a
146
- declared `extractCustom` phase. The project-owned callback returns candidate
147
- semantics plus structured source evidence; Context owns canonical refs,
148
- fingerprints, candidate storage, Review snapshots, freshness, and rerun cleanup.
149
- Do not use a generic `customPhase` callback to write lifecycle files directly.
150
- Large custom adapters may return candidates as an `AsyncIterable`; Context
151
- retains at most the proof boundary for an over-limit unit instead of collecting
152
- thousands of full Markdown candidates. A project-owned `inspect` adapter may
153
- report generic module/protocol findings and capability gaps without putting
154
- framework-specific rules in the community CLI.
155
-
156
- Prefer a reusable structural library over a project-local parser when one
157
- matches the confirmed source: `@c4a/extract-go` for Go facts,
158
- `@c4a/extract-rush` for Rush workspace facts, and
159
- `extractReactRouterRoutes()` from `@c4a/extract-ts` for React Router facts.
160
- These are optional project dependencies consumed inside `extractCustom()`;
161
- they are not built-in CLI phases. Keep product-specific classification and
162
- candidate rendering in the project, and do not ask the CLI or parser to infer
163
- business meaning.
164
-
165
- For Rust, Python, Java/JVM, or another source without a matching reusable
166
- extractor, keep the lifecycle in `extractCustom()` and implement only the
167
- missing project adapter. If reliable syntax facts cannot be produced, stop at
168
- configuration and report the generic capability gap rather than emitting an
169
- empty or guessed graph.
170
- # Agent audit after extraction
171
-
172
- After every complete code-extraction batch, the Route produces one batch-level
173
- code-index audit. Mechanical signals cover content depth, evidence scope,
174
- declared-source coverage, and structured handoffs. A dimension outside its
175
- absolute bounds is a mechanical rejection and cannot be accepted. Advisory or
176
- elevated signals inside those bounds remain review evidence: the Agent must
177
- inspect the affected pages and submit one `accept`, `revise`, or
178
- `request-input` decision for all index units together.
179
-
180
- Do not split this into one confirmation per module. In fully managed operation,
181
- real issues select `revise` and the Route returns through project configuration,
182
- batch Preview, extraction, and a new audit until the index is acceptable. A
183
- false positive may be accepted only with a concrete inspected reason. Ask the
184
- user only when reliable correction needs unavailable material or access.
@@ -1,83 +0,0 @@
1
- ---
2
- id: procedure.code-index-audit
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Code-index Agent audit
8
-
9
- This Route is a required semantic review of the complete proposed code index.
10
- The CLI reports mechanical signals; the Agent reads the affected candidate
11
- content and evidence, compares registered sources with the user-confirmed
12
- scope, and decides whether the index is fit for its declared output profiles.
13
- Reader metrics exclude Context lifecycle comments and evidence annotations.
14
- Improve the source-backed knowledge itself; do not change Markdown syntax,
15
- sentence count, or pagination solely to influence a mechanical counter.
16
-
17
- The report contains no aggregate score. Every dimension is computed
18
- independently with its observed value, floor, recommended target, ceiling,
19
- mechanical score, uncovered identities, and legal repair actions. A dimension
20
- outside its absolute bounds cannot be accepted or offset by another strong
21
- dimension. Every elevated signal must receive an assessment tied to inspected
22
- content. Submit one `context.code-index-audit-decision.v1` payload for the
23
- complete batch.
24
-
25
- Read the complete inventory before deciding. It separates eligible and
26
- analyzed files/LOC, read documents, target and exported symbols, stable entries,
27
- protocol boundaries, exclusions, and parser gaps. For each failed or
28
- below-target dimension, use the returned uncovered identities, affected pages,
29
- recommended template resources, and action vocabulary. Do not replace those
30
- facts with an inferred file list.
31
-
32
- For custom adapters, file and symbol identity arrays are complete denominators,
33
- not samples: their lengths must match the declared counts, analyzed identities
34
- must belong to eligible identities, and exported identities must belong to the
35
- target-symbol set. For a single-source unit, the CLI independently enumerates
36
- the represented language families plus Markdown/MDX after declared exclusions;
37
- an adapter cannot make its ratio pass by reporting only hand-picked evidence
38
- files. Conventional sibling page entries, Go route-register calls, and exported
39
- operations from a declared Go handler source of truth are also independently
40
- enumerated; include every discovered identity in the target-symbol and boundary
41
- denominators even when one aggregate page explains them. Section evidence may
42
- contain multiple files and may overlap
43
- another Section when one fact crosses a boundary. It must not be reduced to one
44
- arbitrary primary file, and every Section must not repeat the complete page
45
- evidence set merely to satisfy coverage. Distinct structured relationships must
46
- cite the concrete evidence for their own handoff instead of repeating one whole
47
- page evidence set across every destination.
48
-
49
- ## Decisions
50
-
51
- - `accept`: the requested scope is represented, every dimension is within its
52
- absolute bounds, and every real content-depth, evidence-scope, template, and
53
- relationship issue is resolved. A below-target dimension remains visible
54
- and needs a concrete reason in ordinary operation.
55
- - `revise`: one or more real problems remain. Identify the affected units and
56
- describe changes to scope, aggregation, sections, evidence, or structured
57
- handoffs. The Route returns to `src/index.ts`, Preview, extraction, and a new
58
- audit revision.
59
- - `request-input`: reliable revision requires material unavailable in the
60
- registered sources, such as an external protocol or missing source boundary.
61
- Ask only for that material, then submit a new decision.
62
-
63
- ## Fully managed operation
64
-
65
- Fully managed authority does not bypass the audit. When an absolute dimension
66
- fails, choose a returned repair action and continue through configuration,
67
- Preview, extraction, and audit without asking the user. Aim for the recommended
68
- target instead of stopping immediately at the floor. The retry ledger is bound
69
- to unit, source revision, profile, and problem fingerprint; superficial wording
70
- changes do not reset it. After three unsuccessful revisions of the same
71
- problem, Context combines all affected modules into one human-guidance Gate.
72
- Pause earlier only for unavailable material, source access, or missing parser
73
- capability.
74
-
75
- After each decision, briefly tell the user which decision was selected, the
76
- affected units, and the next Graph path. Do not stop a managed run merely to
77
- announce a successful automatic revision.
78
-
79
- The current `context.code-index-audit-report.v2` is computed from proposed or
80
- approved knowledge. Only its decision receipt and compact retry metrics stay
81
- under `.tmp/context-runtime/code-index-audit/`. Package output records only the
82
- selected report digest and decision; page metrics, exclusions, template
83
- fingerprints, and repair history are never published.
@@ -1,22 +0,0 @@
1
- ---
2
- id: procedure.document-classification
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Document classification
8
-
9
- Classification chooses the main knowledge collection for a captured document.
10
- The choice must follow evidence investigation, not the URL, file name, a user
11
- example, or a fixed content-specific prompt.
12
-
13
- Read the current collection-neutral evidence view, explain a short
14
- evidence-backed recommendation and its output implications, then obtain the
15
- user decision unless the current session explicitly delegates this gate.
16
- Read every Route-selected `context.source-body/*` resource in full. Index and
17
- heading metadata support navigation but are not evidence that the document
18
- body was read.
19
-
20
- After the decision, declare the complete align, compile, and review lifecycle
21
- for the same canonical source and collection. Re-evaluate instead of assuming
22
- the declaration closed every document target.
@@ -1,91 +0,0 @@
1
- ---
2
- id: procedure.document-optimization
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Source-constrained editorial revisions
8
-
9
- This optional phase improves the publication value and readability of approved
10
- file and document prose without mutating the approved page. It runs only when
11
- `package.json.context.documentOptimization` is true.
12
-
13
- Run the Route-selected plan command. Each fragment is one source-backed Context
14
- Section and includes mechanical readability signals, allowed actions, exact
15
- line ranges, and source identity. Read every returned Section and write one
16
- decision for each fragment to the returned `payload_target`:
17
-
18
- - `keep` when it is already useful and readable. If the fragment has any
19
- mechanical signal, include a concrete `assessment` that explains why every
20
- signal is a false positive or why changing the Section would reduce source
21
- fidelity. Name every reported signal code in that assessment so the CLI can
22
- verify complete coverage; do not use one generic assessment for a batch;
23
- - `repair` for local typography, Markdown, spacing, or a descriptive link label
24
- whose purpose is already stated in the same Section;
25
- - `reshape` for source-preserving structural changes such as a wide table into
26
- a short index plus detail entries, or a long paragraph into stable headings;
27
- - `omit` only when the plan permits it and the selected reason matches a
28
- mechanically identified non-knowledge Section.
29
-
30
- An unanswered question set, empty placeholder, decision-free draft, duplicate,
31
- or obsolete-only Section may be omitted. Questions with answers, limitations
32
- with impact and action, and deprecations with a replacement remain knowledge.
33
- Mechanical signals are review leads, not a complete readability verdict. Read
34
- every fragment even when it has no signal. A mixture of false positives and
35
- valid repair candidates does not justify keeping the whole batch unchanged.
36
- Every actionable signal must end in a safe edit, an eligible omission, a
37
- batched input request, or a Section-specific explanation that the signal is a
38
- false positive or that the edit would damage source fidelity. Time, token or
39
- compute cost, workload, batch size, deadline, and desire to finish sooner are
40
- never valid reasons to keep, skip, defer, or reduce an optimization. Do not
41
- default a batch to `keep` because it contains many fragments; finish the
42
- complete current batch with the same quality standard as a single fragment.
43
- Signals that recommend `request-input` identify ambiguous currency, ownership,
44
- link purpose, or sensitive values. The plan returns all of them in
45
- `input_requests`: ask one concise, batched question and wait before applying
46
- the complete optimization payload. Do not convert a required input into
47
- `keep` merely to avoid a pause. Preserve the exact destination of a volatile
48
- URL and safely improve its descriptive label or surrounding layout when the
49
- same Section already states its purpose; ask only for information that cannot
50
- be recovered from the approved Section or its source evidence.
51
-
52
- In fully managed operation, apply every safe `repair`, `reshape`, and eligible
53
- `omit` autonomously and continue until the optimization status is current.
54
- Managed authority removes routine review pauses, not quality work or genuine
55
- missing-input boundaries. A large repair set is expected work, not a blocker.
56
- If an `input_requests` batch remains after completing all independently safe
57
- analysis, ask once for that batch and resume from the returned Route.
58
-
59
- Keep all work inside the same source Section. Preserve link destinations,
60
- images, code, commands, numbers, identifiers, conditions, and source markers
61
- exactly. Do not introduce facts, infer an answer, or replace a complete
62
- contract with a summary.
63
-
64
- After the complete payload is ready, execute the exact `next_action.command`
65
- returned by the plan. Context rejects stale, incomplete, duplicate,
66
- cross-Section, protected-value, semantically broad, or unexplained signaled
67
- `keep` decisions. The assessment is used only to audit the current decision and
68
- is not stored in approved knowledge, revisions, or package output. Unchanged
69
- Sections reuse their previous decision; changed Sections alone return to this
70
- phase.
71
-
72
- Only pages with reader-visible changes are stored. A revision is a full
73
- Markdown sidecar beside its approved page: `knowledge/guides/setup.md` becomes
74
- `knowledge/guides/setup__revision.md`. Default knowledge discovery excludes the
75
- reserved suffix. The filename derives the base page; the revision stores only
76
- the base digest that cannot be derived. Unchanged Sections inside a full
77
- revision are inferred. A page with no changes stores one derived negative cache
78
- key below `.tmp/context-runtime/document-optimization/`; replacement prose and
79
- Section metadata are never duplicated there. An omitted Section keeps its
80
- lifecycle marker in the revision so its source identity remains auditable, but
81
- its reader-visible body and all revision audit state are absent from `dist/`.
82
-
83
- For a later user-requested correction, use `context revise "<title or approved
84
- path>" --format json`. The resulting `route.document-revision.requested` owns
85
- target selection, revision editing, and validation; it also works when broad
86
- document optimization was not previously enabled. The compatibility entry
87
- `context optimize-docs revise` accepts the same selectors. Validation rejects
88
- lifecycle metadata changes, stale page baselines, protected-value changes,
89
- cross-Section rewrites, unsupported omissions, and invalid Markdown structure.
90
- A source change makes the revision a blocking conflict instead of silently
91
- applying it. Do not create fragment JSON files or another revision namespace.
@@ -1,68 +0,0 @@
1
- ---
2
- id: procedure.prose-align
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Prose structure alignment
8
-
9
- Alignment proposes source-bound knowledge structure. It does not write approved
10
- knowledge.
11
-
12
- Follow the current route's evidence view and input schema. Prefer source heading
13
- and block boundaries when they preserve coherent reading units; fixed line
14
- windows are only a fallback for unstructured text. A page may contain multiple
15
- sections, each with its own continuous evidence span.
16
-
17
- The default `read-plan` is the authoring packet for ordinary documents. It
18
- includes the payload contract, a compact canonical source-ref map, exact source
19
- body resources, the recommended scratch path, and the direct stage command.
20
- Do not separately request `schema`, `source-index`, or `existing-knowledge`
21
- unless the packet reports truncation or the task specifically needs an existing
22
- approved identity. Those views are diagnostics and large-source fallbacks, not
23
- mandatory workflow steps.
24
-
25
- Every `context.source-body/*` item selected in `workflow.current.resources`
26
- is source evidence, not supporting metadata. Read the complete Markdown file
27
- when its `read_state` is `read-required`. A source index, heading tree, token
28
- count, or successful capture never substitutes for body reading. A matching
29
- content digest receipt may be reused only while that text remains available in
30
- the current conversation. After reading every selected direct path, execute the
31
- single `resources.after_read.command`. For a generated Context View, execute
32
- its materialization command, read its complete file, then execute its exact
33
- `next_action.command`. Context carries the merged receipt file forward. A Route
34
- revision change does not invalidate unchanged bytes, but every lifecycle
35
- command remains revision-bound.
36
-
37
- When the route returns `payload_target`, write the Agent-authored structure input
38
- to its recommended `.tmp/agent-payloads/` path. This scratch area is separate
39
- from CLI-owned `.tmp/context-runtime/` and can be discarded after a successful
40
- stage. The recommendation does not restrict an explicit user-selected path.
41
-
42
- Stage all required source/collection slots before batch Review. Structure
43
- confirmation is an explicit gate. A confirmation applies only to the staged
44
- slot digest shown by the route; if the digest changes, confirm again.
45
-
46
- When the current Route exposes `batch`, author every listed target payload in
47
- one Agent planning pass, then write the small batch manifest to `batch.input`.
48
- Use `batch.validate.command` for a read-only all-target check or
49
- `batch.stage.command` to validate every target before any stage begins and then
50
- write the ready slots serially. The manifest contains only each `phase_id` and
51
- its structure payload `input` path; it does not merge document semantics or let
52
- the CLI choose page structure. A failed preflight writes no slot. If a later
53
- filesystem write fails, the result identifies completed slots and the Route
54
- remains recoverable.
55
-
56
- `--stage` performs the same validation and deterministic self-repair as
57
- `--validate`; use the separate validation command only for a diagnostics-only
58
- pass. In a managed conversation, a valid stage also records structure
59
- confirmation in the same write. Validation states are literal: `ready` may
60
- stage, `repair-required` may not, and `invalid` contains errors. `valid` is true
61
- only for `ready`; `error_free` distinguishes a blocker-only result from one
62
- containing errors. `self_healed` reports the input and output Section counts,
63
- how many original Sections were split, and the structural reason codes used by
64
- the repair.
65
-
66
- Independent read-only evidence views may run in parallel. Structure stage,
67
- confirmation, compile writes, and Review application are serial lifecycle
68
- mutations; execute them in the order selected by `workflow.current`.
@@ -1,23 +0,0 @@
1
- ---
2
- id: procedure.prose-compile
3
- kind: procedure
4
- mediaType: text/markdown
5
- ---
6
-
7
- # Source-bound prose compilation
8
-
9
- Compile materializes review candidates from confirmed structure and source
10
- evidence. It never writes directly to approved knowledge.
11
-
12
- The CLI derives this projection mechanically from the confirmed section ids,
13
- kinds, and source spans. Run only the revision-bound compile command returned
14
- by the current Route. Do not create compile-action payloads or rewrite source
15
- content.
16
-
17
- One compile command validates every owned view first, then atomically
18
- materializes the source/collection candidate batch. In an explicitly managed
19
- conversation, the host loop may continue across the remaining deterministic
20
- compile slots after this procedure has been read; it re-evaluates revision and
21
- validation state after every write. The current structure view is optional
22
- inspection context because the CLI consumes the confirmed structure directly.
23
- Do not open a partial Review while planned views remain.