@c4a/context 0.6.0-beta.6 → 0.6.0-beta.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.
@@ -13,7 +13,10 @@ bun install
13
13
  context status
14
14
  ```
15
15
 
16
- Use `--dev` only when testing a locally linked SDK. Published users can omit it.
16
+ Use `--dev` when testing a local link or prepared pack before the matching SDK
17
+ version is published. It writes a `file:` dependency to the SDK resolved beside
18
+ the active CLI. Published users can omit it and install the versioned SDK from
19
+ the registry.
17
20
  When operating through an Agent plugin, use the installed Context continuation entry from the project root after initialization; it reads `context status` and then calls the lower-level CLI primitives as needed. The exact slash command or skill name is host-specific.
18
21
 
19
22
  ## 2. Choose And Register A Source Boundary
@@ -101,6 +104,11 @@ pausing for another date name or collection choice between modules. If any
101
104
  module lacks a declaration, status returns `needs-capture-phase` and a precise
102
105
  `routing.configuration` action instead of an unexecutable command.
103
106
 
107
+ After capture, status returns `captured-ready-to-classify` for document modules
108
+ without an align declaration. Run the returned collection-neutral evidence
109
+ views first; only then propose a mainline collection and ask for confirmation.
110
+ The batch read permission does not itself choose a collection.
111
+
104
112
  When the workspace also contains repo sources, Context prioritizes untouched
105
113
  code after all document captures finish: status returns `ready-to-extract`
106
114
  until the code extraction round is current, then returns to document
@@ -19,6 +19,17 @@ CLI commands, source names, phase ids, status values, payload keys, and
19
19
  `source_ref` values are protocol text. Keep those exact when needed, but do not
20
20
  make them the main explanation.
21
21
 
22
+ ## Fully Managed Conversation
23
+
24
+ If the user explicitly says the current conversation is fully managed, briefly
25
+ confirm that eligible workflow decisions will proceed automatically, then use
26
+ the CLI's `--managed` status loop. Do not ask the ordinary classification,
27
+ extraction-scope, structure-confirmation, Review, or package-output questions.
28
+ Continue to surface source/read permission, external operation requests, and
29
+ validation or verification failures because managed mode does not authorize or
30
+ hide them. The authorization ends with the conversation and must not be written
31
+ to project configuration.
32
+
22
33
  ## Human Gate Question Form
23
34
 
24
35
  When the decision has a small fixed option set, use the host's native
@@ -14,6 +14,24 @@ This guide is for Coding Agents operating a Context workspace.
14
14
  and [Package Templates](../reference/package-templates.md).
15
15
  6. Before asking a human gate question, read [Agent Dialogue](./agent-dialogue.md).
16
16
 
17
+ ## Current-conversation fully managed mode
18
+
19
+ When the user explicitly requests fully managed operation in the current
20
+ conversation, use `context status --managed --format json` and keep `--managed`
21
+ on the commands returned by that loop. Eligible classification, extraction
22
+ scope, structure confirmation, Review, and package-output gates may proceed
23
+ without another question. Review uses the CLI's atomic `context review
24
+ approve-all ... --managed` route; valid structure staging records
25
+ `confirmed_by: managed-session`.
26
+
27
+ This is execution authority, not project configuration. Do not add it to
28
+ `defineProject`, environment files, or committed workspace state, and do not
29
+ carry it into a new conversation. It never grants a new source boundary or
30
+ source-body read permission, authorizes clone/checkout/fetch/install/build/test
31
+ operations outside the Context workspace, or suppresses validation, close, or
32
+ verify failures. Without an explicit request, use ordinary status and all
33
+ existing human gates.
34
+
17
35
  If the installed docs are unavailable, run `bun install` in the Context workspace.
18
36
 
19
37
  ## Dialogue Language
@@ -131,8 +149,9 @@ captured through the Lark capture phase, and written as committed snapshots
131
149
  as a sibling file under `sources/lark/<date>/`, tracked by the date-level `manifest.json`;
132
150
  do not fetch or import Lark content with ad hoc scripts.
133
151
  If the user requests multiple documents together, register and declare all of
134
- them before capture. The user's explicit batch request supplies one read scope
135
- and one mainline collection choice. Follow `routing.command_plan`: run
152
+ them before capture. The user's explicit batch request supplies one read scope,
153
+ but it does not imply a mainline collection unless the user explicitly chose
154
+ one. Follow `routing.command_plan`: run
136
155
  `immediate` items directly and run `after-human-confirmation` items only after
137
156
  the current conversation contains that confirmation. Do not ask for another
138
157
  date name or repeat the collection gate per document.
@@ -152,6 +171,39 @@ current step:
152
171
  - `command_plan[].availability` says whether each command runs immediately or
153
172
  only after user confirmation.
154
173
 
174
+ Status also returns `declarationGraph` and `configurationGaps`. These expose
175
+ capture, align, compile, and Review coverage for each canonical document source
176
+ and declared align collection. Missing declarations are early warnings while
177
+ structure is still being planned; after confirmation, every collection planned
178
+ by the structure must have an exact compile route for the same source. Do not
179
+ run a compile command from another collection as a fallback. A
180
+ `reviewValidity({ scope: "all" })` declaration covers every collection.
181
+
182
+ When status is `captured-ready-to-classify`, execute its immediate capture-phase
183
+ evidence commands before adding align/compile declarations. Inspect every
184
+ unclassified target, explain the evidence behind the proposed mainline
185
+ collection, and wait for user confirmation. Filenames, URLs, source titles, and
186
+ collection names are hints, not sufficient classification evidence by
187
+ themselves.
188
+
189
+ Also inspect `pendingStructureTargets`. A non-empty list means captured document
190
+ work remains outside the active structure snapshots, even if the current package
191
+ is already built. Follow `needs-prose-configuration` first when declarations are
192
+ missing, then run the exact returned align command. Continue in the same
193
+ workspace; do not replace a valid earlier structure round or create a second
194
+ workspace merely to add the next document.
195
+
196
+ Use `structureBatch` for the complete multi-source slot overview. Evidence View
197
+ commands are workspace-read-only and parallel-safe; structure stage/confirm,
198
+ compile stage, Review apply, and close mutate workspace state and must run
199
+ serially.
200
+
201
+ The confirmation and Review scopes are different: confirm each canonical source
202
+ plus collection structure slot independently, but do not open Review while
203
+ another declared slot remains pending in the same round. Compile every View from
204
+ all slots first, open one collection-level Review, and let deterministic close
205
+ merge the active slots into `knowledge/structure.yaml`.
206
+
155
207
  Do not infer permission from the presence of a command. Do not infer a command
156
208
  from prose when `commands_available=false`; complete the returned configuration
157
209
  action and rerun status instead.
@@ -66,6 +66,26 @@ package; the OKF-compatible interchange surface is the selected OKF root
66
66
  subtrees under `dist/<package-name>/`, with `wikis/index.md` as the required
67
67
  default KB entry.
68
68
 
69
+ Current collection mapping:
70
+
71
+ | Internal collection | Package path | Role |
72
+ |---|---|---|
73
+ | `codegraph` | `wikis/codegraph/` | Structured code entities and relationships. |
74
+ | `business` | `wikis/business/` | Structured business entities and relationships. |
75
+ | `product` | `wikis/product/` | Structured product entities, behavior, and relationships. |
76
+ | `architecture` | `guides/architecture/` | Architecture explanations and design narratives. |
77
+ | `sop` | `guides/sop/` | Procedures and runbooks. |
78
+ | `faq` | `guides/faq/` | Question-oriented explanations and troubleshooting. |
79
+ | `decision` | `guides/decision/` | Decision records and trade-off narratives. |
80
+ | `incident` | `guides/incident/` | Incident timelines, response, and follow-up. |
81
+ | `standards` | `rules/standards/` | Normative standards and constraints. |
82
+ | `test` | `rules/test/` | Validation rules, scenarios, and acceptance checks. |
83
+ | `feats` | `feats/` | Feature capability records. |
84
+
85
+ `wikis/` is the structured entity-and-relationship layer. `guides/` and
86
+ `rules/` may explain, operationalize, or constrain that knowledge; their
87
+ placement does not create a relationship unless Context includes a typed edge.
88
+
69
89
  `index.md` is reserved for OKF bundle and directory indexes. Source documents
70
90
  may be named `index.md`, but generated concept pages must use a non-reserved
71
91
  name such as `index-page.md`; `context build` rejects copied knowledge that
@@ -132,9 +132,12 @@ child indexes expose their own subdirectories and pages.
132
132
 
133
133
  The generated `dist/<package-name>/wikis/` tree is the required default KB
134
134
  entry surface. Internal collections are mapped into OKF roots during build:
135
- wiki-like collections under `wikis/`, guide-like collections under `guides/`,
136
- rule-like collections under `rules/`, and feature namespace output under
137
- `feats/`.
135
+ `codegraph`, `business`, and `product` go to `wikis/`; `architecture`, `sop`,
136
+ `faq`, `decision`, and `incident` go to `guides/`; `standards` and `test` go to
137
+ `rules/`; and `feats` goes to `feats/`. Treat `wikis/` as the structured
138
+ entity-and-relationship layer. Guides and rules may explain, operationalize,
139
+ or constrain that knowledge, but directory placement alone does not establish
140
+ a relationship.
138
141
 
139
142
  Default navigation rules:
140
143
 
@@ -200,6 +200,49 @@ extraction phases, review gates, close/build, and packages explicitly. The CLI
200
200
  then routes work through `context status`, `context run <phase-id>`, `context
201
201
  review html/apply`, `context close`, `context verify`, and `context build`.
202
202
 
203
+ ### Status declaration coverage
204
+
205
+ `context status --format json` includes a `declarationGraph` and
206
+ `configurationGaps` for document workflows. Each row reports capture, align,
207
+ compile, and Review coverage for a canonical source plus collection. Gaps are
208
+ non-blocking before structure confirmation. Once a structure is confirmed,
209
+ compile routing is exact: phase selection uses canonical source plus collection,
210
+ and candidate progress remains bound to the current `structure_digest`. A
211
+ compile phase from another collection is never used as fallback.
212
+
213
+ Captured align targets that do not yet have an active confirmed structure are
214
+ reported in `pendingStructureTargets`. They remain unfinished even when the
215
+ currently active structures have been closed, verified, and built. Missing
216
+ compile or Review declarations route to `needs-prose-configuration`; once the
217
+ declarations are complete, status returns the exact align investigation command
218
+ for the next target. A built package does not freeze the workspace or require a
219
+ new workspace for later sources.
220
+
221
+ Use `context status --format json --view summary` when only the current state,
222
+ target, counts, diagnostics, and recommended command are needed. The full view
223
+ retains source, phase, package, and lifecycle inventories.
224
+
225
+ ### Current-conversation managed execution
226
+
227
+ `context status --managed --format json` exposes
228
+ `executionMode: { mode: "managed", scope: "current-conversation" }` and resolves
229
+ eligible human gates into immediate commands. The flag is deliberately absent
230
+ from `defineProject`: callers must pass it on each status/run/review command in
231
+ the authorized conversation. A later process or conversation gets ordinary
232
+ human-gated behavior by default.
233
+
234
+ Managed Review is atomic and scope-validated:
235
+
236
+ ```bash
237
+ context review approve-all <collection> --managed --format json
238
+ context review approve-all --all --managed --format json
239
+ ```
240
+
241
+ Managed structure staging uses `context run <align-phase> --stage --managed
242
+ --input <structure.yaml> --format json`. Source boundaries and unread source
243
+ bodies, external operations, payload validation, deterministic close, and
244
+ verification errors are never bypassed.
245
+
203
246
  ### `captureFile`
204
247
 
205
248
  Capture a registered file source into a committed normalized document snapshot.
@@ -285,6 +328,12 @@ alignProse({
285
328
  });
286
329
  ```
287
330
 
331
+ `collection` is an internal knowledge classification, not a package directory.
332
+ Package build maps `codegraph`/`business`/`product` to `wikis/`,
333
+ `architecture`/`sop`/`faq`/`decision`/`incident` to `guides/`,
334
+ `standards`/`test` to `rules/`, and `feats` to `feats/`. The complete output
335
+ contract is documented in [Package Outputs](../guides/package-outputs.md).
336
+
288
337
  When `source("name")` is type-neutral, the SDK may declare
289
338
  `align:source:<source-name>:architecture`; the CLI resolves it to
290
339
  `align:file:<source-name>:architecture` or `align:lark:<source-name>:architecture` after
@@ -299,20 +348,57 @@ context run align:file:<source-name>:architecture --view source-index --compact
299
348
  context run align:file:<source-name>:architecture --view span-detail --span <source-ref> --format json
300
349
  context run align:file:<source-name>:architecture --view span-text --span <source-ref> --format json
301
350
  context run align:file:<source-name>:architecture --view schema --format json
351
+ context run align:file:<source-name>:architecture --view semantic-rules --format json
302
352
  context run align:file:<source-name>:architecture --validate --input <structure.yaml> --format json
353
+ context run align:file:<source-name>:architecture --view diagnostics --input <structure.yaml> --format json
303
354
  context run align:file:<source-name>:architecture --view structure-summary --input <structure.yaml> --format json
304
355
  context run align:file:<source-name>:architecture --stage --input <structure.yaml> --format json
305
356
  ```
306
357
 
307
- Evidence views include `read-plan`, `source-index`, `span-detail`,
308
- `span-text`, `schema`, and `structure-summary`. Additional diagnostic views may
309
- be present, but the default path is compact index first, then exact source spans.
310
- Agents should not inspect `sources/` or `.tmp` directly.
358
+ `--validate`, `--stage`, `--confirm`, and `--repair` are mutually exclusive
359
+ operations. An `--input` without an operation is rejected unless the selected
360
+ view explicitly consumes that input. Successful validation returns a stage
361
+ command with the same file path. JSON run output keeps `next_action` first;
362
+ schema and full reports stay behind explicit Views, while `--verbose` restores
363
+ the full phase result and repeated contracts. Long diagnostics return a compact
364
+ first page plus an exact diagnostics continuation command.
365
+
366
+ Align and compile evidence results include `semantic_rules`. Its `required`
367
+ array is the rule subset selected for the current judgment, with a selection
368
+ reason and content digest for each rule. `handle`, `digest`, and
369
+ `rules_version` are stable cache checks: reuse a loaded ruleset only while its
370
+ content remains in the active context and both handle and digest still match.
371
+ After context compaction, resume the paginated `semantic-rules` View for the
372
+ returned required subset; a handle alone does not imply that the rule text is
373
+ still available.
374
+
375
+ Document evidence boundaries are deterministic rather than semantic.
376
+ `source-index` and `chunks` mark Markdown AST blocks with
377
+ `boundary_role: "markdown-ast-block"` and `section_candidate: true`.
378
+ `span-text`/`span-detail` mark each returned page as
379
+ `range_role: "transport-page"` and `section_candidate: false`; pagination line
380
+ ranges are never structure boundaries. Structure validation blocks repeated
381
+ fixed-width line grids that cut through AST blocks and reports sections that
382
+ cross multiple heading paths, without classifying document topics.
383
+
384
+ After capture, the capture phase itself exposes collection-neutral `read-plan`,
385
+ `source-index`, `span-detail`, `span-text`, and other read-only evidence views.
386
+ Status reports `captured-ready-to-classify` until every captured target has an
387
+ evidence-backed, user-confirmed align declaration. Align then adds `schema` and
388
+ `structure-summary` for structure work. Agents should not inspect `sources/` or
389
+ `.tmp` directly.
390
+
391
+ Compile `read-plan`, `blockers`, `node-context`, and `schema` Views are also
392
+ workspace-read-only and may run concurrently. `--validate`, `--stage`,
393
+ structure confirmation, Review apply, and close are serial mutations.
311
394
 
312
395
  Structure payloads use `schema_version: "context.structure.v1"` and canonical
313
396
  `file:` / `lark:` `#span` source refs. A one-file-to-one-page plan is represented
314
397
  as ordinary `nodes[]` and `views[]` in the structure. It does not bypass
315
- structure confirmation or compile.
398
+ structure confirmation or compile. Continuity applies to each Section, while one View/Page may
399
+ contain multiple independently retrievable continuous Sections. The optional
400
+ `suggested-splits` repair can expand a broad cross-heading Section into Markdown
401
+ structural groups without creating child Views.
316
402
 
317
403
  ### `compileProse`
318
404
 
@@ -352,10 +438,11 @@ context run compile:file:<source-name>:architecture --stage --input <compile-act
352
438
  ```
353
439
 
354
440
  Compile remains one View per write for evidence isolation. After staging, follow
355
- `continue_compile_batch` to prepare the next View. Only the final View returns
356
- the human Review action, so one confirmed structure produces one review
357
- payload. `context close` is blocked while a planned View is unprepared, still
358
- draft, or rejected without a structure revision.
441
+ `continue_compile_batch` to prepare the next View. Each canonical source plus
442
+ collection is confirmed as an independent structure slot. When other captured
443
+ align targets remain pending, status routes to those slots before opening one
444
+ collection-level Review payload. `context close` is blocked while a planned
445
+ View is unprepared, still draft, or rejected without a structure revision.
359
446
 
360
447
  Compile action payloads use `schema_version: "context.compile-actions.v1"`.
361
448
  By default, actions should omit body content and let the CLI mirror cited source
@@ -506,10 +593,20 @@ review html --all --open --format json`, confirm the returned `opened` field,
506
593
  and wait for the user-copied payload. They should not run the phase as an
507
594
  automatic approval step or synthesize a payload themselves.
508
595
 
509
- The gate is batch-scoped: prose waits for every planned View in the confirmed
510
- structure, and codegraph waits for every pending extract phase in the confirmed
511
- module round. Candidate count/hash therefore describes the complete current
512
- batch rather than one page or module.
596
+ The only batch-wide exception is explicit current-conversation fully managed
597
+ authority. In that mode, follow the `context status --managed` route to
598
+ `context review approve-all ... --managed`; the CLI validates the exact current
599
+ scope before applying one default-approved decision.
600
+
601
+ The gate is batch-scoped: prose waits for every planned View across all active
602
+ structure slots and every declared `pendingStructureTargets` item in the round;
603
+ codegraph waits for every pending extract phase in the confirmed module round.
604
+ Candidate count/hash therefore describes the complete current batch rather than
605
+ one page, source slot, or module. Deterministic close later merges all active
606
+ slots into `knowledge/structure.yaml`.
607
+
608
+ `status.structureBatch` lists unclassified, configuration-required, pending,
609
+ and active structure slots together with the execution policy for the round.
513
610
 
514
611
  If the user explicitly asks for an automated or quick approval/rejection path,
515
612
  use the scoped quick commands instead of hand-writing a payload:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/context",
3
- "version": "0.6.0-beta.6",
3
+ "version": "0.6.0-beta.8",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "yaml": "^2.5.1",
@@ -19,9 +19,11 @@ product-specific skills or routing rules.
19
19
  Selected OKF root directories such as `wikis/`, `guides/`, `rules/`, and
20
20
  `feats/` follow the C4A OKF Profile: OKF fields and C4A extension fields stay
21
21
  at the top level, and no `context` or `schema` field is emitted. Root mapping:
22
- `wikis/` maps from internal `codegraph`, `business`, `architecture`, `faq`, and
23
- `decision`; `guides/` maps from `sop` and `incident`; `rules/` maps from
24
- `product`, `standards`, and `test`; `feats/` maps from `feats`. Customize
22
+ `wikis/` maps from structured `codegraph`, `business`, and `product` knowledge;
23
+ `guides/` maps from `architecture`, `sop`, `faq`, `decision`, and `incident`;
24
+ `rules/` maps from `standards` and `test`; `feats/` maps from `feats`. Treat
25
+ `wikis/` as the entity-and-relationship layer; guides and rules may explain or
26
+ constrain that layer. Customize
25
27
  `wikis/index.md` before build to describe the package scope and query guidance;
26
28
  other selected OKF root indexes are generated unless this template supplies
27
29
  them.
@@ -49,8 +49,9 @@ beyond the packaged content.
49
49
  | User intent | First move | Evidence move |
50
50
  |---|---|---|
51
51
  | Vague topic or unknown name | Open the package's OKF root index, usually `wikis/index.md`, then child indexes such as `wikis/<group>/index.md`. If the package includes other selected OKF roots such as `guides/` or `rules/`, use their indexes too. | Choose candidate pages by title, path, frontmatter, and index grouping. |
52
- | Process, runbook, SOP, incident, oncall, or troubleshooting question | Start from `guides/index.md` when present. These pages are mapped from internal `sop` and `incident` collections. | Use guide pages for steps, roles, operational context, incident timelines, and action items; cite sections rather than general procedure memory. |
53
- | Requirement, PRD, standard, spec, acceptance, or test scenario question | Start from `rules/index.md` when present. These pages are mapped from internal `product`, `standards`, and `test` collections. | Use rule pages for requirements, constraints, acceptance criteria, validation scenarios, and normative decisions. |
52
+ | Architecture, procedure, FAQ, decision, incident, or troubleshooting question | Start from `guides/index.md` when present. These pages are mapped from internal `architecture`, `sop`, `faq`, `decision`, and `incident` collections. | Use guide pages for explanations, design narratives, decisions, steps, operational context, and troubleshooting; cite the relevant sections. |
53
+ | Structured product or business question | Start from `wikis/index.md`, then the `product` or `business` group index. | Use entity pages and typed relationships to establish scope before reading supporting narratives. |
54
+ | Standard, constraint, acceptance, or test scenario question | Start from `rules/index.md` when present. These pages are mapped from internal `standards` and `test` collections. | Use rule pages for normative constraints, acceptance criteria, and validation scenarios. |
54
55
  | Specific entity/domain/action named | Open the matching page or nearest group index. | Read the page sections and source metadata. |
55
56
  | Relationship or impact question | Check `context-build-inventory.json` `structure.edge_records`, then related endpoint pages. | Cite typed edge evidence if available; otherwise cite page sections and mark relation gaps. |
56
57
  | Detail within a known page | Read that page's relevant `context:section` block. | Cite the section id/source_ref and quote or summarize only supported text. |
@@ -185,10 +186,13 @@ the user it is false; distinguish "not evidenced here" from "not true."
185
186
 
186
187
  - The bundled OKF root directories, usually including `wikis/`, are the source
187
188
  of truth for this skill.
188
- - OKF root mapping: `wikis/` maps from internal `codegraph`, `business`,
189
- `architecture`, `faq`, and `decision`; `guides/` maps from `sop` and
190
- `incident`; `rules/` maps from `product`, `standards`, and `test`; `feats/`
191
- maps from `feats`.
189
+ - OKF root mapping: `wikis/` maps from the structured `codegraph`, `business`,
190
+ and `product` collections; `guides/` maps from `architecture`, `sop`, `faq`,
191
+ `decision`, and `incident`; `rules/` maps from `standards` and `test`;
192
+ `feats/` maps from `feats`.
193
+ - Treat `wikis/` as the primary entity-and-relationship layer. Guides and rules
194
+ may explain, operationalize, or constrain that structured knowledge, but
195
+ directory co-location alone is not relationship evidence.
192
196
  - Bundled OKF root directories follow the C4A OKF Profile.
193
197
  - Prefer OKF indexes, `context-build-inventory.json`, package manifests when
194
198
  present, build inventory, and page source span metadata over raw text search.