@polderlabs/bizar 10.14.0 → 10.16.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.
Files changed (129) hide show
  1. package/AGENTS.md +75 -10
  2. package/cli/bin.mjs +24 -1
  3. package/cli/commands/hook.mjs +10 -2
  4. package/cli/commands/models.mjs +610 -0
  5. package/cli/commands/tier.mjs +151 -0
  6. package/cli/commands/tools.mjs +124 -0
  7. package/cli/commands/upgrade-defaults.mjs +139 -0
  8. package/cli/commands/workflow.mjs +9 -2
  9. package/cli/commands/worktree-merge.mjs +301 -25
  10. package/cli/core/workflow-state.mjs +20 -15
  11. package/cli/provision.mjs +183 -84
  12. package/cli/task-ledger.mjs +18 -57
  13. package/cli/worker-dispatcher.mjs +1 -1
  14. package/config/AGENTS.md +1 -1
  15. package/config/agents/model-assignment.mjs +69 -109
  16. package/config/claude/CLAUDE.md +196 -0
  17. package/{.claude → config/claude}/agents/brand-designer.md +0 -1
  18. package/{.claude → config/claude}/agents/debug-specialist.md +0 -1
  19. package/{.claude → config/claude}/agents/exec-assistant.md +0 -1
  20. package/{.claude → config/claude}/agents/help-desk.md +0 -1
  21. package/{.claude → config/claude}/agents/it-lead.md +0 -1
  22. package/{.claude → config/claude}/agents/knowledge-manager.md +0 -1
  23. package/{.claude → config/claude}/agents/office-coordinator.md +0 -1
  24. package/{.claude → config/claude}/agents/office-greeter.md +0 -1
  25. package/{.claude → config/claude}/agents/office-manager.md +159 -16
  26. package/{.claude → config/claude}/agents/planner.md +0 -1
  27. package/{.claude → config/claude}/agents/principal-engineer.md +0 -1
  28. package/{.claude → config/claude}/agents/qa-reviewer.md +0 -1
  29. package/{.claude → config/claude}/agents/research-analyst.md +0 -1
  30. package/{.claude → config/claude}/agents/senior-engineer.md +0 -1
  31. package/{.claude → config/claude}/agents/support-tech.md +0 -1
  32. package/{.claude → config/claude}/agents/ui-designer.md +0 -1
  33. package/config/claude/commands/backup.md +19 -0
  34. package/config/claude/commands/browser.md +19 -0
  35. package/config/claude/commands/doctor.md +17 -0
  36. package/config/claude/commands/migrate.md +18 -0
  37. package/config/claude/commands/picker.md +20 -0
  38. package/config/claude/commands/rca.md +19 -0
  39. package/config/claude/commands/repair.md +16 -0
  40. package/config/claude/commands/restore.md +20 -0
  41. package/{.claude → config/claude}/commands/team.md +4 -1
  42. package/config/claude/commands/tier.md +32 -0
  43. package/config/claude/commands/tools.md +31 -0
  44. package/config/claude/commands/ultracode.md +8 -0
  45. package/config/claude/commands/update.md +15 -0
  46. package/config/claude/commands/upgrade-defaults.md +36 -0
  47. package/{.claude → config/claude}/hooks/advisor-context.mjs +3 -0
  48. package/config/claude/hooks/agent-model-guard.mjs +110 -0
  49. package/config/claude/hooks/bizar-hook-wrapper.sh +25 -0
  50. package/{.claude → config/claude}/hooks/control-inbox.mjs +1 -1
  51. package/config/claude/hooks/git-workflow-guard.mjs +374 -0
  52. package/config/claude/hooks/path-ownership-guard.mjs +109 -0
  53. package/config/claude/hooks/pretooluse-bash.mjs +94 -0
  54. package/{.claude → config/claude}/hooks/pretooluse-editwrite.mjs +30 -23
  55. package/{.claude → config/claude}/hooks/sessionstart-prime.mjs +5 -0
  56. package/{.claude → config/claude}/hooks/simplify-guard.mjs +1 -1
  57. package/config/claude/hooks/team-lifecycle.mjs +44 -0
  58. package/{.claude → config/claude}/hooks/verify-deliverables.mjs +1 -1
  59. package/{.claude → config/claude}/hooks/worker-suggest.mjs +3 -2
  60. package/config/claude/hooks/worktree-archive.mjs +125 -0
  61. package/{.claude → config/claude}/hooks/worktree-bootstrap.mjs +12 -1
  62. package/config/claude/model-router.json +127 -0
  63. package/config/claude/settings.json +283 -0
  64. package/config/skills/bizar/SKILL.md +1 -1
  65. package/config/skills/harness-engineering/SKILL.md +1 -1
  66. package/config/skills/ultracode/SKILL.md +15 -0
  67. package/config/workflows/bizar-debug.js +84 -0
  68. package/config/workflows/bizar-implement.js +78 -0
  69. package/config/workflows/bizar-research.js +96 -0
  70. package/config/workflows/ultracode-research.js +42 -0
  71. package/config/workflows/ultracode-review.js +52 -0
  72. package/config/workflows/ultracode.js +77 -0
  73. package/package.json +10 -9
  74. package/packages/sdk/dist/mcp/server.js +5 -2
  75. package/packages/sdk/dist/router/agent-model-registry.d.ts +78 -81
  76. package/packages/sdk/dist/router/agent-model-registry.js +94 -214
  77. package/packages/sdk/dist/version.d.ts +1 -1
  78. package/packages/sdk/dist/version.js +1 -1
  79. package/packages/sdk/package.json +1 -1
  80. package/.claude/hooks/agent-model-guard.mjs +0 -153
  81. package/.claude/hooks/git-workflow-guard.mjs +0 -130
  82. package/.claude/hooks/path-ownership-guard.mjs +0 -85
  83. package/.claude/hooks/pretooluse-bash.mjs +0 -79
  84. package/.claude/model-router.json +0 -179
  85. package/.claude/settings.json +0 -253
  86. package/.claude-plugin/plugin.json +0 -41
  87. /package/{.claude → config/claude}/agents/_shared/AGENT_BASELINE.md +0 -0
  88. /package/{.claude → config/claude}/agents/_shared/CLAUDE_TOOLS.md +0 -0
  89. /package/{.claude → config/claude}/agents/_shared/SKILLS.md +0 -0
  90. /package/{.claude → config/claude}/commands/audit.md +0 -0
  91. /package/{.claude → config/claude}/commands/autopilot.md +0 -0
  92. /package/{.claude → config/claude}/commands/bizar.md +0 -0
  93. /package/{.claude → config/claude}/commands/cancel.md +0 -0
  94. /package/{.claude → config/claude}/commands/cron.md +0 -0
  95. /package/{.claude → config/claude}/commands/explain.md +0 -0
  96. /package/{.claude → config/claude}/commands/init.md +0 -0
  97. /package/{.claude → config/claude}/commands/learn.md +0 -0
  98. /package/{.claude → config/claude}/commands/plan.md +0 -0
  99. /package/{.claude → config/claude}/commands/plow-through.md +0 -0
  100. /package/{.claude → config/claude}/commands/pr-review.md +0 -0
  101. /package/{.claude → config/claude}/commands/quick.md +0 -0
  102. /package/{.claude → config/claude}/commands/ralph.md +0 -0
  103. /package/{.claude → config/claude}/commands/ralplan.md +0 -0
  104. /package/{.claude → config/claude}/commands/setup-provider.md +0 -0
  105. /package/{.claude → config/claude}/commands/spec.md +0 -0
  106. /package/{.claude → config/claude}/commands/sprint.md +0 -0
  107. /package/{.claude → config/claude}/commands/tailscale-serve.md +0 -0
  108. /package/{.claude → config/claude}/commands/test.md +0 -0
  109. /package/{.claude → config/claude}/commands/ultraqa.md +0 -0
  110. /package/{.claude → config/claude}/commands/ultrawork.md +0 -0
  111. /package/{.claude → config/claude}/commands/use-default.md +0 -0
  112. /package/{.claude → config/claude}/commands/use-premium.md +0 -0
  113. /package/{.claude → config/claude}/commands/validate.md +0 -0
  114. /package/{.claude → config/claude}/commands/verify.md +0 -0
  115. /package/{.claude → config/claude}/hooks/README.md +0 -0
  116. /package/{.claude → config/claude}/hooks/agent-grounding.mjs +0 -0
  117. /package/{.claude → config/claude}/hooks/auto-instinct.sh +0 -0
  118. /package/{.claude → config/claude}/hooks/content-style-guard.mjs +0 -0
  119. /package/{.claude → config/claude}/hooks/git-command-parser.mjs +0 -0
  120. /package/{.claude → config/claude}/hooks/keyword-router.mjs +0 -0
  121. /package/{.claude → config/claude}/hooks/learning-extract.mjs +0 -0
  122. /package/{.claude → config/claude}/hooks/permission-request.mjs +0 -0
  123. /package/{.claude → config/claude}/hooks/persistent-mode.mjs +0 -0
  124. /package/{.claude → config/claude}/hooks/post-tool-use-failure.mjs +0 -0
  125. /package/{.claude → config/claude}/hooks/posttooluse-editwrite.mjs +0 -0
  126. /package/{.claude → config/claude}/hooks/precompact-priorities.sh +0 -0
  127. /package/{.claude → config/claude}/hooks/sessionend-recall.mjs +0 -0
  128. /package/{.claude → config/claude}/hooks/telemetry.mjs +0 -0
  129. /package/{.claude → config/claude}/hooks/thinking-route.mjs +0 -0
package/AGENTS.md CHANGED
@@ -31,6 +31,21 @@ make session-end # lifecycle compatibility target
31
31
  - **MUST NOT** use a persistent Claude daemon. Claude Code and the Agent SDK run in-process; background work uses Claude Code's Agent tool.
32
32
  - **MUST NOT** rebase or force-push under the default project policy.
33
33
 
34
+ ### Worktree discipline
35
+
36
+ Every code-writing Agent call dispatched by an orchestrator MUST pass
37
+ `isolation: "worktree"`. Read-only agents stay foreground. Dispatched
38
+ worktrees branch from HEAD as `wt/<agent_type>-<short-task-id>`. The
39
+ SubagentStart hook (`config/claude/hooks/worktree-bootstrap.mjs`) bootstraps
40
+ the worktree; the SubagentStop hook (`config/claude/hooks/worktree-archive.mjs`)
41
+ records the branch into `~/.config/bizar/worktree-queue.json`. The
42
+ orchestrator merges the queue with `bizar worktree-merge --all` (or one
43
+ branch at a time with `bizar worktree-merge <branch>`); the sequencer
44
+ tags each source tip as `merge-archive/<branch>-<sha>` before
45
+ `git merge --no-ff` and surfaces conflicts instead of silently dropping
46
+ work. Conflicts MUST be reported to the user for resolution; never silently
47
+ force a resolution you do not understand.
48
+
34
49
  ## Autonomy and parallelism
35
50
 
36
51
  Agents execute clear, local, reversible work autonomously — they inspect,
@@ -43,20 +58,70 @@ still deny prohibited actions and escalate externally visible or irreversible
43
58
  actions with `permissionDecision: "ask"`; that escalation list is the
44
59
  authoritative floor, not a starting point.
45
60
 
46
- Subagent dispatch through the Agent tool is the default for disjoint work.
47
- When two or more subtasks have non-overlapping file scopes and no data
48
- dependency on each other's intermediate output, the orchestrator MUST
49
- dispatch them in parallel in a single tool block rather than sequentially.
50
- Sequential dispatch is reserved for tasks that depend on a previous step's
51
- output (research plan implement, integration that requires a commit SHA,
52
- verification that consumes a build artifact). The `office-manager` skill
53
- enforces this; individual agents do not re-derive the rule.
54
-
55
- The authoritative hard approval list (cannot be auto-approved) is: commits, pushes, pull-request
61
+ Native dynamic workflows under `config/workflows/` and `~/.claude/workflows/`
62
+ are the primary dispatch mechanism for non-trivial tasks. Mike dispatches a
63
+ named workflow when the request maps to a research / implement / debug /
64
+ review shape. For work that needs 3+ long-lived workers with bounded cross-
65
+ talk, Mike invokes a workflow that fans out as a native agent team; the team
66
+ is host-side state under `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`, and per
67
+ Anthropic's docs `team_name` is deprecated and ignored. Plain `Agent` calls
68
+ are reserved for trivial, single-shot, or fully isolated work. When two or
69
+ more subtasks within a workflow have non-overlapping file scopes and no data
70
+ dependency on each other's intermediate output, the orchestrator MUST dispatch
71
+ them concurrently through `parallel([...])`. Sequential dispatch is reserved
72
+ for dependent phases and integration.
73
+
74
+ Agent roles are model-agnostic. Mike selects the cheapest sufficient tier for
75
+ each dispatch. It passes a concrete model only when live discovery proves a
76
+ configured tier candidate; otherwise it omits `model` and inherits the active
77
+ session. Bizar never retries a failed dispatch by cycling aliases, providers, or
78
+ tiers.
79
+
80
+ The authoritative hard approval list (cannot be auto-approved) is: pushes, pull-request
56
81
  mutations, releases, package publication, deployments, production/shared-
57
82
  infrastructure writes, credential changes, public exposure, irreversible
58
83
  destruction. Everything else proceeds.
59
84
 
85
+ Under F-176 the seven-category floor above is enforced by `permission-request.mjs`
86
+ (the destructive subset: force-push, rebase, root deletion, system-destructive
87
+ commands) and surfaced for the rest via `git-workflow-guard.mjs` as advisory
88
+ reminders in `hookSpecificOutput.additionalContext`. `permissions.deny` and
89
+ `permissions.ask` are emptied by design — the floor is enforced by hook output,
90
+ not by Claude Code prompts.
91
+
92
+ > Note: `config/claude/settings.json` ships `permissions.ask` moved into
93
+ > `permissions.allow` so subagents do not prompt for commits, pushes, PRs,
94
+ > or deploys. Operators who want HITL back can move the following exact
95
+ > patterns from `permissions.allow` into `permissions.ask` in their local
96
+ > `~/.claude/settings.json` override:
97
+ >
98
+ > - `Bash(git push *)`
99
+ > - `Bash(git -C * push *)`
100
+ > - `Bash(git --git-dir=* push *)`
101
+ > - `Bash(git push --force *)`
102
+ > - `Bash(git push -f *)`
103
+ > - `Bash(git rebase *)`
104
+ > - `Bash(gh pr create *)`
105
+ > - `Bash(gh pr merge *)`
106
+ > - `Bash(gh release create *)`
107
+ > - `Bash(npm publish *)`
108
+ > - `Bash(bun publish *)`
109
+ > - `Bash(pnpm publish *)`
110
+ > - `Bash(vercel deploy *)`
111
+ > - `Bash(wrangler deploy *)`
112
+ > - `Bash(flyctl deploy *)`
113
+
114
+ > Note: `disableAutoCompact: true` is shipped by default. Sessions rely on
115
+ > manual `/compact` instead. Hook `precompact-priorities.sh` preserves
116
+ > evidence and decisions on compaction.
117
+ Local `git commit` is always allowed silently via `permissions.allow`; the seven
118
+ HITL categories above are gated by `permission-request.mjs` plus the advisory
119
+ hook chain.
120
+
121
+ Agents always fetch current official documentation via WebSearch + WebFetch at
122
+ task start and whenever uncertainty appears during work. Guess-and-try is
123
+ prohibited.
124
+
60
125
  ## Execution model
61
126
 
62
127
  The autonomy and approval policy above governs this execution model. The project defaults to `acceptEdits`; eligible operators may opt into Claude Code Auto mode.
package/cli/bin.mjs CHANGED
@@ -416,14 +416,37 @@ async function main() {
416
416
  break;
417
417
  }
418
418
 
419
+ case 'models': {
420
+ const mod = await importCommand('models');
421
+ if (!mod) {
422
+ console.error(chalk.red(` ✗ Could not load models command module`));
423
+ process.exit(EXIT_ERROR);
424
+ return;
425
+ }
426
+ dbg('loaded command module:', 'models');
427
+ const found = await mod.run(cmd, cmdArgs, isHelpRequest);
428
+ if (found === false) {
429
+ console.error(chalk.red(` ✗ Usage: bizar models [--list|--set|--clear|--json] — run 'bizar models --help'`));
430
+ process.exit(EXIT_USAGE);
431
+ }
432
+ break;
433
+ }
434
+
419
435
  case 'model': {
436
+ // Deprecated alias. Routes to the original `model.mjs` so the
437
+ // legacy JSON shape (`{ providers: { ... }, total: N }`) and table
438
+ // output keep working for existing scripts and tests. New code
439
+ // should use `bizar models` (see `case 'models'`).
420
440
  const mod = await importCommand('model');
421
441
  if (!mod) {
422
442
  console.error(chalk.red(` ✗ Could not load model command module`));
423
443
  process.exit(EXIT_ERROR);
424
444
  return;
425
445
  }
426
- dbg('loaded command module:', 'model');
446
+ dbg('loaded command module (deprecated alias):', 'model');
447
+ if (!isHelpRequest) {
448
+ console.error(chalk.yellow(' ! `bizar model` is deprecated; use `bizar models` for the new picker surface.'));
449
+ }
427
450
  const found = await mod.run(cmd, cmdArgs, isHelpRequest);
428
451
  if (found === false) {
429
452
  console.error(chalk.red(` ✗ Usage: bizar model <subcommand> — run 'bizar model --help'`));
@@ -14,7 +14,7 @@ import { dirname, resolve } from 'node:path';
14
14
  import { fileURLToPath, pathToFileURL } from 'node:url';
15
15
 
16
16
  const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
17
- const HOOK_ROOT = resolve(PACKAGE_ROOT, '.claude', 'hooks');
17
+ const HOOK_ROOT = resolve(PACKAGE_ROOT, 'config', 'claude', 'hooks');
18
18
  const PRETOOL_SAFETY_LEAVES = new Set([
19
19
  'pretooluse-editwrite', 'path-ownership-guard',
20
20
  'pretooluse-bash', 'git-workflow-guard',
@@ -44,8 +44,10 @@ export const HOOK_PROGRAMS = Object.freeze({
44
44
  'simplify-guard': 'simplify-guard.mjs',
45
45
  telemetry: 'telemetry.mjs',
46
46
  'thinking-route': 'thinking-route.mjs',
47
+ 'team-lifecycle': 'team-lifecycle.mjs',
47
48
  'verify-deliverables': 'verify-deliverables.mjs',
48
49
  'worker-suggest': 'worker-suggest.mjs',
50
+ 'worktree-archive': 'worktree-archive.mjs',
49
51
  'worktree-bootstrap': 'worktree-bootstrap.mjs',
50
52
  });
51
53
 
@@ -80,7 +82,10 @@ export const EVENT_CHAINS = Object.freeze({
80
82
  'advisor-context',
81
83
  'worktree-bootstrap',
82
84
  ]),
83
- 'subagent-stop': Object.freeze(['verify-deliverables']),
85
+ 'subagent-stop': Object.freeze(['verify-deliverables', 'worktree-archive']),
86
+ 'task-created': Object.freeze(['team-lifecycle']),
87
+ 'task-completed': Object.freeze(['team-lifecycle']),
88
+ 'teammate-idle': Object.freeze(['team-lifecycle']),
84
89
  'pre-compact': Object.freeze(['persistent-mode', 'precompact-priorities']),
85
90
  stop: Object.freeze(['persistent-mode']),
86
91
  'session-end': Object.freeze(['sessionend-recall', 'learning-extract']),
@@ -95,6 +100,9 @@ const EVENT_NAMES = Object.freeze({
95
100
  'post-tool-use-failure': 'PostToolUseFailure',
96
101
  'subagent-start': 'SubagentStart',
97
102
  'subagent-stop': 'SubagentStop',
103
+ 'task-created': 'TaskCreated',
104
+ 'task-completed': 'TaskCompleted',
105
+ 'teammate-idle': 'TeammateIdle',
98
106
  'pre-compact': 'PreCompact',
99
107
  stop: 'Stop',
100
108
  'session-end': 'SessionEnd',