@c4a/context-cli 0.6.0-alpha.6 → 0.6.0-beta.2

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 (56) hide show
  1. package/cli.js +5288 -8006
  2. package/package.json +2 -1
  3. package/plugin/skills/skill-prose-align/SKILL.md +23 -9
  4. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  5. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  6. package/plugin/skills/skill-prose-compile/SKILL.md +17 -8
  7. package/plugin/skills/skill-review-gate/SKILL.md +5 -5
  8. package/plugin/skills/skill-source-scope/SKILL.md +91 -68
  9. package/plugin/skills/skill-source-scope/references/capture-source.md +12 -11
  10. package/plugins/VERSION +1 -1
  11. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  12. package/plugins/claude/skills/skill-prose-align/SKILL.md +23 -9
  13. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  14. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  15. package/plugins/claude/skills/skill-prose-compile/SKILL.md +17 -8
  16. package/plugins/claude/skills/skill-review-gate/SKILL.md +5 -5
  17. package/plugins/claude/skills/skill-source-scope/SKILL.md +91 -68
  18. package/plugins/claude/skills/skill-source-scope/references/capture-source.md +12 -11
  19. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  20. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  21. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  22. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +23 -9
  23. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +17 -8
  24. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +5 -5
  25. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
  26. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +91 -68
  27. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  28. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  29. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +23 -9
  30. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +17 -8
  31. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +5 -5
  32. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
  33. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +91 -68
  34. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  35. package/plugins/cursor/skills/skill-prose-align/SKILL.md +23 -9
  36. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  37. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  38. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +17 -8
  39. package/plugins/cursor/skills/skill-review-gate/SKILL.md +5 -5
  40. package/plugins/cursor/skills/skill-source-scope/SKILL.md +91 -68
  41. package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +12 -11
  42. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  43. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  44. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +23 -9
  45. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +17 -8
  46. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +5 -5
  47. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
  48. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +91 -68
  49. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
  50. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
  51. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +23 -9
  52. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +17 -8
  53. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +5 -5
  54. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
  55. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +91 -68
  56. package/babel.cjs +0 -257
@@ -23,10 +23,14 @@ Turn captured document evidence into confirmed structure.
23
23
  and view set returned by the CLI.
24
24
  - Write and validate `context.structure.v1` into `unapproved/structure.yaml`.
25
25
  Stop for user confirmation before compile.
26
- - Before classifying nodes, section plans, edges, weak evidence, duplicates,
26
+ - Before classifying nodes, section plans, edges, support strength, duplicates,
27
27
  conflicts, ownership, or unresolved items, read the current procedure
28
28
  references listed by the CLI as `semantic_reference_files`. These references
29
29
  are the current structure judgment rules, not summaries.
30
+ - Plan source evidence as Sections before promoting any heading to a Node/View.
31
+ Local FAQ, decision, incident, warning, or reference fragments normally stay
32
+ under the owning View unless source evidence proves independent retrieval
33
+ identity.
30
34
  - Do not produce or validate a structure payload from this entry file alone. If
31
35
  the relevant `semantic_reference_files` have not been read in the current
32
36
  turn, stop and read them first.
@@ -195,15 +199,23 @@ Validate:
195
199
  context run align:<type>:<source>:<collection> --validate --input <structure.yaml> --format json
196
200
  ```
197
201
 
198
- Validation returns `structure_summary` and writes a temporary
199
- `structure_report.path` under `.tmp/context-runtime/reports/`. Use those
200
- artifacts as the primary confirmation material; do not ask the user to confirm a
201
- structure they cannot inspect. If the user needs a focused view, run:
202
+ Validation returns `structure_summary` and writes a temporary HTML report under
203
+ `.tmp/context-runtime/reports/`. Use `structure_report.file_url` as the primary
204
+ user-facing link, and include `structure_report.absolute_path` as a copyable
205
+ fallback. Do not ask the user to confirm a structure they cannot click or open.
206
+ If the user needs a focused view, run:
202
207
 
203
208
  ```bash
204
209
  context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
205
210
  ```
206
211
 
212
+ The CLI response may include a large full `structure_summary` for debugging and
213
+ report rendering. For user confirmation, prioritize the first-screen fields:
214
+ `review_notice`, `structure_report`, and `structure_summary_compact`. A valid
215
+ user-facing confirmation prompt must include the report `file_url`, the absolute
216
+ path fallback, and a compact summary of collections/views/unresolved/diagnostics.
217
+ Do not ask the user to confirm from counts alone.
218
+
207
219
  Repair diagnostics by routing them to the right decision:
208
220
 
209
221
  - source ref or snapshot mismatch -> reread evidence views or refresh capture;
@@ -228,13 +240,15 @@ After validation, and again after a draft structure is staged, show the user:
228
240
  - expected compile order;
229
241
  - downstream impact: these choices freeze paths, section ownership, and
230
242
  relationships for this compile round.
231
- - the `structure_report.path` generated by validate or `--view
232
- structure-summary`.
243
+ - the `structure_report.file_url` generated by validate or `--view
244
+ structure-summary`;
245
+ - the `structure_report.absolute_path` fallback in case the host cannot click
246
+ file URLs.
233
247
 
234
248
  If the CLI stage result includes `next_action.human_gate: true`, treat it as a
235
249
  hard stop for structure review. Do not ask for a blind "confirm structure"
236
- reply. Surface the report path and enough structured summary for the user to
237
- inspect what will be confirmed.
250
+ reply. Surface the report `file_url`, absolute path, and enough structured
251
+ summary for the user to inspect what will be confirmed.
238
252
 
239
253
  Use the host's multi-choice question tool when available. If unavailable, use a
240
254
  short Markdown fallback. Good options are:
@@ -21,9 +21,12 @@ Compile confirmed document structure into reviewable draft knowledge.
21
21
  - The input is already confirmed `context.structure.v1`; do not redesign node
22
22
  ownership, page paths, or relationships here. Return to prose align if those
23
23
  are wrong.
24
- - Read compile context through CLI views only: `read-plan`, `node-context`, and
25
- `schema`. Use align evidence views only when the compile view or validation
26
- output gives a specific source ref that needs exact text.
24
+ - Read compile context through CLI views only: `blockers`, `read-plan`,
25
+ `node-context`, and `schema`. Start with `blockers` for large or recently
26
+ repaired structures; if it returns section blockers, return to prose align
27
+ instead of drafting compile actions. Use align evidence views only when the
28
+ compile view or validation output gives a specific source ref that needs exact
29
+ text.
27
30
  - Emit `context.compile-actions.v1`; the CLI mirrors source spans, derives
28
31
  `content_mode`, writes review candidates, and enforces source-bound evidence.
29
32
  - The `summary` field in each action is the Agent-authored behavior half only:
@@ -88,14 +91,17 @@ Use semantic labels, not SDK function names:
88
91
  Recommended read order:
89
92
 
90
93
  ```bash
94
+ context run compile:<type>:<source>:<collection> --view blockers --format json
91
95
  context run compile:<type>:<source>:<collection> --view read-plan --format json
92
96
  context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
93
97
  context run compile:<type>:<source>:<collection> --view schema --format json
94
98
  ```
95
99
 
96
100
  Use CLI-returned `available_view_refs`, `planned_sections`, `local_sources`, and
97
- `next_action.command`. Do not reconstruct the structure by opening
98
- `unapproved/structure.yaml` or `knowledge/structure.yaml` directly.
101
+ `next_action.command`. If `blockers.section_blockers[]` is non-empty, repair the
102
+ structure through align first; do not inspect every node or hand-split compile
103
+ actions. Do not reconstruct the structure by opening `unapproved/structure.yaml`
104
+ or `knowledge/structure.yaml` directly.
99
105
 
100
106
  ## Procedure References
101
107
 
@@ -134,12 +140,15 @@ relationship reference blocks.
134
140
  Run:
135
141
 
136
142
  ```bash
143
+ context run compile:<type>:<source>:<collection> --view blockers --format json
137
144
  context run compile:<type>:<source>:<collection> --view read-plan --format json
138
145
  ```
139
146
 
140
- Use the returned node list, source overview, and next action. If the CLI says
141
- the structure is missing, unconfirmed, stale, frozen against the wrong
142
- snapshot, or invalid, return to prose align or source capture as indicated.
147
+ Use the returned blockers, node list, source overview, and next action. If the
148
+ blockers view reports section blockers, return to prose align and repair the
149
+ confirmed structure before compile. If the CLI says the structure is missing,
150
+ unconfirmed, stale, frozen against the wrong snapshot, or invalid, return to
151
+ prose align or source capture as indicated.
143
152
 
144
153
  ### Step 2 — Inspect One Node
145
154
 
@@ -20,8 +20,8 @@ Run the human review gate. The user decides approval or rejection.
20
20
  - `<collection>` is an internal production collection such as `architecture`,
21
21
  `sop`, `decision`, or `standards`; it is not an OKF package root such as
22
22
  `wikis`, `guides`, or `rules`.
23
- - If browser opening fails or the host cannot make a path clickable, provide the
24
- `file://` URL.
23
+ - Always surface the CLI-printed `file_url`. If browser opening fails or the
24
+ host cannot make a path clickable, also provide `absolute_path`.
25
25
  - Apply only the JSONL payload copied by the user from the review UI.
26
26
  - Do not parse `unapproved/entities.jsonl`, `.tmp`, or HTML internals with
27
27
  scripts to synthesize decisions.
@@ -40,9 +40,9 @@ For the internal collection reported by status, run:
40
40
  context review html <collection> --open
41
41
  ```
42
42
 
43
- Tell the user where the page opened. If needed, provide a clickable
44
- `file://.../<collection>.html` URL or the exact path printed by the CLI. Do
45
- not assume a fixed review filename; review scope is collection or `--all`.
43
+ Tell the user where the page opened and include the CLI-printed `file_url` as a
44
+ clickable link plus `absolute_path` as a copyable fallback. Do not assume a
45
+ fixed review filename; review scope is collection or `--all`.
46
46
  Do not substitute OKF package roots (`wikis`, `guides`, `rules`) for this
47
47
  argument; review scope is the internal collection namespace.
48
48
 
@@ -13,10 +13,10 @@ tools:
13
13
  Current capture discipline for document sources. The executable path is source
14
14
  registration plus the declared capture phase flow:
15
15
 
16
- - local Markdown/MDX file source: `context source add file <name> --local <path>`
17
- followed by `context run capture:file:<name> --format json`;
18
- - Lark/Feishu source: `context source add lark <name> ...` followed by
19
- `context run capture:lark:<name> --format json`;
16
+ - local Markdown/MDX file source: `context source add file --local <path>`
17
+ followed by `context run capture:file:<source-name> --format json`;
18
+ - Lark/Feishu source: `context source add lark ...` followed by
19
+ `context run capture:lark:<source-name> --format json`;
20
20
  - refresh: rerun the same declared capture phase after status or the user asks
21
21
  for recapture.
22
22
 
@@ -52,8 +52,9 @@ manager or version.
52
52
  Before choosing a local Markdown capture route, honor the surrounding task context. Driver documents such as run instructions, handbooks, READMEs, plans, feedback issues, corpus/index/manifests, and batch lists are not Context sources unless the user explicitly asks to ingest them. Capture only ingest targets that are already explicit in the user request; if they are missing, ask one clarification instead of capturing the driver document.
53
53
 
54
54
  - One or more local `.md` / `.mdx` files or a local documentation folder to ingest →
55
- register one file source with the user-confirmed source name and boundary:
56
- `context source add file <name> --local <file-or-folder>`. For an explicit
55
+ register one file source with the user-confirmed boundary:
56
+ `context source add file --local <file-or-folder>`. The CLI returns the date
57
+ source name (`YYYYMMDD`) to use in project phases. For an explicit
57
58
  batch inside a broader folder, preserve the user's include list on source
58
59
  registration. Default file capture handles `.md`. If the CLI reports
59
60
  document-site files such as `.mdx`, `_meta.json`, sidebars, or docs config,
@@ -65,15 +66,15 @@ Before choosing a local Markdown capture route, honor the surrounding task conte
65
66
  `__context_route_metadata.md` as mechanical route evidence; it also extracts
66
67
  static MDX component props/children into `__context_mdx_component_text.md`
67
68
  when components carry user-facing text. Declare
68
- `captureFile({ source: source("<name>"), processor: mdxJsonDocs() })`, then
69
- run `context run capture:file:<name> --format json`. If the selected MDX page
69
+ `captureFile({ source: source("<source-name>"), processor: mdxJsonDocs() })`, then
70
+ run `context run capture:file:<source-name> --format json`. If the selected MDX page
70
71
  is empty or only mounts runtime-rendered content, tell the user that capture
71
72
  found a document-site shell and ask for the rendered-site or data-source
72
73
  boundary instead of inventing body text.
73
74
  - A Lark/Feishu URL, doc token, or wiki token → register one Lark source:
74
- `context source add lark <name> --url <url>` or the matching token flag.
75
- Declare `captureLark({ source: source("<name>") })`, then run
76
- `context run capture:lark:<name> --format json`.
75
+ `context source add lark --url <url>` or the matching token flag.
76
+ Declare `captureLark({ source: source("<source-name>") })`, then run
77
+ `context run capture:lark:<source-name> --format json`.
77
78
  - Mixed local document and Lark document batches are separate sources unless
78
79
  the current CLI explicitly offers a combined source contract. Do not write an
79
80
  Agent-side URL/file loop.
@@ -21,22 +21,21 @@ Choose and validate what may become draft knowledge.
21
21
  file source, or Lark/Feishu document. Current CLI can execute repo sources,
22
22
  local file sources, and Lark document capture through the declared flow.
23
23
  - Treat source registration as a knowledge-boundary decision, not a parameter
24
- prompt. Explain that the source name becomes a stable namespace in source
25
- refs, phase ids, and package naming. Approved knowledge paths are derived
26
- later from collection, containment, and slug. Give concrete examples before
27
- asking for confirmation.
28
- - If the user already provided a path and only the source name is missing, still
29
- explain what that name means. Do not ask "confirm source name" without saying
30
- whether the boundary is a single package/module or a parent monorepo/subspace
31
- namespace.
24
+ prompt. Do not invent semantic source names from paths, filenames, or source
25
+ body content. By default, omit the source name and let the CLI use today's
26
+ date (`YYYYMMDD`) as the source namespace. Explain that this namespace appears
27
+ in source refs, phase ids, and package naming; approved knowledge paths are
28
+ derived later from collection, containment, and slug.
29
+ - If the default date source name already exists, stop and ask the user which
30
+ explicit date name to use. Do not auto-append sequence numbers and do not
31
+ summarize the source theme as a fallback.
32
32
  - Do not infer a source from cwd, parent directories, package names, monorepo
33
33
  layout, or git remote.
34
34
  - In monorepos, one source may conceptually be the whole repo/subspace or one
35
35
  package/subdirectory. If the user wants one package manual, prefer the
36
36
  package/subdirectory. If the user wants one unified knowledge product across
37
- modules, explain that the source name becomes the repo/source identity and
38
- may be used in codegraph NodeRefs such as `codegraph/product-ui/...` when the
39
- extraction rules derive those refs. Current repo extraction
37
+ modules, explain that the date source namespace can be used in codegraph
38
+ NodeRefs when extraction rules derive grouped refs. Current repo extraction
40
39
  still requires choosing a concrete single-module extraction boundary before
41
40
  running extraction; do not run extraction against an ambiguous multi-module
42
41
  source.
@@ -74,11 +73,29 @@ Ask for a knowledge source in plain language and map it to the supported path:
74
73
 
75
74
  | User source | What to ask for | Current handling |
76
75
  |---|---|---|
77
- | Local code repo | knowledge boundary, stable source name, and local repo path | Register with `context source add repo <name> --local <path>`. CLI records git root + optional `subpath`; `sources/repo/<name>` becomes an ignored symlink to the chosen repo/subdir view. |
78
- | Local monorepo package/module | whether the source is the whole repo/subspace or one package/subdir; stable source name; chosen path | Register the chosen boundary as the repo source. If the user wants one package manual, register that package/subdir. If the user wants a unified subspace manual, register the subspace. Do not use `extractTs.include` as a package selector. |
79
- | Remote Git repo | knowledge boundary, stable source name, remote URL, pinned commit/ref, desired package/subdir, and permission to clone | CLI does not clone automatically. After explicit user approval, the agent may clone/checkout to an ignored local path, then register that local checkout. Cloned source content must not be committed. |
80
- | Local Markdown / document file or folder | document boundary, stable source name, local path, include glob if needed, and permission to read the source body | Register with `context source add file <name> --local <path>`, declare the matching capture phase, then hand off to material investigation and structure drafting after capture. Do not run capture before the user confirms read permission. |
81
- | Lark / Feishu document | document URL/token, intended collection, and permission to read remotely | Register with `context source add lark <name>` plus exactly one of `--url`, `--doc-token`, or `--wiki-token`; declare the matching capture phase, then hand off to material investigation and structure drafting after capture. Explain that capture writes a committed snapshot under `sources/lark/<name>/`, supports offline verify/fresh clone reproduction, and does not write credentials. Do not fetch through ad hoc scripts. |
76
+ | Local code repo | knowledge boundary and local repo path | Register with `context source add repo --local <path>` unless the user explicitly provides a date source name. CLI records git root + optional `subpath`; `sources/repo/YYYYMMDD` becomes an ignored symlink to the chosen repo/subdir view. |
77
+ | Local monorepo package/module | whether the source is the whole repo/subspace or one package/subdir; chosen path | Register the chosen boundary as the repo source. If the user wants one package manual, register that package/subdir. If the user wants a unified subspace manual, register the subspace. Do not use `extractTs.include` as a package selector. |
78
+ | Remote Git repo | knowledge boundary, remote URL, pinned commit/ref, desired package/subdir, and permission to clone | CLI does not clone automatically. After explicit user approval, the agent may clone/checkout to an ignored local path, then register that local checkout. Cloned source content must not be committed. |
79
+ | Local Markdown / document file or folder | document boundary, local path, include glob or include-list if needed, and permission to read the source body | Register with `context source add file --local <path>`, declare the matching capture phase, then hand off to material investigation and structure drafting after capture. Do not run capture before the user confirms read permission. |
80
+ | Lark / Feishu document | document URL/token, intended collection, and permission to read remotely | Register with `context source add lark` plus exactly one of `--url`, `--doc-token`, or `--wiki-token`; declare the matching capture phase, then hand off to material investigation and structure drafting after capture. Explain that capture writes a committed snapshot under `sources/lark/YYYYMMDD/`, supports offline verify/fresh clone reproduction, and does not write credentials. Do not fetch through ad hoc scripts. |
81
+
82
+ When asking for a document mainline collection, do not ask only "which
83
+ collection?". Explain every available option in product language:
84
+
85
+ | Collection | Use when the source is mainly about |
86
+ |---|---|
87
+ | `business` | 业务域、业务对象、行业/组织概念、非技术的领域知识 |
88
+ | `product` | PRD、用户故事、产品行为、需求说明、验收口径 |
89
+ | `architecture` | 系统架构、组件/模块设计、技术方案、工具链、平台能力 |
90
+ | `sop` | SOP、操作流程、排障步骤、oncall/runbook、巡检维护 |
91
+ | `faq` | 问答集合、常见问题、按问题检索的解释和处理建议 |
92
+ | `standards` | 规范、标准、约束、检查清单、合规/质量规则 |
93
+ | `decision` | 明确的方案选择、取舍理由、ADR、决策记录 |
94
+ | `incident` | 事故复盘、故障时间线、影响面、根因、处置和预防措施 |
95
+ | `test` | 测试计划、测试场景、验证矩阵、验收用例 |
96
+
97
+ Do not offer `codegraph` or `feats` for prose document alignment. `codegraph`
98
+ comes from code extraction, and `feats` is a later feature namespace.
82
99
 
83
100
  </reference>
84
101
 
@@ -92,48 +109,48 @@ choice:
92
109
 
93
110
  ```text
94
111
  You are choosing what one source means for this knowledge workspace.
95
- The source name becomes part of source refs and phase ids. Approved knowledge
112
+ The date source name becomes part of source refs and phase ids. Approved knowledge
96
113
  paths are derived later from collection, containment, and slug. NodeRef and
97
114
  ViewRef are identity fields, not path strings.
98
115
 
99
116
  If the source is one package:
100
- knowledge/codegraph/component-lib/...
101
- repo:component-lib#symbol:...
102
- capture:file:component-lib
103
- dist/component-lib-kb/
117
+ knowledge/codegraph/YYYYMMDD/...
118
+ repo:YYYYMMDD#symbol:...
119
+ capture:file:YYYYMMDD
120
+ dist/YYYYMMDD-kb/
104
121
 
105
122
  If the source is one document source:
106
123
  knowledge/architecture/entity/example.md
107
- file:product-docs/getting-started.md#span:...
108
- align:file:product-docs:architecture
109
- dist/product-docs-kb/
124
+ file:YYYYMMDD/getting-started.md#span:...
125
+ align:file:YYYYMMDD:architecture
126
+ dist/YYYYMMDD-kb/
110
127
 
111
128
  If the source is a parent monorepo/subspace namespace, later multi-module
112
129
  outputs can be shaped like:
113
- knowledge/codegraph/product-ui/component-web/...
114
- knowledge/codegraph/product-ui/component-lynx/...
130
+ knowledge/codegraph/YYYYMMDD/component-web/...
131
+ knowledge/codegraph/YYYYMMDD/component-lynx/...
115
132
  ```
116
133
 
117
- If the source already points at one package/module root, the path uses the
118
- source name once. An extra module/package segment is only expected when the
119
- chosen source boundary intentionally covers multiple modules. In the current workflow, treat that
120
- parent source as a planning/inspection boundary first; choose a concrete
121
- package/subdirectory source before real extraction.
134
+ If the source already points at one package/module root, the source namespace
135
+ is still the date name. An extra module/package segment is only expected when
136
+ the chosen source boundary intentionally covers multiple modules. In the
137
+ current workflow, treat that parent source as a planning/inspection boundary
138
+ first; choose a concrete package/subdirectory source before real extraction.
122
139
 
123
140
  When the user has already provided a path, describe the current interpretation
124
- before asking for the name:
141
+ and use the CLI date default:
125
142
 
126
143
  ```text
127
144
  I am treating this path as the source boundary:
128
145
  <path>
129
146
 
130
- If this path is one package/module, the source name will be used directly:
131
- source refs such as repo:<source-name>#...
147
+ If this path is one package/module, the date source name will be used in
148
+ source refs such as repo:YYYYMMDD#...
132
149
 
133
150
  If this path is a parent monorepo/subspace that contains multiple modules, the
134
- source name becomes the parent source namespace for grouped codegraph NodeRefs
151
+ date source name becomes the parent source namespace for grouped codegraph NodeRefs
135
152
  when extraction derives those refs:
136
- knowledge/codegraph/<source-name>/<module-name>/...
153
+ knowledge/codegraph/YYYYMMDD/<module-name>/...
137
154
 
138
155
  For the current extraction flow, a multi-module parent source is used for
139
156
  inspection/planning first. Before reading code, we still need a concrete
@@ -148,8 +165,9 @@ Then ask for one of:
148
165
  - Lark/Feishu document URL.
149
166
 
150
167
  Do not ask "what is the source name?" as the first or only question. Ask what
151
- they want the knowledge source to cover, then propose a source name derived from
152
- that boundary and explain the path impact.
168
+ they want the knowledge source to cover, then use the date default. Ask for an
169
+ explicit date name only when today's source name already exists or the user
170
+ asks to override it.
153
171
 
154
172
  Good user-facing wording:
155
173
 
@@ -158,22 +176,22 @@ Next we need to add a knowledge source.
158
176
 
159
177
  If you only want a manual for the component package, choose that package
160
178
  directory as the source boundary, for example:
161
- name: component-lib
179
+ name: YYYYMMDD
162
180
  path: /repo/packages/component-lib
163
181
 
164
182
  If you want one manual for the whole subspace, choose the subspace root:
165
- name: product-ui
183
+ name: YYYYMMDD
166
184
  path: /repo/subspaces/product-ui
167
185
 
168
- The name is not just a label. It will appear in source refs such as
169
- repo:component-lib#... and in phase ids such as extract:component-lib:codegraph.
186
+ The date name is not just a label. It will appear in source refs such as
187
+ repo:YYYYMMDD#... and in phase ids such as extract:YYYYMMDD:codegraph.
170
188
  Approved paths are derived from collection, containment, and slug. NodeRef and
171
189
  ViewRef are identity fields, not path strings.
172
190
 
173
- For a unified subspace package shape, a parent source name such as `product-ui`
191
+ For a unified subspace package shape, the date source name
174
192
  lets the output group child modules under that namespace:
175
- knowledge/codegraph/product-ui/component-web/...
176
- knowledge/codegraph/product-ui/component-lynx/...
193
+ knowledge/codegraph/YYYYMMDD/component-web/...
194
+ knowledge/codegraph/YYYYMMDD/component-lynx/...
177
195
 
178
196
  Current extraction can inspect a parent source, but it should extract from a
179
197
  confirmed single package/subdirectory source. If this path is a parent source,
@@ -186,14 +204,14 @@ a supported repo source.
186
204
 
187
205
  For a local repo source, ask for:
188
206
 
189
- - source boundary and stable source name;
207
+ - source boundary;
190
208
  - local repo or package/subdirectory path;
191
209
  - remote/ref only when not inferable or when the user wants an explicit pin.
192
210
 
193
211
  After the user provides the choice, run:
194
212
 
195
213
  ```bash
196
- context source add repo <name> --local <repo-or-subdir>
214
+ context source add repo --local <repo-or-subdir>
197
215
  context source ensure
198
216
  ```
199
217
 
@@ -207,34 +225,39 @@ cloned source content.
207
225
  For local Markdown/MDX document sources, after the user confirms the boundary, run:
208
226
 
209
227
  ```bash
210
- context source add file <name> --local <file-or-folder>
228
+ context source add file --local <file-or-folder>
211
229
  ```
212
230
 
231
+ Use an explicit `<name>` only when the user has approved a non-default date
232
+ source name. Otherwise run `context source add file --local <file-or-folder>`.
233
+
213
234
  Default file capture handles Markdown. If `context source add file`,
214
235
  `context source inspect`, `context status`, or capture output reports that the
215
236
  source looks like an MDX documentation site, stop at the source boundary gate
216
237
  and ask the user to confirm that interpretation before changing `src/index.ts`.
217
238
  For MDX documentation sites that use `_meta.json` route metadata, declare
218
- `captureFile({ source: source("<name>"), processor: mdxJsonDocs() })` in
239
+ `captureFile({ source: source("<date-name>"), processor: mdxJsonDocs() })` in
219
240
  `src/index.ts`; included `_meta.json` files are route metadata, and the CLI
220
241
  generates `__context_route_metadata.md` as mechanical route evidence. Use
221
- `--include` only when the approved boundary is narrower than the folder. Then
222
- explain that the next operation reads the approved document files and writes a
223
- committed snapshot under `sources/file/<name>/`. After the user confirms read
224
- permission, summarize the `src/index.ts` change or show an equivalent diff
225
- summary, and run the capture phase.
242
+ `--include` only when the approved boundary is narrower than the folder. For a
243
+ long fixed batch, prefer `--include-list <file>` with one include per line;
244
+ blank lines and `#` comments are ignored. Then explain that the next operation
245
+ reads the approved document files and writes a committed snapshot under
246
+ `sources/file/YYYYMMDD/`. After the user confirms read permission, summarize the
247
+ `src/index.ts` change or show an equivalent diff summary, and run the capture
248
+ phase.
226
249
  Apply [skill-source-scope/references/capture-source.md](skill-source-scope/references/capture-source.md) for route
227
250
  selection, dependency recovery, output handling, and final reporting, using the
228
251
  current capture phase command returned by `context status`.
229
252
 
230
253
  For Lark/Feishu document sources, register the source but do not fetch content
231
254
  with ad hoc scripts. Explain which remote document or wiki token will be read,
232
- that the snapshot is written under `sources/lark/<name>/`, that committed
255
+ that the snapshot is written under `sources/lark/YYYYMMDD/`, that committed
233
256
  snapshots enable offline verify and fresh-clone reproduction, that whether to
234
257
  add extra ignore rules is a business repository decision, and that access
235
258
  credentials are not written to the workspace. Use the declared capture/align
236
259
  flow only after the user confirms remote reading. After declaring
237
- `captureLark({ source: source("<name>") })`, summarize the `src/index.ts`
260
+ `captureLark({ source: source("<date-name>") })`, summarize the `src/index.ts`
238
261
  change or show an equivalent diff summary.
239
262
  Apply [skill-source-scope/references/capture-source.md](skill-source-scope/references/capture-source.md) for route
240
263
  selection, dependency recovery, output handling, and final reporting, using the
@@ -254,14 +277,14 @@ the choices without exposing internal API names first:
254
277
  - for the current executable flow, register one package/subdirectory as its
255
278
  own source when the user wants a focused package manual;
256
279
  - if the user is designing a unified subspace knowledge base, keep the
257
- parent source name as the namespace decision, but do not run extraction until
258
- the concrete module extraction boundary is confirmed.
280
+ date source namespace as the namespace decision, but do not run extraction
281
+ until the concrete module extraction boundary is confirmed.
259
282
 
260
283
  Wait for the user to choose. If the user chooses `packages/button`, register it
261
284
  as a separate source such as:
262
285
 
263
286
  ```bash
264
- context source add repo button --local <repo>/packages/button
287
+ context source add repo --local <repo>/packages/button
265
288
  ```
266
289
 
267
290
  Do not model a monorepo package choice as `include: ["packages/button/src/**"]`
@@ -276,7 +299,7 @@ the capture summary first:
276
299
  - document count;
277
300
  - title tree, heading tree, or source span distribution from the CLI output;
278
301
  - available reading budget and evidence views;
279
- - snapshot path under `sources/file|lark/<source-name>/`;
302
+ - snapshot path under `sources/file|lark/YYYYMMDD/`;
280
303
  - the fact that approved pages are planned through
281
304
  `unapproved/structure.yaml` before compile;
282
305
  - whether the source is local file/folder evidence or Lark/Feishu evidence.
@@ -338,11 +361,11 @@ I will first generate a preview without writing candidates. The preview will
338
361
  show counts plus the planned `knowledge/` tree.
339
362
  ```
340
363
 
341
- Only after the user confirms this product-level scope, declare the chosen source
342
- with `source("<name>")`, add the TypeScript extraction phase, and add the human
343
- review phase. Use `include` only for a file-level filter within the chosen
344
- source boundary. Mention the internal API names only in code-change summaries,
345
- or when the user asks for implementation details.
364
+ Only after the user confirms this product-level scope, declare the chosen date
365
+ source with `source("YYYYMMDD")`, add the TypeScript extraction phase, and add
366
+ the human review phase. Use `include` only for a file-level filter within the
367
+ chosen source boundary. Mention the internal API names only in code-change
368
+ summaries, or when the user asks for implementation details.
346
369
 
347
370
  ### Step 5 — Show The Pre-extraction Preview
348
371
 
@@ -366,12 +389,12 @@ containment, and slug; NodeRef/ViewRef are identity fields, not path strings:
366
389
  knowledge/<collection>/<containment>/<slug>.md
367
390
  ```
368
391
 
369
- If source name, package name, module list, candidate estimate, or path shape is
370
- not what the user expects, stop and repair the source boundary or source name
392
+ If date source name, package name, module list, candidate estimate, or path shape is
393
+ not what the user expects, stop and repair the source boundary or explicit date name
371
394
  before extraction.
372
395
 
373
396
  For a single-module code source, a repeated path like
374
- `knowledge/codegraph/<source-name>/<package-name>/...` is usually a schema
397
+ `knowledge/codegraph/<date-source-name>/<package-name>/...` is usually a schema
375
398
  problem or a wrong source boundary. Stop before extraction if the preview shows
376
399
  that shape unexpectedly.
377
400
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "context",
3
3
  "displayName": "C4A Context",
4
- "version": "0.6.0-alpha.6",
4
+ "version": "0.6.0-beta.2",
5
5
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
6
6
  "author": {
7
7
  "name": "Context4AI",
@@ -23,10 +23,14 @@ Turn captured document evidence into confirmed structure.
23
23
  and view set returned by the CLI.
24
24
  - Write and validate `context.structure.v1` into `unapproved/structure.yaml`.
25
25
  Stop for user confirmation before compile.
26
- - Before classifying nodes, section plans, edges, weak evidence, duplicates,
26
+ - Before classifying nodes, section plans, edges, support strength, duplicates,
27
27
  conflicts, ownership, or unresolved items, read the current procedure
28
28
  references listed by the CLI as `semantic_reference_files`. These references
29
29
  are the current structure judgment rules, not summaries.
30
+ - Plan source evidence as Sections before promoting any heading to a Node/View.
31
+ Local FAQ, decision, incident, warning, or reference fragments normally stay
32
+ under the owning View unless source evidence proves independent retrieval
33
+ identity.
30
34
  - Do not produce or validate a structure payload from this entry file alone. If
31
35
  the relevant `semantic_reference_files` have not been read in the current
32
36
  turn, stop and read them first.
@@ -195,15 +199,23 @@ Validate:
195
199
  context run align:<type>:<source>:<collection> --validate --input <structure.yaml> --format json
196
200
  ```
197
201
 
198
- Validation returns `structure_summary` and writes a temporary
199
- `structure_report.path` under `.tmp/context-runtime/reports/`. Use those
200
- artifacts as the primary confirmation material; do not ask the user to confirm a
201
- structure they cannot inspect. If the user needs a focused view, run:
202
+ Validation returns `structure_summary` and writes a temporary HTML report under
203
+ `.tmp/context-runtime/reports/`. Use `structure_report.file_url` as the primary
204
+ user-facing link, and include `structure_report.absolute_path` as a copyable
205
+ fallback. Do not ask the user to confirm a structure they cannot click or open.
206
+ If the user needs a focused view, run:
202
207
 
203
208
  ```bash
204
209
  context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
205
210
  ```
206
211
 
212
+ The CLI response may include a large full `structure_summary` for debugging and
213
+ report rendering. For user confirmation, prioritize the first-screen fields:
214
+ `review_notice`, `structure_report`, and `structure_summary_compact`. A valid
215
+ user-facing confirmation prompt must include the report `file_url`, the absolute
216
+ path fallback, and a compact summary of collections/views/unresolved/diagnostics.
217
+ Do not ask the user to confirm from counts alone.
218
+
207
219
  Repair diagnostics by routing them to the right decision:
208
220
 
209
221
  - source ref or snapshot mismatch -> reread evidence views or refresh capture;
@@ -228,13 +240,15 @@ After validation, and again after a draft structure is staged, show the user:
228
240
  - expected compile order;
229
241
  - downstream impact: these choices freeze paths, section ownership, and
230
242
  relationships for this compile round.
231
- - the `structure_report.path` generated by validate or `--view
232
- structure-summary`.
243
+ - the `structure_report.file_url` generated by validate or `--view
244
+ structure-summary`;
245
+ - the `structure_report.absolute_path` fallback in case the host cannot click
246
+ file URLs.
233
247
 
234
248
  If the CLI stage result includes `next_action.human_gate: true`, treat it as a
235
249
  hard stop for structure review. Do not ask for a blind "confirm structure"
236
- reply. Surface the report path and enough structured summary for the user to
237
- inspect what will be confirmed.
250
+ reply. Surface the report `file_url`, absolute path, and enough structured
251
+ summary for the user to inspect what will be confirmed.
238
252
 
239
253
  Use the host's multi-choice question tool when available. If unavailable, use a
240
254
  short Markdown fallback. Good options are: