@c4a/context 0.7.1 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -170
- package/README.zh-CN.md +52 -129
- package/docs/README.md +9 -10
- package/docs/README.zh-CN.md +6 -7
- package/docs/getting-started.md +73 -428
- package/docs/guides/agent-guide.md +94 -518
- package/docs/guides/code-indexer-skill-authoring.md +24 -13
- package/docs/guides/markdown-indexer-skill-authoring.md +14 -14
- package/docs/reference/code-extractors.md +29 -121
- package/docs/reference/indexer-provider-protocol.md +43 -110
- package/docs/reference/package-templates.md +2 -3
- package/docs/reference/project-api.md +52 -986
- package/index.d.ts +10 -8
- package/index.js +4739 -7103
- package/indexerAgentStepProtocol.d.ts +1366 -7649
- package/indexerArtifact.d.ts +225 -0
- package/indexerArtifactDependencies.d.ts +41 -39
- package/indexerArtifactResult.d.ts +219 -252
- package/indexerAuthorizedWorksetView.d.ts +368 -0
- package/indexerBaseQuestionAmendment.d.ts +484 -280
- package/indexerBenchmark.d.ts +16 -16
- package/indexerCandidateCompile.d.ts +66 -60
- package/indexerCapabilityGroupEvidence.d.ts +6 -6
- package/indexerCatalogFallback.d.ts +122 -128
- package/indexerCollectionMapping.d.ts +13 -13
- package/indexerContentLayers.d.ts +8 -8
- package/indexerContractOverlay.d.ts +10 -10
- package/indexerControlledInvocation.d.ts +12 -12
- package/indexerControlledProgram.d.ts +2467 -2797
- package/indexerCoreExports.d.ts +6 -6
- package/indexerCustomizationDraft.d.ts +3315 -2091
- package/indexerCustomizationLadder.d.ts +2 -2
- package/indexerDependencyView.d.ts +108 -108
- package/indexerEffectiveArtifact.d.ts +1134 -0
- package/indexerEvidenceAdapterAuthorityMerge.d.ts +48 -0
- package/indexerEvidenceAdapterResult.d.ts +52 -52
- package/indexerExampleDecision.d.ts +128 -128
- package/indexerExampleIdentity.d.ts +6 -6
- package/indexerGeneratedAuthoringAudit.d.ts +18 -18
- package/indexerIncrementalImpact.d.ts +16 -16
- package/indexerInspectorWorksetProjection.d.ts +6 -0
- package/indexerInventoryDisposition.d.ts +70 -70
- package/indexerLayerComposition.d.ts +2139 -373
- package/indexerLayoutChange.d.ts +10 -10
- package/indexerLayoutProposalSet.d.ts +71 -66
- package/indexerLayoutResolver.d.ts +53 -48
- package/indexerLayoutTransition.d.ts +0 -50
- package/indexerLifecycle.d.ts +0 -13
- package/indexerMainLifecycle.d.ts +10 -0
- package/indexerMainRunLedger.d.ts +138 -11
- package/indexerMainRunProtocol.d.ts +1406 -785
- package/indexerMainWorkset.d.ts +460 -206
- package/indexerMaterialGapLedger.d.ts +13 -2904
- package/indexerOverlayQuestionAmendment.d.ts +491 -287
- package/indexerOverlayQuestionApplyProposal.d.ts +1022 -614
- package/indexerParserCapabilityCatalog.d.ts +136 -0
- package/indexerParserCoordinate.d.ts +16 -16
- package/indexerParserDependencyIntent.d.ts +22 -0
- package/indexerParserExecutionPlan.d.ts +388 -0
- package/indexerParserFactView.d.ts +42 -22
- package/indexerPartitionConvergence.d.ts +0 -3
- package/indexerPartitionInventory.d.ts +2 -0
- package/indexerPartitionPlan.d.ts +101 -99
- package/indexerPhysicalArtifactManifest.d.ts +8 -8
- package/indexerPostAuthorComposition.d.ts +116 -1156
- package/indexerPostAuthorRunLedger.d.ts +1434 -280
- package/indexerPrimaryProjection.d.ts +10 -10
- package/indexerPrimaryResultView.d.ts +435 -0
- package/indexerProfileContract.d.ts +181 -181
- package/indexerProgramExecutionAuthorization.d.ts +12 -12
- package/indexerProgramRunProtocol.d.ts +2141 -2749
- package/indexerProjectProposal.d.ts +496 -292
- package/indexerProjectedArtifactFanOutAudit.d.ts +0 -3
- package/indexerProtocolCommon.d.ts +4 -1
- package/indexerProvider.d.ts +134 -218
- package/indexerProviderComposition.d.ts +53 -53
- package/indexerProviderResolution.d.ts +12 -12
- package/indexerProviderResolutionAction.d.ts +14 -14
- package/indexerProviderRouting.d.ts +923 -515
- package/indexerProviderSelectionProposal.d.ts +893 -485
- package/indexerQuestionAuthority.d.ts +46 -47
- package/indexerReaderTargetInventory.d.ts +8 -8
- package/indexerRegistry.d.ts +765 -357
- package/indexerRequirementConfirmation.d.ts +98 -98
- package/indexerRequirementLifecycle.d.ts +224 -224
- package/indexerResultReconciliation.d.ts +204 -5919
- package/indexerResultReconciliationRun.d.ts +0 -1
- package/indexerRunEnvelope.d.ts +20 -20
- package/indexerSemanticInput.d.ts +3678 -0
- package/indexerStructuredDeclaration.d.ts +57 -53
- package/indexerSubjectCatalog.d.ts +14 -14
- package/indexerSubjectIdentity.d.ts +2 -2
- package/indexerSubjectKeyAuthority.d.ts +31 -30
- package/indexerTemplateRendering.d.ts +64 -64
- package/indexerToolSnapshot.d.ts +8 -8
- package/package.json +1 -1
- package/phases.d.ts +3 -183
- package/codeIndexPlan.d.ts +0 -158
- package/indexerAuditFacts.d.ts +0 -66
- package/indexerAuditOverrideReadiness.d.ts +0 -27
- package/indexerAuditProtocol.d.ts +0 -238
- package/indexerAuditRevision.d.ts +0 -726
- package/indexerAuditRevisionActions.d.ts +0 -236
- package/indexerMaterialAnswer.d.ts +0 -738
- package/indexerMaterialAnswerActualization.d.ts +0 -91
- package/indexerMaterialAnswerExecutionPlan.d.ts +0 -2887
- package/indexerMaterialAnswerFlow.d.ts +0 -63
- package/indexerMaterialAnswerLayout.d.ts +0 -76
- package/indexerMaterialAnswerReview.d.ts +0 -217
- package/indexerMaterialAnswerReviewRoute.d.ts +0 -6145
- package/indexerMaterialAnswerRunLedger.d.ts +0 -918
- package/indexerMaterialAnswerRunProtocol.d.ts +0 -1253
- package/indexerMaterialQuestionExclusion.d.ts +0 -129
- package/indexerMaterialQuestionWorkset.d.ts +0 -508
- package/indexerPlannedMaterialAnswer.d.ts +0 -116
- package/indexerProfileMetricAudit.d.ts +0 -218
- package/indexerWorksetRead.d.ts +0 -287
|
@@ -1,520 +1,96 @@
|
|
|
1
1
|
# Agent Guide
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
current
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
##
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`knowledge/decisions.json` rejected candidate ID-to-fingerprint map.
|
|
98
|
-
- `knowledge/structure.yaml.source_inputs` contains only source, collection,
|
|
99
|
-
and consumed snapshot hash for closed prose targets. It lets status detect a
|
|
100
|
-
changed or unfinished target without retaining lifecycle snapshots.
|
|
101
|
-
- `dist/` contains generated package outputs.
|
|
102
|
-
- `.tmp/agent-payloads/` is the recommended location for transient inputs written
|
|
103
|
-
by the Agent for CLI commands. It is not enforced, but avoids introducing
|
|
104
|
-
top-level scratch directories; remove these files after the corresponding
|
|
105
|
-
stage or apply succeeds unless the user explicitly wants to retain them.
|
|
106
|
-
- file and Lark documents from one date live as sibling files under `sources/file/<date>/` and `sources/lark/<date>/`; each date directory has one shared `manifest.json`.
|
|
107
|
-
- `.tmp/context-runtime/` contains ignored runtime cache, logs, review HTML, previews, and locks. Successful close removes completed lifecycle and review runtime state.
|
|
108
|
-
|
|
109
|
-
Do not create hidden workspace state directories.
|
|
110
|
-
|
|
111
|
-
## Workflow resources and entrypoints
|
|
112
|
-
|
|
113
|
-
Long procedures, semantic judgment rules, schemas, and current workspace views
|
|
114
|
-
are published as Context workflow resources. Status returns only the resources
|
|
115
|
-
selected for the current route. Read required resources before acting; use
|
|
116
|
-
recommended resources only when the current evidence or diagnostic needs them.
|
|
117
|
-
Do not preload every workflow resource or SDK manual.
|
|
118
|
-
|
|
119
|
-
Present only the current workflow surface:
|
|
120
|
-
|
|
121
|
-
| Task | Current route |
|
|
122
|
-
|---|---|
|
|
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
|
-
| 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 | 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. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
131
|
-
|
|
132
|
-
Judgment behavior is part of evidence views, source span resolvers, repair
|
|
133
|
-
hints, review/status diagnostics, OKF indexes, and package query discipline. Do
|
|
134
|
-
not describe unsupported commands or unsupported lifecycle state as alternate
|
|
135
|
-
routes.
|
|
136
|
-
|
|
137
|
-
## Source Safety
|
|
138
|
-
|
|
139
|
-
The CLI never silently clones, checks out, resets, fetches, installs, builds, or
|
|
140
|
-
runs scripts inside source repositories. If a repo operation is needed, ask the
|
|
141
|
-
user first.
|
|
142
|
-
|
|
143
|
-
`missing-source` is a human gate. In user-facing language, describe the next
|
|
144
|
-
action as adding a knowledge source, not as filling CLI placeholders. Treat this
|
|
145
|
-
as a source boundary decision. Document sources use today's local date as their
|
|
146
|
-
name. Repo sources use the date as a batch and require the confirmed module
|
|
147
|
-
identity. Do not invent semantic date suffixes. The concrete repo selector
|
|
148
|
-
appears in source refs, phase ids, and codeindex paths:
|
|
149
|
-
|
|
150
|
-
```text
|
|
151
|
-
knowledge/<collection>/<slug>.md
|
|
152
|
-
knowledge/<collection>/<containment>/<slug>.md # intentional hierarchy only
|
|
153
|
-
repo:<date>/<module>#symbol:...
|
|
154
|
-
file:<source-name>/<document>#span:...
|
|
155
|
-
lark:<source-name>/<document>#span:...
|
|
156
|
-
capture:file:<source-name>
|
|
157
|
-
align:lark:<source-name>:architecture
|
|
158
|
-
dist/<source-name>-kb/
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Every prose View requires a stable filename `slug`. The CLI derives its path
|
|
162
|
-
from collection, slug, and optional `containment`; omit `path` from the input.
|
|
163
|
-
Supply `containment` only for an intentional parent/child hierarchy;
|
|
164
|
-
independent collection entries stay directly under the collection.
|
|
165
|
-
Codegraph paths use the registered date/module grouping before the symbol slug.
|
|
166
|
-
|
|
167
|
-
Ask what the user wants the source to cover: a single local Markdown/MDX document,
|
|
168
|
-
a local Markdown/MDX directory, an article/documentation repository as a file
|
|
169
|
-
source, a Lark/Feishu document URL or token, a local code repo/package, or a
|
|
170
|
-
remote Git repo/package. Repo sources use today's date as one batch and a
|
|
171
|
-
confirmed `--module` identity; do not create date suffixes for separate
|
|
172
|
-
packages. The CLI rejects non-date or impossible repo batch names. Use
|
|
173
|
-
`context source ensure <date>` / `context source inspect <date>` to operate on
|
|
174
|
-
all registered modules in one batch, or `<date>/<module>` for one module.
|
|
175
|
-
If the user supplies several repo/file/Lark sources in one request, create one
|
|
176
|
-
`context source add batch <date> --input <payload> --format json` payload and
|
|
177
|
-
register them under a single project write lock. Never parallelize mutating
|
|
178
|
-
`source add` commands; on a lock-held error, wait and retry.
|
|
179
|
-
|
|
180
|
-
Do not select sources from repository layout or Git metadata. After the user
|
|
181
|
-
has named an exact local module or path, however, resolving one unique matching
|
|
182
|
-
directory and reading its Git root, `origin`, and current commit are mechanical
|
|
183
|
-
identity checks. Pass the resolved local path relative to the Context project
|
|
184
|
-
root; when the workspace was initialized in a child `context/` directory,
|
|
185
|
-
recompute sibling paths from that new root. In ordinary and fully managed modes,
|
|
186
|
-
do not request a remote URL again when that confirmed local checkout provides
|
|
187
|
-
it.
|
|
188
|
-
|
|
189
|
-
Current execution supports repo sources, local Markdown/MDX file sources, and Lark /
|
|
190
|
-
Feishu document sources. Local
|
|
191
|
-
repo/package sources are registered with `context source add repo [YYYYMMDD] --module <module> --local <path>`;
|
|
192
|
-
the materialized `sources/repo/<date>/<module>` entry is an ignored
|
|
193
|
-
relative symlink to the selected checkout or subdirectory view. If the source
|
|
194
|
-
and Context workspace share a Git root, absolute input is normalized to a
|
|
195
|
-
workspace-relative repo root plus `subpath`; do not rewrite it back to an
|
|
196
|
-
absolute machine path. Local Markdown/MDX sources
|
|
197
|
-
are registered with `context source add file [YYYYMMDD] --module <module> --local <path>` plus any
|
|
198
|
-
needed `--include` patterns, captured with `captureFile`, then planned through
|
|
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
|
-
clone/checkout; clone into an ignored local path, checkout the requested commit,
|
|
204
|
-
then register that local checkout. Do not commit cloned source content. Lark /
|
|
205
|
-
Feishu sources are registered as document modules under a shared date batch,
|
|
206
|
-
captured through the Lark capture phase, and written as committed snapshots
|
|
207
|
-
as a sibling file under `sources/lark/<date>/`, tracked by the date-level `manifest.json`;
|
|
208
|
-
do not fetch or import Lark content with ad hoc scripts.
|
|
209
|
-
If the user requests multiple documents together, register and declare all of
|
|
210
|
-
them before capture. The user's explicit batch request supplies one read scope,
|
|
211
|
-
but it does not imply a mainline collection unless the user explicitly chose
|
|
212
|
-
one. Follow `workflow.current.commands`: run `immediate` items directly and run
|
|
213
|
-
`after-human-confirmation` items only after the current conversation contains
|
|
214
|
-
that confirmation. Preserve the returned workflow revision and authority flags
|
|
215
|
-
exactly. Do not ask for another date name or repeat the collection gate per
|
|
216
|
-
document.
|
|
217
|
-
|
|
218
|
-
## Current-step protocol
|
|
219
|
-
|
|
220
|
-
Treat `context status --format json` `workflow.current` as the complete
|
|
221
|
-
protocol for the current step:
|
|
222
|
-
|
|
223
|
-
- `availability` distinguishes an immediately executable route from a human
|
|
224
|
-
decision or a blocked route;
|
|
225
|
-
- `gate` identifies the decision, its authority, and whether a managed session
|
|
226
|
-
may resolve it;
|
|
227
|
-
- `configuration` identifies the exact project file and declaration action when
|
|
228
|
-
no CLI command is valid yet;
|
|
229
|
-
- `commands[].availability` says whether each command runs immediately or only
|
|
230
|
-
after user confirmation;
|
|
231
|
-
- `resources.required` is the complete mandatory context for this route;
|
|
232
|
-
- `resources.recommended` is optional follow-up context; and
|
|
233
|
-
- `after_action.evaluate` requires status to be evaluated again after the
|
|
234
|
-
action.
|
|
235
|
-
|
|
236
|
-
Read a resource `path` directly. If a resource provides `command`, execute that
|
|
237
|
-
revision-bound Context command and read the returned file. Long procedures and
|
|
238
|
-
semantic rules live in these resources; they are loaded progressively, not
|
|
239
|
-
discarded or shortened into the status response.
|
|
240
|
-
|
|
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.
|
|
258
|
-
|
|
259
|
-
Do not infer permission from the presence of a command. When
|
|
260
|
-
`workflow.current.commands` is empty, do not derive a lifecycle command from
|
|
261
|
-
prose; complete the returned `configuration` action or resolve the returned
|
|
262
|
-
gate, then rerun status.
|
|
263
|
-
|
|
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
|
|
272
|
-
what code area and symbol policy will become draft knowledge, then ask which
|
|
273
|
-
registered source and file/symbol range to ingest. Do not inspect the source
|
|
274
|
-
repository to choose packages or globs on the user's behalf. The
|
|
275
|
-
`route.extract.configuration-required` Route carries
|
|
276
|
-
`workflow.current.configuration` until that confirmed scope is declared; only
|
|
277
|
-
a declared phase can select `route.extract.pending-target` and return an
|
|
278
|
-
executable preview or extraction command.
|
|
279
|
-
|
|
280
|
-
For a fresh mixed-source workspace, capture every confirmed file/Lark source
|
|
281
|
-
first. If repo code is still unprocessed and document structure has not started,
|
|
282
|
-
`context status` prioritizes `route.extract.pending-target` over document
|
|
283
|
-
investigation. Complete code extraction and its batch Review before starting
|
|
284
|
-
prose align. Once a document structure draft exists, keep that current human
|
|
285
|
-
gate and do not switch workflows mid-review.
|
|
286
|
-
|
|
287
|
-
For monorepos, the date is one registration batch and every selected package is
|
|
288
|
-
a module under it. Stable codeindex paths omit that batch date and therefore
|
|
289
|
-
look like `knowledge/codeindex/module-a/...` and
|
|
290
|
-
`knowledge/codeindex/module-b/...`. Date/module remains in phase ids and
|
|
291
|
-
repo source refs. Use the whole repo/subspace
|
|
292
|
-
only for inspection when it contains multiple modules. If the user chooses
|
|
293
|
-
`packages/button`, register it with `--module button` under the same date and
|
|
294
|
-
write `extractTs({ source: source("20260712", "button"), ... })`. Do not use
|
|
295
|
-
`include: ["packages/button/src/**"]` to choose a package from a larger source;
|
|
296
|
-
`include` only filters files inside the selected source. Repo module names are
|
|
297
|
-
project-wide codeindex identities; refresh an existing module through its
|
|
298
|
-
original date/module selector instead of reusing its name under a later date.
|
|
299
|
-
|
|
300
|
-
For a non-standard package, configure source-relative `entries` on `extractTs`;
|
|
301
|
-
every entry must match `include`. If the user wants all declarations in the
|
|
302
|
-
selected files instead of public API reachability, use `mode: "scan"`, which
|
|
303
|
-
needs no entries and defaults to including internal symbols. Never add an entry
|
|
304
|
-
file or package manifest field to the source repository solely to make Context
|
|
305
|
-
run.
|
|
306
|
-
|
|
307
|
-
Follow the source inspection pattern when scope is unclear: run
|
|
308
|
-
`context source inspect <date>/<module> --format json`, show the candidate package
|
|
309
|
-
paths from that CLI output, wait for the user to choose the package path(s), then
|
|
310
|
-
declare sources/phases. If the extraction preview reports modules outside the
|
|
311
|
-
confirmed source boundary, stop before review and repair the source declaration.
|
|
312
|
-
|
|
313
|
-
Before running extraction, prefer:
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
context source inspect <date>/<module> --format json
|
|
317
|
-
context run <extract-phase-id> --dry-run --format json
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
After the preview, run codeindex extraction normally unless the user explicitly
|
|
321
|
-
asked for CI/CD automation. The first normal run requires Review for all code
|
|
322
|
-
candidates. Subsequent normal runs require Review only for added, changed, or
|
|
323
|
-
removed symbols; unchanged approved symbols stay approved. After each result,
|
|
324
|
-
run `context status --format json`. `continue-codeindex-batch` only requests
|
|
325
|
-
workspace re-evaluation. Open Review only when
|
|
326
|
-
`workflow.current.gate.id=knowledge-review`; otherwise execute the current
|
|
327
|
-
route.
|
|
328
|
-
|
|
329
|
-
For a non-interactive pipeline, use `context run <extract-phase-id>
|
|
330
|
-
--auto-promote --format json`. This flag applies only to codeindex, applies its
|
|
331
|
-
deterministic deltas, refreshes deterministic close when needed, runs verify,
|
|
332
|
-
and fails the command if close or verify fails. Read `autoPromotion.close` and
|
|
333
|
-
`autoPromotion.verify` before continuing. Package build remains explicit: when
|
|
334
|
-
the pipeline publishes packages, run `context build` after successful auto
|
|
335
|
-
promotion. Never use auto promotion for semantic knowledge collections.
|
|
336
|
-
|
|
337
|
-
Use the preview `mode`, optional `entries`, `preview.sources[].modules[]`,
|
|
338
|
-
`entryFiles`, exported/internal symbol counts, `candidateKinds`,
|
|
339
|
-
`candidateEstimate`, and `agent_hints`
|
|
340
|
-
fields as the authoritative scope check. To the user, call it a preview without
|
|
341
|
-
writing candidates; avoid the internal CLI term. Also show `knowledgeTree` and
|
|
342
|
-
`knowledgePathExamples` before first extraction.
|
|
343
|
-
|
|
344
|
-
These are structural extractor facts. Do not turn kind counts or file paths
|
|
345
|
-
into a product-specific recommendation unless the user or Agent supplies that
|
|
346
|
-
judgment.
|
|
347
|
-
|
|
348
|
-
Treat `NO_ENTRY_DETECTED` as a configuration failure: choose explicit
|
|
349
|
-
`entries`, or use `mode: "scan"` when the intended scope is all matched files;
|
|
350
|
-
never report an empty extraction as success. Report discovered, AST-analyzed,
|
|
351
|
-
skipped, symbol, and relation counts separately. The extractor follows
|
|
352
|
-
tsconfig/jsconfig `baseUrl` and `paths`, so do not ask users to rewrite `@/`
|
|
353
|
-
imports solely for Context. Explain the concrete output shape:
|
|
354
|
-
|
|
355
|
-
```text
|
|
356
|
-
knowledge/codeindex/<module>/symbol/<slug>.md
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
If the module or resulting path shape looks wrong, stop and repair the
|
|
360
|
-
module registration before running extraction. An extra repeated package
|
|
361
|
-
segment below the module may indicate an over-broad source boundary. Do not write ad hoc scripts to
|
|
362
|
-
count packages, parse `package.json`, or sample the lifecycle candidate ledger.
|
|
363
|
-
|
|
364
|
-
## Review Rules
|
|
365
|
-
|
|
366
|
-
- Use `context review html <collection> --open --format json` for visual review.
|
|
367
|
-
Check `opened`: say the browser opened only when it is `true`; otherwise
|
|
368
|
-
report `open_error` and provide the emitted `file_url` plus `absolute_path`.
|
|
369
|
-
- Use `context review list <collection>` only for a textual overview.
|
|
370
|
-
- Ask the user to paste the copied review decision Payload into chat. Uniform
|
|
371
|
-
decisions use one JSON line; exceptions add JSONL lines. The agent writes
|
|
372
|
-
that pasted payload to a temporary scratch file and runs `context review apply
|
|
373
|
-
<payload-file>` only after the user has reviewed and provided the payload.
|
|
374
|
-
- Do not synthesize review payloads from HTML, JSON, runtime snapshots, or
|
|
375
|
-
candidate ids.
|
|
376
|
-
- Do not default candidates to approved/rejected on behalf of the user.
|
|
377
|
-
- If the user explicitly authorizes a quick or automated decision, use
|
|
378
|
-
`context review approve <candidate-id> --collection <collection>` /
|
|
379
|
-
`context review reject <candidate-id> --collection <collection>` or `--all`.
|
|
380
|
-
These commands still enforce the scoped candidate-id gate.
|
|
381
|
-
- Do not edit approved Markdown by hand as part of review apply.
|
|
382
|
-
|
|
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.
|
|
390
|
-
|
|
391
|
-
For such an existing declaration, the compatibility sequence is:
|
|
392
|
-
|
|
393
|
-
1. investigate material through Context evidence views;
|
|
394
|
-
2. propose a structure draft with nodes, section plans, supported edges, and
|
|
395
|
-
unresolved items;
|
|
396
|
-
3. resolve only the non-mechanical blockers until validation state is `ready`,
|
|
397
|
-
stage the structure, open its HTML report, then follow the current Route's
|
|
398
|
-
structure-confirmation gate;
|
|
399
|
-
4. compile source-bound draft pages from confirmed structure;
|
|
400
|
-
5. send compiled drafts through human review, then close and build.
|
|
401
|
-
|
|
402
|
-
One file per page is still possible, but it is represented as a simple
|
|
403
|
-
structure draft. It does not bypass structure confirmation or compile.
|
|
404
|
-
|
|
405
|
-
Material investigation:
|
|
406
|
-
|
|
407
|
-
```bash
|
|
408
|
-
context run align:<type>:<source>:<collection> --view read-plan --format json
|
|
409
|
-
context run align:<type>:<source>:<collection> --view source-index --compact --format json
|
|
410
|
-
context run align:<type>:<source>:<collection> --view span-detail --span <source-ref> --format json
|
|
411
|
-
context run align:<type>:<source>:<collection> --view span-text --span <source-ref> --format json
|
|
412
|
-
context run align:<type>:<source>:<collection> --view existing-knowledge --query <title-or-stable-ref> --format json
|
|
413
|
-
context run align:<type>:<source>:<collection> --view schema --format json
|
|
414
|
-
context run align:<type>:<source>:<collection> --validate --input <structure.yaml> --format json
|
|
415
|
-
context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
|
|
416
|
-
context run align:<type>:<source>:<collection> --stage --input <structure.yaml> --format json
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
Read source material only through these evidence views. `source-index` gives a
|
|
420
|
-
compact refs-first map when run with `--compact`; use `span-detail` /
|
|
421
|
-
`span-text` only for exact evidence. Before introducing a new Node identity,
|
|
422
|
-
use the targeted `existing-knowledge` View returned by the read plan to inspect
|
|
423
|
-
approved stable refs; do not inspect `knowledge/**` directly. The CLI applies
|
|
424
|
-
deterministic boundary repairs internally and returns only blockers that need
|
|
425
|
-
Agent judgment. For oversized Views, use the returned structural diagnostics
|
|
426
|
-
while classifying
|
|
427
|
-
child Nodes from evidence. Stage only after validation state is `ready`; stage
|
|
428
|
-
opens the final `structure-summary` report for the current Route's confirmation
|
|
429
|
-
gate. Ask a separate structure-design question only when evidence supports
|
|
430
|
-
multiple incompatible semantic choices. Do not inspect `sources/` or `.tmp`
|
|
431
|
-
directly.
|
|
432
|
-
|
|
433
|
-
Compile:
|
|
434
|
-
|
|
435
|
-
```bash
|
|
436
|
-
context run compile:<type>:<source>:<collection> --view read-plan --format json
|
|
437
|
-
context run compile:<type>:<source>:<collection> --validate --format json
|
|
438
|
-
context run compile:<type>:<source>:<collection> --stage --format json
|
|
439
|
-
context run compile:<type>:<source>:<collection> --view diagnostics --format json
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
Compile derives every candidate mechanically from the confirmed section ids,
|
|
443
|
-
kinds, ownership, and source spans. One stage command validates the complete
|
|
444
|
-
source/collection slot before atomically writing its candidates. The Agent does
|
|
445
|
-
not author compile actions or rewrite reader-visible body. Re-evaluate status
|
|
446
|
-
after the batch, finish any other structure slots, then open one
|
|
447
|
-
collection-level Review, apply one Payload, and run close once.
|
|
448
|
-
|
|
449
|
-
Relationships and cross references remain structure typed edges; compile does
|
|
450
|
-
not infer them or inject relation markers into verbatim body.
|
|
451
|
-
|
|
452
|
-
## Package Rules
|
|
453
|
-
|
|
454
|
-
If `workflow.current.reason_code` is `route.package.output-required`, treat it
|
|
455
|
-
as a human gate.
|
|
456
|
-
First read [Package Outputs](./package-outputs.md). Then explain the package
|
|
457
|
-
decision using concrete output trees, not unexplained labels.
|
|
458
|
-
|
|
459
|
-
Recommended first option:
|
|
460
|
-
|
|
461
|
-
```text
|
|
462
|
-
dist/<name>-kb/
|
|
463
|
-
├── AGENTS.md
|
|
464
|
-
├── skills/knowledge-query/SKILL.md
|
|
465
|
-
└── wikis/
|
|
466
|
-
├── index.md
|
|
467
|
-
├── <group-page>.md
|
|
468
|
-
└── <large-group>/index.md
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
This is an agent knowledge-base package. It is the recommended first output for
|
|
472
|
-
agent consumption; the internal `skills/` folder follows agent installation
|
|
473
|
-
conventions.
|
|
474
|
-
The package name already identifies the surrounding `dist/` directory. Its OKF
|
|
475
|
-
roots stay flat (`wikis/`, `guides/`, `rules/`, and `feats/`), so do not ask for
|
|
476
|
-
a second distribution namespace. Ask separately whether the author wants a
|
|
477
|
-
short Skill prefix; if so, maintain the complete final Skill directory name in
|
|
478
|
-
the template.
|
|
479
|
-
The default `knowledge-query` skill teaches agents to query copied OKF root
|
|
480
|
-
directories structure-first, starting with `wikis/`, cite
|
|
481
|
-
page/section evidence, use structure/build metadata when present, and report
|
|
482
|
-
gaps instead of inventing unsupported answers. Tell the user that
|
|
483
|
-
`src/package-templates/kb/` is editable before build, so they can customize the
|
|
484
|
-
query skill or add project-specific skills when needed.
|
|
485
|
-
|
|
486
|
-
Selected OKF root subtrees such as `wikis/`, `guides/`, `rules/`, and
|
|
487
|
-
`feats/` follow the C4A OKF Profile. The package root contains agent
|
|
488
|
-
installation files; the OKF-compatible interchange surface is the selected OKF
|
|
489
|
-
root directories. Tell the user they can customize
|
|
490
|
-
`src/package-templates/kb/wikis/index.md` before build to describe package
|
|
491
|
-
scope and query guidance. The default root index should list only next-level
|
|
492
|
-
entries. By default, `context build` links small directory contents directly
|
|
493
|
-
and generates a child index only when that directory contains more than 50
|
|
494
|
-
selected knowledge pages.
|
|
495
|
-
|
|
496
|
-
Alternative:
|
|
497
|
-
|
|
498
|
-
```text
|
|
499
|
-
dist/<name>-llms/
|
|
500
|
-
└── llms.txt
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
This is an LLM text bundle output for one model/RAG import file.
|
|
504
|
-
|
|
505
|
-
The user may also skip package output for now and keep only `knowledge/`.
|
|
506
|
-
|
|
507
|
-
Do not offer `both` as a shortcut. If the user wants multiple outputs, declare
|
|
508
|
-
one package first, build and inspect it, then ask before adding another.
|
|
509
|
-
|
|
510
|
-
Every package needs a template path. Treat `src/package-templates/kb` and
|
|
511
|
-
`src/package-templates/llms` as editable starting points, not final deliverables.
|
|
512
|
-
The agent knowledge-base package template must contain at least one `SKILL.md` and
|
|
513
|
-
`wikis/index.md`; otherwise it is a hollow package and should not be reported
|
|
514
|
-
as usable. Template paths also must not collide with copied knowledge paths.
|
|
515
|
-
When a collision is reported, rename the template file or exclude the knowledge
|
|
516
|
-
path before build.
|
|
517
|
-
|
|
518
|
-
Do not present a clean `context build`, clean `context verify`, or file count as
|
|
519
|
-
proof that the output is useful. Inspect the generated package shape against the
|
|
520
|
-
user's chosen output contract.
|
|
3
|
+
The Context Agent coordinates one knowledge-production lifecycle. It does not
|
|
4
|
+
invent a separate pipeline for code, documents, or a particular host.
|
|
5
|
+
|
|
6
|
+
## Start from the Route
|
|
7
|
+
|
|
8
|
+
Read `context status --format json`, then consume only the procedures, schemas,
|
|
9
|
+
and manuals selected by `workflow.current.resources`. Preserve revision and
|
|
10
|
+
authority flags in the next command. Do not infer progress from filenames or
|
|
11
|
+
probe ignored runtime files when the Route already states the next action.
|
|
12
|
+
|
|
13
|
+
## Stable decisions
|
|
14
|
+
|
|
15
|
+
Ask the user only when the answer changes a durable boundary:
|
|
16
|
+
|
|
17
|
+
- which source or module is in scope;
|
|
18
|
+
- which readers and questions matter;
|
|
19
|
+
- whether two subjects are the same knowledge owner;
|
|
20
|
+
- whether a Provider customization or executable extension is acceptable;
|
|
21
|
+
- whether the proposed semantic outline organizes the requested knowledge;
|
|
22
|
+
- whether the displayed Candidate content is approved.
|
|
23
|
+
|
|
24
|
+
The Agent may decide mechanical details from evidence: parser selection within
|
|
25
|
+
an approved Provider, deterministic partition execution, page slug generation,
|
|
26
|
+
and recovery of an already completed step.
|
|
27
|
+
|
|
28
|
+
## Authoring boundary
|
|
29
|
+
|
|
30
|
+
`src/index.ts` owns source capture and package output. `src/indexers.yaml` owns
|
|
31
|
+
knowledge requirements and Provider selection. Keep these responsibilities
|
|
32
|
+
separate.
|
|
33
|
+
|
|
34
|
+
Code and Markdown Providers receive controlled worksets and return typed
|
|
35
|
+
results. They do not write Candidate, Review, `knowledge/`, or `dist/` files.
|
|
36
|
+
Context validates and persists their result before the next action consumes it.
|
|
37
|
+
Initial Provider selection follows the same rule: use the requirements and
|
|
38
|
+
CLI-bundled catalog in the current Action input, return only non-CLI visible
|
|
39
|
+
Skill identities and semantic Indexer entries, and let the CLI perform routing,
|
|
40
|
+
resolution, staging, validation, and atomic registry apply. External resolver
|
|
41
|
+
results and non-allowlisted program decisions resume through subsequent
|
|
42
|
+
`complete-current` Routes; do not invoke the low-level Provider commands.
|
|
43
|
+
For Partition, Author, and Composer steps, read the Route-selected instructions
|
|
44
|
+
and Authorized Workset View, return only the compact semantic value requested
|
|
45
|
+
by the current schema, and submit it with the Route's single
|
|
46
|
+
`context action complete-current` command. Do not create a helper script or
|
|
47
|
+
construct internal Result, digest, receipt, Fact, or evidence-binding objects.
|
|
48
|
+
|
|
49
|
+
Parser packages are Provider internals. Do not expose parser choice as an
|
|
50
|
+
extra user workflow unless it changes coverage or requires executable code the
|
|
51
|
+
user has not authorized.
|
|
52
|
+
|
|
53
|
+
## Review boundary
|
|
54
|
+
|
|
55
|
+
Review is about the proposed knowledge, not the storage mechanism. Show:
|
|
56
|
+
|
|
57
|
+
- readable target paths and titles;
|
|
58
|
+
- concise summaries and relevant source paths;
|
|
59
|
+
- the final page content or a clear structural preview;
|
|
60
|
+
- conflicts, omissions, and forced-approval warnings that affect correctness.
|
|
61
|
+
|
|
62
|
+
Do not show evidence hashes, content-addressed IDs, execution receipts, or
|
|
63
|
+
other machine fields by default. Keep those in runtime state only when they are
|
|
64
|
+
needed for validation, stale detection, or recovery.
|
|
65
|
+
|
|
66
|
+
A compatible production round has two semantic judgments. The first checks the
|
|
67
|
+
outline after all Partition shards converge; the second checks the final
|
|
68
|
+
reader-facing Candidate set. Ordinary mode presents both to the user. Fully
|
|
69
|
+
managed mode lets the Agent resolve both with current-conversation authority.
|
|
70
|
+
A destructive or ambiguous layout change is separate and always human-only.
|
|
71
|
+
|
|
72
|
+
## Quality bar
|
|
73
|
+
|
|
74
|
+
Judge output from the reader's point of view:
|
|
75
|
+
|
|
76
|
+
- pages have semantic subjects rather than ordinal batches or symbol dumps;
|
|
77
|
+
- filenames and directories are readable and stable;
|
|
78
|
+
- content explains behavior, boundaries, examples, and constraints supported
|
|
79
|
+
by the source;
|
|
80
|
+
- templates are actually filled with source-specific information;
|
|
81
|
+
- duplicate pages and unsupported claims are absent;
|
|
82
|
+
- `dist/` is smaller and cleaner than the production workspace.
|
|
83
|
+
|
|
84
|
+
When dogfooding, compare the generated knowledge with an existing useful
|
|
85
|
+
knowledge base. Feed gaps back into the Provider profile, instructions,
|
|
86
|
+
templates, or parser coverage rather than editing generated pages by hand.
|
|
87
|
+
|
|
88
|
+
## Recovery and Git
|
|
89
|
+
|
|
90
|
+
Runtime artifacts under `.tmp/context-runtime/` may be rich because they are
|
|
91
|
+
local and disposable. Committed knowledge should contain only readable content
|
|
92
|
+
and metadata required for future updates or rebuilds. A successful close may
|
|
93
|
+
discard transient Review details.
|
|
94
|
+
|
|
95
|
+
Context completion does not authorize Git operations. Stage, commit, push,
|
|
96
|
+
publish, and deploy only when the user explicitly requests them.
|