@polderlabs/bizar 10.12.2 → 10.13.0

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,35 @@
1
+ ---
2
+ description: Skip Bizar\'s mandatory routing for this turn. Use for trivial single-step work the chat can handle directly.
3
+ argument-hint: "[task]"
4
+ disable-model-invocation: true
5
+ allowed-tools: Read, Bash, Edit, Write, Grep, Glob
6
+ ---
7
+
8
+ # /quick — One-Turn Routing Bypass
9
+
10
+ Run `$ARGUMENTS` directly in this session. Do NOT delegate to subagents.
11
+
12
+ ## Mechanism
13
+
14
+ This command creates a sentinel file `.bizar/.quick-once` in the current
15
+ working directory. The `worker-suggest` UserPromptSubmit hook checks for
16
+ this sentinel and short-circuits the orchestrator routing prompt for the
17
+ NEXT turn only. The sentinel is removed automatically by the
18
+ `session-end` lifecycle hook (or manually by the next non-quick user
19
+ prompt).
20
+
21
+ ## What this is for
22
+
23
+ - One-line file edits
24
+ - Quick lookups ("find X", "show me Y")
25
+ - Mechanical renames
26
+ - Single-tool invocations
27
+
28
+ ## What this is NOT for
29
+
30
+ - Multi-step implementations
31
+ - Anything that requires verification across multiple files
32
+ - Any task that should be tracked in `feature_list.json`
33
+
34
+ If the task balloons, abort, delete the sentinel, and re-run the request
35
+ without `/quick` so the orchestrator can dispatch properly.
@@ -28,7 +28,7 @@
28
28
 
29
29
  'use strict';
30
30
 
31
- import { readFileSync, existsSync, mkdirSync, writeFileSync, appendFileSync } from 'node:fs';
31
+ import { readFileSync, existsSync, mkdirSync, writeFileSync, appendFileSync, unlinkSync } from 'node:fs';
32
32
  import { join } from 'node:path';
33
33
  import os from 'node:os';
34
34
 
@@ -370,6 +370,14 @@ process.stdin.on('end', () => {
370
370
  const notePath = writeSessionNote(cwd, sessionId, reason, summary);
371
371
  const stateOk = writeSessionState(cwd, sessionId, reason, summary, nextStep);
372
372
 
373
+ // Clear /quick sentinel so the next session is back to orchestrator routing.
374
+ try {
375
+ const quickSentinel = join(cwd, '.bizar', '.quick-once');
376
+ if (existsSync(quickSentinel)) {
377
+ try { unlinkSync(quickSentinel); } catch { /* best-effort */ }
378
+ }
379
+ } catch { /* best-effort */ }
380
+
373
381
  // Silent success — the artifact is the file system.
374
382
  process.stdout.write(
375
383
  JSON.stringify({
@@ -36,6 +36,7 @@
36
36
  'use strict';
37
37
 
38
38
  import { dirname, join } from 'node:path';
39
+ import { existsSync } from 'node:fs';
39
40
  import { fileURLToPath } from 'node:url';
40
41
 
41
42
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -53,6 +54,21 @@ process.stdin.on('end', async () => {
53
54
 
54
55
  const prompt = String(input.prompt ?? input.user_prompt ?? '').trim();
55
56
 
57
+ // /quick sentinel bypass: when .bizar/.quick-once exists, skip the
58
+ // orchestrator routing policy for this single turn. The sentinel is
59
+ // created by the /quick slash command and removed by session-end.
60
+ const quickSentinel = join(input.cwd || process.cwd(), '.bizar', '.quick-once');
61
+ if (existsSync(quickSentinel)) {
62
+ process.stdout.write(JSON.stringify({
63
+ hookSpecificOutput: {
64
+ hookEventName: 'UserPromptSubmit',
65
+ additionalContext: '',
66
+ },
67
+ }) + '\n');
68
+ process.exit(0);
69
+ return;
70
+ }
71
+
56
72
  // Empty prompts get the silent treatment — the user has not yet
57
73
  // committed any intent.
58
74
  if (prompt.length === 0) {
@@ -68,9 +84,8 @@ process.stdin.on('end', async () => {
68
84
 
69
85
  const routePolicy = [
70
86
  'Mandatory Bizar routing policy:',
71
- '- If this is the primary session, use the Agent tool to delegate the request to custom Bizar agent @mike before doing task analysis or implementation.',
87
+ '- If this is the primary session, you ARE @mike. Inline-play the orchestrator role: decompose the request, route to specialists via the Agent tool inside this session when a specialist would materially improve the answer, and synthesize the verified result. Otherwise execute directly. Keep the phased research/plan/implement/review discipline as guidance, not as a forced dispatch gate.',
72
88
  '- @mike must route trivial work to @brenda and non-trivial work through the configured research, plan, implementation, review, and verification agents.',
73
- '- Do not implement directly in the primary session.',
74
89
  '- If you are already running as a Bizar custom agent, follow your assigned role and do not recursively dispatch yourself.',
75
90
  ].join('\n');
76
91
 
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://bizar.dev/schema/model-router.v2.json",
3
3
  "version": "11.0.0",
4
- "endpoint": "http://localhost:20128/v1",
4
+ "endpoint": "http://localhost:20129/v1",
5
5
  "comment": "Bizar assigns one exact gateway model to each shipped agent. Role selection and complexity/model selection are separate decisions; every run snapshots its assignments before dispatch.",
6
6
  "gateway": {
7
7
  "required": true,
8
- "endpoint": "http://localhost:20128/v1",
8
+ "endpoint": "http://localhost:20129/v1",
9
9
  "availabilityProbe": "/models",
10
10
  "exactModelRequired": true,
11
11
  "unavailableBehavior": "fail",
@@ -37,6 +37,11 @@
37
37
  "mcp__bizar__graph_path",
38
38
  "mcp__bizar__list_instincts",
39
39
  "mcp__bizar__list_decisions",
40
+ "mcp__bizar__bizar_task",
41
+ "mcp__bizar__bizar_workflow",
42
+ "mcp__bizar__bizar_control",
43
+ "mcp__bizar__bizar_audit",
44
+ "mcp__bizar__bizar_model_list",
40
45
  "mcp__semble__*",
41
46
  "mcp__agent-browser__*"
42
47
  ],
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "bizar-harness",
4
4
  "displayName": "Bizar Harness",
5
- "version": "10.12.2",
5
+ "version": "10.13.0",
6
6
  "description": "Guarded multi-agent workflows for Claude Code with a single orchestrator, durable workflow state, and explicit human approval boundaries.",
7
7
  "author": {
8
8
  "name": "Polderlabs"
package/cli/audit.mjs CHANGED
@@ -11,11 +11,18 @@ function frontmatter(text) {
11
11
  }
12
12
 
13
13
  export async function runAudit() {
14
- console.log(chalk.bold.cyan('\n BIZARHARNESS AGENT AUDIT\n'));
14
+ // F-146 — machine-readable JSON branch for `bizar_audit` MCP tool.
15
+ // Must short-circuit BEFORE any human-formatted console output so the
16
+ // tool result is pure JSON.
17
+ const jsonMode = process.argv.includes('--json');
18
+
19
+ const emit = (line) => { if (!jsonMode) console.log(line); };
20
+ if (!jsonMode) emit(chalk.bold.cyan('\n BIZARHARNESS AGENT AUDIT\n'));
15
21
  const agentsDir = join(CONFIG_DIR, 'agents');
16
22
  if (!existsSync(agentsDir)) {
17
23
  const result = { issues: [{ path: agentsDir, severity: 'HIGH', msg: 'agents directory missing' }], warnings: [], score: 0 };
18
- console.log(chalk.red(` ✗ No agents directory found at ${agentsDir}`));
24
+ emit(chalk.red(` ✗ No agents directory found at ${agentsDir}`));
25
+ if (jsonMode) process.stdout.write(JSON.stringify(result));
19
26
  return result;
20
27
  }
21
28
 
@@ -43,9 +50,11 @@ export async function runAudit() {
43
50
  }
44
51
  }
45
52
 
46
- for (const item of issues) console.log(chalk.red(` ✗ ${item.severity} ${item.path}: ${item.msg}`));
47
- for (const item of warnings) console.log(chalk.yellow(` ⚠ ${item.path}: ${item.msg}`));
53
+ for (const item of issues) emit(chalk.red(` ✗ ${item.severity} ${item.path}: ${item.msg}`));
54
+ for (const item of warnings) emit(chalk.yellow(` ⚠ ${item.path}: ${item.msg}`));
48
55
  const score = Math.max(0, 100 - issues.length * 15 - warnings.length * 3);
49
- console.log(`\n Security score: ${score}/100 (${files.length} agents)\n`);
50
- return { issues, warnings, score, totalIssues: issues.length, totalWarnings: warnings.length };
51
- }
56
+ emit(`\n Security score: ${score}/100 (${files.length} agents)\n`);
57
+ const result = { issues, warnings, score, totalIssues: issues.length, totalWarnings: warnings.length };
58
+ if (jsonMode) process.stdout.write(JSON.stringify(result));
59
+ return result;
60
+ }
package/cli/bin.mjs CHANGED
@@ -117,8 +117,10 @@ function showHelp() {
117
117
  claim <subcommand> GitHub-style claim protocol over feature_list.json
118
118
  task <subcommand> Durable dependency/worktree/path task coordination
119
119
  control <subcommand> Machine-readable agents/tasks/sessions/messages API
120
+ picker-proxy <start> Run the 9router picker proxy (default port 20129)
120
121
  workflow <subcommand> Session-bound autopilot workflow state
121
122
  hook <name> Run a portable Claude Code hook
123
+ worktree-merge <branch> Merge a feature branch with archive tag (no work lost)
122
124
 
123
125
  Examples:
124
126
  bizar install
@@ -459,6 +461,16 @@ async function main() {
459
461
  break;
460
462
  }
461
463
 
464
+ case 'picker-proxy': {
465
+ await import('./commands/picker-proxy.mjs');
466
+ return;
467
+ }
468
+
469
+ case 'worktree-merge': {
470
+ await import('./commands/worktree-merge.mjs');
471
+ return;
472
+ }
473
+
462
474
  default: {
463
475
  console.error(chalk.red(` ✗ Unknown command: ${cmd}`));
464
476
  showHelp();
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ // 9router picker proxy — rewrites upstream model IDs to `claude-...` so
3
+ // Claude Code's /model picker surfaces them while preserving Anthropic defaults.
4
+ //
5
+ // ponytail: UPSTREAM host/port are constant because the picker proxy only ever
6
+ // fronts the local 9router gateway. If multi-gateway routing is ever needed,
7
+ // convert these to env-driven and re-test. BIZAR_PICKER_PROXY_TEST_* env vars
8
+ // exist only for the test harness.
9
+
10
+ import { createServer, request as httpRequest } from "node:http";
11
+
12
+ const UPSTREAM_HOST = process.env.BIZAR_PICKER_PROXY_TEST_UPSTREAM_HOST || "127.0.0.1";
13
+ const UPSTREAM_PORT = Number(process.env.BIZAR_PICKER_PROXY_TEST_UPSTREAM_PORT || 20128);
14
+ const LISTEN_HOST = process.env.BIZAR_PICKER_PROXY_TEST_LISTEN_HOST || "127.0.0.1";
15
+ const LISTEN_PORT = Number(process.env.BIZAR_PICKER_PROXY_TEST_LISTEN_PORT || process.env.BIZAR_PICKER_PROXY_PORT || 20129);
16
+
17
+ export function rewriteIds(parsed) {
18
+ if (Array.isArray(parsed?.data)) {
19
+ for (const m of parsed.data) {
20
+ if (typeof m.id !== "string") continue;
21
+ if (!m.id.startsWith("claude") && !m.id.startsWith("anthropic")) {
22
+ m.id = `claude-${m.id}`;
23
+ }
24
+ }
25
+ }
26
+ return parsed;
27
+ }
28
+
29
+ function proxyUpstream(req, res) {
30
+ const upstream = httpRequest({
31
+ host: UPSTREAM_HOST,
32
+ port: UPSTREAM_PORT,
33
+ path: req.url,
34
+ method: req.method,
35
+ headers: { ...req.headers, host: `${UPSTREAM_HOST}:${UPSTREAM_PORT}` },
36
+ });
37
+ upstream.on("error", (e) => {
38
+ res.writeHead(502, { "content-type": "text/plain" });
39
+ res.end(`upstream error: ${e.message}`);
40
+ });
41
+ upstream.on("response", (upRes) => {
42
+ res.writeHead(upRes.statusCode || 502, upRes.headers);
43
+ upRes.pipe(res);
44
+ });
45
+ req.pipe(upstream);
46
+ }
47
+
48
+ function handleModels(req, res) {
49
+ const upstream = httpRequest({
50
+ host: UPSTREAM_HOST,
51
+ port: UPSTREAM_PORT,
52
+ path: "/v1/models?limit=1000",
53
+ method: "GET",
54
+ headers: { accept: "application/json" },
55
+ });
56
+ upstream.on("error", (e) => {
57
+ res.writeHead(502, { "content-type": "text/plain" });
58
+ res.end(`upstream error: ${e.message}`);
59
+ });
60
+ upstream.on("response", (upRes) => {
61
+ let body = "";
62
+ upRes.setEncoding("utf8");
63
+ upRes.on("data", (c) => (body += c));
64
+ upRes.on("end", () => {
65
+ let parsed;
66
+ try {
67
+ parsed = JSON.parse(body);
68
+ } catch {
69
+ res.writeHead(502, { "content-type": "text/plain" });
70
+ res.end("upstream not JSON");
71
+ return;
72
+ }
73
+ rewriteIds(parsed);
74
+ const out = JSON.stringify(parsed);
75
+ res.writeHead(200, {
76
+ "content-type": "application/json",
77
+ "content-length": Buffer.byteLength(out),
78
+ });
79
+ res.end(out);
80
+ });
81
+ });
82
+ upstream.end();
83
+ }
84
+
85
+ export function createProxyServer() {
86
+ return createServer((req, res) => {
87
+ if (req.method === "GET" && req.url?.startsWith("/v1/models")) {
88
+ handleModels(req, res);
89
+ return;
90
+ }
91
+ proxyUpstream(req, res);
92
+ });
93
+ }
94
+
95
+ if (import.meta.url === `file://${process.argv[1]}`) {
96
+ const server = createProxyServer();
97
+ server.listen(LISTEN_PORT, LISTEN_HOST, () => {
98
+ process.stdout.write(`[picker-proxy] listening on http://${LISTEN_HOST}:${LISTEN_PORT} -> ${UPSTREAM_HOST}:${UPSTREAM_PORT}\n`);
99
+ });
100
+ }
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ // `bizar picker-proxy start` — spawn the 9router picker proxy in the foreground.
3
+
4
+ import { spawn } from "node:child_process";
5
+ import { fileURLToPath } from "node:url";
6
+ import { dirname, join } from "node:path";
7
+
8
+ const sub = process.argv[2];
9
+ if (sub === "start") {
10
+ const here = dirname(fileURLToPath(import.meta.url));
11
+ const child = spawn(process.execPath, [join(here, "9router-picker-proxy.mjs")], { stdio: "inherit" });
12
+ child.on("exit", (code) => process.exit(code ?? 1));
13
+ process.on("SIGINT", () => child.kill("SIGINT"));
14
+ process.on("SIGTERM", () => child.kill("SIGTERM"));
15
+ } else {
16
+ console.error("usage: bizar picker-proxy start");
17
+ process.exit(2);
18
+ }
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ // `bizar worktree-merge <branch>` — merge a feature branch into the current
3
+ // branch with guaranteed artifact preservation. Tags the source branch tip
4
+ // as `merge-archive/<branch>-<sha>` before merge, so parallel pipeline work
5
+ // is never lost on conflict resolution. `git merge --no-ff` keeps the merge
6
+ // topology visible in `git log --graph`.
7
+
8
+ import { spawnSync } from "node:child_process";
9
+
10
+ const branch = process.argv[2];
11
+ if (!branch) {
12
+ console.error("usage: bizar worktree-merge <branch>");
13
+ process.exit(2);
14
+ }
15
+
16
+ const tip = spawnSync("git", ["rev-parse", branch], { encoding: "utf8" });
17
+ if (tip.status !== 0) {
18
+ console.error(tip.stderr || tip.stdout);
19
+ process.exit(1);
20
+ }
21
+ const sha = tip.stdout.trim();
22
+ const safe = branch.replace(/[^a-zA-Z0-9._-]/g, "-");
23
+ const tag = `merge-archive/${safe}-${sha.slice(0, 7)}`;
24
+ const tagged = spawnSync("git", ["tag", tag, sha], { encoding: "utf8", stdio: "inherit" });
25
+ if (tagged.status !== 0) process.exit(tagged.status ?? 1);
26
+
27
+ const m = spawnSync(
28
+ "git",
29
+ ["merge", "--no-ff", branch, "-m", `merge: ${branch} into current branch`],
30
+ { encoding: "utf8", stdio: "inherit" },
31
+ );
32
+ process.exit(m.status ?? 1);
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: i-have-adhd
3
+ description: 'Shape output for a reader with ADHD: lead with the next action, number multi-step work, restate state across turns, suppress tangents, give specific time estimates, make wins visible. Invoke with /i-have-adhd; stays on until "stop adhd mode".'
4
+ license: MIT
5
+ metadata:
6
+ hermes:
7
+ tags: [ADHD, Output Style, Productivity, Formatting]
8
+ category: productivity
9
+ related_skills: []
10
+ ---
11
+
12
+ # i-have-adhd
13
+ # disable-model-invocation deliberately omitted: keep this skill always-on. See PROGRESS.md F-146.
14
+
15
+ The reader has ADHD. Output is not just brief. It is shaped so an ADHD brain can act on it.
16
+
17
+ ## Persistence
18
+
19
+ These rules apply to every response for the rest of the session, not only this one. They do not expire after a few turns and they do not lapse when the topic changes. If you are unsure whether they still apply, they do.
20
+
21
+ Turn them off only when the reader says "stop adhd mode" or "normal mode". Confirm in one line, then return to your default style.
22
+
23
+ ## What ADHD changes about reading
24
+
25
+ Five facts drive every rule below:
26
+
27
+ 1. Working memory is small. Anything not on screen is forgotten. Do not ask the reader to "keep in mind X."
28
+ 2. Knowing the answer is not doing the answer. The friction between "got it" and "done it" is where work dies.
29
+ 3. Starting is the hardest step. The first action must be obvious, small, and doable now.
30
+ 4. Time estimates feel uniform. "A bit of work" and "a few hours" register the same. Vague estimates fail.
31
+ 5. Dopamine is scarce. Visible progress matters. Buried wins do not register.
32
+
33
+ ## Rules
34
+
35
+ ### 1. Lead with the next action
36
+
37
+ The first line is something the reader can do. Not context. Not a plan. The action.
38
+
39
+ Bad: "Let's think about this. Your auth flow has a few moving pieces..."
40
+ Good: "Run `npm install jsonwebtoken`, then edit `src/auth.ts:42`."
41
+
42
+ If the answer is a command, path, or snippet, it goes first. Prose comes after, if at all.
43
+
44
+ ### 2. Number multi-step tasks
45
+
46
+ If the work takes more than one step, write a numbered list. Each step is one bounded action. No step contains "and then" twice.
47
+
48
+ Use the fewest steps that still work. Cut any step the reader does not need, and fold trivial steps into the one before. A short path finished beats a complete path abandoned.
49
+
50
+ Bad: "First open the file, find the function, swap it out, then run the tests."
51
+
52
+ Good:
53
+ ```
54
+ 1. Open `src/auth.ts`
55
+ 2. Replace `verifyToken` (lines 42 to 58) with the snippet below
56
+ 3. Run `npm test -- auth.spec.ts`
57
+ ```
58
+
59
+ ### 3. End with one concrete next action
60
+
61
+ If anything is left open, name ONE thing the reader can do in under two minutes. Even "open the file" counts.
62
+
63
+ Bad: "Hope that helps. Let me know if you want to dig deeper."
64
+ Good: "Next: run `npm test` and paste the first failing line."
65
+
66
+ ### 4. Suppress tangents
67
+
68
+ If a second issue exists, finish the first, then offer the second as a separate question.
69
+
70
+ Bad: "Here's the fix. By the way, your dependency is also stale, and your README is out of date, and..."
71
+ Good: "Here's the fix. Separately: there is also a stale dependency. Want me to handle that next?"
72
+
73
+ A question that comes up mid-work is not a tangent: answer it yourself if you can and fold the result in. If it still needs the reader, surface it once, at the end.
74
+
75
+ ### 5. Restate state every turn
76
+
77
+ The reader cannot hold "we are on step 3 of 5" between messages. Restate it.
78
+
79
+ Bad: "Done. Ready for the next part?"
80
+ Good: "Step 3 of 5 done: schema updated. Next: backfill the new column. Run the script?"
81
+
82
+ If the harness has a task or plan tool, use it for multi-step work: one item per step, one in progress at a time. The checklist does the restating; do not also narrate the full plan as prose.
83
+
84
+ ### 6. Give specific time estimates
85
+
86
+ Vague estimates fail. Ballpark in concrete units.
87
+
88
+ Bad: "This will take some work."
89
+ Good: "About 15 minutes if tests already cover this. An afternoon if not."
90
+
91
+ ### 7. Make completed work visible
92
+
93
+ Show what now works, in concrete terms. Do not bury wins in a recap.
94
+
95
+ Bad: "I've made some changes to the auth flow. Among other things..."
96
+ Good: "Login now works with magic links. Try: `npm run dev`, open `/login`."
97
+
98
+ ### 8. Matter-of-fact tone for errors
99
+
100
+ Never use "Uh oh," "Oh no," or "There seems to be a problem." State cause and fix.
101
+
102
+ Bad: "Uh oh, the test is failing. There seems to be an issue..."
103
+ Good: "Test fails at `auth.spec.ts:42`: expected 200, got 401. Cause: missing auth header. Fix: add `Authorization: Bearer ${token}` to the request."
104
+
105
+ ### 9. Cap lists at 5 items
106
+
107
+ If a list grows past five, split into "do now" vs "later," or "must" vs "nice to have." Five items ranked beats ten unranked.
108
+
109
+ ### 10. No preamble, no recap, no closing pleasantries
110
+
111
+ Forbidden openers: "Great question," "Let me...", "I'll...", "Sure!", "Looking at your...", "To answer your question..."
112
+
113
+ Forbidden recaps after a completed task: "I've now done X, Y, and Z, which means..."
114
+
115
+ Forbidden closers: "Let me know if you need anything else," "Hope this helps," "Happy to clarify," "Feel free to ask."
116
+
117
+ Start with the answer. End when the answer is done.
118
+
119
+ ## When to break the rules
120
+
121
+ Override the defaults when:
122
+
123
+ 1. User asks to "explain" or "walk me through." Explain fully. Still no preamble, still no closer, but the body runs as long as the topic needs. Add headers so the reader can skim back.
124
+ 2. Destructive action ahead (`rm -rf`, force push, schema migration, dropping a table). Confirm before acting. Safety wins over brevity.
125
+ 3. Debug spiral. If the last three turns have been "still broken," stop iterating on code. Name the assumption that might be wrong. Ask one diagnostic question.
126
+ 4. Real ambiguity in the request. One short clarifying question beats guessing and rewriting.
127
+ 5. A rule fights the task. When a rule would delete the answer itself, the task wins; the shape stays. Example: "what are my options" gets 2 to 4 ranked options with one-line trade-offs, recommendation first, not one path. The options are the answer.
128
+ 6. A rule fights the harness. Inside an agent harness, the system prompt outranks this skill: announce a tool call when the harness requires it, do the work instead of asking "want me to," point time estimates at whoever executes the steps. Same principle as 5: the constraint wins, the shape stays.
129
+
130
+ ## Pre-send check
131
+
132
+ Before sending, delete:
133
+
134
+ 1. The first sentence if it announces what you are about to do.
135
+ 2. The last sentence if it asks "anything else?" or recaps what just happened.
136
+ 3. Any "by the way" sidebar.
137
+ 4. Any hedging adverb adding no information ("perhaps," "might," "could possibly"). Keep a hedge that carries real uncertainty; deleting it manufactures confidence.
138
+ 5. Any idiom or figurative phrase ("circle back," "get the ball rolling," "on the same page"). Replace with the literal action.
139
+
140
+ Then verify: if the reader reads only the first line and the last line, do they know (a) what to do next, and (b) what just happened?
141
+
142
+ If yes, send.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polderlabs/bizar",
3
- "version": "10.12.2",
3
+ "version": "10.13.0",
4
4
  "description": "Autonomous, human-in-the-loop multi-agent harness for Claude Code with guarded workflows, typed SDK primitives, and MCP tools.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,6 +33,7 @@
33
33
  import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from "node:fs";
34
34
  import { join } from "node:path";
35
35
  import { homedir } from "node:os";
36
+ import { spawnSync } from "node:child_process";
36
37
  import { listInstincts } from "../learning/instincts.js";
37
38
  import { listDecisions } from "../learning/decisions.js";
38
39
  /**
@@ -54,6 +55,22 @@ function err(text) {
54
55
  // a structured payload so the model can react.
55
56
  return { content: [{ type: "text", text: `error: ${text}` }] };
56
57
  }
58
+ // Spawn the local `bizar` CLI with --json. Thin wrappers for the 5 agent-
59
+ // facing surfaces (task, workflow, control, audit, model list) so subagents
60
+ // can call them through MCP instead of shelling out. 30s ceiling keeps the
61
+ // MCP request from hanging on a stuck subprocess.
62
+ function runBizar(args) {
63
+ const r = spawnSync("bizar", [...args, "--json"], { encoding: "utf8", timeout: 30_000 });
64
+ if (r.status !== 0)
65
+ return { ok: false, error: `bizar ${args.join(" ")} exited ${r.status}: ${r.stderr || r.stdout}` };
66
+ return { ok: true, stdout: r.stdout };
67
+ }
68
+ function readJsonSafe(text) { try {
69
+ return JSON.parse(text);
70
+ }
71
+ catch {
72
+ return null;
73
+ } }
57
74
  // ---------------------------------------------------------------------------
58
75
  // Pillar D — instinct + decision read-back (v10.3.0)
59
76
  // ---------------------------------------------------------------------------
@@ -278,6 +295,109 @@ const graphPathTool = defineTool("graph_path", "Find the shortest path between t
278
295
  }
279
296
  }, { readOnlyHint: true });
280
297
  // ---------------------------------------------------------------------------
298
+ // Agent-facing CLI wrappers (F-146) — thin `bizar <surface> --json` shells.
299
+ // ---------------------------------------------------------------------------
300
+ // Forward action + arbitrary key/value args to `bizar task <action> --json`.
301
+ // Valid actions: create, ready, list, show, claim, heartbeat, complete,
302
+ // cancel, sweep.
303
+ const bizarTaskTool = defineTool("bizar_task", "Wrapper around `bizar task <action> --json`. Actions: create, ready, list, show, claim, heartbeat, complete, cancel, sweep. Pass other CLI flags (e.g. --title, --scope, --depends-on, --owner, --workspace, --lease-ms, --evidence, --reason) as string fields.", { action: "string" }, async (args) => {
304
+ try {
305
+ const { action, ...rest } = args;
306
+ if (!action)
307
+ return err("missing action");
308
+ const flat = [action];
309
+ for (const [k, v] of Object.entries(rest)) {
310
+ if (v === undefined || v === null || v === "")
311
+ continue;
312
+ flat.push(`--${k}`, String(v));
313
+ }
314
+ const r = runBizar(["task", ...flat]);
315
+ if (!r.ok)
316
+ return err(r.error);
317
+ const parsed = readJsonSafe(r.stdout);
318
+ return ok(parsed !== null ? JSON.stringify(parsed) : r.stdout);
319
+ }
320
+ catch (e) {
321
+ return err(String(e));
322
+ }
323
+ });
324
+ // Forward action + args to `bizar workflow <action> --json`.
325
+ // Valid actions: start, status, resume, advance, fail, cancel.
326
+ const bizarWorkflowTool = defineTool("bizar_workflow", "Wrapper around `bizar workflow <action> --json`. Actions: start, status, resume, advance, fail, cancel. Pass CLI flags (e.g. --goal, --profile, --session, --run, --revision, --stage, --evidence, --reason) as string fields.", { action: "string" }, async (args) => {
327
+ try {
328
+ const { action, ...rest } = args;
329
+ if (!action)
330
+ return err("missing action");
331
+ const flat = [action];
332
+ for (const [k, v] of Object.entries(rest)) {
333
+ if (v === undefined || v === null || v === "")
334
+ continue;
335
+ flat.push(`--${k}`, String(v));
336
+ }
337
+ const r = runBizar(["workflow", ...flat]);
338
+ if (!r.ok)
339
+ return err(r.error);
340
+ const parsed = readJsonSafe(r.stdout);
341
+ return ok(parsed !== null ? JSON.stringify(parsed) : r.stdout);
342
+ }
343
+ catch (e) {
344
+ return err(String(e));
345
+ }
346
+ });
347
+ // Forward action + args to `bizar control <action> --json`.
348
+ // Valid actions: snapshot, agents, tasks, sessions, messages, message.
349
+ const bizarControlTool = defineTool("bizar_control", "Wrapper around `bizar control <action> --json`. Actions: snapshot, agents, tasks, sessions, messages, message. Pass CLI flags (e.g. --agent, --session, --text, --from) as string fields.", { action: "string" }, async (args) => {
350
+ try {
351
+ const { action, ...rest } = args;
352
+ if (!action)
353
+ return err("missing action");
354
+ const flat = [action];
355
+ for (const [k, v] of Object.entries(rest)) {
356
+ if (v === undefined || v === null || v === "")
357
+ continue;
358
+ flat.push(`--${k}`, String(v));
359
+ }
360
+ const r = runBizar(["control", ...flat]);
361
+ if (!r.ok)
362
+ return err(r.error);
363
+ const parsed = readJsonSafe(r.stdout);
364
+ return ok(parsed !== null ? JSON.stringify(parsed) : r.stdout);
365
+ }
366
+ catch (e) {
367
+ return err(String(e));
368
+ }
369
+ });
370
+ // `bizar audit --json` — single-shot wrapper, no action routing needed.
371
+ const bizarAuditTool = defineTool("bizar_audit", "Wrapper around `bizar audit --json`. Emits the structured audit report (issues, warnings, score) without human-formatted output.", {}, async () => {
372
+ try {
373
+ const r = runBizar(["audit"]);
374
+ if (!r.ok)
375
+ return err(r.error);
376
+ const parsed = readJsonSafe(r.stdout);
377
+ if (parsed !== null)
378
+ return ok(JSON.stringify(parsed));
379
+ // CLI did not honour --json; surface a structured error so callers
380
+ // know the binary is on an older revision than this wrapper expects.
381
+ return err(`bizar audit did not emit JSON; first chars: ${r.stdout.slice(0, 80)}`);
382
+ }
383
+ catch (e) {
384
+ return err(String(e));
385
+ }
386
+ }, { readOnlyHint: true });
387
+ // `bizar model list --json` — gateway model inventory.
388
+ const bizarModelListTool = defineTool("bizar_model_list", "Wrapper around `bizar model list --json`. Lists every model id reachable through the configured 9Router gateway.", {}, async () => {
389
+ try {
390
+ const r = runBizar(["model", "list"]);
391
+ if (!r.ok)
392
+ return err(r.error);
393
+ const parsed = readJsonSafe(r.stdout);
394
+ return ok(parsed !== null ? JSON.stringify(parsed) : r.stdout);
395
+ }
396
+ catch (e) {
397
+ return err(String(e));
398
+ }
399
+ }, { readOnlyHint: true });
400
+ // ---------------------------------------------------------------------------
281
401
  // Factory — wire all tools into an MCP server
282
402
  // ---------------------------------------------------------------------------
283
403
  export const BIZAR_TOOLS = [
@@ -290,6 +410,12 @@ export const BIZAR_TOOLS = [
290
410
  graphPathTool,
291
411
  listInstinctsTool,
292
412
  listDecisionsTool,
413
+ // F-146 — agent-facing CLI wrappers
414
+ bizarTaskTool,
415
+ bizarWorkflowTool,
416
+ bizarControlTool,
417
+ bizarAuditTool,
418
+ bizarModelListTool,
293
419
  ];
294
420
  /**
295
421
  * Build the Bizar MCP server config. Pass this into Claude Code's
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * SDK version constant. Keep synchronized with the workspace package versions.
3
3
  */
4
- export declare const SDK_VERSION: "10.12.2";
4
+ export declare const SDK_VERSION: "10.13.0";
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * SDK version constant. Keep synchronized with the workspace package versions.
3
3
  */
4
- export const SDK_VERSION = "10.12.2";
4
+ export const SDK_VERSION = "10.13.0";
5
5
  //# sourceMappingURL=version.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polderlabs/bizar-sdk",
3
- "version": "10.12.2",
3
+ "version": "10.13.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",