@mcpbox/mcpbox-claude 0.1.6 → 0.1.8

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,20 @@
1
+ {
2
+ "name": "mcpbox",
3
+ "interface": {
4
+ "displayName": "MCPBox"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "mcpbox",
9
+ "source": {
10
+ "source": "local",
11
+ "path": "."
12
+ },
13
+ "policy": {
14
+ "installation": "AVAILABLE",
15
+ "authentication": "ON_INSTALL"
16
+ },
17
+ "category": "Productivity"
18
+ }
19
+ ]
20
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcpbox-claude",
3
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.6",
4
+ "version": "0.1.8",
5
5
  "author": {
6
6
  "name": "tupical"
7
7
  },
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "mcpbox",
3
+ "version": "0.1.7",
4
+ "description": "MCPBox agent stack for Codex: the daruma tracker plus the MeiSei maturity pipeline behind one MCP server.",
5
+ "author": {
6
+ "name": "tupical"
7
+ },
8
+ "homepage": "https://mcpbox.ru",
9
+ "mcpServers": "./.mcp.json",
10
+ "interface": {
11
+ "displayName": "MCPBox",
12
+ "shortDescription": "Task tracker + maturity pipeline for agents.",
13
+ "longDescription": "One MCP endpoint (https://mcpbox.ru/v1/mcp) exposing the daruma tracker (tasks, plans, plan-only intake) and the platform pipeline torii→satori→enma→yatagarasu→fujin→daruma. Ships the routing policy as a skill and /mcpbox-* prompts.",
14
+ "developerName": "tupical",
15
+ "category": "Productivity",
16
+ "websiteURL": "https://mcpbox.ru"
17
+ }
18
+ }
package/.mcp.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "mcpbox": {
4
+ "type": "http",
5
+ "url": "https://mcpbox.ru/v1/mcp",
6
+ "oauth_resource": "https://mcpbox.ru/v1/mcp"
7
+ }
8
+ }
9
+ }
@@ -39,8 +39,9 @@ Usage:
39
39
  mcpbox-claude init [--dir DIR] Write the managed CLAUDE.md policy block
40
40
  (daruma tracker + full pipeline). Idempotent.
41
41
  mcpbox-claude uninit [--dir DIR] Remove the managed CLAUDE.md policy block.
42
- mcpbox-claude codex-init [--dir DIR] Write AGENTS.md policy + ~/.codex/config.toml
43
- [mcp_servers.mcpbox]. Idempotent.
42
+ mcpbox-claude codex-init [--dir DIR] Write AGENTS.md policy, ~/.codex/config.toml
43
+ [mcp_servers.mcpbox], the mcpbox skill and
44
+ /mcpbox-* prompts. Idempotent.
44
45
  mcpbox-claude codex-uninit [--dir DIR]
45
46
  mcpbox-claude cursor-init [--dir DIR] Write .cursor/rules/mcpbox-policy.mdc +
46
47
  .cursor/mcp.json mcpbox entry. Idempotent.
@@ -102,16 +103,20 @@ function report(r) {
102
103
 
103
104
  async function cmdCodexInit(rest) {
104
105
  const { projectDir } = parseDirFlag(rest);
105
- const { policy, mcp } = await installCodex({ projectDir });
106
+ const { policy, mcp, skill, prompts } = await installCodex({ projectDir });
106
107
  report(policy);
107
108
  report(mcp);
109
+ report(skill);
110
+ report(prompts);
108
111
  }
109
112
 
110
113
  async function cmdCodexUninit(rest) {
111
114
  const { projectDir } = parseDirFlag(rest);
112
- const { policy, mcp } = await removeCodex({ projectDir });
115
+ const { policy, mcp, skill, prompts } = await removeCodex({ projectDir });
113
116
  report(policy);
114
117
  report(mcp);
118
+ report(skill);
119
+ report(prompts);
115
120
  }
116
121
 
117
122
  async function cmdCursorInit(rest) {
package/commands/mode.md CHANGED
@@ -6,12 +6,19 @@ The user invoked `/mcpbox:mode` with `$ARGUMENTS` = `off` | `lite` | `full` (emp
6
6
 
7
7
  ## What each level does
8
8
 
9
- - **off** — no pipeline nudging. Treat every request as direct daruma task tracking.
9
+ - **off** — no pipeline nudging; don't raise the pipeline on your own. Raw material still
10
+ isn't materialized straight into daruma — ask the user instead.
10
11
  - **lite** (default) — nudge toward the pipeline only when the input explicitly mentions it
11
12
  (pipeline / maturity / handoff / конвейер …).
12
13
  - **full** — assess every substantive request for **rawness**. A raw idea, hypothesis, or
13
14
  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
+ before it becomes a task.
16
+
17
+ The mode only tunes how actively you *offer* the pipeline. It does not change where work
18
+ lands — that is the one routing rule, identical in the MCP server's `initialize` instructions,
19
+ the policy block, and the `daruma_plan_materialize` description: decided-and-bounded work and
20
+ follow-ups extending a run you already have go straight to daruma; only raw material goes
21
+ through the pipeline.
15
22
 
16
23
  The level persists across sessions (stored in `~/.agents/mcpbox/mode`) and is read by the
17
24
  UserPromptSubmit hook, which injects the matching reminder on each prompt.
@@ -58,7 +58,7 @@ const PATTERNS = [
58
58
  // full mode: remind the agent to judge rawness itself — a regex can't. Only
59
59
  // fires on substantive prompts that didn't already match an explicit intent.
60
60
  const FULL_ASSESS_HINT =
61
- "[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.";
61
+ "[mcpbox:full] Assess this request for rawness before acting: only raw material — an idea, hypothesis, or undecided direction — matures through the pipeline (mcpbox_pipeline_run → …fujin → handoff). Work that is already decided and bounded, and follow-up work that extends a run you already have, both go straight to daruma via daruma_plan_materialize.";
62
62
 
63
63
  // ponytail: length heuristic for "substantive" — cheap and good enough to skip
64
64
  // "ok"/"yes"/"go". Swap for a token/keyword check only if it nags in practice.
package/lib/codex.mjs CHANGED
@@ -1,19 +1,26 @@
1
1
  // Codex surface for the mcpbox harness — parity with the Claude CLAUDE.md
2
- // plugin. Two idempotent writes:
3
- // 1. AGENTS.md policy block (Codex reads it every session in the workspace).
2
+ // plugin. Four idempotent writes:
3
+ // 1. AGENTS.md policy block. Measured against Codex 0.146: AGENTS.md is
4
+ // read from the working directory, NOT from a parent — a global install
5
+ // lands it in ~/AGENTS.md where no project sees it, hence (3) and (4).
4
6
  // 2. `~/.codex/config.toml` [mcp_servers.mcpbox] pointing at the single
5
7
  // canonical HTTP endpoint. Codex's config is global-only, so the entry
6
8
  // is fenced with comment markers and replaced in place — surrounding
7
9
  // hand-written TOML is preserved.
10
+ // 3. `$CODEX_HOME/skills/mcpbox/SKILL.md` — the same policy, reachable from
11
+ // every working directory instead of just the install one.
12
+ // 4. `$CODEX_HOME/prompts/mcpbox-*.md` — Codex's slash commands. Generated
13
+ // from the plugin's commands/, which already use exactly this shape
14
+ // (frontmatter `description` + "the user invoked" body).
8
15
  //
9
16
  // The policy body is BLOCK_BODY_PLAIN from lib/policy.mjs — one source of
10
- // truth, minus the Claude-only slash commands this surface cannot run.
11
- // shared across CLAUDE.md / AGENTS.md / .cursor/rules. Slash-command and
12
- // tool-surface phrasing stays Claude-flavoured; that's a deliberate
13
- // non-issue, not per-surface forks to maintain.
17
+ // truth shared across CLAUDE.md / AGENTS.md / .cursor/rules, minus the
18
+ // Claude-only slash commands this surface cannot run.
14
19
 
20
+ import { promises as fs } from "node:fs";
15
21
  import { homedir } from "node:os";
16
- import { join, resolve } from "node:path";
22
+ import { dirname, join, resolve } from "node:path";
23
+ import { fileURLToPath } from "node:url";
17
24
  import {
18
25
  BLOCK_BODY_PLAIN,
19
26
  MCP_URL,
@@ -30,8 +37,20 @@ const TOML_BLOCK = `[mcp_servers.mcpbox]
30
37
  url = "${MCP_URL}"
31
38
  `;
32
39
 
40
+ // Codex data dir: explicit override (tests) > $CODEX_HOME > ~/.codex.
41
+ export function codexHomeDir(home) {
42
+ if (home) return resolve(home);
43
+ const env = process.env.CODEX_HOME?.trim();
44
+ if (env) return env;
45
+ return join(homedir(), ".codex");
46
+ }
47
+
33
48
  function codexConfigPath(configPath) {
34
- return configPath ? resolve(configPath) : join(homedir(), ".codex", "config.toml");
49
+ return configPath ? resolve(configPath) : join(codexHomeDir(), "config.toml");
50
+ }
51
+
52
+ function packageRoot() {
53
+ return resolve(dirname(fileURLToPath(import.meta.url)), "..");
35
54
  }
36
55
 
37
56
  // AGENTS.md policy block in the project directory.
@@ -55,17 +74,96 @@ export function removeCodexMcp({ configPath } = {}) {
55
74
  return removeManagedBlock({ target: codexConfigPath(configPath), begin: TOML_BEGIN, end: TOML_END });
56
75
  }
57
76
 
58
- // Both surfaces at once (what `mcpbox-claude codex-init` calls).
59
- export async function installCodex({ projectDir } = {}) {
77
+ // The policy as a user-level Codex skill, so it is reachable from any working
78
+ // directory — AGENTS.md alone only covers the one the installer ran in.
79
+ export async function installCodexSkill({ codexHome } = {}) {
80
+ const target = join(codexHomeDir(codexHome), "skills", "mcpbox", "SKILL.md");
81
+ const body = `---
82
+ name: mcpbox
83
+ description: MCPBox/daruma routing policy — read before creating tasks or plans, choosing between the daruma tracker and the maturity pipeline, or when the user mentions the tracker, backlog, plan, decomposition, or \`mcpbox mode\`.
84
+ ---
85
+
86
+ ${BLOCK_BODY_PLAIN}`;
87
+ let before = null;
88
+ try {
89
+ before = await fs.readFile(target, "utf8");
90
+ } catch { /* absent → install */ }
91
+ if (before === body) return { action: "unchanged", path: target };
92
+ await fs.mkdir(dirname(target), { recursive: true });
93
+ await fs.writeFile(target, body);
94
+ return { action: before === null ? "installed" : "updated", path: target };
95
+ }
96
+
97
+ export async function removeCodexSkill({ codexHome } = {}) {
98
+ const dir = join(codexHomeDir(codexHome), "skills", "mcpbox");
99
+ try {
100
+ await fs.access(dir);
101
+ } catch {
102
+ return { action: "missing", path: join(dir, "SKILL.md") };
103
+ }
104
+ await fs.rm(dir, { recursive: true, force: true });
105
+ return { action: "removed-block", path: join(dir, "SKILL.md") };
106
+ }
107
+
108
+ // Codex slash commands live in `$CODEX_HOME/prompts/<name>.md` and are invoked
109
+ // as `/<name>`; the plugin's `commands/tasks.md` becomes `/mcpbox-tasks`.
110
+ // There is no `:` namespace here, so the body's `/mcpbox:tasks` is rewritten
111
+ // to the name the user can actually type.
112
+ export function codexPromptName(commandFile) {
113
+ return `mcpbox-${commandFile.replace(/\.md$/, "")}`;
114
+ }
115
+
116
+ export async function installCodexPrompts({ codexHome } = {}) {
117
+ const source = join(packageRoot(), "commands");
118
+ const targetDir = join(codexHomeDir(codexHome), "prompts");
119
+ const files = (await fs.readdir(source)).filter((f) => f.endsWith(".md")).sort();
120
+ await fs.mkdir(targetDir, { recursive: true });
121
+ let written = 0;
122
+ for (const file of files) {
123
+ const name = codexPromptName(file);
124
+ const body = (await fs.readFile(join(source, file), "utf8"))
125
+ .replace(/\/mcpbox:([a-z-]+)/g, "/mcpbox-$1");
126
+ const target = join(targetDir, `${name}.md`);
127
+ let before = null;
128
+ try {
129
+ before = await fs.readFile(target, "utf8");
130
+ } catch { /* absent */ }
131
+ if (before === body) continue;
132
+ await fs.writeFile(target, body);
133
+ written += 1;
134
+ }
135
+ return { action: written ? "installed" : "unchanged", path: targetDir, count: files.length };
136
+ }
137
+
138
+ export async function removeCodexPrompts({ codexHome } = {}) {
139
+ const targetDir = join(codexHomeDir(codexHome), "prompts");
140
+ let files = [];
141
+ try {
142
+ files = await fs.readdir(targetDir);
143
+ } catch {
144
+ return { action: "missing", path: targetDir };
145
+ }
146
+ // Only our own `mcpbox-*.md` — a hand-written prompt next to them survives.
147
+ const ours = files.filter((f) => f.startsWith("mcpbox-") && f.endsWith(".md"));
148
+ await Promise.all(ours.map((f) => fs.rm(join(targetDir, f), { force: true })));
149
+ return { action: ours.length ? "removed-block" : "missing", path: targetDir };
150
+ }
151
+
152
+ // Every surface at once (what `mcpbox-claude codex-init` calls).
153
+ export async function installCodex({ projectDir, codexHome } = {}) {
60
154
  const policy = await installCodexPolicy({ projectDir });
61
155
  const mcp = await installCodexMcp();
62
- return { policy, mcp };
156
+ const skill = await installCodexSkill({ codexHome });
157
+ const prompts = await installCodexPrompts({ codexHome });
158
+ return { policy, mcp, skill, prompts };
63
159
  }
64
160
 
65
- export async function removeCodex({ projectDir } = {}) {
161
+ export async function removeCodex({ projectDir, codexHome } = {}) {
66
162
  const policy = await removeCodexPolicy({ projectDir });
67
163
  const mcp = await removeCodexMcp();
68
- return { policy, mcp };
164
+ const skill = await removeCodexSkill({ codexHome });
165
+ const prompts = await removeCodexPrompts({ codexHome });
166
+ return { policy, mcp, skill, prompts };
69
167
  }
70
168
 
71
169
  export { BEGIN, END, TOML_BEGIN, TOML_END, codexConfigPath };
package/lib/policy.mjs CHANGED
@@ -5,11 +5,13 @@
5
5
  // `~/.claude/CLAUDE.md`.
6
6
  //
7
7
  // The block has two parts:
8
- // Part A — the daruma tracker rules. This text is the OSS `daruma-claude`
9
- // policy mirrored verbatim (OSS stays the source of the daruma
10
- // instructions); only the server name and slash-command namespace
11
- // are adjusted for mcpbox. Keep Part A in sync with
12
- // `vendor/oss/.../policy_claude.md`.
8
+ // Part A — the daruma tracker rules, tracking the OSS `daruma-claude` policy
9
+ // (OSS stays the source of the daruma instructions). Adjusted for
10
+ // mcpbox in the server name, the slash-command namespace, and the
11
+ // external-issue paragraph — OSS has no pipeline, so there it may
12
+ // send every imported issue straight to daruma, while here that
13
+ // answer depends on the routing rule in Part B. Keep the rest in
14
+ // sync with `vendor/oss/.../policy_claude.md`.
13
15
  // Part B — the MCPBox pipeline rules (torii→satori→enma→yatagarasu→fujin→
14
16
  // daruma maturity route, `mcpbox_pipeline_*` tools, the
15
17
  // handoff-only invariant). This is mcpbox-owned and has no OSS
@@ -143,10 +145,14 @@ a tool, **assume mcpbox**. Only ask for clarification when they explicitly
143
145
  mention a different system (Linear, Jira, GitHub Issues, etc.).
144
146
 
145
147
  **Importing an external issue** — «перенеси/заведи ишью N в трекер / таск-менеджер»,
146
- "move/import issue N into the tracker" — is **intake**, not a lookup: land it by
147
- materializing a plan (\`daruma_plan_materialize\`) that carries the imported task,
148
- and when the source is a real system (GitHub/Jira/Linear) \`daruma_link\` the new
149
- task back to it. Do not treat the issue id as an existing daruma task to fetch.
148
+ "move/import issue N into the tracker" — is **intake**, not a lookup: never treat
149
+ the issue id as an existing daruma task to fetch. Where it lands depends on the
150
+ issue itself, per the routing rule below (§ «Куда попадает работа»): an issue that
151
+ already carries a real statement is case 1 and goes straight to
152
+ \`daruma_plan_materialize\`; an issue that is really a wish or an undecided
153
+ direction is case 3 and goes through the pipeline. Either way, when the source is
154
+ a real system (GitHub/GitLab/Jira/Linear) \`daruma_link\` the resulting task back
155
+ to it.
150
156
 
151
157
  ---
152
158
 
@@ -213,10 +219,10 @@ daruma execution задача/план (терминальный слой
213
219
  - **Между шагами носится только \`run_id\`**, не сырьё промежуточных
214
220
  артефактов — полный контекст персистирован на сервере, читается через
215
221
  \`mcpbox_trace_get\`.
216
- - **daruma-задача заводится ТОЛЬКО через \`mcpbox_pipeline_handoff\`** зрелого
217
- Action Packet. Материализовать задачу «из воздуха» (\`daruma_plan_materialize\`
218
- без апстрима) в pipeline-контексте запрещено — на стороне daruma инвариант
219
- «планы — единственный вход».
222
+ - **Задача из СЫРЬЯ заводится только через \`mcpbox_pipeline_handoff\`** зрелого
223
+ Action Packet — прогнать сырьё мимо слоёв нельзя. Это правило про сырьё, а не
224
+ про daruma: решённая работа и догрузка идущего прогона заходят обычным
225
+ \`daruma_plan_materialize\` (см. § «Куда попадает работа»).
220
226
  - **Отказ слоя → возврат на предыдущий слой, не обход.** Ошибка хопа помечает
221
227
  прогон \`failed\` (причина в \`mcpbox_trace_get\`); почини вход предыдущего
222
228
  слоя и **повтори \`advance\`**. Maturity gate fujin (Action Packet не созрел)
@@ -225,13 +231,32 @@ daruma execution задача/план (терминальный слой
225
231
  - **Итог сверяется через \`mcpbox_trace_get\`** (ожидаем \`status=handed_off\`,
226
232
  \`task_id\`).
227
233
 
228
- ### When to use which
234
+ ### Куда попадает работа — единственное правило маршрутизации
229
235
 
230
- - Простой трекинг задач/планов уже готовой работы → **Part A** (daruma tools).
231
- - Сырьё, идея, запрос, требующие созревания перед исполнением → **Part B**
232
- (pipeline): открой прогон \`mcpbox_pipeline_run\`, доведи до \`fujin\`,
233
- материализуй задачу \`mcpbox_pipeline_handoff\`. Не создавай задачу напрямую
234
- в обход pipeline, если запрос — сырьё.
236
+ Это же правило дословно приходит в \`instructions\` MCP-сервера при \`initialize\`
237
+ и в описании \`daruma_plan_materialize\`. Три носителя, один текст — если они
238
+ когда-нибудь разойдутся, прав сервер.
239
+
240
+ Задай один вопрос: **работа уже решена?**
241
+
242
+ 1. **Решена и ограничена** — цель, границы и критерий завершения известны
243
+ (включая внешний issue с готовой постановкой) → сразу в daruma через
244
+ \`daruma_plan_materialize\`. Pipeline не нужен.
245
+ 2. **Относится к уже идущему прогону** — follow-up, подзадача, доработка или
246
+ расширение того, что прогон уже принёс → тоже сразу в daruma через
247
+ \`daruma_plan_materialize\`, и свяжи с задачей прогона (\`daruma_link\`).
248
+ **Заново гнать это через torii неверно**: собственные продолжения прогона
249
+ не нуждаются в повторном созревании.
250
+ 3. **Сырьё** — идея, гипотеза, неопределённое направление, где ещё не решено
251
+ *что* делать → \`mcpbox_pipeline_run\`, довести до \`fujin\`, материализовать
252
+ через \`mcpbox_pipeline_handoff\`. Напрямую в daruma такое не заводить.
253
+
254
+ Pipeline обязателен **только в случае 3**; случаи 1 и 2 — обычный вход в daruma.
255
+ Не можешь отличить случай 1 от случая 3 — спроси пользователя, не угадывай.
256
+
257
+ \`~/.agents/mcpbox/mode\` управляет только тем, насколько активно ты *предлагаешь*
258
+ pipeline (\`off\`/\`lite\`/\`full\`), и не отменяет случай 3: сырьё не заводится в
259
+ daruma напрямую ни в одном режиме — при \`off\` просто уточни у пользователя.
235
260
 
236
261
  `;
237
262
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpbox/mcpbox-claude",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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": {
@@ -15,6 +15,9 @@
15
15
  "commands/",
16
16
  "hooks/",
17
17
  ".claude-plugin/",
18
+ ".codex-plugin/",
19
+ ".agents/",
20
+ ".mcp.json",
18
21
  "README.md"
19
22
  ],
20
23
  "engines": {