@c4a/context-cli 0.7.0 → 0.7.4

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 (219) hide show
  1. package/README.md +18 -39
  2. package/README.zh-CN.md +13 -27
  3. package/cli.js +59230 -80555
  4. package/indexers/bundles/context-code-indexer/SKILL.md +30 -3
  5. package/indexers/bundles/context-code-indexer/context-indexer.yaml +3 -8
  6. package/indexers/bundles/context-code-indexer/references/indexer.md +110 -7
  7. package/indexers/bundles/context-code-indexer/references/metrics.md +143 -37
  8. package/indexers/bundles/context-code-indexer/templates/adapter-integration.md +2 -2
  9. package/indexers/bundles/context-code-indexer/templates/component-library.md +8 -0
  10. package/indexers/bundles/context-code-indexer/templates/gateway-facade.md +16 -0
  11. package/indexers/bundles/context-markdown-indexer/SKILL.md +13 -3
  12. package/indexers/bundles/context-markdown-indexer/context-indexer.yaml +20 -7
  13. package/indexers/bundles/context-markdown-indexer/references/indexer.md +33 -4
  14. package/indexers/bundles/context-markdown-indexer/references/semantic-planning.md +30 -14
  15. package/indexers/bundles/context-markdown-indexer/references/structure-and-artifacts.md +6 -0
  16. package/indexers/bundles/context-markdown-indexer/tests/fixtures/anonymous.json +1 -1
  17. package/indexers/bundles/context-markdown-indexer/tests/fixtures/profiles.json +13 -13
  18. package/indexers/bundles/context-markdown-indexer/tests/fixtures/routing.json +122 -0
  19. package/indexers/contracts/operator-contract.json +2 -2
  20. package/indexers/contracts/profile-contract.json +3819 -454
  21. package/indexers/release-manifest.json +22 -22
  22. package/package.json +13 -3
  23. package/plugins/VERSION +1 -1
  24. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  25. package/plugins/claude/commands/context.md +44 -85
  26. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  27. package/plugins/codex/skills/context/SKILL.md +44 -85
  28. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  29. package/plugins/cursor/commands/c4a-context.md +44 -85
  30. package/plugins/skills/context/SKILL.md +44 -85
  31. package/plugins/skills/context-code-indexer/SKILL.md +30 -3
  32. package/plugins/skills/context-code-indexer/context-indexer.yaml +3 -8
  33. package/plugins/skills/context-code-indexer/references/indexer.md +110 -7
  34. package/plugins/skills/context-code-indexer/references/metrics.md +143 -37
  35. package/plugins/skills/context-code-indexer/templates/adapter-integration.md +2 -2
  36. package/plugins/skills/context-code-indexer/templates/component-library.md +8 -0
  37. package/plugins/skills/context-code-indexer/templates/gateway-facade.md +16 -0
  38. package/plugins/skills/context-markdown-indexer/SKILL.md +13 -3
  39. package/plugins/skills/context-markdown-indexer/context-indexer.yaml +20 -7
  40. package/plugins/skills/context-markdown-indexer/references/indexer.md +33 -4
  41. package/plugins/skills/context-markdown-indexer/references/semantic-planning.md +30 -14
  42. package/plugins/skills/context-markdown-indexer/references/structure-and-artifacts.md +6 -0
  43. package/plugins/skills/context-markdown-indexer/tests/fixtures/anonymous.json +1 -1
  44. package/plugins/skills/context-markdown-indexer/tests/fixtures/profiles.json +13 -13
  45. package/plugins/skills/context-markdown-indexer/tests/fixtures/routing.json +122 -0
  46. package/providers/context/actions/advance-current-indexer-lifecycle.yaml +6 -0
  47. package/providers/context/actions/configure-indexer-providers.yaml +1 -1
  48. package/providers/context/actions/materialize-indexer-workset-view.yaml +7 -0
  49. package/providers/context/actions/run-indexer-lifecycle.yaml +7 -0
  50. package/providers/context/actions/run-indexer-post-author-composer.yaml +1 -1
  51. package/providers/context/codes.yaml +9 -49
  52. package/providers/context/graphs/indexer.yaml +75 -592
  53. package/providers/context/graphs/workspace.yaml +25 -500
  54. package/providers/context/manifest.json +110 -1199
  55. package/providers/context/provider.yaml +2 -2
  56. package/providers/context/resources/diagnostics/projection-stale.md +0 -1
  57. package/providers/context/resources/dialogue/human-gates.md +3 -3
  58. package/providers/context/resources/manuals/reference/package-templates.md +2 -3
  59. package/providers/context/resources/manuals/reference/project-api.md +52 -985
  60. package/providers/context/resources/procedures/close-and-build.md +8 -23
  61. package/providers/context/resources/procedures/knowledge-review.md +13 -4
  62. package/providers/context/resources/procedures/source-capture-detailed.md +6 -8
  63. package/providers/context/resources/views/authorized-indexer-workset-view.yaml +15 -0
  64. package/providers/context/resources/views/package-current.yaml +1 -1
  65. package/providers/context/resources/views/resolved-indexer-instructions.yaml +1 -1
  66. package/providers/context/resources/views/review-current.yaml +1 -1
  67. package/providers/context/resources/views/source-boundary.yaml +1 -1
  68. package/providers/context/resources/views/source-current.yaml +1 -1
  69. package/providers/context/resources/views/verification-current.yaml +1 -1
  70. package/providers/context/resources/views/workspace-current.yaml +1 -1
  71. package/providers/context/schemas/indexer-agent-step-input.schema.json +2 -2
  72. package/providers/context/schemas/indexer-agent-step-result.schema.json +298 -32
  73. package/providers/context/schemas/indexer-authorized-workset-view.schema.json +65 -0
  74. package/providers/context/schemas/indexer-contract-overlay-validation-input.schema.json +0 -42
  75. package/providers/context/schemas/indexer-contract-overlay-validation-result.schema.json +27 -122
  76. package/providers/context/schemas/indexer-lifecycle-continuation.schema.json +15 -0
  77. package/providers/context/schemas/indexer-main-lifecycle-input.schema.json +13 -20
  78. package/providers/context/schemas/indexer-main-lifecycle-output.schema.json +17 -2
  79. package/providers/context/schemas/indexer-materialized-resource.schema.json +8 -1
  80. package/providers/context/schemas/indexer-overlay-question-proposal-input.schema.json +55 -6
  81. package/providers/context/schemas/indexer-overlay-question-rebind-input.schema.json +4 -4
  82. package/providers/context/schemas/indexer-workset-view-materialization-request.schema.json +32 -0
  83. package/providers/context/skills/configure-indexer-providers/SKILL.md +40 -27
  84. package/providers/context/skills/run-indexer-agent-step/SKILL.md +34 -8
  85. package/providers/context/skills/run-indexer-lifecycle/SKILL.md +37 -0
  86. package/providers/context/skills/run-indexer-post-author-composer/SKILL.md +38 -9
  87. package/docs/document-optimization.md +0 -82
  88. package/docs/document-optimization.zh-CN.md +0 -70
  89. package/indexers/capability-manifest.json +0 -40
  90. package/indexers/contracts/hard-rule-conformance.json +0 -2644
  91. package/providers/context/actions/accept-main-index-run.yaml +0 -7
  92. package/providers/context/actions/accept-material-answer-run.yaml +0 -7
  93. package/providers/context/actions/accept-post-author-composer-run.yaml +0 -7
  94. package/providers/context/actions/actualize-material-answer-bindings.yaml +0 -8
  95. package/providers/context/actions/align-next.yaml +0 -6
  96. package/providers/context/actions/apply-code-index-guidance.yaml +0 -5
  97. package/providers/context/actions/apply-document-optimization-guidance.yaml +0 -5
  98. package/providers/context/actions/apply-structure-confirmation.yaml +0 -5
  99. package/providers/context/actions/audit-material-gap-state.yaml +0 -8
  100. package/providers/context/actions/audit-projected-artifact-fan-out.yaml +0 -8
  101. package/providers/context/actions/authorize-indexer-contract-overlay.yaml +0 -7
  102. package/providers/context/actions/build-main-index-author-worksets.yaml +0 -7
  103. package/providers/context/actions/build-main-index-catalog-fallback.yaml +0 -7
  104. package/providers/context/actions/build-main-index-partition-worksets.yaml +0 -7
  105. package/providers/context/actions/build-material-question-workset.yaml +0 -7
  106. package/providers/context/actions/build-post-author-composer-worksets.yaml +0 -7
  107. package/providers/context/actions/build-question-target-inventory.yaml +0 -7
  108. package/providers/context/actions/build-subject-catalog.yaml +0 -7
  109. package/providers/context/actions/build-target-resolution-views.yaml +0 -7
  110. package/providers/context/actions/checkpoint-material-answer-review.yaml +0 -8
  111. package/providers/context/actions/checkpoint-material-gaps.yaml +0 -8
  112. package/providers/context/actions/close-indexer-approved-knowledge.yaml +0 -8
  113. package/providers/context/actions/compile-next.yaml +0 -5
  114. package/providers/context/actions/compose-indexer-post-author-fragments.yaml +0 -7
  115. package/providers/context/actions/configure-code-extraction.yaml +0 -5
  116. package/providers/context/actions/configure-prose-lifecycle.yaml +0 -5
  117. package/providers/context/actions/converge-main-index-partition-run.yaml +0 -7
  118. package/providers/context/actions/evaluate-material-gaps.yaml +0 -8
  119. package/providers/context/actions/extract-next.yaml +0 -5
  120. package/providers/context/actions/fail-main-index-run.yaml +0 -7
  121. package/providers/context/actions/fail-material-answer-run.yaml +0 -7
  122. package/providers/context/actions/fail-post-author-composer-run.yaml +0 -7
  123. package/providers/context/actions/inspect-code-extraction.yaml +0 -5
  124. package/providers/context/actions/inspect-document-classification.yaml +0 -5
  125. package/providers/context/actions/inspect-index-candidate-review-readiness.yaml +0 -8
  126. package/providers/context/actions/inspect-index-profile-failure.yaml +0 -7
  127. package/providers/context/actions/inspect-material-answer-review.yaml +0 -8
  128. package/providers/context/actions/inspect-structure.yaml +0 -5
  129. package/providers/context/actions/migrate-codeindex.yaml +0 -5
  130. package/providers/context/actions/observe-main-index-run-ledger.yaml +0 -7
  131. package/providers/context/actions/observe-material-answer-runs.yaml +0 -7
  132. package/providers/context/actions/observe-post-author-composer-worksets.yaml +0 -7
  133. package/providers/context/actions/optimize-documents.yaml +0 -6
  134. package/providers/context/actions/override-index-profile-audit.yaml +0 -7
  135. package/providers/context/actions/prepare-main-index-run-ledger.yaml +0 -7
  136. package/providers/context/actions/prepare-material-answer-runs.yaml +0 -7
  137. package/providers/context/actions/preview-extraction-batch.yaml +0 -5
  138. package/providers/context/actions/reconcile-indexer-results.yaml +0 -7
  139. package/providers/context/actions/reconcile-review-identities.yaml +0 -5
  140. package/providers/context/actions/record-index-profile-revision.yaml +0 -7
  141. package/providers/context/actions/report-index-profile-failure.yaml +0 -7
  142. package/providers/context/actions/resolve-effective-composers.yaml +0 -7
  143. package/providers/context/actions/review-material-answer-candidate.yaml +0 -8
  144. package/providers/context/actions/revise-code-index-audit.yaml +0 -5
  145. package/providers/context/actions/revise-document.yaml +0 -5
  146. package/providers/context/actions/revise-index-output.yaml +0 -7
  147. package/providers/context/actions/run-material-answer-indexers.yaml +0 -7
  148. package/providers/context/actions/start-main-index-run.yaml +0 -7
  149. package/providers/context/actions/start-material-answer-run.yaml +0 -7
  150. package/providers/context/actions/start-post-author-composer-run.yaml +0 -7
  151. package/providers/context/actions/submit-code-index-audit.yaml +0 -6
  152. package/providers/context/resources/dialogue/code-extraction.md +0 -87
  153. package/providers/context/resources/dialogue/document-classification.md +0 -33
  154. package/providers/context/resources/dialogue/structure-confirmation.md +0 -44
  155. package/providers/context/resources/dialogue/workflow-mode-after-capture.md +0 -25
  156. package/providers/context/resources/manuals/reference/code-extractors.md +0 -152
  157. package/providers/context/resources/procedures/code-extraction.md +0 -188
  158. package/providers/context/resources/procedures/code-index-audit.md +0 -113
  159. package/providers/context/resources/procedures/document-classification.md +0 -22
  160. package/providers/context/resources/procedures/document-optimization.md +0 -110
  161. package/providers/context/resources/procedures/document-revision.md +0 -36
  162. package/providers/context/resources/procedures/prose-align.md +0 -68
  163. package/providers/context/resources/procedures/prose-compile.md +0 -23
  164. package/providers/context/resources/semantic/align/candidate-resolution.md +0 -106
  165. package/providers/context/resources/semantic/align/density-profile.md +0 -41
  166. package/providers/context/resources/semantic/align/gates.md +0 -276
  167. package/providers/context/resources/semantic/align/structure-planning.md +0 -337
  168. package/providers/context/resources/semantic/code-index/classification.md +0 -270
  169. package/providers/context/resources/semantic/code-index/templates/adapter.md +0 -118
  170. package/providers/context/resources/semantic/code-index/templates/api-service.md +0 -116
  171. package/providers/context/resources/semantic/code-index/templates/background-runtime.md +0 -109
  172. package/providers/context/resources/semantic/code-index/templates/cli-tool.md +0 -129
  173. package/providers/context/resources/semantic/code-index/templates/contract-source.md +0 -73
  174. package/providers/context/resources/semantic/code-index/templates/contracts-and-chains.md +0 -81
  175. package/providers/context/resources/semantic/code-index/templates/cross-module-chain.md +0 -78
  176. package/providers/context/resources/semantic/code-index/templates/derived-source.md +0 -116
  177. package/providers/context/resources/semantic/code-index/templates/domain-service.md +0 -109
  178. package/providers/context/resources/semantic/code-index/templates/event-flow.md +0 -62
  179. package/providers/context/resources/semantic/code-index/templates/monorepo-container.md +0 -124
  180. package/providers/context/resources/semantic/code-index/templates/persistence-boundary.md +0 -56
  181. package/providers/context/resources/semantic/code-index/templates/plugin-extension.md +0 -52
  182. package/providers/context/resources/semantic/code-index/templates/protocol-boundary.md +0 -88
  183. package/providers/context/resources/semantic/code-index/templates/sdk-library.md +0 -132
  184. package/providers/context/resources/semantic/code-index/templates/web-application.md +0 -145
  185. package/providers/context/resources/semantic/compile/index.md +0 -31
  186. package/providers/context/resources/views/code-index-audit.yaml +0 -6
  187. package/providers/context/resources/views/document-optimization-current.yaml +0 -6
  188. package/providers/context/resources/views/extraction-preview.yaml +0 -6
  189. package/providers/context/resources/views/structure-current.yaml +0 -6
  190. package/providers/context/schemas/code-index-audit-decision.schema.json +0 -94
  191. package/providers/context/schemas/document-optimization-decisions.schema.json +0 -57
  192. package/providers/context/schemas/indexer-candidate-review-readiness-input.schema.json +0 -46
  193. package/providers/context/schemas/indexer-candidate-review-readiness-output.schema.json +0 -104
  194. package/providers/context/schemas/indexer-contract-overlay-authorization-input.schema.json +0 -32
  195. package/providers/context/schemas/indexer-contract-overlay-authorization-result.schema.json +0 -121
  196. package/providers/context/schemas/indexer-material-answer-lifecycle-input.schema.json +0 -90
  197. package/providers/context/schemas/indexer-material-answer-lifecycle-output.schema.json +0 -80
  198. package/providers/context/schemas/indexer-material-answer-review-inspection-input.schema.json +0 -32
  199. package/providers/context/schemas/indexer-material-answer-review-inspection-output.schema.json +0 -32
  200. package/providers/context/schemas/indexer-material-answer-review-resolution-input.schema.json +0 -19
  201. package/providers/context/schemas/indexer-material-answer-review-resolution-output.schema.json +0 -87
  202. package/providers/context/schemas/indexer-material-gap-lifecycle-input.schema.json +0 -86
  203. package/providers/context/schemas/indexer-material-gap-lifecycle-output.schema.json +0 -19
  204. package/providers/context/schemas/indexer-post-author-fragment-result.schema.json +0 -18
  205. package/providers/context/schemas/indexer-post-author-lifecycle-input.schema.json +0 -94
  206. package/providers/context/schemas/indexer-post-author-lifecycle-output.schema.json +0 -72
  207. package/providers/context/schemas/indexer-profile-failure-inspection-input.schema.json +0 -13
  208. package/providers/context/schemas/indexer-profile-failure-inspection-result.schema.json +0 -19
  209. package/providers/context/schemas/indexer-profile-failure-report-input.schema.json +0 -22
  210. package/providers/context/schemas/indexer-profile-failure-report-result.schema.json +0 -49
  211. package/providers/context/schemas/indexer-profile-override-decision.schema.json +0 -20
  212. package/providers/context/schemas/indexer-profile-override-result.schema.json +0 -49
  213. package/providers/context/schemas/indexer-profile-revision-agent-input.schema.json +0 -18
  214. package/providers/context/schemas/indexer-profile-revision-record-input.schema.json +0 -31
  215. package/providers/context/schemas/indexer-profile-revision-record-result.schema.json +0 -45
  216. package/providers/context/schemas/indexer-result-reconciliation-input.schema.json +0 -59
  217. package/providers/context/schemas/indexer-result-reconciliation-output.schema.json +0 -43
  218. package/providers/context/schemas/prose-structure-batch.schema.json +0 -35
  219. package/providers/context/skills/revise-index-output/SKILL.md +0 -12
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: context-run-indexer-agent-step
3
- description: Execute one Context-authorized Indexer workset using only the current Route input and resolved Provider instructions.
3
+ description: Execute one Context-authorized Indexer workset using only the current Route input, resolved Provider instructions, and authorized workset View.
4
4
  metadata:
5
5
  agent-graph: path:../../provider.yaml
6
6
  agent-graph.graph: indexer
@@ -10,11 +10,37 @@ metadata:
10
10
  # Run one Indexer Agent step
11
11
 
12
12
  Read the current Route action input and every required Resource marked `read-required`.
13
- Use only the materialized `resolved-indexer-instructions` content, the supplied workset,
14
- composition input, and Context-authorized evidence. Do not discover another Skill, read a
15
- Provider path, widen source scope, run a program, or invent missing evidence.
13
+ Use only the materialized `resolved-indexer-instructions`, the supplied workset authority,
14
+ and the single `authorized-indexer-workset-view`. The View already contains the exact facts,
15
+ dependencies, Provider fragments, and Author authority authorized for this workset. Do not
16
+ construct evidence read requests, manage pages or cursors, discover another Skill, read a
17
+ Provider path, widen source scope, run an unauthorized Indexer or parser, or invent missing
18
+ evidence.
16
19
 
17
- Return exactly `context.indexer.agent-step-result/v1`. Preserve the supplied input and
18
- execution request digests, bind the materialized instruction payload digest, and include
19
- the current Host execution receipt. Context performs the final schema, evidence, owner,
20
- scope, and workset validation; never report success merely because the prose looks valid.
20
+ Author the stage-specific operation Result described by the Action output schema. Copy dynamic
21
+ authority values only from the Route input or authorized View; in particular,
22
+ `consumed_input_view_digest` means `run_request.composition_input.view_digest`, not the
23
+ authorized View's own digest.
24
+
25
+ For a Partition Result, read `partition-authority` before choosing each group subject. A string
26
+ changes only the local key and preserves `base_subject_key` namespace and kind. Use an explicit
27
+ subject object only when its kind is listed in `subject_key_contract.kinds`; never invent a kind
28
+ from a page title, operation name, framework term, or business vocabulary.
29
+
30
+ For an Author Result, a selected parser Fact is an immutable projection, not material for a new
31
+ Fact shape. Build it only from the matching View items:
32
+
33
+ - `fact_ref` = the `fact` item's `value.fact_ref`;
34
+ - `fact_kind` = the `fact` item's `value.kind`;
35
+ - `subject_key` = `author-authority.expected_subject_key`;
36
+ - `value` = the `fact` item's `value.payload` exactly, without wrapping, renaming, or adding fields;
37
+ - `evidence_refs` = the source-span evidence refs reached through the matching `selected-fact`
38
+ dependency node.
39
+
40
+ Build each EvidenceBinding from that same source-span dependency's `evidence_ref`, `source_ref`,
41
+ `module_ref`, `locator`, and `content_digest`. Do not infer a new locator or digest from prose.
42
+ Do not invent or manually copy read-receipt, execution-receipt, or stable-result digests. The Host
43
+ integration must use Context's protocol builders to derive content-addressed fields and finalize
44
+ exactly `context.indexer.agent-step-result/v1`; Context performs the existing dependency, schema,
45
+ owner, scope, and workset validation before reporting success. Never report success merely because
46
+ the envelope or prose looks valid.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: context-run-indexer-lifecycle
3
+ description: Continue the sole Context registry-and-Provider indexing route; use only when the workspace Graph selects route.indexer.lifecycle-required.
4
+ metadata:
5
+ agent-graph: path:../../provider.yaml
6
+ agent-graph.graph: workspace
7
+ agent-graph.entry: context
8
+ ---
9
+
10
+ # Run The Indexer Lifecycle
11
+
12
+ This Action continues the sole registry-and-Provider indexing route. Use the
13
+ current Indexer subroute for semantic partitioning, structure review, authoring,
14
+ composition, layout, Candidate compilation, and repair. Existing approved
15
+ knowledge is an input to incremental planning, never a parallel authoring path.
16
+
17
+ Read
18
+ `node_modules/@c4a/context/docs/guides/indexer-provider-and-customization.md`,
19
+ then follow the root `context` Skill's Indexer instructions and the exact
20
+ structured outcomes returned by `context indexer ...`. Start by forming and
21
+ confirming requirements when `src/indexers.yaml` is absent or stale; otherwise
22
+ continue the current registry selection, Provider resolution, execution,
23
+ reconciliation, mechanical validation, layout, and Candidate compile subroute. The Indexer
24
+ Graph is the authority for each substep. Never skip directly to compile and
25
+ never synthesize a Provider Result or a default plan.
26
+
27
+ Stop on the first Host permission, non-delegatable Gate, validation failure, or
28
+ human decision. Once current Candidates have been compiled, return control to
29
+ `context status --format json`; the workspace Graph will select Knowledge
30
+ Review. The Action output is only:
31
+
32
+ ```json
33
+ {
34
+ "protocol": "context.indexer.lifecycle-continuation/v1",
35
+ "outcome": "follow-indexer-route"
36
+ }
37
+ ```
@@ -9,13 +9,42 @@ metadata:
9
9
 
10
10
  # Run one post-author composer
11
11
 
12
- Read the current Route input and the exact `context.indexer.layer-fragment-request/v1`.
13
- Use only its bounded `primary_result_view`, selected `composer_ref`, allowed target refs,
14
- and the resolved instructions supplied by Context. Do not discover another Skill or
15
- composer, read project files outside the request, change a SubjectKey, create a complete
16
- primary Result, or widen the target set.
12
+ Read both required Route resources before acting:
17
13
 
18
- Return exactly `context.indexer.layer-fragment-result/v1`. Preserve the request digest,
19
- composer ref, and consumed PrimaryResultView digest. Return only zero or more
20
- `derived-artifact-proposal` fragments for allowed targets. Context performs final schema,
21
- identity, evidence, policy, layer, and receipt validation before accepting the Result.
14
+ - `resolved-indexer-instructions` defines the selected Composer's job;
15
+ - `authorized-indexer-workset-view` is the complete, bounded PrimaryResult View.
16
+
17
+ Use only the target aliases and source aliases exposed by that View and the current Route.
18
+ Do not discover another Skill or Composer, scan project files outside the View, change a
19
+ SubjectKey, rewrite the primary Result, or widen the target set.
20
+
21
+ Return only the minimal semantic JSON accepted by the current Route:
22
+
23
+ ```json
24
+ {
25
+ "stage": "post-author",
26
+ "outcome": "complete",
27
+ "proposals": [
28
+ {
29
+ "target": "target:1",
30
+ "artifact_kind": "content",
31
+ "title": "Reader-facing title",
32
+ "summary": "Why this derived page is useful",
33
+ "sections": [
34
+ {
35
+ "key": "overview",
36
+ "heading": "Overview",
37
+ "markdown": "Reader-facing content",
38
+ "source_refs": ["fact:1"]
39
+ }
40
+ ]
41
+ }
42
+ ],
43
+ "diagnostics": []
44
+ }
45
+ ```
46
+
47
+ If no derived Artifact is needed, return `outcome: "complete"` with an empty
48
+ `proposals` array. If the bounded inputs cannot be processed, return `outcome: "failed"`
49
+ with at least one diagnostic. Context expands aliases, validates evidence and policy,
50
+ creates internal fragments and digests, then resumes the same production state machine.
@@ -1,82 +0,0 @@
1
- # Document revisions
2
-
3
- New workspaces enable source-constrained editorial revision by default. It is a
4
- build phase for source-backed prose that improves publication value and
5
- readability without changing the approved knowledge page or inventing facts.
6
-
7
- To opt out during initialization:
8
-
9
- ```bash
10
- context init context --no-optimize-docs
11
- ```
12
-
13
- Existing workspaces retain their current setting. Change it explicitly with:
14
-
15
- ```bash
16
- context optimize-docs enable
17
- context optimize-docs disable
18
- context status --format json
19
- ```
20
-
21
- When enabled, the workflow plans only new or changed source Sections. For each
22
- Section the CLI reports mechanical signals and allowed actions. The Agent may
23
- keep it, repair local presentation, reshape it within the same source boundary,
24
- or omit it when the CLI confirms a non-knowledge reason. Only changed pages
25
- receive a full revision beside their approved page:
26
-
27
- Signals are review leads rather than a complete readability verdict. The Agent
28
- must read every Section. Keeping a signaled Section requires a concrete,
29
- decision-only assessment explaining why each signal is a false positive or why
30
- editing would reduce source fidelity. The assessment names every reported
31
- signal code so the CLI can verify complete coverage; it is never published.
32
- Time, cost, workload, batch size, or delivery pressure are not valid keep or
33
- defer reasons. Fully managed operation applies all safe repairs, reshapes, and
34
- eligible omissions autonomously; only genuinely unavailable semantic input is
35
- batched for the user. A large fragment set must meet the same quality standard
36
- as a single fragment.
37
-
38
- ```text
39
- knowledge/guides/setup.md
40
- knowledge/guides/setup__revision.md
41
- ```
42
-
43
- The `__revision.md` suffix is reserved. Default knowledge discovery, structure,
44
- search, and package selection exclude revision files. Validation and build
45
- associate a revision with its sibling base page and apply it under the original
46
- package path. A revision stores only the base digest that cannot be inferred;
47
- its path and revised Sections are derived. Unchanged Sections inside a full
48
- revision are inferred. A page with no changes stores only one derived negative
49
- cache key below `.tmp/context-runtime/document-optimization/`; replacement
50
- prose and Section metadata are not duplicated there.
51
-
52
- Typical repair candidates are Markdown syntax, spacing, empty table rows, and
53
- descriptive labels for links whose purpose is already present. Reshape handles
54
- wide tables, long cells, mixed images and links, or long prose by creating a
55
- clearer structure inside the same Section. Unanswered question sets, empty
56
- placeholders, decision-free drafts, duplicates, and obsolete-only Sections may
57
- be omitted. Questions with answers, limitations with an action, and
58
- deprecations with a replacement remain knowledge. Link targets, images, code,
59
- commands, numbers, identifiers, conditions, and source references are protected
60
- through validation. Ambiguous currency, ownership, or sensitive values appear
61
- together in the plan's `input_requests` and require one batched user decision.
62
-
63
- After capture, review, or build, a user may ask conversationally to correct one
64
- existing knowledge page. Start the correction by title, approved path, or
65
- ViewRef:
66
-
67
- ```bash
68
- context revise "<title, approved path, or ViewRef>" --format json
69
- ```
70
-
71
- Context starts `route.document-revision.requested` only after resolving one
72
- page. Ambiguous requests return candidates instead of guessing. Edit
73
- reader-visible prose within existing `context:section` boundaries without
74
- changing provenance or protected values, then run `context optimize-docs
75
- validate`. A valid correction ends
76
- the request and the next Route offers a package build when output is stale. If
77
- broad document optimization was disabled, this entry activates only the target
78
- page and keeps every other eligible page out of the pending batch. If upstream
79
- content changes, the revision becomes a conflict and must be reviewed again.
80
-
81
- Disabling moves active revision pages to Context runtime recovery storage. The
82
- next build uses approved knowledge directly.
@@ -1,70 +0,0 @@
1
- # 文档修订页
2
-
3
- 新工作区默认开启来源约束的编辑修订。它是面向来源可追溯正文的构建阶段,在不修改
4
- 正式知识页、不补写事实的前提下,提高发布内容的知识价值和可读性。
5
-
6
- 初始化时如需关闭:
7
-
8
- ```bash
9
- context init context --no-optimize-docs
10
- ```
11
-
12
- 已有工作区保持当前设置,可显式调整:
13
-
14
- ```bash
15
- context optimize-docs enable
16
- context optimize-docs disable
17
- context status --format json
18
- ```
19
-
20
- 开启后,工作流只规划新增或发生变化的来源 Section。CLI 为每个 Section 枚举机械
21
- 信号和允许动作;Agent 可以保持不变、局部修复、在同一来源边界内重排,或在 CLI
22
- 确认其属于无知识价值内容时省略。只有实际变化的页面才在原文旁生成完整修订页:
23
-
24
- ```text
25
- knowledge/guides/setup.md
26
- knowledge/guides/setup__revision.md
27
- ```
28
-
29
- `__revision.md` 是保留后缀。默认知识发现、结构、检索和包选择都排除修订页;
30
- 校验和构建根据文件名把它关联回同目录原文,并仍按原文件名输出。修订页只额外
31
- 记录无法推导的原文摘要;原文路径和修订 Section 由文件名与正文差异推导。完整修订
32
- 页中未变化的 Section 直接推导为 `keep`;整页都不修改时,运行时只保存一个页级负
33
- 缓存键,不重复保存改写正文或 Section 元数据。
34
-
35
- 局部修复适用于 Markdown、空白、空表格行,以及来源已经说明用途的链接名称。结构
36
- 重排适用于宽表格、长单元格、图片与链接混排或过长段落,但不能跨 Section 搬运事实。
37
- 未回答的问题集合、空占位、没有结论的草稿、重复内容和只有旧稿的 Section 可以省略;
38
- 有答案的问句、有影响和动作的限制、带替代方案的废弃说明仍属于知识。链接目标、图片、
39
- 代码、命令、数字、标识符、条件和来源引用由 CLI 机械保护。事实时效、职责或敏感值不
40
- 明确时,CLI 会把相关 Section 集中列入计划的 `input_requests`,工作流只询问用户一次,
41
- 不会自动省略。
42
-
43
- 机械信号只是审阅线索,不代表最终结论,也不是完整的可读性检查。Agent 必须阅读每个
44
- Section;若对带信号的 Section 选择 `keep`,需要在本次决策中逐段说明信号为何误报,
45
- 或修改为何会损害来源忠实度,并在说明中逐一写出对应的信号 code,供 CLI 机械核对覆盖
46
- 是否完整。CLI 会拒绝没有具体说明或漏掉信号的 `keep`,但这段说明只用于当前决策审计,
47
- 不会写入正式知识、修订页或构建产物。部分信号误报也不能成为整批保持不变的理由。
48
-
49
- 时间、成本、工作量、批次规模或赶进度都不是 `keep`、跳过或延期的有效理由。全托管
50
- 模式下,Agent 应自动完成所有安全的局部修复、结构重排和允许省略,直到当前批次收敛;
51
- 只有确实无法从当前 Section 或来源证据取得的语义信息,才集中向用户询问一次。片段多
52
- 不能降低质量标准,也不能把整批默认判为 `keep`。
53
-
54
- 工作区采集、审核或构建完成后,用户可以直接通过对话要求修正某篇知识。Agent
55
- 先使用标题、正式知识路径或 ViewRef 启动修订:
56
-
57
- ```bash
58
- context revise "<标题、正式知识路径或 ViewRef>" --format json
59
- ```
60
-
61
- CLI 只在目标唯一时创建或复用该页修订,并由 Agent Graph 返回
62
- `route.document-revision.requested`。若有多个候选,Agent 必须依据当前对话选定,
63
- 否则询问用户。Agent 只在已有 `context:section` 内编辑面向读者的正文,不修改来源
64
- 信息、Section 边界和受保护值,随后运行 `context optimize-docs validate`。校验成功后,
65
- 请求自动结束;若产物因此过期,下一条 Route 会直接提示重新构建。即使工作区
66
- 此前关闭了整库文档编译优化,这个入口也只激活目标页面,不会让其他页面进入
67
- 待优化队列。上游内容变化后,旧修订页会成为冲突,不会被静默应用。
68
-
69
- 关闭后,修订页会被移动到 Context 的运行时恢复目录,下一次构建直接使用正式
70
- 知识。
@@ -1,40 +0,0 @@
1
- {
2
- "protocol": "context.indexer.release-capability-manifest/v1",
3
- "package": "@c4a/context-cli",
4
- "version": "0.7.0",
5
- "channel": "latest",
6
- "dist_tag": "latest",
7
- "capabilities": [
8
- {
9
- "id": "host-action-v2",
10
- "state": "ready",
11
- "required_milestone": "0.7.0-preview.1"
12
- },
13
- {
14
- "id": "provider-lifecycle",
15
- "state": "ready",
16
- "required_milestone": "0.7.0-preview.1"
17
- },
18
- {
19
- "id": "code-indexer",
20
- "state": "ready",
21
- "required_milestone": "0.7.0-preview.2"
22
- },
23
- {
24
- "id": "markdown-indexer",
25
- "state": "ready",
26
- "required_milestone": "0.7.0-preview.3"
27
- },
28
- {
29
- "id": "enterprise-overlay-trust",
30
- "state": "ready",
31
- "required_milestone": "0.7.0-rc.1"
32
- },
33
- {
34
- "id": "phase-g-cutover",
35
- "state": "ready",
36
- "required_milestone": "0.7.0"
37
- }
38
- ],
39
- "manifest_digest": "sha256:308607b2f4cd11fbab4e4d6596f00f633e2aed0e60af24f44f0c3fb63efd6c08"
40
- }