@mcpbox/mcpbox-claude 0.1.3 → 0.1.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.
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "mcpbox",
3
+ "owner": {
4
+ "name": "tupical"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "mcpbox-claude",
9
+ "source": "./",
10
+ "description": "MCPBox agent stack for Claude Code. One MCP server (https://mcpbox.ru/v1/mcp) exposing the daruma tracker tools plus the platform pipeline (torii→satori→enma→yatagarasu→fujin→daruma). Ships /mcpbox:{tasks,plan,next,mine,status,close,sync,capture,doctor,mode} + pipeline commands, SessionStart/Stop/UserPromptSubmit hooks, and a managed CLAUDE.md policy covering the full maturity stack."
11
+ }
12
+ ]
13
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcpbox-claude",
3
- "description": "MCPBox × Claude Code glue. Drives the mcpbox MCP server (daruma tracker + full MeiSei pipeline torii→…→fujin→daruma). Ships /mcpbox:{tasks,plan,next,mine,status,close,sync,capture,doctor} and pipeline commands, SessionStart/Stop/UserPromptSubmit hooks, and a managed CLAUDE.md policy that makes mcpbox the default tracker AND pipeline substrate.",
4
- "version": "0.1.0",
3
+ "description": "MCPBox × Claude Code glue. Drives the mcpbox MCP server (daruma tracker + full MeiSei pipeline torii→…→fujin→daruma). Ships /mcpbox:{tasks,plan,next,mine,status,close,sync,capture,doctor,mode} and pipeline commands, SessionStart/Stop/UserPromptSubmit hooks, and a managed CLAUDE.md policy that makes mcpbox the default tracker AND pipeline substrate.",
4
+ "version": "0.1.5",
5
5
  "author": {
6
6
  "name": "tupical"
7
7
  },
package/README.md CHANGED
@@ -7,7 +7,7 @@ and drops a managed policy into each agent's native config file.
7
7
 
8
8
  Normally installed for you by `npx @mcpbox/mcpbox setup` (or
9
9
  `curl -fsSL https://mcpbox.ru/install.sh | sh`), which also registers the MCP
10
- server and picks Global vs Repository scope. Use this CLI directly to manage
10
+ server and picks Repository, Repository (user scope), or Global. Use this CLI directly to manage
11
11
  just the policy.
12
12
 
13
13
  ## What it manages
@@ -16,9 +16,13 @@ just the policy.
16
16
  |--------|----------------------------------------|-------------------------------------|-------|
17
17
  | Claude | `CLAUDE.md` block + plugin (hooks, `/mcpbox:*`) | `claude mcp add` (`.mcp.json` / `~/.claude.json`) | plugin `hooks.json` |
18
18
  | Codex | `AGENTS.md` block (`mcpbox:policy`) | `[mcp_servers.mcpbox]` in `~/.codex/config.toml` | — |
19
- | Cursor | `.cursor/rules/mcpbox-policy.mdc` (`alwaysApply`) | `mcpbox` entry in `.cursor/mcp.json` | — |
19
+ | Cursor | `.cursor/rules/mcpbox-policy.mdc` + `/mcpbox-mode` | `mcpbox` entry in `.cursor/mcp.json` | — |
20
20
  | Kimi | `AGENTS.md` block (`mcpbox:policy`) | `mcpbox` entry in `~/.kimi-code/mcp.json` | `[[hooks]]` block in `~/.kimi-code/config.toml` |
21
21
 
22
+ All four agents accept `mcpbox mode [off|lite|full]` through the managed
23
+ policy. Claude also exposes `/mcpbox:mode`, Cursor exposes `/mcpbox-mode`, and
24
+ the shared value lives in `~/.agents/mcpbox/mode`.
25
+
22
26
  Kimi specifics:
23
27
 
24
28
  - MCP and hooks are **user-level** (Kimi reads hooks only from
@@ -42,6 +46,7 @@ mcpbox-claude kimi-init [--dir DIR] AGENTS.md policy + ~/.kimi-code/mcp.json
42
46
  + ~/.kimi-code/config.toml [[hooks]].
43
47
  mcpbox-claude kimi-uninit [--dir DIR]
44
48
  mcpbox-claude doctor [--json] Check the mcpbox MCP server + policy are wired.
49
+ mcpbox-claude mode [off|lite|full] Show or set the shared pipeline mode.
45
50
  ```
46
51
 
47
52
  All writes are idempotent and preserve surrounding hand-written content.
@@ -6,21 +6,29 @@
6
6
  // (daruma tracker + full pipeline). Idempotent.
7
7
  // mcpbox-claude uninit [--dir DIR] Remove the managed policy block.
8
8
  // mcpbox-claude doctor [--json] Check the mcpbox MCP server + policy are wired.
9
+ // mcpbox-claude mode [off|lite|full] Get/set pipeline strictness (raw-idea routing).
9
10
  // mcpbox-claude --version | --help
10
11
  //
11
12
  // ponytail: no orchestrator (start/team-from-plan) or self-update here — the
12
13
  // mcpbox server already exposes the pipeline tools; add an omc-team driver only
13
14
  // if a CLI-driven execution loop is actually requested.
14
15
 
15
- import { readFileSync } from "node:fs";
16
+ import { existsSync, readFileSync } from "node:fs";
16
17
  import { promises as fs } from "node:fs";
18
+ import { homedir } from "node:os";
17
19
  import { fileURLToPath } from "node:url";
18
20
  import { dirname, join, resolve } from "node:path";
19
21
  import { spawnSync } from "node:child_process";
20
22
  import { installPolicy, removePolicy, BEGIN } from "../lib/policy.mjs";
21
23
  import { installCodex, removeCodex, installCodexPolicy } from "../lib/codex.mjs";
22
- import { installCursor, removeCursor, installCursorRule } from "../lib/cursor.mjs";
24
+ import {
25
+ installCursor,
26
+ removeCursor,
27
+ installCursorRule,
28
+ installCursorModeCommand,
29
+ } from "../lib/cursor.mjs";
23
30
  import { installKimi, removeKimi } from "../lib/kimi.mjs";
31
+ import { readMode, writeMode, MODES } from "../lib/mode.mjs";
24
32
 
25
33
  const __dirname = dirname(fileURLToPath(import.meta.url));
26
34
  const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf8"));
@@ -42,6 +50,11 @@ Usage:
42
50
  Idempotent.
43
51
  mcpbox-claude kimi-uninit [--dir DIR]
44
52
  mcpbox-claude doctor [--json] Check the mcpbox MCP server + policy are wired.
53
+ mcpbox-claude mode [off|lite|full] Get/set pipeline strictness (how raw ideas route).
54
+ mcpbox-claude export-marketplace [--dir DIR]
55
+ Mirror this package to a stable directory usable as
56
+ a Claude Code marketplace; prints the path.
57
+ Default: ~/.agents/mcpbox/marketplace
45
58
  mcpbox-claude --version | -v
46
59
  mcpbox-claude --help | -h
47
60
  `;
@@ -103,16 +116,18 @@ async function cmdCodexUninit(rest) {
103
116
 
104
117
  async function cmdCursorInit(rest) {
105
118
  const { projectDir } = parseDirFlag(rest);
106
- const { rule, mcp } = await installCursor({ projectDir });
119
+ const { rule, mcp, mode } = await installCursor({ projectDir });
107
120
  report(rule);
108
121
  report(mcp);
122
+ report(mode);
109
123
  }
110
124
 
111
125
  async function cmdCursorUninit(rest) {
112
126
  const { projectDir } = parseDirFlag(rest);
113
- const { rule, mcp } = await removeCursor({ projectDir });
127
+ const { rule, mcp, mode } = await removeCursor({ projectDir });
114
128
  report(rule);
115
129
  report(mcp);
130
+ report(mode);
116
131
  }
117
132
 
118
133
  async function cmdKimiInit(rest) {
@@ -141,6 +156,7 @@ async function cmdCodexPolicy(rest) {
141
156
  async function cmdCursorPolicy(rest) {
142
157
  const { projectDir } = parseDirFlag(rest);
143
158
  report(await installCursorRule({ projectDir }));
159
+ report(await installCursorModeCommand({ projectDir }));
144
160
  }
145
161
 
146
162
  async function policyPresent(projectDir) {
@@ -160,6 +176,16 @@ function mcpServerPresent() {
160
176
  return /(^|\n)\s*mcpbox\b/.test(r.stdout);
161
177
  }
162
178
 
179
+ async function cmdMode(rest) {
180
+ const [arg] = rest;
181
+ if (!arg || arg === "--show") {
182
+ process.stdout.write(`mcpbox pipeline mode: ${readMode()} (${MODES.join(" | ")})\n`);
183
+ return;
184
+ }
185
+ const m = await writeMode(arg); // throws on invalid → caught by main().catch
186
+ process.stdout.write(`✓ mcpbox pipeline mode: ${m}\n`);
187
+ }
188
+
163
189
  async function cmdDoctor(rest) {
164
190
  const json = rest.includes("--json");
165
191
  const flags = rest.filter((a) => a !== "--json");
@@ -182,6 +208,25 @@ async function cmdDoctor(rest) {
182
208
  process.exit(ready ? 0 : 1);
183
209
  }
184
210
 
211
+ // The marketplace repo is private, so `claude plugin marketplace add
212
+ // tupical/mcpbox.ru` only resolves for users with access to it. This package is
213
+ // public and carries .claude-plugin/marketplace.json, so it can be the
214
+ // marketplace itself — but Claude Code reads a directory marketplace in place
215
+ // rather than copying it, and npx unpacks us into a disposable cache. Mirror
216
+ // the package to a stable path first.
217
+ async function cmdExportMarketplace(rest) {
218
+ const { projectDir } = parseDirFlag(rest);
219
+ const source = resolve(__dirname, "..");
220
+ const target = resolve(projectDir ?? join(homedir(), ".agents", "mcpbox", "marketplace"));
221
+ if (existsSync(target) && !existsSync(join(target, ".claude-plugin", "marketplace.json"))) {
222
+ throw new Error(`${target} exists and is not an mcpbox marketplace — refusing to overwrite it`);
223
+ }
224
+ await fs.rm(target, { recursive: true, force: true });
225
+ await fs.mkdir(dirname(target), { recursive: true });
226
+ await fs.cp(source, target, { recursive: true });
227
+ process.stdout.write(`${target}\n`);
228
+ }
229
+
185
230
  async function main(argv) {
186
231
  const [, , cmd, ...rest] = argv;
187
232
  switch (cmd) {
@@ -217,6 +262,10 @@ async function main(argv) {
217
262
  return cmdCursorPolicy(rest);
218
263
  case "doctor":
219
264
  return cmdDoctor(rest);
265
+ case "mode":
266
+ return cmdMode(rest);
267
+ case "export-marketplace":
268
+ return cmdExportMarketplace(rest);
220
269
  default:
221
270
  process.stderr.write(`Unknown command: ${cmd}\n\n${HELP}`);
222
271
  process.exit(2);
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Set how strictly raw ideas route through the mcpbox maturity pipeline (off | lite | full).
3
+ ---
4
+
5
+ The user invoked `/mcpbox:mode` with `$ARGUMENTS` = `off` | `lite` | `full` (empty → show current).
6
+
7
+ ## What each level does
8
+
9
+ - **off** — no pipeline nudging. Treat every request as direct daruma task tracking.
10
+ - **lite** (default) — nudge toward the pipeline only when the input explicitly mentions it
11
+ (pipeline / maturity / handoff / конвейер …).
12
+ - **full** — assess every substantive request for **rawness**. A raw idea, hypothesis, or
13
+ undecided direction matures through the pipeline (`mcpbox_pipeline_run` → …fujin → handoff)
14
+ before any daruma task; a concrete, bounded task goes straight to daruma.
15
+
16
+ The level persists across sessions (stored in `~/.agents/mcpbox/mode`) and is read by the
17
+ UserPromptSubmit hook, which injects the matching reminder on each prompt.
18
+
19
+ ## Steps
20
+
21
+ 1. Run:
22
+ - Claude plugin: `node "${CLAUDE_PLUGIN_ROOT}/bin/mcpbox-claude.mjs" mode $ARGUMENTS`
23
+ - Other agents: `npx -y @mcpbox/mcpbox-claude@latest mode $ARGUMENTS`
24
+ - empty `$ARGUMENTS` → prints the current mode.
25
+ - invalid value → the CLI errors with the allowed set (`off | lite | full`); relay it verbatim.
26
+ 2. Report the resulting mode in one line.
@@ -12,9 +12,11 @@
12
12
  // Claude Code — this also covers Claude setups without the env var).
13
13
 
14
14
  import { pathToFileURL } from "node:url";
15
+ import { readMode } from "../lib/mode.mjs";
15
16
 
16
17
  // Intent patterns. Order matters — first match wins. ASCII keywords use \b;
17
18
  // Cyrillic uses whitespace/edge guards since \b is ASCII-only.
19
+ // PATTERNS[0] is the pipeline pattern — mode "off" drops it (see promptSubmitHint).
18
20
  const PATTERNS = [
19
21
  {
20
22
  re: /\b(pipeline|maturity|handoff|action\s*packet)\b|(?<![а-яёА-ЯЁ])(пайплайн|конвейер|зрелость|хендофф)(?![а-яёА-ЯЁ])/,
@@ -47,14 +49,25 @@ const PATTERNS = [
47
49
  },
48
50
  ];
49
51
 
50
- export function promptSubmitHint(promptText = "") {
52
+ // full mode: remind the agent to judge rawness itself — a regex can't. Only
53
+ // fires on substantive prompts that didn't already match an explicit intent.
54
+ const FULL_ASSESS_HINT =
55
+ "[mcpbox:full] Assess this request for rawness before acting: a raw idea / hypothesis / undecided direction matures through the pipeline (mcpbox_pipeline_run → …fujin → handoff) before any daruma task; a concrete, bounded task goes straight to daruma.";
56
+
57
+ // ponytail: length heuristic for "substantive" — cheap and good enough to skip
58
+ // "ok"/"yes"/"go". Swap for a token/keyword check only if it nags in practice.
59
+ const SUBSTANTIVE_MIN = 40;
60
+
61
+ export function promptSubmitHint(promptText = "", mode = "lite") {
51
62
  // Strip fenced code blocks so a keyword pasted inside ``` … ``` doesn't
52
63
  // trigger a routing hint (OMC-style false-positive guard, kept minimal —
53
64
  // these hints are low-stakes suggestions, not mode activation).
54
65
  const prompt = promptText.replace(/```[\s\S]*?```/g, " ").toLowerCase().trim();
55
- for (const { re, hint } of PATTERNS) {
66
+ const patterns = mode === "off" ? PATTERNS.slice(1) : PATTERNS;
67
+ for (const { re, hint } of patterns) {
56
68
  if (re.test(prompt)) return hint;
57
69
  }
70
+ if (mode === "full" && prompt.length >= SUBSTANTIVE_MIN) return FULL_ASSESS_HINT;
58
71
  return "";
59
72
  }
60
73
 
@@ -99,7 +112,7 @@ async function main() {
99
112
  } catch { /* not JSON — no prompt to route */ }
100
113
  }
101
114
  }
102
- const hint = promptSubmitHint(prompt);
115
+ const hint = promptSubmitHint(prompt, readMode());
103
116
  if (hint) process.stdout.write(hint + "\n");
104
117
  }
105
118
 
package/lib/cursor.mjs CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  import { promises as fs } from "node:fs";
11
11
  import { dirname, join, resolve } from "node:path";
12
+ import { fileURLToPath } from "node:url";
12
13
  import { BLOCK_BODY, MCP_URL } from "./policy.mjs";
13
14
 
14
15
  const RULE_FRONTMATTER = `---
@@ -34,6 +35,38 @@ function mcpPath(projectDir) {
34
35
  }
35
36
 
36
37
  const MCP_ENTRY = { type: "http", url: MCP_URL };
38
+ const MODE_COMMAND_SOURCE = join(dirname(fileURLToPath(import.meta.url)), "..", "commands", "mode.md");
39
+
40
+ function modeCommandPath(projectDir) {
41
+ const dir = projectDir ? resolve(projectDir) : process.cwd();
42
+ return join(dir, ".cursor", "commands", "mcpbox-mode.md");
43
+ }
44
+
45
+ export async function installCursorModeCommand({ projectDir } = {}) {
46
+ const target = modeCommandPath(projectDir);
47
+ const content = await fs.readFile(MODE_COMMAND_SOURCE, "utf8");
48
+ await fs.mkdir(dirname(target), { recursive: true });
49
+ let existing = null;
50
+ try {
51
+ existing = await fs.readFile(target, "utf8");
52
+ } catch (err) {
53
+ if (err.code !== "ENOENT") throw err;
54
+ }
55
+ if (existing === content) return { action: "unchanged", path: target };
56
+ await fs.writeFile(target, content);
57
+ return { action: existing === null ? "installed" : "updated", path: target };
58
+ }
59
+
60
+ export async function removeCursorModeCommand({ projectDir } = {}) {
61
+ const target = modeCommandPath(projectDir);
62
+ try {
63
+ await fs.unlink(target);
64
+ return { action: "removed-file", path: target };
65
+ } catch (err) {
66
+ if (err.code === "ENOENT") return { action: "missing", path: target };
67
+ throw err;
68
+ }
69
+ }
37
70
 
38
71
  // `.cursor/rules/mcpbox-policy.mdc` — whole-file managed rule.
39
72
  export async function installCursorRule({ projectDir } = {}) {
@@ -109,13 +142,15 @@ export async function removeCursorMcp({ projectDir } = {}) {
109
142
  export async function installCursor({ projectDir } = {}) {
110
143
  const rule = await installCursorRule({ projectDir });
111
144
  const mcp = await installCursorMcp({ projectDir });
112
- return { rule, mcp };
145
+ const mode = await installCursorModeCommand({ projectDir });
146
+ return { rule, mcp, mode };
113
147
  }
114
148
 
115
149
  export async function removeCursor({ projectDir } = {}) {
116
150
  const rule = await removeCursorRule({ projectDir });
117
151
  const mcp = await removeCursorMcp({ projectDir });
118
- return { rule, mcp };
152
+ const mode = await removeCursorModeCommand({ projectDir });
153
+ return { rule, mcp, mode };
119
154
  }
120
155
 
121
- export { rulePath, mcpPath };
156
+ export { rulePath, mcpPath, modeCommandPath };
package/lib/kimi.mjs CHANGED
@@ -46,6 +46,7 @@ const HOOK_ASSETS = [
46
46
  ["hooks", "user-prompt-submit.mjs"],
47
47
  ["hooks", "stop.mjs"],
48
48
  ["lib", "mcp-client.mjs"],
49
+ ["lib", "mode.mjs"],
49
50
  ];
50
51
 
51
52
  const MCP_ENTRY = { url: MCP_URL };
package/lib/mode.mjs ADDED
@@ -0,0 +1,44 @@
1
+ // Pipeline strictness mode: how aggressively raw ideas get routed through the
2
+ // mcpbox maturity pipeline (torii→…→fujin→handoff) vs. tracked directly in daruma.
3
+ //
4
+ // off — no pipeline nudging; every request is treated as direct daruma work.
5
+ // lite — nudge toward the pipeline only when the input explicitly mentions it. (default)
6
+ // full — remind the agent to assess every substantive request for "rawness":
7
+ // raw ideas mature through the pipeline; concrete bounded tasks go to daruma.
8
+ //
9
+ // The `mcpbox-claude mode` CLI writes it; hooks and the shared agent policy
10
+ // read it. The old Claude-only file remains a read fallback for upgrades.
11
+
12
+ import { promises as fs, readFileSync } from "node:fs";
13
+ import { homedir } from "node:os";
14
+ import { dirname, join } from "node:path";
15
+
16
+ export const MODES = ["off", "lite", "full"];
17
+ export const DEFAULT_MODE = "lite";
18
+
19
+ // ponytail: one shared file for every agent. Key it on cwd only if per-repo
20
+ // strictness is ever needed.
21
+ export const modeFile = (home = homedir()) => join(home, ".agents", "mcpbox", "mode");
22
+ const legacyModeFile = (home = homedir()) => join(home, ".claude", "mcpbox-mode");
23
+
24
+ export function readMode(home = homedir()) {
25
+ for (const file of [modeFile(home), legacyModeFile(home)]) {
26
+ try {
27
+ const v = readFileSync(file, "utf8").trim();
28
+ if (MODES.includes(v)) return v;
29
+ } catch {
30
+ // missing / unreadable → try the legacy file, then default
31
+ }
32
+ }
33
+ return DEFAULT_MODE;
34
+ }
35
+
36
+ export async function writeMode(mode, home = homedir()) {
37
+ if (!MODES.includes(mode)) {
38
+ throw new Error(`invalid mode "${mode}" — want one of: ${MODES.join(" | ")}`);
39
+ }
40
+ const file = modeFile(home);
41
+ await fs.mkdir(dirname(file), { recursive: true });
42
+ await fs.writeFile(file, mode + "\n");
43
+ return mode;
44
+ }
package/lib/policy.mjs CHANGED
@@ -158,6 +158,23 @@ rule is enforced by the **server**: each layer takes only the persisted output
158
158
  of the previous layer (except \`torii\`), and skipping a layer or targeting
159
159
  \`torii\` returns \`422\`. The agent cannot invent a layer's input.
160
160
 
161
+ ### Pipeline mode
162
+
163
+ The shared mode is stored in \`~/.agents/mcpbox/mode\` (missing means
164
+ \`lite\`) and applies to Claude, Codex, Cursor, and Kimi:
165
+
166
+ - \`off\` — never nudge toward the pipeline.
167
+ - \`lite\` — use it only when the request explicitly asks for pipeline,
168
+ maturity, handoff, or «конвейер».
169
+ - \`full\` — assess every substantive request for rawness; raw ideas go
170
+ through the pipeline, concrete bounded work goes directly to daruma.
171
+
172
+ Before routing a substantive request, read and honor that file. If the user
173
+ enters \`mcpbox mode\` or \`mcpbox mode off|lite|full\`, run
174
+ \`npx -y @mcpbox/mcpbox-claude@latest mode [value]\` and report its one-line
175
+ result. Do not confuse this pipeline mode with the daruma cloud/self-host
176
+ profile.
177
+
161
178
  ### Maturity route
162
179
 
163
180
  \`\`\`
@@ -220,6 +237,7 @@ daruma execution задача/план (терминальный слой
220
237
  - \`/mcpbox:next\` — claim the next ready task.
221
238
  - \`/mcpbox:mine\` — tasks claimed by this session.
222
239
  - \`/mcpbox:status\` — server + pipeline health (\`daruma_healthz\`, recent runs).
240
+ - \`/mcpbox:mode [off|lite|full]\` — show or set the shared pipeline mode.
223
241
  - \`/mcpbox:pipeline-run "<idea>"\` — open a maturity run from raw input.
224
242
  - \`/mcpbox:trace <run_id>\` — trace a run's lineage and per-hop status.
225
243
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpbox/mcpbox-claude",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "MCPBox agent harness for Claude Code: managed policy (daruma tracker + full pipeline), hooks, and slash commands over the single mcpbox MCP server.",
5
5
  "type": "module",
6
6
  "publishConfig": {