@c4a/context 0.6.19 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +2 -2
  3. package/codeIndexPlan.d.ts +34 -0
  4. package/docs/README.md +7 -0
  5. package/docs/README.zh-CN.md +5 -0
  6. package/docs/getting-started.md +30 -24
  7. package/docs/guides/agent-guide.md +41 -46
  8. package/docs/guides/code-indexer-skill-authoring.md +124 -0
  9. package/docs/guides/indexer-provider-and-customization.md +140 -0
  10. package/docs/guides/markdown-indexer-skill-authoring.md +118 -0
  11. package/docs/reference/code-extractors.md +9 -24
  12. package/docs/reference/indexer-provider-protocol.md +808 -0
  13. package/docs/reference/project-api.md +41 -40
  14. package/index.d.ts +47 -1
  15. package/index.js +28010 -3945
  16. package/indexerAgentStepProtocol.d.ts +9391 -0
  17. package/indexerArtifactDependencies.d.ts +689 -0
  18. package/indexerArtifactPolicy.d.ts +335 -0
  19. package/indexerArtifactResult.d.ts +2009 -0
  20. package/indexerAuditFacts.d.ts +66 -0
  21. package/indexerAuditOverrideReadiness.d.ts +27 -0
  22. package/indexerAuditProtocol.d.ts +238 -0
  23. package/indexerAuditRevision.d.ts +726 -0
  24. package/indexerAuditRevisionActions.d.ts +236 -0
  25. package/indexerAuthoringFixture.d.ts +152 -0
  26. package/indexerBaseQuestionAmendment.d.ts +2403 -0
  27. package/indexerBenchmark.d.ts +1062 -0
  28. package/indexerCandidateCompile.d.ts +985 -0
  29. package/indexerCapabilityGroupEvidence.d.ts +129 -0
  30. package/indexerCatalogFallback.d.ts +1262 -0
  31. package/indexerCollectionMapping.d.ts +75 -0
  32. package/indexerContentLayers.d.ts +137 -0
  33. package/indexerContractOverlay.d.ts +879 -0
  34. package/indexerControlledInvocation.d.ts +512 -0
  35. package/indexerControlledProgram.d.ts +12535 -0
  36. package/indexerCoreExports.d.ts +21 -0
  37. package/indexerCustomizationDraft.d.ts +13800 -0
  38. package/indexerCustomizationLadder.d.ts +103 -0
  39. package/indexerDependencyView.d.ts +1610 -0
  40. package/indexerEvidenceAdapterResult.d.ts +504 -0
  41. package/indexerExampleDecision.d.ts +1606 -0
  42. package/indexerExampleIdentity.d.ts +132 -0
  43. package/indexerExampleIdentityAudit.d.ts +70 -0
  44. package/indexerExampleLinkageAudit.d.ts +80 -0
  45. package/indexerGeneratedAuthoringAudit.d.ts +208 -0
  46. package/indexerIncrementalImpact.d.ts +221 -0
  47. package/indexerInventoryDisposition.d.ts +443 -0
  48. package/indexerLayerComposition.d.ts +1652 -0
  49. package/indexerLayoutChange.d.ts +329 -0
  50. package/indexerLayoutProposalSet.d.ts +447 -0
  51. package/indexerLayoutResolver.d.ts +342 -0
  52. package/indexerLayoutTransition.d.ts +247 -0
  53. package/indexerLifecycle.d.ts +53 -0
  54. package/indexerMainLifecycle.d.ts +258 -0
  55. package/indexerMainRunLedger.d.ts +888 -0
  56. package/indexerMainRunProtocol.d.ts +6471 -0
  57. package/indexerMainWorkset.d.ts +2141 -0
  58. package/indexerMaterialAnswer.d.ts +738 -0
  59. package/indexerMaterialAnswerActualization.d.ts +91 -0
  60. package/indexerMaterialAnswerExecutionPlan.d.ts +2887 -0
  61. package/indexerMaterialAnswerFlow.d.ts +63 -0
  62. package/indexerMaterialAnswerLayout.d.ts +76 -0
  63. package/indexerMaterialAnswerReview.d.ts +217 -0
  64. package/indexerMaterialAnswerReviewRoute.d.ts +6145 -0
  65. package/indexerMaterialAnswerRunLedger.d.ts +918 -0
  66. package/indexerMaterialAnswerRunProtocol.d.ts +1253 -0
  67. package/indexerMaterialGapLedger.d.ts +3111 -0
  68. package/indexerMaterialQuestionExclusion.d.ts +129 -0
  69. package/indexerMaterialQuestionWorkset.d.ts +508 -0
  70. package/indexerNavigationArtifactGraph.d.ts +5 -0
  71. package/indexerNavigationArtifactPlan.d.ts +39 -0
  72. package/indexerOverlayQuestionAmendment.d.ts +2551 -0
  73. package/indexerOverlayQuestionApplyProposal.d.ts +4697 -0
  74. package/indexerParserCoordinate.d.ts +222 -0
  75. package/indexerParserFactView.d.ts +503 -0
  76. package/indexerPartitionConvergence.d.ts +496 -0
  77. package/indexerPartitionPlan.d.ts +919 -0
  78. package/indexerPartitionStrategyResolution.d.ts +594 -0
  79. package/indexerPhysicalArtifactAudit.d.ts +247 -0
  80. package/indexerPhysicalArtifactManifest.d.ts +449 -0
  81. package/indexerPlannedMaterialAnswer.d.ts +116 -0
  82. package/indexerPostAuthorComposition.d.ts +2000 -0
  83. package/indexerPostAuthorRunLedger.d.ts +1972 -0
  84. package/indexerPrimaryProjection.d.ts +262 -0
  85. package/indexerProfileContract.d.ts +3034 -0
  86. package/indexerProfileMetricAudit.d.ts +218 -0
  87. package/indexerProgramExecutionAuthorization.d.ts +227 -0
  88. package/indexerProgramRunProtocol.d.ts +7642 -0
  89. package/indexerProjectProposal.d.ts +2807 -0
  90. package/indexerProjectedArtifactFanOutAudit.d.ts +159 -0
  91. package/indexerProjectedArtifactPlan.d.ts +217 -0
  92. package/indexerProtocolCommon.d.ts +29 -0
  93. package/indexerProvider.d.ts +2510 -0
  94. package/indexerProviderComposition.d.ts +1357 -0
  95. package/indexerProviderContractReferences.d.ts +13 -0
  96. package/indexerProviderProfileResolution.d.ts +20 -0
  97. package/indexerProviderResolution.d.ts +752 -0
  98. package/indexerProviderResolutionAction.d.ts +678 -0
  99. package/indexerProviderRouting.d.ts +3909 -0
  100. package/indexerProviderSelectionProposal.d.ts +3311 -0
  101. package/indexerQuestionAuthority.d.ts +419 -0
  102. package/indexerReaderTargetInventory.d.ts +161 -0
  103. package/indexerReferenceOnlyAudit.d.ts +90 -0
  104. package/indexerRegistry.d.ts +3019 -0
  105. package/indexerRequirementComparison.d.ts +44 -0
  106. package/indexerRequirementConfirmation.d.ts +1193 -0
  107. package/indexerRequirementLifecycle.d.ts +3314 -0
  108. package/indexerRestrictedSelector.d.ts +63 -0
  109. package/indexerResultReconciliation.d.ts +6844 -0
  110. package/indexerResultReconciliationRun.d.ts +15 -0
  111. package/indexerRunEnvelope.d.ts +384 -0
  112. package/indexerRunProtocolCommon.d.ts +21 -0
  113. package/indexerSharedArtifactFingerprint.d.ts +33 -0
  114. package/indexerStructuredDeclaration.d.ts +513 -0
  115. package/indexerSubjectCatalog.d.ts +230 -0
  116. package/indexerSubjectIdentity.d.ts +19 -0
  117. package/indexerSubjectKeyAuthority.d.ts +785 -0
  118. package/indexerTemplateRendering.d.ts +485 -0
  119. package/indexerToolSnapshot.d.ts +431 -0
  120. package/indexerWorksetRead.d.ts +287 -0
  121. package/package.json +1 -1
  122. package/phases.d.ts +1 -1
package/README.md CHANGED
@@ -86,9 +86,9 @@ maintain this declaration from the user's requirements.
86
86
  |---|---|
87
87
  | `defineProject()` | Declares the complete project graph. |
88
88
  | `source()` and `allSources()` | References registered repo, file, or Lark source boundaries. |
89
- | `extractTs()` | Extracts TypeScript/TSX symbols and relationships into `codeindex` candidates. |
89
+ | `extractTs()` | Extracts TypeScript/JavaScript and TSX/JSX symbols and relationships into `codeindex` candidates. |
90
90
  | `extractCustom()` | Runs a project-owned code extractor while Context owns candidate, evidence, freshness, and Review state. |
91
- | `alignProse()` and `compileProse()` | Structures document evidence and compiles source-bound knowledge candidates. |
91
+ | `alignProse()` and `compileProse()` | Legacy explicit phase factories retained for existing workspace migration and repair. New workspaces use `src/indexers.yaml` and the Context Indexer lifecycle. |
92
92
  | `reviewValidity()` | Declares the review gate for one collection or the project. |
93
93
  | `customPhase()` | Adds project-specific orchestration when built-in phase factories are not enough. |
94
94
  | `kbPackage()` | Builds an Agent knowledge-base package from approved knowledge and templates. |
package/README.zh-CN.md CHANGED
@@ -80,9 +80,9 @@ Route 会按需选择维护这份声明所需的操作说明、Schema 和手册
80
80
  |---|---|
81
81
  | `defineProject()` | 声明完整的项目处理图。 |
82
82
  | `source()` 和 `allSources()` | 引用已经登记的代码仓库、本地文件或飞书来源边界。 |
83
- | `extractTs()` | 从 TypeScript/TSX 中提取符号和关系,生成 `codeindex` 候选。 |
83
+ | `extractTs()` | 从 TypeScript/JavaScript 与 TSX/JSX 中提取符号和关系,生成 `codeindex` 候选。 |
84
84
  | `extractCustom()` | 运行项目自有代码提取器,同时由 Context 维护候选、证据、新鲜度和审核状态。 |
85
- | `alignProse()` 和 `compileProse()` | 整理文档证据,并生成与来源绑定的知识候选。 |
85
+ | `alignProse()` 和 `compileProse()` | 仅为既有工作区迁移和修复保留的显式阶段工厂;新工作区使用 `src/indexers.yaml` 与统一 Indexer 生命周期。 |
86
86
  | `reviewValidity()` | 声明单个知识类型或整个项目的审核门禁。 |
87
87
  | `customPhase()` | 在内置阶段无法覆盖时增加项目专用编排。 |
88
88
  | `kbPackage()` | 使用审核通过的知识和模板构建 Agent 知识库。 |
@@ -53,6 +53,34 @@ export interface CodeIndexCapabilityGap {
53
53
  reason: string;
54
54
  requestedMaterial?: string;
55
55
  }
56
+ export interface CodeIndexIdentityGroup {
57
+ id: string;
58
+ /** Stable target identities represented by one reader-facing capability group. */
59
+ members: readonly string[];
60
+ /** Reader-facing page that explains the common responsibility of the members. */
61
+ viewRef: string;
62
+ /** Eligible source files that prove the group membership. */
63
+ sourceFiles: readonly string[];
64
+ }
65
+ export type CodeIndexChainCandidateFamily = "entry-operation" | "operation-handler" | "handler-downstream" | "event-processing" | "command-effect" | "export-implementation" | "cross-source-handoff";
66
+ export interface CodeIndexChainCandidate {
67
+ id: string;
68
+ family: CodeIndexChainCandidateFamily;
69
+ from: string;
70
+ to: string;
71
+ sourceFiles: readonly string[];
72
+ confidence: "structural" | "declared" | "ambiguous";
73
+ }
74
+ export interface CodeIndexChainCandidateDecision {
75
+ candidateId: string;
76
+ decision: "document" | "merge" | "exclude" | "request-input";
77
+ /** Required for document decisions and must identify the reader-facing chain page. */
78
+ viewRef?: string;
79
+ /** Required when an equivalent candidate is merged into a canonical chain. */
80
+ canonicalChainId?: string;
81
+ /** Required for exclude and request-input decisions. */
82
+ reason?: string;
83
+ }
56
84
  /** Complete source inventory returned by a project adapter for mechanical quality scoring. */
57
85
  export interface CodeIndexInspectionInventory {
58
86
  indexUnitId: string;
@@ -92,6 +120,12 @@ export interface CodeIndexInspectionInventory {
92
120
  kind: "entry" | "export" | "route" | "operation" | "handler" | "downstream" | "command" | "event" | "plugin" | "handoff";
93
121
  identity: string;
94
122
  }[];
123
+ /** Source-constrained groups that cover target identities without listing every member in prose. */
124
+ identityGroups?: readonly CodeIndexIdentityGroup[];
125
+ /** Static or declared chain candidates discovered during source inspection. */
126
+ chainCandidates?: readonly CodeIndexChainCandidate[];
127
+ /** Explicit disposition for every discovered chain candidate. */
128
+ chainCandidateDecisions?: readonly CodeIndexChainCandidateDecision[];
95
129
  excludedFiles: number;
96
130
  /** Complete identities deliberately excluded after discovery. */
97
131
  excludedFileTargets: readonly string[];
package/docs/README.md CHANGED
@@ -25,6 +25,9 @@ preload the whole manual set.
25
25
  | Understand the whole knowledge-project shape | [Getting Started](./getting-started.md) |
26
26
  | Know what the Agent may decide or change | [Agent Guide](./guides/agent-guide.md) and [Agent Dialogue](./guides/agent-dialogue.md) |
27
27
  | Configure sources, phases, review, or packages | [Project API](./reference/project-api.md) |
28
+ | Author or inspect an Indexer Provider protocol | [Indexer Provider Protocol](./reference/indexer-provider-protocol.md) |
29
+ | Select or customize an Indexer Provider | [Provider Selection and Customization](./guides/indexer-provider-and-customization.md) |
30
+ | Author a Code or Markdown Indexer Skill | [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) and [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md) |
28
31
  | Choose a code extraction path | [Code Extractor Selection](./reference/code-extractors.md) |
29
32
  | Choose an Agent package or LLM document | [Package Outputs](./guides/package-outputs.md) |
30
33
  | Customize package files and indexes | [Package Templates](./reference/package-templates.md) and [Template Variables](./reference/template-variables.md) |
@@ -38,6 +41,10 @@ preload the whole manual set.
38
41
  - [Package Outputs](./guides/package-outputs.md) — how to choose between an agent knowledge-base package, LLM text, or no package output.
39
42
  - [Lark Resource Materialization](./guides/lark-resources.md) — how embedded resources move from source evidence to approved knowledge and package assets.
40
43
  - [Project API](./reference/project-api.md) — `defineProject`, sources, phases, review, and packages.
44
+ - [Indexer Provider Protocol](./reference/indexer-provider-protocol.md) — manifest, controlled execution, detector/inspector I/O, customization, and staged project apply.
45
+ - [Provider Selection and Customization](./guides/indexer-provider-and-customization.md) — registry-only selection, the six-level customization ladder, upgrade conflicts, debugging, and completion conditions.
46
+ - [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) — the 23-point Provider Skill release contract and anonymous fixture expectations.
47
+ - [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md) — capture/semantic boundaries, Section placement, material answers, editorial policy, and local incremental behavior.
41
48
  - [Code Extractor Selection](./reference/code-extractors.md) — inspect module technology signals and choose a built-in extractor, reusable structural package, or project adapter.
42
49
  - [Package Templates](./reference/package-templates.md) — `kbPackage`, `llmsPackage`, template variables, and examples.
43
50
  - [Template Variables](./reference/template-variables.md) — Handlebars variables, loops, comments, and default knowledge inventories.
@@ -16,6 +16,8 @@
16
16
  | 理解完整知识项目的形态 | [Getting Started](./getting-started.md) |
17
17
  | 判断 Agent 可以决定或修改什么 | [Agent Guide](./guides/agent-guide.md) 和 [Agent Dialogue](./guides/agent-dialogue.md) |
18
18
  | 配置来源、阶段、审核或产物 | [Project API](./reference/project-api.md) |
19
+ | 选择或定制 Indexer Provider | [Provider Selection and Customization](./guides/indexer-provider-and-customization.md) |
20
+ | 编写 Code/Markdown Indexer Skill | [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) 和 [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md) |
19
21
  | 选择代码提取方式 | [Code Extractor Selection](./reference/code-extractors.md) |
20
22
  | 选择 Agent 知识包或 LLM 文档 | [Package Outputs](./guides/package-outputs.md) |
21
23
  | 自定义包文件和索引 | [Package Templates](./reference/package-templates.md) 和 [Template Variables](./reference/template-variables.md) |
@@ -29,6 +31,9 @@
29
31
  - [Package Outputs](./guides/package-outputs.md):如何选择 Agent 知识包、LLM 文本或不构建产物。
30
32
  - [Lark Resource Materialization](./guides/lark-resources.md):内嵌资源如何从来源证据进入正式知识和知识包。
31
33
  - [Project API](./reference/project-api.md):`defineProject`、来源、阶段、审核和知识包声明。
34
+ - [Provider Selection and Customization](./guides/indexer-provider-and-customization.md):registry-only 选择、六级最小定制阶梯、升级冲突、调试与退出条件。
35
+ - [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md):Code Provider Skill 的 23 项作者/发布契约。
36
+ - [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md):capture/semantic 边界、Section 投影、material answer、编辑策略与局部增量。
32
37
  - [Code Extractor Selection](./reference/code-extractors.md):如何根据技术信号选择内建提取器、结构库或项目适配器。
33
38
  - [Package Templates](./reference/package-templates.md):`kbPackage`、`llmsPackage`、模板变量和示例。
34
39
  - [Template Variables](./reference/template-variables.md):Handlebars 变量、循环、注释和默认知识清单。
@@ -81,12 +81,14 @@ processor, confirm the source boundary and add the processor before capture.
81
81
  If the selected page is only a runtime shell, capture the rendered-site source
82
82
  or project-specific data source explicitly; do not ask the agent to invent
83
83
  missing body text. The concrete command shape is available from
84
- `context source add file --help`; after registration, declare `captureFile`,
85
- `alignProse`, `compileProse`, and `reviewValidity`.
84
+ `context source add file --help`; after registration, declare `captureFile`
85
+ and `reviewValidity`, then let the Context Indexer lifecycle create the
86
+ confirmed requirements and exact Provider registry in `src/indexers.yaml`.
86
87
 
87
88
  For a Lark / Feishu document, register a Lark source with exactly one identity
88
- form, then declare `captureLark`, `alignProse`, `compileProse`, and
89
- `reviewValidity`.
89
+ form, then declare `captureLark` and `reviewValidity`. Do not add
90
+ `alignProse`/`compileProse` to a new workspace; those factories remain only for
91
+ explicit migration and repair of older declarations.
90
92
 
91
93
  File and Lark sources use the same date-batch shape as repo sources. Multiple
92
94
  documents belong under one date instead of receiving `-2` / `-A` suffixes:
@@ -140,17 +142,17 @@ of returning an unexecutable command. Read every
140
142
  semantic rules remain available as files and are loaded only for the route that
141
143
  needs them.
142
144
 
143
- After capture, status selects `route.document.classification-required` for
144
- document modules without an align declaration. Run the Gate's returned
145
- collection-neutral inspection commands first; only then propose a mainline
146
- collection and ask for confirmation. Batch read permission does not choose a
147
- collection.
145
+ After capture, status selects `route.indexer.lifecycle-required`. Follow its
146
+ `run-indexer-lifecycle` resource and the exact `context indexer ...` outcomes:
147
+ confirm the complete requirement set, discover and resolve an exact Markdown
148
+ Provider, execute its evidence-bound worksets, reconcile/layout/audit the
149
+ Result, and compile the current Candidate batch. Batch read permission does
150
+ not choose requirements, a Provider, or a collection.
148
151
 
149
152
  When the workspace also contains repo sources, Context prioritizes untouched
150
- code after all document captures finish: the current reason is
151
- `route.extract.pending-target` until the code extraction round is current,
152
- then routing returns to document investigation. An existing document
153
- structure/compile gate is never interrupted.
153
+ code and document owner cells through that same Indexer Route. It does not
154
+ switch to a second extraction or prose lifecycle and does not interrupt an
155
+ accepted workset that is already durably recorded.
154
156
 
155
157
  For a single component package, use the package directory as the repo source
156
158
  boundary:
@@ -221,15 +223,14 @@ current Route rather than duplicating them in the project Skill.
221
223
 
222
224
  ### Document Source Flow
223
225
 
224
- For source documents, keep the project declaration small and let the CLI guide
225
- the evidence views, structure confirmation, deterministic compile projection,
226
- review, and close steps:
226
+ For source documents, keep the project declaration small. `src/index.ts`
227
+ declares the trusted source/capture/review/package surface; the confirmed
228
+ requirements and exact Provider selection live separately in
229
+ `src/indexers.yaml`:
227
230
 
228
231
  ```ts
229
232
  import {
230
- alignProse,
231
233
  captureFile,
232
- compileProse,
233
234
  defineProject,
234
235
  reviewValidity,
235
236
  source,
@@ -241,9 +242,7 @@ export default defineProject({
241
242
  sources: [docs],
242
243
  phases: [
243
244
  captureFile({ source: docs }),
244
- alignProse({ source: docs, collection: "architecture" }),
245
- compileProse({ source: docs, collection: "architecture" }),
246
- reviewValidity({ collection: "architecture" }),
245
+ reviewValidity({ scope: "all" }),
247
246
  ],
248
247
  packages: [],
249
248
  });
@@ -254,11 +253,18 @@ Then return to the installed Context Agent entry. For maintainer inspection,
254
253
  sequence is:
255
254
 
256
255
  1. capture the source into committed snapshots;
257
- 2. investigate evidence and confirm the CLI-managed lifecycle structure;
258
- 3. compile every source-bound View from confirmed structure;
259
- 4. review/apply the complete candidate batch once;
256
+ 2. confirm requirements and resolve exact Code/Markdown Providers through the
257
+ sole Indexer Route;
258
+ 3. execute and reconcile evidence-bound worksets, then derive layout and audit
259
+ the Result;
260
+ 4. compile and review/apply the complete Indexer Candidate batch once;
260
261
  5. run close once, then verify and build when packages are declared.
261
262
 
263
+ See [Indexer Provider selection and customization](./guides/indexer-provider-and-customization.md)
264
+ for the registry and Provider flow. Existing workspaces that still declare
265
+ `alignProse`/`compileProse` may use their explicit diagnostic commands during
266
+ migration, but Context does not select them as the default workflow.
267
+
262
268
  Do not read `sources/` or raw Markdown directly after entering the Context
263
269
  workflow; use the evidence views and `source_ref` values returned by the CLI.
264
270
 
@@ -122,12 +122,11 @@ Present only the current workflow surface:
122
122
  |---|---|
123
123
  | Register a knowledge boundary | `context source add file/lark/repo ...`, followed by the matching project phase declaration. Source registration is a user-confirmed boundary decision. |
124
124
  | Capture document sources | Run the declared `capture:file:<date>/<module>` or `capture:lark:<date>/<module>` phase only after read permission. Capture writes a sibling document file under the matching date directory, updates that directory's single `manifest.json`, and mechanically materializes supported Lark resources. Do not download or rewrite embedded resources outside the CLI. |
125
- | Investigate captured material | Use `context status` and the returned `context run align:<type>:<source>:<collection> --view ...` commands. Evidence views drive reading; raw directory grep is not the workflow. |
126
- | Confirm prose structure | `alignProse` validates and stages CLI-managed lifecycle structure. Validation does not equal user confirmation; only confirmed lifecycle state may enter prose compile. |
127
- | Compile source-bound drafts | `compileProse` turns confirmed structure into source-bound draft pages. It does not approve knowledge. |
128
- | Review and apply | Use `context review html` and `context review apply`. Approved prose pages are source-mirrored; rewrite/compression problems should return to structure/compile repair before apply. |
125
+ | Investigate captured material | Follow `route.indexer.lifecycle-required` and its `run-indexer-lifecycle` resource. Use only the evidence views and `context indexer ...` commands returned by the current subroute; raw directory grep is not the workflow. |
126
+ | Index documents and code | Confirm requirements, resolve exact Providers, execute/recover worksets, reconcile Results, derive layout, audit, and compile the current Indexer Candidate batch. There is no separate default extraction, classification, align, or structure-confirmation route. |
127
+ | Review and apply | Use `context review html` and `context review apply`. Approved pages retain their exact Indexer Result/evidence binding; quality problems return to the affected Indexer revision before apply. |
129
128
  | Close, verify, build | Run `context close`, `context verify`, then `context build`. Close derives `knowledge/structure.yaml`, approved edge projection, and the final verify gate. |
130
- | Code extraction | Use `context source inspect <source-name>` and the declared extract phase preview before code draft writes. |
129
+ | Code evidence | The Code Indexer uses registered parser capabilities and evidence adapters through the same Indexer Route. Legacy explicit extract phases are migration/repair entrypoints, not the default workflow. |
131
130
  | Source retraction | Follow the current status or lifecycle command if one exists. Do not delete `sources/`, `knowledge/`, `dist/`, or `.tmp` to simulate lifecycle actions. |
132
131
 
133
132
  Judgment behavior is part of evidence views, source span resolvers, repair
@@ -197,9 +196,10 @@ workspace-relative repo root plus `subpath`; do not rewrite it back to an
197
196
  absolute machine path. Local Markdown/MDX sources
198
197
  are registered with `context source add file [YYYYMMDD] --module <module> --local <path>` plus any
199
198
  needed `--include` patterns, captured with `captureFile`, then planned through
200
- `alignProse` and compiled with
201
- `compileProse`. A one-file-to-one-page outcome is a degenerate structure plan,
202
- not a separate content path. Remote Git operations require explicit user approval before any
199
+ the confirmed requirement set and exact Markdown Indexer registry in
200
+ `src/indexers.yaml`. Artifact and Section layout is derived from the validated
201
+ Provider Result; it does not require a default align/structure-confirmation
202
+ round. Remote Git operations require explicit user approval before any
203
203
  clone/checkout; clone into an ignored local path, checkout the requested commit,
204
204
  then register that local checkout. Do not commit cloned source content. Lark /
205
205
  Feishu sources are registered as document modules under a shared date batch,
@@ -238,47 +238,37 @@ revision-bound Context command and read the returned file. Long procedures and
238
238
  semantic rules live in these resources; they are loaded progressively, not
239
239
  discarded or shortened into the status response.
240
240
 
241
- Status also returns `declarationGraph` and `configurationGaps`. These expose
242
- capture, align, compile, and Review coverage for each canonical document source
243
- and declared align collection. Missing declarations are early warnings while
244
- structure is still being planned; after confirmation, every collection planned
245
- by the structure must have an exact compile route for the same source. Do not
246
- run a compile command from another collection as a fallback. A
247
- `reviewValidity({ scope: "all" })` declaration covers every collection.
248
-
249
- When `workflow.current.reason_code` is
250
- `route.document.classification-required`, execute its read-only
251
- `inspection_action` commands before adding align/compile declarations. Inspect
252
- every unclassified target, explain the evidence behind the proposed mainline
253
- collection, and wait for user confirmation. Filenames, URLs, source titles,
254
- and collection names are hints, not sufficient classification evidence.
255
-
256
- Also inspect `pendingStructureTargets`. A non-empty list means captured document
257
- work remains outside the active structure snapshots, even if the current package
258
- is already built. Follow `needs-prose-configuration` first when declarations are
259
- missing, then run the exact returned align command. Continue in the same
260
- workspace; do not replace a valid earlier structure round or create a second
261
- workspace merely to add the next document. Missing declarations are selected
262
- by `route.prose.configuration-required`; do not branch on an old top-level
263
- `needs-prose-configuration` state.
264
-
265
- Use `structureBatch` for the complete multi-source slot overview. Evidence View
266
- commands are workspace-read-only and parallel-safe; structure stage/confirm,
267
- compile stage, Review apply, and close mutate workspace state and must run
268
- serially.
269
-
270
- The confirmation and Review scopes are different: confirm each canonical source
271
- plus collection structure slot independently, but do not open Review while
272
- another declared slot remains pending in the same round. Compile every View from
273
- all slots first, open one collection-level Review, and let deterministic close
274
- merge the active slots into `knowledge/structure.yaml`.
241
+ Status also returns `declarationGraph` and `configurationGaps`. For new
242
+ workspaces, use them to diagnose source/capture/review/package declarations;
243
+ requirements, owner cells, Provider selection, worksets, audit, and Candidate
244
+ progress come from the Indexer lifecycle. `reviewValidity({ scope: "all" })`
245
+ covers the unified Candidate batch.
246
+
247
+ When `workflow.current.reason_code` is `route.indexer.lifecycle-required`, read
248
+ the selected lifecycle resource and follow the first structured Indexer
249
+ outcome. Do not invent a collection from filenames, URLs, source titles, or old
250
+ align declarations. The confirmed requirement set and exact Provider registry
251
+ are the durable authority.
252
+
253
+ Indexer evidence reads may be parallel when the current worksets and Host permit
254
+ it. Ledger transitions, Candidate compile, Review apply, and close mutate
255
+ workspace state and must follow their exact CAS-bound commands. Do not open
256
+ Review until every required owner cell has an accepted current Result and the
257
+ batch audit is ready.
275
258
 
276
259
  Do not infer permission from the presence of a command. When
277
260
  `workflow.current.commands` is empty, do not derive a lifecycle command from
278
261
  prose; complete the returned `configuration` action or resolve the returned
279
262
  gate, then rerun status.
280
263
 
281
- Extraction scope is also a human gate. If no extract phase is declared, explain
264
+ ## Legacy Explicit Code Extraction Commands
265
+
266
+ The following `extractTs`/`extractCustom` route applies only when maintaining an
267
+ existing project that still declares an explicit extraction phase. New
268
+ workspaces express code ownership and scope as Indexer requirements and use the
269
+ Code Indexer through `route.indexer.lifecycle-required`.
270
+
271
+ For an existing explicit phase, extraction scope is a human gate. If no extract phase is declared, explain
282
272
  what code area and symbol policy will become draft knowledge, then ask which
283
273
  registered source and file/symbol range to ingest. Do not inspect the source
284
274
  repository to choose packages or globs on the user's behalf. The
@@ -390,10 +380,15 @@ count packages, parse `package.json`, or sample the lifecycle candidate ledger.
390
380
  These commands still enforce the scoped candidate-id gate.
391
381
  - Do not edit approved Markdown by hand as part of review apply.
392
382
 
393
- ## Prose Align And Compile Rules
383
+ ## Legacy Prose Migration And Repair Commands
384
+
385
+ `alignProse` and `compileProse` remain callable for existing workspace
386
+ migration, explicit diagnostics, and repair. They are not selected by the
387
+ default Graph and must not be added to a new project as an alternate indexing
388
+ workflow. Use the commands below only when the current CLI explicitly returns
389
+ one of these legacy phase ids.
394
390
 
395
- After document capture, do not ask the user to choose an SDK path. Explain the
396
- product sequence:
391
+ For such an existing declaration, the compatibility sequence is:
397
392
 
398
393
  1. investigate material through Context evidence views;
399
394
  2. propose a structure draft with nodes, section plans, supported edges, and
@@ -0,0 +1,124 @@
1
+ # Code Indexer Skill authoring
2
+
3
+ This guide defines the release checklist for a Code Indexer Provider Skill.
4
+ It does not reproduce Context's internal Agent Graph lifecycle. The Provider
5
+ receives validated requirements, scopes, worksets and evidence views and
6
+ returns only its declared structured Results/fragments.
7
+
8
+ ## Minimal package
9
+
10
+ Use one `context-indexer.yaml` with protocol
11
+ `context.indexer.provider/v1`. Give the Skill a SemVer version and publish the
12
+ complete Bundle with a reproducible integrity digest. Instructions, templates,
13
+ fixtures and portable program entries live below the Skill root. Do not invent
14
+ source-specific manifest names or a second schema tree.
15
+
16
+ Programs use a structured `runtime: node`, portable `entry` and literal `args`.
17
+ They never use a free-form command. A detector only reports activation signals;
18
+ an inspector only returns bounded evidence/enrichment. Neither is a hard-gate
19
+ authority. CLI profile contracts and verified data-only overlays own mechanical
20
+ rules, metric operators and thresholds.
21
+
22
+ ## Author contract checklist
23
+
24
+ 1. **Responsibility.** Classify supported code modules and produce evidence-
25
+ bound partitions, logical units, Artifact Bundles and Results. Do not own
26
+ source authorization, requirement approval, final review, CLI metrics or
27
+ package publication.
28
+ 2. **Manifest.** Use the sole `context-indexer.yaml` field tree. Bind domains,
29
+ profiles, operations/fragments, resources, source roles, logical units,
30
+ customization support and composition without duplicate aliases.
31
+ 3. **Resource composition.** Combine only declared programs, profile-bound
32
+ instructions, templates and optional detector/inspector resources. Omitted
33
+ capabilities remain unsupported; natural language cannot add them.
34
+ 4. **Activation and profiles.** Declare strong/supporting/negative signals.
35
+ Dependency names are candidates, not runtime proof. One module may combine
36
+ one primary profile with supporting/extensions and selected composers.
37
+ 5. **Sources and Artifacts.** Declare source roles and logical-unit intent;
38
+ select only CLI-registered Artifact kinds/policy variants. Keep logical unit
39
+ identity separate from physical Artifact count.
40
+ 6. **Inventory protocols.** Close every input member with an explicit
41
+ disposition. Use stable aggregation, full-path example identity and
42
+ structured chain decisions; do not substitute page prose for inventory.
43
+ 7. **Metrics.** Reference registered metric ids and revision guidance. The CLI
44
+ alone owns recommended ranges, `inflation-sensitive` 150% enforcement and
45
+ mechanical audit results; a Provider cannot return a pass or threshold.
46
+ 8. **Revision boundary.** Use metric-specific revisions for at most the Route-
47
+ supplied attempts. After three failed attempts, report the complete issue
48
+ set for the human Gate. Forced approval cannot bypass base integrity rules.
49
+ 9. **Reader questions.** Declare reusable question templates with stable refs,
50
+ target domains and allowed evidence contracts. Do not make a question id
51
+ globally unique to one SubjectKey group.
52
+ 10. **Inspector safety.** Accept only the versioned stdin request and bounded
53
+ authorized evidence view; emit strict JSON within limits. Never read the
54
+ repository, environment or network implicitly, and never expose raw
55
+ config values, secrets or unbounded stderr/stdout.
56
+ 11. **Base gates.** Do not reduce source scope integrity, identity, evidence,
57
+ requirement, disposition, reference-only or provenance gates. Provider
58
+ integrity identifies content; it does not grant pass authority.
59
+ 12. **Anonymous fixtures.** Cover at least a component library, Web app, API
60
+ service, SDK/library and runtime/worker with neutral paths and identifiers.
61
+ 13. **Release tests.** Validate the manifest/resource ledger, run positive and
62
+ negative fixtures, forward-test the complete Skill, pack it, reinstall the
63
+ exact artifact and compare Bundle bytes/digest.
64
+ 14. **Content ownership.** Public technology belongs in the community Skill;
65
+ company-wide infrastructure belongs in a separate namespaced Provider;
66
+ repository, service, team and business mappings belong in business/project
67
+ Providers. Community fixtures remain anonymous.
68
+ 15. **Marketplace layout.** Archives keep one top-level Skill directory with
69
+ `SKILL.md`, the manifest and referenced runtime resources. Exclude tests,
70
+ caches, credentials, local paths and Host-specific temporary manifests.
71
+ 16. **Material handoff.** Return structured material questions when required
72
+ evidence is missing. Bind owner cell, question contract, Subject target and
73
+ intended landing. Never render gaps as empty pages or speculative prose;
74
+ Context owns the retained ledger, checkpoints, reconciliation and any
75
+ Markdown answer run.
76
+ 17. **Backend profiles.** Test neutral RPC/HTTP, Gateway, Event/function,
77
+ Cron/worker, sync/reconciliation, stateful service/storage and library
78
+ shapes. Local facts remain baseline when optional remote metadata is absent.
79
+ 18. **Versioning.** Use Skill/Provider SemVer, exact Provider pins and Bundle
80
+ integrity. Fixed dependencies require exact versions and resolved
81
+ integrity. `@context-indexer-origin` is optional on local customizations
82
+ only and grants no authority.
83
+ 19. **Trust boundary.** Skill/manifest describes capabilities; the verified
84
+ Bundle supplies bytes; workspace customization supplies project deltas;
85
+ CLI contracts supply hard rules. Keep these four authorities distinct.
86
+ 20. **Requirement direction.** `IndexRequirementSet` constrains registry,
87
+ extractor and Result in one direction. Apply requirement/registry changes
88
+ through staged, digest-bound proposals and transactional apply; do not edit
89
+ a live registry around the Route.
90
+ 21. **Program and remote authority.** Programs must pass static policy and the
91
+ applicable trusted/sandbox authorization. Optional remote tools use a
92
+ versioned Host Action, exact source-bound request and readable receipt;
93
+ they never expand scope or perform writes.
94
+ 22. **End-to-end recovery.** Test discovery, exact Provider resolution,
95
+ content-addressed staging, controlled execution, Artifact/Evidence Result
96
+ validation and crash recovery. A resumed run reuses only complete accepted
97
+ records and never infers success from a partial receipt.
98
+ 23. **Customization ladder.** Preserve this order: Provider only → config →
99
+ instructions append → one template override → program extension →
100
+ restricted replace. Document the proof and exit condition at every step;
101
+ see [Provider selection and customization](./indexer-provider-and-customization.md).
102
+
103
+ ## Result and composition rules
104
+
105
+ Exactly one primary layer returns a complete partition/author Result for an
106
+ operation. Pre-author extensions return only declared fragments and cannot
107
+ change ownership, denominator or Subject identity. Post-author composers bind
108
+ one current `PrimaryResultView` and return only a derived proposal fragment;
109
+ an empty composer run still has a receipt. Composer selection is the
110
+ intersection of registry selection, manifest declaration and current profile
111
+ applicability, not array order.
112
+
113
+ Use canonical SubjectKey schemas and the Context NodeRef formula. Code and
114
+ Markdown Indexers must reuse the same Node when the SubjectKey is equal. An
115
+ enricher uses the supplied TargetResolutionView (`resolved`, `absent` or
116
+ `ambiguous`) and never guesses identity from a title or path resemblance.
117
+
118
+ ## Publication gate
119
+
120
+ Do not publish until the exact packed artifact passes manifest/schema
121
+ validation, anonymous positive/negative fixtures, no-scope-expansion and
122
+ secret-leak tests, deterministic Bundle reconstruction, exact-version install,
123
+ controlled execution and forward tests. Publishing a new version does not make
124
+ existing workspace pins current; workspace selection must re-resolve it.
@@ -0,0 +1,140 @@
1
+ # Indexer Provider selection and customization
2
+
3
+ This guide is for workspace users and Agents selecting Code or Markdown
4
+ Indexer Providers. Provider authors should also read the dedicated
5
+ [Code Indexer](./code-indexer-skill-authoring.md) or
6
+ [Markdown Indexer](./markdown-indexer-skill-authoring.md) authoring guide.
7
+
8
+ Context is registry-only by default. The durable selection lives in
9
+ `src/indexers.yaml`; `package.json`, discovered Skill paths, Host cache paths,
10
+ resolved transport paths and runtime staging directories are not selection
11
+ authority. A Provider-only project does not create `src/indexer/`.
12
+
13
+ ## Selection flow
14
+
15
+ 1. Inspect and confirm the complete `IndexRequirementSet`. A Provider,
16
+ registry entry or Result may strengthen it but cannot remove targets,
17
+ questions, evidence obligations or required owner cells.
18
+ 2. Run `context indexer catalog --format json` and report those CLI-bundled
19
+ entry Skills together with Indexer Skills already visible to the Host.
20
+ When the Host exposes an exact Skill root, read only its `SKILL.md`
21
+ frontmatter and sibling `context-indexer.yaml`; the manifest version is
22
+ authoritative and `metadata.context-provider-version` must match it. Group
23
+ the same Skill name and exact version into one conversational item with all
24
+ observed source types. An installed projection of an identical CLI-bundled
25
+ identity is not a second Provider; different versions remain distinct. Do
26
+ not scan `.claude`, `.codex`, `.agents` or arbitrary user directories.
27
+ 3. Route the path-free visible identities with
28
+ `context indexer route-indexer-provider-selection`. Try the applicable
29
+ community fallback once when the Route requests it.
30
+ 4. Statically validate the returned selection proposal before a Host resolves
31
+ any Bundle. Resolve only the emitted exact requests, then stage and validate
32
+ the complete content ledger.
33
+ 5. Apply the registry and any declared customization through the staged,
34
+ CAS-bound project proposal. A successful static report is not write or
35
+ execution authority.
36
+
37
+ Every required requirement/domain/source/module cell has exactly one primary
38
+ owner. Read scope may overlap for supporting profiles, extensions and
39
+ enrichers. Array order is never precedence. Each Provider layer retains its own
40
+ exact version, integrity, portable distribution, config and resource
41
+ fingerprints.
42
+
43
+ ## Six-level customization ladder
44
+
45
+ Use the first level that closes the CLI-proven capability gap. Do not start at
46
+ a more powerful level because it is convenient.
47
+
48
+ | Level | Change | Entry evidence | Exit condition |
49
+ | --- | --- | --- | --- |
50
+ | 1. Provider only | Select an existing exact Provider/profile | The confirmed requirements are fully owned by declared capabilities | Final selection validation passes and no project customization files exist |
51
+ | 2. Config | Select declared variants, resources or data-only options | The manifest exposes a closed config schema that covers the difference | Config validates; no instruction, template or program change is needed |
52
+ | 3. Instructions append | Add bounded project guidance | The gap is semantic guidance and does not change contracts, scope, identity, denominators or hard rules | Appended resource closes the gap and the origin/version fingerprint is retained |
53
+ | 4. Template override | Replace one declared template for one profile | The Artifact policy is already valid; only reader organization/rendering differs | One exact template id/profile is overridden; unrelated templates remain Provider-owned |
54
+ | 5. Program extension | Add a fixed local program under the declared indexer root | A structured algorithm is required and smaller levels are proven insufficient | Static policy passes and independent program/dependency authorization is complete |
55
+ | 6. Restricted replace | Replace only the capability named by the final gap proof | Extension cannot satisfy the exact owner cells and a human accepts the larger maintenance boundary | Replacement remains requirement-compatible, content-addressed and explicitly reviewable |
56
+
57
+ Levels 3–6 are allowed only after the Route returns
58
+ `indexer-customization-required` with a current `capability_gap_proof`. Copy the
59
+ proof into the draft unchanged. A draft cannot weaken requirements, widen
60
+ source scope, copy a parser, add an evaluator, or claim that it has been
61
+ applied. If no safe level closes the gap, stop instead of emitting a
62
+ conforming-looking file.
63
+
64
+ ## Upgrade and conflict handling
65
+
66
+ Provider upgrades never silently absorb a local override. Re-resolve the exact
67
+ version and Bundle, then compare the new Provider config, instructions,
68
+ templates, program resources, profile/SubjectKey contracts and the local
69
+ customization fingerprint.
70
+
71
+ - An unchanged upstream resource keeps the local override current.
72
+ - A changed resource outside the override makes only its dependent units stale.
73
+ - A changed resource under an instruction/template/program override returns
74
+ `indexer-customization-upstream-changed`; rebase or remove the override.
75
+ - Missing, undeclared, escaping or contract-conflicting local resources return
76
+ `indexer-customization-invalid`.
77
+ - An exact Provider version/integrity that cannot be resolved returns
78
+ `indexer-provider-unavailable`; do not substitute another version or stale
79
+ cache.
80
+ - Multiple primary owners return a conflict for explicit resolution. Do not
81
+ use discovery order or a preferred Provider name as a tie-breaker.
82
+
83
+ The optional `@context-indexer-origin <skill>@<version>` comment records where
84
+ a local customization began. It grants no trust and never bypasses revalidation.
85
+
86
+ ## Outcome handling
87
+
88
+ These outcomes all point back to this guide:
89
+
90
+ | Outcome | Required next action |
91
+ | --- | --- |
92
+ | `indexer-provider-required` | Discover visible entry Skills, route a path-free proposal, and keep the requirement set unchanged. |
93
+ | `indexer-provider-unavailable` | Restore the exact distribution or choose a new Provider through the selection Gate. Never use an approximate version. |
94
+ | `indexer-customization-required` | Follow the six-level ladder using only the returned current gap proof. |
95
+ | `indexer-customization-invalid` | Remove undeclared/escaping/conflicting files, then rebuild and restage the proposal. |
96
+ | `indexer-customization-upstream-changed` | Reconcile the upstream change with every affected override and rerun final validation. |
97
+
98
+ ## Debugging commands
99
+
100
+ Use `--help` for the current payload schema and copy Route-returned commands
101
+ when available:
102
+
103
+ ```bash
104
+ context indexer catalog --format json
105
+ context indexer inspect-index-requirements --help
106
+ context indexer compare-index-requirements --help
107
+ context indexer route-indexer-provider-selection --help
108
+ context indexer validate-indexer-selection-proposal --help
109
+ context indexer resolve-indexer-providers --help
110
+ context indexer stage-indexer-provider-bundle --help
111
+ context indexer validate-indexer-customization --help
112
+ context indexer prepare-indexer-customization-project --help
113
+ context indexer stage-indexer-project-proposal --help
114
+ context indexer apply-indexer-project --help
115
+ context indexer observe-indexer-project --help
116
+ ```
117
+
118
+ Keep full runtime reports under `.tmp/context-runtime/`. Do not persist Bundle
119
+ bytes, resolution receipts, selection discovery, run ledgers or audit reports
120
+ in `src/`, `knowledge/` or `dist/`.
121
+
122
+ ## Completion check
123
+
124
+ Selection/customization is complete only when all of these are true:
125
+
126
+ - the confirmed requirement digest is unchanged;
127
+ - every required owner cell has exactly one primary owner;
128
+ - every Provider is exact-versioned, integrity-checked and staged from a
129
+ portable distribution;
130
+ - profile variants, SubjectKey authority, config and resources pass final
131
+ validation;
132
+ - each local change is the smallest proven ladder level and has no unrelated
133
+ copied resources;
134
+ - program and dependency receipts exist when required and do not claim a
135
+ sandbox the Host does not provide;
136
+ - the transactional apply observation matches every target digest;
137
+ - a final static/final selection validation passes after apply.
138
+
139
+ For the complete manifest and execution surface, see
140
+ [Indexer Provider protocol](../reference/indexer-provider-protocol.md).