@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
@@ -37,14 +37,13 @@ Compile confirmed document structure into reviewable draft knowledge.
37
37
  Do not write explicit `content`. If the evidence cannot be represented as a
38
38
  faithful mirrored continuous span, split the section or return to prose align
39
39
  for a confirmed structure change.
40
- - Before choosing section kind, summary, skip/update, weak-evidence handling, or
41
- structure repair, read only the procedure references in the CLI
42
- `semantic_rules.required` set. The CLI selects core and conditional rules for
43
- the current node and explains each selection with `reason`.
40
+ - Before semantic judgment, use the CLI `semantic-rules` View to page through
41
+ only `semantic_rules.required`; selection `reason` explains why each rule is
42
+ needed for the current node.
44
43
  - Do not produce or validate compile actions from this entry file alone. A
45
44
  ruleset already present in the active context may be reused only when both its
46
45
  `handle` and `digest` match. If the context was compacted, the digest changed,
47
- or the rule content is no longer present, read `semantic_rules.required`.
46
+ or the rule content is no longer present, resume the CLI rule-page sequence.
48
47
 
49
48
  <reference>
50
49
 
@@ -61,21 +60,16 @@ Use semantic labels, not SDK function names:
61
60
 
62
61
  ## Runtime Discipline
63
62
 
64
- - Follow `context status`, `routing.command_plan`, compile view
65
- `next_action`, and validation diagnostics. Treat CLI commands as the source
66
- of truth.
67
- - Use only the returned `next_action.command` for the next required write.
68
- Treat `allowed_actions[]` as permission for read-only insertions; it is not a
69
- menu of alternate write paths.
70
- - Treat `agent_hints[]` as temporary diagnostics. If an agent hint conflicts
71
- with a status route, compile view `next_action`, or validation result, follow
72
- the top-level route.
73
- - Do not use direct file tools, shell scripts, `jq`, `sed`, `cat`, `head`,
74
- `tail`, Python, or Node.js to inspect `sources/`, `unapproved/`,
75
- `knowledge/`, `dist/`, or CLI-managed `.tmp` as a substitute for Context
76
- views.
77
- - Run one write at a time. Do not parallelize compile stage, review apply,
78
- close, or build writes.
63
+ `skill-continue-workflow` owns global state routing; this Skill owns only the
64
+ compile phase selected by that route. Use CLI context/rule/diagnostic Views and
65
+ their exact continuation commands. Hints are subordinate to `next_action`.
66
+ Never inspect CLI-managed state files as a substitute for a View.
67
+ - Compile `read-plan`, `blockers`, `node-context`, and `schema` Views are
68
+ workspace-read-only and may be fetched in parallel. `--validate`, `--stage`,
69
+ structure confirmation, Review apply, and close remain serial mutations.
70
+ - One planned Section produces one compile action. When evidence contains
71
+ independently retrievable units, split them into sibling Sections in align;
72
+ do not split one planned Section into several compile actions.
79
73
  - One write still means one View, not one human Review. Stage every View in the
80
74
  same confirmed structure sequentially, follow `continue_compile_batch`, and
81
75
  open Review only after the CLI reports that the whole batch is prepared.
@@ -161,12 +155,12 @@ For each node that should become draft knowledge, run:
161
155
  ```bash
162
156
  context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
163
157
  context run compile:<type>:<source>:<collection> --view schema --format json
158
+ context run compile:<type>:<source>:<collection> --view semantic-rules --source <view-ref> --format json
164
159
  ```
165
160
 
166
- Read only the compile references listed by `semantic_rules.required` before
167
- classifying section kind, summary, support, skip/update, weak evidence, or
168
- structure repair. Do not load the full rule inventory unless the CLI explicitly
169
- returns it as required.
161
+ Follow the semantic-rules `next_action.command` pages before classifying section
162
+ kind, summary, support, skip/update, weak evidence, or structure repair. Do not
163
+ load rules outside the returned required set.
170
164
 
171
165
  Do not treat those references as optional background. They are the current
172
166
  compile drafting, judgment, and semantic-repair procedures.
@@ -236,16 +230,21 @@ After staging, follow `next_action` exactly:
236
230
  - `continue_compile_batch` with `human_gate=false`: move to the returned next
237
231
  View and repeat **Step 2–4**. Do not open Review yet.
238
232
  - `review_candidates` with `human_gate=true`: every planned View in this
239
- confirmed structure is prepared; return to `context status`, then delegate
233
+ confirmed structure slot is prepared; return to `context status`. If
234
+ `pendingStructureTargets` is non-empty, complete those slots first. Delegate
240
235
  one collection-level Review to
241
- `skill-review-gate.md`.
236
+ `skill-review-gate.md` only when status
237
+ reports the complete multi-slot round ready.
238
+ - Use `status.structureBatch` as the complete slot overview. Its evidence Views
239
+ are parallel-safe, its structure mutations are serial, and Review opens once
240
+ after all declared slots are prepared.
242
241
 
243
242
  The CLI blocks Review and close while confirmed Views remain unprepared. Do not
244
243
  turn sequential View writes into sequential user approvals.
245
244
 
246
245
  ### Step 5 — Close Handoff
247
246
 
248
- After the single batch review apply, return to `context status`. If status says
247
+ After the single collection-level batch review apply, return to `context status`. If status says
249
248
  `compile-close-needed`, run deterministic close:
250
249
 
251
250
  ```bash
@@ -16,6 +16,11 @@ Run the human review gate. The user decides approval or rejection.
16
16
  ## TL;DR
17
17
 
18
18
  - The agent never approves or rejects candidates on the user's behalf.
19
+ - Exception: when the current conversation explicitly authorizes fully managed
20
+ operation and status routes a managed Review, run the exact
21
+ `context review approve-all <collection> --managed --format json` (or
22
+ `--all`) command. Do not open HTML, synthesize a Payload, or persist this
23
+ authority in project configuration.
19
24
  - Enter this skill only when the preceding command returns
20
25
  `next_action.human_gate=true`. A no-delta codegraph run returns false and does
21
26
  not need Review.
@@ -39,12 +44,18 @@ Run the human review gate. The user decides approval or rejection.
39
44
  codegraph-only CI/CD policy. It may apply code add/update/remove deltas and
40
45
  refresh deterministic close, and verify them without this gate; it never
41
46
  applies to semantic knowledge. Package build remains an explicit later step.
42
- - `approved-source-ref-ambiguous` on beta.5 approved codegraph pages is an
43
- evidence migration, not a new review decision. Rerun the declared codegraph
44
- extraction, then run `context review migrate-codegraph-refs` and verify.
45
47
 
46
48
  <procedures>
47
49
 
50
+ ### Step 0 — Resolve Managed Review
51
+
52
+ If `context status --managed --format json` returns a managed-session Review
53
+ command, execute that atomic `approve-all` command and return to managed status.
54
+ Candidate scope, ids, fingerprints, structure digests, and source refs remain
55
+ fully validated; any mismatch is an error, not permission to bypass the gate.
56
+ Without explicit current-conversation managed authorization, continue with the
57
+ normal HTML workflow below.
58
+
48
59
  ### Step 1 — Open Review
49
60
 
50
61
  For the internal collection reported by status, run:
@@ -116,9 +127,9 @@ duplicate extract-index defect rather than running the metadata migration.
116
127
 
117
128
  ### Step 5 — Self-verify Checklist
118
129
 
119
- - [ ] Every decision came from the user's copied payload. If not, stop and
120
- discard the agent-authored decision, unless the user explicitly requested a
121
- scoped quick command and that command used `--collection` or `--all`.
130
+ - [ ] Every decision came from the user's copied payload, an explicitly scoped
131
+ quick command, or the current conversation's managed `approve-all` command.
132
+ If not, stop and discard the agent-authored decision.
122
133
  - [ ] Payload was applied through `context review apply`. If not, return to
123
134
  **Step 3**.
124
135
  - [ ] No direct edits were made to `knowledge/` or `unapproved/`. If not, report
@@ -52,6 +52,10 @@ Choose and validate what may become draft knowledge.
52
52
  - Before first real extraction, generate a no-write preview and show module
53
53
  counts plus `knowledgeTree` / `knowledgePathExamples` to the user. Use
54
54
  `--dry-run` only in the command you execute, not as the user-facing label.
55
+ - In explicit current-conversation fully managed mode, an evidence-backed
56
+ collection recommendation and a valid no-write extraction preview may be
57
+ accepted without another question. This never permits inventing a source
58
+ boundary or reading a file/Lark body the user did not authorize.
55
59
  - During a declared multi-module extraction round, treat
56
60
  `next_action.human_gate=false` as mechanical continuation: finish every
57
61
  pending extract phase before opening one combined Review page.
@@ -99,10 +103,13 @@ Ask for a knowledge source in plain language and map it to the supported path:
99
103
  | Local monorepo package/module | which concrete packages/subdirs belong to this batch | Register every confirmed boundary as a module under the same date. Do not create `YYYYMMDD-A/B/C`, and do not use `extractTs.include` as a package selector. |
100
104
  | 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. |
101
105
  | Local Markdown / document file or folder | date batch, document module boundary, local path, include glob or include-list if needed, and permission to read the source body | Register with `context source add file [YYYYMMDD] --module <module> --local <path>`; `--module` may be omitted when the path-derived name is sufficient. Documents from the same date are written as sibling files under `sources/file/YYYYMMDD/` and share that date's `manifest.json`. |
102
- | Lark / Feishu document | date batch, document module, URL/token, intended collection, and permission to read remotely | Register each document with `context source add lark [YYYYMMDD] --module <module>` plus exactly one identity flag. Documents from the same date are written as sibling files under `sources/lark/YYYYMMDD/` and share that date's `manifest.json`. Omit `--module` when the CLI-derived opaque identity is acceptable. |
106
+ | Lark / Feishu document | date batch, document module, URL/token, and permission to read remotely | Register each document with `context source add lark [YYYYMMDD] --module <module>` plus exactly one identity flag. Documents from the same date are written as sibling files under `sources/lark/YYYYMMDD/` and share that date's `manifest.json`. Omit `--module` when the CLI-derived opaque identity is acceptable. Choose the mainline collection only after capture investigation. |
103
107
 
104
- When asking for a document mainline collection, do not ask only "which
105
- collection?". Explain every available option in product language:
108
+ When status reaches `captured-ready-to-classify`, run every immediate
109
+ collection-neutral investigation command first. Then ask for a document
110
+ mainline collection with an evidence-backed recommendation; do not ask only
111
+ "which collection?" or infer it from registration metadata. Explain relevant
112
+ options in product language:
106
113
 
107
114
  | Collection | Use when the source is mainly about |
108
115
  |---|---|
@@ -501,12 +508,6 @@ needed, and verifies the result. Read `autoPromotion.close` and
501
508
  failure. Run `context build` separately when the pipeline publishes packages.
502
509
  Never use `--auto-promote` for prose or semantic collections.
503
510
 
504
- If an upgraded workspace reports `approved-source-ref-ambiguous` for pre-file-aware
505
- beta.5 codegraph refs, preserve the existing approval decisions. Rerun the
506
- declared codegraph extraction phase to produce the current file-aware symbol
507
- index, then run `context review migrate-codegraph-refs` and `context verify`.
508
- Tell the user this is evidence metadata migration and does not reopen Review.
509
-
510
511
  If the preview reports modules outside the confirmed source boundary, do not
511
512
  run extraction. Ask the user to choose the corrected source boundary.
512
513
 
@@ -1,16 +0,0 @@
1
- {
2
- "name": "context",
3
- "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
4
- "version": "__VERSION__",
5
- "author": {
6
- "name": "c4a"
7
- },
8
- "license": "MIT",
9
- "keywords": [
10
- "context",
11
- "knowledge-base",
12
- "wiki",
13
- "claude-plugin",
14
- "c4a"
15
- ]
16
- }
@@ -1,38 +0,0 @@
1
- {
2
- "name": "context",
3
- "version": "__VERSION__",
4
- "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
5
- "author": {
6
- "name": "c4a"
7
- },
8
- "homepage": "https://github.com/context4ai/c4a",
9
- "repository": "https://github.com/context4ai/c4a/tree/main/packages/context-cli",
10
- "license": "MIT",
11
- "keywords": [
12
- "context",
13
- "knowledge-base",
14
- "codex-plugin",
15
- "agent-skills",
16
- "c4a"
17
- ],
18
- "skills": "./skills/",
19
- "interface": {
20
- "displayName": "C4A Context",
21
- "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv__VERSION__",
22
- "longDescription": "Create a Context workspace and use agent-guided next steps to register sources, run extraction, review candidates, build package outputs, and verify health without silently mutating source repositories.",
23
- "developerName": "c4a",
24
- "category": "Productivity",
25
- "brandColor": "#ef6f2e",
26
- "composerIcon": "./assets/icon.svg",
27
- "logo": "./assets/logo.svg",
28
- "capabilities": [
29
- "Read",
30
- "Write"
31
- ],
32
- "websiteURL": "https://github.com/context4ai/c4a",
33
- "defaultPrompt": [
34
- "Continue my Context workspace with the next useful step.",
35
- "Inspect my Context workspace and proceed safely."
36
- ]
37
- }
38
- }
@@ -1,29 +0,0 @@
1
- {
2
- "name": "context",
3
- "displayName": "C4A Context",
4
- "version": "__VERSION__",
5
- "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
6
- "author": {
7
- "name": "Context4AI",
8
- "email": "support@context4ai.dev"
9
- },
10
- "homepage": "https://github.com/context4ai/c4a",
11
- "repository": "https://github.com/context4ai/c4a",
12
- "license": "MIT",
13
- "logo": "assets/logo.svg",
14
- "keywords": [
15
- "context",
16
- "knowledge",
17
- "citations",
18
- "agent-skills"
19
- ],
20
- "category": "developer-tools",
21
- "tags": [
22
- "knowledge",
23
- "documentation",
24
- "agent-skills",
25
- "citations"
26
- ],
27
- "commands": "./commands/",
28
- "skills": "./skills/"
29
- }
package/plugin/README.md DELETED
@@ -1,150 +0,0 @@
1
- # Context Plugin
2
-
3
- > [中文版本](./README_CN.md)
4
-
5
- <p align="center"><img src="./assets/logo.svg" alt="C4A Context" width="180"/></p>
6
-
7
- Context provides agent commands for maintaining a project-local knowledge workspace. The plugin is installed globally for the agent, while each workspace keeps its own sources, pending review state, approved knowledge, and build output. Public agent entrypoints are intentionally small: initialize once, then use next-step guidance.
8
-
9
- Agent dialogue should follow the user's current conversation language. CLI
10
- commands, flags, ids, status values, JSONL keys, and `source_ref` tokens are
11
- protocol text and stay unchanged.
12
-
13
- ## Install
14
-
15
- Install the CLI first:
16
-
17
- ```bash
18
- npm i -g @c4a/context-cli
19
- # or
20
- bun add -g @c4a/context-cli
21
- ```
22
-
23
- Then install the bundled plugin marketplace globally:
24
-
25
- ```bash
26
- context plugin install
27
- ```
28
-
29
- The installer resolves the plugin marketplace from the installed CLI package. Published packages use `dist/plugins`; source checkouts use the same generated tree after `bun run --filter @c4a/context-cli build`. For Codex, it materializes the bundled plugin into `~/.codex/plugins/cache/c4a/context/local/`, matching Codex's local-plugin cache convention.
30
-
31
- For a dry run:
32
-
33
- ```bash
34
- context plugin install --dry-run
35
- context plugin path
36
- ```
37
-
38
- ## Workflow
39
-
40
- Run commands from the context project root.
41
-
42
- 1. Initialize a workspace:
43
-
44
- ```bash
45
- context init context
46
- cd context
47
- bun install
48
- ```
49
-
50
- 2. Continue through the installed agent entry:
51
-
52
- ```bash
53
- <host-specific Context continuation command or skill>
54
- ```
55
-
56
- The continuation entry first runs `context status`, then follows CLI diagnostics. It
57
- executes safe mechanical `next:` steps instead of only reporting them, and stops
58
- at `Human gate:` / placeholder next steps, source registration, source scope
59
- selection, review, package output choice, or source-repo operations that require
60
- user approval. It must not infer repo sources or extraction scope from the
61
- surrounding monorepo.
62
- It uses lower-level CLI primitives only when the workspace state requires them:
63
-
64
- - `context source ...`
65
- - `context run ...`
66
- - `context review ...`
67
- - `context close`
68
- - `context build`
69
- - `context verify`
70
-
71
- ## SDK Manual For Agents
72
-
73
- After `bun install`, the project has a local SDK manual under:
74
-
75
- ```text
76
- node_modules/@c4a/context/docs/
77
- ```
78
-
79
- Recommended files:
80
-
81
- - `node_modules/@c4a/context/docs/guides/agent-dialogue.md`
82
- - `node_modules/@c4a/context/docs/guides/agent-guide.md`
83
- - `node_modules/@c4a/context/docs/reference/project-api.md`
84
- - `node_modules/@c4a/context/docs/reference/package-templates.md`
85
-
86
- Template examples are installed at:
87
-
88
- ```text
89
- node_modules/@c4a/context/templates/package-templates/
90
- ```
91
-
92
- Agents should read these files instead of probing `node_modules/@c4a/context/dist`
93
- with ad-hoc scripts.
94
-
95
- ## Workspace Shape
96
-
97
- Committed project state lives in:
98
-
99
- - `src/` — project flow and custom code;
100
- - `sources/repo/index.yaml`, `sources/file/index.yaml`, and
101
- `sources/lark/index.yaml` — source registries;
102
- - `unapproved/entities.jsonl` — draft/rejected/deprecated metadata;
103
- - `unapproved/structure.yaml` — unconfirmed or confirmed prose structure draft;
104
- - `knowledge/` — approved Markdown;
105
- - `knowledge/structure.yaml` — closed structure/edge projection derived from
106
- approved knowledge;
107
- - `dist/` — built packages;
108
- - `README.md`, `AGENTS.md`, `package.json`.
109
-
110
- Runtime scratch lives in `.tmp/context-runtime/` and is ignored.
111
-
112
- ## Agent Entry Points
113
-
114
- The global plugin exposes only the user-facing Context commands for the current workspace:
115
-
116
- - `init`
117
- - `continue`
118
-
119
- The CLI still provides lower-level primitives, but they are not public slash
120
- commands. The continuation entry chooses them based on CLI output and user intent.
121
-
122
- Current source registration, document capture discipline, structure planning,
123
- node classification, reading density, candidate resolution, edge gates,
124
- source-bound section drafting, refresh/update judgment, semantic conflict
125
- judgment, and close guidance live in internal procedures under
126
- `skill-source-scope`, `skill-prose-align`, and `skill-prose-compile`.
127
-
128
- Package-time querying is generated into each built package as the
129
- `knowledge-query` skill. Package output decisions live in `skill-package-output`.
130
- The current workflow does not expose source deletion, purge, or retraction
131
- commands. If a user asks for that kind of lifecycle change, stop and explain
132
- that the current plugin has no approved gate for it; do not recreate
133
- file-mutating operations outside the current workflow.
134
-
135
- Agents should follow the current status route and internal procedures. Do not
136
- call or reconstruct command shapes or payload protocols that are absent from the
137
- current CLI/schema views.
138
-
139
- The CLI performs mechanical work only. It does not clone, checkout, reset, fetch, or call an LLM silently. When source repos are missing or at the wrong commit, it reports diagnostics and expects the agent to ask the user before running external repo operations.
140
-
141
- ## Current Workflow Surface
142
-
143
- This plugin exposes the current workflow through `init` and `continue`.
144
- `continue` starts from `context status`, follows the status route, and delegates
145
- to current source/capture phases, prose align evidence views, source-bound prose
146
- compile, review, close, verify/build/status guidance, OKF indexes, generated
147
- knowledge-query skills, and declared project phase previews.
148
-
149
- Agents must not simulate lifecycle or retraction work by deleting workspace
150
- files. Source deletion, purge, and retraction are not current plugin operations.
@@ -1,136 +0,0 @@
1
- # Context Plugin
2
-
3
- > [English version](./README.md)
4
-
5
- <p align="center"><img src="./assets/logo.svg" alt="C4A Context" width="180"/></p>
6
-
7
- Context 提供面向 Agent 的知识工作区命令。Plugin 安装到全局 Agent 环境;每个知识工作区只保存自己的源声明、待审状态、已批准知识和构建产物。公开入口刻意收口:初始化一次,之后通过 next-step guidance 推进。
8
-
9
- Agent 与用户对话时应使用当前对话语言;CLI 命令、参数、id、状态枚举、JSONL key 和 `source_ref` 属于协议文本,保持英文或原样。
10
-
11
- ## 安装
12
-
13
- 先安装 CLI:
14
-
15
- ```bash
16
- npm i -g @c4a/context-cli
17
- # 或
18
- bun add -g @c4a/context-cli
19
- ```
20
-
21
- 再把随 CLI 包发布的 plugin marketplace 安装到全局:
22
-
23
- ```bash
24
- context plugin install
25
- ```
26
-
27
- 安装器会从当前 CLI 包动态解析 marketplace 目录。发布包使用 `dist/plugins`;源码 checkout 在执行 `bun run --filter @c4a/context-cli build` 后也使用同样的生成目录。对 Codex,安装器会把随包生成的插件复制到 `~/.codex/plugins/cache/c4a/context/local/`,符合 Codex 本地插件的 cache 约定。
28
-
29
- 只查看将执行的操作:
30
-
31
- ```bash
32
- context plugin install --dry-run
33
- context plugin path
34
- ```
35
-
36
- ## 工作流
37
-
38
- 在 context 项目根目录执行命令。
39
-
40
- 1. 初始化工作区:
41
-
42
- ```bash
43
- context init context
44
- cd context
45
- bun install
46
- ```
47
-
48
- 2. 通过已安装的 Agent 入口继续推进:
49
-
50
- ```bash
51
- <当前宿主暴露的 Context continuation command 或 skill>
52
- ```
53
-
54
- Continuation 入口会先运行 `context status`,然后跟随 CLI 诊断。安全的机械 `next:` 步骤会直接执行,不会只把命令复述给用户;遇到 `Human gate:`、带占位符的 next、source 注册、source 范围选择、审阅、package 输出选择或需要用户授权的 source repo 操作才会停下来确认。它不能根据周边 monorepo 自行推断 repo source 或提取范围,只在工作区状态需要时调用底层 CLI 能力:
55
-
56
- - `context source ...`
57
- - `context run ...`
58
- - `context review ...`
59
- - `context close`
60
- - `context build`
61
- - `context verify`
62
-
63
- ## Agent 可读的 SDK 手册
64
-
65
- 执行 `bun install` 后,项目内会有 SDK 手册:
66
-
67
- ```text
68
- node_modules/@c4a/context/docs/
69
- ```
70
-
71
- 推荐先读:
72
-
73
- - `node_modules/@c4a/context/docs/guides/agent-dialogue.md`
74
- - `node_modules/@c4a/context/docs/guides/agent-guide.md`
75
- - `node_modules/@c4a/context/docs/reference/project-api.md`
76
- - `node_modules/@c4a/context/docs/reference/package-templates.md`
77
-
78
- 模板示例在:
79
-
80
- ```text
81
- node_modules/@c4a/context/templates/package-templates/
82
- ```
83
-
84
- Agent 应读取这些文件,不要通过临时脚本反查 `node_modules/@c4a/context/dist`
85
- 来猜 SDK API。
86
-
87
- ## 工作区形态
88
-
89
- 需要提交的项目状态在:
90
-
91
- - `src/`:项目流程和定制代码;
92
- - `sources/repo/index.yaml`、`sources/file/index.yaml`、`sources/lark/index.yaml`:源 registry;
93
- - `unapproved/entities.jsonl`:draft/rejected/deprecated 元信息;
94
- - `unapproved/structure.yaml`:未确认或已确认的文档结构草稿;
95
- - `knowledge/`:approved Markdown;
96
- - `knowledge/structure.yaml`:由 approved knowledge 派生的结构与关系投影;
97
- - `dist/`:构建产物;
98
- - `README.md`、`AGENTS.md`、`package.json`。
99
-
100
- 运行缓存放在 `.tmp/context-runtime/`,并被忽略。
101
-
102
- ## Agent 入口
103
-
104
- 全局 plugin 只暴露面向用户的 Context 命令:
105
-
106
- - `init`
107
- - `continue`
108
-
109
- CLI 仍保留底层能力,但它们不是公开 slash command。Continuation 入口根据 CLI 输出和用户意图选择要调用的底层命令。
110
-
111
- 当前 source 注册、文档 capture 纪律、structure planning、Node 分类、阅读密度、
112
- 候选处理、edge gates、source-bound section drafting、refresh/update 判断、
113
- 语义冲突判断和 close 指引都在 `skill-source-scope`、`skill-prose-align`、
114
- `skill-prose-compile` 下面的内部 procedure。
115
-
116
- 包内查询能力在构建包时生成到 `knowledge-query` skill。package 输出决策在
117
- `skill-package-output`。当前工作流不暴露 source 删除、purge 或撤回命令。
118
- 如果用户要求这类生命周期变更,先停下来说明当前 plugin 没有已批准门禁;
119
- Agent 不得在当前工作流之外重建文件变更类操作。
120
-
121
- Agent 应按当前 status route 和内部 procedure 推进。不要调用或重建当前
122
- CLI/schema views 没有暴露的命令形态或 payload 协议。
123
-
124
- CLI 只做机械操作。它不会静默 clone、checkout、reset、fetch,也不会调用 LLM。源仓库缺失或 commit 不匹配时,CLI 只返回诊断;Agent 需要先征询用户,再决定是否执行外部 repo 操作。
125
-
126
- ## 当前工作流入口
127
-
128
- 本 plugin 只暴露当前工作流入口: `init` 和 `continue`。`continue` 从
129
- `context status` 开始,按 status route 分发到 source/capture phase、prose
130
- align evidence views、source-bound prose compile、review、close、
131
- verify/build/status guidance、OKF indexes、生成包里的 knowledge-query skill,
132
- 以及已声明 project phase 的只读预览。
133
-
134
- Agent 不得通过直接删除 `sources/`、`knowledge/`、`unapproved/`、`dist/`
135
- 或 `.tmp` 来模拟生命周期或撤回操作。source 删除、purge 和撤回不是当前
136
- plugin 操作。
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 758 296" fill="none">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M647.569 0.78043C613.4 3.48518 581.318 15.3269 533.021 43.0605C527.45 46.2597 498.781 61.8832 490.42 67.9156C464.4 83.1281 440.36 99.9754 407.462 125.999C399.965 131.93 392.626 137.658 391.153 138.729C389.68 139.8 382.798 145.128 375.858 150.569C368.919 156.01 358.504 163.98 352.714 168.281L343.516 175.006L348.516 179.006C351.553 181.229 358.164 187.09 362.516 190.006L370.516 196.006L379.016 190.006C384.498 185.597 392.279 178.726 395.782 175.811C399.285 172.896 411.776 162.857 414.201 160.847C416.626 158.838 420.318 155.949 427.144 150.29C445.631 134.963 481.502 112.007 494.26 102.533C581.313 47.1925 633.705 27.2029 682.312 46.6436C688.772 50.1275 692.158 52.8781 699.014 60.2106C706.594 68.3166 708.17 70.6632 712.305 79.9992C717.792 92.3865 720.263 102.609 721.288 117.182C723.104 142.96 716.794 171.243 703.236 198.108C693.06 218.269 684.3 229.708 671.088 242.211C628.153 272.315 597.665 274.481 543.801 261.017C510.873 246.43 487.481 230.006 448.016 193.506C444.204 190.241 440.144 186.014 439.516 186.006C438.281 185.991 399.991 214.634 399.516 216.006C399.235 216.815 404.057 219.412 409.016 222.506C410.702 223.559 412.975 225.335 416.516 227.006C433.391 238.059 468.991 255.632 482.516 262.006C485.929 263.614 490.402 264.707 492.545 265.749C509.884 274.195 533.276 282.099 555.644 287.07C564.55 289.049 601.674 289.814 609.103 288.171C612.031 287.523 616.387 286.554 618.782 286.017C633.747 282.66 656.745 272.897 670.289 264.153C708.746 239.325 740.493 194.104 753.016 146.317C764.533 102.359 755.681 60.2459 728.902 31.5909C712.119 13.6333 693.371 4.36271 667.389 1.17066C661.613 0.461953 656.637 -0.0628543 656.33 0.00607299C656.023 0.0750003 652.081 0.42386 647.569 0.78043ZM122.268 6.91848C100.692 8.62683 75.6783 17.7423 58.0176 30.3336C30.2119 50.158 12.2534 76.5887 3.92103 109.95C0.744084 122.668 -0.943192 149.281 0.550004 163.097C6.34545 216.709 38.9366 261.239 87.8925 282.436C108.528 291.37 128.098 295.45 152.658 295.937C173.489 296.35 191.779 294.037 213.531 288.238C254.082 277.427 282.658 266.098 328.68 231.976C341.818 222.235 344.259 221.314 342.05 219.506C337.696 215.941 316.951 199.525 316.016 199.506C315.451 199.495 312.641 202.192 307.128 205.872C245.084 247.275 198.239 258.453 151.476 252.979C138.261 251.432 123.184 247.836 114.645 244.194C82.5503 230.506 61.7452 207.016 52.8018 174.371C50.4952 165.952 50.3622 164.208 50.7059 146.886C51.0496 129.561 51.2517 127.827 53.8915 119.499C58.217 105.86 62.5516 96.3835 68.4271 87.7254C96.678 46.0924 144.857 34.898 199.322 57.3119C205.245 59.7489 221.144 67.3217 224.619 69.361C245.505 81.6138 248.559 83.5927 268.609 97.8683C286.178 110.375 299.632 125.4 316.016 139.031C330.379 150.982 332.229 144.373 335.6 144.44C337.306 142.561 337.353 141.225 335.571 139.031C334.554 137.779 334.892 138.21 331.041 133.458C307.893 104.899 285.92 82.0366 264.533 63.4627C232.185 35.3673 200.085 17.5822 168.343 10.1701C158.514 7.87465 132.964 6.07147 122.268 6.91848Z" fill="#ef6f2e"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 758 296" fill="none">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M647.569 0.78043C613.4 3.48518 581.318 15.3269 533.021 43.0605C527.45 46.2597 498.781 61.8832 490.42 67.9156C464.4 83.1281 440.36 99.9754 407.462 125.999C399.965 131.93 392.626 137.658 391.153 138.729C389.68 139.8 382.798 145.128 375.858 150.569C368.919 156.01 358.504 163.98 352.714 168.281L343.516 175.006L348.516 179.006C351.553 181.229 358.164 187.09 362.516 190.006L370.516 196.006L379.016 190.006C384.498 185.597 392.279 178.726 395.782 175.811C399.285 172.896 411.776 162.857 414.201 160.847C416.626 158.838 420.318 155.949 427.144 150.29C445.631 134.963 481.502 112.007 494.26 102.533C581.313 47.1925 633.705 27.2029 682.312 46.6436C688.772 50.1275 692.158 52.8781 699.014 60.2106C706.594 68.3166 708.17 70.6632 712.305 79.9992C717.792 92.3865 720.263 102.609 721.288 117.182C723.104 142.96 716.794 171.243 703.236 198.108C693.06 218.269 684.3 229.708 671.088 242.211C628.153 272.315 597.665 274.481 543.801 261.017C510.873 246.43 487.481 230.006 448.016 193.506C444.204 190.241 440.144 186.014 439.516 186.006C438.281 185.991 399.991 214.634 399.516 216.006C399.235 216.815 404.057 219.412 409.016 222.506C410.702 223.559 412.975 225.335 416.516 227.006C433.391 238.059 468.991 255.632 482.516 262.006C485.929 263.614 490.402 264.707 492.545 265.749C509.884 274.195 533.276 282.099 555.644 287.07C564.55 289.049 601.674 289.814 609.103 288.171C612.031 287.523 616.387 286.554 618.782 286.017C633.747 282.66 656.745 272.897 670.289 264.153C708.746 239.325 740.493 194.104 753.016 146.317C764.533 102.359 755.681 60.2459 728.902 31.5909C712.119 13.6333 693.371 4.36271 667.389 1.17066C661.613 0.461953 656.637 -0.0628543 656.33 0.00607299C656.023 0.0750003 652.081 0.42386 647.569 0.78043ZM122.268 6.91848C100.692 8.62683 75.6783 17.7423 58.0176 30.3336C30.2119 50.158 12.2534 76.5887 3.92103 109.95C0.744084 122.668 -0.943192 149.281 0.550004 163.097C6.34545 216.709 38.9366 261.239 87.8925 282.436C108.528 291.37 128.098 295.45 152.658 295.937C173.489 296.35 191.779 294.037 213.531 288.238C254.082 277.427 282.658 266.098 328.68 231.976C341.818 222.235 344.259 221.314 342.05 219.506C337.696 215.941 316.951 199.525 316.016 199.506C315.451 199.495 312.641 202.192 307.128 205.872C245.084 247.275 198.239 258.453 151.476 252.979C138.261 251.432 123.184 247.836 114.645 244.194C82.5503 230.506 61.7452 207.016 52.8018 174.371C50.4952 165.952 50.3622 164.208 50.7059 146.886C51.0496 129.561 51.2517 127.827 53.8915 119.499C58.217 105.86 62.5516 96.3835 68.4271 87.7254C96.678 46.0924 144.857 34.898 199.322 57.3119C205.245 59.7489 221.144 67.3217 224.619 69.361C245.505 81.6138 248.559 83.5927 268.609 97.8683C286.178 110.375 299.632 125.4 316.016 139.031C330.379 150.982 332.229 144.373 335.6 144.44C337.306 142.561 337.353 141.225 335.571 139.031C334.554 137.779 334.892 138.21 331.041 133.458C307.893 104.899 285.92 82.0366 264.533 63.4627C232.185 35.3673 200.085 17.5822 168.343 10.1701C158.514 7.87465 132.964 6.07147 122.268 6.91848Z" fill="#ef6f2e"/>
3
- </svg>
Binary file
Binary file
@@ -1,34 +0,0 @@
1
- ---
2
- description: "Inspect the Context workspace, decide the next useful action, and proceed."
3
- argument-hint: "[user intent]"
4
- allowed-tools: Bash(context:*), Bash(bun:*), Bash(cd *)
5
- ---
6
-
7
- ## Your Task
8
-
9
- Use this as the conversational entry for an existing Context workspace. There is
10
- no `context continue` CLI primitive; the command runs lower-level `context ...`
11
- commands only when the workspace state requires them.
12
-
13
- If the user is starting a new workspace or a new batch from a raw repository
14
- root, do not run `context status` first. Use the public Context init entry or
15
- `context init` to create the workspace, complete the init setup command, then
16
- return here from the initialized workspace.
17
-
18
- If `context status` reports `workspace-not-found` and points at a configured
19
- `context.workspaceDir`, do not keep working from the host repository root. Enter
20
- that workspace when it exists, or initialize it through the init workflow after
21
- confirming with the user.
22
-
23
- Language policy: explain, ask, confirm, and summarize in the user's current
24
- conversation language. Keep CLI commands, flags, paths, ids, status enum values,
25
- JSONL payload keys, `source_ref` values, and copied CLI output tokens unchanged.
26
-
27
- Use the internal `context:skill-continue-workflow` procedure end to end. It owns the
28
- status loop, safe mechanical next steps, source/scope gate, review gate, package
29
- gate, and final report rules.
30
-
31
- Do not infer repo sources, extraction scope, review decisions, or package output
32
- choices from surrounding files. Do not call source-repo operations such as
33
- clone, checkout, reset, fetch, install, build, or test without explicit user
34
- approval.
@@ -1,21 +0,0 @@
1
- ---
2
- description: "Initialize a Context knowledge workspace."
3
- argument-hint: "[project-dir] [--name <name>]"
4
- allowed-tools: Bash(context:*), Bash(bun:*), Bash(cd *)
5
- ---
6
-
7
- ## Your Task
8
-
9
- Initialize a Context workspace with the global CLI, then continue only through
10
- safe mechanical setup steps until the first human decision gate.
11
-
12
- Language policy: explain, ask, confirm, and summarize in the user's current
13
- conversation language. Keep CLI commands, flags, file paths, package names,
14
- enum values, payload keys, and copied CLI output tokens unchanged.
15
-
16
- Use the internal `context:skill-init-workspace` procedure end to end. It owns
17
- the `context init` invocation, dependency install follow-up, generated
18
- `AGENTS.md` handoff, status handoff, and stop conditions.
19
-
20
- Do not add extra project-local agent setup. Do not infer repo sources or
21
- extraction scope from the surrounding monorepo after setup.