@c4a/context 0.7.4 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +17 -8
  2. package/README.zh-CN.md +15 -8
  3. package/docs/README.md +13 -1
  4. package/docs/README.zh-CN.md +13 -1
  5. package/docs/getting-started.md +95 -69
  6. package/docs/guides/agent-dialogue.md +19 -9
  7. package/docs/guides/agent-guide.md +52 -10
  8. package/docs/guides/code-indexer-skill-authoring.md +50 -5
  9. package/docs/guides/indexer-manifest-example.md +103 -0
  10. package/docs/guides/indexer-provider-and-customization.md +307 -31
  11. package/docs/guides/indexer-skill-creation.md +99 -0
  12. package/docs/guides/knowledge-updates.md +324 -0
  13. package/docs/guides/lark-resources.md +5 -1
  14. package/docs/guides/markdown-indexer-skill-authoring.md +25 -7
  15. package/docs/guides/note.md +37 -0
  16. package/docs/guides/package-outputs.md +22 -17
  17. package/docs/guides/sessions.md +50 -0
  18. package/docs/guides/workspace-commit.md +45 -0
  19. package/docs/guides/workspace-prepare.md +72 -0
  20. package/docs/guides/workspace-restore.md +59 -0
  21. package/docs/reference/code-extractors.md +23 -11
  22. package/docs/reference/indexer-provider-protocol.md +116 -22
  23. package/docs/reference/package-templates.md +10 -9
  24. package/docs/reference/project-api.md +47 -13
  25. package/docs/reference/template-variables.md +7 -7
  26. package/index.d.ts +11 -0
  27. package/index.js +1819 -584
  28. package/indexerAgentStepProtocol.d.ts +1284 -2060
  29. package/indexerApprovedKnowledge.d.ts +371 -0
  30. package/indexerArticlePlan.d.ts +83 -0
  31. package/indexerArtifact.d.ts +10 -7
  32. package/indexerArtifactDependencies.d.ts +7 -5
  33. package/indexerArtifactPolicy.d.ts +16 -16
  34. package/indexerArtifactResult.d.ts +76 -69
  35. package/indexerAuthoringFixture.d.ts +8 -8
  36. package/indexerAuthorizedWorksetView.d.ts +14 -14
  37. package/indexerBaseQuestionAmendment.d.ts +40 -0
  38. package/indexerCandidateCompile.d.ts +46 -36
  39. package/indexerCatalogFallback.d.ts +566 -48
  40. package/indexerCompositionFactDependencies.d.ts +16 -0
  41. package/indexerContentLayers.d.ts +6 -4
  42. package/indexerContractDeclaration.d.ts +3 -0
  43. package/indexerControlledProgram.d.ts +1039 -238
  44. package/indexerCustomizationDraft.d.ts +188 -0
  45. package/indexerDependencyView.d.ts +17 -17
  46. package/indexerEffectiveArtifact.d.ts +26 -15
  47. package/indexerExampleFactDependencies.d.ts +17 -0
  48. package/indexerExampleIdentityAudit.d.ts +2 -2
  49. package/indexerInventoryDisposition.d.ts +44 -44
  50. package/indexerKnowledgeDependency.d.ts +46 -0
  51. package/indexerLayerComposition.d.ts +92 -54
  52. package/indexerLayoutChange.d.ts +8 -8
  53. package/indexerLayoutProposalSet.d.ts +15 -10
  54. package/indexerLayoutResolver.d.ts +15 -6
  55. package/indexerLayoutTransition.d.ts +8 -8
  56. package/indexerLifecycle.d.ts +1 -1
  57. package/indexerMainRunLedger.d.ts +7 -0
  58. package/indexerMainRunProtocol.d.ts +872 -196
  59. package/indexerMainWorkset.d.ts +50 -0
  60. package/indexerNavigationArtifactPlan.d.ts +2 -2
  61. package/indexerOverlayQuestionAmendment.d.ts +56 -16
  62. package/indexerOverlayQuestionApplyProposal.d.ts +98 -26
  63. package/indexerPartitionPlan.d.ts +585 -40
  64. package/indexerPhysicalArtifactAudit.d.ts +2 -2
  65. package/indexerPhysicalArtifactManifest.d.ts +24 -24
  66. package/indexerPostAuthorRunLedger.d.ts +60 -34
  67. package/indexerPrimaryProjection.d.ts +2 -2
  68. package/indexerProfileContract.d.ts +28 -28
  69. package/indexerProgramRunProtocol.d.ts +868 -194
  70. package/indexerProjectProposal.d.ts +36 -8
  71. package/indexerProjectedArtifactFanOutAudit.d.ts +2 -2
  72. package/indexerProvider.d.ts +72 -28
  73. package/indexerProviderComposition.d.ts +4 -4
  74. package/indexerProviderRouting.d.ts +52 -0
  75. package/indexerProviderSelectionProposal.d.ts +48 -0
  76. package/indexerPublicContractFacts.d.ts +7 -0
  77. package/indexerPublicContractTable.d.ts +11 -0
  78. package/indexerReaderTargetInventory.d.ts +6 -6
  79. package/indexerReferenceOnlyAudit.d.ts +2 -2
  80. package/indexerRegistry.d.ts +52 -0
  81. package/indexerRequirementConfirmation.d.ts +48 -16
  82. package/indexerRequirementLifecycle.d.ts +154 -42
  83. package/indexerResultReconciliation.d.ts +12 -11
  84. package/indexerSemanticInput.d.ts +28014 -1847
  85. package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
  86. package/indexerStructuredDeclaration.d.ts +8 -8
  87. package/indexerTemplateRendering.d.ts +7 -7
  88. package/indexerToolSnapshot.d.ts +16 -16
  89. package/managedSources.d.ts +15 -0
  90. package/package.json +1 -1
  91. package/phases.d.ts +0 -3
  92. package/processedScopes.d.ts +75 -0
  93. package/readingStructure.d.ts +188 -0
  94. package/sessionMetadata.d.ts +49 -0
  95. package/sources.d.ts +9 -3
  96. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
  97. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
@@ -0,0 +1,99 @@
1
+ # Creating a reusable Indexer Skill
2
+
3
+ A Provider is a portable Skill bundle. Workspace-local customization changes a
4
+ selected Provider for one workspace; it is not the packaging format for a new
5
+ Provider. Start from the source interpretation and reader task, then choose
6
+ primary replacement or an advertised extension.
7
+
8
+ ## Package and protocol
9
+
10
+ A typical instruction-only bundle contains:
11
+
12
+ ```text
13
+ context-example-indexer/
14
+ SKILL.md
15
+ context-indexer.yaml
16
+ references/indexer.md
17
+ references/writing.md
18
+ templates/reader-guide.md
19
+ ```
20
+
21
+ The name is illustrative. Use a discoverable context-…-indexer… name and an
22
+ explicit Provider identity/version. SKILL.md describes when the lifecycle may
23
+ select it; context-indexer.yaml declares context.indexer.provider/v1, domains,
24
+ activation, profiles, operations and resources. Instructions and templates must
25
+ be declared for the profiles using them. Do not copy unused profiles, composers
26
+ or resource paths. Do not add a provider manifest to the creation assistant itself.
27
+
28
+ Start from the [minimal manifest](indexer-manifest-example.md), which gives the
29
+ field tree in three groups: required, required once a capability is declared, and
30
+ optional. Read the [protocol](../reference/indexer-provider-protocol.md) for the
31
+ subsystem rules behind those fields — selection validation, partition authority,
32
+ overlays, controlled invocation — and the [selection
33
+ guide](indexer-provider-and-customization.md) for composition.
34
+ The four built-in examples are context-code-indexer, context-markdown-indexer,
35
+ context-note-indexer and context-sessions-indexer. The latter two are independent
36
+ source interpreters using markdown-domain contracts. Use their source-specific
37
+ references instead of making a Markdown Provider accept everything.
38
+
39
+ ## Find a real example
40
+
41
+ If Context CLI is available, inspect `context indexer catalog --format json`.
42
+ Use the selected entry's guidance.skill_path and guidance.manifest_path to locate
43
+ its bundle; read only that example and its declared resources. Alternatively use
44
+ an exact Host-exposed installed Skill. Do not guess cache paths. This read-only
45
+ catalog use is for Provider development, not a new production discovery gate.
46
+
47
+ Choose one profile and follow its manifest references through instructions and
48
+ template to its declared results. A code example demonstrates parser facts and
49
+ public APIs; a document example demonstrates evidence-based consolidation;
50
+ a note example demonstrates excerpts versus summaries; a sessions example
51
+ separates decisions, rejected proposals and optional change associations.
52
+ Adapt behavior, not only names. The example's breadth is not a minimum feature
53
+ requirement for a specialized Provider.
54
+
55
+ ## Validate against the installed SDK
56
+
57
+ Use the matching SDK's public exports. For community installations the package
58
+ is @c4a/context; for an internal distribution use its supplied SDK coordinates.
59
+ With the SDK available, this Node ESM check validates the manifest and declared resource paths:
60
+
61
+ ```js
62
+ import { loadIndexerProviderManifest } from '@c4a/context';
63
+ const manifest = await loadIndexerProviderManifest(process.argv[2]);
64
+ console.log(manifest.id, manifest.version);
65
+ ```
66
+
67
+ The argument is the Skill bundle directory. This check does not establish that
68
+ all resources are usable or that the Provider can produce useful pages. Check
69
+ all declared resource paths stay within the bundle and exist; validate templates
70
+ with the SDK template loader and their declared profile contracts. Consult the
71
+ installed exported signatures before writing the runner: do not invent a CLI
72
+ validate command or fabricate a production Route to run a development check.
73
+
74
+ Template protocol is context.indexer.template/v1. Semantic prose and deterministic
75
+ Facts have separate variables; registered renderers own program blocks. A
76
+ Provider cannot invent a renderer or an arbitrary document kind. Use supported
77
+ profile/artifact contracts or the existing declared overlay mechanism.
78
+
79
+ Use anonymous fixtures that demonstrate the advertised source interpretation:
80
+ one useful result, material that cannot support a claim, and an existing-page
81
+ update. Test primary/extension ownership only if that composition is advertised.
82
+ Test the complete selected bundle in a disposable workspace through the normal
83
+ lifecycle when the necessary CLI and materials are available. Preserve the
84
+ user's live workspace. Record exact commands and failures; clearly distinguish
85
+ schema/resource checks from semantic review and lifecycle verification.
86
+
87
+ ## Distribution and use
88
+
89
+ Keep references and templates inside the bundle, with portable relative paths.
90
+ The complete runtime file ledger determines integrity; do not hand-write a hash
91
+ or copy another bundle's integrity. Use the target distribution's existing
92
+ packaging/resolution tools. Development fixtures need not be shipped as runtime
93
+ resources. Installation may use any supported organizational channel.
94
+
95
+ A business Provider may be enabled through the host and selected instead of the
96
+ default. Prefixes aid discovery; the manifest and verified resources determine
97
+ compatibility. Select through the current Context Provider-selection Route when
98
+ the user requests actual use. No new CLI install registry or creation-specific
99
+ production state is needed.
@@ -0,0 +1,324 @@
1
+ # Update existing knowledge
2
+
3
+ Use the same Context conversation and the current workspace. Identify whether
4
+ this is a continuation, an adjustment to the current task, a correction to one
5
+ page, or an independent task. An old Route does not incorporate a new request.
6
+ For explicit workspace preparation, Git commit or historical restoration, use
7
+ [prepare](workspace-prepare.md), [commit](workspace-commit.md) or
8
+ [restore](workspace-restore.md); these Agent-led operations do not automatically
9
+ start production. Otherwise, do not start an independent task while another remains: explain what is saved
10
+ and unfinished, and obtain the user's choice to finish or roll back the current
11
+ work. Do not delete runtime files to simulate rollback.
12
+
13
+ For an unambiguous page correction, use `context revise "<path or title>"
14
+ --instruction "<correction>" --format json`. Context supplies the existing text
15
+ and continues through Review and delivery. Expression-only changes need no
16
+ source capture or Parser. Preserve prior confirmed contributions; distinguish
17
+ actual behavior, a confirmed decision, and a proposal that is not implemented.
18
+
19
+ ## Edit one section or review part of a batch
20
+
21
+ For a reading-directory-only change, use the existing `context task adjust
22
+ --input <file|-> --format json` action with `reading_structure`. Supply its
23
+ current `expected_revision`, explicit `upsert` entries and `remove` keys. Each
24
+ entry retains its stable key, parent, title and order; optional targets use
25
+ article identity and section key. The current structure preview supplies those
26
+ identities. Use `expected_revision: null` only when no reading structure exists.
27
+ After adjustment, follow status to rebuild affected packages. This changes the
28
+ reading organization without capturing sources or rewriting approved prose.
29
+ Do not directly edit generated package navigation or use titles as identities.
30
+
31
+ The current approved-revision Route accepts either full `markdown` or explicit
32
+ `sections` edits. Use an existing `writing_context.current_sections` ID and an
33
+ ordered `content` list of `{ "markdown": "new text" }` and/or
34
+ `{ "program": "exact current program token" }`. Unchanged sections and the
35
+ selected section's source references remain intact. Use full Markdown when
36
+ changing structure, adding a page or when a section has no unambiguous ID.
37
+
38
+ For an optional check, append `--preview` to the current `action complete-current`
39
+ command with the same revision and input file. It validates and returns the
40
+ assembled page and previous text without accepting the edit. Submit the same
41
+ input without that flag to continue. A preview is not approval and does not make
42
+ a stale revision valid.
43
+
44
+ Review can approve checked pages while leaving repair pages pending. The HTML
45
+ review code includes pending positions; managed Review provides the same current
46
+ scope as a JSON template. Send decisions only for pages actually reviewed. Omit
47
+ means a durable exclusion, not repair. Partial approval alone does not build.
48
+
49
+ When the user requests an earlier delivery, use the Route's `context run
50
+ --deliver` request. Independently approved pages can pass close/build while
51
+ pending candidates remain for Review or repair. Links to pending or missing
52
+ pages keep their necessary scope together. Source processing baselines advance
53
+ only after the entire update finishes. Failed builds retain the selected delivery
54
+ and pending work; repair the cause and follow the current Route.
55
+
56
+ ## Acquire the selected change once
57
+
58
+ Use the host's existing Git, code-hosting or document tools and their installed
59
+ guidance. Context does not poll a platform, discover remote changes, or infer
60
+ that a merge request is merged. Reading an already selected source does not
61
+ require a new permission question when access was already authorized. Do not
62
+ change the user's checkout or fetch another repository without that scope.
63
+
64
+ For a branch or MR/PR, establish the repository, intended target branch, merge
65
+ state and actual fixed target commit. An unmerged proposal is not the current
66
+ mainline. A merge, squash or rebase can produce different commit identities;
67
+ use the target branch's actual result, not the feature branch SHA. Include
68
+ other intervening changes between the last processed version and the selected
69
+ target when they affect the registered modules. Reverts are real changes.
70
+
71
+ Use already available local Git objects to compare the selected module trees
72
+ and necessary diffs. A new repository commit with unchanged module trees can
73
+ be a no-knowledge-change conclusion. That conclusion must also account for any
74
+ new note or development context. If a baseline is unavailable after force push,
75
+ a shallow checkout or history cleanup, state that a complete old diff is
76
+ unavailable; compare current material with approved knowledge in the confirmed
77
+ scope. Do not claim no change because a Git command failed. A repeated MR may
78
+ still bring new relevant context; it does not justify moving the code baseline
79
+ backwards or summarizing unrelated commits as part of that MR.
80
+
81
+ For documents, a revision shortcut is valid only if the host actually exposes a
82
+ reliable version for the selected document and its needed images/attachments.
83
+ Otherwise read that selected document and resources. Keep the returned bytes
84
+ for the existing capture/import action; do not fetch them again as verification.
85
+ An unchanged body does not prove images are unchanged. Distinguish lack of
86
+ permission, deleted content, and moved content; a read failure is not permission
87
+ to retire a knowledge page. CLI status describes local acquisition only.
88
+
89
+ After the current source configuration and material identify the chosen fixed
90
+ versions, submit the update with `context update --input <file|-> --format json`.
91
+ Write ordinary YAML or JSON with the host's editor, without a generated wrapper
92
+ program. Input files belong under this workspace's `.tmp/`.
93
+
94
+ ```yaml
95
+ scopes:
96
+ - requirement_ref: reader-guide
97
+ source_ref: repo:20260901/library
98
+ changes: The selected change adds one public option; inspect its explanation and examples.
99
+ ```
100
+
101
+ `requirement_ref` is the existing requirement id. Omit `module_refs` for a whole
102
+ confirmed source scope. `processed_version` may be supplied to bind the exact
103
+ acquired commit or document content digest; otherwise Context captures it from
104
+ the existing local material. A supplied version must match that material.
105
+ Follow the returned Route. The candidate list is a conservative source match,
106
+ not a list of pages that must change. Read the actual change and current pages,
107
+ also checking additions that have no old page reference. The scope is complete
108
+ only after every required change is reviewed, closed and built, or after an
109
+ explicit conclusion that it needs no knowledge changes.
110
+
111
+ Before importing a `note`, read [note source preparation](note.md).
112
+ Before importing `sessions`, read [development summary preparation](sessions.md).
113
+ Choose the reference for the actual input; do not read both by default.
114
+
115
+ ## Save text without an external file
116
+
117
+ Use `context source import --input <file|-> --format json`:
118
+
119
+ ```yaml
120
+ type: note
121
+ name: 20260907/decision-context.md
122
+ markdown: |
123
+ # Decision context
124
+
125
+ The selected discussion confirmed this exception for the stated situation.
126
+ The implementation has not yet changed. Source: the discussion supplied here.
127
+ ```
128
+
129
+ The body is saved directly under `sources/note/` or `sources/sessions/`; no
130
+ external `local`, capture, registry or second copy is required. Use a readable
131
+ semantic filename under an eight-digit date directory. Do not put a date, hash
132
+ or session id into the filename again. Keep the path for retries and later
133
+ edits. To revise an existing source, read it and pass its current `base_digest`
134
+ with the replacement Markdown. Distinct same-day material needs a distinct
135
+ semantic name, never a silent overwrite. `source list`, `source get` and
136
+ `source inspect` expose the actual source paths. Removal uses the existing
137
+ preview and exact plan digest, and refuses still-referenced text.
138
+
139
+ Saving alone does not start indexing. If the user only wants the source saved,
140
+ report its path and stop. For production, reuse the existing requirement:
141
+ put independent content in `target_scope`; put supporting material in
142
+ `evidence_source_scope` and ensure the selected Indexer's existing `read_scope`
143
+ covers it. Do not create a separate Markdown production target for a supporting
144
+ explanation of a code page. In the source-update decision, include its exact
145
+ `supporting_sources` on the affected page. Include that source's scope in this
146
+ update so completion can distinguish code from newly processed context.
147
+
148
+ ## Development context accompanying a commit
149
+
150
+ Use `trace-session` only as this conditional source-preparation step. If the MR,
151
+ code and existing design already explain the relevant information, cite them.
152
+ Write a `sessions` source only when real, explicitly available development
153
+ context contains useful decisions, reasons or limits missing from those sources.
154
+ Do not fabricate discussion from a diff, search host session storage, ask for
155
+ nonessential history, or create an empty/skip report. This is only the code-related subcase. An authorized conversation summary
156
+ without an MR or commit is also `sessions`; see the sessions source guide.
157
+ Optional `changes` belongs in the source frontmatter, not knowledge headers.
158
+
159
+ Use the available merge date, or commit date for a pure commit, for the initial
160
+ directory; if unavailable or saving an unmerged discussion explicitly, use the
161
+ current collection date and explain the context. Do not query a platform just
162
+ for this date. Keep the path when later adding a reference or retrying another
163
+ day. One coherent change can share one summary; separate unrelated changes.
164
+
165
+ The shortest useful body is the real repository/MR/commit reference plus one
166
+ paragraph explaining what the code does not tell a later reader. Describe only
167
+ the actually associated commit subset. Omit a full change recap, transcript,
168
+ test log, session id and formal approval claim. Write confirmed decisions as
169
+ such, alternatives as alternatives, and unresolved proposals as unresolved.
170
+ Do not claim execution or tests that were not observed. The writing aid below
171
+ is optional; no section is mandatory:
172
+
173
+ ```markdown
174
+ # <Change topic>
175
+
176
+ <Reference the actual repository and MR or concrete commits already available.>
177
+
178
+ <Explain the useful decision, reason or constraint absent from the code/design.
179
+ State its applicability and distinguish implemented behavior from a proposal.>
180
+ ```
181
+
182
+ Late context can update a page even when the code version is already processed.
183
+ Reuse that fixed code version and current approved prose; do not restart Parser
184
+ merely because a summary arrived. Import once, then include the necessary
185
+ context with the same knowledge update. Saved context survives a failed build;
186
+ saving it does not mean its knowledge impact has been delivered.
187
+
188
+ ## Optional correction of an upstream document
189
+
190
+ Local knowledge approval and fully managed execution do not authorize a remote
191
+ write. First determine whether the knowledge misunderstood correct source text,
192
+ a confirmed decision has not reached the source, or the conclusion is still
193
+ uncertain. The first needs only a local correction; the second can use a note
194
+ locally while an upstream change is considered; uncertainty is not a fact.
195
+
196
+ Present the exact document, affected passage, proposed before/after text, reason
197
+ and affected knowledge. Reuse existing authorization for that concrete edit;
198
+ otherwise ask for it. Before writing, read the affected passage again using the
199
+ host document tool. Adapt only within the authorized scope if another person
200
+ has edited it; ask again only when the requested change materially differs.
201
+
202
+ Execute with the host tool and read back the result. If the write result is
203
+ uncertain, read back before retrying an insertion. Only the actual returned
204
+ source text and resources may refresh its snapshot. Feed them into the same
205
+ local capture/update route; a note or proposed patch is not a remote snapshot.
206
+ If the remote edit succeeded but local build failed, resume local delivery;
207
+ do not repeat the remote edit. Explain remote and local outcomes separately.
208
+ Do not automatically delete an absorbed note, post comments, notify groups or
209
+ change permissions. Permission failure can leave a concrete suggestion for
210
+ the user without blocking an independently supported local correction.
211
+
212
+ ## Import a document response already read by the host
213
+
214
+ For a registered Lark source, retain the actual full JSON response from
215
+ `lark-cli docs +fetch` and each returned continuation page. Do not reconstruct a
216
+ response from a summary. Use the same source import command:
217
+
218
+ ```yaml
219
+ type: lark
220
+ name: 20260907/guide
221
+ access_identity: user
222
+ response_files: [.tmp/guide-response.json]
223
+ media_files:
224
+ actual-image-token: .tmp/downloaded-image.png
225
+ ```
226
+
227
+ Only include real media tokens and downloaded files. Context runs the ordinary
228
+ capture normalization and resource checks on these bytes. It does not fetch the
229
+ provided document again; missing required resources follow existing capture
230
+ handling. Partial outline/section fragments cannot replace a full snapshot.
231
+ Use the identity that actually produced the response, not a credential fallback
232
+ chosen to bypass permissions. Subsequent local updates use the captured version
233
+ and the same Review/build route.
234
+
235
+ ## Adjust or roll back current work
236
+
237
+ For an explicit same-task change to native Indexer source inputs, use
238
+ `context task adjust --input <file|-> --format json` with `scopes` containing the
239
+ selected `source_ref` and optional `module_refs`, plus an `instruction` explaining
240
+ the adjustment. It invalidates those old worksets and retains independent work.
241
+ Import the fixed replacement material before following the refreshed Route.
242
+ Do not execute the old batch payload. A local page correction still uses
243
+ `revise`; it is not a reason to invalidate an entire source.
244
+
245
+ For an independent task, complete the old Route unless the user chooses a
246
+ concrete rollback. Without an identifiable baseline or attribution of changes,
247
+ ask about that gap or offer completion; never guess original bytes. Prepare
248
+ `context task rollback --input <file|-> --format json` using:
249
+
250
+ ```yaml
251
+ summary: Restore the selected page and discard unfinished follow-up drafts; keep other work.
252
+ discard_unfinished: true
253
+ files:
254
+ - path: knowledge/guides/selected-page.md
255
+ base_digest: sha256:<current-file-digest>
256
+ content: |
257
+ <exact recoverable original Markdown, not a newly generated replacement>
258
+ ```
259
+
260
+ `files` contains only the explicitly selected reversions. `content: null` removes
261
+ an explicitly selected file that this task added; `base_digest: null` is for
262
+ restoring an absent file. Include changed sources/configuration/processed scopes
263
+ when they belong to the rollback. Leave unrelated and pre-existing edits alone.
264
+ An empty list only discards unfinished work and must not be described as undoing
265
+ already delivered pages. The preview shows actual before/after contents and
266
+ draft loss. Once the user approves that exact scope, run the preview's apply
267
+ command with its plan digest. Then follow the rollback Route through close,
268
+ build and cleanup. A failed build retries delivery, not the already-applied
269
+ reversions. Begin the independent task only after cleanup succeeds.
270
+
271
+ A managed source can be explicitly renamed with `context source rename
272
+ "<note:... or sessions:...>" --name "YYYYMMDD/new-name.md" --format json` after
273
+ its active work is finished. Review the file/reference changes, then apply the
274
+ returned digest-bound command. Existing references move with it; the original
275
+ body is not copied into another source type. Follow status to refresh affected
276
+ knowledge structure and packages.
277
+
278
+ To move an approved page, use `context revise "<old path>" --move-to "<new path>"
279
+ --instruction "<requested move and content changes>" --format json`. The new
280
+ path stays in the same collection. The revision retains the page identity,
281
+ rebases outgoing links and updates incoming Markdown links at approval. A new
282
+ subject name alone only needs a title/content revision; do not create duplicate
283
+ pages. Retirement is a content decision: explain the inapplicable material and
284
+ supported replacement before changing its page and referring navigation.
285
+
286
+ ### Adjust inputs while a local update is unfinished
287
+
288
+ `context task adjust --input <file> --format json` also applies to an active
289
+ approved-page revision or source-update queue. Keep `scopes` and `instruction`
290
+ explicit. First call without `refresh`; it authorizes replacing only those
291
+ inputs and blocks page completion while acquisition is pending. Import the
292
+ selected new material, then repeat with `refresh: true` to bind the actual local
293
+ versions and obtain the new Route. Do not submit the old revision. Current
294
+ prose and queued pages remain; an affected draft returns to writing/review.
295
+ An unrelated queued page does not revoke an unchanged current page's review.
296
+ If a page has already been applied, finish its close/build before changing its
297
+ inputs. Only the final completed scope advances its processed baseline.
298
+
299
+ For several documents, `source import` also accepts a JSON/YAML array of the same
300
+ single-document inputs. Its receipt reports each zero-based input index and
301
+ success or error separately; a partial batch returns a nonzero exit code.
302
+ Keep successful sources and retry only failed entries. It does not fetch a
303
+ successful prefetched document again or roll back an unrelated saved note.
304
+
305
+ To add a new supporting source to an unfinished local revision, first save it
306
+ and include it in the current requirement's evidence scope and the selected
307
+ Indexer's read scope. Its `task adjust` scope also supplies the explicit
308
+ `requirement_ref`. This extends the current page's available sources and keeps
309
+ queued pages; it does not silently start another task or another Indexer.
310
+
311
+ ### Replacing supporting article identities
312
+
313
+ When an upstream article is split, merged or removed, start `context revise` for
314
+ its consumer and use `context task adjust --input - --format json` with
315
+ `instruction` and `knowledge_dependencies: { dependencies }`. Each dependency
316
+ uses an approved `artifact_ref`, optional `section_refs`, and `required` flag.
317
+ The current Author input returns authorized replacement facts and their evidence.
318
+ Repeat the adjustment with `knowledge_dependencies.sections`, selecting each
319
+ retained `section_key` and its full `fact_refs` and `evidence_refs` support. Then
320
+ revise the explanation and complete normal Review, close and build. An explicit
321
+ empty dependency list removes the relationship only when remaining sections have
322
+ valid direct support. Missing dependencies, changed approvals and invalid source
323
+ references cannot silently become current evidence. Writing quality remains an
324
+ Agent/Review decision; no chapter-count or wording gate is introduced.
@@ -2,7 +2,11 @@
2
2
 
3
3
  Lark documents can contain evidence that is not present in the readable text
4
4
  body. Context handles these resources mechanically during `captureLark`; the
5
- Agent does not download, summarize, or reconstruct them itself.
5
+ Agent does not reconstruct resource bytes or substitute a summary for them.
6
+ When the host already fetched the document, `context source import` accepts the
7
+ actual full response files and downloaded media for the same normalization and
8
+ resource checks; it does not fetch that supplied body again. See
9
+ [importing an existing response](knowledge-updates.md#import-a-document-response-already-read-by-the-host).
6
10
 
7
11
  ## Resource policy
8
12
 
@@ -5,7 +5,12 @@ versioning, Bundle, requirement, trust, Result and customization contracts as
5
5
  Code Providers. Read the shared
6
6
  [Code Indexer author checklist](./code-indexer-skill-authoring.md) and
7
7
  [Provider selection/customization guide](./indexer-provider-and-customization.md)
8
- first. This page defines the Markdown-specific boundary.
8
+ first. This page defines the boundary for captured file/Lark documents.
9
+ Saved notes and conversation summaries use their dedicated Note/Sessions
10
+ Providers, or an explicitly selected business replacement, on the same protocol.
11
+ They reuse Markdown reading without a second capture phase. A Markdown page may
12
+ still consume either as authorized supporting material; specialized extension
13
+ guidance does not transfer primary ownership.
9
14
 
10
15
  ## Capture before semantics
11
16
 
@@ -41,8 +46,10 @@ Author Results propose logical Sections and their intent; they do not write
41
46
 
42
47
  Context owns the closed mapping from profile/Section intent to collection and
43
48
  path. The layout resolver reuses an existing Artifact by stable identity,
44
- detects add/remove/rename/split/merge/move changes and requests a human Gate
45
- only for destructive or ambiguous existing-layout changes. A Provider cannot
49
+ detects add/remove/rename/split/merge/move changes. Ordinary production reviews
50
+ the proposed new structure before Author, including new topics in an update.
51
+ Protected changes to an approved layout have their own human-only Gate; this
52
+ is distinct from ordinary structure review and its managed delegation. A Provider cannot
46
53
  avoid that Gate by emitting a path or relabeling the change.
47
54
 
48
55
  ## Reusing Code Nodes
@@ -77,10 +84,12 @@ collection-wide recomputation.
77
84
 
78
85
  Editorial instructions may guide clarity, consolidation, ordering and
79
86
  reader-facing terminology. They cannot alter facts, evidence, source role,
80
- requirement scope, protected values, revision identity, collection authority or
81
- hard metrics. Deterministic blocks render only registered facts; semantic prose
82
- must cite consumed evidence. Placeholders, speculation, fabricated transitions
83
- and “content unavailable” pages are invalid even when the structure looks rich.
87
+ requirement scope, protected values, revision identity or collection authority.
88
+ Deterministic blocks render only registered facts; semantic prose cites consumed
89
+ evidence. The Agent or user assesses missing explanations, speculation and
90
+ unfilled placeholders in the existing content Review. Context does not scan
91
+ words, braces, comments or headings to reject content, and an editorial hint
92
+ does not create another gate or require a signal-clearing receipt.
84
93
 
85
94
  ## Missing material
86
95
 
@@ -96,6 +105,15 @@ content Review. There is no answer-only operation or evidence-specific Review.
96
105
  A blocking gap closes only through current source or an explicit non-delegable
97
106
  requirement change.
98
107
 
108
+ ## Bounded execution
109
+
110
+ Each captured document remains an independently recoverable Partition input,
111
+ but Context may transport several documents in one bounded Agent step. Return
112
+ one result for every supplied task key and let global convergence merge
113
+ documents that establish the same Subject. Batch order, filename order and
114
+ heading order never create Subject identity. Author and Review use the same
115
+ bounded transport rule without adding intermediate user approvals.
116
+
99
117
  ## Markdown author fixture checklist
100
118
 
101
119
  Release fixtures should cover:
@@ -0,0 +1,37 @@
1
+ # Prepare a note source
2
+
3
+ Read this before importing or correcting a note. The CLI saves supplied Markdown;
4
+ source preparation happens before knowledge production.
5
+
6
+ A note may contain supplied original text, selected verbatim excerpts, a summary,
7
+ or a useful combination. Do not require raw text plus a summary for every note.
8
+ If both exist, distinguish them with readable headings or prose. Preserve short
9
+ original text when useful; do not duplicate it just to fill a form. Label an
10
+ external or Agent summary as a summary, never an original transcript.
11
+
12
+ For long inputs, retain relevant excerpts or summarize within the agreed purpose.
13
+ Keep qualifications, exceptions, disagreement and unresolved questions that affect
14
+ the conclusion. State the available origin and selected scope, including material
15
+ omissions when consequential. Quote only actual verbatim input. Do not invent
16
+ links, speakers, dates or confirmation. A link does not mean its target was read;
17
+ ask about essential missing context rather than fetching everything for a label.
18
+
19
+ Save the body under sources/note/YYYYMMDD/topic.md with the existing import action.
20
+ No extra raw/summary fields, sidecar, duplicate file or mandatory section template
21
+ is needed. Saving alone does not start indexing. Independent reader topics can
22
+ use the selected Note Provider (default or business replacement); supporting
23
+ explanations use the current page's evidence/read scope, retaining its primary.
24
+ When specialized interpretation is needed, explicitly select a compatible
25
+ extension layer. Do not enable another skill merely because a note exists.
26
+
27
+ Knowledge integrates the useful information into explanations, rules or steps
28
+ for the reader. Do not copy the note wholesale or turn proposals into facts.
29
+ An exact short passage is appropriate when its wording matters. Cite the stored
30
+ material actually read, without claiming access to an unavailable original.
31
+
32
+ If the note misrepresents the supplied material, explicitly correct the source
33
+ with its current base_digest, following task adjust first for pinned inputs.
34
+ Do not overwrite original text merely to fit new prose. If the source is correct
35
+ but the knowledge is misleading, revise only that page through Author/Review.
36
+ A confirmed future decision may differ from current implementation; make the
37
+ boundary clear. Knowledge approval does not change or remove the note.
@@ -4,8 +4,10 @@ Package outputs are generated folders under `dist/`. They turn approved
4
4
  knowledge from `knowledge/` into a shape that another consumer can install,
5
5
  read, or import.
6
6
 
7
- Package output is a human decision gate. Do not add package declarations until
8
- the user chooses the intended consumer and output shape.
7
+ Package output is a semantic decision: establish the intended consumer and output
8
+ shape before declaring it. Reuse the user's existing choice. A current managed
9
+ Route may delegate this decision to the Agent; it does not require a repeated
10
+ permission question.
9
11
 
10
12
  Package build consumes approved and closed knowledge. If status reports that
11
13
  close is required, run deterministic close before build. Current close derives
@@ -68,26 +70,29 @@ Do not ask for another distribution namespace. Older workspaces may still
68
70
  contain `distribution.knowledgeNamespace`; Context accepts that legacy input
69
71
  without using it to shape the package.
70
72
 
71
- Skill names are separate. Ask whether the author wants a short optional Skill
72
- prefix, then maintain the complete final template directory name directly—for
73
+ Skill names are separate. If a short prefix is useful, maintain the complete
74
+ final template directory name directly—for
73
75
  example `skills/android-query/SKILL.md`. Package-root layout never renames a
74
76
  Skill.
75
77
 
76
78
  The default `knowledge-query` Skill is a complete generic query entry. It
77
79
  carries the structure-first query discipline: start from OKF directory indexes, use
78
80
  `context-build-inventory.json` edge records for package-visible relationships,
79
- inspect page `sources` / `context:section` source_ref metadata, cite
80
- page/section evidence, and report explicit gaps when the package does not cover
81
- a requested fact. It does not treat direct grep over bundled OKF root
81
+ read candidate pages, cite their visible headings and relevant passages, and
82
+ report gaps when the package does not cover a requested fact. Consumer pages
83
+ omit `sources` and `context:section` metadata. For exact upstream attribution,
84
+ a maintainer needs the original workspace page mapped by the inventory; a
85
+ package-only reader must not claim to have read that source. It does not treat direct grep over bundled OKF root
82
86
  directories as the primary discovery path. When indexes do not narrow the
83
87
  scope, or a candidate page is too large to read directly, its bundled
84
88
  `scripts/search.mjs` provides deterministic BM25 ranking over mechanically
85
89
  bounded Markdown chunks. Search results are leads; page bodies and typed edge
86
- records remain the evidence. Its final template-author section
87
- requires package authors to replace or edit the generic routing when the
88
- package needs project-specific terminology, entry points, known limits, or
89
- task workflows. Authors may explicitly accept the generic default when it is
90
- intentionally sufficient.
90
+ records establish what the package actually says. Package authors edit the source
91
+ template when project-specific terminology, entry points or task workflows are
92
+ needed. Authoring instructions should be template comments or separate guidance,
93
+ not a final section addressed to authors in the delivered query Skill. The
94
+ current template-review Route can accept an intentionally sufficient generic
95
+ default under its applicable authority.
91
96
 
92
97
  When approved pages reference materialized resources, Context keeps their
93
98
  production copies in content-addressed `knowledge/assets/` paths and bundles
@@ -162,7 +167,7 @@ It links directly to pages in small child directories and to a child
162
167
  The default threshold is 50 selected knowledge pages. Use Handlebars variables such as
163
168
  `knowledgeGroups`, `knowledgeItems`, and `knowledgeTree` when a project needs
164
169
  custom navigation. Before customizing it, read
165
- `node_modules/@c4a/context/docs/reference/template-variables.md`.
170
+ [Template Variables](../reference/template-variables.md).
166
171
 
167
172
  Newly initialized generic templates must be replaced, edited, or explicitly
168
173
  accepted before the first build. `context status` exposes that choice as a
@@ -259,11 +264,11 @@ Which one should I declare first?
259
264
 
260
265
  If the user chooses the Agent knowledge-base package, explain that its OKF
261
266
  roots are flat within `dist/<package-name>/`; do not ask for a second namespace.
262
- Ask whether its Skills need a short prefix. The author maintains final Skill
263
- names independently from package paths.
267
+ If its Skills need a short prefix, the author maintains those final names
268
+ independently from package paths; this is not a mandatory question.
264
269
 
265
- Do not offer `both` as a shortcut. If the user wants multiple outputs, add one
266
- package first, verify the shape, then add another package after confirmation.
270
+ If the user requests multiple outputs, declare and verify each requested package.
271
+ There is no additional confirmation just because two outputs were already chosen.
267
272
  The default adaptive index policy avoids one-page directory indexes. Configure
268
273
  `kbPackage().navigation` when a package needs a different inline-entry
269
274
  threshold or a fully expanded index at every directory.