@c4a/context-cli 0.7.99 → 0.7.101

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 (75) hide show
  1. package/cli.js +1495 -714
  2. package/indexers/contracts/profile-contract.json +245 -245
  3. package/indexers/release-manifest.json +1 -1
  4. package/package.json +12 -12
  5. package/parserEntryWorker.js +80 -3
  6. package/plugins/VERSION +1 -1
  7. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  8. package/plugins/claude/commands/context.md +4 -2
  9. package/plugins/claude/resources/context/routine-update.md +15 -5
  10. package/plugins/claude/skills/context-plan/SKILL.md +22 -4
  11. package/plugins/claude/skills/context-plan/references/knowledge-migration.md +167 -0
  12. package/plugins/claude/skills/context-plan/references/project-planning.md +5 -0
  13. package/plugins/claude/skills/context-plan/references/quality-audit.md +63 -0
  14. package/plugins/claude/skills/context-plan/references/research-report.md +80 -0
  15. package/plugins/claude/skills/context-plan/references/resource-tools.md +13 -0
  16. package/plugins/claude/skills/context-plan/references/stakeholder-intake.md +38 -0
  17. package/plugins/claude/skills/context-plan/templates/PLAN.md +25 -0
  18. package/plugins/claude/skills/context-plan/templates/research-report/README.md +79 -0
  19. package/plugins/claude/skills/context-plan/templates/research-report/build.mjs +144 -0
  20. package/plugins/claude/skills/context-plan/templates/research-report/example/01-conclusions.md +28 -0
  21. package/plugins/claude/skills/context-plan/templates/research-report/example/A-wiki-a.md +10 -0
  22. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  23. package/plugins/codex/skills/context/SKILL.md +4 -2
  24. package/plugins/codex/skills/context/references/routine-update.md +15 -5
  25. package/plugins/codex/skills/context-plan/SKILL.md +22 -4
  26. package/plugins/codex/skills/context-plan/references/knowledge-migration.md +167 -0
  27. package/plugins/codex/skills/context-plan/references/project-planning.md +5 -0
  28. package/plugins/codex/skills/context-plan/references/quality-audit.md +63 -0
  29. package/plugins/codex/skills/context-plan/references/research-report.md +80 -0
  30. package/plugins/codex/skills/context-plan/references/resource-tools.md +13 -0
  31. package/plugins/codex/skills/context-plan/references/stakeholder-intake.md +38 -0
  32. package/plugins/codex/skills/context-plan/templates/PLAN.md +25 -0
  33. package/plugins/codex/skills/context-plan/templates/research-report/README.md +79 -0
  34. package/plugins/codex/skills/context-plan/templates/research-report/build.mjs +144 -0
  35. package/plugins/codex/skills/context-plan/templates/research-report/example/01-conclusions.md +28 -0
  36. package/plugins/codex/skills/context-plan/templates/research-report/example/A-wiki-a.md +10 -0
  37. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  38. package/plugins/cursor/commands/c4a-context.md +4 -2
  39. package/plugins/cursor/resources/context/routine-update.md +15 -5
  40. package/plugins/cursor/skills/context-plan/SKILL.md +22 -4
  41. package/plugins/cursor/skills/context-plan/references/knowledge-migration.md +167 -0
  42. package/plugins/cursor/skills/context-plan/references/project-planning.md +5 -0
  43. package/plugins/cursor/skills/context-plan/references/quality-audit.md +63 -0
  44. package/plugins/cursor/skills/context-plan/references/research-report.md +80 -0
  45. package/plugins/cursor/skills/context-plan/references/resource-tools.md +13 -0
  46. package/plugins/cursor/skills/context-plan/references/stakeholder-intake.md +38 -0
  47. package/plugins/cursor/skills/context-plan/templates/PLAN.md +25 -0
  48. package/plugins/cursor/skills/context-plan/templates/research-report/README.md +79 -0
  49. package/plugins/cursor/skills/context-plan/templates/research-report/build.mjs +144 -0
  50. package/plugins/cursor/skills/context-plan/templates/research-report/example/01-conclusions.md +28 -0
  51. package/plugins/cursor/skills/context-plan/templates/research-report/example/A-wiki-a.md +10 -0
  52. package/plugins/skills/context/SKILL.md +4 -2
  53. package/plugins/skills/context/references/routine-update.md +15 -5
  54. package/plugins/skills/context-plan/SKILL.md +22 -4
  55. package/plugins/skills/context-plan/references/knowledge-migration.md +167 -0
  56. package/plugins/skills/context-plan/references/project-planning.md +5 -0
  57. package/plugins/skills/context-plan/references/quality-audit.md +63 -0
  58. package/plugins/skills/context-plan/references/research-report.md +80 -0
  59. package/plugins/skills/context-plan/references/resource-tools.md +13 -0
  60. package/plugins/skills/context-plan/references/stakeholder-intake.md +38 -0
  61. package/plugins/skills/context-plan/templates/PLAN.md +25 -0
  62. package/plugins/skills/context-plan/templates/research-report/README.md +79 -0
  63. package/plugins/skills/context-plan/templates/research-report/build.mjs +144 -0
  64. package/plugins/skills/context-plan/templates/research-report/example/01-conclusions.md +28 -0
  65. package/plugins/skills/context-plan/templates/research-report/example/A-wiki-a.md +10 -0
  66. package/providers/context/manifest.json +18 -18
  67. package/providers/context/provider.yaml +1 -1
  68. package/providers/context/resources/manuals/guides/knowledge-updates.md +47 -0
  69. package/providers/context/resources/manuals/guides/package-outputs.md +8 -0
  70. package/providers/context/resources/procedures/knowledge-review.md +13 -0
  71. package/providers/context/resources/procedures/knowledge-updates.md +47 -0
  72. package/providers/context/resources/procedures/production-requirements.md +7 -0
  73. package/providers/context/resources/procedures/production-stage-files.md +37 -0
  74. package/providers/context/resources/procedures/source-capture-detailed.md +5 -0
  75. package/providers/context/schemas/indexer-agent-step-result.schema.json +3 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "protocol": "context.indexer.cli-release-manifest/v1",
3
3
  "package": "@c4a/context-cli",
4
- "version": "0.7.99",
4
+ "version": "0.7.101",
5
5
  "issuer": "context4ai/context",
6
6
  "bundles": [
7
7
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/context-cli",
3
- "version": "0.7.99",
3
+ "version": "0.7.101",
4
4
  "type": "module",
5
5
  "description": "Local runtime and Agent integration for traceable knowledge production",
6
6
  "license": "MIT",
@@ -24,17 +24,17 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@c4a/agent-graph": "0.3.0",
27
- "@c4a/context": "0.7.99",
28
- "@c4a/extract": "0.7.99",
29
- "@c4a/extract-contract": "0.7.99",
30
- "@c4a/extract-go": "0.7.99",
31
- "@c4a/extract-mdx": "0.7.99",
32
- "@c4a/extract-proto": "0.7.99",
33
- "@c4a/extract-rush": "0.7.99",
34
- "@c4a/extract-sql": "0.7.99",
35
- "@c4a/extract-style": "0.7.99",
36
- "@c4a/extract-thrift": "0.7.99",
37
- "@c4a/extract-ts": "0.7.99",
27
+ "@c4a/context": "0.7.101",
28
+ "@c4a/extract": "0.7.101",
29
+ "@c4a/extract-contract": "0.7.101",
30
+ "@c4a/extract-go": "0.7.101",
31
+ "@c4a/extract-mdx": "0.7.101",
32
+ "@c4a/extract-proto": "0.7.101",
33
+ "@c4a/extract-rush": "0.7.101",
34
+ "@c4a/extract-sql": "0.7.101",
35
+ "@c4a/extract-style": "0.7.101",
36
+ "@c4a/extract-thrift": "0.7.101",
37
+ "@c4a/extract-ts": "0.7.101",
38
38
  "@mermaid-js/layout-elk": "0.2.0",
39
39
  "commander": "^11.0.0",
40
40
  "d3-force": "3.0.0",
@@ -18219,13 +18219,25 @@ function updateKnowledgeMap(current, value) {
18219
18219
  validateEntries(payload.entries);
18220
18220
  return { ...payload, revision: indexerProtocolDigest(payload) };
18221
18221
  }
18222
- function projectKnowledgeMap(structure, targets) {
18222
+ function projectKnowledgeMap(structure, targets, options = {}) {
18223
18223
  const children = new Map;
18224
18224
  for (const entry of structure.entries)
18225
18225
  children.set(entry.parent, [...children.get(entry.parent) ?? [], entry]);
18226
18226
  const warnings = [];
18227
+ const hidden = [];
18228
+ function collectHidden(entry) {
18229
+ const href = entry.target === undefined ? undefined : targets.get(knowledgeMapTargetKey(entry.target));
18230
+ if (href !== undefined)
18231
+ hidden.push(href);
18232
+ for (const child of children.get(entry.key) ?? [])
18233
+ collectHidden(child);
18234
+ }
18227
18235
  function project(parent) {
18228
18236
  return (children.get(parent) ?? []).sort((a, b) => a.order - b.order || a.key.localeCompare(b.key)).flatMap((entry) => {
18237
+ if (options.omitHidden === true && entry.hidden === true) {
18238
+ collectHidden(entry);
18239
+ return [];
18240
+ }
18229
18241
  const descendants = project(entry.key);
18230
18242
  const identity = entry.target === undefined ? undefined : knowledgeMapTargetKey(entry.target);
18231
18243
  const href = identity === undefined ? undefined : targets.get(identity);
@@ -18236,7 +18248,8 @@ function projectKnowledgeMap(structure, targets) {
18236
18248
  return [{ key: entry.key, title: entry.title, ...href === undefined ? {} : { href }, children: descendants }];
18237
18249
  });
18238
18250
  }
18239
- return { entries: project(null), warnings };
18251
+ const entries = project(null);
18252
+ return { entries, warnings, hidden };
18240
18253
  }
18241
18254
  function knowledgeMapTargetKey(target) {
18242
18255
  return target.section_key === undefined ? target.artifact_ref : `${target.artifact_ref}#${encodeURIComponent(target.section_key)}`;
@@ -18250,6 +18263,7 @@ var init_knowledgeMap = __esm(() => {
18250
18263
  parent: exports_external.string().min(1).nullable(),
18251
18264
  title: exports_external.string().min(1),
18252
18265
  order: exports_external.number().finite().default(0),
18266
+ hidden: exports_external.boolean().optional(),
18253
18267
  target: exports_external.object({
18254
18268
  artifact_ref: exports_external.string().min(1),
18255
18269
  section_key: exports_external.string().min(1).optional()
@@ -20347,7 +20361,7 @@ function source(name, options, moduleOptions) {
20347
20361
  materializedAt: `sources/${type}/${name}`
20348
20362
  };
20349
20363
  }
20350
- var import_yaml4, DEFAULT_REPO_SOURCES_REGISTRY_PATH = "sources/repo/index.yaml", DEFAULT_FILE_SOURCES_REGISTRY_PATH = "sources/file/index.yaml", DEFAULT_LARK_SOURCES_REGISTRY_PATH = "sources/lark/index.yaml", SOURCE_TYPES, SOURCE_NAME_PATTERN, REPO_DATE_NAMESPACE_PATTERN, repoSourceModuleSchema, repoSourceRegistryEntrySchema, sourceSnapshotSchema2, fileSourceRegistryEntrySchema, fileSourceBatchSchema, larkSourceRegistryEntrySchema, larkSourceBatchSchema, repoSourcesRegistrySchema, fileSourcesRegistrySchema, larkSourcesRegistrySchema, formatRegistryIssues = (issues) => issues.map((issue) => {
20364
+ var import_yaml4, DEFAULT_REPO_SOURCES_REGISTRY_PATH = "sources/repo/index.yaml", DEFAULT_FILE_SOURCES_REGISTRY_PATH = "sources/file/index.yaml", DEFAULT_LARK_SOURCES_REGISTRY_PATH = "sources/lark/index.yaml", SOURCE_TYPES, SOURCE_NAME_PATTERN, REPO_DATE_NAMESPACE_PATTERN, repoSourceModuleSchema, repoSourceRegistryEntrySchema, sourceSnapshotSchema2, fileSourceOriginSchema, fileSourceRegistryEntrySchema, fileSourceBatchSchema, larkSourceRegistryEntrySchema, larkSourceBatchSchema, repoSourcesRegistrySchema, fileSourcesRegistrySchema, larkSourcesRegistrySchema, formatRegistryIssues = (issues) => issues.map((issue) => {
20351
20365
  const path = issue.path.length > 0 ? issue.path.join(".") : "<root>";
20352
20366
  return `${path}: ${issue.message}`;
20353
20367
  }).join("; "), isAbsoluteRegistryPath = (value) => value.startsWith("/") || /^[a-zA-Z]:[\\/]/u.test(value), assertSourceName = (sourceType, name, registryPath) => {
@@ -20478,6 +20492,15 @@ var import_yaml4, DEFAULT_REPO_SOURCES_REGISTRY_PATH = "sources/repo/index.yaml"
20478
20492
  for (const [index, include] of (entry.include ?? []).entries()) {
20479
20493
  assertDocumentIncludePath("file", name, `include[${index}]`, include, registryPath);
20480
20494
  }
20495
+ const documentExtensions = entry.documentExtensions === undefined ? undefined : normalizeFileDocumentExtensions(entry.documentExtensions, name, registryPath);
20496
+ const origin = entry.origin === undefined ? undefined : {
20497
+ kind: entry.origin.kind,
20498
+ id: entry.origin.id,
20499
+ version: entry.origin.version,
20500
+ ...entry.origin.url !== undefined ? { url: entry.origin.url } : {}
20501
+ };
20502
+ if (origin !== undefined)
20503
+ assertFileSourceOrigin(name, origin, entry.local, registryPath);
20481
20504
  const snapshot = entry.snapshot ?? (namespace !== undefined ? { manifest: `sources/file/${namespace}/manifest.json` } : undefined);
20482
20505
  if (snapshot !== undefined) {
20483
20506
  assertDocumentSourcePath("file", name, "snapshot.manifest", snapshot.manifest, registryPath);
@@ -20496,10 +20519,50 @@ var import_yaml4, DEFAULT_REPO_SOURCES_REGISTRY_PATH = "sources/repo/index.yaml"
20496
20519
  materializedAt,
20497
20520
  ...entry.local !== undefined ? { local: entry.local } : {},
20498
20521
  ...entry.include !== undefined ? { include: entry.include } : {},
20522
+ ...documentExtensions !== undefined ? { documentExtensions } : {},
20523
+ ...entry.layout !== undefined ? { layout: entry.layout } : {},
20524
+ ...entry.frozen === true ? { frozen: true } : {},
20525
+ ...origin !== undefined ? { origin } : {},
20499
20526
  ...snapshot !== undefined ? { snapshot } : {}
20500
20527
  };
20501
20528
  });
20502
20529
  });
20530
+ }, parseFileSourcesRegistryDocument = (input, registryPath) => parseFileSourcesRegistry(input, registryPath), FILE_DOCUMENT_EXTENSION_PATTERN, FILE_SOURCE_ORIGIN_KIND_PATTERN, RESERVED_FILE_SOURCE_ORIGIN_KINDS, normalizeFileDocumentExtensions = (extensions, name, registryPath) => {
20531
+ const normalized = [...new Set(extensions.map((extension) => {
20532
+ const value = (extension.startsWith(".") ? extension : `.${extension}`).toLowerCase();
20533
+ if (!FILE_DOCUMENT_EXTENSION_PATTERN.test(value)) {
20534
+ throw new TypeError(`file source "${name}" in ${registryPath} has invalid documentExtensions entry: ${extension}`);
20535
+ }
20536
+ return value;
20537
+ }))];
20538
+ return normalized;
20539
+ }, fileSourceOriginInstallRoot = (kind) => `sources/${kind}`, assertFileSourceOrigin = (name, origin, local, registryPath) => {
20540
+ if (!FILE_SOURCE_ORIGIN_KIND_PATTERN.test(origin.kind) || RESERVED_FILE_SOURCE_ORIGIN_KINDS.includes(origin.kind)) {
20541
+ throw new TypeError(`file source "${name}" in ${registryPath} has invalid origin.kind: ${origin.kind}`);
20542
+ }
20543
+ if (origin.id.startsWith("-") || /[\r\n\0]/u.test(origin.id)) {
20544
+ throw new TypeError(`file source "${name}" in ${registryPath} has invalid origin.id: ${origin.id}`);
20545
+ }
20546
+ if (/[\s/\\]/u.test(origin.version) || origin.version.startsWith("-") || origin.version === "." || origin.version === "..") {
20547
+ throw new TypeError(`file source "${name}" in ${registryPath} has invalid origin.version: ${origin.version}`);
20548
+ }
20549
+ if (local === undefined) {
20550
+ throw new TypeError(`file source "${name}" in ${registryPath} with an origin needs local: ${fileSourceOriginInstallRoot(origin.kind)}/<name>@${origin.version}`);
20551
+ }
20552
+ if (fileSourceOriginVersionRoot(origin, local) === undefined) {
20553
+ throw new TypeError(`file source "${name}" in ${registryPath} must install origin ${origin.kind} under ${fileSourceOriginInstallRoot(origin.kind)}/<name>@${origin.version}[/<subdir>] without . or .. segments: ${local}`);
20554
+ }
20555
+ }, FILE_SOURCE_ORIGIN_DIR_NAME_PATTERN, fileSourceOriginVersionRoot = (origin, local) => {
20556
+ const parts = local.replaceAll("\\", "/").split("/");
20557
+ if (parts.some((part) => part.length === 0 || part === "." || part === ".."))
20558
+ return;
20559
+ if (parts.length < 3 || parts[0] !== "sources" || parts[1] !== origin.kind)
20560
+ return;
20561
+ const suffix = `@${origin.version}`;
20562
+ const dir = parts[2];
20563
+ if (!dir.endsWith(suffix) || !FILE_SOURCE_ORIGIN_DIR_NAME_PATTERN.test(dir.slice(0, -suffix.length)))
20564
+ return;
20565
+ return parts.slice(0, 3).join("/");
20503
20566
  }, parseLarkSourcesRegistry = (input, registryPath) => {
20504
20567
  const parsed = larkSourcesRegistrySchema.safeParse(input);
20505
20568
  if (!parsed.success) {
@@ -20634,11 +20697,21 @@ var init_sources = __esm(() => {
20634
20697
  sourceSnapshotSchema2 = exports_external.object({
20635
20698
  manifest: exports_external.string().min(1)
20636
20699
  }).strict();
20700
+ fileSourceOriginSchema = exports_external.object({
20701
+ kind: exports_external.string().min(1),
20702
+ id: exports_external.string().min(1),
20703
+ version: exports_external.string().min(1),
20704
+ url: exports_external.string().min(1).optional()
20705
+ }).strict();
20637
20706
  fileSourceRegistryEntrySchema = exports_external.object({
20638
20707
  id: exports_external.string().min(1).optional(),
20639
20708
  name: exports_external.string().min(1),
20640
20709
  local: exports_external.string().min(1).optional(),
20641
20710
  include: exports_external.array(exports_external.string().min(1)).optional(),
20711
+ documentExtensions: exports_external.array(exports_external.string().min(1)).min(1).optional(),
20712
+ layout: exports_external.enum(["flat", "tree"]).optional(),
20713
+ frozen: exports_external.boolean().optional(),
20714
+ origin: fileSourceOriginSchema.optional(),
20642
20715
  materializedAt: exports_external.string().min(1).optional(),
20643
20716
  snapshot: sourceSnapshotSchema2.optional()
20644
20717
  }).strict();
@@ -20669,6 +20742,10 @@ var init_sources = __esm(() => {
20669
20742
  larkSourcesRegistrySchema = exports_external.object({
20670
20743
  sources: exports_external.array(exports_external.union([larkSourceRegistryEntrySchema, larkSourceBatchSchema])).default([])
20671
20744
  }).strict();
20745
+ FILE_DOCUMENT_EXTENSION_PATTERN = /^\.[a-z0-9][a-z0-9_-]*$/u;
20746
+ FILE_SOURCE_ORIGIN_KIND_PATTERN = /^[a-z][a-z0-9-]*$/u;
20747
+ RESERVED_FILE_SOURCE_ORIGIN_KINDS = [...SOURCE_TYPES, "notes", "skills"];
20748
+ FILE_SOURCE_ORIGIN_DIR_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/u;
20672
20749
  SOURCES_REGISTRY_EXCLUSION = Symbol.for("c4a.context.sources-registry-exclusion");
20673
20750
  });
20674
20751
 
package/plugins/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.99
1
+ 0.7.101
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "c4a",
3
3
  "description": "Start or continue a project-local knowledge workspace through one graph-routed entry.",
4
- "version": "0.7.99",
4
+ "version": "0.7.101",
5
5
  "author": {
6
6
  "name": "c4a"
7
7
  },
@@ -74,7 +74,9 @@ Classify a request in this order:
74
74
  A registration or association is an entrance, not evidence: it does not show that
75
75
  the content was read, verified or is usable by the reader. Links from knowledge to
76
76
  imports are navigation; a conclusion that depends on external content requires
77
- capturing that content into `sources`.
77
+ capturing that content into `sources`. Versioned content such as a released
78
+ package, Skill or documentation repository is captured as a `file` source with
79
+ an origin, described in the knowledge-updates guide.
78
80
 
79
81
  For long-term association of external knowledge, Skills or plugins, maintain
80
82
  `imports.yaml` through [imports](../resources/context/imports.md); registration alone does
@@ -140,7 +142,7 @@ without the user's authorization.
140
142
 
141
143
  ### Check the CLI first
142
144
 
143
- This Skill ships with Context 0.7.99.
145
+ This Skill ships with Context 0.7.101.
144
146
 
145
147
  When entering production in a workspace, align the CLI, this Skill and the
146
148
  workspace SDK once per session with [version alignment](../resources/context/version-alignment.md):
@@ -13,7 +13,7 @@ instance configuration may also define `ROUTINE_POLICY` defaults; keys in the
13
13
  trigger take precedence. For example, a scheduler's task content:
14
14
 
15
15
  ```text
16
- /c4a:context routine update
16
+ Routine update: use the `c4a:context` Skill and follow its routine update procedure.
17
17
 
18
18
  This is the routine update of the Billing knowledge base. Refresh it from the
19
19
  latest registered code and documents, revise the affected articles so they
@@ -29,7 +29,10 @@ ROUTINE_POLICY:
29
29
  time_budget_minutes: 90 # stop starting new batches after this
30
30
  ```
31
31
 
32
- Start the trigger with one short paragraph naming the knowledge base and what the
32
+ Begin the content with a plain line that names this Skill and the routine
33
+ update, not with a slash command: some schedulers expand a leading command into
34
+ the Skill text and drop everything after it, so the run never sees its settings.
35
+ Then write one short paragraph naming the knowledge base and what the
33
36
  run should achieve, including any team-specific guidance; it tells the agent
34
37
  which workspace and what matters. The paragraph may also set the reviews in
35
38
  plain language: an explicit statement that the whole run is managed and reviewed
@@ -83,7 +86,9 @@ workspace targets or the delivery configuration.
83
86
  For each document, compare its current revision with the captured one when
84
87
  the host exposes a reliable revision; for a Lark document the captured
85
88
  revision is `metadata.source.revisionId` in its snapshot's `manifest.json`.
86
- Otherwise read it and compare content. Changes in cited files and documents
89
+ Otherwise read it and compare content. For a file source with an origin,
90
+ compare the origin's latest available version with its registered
91
+ `origin.version`; a frozen source never changes. Changes in cited files and documents
87
92
  lead to revisions; changes no article cites are assessed in step 7. Ignore
88
93
  generated code, lock files and third-party directories. An unreadable source
89
94
  is a gap, not a change: never retire or take down pages because of it.
@@ -109,8 +114,13 @@ workspace targets or the delivery configuration.
109
114
  source the candidate pages cite, not only this repository: a page that cites
110
115
  a missing source cannot be submitted. `context source recovery-plan --format
111
116
  json` lists them with a fill-in restore input. Re-capture changed documents
112
- through their normal capture Route. Do not start a new batch after the time
113
- budget; finish or checkpoint the current one.
117
+ through their normal capture Route; for a newer origin version, install it
118
+ into a new version directory and move the registration first, as in the
119
+ knowledge-updates guide's versioned external content section. For pages kept
120
+ as written, keep revisions of code contradictions locally, list them in the
121
+ run report, and do not raise again a contradiction the history shows was
122
+ kept unless its cited code changed. Do not
123
+ start a new batch after the time budget; finish or checkpoint the current one.
114
124
  7. **Cover uncited changes.** In the source-update decision, go through
115
125
  `uncited_changes` by directory, new directories first. Skip tests, lock
116
126
  files, generated code and third-party directories, and read the diff only for
@@ -42,7 +42,14 @@ an audience enters production; do not count registration as completed research.
42
42
  knowledge depends on it, which shortens inventory. The `context` Skill carries
43
43
  a template under `references/source-checklist.md`. It is never required —
44
44
  without one, continue and register material from the conversation.
45
- 3. Read [project-planning.md](references/project-planning.md). Review the existing
45
+ 3. Establish the purpose and constraints before deep research, using
46
+ [stakeholder-intake.md](references/stakeholder-intake.md). Read supplied
47
+ meeting notes, proposals and checklists first and ask only what is still
48
+ missing: where existing knowledge lives and who maintains it, where it should
49
+ be maintained afterwards, what must not be rewritten, who uses the result,
50
+ how packages should be split, and structural constraints. Record the answers
51
+ as the evaluation criteria for the research.
52
+ 4. Read [project-planning.md](references/project-planning.md). Review the existing
46
53
  knowledge workspace and relevant approved articles before grouping new material.
47
54
  Map overlaps, gaps and relationships between documents, repositories and pages;
48
55
  distinguish reuse, revision, consolidation and new coverage in the PLAN.
@@ -53,18 +60,29 @@ an audience enters production; do not count registration as completed research.
53
60
  evidence already available; do not wait for a complete PLAN. Follow the early
54
61
  scope rules in project-planning.md, including previously confirmed choices.
55
62
  Reuse accessible local checkouts and saved research before fetching again.
56
- 4. Create or update `PLAN-YYYYMMDD-slug.md` at that project's Git root using
63
+ When the request brings in existing knowledge collections — knowledge or
64
+ wiki repositories, documentation directories, other workspaces or published
65
+ knowledge packages — also follow [knowledge-migration.md](references/knowledge-migration.md):
66
+ identify each collection's kind and real upstreams, audit a bounded sample of
67
+ its claims with [quality-audit.md](references/quality-audit.md), and choose an
68
+ integration approach per collection.
69
+ 5. Create or update `PLAN-YYYYMMDD-slug.md` at that project's Git root using
57
70
  [the report template](templates/PLAN.md). Keep downloaded research under
58
71
  `.tmp/context-plans/YYYYMMDD-slug/`; the layout is a working convention,
59
72
  not a new CLI validation rule.
60
- 5. Present the first report and complete its review before production. By default,
73
+ 6. When stakeholders must choose between approaches, or the research covers
74
+ existing knowledge collections, present a research report before or with the
75
+ first PLAN, following [research-report.md](references/research-report.md):
76
+ conclusions first, then the analysis and evidence. Record each decision made
77
+ during the discussion in the PLAN before asking for approval.
78
+ 7. Present the first report and complete its review before production. By default,
61
79
  obtain the user's approval; only an authorized `plan_review: delegate` override
62
80
  permits Agent review as described below.
63
81
  Resolve the reporting preference: report after all stages, or after each
64
82
  stage; for stage reports, explicitly establish whether to wait for a reply.
65
83
  Preserve already supplied choices. This project approval does not approve
66
84
  candidate articles or grant missing source, Git or publishing permissions.
67
- 5. If the user requested only research or comparison, finish with the report;
85
+ 8. If the user requested only research or comparison, finish with the report;
68
86
  production needs explicit authorization to execute the plan; review delegation
69
87
  alone does not authorize production for a research-only request. After that approval,
70
88
  follow the authorized Git collaboration process. Hand only
@@ -0,0 +1,167 @@
1
+ # Bring existing knowledge collections into a workspace
2
+
3
+ Use when the project covers knowledge that someone already curated: knowledge
4
+ or wiki repositories (including LLM-maintained wikis), documentation
5
+ directories, another Context workspace, or published knowledge packages.
6
+ This is research guidance for the PLAN; registration and production still
7
+ follow the `context` Skill after approval.
8
+
9
+ ## Identify each collection's kind
10
+
11
+ Inspect the structure before reading bodies. Typical kinds and their signals:
12
+
13
+ | Kind | Signals | Where its value is |
14
+ | --- | --- | --- |
15
+ | Mirror plus summary | A raw or mirror directory of copied documents with source metadata (original link, revision), plus a small set of summary pages | The original documents behind it; the summary layer is secondary |
16
+ | Raw archive | Hundreds or thousands of copied documents or code snapshots, a source list, few distilled pages | Coverage of the originals; needs scoping and batches |
17
+ | Code-curated wiki | Pages written from source code, often with evidence tables naming files, symbols and a code revision | The code it cites; the pages show which questions matter |
18
+ | Maintained first-hand wiki | Organized pages, frequent recent commits by a team, often its own skills, checks or evaluations | The pages themselves; the team keeps them current |
19
+ | Published package or skill | A versioned knowledge package or skill from a registry | Its versioned content; follows its publisher's releases |
20
+
21
+ A collection can contain several kinds; classify parts separately when they
22
+ need different treatment. Record commit activity, owners and last update, since
23
+ they decide whether the collection is still maintained.
24
+
25
+ ## Trace the real upstreams
26
+
27
+ For each collection, list the documents, repositories and other sources its
28
+ pages were built from, using source metadata, source lists, frontmatter, links
29
+ and evidence tables. Deduplicate by actual identity and compare with the
30
+ workspace's registered sources. Record how many are already registered, how
31
+ many are new and stable, and how many are research notes, duplicates, archives
32
+ or empty pages. Report unreadable upstreams as access gaps, not as absent.
33
+
34
+ Estimate what is unique to the collection after removing content that the
35
+ existing articles and the traced upstreams already cover: the collection
36
+ author's own judgments, operating procedures, tables or examples that exist
37
+ nowhere else.
38
+
39
+ ## Compare with the existing knowledge
40
+
41
+ Apply the coverage map in [project-planning.md](project-planning.md). For each
42
+ collection also produce:
43
+
44
+ - **Impact on navigation**: a pruned tree of the existing navigation showing
45
+ which existing articles would be revised, which articles would be added and
46
+ which new subsections are needed. Respect structural constraints from the
47
+ intake, such as keeping the top-level sections; place new topics inside the
48
+ existing sections where readers already look for them.
49
+ - **Conflicts**: statements that disagree with existing articles or with code,
50
+ with both sides quoted briefly. Existing articles can be wrong too.
51
+
52
+ ## Choose an integration approach
53
+
54
+ | Approach | What happens | Content rewritten | Errors correctable from code | Original afterwards |
55
+ | --- | --- | --- | --- | --- |
56
+ | Standard production | Produce articles from the collection's own knowledge: register the collection as a document source (a file source keeping its folders, following its repository version as an origin), or the code its evidence cites (a code-curated wiki then guides which questions to answer) | Yes | Yes | Can be archived once the workspace maintains the topic |
57
+ | Register original upstream | Replace a mirror or summary layer with the original documents it copied; keep only the author's unique judgments as notes | Yes, from the originals | Yes | The summary layer can stop being maintained |
58
+ | Keep unchanged | Keep the collection's pages as they are, placed in the existing sections and selected into a package | No | Only flag when cited code changes | Maintained where it is |
59
+ | In-repository knowledge | Leave the collection in its repository for agents working there; not part of the workspace | No | No | Maintained where it is |
60
+ | Mechanical packaging | Package the collection's files unchanged with a script, outside the workspace | No | No | Maintained where it is |
61
+ | External package source | Install a published package or skill at an exact version and register it as a file source with that origin | Yes | Yes, with code sources | Follows the publisher |
62
+
63
+ Choose per collection, or per part of a collection, using the intake answers:
64
+ where the knowledge really comes from, whether its team keeps maintaining it,
65
+ what must stay unchanged, and how much it overlaps existing articles. Score each
66
+ plausible approach for each collection on a 1–5 fit scale against those intake
67
+ criteria (5 fits best), and show feasibility, effort (for example agent days and
68
+ review time) and risk next to the score. Explain the choice together with its
69
+ benefit and its cost. Approaches can be combined, for example registering the
70
+ upstream of a raw archive while keeping a few distilled pages unchanged.
71
+
72
+ Check what the installed Context actually supports before recommending an
73
+ approach. Approaches the installation cannot perform yet are recorded as options
74
+ with their limitation, not presented as ready. In particular:
75
+
76
+ - A repository source currently has one subpath and no exclusion rules, and
77
+ repository sources are processed as code. A repository that contains only
78
+ Markdown does not enter document production when registered as a repository.
79
+ Register it as a file source that keeps its folders, with the repository and
80
+ commit as its origin, so routine updates follow new commits; or register its
81
+ original upstream instead when it mirrors or summarizes other documents.
82
+ - A file source commits its captured snapshot (documents and the images they
83
+ link), so a very large collection grows the workspace repository; select the
84
+ folders articles need with include rules. Installed origin content itself is
85
+ not committed.
86
+ - Package-only content is available: bind the articles under a hidden knowledge
87
+ map category so they stay out of website navigation, select them into their
88
+ package, and link them from an entry article on the main site. Add the paths to
89
+ the website package's `select.exclude` to leave the pages off the website.
90
+ - Keeping pages unchanged goes through production with `preserve_original: true`
91
+ on the requirement: register the collection as a file source that keeps its
92
+ folders (with its repository and commit as origin when it keeps changing), and
93
+ list the code repositories the pages describe in `evidence_source_scope`.
94
+ Writers keep each page's title, sections, order and wording, cite its lines and
95
+ the code it describes, and propose contradictions with the code for review:
96
+ the user accepts them (also proposing the fix upstream), keeps them only
97
+ locally, or keeps the original. Decisions live in the articles and their
98
+ history. Managed and routine runs revise locally. Each
99
+ page still goes through ordinary batches and review; estimate that cost.
100
+
101
+ When the user chooses an approach the installation cannot perform yet, keep the
102
+ choice, mark the affected stage as blocked by that capability, propose an interim
103
+ approach that can run now (for example mechanical packaging outside the workspace),
104
+ and record the capability dependency in the PLAN.
105
+
106
+ ## Scale and stage limits for collections
107
+
108
+ Count documents by their upstream identity: mirrored copies inside a collection
109
+ are the same documents as their originals, not additional sources. Apply the
110
+ planning scope rules to the distinct upstream documents in this task's scope; a
111
+ large mirror can trigger the human scope question, which may be asked early with
112
+ the evidence already available. The one-new-repository-per-stage limit applies to
113
+ code repositories investigated for production; a collection kept unchanged or
114
+ bypassed in favor of its upstream does not count as a new repository.
115
+
116
+ ## Prepare content that is kept unchanged or packaged mechanically
117
+
118
+ Content that will not be rewritten needs a readiness check before it is selected
119
+ into a package: every page reachable from its index, relative links resolving,
120
+ images and attachments actually present (not placeholders or remote-only files),
121
+ no template or placeholder rows in its source lists, and no credentials or private
122
+ data in logs and build files. Report findings to the owning team instead of
123
+ editing their pages.
124
+
125
+ ## Skills and tools inside collections
126
+
127
+ Collections may carry their own skills, agents or scripts. Do not package them as
128
+ knowledge. Recommend publishing them through the host's skill distribution, and
129
+ assess separately any that write data or call production systems.
130
+
131
+ ## Earlier integrations
132
+
133
+ Check whether the workspace already absorbed an earlier version of a collection,
134
+ for example as notes or articles from a previous project. Record what will
135
+ supersede those notes and which articles they support, so earlier material is not
136
+ duplicated or left contradicting the new sources.
137
+
138
+ ## Following an upstream or absorbing once
139
+
140
+ | Mode | What to do | Afterwards |
141
+ | --- | --- | --- |
142
+ | Follow the upstream | Register the collection, its modules or its originals as sources with fixed versions; a versioned collection or package becomes a file source with an origin | Routine updates follow the upstream; the original team keeps maintaining it |
143
+ | Absorb once | Bring the material in one time — original files as a file source keeping its folders, the author's judgments as notes — and produce articles from it; freeze the file source when the original is archived | The original can be archived; maintenance moves to the workspace |
144
+
145
+ Notes carry summaries and supplements: decisions, procedures, comparisons or
146
+ explanations that exist nowhere else. Do not copy whole summary pages into notes
147
+ when their originals can be registered.
148
+
149
+ ## Packages and navigation
150
+
151
+ Navigation and package scope are independent. A package selects approved
152
+ articles by path patterns or explicit lists, so a new package does not need its
153
+ own top-level section. Explicit lists are normal in an existing workspace whose
154
+ paths are organized by article type; path conventions help mainly for new
155
+ subdirectories, where package selection can then follow new articles
156
+ automatically.
157
+
158
+ When the project produces separate packages, list each package's articles
159
+ individually with their navigation location and status (added, revised, kept
160
+ unchanged, unchanged). Include existing unchanged articles from the navigation
161
+ subtrees the package covers and the articles its new or revised articles link to;
162
+ a large unchanged module may be listed as one row with its page count.
163
+ Content that should appear only in a package, not in website navigation, goes
164
+ under a hidden knowledge map category.
165
+
166
+ State the basis of every overlap figure (pages or characters) and use the same
167
+ basis across collections where possible.
@@ -125,6 +125,11 @@ an unrelated source. Keep approved pages, pending drafts, older package output
125
125
  and previous PLAN deliveries distinct; a draft is pending work, not an approved
126
126
  answer or a reason to produce the same page again.
127
127
 
128
+ When the incoming material is an existing knowledge collection (a wiki or
129
+ knowledge repository, documentation directory, another workspace or a published
130
+ package), also identify its kind, real upstreams and quality as described in
131
+ [knowledge-migration.md](knowledge-migration.md) and [quality-audit.md](quality-audit.md).
132
+
128
133
  Record a compact coverage-and-relationship map in the PLAN, grouping related
129
134
  sources where useful. For each proposed topic, identify the existing page or
130
135
  section, the new material, the actual overlap or gap, useful connections and
@@ -0,0 +1,63 @@
1
+ # Audit the accuracy and freshness of existing knowledge
2
+
3
+ Use during research on an existing knowledge collection, and on existing
4
+ workspace articles that the project will revise. The audit gives evidence for
5
+ the integration approach; it does not correct anything during research.
6
+
7
+ ## Sample claims that code can confirm
8
+
9
+ For each collection, pick about ten concrete claims that the pinned code can
10
+ confirm or refute: service or module names, table and field names, interfaces,
11
+ states and transitions, configuration keys, thresholds and time limits, and
12
+ code paths. Spread the sample across the collection's main areas; prefer claims
13
+ readers would act on.
14
+
15
+ Check each claim against code at a fixed revision. Use already registered or
16
+ locally available repositories first; record repositories you could not read
17
+ instead of cloning unrelated ones. Classify each result:
18
+
19
+ | Result | Meaning |
20
+ | --- | --- |
21
+ | Consistent | The code supports the claim |
22
+ | Partly consistent | The core holds but a detail differs or is incomplete |
23
+ | Inconsistent | The code contradicts the claim |
24
+ | Unverifiable | The claim depends on configuration, data or code that was not available |
25
+
26
+ Record for each claim: the statement, where it appears, the code location, the
27
+ result and, for inconsistencies, what the code actually does.
28
+
29
+ ## Check freshness
30
+
31
+ Note how the collection records currency: update dates, verified revisions,
32
+ status labels. Compare them with the upstream's actual changes, for example
33
+ commits to the cited code since the verified revision, or newer document
34
+ revisions. Flag pages that claim to be current but have not been reviewed
35
+ since material changes.
36
+
37
+ ## Classify the problems
38
+
39
+ Group the inconsistencies and stale items into two kinds:
40
+
41
+ - **Written wrong**: inconsistent with code when written — often names, paths,
42
+ formats or omitted branches. Citing specific code lines while writing and
43
+ reviewing exposes these.
44
+ - **Went stale**: correct once, but the code or rules changed and the page did
45
+ not follow. Comparing cited source regions on scheduled updates exposes these.
46
+
47
+ Include problems found in the existing workspace articles too; the comparison
48
+ is about the method, not about whose content is better.
49
+
50
+ ## Decide how much code evidence each collection needs
51
+
52
+ - Mirrors and summaries of documents: regenerate from the originals and code;
53
+ do not cite the summaries as evidence.
54
+ - Code-curated collections: anchor to current code so drift is detected.
55
+ - Maintained first-hand collections with their own checks: code evidence may be
56
+ limited to flagging changes when they are kept unchanged.
57
+
58
+ ## Report
59
+
60
+ Show the totals per collection, a handful of concrete examples with their
61
+ classification and consequence for readers, and which step of the production
62
+ process would catch each kind of problem. State the cost of that process —
63
+ source registration, review and running scheduled updates — next to its benefit.