@c4a/context 0.7.5 → 0.7.9

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 (98) 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 +20 -9
  7. package/docs/guides/agent-guide.md +48 -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 +334 -15
  11. package/docs/guides/indexer-skill-creation.md +99 -0
  12. package/docs/guides/knowledge-updates.md +422 -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 +231 -60
  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 +135 -22
  23. package/docs/reference/package-templates.md +10 -9
  24. package/docs/reference/project-api.md +100 -13
  25. package/docs/reference/template-variables.md +7 -7
  26. package/index.d.ts +15 -0
  27. package/index.js +1708 -626
  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 +12 -12
  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/indexerProtocolHash.d.ts +2 -0
  72. package/indexerProvider.d.ts +102 -58
  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 +658 -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 +27168 -3813
  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/knowledgeMap.d.ts +188 -0
  90. package/managedSources.d.ts +15 -0
  91. package/package.json +1 -1
  92. package/packageSite.d.ts +25 -0
  93. package/phases.d.ts +0 -3
  94. package/processedScopes.d.ts +75 -0
  95. package/sessionMetadata.d.ts +49 -0
  96. package/sources.d.ts +9 -3
  97. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
  98. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
@@ -0,0 +1,422 @@
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
+ ## First-task intake budget
20
+
21
+ Before registration and capture, the Agent uses the user's task instructions and
22
+ reads batch metadata titles across the explicitly supplied document list. Lark
23
+ metadata requests accept at most 200 entries each, not 200 words or 200 documents
24
+ overall. H1/H2 may be reused only when metadata returns them without
25
+ body retrieval; Lark batch metadata returns titles, not headings. Batch failure
26
+ falls back to at most 10 unresolved document title lookups total, unless a shared
27
+ authentication failure makes those calls redundant. The Agent does not fetch
28
+ source bodies, outlines, images or attachments. Missing title metadata is
29
+ optional: preserve the original URL without falling back to body retrieval or
30
+ changing credentials. Resolve intent from the conversation; refine provisional
31
+ chapters and module boundaries from evidence after formal capture.
32
+
33
+ ## Workspace versions and changelog
34
+
35
+ `package.json.version` is the workspace SemVer. At completed-scope delivery the
36
+ workflow asks the Agent to inspect formal changes and record an increasing version
37
+ with a concise changelog. Added modules or expanded material coverage increment
38
+ minor; corrections, existing-module updates, navigation and persistent status
39
+ changes increment patch. Major requires an explicit user instruction. Temporary
40
+ progress under `.tmp/` never causes a version increase.
41
+
42
+ Version recording runs at completed-scope delivery after Review, Close and package
43
+ configuration/template approval, before the final build. The record response
44
+ returns the next workspace Route, so no extra status call is needed. Build retries
45
+ reuse the recorded version when formal content is unchanged. Intermediate batches
46
+ do not each receive a version.
47
+
48
+ The workspace AGENTS.md and version-writing instructions require each entry's
49
+ details to stay within 1500 visible characters, including punctuation across the
50
+ title, changes, trigger descriptions and actor display name, excluding protocol
51
+ keys, version and date. The Agent compresses longer drafts before submission,
52
+ preserving main changes, impact and triggers instead of truncating text or splitting
53
+ the iteration into extra versions. This is an Agent writing rule, not a prose-quality
54
+ CLI gate.
55
+
56
+ `context version inspect --format json` returns changed paths and a digest. The
57
+ coordinator submits `context version record --input <file> --format json` with:
58
+
59
+ ```yaml
60
+ expected_digest: "<digest returned by inspect>"
61
+ version: 0.2.0
62
+ title: Add module recovery guidance
63
+ changes:
64
+ - Document recovery conditions and the supported retry flow.
65
+ triggers:
66
+ - kind: module
67
+ description: Additional module material requested in this iteration.
68
+ actor:
69
+ kind: lark
70
+ name: Example User
71
+ ```
72
+
73
+ `actor` is optional; omit it to use local Git `user.name` when configured. Use a
74
+ Lark display name only when explicitly known from the conversation. Trigger kinds
75
+ are `initial`, `note`, `sessions`, `mr`, `module`, `document`, `navigation`,
76
+ `repair`, `dist`, and `other`. Agent-written fields describe the actual diff and
77
+ conversation; they must not expose credentials, raw transcripts or private IDs.
78
+
79
+ The CLI writes `changelog.yaml`, generated `CHANGELOG.md`, `package.json` and the
80
+ `.context-version.json` content baseline together. Keep these formal files with
81
+ the workspace; do not hand-edit generated baselines. Git-managed and unignored
82
+ new files are compared (without Git, non-runtime workspace files are compared).
83
+ Version metadata itself, `dist`, `.tmp` and dependencies do not cause changes.
84
+
85
+ Successful builds record version and per-package hashes in `.context-builds.json`.
86
+ They do not increase versions. Before publishing, `context version publish-check
87
+ --format json` compares against `.context-published.json`. A same-version changed
88
+ output requires a patch using `version inspect --publish` and a `dist` trigger,
89
+ then a rebuild. Record `version published --hash <checked-hash> --receipt
90
+ <successful-publication-reference> --format json` only after external success.
91
+ No command commits, tags or uploads automatically.
92
+
93
+ Website history is available at `changelog.html`: cards are newest first, the
94
+ latest three expanded and older cards collapsed. The History button beside the
95
+ theme switch and footer update timestamps link there. KB and LLMS outputs carry
96
+ the same workspace version and changelog.
97
+
98
+ ## Customize the knowledge map at any time
99
+
100
+ For a knowledge-map-only change, use the existing `context task adjust
101
+ --input <file|-> --format json` action with `knowledge_map`. Supply its
102
+ current `expected_revision`, explicit `upsert` entries and `remove` keys. Each
103
+ entry retains its stable key, parent, title and order; optional targets use
104
+ article identity and section key. The current structure preview supplies those
105
+ identities. Read the persistent `src/knowledge-map.yaml`; use
106
+ `expected_revision: null` only when no knowledge map exists.
107
+ After adjustment, follow status to rebuild affected packages. This changes the
108
+ reading organization without capturing sources or rewriting approved prose.
109
+ Do not directly edit generated package navigation or use titles as identities.
110
+
111
+ Users can ask in conversation to move a topic, rename a directory, change order,
112
+ or organize the same articles for another reader task. Handle this during ongoing
113
+ production or after completion through the same adjustment; no active Indexer
114
+ task, source recapture or new mode choice is required. Finish or revoke active
115
+ worker assignments before changing the map. Preserve unrelated entries and page
116
+ identities. The map controls website navigation and LLMS organization together.
117
+
118
+ For each new or changed article, the Agent decides whether to retain its current
119
+ placement, add another placement, move it, or create a warranted category. Check
120
+ these choices against the user's settled organization before structure approval
121
+ and delivery. New articles must be bound even if the map revision has not changed;
122
+ modifying a title alone is not a reason to change article identity. Never satisfy
123
+ coverage by mechanically placing every new page under an unrelated catch-all.
124
+ Build reports missing bindings for the Agent to resolve; it does not classify
125
+ content. Moving a menu entry does not change the article URL.
126
+
127
+ ## Edit one section or review part of a batch
128
+
129
+ The current approved-revision Route accepts either full `markdown` or explicit
130
+ `sections` edits. Use an existing `writing_context.current_sections` ID and an
131
+ ordered `content` list of `{ "markdown": "new text" }` and/or
132
+ `{ "program": "exact current program token" }`. Unchanged sections and the
133
+ selected section's source references remain intact. Use full Markdown when
134
+ changing structure, adding a page or when a section has no unambiguous ID.
135
+
136
+ For an optional check, append `--preview` to the current `action complete-current`
137
+ command with the same revision and input file. It validates and returns the
138
+ assembled page and previous text without accepting the edit. Submit the same
139
+ input without that flag to continue. A preview is not approval and does not make
140
+ a stale revision valid.
141
+
142
+ Review can approve checked pages while leaving repair pages pending. The HTML
143
+ review code includes pending positions; managed Review provides the same current
144
+ scope as a JSON template. Send decisions only for pages actually reviewed. Omit
145
+ means a durable exclusion, not repair. Partial approval alone does not build.
146
+
147
+ When the user requests an earlier delivery, use the Route's `context run
148
+ --deliver` request. Independently approved pages can pass close/build while
149
+ pending candidates remain for Review or repair. Links to pending or missing
150
+ pages keep their necessary scope together. Source processing baselines advance
151
+ only after the entire update finishes. Failed builds retain the selected delivery
152
+ and pending work; repair the cause and follow the current Route.
153
+
154
+ ## Acquire the selected change once
155
+
156
+ Use the host's existing Git, code-hosting or document tools and their installed
157
+ guidance. Context does not poll a platform, discover remote changes, or infer
158
+ that a merge request is merged. Reading an already selected source does not
159
+ require a new permission question when access was already authorized. Do not
160
+ change the user's checkout or fetch another repository without that scope.
161
+
162
+ For a branch or MR/PR, establish the repository, intended target branch, merge
163
+ state and actual fixed target commit. An unmerged proposal is not the current
164
+ mainline. A merge, squash or rebase can produce different commit identities;
165
+ use the target branch's actual result, not the feature branch SHA. Include
166
+ other intervening changes between the last processed version and the selected
167
+ target when they affect the registered modules. Reverts are real changes.
168
+
169
+ Use already available local Git objects to compare the selected module trees
170
+ and necessary diffs. A new repository commit with unchanged module trees can
171
+ be a no-knowledge-change conclusion. That conclusion must also account for any
172
+ new note or development context. If a baseline is unavailable after force push,
173
+ a shallow checkout or history cleanup, state that a complete old diff is
174
+ unavailable; compare current material with approved knowledge in the confirmed
175
+ scope. Do not claim no change because a Git command failed. A repeated MR may
176
+ still bring new relevant context; it does not justify moving the code baseline
177
+ backwards or summarizing unrelated commits as part of that MR.
178
+
179
+ For documents, a revision shortcut is valid only if the host actually exposes a
180
+ reliable version for the selected document and its needed images/attachments.
181
+ Otherwise read that selected document and resources. Keep the returned bytes
182
+ for the existing capture/import action; do not fetch them again as verification.
183
+ An unchanged body does not prove images are unchanged. Distinguish lack of
184
+ permission, deleted content, and moved content; a read failure is not permission
185
+ to retire a knowledge page. CLI status describes local acquisition only.
186
+
187
+ After the current source configuration and material identify the chosen fixed
188
+ versions, submit the update with `context update --input <file|-> --format json`.
189
+ Write ordinary YAML or JSON with the host's editor, without a generated wrapper
190
+ program. Input files belong under this workspace's `.tmp/`.
191
+
192
+ ```yaml
193
+ scopes:
194
+ - requirement_ref: reader-guide
195
+ source_ref: repo:20260901/library
196
+ changes: The selected change adds one public option; inspect its explanation and examples.
197
+ ```
198
+
199
+ `requirement_ref` is the existing requirement id. Omit `module_refs` for a whole
200
+ confirmed source scope. `processed_version` may be supplied to bind the exact
201
+ acquired commit or document content digest; otherwise Context captures it from
202
+ the existing local material. A supplied version must match that material.
203
+ Follow the returned Route. The candidate list is a conservative source match,
204
+ not a list of pages that must change. Read the actual change and current pages,
205
+ also checking additions that have no old page reference. The scope is complete
206
+ only after every required change is reviewed, closed and built, or after an
207
+ explicit conclusion that it needs no knowledge changes.
208
+
209
+ Before importing a `note`, read [note source preparation](note.md).
210
+ Before importing `sessions`, read [development summary preparation](sessions.md).
211
+ Choose the reference for the actual input; do not read both by default.
212
+
213
+ ## Save text without an external file
214
+
215
+ Use `context source import --input <file|-> --format json`:
216
+
217
+ ```yaml
218
+ type: note
219
+ name: 20260907/decision-context.md
220
+ markdown: |
221
+ # Decision context
222
+
223
+ The selected discussion confirmed this exception for the stated situation.
224
+ The implementation has not yet changed. Source: the discussion supplied here.
225
+ ```
226
+
227
+ The body is saved directly under `sources/note/` or `sources/sessions/`; no
228
+ external `local`, capture, registry or second copy is required. Use a readable
229
+ semantic filename under an eight-digit date directory. Do not put a date, hash
230
+ or session id into the filename again. Keep the path for retries and later
231
+ edits. To revise an existing source, read it and pass its current `base_digest`
232
+ with the replacement Markdown. Distinct same-day material needs a distinct
233
+ semantic name, never a silent overwrite. `source list`, `source get` and
234
+ `source inspect` expose the actual source paths. Removal uses the existing
235
+ preview and exact plan digest, and refuses still-referenced text.
236
+
237
+ Saving alone does not start indexing. If the user only wants the source saved,
238
+ report its path and stop. For production, reuse the existing requirement:
239
+ put independent content in `target_scope`; put supporting material in
240
+ `evidence_source_scope` and ensure the selected Indexer's existing `read_scope`
241
+ covers it. Do not create a separate Markdown production target for a supporting
242
+ explanation of a code page. In the source-update decision, include its exact
243
+ `supporting_sources` on the affected page. Include that source's scope in this
244
+ update so completion can distinguish code from newly processed context.
245
+
246
+ ## Development context accompanying a commit
247
+
248
+ Use `trace-session` only as this conditional source-preparation step. If the MR,
249
+ code and existing design already explain the relevant information, cite them.
250
+ Write a `sessions` source only when real, explicitly available development
251
+ context contains useful decisions, reasons or limits missing from those sources.
252
+ Do not fabricate discussion from a diff, search host session storage, ask for
253
+ nonessential history, or create an empty/skip report. This is only the code-related subcase. An authorized conversation summary
254
+ without an MR or commit is also `sessions`; see the sessions source guide.
255
+ Optional `changes` belongs in the source frontmatter, not knowledge headers.
256
+
257
+ Use the available merge date, or commit date for a pure commit, for the initial
258
+ directory; if unavailable or saving an unmerged discussion explicitly, use the
259
+ current collection date and explain the context. Do not query a platform just
260
+ for this date. Keep the path when later adding a reference or retrying another
261
+ day. One coherent change can share one summary; separate unrelated changes.
262
+
263
+ The shortest useful body is the real repository/MR/commit reference plus one
264
+ paragraph explaining what the code does not tell a later reader. Describe only
265
+ the actually associated commit subset. Omit a full change recap, transcript,
266
+ test log, session id and formal approval claim. Write confirmed decisions as
267
+ such, alternatives as alternatives, and unresolved proposals as unresolved.
268
+ Do not claim execution or tests that were not observed. The writing aid below
269
+ is optional; no section is mandatory:
270
+
271
+ ```markdown
272
+ # <Change topic>
273
+
274
+ <Reference the actual repository and MR or concrete commits already available.>
275
+
276
+ <Explain the useful decision, reason or constraint absent from the code/design.
277
+ State its applicability and distinguish implemented behavior from a proposal.>
278
+ ```
279
+
280
+ Late context can update a page even when the code version is already processed.
281
+ Reuse that fixed code version and current approved prose; do not restart Parser
282
+ merely because a summary arrived. Import once, then include the necessary
283
+ context with the same knowledge update. Saved context survives a failed build;
284
+ saving it does not mean its knowledge impact has been delivered.
285
+
286
+ ## Optional correction of an upstream document
287
+
288
+ Local knowledge approval and fully managed execution do not authorize a remote
289
+ write. First determine whether the knowledge misunderstood correct source text,
290
+ a confirmed decision has not reached the source, or the conclusion is still
291
+ uncertain. The first needs only a local correction; the second can use a note
292
+ locally while an upstream change is considered; uncertainty is not a fact.
293
+
294
+ Present the exact document, affected passage, proposed before/after text, reason
295
+ and affected knowledge. Reuse existing authorization for that concrete edit;
296
+ otherwise ask for it. Before writing, read the affected passage again using the
297
+ host document tool. Adapt only within the authorized scope if another person
298
+ has edited it; ask again only when the requested change materially differs.
299
+
300
+ Execute with the host tool and read back the result. If the write result is
301
+ uncertain, read back before retrying an insertion. Only the actual returned
302
+ source text and resources may refresh its snapshot. Feed them into the same
303
+ local capture/update route; a note or proposed patch is not a remote snapshot.
304
+ If the remote edit succeeded but local build failed, resume local delivery;
305
+ do not repeat the remote edit. Explain remote and local outcomes separately.
306
+ Do not automatically delete an absorbed note, post comments, notify groups or
307
+ change permissions. Permission failure can leave a concrete suggestion for
308
+ the user without blocking an independently supported local correction.
309
+
310
+ ## Import a document response already read by the host
311
+
312
+ For a registered Lark source, retain the actual full JSON response from
313
+ `lark-cli docs +fetch` and each returned continuation page. Do not reconstruct a
314
+ response from a summary. Use the same source import command:
315
+
316
+ ```yaml
317
+ type: lark
318
+ name: 20260907/guide
319
+ access_identity: user
320
+ response_files: [.tmp/guide-response.json]
321
+ media_files:
322
+ actual-image-token: .tmp/downloaded-image.png
323
+ ```
324
+
325
+ Only include real media tokens and downloaded files. Context runs the ordinary
326
+ capture normalization and resource checks on these bytes. It does not fetch the
327
+ provided document again; missing required resources follow existing capture
328
+ handling. Partial outline/section fragments cannot replace a full snapshot.
329
+ Use the identity that actually produced the response, not a credential fallback
330
+ chosen to bypass permissions. Subsequent local updates use the captured version
331
+ and the same Review/build route.
332
+
333
+ ## Adjust or roll back current work
334
+
335
+ For an explicit same-task change to native Indexer source inputs, use
336
+ `context task adjust --input <file|-> --format json` with `scopes` containing the
337
+ selected `source_ref` and optional `module_refs`, plus an `instruction` explaining
338
+ the adjustment. It invalidates those old worksets and retains independent work.
339
+ Import the fixed replacement material before following the refreshed Route.
340
+ Do not execute the old batch payload. A local page correction still uses
341
+ `revise`; it is not a reason to invalidate an entire source.
342
+
343
+ For an independent task, complete the old Route unless the user chooses a
344
+ concrete rollback. Without an identifiable baseline or attribution of changes,
345
+ ask about that gap or offer completion; never guess original bytes. Prepare
346
+ `context task rollback --input <file|-> --format json` using:
347
+
348
+ ```yaml
349
+ summary: Restore the selected page and discard unfinished follow-up drafts; keep other work.
350
+ discard_unfinished: true
351
+ files:
352
+ - path: knowledge/guides/selected-page.md
353
+ base_digest: sha256:<current-file-digest>
354
+ content: |
355
+ <exact recoverable original Markdown, not a newly generated replacement>
356
+ ```
357
+
358
+ `files` contains only the explicitly selected reversions. `content: null` removes
359
+ an explicitly selected file that this task added; `base_digest: null` is for
360
+ restoring an absent file. Include changed sources/configuration/processed scopes
361
+ when they belong to the rollback. Leave unrelated and pre-existing edits alone.
362
+ An empty list only discards unfinished work and must not be described as undoing
363
+ already delivered pages. The preview shows actual before/after contents and
364
+ draft loss. Once the user approves that exact scope, run the preview's apply
365
+ command with its plan digest. Then follow the rollback Route through close,
366
+ build and cleanup. A failed build retries delivery, not the already-applied
367
+ reversions. Begin the independent task only after cleanup succeeds.
368
+
369
+ A managed source can be explicitly renamed with `context source rename
370
+ "<note:... or sessions:...>" --name "YYYYMMDD/new-name.md" --format json` after
371
+ its active work is finished. Review the file/reference changes, then apply the
372
+ returned digest-bound command. Existing references move with it; the original
373
+ body is not copied into another source type. Follow status to refresh affected
374
+ knowledge structure and packages.
375
+
376
+ To move an approved page, use `context revise "<old path>" --move-to "<new path>"
377
+ --instruction "<requested move and content changes>" --format json`. The new
378
+ path stays in the same collection. The revision retains the page identity,
379
+ rebases outgoing links and updates incoming Markdown links at approval. A new
380
+ subject name alone only needs a title/content revision; do not create duplicate
381
+ pages. Retirement is a content decision: explain the inapplicable material and
382
+ supported replacement before changing its page and referring navigation.
383
+
384
+ ### Adjust inputs while a local update is unfinished
385
+
386
+ `context task adjust --input <file> --format json` also applies to an active
387
+ approved-page revision or source-update queue. Keep `scopes` and `instruction`
388
+ explicit. First call without `refresh`; it authorizes replacing only those
389
+ inputs and blocks page completion while acquisition is pending. Import the
390
+ selected new material, then repeat with `refresh: true` to bind the actual local
391
+ versions and obtain the new Route. Do not submit the old revision. Current
392
+ prose and queued pages remain; an affected draft returns to writing/review.
393
+ An unrelated queued page does not revoke an unchanged current page's review.
394
+ If a page has already been applied, finish its close/build before changing its
395
+ inputs. Only the final completed scope advances its processed baseline.
396
+
397
+ For several documents, `source import` also accepts a JSON/YAML array of the same
398
+ single-document inputs. Its receipt reports each zero-based input index and
399
+ success or error separately; a partial batch returns a nonzero exit code.
400
+ Keep successful sources and retry only failed entries. It does not fetch a
401
+ successful prefetched document again or roll back an unrelated saved note.
402
+
403
+ To add a new supporting source to an unfinished local revision, first save it
404
+ and include it in the current requirement's evidence scope and the selected
405
+ Indexer's read scope. Its `task adjust` scope also supplies the explicit
406
+ `requirement_ref`. This extends the current page's available sources and keeps
407
+ queued pages; it does not silently start another task or another Indexer.
408
+
409
+ ### Replacing supporting article identities
410
+
411
+ When an upstream article is split, merged or removed, start `context revise` for
412
+ its consumer and use `context task adjust --input - --format json` with
413
+ `instruction` and `knowledge_dependencies: { dependencies }`. Each dependency
414
+ uses an approved `artifact_ref`, optional `section_refs`, and `required` flag.
415
+ The current Author input returns authorized replacement facts and their evidence.
416
+ Repeat the adjustment with `knowledge_dependencies.sections`, selecting each
417
+ retained `section_key` and its full `fact_refs` and `evidence_refs` support. Then
418
+ revise the explanation and complete normal Review, close and build. An explicit
419
+ empty dependency list removes the relationship only when remaining sections have
420
+ valid direct support. Missing dependencies, changed approvals and invalid source
421
+ references cannot silently become current evidence. Writing quality remains an
422
+ 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
 
@@ -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.