@c4a/context-cli 0.7.100 → 0.7.102

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 +1499 -715
  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 +10 -3
  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 +10 -3
  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 +10 -3
  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 +10 -3
  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 +40 -1
  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
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ // Build a single-page research report from Markdown chapters. No dependencies.
3
+ // Usage: node build.mjs <chapters-dir> <out.html> [--title T] [--subtitle S] [--labels labels.json]
4
+ import { readFileSync, readdirSync, writeFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+
7
+ const args = process.argv.slice(2);
8
+ const opt = (k, d) => { const eq = args.find((a) => a.startsWith(`${k}=`)); if (eq) return eq.slice(k.length + 1); const i = args.indexOf(k); return i >= 0 ? args[i + 1] : d; };
9
+ const [dir, out] = args.filter((a, i) => !a.startsWith("--") && !(i > 0 && args[i - 1].startsWith("--") && !args[i - 1].includes("=")));
10
+ if (!dir || !out) { console.error("usage: node build.mjs <chapters-dir> <out.html> [--title T] [--subtitle S] [--labels file]"); process.exit(2); }
11
+ const LABELS = { add: "added", mod: "revised", dir: "new section", keep: "kept unchanged", report: "Report", appendix: "Appendix", outline: "On this chapter", prev: "Previous", next: "Next", copied: "Copied", ...(opt("--labels") ? JSON.parse(readFileSync(opt("--labels"), "utf8")) : {}) };
12
+ const C = { brand: "#2563eb", accent: "#00bec8", ok: "#16a34a", warn: "#d97706", bad: "#dc2626", gray: "#9ca3af", text: "#161e2e", muted: "#646b7c", border: "#e7e9ef" };
13
+ const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
14
+ const unesc = (s) => String(s).replace(/&(amp|lt|gt|quot|#39);/g, (_, e) => ({ amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'" })[e]);
15
+ // Links may only be web, mail, in-page or relative; anything else (javascript:, data:) stays plain text.
16
+ const safeUrl = (u) => { const raw = unesc(u).replace(/[\u0000-\u0020]/g, ""); const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(raw); return !scheme || ["http", "https", "mailto"].includes(scheme[1].toLowerCase()) ? u : null; };
17
+
18
+ // ---------- inline ----------
19
+ const PATH = /^(?:[\p{L}\p{N}_@.+\-]+\/)+(?:[\p{L}\p{N}_@.+\-*]+(?::\d+(?:-\d+)?)?)?$/u;
20
+ const shortPath = (p) => { if (p.length <= 40) return p; const s = p.split("/"); const last = s.pop(); return `${s[0]}/…/${last.length > 32 ? last.slice(0, 14) + "…" + last.slice(-14) : last}`; };
21
+ function inline(t) {
22
+ const codes = [];
23
+ t = t.replace(/`([^`]+)`/g, (_, c) => { codes.push(PATH.test(c) ? `<span class="pc" data-p="${esc(c)}" title="${esc(c)}">${esc(shortPath(c))}</span>` : `<code>${esc(c)}</code>`); return `\u0000${codes.length - 1}\u0000`; });
24
+ t = esc(t)
25
+ .replace(/\*\*(.+?)\*\*/g, "<b>$1</b>")
26
+ .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (_, x, u) => { const safe = safeUrl(u); return safe === null ? x : `<a href="${safe}">${x}</a>`; });
27
+ return t.replace(/\u0000(\d+)\u0000/g, (_, i) => codes[+i]);
28
+ }
29
+
30
+ // ---------- blocks ----------
31
+ function tree(src) {
32
+ const tags = { "[add]": "add", "[mod]": "mod", "[dir]": "dir", "[keep]": "keep" };
33
+ return `<pre class="tree">${src.trimEnd().split("\n").map((l) => {
34
+ const k = Object.keys(tags).find((t) => l.trimEnd().endsWith(t));
35
+ if (!k) return `<span>${esc(l)}</span>`;
36
+ const body = l.trimEnd().slice(0, -k.length).trimEnd(); const m = body.match(/^([│├└─\s]*)(.*)$/u);
37
+ return `<span class="${tags[k]}">${esc(m[1])}<i>${esc(m[2])}</i><em>${esc(LABELS[tags[k]])}</em></span>`;
38
+ }).join("")}</pre>`;
39
+ }
40
+ function chart(src, where) {
41
+ let d; try { d = JSON.parse(src); } catch (e) { throw new Error(`${where}: invalid chart JSON (${e.message})`); } const COLOR = /^#[0-9a-fA-F]{3,8}$/;
42
+ const color = (c, f) => { if (typeof c !== "string" || !COLOR.test(c)) throw new Error(`${where}: ${f} must be a #rgb or #rrggbb colour`); return c; };
43
+ const num = (v, f) => { if (typeof v !== "number" || !Number.isFinite(v)) throw new Error(`${where}: ${f} must be a finite number`); return v; };
44
+ for (const k of ["max", "xmax", "ymax"]) if (d[k] !== undefined) num(d[k], k);
45
+ (d.values || []).forEach((row, i) => row.forEach((v, j) => num(v, `values[${i}][${j}]`)));
46
+ (d.rows || []).forEach((r, i) => (Array.isArray(r.values) ? r.values : []).forEach((v, j) => num(v, `rows[${i}].values[${j}]`)));
47
+ (d.points || []).forEach((p, i) => { num(p.x, `points[${i}].x`); num(p.y, `points[${i}].y`); if (p.color !== undefined) color(p.color, `points[${i}].color`); });
48
+ const pal = (d.colors || [C.ok, C.warn, C.bad, C.gray, C.brand, C.accent]).map((c, i) => color(c, `colors[${i}]`));
49
+ if ((d.type === "matrix" || d.type === undefined || d.type === "bar") && !(d.rows || []).length) throw new Error(`${where}: chart needs at least one row`);
50
+ if (d.type === "scatter" && !(d.points || []).length) throw new Error(`${where}: scatter needs at least one point`);
51
+ if (d.type === "matrix") {
52
+ const W = 160 + d.columns.length * 112, H = 50 + d.rows.length * 38;
53
+ let s = `<svg viewBox="0 0 ${W} ${H}">`;
54
+ d.columns.forEach((c, j) => { s += `<text x="${160 + j * 112 + 56}" y="22" font-size="11" text-anchor="middle" fill="${C.muted}">${esc(c)}</text>`; });
55
+ const rec = new Set((d.recommend || []).map(([r, c]) => `${r},${c}`));
56
+ d.rows.forEach((r, i) => { const mark = (v, j) => d.recommend ? rec.has(`${i},${j}`) : v === Math.max(...d.values[i]); s += `<text x="150" y="${61 + i * 38}" font-size="12" text-anchor="end">${esc(r)}</text>`;
57
+ d.values[i].forEach((v, j) => { const op = 0.15 + 0.85 * v / ((d.max ?? 5) || 1); s += `<rect x="${164 + j * 112}" y="${40 + i * 38}" width="104" height="32" rx="4" fill="${C.brand}" fill-opacity="${op.toFixed(2)}" ${mark(v, j) ? `stroke="${C.text}" stroke-width="2"` : ""}/><text x="${216 + j * 112}" y="${61 + i * 38}" font-size="12" text-anchor="middle" fill="${op > 0.6 ? "#fff" : C.text}" font-weight="${mark(v, j) ? 700 : 400}">${v}</text>`; }); });
58
+ return fig(s + "</svg>", d.title);
59
+ }
60
+ if (d.type === "scatter") {
61
+ const W = 720, H = 320, X = (v) => 70 + v / (d.xmax || 1) * 600, Y = (v) => 280 - v / (d.ymax || 1) * 250;
62
+ let s = `<svg viewBox="0 0 ${W} ${H}"><rect x="70" y="30" width="600" height="250" fill="#f8f9fc" stroke="${C.border}"/>`;
63
+ s += `<text x="370" y="310" font-size="12" text-anchor="middle" fill="${C.muted}">${esc(d.xlabel || "")}</text><text x="20" y="155" font-size="12" text-anchor="middle" fill="${C.muted}" transform="rotate(-90 20 155)">${esc(d.ylabel || "")}</text>`;
64
+ d.points.forEach((p) => { s += `<circle cx="${X(p.x)}" cy="${Y(p.y)}" r="8" fill="${p.color || C.brand}"/><text x="${X(p.x) + 13}" y="${Y(p.y) - 2}" font-size="12.5" font-weight="700">${esc(p.label)}</text>${p.note ? `<text x="${X(p.x) + 13}" y="${Y(p.y) + 14}" font-size="11" fill="${C.muted}">${esc(p.note)}</text>` : ""}`; });
65
+ return fig(s + "</svg>", d.title);
66
+ }
67
+ const max = (d.max ?? Math.max(...d.rows.map((r) => r.values.reduce((a, b) => a + b, 0)))) || 1; const W = 760, L = 130, R = 190, bw = W - L - R;
68
+ let s = `<svg viewBox="0 0 ${W} ${d.rows.length * 34 + 20}">`;
69
+ d.rows.forEach((r, i) => { const y = 10 + i * 34; let x = L; s += `<text x="${L - 10}" y="${y + 15}" font-size="12" text-anchor="end">${esc(r.label)}</text>`;
70
+ r.values.forEach((v, j) => { const w = Math.max(v / max * bw, v > 0 ? 2 : 0); s += `<rect x="${x}" y="${y}" width="${w}" height="20" rx="3" fill="${pal[j % pal.length]}"/>`; if (d.segmentLabels && w > 22) s += `<text x="${x + w / 2}" y="${y + 14}" font-size="11" text-anchor="middle" fill="#fff">${v}</text>`; x += w; });
71
+ s += `<text x="${x + 8}" y="${y + 15}" font-size="12" fill="${C.muted}">${esc(r.note ?? r.values.reduce((a, b) => a + b, 0) + (d.unit || ""))}</text>`; });
72
+ const legend = (d.legend || []).map((l, j) => `<span><b style="background:${pal[j % pal.length]}"></b>${esc(l)}</span>`).join("");
73
+ return fig(s + "</svg>", d.title, legend);
74
+ }
75
+ const fig = (svg, cap, legend = "") => `<figure>${svg}${legend ? `<div class="lg">${legend}</div>` : ""}${cap ? `<figcaption>${esc(cap)}</figcaption>` : ""}</figure>`;
76
+
77
+ function render(md, file = "") {
78
+ const lines = md.replace(/\r/g, "").split("\n"); let h = ""; let i = 0;
79
+ const isTable = (l) => /^\s*\|.*\|\s*$/.test(l);
80
+ while (i < lines.length) {
81
+ const l = lines[i];
82
+ const fence = l.match(/^```(\w*)/);
83
+ if (fence) { const body = []; i++; while (i < lines.length && !lines[i].startsWith("```")) body.push(lines[i++]); i++;
84
+ const b = body.join("\n"); h += fence[1] === "tree" ? tree(b) : fence[1] === "chart" ? chart(b, `${file}:${i}`) : `<pre><code>${esc(b)}</code></pre>`; continue; }
85
+ const hd = l.match(/^(#{1,4})\s+(.*)$/); if (hd) { h += `<h${hd[1].length}>${inline(hd[2])}</h${hd[1].length}>`; i++; continue; }
86
+ if (isTable(l) && i + 1 < lines.length && /^\s*\|[\s:|-]+\|\s*$/.test(lines[i + 1])) {
87
+ const cells = (r) => r.trim().slice(1, -1).replace(/`[^`]*`/g, (m) => m.replace(/\|/g, "\u0001")).split("|").map((c) => c.trim().replace(/\u0001/g, "|"));
88
+ h += `<div class="tw"><table><thead><tr>${cells(l).map((c) => `<th>${inline(c)}</th>`).join("")}</tr></thead><tbody>`; i += 2;
89
+ while (i < lines.length && isTable(lines[i])) h += `<tr>${cells(lines[i++]).map((c) => `<td>${inline(c)}</td>`).join("")}</tr>`;
90
+ h += "</tbody></table></div>"; continue; }
91
+ if (/^>\s?/.test(l)) { const q = []; while (i < lines.length && /^>\s?/.test(lines[i])) q.push(lines[i++].replace(/^>\s?/, "")); h += `<blockquote><p>${inline(q.join(" "))}</p></blockquote>`; continue; }
92
+ const li = l.match(/^(\s*)([-*]|\d+\.)\s+(.*)$/);
93
+ if (li) { const ordered = /\d/.test(li[2]); h += ordered ? "<ol>" : "<ul>";
94
+ while (i < lines.length) { const m = lines[i].match(/^(\s*)([-*]|\d+\.)\s+(.*)$/); if (!m) { if (/^\s{2,}\S/.test(lines[i])) { h = h.replace(/<\/li>$/, ` ${inline(lines[i].trim())}</li>`); i++; continue; } break; }
95
+ h += `<li${m[1].length ? ' class="sub"' : ""}>${inline(m[3])}</li>`; i++; }
96
+ h += ordered ? "</ol>" : "</ul>"; continue; }
97
+ if (!l.trim()) { i++; continue; }
98
+ const p = []; while (i < lines.length && lines[i].trim() && !/^(#{1,4}\s|```|>|\s*([-*]|\d+\.)\s)/.test(lines[i]) && !isTable(lines[i])) p.push(lines[i++]);
99
+ h += `<p>${inline(p.join(" "))}</p>`;
100
+ }
101
+ return h;
102
+ }
103
+
104
+ // ---------- page ----------
105
+ const files = readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
106
+ let nav = "", body = "", n = 0, inApp = false;
107
+ try { files.forEach((f, k) => {
108
+ const app = /^[A-Z][-_.]/.test(f); const id = `c${k + 1}`; let title = f;
109
+ const html = render(readFileSync(join(dir, f), "utf8"), f).replace(/<h([1-3])>(.*?)<\/h\1>/g, (m, lv, t) => { if (lv === "1") { title = unesc(t.replace(/<[^>]+>/g, "")); return m; } n++; return `<h${lv} id="${id}-${n}">${t}</h${lv}>`; });
110
+ if (app && !inApp) { nav += `<div class="cap">${esc(LABELS.appendix)}</div>`; inApp = true; }
111
+ nav += `<a href="#${id}" data-ch="${id}">${app ? "" : `<span>${k + 1}</span>`}${esc(title)}</a>`;
112
+ body += `<article class="ch" id="${id}" data-title="${esc(title)}">${html}<div class="pager"></div></article>`;
113
+ }); } catch (e) { console.error(`build failed: ${e.message}`); process.exit(1); }
114
+ const title = opt("--title", "Research report"), sub = opt("--subtitle", "");
115
+ writeFileSync(out, `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${esc(title)}</title><style>
116
+ *{box-sizing:border-box}body{margin:0;font:15px/1.8 Inter,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;color:${C.text}}
117
+ header{position:fixed;inset:0 0 auto;height:56px;display:flex;align-items:center;gap:12px;padding:0 24px;border-bottom:1px solid ${C.border};background:#fffffff2;z-index:2}header span{color:${C.muted};font-size:13px}
118
+ #side{position:fixed;top:56px;bottom:0;left:0;width:260px;overflow:auto;padding:20px 14px;background:#f8f9fc;border-right:1px solid ${C.border}}#side a{display:flex;gap:8px;padding:6px 10px;border-radius:7px;color:${C.text};text-decoration:none;font-size:14px}#side a span{color:${C.muted}}#side a.on{background:#e8efff;color:${C.brand};font-weight:600}.cap{font-size:12px;color:${C.muted};margin:18px 10px 6px}
119
+ main{margin:0 230px 0 260px;padding:80px 48px 100px}.ch{display:none;max-width:940px;margin:auto}.ch.on{display:block}
120
+ #out{position:fixed;top:56px;right:0;bottom:0;width:230px;overflow:auto;padding:28px 16px;border-left:1px solid ${C.border}}#out a{display:block;color:${C.muted};text-decoration:none;font-size:13px;padding:3px 8px;border-left:2px solid transparent}#out a.h3{padding-left:20px}#out a.on{color:${C.brand};border-color:${C.brand}}
121
+ h1{font-size:28px}h2{font-size:21px;margin-top:36px;padding-top:18px;border-top:1px solid ${C.border}}h2,h3{scroll-margin-top:70px}a{color:${C.brand}}code{background:#f1f3f7;padding:1px 5px;border-radius:4px;font-size:13px}
122
+ pre{background:#f6f8fa;border:1px solid ${C.border};border-radius:8px;padding:12px 16px;overflow:auto;line-height:1.6}.tw{overflow-x:auto}table{border-collapse:collapse;width:100%;font-size:13.5px}th,td{border:1px solid ${C.border};padding:7px 10px;text-align:left;vertical-align:top}th{background:#f8f9fc}
123
+ blockquote{margin:0 0 20px;padding:10px 16px;border-left:4px solid ${C.brand};background:#f3f7ff}li.sub{margin-left:20px}
124
+ figure{margin:18px 0;padding:14px;border:1px solid ${C.border};border-radius:10px}figure svg{width:100%;height:auto}figcaption{text-align:center;color:${C.muted};font-size:13px}.lg{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:${C.muted}}.lg b{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:5px}
125
+ .pc{font:12.5px ui-monospace,monospace;background:#f1f3f7;border:1px solid #e5e8ef;border-radius:5px;padding:0 6px;cursor:copy;white-space:nowrap}td .pc{display:table;margin:2px 0}
126
+ .tree{font:13px/1.65 ui-monospace,"PingFang SC",monospace}.tree span{display:block}.tree i{font-style:normal;padding:0 4px;border-radius:4px}.tree em{font-style:normal;font-size:12px;margin-left:10px;padding:0 6px;border-radius:9px;color:#fff}
127
+ .tree .add i{background:#dcfce7}.tree .add em{background:${C.ok}}.tree .mod i{background:#fef3c7}.tree .mod em{background:${C.warn}}.tree .dir i{background:#dbeafe;font-weight:600}.tree .dir em{background:${C.brand}}.tree .keep i{background:#cffafe}.tree .keep em{background:#0891b2}
128
+ .pager{display:flex;justify-content:space-between;gap:16px;margin-top:48px}.pager a{flex:1;border:1px solid ${C.border};border-radius:10px;padding:10px 14px;text-decoration:none;color:${C.text}}.pager small{display:block;color:${C.muted}}
129
+ @media(max-width:1200px){#out{display:none}main{margin-right:0}}@media(max-width:820px){#side{display:none}main{margin-left:0;padding:72px 16px}}
130
+ </style></head><body><header><b>${esc(title)}</b><span>${esc(sub)}</span></header><nav id="side"><div class="cap">${esc(LABELS.report)}</div>${nav}</nav><main>${body}</main><aside id="out"></aside><script>
131
+ const CH=[...document.querySelectorAll('.ch')],S=[...document.querySelectorAll('#side a')],O=document.getElementById('out');let H=[],A=[];
132
+ const OUTLINE=${JSON.stringify(LABELS.outline).replace(/</g, "\\u003c")},PREV=${JSON.stringify(LABELS.prev).replace(/</g, "\\u003c")},NEXT=${JSON.stringify(LABELS.next).replace(/</g, "\\u003c")};
133
+ // Build navigation from text nodes only; titles never become markup.
134
+ function link(cls,id,small,text){const a=document.createElement('a');if(cls)a.className=cls;a.href='#'+id;if(small){const s=document.createElement('small');s.textContent=small;a.append(s)}a.append(document.createTextNode(text||''));return a}
135
+ function show(h){let e=document.getElementById((h||'').slice(1)),t=null;if(!e||!e.classList.contains('ch')){t=e;e=e?e.closest('.ch'):CH[0]}
136
+ CH.forEach(c=>c.classList.toggle('on',c===e));S.forEach(a=>a.classList.toggle('on',a.dataset.ch===e.id));H=[...e.querySelectorAll('h2,h3')];
137
+ O.replaceChildren();if(H.length){const b=document.createElement('b');b.style.fontSize='13px';b.textContent=OUTLINE;O.append(b,...H.map(x=>link(x.tagName.toLowerCase(),x.id,null,x.textContent)))}A=[...O.querySelectorAll('a')];
138
+ const i=CH.indexOf(e),p=CH[i-1],n=CH[i+1],pg=e.querySelector('.pager');pg.replaceChildren(p?link('',p.id,PREV,p.dataset.title):document.createElement('span'),n?link('',n.id,NEXT,n.dataset.title):document.createElement('span'));
139
+ t?t.scrollIntoView():scrollTo(0,0);spy()}
140
+ function spy(){let k=-1;H.forEach((x,i)=>{if(x.getBoundingClientRect().top<100)k=i});A.forEach((a,i)=>a.classList.toggle('on',i===k))}
141
+ document.addEventListener('click',e=>{const c=e.target.closest('.pc');if(!c)return;navigator.clipboard&&navigator.clipboard.writeText(c.dataset.p);const o=c.textContent;c.textContent=${JSON.stringify(LABELS.copied).replace(/</g, "\\u003c")};setTimeout(()=>c.textContent=o,900)});
142
+ addEventListener('hashchange',()=>show(location.hash));addEventListener('scroll',spy,{passive:true});show(location.hash);
143
+ </script></body></html>`);
144
+ console.log(`${out}: ${files.length} chapters`);
@@ -0,0 +1,28 @@
1
+ # Conclusions and recommendation
2
+
3
+ > **Conclusion**: both collections can be integrated, with different approaches.
4
+
5
+ ## At a glance
6
+
7
+ | Collection | Kind | Approach |
8
+ | --- | --- | --- |
9
+ | Wiki A | Mirror plus summary | Register original upstream |
10
+ | Wiki B | Code-curated wiki | Standard production |
11
+
12
+ ```chart
13
+ {"title": "Code check results", "legend": ["consistent", "partial", "inconsistent", "unverifiable"],
14
+ "rows": [{"label": "Wiki A", "values": [7, 0, 2, 1]}, {"label": "Wiki B", "values": [11, 0, 0, 1]}]}
15
+ ```
16
+
17
+ ## Impact on navigation
18
+
19
+ ```tree
20
+ Knowledge base
21
+ ├── Business
22
+ │ └── Billing rules [mod]
23
+ └── Operations
24
+ └── Incident handbook [dir]
25
+ └── Escalation [add]
26
+ ```
27
+
28
+ Evidence lives in `docs/runbooks/billing/escalation-and-on-call-handbook.md`.
@@ -0,0 +1,10 @@
1
+ # Wiki A
2
+
3
+ ## Overview
4
+
5
+ - **Kind**: mirror plus summary
6
+ - **Upstreams**: 79 documents, 15 already registered
7
+
8
+ ```chart
9
+ {"type": "matrix", "title": "Approach scores", "columns": ["Standard", "Upstream", "Unchanged"], "rows": ["Wiki A"], "values": [[4, 5, 2]], "max": 5}
10
+ ```
@@ -2,7 +2,7 @@
2
2
  "schema": "agent-graph.bundle.v1",
3
3
  "provider": {
4
4
  "id": "c4a/context",
5
- "version": "0.7.100"
5
+ "version": "0.7.102"
6
6
  },
7
7
  "providerManifest": "provider.yaml",
8
8
  "graphs": [
@@ -198,7 +198,7 @@
198
198
  {
199
199
  "id": "context.sdk.package-outputs",
200
200
  "path": "resources/manuals/guides/package-outputs.md",
201
- "digest": "sha256:26131be68903dea2a79d098f4d206ddc637a485488d7aac910eb253e00e06c75"
201
+ "digest": "sha256:20e7be0fb7b40221df448f9b644b782fe417b3c41627d63d55f317cdeda47460"
202
202
  },
203
203
  {
204
204
  "id": "context.sdk.package-templates",
@@ -323,12 +323,12 @@
323
323
  {
324
324
  "id": "procedure.knowledge-review",
325
325
  "path": "resources/procedures/knowledge-review.md",
326
- "digest": "sha256:bc8e0de7d9a94480b21373074bb18deb50ab532327e18bb734cc762afa5e09dd"
326
+ "digest": "sha256:0608d129f3134501b3f9d9f856d0149328c1e6761c6c707826f274d504e10774"
327
327
  },
328
328
  {
329
329
  "id": "procedure.knowledge-updates",
330
330
  "path": "resources/procedures/knowledge-updates.md",
331
- "digest": "sha256:cea8c52aa3144586a3bc3a27d6d042b11046c1df7778e4f3a6ec297883eaf335"
331
+ "digest": "sha256:08fe0c29905aa64b47d311dee0297d427ccab7a3e3a2ad7cb6a559b1f636184b"
332
332
  },
333
333
  {
334
334
  "id": "procedure.note",
@@ -348,12 +348,12 @@
348
348
  {
349
349
  "id": "procedure.production-requirements",
350
350
  "path": "resources/procedures/production-requirements.md",
351
- "digest": "sha256:af042f16b3cdbb33db48f4ab318293a96e23eeb10b82686bc54ec7d0372afbbd"
351
+ "digest": "sha256:d9f6339331049eb04f18a31ae54e0fd959b6c58124e6508ca0549e9965dc6d8a"
352
352
  },
353
353
  {
354
354
  "id": "procedure.production-stage-files",
355
355
  "path": "resources/procedures/production-stage-files.md",
356
- "digest": "sha256:8e4a54018ddc458f325c0f9c3dec3f477a1c2310d92bda55473d5ee7d0316919"
356
+ "digest": "sha256:6e343725e1dd5bdb3e90420ca58a69b5b0548859bf7b260c214c44eaf3583d3c"
357
357
  },
358
358
  {
359
359
  "id": "procedure.project-configuration",
@@ -383,7 +383,7 @@
383
383
  {
384
384
  "id": "procedure.source-capture-detailed",
385
385
  "path": "resources/procedures/source-capture-detailed.md",
386
- "digest": "sha256:1cc431617b39e474d97bc7491d43b88b2fc5e66b8678369d48dd973243da634f"
386
+ "digest": "sha256:6426f37d404d5135fca90e289a66d07c27e4e95599c7fac2ebf7c759d76c9565"
387
387
  },
388
388
  {
389
389
  "id": "procedure.source-update",
@@ -445,7 +445,7 @@
445
445
  {
446
446
  "id": "schemas/indexer-agent-step-result.schema.json",
447
447
  "path": "schemas/indexer-agent-step-result.schema.json",
448
- "digest": "sha256:56d6ead3dc53b5a56079e04385c7b2293a017c19d33762ca9ba8307ae0684ecc"
448
+ "digest": "sha256:a45fca882baad60ff0e7de7407fa30df89b2eba7204343df8f4008a2f71a26f5"
449
449
  },
450
450
  {
451
451
  "id": "context.indexer.registry-bootstrap",
@@ -598,7 +598,7 @@
598
598
  },
599
599
  {
600
600
  "path": "provider.yaml",
601
- "digest": "sha256:749ea9a94cd4a43b22b6f267b3a2226d760ae5d3f6ff72c39cbe0b74b310d2aa"
601
+ "digest": "sha256:6c92dffa4f1269a6b31204d669df469522292fa3bf841c9cacc1ac40756a0837"
602
602
  },
603
603
  {
604
604
  "path": "resources/contracts/indexer-provider-guide.yaml",
@@ -658,7 +658,7 @@
658
658
  },
659
659
  {
660
660
  "path": "resources/manuals/guides/knowledge-updates.md",
661
- "digest": "sha256:9d708ae727e4ae7be5427720ee1ba02d33fce8848d05a258ac1081ce62fa8407"
661
+ "digest": "sha256:380c6f978c7275c621bce8ee0207b566b66c19db899765ca0b455c4df1782928"
662
662
  },
663
663
  {
664
664
  "path": "resources/manuals/guides/lark-resources.md",
@@ -674,7 +674,7 @@
674
674
  },
675
675
  {
676
676
  "path": "resources/manuals/guides/package-outputs.md",
677
- "digest": "sha256:26131be68903dea2a79d098f4d206ddc637a485488d7aac910eb253e00e06c75"
677
+ "digest": "sha256:20e7be0fb7b40221df448f9b644b782fe417b3c41627d63d55f317cdeda47460"
678
678
  },
679
679
  {
680
680
  "path": "resources/manuals/guides/page-customization.md",
@@ -750,11 +750,11 @@
750
750
  },
751
751
  {
752
752
  "path": "resources/procedures/knowledge-review.md",
753
- "digest": "sha256:bc8e0de7d9a94480b21373074bb18deb50ab532327e18bb734cc762afa5e09dd"
753
+ "digest": "sha256:0608d129f3134501b3f9d9f856d0149328c1e6761c6c707826f274d504e10774"
754
754
  },
755
755
  {
756
756
  "path": "resources/procedures/knowledge-updates.md",
757
- "digest": "sha256:cea8c52aa3144586a3bc3a27d6d042b11046c1df7778e4f3a6ec297883eaf335"
757
+ "digest": "sha256:08fe0c29905aa64b47d311dee0297d427ccab7a3e3a2ad7cb6a559b1f636184b"
758
758
  },
759
759
  {
760
760
  "path": "resources/procedures/note.md",
@@ -770,11 +770,11 @@
770
770
  },
771
771
  {
772
772
  "path": "resources/procedures/production-requirements.md",
773
- "digest": "sha256:af042f16b3cdbb33db48f4ab318293a96e23eeb10b82686bc54ec7d0372afbbd"
773
+ "digest": "sha256:d9f6339331049eb04f18a31ae54e0fd959b6c58124e6508ca0549e9965dc6d8a"
774
774
  },
775
775
  {
776
776
  "path": "resources/procedures/production-stage-files.md",
777
- "digest": "sha256:8e4a54018ddc458f325c0f9c3dec3f477a1c2310d92bda55473d5ee7d0316919"
777
+ "digest": "sha256:6e343725e1dd5bdb3e90420ca58a69b5b0548859bf7b260c214c44eaf3583d3c"
778
778
  },
779
779
  {
780
780
  "path": "resources/procedures/project-configuration.md",
@@ -798,7 +798,7 @@
798
798
  },
799
799
  {
800
800
  "path": "resources/procedures/source-capture-detailed.md",
801
- "digest": "sha256:1cc431617b39e474d97bc7491d43b88b2fc5e66b8678369d48dd973243da634f"
801
+ "digest": "sha256:6426f37d404d5135fca90e289a66d07c27e4e95599c7fac2ebf7c759d76c9565"
802
802
  },
803
803
  {
804
804
  "path": "resources/procedures/source-update.md",
@@ -870,7 +870,7 @@
870
870
  },
871
871
  {
872
872
  "path": "schemas/indexer-agent-step-result.schema.json",
873
- "digest": "sha256:56d6ead3dc53b5a56079e04385c7b2293a017c19d33762ca9ba8307ae0684ecc"
873
+ "digest": "sha256:a45fca882baad60ff0e7de7407fa30df89b2eba7204343df8f4008a2f71a26f5"
874
874
  },
875
875
  {
876
876
  "path": "schemas/indexer-registry-bootstrap.schema.json",
@@ -921,5 +921,5 @@
921
921
  "indexer": [],
922
922
  "workspace": []
923
923
  },
924
- "digest": "sha256:f7312a4a6cafc19fc24ae685941d65eb8eb842753d22a54569c7a925160a9386"
924
+ "digest": "sha256:9b5a6245148db2dfa6c592472c1b9a08acd1b42f52c93127c3db5116bb08f0ad"
925
925
  }
@@ -1,6 +1,6 @@
1
1
  schema: agent-graph.provider.v1
2
2
  id: c4a/context
3
- version: 0.7.100
3
+ version: 0.7.102
4
4
  name: Context workflow
5
5
  description: Internal work contract for Context knowledge workspaces.
6
6
  graphs:
@@ -231,6 +231,8 @@ production or after completion through the same adjustment; no active Indexer
231
231
  task, source recapture or new mode choice is required. Finish or revoke active
232
232
  worker assignments before changing the map. Preserve unrelated entries and page
233
233
  identities. The map controls website navigation and LLMS organization together.
234
+ Mark a category entry `hidden: true` to keep its articles in packages and LLMS but
235
+ out of website navigation; they still count as placed.
234
236
 
235
237
  For each new or changed article, the Agent decides whether to retain its current
236
238
  placement, add another placement, move it, or create a warranted category. Check
@@ -454,6 +456,51 @@ Before importing a `note`, read [note source preparation](note.md).
454
456
  Before importing `sessions`, read [development summary preparation](sessions.md).
455
457
  Choose the reference for the actual input; do not read both by default.
456
458
 
459
+ ## Versioned external content and archived collections
460
+
461
+ Published content that another team versions, such as a documentation
462
+ repository, a released knowledge package or a released Skill, can be a `file`
463
+ source with an origin. Context never installs it: you install the exact version
464
+ as real files, Context checks the directory, records each file's fingerprint in
465
+ the snapshot and cites it like any local document.
466
+
467
+ ```bash
468
+ context source add file <name> --layout tree \
469
+ --local sources/<kind>/<name>@<version>[/<subdir>] \
470
+ --origin-kind <kind> --origin-id <id> --origin-version <version> [--origin-url <url>]
471
+ ```
472
+
473
+ - Install outside the workspace with the origin's own tool so it cannot write
474
+ locks or tool configuration into the workspace, then copy the real files into
475
+ `sources/<kind>/<name>@<version>/`. Do not link them. Registration adds
476
+ `sources/<kind>/` to `.gitignore`; only the registry and the captured snapshot
477
+ are committed. The registration output's `origin.install_hint` gives the
478
+ command for known kinds (`git` is built in).
479
+ - `--layout tree` keeps folders and the images documents link to. Markdown is
480
+ the default; add `--document-ext .json --document-ext .yaml` to cite small
481
+ structured files as text. Images are kept as assets, not citations. A missing,
482
+ oversized (over 5 MB), conflicting or out-of-source image is reported in
483
+ `asset_gaps` and stays a link; capture continues. Choose the layout before
484
+ articles cite the source: switching it later moves snapshot paths, so the
485
+ citations need the same treatment as a renamed file.
486
+ - **Upgrade.** Compare the available version with `origin.version` (the
487
+ registration output may give a `versions_command`). Same version: skip. A
488
+ newer one: install it into a new `<name>@<new>` directory, rerun `source add
489
+ file <name> --local <new dir> --origin-version <new>`, then capture. The
490
+ snapshot fingerprints show which files changed; revise the pages citing them as
491
+ for any document change, then delete the old version directory.
492
+ - **Restore.** In a fresh clone the install directory is absent. Capture then
493
+ reports a deferred acquisition gap whose `next` is the install command for the
494
+ registered version; install that exact version, not the latest.
495
+ - Register content as a source only when articles cite it. Content that readers
496
+ only need to find stays an import.
497
+
498
+ To absorb a collection once instead of following it, register its folder with
499
+ `--layout tree`, capture it, write the author's own judgments as notes, and
500
+ produce articles. When the original is archived, run `context source add file
501
+ <name> --freeze`: the snapshot stays citable and capture no longer reads the
502
+ local path. `--unfreeze` allows capturing again.
503
+
457
504
  ## Save text without an external file
458
505
 
459
506
  Use `context source import --input <file|-> --format json`:
@@ -149,6 +149,14 @@ return the missing article list plus a navigation-only task adjustment input.
149
149
  Category nodes can remain empty while future articles are planned. The builder
150
150
  does not infer business categories or alter article content.
151
151
 
152
+ An entry with `hidden: true` keeps itself and its descendants out of the website
153
+ sidebar, top navigation and the "All articles" fallback. Articles bound under it
154
+ count as placed, keep their pages and URLs on the website when the package
155
+ selects them, and stay listed in knowledge-package navigation and LLMS. Use it for
156
+ content that belongs in packages but not in website navigation, linked from an
157
+ entry article; add `select.exclude` to the website package as well to leave the
158
+ pages out of the website entirely.
159
+
152
160
  Top navigation contains the first-level reading directories. Selecting
153
161
  a section shows only its descendants in the left sidebar; opening an article
154
162
  directly selects its section. Skills and their Markdown references remain
@@ -37,6 +37,19 @@ No review code or special approval phrase is required. When the report's
37
37
  `navigation.changes` is not empty, name those menu changes (added, removed,
38
38
  renamed, pointing elsewhere) in the confirmation request.
39
39
 
40
+ When the report returns `original_revisions`, the batch proposes revisions to
41
+ pages kept as written. Run `context review original-revisions --format json`
42
+ and present each proposal with its original text, revision and evidence. The
43
+ user chooses per proposal and the choice is applied to the article: `upstream`
44
+ keeps the revision and proposes the correction to the original document through
45
+ the knowledge-updates guide's optional upstream correction (a remote write still
46
+ needs its own authorization), `local` keeps the revision only here, and `keep`
47
+ restores the original passage while keeping its code citation. Record each
48
+ outcome in the batch's changelog entry or commit message, then remove the
49
+ proposals with `context review original-revisions --resolve <id|all>`. In fully
50
+ managed and routine runs keep the revisions locally and list them in the run
51
+ report so the user can change them later.
52
+
40
53
  For old automation, `review approve-all --force` remains a deprecated explicit
41
54
  approval alias and applies the current candidate scope without requiring a new
42
55
  report. Prefer `--confirmed` for new calls. The CLI also accepts existing legacy
@@ -231,6 +231,8 @@ production or after completion through the same adjustment; no active Indexer
231
231
  task, source recapture or new mode choice is required. Finish or revoke active
232
232
  worker assignments before changing the map. Preserve unrelated entries and page
233
233
  identities. The map controls website navigation and LLMS organization together.
234
+ Mark a category entry `hidden: true` to keep its articles in packages and LLMS but
235
+ out of website navigation; they still count as placed.
234
236
 
235
237
  For each new or changed article, the Agent decides whether to retain its current
236
238
  placement, add another placement, move it, or create a warranted category. Check
@@ -454,6 +456,51 @@ Before importing a `note`, read [note source preparation](note.md).
454
456
  Before importing `sessions`, read [development summary preparation](sessions.md).
455
457
  Choose the reference for the actual input; do not read both by default.
456
458
 
459
+ ## Versioned external content and archived collections
460
+
461
+ Published content that another team versions, such as a documentation
462
+ repository, a released knowledge package or a released Skill, can be a `file`
463
+ source with an origin. Context never installs it: you install the exact version
464
+ as real files, Context checks the directory, records each file's fingerprint in
465
+ the snapshot and cites it like any local document.
466
+
467
+ ```bash
468
+ context source add file <name> --layout tree \
469
+ --local sources/<kind>/<name>@<version>[/<subdir>] \
470
+ --origin-kind <kind> --origin-id <id> --origin-version <version> [--origin-url <url>]
471
+ ```
472
+
473
+ - Install outside the workspace with the origin's own tool so it cannot write
474
+ locks or tool configuration into the workspace, then copy the real files into
475
+ `sources/<kind>/<name>@<version>/`. Do not link them. Registration adds
476
+ `sources/<kind>/` to `.gitignore`; only the registry and the captured snapshot
477
+ are committed. The registration output's `origin.install_hint` gives the
478
+ command for known kinds (`git` is built in).
479
+ - `--layout tree` keeps folders and the images documents link to. Markdown is
480
+ the default; add `--document-ext .json --document-ext .yaml` to cite small
481
+ structured files as text. Images are kept as assets, not citations. A missing,
482
+ oversized (over 5 MB), conflicting or out-of-source image is reported in
483
+ `asset_gaps` and stays a link; capture continues. Choose the layout before
484
+ articles cite the source: switching it later moves snapshot paths, so the
485
+ citations need the same treatment as a renamed file.
486
+ - **Upgrade.** Compare the available version with `origin.version` (the
487
+ registration output may give a `versions_command`). Same version: skip. A
488
+ newer one: install it into a new `<name>@<new>` directory, rerun `source add
489
+ file <name> --local <new dir> --origin-version <new>`, then capture. The
490
+ snapshot fingerprints show which files changed; revise the pages citing them as
491
+ for any document change, then delete the old version directory.
492
+ - **Restore.** In a fresh clone the install directory is absent. Capture then
493
+ reports a deferred acquisition gap whose `next` is the install command for the
494
+ registered version; install that exact version, not the latest.
495
+ - Register content as a source only when articles cite it. Content that readers
496
+ only need to find stays an import.
497
+
498
+ To absorb a collection once instead of following it, register its folder with
499
+ `--layout tree`, capture it, write the author's own judgments as notes, and
500
+ produce articles. When the original is archived, run `context source add file
501
+ <name> --freeze`: the snapshot stays citable and capture no longer reads the
502
+ local path. `--unfreeze` allows capturing again.
503
+
457
504
  ## Save text without an external file
458
505
 
459
506
  Use `context source import --input <file|-> --format json`:
@@ -46,6 +46,13 @@ exclusions:
46
46
  omit it only for a confirmed exclusion of the whole selected source scope.
47
47
  Do not automatically exclude something merely because it is large or costly.
48
48
 
49
+ `preserve_original: true` keeps the target pages as written: each article keeps
50
+ its page's title, sections and order, and contradictions with the code are
51
+ recorded as proposals instead of silent edits. List the code repositories the
52
+ pages describe in its `evidence_source_scope`, so writers can cite and check
53
+ that code. Writers follow "Pages kept as written" in the production stage files
54
+ guide.
55
+
49
56
  Do not add Provider selections, versions, hashes, run identifiers, candidate
50
57
  receipts or task assignments. Those are not long-term requirements. Skills and
51
58
  writing batches are declared in the temporary investigation plan.
@@ -56,7 +56,9 @@ During an approved stage, use the existing plan-amendment path for in-scope
56
56
  additions and preserve completed work. Do not restart planning solely because
57
57
  another article is ready to write. Keep remaining investigation explicit; a small
58
58
  current task does not mean other authorized work is finished. New source or purpose
59
- authorization still follows the current Route.
59
+ authorization still follows the current Route. When an amendment replaces a task,
60
+ its result lists `previous_drafts`: copy each `from` directory's draft files into
61
+ its `to` directory, then revise them for the new task instead of starting over.
60
62
 
61
63
  Write results under the returned Agent directory. All submission paths are
62
64
  relative to `.tmp/agent-work/production-stages/<stage>/`, even when the manifest is in `submissions/`. They are never relative to `.tmp/context-runtime/` or to the manifest location. Each task lists the complete workspace-relative Markdown and reference output paths.
@@ -109,6 +111,43 @@ To cancel that pause explicitly, use `context run --resume-writing --format json
109
111
  It preserves approved articles, candidates and existing task input handles.
110
112
  Partial delivery must include the approved articles needed by its local links.
111
113
 
114
+ ### Pages kept as written
115
+
116
+ When the task's requirement in `shared/requirements.md` has
117
+ `preserve_original: true`, reproduce each original page as an article: keep its
118
+ title, section headings and the main order of its content, and keep its wording.
119
+ Cite each section's original lines, and also cite the code a passage describes
120
+ from the requirement's `evidence_source_scope`, so later code changes reach the
121
+ article.
122
+
123
+ Where a passage contradicts the cited code or describes behavior the code no
124
+ longer has, write the corrected text in the article and propose the revision
125
+ with `context review original-revisions --propose <file|-> --format json`:
126
+
127
+ ```yaml
128
+ revisions:
129
+ - id: limits-default
130
+ article: guides/limits.md # knowledge path of the article
131
+ section: limits
132
+ original: { source_ref: file:wiki, locator: { path: limits.md, start_line: 3, end_line: 3 } }
133
+ revised: "The limit is 5."
134
+ reason: stale # wrong: never matched the code; stale: the code changed since
135
+ evidence:
136
+ - { source_ref: repo:service, locator: { path: src/limits.ts, start_line: 1, end_line: 1 } }
137
+ ```
138
+
139
+ Context reads the original passage and keeps the proposal with the current
140
+ batch under the workspace write lock, so parallel writers do not overwrite each
141
+ other. Proposals are temporary: once the user decides, the article carries the
142
+ decision. Do not correct wording, style or structure that the code does not
143
+ contradict.
144
+
145
+ Before proposing a correction for an existing article, read its Git history and
146
+ the workspace changelog: a contradiction the user already chose to keep stays
147
+ kept and is not proposed again unless the cited code changed since that
148
+ decision. Keep the code citation on a kept passage, so a later change to that
149
+ code reaches the article through the ordinary source update.
150
+
112
151
  ### Locating submitted references
113
152
 
114
153
  Submission locators also accept `{path, heading}` or `{path, quote}` instead of
@@ -178,6 +178,11 @@ Before choosing a local Markdown capture route, honor the surrounding task conte
178
178
  is empty or only mounts runtime-rendered content, tell the user that capture
179
179
  found a document-site shell and ask for the rendered-site or data-source
180
180
  boundary instead of inventing body text.
181
+ - A documentation folder whose folders matter, versioned external content (a
182
+ documentation repository, a released package or Skill), or a collection to
183
+ absorb once and archive → register a file source with `--layout tree`, plus
184
+ `--origin-*` for versioned content or `--freeze` after archiving. Follow
185
+ [Versioned external content](../manuals/guides/knowledge-updates.md#versioned-external-content-and-archived-collections).
181
186
  - A Lark/Feishu URL, doc token, or wiki token → register one Lark source:
182
187
  `context source add lark [YYYYMMDD] --module <module> --url <url>` or the
183
188
  matching token flag. Register every requested document under the same date;
@@ -347,6 +347,9 @@
347
347
  "type": "number",
348
348
  "default": 0
349
349
  },
350
+ "hidden": {
351
+ "type": "boolean"
352
+ },
350
353
  "target": {
351
354
  "type": "object",
352
355
  "properties": {