@reinamaccredy/oh-my-opencode 3.0.0-beta.14 → 3.0.0-beta.15

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.
package/dist/index.js CHANGED
@@ -16974,13 +16974,7 @@ var GOOGLE_TO_PROXYPAL_MODEL_MAP = {
16974
16974
  "google/gemini-3-pro-high": "proxypal/gemini-3-pro-preview",
16975
16975
  "google/gemini-3-pro-low": "proxypal/gemini-3-pro-preview"
16976
16976
  };
16977
- var MODEL_TO_CATEGORY_MAP = {
16978
- "proxypal/gemini-3-pro-preview": "visual-engineering",
16979
- "proxypal/gpt-5.2-codex": "ultrabrain",
16980
- "proxypal/gemini-3-flash-preview": "quick",
16981
- "proxypal/gemini-claude-opus-4-5-thinking": "most-capable",
16982
- "proxypal/gemini-claude-sonnet-4-5-thinking": "general"
16983
- };
16977
+ var MODEL_TO_CATEGORY_MAP = {};
16984
16978
  function migrateGoogleToProxypalModel(model) {
16985
16979
  const proxypalModel = GOOGLE_TO_PROXYPAL_MODEL_MAP[model];
16986
16980
  if (proxypalModel) {
@@ -19274,8 +19268,32 @@ function createBackgroundNotificationHook(manager) {
19274
19268
  const eventHandler = async ({ event }) => {
19275
19269
  manager.handleEvent(event);
19276
19270
  };
19271
+ const toolExecuteAfterHandler = async (input, output) => {
19272
+ const sessionID = input.sessionID;
19273
+ if (!sessionID)
19274
+ return;
19275
+ if (!manager.hasPendingNotifications(sessionID))
19276
+ return;
19277
+ const notifications = manager.consumePendingNotifications(sessionID);
19278
+ if (notifications.length === 0)
19279
+ return;
19280
+ const messages = notifications.map((n) => {
19281
+ if (n.status === "error") {
19282
+ return `[BACKGROUND TASK FAILED] Task "${n.description}" failed after ${n.duration}. Error: ${n.error || "Unknown error"}. Use background_output with task_id="${n.taskId}" for details.`;
19283
+ }
19284
+ return `[BACKGROUND TASK COMPLETED] Task "${n.description}" finished in ${n.duration}. Use background_output with task_id="${n.taskId}" to get results.`;
19285
+ });
19286
+ const injection = `
19287
+
19288
+ ---
19289
+ ` + messages.join(`
19290
+ `) + `
19291
+ ---`;
19292
+ output.output = output.output + injection;
19293
+ };
19277
19294
  return {
19278
- event: eventHandler
19295
+ event: eventHandler,
19296
+ "tool.execute.after": toolExecuteAfterHandler
19279
19297
  };
19280
19298
  }
19281
19299
  // src/hooks/auto-update-checker/checker.ts
@@ -21295,397 +21313,219 @@ function mergeSkills(builtinSkills, config, userClaudeSkills, userOpencodeSkills
21295
21313
  }
21296
21314
  return Array.from(skillMap.values());
21297
21315
  }
21298
- // src/features/builtin-skills/skills.ts
21299
- var maestroCoreSkill = {
21300
- name: "maestro-core",
21301
- description: "Use when any Maestro skill loads - provides skill hierarchy, HALT/DEGRADE policies, and trigger routing rules for orchestration decisions",
21302
- template: `# Maestro Core - Workflow Router
21303
-
21304
- Central hub for Maestro workflow skills. Routes triggers, defines hierarchy, and handles fallbacks.
21316
+ // src/features/maestro/skills/index.ts
21317
+ var tddSkill = {
21318
+ name: "tdd",
21319
+ description: "TDD methodology for implementation tasks. Enforces RED\u2192GREEN\u2192REFACTOR cycle. Auto-injected for ci/co/ca modes.",
21320
+ template: `# TDD - Test-Driven Development
21305
21321
 
21306
- ## Skill Hierarchy
21322
+ Enforce RED \u2192 GREEN \u2192 REFACTOR cycle for all implementation work.
21307
21323
 
21308
- \`\`\`
21309
- conductor (1) > orchestrator (2) > designing (3) > tracking (4) > specialized (5)
21310
- \`\`\`
21311
-
21312
- Higher rank wins on conflicts.
21313
-
21314
- ## Ownership Matrix
21324
+ ## Cycle
21315
21325
 
21316
- | Skill | Owns | Primary Triggers |
21317
- |-------|------|------------------|
21318
- | conductor | Implementation + autonomous | \`ci\`, \`ca\`, \`/conductor-implement\`, \`/conductor-autonomous\` |
21319
- | orchestrator | Parallel execution | \`co\`, \`/conductor-orchestrate\` |
21320
- | designing | Phases 1-10 (design \u2192 track creation) | \`ds\`, \`cn\`, \`/conductor-newtrack\`, \`/conductor-design\` |
21321
- | tracking | Task/bead management | \`bd *\`, \`fb\`, \`rb\` |
21322
- | handoff | Session cycling | \`ho\`, \`/conductor-finish\`, \`/conductor-handoff\` |
21323
- | creating-skills | Skill authoring | "create skill", "write skill" |
21326
+ | Phase | Action | Gate |
21327
+ |-------|--------|------|
21328
+ | RED | Write failing test first | Test must FAIL |
21329
+ | GREEN | Implement minimal code to pass | Test must PASS |
21330
+ | REFACTOR | Clean up while tests pass | All tests PASS |
21324
21331
 
21325
- ## Workflow Chain
21326
-
21327
- \`\`\`
21328
- ds/cn \u2192 design.md \u2192 /conductor-newtrack \u2192 spec.md + plan.md \u2192 fb \u2192 tracking \u2192 ci/co/ca \u2192 implementation
21329
- \`\`\`
21332
+ ## Protocol
21330
21333
 
21331
- ## Routing Table
21334
+ 1. **Before implementation**: Write test that captures expected behavior
21335
+ 2. **Run test**: Verify it fails for the right reason
21336
+ 3. **Implement**: Write minimal code to make test pass
21337
+ 4. **Verify**: Run test, must pass
21338
+ 5. **Refactor**: Clean up code, run tests after each change
21339
+ 6. **Repeat**: Next behavior/requirement
21332
21340
 
21333
- **CRITICAL:** After loading \`maestro-core\`, you MUST explicitly load the target skill via \`skill(name="...")\` before proceeding.
21341
+ ## Commands
21334
21342
 
21335
- ### Quick Triggers
21336
-
21337
- | Trigger | Skill |
21338
- |---------|-------|
21339
- | \`ds\`, \`cn\` | designing |
21340
- | \`ci\` | conductor |
21341
- | \`ca\` | conductor |
21342
- | \`co\` | orchestrator |
21343
- | \`fb\`, \`rb\`, \`bd *\` | tracking |
21344
- | \`ho\` | handoff |
21343
+ \`\`\`bash
21344
+ # Run tests (detect project type)
21345
+ bun test || npm test || pnpm test || yarn test
21345
21346
 
21346
- ### Routing Flow
21347
+ # Run specific test file
21348
+ bun test {file} || npm test -- {file}
21347
21349
 
21348
- \`\`\`
21349
- 1. User triggers command (e.g., \`ci\`)
21350
- 2. Load maestro-core \u2192 get routing table
21351
- 3. Look up trigger \u2192 find target skill
21352
- 4. MUST call skill tool to load target skill
21353
- 5. Follow loaded skill instructions
21350
+ # Watch mode (if supported)
21351
+ bun test --watch || npm test -- --watch
21354
21352
  \`\`\`
21355
21353
 
21356
- ## Fallback Policies
21354
+ ## Gate Rules
21357
21355
 
21358
- | Condition | Action | Message |
21359
- |-----------|--------|---------|
21360
- | \`bd\` unavailable | HALT | \`\u274C Cannot proceed: bd CLI required\` |
21361
- | \`conductor/\` missing | DEGRADE | \`\u26A0\uFE0F Standalone mode - limited features\` |
21362
- | Agent Mail unavailable | HALT | \`\u274C Cannot proceed: Agent Mail required for coordination\` |
21356
+ - Cannot mark task complete if tests fail
21357
+ - Cannot skip RED phase (write test first)
21358
+ - Cannot proceed to next task with failing tests
21359
+ - Must run tests after REFACTOR
21363
21360
 
21364
- ## Related Skills
21361
+ ## Anti-Patterns
21365
21362
 
21366
- - **designing** - Double Diamond design sessions (phases 1-10)
21367
- - **conductor** - Implementation execution
21368
- - **orchestrator** - Multi-agent parallel execution
21369
- - **tracking** - Issue tracking and dependency graphs
21370
- - **handoff** - Session cycling and context preservation`
21363
+ - Writing implementation before test (violates RED)
21364
+ - Writing more code than needed to pass (violates GREEN)
21365
+ - Skipping REFACTOR phase
21366
+ - Ignoring test failures`
21371
21367
  };
21372
- var designingSkill = {
21373
- name: "designing",
21374
- description: 'Design Session - collaborative brainstorming to turn ideas into actionable implementation plans using the Unified Pipeline methodology. Use when user types "ds" or wants to explore/design a feature before implementation. "pl" triggers phases 5-10 (STANDALONE/ALIAS/NO-OP modes). MUST load maestro-core skill first for routing.',
21375
- template: `# Design & Planning
21376
-
21377
- Turn ideas into fully-formed, implementation-ready designs through a unified 10-phase pipeline.
21378
-
21379
- ## Entry Points
21380
-
21381
- | Trigger | Action |
21382
- |---------|--------|
21383
- | \`ds\` | Start unified pipeline (all 10 phases) |
21384
- | \`/conductor-design\` | Start unified pipeline (alias) |
21385
- | \`cn\`, \`/conductor-newtrack\` | Create spec + plan + beads from existing design.md |
21386
- | \`pl\`, \`/plan\` | Planning phases (5-10) - see pl Entry Modes below |
21387
- | "design a feature" | Start unified pipeline |
21388
- | "let's think through X" | Start unified pipeline |
21389
-
21390
- ## Quick Reference
21391
-
21392
- ### Unified Pipeline (10 Phases)
21368
+ var agentMailSkill = {
21369
+ name: "agent-mail",
21370
+ description: "Worker coordination for parallel execution. Provides messaging, file reservations, and session management. Auto-injected for co/ca modes.",
21371
+ template: `# Agent Mail - Worker Coordination
21393
21372
 
21394
- | # | Phase | Type | Purpose | Exit Criteria |
21395
- |---|-------|------|---------|---------------|
21396
- | 1 | **DISCOVER** | Diverge | Explore problem + research context | Problem articulated |
21397
- | 2 | **DEFINE** | Converge | Frame problem + select approach | Approach selected |
21398
- | 3 | **DEVELOP** | Diverge | Architecture + components | Interfaces defined |
21399
- | 4 | **VERIFY** | Converge | Oracle audit + risk assessment | Oracle APPROVED |
21400
- | 5 | **DECOMPOSE** | Execute | Create beads (fb) | Beads filed |
21401
- | 6 | **VALIDATE** | Execute | Dependency check (bv) + Oracle review | Dependencies valid |
21402
- | 7 | **ASSIGN** | Execute | Track assignments | Tracks assigned |
21403
- | 8 | **READY** | Complete | Handoff to ci/co/ca | Execution ready |
21404
- | 9 | **EXECUTE** | Implement | Run ci/co/ca on tracks | All beads completed |
21405
- | 10 | **FINISH** | Archive | Extract learnings + archive track | Track archived |
21373
+ CLI-based coordination for parallel workers in co/ca modes.
21406
21374
 
21407
- ## Mode Routing
21375
+ ## CLI Location
21408
21376
 
21409
- Complexity scoring determines execution mode:
21410
-
21411
- | Score | Mode | Phases | A/P/C | Research |
21412
- |-------|------|--------|-------|----------|
21413
- | < 4 | **SPEED** | 1,2,4,8 | No | 1 hook (start) |
21414
- | 4-6 | **ASK** | User chooses | Optional | User chooses |
21415
- | > 6 | **FULL** | 1-10 | Yes | 2 hooks |
21416
-
21417
- ## Core Principles
21377
+ \`\`\`bash
21378
+ bun toolboxes/agent-mail/agent-mail.js <command>
21379
+ \`\`\`
21418
21380
 
21419
- - **One question at a time** - Don't overwhelm
21420
- - **Multiple choice preferred** - Easier to answer
21421
- - **YAGNI ruthlessly** - Remove unnecessary features
21422
- - **Explore alternatives** - Always propose 2-3 approaches
21423
- - **Research consolidated** - 2 strategic hooks, not 5
21381
+ ## Worker 4-Step Protocol
21424
21382
 
21425
- ## \u26D4 EXECUTION BLOCKS (CRITICAL)
21383
+ | Step | Command | Required |
21384
+ |------|---------|----------|
21385
+ | 1. INIT | \`macro-start-session\` | FIRST |
21386
+ | 2. WORK | (do assigned tasks) | - |
21387
+ | 3. REPORT | \`send-message\` | LAST |
21388
+ | 4. CLEANUP | \`release-file-reservations\` | LAST |
21426
21389
 
21427
- **This skill contains EXECUTION BLOCKS marked with \u26D4. When you encounter one, you MUST:**
21428
- 1. **STOP** what you're doing
21429
- 2. **EXECUTE** the tool calls specified (Task(), oracle(), skill())
21430
- 3. **WAIT** for results before proceeding
21390
+ ## Commands
21431
21391
 
21432
- **EXECUTION BLOCKS are NOT documentation - they are COMMANDS you must execute.**
21392
+ ### Session Management
21393
+ \`\`\`bash
21394
+ # Initialize worker session
21395
+ bun toolboxes/agent-mail/agent-mail.js macro-start-session
21433
21396
 
21434
- ## Session Flow
21397
+ # Health check
21398
+ bun toolboxes/agent-mail/agent-mail.js health-check
21399
+ \`\`\`
21435
21400
 
21436
- 0. **Load Core** - Load maestro-core for routing table and fallback policies
21437
- 1. **Initialize** - Load handoffs, CODEMAPS, verify conductor setup
21438
- 2. **Research** - \u26D4 EXECUTION BLOCK at Phase 1 start (spawn 3 Task() agents)
21439
- 3. **Route** - Score complexity (< 4 = SPEED, > 6 = FULL)
21440
- 4. **Execute** - 10-phase pipeline with A/P/C checkpoints
21441
- 5. **Validate** - \u26D4 EXECUTION BLOCK at Phase 4 (call oracle())
21442
- 6. **Complete** - Phase 8 (READY) triggers \`ci\`/\`co\`/\`ca\` \u2192 Phase 9 (EXECUTE) \u2192 Phase 10 (FINISH)
21401
+ ### Messaging
21402
+ \`\`\`bash
21403
+ # Send message to orchestrator
21404
+ bun toolboxes/agent-mail/agent-mail.js send-message --to orchestrator --body "Epic complete"
21443
21405
 
21444
- ## Next Steps (after Phase 8: READY)
21406
+ # Check inbox for blockers/instructions
21407
+ bun toolboxes/agent-mail/agent-mail.js fetch-inbox
21445
21408
 
21446
- | Command | Description | Phase |
21447
- |---------|-------------|-------|
21448
- | \`ci\` | \`/conductor-implement\` - Execute track | Phase 9 (EXECUTE) |
21449
- | \`co\` | \`/conductor-orchestrate\` - Spawn parallel workers | Phase 9 (EXECUTE) |
21450
- | \`ca\` | \`/conductor-autonomous\` - Ralph loop | Phase 9 (EXECUTE) |
21451
- | \`/conductor-finish\` | Archive track + extract learnings | Phase 10 (FINISH) |
21409
+ # Reply to message
21410
+ bun toolboxes/agent-mail/agent-mail.js reply-message --id <msg-id> --body "Acknowledged"
21411
+ \`\`\`
21452
21412
 
21453
- ## Anti-Patterns
21413
+ ### File Reservations
21414
+ \`\`\`bash
21415
+ # Reserve files before editing
21416
+ bun toolboxes/agent-mail/agent-mail.js reserve-files --paths "src/api/user.ts,src/api/auth.ts"
21454
21417
 
21455
- - \u274C Jumping to solutions before understanding the problem
21456
- - \u274C Skipping verification at Phase 4 (VERIFY)
21457
- - \u274C Asking multiple questions at once
21458
- - \u274C Over-engineering simple features (use SPEED mode)
21459
- - \u274C Running \`pl\` after \`ds\` completes (no longer needed)
21418
+ # Release reservations when done
21419
+ bun toolboxes/agent-mail/agent-mail.js release-file-reservations
21420
+ \`\`\`
21460
21421
 
21461
- ## Related
21422
+ ## Rules
21462
21423
 
21463
- - **conductor** - Track creation and implementation
21464
- - **tracking** - Issue tracking after design
21465
- - **orchestrator** - Parallel execution in Phase 9 (EXECUTE)`
21424
+ - Never start work before \`macro-start-session\`
21425
+ - Never exit without \`send-message\` to orchestrator
21426
+ - Never touch files outside assigned scope
21427
+ - Always release reservations on completion
21428
+ - Report blockers immediately via \`send-message\``
21466
21429
  };
21430
+ function createMaestroSkills() {
21431
+ return [tddSkill, agentMailSkill];
21432
+ }
21433
+
21434
+ // src/features/builtin-skills/skills.ts
21467
21435
  var conductorSkill = {
21468
21436
  name: "conductor",
21469
- description: "Implementation execution for context-driven development. Trigger with ci, /conductor-implement, or /conductor-* commands. Use when executing tracks with specs/plans. For design phases, see designing skill. For session handoffs, see handoff skill.",
21437
+ description: "Implementation execution with TDD. Trigger with ci (sequential), co (parallel), or ca (autonomous). Auto-injects tdd skill for all modes, agent-mail for co/ca.",
21470
21438
  template: `# Conductor: Implementation Execution
21471
21439
 
21472
- Execute tracks with TDD and parallel routing.
21440
+ Execute implementation with TDD and optional parallel routing.
21473
21441
 
21474
21442
  ## Entry Points
21475
21443
 
21476
- | Trigger | Action | Reference |
21477
- |---------|--------|-----------|
21478
- | \`/conductor-setup\` | Initialize project context | Setup workflow |
21479
- | \`/conductor-implement\` | Execute track (auto-routes if parallel) | Implement workflow |
21480
- | \`ca\`, \`/conductor-autonomous\` | **Run ralph.sh directly** (no Task/sub-agents) | Autonomous workflow |
21481
- | \`/conductor-status\` | Display progress overview | Structure |
21482
- | \`/conductor-revise\` | Update spec/plan mid-work | Revisions |
21483
-
21484
- ## Related Skills (Not Owned by Conductor)
21485
-
21486
- | For... | Use Skill | Triggers |
21487
- |--------|-----------|----------|
21488
- | Design phases (1-8) | designing | \`ds\`, \`cn\`, \`/conductor-design\`, \`/conductor-newtrack\` |
21489
- | Session handoffs | handoff | \`ho\`, \`/conductor-finish\`, \`/conductor-handoff\` |
21444
+ | Trigger | Mode | Description |
21445
+ |---------|------|-------------|
21446
+ | \`ci\` | Sequential | Execute beads one-by-one with TDD |
21447
+ | \`co\` | Parallel | Spawn workers per epic, coordinate via Agent Mail |
21448
+ | \`ca\` | Autonomous | Ralph loop - continuous execution until complete |
21490
21449
 
21491
- ## Quick Reference
21492
-
21493
- | Phase | Purpose | Output | Skill |
21494
- |-------|---------|--------|-------|
21495
- | Requirements | Understand problem | design.md | designing |
21496
- | Plan | Create spec + plan | spec.md + plan.md | designing |
21497
- | **Implement** | Build with TDD | Code + tests | **conductor** |
21498
- | **Autonomous** | Ralph loop execution | Auto-verified stories | **conductor** |
21499
- | Reflect | Verify before shipping | LEARNINGS.md | handoff |
21500
-
21501
- ## Core Principles
21502
-
21503
- - **Load core first** - Load maestro-core for routing table and fallback policies
21504
- - **TDD by default** - RED \u2192 GREEN \u2192 REFACTOR (use \`--no-tdd\` to disable)
21505
- - **Beads integration** - Zero manual \`bd\` commands in happy path
21506
- - **Parallel routing** - \`## Track Assignments\` in plan.md triggers orchestrator
21507
- - **Validation gates** - Automatic checks at each phase transition
21508
-
21509
- ## Directory Structure
21510
-
21511
- \`\`\`
21512
- conductor/
21513
- \u251C\u2500\u2500 product.md, tech-stack.md, workflow.md # Project context
21514
- \u251C\u2500\u2500 code_styleguides/ # Language-specific style rules
21515
- \u251C\u2500\u2500 CODEMAPS/ # Architecture docs
21516
- \u251C\u2500\u2500 handoffs/ # Session context
21517
- \u251C\u2500\u2500 spikes/ # Research spikes (pl output)
21518
- \u2514\u2500\u2500 tracks/<track_id>/ # Per-track work
21519
- \u251C\u2500\u2500 design.md, spec.md, plan.md # Planning artifacts
21520
- \u2514\u2500\u2500 metadata.json # State tracking (includes planning state)
21521
- \`\`\`
21522
-
21523
- ## Beads Integration
21524
-
21525
- All execution routes through orchestrator with Agent Mail coordination:
21526
- - Workers claim beads via \`bd update --status in_progress\`
21527
- - Workers close beads via \`bd close --reason completed|skipped|blocked\`
21528
- - File reservations via \`file_reservation_paths\`
21529
- - Communication via \`send_message\`/\`fetch_inbox\`
21530
-
21531
- ## /conductor-implement Auto-Routing
21532
-
21533
- 1. Read \`metadata.json\` - check \`orchestrated\` flag
21534
- 2. Read \`plan.md\` - check for \`## Track Assignments\`
21535
- 3. Check \`beads.fileScopes\` - file-scope based grouping
21536
- 4. If parallel detected (\u22652 non-overlapping groups) \u2192 Load orchestrator skill
21537
- 5. Else \u2192 Sequential execution with TDD
21450
+ ## Auto-Injected Skills
21538
21451
 
21539
- ## Anti-Patterns
21540
-
21541
- - \u274C Manual \`bd\` commands when workflow commands exist
21542
- - \u274C Ignoring validation gate failures
21543
- - \u274C Using conductor for design (use designing instead)
21544
- - \u274C Using conductor for handoffs (use handoff instead)
21545
-
21546
- ## Related
21547
-
21548
- - **designing** - Double Diamond design + track creation
21549
- - **handoff** - Session cycling and finish workflow
21550
- - **tracking** - Issue tracking (beads)
21551
- - **orchestrator** - Parallel execution
21552
- - **maestro-core** - Routing policies`
21553
- };
21554
- var orchestratorSkill = {
21555
- name: "orchestrator",
21556
- description: 'Multi-agent parallel execution with autonomous workers. Use when plan.md has Track Assignments section or user triggers /conductor-orchestrate, "run parallel", "spawn workers". MUST load maestro-core skill first for routing.',
21557
- template: `# Orchestrator - Multi-Agent Parallel Execution
21558
-
21559
- > **Spawn autonomous workers to execute tracks in parallel using Agent Mail coordination.**
21452
+ | Mode | Skills |
21453
+ |------|--------|
21454
+ | \`ci\` | tdd, tracking |
21455
+ | \`co\` | tdd, agent-mail, tracking |
21456
+ | \`ca\` | tdd, agent-mail, tracking |
21560
21457
 
21561
- ## Agent Mail: CLI Primary, MCP Fallback
21458
+ ## TDD Protocol (All Modes)
21562
21459
 
21563
- This skill uses a **lazy-load pattern** for Agent Mail:
21460
+ | Phase | Action | Gate |
21461
+ |-------|--------|------|
21462
+ | RED | Write failing test first | Test must FAIL |
21463
+ | GREEN | Implement minimal code | Test must PASS |
21464
+ | REFACTOR | Clean up, tests pass | All tests PASS |
21564
21465
 
21565
- | Priority | Tool | When Available |
21566
- |----------|------|----------------|
21567
- | **Primary** | \`bun toolboxes/agent-mail/agent-mail.js\` | Always (via Bash) |
21568
- | **Fallback** | MCP tools (via \`mcp.json\`) | When skill loaded + MCP server running |
21466
+ ## Sequential Mode (ci)
21569
21467
 
21570
- **Detection flow:**
21571
21468
  \`\`\`
21572
- 1. Try CLI: bun toolboxes/agent-mail/agent-mail.js health-check
21573
- \u2193 success? \u2192 Use CLI for all Agent Mail operations
21574
- \u2193 fails?
21575
- 2. Fallback: MCP tools (lazy-loaded via skills/orchestrator/mcp.json)
21469
+ 1. bd ready --limit 1 # Get next ready bead
21470
+ 2. bd update {id} --status in_progress
21471
+ 3. TDD cycle (RED \u2192 GREEN \u2192 REFACTOR)
21472
+ 4. bd close {id} --reason completed
21473
+ 5. Repeat until no ready beads
21576
21474
  \`\`\`
21577
21475
 
21578
- **CLI benefits:** Zero token cost until used, no MCP server dependency.
21579
-
21580
- ## Core Principles
21581
-
21582
- - **Load core first** - Load maestro-core for routing table and fallback policies
21583
- - **CLI first** - Use \`bun toolboxes/agent-mail/agent-mail.js\` CLI before falling back to MCP tools
21584
- - **Pre-register workers** before spawning (Agent Mail validates recipients)
21585
- - **Workers own their beads** - can \`bd claim/close\` directly (unlike sequential mode)
21586
- - **File reservations prevent conflicts** - reserve before edit, release on complete
21587
- - **Summary before exit** - all workers MUST send completion message
21588
- - **TDD by default** - workers follow RED \u2192 GREEN \u2192 REFACTOR cycle (use \`--no-tdd\` to disable)
21589
-
21590
- ## When to Use
21591
-
21592
- | Trigger | Condition |
21593
- |---------|-----------|
21594
- | Auto-routed | \`/conductor-implement\` when plan has Track Assignments |
21595
- | File-scope | \`/conductor-implement\` when \u22652 non-overlapping file groups detected |
21596
- | Direct | \`/conductor-orchestrate\` or \`co\` |
21597
- | Phrase | "run parallel", "spawn workers", "dispatch agents" |
21598
- | **See also** | \`ca\` for autonomous execution |
21599
-
21600
- ## Auto-Trigger Behavior
21601
-
21602
- Parallel execution starts **automatically** when detected - no confirmation needed:
21476
+ ## Parallel Mode (co)
21603
21477
 
21604
21478
  \`\`\`
21605
- \uD83D\uDCCA Parallel execution detected:
21606
- - Track A: 2 tasks (src/api/)
21607
- - Track B: 2 tasks (lib/)
21608
- - Track C: 1 task (schemas/)
21609
-
21610
- \u26A1 Spawning workers...
21479
+ 1. Group ready beads by epic
21480
+ 2. For each epic, spawn worker:
21481
+ sisyphus_task(
21482
+ category="general",
21483
+ skills=["tdd", "agent-mail", "tracking"],
21484
+ run_in_background=true,
21485
+ prompt="Epic: {title}..."
21486
+ )
21487
+ 3. Monitor via background_output()
21488
+ 4. Close epics when all beads complete
21611
21489
  \`\`\`
21612
21490
 
21613
- ## Quick Reference
21614
-
21615
- | Action | Tool |
21616
- |--------|------|
21617
- | Parse plan.md | \`Read("conductor/tracks/<id>/plan.md")\` |
21618
- | Initialize | \`bun toolboxes/agent-mail/agent-mail.js macro-start-session\` |
21619
- | Spawn workers | \`Task()\` for each track |
21620
- | Monitor | \`bun toolboxes/agent-mail/agent-mail.js fetch-inbox\` |
21621
- | Resolve blockers | \`bun toolboxes/agent-mail/agent-mail.js reply-message\` |
21622
- | Complete | \`bun toolboxes/agent-mail/agent-mail.js send-message\`, \`bd close epic\` |
21623
- | Track threads | \`bun toolboxes/agent-mail/agent-mail.js summarize-thread\` |
21624
- | Auto-routing | Auto-detect parallel via \`metadata.json.beads\` |
21625
-
21626
- ## 8-Phase Orchestrator Protocol
21627
-
21628
- 0. **Preflight** - Session identity, detect active sessions
21629
- 1. **Read Plan** - Parse Track Assignments from plan.md
21630
- 2. **Validate** - Health check Agent Mail CLI (HALT if unavailable)
21631
- 3. **Initialize** - ensure_project, register orchestrator + all workers
21632
- 4. **Spawn Workers** - Task() for each track (parallel)
21633
- 5. **Monitor + Verify** - fetch_inbox, verify worker summaries
21634
- - Workers use track threads (\`TRACK_THREAD\`) for bead-to-bead context
21635
- 6. **Resolve** - reply_message for blockers
21636
- 7. **Complete** - Send summary, close epic, \`rb\` review
21637
-
21638
- ## Worker 4-Step Protocol
21639
-
21640
- All workers MUST follow this exact sequence:
21491
+ ## Autonomous Mode (ca)
21641
21492
 
21642
21493
  \`\`\`
21643
- \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
21644
- \u2502 STEP 1: INITIALIZE - bun toolboxes/agent-mail/agent-mail.js macro-start-session \u2502
21645
- \u2502 STEP 2: EXECUTE - claim beads, do work, close beads \u2502
21646
- \u2502 STEP 3: REPORT - bun toolboxes/agent-mail/agent-mail.js send-message \u2502
21647
- \u2502 STEP 4: CLEANUP - bun toolboxes/agent-mail/agent-mail.js release-file-reservations \u2502
21648
- \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
21494
+ 1. Loop while bd ready shows pending beads:
21495
+ a. Group ready beads by epic
21496
+ b. Spawn parallel workers (like co mode)
21497
+ c. Wait for all workers
21498
+ d. TDD gate check - fix failures
21499
+ e. Continue to next iteration
21500
+ 2. Exit when all beads complete
21649
21501
  \`\`\`
21650
21502
 
21651
- | Step | Tool | Required |
21652
- |------|------|----------|
21653
- | 1 | \`bun toolboxes/agent-mail/agent-mail.js macro-start-session\` | \u2705 FIRST |
21654
- | 2 | \`bd update\`, \`bd close\` | \u2705 |
21655
- | 3 | \`bun toolboxes/agent-mail/agent-mail.js send-message\` | \u2705 LAST |
21656
- | 4 | \`bun toolboxes/agent-mail/agent-mail.js release-file-reservations\` | \u2705 |
21503
+ ## Beads Integration
21657
21504
 
21658
- **Critical rules:**
21659
- - \u274C Never start work before \`macro-start-session\`
21660
- - \u274C Never return without \`send-message\` to orchestrator
21661
- - \u274C Never touch files outside assigned scope
21505
+ - Claim: \`bd update {id} --status in_progress\`
21506
+ - Close: \`bd close {id} --reason completed|skipped|blocked\`
21507
+ - Ready: \`bd ready\` shows next available work
21662
21508
 
21663
21509
  ## Anti-Patterns
21664
21510
 
21665
- | \u274C Don't | \u2705 Do |
21666
- |----------|-------|
21667
- | Spawn workers without pre-registration | Register all workers BEFORE spawning |
21668
- | Skip completion summary | Always send_message before exit |
21669
- | Ignore file reservation conflicts | Wait or resolve before proceeding |
21670
- | Use orchestration for simple tasks | Use sequential \`/conductor-implement\` |
21511
+ - \u274C Skipping TDD (write test first!)
21512
+ - \u274C Not closing beads after completion
21513
+ - \u274C Manual orchestration in ci mode (use co instead)
21514
+ - \u274C Ignoring test failures
21671
21515
 
21672
21516
  ## Related
21673
21517
 
21674
- - **maestro-core** - Routing and fallback policies
21675
- - **conductor** - Track management, \`/conductor-implement\`
21676
- - **tracking** - Issue tracking, \`bd\` commands`
21518
+ - **tdd** - Test-driven development (auto-injected)
21519
+ - **agent-mail** - Worker coordination for co/ca (auto-injected)
21520
+ - **tracking** - Beads CLI for task management`
21677
21521
  };
21678
21522
  var trackingSkill = {
21679
21523
  name: "tracking",
21680
- description: `Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status". MUST load maestro-core skill first for routing.`,
21524
+ description: `Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".`,
21681
21525
  template: `# Tracking - Persistent Memory for AI Agents
21682
21526
 
21683
21527
  Graph-based issue tracker that survives conversation compaction. Provides persistent memory for multi-session work with complex dependencies.
21684
21528
 
21685
- ## Prerequisites
21686
-
21687
- - **Load maestro-core first** - For routing table and fallback policies
21688
-
21689
21529
  ## Entry Points
21690
21530
 
21691
21531
  | Trigger | Reference | Action |
@@ -21732,9 +21572,7 @@ Graph-based issue tracker that survives conversation compaction. Provides persis
21732
21572
 
21733
21573
  ## Related
21734
21574
 
21735
- - **maestro-core** - Workflow router and skill hierarchy
21736
- - **conductor** - Automated beads operations via facade
21737
- - **orchestrator** - Multi-agent parallel execution`
21575
+ - **conductor** - Automated beads operations via ci/co/ca`
21738
21576
  };
21739
21577
  var playwrightSkill = {
21740
21578
  name: "playwright",
@@ -22088,36 +21926,7 @@ CORRECT: Split by directory/concern:
22088
21926
  = 5 commits from 8 files (CORRECT)
22089
21927
  \`\`\`
22090
21928
 
22091
- ### 3.2 Split by Concern SECOND (Secondary Split)
22092
-
22093
- **Within same directory, split by logical concern:**
22094
-
22095
- \`\`\`
22096
- Example: components/demo/ has 4 files
22097
- - browser-frame.tsx (UI frame)
22098
- - shopify-full-site.tsx (specific demo)
22099
- - review-dashboard.tsx (NEW - specific demo)
22100
- - tone-settings.tsx (NEW - specific demo)
22101
-
22102
- Option A (acceptable): 1 commit if ALL tightly coupled
22103
- Option B (preferred): 2 commits
22104
- - Commit: "Update existing demo components" (browser-frame, shopify)
22105
- - Commit: "Add new demo components" (review-dashboard, tone-settings)
22106
- \`\`\`
22107
-
22108
- ### 3.3 NEVER Do This (Anti-Pattern Examples)
22109
-
22110
- \`\`\`
22111
- WRONG: "Refactor entire landing page" - 1 commit with 15 files
22112
- WRONG: "Update components and tests" - 1 commit mixing concerns
22113
- WRONG: "Big update" - Any commit touching 5+ unrelated files
22114
-
22115
- RIGHT: Multiple focused commits, each 1-4 files max
22116
- RIGHT: Each commit message describes ONE specific change
22117
- RIGHT: A reviewer can understand each commit in 30 seconds
22118
- \`\`\`
22119
-
22120
- ### 3.4 Implementation + Test Pairing (MANDATORY)
21929
+ ### 3.2 Implementation + Test Pairing (MANDATORY)
22121
21930
 
22122
21931
  \`\`\`
22123
21932
  RULE: Test files MUST be in same commit as implementation
@@ -22131,34 +21940,7 @@ Test patterns to match:
22131
21940
  - tests/*.py <-> src/*.py
22132
21941
  \`\`\`
22133
21942
 
22134
- ### 3.5 MANDATORY JUSTIFICATION (Before Creating Commit Plan)
22135
-
22136
- **NON-NEGOTIABLE: Before finalizing your commit plan, you MUST:**
22137
-
22138
- \`\`\`
22139
- FOR EACH planned commit with 3+ files:
22140
- 1. List all files in this commit
22141
- 2. Write ONE sentence explaining why they MUST be together
22142
- 3. If you can't write that sentence -> SPLIT
22143
-
22144
- TEMPLATE:
22145
- "Commit N contains [files] because [specific reason they are inseparable]."
22146
-
22147
- VALID reasons:
22148
- VALID: "implementation file + its direct test file"
22149
- VALID: "type definition + the only file that uses it"
22150
- VALID: "migration + model change (would break without both)"
22151
-
22152
- INVALID reasons (MUST SPLIT instead):
22153
- INVALID: "all related to feature X" (too vague)
22154
- INVALID: "part of the same PR" (not a reason)
22155
- INVALID: "they were changed together" (not a reason)
22156
- INVALID: "makes sense to group" (not a reason)
22157
- \`\`\`
22158
-
22159
- **OUTPUT THIS JUSTIFICATION in your analysis before executing commits.**
22160
-
22161
- ### 3.7 Dependency Ordering
21943
+ ### 3.3 Dependency Ordering
22162
21944
 
22163
21945
  \`\`\`
22164
21946
  Level 0: Utilities, constants, type definitions
@@ -22170,22 +21952,7 @@ Level 4: Configuration, infrastructure
22170
21952
  COMMIT ORDER: Level 0 -> Level 1 -> Level 2 -> Level 3 -> Level 4
22171
21953
  \`\`\`
22172
21954
 
22173
- ### 3.8 Create Commit Groups
22174
-
22175
- For each logical feature/change:
22176
- \`\`\`yaml
22177
- - group_id: 1
22178
- feature: "Add Shopify discount deletion"
22179
- files:
22180
- - errors/shopify_error.py
22181
- - types/delete_input.py
22182
- - mutations/update_contract.py
22183
- - tests/test_update_contract.py
22184
- dependency_level: 2
22185
- target_commit: null | <existing-hash> # null = new, hash = fixup
22186
- \`\`\`
22187
-
22188
- ### 3.9 MANDATORY OUTPUT (BLOCKING)
21955
+ ### 3.4 MANDATORY OUTPUT (BLOCKING)
22189
21956
 
22190
21957
  **You MUST output this block before proceeding to Phase 4. NO EXCEPTIONS.**
22191
21958
 
@@ -22206,789 +21973,50 @@ COMMIT 2: [message in detected style]
22206
21973
  - path/to/file2.py
22207
21974
  Justification: independent utility function
22208
21975
 
22209
- COMMIT 3: [message in detected style]
22210
- - config/settings.py
22211
- - config/constants.py
22212
- Justification: tightly coupled config changes
22213
-
22214
- Execution order: Commit 1 -> Commit 2 -> Commit 3
22215
- (follows dependency: Level 0 -> Level 1 -> Level 2 -> ...)
21976
+ Execution order: Commit 1 -> Commit 2 -> ...
22216
21977
  \`\`\`
22217
-
22218
- **VALIDATION BEFORE EXECUTION:**
22219
- - Each commit has <=4 files (or justified)
22220
- - Each commit message matches detected STYLE + LANGUAGE
22221
- - Test files paired with implementation
22222
- - Different directories = different commits (or justified)
22223
- - Total commits >= min_commits
22224
-
22225
- **IF ANY CHECK FAILS, DO NOT PROCEED. REPLAN.**
22226
21978
  </atomic_planning>
22227
21979
 
22228
21980
  ---
22229
21981
 
22230
- ## PHASE 4: Commit Strategy Decision
22231
-
22232
- <strategy_decision>
22233
- ### 4.1 For Each Commit Group, Decide:
22234
-
22235
- \`\`\`
22236
- FIXUP if:
22237
- - Change complements existing commit's intent
22238
- - Same feature, fixing bugs or adding missing parts
22239
- - Review feedback incorporation
22240
- - Target commit exists in local history
22241
-
22242
- NEW COMMIT if:
22243
- - New feature or capability
22244
- - Independent logical unit
22245
- - Different issue/ticket
22246
- - No suitable target commit exists
22247
- \`\`\`
22248
-
22249
- ### 4.2 History Rebuild Decision (Aggressive Option)
22250
-
22251
- \`\`\`
22252
- CONSIDER RESET & REBUILD when:
22253
- - History is messy (many small fixups already)
22254
- - Commits are not atomic (mixed concerns)
22255
- - Dependency order is wrong
22256
-
22257
- RESET WORKFLOW:
22258
- 1. git reset --soft $(git merge-base HEAD main)
22259
- 2. All changes now staged
22260
- 3. Re-commit in proper atomic units
22261
- 4. Clean history from scratch
22262
-
22263
- ONLY IF:
22264
- - All commits are local (not pushed)
22265
- - User explicitly allows OR branch is clearly WIP
22266
- \`\`\`
22267
-
22268
- ### 4.3 Final Plan Summary
22269
-
22270
- \`\`\`yaml
22271
- EXECUTION_PLAN:
22272
- strategy: FIXUP_THEN_NEW | NEW_ONLY | RESET_REBUILD
22273
- fixup_commits:
22274
- - files: [...]
22275
- target: <hash>
22276
- new_commits:
22277
- - files: [...]
22278
- message: "..."
22279
- level: N
22280
- requires_force_push: true | false
22281
- \`\`\`
22282
- </strategy_decision>
22283
-
22284
- ---
22285
-
22286
- ## PHASE 5: Commit Execution
22287
-
22288
- <execution>
22289
- ### 5.1 Register TODO Items
22290
-
22291
- Use TodoWrite to register each commit as a trackable item:
22292
- \`\`\`
22293
- - [ ] Fixup: <description> -> <target-hash>
22294
- - [ ] New: <description>
22295
- - [ ] Rebase autosquash
22296
- - [ ] Final verification
22297
- \`\`\`
22298
-
22299
- ### 5.2 Fixup Commits (If Any)
22300
-
22301
- \`\`\`bash
22302
- # Stage files for each fixup
22303
- git add <files>
22304
- git commit --fixup=<target-hash>
22305
-
22306
- # Repeat for all fixups...
22307
-
22308
- # Single autosquash rebase at the end
22309
- MERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)
22310
- GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE
22311
- \`\`\`
22312
-
22313
- ### 5.3 New Commits (After Fixups)
22314
-
22315
- For each new commit group, in dependency order:
22316
-
22317
- \`\`\`bash
22318
- # Stage files
22319
- git add <file1> <file2> ...
22320
-
22321
- # Verify staging
22322
- git diff --staged --stat
22323
-
22324
- # Commit with detected style
22325
- git commit -m "<message-matching-COMMIT_CONFIG>"
22326
-
22327
- # Verify
22328
- git log -1 --oneline
22329
- \`\`\`
22330
-
22331
- ### 5.4 Commit Message Generation
22332
-
22333
- **Based on COMMIT_CONFIG from Phase 1:**
22334
-
22335
- \`\`\`
22336
- IF style == SEMANTIC AND language == KOREAN:
22337
- -> "feat: \uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00"
22338
-
22339
- IF style == SEMANTIC AND language == ENGLISH:
22340
- -> "feat: add login feature"
22341
-
22342
- IF style == PLAIN AND language == KOREAN:
22343
- -> "\uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00"
22344
-
22345
- IF style == PLAIN AND language == ENGLISH:
22346
- -> "Add login feature"
22347
-
22348
- IF style == SHORT:
22349
- -> "format" / "type fix" / "lint"
22350
- \`\`\`
22351
-
22352
- **VALIDATION before each commit:**
22353
- 1. Does message match detected style?
22354
- 2. Does language match detected language?
22355
- 3. Is it similar to examples from git log?
22356
-
22357
- If ANY check fails -> REWRITE message.
22358
-
22359
- ### 5.5 Commit Footer & Co-Author (Configurable)
22360
-
22361
- **Check oh-my-opencode.json for these flags:**
22362
- - \`git_master.commit_footer\` (default: true) - adds footer message
22363
- - \`git_master.include_co_authored_by\` (default: true) - adds co-author trailer
22364
-
22365
- If enabled, add Sisyphus attribution to EVERY commit:
22366
-
22367
- 1. **Footer in commit body (if \`commit_footer: true\`):**
22368
- \`\`\`
22369
- Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
22370
- \`\`\`
22371
-
22372
- 2. **Co-authored-by trailer (if \`include_co_authored_by: true\`):**
22373
- \`\`\`
22374
- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
22375
- \`\`\`
22376
-
22377
- **Example (both enabled):**
22378
- \`\`\`bash
22379
- git commit -m "{Commit Message}" -m "Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)" -m "Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>"
22380
- \`\`\`
22381
-
22382
- **To disable:** Set in oh-my-opencode.json:
22383
- \`\`\`json
22384
- { "git_master": { "commit_footer": false, "include_co_authored_by": false } }
22385
- \`\`\`
22386
- </execution>
22387
-
22388
- ---
22389
-
22390
- ## PHASE 6: Verification & Cleanup
22391
-
22392
- <verification>
22393
- ### 6.1 Post-Commit Verification
22394
-
22395
- \`\`\`bash
22396
- # Check working directory clean
22397
- git status
22398
-
22399
- # Review new history
22400
- git log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD
22401
-
22402
- # Verify each commit is atomic
22403
- # (mentally check: can each be reverted independently?)
22404
- \`\`\`
22405
-
22406
- ### 6.2 Force Push Decision
22407
-
22408
- \`\`\`
22409
- IF fixup was used AND branch has upstream:
22410
- -> Requires: git push --force-with-lease
22411
- -> WARN user about force push implications
22412
-
22413
- IF only new commits:
22414
- -> Regular: git push
22415
- \`\`\`
22416
-
22417
- ### 6.3 Final Report
21982
+ ## PHASE 4-6: Execution & Verification
22418
21983
 
22419
- \`\`\`
22420
- COMMIT SUMMARY:
22421
- Strategy: <what was done>
22422
- Commits created: N
22423
- Fixups merged: M
22424
-
22425
- HISTORY:
22426
- <hash1> <message1>
22427
- <hash2> <message2>
22428
- ...
22429
-
22430
- NEXT STEPS:
22431
- - git push [--force-with-lease]
22432
- - Create PR if ready
22433
- \`\`\`
22434
- </verification>
22435
-
22436
- ---
21984
+ Execute commits in dependency order, verify each, then final report.
22437
21985
 
22438
21986
  ## Quick Reference
22439
21987
 
22440
- ### Style Detection Cheat Sheet
22441
-
22442
- | If git log shows... | Use this style |
22443
- |---------------------|----------------|
22444
- | \`feat: xxx\`, \`fix: yyy\` | SEMANTIC |
22445
- | \`Add xxx\`, \`Fix yyy\`, \`xxx \uCD94\uAC00\` | PLAIN |
22446
- | \`format\`, \`lint\`, \`typo\` | SHORT |
22447
- | Full sentences | SENTENCE |
22448
- | Mix of above | Use MAJORITY (not semantic by default) |
22449
-
22450
- ### Decision Tree
22451
-
22452
- \`\`\`
22453
- Is this on main/master?
22454
- YES -> NEW_COMMITS_ONLY, never rewrite
22455
- NO -> Continue
22456
-
22457
- Are all commits local (not pushed)?
22458
- YES -> AGGRESSIVE_REWRITE allowed
22459
- NO -> CAREFUL_REWRITE (warn on force push)
22460
-
22461
- Does change complement existing commit?
22462
- YES -> FIXUP to that commit
22463
- NO -> NEW COMMIT
22464
-
22465
- Is history messy?
22466
- YES + all local -> Consider RESET_REBUILD
22467
- NO -> Normal flow
22468
- \`\`\`
22469
-
22470
- ### Anti-Patterns (AUTOMATIC FAILURE)
22471
-
22472
- 1. **NEVER make one giant commit** - 3+ files MUST be 2+ commits
22473
- 2. **NEVER default to semantic commits** - detect from git log first
22474
- 3. **NEVER separate test from implementation** - same commit always
22475
- 4. **NEVER group by file type** - group by feature/module
22476
- 5. **NEVER rewrite pushed history** without explicit permission
22477
- 6. **NEVER leave working directory dirty** - complete all changes
22478
- 7. **NEVER skip JUSTIFICATION** - explain why files are grouped
22479
- 8. **NEVER use vague grouping reasons** - "related to X" is NOT valid
22480
-
22481
- ---
22482
-
22483
- ## FINAL CHECK BEFORE EXECUTION (BLOCKING)
22484
-
22485
- \`\`\`
22486
- STOP AND VERIFY - Do not proceed until ALL boxes checked:
22487
-
22488
- [] File count check: N files -> at least ceil(N/3) commits?
22489
- - 3 files -> min 1 commit
22490
- - 5 files -> min 2 commits
22491
- - 10 files -> min 4 commits
22492
- - 20 files -> min 7 commits
22493
-
22494
- [] Justification check: For each commit with 3+ files, did I write WHY?
22495
-
22496
- [] Directory split check: Different directories -> different commits?
22497
-
22498
- [] Test pairing check: Each test with its implementation?
22499
-
22500
- [] Dependency order check: Foundations before dependents?
22501
- \`\`\`
22502
-
22503
- **HARD STOP CONDITIONS:**
22504
- - Making 1 commit from 3+ files -> **WRONG. SPLIT.**
22505
- - Making 2 commits from 10+ files -> **WRONG. SPLIT MORE.**
22506
- - Can't justify file grouping in one sentence -> **WRONG. SPLIT.**
22507
- - Different directories in same commit (without justification) -> **WRONG. SPLIT.**
22508
-
22509
- ---
22510
- ---
22511
-
22512
- # REBASE MODE (Phase R1-R4)
22513
-
22514
- ## PHASE R1: Rebase Context Analysis
22515
-
22516
- <rebase_context>
22517
- ### R1.1 Parallel Information Gathering
22518
-
22519
- \`\`\`bash
22520
- # Execute ALL in parallel
22521
- git branch --show-current
22522
- git log --oneline -20
22523
- git merge-base HEAD main 2>/dev/null || git merge-base HEAD master
22524
- git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "NO_UPSTREAM"
22525
- git status --porcelain
22526
- git stash list
22527
- \`\`\`
22528
-
22529
- ### R1.2 Safety Assessment
22530
-
22531
- | Condition | Risk Level | Action |
22532
- |-----------|------------|--------|
22533
- | On main/master | CRITICAL | **ABORT** - never rebase main |
22534
- | Dirty working directory | WARNING | Stash first: \`git stash push -m "pre-rebase"\` |
22535
- | Pushed commits exist | WARNING | Will require force-push; confirm with user |
22536
- | All commits local | SAFE | Proceed freely |
22537
- | Upstream diverged | WARNING | May need \`--onto\` strategy |
22538
-
22539
- ### R1.3 Determine Rebase Strategy
22540
-
22541
- \`\`\`
22542
- USER REQUEST -> STRATEGY:
22543
-
22544
- "squash commits" / "cleanup" / "\uC815\uB9AC"
22545
- -> INTERACTIVE_SQUASH
22546
-
22547
- "rebase on main" / "update branch" / "\uBA54\uC778\uC5D0 \uB9AC\uBCA0\uC774\uC2A4"
22548
- -> REBASE_ONTO_BASE
22549
-
22550
- "autosquash" / "apply fixups"
22551
- -> AUTOSQUASH
22552
-
22553
- "reorder commits" / "\uCEE4\uBC0B \uC21C\uC11C"
22554
- -> INTERACTIVE_REORDER
22555
-
22556
- "split commit" / "\uCEE4\uBC0B \uBD84\uB9AC"
22557
- -> INTERACTIVE_EDIT
22558
- \`\`\`
22559
- </rebase_context>
22560
-
22561
- ---
22562
-
22563
- ## PHASE R2: Rebase Execution
22564
-
22565
- <rebase_execution>
22566
- ### R2.1 Interactive Rebase (Squash/Reorder)
22567
-
22568
- \`\`\`bash
22569
- # Find merge-base
22570
- MERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)
22571
-
22572
- # Start interactive rebase
22573
- # NOTE: Cannot use -i interactively. Use GIT_SEQUENCE_EDITOR for automation.
22574
-
22575
- # For SQUASH (combine all into one):
22576
- git reset --soft $MERGE_BASE
22577
- git commit -m "Combined: <summarize all changes>"
22578
-
22579
- # For SELECTIVE SQUASH (keep some, squash others):
22580
- # Use fixup approach - mark commits to squash, then autosquash
22581
- \`\`\`
22582
-
22583
- ### R2.2 Autosquash Workflow
22584
-
22585
- \`\`\`bash
22586
- # When you have fixup! or squash! commits:
22587
- MERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)
22588
- GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE
22589
-
22590
- # The GIT_SEQUENCE_EDITOR=: trick auto-accepts the rebase todo
22591
- # Fixup commits automatically merge into their targets
22592
- \`\`\`
22593
-
22594
- ### R2.3 Rebase Onto (Branch Update)
22595
-
22596
- \`\`\`bash
22597
- # Scenario: Your branch is behind main, need to update
22598
-
22599
- # Simple rebase onto main:
22600
- git fetch origin
22601
- git rebase origin/main
22602
-
22603
- # Complex: Move commits to different base
22604
- # git rebase --onto <newbase> <oldbase> <branch>
22605
- git rebase --onto origin/main $(git merge-base HEAD origin/main) HEAD
22606
- \`\`\`
22607
-
22608
- ### R2.4 Handling Conflicts
22609
-
22610
- \`\`\`
22611
- CONFLICT DETECTED -> WORKFLOW:
22612
-
22613
- 1. Identify conflicting files:
22614
- git status | grep "both modified"
22615
-
22616
- 2. For each conflict:
22617
- - Read the file
22618
- - Understand both versions (HEAD vs incoming)
22619
- - Resolve by editing file
22620
- - Remove conflict markers (<<<<, ====, >>>>)
22621
-
22622
- 3. Stage resolved files:
22623
- git add <resolved-file>
22624
-
22625
- 4. Continue rebase:
22626
- git rebase --continue
22627
-
22628
- 5. If stuck or confused:
22629
- git rebase --abort # Safe rollback
22630
- \`\`\`
22631
-
22632
- ### R2.5 Recovery Procedures
22633
-
22634
- | Situation | Command | Notes |
22635
- |-----------|---------|-------|
22636
- | Rebase going wrong | \`git rebase --abort\` | Returns to pre-rebase state |
22637
- | Need original commits | \`git reflog\` -> \`git reset --hard <hash>\` | Reflog keeps 90 days |
22638
- | Accidentally force-pushed | \`git reflog\` -> coordinate with team | May need to notify others |
22639
- | Lost commits after rebase | \`git fsck --lost-found\` | Nuclear option |
22640
- </rebase_execution>
22641
-
22642
- ---
22643
-
22644
- ## PHASE R3: Post-Rebase Verification
22645
-
22646
- <rebase_verify>
22647
- \`\`\`bash
22648
- # Verify clean state
22649
- git status
22650
-
22651
- # Check new history
22652
- git log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD
22653
-
22654
- # Verify code still works (if tests exist)
22655
- # Run project-specific test command
22656
-
22657
- # Compare with pre-rebase if needed
22658
- git diff ORIG_HEAD..HEAD --stat
22659
- \`\`\`
22660
-
22661
- ### Push Strategy
22662
-
22663
- \`\`\`
22664
- IF branch never pushed:
22665
- -> git push -u origin <branch>
22666
-
22667
- IF branch already pushed:
22668
- -> git push --force-with-lease origin <branch>
22669
- -> ALWAYS use --force-with-lease (not --force)
22670
- -> Prevents overwriting others' work
22671
- \`\`\`
22672
- </rebase_verify>
22673
-
22674
- ---
22675
-
22676
- ## PHASE R4: Rebase Report
22677
-
22678
- \`\`\`
22679
- REBASE SUMMARY:
22680
- Strategy: <SQUASH | AUTOSQUASH | ONTO | REORDER>
22681
- Commits before: N
22682
- Commits after: M
22683
- Conflicts resolved: K
22684
-
22685
- HISTORY (after rebase):
22686
- <hash1> <message1>
22687
- <hash2> <message2>
22688
-
22689
- NEXT STEPS:
22690
- - git push --force-with-lease origin <branch>
22691
- - Review changes before merge
22692
- \`\`\`
22693
-
22694
- ---
22695
- ---
22696
-
22697
- # HISTORY SEARCH MODE (Phase H1-H3)
22698
-
22699
- ## PHASE H1: Determine Search Type
22700
-
22701
- <history_search_type>
22702
- ### H1.1 Parse User Request
22703
-
22704
- | User Request | Search Type | Tool |
22705
- |--------------|-------------|------|
22706
- | "when was X added" / "X\uAC00 \uC5B8\uC81C \uCD94\uAC00\uB410\uC5B4" | PICKAXE | \`git log -S\` |
22707
- | "find commits changing X pattern" | REGEX | \`git log -G\` |
22708
- | "who wrote this line" / "\uC774 \uC904 \uB204\uAC00 \uC37C\uC5B4" | BLAME | \`git blame\` |
22709
- | "when did bug start" / "\uBC84\uADF8 \uC5B8\uC81C \uC0DD\uACBC\uC5B4" | BISECT | \`git bisect\` |
22710
- | "history of file" / "\uD30C\uC77C \uD788\uC2A4\uD1A0\uB9AC" | FILE_LOG | \`git log -- path\` |
22711
- | "find deleted code" / "\uC0AD\uC81C\uB41C \uCF54\uB4DC \uCC3E\uAE30" | PICKAXE_ALL | \`git log -S --all\` |
22712
-
22713
- ### H1.2 Extract Search Parameters
22714
-
22715
- \`\`\`
22716
- From user request, identify:
22717
- - SEARCH_TERM: The string/pattern to find
22718
- - FILE_SCOPE: Specific file(s) or entire repo
22719
- - TIME_RANGE: All time or specific period
22720
- - BRANCH_SCOPE: Current branch or --all branches
22721
- \`\`\`
22722
- </history_search_type>
22723
-
22724
- ---
22725
-
22726
- ## PHASE H2: Execute Search
22727
-
22728
- <history_search_exec>
22729
- ### H2.1 Pickaxe Search (git log -S)
22730
-
22731
- **Purpose**: Find commits that ADD or REMOVE a specific string
22732
-
22733
- \`\`\`bash
22734
- # Basic: Find when string was added/removed
22735
- git log -S "searchString" --oneline
22736
-
22737
- # With context (see the actual changes):
22738
- git log -S "searchString" -p
22739
-
22740
- # In specific file:
22741
- git log -S "searchString" -- path/to/file.py
22742
-
22743
- # Across all branches (find deleted code):
22744
- git log -S "searchString" --all --oneline
22745
-
22746
- # With date range:
22747
- git log -S "searchString" --since="2024-01-01" --oneline
22748
-
22749
- # Case insensitive:
22750
- git log -S "searchstring" -i --oneline
22751
- \`\`\`
22752
-
22753
- **Example Use Cases:**
22754
- \`\`\`bash
22755
- # When was this function added?
22756
- git log -S "def calculate_discount" --oneline
22757
-
22758
- # When was this constant removed?
22759
- git log -S "MAX_RETRY_COUNT" --all --oneline
22760
-
22761
- # Find who introduced a bug pattern
22762
- git log -S "== None" -- "*.py" --oneline # Should be "is None"
22763
- \`\`\`
22764
-
22765
- ### H2.2 Regex Search (git log -G)
22766
-
22767
- **Purpose**: Find commits where diff MATCHES a regex pattern
22768
-
22769
- \`\`\`bash
22770
- # Find commits touching lines matching pattern
22771
- git log -G "pattern.*regex" --oneline
22772
-
22773
- # Find function definition changes
22774
- git log -G "def\\s+my_function" --oneline -p
22775
-
22776
- # Find import changes
22777
- git log -G "^import\\s+requests" -- "*.py" --oneline
22778
-
22779
- # Find TODO additions/removals
22780
- git log -G "TODO|FIXME|HACK" --oneline
22781
- \`\`\`
22782
-
22783
- **-S vs -G Difference:**
22784
- \`\`\`
22785
- -S "foo": Finds commits where COUNT of "foo" changed
22786
- -G "foo": Finds commits where DIFF contains "foo"
22787
-
22788
- Use -S for: "when was X added/removed"
22789
- Use -G for: "what commits touched lines containing X"
22790
- \`\`\`
22791
-
22792
- ### H2.3 Git Blame
22793
-
22794
- **Purpose**: Line-by-line attribution
22795
-
22796
- \`\`\`bash
22797
- # Basic blame
22798
- git blame path/to/file.py
22799
-
22800
- # Specific line range
22801
- git blame -L 10,20 path/to/file.py
22802
-
22803
- # Show original commit (ignoring moves/copies)
22804
- git blame -C path/to/file.py
22805
-
22806
- # Ignore whitespace changes
22807
- git blame -w path/to/file.py
22808
-
22809
- # Show email instead of name
22810
- git blame -e path/to/file.py
22811
-
22812
- # Output format for parsing
22813
- git blame --porcelain path/to/file.py
22814
- \`\`\`
22815
-
22816
- **Reading Blame Output:**
22817
- \`\`\`
22818
- ^abc1234 (Author Name 2024-01-15 10:30:00 +0900 42) code_line_here
22819
- | | | | +-- Line content
22820
- | | | +-- Line number
22821
- | | +-- Timestamp
22822
- | +-- Author
22823
- +-- Commit hash (^ means initial commit)
22824
- \`\`\`
22825
-
22826
- ### H2.4 Git Bisect (Binary Search for Bugs)
22827
-
22828
- **Purpose**: Find exact commit that introduced a bug
22829
-
22830
- \`\`\`bash
22831
- # Start bisect session
22832
- git bisect start
22833
-
22834
- # Mark current (bad) state
22835
- git bisect bad
22836
-
22837
- # Mark known good commit (e.g., last release)
22838
- git bisect good v1.0.0
22839
-
22840
- # Git checkouts middle commit. Test it, then:
22841
- git bisect good # if this commit is OK
22842
- git bisect bad # if this commit has the bug
22843
-
22844
- # Repeat until git finds the culprit commit
22845
- # Git will output: "abc1234 is the first bad commit"
22846
-
22847
- # When done, return to original state
22848
- git bisect reset
22849
- \`\`\`
22850
-
22851
- **Automated Bisect (with test script):**
22852
- \`\`\`bash
22853
- # If you have a test that fails on bug:
22854
- git bisect start
22855
- git bisect bad HEAD
22856
- git bisect good v1.0.0
22857
- git bisect run pytest tests/test_specific.py
22858
-
22859
- # Git runs test on each commit automatically
22860
- # Exits 0 = good, exits 1-127 = bad, exits 125 = skip
22861
- \`\`\`
22862
-
22863
- ### H2.5 File History Tracking
22864
-
22865
- \`\`\`bash
22866
- # Full history of a file
22867
- git log --oneline -- path/to/file.py
22868
-
22869
- # Follow file across renames
22870
- git log --follow --oneline -- path/to/file.py
22871
-
22872
- # Show actual changes
22873
- git log -p -- path/to/file.py
22874
-
22875
- # Files that no longer exist
22876
- git log --all --full-history -- "**/deleted_file.py"
22877
-
22878
- # Who changed file most
22879
- git shortlog -sn -- path/to/file.py
22880
- \`\`\`
22881
- </history_search_exec>
22882
-
22883
- ---
22884
-
22885
- ## PHASE H3: Present Results
22886
-
22887
- <history_results>
22888
- ### H3.1 Format Search Results
22889
-
22890
- \`\`\`
22891
- SEARCH QUERY: "<what user asked>"
22892
- SEARCH TYPE: <PICKAXE | REGEX | BLAME | BISECT | FILE_LOG>
22893
- COMMAND USED: git log -S "..." ...
22894
-
22895
- RESULTS:
22896
- Commit Date Message
22897
- --------- ---------- --------------------------------
22898
- abc1234 2024-06-15 feat: add discount calculation
22899
- def5678 2024-05-20 refactor: extract pricing logic
22900
-
22901
- MOST RELEVANT COMMIT: abc1234
22902
- DETAILS:
22903
- Author: John Doe <john@example.com>
22904
- Date: 2024-06-15
22905
- Files changed: 3
22906
-
22907
- DIFF EXCERPT (if applicable):
22908
- + def calculate_discount(price, rate):
22909
- + return price * (1 - rate)
22910
- \`\`\`
22911
-
22912
- ### H3.2 Provide Actionable Context
22913
-
22914
- Based on search results, offer relevant follow-ups:
22915
-
22916
- \`\`\`
22917
- FOUND THAT commit abc1234 introduced the change.
22918
-
22919
- POTENTIAL ACTIONS:
22920
- - View full commit: git show abc1234
22921
- - Revert this commit: git revert abc1234
22922
- - See related commits: git log --ancestry-path abc1234..HEAD
22923
- - Cherry-pick to another branch: git cherry-pick abc1234
22924
- \`\`\`
22925
- </history_results>
22926
-
22927
- ---
22928
-
22929
- ## Quick Reference: History Search Commands
22930
-
22931
21988
  | Goal | Command |
22932
21989
  |------|---------|
22933
21990
  | When was "X" added? | \`git log -S "X" --oneline\` |
22934
- | When was "X" removed? | \`git log -S "X" --all --oneline\` |
22935
- | What commits touched "X"? | \`git log -G "X" --oneline\` |
22936
21991
  | Who wrote line N? | \`git blame -L N,N file.py\` |
22937
21992
  | When did bug start? | \`git bisect start && git bisect bad && git bisect good <tag>\` |
22938
21993
  | File history | \`git log --follow -- path/file.py\` |
22939
- | Find deleted file | \`git log --all --full-history -- "**/filename"\` |
22940
- | Author stats for file | \`git shortlog -sn -- path/file.py\` |
22941
21994
 
22942
- ---
22943
-
22944
- ## Anti-Patterns (ALL MODES)
21995
+ ## Anti-Patterns
22945
21996
 
22946
- ### Commit Mode
22947
21997
  - One commit for many files -> SPLIT
22948
21998
  - Default to semantic style -> DETECT first
22949
-
22950
- ### Rebase Mode
22951
21999
  - Rebase main/master -> NEVER
22952
- - \`--force\` instead of \`--force-with-lease\` -> DANGEROUS
22953
- - Rebase without stashing dirty files -> WILL FAIL
22954
-
22955
- ### History Search Mode
22956
- - \`-S\` when \`-G\` is appropriate -> Wrong results
22957
- - Blame without \`-C\` on moved code -> Wrong attribution
22958
- - Bisect without proper good/bad boundaries -> Wasted time`
22000
+ - \`--force\` instead of \`--force-with-lease\` -> DANGEROUS`
22959
22001
  };
22960
22002
  function createBuiltinSkills() {
22003
+ const maestroSkills = createMaestroSkills();
22961
22004
  return [
22962
- maestroCoreSkill,
22963
- designingSkill,
22964
22005
  conductorSkill,
22965
- orchestratorSkill,
22966
22006
  trackingSkill,
22967
22007
  playwrightSkill,
22968
22008
  frontendUiUxSkill,
22969
- gitMasterSkill
22009
+ gitMasterSkill,
22010
+ ...maestroSkills
22970
22011
  ];
22971
22012
  }
22972
22013
 
22973
22014
  // src/features/opencode-skill-loader/skill-content.ts
22974
- var MAESTRO_SKILLS = new Set([
22975
- "designing",
22976
- "conductor",
22977
- "orchestrator",
22978
- "tracking"
22979
- ]);
22980
22015
  function resolveMultipleSkills(skillNames) {
22981
22016
  const skills = createBuiltinSkills();
22982
22017
  const skillMap = new Map(skills.map((s) => [s.name, s.template]));
22983
22018
  const resolved = new Map;
22984
22019
  const notFound = [];
22985
- const hasMaestroSkill = skillNames.some((name) => MAESTRO_SKILLS.has(name));
22986
- if (hasMaestroSkill && !skillNames.includes("maestro-core")) {
22987
- const maestroCoreTemplate = skillMap.get("maestro-core");
22988
- if (maestroCoreTemplate) {
22989
- resolved.set("maestro-core", maestroCoreTemplate);
22990
- }
22991
- }
22992
22020
  for (const name of skillNames) {
22993
22021
  const template = skillMap.get(name);
22994
22022
  if (template) {
@@ -23265,8 +22293,9 @@ Return your findings and recommendations. The actual implementation will be hand
23265
22293
 
23266
22294
  // src/hooks/prometheus-md-only/index.ts
23267
22295
  function isAllowedFile(filePath) {
23268
- const hasAllowedExtension = ALLOWED_EXTENSIONS.some((ext) => filePath.endsWith(ext));
23269
- const isInAllowedPath = filePath.includes(ALLOWED_PATH_PREFIX);
22296
+ const normalizedPath = filePath.replace(/\\/g, "/");
22297
+ const hasAllowedExtension = ALLOWED_EXTENSIONS.some((ext) => normalizedPath.endsWith(ext));
22298
+ const isInAllowedPath = normalizedPath.includes(ALLOWED_PATH_PREFIX);
23270
22299
  return hasAllowedExtension && isInAllowedPath;
23271
22300
  }
23272
22301
  function getMessageDir9(sessionID) {
@@ -44701,8 +43730,13 @@ Session ID: ${task.sessionID}
44701
43730
 
44702
43731
  (No assistant response found)`;
44703
43732
  }
44704
- const lastMessage = assistantMessages[assistantMessages.length - 1];
44705
- const textParts = lastMessage?.parts?.filter((p2) => p2.type === "text") ?? [];
43733
+ const sortedMessages = [...assistantMessages].sort((a, b3) => {
43734
+ const timeA = String(a.info?.time ?? "");
43735
+ const timeB = String(b3.info?.time ?? "");
43736
+ return timeB.localeCompare(timeA);
43737
+ });
43738
+ const lastMessage = sortedMessages[0];
43739
+ const textParts = lastMessage.parts?.filter((p2) => p2.type === "text") ?? [];
44706
43740
  const textContent = textParts.map((p2) => p2.text ?? "").filter((text) => text.length > 0).join(`
44707
43741
  `);
44708
43742
  const duration3 = formatDuration(task.startedAt, task.completedAt);
@@ -45738,10 +44772,12 @@ class ConcurrencyManager {
45738
44772
 
45739
44773
  // src/features/background-agent/manager.ts
45740
44774
  var TASK_TTL_MS = 30 * 60 * 1000;
44775
+ var MIN_STABILITY_TIME_MS = 10 * 1000;
45741
44776
 
45742
44777
  class BackgroundManager {
45743
44778
  tasks;
45744
44779
  notifications;
44780
+ pendingNotifications;
45745
44781
  client;
45746
44782
  directory;
45747
44783
  pollingInterval;
@@ -45749,6 +44785,7 @@ class BackgroundManager {
45749
44785
  constructor(ctx, config3) {
45750
44786
  this.tasks = new Map;
45751
44787
  this.notifications = new Map;
44788
+ this.pendingNotifications = new Map;
45752
44789
  this.client = ctx.client;
45753
44790
  this.directory = ctx.directory;
45754
44791
  this.concurrencyManager = new ConcurrencyManager(config3);
@@ -46029,6 +45066,15 @@ class BackgroundManager {
46029
45066
  clearNotifications(sessionID) {
46030
45067
  this.notifications.delete(sessionID);
46031
45068
  }
45069
+ hasPendingNotifications(sessionID) {
45070
+ const pending = this.pendingNotifications.get(sessionID);
45071
+ return pending !== undefined && pending.length > 0;
45072
+ }
45073
+ consumePendingNotifications(sessionID) {
45074
+ const pending = this.pendingNotifications.get(sessionID) ?? [];
45075
+ this.pendingNotifications.delete(sessionID);
45076
+ return pending;
45077
+ }
46032
45078
  clearNotificationsForTask(taskId) {
46033
45079
  for (const [sessionID, tasks] of this.notifications.entries()) {
46034
45080
  const filtered = tasks.filter((t) => t.id !== taskId);
@@ -46057,6 +45103,7 @@ class BackgroundManager {
46057
45103
  this.stopPolling();
46058
45104
  this.tasks.clear();
46059
45105
  this.notifications.clear();
45106
+ this.pendingNotifications.clear();
46060
45107
  }
46061
45108
  notifyParentSession(task) {
46062
45109
  const duration3 = this.formatDuration(task.startedAt, task.completedAt);
@@ -46069,37 +45116,30 @@ class BackgroundManager {
46069
45116
  duration: duration3
46070
45117
  });
46071
45118
  }
46072
- const message = `[BACKGROUND TASK COMPLETED] Task "${task.description}" finished in ${duration3}. Use background_output with task_id="${task.id}" to get results.`;
46073
- log("[background-agent] Sending notification to parent session:", { parentSessionID: task.parentSessionID });
45119
+ const notification = {
45120
+ taskId: task.id,
45121
+ description: task.description,
45122
+ duration: duration3,
45123
+ status: task.status === "error" ? "error" : "completed",
45124
+ error: task.error
45125
+ };
45126
+ const existing = this.pendingNotifications.get(task.parentSessionID) ?? [];
45127
+ existing.push(notification);
45128
+ this.pendingNotifications.set(task.parentSessionID, existing);
45129
+ log("[background-agent] Stored pending notification for parent session:", {
45130
+ parentSessionID: task.parentSessionID,
45131
+ taskId: task.id
45132
+ });
46074
45133
  const taskId = task.id;
46075
- setTimeout(async () => {
45134
+ setTimeout(() => {
46076
45135
  if (task.concurrencyKey) {
46077
45136
  this.concurrencyManager.release(task.concurrencyKey);
45137
+ task.concurrencyKey = undefined;
46078
45138
  }
46079
- try {
46080
- const body = {
46081
- parts: [{ type: "text", text: message }]
46082
- };
46083
- if (task.parentAgent !== undefined) {
46084
- body.agent = task.parentAgent;
46085
- }
46086
- if (task.parentModel?.providerID && task.parentModel?.modelID) {
46087
- body.model = { providerID: task.parentModel.providerID, modelID: task.parentModel.modelID };
46088
- }
46089
- await this.client.session.prompt({
46090
- path: { id: task.parentSessionID },
46091
- body,
46092
- query: { directory: this.directory }
46093
- });
46094
- log("[background-agent] Successfully sent prompt to parent session:", { parentSessionID: task.parentSessionID });
46095
- } catch (error45) {
46096
- log("[background-agent] prompt failed:", String(error45));
46097
- } finally {
46098
- this.clearNotificationsForTask(taskId);
46099
- this.tasks.delete(taskId);
46100
- log("[background-agent] Removed completed task from memory:", taskId);
46101
- }
46102
- }, 200);
45139
+ this.clearNotificationsForTask(taskId);
45140
+ this.tasks.delete(taskId);
45141
+ log("[background-agent] Removed completed task from memory:", taskId);
45142
+ }, 5 * 60 * 1000);
46103
45143
  }
46104
45144
  formatDuration(start, end) {
46105
45145
  const duration3 = (end ?? new Date).getTime() - start.getTime();
@@ -46162,11 +45202,7 @@ class BackgroundManager {
46162
45202
  continue;
46163
45203
  try {
46164
45204
  const sessionStatus = allStatuses[task.sessionID];
46165
- if (!sessionStatus) {
46166
- log("[background-agent] Session not found in status:", task.sessionID);
46167
- continue;
46168
- }
46169
- if (sessionStatus.type === "idle") {
45205
+ if (sessionStatus?.type === "idle") {
46170
45206
  const hasIncompleteTodos2 = await this.checkSessionTodos(task.sessionID);
46171
45207
  if (hasIncompleteTodos2) {
46172
45208
  log("[background-agent] Task has incomplete todos via polling, waiting:", task.id);
@@ -46210,6 +45246,27 @@ class BackgroundManager {
46210
45246
  task.progress.lastMessage = lastMessage;
46211
45247
  task.progress.lastMessageAt = new Date;
46212
45248
  }
45249
+ const currentMsgCount = messages.length;
45250
+ const elapsedMs = Date.now() - task.startedAt.getTime();
45251
+ if (elapsedMs >= MIN_STABILITY_TIME_MS) {
45252
+ if (task.lastMsgCount === currentMsgCount) {
45253
+ task.stablePolls = (task.stablePolls ?? 0) + 1;
45254
+ if (task.stablePolls >= 3) {
45255
+ const hasIncompleteTodos2 = await this.checkSessionTodos(task.sessionID);
45256
+ if (!hasIncompleteTodos2) {
45257
+ task.status = "completed";
45258
+ task.completedAt = new Date;
45259
+ this.markForNotification(task);
45260
+ this.notifyParentSession(task);
45261
+ log("[background-agent] Task completed via stability detection:", task.id);
45262
+ continue;
45263
+ }
45264
+ }
45265
+ } else {
45266
+ task.stablePolls = 0;
45267
+ }
45268
+ }
45269
+ task.lastMsgCount = currentMsgCount;
46213
45270
  }
46214
45271
  } catch (error45) {
46215
45272
  log("[background-agent] Poll error for task:", { taskId: task.id, error: error45 });
@@ -56588,6 +55645,7 @@ var OhMyOpenCodePlugin = async (ctx) => {
56588
55645
  await editErrorRecovery?.["tool.execute.after"](input, output);
56589
55646
  await sisyphusOrchestrator?.["tool.execute.after"]?.(input, output);
56590
55647
  await taskResumeInfo["tool.execute.after"](input, output);
55648
+ await backgroundNotificationHook?.["tool.execute.after"]?.(input, output);
56591
55649
  }
56592
55650
  };
56593
55651
  };