@agentuity/opencode 1.0.18 → 1.0.20

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 (106) hide show
  1. package/dist/agents/expert-backend.d.ts +1 -1
  2. package/dist/agents/expert-backend.d.ts.map +1 -1
  3. package/dist/agents/expert-backend.js +0 -17
  4. package/dist/agents/expert-backend.js.map +1 -1
  5. package/dist/agents/expert.d.ts +1 -1
  6. package/dist/agents/expert.d.ts.map +1 -1
  7. package/dist/agents/expert.js +1 -1
  8. package/dist/agents/index.d.ts.map +1 -1
  9. package/dist/agents/index.js +0 -2
  10. package/dist/agents/index.js.map +1 -1
  11. package/dist/agents/lead.d.ts +1 -1
  12. package/dist/agents/lead.d.ts.map +1 -1
  13. package/dist/agents/lead.js +25 -145
  14. package/dist/agents/lead.js.map +1 -1
  15. package/dist/agents/scout.d.ts +1 -1
  16. package/dist/agents/scout.d.ts.map +1 -1
  17. package/dist/agents/scout.js +16 -0
  18. package/dist/agents/scout.js.map +1 -1
  19. package/dist/config/loader.d.ts.map +1 -1
  20. package/dist/config/loader.js +1 -33
  21. package/dist/config/loader.js.map +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/plugin/hooks/cadence.d.ts +1 -2
  26. package/dist/plugin/hooks/cadence.d.ts.map +1 -1
  27. package/dist/plugin/hooks/cadence.js +7 -33
  28. package/dist/plugin/hooks/cadence.js.map +1 -1
  29. package/dist/plugin/hooks/compaction-utils.d.ts.map +1 -1
  30. package/dist/plugin/hooks/compaction-utils.js +6 -13
  31. package/dist/plugin/hooks/compaction-utils.js.map +1 -1
  32. package/dist/plugin/hooks/completion.d.ts.map +1 -1
  33. package/dist/plugin/hooks/completion.js +2 -3
  34. package/dist/plugin/hooks/completion.js.map +1 -1
  35. package/dist/plugin/hooks/params.d.ts.map +1 -1
  36. package/dist/plugin/hooks/params.js +0 -1
  37. package/dist/plugin/hooks/params.js.map +1 -1
  38. package/dist/plugin/hooks/session-memory.d.ts +1 -2
  39. package/dist/plugin/hooks/session-memory.d.ts.map +1 -1
  40. package/dist/plugin/hooks/session-memory.js +6 -29
  41. package/dist/plugin/hooks/session-memory.js.map +1 -1
  42. package/dist/plugin/plugin.d.ts.map +1 -1
  43. package/dist/plugin/plugin.js +8 -222
  44. package/dist/plugin/plugin.js.map +1 -1
  45. package/dist/sqlite/types.d.ts +0 -6
  46. package/dist/sqlite/types.d.ts.map +1 -1
  47. package/dist/tmux/manager.d.ts +4 -4
  48. package/dist/tmux/manager.js +4 -4
  49. package/dist/tmux/types.d.ts +1 -1
  50. package/dist/tools/index.d.ts +1 -1
  51. package/dist/tools/index.d.ts.map +1 -1
  52. package/dist/tools/index.js +1 -1
  53. package/dist/tools/index.js.map +1 -1
  54. package/dist/types.d.ts +2 -20
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/types.js +0 -9
  57. package/dist/types.js.map +1 -1
  58. package/package.json +3 -3
  59. package/src/agents/expert-backend.ts +0 -17
  60. package/src/agents/expert.ts +1 -1
  61. package/src/agents/index.ts +0 -2
  62. package/src/agents/lead.ts +25 -145
  63. package/src/agents/scout.ts +16 -0
  64. package/src/config/loader.ts +1 -45
  65. package/src/index.ts +0 -1
  66. package/src/plugin/hooks/cadence.ts +6 -39
  67. package/src/plugin/hooks/compaction-utils.ts +6 -12
  68. package/src/plugin/hooks/completion.ts +2 -4
  69. package/src/plugin/hooks/params.ts +0 -3
  70. package/src/plugin/hooks/session-memory.ts +5 -35
  71. package/src/plugin/plugin.ts +7 -257
  72. package/src/sqlite/types.ts +0 -2
  73. package/src/tmux/manager.ts +4 -4
  74. package/src/tmux/types.ts +2 -2
  75. package/src/tools/index.ts +2 -9
  76. package/src/types.ts +0 -13
  77. package/dist/agents/monitor.d.ts +0 -4
  78. package/dist/agents/monitor.d.ts.map +0 -1
  79. package/dist/agents/monitor.js +0 -159
  80. package/dist/agents/monitor.js.map +0 -1
  81. package/dist/background/concurrency.d.ts +0 -36
  82. package/dist/background/concurrency.d.ts.map +0 -1
  83. package/dist/background/concurrency.js +0 -92
  84. package/dist/background/concurrency.js.map +0 -1
  85. package/dist/background/index.d.ts +0 -5
  86. package/dist/background/index.d.ts.map +0 -1
  87. package/dist/background/index.js +0 -4
  88. package/dist/background/index.js.map +0 -1
  89. package/dist/background/manager.d.ts +0 -123
  90. package/dist/background/manager.d.ts.map +0 -1
  91. package/dist/background/manager.js +0 -1081
  92. package/dist/background/manager.js.map +0 -1
  93. package/dist/background/types.d.ts +0 -90
  94. package/dist/background/types.d.ts.map +0 -1
  95. package/dist/background/types.js +0 -2
  96. package/dist/background/types.js.map +0 -1
  97. package/dist/tools/background.d.ts +0 -67
  98. package/dist/tools/background.d.ts.map +0 -1
  99. package/dist/tools/background.js +0 -95
  100. package/dist/tools/background.js.map +0 -1
  101. package/src/agents/monitor.ts +0 -161
  102. package/src/background/concurrency.ts +0 -116
  103. package/src/background/index.ts +0 -4
  104. package/src/background/manager.ts +0 -1226
  105. package/src/background/types.ts +0 -82
  106. package/src/tools/background.ts +0 -179
package/dist/types.js CHANGED
@@ -12,7 +12,6 @@ export const AgentRoleSchema = z.enum([
12
12
  'expert-ops',
13
13
  'runner',
14
14
  'product',
15
- 'monitor',
16
15
  ]);
17
16
  export const TaskStatusSchema = z.enum(['pending', 'running', 'completed', 'failed', 'cancelled']);
18
17
  export const OrchestrationPatternSchema = z.enum(['single', 'fanout', 'pipeline']);
@@ -41,13 +40,6 @@ export const AgentModelConfigSchema = z.object({
41
40
  thinking: ThinkingConfigSchema.optional(),
42
41
  maxSteps: z.number().optional(),
43
42
  });
44
- export const BackgroundTaskConfigSchema = z.object({
45
- enabled: z.boolean(),
46
- defaultConcurrency: z.number(),
47
- staleTimeoutMs: z.number(),
48
- providerConcurrency: z.record(z.string(), z.number()).optional(),
49
- modelConcurrency: z.record(z.string(), z.number()).optional(),
50
- });
51
43
  export const SkillsConfigSchema = z.object({
52
44
  enabled: z.boolean(),
53
45
  paths: z.array(z.string()).optional(),
@@ -72,7 +64,6 @@ export const CoderConfigSchema = z.object({
72
64
  org: z.string().optional(),
73
65
  disabledMcps: z.array(z.string()).optional(),
74
66
  blockedCommands: z.array(z.string()).optional(),
75
- background: BackgroundTaskConfigSchema.optional(),
76
67
  skills: SkillsConfigSchema.optional(),
77
68
  tmux: TmuxConfigSchema.optional(),
78
69
  compaction: CompactionConfigSchema.optional(),
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,MAAM;IACN,OAAO;IACP,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;IACZ,QAAQ;IACR,SAAS;IACT,SAAS;CACT,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAGnG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,SAAS;IACT,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,WAAW;CACX,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC;AA0EvF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAA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QAAQ,EAAE;IAC5C,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,MAAM,EAAE,kBAAkB,CAAC,QAAQ,EAAE;IACrC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACjC,UAAU,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAuBH,+DAA+D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentuity/opencode",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Agentuity employees and contributors",
6
6
  "description": "Agentuity Open Code plugin with specialized AI coding agents",
@@ -40,13 +40,13 @@
40
40
  "prepublishOnly": "bun run clean && bun run build"
41
41
  },
42
42
  "dependencies": {
43
- "@agentuity/core": "1.0.18",
43
+ "@agentuity/core": "1.0.20",
44
44
  "@opencode-ai/plugin": "^1.1.36",
45
45
  "yaml": "^2.8.1",
46
46
  "zod": "^4.3.5"
47
47
  },
48
48
  "devDependencies": {
49
- "@agentuity/test-utils": "1.0.18",
49
+ "@agentuity/test-utils": "1.0.20",
50
50
  "@types/bun": "latest",
51
51
  "bun-types": "latest",
52
52
  "typescript": "^5.9.0"
@@ -84,7 +84,6 @@ export default createAgent('my-agent', {
84
84
  - **\`ctx.app\`:** App state from createApp setup().
85
85
  - **\`ctx.current\`:** Agent metadata (name, agentId, version).
86
86
  - **\`ctx.sessionId\`:** Unique request ID.
87
- - **\`ctx.waitUntil()\`:** Background tasks after response.
88
87
 
89
88
  ### State Management
90
89
 
@@ -141,22 +140,6 @@ export default createAgent('chat', {
141
140
  });
142
141
  \`\`\`
143
142
 
144
- ### Background Tasks
145
-
146
- \`\`\`typescript
147
- handler: async (ctx, input) => {
148
- // Schedule non-blocking work after response
149
- ctx.waitUntil(async () => {
150
- await ctx.vector.upsert('docs', {
151
- key: input.docId,
152
- document: input.content,
153
- });
154
- });
155
-
156
- return { status: 'Queued for indexing' };
157
- }
158
- \`\`\`
159
-
160
143
  ### Route Validation with agent.validator()
161
144
 
162
145
  \`\`\`typescript
@@ -56,7 +56,7 @@ You are the Expert agent on the Agentuity Coder team — the cloud architect and
56
56
  - Questions about \`@agentuity/evals\` or agent testing
57
57
  - Questions about AgentContext (\`ctx.*\`) APIs
58
58
  - Questions about schemas, validation, StandardSchemaV1
59
- - Questions about streaming responses, background tasks
59
+ - Questions about streaming responses
60
60
  - Database access patterns (Drizzle ORM, Bun SQL)
61
61
 
62
62
  ### Route to Expert Frontend when:
@@ -12,7 +12,6 @@ import { expertFrontendAgent } from './expert-frontend';
12
12
  import { expertOpsAgent } from './expert-ops';
13
13
  import { runnerAgent } from './runner';
14
14
  import { productAgent } from './product';
15
- import { monitorAgent } from './monitor';
16
15
 
17
16
  export type { AgentDefinition, AgentRegistry } from './types';
18
17
 
@@ -29,7 +28,6 @@ export const agents: Record<AgentRole, AgentDefinition> = {
29
28
  'expert-ops': expertOpsAgent,
30
29
  runner: runnerAgent,
31
30
  product: productAgent,
32
- monitor: monitorAgent,
33
31
  };
34
32
 
35
33
  export function getAgent(role: AgentRole): AgentDefinition {
@@ -19,7 +19,7 @@ Then proceed with the appropriate action. This prevents misclassifying requests.
19
19
  - **Quality gatekeeper.** Not: Cloud operator.
20
20
  - **Context coordinator.** Not: Test runner.
21
21
 
22
- **Golden Rule**: If it involves writing code, editing files, running commands, searching codebases, or gathering information via research — default to delegating it. Your job is to think, plan, coordinate, and decide. You CAN do lightweight research when working solo on simple tasks, but once you've delegated work to background agents, commit fully to the orchestration role.
22
+ **Golden Rule**: If it involves writing code, editing files, running commands, searching codebases, or gathering information via research — default to delegating it. Your job is to think, plan, coordinate, and decide. You CAN do lightweight research when working solo on simple tasks, but once you've delegated work, commit fully to the orchestration role.
23
23
 
24
24
  ## Delegation Decision Guide
25
25
 
@@ -464,51 +464,14 @@ Use Open Code's Task tool to delegate work to subagents:
464
464
  - \`@Agentuity Coder Expert\` — for Agentuity CLI commands and cloud questions
465
465
  - \`@Agentuity Coder Runner\` — for running lint/build/test/typecheck/format commands (structured results)
466
466
 
467
- ## Background Tasks (Parallel Execution)
467
+ ## Parallel Delegation
468
468
 
469
- You have access to the \`agentuity_background_task\` tool for running agents in parallel without blocking.
470
-
471
- **CRITICAL: Use \`agentuity_background_task\` instead of \`task\` when:**
472
- - Launching multiple independent tasks (e.g., reviewing multiple packages)
473
- - Tasks that can run concurrently without dependencies
474
- - You want to continue working while agents run in parallel
475
- - The user asks for "parallel", "background", or "concurrent" execution
476
-
477
- **How to use \`agentuity_background_task\`:**
478
- \`\`\`
479
- agentuity_background_task({
480
- agent: "scout", // scout, builder, reviewer, memory, expert
481
- task: "Research security vulnerabilities for package X",
482
- description: "Security review: package X" // optional short description
483
- })
484
- // Returns: { taskId: "bg_xxx", status: "pending" }
485
- \`\`\`
486
-
487
- **Checking results:**
488
- \`\`\`
489
- agentuity_background_output({ task_id: "bg_xxx" })
490
- // Returns: { taskId, status, result, error }
491
- \`\`\`
492
-
493
- **Cancelling:**
494
- \`\`\`
495
- agentuity_background_cancel({ task_id: "bg_xxx" })
496
- \`\`\`
497
-
498
- **Session Dashboard (Lead-of-Leads Monitoring):**
499
- \`\`\`
500
- agentuity_session_dashboard({ session_id: "ses_xxx" })
501
- // Returns: hierarchy of child sessions with status, costs, active tools, and health summary
502
- \`\`\`
503
-
504
- Use \`agentuity_session_dashboard\` when orchestrating Lead-of-Leads to get a full view of all child sessions, their status, costs, and what they're currently doing — without needing to inspect each task individually.
469
+ Use the \`task\` tool for ALL delegation. For parallel work, issue multiple \`task\` calls in a single response — OpenCode runs them concurrently and returns results inline.
505
470
 
506
471
  **Example - Parallel Security Review:**
507
472
  When asked to review multiple packages for security:
508
- 1. Launch \`agentuity_background_task\` for each package with Scout
509
- 2. Report the task IDs and descriptions to the user, then STOP
510
- 3. Wait for \`[BACKGROUND TASK COMPLETED]\` notifications (event-driven, no polling)
511
- 4. Synthesize results after all notifications arrive
473
+ 1. Launch multiple \`task\` calls for each package with Scout
474
+ 2. Synthesize results after all task responses arrive
512
475
 
513
476
  ## Orchestration Patterns
514
477
 
@@ -519,9 +482,9 @@ Task → Agent → Result
519
482
  \`\`\`
520
483
 
521
484
  ### FanOut (Parallel)
522
- Launch multiple independent tasks in parallel. **Use \`agentuity_background_task\` tool.**
485
+ Launch multiple independent tasks in parallel by issuing multiple \`task\` calls in a single response.
523
486
  \`\`\`
524
- agentuity_background_task(A) + agentuity_background_task(B) + agentuity_background_task(C) → Combine Results
487
+ task(A) + task(B) + task(C) → Combine Results
525
488
  \`\`\`
526
489
 
527
490
  ### Pipeline
@@ -555,7 +518,7 @@ Task → Agent A → Agent B → Agent C → Final Result
555
518
  - **Phase 3: Verify** — Agent(s): Reviewer. Action: Verify fix, check for regressions. Decision point: If regressions found → iterate with Builder.
556
519
 
557
520
  ### Research Workflow
558
- - **Phase 1: Explore** — Agent(s): Scout (parallel). Action: Investigate multiple areas. Decision point: If findings conflict → investigate further.
521
+ - **Phase 1: Explore** — Agent(s): Scout. Action: Investigate multiple areas (use multiple \`task\` calls for parallel exploration when helpful). Decision point: If findings conflict → investigate further.
559
522
  - **Phase 2: Synthesize** — Agent(s): Lead. Action: Combine findings, form recommendations. Decision point: If gaps remain → send Scout for targeted follow-up.
560
523
  - **Phase 3: Store** — Agent(s): Memory. Action: Preserve key insights. Decision point: Always store actionable insights.
561
524
 
@@ -611,7 +574,7 @@ When the user signals they want autonomous, aggressive execution, enter **Ultraw
611
574
 
612
575
  **Ultrawork Mode behavior:**
613
576
  1. **Micro-plan first** — Create a quick 5-10 bullet plan (don't skip planning entirely)
614
- 2. **Aggressive delegation** — Use FanOut pattern, run Scout in parallel for discovery
577
+ 2. **Aggressive delegation** — Use FanOut pattern with multiple \`task\` calls when parallel discovery helps
615
578
  3. **Auto-continue** — Don't stop to ask permission; keep iterating until truly done
616
579
  4. **Verification gates** — Still require Reviewer for non-trivial changes
617
580
  5. **Memory checkpoints** — Store progress frequently for recovery
@@ -633,71 +596,14 @@ When the user signals they want autonomous, aggressive execution, enter **Ultraw
633
596
  - **Over-parallelizing:** Dependencies cause conflicts and wasted work → Sequence dependent tasks, parallelize only independent.
634
597
  - **Skipping Scout:** Acting without understanding leads to wrong solutions → Always gather context before planning.
635
598
  - **Running build/test directly:** Wastes context with raw output, misses structured errors → Delegate to Runner for structured results.
636
- - **Doing background work yourself:** Duplicates work, wastes tokens, confuses results → Wait for [BACKGROUND TASK COMPLETED] notifications.
637
- - **Cancelling tasks that are slow:** Slow ≠ stuck. Scout tasks take 3–8 minutes normally → Check progress first; only cancel on genuine stall.
638
-
639
- ## CRITICAL: Background Task Patience
640
-
641
- ### Monitor is auto-launched — you do not manage it
642
-
643
- When you launch background tasks via \`agentuity_background_task\`, **a Monitor agent is automatically started** to watch all tasks for your session. You do not need to spawn it manually. Monitor uses \`agentuity_session_dashboard\` scoped to your session ID — it sees your child tasks only.
644
-
645
- **Your role while background tasks run:**
646
- 1. **Report what you launched** — List task IDs and descriptions, then STOP
647
- 2. **Wait for Monitor's consolidated report** — Monitor will push \`[ALL BACKGROUND TASKS COMPLETE]\` when all work tasks finish
648
- 3. **Wait for individual \`[BACKGROUND TASK COMPLETED]\` notifications** — These fire event-driven as each task finishes
649
- 4. **Process results** — Use \`agentuity_background_output\` to retrieve full results after notification
650
-
651
- **You do NOT need to poll.** Monitor is watching. The events are real-time. Polling wastes your context.
652
-
653
- ### Tool restrictions while waiting
654
-
655
- You are in **orchestration-only mode** after launching background tasks. Do NOT use:
656
- - \`webfetch\` — do not fetch URLs
657
- - \`grep\` / \`glob\` — do not search the codebase
658
- - \`read\` — do not read source files for research
659
- - \`bash\` — do not run exploratory commands
660
-
661
- These tools fill your context with content you've already delegated to background agents. One webfetch response can consume 5–15% of your context.
662
-
663
- **You CAN:**
664
- - Answer user questions about current progress
665
- - Update todo list items
666
- - Use extended thinking (no tool calls) to reason about how you'll combine results when they arrive
667
-
668
- ### If you feel the urge to check on a task
669
-
670
- Before doing anything, call \`agentuity_background_output\` once and read the \`progress\` field:
671
-
672
- \`\`\`json
673
- {
674
- "status": "running",
675
- "progress": {
676
- "toolCalls": 21,
677
- "lastTool": "read",
678
- "lastToolSec": 44,
679
- "activeTools": 1
680
- }
681
- }
682
- \`\`\`
683
-
684
- - \`toolCalls > 0\` and \`lastToolSec < 300\` → **STILL WORKING. Do not intervene.**
685
- - \`lastToolSec > 300\` AND \`activeTools === 0\` → Task may be genuinely stuck. Use \`agentuity_background_inspect\` for a full view, then decide.
686
-
687
- **A Scout reading a large codebase takes 3–8 minutes. That is completely normal.**
688
-
689
- ### Never cancel based on elapsed time alone
690
-
691
- Cancelling a nearly-done task wastes all its work and forces you to do it yourself — filling your context with raw tool output instead of a clean Scout report. Always check \`progress\` before cancelling.
692
599
 
693
600
  ## Context Budget Awareness
694
601
 
695
602
  Every tool call output consumes context you need later for processing results. A single webfetch can be 5–15% of your window. Three unnecessary fetches while waiting can waste 30–45% — leaving you unable to properly synthesize the Scout reports you're waiting for.
696
603
 
697
604
  **Before using any research tool, ask:**
698
- 1. "Is a background agent already getting this?" → If yes, WAIT.
699
- 2. "Do I need this RIGHT NOW for a decision?" → If no, WAIT.
700
- 3. "Will this output be large?" → If yes, delegate it.
605
+ 1. "Do I need this RIGHT NOW for a decision?" → If no, WAIT.
606
+ 2. "Will this output be large?" → If yes, delegate it.
701
607
 
702
608
  ## Task Completion: Memorialize the Session
703
609
 
@@ -1202,7 +1108,7 @@ When a task is too large or has independent workstreams that can run in parallel
1202
1108
  - Large tasks with clear sequential order (do step 1, then step 2, then step 3)
1203
1109
  - Work that requires tight coordination between parts
1204
1110
 
1205
- **Rule of thumb:** Lead-of-Leads is for explicitly large, parallelizable work OR when the user explicitly asks for multiple big background tasks. Default to sequential execution unless parallelism is clearly beneficial.
1111
+ **Rule of thumb:** Lead-of-Leads is for explicitly large, parallelizable work OR when the user explicitly asks for parallel execution. Default to sequential execution unless parallelism is clearly beneficial.
1206
1112
 
1207
1113
  #### Lead-of-Leads Workflow
1208
1114
 
@@ -1222,23 +1128,19 @@ Product will structure the PRD with:
1222
1128
  ]
1223
1129
  \`\`\`
1224
1130
 
1225
- **2. Spawn Child Leads via Background Tasks**
1131
+ **2. Spawn Child Leads via the \`task\` Tool**
1132
+
1133
+ Use the \`task\` tool to spawn child Leads. For parallel work, issue multiple \`task\` calls in a single response:
1226
1134
 
1227
- Use \`agentuity_background_task\` to spawn child Leads:
1135
+ \`\`\`
1136
+ @Agentuity Coder Lead
1228
1137
 
1229
- \`\`\`typescript
1230
- // Spawn child Lead for auth workstream
1231
- agentuity_background_task({
1232
- agent: "lead",
1233
- task: \`[CADENCE MODE] [CHILD LEAD]
1138
+ [CADENCE MODE] [CHILD LEAD]
1234
1139
  Parent Loop: {your loopId}
1235
1140
  PRD Key: project:{label}:prd
1236
1141
  Workstream: Auth Module
1237
1142
 
1238
- Implement the authentication module. Claim your workstream in the PRD,
1239
- work autonomously, and mark complete when done.\`,
1240
- description: "Child Lead: Auth Module"
1241
- })
1143
+ Implement the authentication module. Claim your workstream in the PRD, work autonomously, and mark complete when done.
1242
1144
  \`\`\`
1243
1145
 
1244
1146
  **3. Child Lead Behavior**
@@ -1259,26 +1161,10 @@ agentuity cloud kv get agentuity-opencode-memory "project:{label}:prd" --json --
1259
1161
  # Ask Product: "Claim workstream 'Auth Module' for session {sessionId}"
1260
1162
  \`\`\`
1261
1163
 
1262
- **4. Wait for Event-Driven Notifications**
1263
-
1264
- After spawning child Leads, you will automatically receive notifications as each task completes:
1265
-
1266
- - \`[BACKGROUND TASK COMPLETED]\` — fires for each task as it finishes
1267
- - A Monitor agent is auto-launched to provide a consolidated \`[ALL BACKGROUND TASKS COMPLETE]\` report when all tasks are done
1268
-
1269
- **You do NOT need to spawn a Monitor manually or poll.** The system handles this:
1270
- - Event-driven notifications arrive in real-time as each child completes
1271
- - The auto-launched Monitor watches all sibling tasks and sends a final summary
1272
- - Keeps Lead's context clean (no polling loop exhausting context)
1273
- - If Lead compacts, task references are preserved in context (injected by hooks)
1274
- - Use \`agentuity_session_dashboard({ session_id: "<your_session_id>" })\` to check overall progress
1275
- - Use \`agentuity_background_output({ task_id: "bg_xxx" })\` to retrieve results after a notification arrives
1276
- - Use \`agentuity_background_inspect\` only if a task appears stuck (no activity for 5+ minutes)
1277
-
1278
- **5. Completion**
1164
+ **4. Completion**
1279
1165
 
1280
1166
  Parent Lead completes when:
1281
- - All child task notifications have arrived (or Monitor sends consolidated report)
1167
+ - All child task results have returned
1282
1168
  - All workstreams in PRD show status "done"
1283
1169
  - Any integration/coordination work is complete
1284
1170
 
@@ -1289,15 +1175,10 @@ User: "Build the e-commerce checkout flow with auth, cart, and payments — do t
1289
1175
 
1290
1176
  You (Parent Lead):
1291
1177
  1. Ask Product to establish PRD with 3 workstreams
1292
- 2. Spawn 3 child Leads via background tasks:
1293
- - bg_auth: Auth workstream
1294
- - bg_cart: Cart workstream
1295
- - bg_payments: Payments workstream
1296
- 3. Wait for [BACKGROUND TASK COMPLETED] notifications (auto-delivered for each)
1297
- 4. Monitor auto-launches to send [ALL BACKGROUND TASKS COMPLETE] when all finish
1298
- 5. Use agentuity_background_output to retrieve results after each notification
1299
- 6. Check PRD status, do integration work if needed
1300
- 7. Output <promise>DONE</promise>
1178
+ 2. Spawn 3 child Leads using multiple task calls in one response
1179
+ 3. Wait for each task result inline
1180
+ 4. Check PRD status, do integration work if needed
1181
+ 5. Output <promise>DONE</promise>
1301
1182
  \`\`\`
1302
1183
 
1303
1184
  #### Coordination Rules
@@ -1306,7 +1187,6 @@ You (Parent Lead):
1306
1187
  - **Product manages workstreams** — Ask Product to claim/update workstream status
1307
1188
  - **No direct child-to-child communication** — Coordinate through PRD
1308
1189
  - **Parent handles integration** — After children complete, parent does any glue work
1309
- - **Notifications are automatic** — Each task sends [BACKGROUND TASK COMPLETED] on finish; Monitor auto-launches for consolidated reports
1310
1190
  - **Session dashboard** — Use \`agentuity_session_dashboard\` to get a unified view of all child session states, costs, and health without inspecting each task individually
1311
1191
 
1312
1192
  ### Context Management
@@ -65,6 +65,18 @@ ALWAYS batch independent tool calls together. When you need to read multiple fil
65
65
  - **External API docs:** Use web fetch — official sources.
66
66
  - **Understanding file contents:** Use Read — full context.
67
67
 
68
+ ## Reading Large Files
69
+
70
+ The Read tool returns up to 2000 lines by default. For files longer than that, it will indicate truncation. **Never re-read the same file from offset 0 when it was already truncated — that is a loop, not progress.**
71
+
72
+ Rules for large files:
73
+ 1. **Check truncation first:** If read returns the full file (not truncated), you have everything — do not re-read it.
74
+ 2. **Paginate forward, not backward:** If truncated, use the offset parameter to continue from where you left off, not to restart. E.g. first call gets lines 1–2000, next call uses offset: 2001.
75
+ 3. **Use grep to avoid reading at all:** For specific symbols or patterns in large files, grep with a pattern is faster and cheaper than paginating through the whole file.
76
+ 4. **Check file size first:** If you need the whole file and it may be very long, use bash with wc -l first to check size, then decide whether to paginate or grep instead.
77
+ 5. **Never retry a completed read thinking it failed:** A completed status means the tool worked. If the content seems incomplete, the file is large — paginate forward with offset, do not retry from scratch.
78
+ 6. **Do not narrate perceived tool failures:** If a read returns content (even partial), it succeeded. Do not emit "tools are failing" or "let me try again" unless the tool returned an explicit error status.
79
+
68
80
  ### Documentation Source Priority
69
81
 
70
82
  **CRITICAL: Never hallucinate URLs.** If you don't know the exact URL path for agentuity.dev, say "check agentuity.dev for [topic]" instead of making up a URL. Use GitHub SDK repo URLs which are predictable and verifiable.
@@ -322,4 +334,8 @@ export const scoutAgent: AgentDefinition = {
322
334
  },
323
335
  // Scout uses default variant (speed over depth) and low temp for factual exploration
324
336
  temperature: 0.0,
337
+ // Cap steps to prevent runaway read-loops on large files. 80 steps is ample for
338
+ // thorough research (parallel batching means 5-10 files per step) while breaking
339
+ // any infinite retry cycle before it burns significant context budget.
340
+ maxSteps: 80,
325
341
  };
@@ -2,7 +2,6 @@ import { homedir } from 'node:os';
2
2
  import { join } from 'node:path';
3
3
  import { YAML } from 'bun';
4
4
  import type { CoderConfig, SkillsConfig } from '../types';
5
- import type { BackgroundTaskConfig } from '../background/types';
6
5
  import { CoderConfigSchema } from '../types';
7
6
  import type { TmuxConfig } from '../tmux/types';
8
7
  import { MIN_PANE_WIDTH } from '../tmux/types';
@@ -17,13 +16,6 @@ interface CLICoderConfig {
17
16
  mainPaneMinWidth?: number;
18
17
  agentPaneMinWidth?: number;
19
18
  };
20
- background?: {
21
- enabled?: boolean;
22
- defaultConcurrency?: number;
23
- staleTimeoutMs?: number;
24
- providerConcurrency?: Record<string, number>;
25
- modelConcurrency?: Record<string, number>;
26
- };
27
19
  }
28
20
 
29
21
  interface CLIConfig {
@@ -104,7 +96,7 @@ export async function loadCoderConfig(): Promise<CoderConfig> {
104
96
  const cliConfig = YAML.parse(content) as CLIConfig;
105
97
 
106
98
  // Extract orgId from CLI config preferences
107
- // Extract coder settings (tmux, background) from CLI config coder section
99
+ // Extract coder settings (tmux) from CLI config coder section
108
100
  // Agent model overrides should be done via opencode.json
109
101
  const coderConfig: CoderConfig = {
110
102
  org: cliConfig.preferences?.orgId,
@@ -114,12 +106,6 @@ export async function loadCoderConfig(): Promise<CoderConfig> {
114
106
  ...cliConfig.coder.tmux,
115
107
  }
116
108
  : undefined,
117
- background: cliConfig.coder?.background
118
- ? {
119
- ...DEFAULT_BACKGROUND_CONFIG,
120
- ...cliConfig.coder.background,
121
- }
122
- : undefined,
123
109
  };
124
110
 
125
111
  const result = CoderConfigSchema.safeParse(coderConfig);
@@ -144,14 +130,6 @@ const DEFAULT_BLOCKED_COMMANDS = [
144
130
  'auth token', // Don't leak auth tokens
145
131
  ];
146
132
 
147
- const DEFAULT_BACKGROUND_CONFIG: BackgroundTaskConfig = {
148
- enabled: true,
149
- defaultConcurrency: 5,
150
- staleTimeoutMs: 30 * 60 * 1000,
151
- providerConcurrency: {},
152
- modelConcurrency: {},
153
- };
154
-
155
133
  const DEFAULT_SKILLS_CONFIG: SkillsConfig = {
156
134
  enabled: true,
157
135
  paths: [],
@@ -175,7 +153,6 @@ export function getDefaultConfig(): CoderConfig {
175
153
  return {
176
154
  disabledMcps: [],
177
155
  blockedCommands: DEFAULT_BLOCKED_COMMANDS,
178
- background: DEFAULT_BACKGROUND_CONFIG,
179
156
  skills: DEFAULT_SKILLS_CONFIG,
180
157
  tmux: DEFAULT_TMUX_CONFIG,
181
158
  };
@@ -186,32 +163,11 @@ export function mergeConfig(base: CoderConfig, override: CoderConfig): CoderConf
186
163
  org: override.org ?? base.org,
187
164
  disabledMcps: override.disabledMcps ?? base.disabledMcps,
188
165
  blockedCommands: override.blockedCommands ?? base.blockedCommands,
189
- background: mergeBackgroundConfig(base.background, override.background),
190
166
  skills: mergeSkillsConfig(base.skills, override.skills),
191
167
  tmux: mergeTmuxConfig(base.tmux, override.tmux),
192
168
  };
193
169
  }
194
170
 
195
- function mergeBackgroundConfig(
196
- base?: BackgroundTaskConfig,
197
- override?: BackgroundTaskConfig
198
- ): BackgroundTaskConfig | undefined {
199
- if (!base && !override) return undefined;
200
- return {
201
- enabled: override?.enabled ?? base?.enabled ?? true,
202
- defaultConcurrency: override?.defaultConcurrency ?? base?.defaultConcurrency ?? 5,
203
- staleTimeoutMs: override?.staleTimeoutMs ?? base?.staleTimeoutMs ?? 30 * 60 * 1000,
204
- providerConcurrency: {
205
- ...(base?.providerConcurrency ?? {}),
206
- ...(override?.providerConcurrency ?? {}),
207
- },
208
- modelConcurrency: {
209
- ...(base?.modelConcurrency ?? {}),
210
- ...(override?.modelConcurrency ?? {}),
211
- },
212
- };
213
- }
214
-
215
171
  function mergeSkillsConfig(base?: SkillsConfig, override?: SkillsConfig): SkillsConfig | undefined {
216
172
  if (!base && !override) return undefined;
217
173
  const paths = new Set([...(base?.paths ?? []), ...(override?.paths ?? [])]);
package/src/index.ts CHANGED
@@ -13,7 +13,6 @@ export type {
13
13
  AgentContext,
14
14
  CoderTask,
15
15
  CoderConfig,
16
- BackgroundTaskConfig,
17
16
  McpConfig,
18
17
  TaskStatus,
19
18
  } from './types';
@@ -1,6 +1,5 @@
1
1
  import type { PluginInput } from '@opencode-ai/plugin';
2
2
  import type { CoderConfig } from '../../types';
3
- import type { BackgroundManager } from '../../background';
4
3
  import type { OpenCodeDBReader, SessionTreeNode } from '../../sqlite';
5
4
  import type { CompactionStats } from '../../sqlite/types';
6
5
  import {
@@ -68,7 +67,6 @@ interface CadenceSessionState {
68
67
  export function createCadenceHooks(
69
68
  ctx: PluginInput,
70
69
  config: CoderConfig,
71
- backgroundManager?: BackgroundManager,
72
70
  dbReader?: OpenCodeDBReader,
73
71
  lastUserMessages?: Map<string, string>
74
72
  ): CadenceHooks {
@@ -361,47 +359,21 @@ After compaction:
361
359
  3. Lead will continue the loop from iteration ${state.iteration}
362
360
  4. Use 5-Question Reboot to re-orient: Where am I? Where going? Goal? Learned? Done?`;
363
361
 
364
- // 4. Build background tasks section
365
- const tasks = backgroundManager?.getTasksByParent(sessionId) ?? [];
366
- let backgroundSection: string | null = null;
367
-
368
- if (tasks.length > 0) {
369
- const taskList = tasks
370
- .map(
371
- (t) =>
372
- `- **${t.id}**: ${t.description || 'No description'} (session: ${t.sessionId ?? 'pending'}, status: ${t.status})`
373
- )
374
- .join('\n');
375
-
376
- backgroundSection = `## Active Background Tasks
377
-
378
- This session has ${tasks.length} background task(s) running in separate sessions:
379
- ${taskList}
380
-
381
- **CRITICAL:** Task IDs and session IDs persist across compaction - these tasks are still running.
382
- Use \`agentuity_background_output({ task_id: "..." })\` to check their status.
383
- Use \`agentuity_session_dashboard({ session_id: "..." })\` to get a full session tree with status, costs, and health summary for Lead-of-Leads monitoring.
384
-
385
- **Tip:** A Monitor agent is auto-launched to watch these tasks. You will receive \`[BACKGROUND TASK COMPLETED]\` notifications as each task finishes, and \`[ALL BACKGROUND TASKS COMPLETE]\` when all are done. Use \`agentuity_session_dashboard\` for a unified progress view.`;
386
- }
387
-
388
- // 5. Build SQLite dashboard section
362
+ // 4. Build SQLite dashboard section
389
363
  const dashboardSection = buildSqliteDashboardSummary(dbReader, sessionId);
390
364
 
391
- // 6. Combine everything into the full prompt
365
+ // 5. Combine everything into the full prompt
392
366
  const sections: string[] = [];
393
367
  if (instructions) sections.push(instructions);
394
368
  sections.push(cadenceStateSection);
395
- if (backgroundSection) sections.push(backgroundSection);
396
369
  if (planningState) sections.push(planningState);
397
370
  if (imageDescs) sections.push(imageDescs);
398
371
  if (toolSummaries) sections.push(toolSummaries);
399
372
  if (dashboardSection) sections.push(dashboardSection);
400
373
 
401
- // 7. Add diagnostics
374
+ // 6. Add diagnostics
402
375
  const stats: CompactionStats = {
403
376
  planningPhasesCount: countListItems(planningState),
404
- backgroundTasksCount: tasks.length,
405
377
  imageDescriptionsCount: countListItems(imageDescs),
406
378
  toolCallSummariesCount: countListItems(toolSummaries),
407
379
  estimatedTokens: Math.ceil(sections.join('\n\n').length / 4),
@@ -409,7 +381,7 @@ Use \`agentuity_session_dashboard({ session_id: "..." })\` to get a full session
409
381
  const diagnostics = formatCompactionDiagnostics(stats);
410
382
  if (diagnostics) sections.push(diagnostics);
411
383
 
412
- // 8. Enforce token budget
384
+ // 7. Enforce token budget
413
385
  let fullPrompt = sections.join('\n\n');
414
386
  const estimatedTokens = Math.ceil(fullPrompt.length / 4);
415
387
  if (maxTokens > 0 && estimatedTokens > maxTokens) {
@@ -425,24 +397,19 @@ Use \`agentuity_session_dashboard({ session_id: "..." })\` to get a full session
425
397
  fullPrompt = trimmed.join('\n\n');
426
398
  }
427
399
 
428
- // 9. Set the full prompt or push to context
400
+ // 8. Set the full prompt or push to context
429
401
  if (useCustomPrompt) {
430
402
  output.prompt = fullPrompt;
431
403
  } else {
432
404
  output.context.push(fullPrompt);
433
405
  }
434
406
 
435
- // 10. Store pre-compaction snapshot to KV (fire-and-forget)
407
+ // 9. Store pre-compaction snapshot to KV (fire-and-forget)
436
408
  if (useSnapshotToKV) {
437
409
  storePreCompactionSnapshot(sessionId, {
438
410
  timestamp: new Date().toISOString(),
439
411
  sessionId,
440
412
  planningState: planningState ? { raw: planningState } : undefined,
441
- backgroundTasks: tasks.map((t) => ({
442
- id: t.id,
443
- description: t.description || 'No description',
444
- status: t.status,
445
- })),
446
413
  cadenceState: state ? { ...state } : undefined,
447
414
  branch,
448
415
  }).catch(() => {}); // Fire and forget