@c4a/context 0.6.1-beta.1 → 0.6.1-beta.2
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 +9 -2
- package/README.zh-CN.md +5 -1
- package/contracts.d.ts +5 -0
- package/docs/README.md +5 -3
- package/docs/getting-started.md +45 -21
- package/docs/guides/agent-dialogue.md +38 -350
- package/docs/guides/agent-guide.md +118 -87
- package/docs/guides/package-outputs.md +69 -16
- package/docs/reference/package-templates.md +103 -20
- package/docs/reference/project-api.md +70 -74
- package/docs/reference/template-variables.md +27 -11
- package/index.d.ts +10 -3
- package/index.js +58 -4
- package/package.json +1 -1
- package/templates/package-templates/kb/AGENTS.md +10 -10
- package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +16 -15
- package/templates/package-templates/kb/wikis/index.md +7 -7
|
@@ -5,20 +5,26 @@ This guide is for Coding Agents operating a Context workspace.
|
|
|
5
5
|
## Start Here
|
|
6
6
|
|
|
7
7
|
1. If a public Agent entry is available, use the installed Context continuation command/skill from the project root; the exact slash command or skill name is host-specific.
|
|
8
|
-
2. If you are implementing that entry or operating without plugins, run
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
2. If you are implementing that entry or operating without plugins, run
|
|
9
|
+
`context status --format json`.
|
|
10
|
+
3. Treat `workflow.current` as the current-step authority. Read every
|
|
11
|
+
`resources.required` item, execute only returned commands with their
|
|
12
|
+
revision/authority flags unchanged, and rerun status after each action.
|
|
13
|
+
A phase-local `next_action` may continue pagination or validation inside the
|
|
14
|
+
current operation; it never replaces the workspace route.
|
|
12
15
|
4. Before editing `src/index.ts`, read [Project API](../reference/project-api.md).
|
|
13
16
|
5. Before declaring or repairing packages, read [Package Outputs](./package-outputs.md)
|
|
14
17
|
and [Package Templates](../reference/package-templates.md).
|
|
15
|
-
6. Before asking a human gate question, read
|
|
18
|
+
6. Before asking a human gate question, read the dialogue resource selected in
|
|
19
|
+
`workflow.current.resources.required`; use [Agent Dialogue](./agent-dialogue.md)
|
|
20
|
+
only for stable cross-gate principles.
|
|
16
21
|
|
|
17
22
|
## Current-conversation fully managed mode
|
|
18
23
|
|
|
19
24
|
When the user explicitly requests fully managed operation in the current
|
|
20
25
|
conversation, use `context status --managed --format json` and keep `--managed`
|
|
21
|
-
on
|
|
26
|
+
only on commands that actually include it. Preserve every returned
|
|
27
|
+
revision/authority flag. Eligible classification, extraction
|
|
22
28
|
scope, structure confirmation, Review, and package-output gates may proceed
|
|
23
29
|
without another question. Review uses the CLI's atomic `context review
|
|
24
30
|
approve-all ... --managed` route; valid structure staging records
|
|
@@ -44,8 +50,9 @@ protocol text: copy those exactly and do not translate them.
|
|
|
44
50
|
At human gates, explain the product decision and impact before internal API
|
|
45
51
|
details. Do not start with `extractTs`, `include`, `exportedOnly`,
|
|
46
52
|
`reviewValidity`, placeholder commands, or raw TypeScript snippets unless the
|
|
47
|
-
user asks for implementation detail. The
|
|
48
|
-
[Agent Dialogue](./agent-dialogue.md)
|
|
53
|
+
user asks for implementation detail. The current gate's dialogue pattern is
|
|
54
|
+
selected by `workflow.current.resources`; [Agent Dialogue](./agent-dialogue.md)
|
|
55
|
+
explains stable cross-gate principles.
|
|
49
56
|
|
|
50
57
|
## Do Not Self-Discover The SDK
|
|
51
58
|
|
|
@@ -69,7 +76,13 @@ node_modules/@c4a/context/docs/reference/package-templates.md
|
|
|
69
76
|
|
|
70
77
|
Do not create hidden workspace state directories.
|
|
71
78
|
|
|
72
|
-
## Workflow
|
|
79
|
+
## Workflow resources and entrypoints
|
|
80
|
+
|
|
81
|
+
Long procedures, semantic judgment rules, schemas, and current workspace views
|
|
82
|
+
are published as Context workflow resources. Status returns only the resources
|
|
83
|
+
selected for the current route. Read required resources before acting; use
|
|
84
|
+
recommended resources only when the current evidence or diagnostic needs them.
|
|
85
|
+
Do not preload every workflow resource or SDK manual.
|
|
73
86
|
|
|
74
87
|
Present only the current workflow surface:
|
|
75
88
|
|
|
@@ -104,7 +117,8 @@ identity. Do not invent semantic date suffixes. The concrete repo selector
|
|
|
104
117
|
appears in source refs, phase ids, and codegraph paths:
|
|
105
118
|
|
|
106
119
|
```text
|
|
107
|
-
knowledge/<collection>/<
|
|
120
|
+
knowledge/<collection>/<slug>.md
|
|
121
|
+
knowledge/<collection>/<containment>/<slug>.md # intentional hierarchy only
|
|
108
122
|
repo:<date>/<module>#symbol:...
|
|
109
123
|
file:<source-name>/<document>#span:...
|
|
110
124
|
lark:<source-name>/<document>#span:...
|
|
@@ -113,7 +127,9 @@ align:lark:<source-name>:architecture
|
|
|
113
127
|
dist/<source-name>-kb/
|
|
114
128
|
```
|
|
115
129
|
|
|
116
|
-
Prose align/compile paths derive from collection
|
|
130
|
+
Prose align/compile paths derive from collection and slug. `containment` is
|
|
131
|
+
optional and should be supplied only for an intentional parent/child hierarchy;
|
|
132
|
+
independent collection entries stay directly under the collection.
|
|
117
133
|
Codegraph paths use the registered date/module grouping before the symbol slug.
|
|
118
134
|
|
|
119
135
|
Ask what the user wants the source to cover: a single local Markdown/MDX document,
|
|
@@ -151,25 +167,34 @@ do not fetch or import Lark content with ad hoc scripts.
|
|
|
151
167
|
If the user requests multiple documents together, register and declare all of
|
|
152
168
|
them before capture. The user's explicit batch request supplies one read scope,
|
|
153
169
|
but it does not imply a mainline collection unless the user explicitly chose
|
|
154
|
-
one. Follow `
|
|
155
|
-
`
|
|
156
|
-
|
|
157
|
-
date name or repeat the collection gate per
|
|
170
|
+
one. Follow `workflow.current.commands`: run `immediate` items directly and run
|
|
171
|
+
`after-human-confirmation` items only after the current conversation contains
|
|
172
|
+
that confirmation. Preserve the returned workflow revision and authority flags
|
|
173
|
+
exactly. Do not ask for another date name or repeat the collection gate per
|
|
174
|
+
document.
|
|
158
175
|
|
|
159
176
|
## Current-step protocol
|
|
160
177
|
|
|
161
|
-
Treat `context status --format json` `
|
|
162
|
-
current step:
|
|
178
|
+
Treat `context status --format json` `workflow.current` as the complete
|
|
179
|
+
protocol for the current step:
|
|
163
180
|
|
|
164
|
-
- `
|
|
165
|
-
|
|
166
|
-
- `
|
|
167
|
-
|
|
181
|
+
- `availability` distinguishes an immediately executable route from a human
|
|
182
|
+
decision or a blocked route;
|
|
183
|
+
- `gate` identifies the decision, its authority, and whether a managed session
|
|
184
|
+
may resolve it;
|
|
168
185
|
- `configuration` identifies the exact project file and declaration action when
|
|
169
186
|
no CLI command is valid yet;
|
|
170
|
-
- `
|
|
171
|
-
|
|
172
|
-
|
|
187
|
+
- `commands[].availability` says whether each command runs immediately or only
|
|
188
|
+
after user confirmation;
|
|
189
|
+
- `resources.required` is the complete mandatory context for this route;
|
|
190
|
+
- `resources.recommended` is optional follow-up context; and
|
|
191
|
+
- `after_action.evaluate` requires status to be evaluated again after the
|
|
192
|
+
action.
|
|
193
|
+
|
|
194
|
+
Read a resource `path` directly. If a resource provides `command`, execute that
|
|
195
|
+
revision-bound Context command and read the returned file. Long procedures and
|
|
196
|
+
semantic rules live in these resources; they are loaded progressively, not
|
|
197
|
+
discarded or shortened into the status response.
|
|
173
198
|
|
|
174
199
|
Status also returns `declarationGraph` and `configurationGaps`. These expose
|
|
175
200
|
capture, align, compile, and Review coverage for each canonical document source
|
|
@@ -179,19 +204,21 @@ by the structure must have an exact compile route for the same source. Do not
|
|
|
179
204
|
run a compile command from another collection as a fallback. A
|
|
180
205
|
`reviewValidity({ scope: "all" })` declaration covers every collection.
|
|
181
206
|
|
|
182
|
-
When
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
collection
|
|
187
|
-
|
|
207
|
+
When `workflow.current.reason_code` is
|
|
208
|
+
`route.document.classification-required`, execute its read-only
|
|
209
|
+
`inspection_action` commands before adding align/compile declarations. Inspect
|
|
210
|
+
every unclassified target, explain the evidence behind the proposed mainline
|
|
211
|
+
collection, and wait for user confirmation. Filenames, URLs, source titles,
|
|
212
|
+
and collection names are hints, not sufficient classification evidence.
|
|
188
213
|
|
|
189
214
|
Also inspect `pendingStructureTargets`. A non-empty list means captured document
|
|
190
215
|
work remains outside the active structure snapshots, even if the current package
|
|
191
216
|
is already built. Follow `needs-prose-configuration` first when declarations are
|
|
192
217
|
missing, then run the exact returned align command. Continue in the same
|
|
193
218
|
workspace; do not replace a valid earlier structure round or create a second
|
|
194
|
-
workspace merely to add the next document.
|
|
219
|
+
workspace merely to add the next document. Missing declarations are selected
|
|
220
|
+
by `route.prose.configuration-required`; do not branch on an old top-level
|
|
221
|
+
`needs-prose-configuration` state.
|
|
195
222
|
|
|
196
223
|
Use `structureBatch` for the complete multi-source slot overview. Evidence View
|
|
197
224
|
commands are workspace-read-only and parallel-safe; structure stage/confirm,
|
|
@@ -204,24 +231,26 @@ another declared slot remains pending in the same round. Compile every View from
|
|
|
204
231
|
all slots first, open one collection-level Review, and let deterministic close
|
|
205
232
|
merge the active slots into `knowledge/structure.yaml`.
|
|
206
233
|
|
|
207
|
-
Do not infer permission from the presence of a command.
|
|
208
|
-
|
|
209
|
-
action
|
|
234
|
+
Do not infer permission from the presence of a command. When
|
|
235
|
+
`workflow.current.commands` is empty, do not derive a lifecycle command from
|
|
236
|
+
prose; complete the returned `configuration` action or resolve the returned
|
|
237
|
+
gate, then rerun status.
|
|
210
238
|
|
|
211
239
|
Extraction scope is also a human gate. If no extract phase is declared, explain
|
|
212
240
|
what code area and symbol policy will become draft knowledge, then ask which
|
|
213
241
|
registered source and file/symbol range to ingest. Do not inspect the source
|
|
214
|
-
repository to choose packages or globs on the user's behalf.
|
|
215
|
-
`
|
|
216
|
-
|
|
242
|
+
repository to choose packages or globs on the user's behalf. The
|
|
243
|
+
`route.extract.configuration-required` Route carries
|
|
244
|
+
`workflow.current.configuration` until that confirmed scope is declared; only
|
|
245
|
+
a declared phase can select `route.extract.pending-target` and return an
|
|
217
246
|
executable preview or extraction command.
|
|
218
247
|
|
|
219
248
|
For a fresh mixed-source workspace, capture every confirmed file/Lark source
|
|
220
249
|
first. If repo code is still unprocessed and document structure has not started,
|
|
221
|
-
`context status` prioritizes `
|
|
222
|
-
Complete
|
|
223
|
-
Once a document structure draft exists, keep that current human
|
|
224
|
-
switch workflows mid-review.
|
|
250
|
+
`context status` prioritizes `route.extract.pending-target` over document
|
|
251
|
+
investigation. Complete code extraction and its batch Review before starting
|
|
252
|
+
prose align. Once a document structure draft exists, keep that current human
|
|
253
|
+
gate and do not switch workflows mid-review.
|
|
225
254
|
|
|
226
255
|
For monorepos, the date is one registration batch and every selected package is
|
|
227
256
|
a module under it. Stable codegraph paths omit that batch date and therefore
|
|
@@ -259,10 +288,11 @@ context run <extract-phase-id> --dry-run --format json
|
|
|
259
288
|
After the preview, run codegraph extraction normally unless the user explicitly
|
|
260
289
|
asked for CI/CD automation. The first normal run requires Review for all code
|
|
261
290
|
candidates. Subsequent normal runs require Review only for added, changed, or
|
|
262
|
-
removed symbols; unchanged approved symbols stay approved.
|
|
263
|
-
`
|
|
264
|
-
|
|
265
|
-
`
|
|
291
|
+
removed symbols; unchanged approved symbols stay approved. After each result,
|
|
292
|
+
run `context status --format json`. `continue-codegraph-batch` only requests
|
|
293
|
+
workspace re-evaluation. Open Review only when
|
|
294
|
+
`workflow.current.gate.id=knowledge-review`; otherwise execute the current
|
|
295
|
+
route.
|
|
266
296
|
|
|
267
297
|
For a non-interactive pipeline, use `context run <extract-phase-id>
|
|
268
298
|
--auto-promote --format json`. This flag applies only to codegraph, applies its
|
|
@@ -272,21 +302,17 @@ and fails the command if close or verify fails. Read `autoPromotion.close` and
|
|
|
272
302
|
the pipeline publishes packages, run `context build` after successful auto
|
|
273
303
|
promotion. Never use auto promotion for semantic knowledge collections.
|
|
274
304
|
|
|
275
|
-
If verify reports `approved-source-ref-ambiguous` on approved codegraph pages
|
|
276
|
-
created by beta.5, do not send those pages back through Review and do not filter
|
|
277
|
-
approved symbols away. Rerun the declared codegraph extraction phase to refresh
|
|
278
|
-
the trusted file-aware symbol index, then run `context review
|
|
279
|
-
migrate-codegraph-refs` and `context verify`. Tell the user that this preserves
|
|
280
|
-
their decisions and approved content while upgrading evidence metadata. If the
|
|
281
|
-
reported ref already contains `<file>:<symbol>:<kind>`, treat it as a duplicate
|
|
282
|
-
symbol-index defect instead of a legacy migration.
|
|
283
|
-
|
|
284
305
|
Use the preview `mode`, optional `entries`, `preview.sources[].modules[]`,
|
|
306
|
+
`entryFiles`, exported/internal symbol counts, `candidateKinds`,
|
|
285
307
|
`candidateEstimate`, and `agent_hints`
|
|
286
308
|
fields as the authoritative scope check. To the user, call it a preview without
|
|
287
309
|
writing candidates; avoid the internal CLI term. Also show `knowledgeTree` and
|
|
288
310
|
`knowledgePathExamples` before first extraction.
|
|
289
311
|
|
|
312
|
+
These are structural extractor facts. Do not turn kind counts or file paths
|
|
313
|
+
into a product-specific recommendation unless the user or Agent supplies that
|
|
314
|
+
judgment.
|
|
315
|
+
|
|
290
316
|
Treat `NO_ENTRY_DETECTED` as a configuration failure: choose explicit
|
|
291
317
|
`entries`, or use `mode: "scan"` when the intended scope is all matched files;
|
|
292
318
|
never report an empty extraction as success. Report discovered, AST-analyzed,
|
|
@@ -320,7 +346,6 @@ count packages, parse `package.json`, or sample `unapproved/entities.jsonl`.
|
|
|
320
346
|
`context review approve <candidate-id> --collection <collection>` /
|
|
321
347
|
`context review reject <candidate-id> --collection <collection>` or `--all`.
|
|
322
348
|
These commands still enforce the scoped candidate-id gate.
|
|
323
|
-
- Do not expand the compact review decision Payload into pretty JSON unless the user asks.
|
|
324
349
|
- Do not edit approved Markdown by hand as part of review apply.
|
|
325
350
|
|
|
326
351
|
## Prose Align And Compile Rules
|
|
@@ -331,10 +356,9 @@ product sequence:
|
|
|
331
356
|
1. investigate material through Context evidence views;
|
|
332
357
|
2. propose a structure draft with nodes, section plans, supported edges, and
|
|
333
358
|
unresolved items;
|
|
334
|
-
3.
|
|
335
|
-
structure, open its HTML report, then
|
|
336
|
-
confirmation
|
|
337
|
-
order for this round;
|
|
359
|
+
3. resolve only the non-mechanical blockers until validation state is `ready`,
|
|
360
|
+
stage the structure, open its HTML report, then follow the current Route's
|
|
361
|
+
structure-confirmation gate;
|
|
338
362
|
4. compile source-bound draft pages from confirmed structure;
|
|
339
363
|
5. send compiled drafts through human review, then close and build.
|
|
340
364
|
|
|
@@ -356,41 +380,38 @@ context run align:<type>:<source>:<collection> --stage --input <structure.yaml>
|
|
|
356
380
|
|
|
357
381
|
Read source material only through these evidence views. `source-index` gives a
|
|
358
382
|
compact refs-first map when run with `--compact`; use `span-detail` /
|
|
359
|
-
`span-text` only for exact evidence.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
when evidence supports multiple incompatible semantic choices, and make clear
|
|
368
|
-
that it is not final review. Do not inspect `sources/` or `.tmp` directly.
|
|
383
|
+
`span-text` only for exact evidence. The CLI applies deterministic boundary
|
|
384
|
+
repairs internally and returns only blockers that need Agent judgment. For
|
|
385
|
+
oversized Views, use the returned structural diagnostics while classifying
|
|
386
|
+
child Nodes from evidence. Stage only after validation state is `ready`; stage
|
|
387
|
+
opens the final `structure-summary` report for the current Route's confirmation
|
|
388
|
+
gate. Ask a separate structure-design question only when evidence supports
|
|
389
|
+
multiple incompatible semantic choices. Do not inspect `sources/` or `.tmp`
|
|
390
|
+
directly.
|
|
369
391
|
|
|
370
392
|
Compile:
|
|
371
393
|
|
|
372
394
|
```bash
|
|
373
395
|
context run compile:<type>:<source>:<collection> --view read-plan --format json
|
|
374
|
-
context run compile:<type>:<source>:<collection> --
|
|
375
|
-
context run compile:<type>:<source>:<collection> --
|
|
376
|
-
context run compile:<type>:<source>:<collection> --
|
|
377
|
-
context run compile:<type>:<source>:<collection> --stage --input <compile-actions.yaml> --format json
|
|
396
|
+
context run compile:<type>:<source>:<collection> --validate --format json
|
|
397
|
+
context run compile:<type>:<source>:<collection> --stage --format json
|
|
398
|
+
context run compile:<type>:<source>:<collection> --view diagnostics --format json
|
|
378
399
|
```
|
|
379
400
|
|
|
380
|
-
Compile
|
|
381
|
-
|
|
382
|
-
|
|
401
|
+
Compile derives every candidate mechanically from the confirmed section ids,
|
|
402
|
+
kinds, ownership, and source spans. One stage command validates the complete
|
|
403
|
+
source/collection slot before atomically writing its candidates. The Agent does
|
|
404
|
+
not author compile actions or rewrite reader-visible body. Re-evaluate status
|
|
405
|
+
after the batch, finish any other structure slots, then open one
|
|
406
|
+
collection-level Review, apply one Payload, and run close once.
|
|
383
407
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
the current compile action contract; split evidence or return to structure
|
|
387
|
-
confirmation instead. Relationships and cross references are structure typed
|
|
388
|
-
edges in current output; this workflow does not render relationship reference
|
|
389
|
-
blocks. Never inject relation markers into verbatim body.
|
|
408
|
+
Relationships and cross references remain structure typed edges; compile does
|
|
409
|
+
not infer them or inject relation markers into verbatim body.
|
|
390
410
|
|
|
391
411
|
## Package Rules
|
|
392
412
|
|
|
393
|
-
If `
|
|
413
|
+
If `workflow.current.reason_code` is `route.package.output-required`, treat it
|
|
414
|
+
as a human gate.
|
|
394
415
|
First read [Package Outputs](./package-outputs.md). Then explain the package
|
|
395
416
|
decision using concrete output trees, not unexplained labels.
|
|
396
417
|
|
|
@@ -402,13 +423,22 @@ dist/<name>-kb/
|
|
|
402
423
|
├── skills/knowledge-query/SKILL.md
|
|
403
424
|
└── wikis/
|
|
404
425
|
├── index.md
|
|
405
|
-
├── <group
|
|
406
|
-
└── <group
|
|
426
|
+
├── <group-page>.md
|
|
427
|
+
└── <large-group>/index.md
|
|
407
428
|
```
|
|
408
429
|
|
|
409
430
|
This is an agent knowledge-base package. It is the recommended first output for
|
|
410
431
|
agent consumption; the internal `skills/` folder follows agent installation
|
|
411
432
|
conventions.
|
|
433
|
+
The package name is the default single-level
|
|
434
|
+
`distribution.knowledgeNamespace`. Ask for an override only when the user
|
|
435
|
+
needs another value; an explicit namespace may contain several concise
|
|
436
|
+
lowercase path segments, such as `group/package` or
|
|
437
|
+
`personal-user.123/package`, with letters and numbers joined by hyphens or
|
|
438
|
+
dots. The namespace applies only to OKF output roots. Ask separately whether
|
|
439
|
+
the author wants a short Skill prefix; if so, maintain the complete final Skill
|
|
440
|
+
directory name in the template. Do not infer custom values from downstream
|
|
441
|
+
platform identifiers.
|
|
412
442
|
The default `knowledge-query` skill teaches agents to query copied OKF root
|
|
413
443
|
directories structure-first, starting with `wikis/`, cite
|
|
414
444
|
page/section evidence, use structure/build metadata when present, and report
|
|
@@ -422,8 +452,9 @@ installation files; the OKF-compatible interchange surface is the selected OKF
|
|
|
422
452
|
root directories. Tell the user they can customize
|
|
423
453
|
`src/package-templates/kb/wikis/index.md` before build to describe package
|
|
424
454
|
scope and query guidance. The default root index should list only next-level
|
|
425
|
-
|
|
426
|
-
|
|
455
|
+
entries. By default, `context build` links small directory contents directly
|
|
456
|
+
and generates a child index only when that directory contains more than 50
|
|
457
|
+
selected knowledge pages.
|
|
427
458
|
|
|
428
459
|
Alternative:
|
|
429
460
|
|
|
@@ -43,6 +43,45 @@ least one `SKILL.md` and `wikis/index.md`.
|
|
|
43
43
|
The default `src/package-templates/kb/` template is only a starting point.
|
|
44
44
|
Inspect the generated `dist/<package-name>/` before calling it usable.
|
|
45
45
|
|
|
46
|
+
KB packages use their package name as a single-level knowledge namespace by
|
|
47
|
+
default:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
kbPackage({
|
|
51
|
+
name: "component-lib-kb",
|
|
52
|
+
template: "src/package-templates/kb",
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This keeps the build folder name independent from install paths and produces
|
|
57
|
+
paths such as:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
skills/knowledge-query/SKILL.md
|
|
61
|
+
wikis/component-lib-kb/index.md
|
|
62
|
+
guides/component-lib-kb/...
|
|
63
|
+
rules/component-lib-kb/...
|
|
64
|
+
feats/component-lib-kb/...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Ask for a custom namespace only when the user needs something other than the
|
|
68
|
+
package name. An explicit value may contain multiple safe lowercase path
|
|
69
|
+
segments:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
distribution: { knowledgeNamespace: "platform/component-lib" }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each segment may contain letters and numbers joined by hyphens or dots; keep
|
|
76
|
+
the complete value concise and stable. Context treats it as an opaque knowledge
|
|
77
|
+
path and does not infer downstream platform identifiers or classify package
|
|
78
|
+
content.
|
|
79
|
+
|
|
80
|
+
Skill names are separate. Ask whether the author wants a short optional Skill
|
|
81
|
+
prefix, then maintain the complete final template directory name directly—for
|
|
82
|
+
example `skills/android-query/SKILL.md`. Context never prepends the knowledge
|
|
83
|
+
namespace to a Skill name.
|
|
84
|
+
|
|
46
85
|
The default `knowledge-query` skill carries the structure-first query
|
|
47
86
|
discipline: start from OKF directory indexes, use
|
|
48
87
|
`context-build-inventory.json` edge records for package-visible relationships,
|
|
@@ -57,14 +96,16 @@ The generated `wikis/` directory is the default OKF root and follows the C4A OKF
|
|
|
57
96
|
Profile. Internal production collections are mapped into package OKF roots such
|
|
58
97
|
as `wikis/`, `guides/`, `rules/`, or `feats/`; when selected, `context build`
|
|
59
98
|
copies them into the package and generates root-aware directory indexes for them
|
|
60
|
-
as
|
|
61
|
-
|
|
99
|
+
as needed. Selected OKF roots always have an index; smaller child directories
|
|
100
|
+
are folded into their nearest generated ancestor index by default. These roots
|
|
101
|
+
contain Markdown with OKF fields and C4A extension fields at the top level, plus
|
|
62
102
|
`context:section` source_ref span comments. C4A extension fields such as `sources`,
|
|
63
103
|
`visibility`, and `code_symbols` are not nested under `context`, and page
|
|
64
104
|
frontmatter does not contain `source_refs`. The package root is an agent
|
|
65
105
|
package; the OKF-compatible interchange surface is the selected OKF root
|
|
66
|
-
subtrees under `dist/<package-name
|
|
67
|
-
|
|
106
|
+
subtrees under `dist/<package-name>/`. The required logical template entry is
|
|
107
|
+
`wikis/index.md`; a namespaced package writes it to
|
|
108
|
+
`wikis/<knowledge-namespace>/index.md`.
|
|
68
109
|
|
|
69
110
|
Current collection mapping:
|
|
70
111
|
|
|
@@ -96,8 +137,9 @@ Tell the user it can be edited before build to describe the package scope,
|
|
|
96
137
|
intended users, and query guidance.
|
|
97
138
|
|
|
98
139
|
The default root index is a starter, not a finished information architecture.
|
|
99
|
-
It
|
|
100
|
-
`index.md`
|
|
140
|
+
It links directly to pages in small child directories and to a child
|
|
141
|
+
`index.md` when that directory exceeds the configured navigation threshold.
|
|
142
|
+
The default threshold is 50 selected knowledge pages. Use Handlebars variables such as
|
|
101
143
|
`knowledgeGroups`, `knowledgeItems`, and `knowledgeTree` when a project needs
|
|
102
144
|
custom navigation. Before customizing it, read
|
|
103
145
|
`node_modules/@c4a/context/docs/reference/template-variables.md`.
|
|
@@ -114,12 +156,12 @@ inside the package. Otherwise `context build` reports a template-boundary
|
|
|
114
156
|
diagnostic. Repair the template under `src/package-templates/`; do not patch
|
|
115
157
|
`dist/` as the durable fix.
|
|
116
158
|
|
|
117
|
-
KB package index links are also checked. `context build` validates
|
|
118
|
-
|
|
119
|
-
bundle-root absolute links
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
159
|
+
KB package index links are also checked. `context build` validates every
|
|
160
|
+
selected OKF root index and generated child `index.md` so relative links and
|
|
161
|
+
OKF bundle-root absolute links resolve inside `dist/<package-name>/`. Broken
|
|
162
|
+
index links are fixed by editing the template, approved knowledge path, or
|
|
163
|
+
package declaration and rerunning `context build`; do not patch `dist/`
|
|
164
|
+
directly as the durable fix.
|
|
123
165
|
|
|
124
166
|
## Alternative Output: LLM Text
|
|
125
167
|
|
|
@@ -154,8 +196,9 @@ knowledge/
|
|
|
154
196
|
|
|
155
197
|
## How To Ask The User
|
|
156
198
|
|
|
157
|
-
When `
|
|
158
|
-
tree. Do not ask the user to pick from
|
|
199
|
+
When `workflow.current.reason_code` is `route.package.output-required`,
|
|
200
|
+
explain the choices with the output tree. Do not ask the user to pick from
|
|
201
|
+
unexplained labels.
|
|
159
202
|
Use the host's native multi-choice tool when available. If unavailable, fall
|
|
160
203
|
back to a short Markdown A/B/C question. The option labels should be:
|
|
161
204
|
agent knowledge-base package, LLM text bundle, and skip package output for now.
|
|
@@ -171,8 +214,8 @@ dist/<name>-kb/
|
|
|
171
214
|
├── skills/knowledge-query/SKILL.md
|
|
172
215
|
└── wikis/
|
|
173
216
|
├── index.md
|
|
174
|
-
├── <group
|
|
175
|
-
└── <group
|
|
217
|
+
├── <group-page>.md
|
|
218
|
+
└── <large-group>/index.md
|
|
176
219
|
|
|
177
220
|
This is best if agents should use the knowledge as a reusable knowledge base.
|
|
178
221
|
|
|
@@ -187,5 +230,15 @@ We can also skip package output for now and keep only knowledge/.
|
|
|
187
230
|
Which one should I declare first?
|
|
188
231
|
```
|
|
189
232
|
|
|
233
|
+
If the user chooses the Agent knowledge-base package, explain that its package
|
|
234
|
+
name is already the default knowledge namespace. Ask for an override only when
|
|
235
|
+
the user needs a different single- or multi-segment path. Ask separately whether
|
|
236
|
+
its Skills need a short prefix. Treat these as independent choices: the
|
|
237
|
+
knowledge namespace controls only OKF roots, while the author maintains final
|
|
238
|
+
Skill names.
|
|
239
|
+
|
|
190
240
|
Do not offer `both` as a shortcut. If the user wants multiple outputs, add one
|
|
191
241
|
package first, verify the shape, then add another package after confirmation.
|
|
242
|
+
The default adaptive index policy avoids one-page directory indexes. Configure
|
|
243
|
+
`kbPackage().navigation` when a package needs a different inline-entry
|
|
244
|
+
threshold or a fully expanded index at every directory.
|