@c4a/context 0.7.5 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +12 -4
  2. package/README.zh-CN.md +11 -4
  3. package/docs/README.md +13 -1
  4. package/docs/README.zh-CN.md +13 -1
  5. package/docs/getting-started.md +95 -69
  6. package/docs/guides/agent-dialogue.md +19 -9
  7. package/docs/guides/agent-guide.md +42 -10
  8. package/docs/guides/code-indexer-skill-authoring.md +42 -11
  9. package/docs/guides/indexer-manifest-example.md +103 -0
  10. package/docs/guides/indexer-provider-and-customization.md +277 -13
  11. package/docs/guides/indexer-skill-creation.md +99 -0
  12. package/docs/guides/knowledge-updates.md +324 -0
  13. package/docs/guides/lark-resources.md +5 -1
  14. package/docs/guides/markdown-indexer-skill-authoring.md +16 -7
  15. package/docs/guides/note.md +37 -0
  16. package/docs/guides/package-outputs.md +22 -17
  17. package/docs/guides/sessions.md +50 -0
  18. package/docs/guides/workspace-commit.md +45 -0
  19. package/docs/guides/workspace-prepare.md +72 -0
  20. package/docs/guides/workspace-restore.md +59 -0
  21. package/docs/reference/code-extractors.md +23 -11
  22. package/docs/reference/indexer-provider-protocol.md +116 -22
  23. package/docs/reference/package-templates.md +10 -9
  24. package/docs/reference/project-api.md +47 -13
  25. package/docs/reference/template-variables.md +7 -7
  26. package/index.d.ts +11 -0
  27. package/index.js +1560 -572
  28. package/indexerAgentStepProtocol.d.ts +44 -0
  29. package/indexerApprovedKnowledge.d.ts +371 -0
  30. package/indexerArticlePlan.d.ts +83 -0
  31. package/indexerArtifact.d.ts +10 -7
  32. package/indexerArtifactDependencies.d.ts +5 -5
  33. package/indexerArtifactPolicy.d.ts +16 -16
  34. package/indexerArtifactResult.d.ts +76 -69
  35. package/indexerAuthoringFixture.d.ts +8 -8
  36. package/indexerAuthorizedWorksetView.d.ts +14 -14
  37. package/indexerBaseQuestionAmendment.d.ts +40 -0
  38. package/indexerCandidateCompile.d.ts +46 -36
  39. package/indexerCatalogFallback.d.ts +566 -48
  40. package/indexerContentLayers.d.ts +6 -4
  41. package/indexerContractDeclaration.d.ts +3 -0
  42. package/indexerControlledProgram.d.ts +1039 -238
  43. package/indexerCustomizationDraft.d.ts +188 -0
  44. package/indexerDependencyView.d.ts +17 -17
  45. package/indexerEffectiveArtifact.d.ts +26 -15
  46. package/indexerExampleFactDependencies.d.ts +17 -0
  47. package/indexerExampleIdentityAudit.d.ts +2 -2
  48. package/indexerInventoryDisposition.d.ts +44 -44
  49. package/indexerKnowledgeDependency.d.ts +46 -0
  50. package/indexerLayerComposition.d.ts +92 -54
  51. package/indexerLayoutChange.d.ts +8 -8
  52. package/indexerLayoutProposalSet.d.ts +15 -10
  53. package/indexerLayoutResolver.d.ts +15 -6
  54. package/indexerLayoutTransition.d.ts +8 -8
  55. package/indexerLifecycle.d.ts +1 -1
  56. package/indexerMainRunLedger.d.ts +3 -0
  57. package/indexerMainRunProtocol.d.ts +872 -196
  58. package/indexerMainWorkset.d.ts +50 -0
  59. package/indexerNavigationArtifactPlan.d.ts +2 -2
  60. package/indexerOverlayQuestionAmendment.d.ts +56 -16
  61. package/indexerOverlayQuestionApplyProposal.d.ts +98 -26
  62. package/indexerPartitionPlan.d.ts +585 -40
  63. package/indexerPhysicalArtifactAudit.d.ts +2 -2
  64. package/indexerPhysicalArtifactManifest.d.ts +24 -24
  65. package/indexerPostAuthorRunLedger.d.ts +60 -34
  66. package/indexerPrimaryProjection.d.ts +2 -2
  67. package/indexerProfileContract.d.ts +28 -28
  68. package/indexerProgramRunProtocol.d.ts +868 -194
  69. package/indexerProjectProposal.d.ts +36 -8
  70. package/indexerProjectedArtifactFanOutAudit.d.ts +2 -2
  71. package/indexerProvider.d.ts +72 -28
  72. package/indexerProviderComposition.d.ts +4 -4
  73. package/indexerProviderRouting.d.ts +52 -0
  74. package/indexerProviderSelectionProposal.d.ts +48 -0
  75. package/indexerPublicContractFacts.d.ts +7 -0
  76. package/indexerPublicContractTable.d.ts +11 -0
  77. package/indexerReaderTargetInventory.d.ts +6 -6
  78. package/indexerReferenceOnlyAudit.d.ts +2 -2
  79. package/indexerRegistry.d.ts +52 -0
  80. package/indexerRequirementConfirmation.d.ts +48 -16
  81. package/indexerRequirementLifecycle.d.ts +154 -42
  82. package/indexerResultReconciliation.d.ts +12 -11
  83. package/indexerSemanticInput.d.ts +27522 -3471
  84. package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
  85. package/indexerStructuredDeclaration.d.ts +8 -8
  86. package/indexerTemplateRendering.d.ts +7 -7
  87. package/indexerToolSnapshot.d.ts +16 -16
  88. package/managedSources.d.ts +15 -0
  89. package/package.json +1 -1
  90. package/phases.d.ts +0 -3
  91. package/processedScopes.d.ts +75 -0
  92. package/readingStructure.d.ts +188 -0
  93. package/sessionMetadata.d.ts +49 -0
  94. package/sources.d.ts +9 -3
  95. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
  96. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
@@ -0,0 +1,72 @@
1
+ # Prepare a workspace for the next task
2
+
3
+ Use only for an explicit workspace preparation request. The goal is usable
4
+ registered sources and no unfinished task, while retaining approved knowledge
5
+ and configuration. Lead with Host tools and actual observations; do not start
6
+ indexing merely because a status response offers production work.
7
+
8
+ ## Establish the scope
9
+
10
+ Use `context entry` to locate the workspace. Inspect current work, active
11
+ processes, Git changes and source registrations. Explain which unfinished
12
+ drafts and queued maintenance will be discarded. Reuse the user's explicit
13
+ authorization; ask only about an unresolved loss, version or access boundary.
14
+ Wait for an active writer to finish and obtain its receipt before changing state.
15
+ If status is broken, inspect its diagnostic and files with Host tools rather
16
+ than treating failure as proof that the workspace is empty.
17
+
18
+ ## End the old task
19
+
20
+ Run `context task prepare --format json`. It previews the exact Context-owned
21
+ task files, including production, Review and maintenance state. It preserves
22
+ approved pages, source records and snapshots, project configuration, repository
23
+ checkouts, other `.tmp` files and existing outputs. It does not claim the output
24
+ or sources are current.
25
+
26
+ Once discarding the shown scope is authorized, execute the returned apply
27
+ command with its plan digest. If the preview changes, inspect the new differences.
28
+ On interruption, rerun the preview and use its resume command; never clear a
29
+ transaction journal or repeat old Author submissions. Other incomplete writes
30
+ must be recovered before cleanup. The completion clears task state only; check
31
+ sources next. Do not manually delete the runtime directory to emulate this action.
32
+
33
+ Other caches are optional cleanup, not a requirement to empty `.tmp`. Inspect
34
+ their ownership and recoverability before deleting them with Host tools. Keep
35
+ reports, unique material, unknown files and modified checkouts unless their
36
+ specific loss is authorized. Do not delete locks, transaction records or active
37
+ tool directories. Empty task directories can remain.
38
+
39
+ ## Restore usable sources
40
+
41
+ For repositories, run `context source recovery-plan --format json` and read
42
+ the installed repository recovery procedure and schema supplied by entry's
43
+ workflow bundle: `repository-source-recovery.md` beside this guide and
44
+ `../../schemas/repository-source-recovery.schema.json`. Reuse a matching local
45
+ checkout or, when authorized, clone into a bounded location using
46
+ `context source restore --input <workspace-input-file> --format json`.
47
+ Group modules sharing a remote and fixed commit; do not clone per module.
48
+ Check registered commit and module paths. Never reset a supplied dirty checkout.
49
+ Authentication or checkout problems can be diagnosed with Host Git tools;
50
+ refresh the recovery plan after fixing them. Do not substitute a newer commit.
51
+
52
+ For Lark, inspect the stored body and required attachments against the source
53
+ records. Use the Host's document tools and the [existing capture guide](knowledge-updates.md)
54
+ to repair missing material, retaining the registered identity. A current remote
55
+ response is not proof of an older snapshot: if it differs, explain that source
56
+ updating is needed and resolve that choice before claiming recovery. If an old
57
+ snapshot is unavailable, report the exact limitation. Do not automatically
58
+ follow every document link or reread already complete materials.
59
+
60
+ For note, sessions and local files, preserve formal source content and verify
61
+ that declared paths can be read. Do not reconstruct lost original sources from
62
+ generated knowledge or scan arbitrary local directories.
63
+
64
+ ## Finish
65
+
66
+ Verify that no task files remain in the preparation preview, no writer remains,
67
+ the required configuration can load, and selected sources resolve to their
68
+ registered versions and paths. CLI inspection or direct Host checks are both
69
+ valid; a failed check is not ready. Report outstanding blockers and their next
70
+ action. Stop when ready for the next user request, without running Author or
71
+ recapturing everything. Historical restoration may additionally require a
72
+ close/build; see [restore a version](workspace-restore.md).
@@ -0,0 +1,59 @@
1
+ # Restore a historical workspace version
2
+
3
+ Use the Agent's Git and environment tools. This restores selected workspace
4
+ files and usable sources; it does not reset the entire repository, rewind source
5
+ repositories, or restore ignored runtime progress.
6
+
7
+ ## Resolve the target
8
+
9
+ Locate the workspace and Git root, then inspect history for that workspace path.
10
+ With no explicit target, select the most recent commit saving its state to undo
11
+ uncommitted results. “Previous version” instead selects the preceding relevant
12
+ saved state, not mechanically `HEAD~1` of a large repository. Validate an explicit
13
+ SHA. For dates, use the user's timezone and actual meaning (for example, as of
14
+ end of that day), inspect candidate history and resolve ambiguity with the user.
15
+ Git history can be nonlinear; do not choose an unrelated branch by timestamp.
16
+ The final target is a concrete SHA and path scope, never a date string alone.
17
+
18
+ Compare target files with current tracked, untracked and staged files. Include
19
+ current additions absent at the target in the proposed removal scope. Keep
20
+ unrelated files, existing staged work and ignored source checkouts. Account for
21
+ workspace moves or renames instead of treating a missing old path as an empty
22
+ version. Reuse explicit authorization; ask when the target or loss is unresolved.
23
+
24
+ ## Restore files and environment
25
+
26
+ Wait for active Context writers and obtain their result. Use the task-state
27
+ preview/apply from [workspace preparation](workspace-prepare.md) to abandon the
28
+ authorized old work before restoring files; it also clears pending maintenance.
29
+ Do not use an old Route after restoration.
30
+
31
+ Use Git to restore only the agreed paths from the selected SHA. A scoped
32
+ `git restore --source=<sha> --worktree -- <paths>` preserves branch history;
33
+ decide separately how authorized overlapping staged changes should be handled.
34
+ Use explicit deletion for agreed additions absent at the target. Never use a
35
+ whole-repository `reset --hard` or `clean -fdx` as a workspace shortcut.
36
+
37
+ Use the restored source records with the preparation guide to restore pinned
38
+ repository versions, module paths, document snapshots and attachments. New remote
39
+ content cannot stand in for lost old snapshots. Do not reclone usable sources.
40
+ On interruption, inspect the actual file diff and remaining source gaps and
41
+ continue those operations; do not assume the previous Git command completed or
42
+ replay old task submissions.
43
+
44
+ Old build output does not describe the restored version. If output is requested,
45
+ follow the current close/build or approved-output rebuild capability from the
46
+ [knowledge update guide](knowledge-updates.md); do not start full indexing merely
47
+ because the restored source configuration is available. Until rebuilt, state
48
+ that existing output is stale. If the historical schema is incompatible, diagnose
49
+ the available migration or tool-version choice, report necessary adaptations,
50
+ and do not pretend incompatible content is current or silently rewrite all pages.
51
+
52
+ ## Verify and stop
53
+
54
+ Compare the selected files with the target commit, identify any agreed adaptations,
55
+ verify unrelated changes/index entries survived, and check source readiness and
56
+ absence of old task state. When building was requested, check the new output as
57
+ well. If only some sources could be restored, report partial completion with the
58
+ specific missing access or version. No automatic commit, branch rewrite or push;
59
+ the user may separately [commit the restored results](workspace-commit.md).
@@ -20,20 +20,32 @@ declare a separate extraction phase in `src/index.ts`.
20
20
  | `@c4a/extract-ts` | TypeScript/JavaScript symbols, exports, imports, calls, and React Router routes |
21
21
  | `@c4a/extract-go` | Go declarations, imports, calls, and common HTTP routes |
22
22
  | `@c4a/extract-rush` | Rush projects, tags, entries, dependencies, and owner boundaries |
23
+ | `@c4a/extract-thrift` | Thrift services, methods and declared data types |
24
+ | `@c4a/extract-proto` | Protobuf messages, fields and service definitions |
25
+ | `@c4a/extract-mdx` | Markdown/MDX document structure and source spans |
26
+ | `@c4a/extract-contract` | Supported structured API contract declarations |
27
+ | `@c4a/extract-style` | Stylesheet declarations, selectors and related structure |
28
+ | `@c4a/extract-sql` | Supported SQL schema declarations |
23
29
  | `@c4a/extract` | Shared extraction result and adapter contracts |
24
30
 
25
31
  These packages do not create Candidate rows, write `knowledge/`, or control
26
- Review. The Code Indexer Provider owns those lifecycle responsibilities.
32
+ Review. The CLI owns those lifecycle responsibilities; Providers interpret the
33
+ supplied facts and sources and return structured semantic results. Package
34
+ presence alone does not prove a parser is selected or supports every dialect.
35
+ Use the selected profile's actual capabilities and parser diagnostics.
27
36
 
28
37
  ## Unsupported technologies
29
38
 
30
- When the current Provider cannot parse a required boundary, first use its
31
- supported customization ladder (`config`, instruction append, template
32
- override, then program extension). Add a reusable parser to the Provider only
33
- when the same technology boundary is useful across projects. Do not create a
34
- project-local parallel knowledge pipeline.
35
-
36
- Parser coverage is complete when every required inventory item has an explicit
37
- disposition and the resulting pages answer the declared reader questions. A
38
- large symbol count by itself is not useful coverage.
39
-
39
+ When a required boundary is unsupported, distinguish a parser limitation from
40
+ missing writing guidance. Config can select supported behavior; instructions or
41
+ templates cannot create missing structural facts. Follow the current Route's
42
+ capability-gap report and smallest supported customization step. A program
43
+ extension requires its existing execution authorization. Prefer a reusable
44
+ parser when the same technology is useful across projects; do not create a
45
+ parallel project-local knowledge pipeline.
46
+
47
+ Mechanical inventory closure requires an explicit disposition for each supplied
48
+ item. It does not prove that the pages answer the reader's questions. Review
49
+ checks usefulness and fidelity separately. Internal or out-of-scope items can
50
+ have justified exclusions without generating pages; symbol count is not a
51
+ knowledge-quality measure.
@@ -1,12 +1,51 @@
1
1
  # Indexer Provider protocol
2
2
 
3
3
  Context defines one Provider manifest, `context-indexer.yaml`, with protocol
4
- `context.indexer.provider/v1`. Code and Markdown Providers use the same field
4
+ `context.indexer.provider/v1`. Code, Markdown, Note and Sessions Providers use the same field
5
5
  tree; `domains`, profiles and declared operations describe their applicable
6
6
  inputs.
7
7
 
8
8
  This page documents the protocol surface currently exposed by `@c4a/context`.
9
- It does not imply that the 0.7.0 CLI Route or its release channel is complete.
9
+ Use the current CLI Route for executable inputs, schemas and selected resources.
10
+ A protocol validator exported by the SDK is not a separate production workflow.
11
+
12
+ ## Articles supported by approved knowledge
13
+
14
+ An article plan may declare `knowledge_dependencies`: stable `artifact_ref`,
15
+ optional `section_refs` (empty means the approved article), and `required`.
16
+ Use references supplied by Context; reader titles and output paths are not
17
+ article identities. Each article keeps its existing primary subject and owned
18
+ members. Referencing another article does not assign its members again.
19
+
20
+ The current Partition/Author workflow delivers ready upstream articles before
21
+ dependent required articles. An unavailable dependency remains visible in the
22
+ structure preview; `request-adjustment` returns to planning. It cannot finish
23
+ as an empty Author wave. Optional Composer output does not satisfy a required
24
+ article plan.
25
+
26
+ Review saves the approved fact payloads, evidence coordinates and versions with
27
+ the approved Markdown transaction. These remain in `knowledge/structure.yaml`
28
+ after close and temporary-cache cleanup. Author receives authorized supporting
29
+ facts separately from approved interpretation. Current source captures, the
30
+ Provider's accepted evidence kinds and the approved article version constrain
31
+ that projection. A stored snapshot alone never expands source access.
32
+
33
+ Previously approved dependencies can reuse their registered source reader even
34
+ when that source has no owned Partition group in the current wave. Only the
35
+ referenced authorized files enter the supporting projection. Missing or changed
36
+ source files remain an upstream update task.
37
+
38
+ An approved dependency change produces a verification warning for downstream
39
+ articles. Use the existing `context revise` action on an affected article; its
40
+ current route exposes `knowledge_input` with supporting facts and interpretations.
41
+ Review accepts the refreshed supporting version even when the Agent confirms
42
+ that the wording can stay the same. A plain edit with unavailable support does
43
+ not clear the warning. `--regenerate` remains the existing program-block rebuild
44
+ option, not a prerequisite for revising a prose synthesis.
45
+
46
+ Writing style, chapter drift and ordinary Provider version differences remain
47
+ guidance. Changed source/approval identities invalidate an in-flight supporting
48
+ projection; they are not semantic content judgments.
10
49
 
11
50
  ## Resources and execution
12
51
 
@@ -76,6 +115,15 @@ config against the Bundle's closed data-only schema, binds the project-local
76
115
  customization fingerprint and requires a policy digest for executable
77
116
  resources. Missing, duplicate, stale or extra inputs fail closed.
78
117
 
118
+ Selection validation is not an upgrade gate on an instruction-only bundled
119
+ Provider. On resume, the CLI resolves that Provider by Skill and portable
120
+ distribution from the current installation, checks the required capabilities,
121
+ and refreshes instruction delivery without comparing it to the registry's
122
+ historical version/integrity. Compatible persisted tasks keep their original
123
+ request/result identities. The current Route revision still prevents stale
124
+ submissions. This does not change staged program execution authorization or
125
+ allow results to be reused across changed source, config or result contracts.
126
+
79
127
  The final stable report excludes transport paths, delivery timestamps and
80
128
  runtime receipt digests. Those values remain in a separate runtime receipt
81
129
  projection, so rematerializing identical content does not make the selection
@@ -375,6 +423,19 @@ temporary Provider path.
375
423
 
376
424
  ## Controlled invocation
377
425
 
426
+ Author result acceptance checks the actual task, source/module, subject and
427
+ Provider layer. Provider integrity, bundle/config/customization fingerprints
428
+ remain recorded metadata, not byte-equality gates between a resumed request and
429
+ its result. Selected Facts are resolved by their supplied identity and source
430
+ references; their current values are recorded without comparing a previous
431
+ parser payload digest. Source-span line ranges may expand within the same file
432
+ content. Structured declarations resolve actual file/item identities, not a
433
+ previous inventory or signature fingerprint. Source file content checks,
434
+ unknown-reference rejection and atomic write protection remain in force.
435
+
436
+ These continuation rules do not relax executable program authorization or allow
437
+ an Agent to select undeclared sources.
438
+
378
439
  `context.indexer.controlled-invocation/v1` binds:
379
440
 
380
441
  - the exact Indexer, Provider, version, Bundle integrity and stable Provider
@@ -387,7 +448,7 @@ temporary Provider path.
387
448
  - a stable trust-policy and authority digest;
388
449
  - timeout and stdin/stdout/stderr byte limits.
389
450
 
390
- The 0.7.0 built-in Host capability is `sandboxed_program: false`. A first-party,
451
+ The built-in Host capability is `sandboxed_program: false`. A first-party,
391
452
  verified or exact project-authorized program may use the `trusted-program` path,
392
453
  which is not an isolation claim. An untrusted program without a real sandbox is
393
454
  not executable.
@@ -535,8 +596,11 @@ children, cycles, path collisions and unregistered files fail. Reader bodies
535
596
  over 1500 lines produce a non-blocking advisory only. Total physical Artifact
536
597
  count has no global maximum.
537
598
 
538
- An initial layout does not create a structural Gate. A content-only increment
539
- reuses the existing Artifact identity and also skips the Gate. Adding reader
599
+ An initial layout does not create the protected `confirm-layout-change` Gate.
600
+ The main lifecycle still reviews its semantic structure before Author in
601
+ ordinary mode; new topics in an update receive that structure review too.
602
+ A content-only increment reuses the existing Artifact identity and skips the
603
+ protected layout-change Gate. Adding reader
540
604
  fan-out to an already approved Node, removing or renaming an Artifact,
541
605
  splitting/merging its declared lineage, moving a logical Section, or changing
542
606
  an approved collection/path is represented by a digest-bound layout change
@@ -585,9 +649,11 @@ ledger, answer workset, or special close route for them.
585
649
  Newly captured Markdown, tool snapshots, or other authorized material re-enter
586
650
  the normal `main-index` operation. The affected Partition and Author worksets
587
651
  run again, reconciliation is recomputed, and the user reviews the resulting
588
- knowledge Candidate once. Successful close writes only approved knowledge and
589
- the recovery metadata in `knowledge/structure.yaml`, then clears transient
590
- Indexer runtime state.
652
+ knowledge Candidate through the existing content Review. Review apply writes
653
+ approved Markdown; close projects `knowledge/structure.yaml` and verifies it.
654
+ Delivery retains accepted work while more pages remain, then cleans completed
655
+ transient state. Durable `processed_scopes` advance only after the selected
656
+ scope's required work and build complete, not after one page in that scope.
591
657
 
592
658
  ## Detector and inspector
593
659
 
@@ -698,7 +764,7 @@ Only `{{variable:<id>}}` and `{{block:<id>}}` are accepted. Direct variables are
698
764
  semantic prose. A block source variable is a deterministic Fact projection,
699
765
  must bind canonical `fact_refs`, and must equal the CLI's normalized projection
700
766
  of those Facts. Blocks select one of
701
- the CLI-owned `bullet-list`, `key-value-table` or `json-code-block` renderers;
767
+ the CLI-owned `bullet-list`, `key-value-table`, `json-code-block` or `public-contract-table` renderers;
702
768
  templates cannot register code or helpers. A block directive occupies its own
703
769
  template line so the renderer can retain an exact content-layer boundary. The
704
770
  contract and body must declare exactly the same Sections and placeholders.
@@ -713,12 +779,13 @@ or sufficient evidence is absent from the rendered Candidate. A required
713
779
  Section in the same state becomes the already-declared material-question
714
780
  transition and makes `review_ready` false.
715
781
 
716
- Before a Candidate can enter Review, Context rejects unknown directives,
717
- unresolved variables, template comments, example placeholders, standalone or
718
- bracketed `TODO`/`TBD`/`待补充`/`待生成` markers, title-only Sections and budget
719
- overflow. A source-backed sentence that discusses a known TODO is not treated
720
- as a placeholder merely because it contains that token; it remains semantic
721
- prose and therefore requires Agent Review. The rendered
782
+ Context validates template-program directives, declared variable types and
783
+ expansion limits before rendering. Supplied variable values and Section prose
784
+ are content, not template programs: JSX, braces, comments, TODOs, headings and
785
+ example placeholders do not cause a content-validation failure. Missing or
786
+ invalid structured input is distinct from an author's choice of words.
787
+ Unfilled authoring placeholders can be mentioned during the existing Agent or
788
+ user Review, but are not an additional CLI gate. The rendered
722
789
  Section content, ordered content-layer ledger and evidence receive stable
723
790
  digests. Deterministic blocks contribute catalog completeness but never
724
791
  semantic-prose density. Later `build` projects this approved body; it does not
@@ -732,10 +799,37 @@ unit, one of its CLI-owned inventory members, or an authorized target-resolution
732
799
  identity. Missing owners, outside subjects, unknown evidence and evidence that
733
800
  is known globally but absent from the owner Section all fail Result validation.
734
801
 
735
- Main-run validation derives
736
- `context.indexer.generated-authoring-audit/v1`. It reports controlled generated
737
- placeholder and empty emitted-Section hard findings, proves that every emitted
738
- structured claim passed owner-local evidence coverage, and lists every
739
- semantic-prose block or direct authored template variable as
740
- `semantic-prose-agent-review-required`. It does not scan free prose to claim
741
- that unsupported natural-language assertions were mechanically detected.
802
+ Main-run validation does not produce a prose-quality audit. Content usefulness,
803
+ completeness and faithfulness belong to the existing Agent or user Review.
804
+ Structured owner/source checks still run, but no keyword, punctuation, heading
805
+ or sentence-pattern scan can reject an otherwise valid Result. Physical output
806
+ checks distinguish a missing or blank body from an authored body; they do not
807
+ decide whether headings, comments or short prose are sufficient knowledge.
808
+
809
+ ### Groups narrowed by a scope decision
810
+
811
+ The CLI may attach `scope_change.removed_member_ids` to a derived PartitionPlan
812
+ group after excluding only part of its membership. This is runtime provenance,
813
+ not an extra field Provider authors should invent in semantic Partition results.
814
+ The remaining identity stays stable; the old page form/template is no longer a
815
+ binding choice. Author receives the change in `page_plan.scope_change` and must
816
+ reassess the residual sources, title and reader task. It can choose an allowed
817
+ page form or an applicable non-publishing outcome. This metadata does not belong
818
+ in knowledge frontmatter and is not proof that remaining material is useful.
819
+
820
+ ## Incremental planning handoff
821
+
822
+ A semantic Partition group may declare `ready_for_author: true` when the Agent
823
+ has resolved its subject, primary ownership, reader task and shared dependencies.
824
+ The CLI can then deliver an initial wave before all Partition tasks are accepted.
825
+ This is an optional scheduling declaration, not a new evidence or approval gate.
826
+ Absent/false groups wait; every inventory member still needs a final disposition.
827
+ The original Partition ledger resumes after normal structure review, Author,
828
+ Composer, content Review, close and successful build. Later material for the same
829
+ subject reuses its page identity and approved prose. A wave finishing never means
830
+ the remaining source scope is complete.
831
+
832
+ Known code-symbol planning views provide member overviews with immutable full
833
+ fact links and bounded captured-source access. Providers must inspect details
834
+ when semantic boundaries are uncertain; unknown payload formats retain full
835
+ reading. Author receives full selected facts and source material.
@@ -182,7 +182,7 @@ Built-in variables:
182
182
  | `{{displayName}}` | Display name. Defaults to a title-cased `packageName`; override with `template.vars.displayName`. |
183
183
  | `{{knowledgeCount}}` | Number of selected approved Markdown files. |
184
184
  | `{{knowledgeTimestamp}}` | Latest `timestamp` from selected approved Markdown, or `1970-01-01T00:00:00.000Z` when empty. |
185
- | `{{knowledge}}` | Concatenated selected approved Markdown bundle. |
185
+ | `{{knowledge}}` | Concatenated consumer projection of selected approved pages, with path headings and without lifecycle metadata. |
186
186
  | `{{approvedKnowledge}}` | Alias for `{{knowledge}}`. |
187
187
  | `{{knowledgeItems}}` | Array of selected approved knowledge page metadata for loops. |
188
188
  | `{{knowledgeGroups}}` | Selected approved knowledge pages grouped by OKF root and first directory segment; each item also exposes `internal_collection`. |
@@ -322,7 +322,7 @@ Approved Markdown under `knowledge/` and its deterministic
322
322
  revision, or build. Do not copy a compact page as a new page without using a
323
323
  Context authoring command;
324
324
  - do not nest Context production metadata under `context`; fields such as
325
- `context.sources` and `context.code_symbols` are not part of the 0.6 profile;
325
+ `context.sources` and `context.code_symbols` are not accepted production fields;
326
326
  - section provenance lives in `<!-- context:section ... source_ref="..." -->`
327
327
  comments. When a Section needs more than one citation, the CLI preserves the
328
328
  complete set in its adjacent `context:source_refs` block;
@@ -352,8 +352,9 @@ treat the complete `source_ref` as opaque. Production pages do not expose
352
352
  Candidate fingerprints, Indexer digests, or `code_origin`.
353
353
 
354
354
  `#span:` refs retain source snapshot line ranges for human review, diffing, and
355
- stable re-pinning. They resolve against committed file/lark document snapshots,
356
- not the code symbol index.
355
+ stable re-pinning. They resolve against the stored file/Lark snapshot or the saved
356
+ Note/Sessions Markdown, not the code symbol index. A session's optional commit/MR
357
+ association stays in its source file; knowledge does not duplicate those fields.
357
358
 
358
359
  The kb package root may contain agent files such as `AGENTS.md` and `skills/`.
359
360
  The OKF-compatible surface is the selected `wikis/`, `guides/`, `rules/`, and
@@ -373,11 +374,11 @@ The OKF-compatible surface is the selected `wikis/`, `guides/`, `rules/`, and
373
374
  6. Writes output under `dist/<package-name>/`.
374
375
 
375
376
  `context-build-inventory.json` records what was selected and why. Each selected
376
- file includes `selected_by` entries such as `{ "kind": "collection" }` and a
377
- `production_metadata` object for selected page-level production fields. Child
378
- and relationship records use the inventory's canonical structure projection,
379
- `{ "kind": "okf_root" }`, `{ "kind": "include" }`, or
380
- `{ "kind": "default" }`. The inventory also exposes package-visible typed
377
+ file includes `selected_by` entries such as `{ "kind": "collection" }`,
378
+ `{ "kind": "okf_root" }`, `{ "kind": "include" }`, or `{ "kind": "default" }`,
379
+ and a `production_metadata` object for selected page-level production fields.
380
+ Child and relationship records use the inventory's canonical structure
381
+ projection. The inventory exposes package-visible typed
381
382
  edges under `structure.edge_records`; these records are filtered to edges whose
382
383
  endpoints are present in the selected package. Use those edge records for
383
384
  relationship citations inside the package instead of assuming the workspace
@@ -26,14 +26,30 @@ state.
26
26
 
27
27
  ```ts
28
28
  const repo = source("20260901", "component-lib");
29
- const docs = source("product-docs", { type: "file" });
30
- const handbook = source("handbook", { type: "lark" });
31
- const everyRepo = allSources("repo");
29
+ const docs = source("20260901/product-docs", { type: "file" });
30
+ const handbook = source("20260901/handbook", { type: "lark" });
31
+ const note = source("20260908/decision-context.md", { type: "note" });
32
+ const session = source("20260908/design-discussion.md", { type: "sessions" });
33
+ const everyRepo = allSources("repo"); // array: use ...everyRepo inside sources
34
+ const everySession = allSources("sessions");
32
35
  ```
33
36
 
34
- References resolve against `sources/repo/index.yaml`,
35
- `sources/file/index.yaml`, and `sources/lark/index.yaml`. Register or refresh
36
- sources through `context source ...`; do not invent snapshot directories.
37
+ Repo, file and Lark references resolve against their respective
38
+ `sources/<type>/index.yaml`. Their names include the registration date and module.
39
+ Register or refresh them through `context source ...`.
40
+
41
+ Note and Sessions references resolve directly to saved Markdown under
42
+ `sources/note/YYYYMMDD/topic.md` and `sources/sessions/YYYYMMDD/topic.md`.
43
+ Use `context source import` to save them; they have no separate registry or
44
+ capture phase. Explicitly include the desired typed references in `sources`,
45
+ for example `sources: [note, session]`, or use `sources: [...everySession]`
46
+ when all saved sessions are intended. Merely saving a source does not select it.
47
+
48
+ A project's source list enables acquisition and initial selection; requirements
49
+ and the selected Indexer's target/read scopes determine what it owns and may read.
50
+ Supporting text does not require a separate page or primary Indexer. See
51
+ [note preparation](../guides/note.md), [sessions preparation](../guides/sessions.md)
52
+ and [knowledge updates](../guides/knowledge-updates.md).
37
53
 
38
54
  ## Capture phases
39
55
 
@@ -44,8 +60,10 @@ captureLark({ source: handbook });
44
60
  ```
45
61
 
46
62
  Capture only creates a deterministic readable snapshot. Classification,
47
- partitioning, authoring, Candidate creation, and Review belong to the selected
48
- Markdown Indexer.
63
+ partitioning and authoring use the selected Provider's guidance. The CLI owns
64
+ worksets, Candidate creation, Review application and delivery. Code, Markdown,
65
+ Note and Sessions Providers can use authorized supporting documents without
66
+ creating a second capture or knowledge pipeline.
49
67
 
50
68
  ## `customPhase`
51
69
 
@@ -79,8 +97,10 @@ may be rebuilt; it is not an authoring source.
79
97
 
80
98
  ## Indexer registry
81
99
 
82
- The Agent and CLI maintain `src/indexers.yaml` through typed proposals and
83
- Review gates. Each selected Indexer binds requirements and scopes to one
100
+ When this file is absent, the configuration Route supplies the initial schema:
101
+ write confirmed `requirements` with `indexers: []`, then re-evaluate. The Provider
102
+ selection Action supplies its own completion schema; that payload is not the
103
+ configuration file. Subsequent changes use typed proposals and applicable gates. Each selected Indexer binds requirements and scopes to one
84
104
  primary Provider, with optional declared layers or composers. Provider code
85
105
  must return the current Indexer result protocol; it must not write Candidate,
86
106
  knowledge, or Review files directly.
@@ -90,6 +110,20 @@ current workflow Route when it is needed.
90
110
 
91
111
  ## Persistent versus runtime state
92
112
 
93
- Commit source registries, `src/index.ts`, `src/indexers.yaml`, package templates,
94
- and approved knowledge. Do not commit `.tmp/context-runtime/`; it contains
95
- recoverable execution state and is cleaned after a successful close.
113
+ Source registries and snapshots, saved notes/summaries, project declarations,
114
+ package templates and approved knowledge are durable inputs. Version them only
115
+ when Git operations are authorized. Keep `.tmp/context-runtime/` out of Git;
116
+ it contains unfinished execution state, not the sole source of recovery truth.
117
+
118
+ `knowledge/structure.yaml` keeps shared page/source metadata and compact
119
+ `processed_scopes` for completed requirement/source/module ranges. A partial
120
+ update or failed build does not advance the whole range's processed version.
121
+ Session commit/MR associations stay in the saved source frontmatter, not copied
122
+ into every knowledge page. Use the CLI to adjust or roll back current work;
123
+ do not edit these baselines or remove runtime files to simulate completion.
124
+
125
+ ## Source visual conversion preference
126
+
127
+ Workspace `package.json` accepts `context.convertVisuals` (boolean, default `true`). Initialization writes it explicitly; older workspaces without the field also default to enabled. This lets a capable Author Agent attempt faithful structural diagram/table conversion. Explicit session instructions override the saved preference. It does not disable native table capture or existing Mermaid when false.
128
+
129
+ Diagram style follows the workspace’s editable `AGENTS.md`; newly initialized workspaces default to minimal theme-aware diagrams without decorative colors. If the Agent cannot read the image or cannot preserve its meaning, it retains the original through the existing asset workflow. Source-based reuse avoids rereading unchanged visuals; file integrity and package hashes continue to reflect actual output changes.
@@ -19,7 +19,7 @@ Approved pages: {{knowledgeCount}}
19
19
  Values support dotted paths:
20
20
 
21
21
  ```md
22
- {{context.package}}
22
+ {{buildInventory.package.name}}
23
23
  ```
24
24
 
25
25
  ### Loop
@@ -102,7 +102,7 @@ Read node_modules/@c4a/context/docs/reference/template-variables.md.
102
102
  | `skillPath` | string | Final package-relative `SKILL.md` path for the Skill currently being rendered. Empty outside a Skill template. |
103
103
  | `knowledgeCount` | number | Selected approved Markdown file count. |
104
104
  | `knowledgeTimestamp` | string | Latest selected approved Markdown `timestamp`, or epoch when empty. |
105
- | `knowledge` | string | Concatenated selected approved Markdown bundle. Use carefully; it can be large. |
105
+ | `knowledge` | string | Concatenated consumer projection of selected approved pages, with path headings. It omits lifecycle metadata and can be large. |
106
106
  | `approvedKnowledge` | string | Alias for `knowledge`. |
107
107
  | `knowledgeItems` | array | One record per selected approved Markdown page. |
108
108
  | `knowledgeGroups` | array | Selected pages grouped by OKF root and the first directory segment under that root; each item also exposes `internal_collection`. |
@@ -131,7 +131,7 @@ Each item contains:
131
131
 
132
132
  | Field | Meaning |
133
133
  |---|---|
134
- | `path` | Package-relative OKF path, for example `wikis/component-lib/symbol/button.md`. |
134
+ | `path` | Package-relative OKF path, for example `guides/architecture/entity/button.md`. |
135
135
  | `sourcePath` | Approved knowledge path before OKF output mapping, for example `architecture/entity/button.md`. |
136
136
  | `approved_path` | Alias for `sourcePath`. |
137
137
  | `dist_path` | Alias for `path`. |
@@ -142,11 +142,11 @@ Each item contains:
142
142
  | `okf_root_path` | Final flat package-relative OKF root. |
143
143
  | `node_ref` | Stable NodeRef from approved frontmatter, for example `entity/button`. |
144
144
  | `view_ref` | Stable ViewRef from approved frontmatter, for example `architecture:entity/button`. |
145
- | `pathWithinCollection` | Path below the OKF root, for example `component-lib/symbol/button.md`. |
145
+ | `pathWithinCollection` | Path below the OKF root, for example `architecture/entity/button.md`. |
146
146
  | `href` | Link relative to the template file currently being rendered. Use this in custom templates. |
147
147
  | `hrefFromTemplate` | Alias for `href`. |
148
- | `hrefFromPackageRoot` | Link from a package-root file such as `AGENTS.md`, for example `./wikis/component-lib/symbol/button.md`. |
149
- | `hrefFromCollectionIndex` | Link from the current OKF root index, for example `./component-lib/symbol/button.md` for a `wikis` item. |
148
+ | `hrefFromPackageRoot` | Link from a package-root file such as `AGENTS.md`, for example `./guides/architecture/entity/button.md`. |
149
+ | `hrefFromCollectionIndex` | Link from the current OKF root index, for example `./architecture/entity/button.md` for a `guides` item. |
150
150
  | `title` | Page title from frontmatter, or a title derived from the file name. |
151
151
  | `type` | OKF `type` from frontmatter. |
152
152
  | `description` | OKF `description` from frontmatter, when present. |
@@ -182,7 +182,7 @@ Each group contains:
182
182
  | `count` | Number of selected pages in this group. |
183
183
  | `hasIndex` | Whether the active package navigation policy generates `indexPath`. |
184
184
  | `has_index` | Alias for `hasIndex`. |
185
- | `indexPath` | OKF-root-aware index path, for example `wikis/component-lib/index.md`, `guides/component-lib/index.md`, or `rules/index.md` for a root group. |
185
+ | `indexPath` | OKF-root-aware index path, for example `wikis/codeindex/index.md`, `guides/architecture/index.md`, or `rules/index.md` for a root group. |
186
186
  | `indexHrefFromTemplate` | Link from the template file currently being rendered to `indexPath`. Check `hasIndex` before rendering it. |
187
187
  | `indexHrefFromCollectionIndex` | Link from the OKF root index to `indexPath`. |
188
188
  | `items` | `knowledgeItems` in the group. |
package/index.d.ts CHANGED
@@ -137,3 +137,14 @@ export declare const llmsPackage: (definition: {
137
137
  template: PackageTemplateInput;
138
138
  select?: PackageSelectDefinition;
139
139
  }) => LlmsPackageDefinition;
140
+ export { projectIndexerPublicContractTable } from "./indexerPublicContractTable.js";
141
+ export { processedScopeSchema, processedScopesSchema, processedScopeKey, readProcessedScopes, mergeProcessedScopes, processedVersionForScope, type ProcessedScope } from "./processedScopes.js";
142
+ export { assertManagedDocumentName, assertManagedDocumentPath, discoverManagedDocuments } from "./managedSources.js";
143
+ export type { ManagedDocumentSourceType, ManagedDocumentSourceEntry } from "./managedSources.js";
144
+ export { sessionChangeSchema, sessionChangesSchema, readSessionChanges, writeSessionChanges } from "./sessionMetadata.js";
145
+ export type { SessionChange } from "./sessionMetadata.js";
146
+ export { indexerArticleKeySchema, indexerArticlePlanSchema, validateIndexerArticlePlan, indexerArticleSectionKey, validateIndexerPlannedArticles } from "./indexerArticlePlan.js";
147
+ export type { IndexerArticlePlan } from "./indexerArticlePlan.js";
148
+ export * from "./readingStructure.js";
149
+ export * from "./indexerKnowledgeDependency.js";
150
+ export * from "./indexerApprovedKnowledge.js";