@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
@@ -0,0 +1,80 @@
1
+ # Write the research report and discuss it
2
+
3
+ Use when stakeholders must choose between approaches or the research covers
4
+ existing knowledge collections. The report is a communication document for
5
+ people; the PLAN remains the working record. Keep both consistent.
6
+
7
+ ## Structure: conclusions first
8
+
9
+ 1. **Conclusions and recommendation**: a one-screen summary of the current
10
+ state, the recommendation per collection and the benefit next to the cost;
11
+ then the reasons, next steps and a short reading guide.
12
+ 2. **Approaches and their trade-offs**: a neutral description of the
13
+ production process and where each candidate approach attaches to it, ending
14
+ with the cross-collection score matrix and each approach's trade-offs.
15
+ 3. **Recommended plan**: target shape including how readers and agents reach
16
+ the packages (installation, query services, repository agent instructions),
17
+ packages, stages, maintenance ownership, a table comparing the current state
18
+ with the recommendation by dimension (coverage, accuracy, freshness,
19
+ maintenance burden, content kept unchanged) together with the cost, decisions
20
+ needed and risks.
21
+ 4. **Impact on the knowledge structure**: an overview tree of navigation
22
+ changes, then per-collection detail. When a constraint or decision changes the
23
+ placement, show the alternatives side by side.
24
+ 5. **Packages and their articles**: each package's articles listed individually
25
+ with navigation location and status.
26
+ 6. **Comparison with existing knowledge**: how each collection is organized,
27
+ overlap, conflicts and upstream registration status.
28
+ 7. **Quality**: audit totals, concrete examples and what would catch them,
29
+ with one example traced over time to show how scheduled source comparison
30
+ would have caught a stale statement.
31
+ 8. **Background**: meeting decisions and action items, proposals, method.
32
+ 9. **Appendices**: one per collection, each opening with a one-picture summary
33
+ (composition, overlap, audit result, approach scores, conclusion).
34
+
35
+ Open each chapter with its own conclusion in one or two sentences.
36
+
37
+ ## Writing rules
38
+
39
+ - Plain language for people new to the subject; define approach names once and
40
+ use them consistently.
41
+ - Objective tone: describe what each collection and team already provides; do
42
+ not present the recommended process as self-evidently superior.
43
+ - Pair every benefit with its execution cost.
44
+ - Name documents by title and repositories by name instead of pasting long
45
+ addresses; long file paths may be shortened in display while keeping the full
46
+ path available to copy.
47
+ - State how numbers were obtained and label estimates.
48
+
49
+ ## Figures
50
+
51
+ Prefer figures over long tables where they help:
52
+
53
+ | Figure | Shows |
54
+ | --- | --- |
55
+ | Collection map | Collections placed by knowledge origin and maintenance activity |
56
+ | Composition | Original copies versus distilled content per collection |
57
+ | Overlap | Share of duplicated, complementary and new content |
58
+ | Upstream registration | Registered versus unregistered upstreams |
59
+ | Audit results | Consistent, partial, inconsistent and unverifiable claims |
60
+ | Approach scores | Each collection scored on each approach, recommendation marked |
61
+ | Production process | Where each approach attaches (as a tree or table) |
62
+ | Navigation impact | Pruned tree marking added, revised, new sections and unchanged content |
63
+
64
+ ## Build and share
65
+
66
+ Write chapters as Markdown files and build a single-page HTML report with
67
+ [the report template](../templates/research-report/README.md): chapter list on the
68
+ left, one chapter at a time in the middle, the chapter's outline on the right.
69
+ Keep chapter sources and figure data under `.tmp/context-plans/<slug>/research/`.
70
+ Share through a channel that keeps the report access-controlled; do not upload
71
+ it to publicly readable storage. Uploading creates an external copy, so confirm
72
+ with the user before publishing it.
73
+
74
+ ## Discuss and record decisions
75
+
76
+ Expect several rounds. After each round, update the report and record each
77
+ decision in the PLAN with its date and who made it; keep open questions visible.
78
+ When an answer is ambiguous, state the interpretation you applied and invite
79
+ correction. A decision on the approach is not approval of the PLAN or of
80
+ production; follow the review policy in the Skill.
@@ -98,3 +98,16 @@ Respect uncommitted work in reused checkouts. Do not reset, replace, rebase or
98
98
  switch a user's active worktree just to change the planning baseline. Use an
99
99
  available read-only view or an authorized separate research checkout when the
100
100
  required revision is unavailable locally.
101
+
102
+ ## Read research material with indexer reading rules
103
+
104
+ Before any source is registered, research may borrow the installed indexers'
105
+ reading methods to explore saved material under `.tmp/context-plans/<slug>/`:
106
+ for documents, start from titles, bounded opening excerpts and the complete
107
+ H2/H3 outline, then read selected full text; for code, start from entry points,
108
+ module boundaries and public interfaces, then read what the quality audit needs.
109
+ This is a reading method only. Do not run indexer production commands, invoke
110
+ indexer Skills as if a production stage were active, register sources, or create
111
+ review candidates during research. Production uses the indexers after the PLAN
112
+ is approved, through the `context` Skill's Route.
113
+
@@ -0,0 +1,38 @@
1
+ # Establish purpose and constraints
2
+
3
+ Use before deep research, and again when a new stakeholder joins the project.
4
+ The answers become the evaluation criteria for the research and the report;
5
+ they do not authorize production, publication or source access.
6
+
7
+ ## Read what already exists first
8
+
9
+ Read the material the user supplied or pointed to: meeting notes, proposals,
10
+ filled source checklists, previous PLANs and the existing workspace's guidance.
11
+ Extract the stated goals, commitments, open questions and the action items
12
+ assigned to each person. When a meeting record is a transcript without a summary,
13
+ derive the decisions and action items from the conversation and label them as
14
+ derived. Ask only about what remains unknown.
15
+
16
+ ## Questions to settle
17
+
18
+ Ask the missing ones together, in one exchange, in the conversation language:
19
+
20
+ | Topic | What to learn | Why it matters |
21
+ | --- | --- | --- |
22
+ | Existing knowledge | Where knowledge already lives (repositories, wikis, documents, packages) and who maintains each | Determines the inventory and who to ask when access fails |
23
+ | Maintenance afterwards | Whether each collection keeps being maintained where it is, or moves into the workspace | Decides between following an upstream and absorbing it once |
24
+ | Content that must not change | Procedures, policies or pages that must keep their original wording | Decides whether an unchanged or reference-only approach is needed |
25
+ | Readers and uses | Who reads the result: coding agents, Q&A, on-call, onboarding | Shapes article boundaries and package split |
26
+ | Package split | Whether different readers need separate packages, and their scope | Decides package selection, independent of navigation |
27
+ | Structural constraints | Limits such as keeping the existing top-level sections | Constrains where new topics may go |
28
+ | Delivery and review | Review mode, reporting rhythm, delivery destination | Inherited by the PLAN and its stages |
29
+
30
+ Accept "not decided yet" as an answer and record it as an open decision; do
31
+ not block research on it. Do not ask about permissions the user cannot grant.
32
+
33
+ ## Record and reuse
34
+
35
+ Write the answers into the PLAN's purpose and decision sections, separating
36
+ facts the user stated, items derived from documents and open questions. Reuse
37
+ them across stages and resumed sessions; ask again only when the scope changes
38
+ materially or a stakeholder contradicts an earlier answer.
@@ -12,6 +12,16 @@ it in. It is a working report, not a machine-validated schema.
12
12
  - Last confirmed result:
13
13
  - Next action:
14
14
 
15
+ ## Purpose, constraints and decisions
16
+
17
+ - Stated purpose, readers and uses (source: user / derived from documents):
18
+ - Where existing knowledge lives, who maintains it, and where it will be maintained afterwards:
19
+ - Content that must not be rewritten; structural constraints (for example keeping top-level sections):
20
+ - Package split and audiences:
21
+ - Decision log (date or "date unknown" with its source, decision, who decided; ambiguous answers record the interpretation applied):
22
+ - Content conflicts awaiting adjudication and who decides:
23
+ - Open decisions:
24
+
15
25
  ## Research scope and findings
16
26
 
17
27
  | Source or subject | Kind and identity | Resolved version / capture context | Scale and coverage | Access or evidence gaps |
@@ -28,6 +38,16 @@ it in. It is a working report, not a machine-validated schema.
28
38
  - Additional sources/links discovered, excluded scope and unresolved coverage:
29
39
  - Scratch research location and reusable checkpoints:
30
40
 
41
+ ## Existing knowledge collections (omit when none)
42
+
43
+ | Collection | Kind and evidence | Maintenance (owner, last update) | Upstreams: registered / new / low value | Unique content estimate | Audit: consistent / partial / inconsistent / unverifiable | Chosen approach, mode (follow / absorb once) and reason |
44
+ | --- | --- | --- | --- | --- | --- | --- |
45
+ | | | | | | | |
46
+
47
+ - Approaches considered per collection with their scores, benefit and cost; capability limits of the installed Context:
48
+ - Quality findings: representative problems, written wrong or went stale, and their consequence for readers:
49
+ - Research report location and the discussion rounds held:
50
+
31
51
  ## Existing knowledge and material relationships
32
52
 
33
53
  - Workspace organization and relevant approved sections actually inspected:
@@ -44,6 +64,11 @@ Support decisions with sections actually read. For new coverage, suggest an
44
64
  existing section or explain the needed addition. Consolidation here is a proposal,
45
65
  not permission to modify or retire approved articles during research.
46
66
 
67
+ ## Target structure and packages
68
+
69
+ - Navigation impact: pruned tree of existing sections with added, revised, new-section and kept-unchanged marks; new topics placed inside existing sections where possible:
70
+ - Packages: name, audience, selection rule (path patterns or explicit list), and each package's article list or the report chapter that holds it:
71
+
47
72
  ## Proposed stages
48
73
 
49
74
  Use stable stage names. For a stage requiring publication, a delivery checkbox
@@ -0,0 +1,79 @@
1
+ # Research report template
2
+
3
+ `build.mjs` turns a directory of Markdown chapters into a single-page HTML report:
4
+ chapter list on the left, one chapter at a time in the middle, the chapter's
5
+ outline on the right. It needs only Node.js and has no package dependencies.
6
+
7
+ ```bash
8
+ node <skill-dir>/templates/research-report/build.mjs \
9
+ .tmp/context-plans/<slug>/research/report \
10
+ .tmp/context-plans/<slug>/research/report.html \
11
+ --title "<report title>" --subtitle "<date · baseline>"
12
+ ```
13
+
14
+ ## Chapters
15
+
16
+ - One file per chapter, ordered by file name: `01-conclusions.md`, `02-approaches.md`, …
17
+ - Files whose name starts with a capital letter and a separator (`A-…`, `B-…`)
18
+ are listed as appendices.
19
+ - Each file starts with `# Title`; `##` and `###` headings form the right-hand outline.
20
+ - Supported Markdown: headings, paragraphs, lists (one nested level), tables,
21
+ block quotes, code, inline code, bold and links. Images and italics are not
22
+ supported. Inline code that looks like a file or directory path (any script)
23
+ is shown shortened and copies the full path on click.
24
+ - `example/` contains a small two-chapter report; build it to see the layout.
25
+
26
+ ## Figures
27
+
28
+ Navigation trees use a `tree` block; end a line with `[add]`, `[mod]`, `[dir]`
29
+ or `[keep]` to mark added articles, revised articles, new sections and content
30
+ kept unchanged. Lines without a marker are unchanged context:
31
+
32
+ ````markdown
33
+ ```tree
34
+ Knowledge base
35
+ ├── Business
36
+ │ └── Billing rules [mod]
37
+ └── Operations
38
+ └── Incident handbook [dir]
39
+ ```
40
+ ````
41
+
42
+ Bar charts and score matrices use a `chart` block with JSON:
43
+
44
+ ````markdown
45
+ ```chart
46
+ {"title": "Code check results", "legend": ["consistent", "partial", "inconsistent", "unverifiable"],
47
+ "rows": [{"label": "Wiki A", "values": [7, 0, 2, 1]}, {"label": "Wiki B", "values": [11, 0, 0, 1]}]}
48
+ ```
49
+ ````
50
+
51
+ ```chart
52
+ {"type": "matrix", "title": "Approach scores", "columns": ["Standard", "Upstream", "Unchanged"],
53
+ "rows": ["Wiki A", "Wiki B"], "values": [[4, 5, 2], [5, 4, 2]], "max": 5}
54
+ ```
55
+
56
+ A matrix marks the row maximum unless `recommend` lists the recommended cells as
57
+ `[[row, column], …]` (zero-based), which also allows combined recommendations.
58
+
59
+ A scatter chart places collections on two axes, for example knowledge origin and
60
+ maintenance activity:
61
+
62
+ ````markdown
63
+ ```chart
64
+ {"type": "scatter", "title": "Collection map", "xlabel": "from documents → from code",
65
+ "ylabel": "maintenance activity", "xmax": 10, "ymax": 10,
66
+ "points": [{"x": 2, "y": 3, "label": "Wiki A", "note": "mirror plus summary"}]}
67
+ ```
68
+ ````
69
+
70
+ Optional `colors`, `unit`, `max`, `segmentLabels` (print each segment's value) and
71
+ per-row `note` adjust a bar chart. Draw process or architecture diagrams as a
72
+ `tree` block or a table. An invalid chart stops the build with the chapter file
73
+ and line.
74
+
75
+ ## Labels
76
+
77
+ Pass `--labels labels.json` to translate interface labels, for example
78
+ `{"add": "新增", "mod": "修订", "dir": "新目录", "keep": "原样", "report": "报告",
79
+ "appendix": "附录", "outline": "本章目录", "prev": "上一章", "next": "下一章", "copied": "已复制"}`.
@@ -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
+ ```
@@ -72,7 +72,9 @@ Classify a request in this order:
72
72
  A registration or association is an entrance, not evidence: it does not show that
73
73
  the content was read, verified or is usable by the reader. Links from knowledge to
74
74
  imports are navigation; a conclusion that depends on external content requires
75
- capturing that content into `sources`.
75
+ capturing that content into `sources`. Versioned content such as a released
76
+ package, Skill or documentation repository is captured as a `file` source with
77
+ an origin, described in the knowledge-updates guide.
76
78
 
77
79
  For long-term association of external knowledge, Skills or plugins, maintain
78
80
  `imports.yaml` through [imports](references/imports.md); registration alone does
@@ -138,7 +140,7 @@ without the user's authorization.
138
140
 
139
141
  ### Check the CLI first
140
142
 
141
- This Skill ships with Context 0.7.99.
143
+ This Skill ships with Context 0.7.101.
142
144
 
143
145
  When entering production in a workspace, align the CLI, this Skill and the
144
146
  workspace SDK once per session with [version alignment](references/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
@@ -41,7 +41,14 @@ an audience enters production; do not count registration as completed research.
41
41
  knowledge depends on it, which shortens inventory. The `context` Skill carries
42
42
  a template under `references/source-checklist.md`. It is never required —
43
43
  without one, continue and register material from the conversation.
44
- 3. Read [project-planning.md](references/project-planning.md). Review the existing
44
+ 3. Establish the purpose and constraints before deep research, using
45
+ [stakeholder-intake.md](references/stakeholder-intake.md). Read supplied
46
+ meeting notes, proposals and checklists first and ask only what is still
47
+ missing: where existing knowledge lives and who maintains it, where it should
48
+ be maintained afterwards, what must not be rewritten, who uses the result,
49
+ how packages should be split, and structural constraints. Record the answers
50
+ as the evaluation criteria for the research.
51
+ 4. Read [project-planning.md](references/project-planning.md). Review the existing
45
52
  knowledge workspace and relevant approved articles before grouping new material.
46
53
  Map overlaps, gaps and relationships between documents, repositories and pages;
47
54
  distinguish reuse, revision, consolidation and new coverage in the PLAN.
@@ -52,18 +59,29 @@ an audience enters production; do not count registration as completed research.
52
59
  evidence already available; do not wait for a complete PLAN. Follow the early
53
60
  scope rules in project-planning.md, including previously confirmed choices.
54
61
  Reuse accessible local checkouts and saved research before fetching again.
55
- 4. Create or update `PLAN-YYYYMMDD-slug.md` at that project's Git root using
62
+ When the request brings in existing knowledge collections — knowledge or
63
+ wiki repositories, documentation directories, other workspaces or published
64
+ knowledge packages — also follow [knowledge-migration.md](references/knowledge-migration.md):
65
+ identify each collection's kind and real upstreams, audit a bounded sample of
66
+ its claims with [quality-audit.md](references/quality-audit.md), and choose an
67
+ integration approach per collection.
68
+ 5. Create or update `PLAN-YYYYMMDD-slug.md` at that project's Git root using
56
69
  [the report template](templates/PLAN.md). Keep downloaded research under
57
70
  `.tmp/context-plans/YYYYMMDD-slug/`; the layout is a working convention,
58
71
  not a new CLI validation rule.
59
- 5. Present the first report and complete its review before production. By default,
72
+ 6. When stakeholders must choose between approaches, or the research covers
73
+ existing knowledge collections, present a research report before or with the
74
+ first PLAN, following [research-report.md](references/research-report.md):
75
+ conclusions first, then the analysis and evidence. Record each decision made
76
+ during the discussion in the PLAN before asking for approval.
77
+ 7. Present the first report and complete its review before production. By default,
60
78
  obtain the user's approval; only an authorized `plan_review: delegate` override
61
79
  permits Agent review as described below.
62
80
  Resolve the reporting preference: report after all stages, or after each
63
81
  stage; for stage reports, explicitly establish whether to wait for a reply.
64
82
  Preserve already supplied choices. This project approval does not approve
65
83
  candidate articles or grant missing source, Git or publishing permissions.
66
- 5. If the user requested only research or comparison, finish with the report;
84
+ 8. If the user requested only research or comparison, finish with the report;
67
85
  production needs explicit authorization to execute the plan; review delegation
68
86
  alone does not authorize production for a research-only request. After that approval,
69
87
  follow the authorized Git collaboration process. Hand only