@c4a/context-cli 0.7.10-alpha.2 → 0.7.11

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 (68) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +3 -3
  3. package/cli.js +2034 -925
  4. package/indexers/bundles/context-code-indexer/references/indexer.md +25 -1
  5. package/indexers/bundles/context-code-indexer/templates/adapter-integration.md +1 -1
  6. package/indexers/bundles/context-code-indexer/templates/api-service.md +1 -1
  7. package/indexers/bundles/context-code-indexer/templates/background-runtime.md +1 -1
  8. package/indexers/bundles/context-code-indexer/templates/cli-tool.md +1 -1
  9. package/indexers/bundles/context-code-indexer/templates/component-library.md +4 -4
  10. package/indexers/bundles/context-code-indexer/templates/contract-source.md +1 -1
  11. package/indexers/bundles/context-code-indexer/templates/data-sync-reconciliation.md +6 -8
  12. package/indexers/bundles/context-code-indexer/templates/domain-service.md +1 -1
  13. package/indexers/bundles/context-code-indexer/templates/monorepo-container.md +1 -1
  14. package/indexers/bundles/context-code-indexer/templates/sdk-library.md +1 -2
  15. package/indexers/bundles/context-code-indexer/templates/web-application.md +1 -1
  16. package/indexers/bundles/context-markdown-indexer/references/indexer.md +7 -2
  17. package/indexers/bundles/context-markdown-indexer/references/semantic-planning.md +9 -6
  18. package/indexers/contracts/profile-contract.json +245 -245
  19. package/indexers/release-manifest.json +17 -17
  20. package/package.json +12 -12
  21. package/parserEntryWorker.js +43 -10
  22. package/plugins/README.md +1 -1
  23. package/plugins/README_CN.md +1 -1
  24. package/plugins/VERSION +1 -1
  25. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  26. package/plugins/claude/commands/context.md +37 -73
  27. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  28. package/plugins/codex/skills/context/SKILL.md +37 -73
  29. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  30. package/plugins/cursor/commands/c4a-context.md +37 -73
  31. package/plugins/skills/context/SKILL.md +37 -73
  32. package/plugins/skills/context-code-indexer/references/indexer.md +25 -1
  33. package/plugins/skills/context-code-indexer/templates/adapter-integration.md +1 -1
  34. package/plugins/skills/context-code-indexer/templates/api-service.md +1 -1
  35. package/plugins/skills/context-code-indexer/templates/background-runtime.md +1 -1
  36. package/plugins/skills/context-code-indexer/templates/cli-tool.md +1 -1
  37. package/plugins/skills/context-code-indexer/templates/component-library.md +4 -4
  38. package/plugins/skills/context-code-indexer/templates/contract-source.md +1 -1
  39. package/plugins/skills/context-code-indexer/templates/data-sync-reconciliation.md +6 -8
  40. package/plugins/skills/context-code-indexer/templates/domain-service.md +1 -1
  41. package/plugins/skills/context-code-indexer/templates/monorepo-container.md +1 -1
  42. package/plugins/skills/context-code-indexer/templates/sdk-library.md +1 -2
  43. package/plugins/skills/context-code-indexer/templates/web-application.md +1 -1
  44. package/plugins/skills/context-markdown-indexer/references/indexer.md +7 -2
  45. package/plugins/skills/context-markdown-indexer/references/semantic-planning.md +9 -6
  46. package/providers/context/graphs/workspace.yaml +1 -22
  47. package/providers/context/manifest.json +34 -70
  48. package/providers/context/provider.yaml +1 -1
  49. package/providers/context/resources/manuals/guides/indexer-provider-and-customization.md +0 -2
  50. package/providers/context/resources/manuals/guides/knowledge-updates.md +108 -5
  51. package/providers/context/resources/manuals/guides/package-outputs.md +39 -1
  52. package/providers/context/resources/manuals/guides/workspace-prepare.md +17 -0
  53. package/providers/context/resources/manuals/reference/project-api.md +58 -19
  54. package/providers/context/resources/procedures/close-and-build.md +21 -0
  55. package/providers/context/resources/procedures/knowledge-review.md +18 -2
  56. package/providers/context/resources/procedures/knowledge-updates.md +108 -5
  57. package/providers/context/resources/procedures/package-output.md +18 -0
  58. package/providers/context/resources/procedures/production-stage-files.md +35 -0
  59. package/providers/context/resources/procedures/repository-source-recovery.md +5 -3
  60. package/providers/context/resources/procedures/source-capture-detailed.md +16 -2
  61. package/providers/context/resources/procedures/task-recovery.md +6 -0
  62. package/providers/context/resources/procedures/work-start-report.md +24 -11
  63. package/providers/context/resources/procedures/workspace-prepare.md +17 -0
  64. package/providers/context/resources/templates/work-start-report.md +11 -6
  65. package/providers/context/actions/inspect-repository-recovery.yaml +0 -6
  66. package/providers/context/actions/restore-repository-sources.yaml +0 -7
  67. package/providers/context/resources/dialogue/repository-source-recovery.md +0 -23
  68. package/providers/context/schemas/repository-source-recovery.schema.json +0 -40
@@ -22,6 +22,49 @@ and continues through Review and delivery. Expression-only changes need no
22
22
  source capture or Parser. Preserve prior confirmed contributions; distinguish
23
23
  actual behavior, a confirmed decision, and a proposal that is not implemented.
24
24
 
25
+ ## Keep planning local to the change
26
+
27
+ Before starting production, compare the proposed content with the workspace's
28
+ reader purpose. For clearly unrelated anecdotes or personal rankings, briefly
29
+ recommend leaving them out of the formal manual or saving them separately because
30
+ they can dilute useful retrieval. Attribution alone does not make content relevant.
31
+ This is advice, not a CLI gate: honor the user's informed choice without repeated
32
+ objections, while preserving subjective attribution and normal Review.
33
+
34
+ Registered repositories are not prerequisites for every new request. Restore only
35
+ sources needed to investigate or write the current task, including unchanged code
36
+ when its implementation needs checking. Notes, document-only work, wording edits
37
+ and navigation changes do not require unrelated checkouts. Retained article
38
+ references alone do not require restoring every referenced repository. Missing
39
+ material remains a gap; it must not be treated as investigated or permanently
40
+ excluded. Independent available material can proceed through planning and delivery.
41
+ For required code, use `context source recovery-plan <registered-name> --format json`.
42
+ Reuse a valid local checkout or obtain clone authorization for the returned pinned
43
+ version, then submit the decision using the returned recovery command and schema.
44
+ Do not restore all registered sources merely because a checkout is missing.
45
+
46
+ For one or two documents or a clearly bounded module, retain the useful planning
47
+ decision: add or revise which articles, and place them where readers expect them.
48
+ Do not expand this into a whole-workspace taxonomy, full navigation redesign or
49
+ multi-wave plan. Read related existing topics first and expand only as needed.
50
+ One module can contain several topics; scope and ambiguity, not source count,
51
+ determine how much investigation is useful.
52
+
53
+ Reuse an approved stage's plan for in-scope additions through its existing amendment
54
+ route. Keep completed work and unrelated pending investigation intact. If article
55
+ targets are already decided before approval, the preparation route supports a
56
+ known-task input to combine preparation and task creation. It still prepares
57
+ navigation and retains report confirmation; it is not a bypass for new source
58
+ authorization. Planning depth is an Agent judgment, not an additional CLI gate.
59
+
60
+ For broad work, distinguish the whole requested outcome, the current batch and
61
+ remaining capability families or document tasks. Entry-first knowledge should
62
+ locate a checked file/symbol or source section and a concrete next step; a module
63
+ name alone is not problem coverage. When merging or revising, preserve useful
64
+ existing detail rather than replacing it with lookup advice. Review checks the
65
+ promised reader task; task completion and navigation binding only describe the
66
+ declared articles, not semantic coverage of all source material.
67
+
25
68
  ## First-task intake budget
26
69
 
27
70
  Before registration and capture, the Agent uses the user's task instructions and
@@ -62,7 +105,14 @@ progress under `.tmp/` never causes a version increase.
62
105
  Version recording runs at completed-scope delivery after Review, Close and package
63
106
  configuration/template approval, before the final build. The record response
64
107
  returns the next workspace Route, so no extra status call is needed. Build retries
65
- reuse the recorded version when formal content is unchanged. Intermediate batches
108
+ reuse the recorded version when formal content is unchanged. If build preparation
109
+ or rendering fails and formal corrections are needed, `version inspect` returns
110
+ `reusable_version` for the current entry only while it has no successful build or
111
+ publication receipt. Submit that same version with the complete iteration's title,
112
+ changes and triggers, including the repair; this replaces the pending changelog
113
+ entry rather than appending another version. Do not submit only the repair and
114
+ lose the original delivery description. Once built or published, the version is
115
+ sealed and further formal changes require an increase. Intermediate batches
66
116
  do not each receive a version.
67
117
 
68
118
  The workspace AGENTS.md and version-writing instructions require each entry's
@@ -91,7 +141,10 @@ actor:
91
141
  ```
92
142
 
93
143
  `actor` is optional; omit it to use local Git `user.name` when configured. Use a
94
- Lark display name only when explicitly known from the conversation. Trigger kinds
144
+ Lark display name only when explicitly known from the conversation. Amending an
145
+ unbuilt entry preserves its actor unless a replacement is explicitly supplied.
146
+ If neither the conversation nor Git identifies the user, omit the actor and
147
+ mention the missing identity in the delivery summary; never guess it. Trigger kinds
95
148
  are `initial`, `note`, `sessions`, `mr`, `module`, `document`, `navigation`,
96
149
  `repair`, `dist`, and `other`. Agent-written fields describe the actual diff and
97
150
  conversation; they must not expose credentials, raw transcripts or private IDs.
@@ -402,11 +455,61 @@ knowledge structure and packages.
402
455
 
403
456
  To move an approved page, use `context revise "<old path>" --move-to "<new path>"
404
457
  --instruction "<requested move and content changes>" --format json`. The new
405
- path stays in the same collection. The revision retains the page identity,
458
+ path may use another supported knowledge collection. The revision retains the page identity,
406
459
  rebases outgoing links and updates incoming Markdown links at approval. A new
407
460
  subject name alone only needs a title/content revision; do not create duplicate
408
- pages. Retirement is a content decision: explain the inapplicable material and
409
- supported replacement before changing its page and referring navigation.
461
+ pages. Changing a website group alone does not require moving or reclassifying an article.
462
+
463
+ ### Restructure existing knowledge
464
+
465
+ Read the affected approved articles and current sources before deciding what to
466
+ keep, deepen, split, merge, retain as history or retire. Reuse the current plan
467
+ and remaining scope; a new article plan does not prove old content was preserved.
468
+ Work by reader task, not source or menu count.
469
+
470
+ For a split or merge, first approve destination content, then revise the original
471
+ and incoming links. Preserve useful details until their destination is available.
472
+ Same-page fragments use ordinary revision edits; cross-page work uses new/revision
473
+ tasks and explicit retirement. Finish each coherent batch's content and navigation
474
+ before delivery; inspect both new content and the old articles' disposition.
475
+
476
+ Preview approved-page retirement with `context task retire --input <file> --format json`:
477
+
478
+ ```yaml
479
+ reason: These reader tasks are now covered by the approved guide.
480
+ targets:
481
+ - path: architecture/old-guide.md
482
+ replacement: sop/current-guide.md
483
+ ```
484
+
485
+ `replacement` is optional and must already be approved, outside the retirement set.
486
+ Use several targets for a batch. Read affected files and blockers, then execute
487
+ the returned digest-bound apply command within the user's authorization; do not
488
+ ask for another confirmation when that retirement is already authorized.
489
+ `context task retire --schema --format yaml` describes the input.
490
+
491
+ Retirement removes selected Markdown and structure entries together, updates
492
+ page-level incoming Markdown links to explicit replacements, and rebinds page
493
+ navigation or removes retired navigation targets while retaining groups.
494
+ Repair fragment links explicitly first: the CLI cannot infer where a split moved
495
+ a paragraph. Without a replacement, repair incoming links before applying.
496
+ Finish active drafts/revisions first; unfinished production targeting a selected
497
+ page must be finished or amended rather than discarded.
498
+
499
+ Follow status and the normal close/version/build flow before delivery. Sources
500
+ and shared assets are not deleted. The response provides a temporary restore
501
+ input for the existing rollback preview, including exact previous article,
502
+ structure and modified navigation/link bytes. Retain that input or a Git baseline
503
+ if restoration is needed after temporary cleanup. Retry an interrupted apply
504
+ with the same input and digest; never delete runtime files to recover. Later
505
+ conflicting edits require inspection instead of blind rollback.
506
+
507
+ Historical pages with continuing reader value should normally retain their
508
+ applicable version. Source read failure, shorter new text or a changed menu is
509
+ not sufficient reason to retire an article.
510
+ Retirement does not narrow the registered production scope. If the user also
511
+ excludes the underlying topic from future work, record that through the existing
512
+ requirements/exclusion flow rather than assuming file removal changes the goal.
410
513
 
411
514
  ### Adjust inputs while a local update is unfinished
412
515
 
@@ -46,13 +46,51 @@ prefixes only, not filesystem output paths.
46
46
  kbPackage({
47
47
  name: "project-kb",
48
48
  template: "src/package-templates/kb",
49
- site: { title: "Project knowledge", lang: "en-US", base: "/" },
49
+ site: {
50
+ title: "Project knowledge",
51
+ lang: "en-US",
52
+ base: "/",
53
+ home: {
54
+ title: "Project knowledge",
55
+ slogan: "Find the context behind the work",
56
+ description: "Browse the approved knowledge map and supporting resources.",
57
+ resources: [{
58
+ title: "Project workspace",
59
+ description: "Open the repository that maintains this knowledge.",
60
+ href: "https://example.com/project",
61
+ featured: true,
62
+ }],
63
+ },
64
+ },
50
65
  });
51
66
  ```
52
67
 
53
68
  `site` is opt-in; omission keeps the existing KB-only output. Optional fields
54
69
  are `title` (defaults to the package name), `description`, `lang` (defaults to
55
70
  `en-US`), and `base` (defaults to `/`; use `/docs/` when hosted under that path).
71
+ `home` optionally customizes the landing-page `title`, `slogan`, `description`
72
+ and action buttons. Its `resources` list adds only configured repository,
73
+ service or support cards; each item requires a safe `href`, a copyable
74
+ `command`, or both. Set `featured: true` on a linked resource to also place it
75
+ between the Browse knowledge and LLM Docs hero actions. Do not add placeholders
76
+ for unknown destinations.
77
+
78
+ Configure resources from confirmed project settings, repository remotes or
79
+ successful publication receipts. If a service has not been created or its URL is
80
+ unknown, omit the resource object; empty strings are not placeholders. Missing
81
+ optional resources do not block building the site or authorize creating services.
82
+ After an authorized deployment succeeds, add its returned destination to the
83
+ existing resource list, avoiding duplicates. Rebuild when this changes the
84
+ configuration; updating the hosted site still requires publication authorization.
85
+
86
+ The homepage uses the first-level knowledge map as a complete site map. Each
87
+ section card previews a bounded number of page links and retains a link to the
88
+ full section, so large knowledge bases remain scannable without hiding top-level
89
+ coverage. LLM Docs and Changelog remain dedicated generated resources. On wide
90
+ screens the homepage content aligns with article content while preserving the
91
+ sidebar rail; on narrow screens it uses the available width. Motion is limited
92
+ to short card entrance and hover feedback and is disabled when the reader asks
93
+ the operating system to reduce motion.
56
94
  The website uses a full-width VitePress theme with system fonts, compact navigation,
57
95
  a wide reading area and a smaller article outline. It starts in
58
96
  light mode regardless of the operating system; an explicit reader choice is
@@ -42,6 +42,23 @@ reports, unique material, unknown files and modified checkouts unless their
42
42
  specific loss is authorized. Do not delete locks, transaction records or active
43
43
  tool directories. Empty task directories can remain.
44
44
 
45
+ Prefer cleanup after successful delivery, not immediately after close: version
46
+ recording, build and retries may still need the current task. Completed production
47
+ drafts and Review state are removed by delivery cleanup. Do not invoke
48
+ `task resume` merely to make a completed workspace advance; it starts a new task
49
+ and requires an actual new user request.
50
+
51
+ Keep repository checkouts referenced by registered sources, including fixed
52
+ commits: removing them can force a costly clone before the next update. Keep
53
+ pending telemetry and source-region baselines; losing the latter reduces the
54
+ ability to distinguish relocated text from changed text. Debug and historical
55
+ views may be archived or removed after diagnosis when no operation is active,
56
+ but unknown Agent files are not automatically disposable.
57
+
58
+ After all scratch state is lost, an existing build receipt defaults the workspace
59
+ to waiting for an explicit new task. This does not restore lost drafts or prove
60
+ sources and outputs are current. Use the recovery checks below before resuming.
61
+
45
62
  ## Restore usable sources
46
63
 
47
64
  For repositories, run `context source recovery-plan --format json` and read
@@ -10,8 +10,8 @@ The project has two durable declarations with separate responsibilities:
10
10
 
11
11
  - `src/index.ts`: source references, document capture, custom non-knowledge
12
12
  orchestration, and package outputs.
13
- - `src/indexers.yaml`: knowledge requirements, Provider selection, target/read
14
- scopes, profiles, and Provider customization.
13
+ - `src/indexers.yaml`: long-term reader requirements, authorized target/supporting
14
+ sources and confirmed exclusions. Skill choices belong to the temporary plan.
15
15
 
16
16
  Do not describe the same knowledge transformation in both files.
17
17
 
@@ -59,6 +59,19 @@ and [knowledge updates](../guides/knowledge-updates.md).
59
59
 
60
60
  ## Capture phases
61
61
 
62
+ For ordinary acquisition, add `--configure` to `context source add repo`, `file`,
63
+ `lark` or `batch`. The command registers the selected inputs and generates explicit
64
+ source references and default document capture phases in `src/index.ts`. It does
65
+ not fetch content, select other registrations or change package outputs.
66
+
67
+ Generation supports a literal `defineProject` with literal source/phase arrays
68
+ and recognizable SDK calls. Existing capture settings are preserved, repeated
69
+ registration is idempotent, and custom/dynamic entries remain untouched with a
70
+ `configuration.status: manual` hint. Registration is still saved; edit only the
71
+ needed declarations through the normal configuration path. For special processors
72
+ or resource options, configure them before following the capture Route. Omitting
73
+ `--configure` keeps registration-only behavior.
74
+
62
75
  ```ts
63
76
  captureFile({ source: docs });
64
77
  captureFile({ source: docs, processor: mdxJsonDocs() });
@@ -73,24 +86,27 @@ creating a second capture or knowledge pipeline.
73
86
 
74
87
  ### Batch capture from the source registry
75
88
 
76
- When all registered Lark documents are intended for this project and share capture
77
- settings, read the registry once instead of copying its module names into
78
- `src/index.ts`. For the standard `src/index.ts` entry:
89
+ For documents with shared capture settings, prefer registry-driven configuration
90
+ over repeating source declarations and capture calls, even for two documents.
91
+ Select the task's intended registrations first. The example below assumes all
92
+ registered Lark documents are in scope, with the standard `src/index.ts` entry:
79
93
 
80
94
  ```ts
81
95
  import { fileURLToPath } from "node:url";
82
96
  import {
83
- allSources, captureLark, defineProject, loadSourcesRegistry, source,
97
+ captureLark, defineProject, loadSourcesRegistry, source,
84
98
  } from "@c4a/context";
85
99
 
86
100
  const workspaceRoot = fileURLToPath(new URL("../", import.meta.url));
87
101
  const registry = await loadSourcesRegistry({ rootDir: workspaceRoot });
102
+ // For a subset, filter registry.larks by the authorized namespace/names here.
88
103
  const documents = registry.larks.map(entry =>
89
104
  source(entry.name, { type: "lark" }),
90
105
  );
91
106
 
92
107
  export default defineProject({
93
- sources: [...allSources("repo"), ...documents],
108
+ sources: documents,
109
+ // Shared settings, independent source identities and capture phases.
94
110
  phases: documents.map(document => captureLark({ source: document })),
95
111
  packages: [],
96
112
  });
@@ -115,6 +131,10 @@ Registry loading only reads local registrations; it does not fetch documents.
115
131
  - The map declares one phase per document. It does not fetch URLs, change capture
116
132
  permissions, or request parallel execution. Run the declared phases through the
117
133
  existing CLI flow so each document retains independent refresh and retry behavior.
134
+ This reduces configuration repetition, not the number of capture operations.
135
+ - Capture boundaries do not dictate article boundaries. During planning and
136
+ writing, combine related captured documents around reader tasks when useful;
137
+ do not create one article or a complete production cycle per source by default.
118
138
 
119
139
  ## `customPhase`
120
140
 
@@ -134,7 +154,22 @@ kbPackage({
134
154
  name: "component-kb",
135
155
  template: "src/package-templates/kb",
136
156
  select: { collections: ["codeindex", "architecture"] },
137
- site: { title: "Component knowledge", lang: "en-US", base: "/" },
157
+ site: {
158
+ title: "Component knowledge",
159
+ lang: "en-US",
160
+ base: "/",
161
+ home: {
162
+ title: "Component knowledge",
163
+ slogan: "Build with the public contract in view",
164
+ description: "Browse components, usage guidance and implementation boundaries.",
165
+ resources: [{
166
+ title: "Project workspace",
167
+ description: "Open the repository that maintains this knowledge.",
168
+ href: "https://example.com/project",
169
+ featured: true,
170
+ }],
171
+ },
172
+ },
138
173
  });
139
174
 
140
175
  llmsPackage({
@@ -150,22 +185,26 @@ may be rebuilt; it is not an authoring source.
150
185
  `kbPackage.site` optionally adds a VitePress website at `dist/<base>-site/` in
151
186
  the same build, beside the KB directory. `<base>` removes one trailing `-kb`
152
187
  from the package name, if present. Omit it for KB-only output. It accepts `title`, `description`,
153
- `lang` and a deployment `base` path. Knowledge map is projected from
188
+ `lang`, a deployment `base` path, and an optional `home` presentation. `home`
189
+ accepts `title`, `slogan`, `description`, hero `actions`, and `resources` shown
190
+ below the generated site map. Each resource needs an `href`, a copyable
191
+ `command`, or both. Omit unknown resources; the builder never invents service
192
+ or repository links. Knowledge map is projected from
154
193
  `src/knowledge-map.yaml` independently of KB directories; see
155
194
  [Package Outputs](../guides/package-outputs.md#optional-static-documentation-website).
156
195
 
157
- ## Indexer registry
196
+ ## Knowledge requirements and Indexer Skills
158
197
 
159
- When this file is absent, the configuration Route supplies the initial schema:
160
- write confirmed `requirements` with `indexers: []`, then re-evaluate. The Provider
161
- selection Action supplies its own completion schema; that payload is not the
162
- configuration file. Subsequent changes use typed proposals and applicable gates. Each selected Indexer binds requirements and scopes to one
163
- primary Provider, with optional declared layers or composers. Provider code
164
- must return the current Indexer result protocol; it must not write Candidate,
165
- knowledge, or Review files directly.
198
+ When `src/indexers.yaml` is absent, the configuration Route supplies its schema.
199
+ Write `requirements` only; do not add `protocol`, `indexers`, Provider selections
200
+ or profiles. Re-evaluate after changing confirmed requirements.
166
201
 
167
- Detailed Provider protocol and customization guidance is selected by the
168
- current workflow Route when it is needed.
202
+ Installed Indexer Skills guide investigation and writing. Relevant Skill choices
203
+ and optional configuration use `indexer_usage` in the temporary production plan,
204
+ not this durable file. There is no separate Provider selection or resolution gate.
205
+ The Agent writes task drafts and reference files under the returned temporary
206
+ directory; the CLI accepts them and owns Candidate, Review and formal output.
207
+ See [Indexer guidance](../guides/indexer-provider-and-customization.md).
169
208
 
170
209
  ## Persistent versus runtime state
171
210
 
@@ -9,10 +9,31 @@ mediaType: text/markdown
9
9
  At completed-scope delivery, follow the version-recording Route. The coordinator
10
10
  writes the semantic changelog from formal diffs and the conversation, including
11
11
  the triggering source and an explicitly known user (Git name is the default).
12
+ Pass `actor` explicitly when the conversation identifies the triggering user,
13
+ including a known Lark display name. If Git has no name and the conversation
14
+ does not identify the user, leave it absent and mention that in the delivery
15
+ summary; do not infer identity from paths, logins or source authors. Amending
16
+ an unbuilt entry preserves its actor unless an explicit replacement is supplied.
12
17
  Record after Close and package/template approval, before the final build, so the
13
18
  selected outputs are built with the new version once. Build records hashes without
14
19
  increasing versions. Never count temporary progress or a build retry as a change.
15
20
 
21
+ For formal repairs before a successful build, use `version inspect`'s
22
+ `reusable_version` when present. Submit the same version and a complete updated
23
+ changelog covering the original work plus repairs, not a repair-only replacement.
24
+ The CLI updates the pending entry in place. A successful build or publication
25
+ seals that version; subsequent changes require an increase. Do not delete build
26
+ or publication receipts to reopen history.
27
+
28
+ Successful delivery clears completed task drafts. Do not empty `.tmp` or call
29
+ `task resume` as a finalization step. Retain registered repository checkouts,
30
+ source-region baselines and queued logs for reuse; optional historical-cache
31
+ cleanup follows the workspace preparation guide after delivery, not after close.
32
+
33
+ Website rendering must preserve literal code and template examples. Do not revise
34
+ valid source-grounded JSX or template syntax merely to avoid Vue interpolation;
35
+ report a rendering defect if the website compiler cannot display it literally.
36
+
16
37
  Before an authorized external publication, run `context version publish-check
17
38
  --format json`. If `needs_version` is true, inspect with `context version inspect
18
39
  --publish --format json`, record a patch changelog using a `dist` trigger, and
@@ -51,6 +51,13 @@ were read.
51
51
  After apply, re-evaluate. Do not infer that close or package output is current.
52
52
  Do not persist a duplicate review-report ledger in the workspace.
53
53
 
54
+ For restructuring, compare replacement content with the affected approved pages:
55
+ useful conditions, steps and explanations must have a destination before removal.
56
+ Review omission rejects a candidate; it does not retire an approved article.
57
+ Use the explicit retirement preview after replacement delivery, and repair its
58
+ reported incoming references. Navigation removal alone does not remove content
59
+ from search or packages. A renamed menu does not require a new article identity.
60
+
54
61
  The Review UI names the internal `rejected` decision **Omit** because it is a
55
62
  durable content decision, not a request to rewrite the page. When a page needs
56
63
  changes, leave that page pending and use `context revise` so the owning
@@ -103,8 +110,11 @@ and the Route returns to their Review/repair after the selected output builds.
103
110
  ## Check usefulness as well as factual accuracy
104
111
 
105
112
  Use the current requirements and agreed scope to check whether a reader can
106
- complete the promised task with these pages. Source citations and a valid API
107
- table alone do not establish that. Compare representative pages with their
113
+ complete the promised task with these pages. For navigation, check a specific
114
+ file/symbol or source section and an actionable next hop; for explanations or
115
+ procedures, check the necessary conditions, steps and examples. Source citations,
116
+ task acceptance and navigation bindings alone do not establish either outcome.
117
+ Compare representative pages with their
108
118
  actual definitions: keep defaults and members attached to the correct callable
109
119
  or type; inspect inherited members and static entry points when needed for the
110
120
  reader's task. Do not infer that an unexpanded type has no options or callbacks.
@@ -116,3 +126,9 @@ not an automatic rejection rule. If the source is insufficient, identify what
116
126
  is unavailable and its effect on the reader instead of inventing content or
117
127
  forcing another identical regeneration. Keep correct pages eligible for the
118
128
  partial approval and delivery path above.
129
+
130
+ Compare the batch with the agreed whole scope and remaining investigation, not
131
+ only its own titles. When revising or merging, preserve useful existing detail
132
+ instead of replacing it with generic lookup advice. Repair affected pages or
133
+ use the current planning route for missing topics. These are Agent judgments,
134
+ not minimum article counts, a new coverage ledger or an extra CLI approval gate.
@@ -22,6 +22,49 @@ and continues through Review and delivery. Expression-only changes need no
22
22
  source capture or Parser. Preserve prior confirmed contributions; distinguish
23
23
  actual behavior, a confirmed decision, and a proposal that is not implemented.
24
24
 
25
+ ## Keep planning local to the change
26
+
27
+ Before starting production, compare the proposed content with the workspace's
28
+ reader purpose. For clearly unrelated anecdotes or personal rankings, briefly
29
+ recommend leaving them out of the formal manual or saving them separately because
30
+ they can dilute useful retrieval. Attribution alone does not make content relevant.
31
+ This is advice, not a CLI gate: honor the user's informed choice without repeated
32
+ objections, while preserving subjective attribution and normal Review.
33
+
34
+ Registered repositories are not prerequisites for every new request. Restore only
35
+ sources needed to investigate or write the current task, including unchanged code
36
+ when its implementation needs checking. Notes, document-only work, wording edits
37
+ and navigation changes do not require unrelated checkouts. Retained article
38
+ references alone do not require restoring every referenced repository. Missing
39
+ material remains a gap; it must not be treated as investigated or permanently
40
+ excluded. Independent available material can proceed through planning and delivery.
41
+ For required code, use `context source recovery-plan <registered-name> --format json`.
42
+ Reuse a valid local checkout or obtain clone authorization for the returned pinned
43
+ version, then submit the decision using the returned recovery command and schema.
44
+ Do not restore all registered sources merely because a checkout is missing.
45
+
46
+ For one or two documents or a clearly bounded module, retain the useful planning
47
+ decision: add or revise which articles, and place them where readers expect them.
48
+ Do not expand this into a whole-workspace taxonomy, full navigation redesign or
49
+ multi-wave plan. Read related existing topics first and expand only as needed.
50
+ One module can contain several topics; scope and ambiguity, not source count,
51
+ determine how much investigation is useful.
52
+
53
+ Reuse an approved stage's plan for in-scope additions through its existing amendment
54
+ route. Keep completed work and unrelated pending investigation intact. If article
55
+ targets are already decided before approval, the preparation route supports a
56
+ known-task input to combine preparation and task creation. It still prepares
57
+ navigation and retains report confirmation; it is not a bypass for new source
58
+ authorization. Planning depth is an Agent judgment, not an additional CLI gate.
59
+
60
+ For broad work, distinguish the whole requested outcome, the current batch and
61
+ remaining capability families or document tasks. Entry-first knowledge should
62
+ locate a checked file/symbol or source section and a concrete next step; a module
63
+ name alone is not problem coverage. When merging or revising, preserve useful
64
+ existing detail rather than replacing it with lookup advice. Review checks the
65
+ promised reader task; task completion and navigation binding only describe the
66
+ declared articles, not semantic coverage of all source material.
67
+
25
68
  ## First-task intake budget
26
69
 
27
70
  Before registration and capture, the Agent uses the user's task instructions and
@@ -62,7 +105,14 @@ progress under `.tmp/` never causes a version increase.
62
105
  Version recording runs at completed-scope delivery after Review, Close and package
63
106
  configuration/template approval, before the final build. The record response
64
107
  returns the next workspace Route, so no extra status call is needed. Build retries
65
- reuse the recorded version when formal content is unchanged. Intermediate batches
108
+ reuse the recorded version when formal content is unchanged. If build preparation
109
+ or rendering fails and formal corrections are needed, `version inspect` returns
110
+ `reusable_version` for the current entry only while it has no successful build or
111
+ publication receipt. Submit that same version with the complete iteration's title,
112
+ changes and triggers, including the repair; this replaces the pending changelog
113
+ entry rather than appending another version. Do not submit only the repair and
114
+ lose the original delivery description. Once built or published, the version is
115
+ sealed and further formal changes require an increase. Intermediate batches
66
116
  do not each receive a version.
67
117
 
68
118
  The workspace AGENTS.md and version-writing instructions require each entry's
@@ -91,7 +141,10 @@ actor:
91
141
  ```
92
142
 
93
143
  `actor` is optional; omit it to use local Git `user.name` when configured. Use a
94
- Lark display name only when explicitly known from the conversation. Trigger kinds
144
+ Lark display name only when explicitly known from the conversation. Amending an
145
+ unbuilt entry preserves its actor unless a replacement is explicitly supplied.
146
+ If neither the conversation nor Git identifies the user, omit the actor and
147
+ mention the missing identity in the delivery summary; never guess it. Trigger kinds
95
148
  are `initial`, `note`, `sessions`, `mr`, `module`, `document`, `navigation`,
96
149
  `repair`, `dist`, and `other`. Agent-written fields describe the actual diff and
97
150
  conversation; they must not expose credentials, raw transcripts or private IDs.
@@ -402,11 +455,61 @@ knowledge structure and packages.
402
455
 
403
456
  To move an approved page, use `context revise "<old path>" --move-to "<new path>"
404
457
  --instruction "<requested move and content changes>" --format json`. The new
405
- path stays in the same collection. The revision retains the page identity,
458
+ path may use another supported knowledge collection. The revision retains the page identity,
406
459
  rebases outgoing links and updates incoming Markdown links at approval. A new
407
460
  subject name alone only needs a title/content revision; do not create duplicate
408
- pages. Retirement is a content decision: explain the inapplicable material and
409
- supported replacement before changing its page and referring navigation.
461
+ pages. Changing a website group alone does not require moving or reclassifying an article.
462
+
463
+ ### Restructure existing knowledge
464
+
465
+ Read the affected approved articles and current sources before deciding what to
466
+ keep, deepen, split, merge, retain as history or retire. Reuse the current plan
467
+ and remaining scope; a new article plan does not prove old content was preserved.
468
+ Work by reader task, not source or menu count.
469
+
470
+ For a split or merge, first approve destination content, then revise the original
471
+ and incoming links. Preserve useful details until their destination is available.
472
+ Same-page fragments use ordinary revision edits; cross-page work uses new/revision
473
+ tasks and explicit retirement. Finish each coherent batch's content and navigation
474
+ before delivery; inspect both new content and the old articles' disposition.
475
+
476
+ Preview approved-page retirement with `context task retire --input <file> --format json`:
477
+
478
+ ```yaml
479
+ reason: These reader tasks are now covered by the approved guide.
480
+ targets:
481
+ - path: architecture/old-guide.md
482
+ replacement: sop/current-guide.md
483
+ ```
484
+
485
+ `replacement` is optional and must already be approved, outside the retirement set.
486
+ Use several targets for a batch. Read affected files and blockers, then execute
487
+ the returned digest-bound apply command within the user's authorization; do not
488
+ ask for another confirmation when that retirement is already authorized.
489
+ `context task retire --schema --format yaml` describes the input.
490
+
491
+ Retirement removes selected Markdown and structure entries together, updates
492
+ page-level incoming Markdown links to explicit replacements, and rebinds page
493
+ navigation or removes retired navigation targets while retaining groups.
494
+ Repair fragment links explicitly first: the CLI cannot infer where a split moved
495
+ a paragraph. Without a replacement, repair incoming links before applying.
496
+ Finish active drafts/revisions first; unfinished production targeting a selected
497
+ page must be finished or amended rather than discarded.
498
+
499
+ Follow status and the normal close/version/build flow before delivery. Sources
500
+ and shared assets are not deleted. The response provides a temporary restore
501
+ input for the existing rollback preview, including exact previous article,
502
+ structure and modified navigation/link bytes. Retain that input or a Git baseline
503
+ if restoration is needed after temporary cleanup. Retry an interrupted apply
504
+ with the same input and digest; never delete runtime files to recover. Later
505
+ conflicting edits require inspection instead of blind rollback.
506
+
507
+ Historical pages with continuing reader value should normally retain their
508
+ applicable version. Source read failure, shorter new text or a changed menu is
509
+ not sufficient reason to retire an article.
510
+ Retirement does not narrow the registered production scope. If the user also
511
+ excludes the underlying topic from future work, record that through the existing
512
+ requirements/exclusion flow rather than assuming file removal changes the goal.
410
513
 
411
514
  ### Adjust inputs while a local update is unfinished
412
515
 
@@ -58,6 +58,24 @@ changed. A request to generate a documentation website follows this same route,
58
58
  including after initial delivery. Inspect existing declarations before editing;
59
59
  do not register the request itself as source material or re-index unchanged knowledge.
60
60
 
61
+ For a new website or a requested homepage redesign, configure `site.home` from
62
+ the confirmed audience and scope: a concise title, slogan and description, plus
63
+ only useful hero actions. The generated homepage already supplies the complete
64
+ top-level site map, LLM Docs and Changelog. Add `home.resources` for verified
65
+ repositories, services, support channels or copyable install commands. Omit
66
+ unknown destinations instead of inventing links or showing empty cards; they
67
+ can be added later without re-indexing knowledge.
68
+
69
+ When configuring the homepage, reuse confirmed project declarations, repository
70
+ remotes, deployment configuration and successful publication receipts. Known
71
+ resource types do not prove that a destination exists. Omit unavailable resources
72
+ entirely rather than passing empty strings; note missing optional destinations in
73
+ the existing work summary without blocking knowledge production or requesting
74
+ new services. After an authorized publication or service setup succeeds, use its
75
+ returned URL and package identity to update the corresponding resource. Preserve
76
+ existing entries, avoid duplicates, and rebuild only when configuration changes.
77
+ Republish the changed site only within the existing publication authorization.
78
+
61
79
  Validate reading targets before build. Website navigation uses the approved reading
62
80
  structure; repair missing bindings through the current structure adjustment action.
63
81
  Build cost is rendering and local search generation, not another Indexer run.
@@ -10,11 +10,46 @@ The stage entry links CLI-owned requirements, planned skill guidance and task
10
10
  directories. Read relevant source text before writing; a skeleton is navigation,
11
11
  not semantic evidence. Skill names guide work, not article ownership or versions.
12
12
 
13
+ Restore repository checkouts only when needed for the current investigation or
14
+ article. Independent notes/documents can proceed while unavailable code remains
15
+ an explicit gap. For a required repository, read the
16
+ [recovery procedure](repository-source-recovery.md) and inspect only its registered
17
+ name, not every repository. Never claim missing material was checked.
18
+
19
+ Plan article paths are relative to `knowledge/`, for example `business/example.md`.
20
+ `indexer_usage.scopes` contains stage source refs, not collection names. Declare
21
+ selected skills through the plan; no separate Indexer registration is required.
22
+
13
23
  Choose relevant code directories while planning or writing. A task brief may
14
24
  name useful reading scope; module labels do not imply directory permissions.
15
25
  No module mapping file, version receipt or article-level scope fields are needed.
16
26
  Read related code as needed within the user's authorized sources.
17
27
 
28
+ Keep planning proportional to this request. For a short document task or one
29
+ bounded module, decide whether to add or revise related articles and their reading
30
+ position; do not redesign unrelated modules or the whole site. Start with relevant
31
+ existing topics, not every navigation page. Expand investigation when the material
32
+ requires it, not to fill a planning template. One batch is sufficient unless real
33
+ dependencies or useful parallel work call for more. Source count is not a page
34
+ count or a CLI threshold.
35
+ For a broad request, identify its major capability families and document tasks;
36
+ lightweight planning limits initial depth, not the authorized range. Use existing
37
+ questions and briefs to distinguish checked entry points from explanations and
38
+ keep unplanned work visible. A first batch is not the whole requested outcome.
39
+
40
+ For restructuring, assess existing articles as well as proposed additions.
41
+ Preserve useful text until approved destinations carry it; then repair links and
42
+ navigation. Splitting/merging uses ordinary article tasks and fragment edits.
43
+ After their delivery, explicitly obsolete approved pages can use the retirement
44
+ preview described in the knowledge-updates guide. Removing a plan task or menu
45
+ entry does not retire its approved article.
46
+
47
+ During an approved stage, use the existing plan-amendment path for in-scope
48
+ additions and preserve completed work. Do not restart planning solely because
49
+ another article is ready to write. Keep remaining investigation explicit; a small
50
+ current task does not mean other authorized work is finished. New source or purpose
51
+ authorization still follows the current Route.
52
+
18
53
  Write results under the returned Agent directory. All submission paths are
19
54
  relative to that stage directory, even when the manifest is in `submissions/`.
20
55
  Copy the CLI's submission template, keep completed tasks only, and keep each