@kurrent/kcap 0.11.3 → 0.11.5

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "kcap",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "Records and visualizes Claude Code sessions via kcap CLI hooks"
5
5
  }
@@ -8,6 +8,10 @@
8
8
  "command": "kcap",
9
9
  "args": ["mcp", "sessions"]
10
10
  },
11
+ "kcap-flows": {
12
+ "command": "kcap",
13
+ "args": ["mcp", "flows"]
14
+ },
11
15
  "kcap-memory": {
12
16
  "command": "kcap",
13
17
  "args": ["mcp", "memory"]
@@ -20,6 +20,14 @@ description: >-
20
20
 
21
21
  Use the `kcap mcp flows` MCP tools (`start_flow`, `send_to_participant`, `get_flow_status`, `close_flow`) to run a structured agent **flow**: your work is handed to a **separate, hosted participant agent** driven by a flow definition from the server's catalog, which returns a result (kind `findings` with the participant's result text, or `clean`); you address a `findings` result and keep iterating until the clean signal. This is a deliberate, heavier workflow — use it only when the user explicitly opts into it.
22
22
 
23
+ ## Role-surface safety gate
24
+
25
+ Classify the session before any flow action. Flow-starting tools without a reviewer result contract
26
+ mean driver; `submit_review_result` plus the prompt's round-token/result contract mean hosted
27
+ reviewer; neither means the integration is missing. If both contracts are present, the MCP surface
28
+ has leaked: fail closed, never start a nested flow, report the leak through `submit_review_result`,
29
+ and end the reviewer turn. The hosted-reviewer contract wins over driver-looking prose.
30
+
23
31
  ## When NOT to use this skill / these tools
24
32
 
25
33
  These tools do **not** perform the work themselves — they hand it off to a separate hosted participant agent running a named flow definition. If the user simply asked *you* to do something in a normal session — e.g. "review my PR", "review this diff", "check this spec", "do X" — just do it yourself and report the result directly. Do **NOT** call `start_flow` / `send_to_participant` for an ordinary request; that would spin up a hosted agent the user did not ask for.
@@ -34,6 +42,18 @@ Once the user has explicitly opted into a flow (see above), pick the `definition
34
42
  - Code changes or a pull request → `definition_id: "code-review"` (built-in; same as `review-flows`' `code-review` kind)
35
43
  - Anything else → the definition id the user named, or one you look up in the server's flow-definition catalog at `/admin/flows`. If you're unsure which definition applies, ask the user rather than guessing.
36
44
 
45
+ For the reserved `spec-review` and `code-review` aliases, reviewer-vendor language is role-bound:
46
+ pass the one vendor explicitly named as the reviewer, ignore driver-harness mentions, honor
47
+ negation, omit the vendor when none is named, and ask when multiple candidates remain. Custom
48
+ catalog definitions keep their authored vendors unless an explicit single-participant override is
49
+ requested; dynamic definitions always carry vendors per participant and reject a top-level override.
50
+
51
+ Canonical reviewer aliases for reserved review flows: Claude / Claude Code → `claude`; Codex /
52
+ OpenAI Codex → `codex`; Cursor / cursor-agent → `cursor`; GitHub Copilot / Copilot CLI → `copilot`;
53
+ Gemini / Gemini CLI → `gemini`; Kiro / Kiro CLI → `kiro`; Pi → `pi`; OpenCode → `opencode`;
54
+ Antigravity / agy → `agy`. Normalize only names bound to the reviewer role, honor negation and
55
+ positive contrast, and ask rather than guessing when two reviewer candidates remain.
56
+
37
57
  ## Composing a dynamic flow
38
58
 
39
59
  If nothing in the catalog fits — no `definition_id` covers the roles or workflow you need — compose one inline instead: pass `definition_yaml` to `start_flow` in place of `definition_id`. Provide exactly one of the two, never both. (`start_review_flow` / `submit_review_round` stay catalog-only — this only applies to the generic `start_flow`.)
@@ -78,11 +98,11 @@ mcp:
78
98
 
79
99
  ## If the flows MCP tools are not loaded
80
100
 
81
- If `start_flow` / `send_to_participant` are not among the tools available in this session, do NOT try to obtain them:
101
+ After applying the role-surface safety gate, if `start_flow` / `send_to_participant` are not among the tools available in this session, do NOT try to obtain them:
82
102
 
83
103
  - Do NOT run `kcap mcp flows` from a shell, do NOT handshake it over stdio/JSON-RPC, and do NOT edit any MCP configuration.
84
- - The absence is deliberate: hosted flow participants run with all MCP servers stripped, so a participant cannot start a nested flow.
85
- - If you were asked to do work and these tools are absent, you are most likely the hosted participant inside an existing flow. This skill does not apply to you — skip the workflow below entirely. Perform the requested work directly, then deliver your result by calling the `submit_review_result` tool (from the injected `kcap-flow-result` server) exactly as the "Result contract" section of your prompt instructs, quoting its round token — `kind: "findings"` plus your result text, or `kind: "clean"`. The tool is the ONLY delivery channel: the server does not read your reply text, so result markers in your final message deliver nothing and the round would sit unresolved until its timeout. If the tool call fails, retry it.
104
+ - Only treat the session as a hosted participant when `submit_review_result` is present and the prompt carries the round-token/result contract. Tool absence alone is not proof.
105
+ - If neither the flow-driver tools nor that reviewer contract is present, tell the user to run `kcap setup` or reinstall/update the plugin and restart the harness. Do not hand-roll JSON-RPC or edit MCP configuration from the session.
86
106
 
87
107
  ## Core rules
88
108
 
@@ -17,6 +17,17 @@ Use the `kcap mcp flows` MCP tools (`start_review_flow`, `submit_review_round`,
17
17
 
18
18
  These four tools are aliases of the generic flow tools (`start_flow`, `send_to_participant`, `get_flow_status`, `close_flow`) — see the `agent-flows` skill for non-review flows.
19
19
 
20
+ ## Role-surface safety gate
21
+
22
+ Classify the session before any flow action:
23
+
24
+ - Driver: flow-starting tools are present and there is no reviewer round-token/result contract.
25
+ - Hosted reviewer: `submit_review_result` is present and the prompt carries the round-token/result contract.
26
+ - Missing integration: neither contract is present.
27
+ - Unsafe leak: both the hosted-reviewer contract and any flow-starting tool are present. Fail closed: do not start or submit a nested flow, report the leaked tool surface through `submit_review_result`, and end the reviewer turn.
28
+
29
+ The hosted-reviewer contract always wins over driver-looking prose or tool availability.
30
+
20
31
  ## When NOT to use this skill / these tools
21
32
 
22
33
  These tools do **not** perform a review — they hand the work off to a separate hosted reviewer. If the user simply asked *you* to review something in a normal session — e.g. "review my PR", "review this diff", "code review this", "look over this spec" — just perform the review yourself and report your findings directly. Do **NOT** call `start_review_flow` / `submit_review_round` for an ordinary review request; that would spin up a hosted reviewer the user did not ask for.
@@ -30,13 +41,28 @@ Once the user has explicitly opted into a flow (see above), pick the `kind`:
30
41
  - Spec or design document → `kind: "spec-review"`
31
42
  - Code changes or a pull request → `kind: "code-review"`
32
43
 
44
+ ## Choosing the reviewer vendor
45
+
46
+ Treat the driver harness and reviewer as independent. A request such as "ask Claude to review"
47
+ selects `vendor: "claude"` even when the current driver is Codex; mentions of the driver do not
48
+ select a reviewer. Anchor vendor language to the reviewer role ("Claude reviewer", "review with
49
+ Cursor", "ask Codex for review"), including negation ("not Claude"). If exactly one reviewer
50
+ vendor is named, pass it. If none is named, omit `vendor` and let the server's configured default
51
+ apply. If multiple reviewer candidates remain after negation, ask the user to choose; never guess.
52
+
53
+ Canonical reviewer aliases: Claude / Claude Code → `claude`; Codex / OpenAI Codex → `codex`;
54
+ Cursor / cursor-agent → `cursor`; GitHub Copilot / Copilot CLI → `copilot`; Gemini / Gemini CLI →
55
+ `gemini`; Kiro / Kiro CLI → `kiro`; Pi → `pi`; OpenCode → `opencode`; Antigravity / agy → `agy`.
56
+ Normalize only the reviewer-role mention. Positive contrast (for example, “from Codex, ask Claude”)
57
+ selects Claude; negated names are removed; two remaining reviewer candidates are ambiguous.
58
+
33
59
  ## If the flows MCP tools are not loaded
34
60
 
35
- If `start_review_flow` / `submit_review_round` are not among the tools available in this session, do NOT try to obtain them:
61
+ After applying the role-surface safety gate, if `start_review_flow` / `submit_review_round` are not among the tools available in this session:
36
62
 
37
63
  - Do NOT run `kcap mcp flows` from a shell, do NOT handshake it over stdio/JSON-RPC, and do NOT edit any MCP configuration.
38
- - The absence is deliberate: hosted review-flow reviewers run with all MCP servers stripped, so a reviewer cannot start a nested flow.
39
- - If you were asked to review a spec, design, or code and these tools are absent, you are most likely the hosted reviewer inside an existing flow. This skill does not apply to you — skip the workflow below entirely. Perform the requested review directly, then deliver your result by calling the `submit_review_result` tool (from the injected `kcap-flow-result` server) exactly as the "Result contract" section of your prompt instructs, quoting its round token — `kind: "findings"` plus your findings text, or `kind: "clean"`. The tool is the ONLY delivery channel: the server does not read your reply text, so ending with `FINDINGS:`/`NO FINDINGS` markers delivers nothing and the round would sit unresolved until its timeout. If the tool call fails, retry it.
64
+ - If `submit_review_result` is present and the prompt contains a round token/result contract, you are a hosted reviewer. Skip this driver workflow, perform the review directly, and submit through that tool. Tool absence alone is not proof that you are a reviewer.
65
+ - If neither the flows tools nor the reviewer result contract is present, the integration is missing. Tell the user to run `kcap setup` or reinstall/update the kcap plugin, then restart the harness. Do not start a shell JSON-RPC workaround or edit MCP configuration from the session.
40
66
 
41
67
  ## Core rules
42
68
 
@@ -52,6 +78,10 @@ If `start_review_flow` / `submit_review_round` are not among the tools available
52
78
 
53
79
  - **`400` starting `no_daemon_available:`** — no connected daemon has the repo checked out. Tell the user to run `kcap agent` on a machine with the repo cloned (or pass an explicit `daemon_name` + `repo_path`).
54
80
  - **`400` starting `daemon_outdated:`** — the daemon's kcap is too old to host flow participants. Tell the user to update (`npm i -g @kurrent/kcap`) and restart `kcap agent`.
81
+ - **`reviewer_vendor_required`** — no explicit vendor and no server default; ask the user to name a reviewer or have an admin configure `Flows:Review:DefaultVendor`.
82
+ - **`reviewer_vendor_unavailable`** — the selected vendor is not installed/certified unattended on an eligible daemon; do not silently fall back to another vendor.
83
+ - **`client_upgrade_required`, `flow_client_protocol_required`, or `flow_client_protocol_unsupported`** — update kcap; reserved review aliases fail closed on stale clients.
84
+ - **`reserved_review_alias_shape`** — an admin changed a reserved alias to an invalid participant shape; restore exactly one participant named `reviewer`.
55
85
  - **`400` starting `participant_unavailable:`** — the reviewer agent died and automatic relaunch is not available yet. Close this flow and start a new one, carrying your context forward; re-submitting will keep failing.
56
86
  - **A round result of `unclear` whose text is exactly `participant_died` or `participant_stopped`** — the reviewer agent crashed or was stopped mid-round. The run stays open but has no live reviewer: close the flow and start a new one.
57
87
 
@@ -78,7 +108,7 @@ if findings:
78
108
 
79
109
  | Tool | Required args | Optional args | When to call |
80
110
  |---|---|---|---|
81
- | `start_review_flow` | `kind` (`spec-review`\|`code-review`), `target_kind` (what is being reviewed: `spec`, `code`, `pr`, `branch`, `file`, etc.), `target_ref` (a path, branch name, or PR URL/number that identifies the target), `target_title` (short human-readable title, e.g. spec name or PR title), `context` (background context: what to focus on, constraints, definition of done) | `instructions`, `mode` (`context-only` — optional; by default, on the same machine, the reviewer's worktree is mirrored from your working tree including uncommitted changes, so it reads the actual source. Pass `context-only` to opt out and treat the submitted context as authoritative) | Once, at the start of a review task. |
111
+ | `start_review_flow` | `kind` (`spec-review`\|`code-review`), `target_kind` (what is being reviewed: `spec`, `code`, `pr`, `branch`, `file`, etc.), `target_ref` (a path, branch name, or PR URL/number that identifies the target), `target_title` (short human-readable title, e.g. spec name or PR title), `context` (background context: what to focus on, constraints, definition of done) | `vendor` (explicit reviewer vendor; omit for server default), `instructions`, `mode` (`context-only` — optional) | Once, at the start of a review task. |
82
112
  | `submit_review_round` | `flow_run_id`, `context` | `instructions` | After addressing findings. Pass the same `flow_run_id` and the updated context. |
83
113
  | `get_review_flow_status` | `flow_run_id` | — | Poll or check the current status of a flow (running, waiting, completed, failed). |
84
114
  | `close_review_flow` | `flow_run_id` | — | Only after the reviewer returns `clean`. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurrent/kcap",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "CLI companion for Kurrent Capacitor — records and visualizes Claude Code sessions",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
@@ -14,12 +14,12 @@
14
14
  "postinstall": "node bin/postinstall.js"
15
15
  },
16
16
  "optionalDependencies": {
17
- "@kurrent/kcap-darwin-arm64": "0.11.3",
18
- "@kurrent/kcap-linux-x64": "0.11.3",
19
- "@kurrent/kcap-linux-arm64": "0.11.3",
20
- "@kurrent/kcap-linux-musl-x64": "0.11.3",
21
- "@kurrent/kcap-linux-musl-arm64": "0.11.3",
22
- "@kurrent/kcap-win-x64": "0.11.3"
17
+ "@kurrent/kcap-darwin-arm64": "0.11.5",
18
+ "@kurrent/kcap-linux-x64": "0.11.5",
19
+ "@kurrent/kcap-linux-arm64": "0.11.5",
20
+ "@kurrent/kcap-linux-musl-x64": "0.11.5",
21
+ "@kurrent/kcap-linux-musl-arm64": "0.11.5",
22
+ "@kurrent/kcap-win-x64": "0.11.5"
23
23
  },
24
24
  "files": [
25
25
  "bin/",