@c4a/context 0.7.4 → 0.7.8

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 (97) hide show
  1. package/README.md +17 -8
  2. package/README.zh-CN.md +15 -8
  3. package/docs/README.md +13 -1
  4. package/docs/README.zh-CN.md +13 -1
  5. package/docs/getting-started.md +95 -69
  6. package/docs/guides/agent-dialogue.md +19 -9
  7. package/docs/guides/agent-guide.md +52 -10
  8. package/docs/guides/code-indexer-skill-authoring.md +50 -5
  9. package/docs/guides/indexer-manifest-example.md +103 -0
  10. package/docs/guides/indexer-provider-and-customization.md +307 -31
  11. package/docs/guides/indexer-skill-creation.md +99 -0
  12. package/docs/guides/knowledge-updates.md +324 -0
  13. package/docs/guides/lark-resources.md +5 -1
  14. package/docs/guides/markdown-indexer-skill-authoring.md +25 -7
  15. package/docs/guides/note.md +37 -0
  16. package/docs/guides/package-outputs.md +22 -17
  17. package/docs/guides/sessions.md +50 -0
  18. package/docs/guides/workspace-commit.md +45 -0
  19. package/docs/guides/workspace-prepare.md +72 -0
  20. package/docs/guides/workspace-restore.md +59 -0
  21. package/docs/reference/code-extractors.md +23 -11
  22. package/docs/reference/indexer-provider-protocol.md +116 -22
  23. package/docs/reference/package-templates.md +10 -9
  24. package/docs/reference/project-api.md +47 -13
  25. package/docs/reference/template-variables.md +7 -7
  26. package/index.d.ts +11 -0
  27. package/index.js +1819 -584
  28. package/indexerAgentStepProtocol.d.ts +1284 -2060
  29. package/indexerApprovedKnowledge.d.ts +371 -0
  30. package/indexerArticlePlan.d.ts +83 -0
  31. package/indexerArtifact.d.ts +10 -7
  32. package/indexerArtifactDependencies.d.ts +7 -5
  33. package/indexerArtifactPolicy.d.ts +16 -16
  34. package/indexerArtifactResult.d.ts +76 -69
  35. package/indexerAuthoringFixture.d.ts +8 -8
  36. package/indexerAuthorizedWorksetView.d.ts +14 -14
  37. package/indexerBaseQuestionAmendment.d.ts +40 -0
  38. package/indexerCandidateCompile.d.ts +46 -36
  39. package/indexerCatalogFallback.d.ts +566 -48
  40. package/indexerCompositionFactDependencies.d.ts +16 -0
  41. package/indexerContentLayers.d.ts +6 -4
  42. package/indexerContractDeclaration.d.ts +3 -0
  43. package/indexerControlledProgram.d.ts +1039 -238
  44. package/indexerCustomizationDraft.d.ts +188 -0
  45. package/indexerDependencyView.d.ts +17 -17
  46. package/indexerEffectiveArtifact.d.ts +26 -15
  47. package/indexerExampleFactDependencies.d.ts +17 -0
  48. package/indexerExampleIdentityAudit.d.ts +2 -2
  49. package/indexerInventoryDisposition.d.ts +44 -44
  50. package/indexerKnowledgeDependency.d.ts +46 -0
  51. package/indexerLayerComposition.d.ts +92 -54
  52. package/indexerLayoutChange.d.ts +8 -8
  53. package/indexerLayoutProposalSet.d.ts +15 -10
  54. package/indexerLayoutResolver.d.ts +15 -6
  55. package/indexerLayoutTransition.d.ts +8 -8
  56. package/indexerLifecycle.d.ts +1 -1
  57. package/indexerMainRunLedger.d.ts +7 -0
  58. package/indexerMainRunProtocol.d.ts +872 -196
  59. package/indexerMainWorkset.d.ts +50 -0
  60. package/indexerNavigationArtifactPlan.d.ts +2 -2
  61. package/indexerOverlayQuestionAmendment.d.ts +56 -16
  62. package/indexerOverlayQuestionApplyProposal.d.ts +98 -26
  63. package/indexerPartitionPlan.d.ts +585 -40
  64. package/indexerPhysicalArtifactAudit.d.ts +2 -2
  65. package/indexerPhysicalArtifactManifest.d.ts +24 -24
  66. package/indexerPostAuthorRunLedger.d.ts +60 -34
  67. package/indexerPrimaryProjection.d.ts +2 -2
  68. package/indexerProfileContract.d.ts +28 -28
  69. package/indexerProgramRunProtocol.d.ts +868 -194
  70. package/indexerProjectProposal.d.ts +36 -8
  71. package/indexerProjectedArtifactFanOutAudit.d.ts +2 -2
  72. package/indexerProvider.d.ts +72 -28
  73. package/indexerProviderComposition.d.ts +4 -4
  74. package/indexerProviderRouting.d.ts +52 -0
  75. package/indexerProviderSelectionProposal.d.ts +48 -0
  76. package/indexerPublicContractFacts.d.ts +7 -0
  77. package/indexerPublicContractTable.d.ts +11 -0
  78. package/indexerReaderTargetInventory.d.ts +6 -6
  79. package/indexerReferenceOnlyAudit.d.ts +2 -2
  80. package/indexerRegistry.d.ts +52 -0
  81. package/indexerRequirementConfirmation.d.ts +48 -16
  82. package/indexerRequirementLifecycle.d.ts +154 -42
  83. package/indexerResultReconciliation.d.ts +12 -11
  84. package/indexerSemanticInput.d.ts +28014 -1847
  85. package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
  86. package/indexerStructuredDeclaration.d.ts +8 -8
  87. package/indexerTemplateRendering.d.ts +7 -7
  88. package/indexerToolSnapshot.d.ts +16 -16
  89. package/managedSources.d.ts +15 -0
  90. package/package.json +1 -1
  91. package/phases.d.ts +0 -3
  92. package/processedScopes.d.ts +75 -0
  93. package/readingStructure.d.ts +188 -0
  94. package/sessionMetadata.d.ts +49 -0
  95. package/sources.d.ts +9 -3
  96. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
  97. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
@@ -21,16 +21,37 @@ rules, metric operators and thresholds.
21
21
 
22
22
  ## Author contract checklist
23
23
 
24
+ For generated API tables, test the final Candidate as well as the parser payload
25
+ and template preview. Cover direct and supporting references, partial contracts,
26
+ shared types with different implementation defaults, ambiguous or cross-file
27
+ links, and an approved-page regeneration after the source changes. Keep a known
28
+ field when only part of its implementation can be extracted. Do not equate an
29
+ accepted result with a corrected page.
30
+
31
+ Document what each supported language adapter actually establishes. Preserve
32
+ written expressions without evaluating arbitrary code, distinguish declaration
33
+ defaults from implementation defaults, and explain unresolved imports or types.
34
+ Unknown material, an unsupported parse, and a renderer contradicting a known fact
35
+ need different responses. Use existing material requests and repair routes;
36
+ neither a new content-quality gate nor a Provider-specific retry ledger is needed.
37
+
24
38
  1. **Responsibility.** Classify supported code modules and produce evidence-
25
39
  bound partitions, logical units, Artifact Bundles and Results. Do not own
26
40
  source authorization, requirement approval, final review, CLI metrics or
27
- package publication.
41
+ package publication. Source-specific Note/Sessions layers may contribute
42
+ declared guidance to a code page; they do not become another primary or
43
+ turn a conversation's proposed change into implemented code behavior.
28
44
  2. **Manifest.** Use the sole `context-indexer.yaml` field tree. Bind domains,
29
45
  profiles, operations/fragments, resources, source roles, logical units,
30
46
  customization support and composition without duplicate aliases.
31
47
  3. **Resource composition.** Combine only declared programs, profile-bound
32
48
  instructions, templates and optional detector/inspector resources. Omitted
33
49
  capabilities remain unsupported; natural language cannot add them.
50
+ Put any Agent-executed grouping rules in those declared instructions or
51
+ templates so Context delivers them with the current View. A partition
52
+ strategy id or digest is not an instruction resource. Context selects and
53
+ records strategy attempts; the Agent returns semantic groups and dispositions,
54
+ without discovering strategy implementations or managing fallback order.
34
55
  4. **Activation and profiles.** Declare strong/supporting/negative signals.
35
56
  Dependency names are candidates, not runtime proof. One module may combine
36
57
  one primary profile with supporting/extensions and selected composers.
@@ -84,8 +105,8 @@ rules, metric operators and thresholds.
84
105
  shapes. Local facts remain baseline when optional remote metadata is absent.
85
106
  18. **Versioning.** Use Skill/Provider SemVer, exact Provider pins and Bundle
86
107
  integrity. Fixed dependencies require exact versions and resolved
87
- integrity. `@context-indexer-origin` is optional on local customizations
88
- only and grants no authority.
108
+ integrity. `@context-indexer-origin` is required on workspace-local customization
109
+ files and grants no authority. It is not required on Provider bundle files.
89
110
  19. **Trust boundary.** Skill/manifest describes capabilities; the verified
90
111
  Bundle supplies bytes; workspace customization supplies project deltas;
91
112
  CLI contracts supply hard rules. Keep these four authorities distinct.
@@ -105,6 +126,30 @@ rules, metric operators and thresholds.
105
126
  instructions append → one template override → program extension →
106
127
  restricted replace. Document the proof and exit condition at every step;
107
128
  see [Provider selection and customization](./indexer-provider-and-customization.md).
129
+ 24. **Batch neutrality.** Write instructions for one semantic task and accept
130
+ that Context may transport several independent tasks in one Agent step.
131
+ Never derive identity, ordering, ownership or evidence scope from a task
132
+ key or batch position. Partition should decide consumer-facing ownership
133
+ from public anchors and unresolved material; detailed supporting Facts are
134
+ consumed in the bounded Author View rather than copied into every
135
+ Partition decision.
136
+
137
+ The current Route delivers readable task material with goals and constraints
138
+ first, followed by the authorized sources and facts. For behavioral explanations,
139
+ read the complete source excerpts. Copy the displayed `source_items` into the
140
+ section's `source_items`; use Fact references in `facts`, not as source items.
141
+ Context resolves a text item's authorized source spans internally. Inventory
142
+ identities and a repository reference do not identify section source material.
143
+ These process-local excerpts are not new Facts or reader-page metadata. Do not
144
+ reopen the repository or infer behavior from a locator alone when the supplied
145
+ lines do not establish it. Batch size does not define a knowledge page boundary.
146
+
147
+ Author task resources may point to one shared batch reading file. Read that path
148
+ once, use shared material only for its listed task keys, and consider each task's
149
+ own goals and source excerpts. Context shares identical material, not conclusions:
150
+ prepare a separate result for each task and submit the `results[]` together through
151
+ the current completion command. A retry includes the remaining tasks' material in
152
+ full; no earlier batch file or additional reading command is required.
108
153
 
109
154
  ## Result and composition rules
110
155
 
@@ -116,8 +161,8 @@ an empty composer run still has a receipt. Composer selection is the
116
161
  intersection of registry selection, manifest declaration and current profile
117
162
  applicability, not array order.
118
163
 
119
- Use canonical SubjectKey schemas and the Context NodeRef formula. Code and
120
- Markdown Indexers must reuse the same Node when the SubjectKey is equal. An
164
+ Use canonical SubjectKey schemas and the Context NodeRef formula. All selected
165
+ Providers must reuse the same Node when the SubjectKey is equal. An
121
166
  enricher uses the supplied TargetResolutionView (`resolved`, `absent` or
122
167
  `ambiguous`) and never guesses identity from a title or path resemblance.
123
168
 
@@ -0,0 +1,103 @@
1
+ # A minimal Provider manifest
2
+
3
+ This is the smallest `context-indexer.yaml` that validates. Start from it and add
4
+ only what your bundle implements. Reading an installed Provider's manifest is
5
+ still worthwhile for behavior, but do not copy its declarations wholesale: they
6
+ describe that bundle's resources, not yours.
7
+
8
+ ```yaml
9
+ protocol: context.indexer.provider/v1
10
+ id: context-example-indexer
11
+ version: 1.0.0
12
+ domains: [markdown]
13
+ activation:
14
+ target_kinds: [document-set]
15
+ required_signals:
16
+ - id: prose-source
17
+ description: The target contains prose a reader would consult.
18
+ supporting_signals: []
19
+ negative_signals: []
20
+ provides:
21
+ profiles: [reader-guide]
22
+ operations:
23
+ - id: main-index
24
+ consumes: context.indexer.main-workset/v2
25
+ produces: context.indexer.main-result/v1
26
+ provider:
27
+ instructions:
28
+ - path: references/indexer.md
29
+ profiles: [reader-guide]
30
+ templates:
31
+ - { id: guide, profile: reader-guide, path: templates/reader-guide.md }
32
+ customization:
33
+ supports: [instructions-append, template-override]
34
+ ```
35
+
36
+ The three groups below are the reason this file exists: a field being absent from
37
+ a manifest means something different depending on which group it belongs to.
38
+
39
+ ## Required
40
+
41
+ The schema rejects a manifest missing any of these.
42
+
43
+ - `protocol`, `id`, `version` — the protocol literal, a discoverable Provider
44
+ identity, and a semver version.
45
+ - `domains` — at least one. Note and Sessions Providers use `markdown`.
46
+ - `activation.target_kinds` — at least one. This is projected into the Provider
47
+ selection catalog, so it decides when your Provider can be selected at all.
48
+ - `activation.required_signals` — at least one `{ id, description }`.
49
+ - `activation.supporting_signals`, `activation.negative_signals` — the arrays
50
+ themselves are required; an empty array is the normal value.
51
+ - `provides.profiles` — at least one. A profile whose id contains `/` is a
52
+ namespaced extension profile and additionally requires a matching
53
+ `composition.extensions` entry.
54
+ - `provides.operations` — at least one. `main-index` is the only operation.
55
+ - `provider` — at least one of `program`, `instructions` or `templates`.
56
+
57
+ ## Required once you declare a capability
58
+
59
+ Declaring a customization capability without the resource that implements it is
60
+ rejected at manifest validation:
61
+
62
+ - `customization.supports` containing `config` requires `provider.config_schema`.
63
+ - `customization.supports` containing `program-extend` requires
64
+ `provider.program`.
65
+
66
+ Both inconsistencies used to surface only at use time — a non-empty config while
67
+ validating the selection, `program-extend` while preparing the customization
68
+ project. Declare only the hooks your bundle actually backs; `instructions-append`
69
+ and `template-override` need no additional resource.
70
+
71
+ Two related rules hold for every resource. Each `instructions` and `templates`
72
+ entry must name a profile that `provides.profiles` declares, and every declared
73
+ path must exist inside the bundle. The reverse also matters: a reference file
74
+ that no entry declares is never delivered to the Agent, so adding a file is not
75
+ the same as making it available.
76
+
77
+ ## Optional, and not uniformly enforced
78
+
79
+ These are accepted and carry authoring intent. It is worth knowing which ones
80
+ have a consumer, because declaring a field is not the same as gaining a check.
81
+
82
+ - `quality_guidance.metric_ids` and `quality_guidance.repair` — read when
83
+ projecting Provider contract references; the repair path ships as a resource.
84
+ - `activation.agent_questions` — questions this Provider wants asked before it
85
+ interprets material.
86
+ - `provides.partition_strategies`, `provides.logical_units`,
87
+ `provides.composers`, `composition.extensions` — declare only what you
88
+ implement. Priorities must be unique per profile, and a composer contract
89
+ requires a post-author `derived-artifact-proposal` layer fragment.
90
+ - `provider.completion_checks`, `provider.forbidden_fallbacks` — the schema
91
+ accepts and deduplicates them, and no execution consumer reads them today.
92
+ Declaring them records intent for a reader of the manifest; it does not add a
93
+ runtime check, and omitting them does not remove one. Material gaps in
94
+ particular are handled by result reconciliation, which does not read
95
+ `completion_checks`.
96
+
97
+ ## Validate it
98
+
99
+ Use the installed SDK, as described in [the authoring
100
+ guide](indexer-skill-creation.md). `parseIndexerProviderManifest` accepts the
101
+ manifest text directly, which is enough to confirm the field tree; loading the
102
+ bundle directory additionally confirms that declared resource paths resolve.
103
+ Neither establishes that the Provider produces useful pages.
@@ -1,6 +1,6 @@
1
1
  # Indexer Provider selection and customization
2
2
 
3
- This guide is for workspace users and Agents selecting Code or Markdown
3
+ This guide is for workspace users and Agents selecting Code, Markdown, Note or Sessions
4
4
  Indexer Providers. Provider authors should also read the dedicated
5
5
  [Code Indexer](./code-indexer-skill-authoring.md) or
6
6
  [Markdown Indexer](./markdown-indexer-skill-authoring.md) authoring guide.
@@ -12,33 +12,219 @@ authority. A Provider-only project does not create `src/indexer/`.
12
12
 
13
13
  ## Selection flow
14
14
 
15
- 1. Inspect and confirm the complete `IndexRequirementSet`. A Provider,
15
+ Follow `workflow.current` from `context status --format json` or `context run`.
16
+ When the registry is missing, the Route names `src/indexers.yaml` in
17
+ `configuration`: declare the confirmed requirements with `indexers: []`, then
18
+ re-evaluate. The next Route supplies the Provider selection input and completion
19
+ command. An unconfigured project does not begin Partition or require a fabricated
20
+ primary owner. `run --managed --until blocked-or-complete` stops at the same
21
+ configuration or semantic input boundary; it does not make those decisions.
22
+
23
+ 1. Form the complete requirements using the initial registry contract below.
24
+ Reuse the user's stated meaning and research the selected material. Ask about
25
+ consequential missing purpose or scope even in managed mode; delegation
26
+ covers execution and eligible reviews, not unanswered intent. A Provider,
16
27
  registry entry or Result may strengthen it but cannot remove targets,
17
28
  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.
29
+ 2. Select applicable Providers from the Host-visible Skills and the CLI-bundled
30
+ catalog already in the current Action input. No separate catalog command,
31
+ installed-Skill inventory, discovery report, or discovery-only confirmation
32
+ is required. Use the supplied exact identity and cli-bundled distribution
33
+ for shipped Providers, even when their Skills are also visible to the Host.
34
+ For a relevant external Skill, read only its exact Host-exposed frontmatter
35
+ and sibling `context-indexer.yaml` needed for selection. Do not guess versions
36
+ or scan `.claude`, `.codex`, `.agents` or arbitrary user directories. Different
37
+ versions remain distinct; discovery order is not selection precedence.
38
+ 3. Submit the semantic `indexers` and any relevant non-CLI `host_visible_skills`
39
+ through the current Route's `context action complete-current` command. The
40
+ latter may be empty; it is not an inventory or an additional discovery step.
41
+ 4. The CLI performs routing, validation, resolution and staging internally.
42
+ Shipped Providers load directly from this CLI release; only external
43
+ Providers may require the returned Host resolution Action. Follow the
44
+ current Route if a distribution is missing, a version conflicts, or program
45
+ execution needs authorization. Do not call the low-level commands below as
46
+ a second production workflow.
47
+ 5. The CLI atomically applies the validated registry and any declared
48
+ customization. A successful static report alone is not write or execution
49
+ authority. Resume from the returned current Route.
36
50
 
37
51
  Every required requirement/domain/source/module cell has exactly one primary
38
52
  owner. Read scope may overlap for supporting profiles, extensions and
39
53
  enrichers. Array order is never precedence. Each Provider layer retains its own
40
54
  exact version, integrity, portable distribution, config and resource
41
55
  fingerprints.
56
+ For CLI-bundled instruction Providers, these fields record the original
57
+ selection; they are not a requirement to reinstall old bytes when resuming.
58
+ The current CLI supplies its installed Provider's guidance automatically.
59
+
60
+ ## Resuming after a tool update
61
+
62
+ Continue with the current Route and its supplied source material. Agents do not
63
+ compare Provider, Fact, signature or inventory fingerprints and do not rewrite
64
+ them in an old request. Context rebuilds the internal result from the submitted
65
+ page content and references.
66
+
67
+ An added parser field or a more complete line range in the same unchanged file
68
+ does not invalidate Author work. Continuation compares selected sources and
69
+ subjects rather than serialized Fact payloads; accepted work retains its
70
+ original request/result pair. New results retain the source references used for
71
+ later updates. Repeated Fact references or reader-question answers are deduplicated;
72
+ multiple sections may answer the same question. A question ID only identifies a
73
+ reader question to cover, not an additional user approval.
74
+
75
+ Missing references, a changed source file, a different page owner/subject or a
76
+ concurrent write remain meaningful conflicts. Requirements, membership and result
77
+ contracts still determine whether a task can be reused. This does not introduce a
78
+ new Agent protocol, hash-entry step or persistent audit file.
79
+
80
+ ## Provider selection result
81
+
82
+ Use the current Action's output schema, which defines the accepted Indexer
83
+ entry fields. This is a `complete-current` input, not a replacement registry
84
+ and not the requirements-only bootstrap schema.
85
+
86
+ For one component-library requirement, the following template selects one
87
+ primary Code Provider. Replace the quoted placeholders using the **current
88
+ Action input**, not values from a different CLI installation:
89
+
90
+ ```yaml
91
+ stage: provider-selection
92
+ host_visible_skills: []
93
+ indexers:
94
+ - id: component-guide
95
+ operations: [main-index]
96
+ requirement_bindings:
97
+ - requirement_ref: "<requirement.id>"
98
+ coverage_domains: ["<required-domain>"]
99
+ owned_scope:
100
+ ref: "requirement:<requirement.id>#target_scope"
101
+ role: primary
102
+ read_scope:
103
+ refs:
104
+ - "requirement:<requirement.id>#target_scope"
105
+ - "requirement:<requirement.id>#evidence_source_scope"
106
+ profile:
107
+ primary:
108
+ id: component-library
109
+ provider: community
110
+ providers:
111
+ - id: community
112
+ role: primary
113
+ skill: "<catalog.skill>"
114
+ version: "<catalog.version>"
115
+ integrity: "<catalog.integrity>"
116
+ distribution:
117
+ kind: cli-bundled
118
+ locator: "<catalog.distribution.locator>"
119
+ ```
120
+
121
+ - Choose `component-library` only if it matches the reader task and appears in
122
+ the selected catalog entry's `capabilities.profiles`. For captured documents,
123
+ notes or conversation summaries, select a profile from the corresponding
124
+ compatible Provider. Copy the actual catalog identity.
125
+ - Bind each selected requirement and all required coverage domains it owns;
126
+ the single-domain template is not permission to drop other required domains.
127
+ `owned_scope` names the target being described. `read_scope` may also include
128
+ supporting evidence, which does not become another owned target.
129
+ - `profile.primary.provider`, each additional profile's `provider`, and each
130
+ composer's `provider` reference a layer's `providers[].id`, not a Skill path.
131
+ Supporting or extension profiles use `profile.additional` with `kind`;
132
+ composers use `profile.composers`. Select only combinations supported by the
133
+ manifests; do not add empty customization or speculative config.
134
+ - The current catalog includes domains, target kinds, profile IDs, operations,
135
+ composers and extension relationships. If more detail is needed, read the
136
+ selected entry's exact `guidance.skill_path` and `guidance.manifest_path`.
137
+ These paths and capabilities are reading aids, not fields to copy into the
138
+ persistent registry. No separate discovery command or cache scan is needed.
139
+ - JSON Schema describes input shapes and accepted values. The CLI additionally
140
+ checks coverage ownership, scope relationships and Provider composition when
141
+ submitting. It atomically applies the selection; do not edit `indexers`
142
+ manually to bypass a rejected result.
143
+
144
+ ## Initial registry: `src/indexers.yaml`
145
+
146
+ The initial configuration Route provides the registered source boundary view.
147
+ Read it when the source identities are not already available from the current
148
+ source registration results. It is a metadata view, not another source capture
149
+ or a request to scan the repository. Use only the user's agreed source scope.
150
+
151
+ Read the `context.indexer.registry-bootstrap` schema at the exact path in the
152
+ current Route's required resources. It ships with the CLI, so it does not
153
+ require a workspace SDK reinstall. It describes this **configuration file**,
154
+ not an Action completion payload. It
155
+ covers the requirements-only state before Provider selection: `indexers` must
156
+ be empty here. Later the Provider selection Route fills that array.
157
+
158
+ Start with this complete YAML example. Replace the example source reference,
159
+ reader goals and coverage domains with the agreed project requirements:
160
+
161
+ ```yaml
162
+ protocol: context.indexer.registry/v1
163
+ requirements:
164
+ - id: component-guide
165
+ purpose: Help application developers integrate components and look up their public API.
166
+ reader_goals: [understand-components, integrate-components]
167
+ coverage_domains:
168
+ component-usage: required
169
+ public-api: required
170
+ target_scope:
171
+ targets:
172
+ - source_ref: repo:20260901/component-library
173
+ evidence_source_scope:
174
+ targets:
175
+ - source_ref: repo:20260901/component-library
176
+ indexers: []
177
+ ```
178
+
179
+ | Field | What to write |
180
+ | --- | --- |
181
+ | `protocol` | Exactly `context.indexer.registry/v1` for the file. |
182
+ | `requirements` | One or more knowledge goals, grouped by reader need; not one entry per file or symbol. |
183
+ | `id` | A unique, readable identifier for this requirement. |
184
+ | `purpose` | Optional short natural-language reader and task purpose; reuse explicit existing goals when absent. |
185
+ | `reader_goals` | One or more readable goal identifiers, such as `integrate-components`. These are not Provider names. |
186
+ | `coverage_domains` | A nonempty map of intended information categories to `required`, `optional` or `out-of-scope`. Provider selection must cover the required categories. |
187
+ | `target_scope.targets` | Sources whose subjects the knowledge should describe. At least one target is required. |
188
+ | `evidence_source_scope.targets` | Sources the Agent may read to support that knowledge. Include the relevant target sources and any agreed supporting documents. At least one is required. |
189
+ | `source_ref` | The source type plus its complete registered name, such as `repo:20260901/component-library`, `file:20260901/usage-guide` or `lark:20260901/faq`. Saved text uses `note:20260908/topic.md` or `sessions:20260908/topic.md`. Preserve the actual name, not these examples. |
190
+ | `module_refs` | Optional on each target; omit for the complete registered source boundary. Supply only known module references for an explicitly narrower scope. Do not invent a module merely because the source is a code module. |
191
+ | `questions` | Optional structured contract-question bindings, not free-text user questions. Omit unless an actual CLI/profile contract supplies their references, versions and digests. Never invent hashes. |
192
+ | `exclusions` | Optional explicit exclusions with `id`, `scope.targets` and a nonempty `reason`. For repository input, optional `paths` lists exact source-relative files or directories, without globs; omitted means the whole named scope. Agreed paths are filtered before Parser and Partition. A shared Indexer retains material still needed by another requirement. Omit when none were agreed. |
193
+ | `indexers` | `[]` until the next Route selects Providers. Do not copy version or integrity values from an unrelated project. |
194
+
195
+ Requirement, goal, domain and exclusion identifiers use lowercase letters,
196
+ digits and `._/-`; the first character is a letter or digit, and slash-separated
197
+ segments cannot be empty, `.` or `..`. Requirement ids and goal lists must not
198
+ contain duplicates. Each scope lists a source once; put its selected modules in
199
+ that target's `module_refs` rather than repeating the source.
200
+
201
+ For document-only knowledge, use the selected captured `file:` or `lark:` source,
202
+ or saved `note:` or `sessions:` source, in both scopes. Saved text must first be
203
+ explicitly selected in the project's `sources`; saving alone is not selection. For a code guide supported by a FAQ, keep the code source in the target
204
+ scope and include both code and FAQ in the evidence scope. If the FAQ also needs
205
+ independent knowledge coverage, include it as a target in the appropriate
206
+ requirement; do not silently treat all captured documents as background.
207
+ Source references identify selected source boundaries, not filesystem paths, URLs,
208
+ image ids, span references or content digests. A repo source already registered
209
+ at a package subdirectory remains bounded to that subdirectory when
210
+ `module_refs` is omitted.
211
+
212
+ Three existing input shapes have different roles:
213
+
214
+ - `src/indexers.yaml`: `protocol: context.indexer.registry/v1`, `requirements`,
215
+ and `indexers`.
216
+ - `IndexRequirementSet`: `protocol: context.indexer.requirement-set/v1` and
217
+ `requirements` only. This is the SDK's requirement value, not the whole file.
218
+ - Diagnostic `inspect-index-requirements --input`: an envelope with
219
+ `protocol: context.indexer.requirement-inspection-input/v1`, `project_ref`
220
+ (the workspace root) and `requirements`; optional `question_contracts` are
221
+ only for real resolved contract questions. It does not accept the whole
222
+ registry or a bare requirement set, and is not a mandatory bootstrap step.
223
+
224
+ After editing the named configuration file, run `context status --format json`
225
+ and follow its new current Route. The next step is Provider selection. Do not
226
+ submit the YAML through `complete-current`, fabricate a lifecycle Result,
227
+ restart the workspace or recapture existing sources.
42
228
 
43
229
  ## Six-level customization ladder
44
230
 
@@ -63,20 +249,33 @@ conforming-looking file.
63
249
 
64
250
  ## Upgrade and conflict handling
65
251
 
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.
252
+ For a CLI-bundled instruction Provider, resume with the installed Skill and
253
+ portable distribution. A version or content change alone does not require
254
+ Provider selection, registry edits, source capture or a restart. The CLI
255
+ refreshes the current batch's instruction resources and Route revision;
256
+ the Agent follows the returned Route without comparing fingerprints.
257
+
258
+ Compatible tasks keep their original request/result records. Instruction or
259
+ template edits do not, by themselves, discard accepted groups or authored
260
+ content. Changes to sources, requirements, executable programs, configuration,
261
+ result contracts or semantic extension inputs remain work invalidation reasons;
262
+ old results must not be relabeled as outputs of a different task.
263
+
264
+ Executable/external Providers continue using their resolved staged programs.
265
+ Updating instruction delivery does not replace executable code or grant new
266
+ execution permissions. Local customization files remain user-owned:
70
267
 
71
268
  - An unchanged upstream resource keeps the local override current.
72
- - A changed resource outside the override makes only its dependent units stale.
269
+ - A changed instruction resource outside the override refreshes guidance for
270
+ pending work, without automatically regenerating completed knowledge.
73
271
  - A changed resource under an instruction/template/program override returns
74
272
  `indexer-customization-upstream-changed`; rebase or remove the override.
75
273
  - Missing, undeclared, escaping or contract-conflicting local resources return
76
274
  `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.
275
+ - A missing CLI-bundled Provider or selected profile/operation/composer returns
276
+ the existing Provider selection Action, with its schema and next command.
277
+ Captured sources and completed knowledge are retained. External distributions
278
+ that cannot be resolved still require the existing resolution/selection flow.
80
279
  - Multiple primary owners return a conflict for explicit resolution. Do not
81
280
  use discovery order or a preferred Provider name as a tie-breaker.
82
281
 
@@ -90,15 +289,17 @@ These outcomes all point back to this guide:
90
289
  | Outcome | Required next action |
91
290
  | --- | --- |
92
291
  | `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. |
292
+ | `provider-unavailable` / `indexer-provider-unavailable` | Follow the current selection/resolution Action to restore the missing capability. A historical bundled content pin alone is not a failure. |
94
293
  | `indexer-customization-required` | Follow the six-level ladder using only the returned current gap proof. |
95
294
  | `indexer-customization-invalid` | Remove undeclared/escaping/conflicting files, then rebuild and restage the proposal. |
96
295
  | `indexer-customization-upstream-changed` | Reconcile the upstream change with every affected override and rerun final validation. |
97
296
 
98
297
  ## Debugging commands
99
298
 
100
- Use `--help` for the current payload schema and copy Route-returned commands
101
- when available:
299
+ These are diagnostic/manual primitives, not a checklist for normal selection.
300
+ Use them only for an explicit diagnostic or a returned recovery. `--help`
301
+ describes command options, not necessarily the payload fields. Use the current
302
+ Route's schema and the initial registry contract above; prefer Route-returned commands:
102
303
 
103
304
  ```bash
104
305
  context indexer catalog --format json
@@ -138,3 +339,78 @@ Selection/customization is complete only when all of these are true:
138
339
 
139
340
  For the complete manifest and execution surface, see
140
341
  [Indexer Provider protocol](../reference/indexer-provider-protocol.md).
342
+
343
+ ## Purpose, page selection, and delivery
344
+
345
+ `purpose` is an optional short description of the intended reader and task.
346
+ Existing `reader_goals` remain valid when it is absent. Context passes this
347
+ requirement through Partition, Author, and Review; it does not classify free
348
+ text against a fixed vocabulary.
349
+
350
+ After representative reading and necessary scope discussion, substantial new work
351
+ can preserve the decisions in `.tmp/work-start-report.md` before Partition.
352
+ The current workflow supplies `procedure.work-start-report` and
353
+ `template.work-start-report`: a readable report with its existing requirement
354
+ reference, use scenarios, scope choices, proposed classifications, first delivery
355
+ and actual execution settings. Lightweight edits keep a short summary. The report
356
+ is scratch context, not a published Artifact, a new approval or a condition for
357
+ advancing the workflow. On its first presentation, invite the user to read and
358
+ correct it and pause for that response, including in managed mode, unless they
359
+ explicitly waived this reading opportunity. Reuse the response and report when
360
+ continuing the same task; do not add a per-batch pause or report-status field.
361
+
362
+ Partition may select `artifact_intent` and `template_id` from the current
363
+ Provider catalog, along with `reader_task`, `outline`, `priority`, and
364
+ `delivery_boundary`. These choices are saved in the existing page plan and
365
+ reused by Author retries. Program templates declare `kind: page-program` in the
366
+ Provider's template resources. Only the selected program is included in the
367
+ Author View; procedure templates remain shared instructions. Workspace template
368
+ overrides retain priority over the bundled default.
369
+
370
+ Selected Code page programs append a deterministic public-contract table to the
371
+ same Candidate as its semantic explanation. Declarations provide field types,
372
+ requiredness, explicit defaults, signatures, and supported registration facts.
373
+ Missing declarations remain explicit; reference tables do not substitute for
374
+ source-backed examples, behavior, or change guidance.
375
+
376
+ The first readable delivery normally contains one to three pages. Subsequent
377
+ batches contain 30–50 pages, or a smaller final tail. Context retains accepted
378
+ Results across Review, close, and build, then continues the remaining pages.
379
+ `context run --deliver --format json` requests an earlier checkpoint. It keeps
380
+ the current approval rules. Status reports page counts and built preview paths;
381
+ Author task counts are reported separately.
382
+
383
+
384
+ ## Source-specific Providers and Host switches
385
+
386
+ The default distribution includes Code, Markdown, Note and Sessions Providers.
387
+ `context-note-indexer` interprets saved records/excerpts/observations;
388
+ `context-sessions-indexer` interprets bounded conversation summaries, with or
389
+ without code associations. Their shared markdown domain reuses document reading
390
+ and profiles; it does not force all sources through Markdown's semantic policy.
391
+ See [note preparation](note.md) and [sessions preparation](sessions.md).
392
+
393
+ The host owns installation and enabled/disabled switches. Business skills may be
394
+ installed by any supported host channel. Discover relevant currently visible
395
+ `context-…-indexer…` skills and read the real sibling manifest; the prefix alone
396
+ is not compatibility proof. Declare the selected business Provider through the
397
+ existing host_visible_skills and indexers result. It can replace a default without
398
+ enabling that default. CLI validates/resolves what was declared; it does not scan
399
+ host caches or maintain a second business-skill enable registry. Respect explicit
400
+ user exclusions even when the bundled catalog contains the default.
401
+
402
+ Choose the page owner from reader need. A note may improve an existing guide,
403
+ answer a FAQ or justify a new reference topic. A session without code may justify
404
+ a decision or process guide. Neither saving nor source type requires a new page.
405
+ For a Code/Markdown page retain its primary and include the actual supporting
406
+ source in evidence/read scope. When specialized source interpretation is needed,
407
+ select a Note/Sessions extension layer and the matching namespaced profile
408
+ (`note/component-library` or `sessions/component-library`, for example) with
409
+ `kind: extension`. The manifest declares each supported base. Supporting profiles
410
+ with `kind: supporting` must come from the same primary layer. One primary writes
411
+ the final page; extension guidance does not create another production target.
412
+
413
+ Optional sessions `changes` records known commit/MR associations in the source
414
+ file. Existing structure.yaml source/section links connect knowledge to it.
415
+ Do not add per-page commit, session or Provider frontmatter. A reference is not
416
+ proof of merging/testing and does not expand source-read authorization.