@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,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
 
@@ -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.
@@ -0,0 +1,50 @@
1
+ # Prepare a conversation-summary source
2
+
3
+ Use sessions for a bounded summary formed from an authorized conversation:
4
+ requirements, design, troubleshooting, operational or general knowledge.
5
+ Code association is optional. An Agent or external supplier prepares the summary
6
+ before import. Do not scan host history, ingest the full transcript, invent a
7
+ conversation from a diff, or move an unrelated conversation into note merely
8
+ because it lacks a commit.
9
+
10
+ Keep the problem, confirmed decisions, useful reasons, constraints and open
11
+ questions. Remove repetitive turns, tool logs and abandoned attempts unless they
12
+ explain a current limit. Preserve whether each statement was proposed, agreed,
13
+ implemented or verified. If only a supplied summary is available, say so; do not
14
+ claim to have read the original. Do not make up speakers, dates or approval.
15
+ A session with no reusable information can remain outside the workspace.
16
+
17
+ Save through `context source import --input <file> --format json`, using
18
+ `type: sessions`, `name: YYYYMMDD/topic.md` and the prepared `markdown` string.
19
+ Choose the actual conversation date, or collection date if unknown, and retain
20
+ the same path for corrections. The summary needs no mandatory body headings.
21
+
22
+ Optional `changes` associates one or several code changes. Each row accepts
23
+ `commit` (full 40/64 hexadecimal Git SHA), `mr` (HTTP(S) MR/PR URL), and optional
24
+ `repository`. At least commit or mr is needed per row; omit the entire field
25
+ for unrelated sessions. Use actual known identifiers, never fabricated hashes.
26
+ A reference does not prove merge, deployment, tests or authorize fetching code.
27
+ The CLI stores this field in the source's YAML frontmatter, discovers it from
28
+ that same file, and does not introduce a sidecar or separate registry.
29
+
30
+ For example, an import may have `changes: [{mr: "https://git.example.org/team/project/merge_requests/42"}]`.
31
+ This is an illustrative URL, not a lookup target. The same payload without
32
+ changes imports an independent requirements discussion normally. Use the current
33
+ base_digest to change text or associations; explicit `changes: []` clears the
34
+ associations. Omission leaves the source's inline changes intact. When replacing
35
+ only the summary body, preserve existing associations unless explicitly removed.
36
+ Do not duplicate commit/MR fields into knowledge frontmatter.
37
+
38
+ Saving alone does not start indexing. Select a compatible Sessions Provider for
39
+ an independent reader topic, or keep an existing page's Code/Markdown primary
40
+ and include the summary in its authorized evidence/read scope. If specialized
41
+ interpretation is needed, explicitly select an extension from the Sessions or
42
+ business Provider. Knowledge turns useful conclusions into answers, explanations
43
+ and procedures, not a meeting recap. Existing structure.yaml source references
44
+ connect each relevant page/section to the saved summary and its optional changes.
45
+
46
+ Correct a faulty summary through source import with current base_digest and task
47
+ adjustment for pinned inputs. If the summary is accurate but the page is wrong,
48
+ revise the approved page. A new topic goes through structure review then normal
49
+ Author/Review. Neither knowledge approval nor source storage approves an upstream
50
+ change. A failed update retains source and approved knowledge for recovery.
@@ -0,0 +1,45 @@
1
+ # Commit workspace results
2
+
3
+ Use Host Git tools, not an invented Context commit command. Commit only when
4
+ the user requests it; fully managed production does not itself authorize Git
5
+ commits or pushes. At the end of the entire requested production scope, after
6
+ close and all requested builds with no pending tasks, a single optional commit
7
+ suggestion is enough. Intermediate delivery is not that endpoint.
8
+
9
+ ## Select the files
10
+
11
+ Locate the Context workspace and its actual Git root. Inspect status, staged
12
+ changes, unstaged changes, untracked files and ignore rules. In an embedded
13
+ workspace the Git root may be a much larger source repository. Explicitly select
14
+ workspace files; never run blanket `git add -A` or commit the entire staged index.
15
+ Check source records for required recovery information; a commit does not bundle
16
+ ignored checkouts or runtime progress. Do not force-add ignored files or assume
17
+ `dist` belongs in Git. Generated files are included only if the project's rules
18
+ and selected scope require them.
19
+
20
+ If there is no Git repository, establish the intended repository location before
21
+ initializing one. If nothing changed, report that no commit is necessary. If the
22
+ user asks for an intermediate snapshot, explain which saved files it contains
23
+ and that it cannot resume ignored Author state from Git alone.
24
+
25
+ ## Commit the selected change
26
+
27
+ Summarize the actual change and choose a message consistent with repository rules.
28
+ Use precise paths and Git's scoped commit facilities or a carefully isolated
29
+ index. `git commit --only -- <paths>` can exclude unrelated staged files; new files
30
+ must first be known to the index. Inspect overlapping partially staged files
31
+ before selecting this approach: do not silently include changes the user did
32
+ not select. Preserve unrelated staged entries, including staged deletions.
33
+
34
+ Git identity, hooks, signing, conflicts and permissions are environmental
35
+ issues for the Agent to diagnose. Do not disable hooks or signing, rewrite global
36
+ Git configuration, stash other work or bypass ignore rules to force success.
37
+ Use an available authorized alternative or report the specific blocker.
38
+
39
+ ## Verify the result
40
+
41
+ Read the actual commit SHA and its changed files/diff; compare against the
42
+ selected scope. Verify unrelated worktree and index content remain unchanged.
43
+ If a hook changed the result, inspect and report it before claiming completion.
44
+ Report the SHA and a brief description. Do not push, publish or create a remote
45
+ repository without the corresponding explicit request.