@c4a/context-cli 0.6.18 → 0.7.0

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 (297) hide show
  1. package/README.md +73 -8
  2. package/README.zh-CN.md +47 -7
  3. package/cli.js +89881 -53821
  4. package/docs/document-optimization.md +35 -11
  5. package/docs/document-optimization.zh-CN.md +29 -9
  6. package/indexers/bundles/context-code-indexer/SKILL.md +20 -0
  7. package/indexers/bundles/context-code-indexer/context-indexer.yaml +230 -0
  8. package/indexers/bundles/context-code-indexer/references/composers/contracts-and-chains.md +23 -0
  9. package/indexers/bundles/context-code-indexer/references/composers/cross-module-chain.md +22 -0
  10. package/indexers/bundles/context-code-indexer/references/composers/development-and-delivery.md +22 -0
  11. package/indexers/bundles/context-code-indexer/references/composers/event-flow.md +21 -0
  12. package/indexers/bundles/context-code-indexer/references/composers/examples-and-documentation.md +22 -0
  13. package/indexers/bundles/context-code-indexer/references/composers/persistence-boundary.md +21 -0
  14. package/indexers/bundles/context-code-indexer/references/composers/protocol-boundary.md +22 -0
  15. package/indexers/bundles/context-code-indexer/references/composers/public-contract.md +23 -0
  16. package/indexers/bundles/context-code-indexer/references/indexer.md +49 -0
  17. package/indexers/bundles/context-code-indexer/references/metrics.md +201 -0
  18. package/indexers/bundles/context-code-indexer/templates/adapter-integration.md +119 -0
  19. package/indexers/bundles/context-code-indexer/templates/api-service.md +118 -0
  20. package/indexers/bundles/context-code-indexer/templates/background-runtime.md +109 -0
  21. package/indexers/bundles/context-code-indexer/templates/cli-tool.md +129 -0
  22. package/indexers/bundles/context-code-indexer/templates/component-library.md +99 -0
  23. package/indexers/bundles/context-code-indexer/templates/contract-source.md +73 -0
  24. package/indexers/bundles/context-code-indexer/templates/data-sync-reconciliation.md +77 -0
  25. package/indexers/bundles/context-code-indexer/templates/derived-generated-source.md +117 -0
  26. package/indexers/bundles/context-code-indexer/templates/domain-service.md +109 -0
  27. package/indexers/bundles/context-code-indexer/templates/event-consumer.md +62 -0
  28. package/indexers/bundles/context-code-indexer/templates/gateway-facade.md +89 -0
  29. package/indexers/bundles/context-code-indexer/templates/monorepo-container.md +124 -0
  30. package/indexers/bundles/context-code-indexer/templates/plugin-extension.md +52 -0
  31. package/indexers/bundles/context-code-indexer/templates/sdk-library.md +132 -0
  32. package/indexers/bundles/context-code-indexer/templates/storage-repository.md +56 -0
  33. package/indexers/bundles/context-code-indexer/templates/web-application.md +146 -0
  34. package/indexers/bundles/context-code-indexer/tests/fixtures/chapters.json +226 -0
  35. package/indexers/bundles/context-code-indexer/tests/fixtures/composers.json +82 -0
  36. package/indexers/bundles/context-code-indexer/tests/fixtures/profiles.json +210 -0
  37. package/indexers/bundles/context-code-indexer/tests/fixtures/scenarios.json +122 -0
  38. package/indexers/bundles/context-markdown-indexer/SKILL.md +20 -0
  39. package/indexers/bundles/context-markdown-indexer/context-indexer.yaml +147 -0
  40. package/indexers/bundles/context-markdown-indexer/references/classification.md +63 -0
  41. package/indexers/bundles/context-markdown-indexer/references/editorial-policy.md +106 -0
  42. package/indexers/bundles/context-markdown-indexer/references/indexer.md +23 -0
  43. package/indexers/bundles/context-markdown-indexer/references/semantic-planning.md +146 -0
  44. package/indexers/bundles/context-markdown-indexer/references/structure-and-artifacts.md +109 -0
  45. package/indexers/bundles/context-markdown-indexer/tests/fixtures/anonymous.json +31 -0
  46. package/indexers/bundles/context-markdown-indexer/tests/fixtures/editorial.json +309 -0
  47. package/indexers/bundles/context-markdown-indexer/tests/fixtures/migration-equivalence.json +186 -0
  48. package/indexers/bundles/context-markdown-indexer/tests/fixtures/profiles.json +171 -0
  49. package/indexers/bundles/context-markdown-indexer/tests/fixtures/routing.json +151 -0
  50. package/indexers/capability-manifest.json +40 -0
  51. package/indexers/contracts/hard-rule-conformance.json +2644 -0
  52. package/indexers/contracts/operator-contract.json +35 -0
  53. package/indexers/contracts/profile-contract.json +10162 -0
  54. package/indexers/release-manifest.json +208 -0
  55. package/package.json +5 -4
  56. package/plugins/README.md +17 -109
  57. package/plugins/README_CN.md +11 -89
  58. package/plugins/VERSION +1 -1
  59. package/plugins/claude/.claude-plugin/plugin.json +3 -11
  60. package/plugins/claude/CLAUDE.md +1 -1
  61. package/plugins/claude/README.md +1 -1
  62. package/plugins/claude/commands/context.md +112 -7
  63. package/plugins/codex/.codex-plugin/plugin.json +6 -17
  64. package/plugins/codex/AGENTS.md +1 -1
  65. package/plugins/codex/README.md +1 -1
  66. package/plugins/codex/skills/context/SKILL.md +113 -19
  67. package/plugins/cursor/.cursor-plugin/plugin.json +4 -17
  68. package/plugins/cursor/AGENTS.md +1 -1
  69. package/plugins/cursor/README.md +3 -2
  70. package/plugins/cursor/commands/c4a-context.md +112 -9
  71. package/plugins/skills/{c4a-context → context}/SKILL.md +114 -20
  72. package/plugins/skills/context-code-indexer/SKILL.md +20 -0
  73. package/plugins/skills/context-code-indexer/context-indexer.yaml +230 -0
  74. package/plugins/skills/context-code-indexer/references/composers/contracts-and-chains.md +23 -0
  75. package/plugins/skills/context-code-indexer/references/composers/cross-module-chain.md +22 -0
  76. package/plugins/skills/context-code-indexer/references/composers/development-and-delivery.md +22 -0
  77. package/plugins/skills/context-code-indexer/references/composers/event-flow.md +21 -0
  78. package/plugins/skills/context-code-indexer/references/composers/examples-and-documentation.md +22 -0
  79. package/plugins/skills/context-code-indexer/references/composers/persistence-boundary.md +21 -0
  80. package/plugins/skills/context-code-indexer/references/composers/protocol-boundary.md +22 -0
  81. package/plugins/skills/context-code-indexer/references/composers/public-contract.md +23 -0
  82. package/plugins/skills/context-code-indexer/references/indexer.md +49 -0
  83. package/plugins/skills/context-code-indexer/references/metrics.md +201 -0
  84. package/plugins/skills/context-code-indexer/templates/adapter-integration.md +119 -0
  85. package/plugins/skills/context-code-indexer/templates/api-service.md +118 -0
  86. package/plugins/skills/context-code-indexer/templates/background-runtime.md +109 -0
  87. package/plugins/skills/context-code-indexer/templates/cli-tool.md +129 -0
  88. package/plugins/skills/context-code-indexer/templates/component-library.md +99 -0
  89. package/plugins/skills/context-code-indexer/templates/contract-source.md +73 -0
  90. package/plugins/skills/context-code-indexer/templates/data-sync-reconciliation.md +77 -0
  91. package/plugins/skills/context-code-indexer/templates/derived-generated-source.md +117 -0
  92. package/plugins/skills/context-code-indexer/templates/domain-service.md +109 -0
  93. package/plugins/skills/context-code-indexer/templates/event-consumer.md +62 -0
  94. package/plugins/skills/context-code-indexer/templates/gateway-facade.md +89 -0
  95. package/plugins/skills/context-code-indexer/templates/monorepo-container.md +124 -0
  96. package/plugins/skills/context-code-indexer/templates/plugin-extension.md +52 -0
  97. package/plugins/skills/context-code-indexer/templates/sdk-library.md +132 -0
  98. package/plugins/skills/context-code-indexer/templates/storage-repository.md +56 -0
  99. package/plugins/skills/context-code-indexer/templates/web-application.md +146 -0
  100. package/plugins/skills/context-code-indexer/tests/fixtures/chapters.json +226 -0
  101. package/plugins/skills/context-code-indexer/tests/fixtures/composers.json +82 -0
  102. package/plugins/skills/context-code-indexer/tests/fixtures/profiles.json +210 -0
  103. package/plugins/skills/context-code-indexer/tests/fixtures/scenarios.json +122 -0
  104. package/plugins/skills/context-markdown-indexer/SKILL.md +20 -0
  105. package/plugins/skills/context-markdown-indexer/context-indexer.yaml +147 -0
  106. package/plugins/skills/context-markdown-indexer/references/classification.md +63 -0
  107. package/plugins/skills/context-markdown-indexer/references/editorial-policy.md +106 -0
  108. package/plugins/skills/context-markdown-indexer/references/indexer.md +23 -0
  109. package/plugins/skills/context-markdown-indexer/references/semantic-planning.md +146 -0
  110. package/plugins/skills/context-markdown-indexer/references/structure-and-artifacts.md +109 -0
  111. package/plugins/skills/context-markdown-indexer/tests/fixtures/anonymous.json +31 -0
  112. package/plugins/skills/context-markdown-indexer/tests/fixtures/editorial.json +309 -0
  113. package/plugins/skills/context-markdown-indexer/tests/fixtures/migration-equivalence.json +186 -0
  114. package/plugins/skills/context-markdown-indexer/tests/fixtures/profiles.json +171 -0
  115. package/plugins/skills/context-markdown-indexer/tests/fixtures/routing.json +151 -0
  116. package/providers/context/actions/accept-main-index-run.yaml +7 -0
  117. package/providers/context/actions/accept-material-answer-run.yaml +7 -0
  118. package/providers/context/actions/accept-post-author-composer-run.yaml +7 -0
  119. package/providers/context/actions/actualize-material-answer-bindings.yaml +8 -0
  120. package/providers/context/actions/apply-code-index-guidance.yaml +5 -0
  121. package/providers/context/actions/apply-document-optimization-guidance.yaml +5 -0
  122. package/providers/context/actions/apply-indexer-project.yaml +7 -0
  123. package/providers/context/actions/audit-material-gap-state.yaml +8 -0
  124. package/providers/context/actions/audit-projected-artifact-fan-out.yaml +8 -0
  125. package/providers/context/actions/authorize-indexer-contract-overlay.yaml +7 -0
  126. package/providers/context/actions/authorize-indexer-dependencies.yaml +7 -0
  127. package/providers/context/actions/authorize-indexer-program-execution.yaml +7 -0
  128. package/providers/context/actions/build-main-index-author-worksets.yaml +7 -0
  129. package/providers/context/actions/build-main-index-catalog-fallback.yaml +7 -0
  130. package/providers/context/actions/build-main-index-partition-worksets.yaml +7 -0
  131. package/providers/context/actions/build-material-question-workset.yaml +7 -0
  132. package/providers/context/actions/build-post-author-composer-worksets.yaml +7 -0
  133. package/providers/context/actions/build-question-target-inventory.yaml +7 -0
  134. package/providers/context/actions/build-subject-catalog.yaml +7 -0
  135. package/providers/context/actions/build-target-resolution-views.yaml +7 -0
  136. package/providers/context/actions/checkpoint-material-answer-review.yaml +8 -0
  137. package/providers/context/actions/checkpoint-material-gaps.yaml +8 -0
  138. package/providers/context/actions/close-indexer-approved-knowledge.yaml +8 -0
  139. package/providers/context/actions/compile-indexer-candidates.yaml +8 -0
  140. package/providers/context/actions/compose-indexer-post-author-fragments.yaml +7 -0
  141. package/providers/context/actions/configure-community-indexer-fallback.yaml +6 -0
  142. package/providers/context/actions/configure-indexer-providers.yaml +6 -0
  143. package/providers/context/actions/confirm-index-requirement-workset.yaml +8 -0
  144. package/providers/context/actions/confirm-subject-reidentification.yaml +8 -0
  145. package/providers/context/actions/converge-main-index-partition-run.yaml +7 -0
  146. package/providers/context/actions/discover-markdown-indexer-providers.yaml +6 -0
  147. package/providers/context/actions/evaluate-material-gaps.yaml +8 -0
  148. package/providers/context/actions/fail-main-index-run.yaml +7 -0
  149. package/providers/context/actions/fail-material-answer-run.yaml +7 -0
  150. package/providers/context/actions/fail-post-author-composer-run.yaml +7 -0
  151. package/providers/context/actions/inspect-index-candidate-review-readiness.yaml +8 -0
  152. package/providers/context/actions/inspect-index-profile-failure.yaml +7 -0
  153. package/providers/context/actions/inspect-indexer-dependencies.yaml +7 -0
  154. package/providers/context/actions/inspect-indexer-program-execution.yaml +7 -0
  155. package/providers/context/actions/inspect-indexer-project-proposal.yaml +7 -0
  156. package/providers/context/actions/inspect-markdown-provider-capture.yaml +7 -0
  157. package/providers/context/actions/inspect-material-answer-review.yaml +8 -0
  158. package/providers/context/actions/maintain-evidence.yaml +1 -1
  159. package/providers/context/actions/materialize-indexer-instructions.yaml +7 -0
  160. package/providers/context/actions/migrate-codeindex.yaml +5 -0
  161. package/providers/context/actions/observe-indexer-project.yaml +7 -0
  162. package/providers/context/actions/observe-main-index-run-ledger.yaml +7 -0
  163. package/providers/context/actions/observe-material-answer-runs.yaml +7 -0
  164. package/providers/context/actions/observe-post-author-composer-worksets.yaml +7 -0
  165. package/providers/context/actions/override-index-profile-audit.yaml +7 -0
  166. package/providers/context/actions/prepare-indexer-customization-project.yaml +7 -0
  167. package/providers/context/actions/prepare-main-index-run-ledger.yaml +7 -0
  168. package/providers/context/actions/prepare-material-answer-runs.yaml +7 -0
  169. package/providers/context/actions/propose-indexer-customization.yaml +7 -0
  170. package/providers/context/actions/propose-overlay-question-amendment.yaml +7 -0
  171. package/providers/context/actions/rebind-indexer-selection-to-requirement.yaml +7 -0
  172. package/providers/context/actions/reconcile-indexer-results.yaml +7 -0
  173. package/providers/context/actions/record-index-profile-revision.yaml +7 -0
  174. package/providers/context/actions/register-source-batch.yaml +1 -1
  175. package/providers/context/actions/report-index-profile-failure.yaml +7 -0
  176. package/providers/context/actions/report-indexer-incremental-impact.yaml +8 -0
  177. package/providers/context/actions/resolve-effective-composers.yaml +7 -0
  178. package/providers/context/actions/restore-repository-sources.yaml +1 -1
  179. package/providers/context/actions/review-material-answer-candidate.yaml +8 -0
  180. package/providers/context/actions/revise-index-output.yaml +7 -0
  181. package/providers/context/actions/route-index-requirement-confirmation.yaml +8 -0
  182. package/providers/context/actions/route-indexer-provider-selection.yaml +7 -0
  183. package/providers/context/actions/run-indexer-agent-step.yaml +7 -0
  184. package/providers/context/actions/run-indexer-post-author-composer.yaml +7 -0
  185. package/providers/context/actions/run-material-answer-indexers.yaml +7 -0
  186. package/providers/context/actions/start-main-index-run.yaml +7 -0
  187. package/providers/context/actions/start-material-answer-run.yaml +7 -0
  188. package/providers/context/actions/start-post-author-composer-run.yaml +7 -0
  189. package/providers/context/actions/validate-indexer-contract-overlays.yaml +7 -0
  190. package/providers/context/actions/validate-indexer-customization.yaml +7 -0
  191. package/providers/context/actions/validate-indexer-selection-proposal.yaml +7 -0
  192. package/providers/context/actions/validate-main-index-run.yaml +7 -0
  193. package/providers/context/actions/validate-markdown-provider-selection.yaml +7 -0
  194. package/providers/context/actions/validate-subject-key-schemas.yaml +8 -0
  195. package/providers/context/codes.yaml +72 -0
  196. package/providers/context/graphs/indexer.yaml +1068 -0
  197. package/providers/context/graphs/workspace.yaml +52 -3
  198. package/providers/context/manifest.json +1487 -157
  199. package/providers/context/provider.yaml +3 -2
  200. package/providers/context/resources/dialogue/code-extraction.md +12 -0
  201. package/providers/context/resources/dialogue/document-classification.md +1 -1
  202. package/providers/context/resources/dialogue/knowledge-review.md +7 -1
  203. package/providers/context/resources/dialogue/source-boundary.md +9 -1
  204. package/providers/context/resources/dialogue/workflow-mode-after-capture.md +11 -8
  205. package/providers/context/resources/dialogue/workflow-mode-after-creation.md +6 -4
  206. package/providers/context/resources/manuals/guides/lark-resources.md +7 -0
  207. package/providers/context/resources/manuals/guides/package-outputs.md +3 -3
  208. package/providers/context/resources/manuals/reference/code-extractors.md +7 -6
  209. package/providers/context/resources/manuals/reference/package-templates.md +18 -10
  210. package/providers/context/resources/manuals/reference/project-api.md +49 -24
  211. package/providers/context/resources/procedures/close-and-build.md +24 -9
  212. package/providers/context/resources/procedures/code-extraction.md +41 -13
  213. package/providers/context/resources/procedures/code-index-audit.md +83 -13
  214. package/providers/context/resources/procedures/document-capture.md +9 -0
  215. package/providers/context/resources/procedures/document-optimization.md +88 -21
  216. package/providers/context/resources/procedures/document-revision.md +11 -6
  217. package/providers/context/resources/procedures/knowledge-review.md +4 -1
  218. package/providers/context/resources/procedures/source-boundary.md +20 -8
  219. package/providers/context/resources/semantic/align/structure-planning.md +4 -4
  220. package/providers/context/resources/semantic/code-index/classification.md +8 -5
  221. package/providers/context/resources/semantic/code-index/templates/adapter.md +9 -0
  222. package/providers/context/resources/semantic/code-index/templates/contracts-and-chains.md +81 -0
  223. package/providers/context/resources/views/resolved-indexer-instructions.yaml +23 -0
  224. package/providers/context/schemas/document-optimization-decisions.schema.json +29 -6
  225. package/providers/context/schemas/indexer-agent-step-input.schema.json +30 -0
  226. package/providers/context/schemas/indexer-agent-step-result.schema.json +47 -0
  227. package/providers/context/schemas/indexer-candidate-compile-input.schema.json +57 -0
  228. package/providers/context/schemas/indexer-candidate-compile-output.schema.json +38 -0
  229. package/providers/context/schemas/indexer-candidate-review-readiness-input.schema.json +46 -0
  230. package/providers/context/schemas/indexer-candidate-review-readiness-output.schema.json +104 -0
  231. package/providers/context/schemas/indexer-contract-overlay-authorization-input.schema.json +32 -0
  232. package/providers/context/schemas/indexer-contract-overlay-authorization-result.schema.json +121 -0
  233. package/providers/context/schemas/indexer-contract-overlay-validation-input.schema.json +90 -0
  234. package/providers/context/schemas/indexer-contract-overlay-validation-result.schema.json +158 -0
  235. package/providers/context/schemas/indexer-customization-project-preparation-result.schema.json +44 -0
  236. package/providers/context/schemas/indexer-customization-proposal-draft.schema.json +83 -0
  237. package/providers/context/schemas/indexer-customization-validation-result.schema.json +36 -0
  238. package/providers/context/schemas/indexer-dependency-authorization-input.schema.json +71 -0
  239. package/providers/context/schemas/indexer-dependency-authorization-result.schema.json +138 -0
  240. package/providers/context/schemas/indexer-incremental-impact-input.schema.json +31 -0
  241. package/providers/context/schemas/indexer-incremental-impact-output.schema.json +52 -0
  242. package/providers/context/schemas/indexer-main-lifecycle-input.schema.json +187 -0
  243. package/providers/context/schemas/indexer-main-lifecycle-output.schema.json +180 -0
  244. package/providers/context/schemas/indexer-markdown-provider-capture-input.schema.json +17 -0
  245. package/providers/context/schemas/indexer-markdown-provider-capture-output.schema.json +54 -0
  246. package/providers/context/schemas/indexer-markdown-provider-validation-input.schema.json +34 -0
  247. package/providers/context/schemas/indexer-markdown-provider-validation-output.schema.json +75 -0
  248. package/providers/context/schemas/indexer-material-answer-lifecycle-input.schema.json +90 -0
  249. package/providers/context/schemas/indexer-material-answer-lifecycle-output.schema.json +80 -0
  250. package/providers/context/schemas/indexer-material-answer-review-inspection-input.schema.json +32 -0
  251. package/providers/context/schemas/indexer-material-answer-review-inspection-output.schema.json +32 -0
  252. package/providers/context/schemas/indexer-material-answer-review-resolution-input.schema.json +19 -0
  253. package/providers/context/schemas/indexer-material-answer-review-resolution-output.schema.json +87 -0
  254. package/providers/context/schemas/indexer-material-gap-lifecycle-input.schema.json +86 -0
  255. package/providers/context/schemas/indexer-material-gap-lifecycle-output.schema.json +19 -0
  256. package/providers/context/schemas/indexer-materialize-request.schema.json +53 -0
  257. package/providers/context/schemas/indexer-materialized-resource.schema.json +57 -0
  258. package/providers/context/schemas/indexer-overlay-question-amendment.schema.json +13 -0
  259. package/providers/context/schemas/indexer-overlay-question-proposal-input.schema.json +40 -0
  260. package/providers/context/schemas/indexer-overlay-question-rebind-input.schema.json +35 -0
  261. package/providers/context/schemas/indexer-overlay-question-rebind-result.schema.json +25 -0
  262. package/providers/context/schemas/indexer-post-author-fragment-request.schema.json +26 -0
  263. package/providers/context/schemas/indexer-post-author-fragment-result.schema.json +18 -0
  264. package/providers/context/schemas/indexer-post-author-lifecycle-input.schema.json +94 -0
  265. package/providers/context/schemas/indexer-post-author-lifecycle-output.schema.json +72 -0
  266. package/providers/context/schemas/indexer-profile-failure-inspection-input.schema.json +13 -0
  267. package/providers/context/schemas/indexer-profile-failure-inspection-result.schema.json +19 -0
  268. package/providers/context/schemas/indexer-profile-failure-report-input.schema.json +22 -0
  269. package/providers/context/schemas/indexer-profile-failure-report-result.schema.json +49 -0
  270. package/providers/context/schemas/indexer-profile-override-decision.schema.json +20 -0
  271. package/providers/context/schemas/indexer-profile-override-result.schema.json +49 -0
  272. package/providers/context/schemas/indexer-profile-revision-agent-input.schema.json +18 -0
  273. package/providers/context/schemas/indexer-profile-revision-record-input.schema.json +31 -0
  274. package/providers/context/schemas/indexer-profile-revision-record-result.schema.json +45 -0
  275. package/providers/context/schemas/indexer-program-execution-authorization-input.schema.json +145 -0
  276. package/providers/context/schemas/indexer-program-execution-authorization-result.schema.json +60 -0
  277. package/providers/context/schemas/indexer-project-action-result.schema.json +19 -0
  278. package/providers/context/schemas/indexer-project-gate-input.schema.json +100 -0
  279. package/providers/context/schemas/indexer-project-observation-input.schema.json +16 -0
  280. package/providers/context/schemas/indexer-project-observation-result.schema.json +42 -0
  281. package/providers/context/schemas/indexer-provider-route-input.schema.json +55 -0
  282. package/providers/context/schemas/indexer-provider-route-report.schema.json +188 -0
  283. package/providers/context/schemas/indexer-requirement-confirmation-input.schema.json +27 -0
  284. package/providers/context/schemas/indexer-requirement-confirmation-output.schema.json +24 -0
  285. package/providers/context/schemas/indexer-result-reconciliation-input.schema.json +59 -0
  286. package/providers/context/schemas/indexer-result-reconciliation-output.schema.json +43 -0
  287. package/providers/context/schemas/indexer-selection-proposal-input.schema.json +12 -0
  288. package/providers/context/schemas/indexer-selection-proposal-validation.schema.json +23 -0
  289. package/providers/context/schemas/indexer-subject-reidentification-input.schema.json +37 -0
  290. package/providers/context/schemas/indexer-subject-reidentification-output.schema.json +31 -0
  291. package/providers/context/schemas/source-batch-input.schema.json +18 -3
  292. package/providers/context/skills/configure-indexer-providers/SKILL.md +58 -0
  293. package/providers/context/skills/prepare-indexer-customization-project/SKILL.md +31 -0
  294. package/providers/context/skills/propose-indexer-customization/SKILL.md +40 -0
  295. package/providers/context/skills/revise-index-output/SKILL.md +12 -0
  296. package/providers/context/skills/run-indexer-agent-step/SKILL.md +20 -0
  297. package/providers/context/skills/run-indexer-post-author-composer/SKILL.md +21 -0
@@ -27,6 +27,10 @@ selected package's public SDK/README before editing `src/index.ts`; never infer
27
27
  its API from bundled output. `moduleTypeEvidence` must identify the inspected
28
28
  paths that support the classification. An `unknown` unit or a unit with no
29
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.
30
34
 
31
35
  For every custom extraction preview, Context probes source paths for known
32
36
  community structural capabilities: TypeScript symbols, React Router routes, Go
@@ -49,6 +53,15 @@ public-contract plan. Scan mode, repository collections, and custom extraction
49
53
  must declare their index units explicitly; an inferred plan is diagnostic only
50
54
  and cannot write candidates.
51
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
+
52
65
  Extractor output shape must match the semantic plan. `extractTs()` projects one
53
66
  candidate page per selected symbol and assigns each source to one index unit;
54
67
  it is suitable for a deliberately granular public reference. Aggregated module
@@ -64,6 +77,10 @@ separately, together with each index unit's output owner, output profile,
64
77
  projected Markdown count, total bytes, largest sampled page, and risk flags.
65
78
  For custom phases, also report detected structural probes, covered and uncovered
66
79
  probe counts, representative evidence paths, and the affected output profile.
80
+ The preview command returns a bounded summary plus one digest-bound item view.
81
+ Follow its `next_action.command` pages until `preview_items_complete` when the
82
+ Route requires semantic scope, ownership, capability, or scale inspection;
83
+ never recover omitted inventory with host-output slicing.
67
84
  Use resolved entry files, exported/internal counts, and symbol-kind counts as
68
85
  structural scope evidence only. Resolve TypeScript/JavaScript
69
86
  configuration and aliases through the extractor rather than guessing paths
@@ -82,13 +99,17 @@ rerun the batch preview, then process exactly one pending extraction target and
82
99
  evaluate again. Do not add a second classification Gate after the page-count
83
100
  Gate; a plan revision returns through the same configuration step.
84
101
 
85
- A batch-total page warning and quality risks such as a thin aggregate are
86
- advisory only. They remain visible for cost and content-shape review but do not
87
- become a new Gate. Legal scale recovery includes narrowing `include`, excluding
88
- generated or mirrored directories, enabling `exportedOnly`, moving from a
89
- symbol catalog to an aggregated `extractCustom()` plan, or registering real
90
- child sources. Splitting one `extractTs()` source into overlapping units is not
91
- a valid workaround.
102
+ A batch-total page warning remains advisory. After extraction, independent
103
+ mechanical dimensions enforce source analysis, target-boundary coverage,
104
+ facts/explanation, evidence scope, implementation ratio, and page shape.
105
+ Aggregate custom candidates are rendered only from evidence-scoped `sections`;
106
+ free Markdown, empty optional sections, template instructions, and placeholders
107
+ cannot become reader-facing knowledge. A required Section without evidence is a
108
+ material/capability gap instead of an empty heading. Legal scale recovery
109
+ includes narrowing `include`, excluding generated or mirrored directories,
110
+ enabling `exportedOnly`, moving from a symbol catalog to an aggregated
111
+ `extractCustom()` plan, or registering real child sources. Splitting one
112
+ `extractTs()` source into overlapping units is not a valid workaround.
92
113
 
93
114
  Current previews are cached below `.tmp/context-runtime/extract/previews/` and
94
115
  formal extraction reuses their validated structural result. Cache identity is
@@ -97,11 +118,17 @@ locks, and the preview protocol. Deleting
97
118
  `.tmp` only causes a fresh preview. Existing approved knowledge is not
98
119
  retroactively rejected solely because it is large.
99
120
 
121
+ New workspaces write `knowledge/codeindex/**`. If an old workspace contains
122
+ legacy `knowledge/codegraph/**`, follow the Route-returned
123
+ `context migrate codeindex --format json` action. It rewrites formal collection
124
+ identities and invalidates derived extraction/audit state without requiring
125
+ `.tmp`. Never create a permanent dual-write or move the directory by hand.
126
+
100
127
  Do not open Review while another extraction target in the same batch remains.
101
128
  Unchanged approved or rejected symbols do not need another decision; new or
102
129
  changed candidates remain subject to the current Review policy.
103
130
 
104
- For TypeScript sources, Context also carries extractor-reported AST relations
131
+ For TypeScript, JavaScript, TSX, and JSX sources, Context also carries extractor-reported AST relations
105
132
  between selected symbols. A relation is projected only when both endpoints
106
133
  resolve uniquely inside the selected module; external, unselected, and
107
134
  ambiguous endpoints are counted as omissions instead of guessed. The extract
@@ -119,7 +146,7 @@ source-backed extraction that found no approved edges from an older or
119
146
  otherwise unknown relationship mode. Never infer missing edges from symbol
120
147
  co-occurrence, filenames, or package size.
121
148
 
122
- When the built-in TypeScript extractor cannot represent the code source, use a
149
+ When the built-in ECMAScript-family extractor cannot represent the code source, use a
123
150
  declared `extractCustom` phase. The project-owned callback returns candidate
124
151
  semantics plus structured source evidence; Context owns canonical refs,
125
152
  fingerprints, candidate storage, Review snapshots, freshness, and rerun cleanup.
@@ -148,10 +175,11 @@ empty or guessed graph.
148
175
 
149
176
  After every complete code-extraction batch, the Route produces one batch-level
150
177
  code-index audit. Mechanical signals cover content depth, evidence scope,
151
- declared-source coverage, and structured handoffs. They are review evidence,
152
- not an automatic numeric rejection: the Agent must inspect the affected pages
153
- and submit one `accept`, `revise`, or `request-input` decision for all index
154
- units together.
178
+ declared-source coverage, and structured handoffs. A dimension outside its
179
+ absolute bounds is a mechanical rejection and cannot be accepted. Advisory or
180
+ elevated signals inside those bounds remain review evidence: the Agent must
181
+ inspect the affected pages and submit one `accept`, `revise`, or
182
+ `request-input` decision for all index units together.
155
183
 
156
184
  Do not split this into one confirmation per module. In fully managed operation,
157
185
  real issues select `revise` and the Route returns through project configuration,
@@ -10,17 +10,78 @@ This Route is a required semantic review of the complete proposed code index.
10
10
  The CLI reports mechanical signals; the Agent reads the affected candidate
11
11
  content and evidence, compares registered sources with the user-confirmed
12
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
+ The complete inventory is evidence, not the default reader-facing output. Do
17
+ not create one sentence, bullet, table row, or page for every discovered file
18
+ or symbol merely to satisfy coverage or density. Group related identities by a
19
+ reader-visible capability, entrypoint, protocol boundary, lifecycle stage, or
20
+ handoff, then explain the group's responsibility, stable inputs and outputs,
21
+ state or failure boundary when applicable, next handoff, and exact supporting
22
+ sources. A granular catalog is appropriate only for a declared public API,
23
+ protocol, or command reference.
13
24
 
14
- The report is not a numeric rejection. A signal may be a false positive, but
15
- it may not be ignored. Every elevated signal must receive an assessment tied
16
- to inspected content. Submit one `context.code-index-audit-decision.v1`
17
- payload for the complete batch.
25
+ When the report shows low density, add source-backed explanation or a complete
26
+ relationship chain. Never add repeated `Observed ...` rows. When symbol
27
+ coverage is low, use a verified evidence-backed group or a profile-appropriate
28
+ catalog instead of copying the inventory into prose. Normalized template
29
+ repetitions do not count as semantic facts, and enumeration-heavy output has a
30
+ profile-specific ceiling.
31
+
32
+ Identity groups and chain candidates are mechanical contracts, not optional
33
+ notes. A group counts only when its members belong to the target inventory, its
34
+ source files belong to the eligible inventory, and its reader-facing page cites
35
+ those files. Every chain candidate must be documented, merged into a documented
36
+ candidate, excluded with a concrete reason, or routed to missing-material input.
37
+ For each discovered external boundary family, retain a representative
38
+ source-backed chain or an explicit material gap.
39
+ When the boundary inventory contains adjacent families such as operation and
40
+ handler, handler and downstream, command and effect, event and processor, or a
41
+ cross-source handoff, the adapter must return the corresponding candidate
42
+ family. Returning an empty candidate list does not bypass chain review.
43
+
44
+ The report contains no aggregate score. Every dimension is computed
45
+ independently with its observed value, floor, recommended target, ceiling,
46
+ mechanical score, uncovered identities, and legal repair actions. A dimension
47
+ outside its absolute bounds cannot be accepted or offset by another strong
48
+ dimension. Every elevated signal must receive an assessment tied to inspected
49
+ content. Submit one `context.code-index-audit-decision.v1` payload for the
50
+ complete batch.
51
+
52
+ Read the complete digest-bound inventory before deciding. The Route-selected
53
+ audit resource returns one budget-safe inspection command. Execute it and then
54
+ each returned `next_action.command` until `audit_items_complete`; do not use
55
+ host output truncation or shell slicing as pagination. The item stream separates
56
+ eligible and analyzed files/LOC, read documents, target and exported symbols,
57
+ stable entries, protocol boundaries, exclusions, and parser gaps. For each
58
+ failed or below-target dimension, use the returned uncovered identities,
59
+ affected pages, recommended template resources, and action vocabulary. Do not
60
+ replace those facts with an inferred file list.
61
+
62
+ For custom adapters, file and symbol identity arrays are complete denominators,
63
+ not samples: their lengths must match the declared counts, analyzed identities
64
+ must belong to eligible identities, and exported identities must belong to the
65
+ target-symbol set. For a single-source unit, the CLI independently enumerates
66
+ the represented language families plus Markdown/MDX after declared exclusions;
67
+ an adapter cannot make its ratio pass by reporting only hand-picked evidence
68
+ files. Conventional sibling page entries, Go route-register calls, and exported
69
+ operations from a declared Go handler source of truth are also independently
70
+ enumerated; include every discovered identity in the target-symbol and boundary
71
+ denominators even when one aggregate page explains them. Section evidence may
72
+ contain multiple files and may overlap
73
+ another Section when one fact crosses a boundary. It must not be reduced to one
74
+ arbitrary primary file, and every Section must not repeat the complete page
75
+ evidence set merely to satisfy coverage. Distinct structured relationships must
76
+ cite the concrete evidence for their own handoff instead of repeating one whole
77
+ page evidence set across every destination.
18
78
 
19
79
  ## Decisions
20
80
 
21
- - `accept`: the requested scope is represented and every real content-depth,
22
- evidence-scope, and relationship issue is resolved. An acceptable or
23
- non-applicable signal needs a concrete reason.
81
+ - `accept`: the requested scope is represented, every dimension is within its
82
+ absolute bounds, and every real content-depth, evidence-scope, template, and
83
+ relationship issue is resolved. A below-target dimension remains visible
84
+ and needs a concrete reason in ordinary operation.
24
85
  - `revise`: one or more real problems remain. Identify the affected units and
25
86
  describe changes to scope, aggregation, sections, evidence, or structured
26
87
  handoffs. The Route returns to `src/index.ts`, Preview, extraction, and a new
@@ -31,13 +92,22 @@ payload for the complete batch.
31
92
 
32
93
  ## Fully managed operation
33
94
 
34
- Fully managed authority does not auto-accept this audit. When a signal is a
35
- real problem, choose `revise` and continue the revision loop without asking the
36
- user. Repeat until the proposed index matches the requested scope and its
37
- module maps, contracts, and handoffs contain useful source-backed explanation.
38
- Pause only for unavailable material, source access, tool failure, or a
39
- concrete no-progress blocker.
95
+ Fully managed authority does not bypass the audit. When an absolute dimension
96
+ fails, choose a returned repair action and continue through configuration,
97
+ Preview, extraction, and audit without asking the user. Aim for the recommended
98
+ target instead of stopping immediately at the floor. The retry ledger is bound
99
+ to unit, source revision, profile, and problem fingerprint; superficial wording
100
+ changes do not reset it. After three unsuccessful revisions of the same
101
+ problem, Context combines all affected modules into one human-guidance Gate.
102
+ Pause earlier only for unavailable material, source access, or missing parser
103
+ capability.
40
104
 
41
105
  After each decision, briefly tell the user which decision was selected, the
42
106
  affected units, and the next Graph path. Do not stop a managed run merely to
43
107
  announce a successful automatic revision.
108
+
109
+ The current `context.code-index-audit-report.v2` is computed from proposed or
110
+ approved knowledge. Only its decision receipt and compact retry metrics stay
111
+ under `.tmp/context-runtime/code-index-audit/`. Package output records only the
112
+ selected report digest and decision; page metrics, exclusions, template
113
+ fingerprints, and repair history are never published.
@@ -47,3 +47,12 @@ asset links. If a selected local
47
47
  boundary is a documentation site rather than plain Markdown, use the
48
48
  Context-provided processor/configuration diagnostic; do not invent rendered
49
49
  text or scan outside the confirmed boundary.
50
+
51
+ For Lark reads, Context prefers the authenticated user identity. If that
52
+ identity is unavailable because its credential is missing, expired, or cannot
53
+ be refreshed, Context may retry the same registered source with the bot
54
+ identity. It does not switch identity after a permission or missing-scope
55
+ response. Once selected, the same identity is used for the document body and
56
+ all embedded resources. If `docs +fetch` lacks the required `--doc-format`
57
+ capability, follow the returned `lark-cli update` recovery and rerun the same
58
+ Route command; do not replace the capture with a hand-written export.
@@ -4,40 +4,107 @@ kind: procedure
4
4
  mediaType: text/markdown
5
5
  ---
6
6
 
7
- # Document revisions
7
+ # Source-constrained editorial revisions
8
8
 
9
- This optional phase improves the presentation of approved file and document
10
- prose without mutating the approved page. It runs only when
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
11
  `package.json.context.documentOptimization` is true.
12
12
 
13
- Run the Route-selected plan command. Read every returned fragment in the
14
- current batch and write one decision for each fragment to the returned
15
- `payload_target`, using the Route input schema. Use `keep` when no safe local
16
- repair is needed. Use `replace` only for Markdown structure, spacing, obvious
17
- typographical errors, or link syntax. Preserve meaning, paragraph order,
18
- technical identifiers, URLs, code, and numbers. Do not summarize, expand,
19
- reorder, or invent facts.
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. `high` signals cannot be kept unchanged. Name every remaining
22
+ `review` signal code in that assessment so the CLI can verify complete
23
+ coverage; do not use one generic assessment for a batch;
24
+ - `repair` for local typography, Markdown, spacing, or a descriptive link label
25
+ whose purpose is already stated in the same Section;
26
+ - `reshape` for source-preserving structural changes such as a wide table into
27
+ a short index plus detail entries, or a long paragraph into stable headings;
28
+ - `omit` only when the plan permits it and the selected reason matches a
29
+ mechanically identified non-knowledge Section.
30
+
31
+ An unanswered question set, empty placeholder, decision-free draft, duplicate,
32
+ or obsolete-only Section may be omitted. Questions with answers, limitations
33
+ with impact and action, and deprecations with a replacement remain knowledge.
34
+ Mechanical signals are review leads, not a complete readability verdict. Read
35
+ every fragment even when it has no signal. A mixture of false positives and
36
+ valid repair candidates does not justify keeping the whole batch unchanged.
37
+ Signals marked `high` are deterministic presentation obligations. A repair or
38
+ reshape is rescanned against the effective replacement and cannot complete
39
+ while one of those signals remains. Signals marked `review` require semantic
40
+ inspection and may be kept only with the signal-specific assessment below.
41
+ Every actionable signal must end in a safe edit, an eligible omission, a
42
+ batched input request, or a Section-specific explanation that the signal is a
43
+ false positive or that the edit would damage source fidelity. Time, token or
44
+ compute cost, workload, batch size, deadline, and desire to finish sooner are
45
+ never valid reasons to keep, skip, defer, or reduce an optimization. Do not
46
+ default a batch to `keep` because it contains many fragments; finish the
47
+ complete current batch with the same quality standard as a single fragment.
48
+ Signals that recommend `request-input` identify ambiguous currency, ownership,
49
+ link purpose, or sensitive values. The plan returns all of them in
50
+ `input_requests`: ask one concise, batched question and wait before applying
51
+ the complete optimization payload. Do not convert a required input into
52
+ `keep` merely to avoid a pause. Preserve the exact destination of a volatile
53
+ URL and safely improve its descriptive label or surrounding layout when the
54
+ same Section already states its purpose; ask only for information that cannot
55
+ be recovered from the approved Section or its source evidence.
56
+
57
+ In fully managed operation, apply every safe `repair`, `reshape`, and eligible
58
+ `omit` autonomously and continue until the optimization status is current.
59
+ Managed authority removes routine review pauses, not quality work or genuine
60
+ missing-input boundaries. A large repair set is expected work, not a blocker.
61
+ If an `input_requests` batch remains after completing all independently safe
62
+ analysis, ask once for that batch and resume from the returned Route.
63
+
64
+ If the same current-batch quality problem fails three consecutive apply
65
+ attempts, stop the automatic revision loop and follow
66
+ `route.document-optimization.guidance-required`. Present one aggregated report
67
+ for all affected Sections and ask for content-organization, source-fidelity, or
68
+ missing-material direction. Do not restart Sections that already pass. A
69
+ successful complete-batch apply clears the temporary retry record; retry
70
+ history is never knowledge or package content.
71
+
72
+ Keep all work inside the same source Section. Preserve link destinations,
73
+ images, code, commands, numbers, identifiers, conditions, and source markers
74
+ exactly. Do not introduce facts, infer an answer, or replace a complete
75
+ contract with a summary.
20
76
 
21
77
  After the complete payload is ready, execute the exact `next_action.command`
22
- returned by the plan. Context rejects stale, incomplete, duplicate, or
23
- semantically broad decisions. Unchanged fragments reuse their previous
24
- decision; changed fragments alone return to this phase.
78
+ returned by the plan. Context rejects stale, incomplete, duplicate,
79
+ cross-Section, protected-value, semantically broad, or unexplained signaled
80
+ `keep` decisions. It also rescans every repair and reshape against the same
81
+ mechanical analyzer before writing the revision; submitting a decision is not
82
+ proof that the effective Markdown is clean. A repair or reshape that retains a
83
+ review-confidence signal must include a Section-specific assessment naming
84
+ that signal. The apply result reports each signal as `resolved` or `justified`
85
+ with its source and post-revision range. The assessment and rescan detail are
86
+ used only to audit the current decision and are not stored in approved
87
+ knowledge, revisions, or package output. Unchanged
88
+ Sections reuse their previous decision; changed Sections alone return to this
89
+ phase.
25
90
 
26
91
  Only pages with reader-visible changes are stored. A revision is a full
27
92
  Markdown sidecar beside its approved page: `knowledge/guides/setup.md` becomes
28
93
  `knowledge/guides/setup__revision.md`. Default knowledge discovery excludes the
29
94
  reserved suffix. The filename derives the base page; the revision stores only
30
- the base digest that cannot be derived. Unchanged fragments inside a revision
31
- are inferred. A page with no changes stores one derived negative cache key
32
- below `.tmp/context-runtime/document-optimization/`; replacement prose and
33
- fragment metadata are never duplicated there.
95
+ the base digest that cannot be derived. Unchanged Sections inside a full
96
+ revision are inferred. A page with no changes stores one derived negative cache
97
+ key below `.tmp/context-runtime/document-optimization/`; replacement prose and
98
+ Section metadata are never duplicated there. An omitted Section keeps its
99
+ lifecycle marker in the revision so its source identity remains auditable, but
100
+ its reader-visible body and all revision audit state are absent from `dist/`.
34
101
 
35
102
  For a later user-requested correction, use `context revise "<title or approved
36
103
  path>" --format json`. The resulting `route.document-revision.requested` owns
37
104
  target selection, revision editing, and validation; it also works when broad
38
105
  document optimization was not previously enabled. The compatibility entry
39
106
  `context optimize-docs revise` accepts the same selectors. Validation rejects
40
- lifecycle metadata changes, stale page baselines, unsafe token changes, broad
41
- rewrites, and invalid Markdown structure. A source change makes the revision a
42
- blocking conflict instead of silently applying it. Do not create fragment JSON
43
- files or another revision namespace.
107
+ lifecycle metadata changes, stale page baselines, protected-value changes,
108
+ cross-Section rewrites, unsupported omissions, and invalid Markdown structure.
109
+ A source change makes the revision a blocking conflict instead of silently
110
+ applying it. Do not create fragment JSON files or another revision namespace.
@@ -8,7 +8,10 @@ mediaType: text/markdown
8
8
 
9
9
  Use this procedure only for a correction explicitly requested by the user after
10
10
  an approved knowledge page already exists. The request selects one page; it
11
- does not authorize a broad rewrite or a change to source facts.
11
+ does not authorize a free rewrite or a change to source facts. It may repair or
12
+ reshape reader-visible content within one existing Context Section, and may
13
+ omit a complete Section only when the current source supports a documented
14
+ non-knowledge reason.
12
15
 
13
16
  1. Run the Route command `context optimize-docs revise-current --format json`.
14
17
  2. Read the complete approved page and its sibling `__revision.md` page named
@@ -16,12 +19,14 @@ does not authorize a broad rewrite or a change to source facts.
16
19
  could change a fact rather than formatting or wording.
17
20
  3. Edit only the returned revision page. Preserve its frontmatter identity,
18
21
  `context_revision` baseline, Context section boundaries, evidence markers,
19
- links, code, numbers, and unsupported details. Make the smallest change that
20
- satisfies the user's request. Never edit the approved base page for this
21
- operation.
22
+ link destinations, images, code, numbers, identifiers, and supported facts.
23
+ A wide table may become an index plus detail entries, and a source-backed
24
+ list may be reorganized, but facts cannot move across Section boundaries.
25
+ Never edit the approved base page for this operation.
22
26
  4. Run `context optimize-docs validate --format json`. If validation reports a
23
- stale baseline, unsafe replacement, or missing evidence, stop and report the
24
- exact finding instead of weakening the correction.
27
+ stale baseline, protected-value change, unsupported omission, broad rewrite,
28
+ or missing evidence, stop and report the exact finding instead of weakening
29
+ the correction.
25
30
  5. Continue from the returned `context status --format json` Route. A valid
26
31
  correction makes the package stale, so the normal build Route will offer
27
32
  compilation without requiring a second correction decision.
@@ -24,7 +24,9 @@ Without explicit session-managed authority:
24
24
 
25
25
  - open the report returned by the route;
26
26
  - let the user approve or reject candidates;
27
- - apply the exact returned decision payload.
27
+ - apply the exact returned decision payload; and
28
+ - retain the exact report reference and reviewed scope in this conversation for
29
+ the final completion summary.
28
30
 
29
31
  The ordinary Route also carries a revision-bound force-approval resolution
30
32
  Action as an escape path. Do not advertise it when first presenting Review.
@@ -38,3 +40,4 @@ conversation. It does not bypass source permission, validation, close, or
38
40
  verify.
39
41
 
40
42
  After apply, re-evaluate. Do not infer that close or package output is current.
43
+ Do not persist a duplicate review-report ledger in the workspace.
@@ -10,14 +10,26 @@ A source boundary is a user decision about which repositories, modules, or
10
10
  documents may become approved knowledge. It affects extraction scope,
11
11
  provenance, output paths, and freshness checks.
12
12
 
13
- Do not infer this boundary from the current directory, monorepo layout, package
14
- names, or Git remotes. Explain the decision in the user's language, obtain the
15
- specific paths or documents, then use the Context source schema and conditional
16
- registration command selected by the route. The command uses `--input -`; after
17
- the current conversation contains the required confirmation, send one YAML or
18
- JSON payload matching the selected schema to its standard input. Do not run the
19
- command before confirmation and do not replace it with a command remembered
20
- from another route.
13
+ Do not infer this boundary by using the current directory, monorepo layout,
14
+ package names, or Git remotes to select additional sources. Once the user has named a concrete local module
15
+ or path, resolving its unique local directory and reading that checkout's Git
16
+ root, `origin`, and current commit are mechanical identity resolution, not a
17
+ new source-boundary decision. Paths in the registration payload are resolved
18
+ from the Context project root; after initializing a child `context/` directory,
19
+ recompute sibling paths from that root instead of reusing the caller's relative
20
+ path. As a final CLI safeguard, an omitted `local` may resolve only to one Git
21
+ directory named by the confirmed module at the project root or its parent; zero
22
+ or multiple matches do not authorize a guess.
23
+
24
+ Explain the decision in the user's language, obtain the specific paths or
25
+ documents, then use the Context source schema and conditional registration
26
+ command selected by the route. If the current user request already names the
27
+ exact modules or documents, that decision is already present; do not ask for
28
+ their remote URLs when a confirmed local Git checkout can supply them. The
29
+ command names a file below `.tmp/agent-payloads/`; after the current
30
+ conversation contains the required confirmation, write one JSON payload
31
+ matching the selected schema to that exact path. Do not run the command before confirmation and do not replace
32
+ it with a command remembered from another route.
21
33
 
22
34
  Context source identity has two parts:
23
35
 
@@ -141,7 +141,7 @@ Use collection routing first:
141
141
  `product`;
142
142
  - architecture, service/module/system design, runtime dependency, code-adjacent
143
143
  prose -> `architecture`; if an existing code projection already owns the
144
- object, reuse its NodeRef/ViewRef instead of creating a `codegraph` prose
144
+ object, reuse its NodeRef/ViewRef instead of creating a `codeindex` prose
145
145
  view;
146
146
  - SOP, runbook, operation drill, workflow, or how-to procedure -> `sop`;
147
147
  - FAQ, question/answer, support notes -> `faq` only when the evidence is an
@@ -158,7 +158,7 @@ Use collection routing first:
158
158
  Sections under the owning view;
159
159
  - test plan, validation scenario, acceptance case -> `test`;
160
160
 
161
- Do not route prose align views to `codegraph` or `feats`: `codegraph` is
161
+ Do not route prose align views to `codeindex` or `feats`: `codeindex` is
162
162
  produced by code extraction / AST projection, and `feats` is reserved for the
163
163
  dedicated feature workflow. For section-vs-collection overlap, keep a local
164
164
  `faq`, `decision`, or `incident` as a Section kind under the owning view unless
@@ -314,7 +314,7 @@ There is no parallel candidate-body authoring path. Emit only the
314
314
 
315
315
  ### Step 6 — Validate And Submit
316
316
 
317
- Before staging, run `context run align:<type>:<source>:<collection> --validate --input - --format json` with the `context.structure.v1` payload. The CLI applies deterministic boundary repairs internally and returns only remaining blockers. For oversized Views, apply the returned child-View and contains-edge suggestions while classifying child Nodes from evidence. Resolve other blockers from evidence; ask the user only when evidence supports multiple incompatible semantic choices. Stage only after validation state is `ready`. The stage result opens the final HTML report for the Route-selected structure-confirmation gate. Execute the revision-bound confirmation command returned by `workflow.current`; managed session authority may resolve that gate without another question.
317
+ Before staging, write the `context.structure.v1` payload to the Route-selected `.tmp/agent-payloads/` path and run the returned `context run align:<type>:<source>:<collection> --validate --input <payload-file> --format json` command. The CLI applies deterministic boundary repairs internally and returns only remaining blockers. For oversized Views, apply the returned child-View and contains-edge suggestions while classifying child Nodes from evidence. Resolve other blockers from evidence; ask the user only when evidence supports multiple incompatible semantic choices. Stage only after validation state is `ready`. The stage result opens the final HTML report for the Route-selected structure-confirmation gate. Execute the revision-bound confirmation command returned by `workflow.current`; managed session authority may resolve that gate without another question.
318
318
 
319
319
  After stage succeeds, do not rerun the same write command to confirm success.
320
320
  Use `context status --format json` or the returned result for read-only
@@ -331,7 +331,7 @@ editing CLI-managed files.
331
331
  - [ ] Evidence was read through returned `next_action.command`, `next_command`, or current CLI schema/view commands only. If not, return to **Step 2**.
332
332
  - [ ] Node classification used the semantic gates in `structure-planning/references/gates.md`. If not, return to **Step 4**.
333
333
  - [ ] URL/reference ownership followed CLI diagnostics, not static prompt rules. If not, return to **Step 5**.
334
- - [ ] The requested align payload passed `context run align:<type>:<source>:<collection> --validate --input - --format json` before stage. If not, return to **Step 6**.
334
+ - [ ] The requested align payload passed the exact Route-selected `--validate --input <payload-file>` command before stage. If not, return to **Step 6**.
335
335
  - [ ] No `sources/`, `knowledge/`, `dist/`, `.tmp`, host tool-results, or CLI-managed files were read or written with generic tools. If violated, restart from **Step 1**.
336
336
 
337
337
  </procedures>
@@ -52,6 +52,7 @@ Each module must have:
52
52
  - every additional applicable type in `moduleTypes`;
53
53
  - relevant behavior and boundary `facets`;
54
54
  - concrete inspected paths in `moduleTypeEvidence`;
55
+ - exact source-relative Markdown paths already read in `documents`;
55
56
  - an explicit gap when available source cannot support a reliable claim.
56
57
 
57
58
  Choose the primary type from the boundary through which a reader most often
@@ -152,11 +153,12 @@ Extractor shape is part of the plan, not an implementation detail:
152
153
  overlapping cross-source unit causes `ownership-ambiguous`.
153
154
  - Use `extractCustom()` for aggregate pages or multiple units over one source.
154
155
  Every candidate must declare its owning `module`, and its evidence must cover
155
- the Route-reported structural probes. Use evidence-scoped `sections` rather
156
- than one undifferentiated `markdown` body: each section declares a coverage
157
- kind and the exact source evidence supporting that part of the page. Resolve
158
- source roots from the extractor context's `sources[].absolutePath`; never
159
- embed a machine-specific checkout path.
156
+ the Route-reported structural probes. The custom-candidate contract has no
157
+ page-level Markdown fallback: every candidate must provide at least one
158
+ evidence-scoped `section`, and each section declares a coverage kind and the
159
+ exact source evidence supporting that part of the page. Resolve source roots
160
+ from the extractor context's `sources[].absolutePath`; never embed a
161
+ machine-specific checkout path.
160
162
  - Register independently visible monorepo children as separate sources before
161
163
  giving them separate `extractTs()` units. An `include` pattern filters files;
162
164
  it does not create a source boundary.
@@ -176,6 +178,7 @@ custom cross-module flow. A minimal plan has this shape:
176
178
  moduleTypes: ["web-application"],
177
179
  facets: ["page-routing", "protocol-consumer"],
178
180
  moduleTypeEvidence: ["package.json", "src/routes.ts"],
181
+ documents: ["README.md", "docs/architecture.md"],
179
182
  outputOwner: "customer-portal",
180
183
  outputProfile: "application-map",
181
184
  inputSources: ["repo:customer-portal"],
@@ -89,6 +89,15 @@ helper separately.
89
89
  Add structured edges only for concrete registration and call paths. Keep a
90
90
  narrative locator when dynamic dispatch prevents an unambiguous edge.
91
91
 
92
+ Return `identityGroups` when several target identities share one explained
93
+ adapter responsibility. Return every source-backed adjacency in
94
+ `chainCandidates`, then provide one `chainCandidateDecisions` record for each
95
+ candidate. A documented decision names the reader-facing view and emits its
96
+ structured edge; an equivalent candidate merges into that canonical candidate;
97
+ false positives and missing external material use `exclude` or `request-input`
98
+ with a concrete reason. Read `contracts-and-chains.md` for the complete generic
99
+ contract.
100
+
92
101
  ## Template composition examples
93
102
 
94
103
  - An HTTP endpoint backed by an RPC client is `api-service` + `adapter`; combine
@@ -0,0 +1,81 @@
1
+ ---
2
+ id: semantic.code-index.template.contracts-and-chains
3
+ kind: procedure
4
+ media-type: text/markdown
5
+ ---
6
+
7
+ # Contracts, identity groups, and execution chains
8
+
9
+ Use this resource after module classification when a code index must connect
10
+ stable identities without turning the inventory into reader-facing prose. It
11
+ applies to application, service, library, runtime, command, adapter, and
12
+ cross-source units.
13
+
14
+ ## Separate inspection facts from reader content
15
+
16
+ The adapter inventory is complete machine evidence. A reader page should group
17
+ members only when they share a source-backed responsibility, boundary, or
18
+ lifecycle. Do not create one sentence, bullet, row, or page per discovered
19
+ identity.
20
+
21
+ An `identityGroups` record must provide:
22
+
23
+ - a stable group `id`;
24
+ - the exact target `members` from the same index-unit inventory;
25
+ - one reader-facing `viewRef` that explains their common responsibility;
26
+ - `sourceFiles` from the eligible-file inventory that prove membership.
27
+
28
+ The referenced page must cite every declared source file. A group does not pass
29
+ coverage merely because its members exist in frontmatter or evidence.
30
+
31
+ ## Discover chain candidates
32
+
33
+ Emit a candidate only when code structure or an authoritative declaration
34
+ supports both adjacent endpoints. Supported families are:
35
+
36
+ - `entry-operation`;
37
+ - `operation-handler`;
38
+ - `handler-downstream`;
39
+ - `event-processing`;
40
+ - `command-effect`;
41
+ - `export-implementation`;
42
+ - `cross-source-handoff`.
43
+
44
+ Each candidate records a stable `id`, `from`, `to`, confidence, and the exact
45
+ eligible `sourceFiles` that support the adjacency. Imports, filenames, symbol
46
+ co-occurrence, or similar names alone are ambiguous evidence; mark such a
47
+ candidate ambiguous or request material instead of asserting a runtime chain.
48
+
49
+ ## Decide every candidate
50
+
51
+ Every discovered candidate receives exactly one decision:
52
+
53
+ - `document`: add a source-backed structured edge and name its reader-facing
54
+ `viewRef`;
55
+ - `merge`: point `canonicalChainId` at an equivalent candidate whose decision
56
+ is `document`;
57
+ - `exclude`: explain why the static match is not a stable runtime relation;
58
+ - `request-input`: explain which external protocol, runtime registration, or
59
+ authoritative material is missing.
60
+
61
+ Decision coverage is 100%. Excluding all candidates does not close an external
62
+ boundary family: at least one representative chain must be documented, merged
63
+ into a documented chain, or explicitly require material.
64
+
65
+ ## Reader-facing chain blueprint
66
+
67
+ ```markdown
68
+ ## <Reader goal or boundary>
69
+
70
+ <Explain the starting trigger and the stable outcome.>
71
+
72
+ 1. **Entry or trigger** — <identity and responsibility>.
73
+ 2. **Operation or handler** — <validation, transformation, or state change>.
74
+ 3. **External handoff or effect** — <contract, ownership, and next boundary>.
75
+
76
+ Failure and retry boundary: <only source-backed behavior>.
77
+ Evidence: <section-scoped locators for each adjacent handoff>.
78
+ ```
79
+
80
+ Remove stages that do not apply. Do not leave empty template headings, repeat a
81
+ module inventory, or infer missing runtime behavior.