Skip to content

Conversation

@rblalock
Copy link
Member

@rblalock rblalock commented Feb 3, 2026

Summary

Three improvements to the Agentuity Coder agent team:

1. Merged Planner into Lead

Lead now handles all planning directly using extended thinking. One less agent hop.

2. Planning with KV Storage

  • Session planning tracks active work (session:{id} in KV)
  • Product owns PRDs at project:{label}:prd
  • Cadence mode requires Product to establish PRD first

3. Lead-of-Leads for Parallel Work

Lead can now spawn child Leads for independent workstreams:

  • New agentuity_background_inspect tool for debugging stuck tasks
  • Hidden BackgroundMonitor agent watches tasks without exhausting Lead's context
  • Task state persists across restarts via session metadata

Breaking Changes

@Agentuity Coder Planner no longer exists — use Lead instead.

Summary by CodeRabbit

  • New Features

    • Added Monitor agent to track background task completion and status
    • Introduced Product role for requirements management and PRD ownership
    • Implemented Lead-of-Leads orchestration pattern for coordinating parallel workstreams
    • Added background task inspection capability for visibility into active work
    • Enhanced planning with progress tracking, phases, findings, and blockers in Cadence mode
  • Changes

    • Restructured agent team: Planner responsibilities reassigned to Lead with extended thinking capabilities
    • Updated role coordination: Product gates new work requirements; Lead handles strategic planning and architecture decisions
    • Expanded context management to include background task information during session memory compaction

…ructure

This commit introduces two major enhancements to the Agentuity Coder agent team:

## 1. Planning with KV Infrastructure

Added Manus-style persistent planning using KV storage:

- **Session Planning**: Active work tracking in session records with loose
  planning section (objective, phases with rich notes, findings, errors,
  blockers, prdKey linking to PRD)
- **PRD Coordination**: Product agent owns PRDs at project:{label}:prd which
  define 'what' and 'why'. Session planning tracks 'how' and 'where we are'
- **Cadence Mode Flow**: Lead MUST involve Product first to establish PRD,
  and involves Product at session end to update PRD
- **5-Question Reboot**: Memory uses this format for Cadence context recall
  (Where am I? Where going? What's the goal? What learned? What done?)
- **Lead-of-Leads**: Parent Lead can spawn child Leads via background tasks
  for parallel work, with PRD workstreams for coordination

## 2. Planner → Lead Merge

Merged the Planner agent into Lead, simplifying from 11 to 10 agents:

- Lead already had 'Technical Planning Is YOUR Job' and extended thinking
- Planner was a delegation convenience; Lead has all the context needed
- Eliminates a hop: Lead → Planner → Lead → Builder becomes Lead thinks → Builder
- Added Strategic Decision Framework guidance to Lead
- Extended thinking section now references Product's PRD for grounding

## Files Changed

### Agent Prompts
- lead.ts: Absorbed Planner capabilities, added planning infrastructure,
  terminology clarifications (Technical Planning vs Product Planning)
- product.ts: Added PRD check/create workflow for Cadence, session end
  updates, workstreams for parallel work
- memory.ts: Added loose planning schema, 5-Question Reboot format,
  Session Planning vs PRD clarity
- scout.ts, builder.ts, architect.ts: Updated Planner references

### Infrastructure
- types.ts: Removed 'planner' from AgentRoleSchema
- agents/index.ts: Removed plannerAgent export
- plugin.ts: Removed from AGENT_MENTIONS
- delegate.ts: Removed from delegation tool
- keyword.ts: Removed from activation message
- cadence.ts, session-memory.ts: Enhanced compaction hooks with planning state

### Removed
- planner.ts: Deleted (capabilities merged into Lead)

## Agent Team (Now 10 Agents)

| Agent     | Role                                              |
|-----------|---------------------------------------------------|
| Lead      | Orchestrates + technical planning (absorbed Planner) |
| Product   | Defines what/why (requirements, PRDs, user value) |
| Scout     | Explores codebase (read-only)                     |
| Builder   | Implements (interactive)                          |
| Architect | Implements (autonomous, Cadence)                  |
| Reviewer  | Reviews code quality                              |
| Memory    | Stores/recalls context                            |
| Reasoner  | Extracts conclusions                              |
| Expert    | Agentuity CLI/cloud specialist                    |
| Runner    | Runs commands                                     |
@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

This PR removes the Planner agent, adds a Monitor agent, elevates Lead to own planning responsibilities, introduces a Product role and a Lead-of-Leads orchestration pattern, and adds background-task inspection, recovery, and status refresh capabilities across hooks, tools, and docs.

Changes

Cohort / File(s) Summary
Agent Role & Types
packages/opencode/src/types.ts, packages/opencode/src/agents/types.ts
Replaced planner with monitor in AgentRole enum; added optional hidden?: boolean to AgentDefinition.
Agents Registry
packages/opencode/src/agents/index.ts, packages/opencode/src/agents/...
Removed planner import/registration and added monitor agent; updated agent prompts to reference Lead for planning.
Planner Removal
packages/opencode/src/agents/planner.ts
Deleted the Planner agent file and its public exports (prompt and agent config).
New Monitor Agent
packages/opencode/src/agents/monitor.ts
Added monitorAgent and MONITOR_SYSTEM_PROMPT: a hidden subagent for polling/background task monitoring with restricted tools and deterministic settings.
Lead & Product Prompts
packages/opencode/src/agents/lead.ts, packages/opencode/src/agents/product.ts
Expanded Lead to own extended planning/ultrathink workflows, added Lead-of-Leads orchestration and PRD/workstream semantics; updated Product prompt and cadence/PRD guidance.
Other Agent Prompt Tweaks
packages/opencode/src/agents/architect.ts, packages/opencode/src/agents/builder.ts, packages/opencode/src/agents/scout.ts
Replaced Planner references with Lead; refined wording for Architect/Builder/Scout personas and Scout reporting format.
Background Task Runtime
packages/opencode/src/background/manager.ts, packages/opencode/src/background/types.ts
BackgroundManager: added inspectTask, refreshStatuses, recoverTasks; persisted task metadata in session titles; added TaskInspection interface.
Plugin Tools & Hooks
packages/opencode/src/plugin/plugin.ts, packages/opencode/src/plugin/hooks/cadence.ts, packages/opencode/src/plugin/hooks/session-memory.ts, packages/opencode/src/plugin/hooks/keyword.ts
Added agentuity_background_inspect tool; propagated BackgroundManager into cadence and memory hooks to include background-task context in compaction/injection; updated activation message to remove Planner and add Monitor/Product.
Delegate Tool & Types Usage
packages/opencode/src/tools/delegate.ts
Delegate args enum updated to remove planner and add monitor; AGENT_MENTIONS updated to exclude planner and reference monitor; added optional context/waitForResult args.
Session Memory & Cadence State
packages/opencode/src/agents/memory.ts, packages/opencode/src/plugin/hooks/session-memory.ts
Added planning schema to session records (planning object, phases, findings, blockers); compaction now optionally includes Planning State and Background Tasks context.
Tests & README
packages/opencode/test/agents.test.ts, packages/opencode/README.md
Updated tests to expect monitor instead of planner and adjusted prompt string expectations; README expanded with Product role, Lead-of-Leads pattern, workstream status examples, and coordination rules.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


🧹 Recent nitpick comments
packages/opencode/src/background/manager.ts (2)

186-186: Add defensive array coercion for consistency with inspectTask.

The ?? [] only guards against undefined/null, but when throwOnError: false, unwrapResponse may return a truthy error object. The same defensive pattern used in inspectTask (lines 140-141) should be applied here to ensure iteration safety.

♻️ Proposed fix
-				const children = unwrapResponse<Array<unknown>>(childrenResponse) ?? [];
+				const rawChildren = unwrapResponse<Array<unknown>>(childrenResponse);
+				const children = Array.isArray(rawChildren) ? rawChildren : [];

243-243: Apply consistent defensive array coercion.

Same issue as in refreshStatuses — apply the Array.isArray guard used in inspectTask for consistency.

♻️ Proposed fix
-			const sessions = unwrapResponse<Array<unknown>>(sessionsResponse) ?? [];
+			const rawSessions = unwrapResponse<Array<unknown>>(sessionsResponse);
+			const sessions = Array.isArray(rawSessions) ? rawSessions : [];
📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 086cb2a and 4a1ed95.

📒 Files selected for processing (1)
  • packages/opencode/src/background/manager.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/opencode/src/background/manager.ts
🧠 Learnings (1)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • packages/opencode/src/background/manager.ts
🧬 Code graph analysis (1)
packages/opencode/src/background/manager.ts (1)
packages/opencode/src/background/types.ts (3)
  • TaskInspection (58-68)
  • BackgroundTaskStatus (2-2)
  • BackgroundTask (12-29)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Build
  • GitHub Check: Queue CLI Tests
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Pack & Upload
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Template Integration Tests
🔇 Additional comments (4)
packages/opencode/src/background/manager.ts (4)

4-11: LGTM!

The expanded type imports are correctly aligned with the new inspection, recovery, and status refresh capabilities added to the manager.


116-156: LGTM!

The defensive array coercion at lines 140-141 correctly addresses the previous feedback about non-array payloads when throwOnError: false. The method gracefully handles edge cases and returns structured inspection results.


316-333: LGTM!

The status mapping is well-documented and the default fallback to 'pending' is a safe choice for unknown session states during recovery.


449-460: LGTM!

The task metadata persistence in the session title is a pragmatic solution enabling recovery without additional storage infrastructure. The JSON structure is well-chosen with essential fields for task reconstruction.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

📦 Canary Packages Published

version: 1.0.1-4a1ed95

Packages
Package Version URL
@agentuity/drizzle 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-drizzle-1.0.1-4a1ed95.tgz
@agentuity/frontend 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-frontend-1.0.1-4a1ed95.tgz
@agentuity/core 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-core-1.0.1-4a1ed95.tgz
@agentuity/evals 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-evals-1.0.1-4a1ed95.tgz
@agentuity/workbench 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-workbench-1.0.1-4a1ed95.tgz
@agentuity/cli 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-cli-1.0.1-4a1ed95.tgz
@agentuity/react 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-react-1.0.1-4a1ed95.tgz
@agentuity/postgres 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-postgres-1.0.1-4a1ed95.tgz
@agentuity/runtime 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-runtime-1.0.1-4a1ed95.tgz
@agentuity/auth 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-auth-1.0.1-4a1ed95.tgz
@agentuity/opencode 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-opencode-1.0.1-4a1ed95.tgz
@agentuity/schema 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-schema-1.0.1-4a1ed95.tgz
@agentuity/server 1.0.1-4a1ed95 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-server-1.0.1-4a1ed95.tgz
Install

Add to your package.json:

{
  "dependencies": {
    "@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-drizzle-1.0.1-4a1ed95.tgz",
    "@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-frontend-1.0.1-4a1ed95.tgz",
    "@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-core-1.0.1-4a1ed95.tgz",
    "@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-evals-1.0.1-4a1ed95.tgz",
    "@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-workbench-1.0.1-4a1ed95.tgz",
    "@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-cli-1.0.1-4a1ed95.tgz",
    "@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-react-1.0.1-4a1ed95.tgz",
    "@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-postgres-1.0.1-4a1ed95.tgz",
    "@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-runtime-1.0.1-4a1ed95.tgz",
    "@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-auth-1.0.1-4a1ed95.tgz",
    "@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-opencode-1.0.1-4a1ed95.tgz",
    "@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-schema-1.0.1-4a1ed95.tgz",
    "@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-server-1.0.1-4a1ed95.tgz"
  }
}

Or install directly:

bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-drizzle-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-frontend-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-core-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-evals-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-workbench-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-cli-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-react-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-postgres-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-runtime-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-auth-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-opencode-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-schema-1.0.1-4a1ed95.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.1-4a1ed95/agentuity-server-1.0.1-4a1ed95.tgz

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/opencode/src/plugin/hooks/session-memory.ts (1)

132-149: ⚠️ Potential issue | 🟡 Minor

Align planning field list with cadence.ts and memory.ts schema: add planning.current and planning.blockers; clarify planning.progress.

The session-memory.ts list omits planning.current (which is present in cadence.ts line 292) and planning.blockers (referenced in memory.ts line 937). Additionally, step 2 references planning.progress but it's not listed in the fields section. Update the planning fields list to match the schema used elsewhere:

🔧 Suggested update
 **Planning State (if active):**
 If this session has planning active (user requested "track progress" or similar), the session record contains:
 - `planning.prdKey` - Link to PRD if one exists
 - `planning.objective` - What we're trying to accomplish
 - `planning.phases` - Current phases with status and notes
+- `planning.current` - Current phase
 - `planning.findings` - Discoveries made during work
 - `planning.errors` - Failures to avoid repeating
+- `planning.blockers` - Active blockers
+- `planning.progress` - Compaction summary
🤖 Fix all issues with AI agents
In `@packages/opencode/README.md`:
- Around line 48-60: Add a short breaking-change callout above or directly below
the "Agent Team" heading stating that the Planner agent has been removed and
replaced by the Product/Lead split; mention potential migration steps (search
for "Planner" in configs, update references to "Lead" or "Product") and link to
any migration notes or changelog. Ensure the note is clearly labeled (e.g.,
"Breaking change: Planner removed") so readers searching the Agent Team table
will see it immediately.

In `@packages/opencode/src/agents/memory.ts`:
- Around line 913-935: The 5-Question Reboot markdown template references
planning.nextActions but the planning schema provides planning.next; update the
template in the Cadence Context Recall block to use planning.next (or map
planning.next to planning.nextActions before rendering) so the Next Actions
section pulls from the actual field; ensure the template placeholder for Next
Actions replaces "{from planning.nextActions}" with the correct
"{planning.next}" and adjust any rendering code that flattens/joins that array
into list items.
- Around line 359-394: The planning JSON example is missing the required PRD
linkage field; add a planning.prdKey property to the planning schema/example so
session plans can reference the PRD. Update the "planning" object (the one with
keys active, objective, current, next, phases, findings, errors, blockers) to
include a prdKey string (or nullable) with a brief comment/example value and
ensure any code that serializes/deserializes planning (e.g., memory read/write
handling for planning) expects and preserves planning.prdKey so PRD linkage is
consistently stored and recalled.

In `@packages/opencode/src/agents/product.ts`:
- Around line 146-206: The PRD example JSON blocks in
packages/opencode/src/agents/product.ts (the "Lightweight PRD" and "Full PRD"
examples) contain inline `//` comments which make them invalid JSON; remove
those `//` comments from inside the JSON objects (e.g., remove the "//
High-level phases - Lead tracks detailed progress in session planning" and "//
Only if Lead-of-Leads parallel work" notes) and instead place those notes as
plain text before or after the code blocks or as separate fields (e.g., add a
"notes" string/array outside the JSON) so the examples shown for
functions/processes that call kv set are valid JSON for direct copy/paste into
kv set.
🧹 Nitpick comments (1)
packages/opencode/src/plugin/hooks/cadence.ts (1)

287-300: Include planning.next and planning.blockers in the cadence compaction list.
This keeps the compaction prompt aligned with the 5‑Question Reboot (“Where going?”) and the overall planning schema used elsewhere.

♻️ Suggested tweak
 **Planning State:**
 If this session has planning active, the session record contains:
 - `planning.prdKey` - Link to the PRD being executed
 - `planning.objective` - What we're trying to accomplish
 - `planning.phases` - Current phases with status and notes
 - `planning.current` - Current phase
+- `planning.next` - Next planned step
 - `planning.findings` - Discoveries made during work
 - `planning.errors` - Failures to avoid repeating
+- `planning.blockers` - Active blockers
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e3b1b0 and 2d3570b.

📒 Files selected for processing (16)
  • packages/opencode/README.md
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/index.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/agents/memory.ts
  • packages/opencode/src/agents/planner.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/tools/delegate.ts
  • packages/opencode/src/types.ts
  • packages/opencode/test/agents.test.ts
💤 Files with no reviewable changes (4)
  • packages/opencode/src/types.ts
  • packages/opencode/src/agents/index.ts
  • packages/opencode/src/agents/planner.ts
  • packages/opencode/src/tools/delegate.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/test/agents.test.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/agents/memory.ts
packages/opencode/src/plugin/**/*

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

Open Code plugin integration code should be in the src/plugin/ directory

Files:

  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
packages/opencode/src/agents/**/*

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

Agent definitions should be located in the src/agents/ directory

Files:

  • packages/opencode/src/agents/architect.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/agents/memory.ts
packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/*/test/**/*.{ts,tsx}: Place test files in test/ folder (never in src/ or __tests__/)
Import from ../src/ in test files to reference source code
Use @agentuity/test-utils for mocks and test helpers

Files:

  • packages/opencode/test/agents.test.ts
🧠 Learnings (1)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/test/agents.test.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/agents/memory.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: SDK Integration Test Suite
🔇 Additional comments (18)
packages/opencode/src/agents/builder.ts (1)

13-13: LGTM!

The terminology update from "Planner" to "Strategic planner" correctly aligns with the PR's Planner → Lead merge. This clarifies that the column describes a capability the Builder should avoid, rather than referencing the now-removed Planner agent.

packages/opencode/src/plugin/hooks/keyword.ts (3)

14-23: LGTM! Team roster correctly reflects the Planner → Lead merge.

The roster now lists 10 agents (down from 11), with Planner removed and Product added. The new roles (Reasoner at line 20, Product at line 23) are appropriately described and align with the PR objectives.


35-41: LGTM! Guidelines updated to reflect the new Product-first workflow.

The updated guidance correctly incorporates the Product agent for new features and unclear requirements (line 38), aligning with the PR's Cadence mode flow where Lead involves Product first. The logical progression (Scout → Product → Reviewer → cloud services) is sensible.


44-92: LGTM! Runtime logic unchanged and functional.

The keyword detection and context injection logic remains intact. The in-memory activatedSessions Set appropriately prevents duplicate activations within a session.

packages/opencode/src/agents/architect.ts (1)

178-182: Lead handoff wording is aligned with the new planning model.

packages/opencode/src/agents/scout.ts (1)

9-12: Scout identity update reads clean and consistent.

packages/opencode/src/agents/product.ts (2)

11-26: Role boundary clarification looks good.


406-412: Principle update is clear and consistent.

packages/opencode/src/plugin/plugin.ts (1)

472-493: Cadence guidance wording is consistent with the new planning flow.

packages/opencode/test/agents.test.ts (2)

6-8: Agent count assertion aligns with planner removal.


141-142: PRD Generation assertion matches new product prompt.

packages/opencode/src/agents/memory.ts (2)

686-688: Good callout to involve Product for PRD updates at session end.


942-975: Clear separation of PRD vs session planning and activation rules.

packages/opencode/src/agents/lead.ts (5)

45-52: Product gate + requirements‑contract guidance is clear and actionable.

Also applies to: 59-59, 122-125, 151-151, 154-161, 163-175, 176-183, 204-206


91-116: Planning/ultrathink and strategic‑decision guidance reads well.

Also applies to: 333-349, 370-370, 391-405, 409-428, 539-547


488-488: Background‑task example looks good.


557-557: Deep‑debug step in the bug workflow is a nice addition.


973-979: Cadence planning/PRD linkage and progress‑capture guidance is solid.

Also applies to: 1001-1011, 1013-1029, 1031-1040, 1041-1067, 1068-1082

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Added comprehensive Lead-of-Leads documentation for parallel work:

Lead Agent:
- When to use Lead-of-Leads (independent workstreams, explicit parallelism)
- When NOT to use (small tasks, sequential work, tight coordination)
- Complete workflow: PRD with workstreams → spawn child Leads → monitor → integrate
- Child Lead behavior with [CHILD LEAD] tag
- Coordination rules (PRD is source of truth)

Product Agent:
- Workstream status values (available, in_progress, done, blocked)
- How to handle workstream requests (create, claim, complete, status)
- Example: claiming a workstream step-by-step

README:
- New 'Lead-of-Leads: Parallel Work Orchestration' section
- ASCII diagram showing the orchestration flow
- Workstream structure and status table
- Coordination rules
The /agentuity-cadence command template was missing Product agent integration.
Now the Cadence workflow properly includes:

1. FIRST: Establish PRD with Product (REQUIRED)
2. Initialize loop state with prdKey link
3. Each iteration (unchanged)
4. When complete
5. Finalize: Update PRD via Product, then memorialize via Memory

Also added 'Product first' to guidelines.
Added Lead-of-Leads section to the /agentuity-cadence command template
so Lead knows when and how to parallelize work:

- When to use: independent workstreams that can run in parallel
- Workflow: Product creates PRD with workstreams, spawn child Leads,
  monitor via PRD, integrate when done
- When NOT to use: small tasks, sequential work, tight coordination
@blacksmith-sh

This comment has been minimized.

…-Leads

- Add inspectTask() to fetch session details and messages from OpenCode Server
- Add refreshStatuses() to batch refresh task statuses via session.children()
- Add agentuity_background_inspect tool for agents to debug stuck tasks
- Add TaskInspection type for structured inspection results

This is Phase 1-3 of Option C (Hybrid) approach for better background task management.
…undManager

- Store task metadata in session title for persistence (Phase 4)
- Add recoverTasks() to reconstruct task state from sessions on startup (Phase 5)
- Call recoverTasks() during plugin initialization
- Properly set concurrencyGroup on recovered tasks

Tasks now survive plugin restarts by storing metadata in OpenCode sessions.
@rblalock rblalock marked this pull request as ready for review February 4, 2026 03:56
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@packages/opencode/README.md`:
- Around line 257-286: Update the fenced ASCII diagram in README.md to declare a
language (use "text") so markdownlint MD040 is satisfied; locate the block
containing the Lead-of-Leads diagram (the triple-backtick fence that starts with
User: "Build auth, cart, and payments in parallel") and change the opening fence
to ```text while keeping the diagram contents and closing fence unchanged.

In `@packages/opencode/src/background/manager.ts`:
- Around line 258-270: The code reconstructing BackgroundTask (properties
queuedAt and startedAt) uses new Date(metadata.createdAt) which can produce
Invalid Date; update the logic in the BackgroundTask construction (in the
manager that builds task from sess/metadata) to parse metadata.createdAt into a
Date, check validity with isNaN(parsed.getTime()) and fall back to new Date()
when invalid or missing, then assign those validated Date objects to queuedAt
and startedAt; keep references to BackgroundTask, metadata.createdAt, queuedAt,
startedAt, mapSessionStatusToTaskStatus and getConcurrencyGroup to locate the
change.
- Around line 160-197: refreshStatuses currently mutates task.status directly
which bypasses the side effects in completeTask/failTask (concurrency slots,
notifications, result handling); change the logic where newStatus !==
task.status to invoke the existing handlers instead of setting task.status
directly: call this.completeTask(matchedTaskId, ...) when
mapSessionStatusToTaskStatus(childSession) yields BackgroundTaskStatus.Completed
and call this.failTask(matchedTaskId, ...) when it yields
BackgroundTaskStatus.Failed (or the equivalent failure enum), leaving other
status transitions to be applied normally; ensure you use the same
matchedTaskId/task lookups used now, avoid duplicate completion/failure if task
already marked finished, and preserve async behavior (await or schedule as
appropriate) so side effects run.
- Around line 120-149: The inspectTask method returns session messages that may
be non-array when throwOnError is false; update inspectTask (inside the
unwrapResponse handling for messages) to coerce the unpacked messages into an
array (e.g., use Array.isArray check or similar) before returning so that
messages is always an array (mirror the defensive pattern used in
fetchLatestResult); locate inspectTask, the unwrapResponse<Array<{ info:
unknown; parts: unknown[] }>>(messagesResponse) binding, and replace the direct
messages ?? [] usage with a normalized array value.
🧹 Nitpick comments (5)
packages/opencode/src/agents/monitor.ts (1)

16-18: Consider adding a maximum poll count or timeout guidance.

"No timeout - watch indefinitely" (line 18) could lead to extended polling if a monitored task hangs. While the parent Lead can cancel the Monitor, consider documenting a recommended upper bound (e.g., "after 100 polls without progress, report potential stall") to provide a safety net.

packages/opencode/test/agents.test.ts (2)

45-57: Consider adding test coverage for the monitor agent in lookup functions.

The getAgentByRole tests verify all agents except monitor. While the monitor agent is hidden and operates as a subagent, the lookup functions should still return it correctly. Adding expect(getAgentByRole('monitor')?.id).toBe('ag-monitor'); would ensure consistency.

💡 Suggested addition
 		expect(getAgentByRole('product')?.id).toBe('ag-product');
 		expect(getAgentByRole('reasoner')?.id).toBe('ag-reasoner');
+		expect(getAgentByRole('monitor')?.id).toBe('ag-monitor');
 	});

60-72: Consider adding test coverage for monitor in getAgentById.

Similar to getAgentByRole, the getAgentById tests don't cover the monitor agent. Adding coverage ensures the bidirectional lookup works correctly.

💡 Suggested addition
 		expect(getAgentById('ag-product')?.role).toBe('product');
 		expect(getAgentById('ag-reasoner')?.role).toBe('reasoner');
+		expect(getAgentById('ag-monitor')?.role).toBe('monitor');
 	});
packages/opencode/src/plugin/hooks/cadence.ts (1)

277-308: Consider extracting shared background task context formatting.

The background task context building logic (lines 277-308) is nearly identical to the implementation in session-memory.ts (lines 134-156). Extracting this to a shared helper function would reduce duplication and ensure consistent formatting.

♻️ Suggested helper extraction

Create a shared helper in a common location (e.g., packages/opencode/src/plugin/hooks/utils.ts):

import type { BackgroundTask } from '../../background';

export function formatBackgroundTaskContext(tasks: BackgroundTask[]): string {
  if (tasks.length === 0) return '';

  const taskList = tasks
    .map(
      (t) =>
        `- **${t.id}**: ${t.description || 'No description'} (session: ${t.sessionId ?? 'pending'}, status: ${t.status})`
    )
    .join('\n');

  return `

## Active Background Tasks

This session has ${tasks.length} background task(s) running in separate sessions:
${taskList}

**CRITICAL:** Task IDs and session IDs persist across compaction - these tasks are still running.
Use \`agentuity_background_output({ task_id: "..." })\` to check their status.
`;
}
packages/opencode/src/background/manager.ts (1)

201-205: Prefer StructuredError + app logging over console.error.

Using console.error drops structure and bypasses the shared error handling approach; consider creating a StructuredError and logging via this.ctx.client.app.log for consistency. As per coding guidelines "Use StructuredError from @agentuity/core for error handling".

Also applies to: 293-295

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5d07aa and 086cb2a.

📒 Files selected for processing (20)
  • packages/opencode/README.md
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/index.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/agents/memory.ts
  • packages/opencode/src/agents/monitor.ts
  • packages/opencode/src/agents/planner.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/agents/types.ts
  • packages/opencode/src/background/manager.ts
  • packages/opencode/src/background/types.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/tools/delegate.ts
  • packages/opencode/src/types.ts
  • packages/opencode/test/agents.test.ts
💤 Files with no reviewable changes (1)
  • packages/opencode/src/agents/planner.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/opencode/src/background/types.ts
  • packages/opencode/src/agents/types.ts
  • packages/opencode/src/types.ts
  • packages/opencode/src/agents/monitor.ts
  • packages/opencode/src/agents/memory.ts
  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/agents/index.ts
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/test/agents.test.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/background/manager.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/tools/delegate.ts
packages/opencode/src/agents/**/*

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

Agent definitions should be located in the src/agents/ directory

Files:

  • packages/opencode/src/agents/types.ts
  • packages/opencode/src/agents/monitor.ts
  • packages/opencode/src/agents/memory.ts
  • packages/opencode/src/agents/index.ts
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
packages/opencode/src/plugin/**/*

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

Open Code plugin integration code should be in the src/plugin/ directory

Files:

  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/plugin/plugin.ts
packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/*/test/**/*.{ts,tsx}: Place test files in test/ folder (never in src/ or __tests__/)
Import from ../src/ in test files to reference source code
Use @agentuity/test-utils for mocks and test helpers

Files:

  • packages/opencode/test/agents.test.ts
packages/opencode/src/tools/**/*

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

Custom tools should be located in the src/tools/ directory

Files:

  • packages/opencode/src/tools/delegate.ts
🧠 Learnings (1)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • packages/opencode/src/background/types.ts
  • packages/opencode/src/agents/types.ts
  • packages/opencode/src/types.ts
  • packages/opencode/src/agents/monitor.ts
  • packages/opencode/src/agents/memory.ts
  • packages/opencode/src/plugin/hooks/session-memory.ts
  • packages/opencode/src/plugin/hooks/cadence.ts
  • packages/opencode/src/agents/index.ts
  • packages/opencode/src/agents/architect.ts
  • packages/opencode/test/agents.test.ts
  • packages/opencode/src/plugin/hooks/keyword.ts
  • packages/opencode/src/agents/lead.ts
  • packages/opencode/src/agents/builder.ts
  • packages/opencode/src/agents/product.ts
  • packages/opencode/src/agents/scout.ts
  • packages/opencode/src/background/manager.ts
  • packages/opencode/src/plugin/plugin.ts
  • packages/opencode/src/tools/delegate.ts
🧬 Code graph analysis (5)
packages/opencode/src/agents/index.ts (1)
packages/opencode/src/agents/monitor.ts (1)
  • monitorAgent (82-109)
packages/opencode/test/agents.test.ts (1)
packages/opencode/src/agents/index.ts (1)
  • agents (17-29)
packages/opencode/src/background/manager.ts (1)
packages/opencode/src/background/types.ts (3)
  • TaskInspection (58-68)
  • BackgroundTaskStatus (2-2)
  • BackgroundTask (12-29)
packages/opencode/src/plugin/plugin.ts (2)
packages/opencode/src/plugin/hooks/cadence.ts (1)
  • createCadenceHooks (52-350)
packages/opencode/src/plugin/hooks/session-memory.ts (1)
  • createSessionMemoryHooks (22-179)
packages/opencode/src/tools/delegate.ts (4)
packages/opencode/src/types.ts (1)
  • AgentRole (31-31)
packages/opencode/src/index.ts (1)
  • AgentRole (11-11)
packages/opencode/src/tools/index.ts (2)
  • DelegateArgsSchema (1-1)
  • DelegateArgs (1-1)
apps/create-agentuity/bin.js (1)
  • args (4-4)
🪛 LanguageTool
packages/opencode/README.md

[style] ~239-~239: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...Leads: Parallel Work Orchestration For very large tasks with independent workstreams, Lea...

(EN_WEAK_ADJECTIVE)

🪛 markdownlint-cli2 (0.20.0)
packages/opencode/README.md

[warning] 257-257: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Storage CLI Tests
  • GitHub Check: Template Integration Tests
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Queue CLI Tests
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Build
🔇 Additional comments (44)
packages/opencode/src/agents/builder.ts (1)

11-14: LGTM — prompt label aligns with renamed role.

packages/opencode/src/plugin/hooks/keyword.ts (2)

10-24: Activation message updates look good.

Role list changes are consistent and read clearly.


35-40: Guideline updates look good.

The revised ordering and wording are clear and aligned with the new flow.

packages/opencode/src/agents/types.ts (1)

14-19: Well-documented new property.

The hidden property is clearly documented with its intended behavior. The constraint that it "only applies to subagents" is documented but not enforced at the type level. Consider whether runtime validation should warn if hidden: true is used without mode: 'subagent'.

packages/opencode/src/agents/memory.ts (2)

686-688: Good addition for PRD update flow.

The guidance to involve Product at session end to update the PRD ensures completed work is properly reflected. This aligns well with the Cadence mode requirements.


942-975: Clear documentation of Session Planning vs PRD distinction.

The table and guidance clearly delineate the purpose and lifecycle of each concept. This will help agents correctly use session planning for execution tracking while keeping PRDs as the source of truth for requirements.

packages/opencode/src/agents/scout.ts (4)

11-15: Role clarification aligns with Planner → Lead merge.

The updated trait table correctly positions Scout as a non-strategic agent. Replacing "Planner who creates strategies" with "Strategic planner (that's Lead's job)" and adding the cartographer/builder distinction reinforces Scout's read-only, fact-finding role.


45-45: Tightened Phase 5 instruction.

The explicit instruction to not include "planning, suggestions, or opinions" prevents Scout from overstepping into Lead's strategic domain.


157-162: "Recommendations" → "Observations" is a good semantic shift.

Changing from recommendations (which imply action suggestions) to observations (factual notes) aligns with Scout's revised role. The examples are appropriately factual.


310-310: New verification criterion strengthens boundaries.

Adding "Did NOT give opinions on the task instructions or suggest what Lead should do" as a self-check reinforces Scout's non-strategic role.

packages/opencode/src/agents/monitor.ts (2)

1-80: Well-structured Monitor agent prompt.

The prompt clearly defines the Monitor's narrow responsibility: poll, track status, report completion. The "What You Do NOT Do" section (lines 52-59) effectively constrains the agent's scope.

The "conversation history as timer" workaround (lines 75-79) is pragmatic given LLM constraints. Note that actual delays will depend on LLM response latency rather than being precisely 10 seconds.


82-109: Monitor agent definition correctly configured.

  • mode: 'subagent' + hidden: true aligns with the new hidden flag semantics
  • Extensive tool exclusion list ensures Monitor can only use agentuity_background_output
  • temperature: 0.0 is appropriate for deterministic polling behavior
  • Lightweight model (claude-haiku-4-5) is a good choice for this simple task
packages/opencode/src/agents/lead.ts (9)

45-59: Product Gate strengthens requirements clarity.

The Product Gate ensures success criteria are clear before implementation begins. The criteria for when to involve Product (unclear "done" definition, new features, ambiguous requests, user-facing changes) are well-defined and actionable.


91-117: Extended thinking guidance effectively absorbs Planner capabilities.

This section successfully merges Planner's deep reasoning into Lead with clear guidelines on when to use extended thinking vs. direct planning. The emphasis on grounding technical planning in Product's PRD requirements (lines 101-104) prevents technical elegance from overriding product goals.


154-182: Requirements Contract and Functional Review Loop formalize Product collaboration.

The lightweight contract format (lines 165-172) provides just enough structure without being heavyweight. The Functional Review Loop (lines 176-182) closes the loop to prevent "technically correct but wrong thing" outcomes.


333-350: Planning Mode Detection covers both Cadence and opt-in scenarios.

Clear trigger phrases for opt-in planning ("track my progress", "make a plan", etc.) and the workflow for activating planning in regular sessions are well-defined.


391-428: Strategic Decision Framework promotes pragmatic minimalism.

The framework's emphasis on simplicity, leveraging existing code, and developer experience over theoretical optimization is sound engineering guidance. The Plan Format for Builder (lines 409-428) provides a clear template for actionable plans.


539-547: Phase-Based Workflow correctly references Lead for planning.

The update from Planner to "Lead (extended thinking)" in Phase 2 aligns with the Planner → Lead merge. The guidance on when to use extended thinking vs. direct planning is clear.


1001-1067: Session Planning vs PRD and Cadence Product Gate are comprehensive.

The distinction between PRD (what/why) and session planning (how/where) is clearly documented. The mandatory Product gate at Cadence start (lines 1013-1029) ensures PRD exists before execution begins. The session-end requirement to update PRD (lines 1031-1040) maintains PRD accuracy.


1149-1294: Lead-of-Leads orchestration pattern is well-designed.

The pattern addresses parallel work orchestration with clear guidance on:

  • When to use (independent workstreams, explicit parallelism)
  • When NOT to use (sequential dependencies, tight coordination)
  • Workflow steps with PRD workstreams
  • BackgroundMonitor delegation for clean context management
  • Coordination rules through PRD as source of truth

The example (lines 1264-1285) provides a concrete illustration of the workflow.


1191-1204: The background task infrastructure accepts "lead" as a valid agent identifier.

The agentuity_background_task tool uses AgentRoleSchema for agent validation, which explicitly includes 'lead' as a valid option. This confirms the Lead-of-Leads pattern is supported—child Leads can be spawned via background tasks to work autonomously on parallel workstreams.

packages/opencode/src/agents/architect.ts (1)

181-181: Terminology update aligns with Planner → Lead merge.

Changing "Consult Planner agent" to "Ask Lead (Lead handles strategic planning)" is consistent with the PR's objective of consolidating strategic planning into Lead.

packages/opencode/src/background/types.ts (1)

53-68: TaskInspection interface provides useful debugging capability.

The interface correctly uses unknown for the loosely-typed session and message fields, which is appropriate for a debugging interface where the exact structure may vary.

Consider documenting the expected format of lastActivity (e.g., "ISO 8601 timestamp string") in the JSDoc for clarity.

packages/opencode/src/agents/index.ts (1)

13-28: LGTM!

The agent registry correctly replaces planner with monitor. The import and registry entry are properly aligned with the new monitorAgent definition from monitor.ts, and the Record<AgentRole, AgentDefinition> type ensures compile-time validation against the updated AgentRole type.

packages/opencode/src/types.ts (1)

18-31: LGTM!

The AgentRoleSchema correctly replaces 'planner' with 'monitor'. Since AgentRole is inferred via z.infer, this change automatically propagates type safety throughout the codebase.

packages/opencode/src/plugin/hooks/session-memory.ts (2)

22-26: LGTM!

The optional backgroundManager parameter maintains backward compatibility while enabling background task context injection. The null coalescing pattern (backgroundManager?.getTasksByParent(sessionId) ?? []) handles the undefined case safely.


134-156: LGTM!

The background task context injection is well-structured:

  • Only builds context when tasks exist (efficient)
  • Includes task ID, description, session ID, and status for traceability
  • Provides clear guidance on how to check task status post-compaction
packages/opencode/src/plugin/hooks/cadence.ts (1)

52-56: LGTM!

The optional backgroundManager parameter follows the same pattern as session-memory.ts, maintaining consistency across hooks.

packages/opencode/src/agents/product.ts (1)

3-27: LGTM!

The prompt correctly updates role attributions: Lead now handles technical architecture/design, while Product maintains ownership of requirements, user value, and product intent. The "Product vs Scout vs Lead" table clearly delineates responsibilities.

packages/opencode/src/tools/delegate.ts (3)

5-26: LGTM!

The DelegateArgsSchema correctly replaces 'planner' with 'monitor'. The schema intentionally uses a hardcoded enum rather than deriving from AgentRole since Lead delegates but cannot be delegated to.


31-42: LGTM!

The AGENT_MENTIONS type correctly uses Exclude<AgentRole, 'lead'> to ensure type safety while excluding the Lead agent from delegation targets. The monitor entry is properly added.


64-65: LGTM!

The type cast args.agent as Exclude<AgentRole, 'lead'> is necessary here because args.agent is inferred from the narrower schema enum, and TypeScript needs the explicit cast to index into AGENT_MENTIONS.

packages/opencode/src/background/manager.ts (3)

4-11: Type import additions look consistent.

The added type imports align with the new background task APIs.


300-316: LGTM: clear status mapping.


432-445: Session title overflow risk is speculative without documented API limits.

The OpenCode SDK session.create() API does not document a maximum length constraint for the title field. While truncating user input is a reasonable defensive practice, the claim that the description "can exceed title limits" cannot be confirmed. Consider:

  • If a legitimate backend limit exists, it should be documented or discovered through error reports rather than speculative fixes.
  • If truncation is needed for safety, prefer a limit derived from actual API documentation or observed failures.

Remove the urgency tag unless you have evidence of failures or confirmed backend constraints.

packages/opencode/README.md (1)

80-90: LGTM: Product model entry is clear.

packages/opencode/src/plugin/plugin.ts (8)

67-81: LGTM: Monitor mention wiring is clear.


129-159: Nice addition: task recovery + background-aware hooks on startup.


300-313: LGTM: hidden agent flag is propagated to config.


499-544: Cadence workflow updates read clearly.


600-615: Delegate tool enum updates are consistent.


638-652: Background task enum updates are consistent.


723-764: Background inspect tool implementation looks good.


903-909: Tools map now exposes background inspection.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@rblalock rblalock requested a review from jhaynie February 4, 2026 04:16
… BackgroundManager

- inspectTask: Add Array.isArray check for messages (mirrors fetchLatestResult pattern)
- refreshStatuses: Use completeTask/failTask for completed/error states to trigger
  proper side effects (concurrency release, notifications, result fetching)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants