@c4a/context 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 (130) hide show
  1. package/README.md +5 -5
  2. package/README.zh-CN.md +5 -5
  3. package/codeIndexPlan.d.ts +84 -0
  4. package/contracts.d.ts +2 -1
  5. package/docs/README.md +7 -0
  6. package/docs/README.zh-CN.md +5 -0
  7. package/docs/getting-started.md +12 -12
  8. package/docs/guides/agent-guide.md +18 -9
  9. package/docs/guides/code-indexer-skill-authoring.md +124 -0
  10. package/docs/guides/indexer-provider-and-customization.md +140 -0
  11. package/docs/guides/lark-resources.md +7 -0
  12. package/docs/guides/markdown-indexer-skill-authoring.md +118 -0
  13. package/docs/guides/package-outputs.md +3 -3
  14. package/docs/reference/code-extractors.md +7 -6
  15. package/docs/reference/indexer-provider-protocol.md +819 -0
  16. package/docs/reference/package-templates.md +18 -10
  17. package/docs/reference/project-api.md +49 -24
  18. package/index.d.ts +48 -2
  19. package/index.js +28239 -3948
  20. package/indexerAgentStepProtocol.d.ts +9391 -0
  21. package/indexerArtifactDependencies.d.ts +689 -0
  22. package/indexerArtifactPolicy.d.ts +335 -0
  23. package/indexerArtifactResult.d.ts +2010 -0
  24. package/indexerAuditFacts.d.ts +66 -0
  25. package/indexerAuditOverrideReadiness.d.ts +27 -0
  26. package/indexerAuditProtocol.d.ts +238 -0
  27. package/indexerAuditRevision.d.ts +726 -0
  28. package/indexerAuditRevisionActions.d.ts +236 -0
  29. package/indexerAuthoringFixture.d.ts +152 -0
  30. package/indexerBaseQuestionAmendment.d.ts +2403 -0
  31. package/indexerBenchmark.d.ts +1062 -0
  32. package/indexerCandidateCompile.d.ts +801 -0
  33. package/indexerCapabilityGroupEvidence.d.ts +129 -0
  34. package/indexerCatalogFallback.d.ts +1262 -0
  35. package/indexerCollectionMapping.d.ts +75 -0
  36. package/indexerContentLayers.d.ts +137 -0
  37. package/indexerControlledInvocation.d.ts +512 -0
  38. package/indexerControlledProgram.d.ts +12535 -0
  39. package/indexerCoreExports.d.ts +21 -0
  40. package/indexerCustomizationDraft.d.ts +13800 -0
  41. package/indexerCustomizationLadder.d.ts +103 -0
  42. package/indexerDependencyView.d.ts +1610 -0
  43. package/indexerEvidenceAdapterResult.d.ts +504 -0
  44. package/indexerExampleDecision.d.ts +1606 -0
  45. package/indexerExampleIdentity.d.ts +132 -0
  46. package/indexerExampleIdentityAudit.d.ts +70 -0
  47. package/indexerExampleLinkageAudit.d.ts +80 -0
  48. package/indexerGeneratedAuthoringAudit.d.ts +208 -0
  49. package/indexerIncrementalImpact.d.ts +221 -0
  50. package/indexerInventoryDisposition.d.ts +443 -0
  51. package/indexerLayerComposition.d.ts +1652 -0
  52. package/indexerLayoutChange.d.ts +329 -0
  53. package/indexerLayoutProposalSet.d.ts +447 -0
  54. package/indexerLayoutResolver.d.ts +342 -0
  55. package/indexerLayoutTransition.d.ts +247 -0
  56. package/indexerLifecycle.d.ts +53 -0
  57. package/indexerMainLifecycle.d.ts +258 -0
  58. package/indexerMainRunLedger.d.ts +888 -0
  59. package/indexerMainRunProtocol.d.ts +6471 -0
  60. package/indexerMainWorkset.d.ts +2141 -0
  61. package/indexerMaterialAnswer.d.ts +738 -0
  62. package/indexerMaterialAnswerActualization.d.ts +91 -0
  63. package/indexerMaterialAnswerExecutionPlan.d.ts +2887 -0
  64. package/indexerMaterialAnswerFlow.d.ts +63 -0
  65. package/indexerMaterialAnswerLayout.d.ts +76 -0
  66. package/indexerMaterialAnswerReview.d.ts +217 -0
  67. package/indexerMaterialAnswerReviewRoute.d.ts +6145 -0
  68. package/indexerMaterialAnswerRunLedger.d.ts +918 -0
  69. package/indexerMaterialAnswerRunProtocol.d.ts +1253 -0
  70. package/indexerMaterialGapLedger.d.ts +3111 -0
  71. package/indexerMaterialQuestionExclusion.d.ts +129 -0
  72. package/indexerMaterialQuestionWorkset.d.ts +508 -0
  73. package/indexerNavigationArtifactGraph.d.ts +5 -0
  74. package/indexerNavigationArtifactPlan.d.ts +39 -0
  75. package/indexerOverlayQuestionAmendment.d.ts +2551 -0
  76. package/indexerOverlayQuestionApplyProposal.d.ts +4697 -0
  77. package/indexerOverlayTrust.d.ts +1425 -0
  78. package/indexerParserCoordinate.d.ts +222 -0
  79. package/indexerParserFactView.d.ts +503 -0
  80. package/indexerPartitionConvergence.d.ts +496 -0
  81. package/indexerPartitionPlan.d.ts +919 -0
  82. package/indexerPartitionStrategyResolution.d.ts +594 -0
  83. package/indexerPhysicalArtifactAudit.d.ts +247 -0
  84. package/indexerPhysicalArtifactManifest.d.ts +449 -0
  85. package/indexerPlannedMaterialAnswer.d.ts +116 -0
  86. package/indexerPostAuthorComposition.d.ts +2000 -0
  87. package/indexerPostAuthorRunLedger.d.ts +1972 -0
  88. package/indexerPrimaryProjection.d.ts +262 -0
  89. package/indexerProfileContract.d.ts +3034 -0
  90. package/indexerProfileMetricAudit.d.ts +218 -0
  91. package/indexerProgramExecutionAuthorization.d.ts +227 -0
  92. package/indexerProgramRunProtocol.d.ts +7642 -0
  93. package/indexerProjectProposal.d.ts +2807 -0
  94. package/indexerProjectedArtifactFanOutAudit.d.ts +159 -0
  95. package/indexerProjectedArtifactPlan.d.ts +217 -0
  96. package/indexerProtocolCommon.d.ts +29 -0
  97. package/indexerProvider.d.ts +2573 -0
  98. package/indexerProviderComposition.d.ts +1357 -0
  99. package/indexerProviderContractReferences.d.ts +13 -0
  100. package/indexerProviderProfileResolution.d.ts +20 -0
  101. package/indexerProviderResolution.d.ts +752 -0
  102. package/indexerProviderResolutionAction.d.ts +678 -0
  103. package/indexerProviderRouting.d.ts +3909 -0
  104. package/indexerProviderSelectionProposal.d.ts +3311 -0
  105. package/indexerQuestionAuthority.d.ts +419 -0
  106. package/indexerReaderTargetInventory.d.ts +161 -0
  107. package/indexerReferenceOnlyAudit.d.ts +90 -0
  108. package/indexerRegistry.d.ts +3019 -0
  109. package/indexerRequirementComparison.d.ts +44 -0
  110. package/indexerRequirementConfirmation.d.ts +1193 -0
  111. package/indexerRequirementLifecycle.d.ts +3314 -0
  112. package/indexerRestrictedSelector.d.ts +63 -0
  113. package/indexerResultReconciliation.d.ts +6844 -0
  114. package/indexerResultReconciliationRun.d.ts +15 -0
  115. package/indexerRunEnvelope.d.ts +384 -0
  116. package/indexerRunProtocolCommon.d.ts +21 -0
  117. package/indexerSharedArtifactFingerprint.d.ts +33 -0
  118. package/indexerStructuredDeclaration.d.ts +513 -0
  119. package/indexerSubjectCatalog.d.ts +230 -0
  120. package/indexerSubjectIdentity.d.ts +19 -0
  121. package/indexerSubjectKeyAuthority.d.ts +785 -0
  122. package/indexerTemplateRendering.d.ts +485 -0
  123. package/indexerToolSnapshot.d.ts +431 -0
  124. package/indexerWorksetRead.d.ts +287 -0
  125. package/package.json +1 -1
  126. package/phases.d.ts +11 -9
  127. package/templates/package-templates/kb/AGENTS.md +1 -1
  128. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +1 -1
  129. package/templates/package-templates.zh-CN/kb/AGENTS.md +1 -1
  130. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +1 -1
package/README.md CHANGED
@@ -58,8 +58,8 @@ const sampleLib = source("20260712", "sample-lib");
58
58
  export default defineProject({
59
59
  sources: [sampleLib],
60
60
  phases: [
61
- extractTs({ source: sampleLib, collection: "codegraph" }),
62
- reviewValidity({ collection: "codegraph" }),
61
+ extractTs({ source: sampleLib, collection: "codeindex" }),
62
+ reviewValidity({ collection: "codeindex" }),
63
63
  ],
64
64
  packages: [
65
65
  kbPackage({
@@ -68,7 +68,7 @@ export default defineProject({
68
68
  path: "src/package-templates/kb",
69
69
  vars: { displayName: "Sample Library KB" },
70
70
  },
71
- select: { collections: ["codegraph"], okfRoots: ["wikis"] },
71
+ select: { collections: ["codeindex"], okfRoots: ["wikis"] },
72
72
  }),
73
73
  ],
74
74
  });
@@ -86,7 +86,7 @@ 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 `codegraph` 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
91
  | `alignProse()` and `compileProse()` | Structures document evidence and compiles source-bound knowledge candidates. |
92
92
  | `reviewValidity()` | Declares the review gate for one collection or the project. |
@@ -120,7 +120,7 @@ Approved Markdown is organized under `knowledge/<collection>/`:
120
120
 
121
121
  | Collection | What it contains | Typical sources |
122
122
  |---|---|---|
123
- | `codegraph` | Code symbols, modules, and relationships | Code repositories |
123
+ | `codeindex` | Code symbols, modules, and relationships | Code repositories |
124
124
  | `business` | Business concepts, roles, and relationships | Business and Lark documents |
125
125
  | `product` | Product capabilities and behavior | Product and requirement documents |
126
126
  | `architecture` | System structure and design explanations | Architecture and design documents |
package/README.zh-CN.md CHANGED
@@ -54,8 +54,8 @@ const sampleLib = source("20260712", "sample-lib");
54
54
  export default defineProject({
55
55
  sources: [sampleLib],
56
56
  phases: [
57
- extractTs({ source: sampleLib, collection: "codegraph" }),
58
- reviewValidity({ collection: "codegraph" }),
57
+ extractTs({ source: sampleLib, collection: "codeindex" }),
58
+ reviewValidity({ collection: "codeindex" }),
59
59
  ],
60
60
  packages: [
61
61
  kbPackage({
@@ -64,7 +64,7 @@ export default defineProject({
64
64
  path: "src/package-templates/kb",
65
65
  vars: { displayName: "Sample Library KB" },
66
66
  },
67
- select: { collections: ["codegraph"], okfRoots: ["wikis"] },
67
+ select: { collections: ["codeindex"], okfRoots: ["wikis"] },
68
68
  }),
69
69
  ],
70
70
  });
@@ -80,7 +80,7 @@ Route 会按需选择维护这份声明所需的操作说明、Schema 和手册
80
80
  |---|---|
81
81
  | `defineProject()` | 声明完整的项目处理图。 |
82
82
  | `source()` 和 `allSources()` | 引用已经登记的代码仓库、本地文件或飞书来源边界。 |
83
- | `extractTs()` | 从 TypeScript/TSX 中提取符号和关系,生成 `codegraph` 候选。 |
83
+ | `extractTs()` | 从 TypeScript/JavaScript 与 TSX/JSX 中提取符号和关系,生成 `codeindex` 候选。 |
84
84
  | `extractCustom()` | 运行项目自有代码提取器,同时由 Context 维护候选、证据、新鲜度和审核状态。 |
85
85
  | `alignProse()` 和 `compileProse()` | 整理文档证据,并生成与来源绑定的知识候选。 |
86
86
  | `reviewValidity()` | 声明单个知识类型或整个项目的审核门禁。 |
@@ -109,7 +109,7 @@ Context CLI 不会把所有语言和仓库解析器都打入自身。知识项
109
109
 
110
110
  | 知识类型 | 主要内容 | 常见来源 |
111
111
  |---|---|---|
112
- | `codegraph` | 代码符号、模块和调用关系 | 代码仓库 |
112
+ | `codeindex` | 代码符号、模块和调用关系 | 代码仓库 |
113
113
  | `business` | 业务概念、角色和业务关系 | 业务文档、飞书文档 |
114
114
  | `product` | 产品能力、功能行为和产品关系 | 产品文档、需求文档 |
115
115
  | `architecture` | 系统结构、模块职责和设计说明 | 架构文档、设计文档 |
@@ -27,6 +27,8 @@ export interface CodeIndexUnitPlan {
27
27
  facets?: readonly CodeIndexModuleFacet[];
28
28
  /** Source-backed reasons for the selected module type. */
29
29
  moduleTypeEvidence?: readonly string[];
30
+ /** Source-relative Markdown documents read while classifying this index unit. */
31
+ documents?: readonly string[];
30
32
  outputProfile: CodeIndexOutputProfile;
31
33
  responsibility: string;
32
34
  entries: readonly string[];
@@ -51,9 +53,91 @@ export interface CodeIndexCapabilityGap {
51
53
  reason: string;
52
54
  requestedMaterial?: string;
53
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
+ }
84
+ /** Complete source inventory returned by a project adapter for mechanical quality scoring. */
85
+ export interface CodeIndexInspectionInventory {
86
+ indexUnitId: string;
87
+ eligibleFiles: number;
88
+ analyzedFiles: number;
89
+ /** Complete eligible source identities used as the file denominator. */
90
+ eligibleFileTargets: readonly string[];
91
+ /** Complete source identities successfully analyzed by the adapter. */
92
+ analyzedFileTargets: readonly string[];
93
+ eligibleLoc: number;
94
+ analyzedLoc: number;
95
+ documentsDiscovered: number;
96
+ documentsRead: number;
97
+ /** Discovered Markdown identities, relative to the registered source root. */
98
+ documentTargets?: readonly string[];
99
+ /** Root README or documentation entry identities that require complete reading. */
100
+ rootDocumentTargets?: readonly string[];
101
+ /** Discovered document identities read during module classification. */
102
+ readDocumentTargets?: readonly string[];
103
+ /** Documents already referenced by emitted knowledge candidates. */
104
+ referencedDocumentTargets?: readonly string[];
105
+ symbolsDiscovered: number;
106
+ symbolsAnalyzed: number;
107
+ targetSymbols: number;
108
+ exportedSymbols: number;
109
+ /** Stable target identities, normally exported or profile-selected symbol names. */
110
+ targetSymbolIdentities: readonly string[];
111
+ /** Public export identities that must remain discoverable. */
112
+ exportedTargetIdentities: readonly string[];
113
+ entryTargets: readonly string[];
114
+ protocolTargets: readonly string[];
115
+ boundaryTargets?: readonly {
116
+ kind: "entry" | "export" | "route" | "operation" | "handler" | "downstream" | "command" | "event" | "plugin" | "handoff";
117
+ identity: string;
118
+ }[];
119
+ coveredBoundaryTargets?: readonly {
120
+ kind: "entry" | "export" | "route" | "operation" | "handler" | "downstream" | "command" | "event" | "plugin" | "handoff";
121
+ identity: string;
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[];
129
+ excludedFiles: number;
130
+ /** Complete identities deliberately excluded after discovery. */
131
+ excludedFileTargets: readonly string[];
132
+ excludedReasons: readonly string[];
133
+ parserSkippedFiles: number;
134
+ /** Complete eligible identities that the parser could not analyze. */
135
+ parserSkippedFileTargets: readonly string[];
136
+ }
54
137
  export interface CodeIndexInspectionResult {
55
138
  findings: readonly CodeIndexInspectionFinding[];
56
139
  capabilityGaps?: readonly CodeIndexCapabilityGap[];
140
+ inventories?: readonly CodeIndexInspectionInventory[];
57
141
  }
58
142
  export interface CodeIndexInspectionContext {
59
143
  projectRoot: string;
package/contracts.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type DocumentMainlineCollection = "business" | "product" | "architecture" | "sop" | "faq" | "standards" | "decision" | "incident" | "test";
2
2
  export type CodegraphCollection = "codegraph";
3
- export type MainlineCollection = CodegraphCollection | DocumentMainlineCollection;
3
+ export type CodeIndexCollection = "codeindex" | CodegraphCollection;
4
+ export type MainlineCollection = CodeIndexCollection | DocumentMainlineCollection;
4
5
  export type TopLevelNamespace = MainlineCollection | "feats";
5
6
  export type OkfRoot = "guides" | "rules" | "wikis" | "feats";
6
7
  export type KnowledgeCollection = TopLevelNamespace;
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 变量、循环、注释和默认知识清单。
@@ -186,8 +186,8 @@ For a monorepo or subspace, choose the boundary deliberately:
186
186
  The long-term multi-module knowledge shape is stable across capture dates:
187
187
 
188
188
  ```text
189
- knowledge/codegraph/module-a/...
190
- knowledge/codegraph/module-b/...
189
+ knowledge/codeindex/module-a/...
190
+ knowledge/codeindex/module-b/...
191
191
  ```
192
192
 
193
193
  The CLI records each module's git root and subpath, then materializes
@@ -274,8 +274,8 @@ const componentLib = source("20260712", "component-lib");
274
274
  export default defineProject({
275
275
  sources: [componentLib],
276
276
  phases: [
277
- extractTs({ source: componentLib, collection: "codegraph" }),
278
- reviewValidity({ collection: "codegraph" }),
277
+ extractTs({ source: componentLib, collection: "codeindex" }),
278
+ reviewValidity({ collection: "codeindex" }),
279
279
  ],
280
280
  packages: [],
281
281
  });
@@ -285,8 +285,8 @@ Inspect and run:
285
285
 
286
286
  ```bash
287
287
  context run --list
288
- context run extract:20260712/component-lib:codegraph --dry-run
289
- context run extract:20260712/component-lib:codegraph
288
+ context run extract:20260712/component-lib:codeindex --dry-run
289
+ context run extract:20260712/component-lib:codeindex
290
290
  ```
291
291
 
292
292
  When operating through an Agent, use `--dry-run --format json` as the CLI
@@ -298,11 +298,11 @@ Treat that preview as a structural scope check before producing draft
298
298
  candidates; the CLI does not decide which symbols are important to a business
299
299
  or audience.
300
300
 
301
- The codegraph path keeps the stable module identity. The date stays in the repo
301
+ The codeindex path keeps the stable module identity. The date stays in the repo
302
302
  source ref and phase id, not in the knowledge path:
303
303
 
304
304
  ```text
305
- knowledge/codegraph/<module>/symbol/<slug>.md
305
+ knowledge/codeindex/<module>/symbol/<slug>.md
306
306
  ```
307
307
 
308
308
  Show the tree/path preview to the user before first extraction and describe it
@@ -423,8 +423,8 @@ const componentLib = source("20260712", "component-lib");
423
423
  export default defineProject({
424
424
  sources: [componentLib],
425
425
  phases: [
426
- extractTs({ source: componentLib, collection: "codegraph" }),
427
- reviewValidity({ collection: "codegraph" }),
426
+ extractTs({ source: componentLib, collection: "codeindex" }),
427
+ reviewValidity({ collection: "codeindex" }),
428
428
  ],
429
429
  packages: [
430
430
  kbPackage({
@@ -433,7 +433,7 @@ export default defineProject({
433
433
  path: "src/package-templates/kb",
434
434
  vars: { displayName: "Component Library KB" },
435
435
  },
436
- select: { include: ["codegraph/component-lib/**"] },
436
+ select: { include: ["codeindex/component-lib/**"] },
437
437
  }),
438
438
  ],
439
439
  });
@@ -446,7 +446,7 @@ of the agent knowledge-base package:
446
446
  llmsPackage({
447
447
  name: "component-lib-llms",
448
448
  template: "src/package-templates/llms",
449
- select: { include: ["codegraph/component-lib/**"] },
449
+ select: { include: ["codeindex/component-lib/**"] },
450
450
  });
451
451
  ```
452
452
 
@@ -146,7 +146,7 @@ action as adding a knowledge source, not as filling CLI placeholders. Treat this
146
146
  as a source boundary decision. Document sources use today's local date as their
147
147
  name. Repo sources use the date as a batch and require the confirmed module
148
148
  identity. Do not invent semantic date suffixes. The concrete repo selector
149
- appears in source refs, phase ids, and codegraph paths:
149
+ appears in source refs, phase ids, and codeindex paths:
150
150
 
151
151
  ```text
152
152
  knowledge/<collection>/<slug>.md
@@ -178,6 +178,15 @@ If the user supplies several repo/file/Lark sources in one request, create one
178
178
  register them under a single project write lock. Never parallelize mutating
179
179
  `source add` commands; on a lock-held error, wait and retry.
180
180
 
181
+ Do not select sources from repository layout or Git metadata. After the user
182
+ has named an exact local module or path, however, resolving one unique matching
183
+ directory and reading its Git root, `origin`, and current commit are mechanical
184
+ identity checks. Pass the resolved local path relative to the Context project
185
+ root; when the workspace was initialized in a child `context/` directory,
186
+ recompute sibling paths from that new root. In ordinary and fully managed modes,
187
+ do not request a remote URL again when that confirmed local checkout provides
188
+ it.
189
+
181
190
  Current execution supports repo sources, local Markdown/MDX file sources, and Lark /
182
191
  Feishu document sources. Local
183
192
  repo/package sources are registered with `context source add repo [YYYYMMDD] --module <module> --local <path>`;
@@ -286,16 +295,16 @@ prose align. Once a document structure draft exists, keep that current human
286
295
  gate and do not switch workflows mid-review.
287
296
 
288
297
  For monorepos, the date is one registration batch and every selected package is
289
- a module under it. Stable codegraph paths omit that batch date and therefore
290
- look like `knowledge/codegraph/module-a/...` and
291
- `knowledge/codegraph/module-b/...`. Date/module remains in phase ids and
298
+ a module under it. Stable codeindex paths omit that batch date and therefore
299
+ look like `knowledge/codeindex/module-a/...` and
300
+ `knowledge/codeindex/module-b/...`. Date/module remains in phase ids and
292
301
  repo source refs. Use the whole repo/subspace
293
302
  only for inspection when it contains multiple modules. If the user chooses
294
303
  `packages/button`, register it with `--module button` under the same date and
295
304
  write `extractTs({ source: source("20260712", "button"), ... })`. Do not use
296
305
  `include: ["packages/button/src/**"]` to choose a package from a larger source;
297
306
  `include` only filters files inside the selected source. Repo module names are
298
- project-wide codegraph identities; refresh an existing module through its
307
+ project-wide codeindex identities; refresh an existing module through its
299
308
  original date/module selector instead of reusing its name under a later date.
300
309
 
301
310
  For a non-standard package, configure source-relative `entries` on `extractTs`;
@@ -318,17 +327,17 @@ context source inspect <date>/<module> --format json
318
327
  context run <extract-phase-id> --dry-run --format json
319
328
  ```
320
329
 
321
- After the preview, run codegraph extraction normally unless the user explicitly
330
+ After the preview, run codeindex extraction normally unless the user explicitly
322
331
  asked for CI/CD automation. The first normal run requires Review for all code
323
332
  candidates. Subsequent normal runs require Review only for added, changed, or
324
333
  removed symbols; unchanged approved symbols stay approved. After each result,
325
- run `context status --format json`. `continue-codegraph-batch` only requests
334
+ run `context status --format json`. `continue-codeindex-batch` only requests
326
335
  workspace re-evaluation. Open Review only when
327
336
  `workflow.current.gate.id=knowledge-review`; otherwise execute the current
328
337
  route.
329
338
 
330
339
  For a non-interactive pipeline, use `context run <extract-phase-id>
331
- --auto-promote --format json`. This flag applies only to codegraph, applies its
340
+ --auto-promote --format json`. This flag applies only to codeindex, applies its
332
341
  deterministic deltas, refreshes deterministic close when needed, runs verify,
333
342
  and fails the command if close or verify fails. Read `autoPromotion.close` and
334
343
  `autoPromotion.verify` before continuing. Package build remains explicit: when
@@ -354,7 +363,7 @@ tsconfig/jsconfig `baseUrl` and `paths`, so do not ask users to rewrite `@/`
354
363
  imports solely for Context. Explain the concrete output shape:
355
364
 
356
365
  ```text
357
- knowledge/codegraph/<module>/symbol/<slug>.md
366
+ knowledge/codeindex/<module>/symbol/<slug>.md
358
367
  ```
359
368
 
360
369
  If the module or resulting path shape looks wrong, stop and repair the
@@ -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).