@c4a/context-cli 0.6.0-beta.7 → 0.6.1-beta.1

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 (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +130 -132
  3. package/README.zh-CN.md +158 -0
  4. package/cli.js +14978 -15477
  5. package/package.json +18 -3
  6. package/plugins/README.md +8 -0
  7. package/plugins/README_CN.md +6 -0
  8. package/plugins/VERSION +1 -1
  9. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  10. package/plugins/claude/skills/skill-continue-workflow/SKILL.md +39 -3
  11. package/plugins/claude/skills/skill-package-output/SKILL.md +16 -3
  12. package/plugins/claude/skills/skill-prose-align/SKILL.md +26 -31
  13. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  14. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  15. package/plugins/claude/skills/skill-prose-compile/SKILL.md +26 -27
  16. package/plugins/claude/skills/skill-review-gate/SKILL.md +17 -6
  17. package/plugins/claude/skills/skill-source-scope/SKILL.md +10 -9
  18. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  19. package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +39 -3
  20. package/plugins/codex/skills/continue/references/internal-procedures/skill-package-output.md +16 -3
  21. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  22. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  23. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +26 -31
  24. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +26 -27
  25. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +17 -6
  26. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +10 -9
  27. package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +39 -3
  28. package/plugins/codex/skills/init/references/internal-procedures/skill-package-output.md +16 -3
  29. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  30. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  31. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +26 -31
  32. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +26 -27
  33. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +17 -6
  34. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +10 -9
  35. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  36. package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +39 -3
  37. package/plugins/cursor/skills/skill-package-output/SKILL.md +16 -3
  38. package/plugins/cursor/skills/skill-prose-align/SKILL.md +26 -31
  39. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  40. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  41. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +26 -27
  42. package/plugins/cursor/skills/skill-review-gate/SKILL.md +17 -6
  43. package/plugins/cursor/skills/skill-source-scope/SKILL.md +10 -9
  44. package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +39 -3
  45. package/plugins/skills/context-continue/references/internal-procedures/skill-package-output.md +16 -3
  46. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  47. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  48. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +26 -31
  49. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +26 -27
  50. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +17 -6
  51. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +10 -9
  52. package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +39 -3
  53. package/plugins/skills/context-init/references/internal-procedures/skill-package-output.md +16 -3
  54. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +6 -12
  55. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +16 -10
  56. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +26 -31
  57. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +26 -27
  58. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +17 -6
  59. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +10 -9
  60. package/plugin/.claude-plugin/plugin.json.template +0 -16
  61. package/plugin/.codex-plugin/plugin.json.template +0 -38
  62. package/plugin/.cursor-plugin/plugin.json.template +0 -29
  63. package/plugin/README.md +0 -150
  64. package/plugin/README_CN.md +0 -136
  65. package/plugin/assets/icon.svg +0 -3
  66. package/plugin/assets/logo.svg +0 -3
  67. package/plugin/assets/workflow-en.png +0 -0
  68. package/plugin/assets/workflow.png +0 -0
  69. package/plugin/commands/continue.md +0 -34
  70. package/plugin/commands/init.md +0 -21
  71. package/plugin/skills/skill-continue-workflow/SKILL.md +0 -199
  72. package/plugin/skills/skill-init-workspace/SKILL.md +0 -74
  73. package/plugin/skills/skill-package-output/SKILL.md +0 -167
  74. package/plugin/skills/skill-prose-align/SKILL.md +0 -327
  75. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/candidate-resolution.md +0 -91
  76. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/density-profile.md +0 -30
  77. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +0 -269
  78. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +0 -276
  79. package/plugin/skills/skill-prose-compile/SKILL.md +0 -288
  80. package/plugin/skills/skill-prose-compile/references/internal-procedures/close-gate.md +0 -132
  81. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/action-domain-gates.md +0 -52
  82. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/notes.md +0 -48
  83. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/refresh-and-update.md +0 -85
  84. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions/references/structural-challenges.md +0 -73
  85. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-actions.md +0 -413
  86. package/plugin/skills/skill-prose-compile/references/internal-procedures/compile-judgment.md +0 -123
  87. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/disposition-semantics.md +0 -81
  88. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/leakage-and-ownership.md +0 -55
  89. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/scope-review-and-omit.md +0 -93
  90. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/temporal-and-evidence.md +0 -79
  91. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment/references/user-confirmation.md +0 -111
  92. package/plugin/skills/skill-prose-compile/references/internal-procedures/semantic-judgment.md +0 -194
  93. package/plugin/skills/skill-review-gate/SKILL.md +0 -127
  94. package/plugin/skills/skill-source-scope/SKILL.md +0 -524
  95. package/plugin/skills/skill-source-scope/references/capture-source.md +0 -201
  96. package/plugins/assets/icon.svg +0 -3
  97. package/plugins/assets/workflow-en.png +0 -0
  98. package/plugins/assets/workflow.png +0 -0
  99. package/plugins/codex/assets/workflow-en.png +0 -0
  100. package/plugins/codex/assets/workflow.png +0 -0
  101. package/plugins/cursor/assets/icon.svg +0 -3
  102. package/plugins/cursor/assets/workflow-en.png +0 -0
  103. package/plugins/cursor/assets/workflow.png +0 -0
  104. package/scripts/build-plugin.ts +0 -658
@@ -1,199 +0,0 @@
1
- ---
2
- name: skill-continue-workflow
3
- description: >
4
- Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Runs the status-driven Context process, executes safe mechanical next steps,
6
- and delegates human gates to source, review, and package procedures.
7
- tools:
8
- - Bash
9
- ---
10
-
11
- # skill-continue-workflow
12
-
13
- Continue an existing Context workspace from its current state.
14
-
15
- ## TL;DR
16
-
17
- - Use this only inside an initialized Context workspace. If the user is starting
18
- a new knowledge workspace or a new batch from a raw project/repo root, do not
19
- run `context status` first; use the init workflow and complete setup before
20
- returning here.
21
- - If `context status` reports `workspace-not-found` with a configured
22
- `context.workspaceDir`, stop. If the directory exists, enter it and rerun
23
- status. If it does not exist, ask whether to initialize it through the init
24
- workflow; do not treat the host repository root as the workspace.
25
- - There is no `context continue` CLI command. Start with `context status`.
26
- - `context status` and CLI diagnostics are the source of truth.
27
- - Inspect `declarationGraph` and `configurationGaps`. Before structure
28
- confirmation they are configuration warnings; after confirmation, a missing
29
- compile route is a hard gate. Never substitute a compile phase from another
30
- collection.
31
- - Execute safe mechanical `next:` steps; stop at semantic choices and human
32
- gates.
33
- - Delegate source/scope decisions to
34
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-source-scope/SKILL.md`.
35
- - Delegate review to `${CLAUDE_PLUGIN_ROOT}/skills/skill-review-gate/SKILL.md`.
36
- - Delegate package output choices to
37
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-package-output/SKILL.md`.
38
- - Delegate document investigation and structure confirmation to
39
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-prose-align/SKILL.md`.
40
- - Delegate source-bound prose compile requests to
41
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-prose-compile/SKILL.md`.
42
- - Do not inspect `.tmp`, `unapproved/`, `knowledge/`, `dist/`, or
43
- `node_modules/@c4a/context/dist` with ad hoc scripts to decide project state.
44
- - Only run commands surfaced by the current status route, current phase view,
45
- review gate, verify/build gate, or package guidance. Do not invent alternate
46
- lifecycle commands from memory.
47
-
48
- <reference>
49
-
50
- ## Safe Mechanical Commands
51
-
52
- These can run when already implied by current status and no placeholder/human
53
- choice remains:
54
-
55
- | State / hint | Allowed action |
56
- |---|---|
57
- | source already declared | `context source ensure`, `context source list`, `context source get` |
58
- | declared phase that does not read new source body or require a semantic choice | `context run <phase-id>` |
59
- | prose align evidence read | `context run align:<type>:<source>:<collection> --view <view>` |
60
- | prose structure validation | `context run align:<type>:<source>:<collection> --validate --input <structure.yaml>` |
61
- | prose compile evidence read | `context run compile:<type>:<source>:<collection> --view <view>` |
62
- | prose compile action validation | `context run compile:<type>:<source>:<collection> --validate --input <compile-actions.yaml>` |
63
- | copied review payload supplied by user | `context review apply <payload-file>` |
64
- | close required after review | `context close --format json` |
65
- | package already declared and close is clean | `context build` |
66
- | validation requested | `context verify` |
67
-
68
- Capture phases are not safe mechanical commands by default. `capture:file:*`
69
- and `capture:lark:*` read local or remote source bodies and update committed
70
- snapshots, so they require the source read-permission gate unless the current
71
- turn already contains explicit user confirmation for that exact source.
72
- An explicit request to capture, ingest, fetch, read, or include the exact
73
- file/Lark path or URL is that confirmation; do not ask again after registration.
74
- Mere mention, source discussion, or a register-only request is not confirmation,
75
- and an explicit refusal always overrides inferred permission.
76
-
77
- ## Human Gates
78
-
79
- Stop and ask, or wait for user input, for:
80
-
81
- - `Human gate:` in CLI output.
82
- - placeholders such as `<name>`, `<repo-or-subdir>`, `<phase-id>`, `<collection>`.
83
- - missing source selection.
84
- - source boundary/name decisions, because they affect `knowledge/` paths and
85
- `source_ref` prefixes.
86
- - source repo operations: clone, checkout, reset, fetch, install, build, test.
87
- - source scope, package/subdirectory, symbol group, or glob choices.
88
- - file/Lark capture or refresh, including capture preview, until the user has
89
- confirmed which local path or remote document may be read.
90
- - review approval/rejection decisions.
91
- - document structure confirmation, section ownership, edge confirmation,
92
- rewrite intent, conflict, weak-evidence, or cross-document organization
93
- choices unless they are being handled through prose align/compile evidence
94
- views and validation.
95
- - package output type or template choices.
96
-
97
- When a human gate has a fixed small option set, use the host's native
98
- multi-choice tool when available (Claude Code `AskUserQuestion`, Codex's
99
- available native user-input tool such as `request_user_input` when exposed,
100
- Cursor Plan Mode `AskQuestion`). If unavailable, fall back to Markdown `A/B/C`
101
- choices. Each option must include the effect of choosing it.
102
-
103
- </reference>
104
-
105
- <procedures>
106
-
107
- ### Step 0 — Confirm Workspace Exists
108
-
109
- If the current task is to create a new Context workspace, or the user has not
110
- identified an initialized Context workspace root for this turn, do not continue
111
- with this workflow. Initialize through the public Context init entry or
112
- `context init` first, run the setup command printed by init, then return to this workflow from the
113
- created workspace.
114
-
115
- ### Step 1 — Read Status
116
-
117
- Run:
118
-
119
- ```bash
120
- context status
121
- ```
122
-
123
- Use the output as evidence. Explain status and next step in the user's language;
124
- do not forward a long raw transcript unless requested.
125
-
126
- ### Step 2 — Route The State
127
-
128
- 1. If status says `missing-source`, `needs-capture-phase`, `needs-capture`,
129
- `needs-extract-phase`, or `ready-to-extract`,
130
- source boundary/name is unclear, source scope is unclear, or an extract
131
- phase needs first-run scope confirmation, follow
132
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-source-scope/SKILL.md`.
133
- When `routing.configuration` is present, make only that declared project
134
- configuration change and rerun status. Otherwise follow
135
- `routing.command_plan`: run `immediate` items directly and wait for current-
136
- conversation confirmation before `after-human-confirmation` items.
137
- For mixed sources, status intentionally returns `ready-to-extract` before
138
- `captured-ready-to-investigate` while all document snapshots are captured,
139
- document structure is untouched, and code extraction is missing, pending,
140
- or stale. Explain that code is processed first, then follow the exact
141
- extraction preview/rerun command.
142
- 2. If status says `captured-ready-to-investigate` or `needs-structure`, or the
143
- user asks to split, merge, classify, relate, or semantically organize
144
- document evidence before draft pages exist, follow
145
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-prose-align/SKILL.md`.
146
- 3. If status says `needs-prose-compile` or `structure-ready`, or the user asks
147
- to turn confirmed structure into source-bound draft pages, follow
148
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-prose-compile/SKILL.md`.
149
- 4. If the latest phase result has `next_action.human_gate=false`, follow its
150
- command and do not invent a Review gate. This includes
151
- `continue_compile_batch` and `continue-codegraph-batch`: finish the whole
152
- prepared round first. If status says
153
- `compile-ready-for-review`, or the latest result has
154
- `next_action.human_gate=true`, follow
155
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-review-gate/SKILL.md`.
156
- 5. If status says `compile-close-needed`, run `context close --format json`
157
- unless CLI diagnostics require human repair, then return to **Step 1**.
158
- 6. If status says `ready-to-build`, `built`, `needs-package-output`, or approved knowledge exists but
159
- package output is not chosen or declared,
160
- follow `${CLAUDE_PLUGIN_ROOT}/skills/skill-package-output/SKILL.md`.
161
- 7. If the next command is safe per [Safe Mechanical Commands](#safe-mechanical-commands),
162
- run it and return to **Step 1**.
163
- 8. If the next command crosses a [Human Gate](#human-gates), ask or wait; do not
164
- guess.
165
-
166
- ### Step 3 — Execute Safely
167
-
168
- Before editing `src/index.ts` or package templates, read:
169
-
170
- ```text
171
- node_modules/@c4a/context/docs/guides/agent-guide.md
172
- node_modules/@c4a/context/docs/guides/package-outputs.md
173
- node_modules/@c4a/context/docs/reference/project-api.md
174
- node_modules/@c4a/context/docs/reference/package-templates.md
175
- ```
176
-
177
- Do not write one-off scripts to parse source packages, count extracted symbols,
178
- or sample candidates. Use `context source inspect` and the extract no-write
179
- preview command.
180
-
181
- ### Step 4 — Report
182
-
183
- Report only the meaningful state transition: commands run, current status,
184
- human gate reached, and the precise user decision needed next. Never present
185
- `context build`, `context verify`, or file counts as proof that a deliverable is
186
- usable; inspect generated package structure when package output is involved.
187
-
188
- ### Step 5 — Self-verify Checklist
189
-
190
- - [ ] `context status` was run first. If not, return to **Step 1**.
191
- - [ ] No human gate was crossed. If not, stop and report the protocol error.
192
- - [ ] No ad hoc file/script probing replaced CLI views. If not, discard that
193
- conclusion and use the CLI view.
194
-
195
- </procedures>
196
- If top-level `state`, `next`, or `routing.command_plan` contradicts
197
- `draftCandidates`, `pendingReview`, `close.state`, package freshness, or verify
198
- counts, stop instead of rerunning a completed phase. Report
199
- `status-route-conflict` and preserve the detailed status output for diagnosis.
@@ -1,74 +0,0 @@
1
- ---
2
- name: skill-init-workspace
3
- description: >
4
- Internal procedure invoked by the public Context init entry; not a user slash command.
5
- Initializes a Context knowledge workspace, executes only safe setup follow-up,
6
- then hands off to the next-step workflow until the first human gate.
7
- tools:
8
- - Bash
9
- ---
10
-
11
- # skill-init-workspace
12
-
13
- Initialize a Context workspace. The CLI creates files; the agent follows safe
14
- setup hints and stops before source/scope choices.
15
-
16
- ## TL;DR
17
-
18
- - Use `context init`; do not add any extra project-local agent setup.
19
- - If init prints the standard setup `next:` command, run it instead of only
20
- repeating it.
21
- - After the setup command succeeds, enter the workspace and read `AGENTS.md`
22
- before running `context status`.
23
- - After setup, use `${CLAUDE_PLUGIN_ROOT}/skills/skill-continue-workflow/SKILL.md`
24
- for status-driven continuation.
25
- - Stop at source registration, extraction scope, review, package output, or any
26
- external repo operation that needs user choice.
27
- - Explain in the user's conversation language. Keep CLI commands, flags, paths,
28
- status values, JSONL keys, and copied CLI tokens unchanged.
29
-
30
- <procedures>
31
-
32
- ### Step 1 — Run Init
33
-
34
- 1. If the user gave no directory, run `context init`.
35
- 2. If the user gave a directory, run `context init <project-dir>`.
36
- 3. If the user supplied a project name option, pass it as `--name <name>`.
37
- 4. Read the CLI feedback block and preserve the project root path.
38
-
39
- ### Step 2 — Execute Safe Setup
40
-
41
- 1. If CLI prints `next: cd "<project-root>" && bun install`,
42
- execute that command.
43
- 2. If install fails, report the failure and stop.
44
- 3. If setup succeeds, read `<project-root>/AGENTS.md`.
45
- 4. After reading `AGENTS.md`, run `context status` from `<project-root>` and
46
- treat that output as the current workspace state.
47
-
48
- ### Step 3 — Handoff Or Stop
49
-
50
- 1. If status is ready for a safe mechanical step, continue with
51
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-continue-workflow/SKILL.md`.
52
- 2. If status is `missing-source`, `Human gate:`, or contains placeholders such as
53
- `<name>`, `<repo-or-subdir>`, `<phase-id>`, or `<collection>`, ask for the
54
- missing human choice and stop. For missing sources, ask for the knowledge
55
- source boundary first; do not ask for a raw source name as an isolated
56
- parameter.
57
- 3. Do not infer repo source, source boundary, source name, package, or
58
- extraction scope from cwd, parent directories, package names, monorepo
59
- layout, or git remote.
60
-
61
- ### Step 4 — Report
62
-
63
- Summarize what was initialized, what setup command ran, current status, and the
64
- human choice needed next. Do not paste a long raw CLI transcript unless the user
65
- asks for exact output.
66
-
67
- ### Step 5 — Self-verify Checklist
68
-
69
- - [ ] Safe setup was executed when CLI provided the standard setup `next:`. If
70
- not, return to **Step 2**.
71
- - [ ] No repo source or extraction scope was inferred. If not, stop and ask the
72
- user to confirm the source boundary and scope.
73
-
74
- </procedures>
@@ -1,167 +0,0 @@
1
- ---
2
- name: skill-package-output
3
- description: >
4
- Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Explains package output choices, prefers kb packages, declares selected
6
- package builders, builds, and inspects generated package structure.
7
- tools:
8
- - Bash
9
- ---
10
-
11
- # skill-package-output
12
-
13
- Choose and build a package output from approved knowledge.
14
-
15
- ## TL;DR
16
-
17
- - Package output is a human choice. Do not add package builders just because an
18
- example exists.
19
- - Recommend an agent knowledge-base package first for agent consumption.
20
- - Present an LLM text bundle as an alternative for a single text/RAG import
21
- bundle.
22
- - Do not use `kbPackage()` or `llmsPackage()` as user-facing option labels.
23
- Mention those API names only after the user chooses an output shape.
24
- - Do not offer `both` as a shortcut. Add one output, build, inspect, then ask
25
- before adding another.
26
- - Build happens after review and deterministic close. If status says
27
- `compile-close-needed`, run `context close --format json` before build.
28
- - Package templates may customize navigation and query guidance, but coverage,
29
- gap, scope, or known-limit claims must cite approved knowledge,
30
- `knowledge/structure.yaml`, or `context-build-inventory.json`.
31
- - Generated package structure, not `context build` alone, proves usability.
32
-
33
- <reference>
34
-
35
- ## Output Shapes
36
-
37
- Recommended first output:
38
-
39
- ```text
40
- dist/<name>-kb/
41
- ├── AGENTS.md
42
- ├── skills/
43
- │ └── knowledge-query/
44
- │ └── SKILL.md
45
- └── wikis/
46
- ├── index.md
47
- ├── <group>/
48
- │ ├── index.md
49
- │ └── ...
50
- └── ...
51
- ```
52
-
53
- Alternative:
54
-
55
- ```text
56
- dist/<name>-llms/
57
- └── llms.txt
58
- ```
59
-
60
- </reference>
61
-
62
- <procedures>
63
-
64
- ### Step 1 — Read Package Docs
65
-
66
- Before editing package declarations or templates, read:
67
-
68
- ```text
69
- node_modules/@c4a/context/docs/guides/package-outputs.md
70
- node_modules/@c4a/context/docs/reference/package-templates.md
71
- ```
72
-
73
- ### Step 2 — Explain The Choice
74
-
75
- Explain in the user's conversation language:
76
-
77
- - an agent knowledge-base package creates copied approved knowledge pages and
78
- reusable query guidance under `dist/<name>-kb/`;
79
- - the default `knowledge-query` skill teaches agents how to query and cite those
80
- copied approved knowledge pages;
81
- - the kb template must keep `wikis/index.md` as the OKF bundle entry page;
82
- - the default `wikis/index.md` is intentionally shallow: it describes the
83
- bundle and links to next-level directories;
84
- - `context build` maps internal production collections into OKF roots and
85
- generates child directory indexes such as `<okf-root>/<group>/index.md`, so
86
- users can browse from OKF root -> group -> page; `wikis/index.md` is the
87
- required default OKF root entry, while selected `guides/`, `rules/`, or
88
- `feats/` roots get their own indexes too;
89
- - an LLM text bundle creates one text/RAG import bundle under
90
- `dist/<name>-llms/`;
91
- - the user can customize `src/package-templates/kb/` before build;
92
- - template variables and examples are documented in
93
- `node_modules/@c4a/context/docs/reference/template-variables.md`;
94
- - build writes a package inventory such as `context-build-inventory.json`, which
95
- templates may cite when describing package coverage. Its edge section reports
96
- the structural edge contract and the evidence status from `context verify`;
97
- - the user can skip package output for now and keep only `knowledge/`.
98
-
99
- Ask which single output to create first using the host's native multi-choice
100
- tool when available. Use semantic option labels:
101
-
102
- - Agent knowledge-base package: for agents to query and cite approved knowledge pages.
103
- - LLM text bundle: for one text/RAG import bundle.
104
- - Skip package output for now: keep approved Markdown only.
105
-
106
- ### Step 3 — Declare The Selected Package
107
-
108
- After the user chooses, read the template variable guide if the template needs
109
- navigation changes:
110
-
111
- ```text
112
- node_modules/@c4a/context/docs/reference/template-variables.md
113
- ```
114
-
115
- Then edit `src/index.ts` and package templates according to the SDK docs. For
116
- kb output, prefer a clear package name such as `<source-name>-kb`.
117
-
118
- ### Step 4 — Build And Inspect
119
-
120
- If status says close is required, run:
121
-
122
- ```bash
123
- context close --format json
124
- ```
125
-
126
- Do not build from unclosed approved knowledge.
127
-
128
- Run:
129
-
130
- ```bash
131
- context build
132
- ```
133
-
134
- Inspect the generated `dist/<name>-kb/` or `dist/<name>-llms/` structure against
135
- [Output Shapes](#output-shapes). For kb packages, inspect every selected
136
- OKF root that appears in `context-build-inventory.json`, not only
137
- `wikis/`.
138
- If templates are placeholders or knowledge pages are thin, say that plainly and
139
- stop for user direction.
140
-
141
- If build reports that a template path collides with copied knowledge, do not
142
- retry blindly. Explain that template files and selected knowledge cannot render
143
- to the same path, then rename the template file or ask whether to exclude that
144
- knowledge path.
145
-
146
- If build reports a template-boundary diagnostic, repair the template by
147
- referencing approved knowledge, `knowledge/structure.yaml`, or
148
- `context-build-inventory.json` for coverage/gap/scope/known-limit statements.
149
- Do not patch `dist/` as the durable fix; edit the template under
150
- `src/package-templates/`.
151
-
152
- ### Step 5 — Self-verify Checklist
153
-
154
- - [ ] User selected the package output. If not, return to **Step 2**.
155
- - [ ] Only one output was added first. If not, ask before continuing with more.
156
- - [ ] A kb package template contains `wikis/index.md` and at least one
157
- `SKILL.md`.
158
- - [ ] For kb output, the generated OKF root indexes link to next-level
159
- directories, and child directory indexes exist when selected knowledge has
160
- subdirectories.
161
- - [ ] Template paths do not collide with copied knowledge paths.
162
- - [ ] Template coverage/gap/scope/known-limit claims cite approved knowledge,
163
- `knowledge/structure.yaml`, or build inventory.
164
- - [ ] Generated structure was inspected after build. If not, return to
165
- **Step 4**.
166
-
167
- </procedures>