New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details β†’
Socket
Book a DemoSign in
Socket

@agentuity/opencode

Package Overview
Dependencies
Maintainers
3
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentuity/opencode

Agentuity Open Code plugin with specialized AI coding agents

latest
npmnpm
Version
2.0.11
Version published
Weekly downloads
621
-20.18%
Maintainers
3
Weekly downloads
Β 
Created
Source

@agentuity/opencode

An Open Code plugin providing a team of specialized AI agents with access to Agentuity cloud services and SDK expertise.

Installation

agentuity ai opencode install

Usage

In Open Code, use slash commands or @mention agents directly:

/agentuity-coder implement dark mode for settings page
/agentuity-cloud list all my KV namespaces
/agentuity-sandbox run bun test in a sandbox

Commands

CommandDescription
/agentuity-coderRun tasks with the full agent team (Lead orchestrates)
/agentuity-cadenceπŸ”„ Start a long-running autonomous loop
/agentuity-cloud☁️ Interact with any Agentuity cloud service
/agentuity-sandboxπŸ–οΈ Run code in isolated sandbox environments
/agentuity-memory-saveSave session context to memory

Cloud Services via /agentuity-cloud

The Expert agent can operate any agentuity cloud subcommand:

ServiceCLIExamples
KVagentuity cloud kvlist namespaces, set key value
Storageagentuity cloud storageupload file, list buckets
Vectoragentuity cloud vectorsearch for auth patterns
Sandboxagentuity cloud sandboxrun tests, create environment
Databaseagentuity cloud dbcreate table, run SQL
SSHagentuity cloud sshconnect to deployment
Deploymentsagentuity cloud deploymentlist, inspect
Agentsagentuity cloud agentlist, inspect
Sessionsagentuity cloud sessionlist, inspect
Threadsagentuity cloud threadlist, inspect

Agent Team

AgentRoleWhen to Use
LeadOrchestratorAutomatically coordinates all work, handles strategic planning
ScoutExplorerFinding files, patterns, codebase analysis (read-only)
BuilderImplementerInteractive code changes, quick fixes, guided implementation
ArchitectAutonomous ImplementerCadence mode, complex multi-file features, long-running tasks
ReviewerCode ReviewerReviewing changes, catching issues, suggesting fixes
MemoryContext ManagerStoring/retrieving context, decisions, patterns across sessions
ExpertAgentuity SpecialistCLI commands, cloud services, SDK questions
ProductRequirements OwnerDefine what to build and why, PRDs, validate product intent
RunnerCommand ExecutorRun lint/build/test/typecheck/format, returns structured summaries

Builder vs Architect

AspectBuilderArchitect
ModeInteractiveAutonomous
Best forQuick fixes, guided workCadence mode, complex features
ModelClaude Opus 4.5GPT 5.2 Codex
ReasoningHighMaximum (xhigh)
ContextSession-basedCheckpoint-based

Use Builder when: You're working interactively, making quick changes, or need guidance.

Use Architect when: Running Cadence mode, implementing complex multi-file features, or need autonomous execution with deep reasoning.

Model Configuration

Each agent has a default model optimized for its role:

AgentDefault ModelReasoning Level
Leadanthropic/claude-opus-4-5-20251101max (extended thinking)
Scoutanthropic/claude-haiku-4-5-20251001-
Builderanthropic/claude-opus-4-5-20251101high
Architectopenai/gpt-5.2-codexxhigh
Revieweranthropic/claude-sonnet-4-5-20250929high
Memoryanthropic/claude-haiku-4-5-20251001-
Expertanthropic/claude-sonnet-4-5-20250929high
Productopenai/gpt-5.2high
Runneranthropic/claude-haiku-4-5-20251001-

Overriding Agent Models

You can override any agent's model via opencode.json:

{
	"agent": {
		"Agentuity Coder Builder": {
			"model": "anthropic/claude-sonnet-4-5-20250514"
		},
		"Agentuity Coder Architect": {
			"model": "openai/gpt-5.2-codex",
			"reasoningEffort": "xhigh"
		}
	}
}

Run opencode models to see all available models.

Configuration Options

For OpenAI models:

  • reasoningEffort: "low" | "medium" | "high" | "xhigh" β€” controls reasoning depth

For Anthropic models:

  • variant: "low" | "medium" | "high" | "max" β€” controls extended thinking level
  • thinking: { "type": "enabled", "budgetTokens": 10000 } β€” explicit thinking config

General:

  • model: The model identifier (e.g., "anthropic/claude-sonnet-4-5-20250514")
  • temperature: Number between 0-1 (lower = more deterministic)
  • maxSteps: Maximum tool use steps per turn

Security

Sensitive CLI commands are blocked by default:

  • agentuity cloud secrets / secret
  • agentuity cloud apikey
  • agentuity auth token

Permissions

The plugin auto-allows certain operations to prevent blocking prompts during agent execution.

Auto-Allowed Directories

DirectoryReason
/tmp/**Memory agent writes temp files for piping large JSON to CLI
$TMPDIR/**OS-specific temp directory (macOS, etc.)

These are standard temp directories designed for ephemeral file operations. In sandbox environments, all permissions are auto-allowed.

Customizing Permissions

To allow additional directories or override defaults, add to your opencode.json:

{
	"permission": {
		"external_directory": {
			"/my/custom/path/**": "allow"
		}
	}
}

Plugin Configuration

Plugin settings are configured in your Agentuity CLI profile (~/.config/agentuity/production.yaml). Add a coder section:

name: production
preferences:
   orgId: org_xxx
coder:
   tmux:
      enabled: true
   background:
      defaultConcurrency: 3

All fields under coder are optional. See Background Agents and Tmux Integration for details.

Note: Agent model overrides go in opencode.json (see Model Configuration), while plugin behavior settings go in the Agentuity profile.

Add to your opencode.json for enhanced Scout/Expert capabilities:

{
	"mcp": {
		"context7": { "type": "remote", "url": "https://mcp.context7.com/mcp" },
		"grep_app": { "type": "remote", "url": "https://mcp.grep.app" },
	},
}
MCPPurposeFree Tier
context7Library docs lookup500 req/month
grep_appGitHub code searchUnlimited

Cadence: Long-Running Autonomous Sessions

Cadence enables the agent team to work autonomously on complex tasks across multiple iterations until completion.

Architect is the recommended agent for Cadence mode. It uses GPT 5.2 Codex with maximum reasoning effort (xhigh), optimized for:

  • Long-running autonomous tasks
  • Complex multi-file features
  • Deep analysis before implementation
  • Checkpoint-based progress tracking

For quick fixes during a Cadence session, Builder can still be used for minor iterations.

Starting a Cadence Loop

/agentuity-cadence implement the new payment integration with Stripe, including tests and docs

Lead will:

  • Create loop state in KV storage (agentuity-opencode-tasks)
  • Work iteratively β€” delegating to Scout, Builder, Reviewer
  • Store checkpoints with Memory after each iteration
  • Output <promise>DONE</promise> when complete

Cadence Control

Start with /agentuity-cadence, then use natural language:

ActionHow
Start/agentuity-cadence build the auth feature
Status"what's the status?"
Pause"pause"
Resume"continue"
Extend"continue for 50 more iterations"
Stop"stop" or Ctrl+C

Headless Execution

For running Cadence in sandboxes or background:

# Start headless
agentuity ai opencode run "/agentuity-cadence build the auth feature"

Control is via natural language within the session, or by managing KV state directly.

How It Works

Cadence is agentic-first β€” Lead's prompt drives the loop, not deterministic code. Lead:

  • Manages its own state in KV
  • Decides when to delegate and to whom
  • Stores checkpoints via Memory for context management
  • Continues until the task is truly complete

See docs/cadence.md for architecture details.

Lead-of-Leads: Parallel Work Orchestration

For very large tasks with independent workstreams, Lead can spawn child Leads to work in parallel.

When to Use

SignalExample
Independent workstreams"Build auth, payments, and notifications" β€” each is separate
Explicit parallelismUser says "do these in parallel" or "work on multiple fronts"
Large scope, clear boundariesPRD has 3+ phases that don't depend on each other

Don't use Lead-of-Leads for:

  • Small tasks that one team can handle easily
  • Large tasks with clear sequential order
  • Work requiring tight coordination between parts

How It Works

User: "Build auth, cart, and payments in parallel"
           β”‚
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Parent Lead β”‚ ◄── Orchestrates
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β”‚ 1. Ask Product to create PRD with workstreams
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Product   β”‚ ◄── Creates PRD with 3 workstreams (status: available)
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β”‚ 2. Spawn 3 child Leads via background tasks
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
    β”‚Child 1β”‚Child 2β”‚Child 3β”‚ ◄── Each claims a workstream
    β”‚ Auth  β”‚ Cart  β”‚Paymentβ”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β”‚ 3. Each child works autonomously, updates PRD when done
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Parent Lead β”‚ ◄── Monitors PRD, does integration when all done
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
    <promise>DONE</promise>

Workstream Status

Product manages workstream status in the PRD:

StatusMeaning
availableReady to be claimed by a child Lead
in_progressClaimed and being worked on
doneCompleted successfully
blockedStuck, needs parent Lead attention

Workstream Structure

{
	"workstreams": [
		{
			"phase": "Auth Module",
			"status": "done",
			"sessionId": "sess_abc",
			"completedAt": "2026-02-03T..."
		},
		{
			"phase": "Payment Integration",
			"status": "in_progress",
			"sessionId": "sess_xyz",
			"startedAt": "2026-02-03T..."
		},
		{
			"phase": "Notification System",
			"status": "available"
		}
	]
}

Coordination Rules

  • PRD is source of truth β€” All Leads read/update the same PRD
  • Product manages workstreams β€” Child Leads ask Product to claim/complete workstreams
  • No direct child-to-child communication β€” Coordinate through PRD only
  • Parent handles integration β€” After children complete, parent does any glue work

Local Development

When developing the opencode package locally, configure OpenCode to use your local build.

Edit ~/.config/opencode/opencode.json to point to your local package:

{
	"$schema": "https://opencode.ai/config.json",
	"plugin": ["/path/to/agentuity/sdk/packages/opencode"],
}

Then build and restart OpenCode:

cd packages/opencode
bun run build

To revert to the published npm package, run agentuity ai opencode install to reset the plugin path to @agentuity/opencode.

Background Agents

Run agents in the background while continuing other work. Background agents execute asynchronously and notify you when complete.

Tools

ToolDescription
agentuity_background_taskLaunch an agent task in the background
agentuity_background_outputRetrieve the result of a completed task
agentuity_background_cancelCancel a running or pending background task

Usage

// Launch a background task
agentuity_background_task({
	agent: 'scout',
	task: 'Find all authentication implementations in this codebase',
});
// Returns: { taskId: 'bg_abc123', status: 'pending' }

// Continue working on other things...

// When notified of completion, retrieve results
agentuity_background_output({ task_id: 'bg_abc123' });
// Returns: { taskId: 'bg_abc123', status: 'completed', result: '...' }

// Cancel if needed
agentuity_background_cancel({ task_id: 'bg_abc123' });

Concurrency Control

Background tasks are rate-limited to prevent overwhelming providers. Configure in your Agentuity CLI profile (~/.config/agentuity/production.yaml):

# Minimal - just enable with defaults
coder:
  background:
    enabled: true

# Or with custom concurrency limits (all fields optional)
coder:
  background:
    enabled: true
    defaultConcurrency: 3
    staleTimeoutMs: 180000
    providerConcurrency:
      anthropic: 2
      openai: 5
    modelConcurrency:
      anthropic/claude-opus-4-5: 1
OptionDefaultDescription
enabledtrueEnable/disable background tasks
defaultConcurrency1Default max concurrent tasks per model
staleTimeoutMs1800000Timeout for stale tasks (30 minutes)
providerConcurrency{}Per-provider concurrency limits (optional)
modelConcurrency{}Per-model concurrency limits (optional)

How It Works

NOTE: This just works, but if you're curious how, read more:

  • Launch: Task is queued with pending status
  • Acquire Slot: Waits for concurrency slot based on model/provider
  • Execute: Creates a new OpenCode session, runs the agent
  • Track Progress: Monitors tool calls and activity
  • Complete: Detects completion via session.idle event
  • Notify: Notifies parent session with results

Architecture

Background tasks leverage OpenCode's session architecture. When you start OpenCode with --port, it runs an HTTP server that can host multiple sessions simultaneously.

flowchart TB
    subgraph MainProcess["Main OpenCode Process (--port 4096)"]
        Server["HTTP Server<br/>localhost:4096"]
        BM["BackgroundManager"]
        TM["TmuxSessionManager"]
        Sessions["Sessions:<br/>β€’ ses_main (your chat)<br/>β€’ ses_bg1 (Scout)<br/>β€’ ses_bg2 (Builder)"]

        Server --- Sessions
        BM --> |"Creates sessions<br/>via SDK"| Server
        BM --> |"Notifies"| TM
    end

    subgraph TmuxPanes["Tmux Panes"]
        MainPane["Main Pane<br/>(your conversation)"]
        Pane1["Agent Pane 1<br/>opencode attach :4096<br/>--session ses_bg1"]
        Pane2["Agent Pane 2<br/>opencode attach :4096<br/>--session ses_bg2"]
    end

    MainPane <--> |"HTTP"| Server
    Pane1 <--> |"HTTP"| Server
    Pane2 <--> |"HTTP"| Server
    TM --> |"tmux split-window"| Pane1
    TM --> |"tmux split-window"| Pane2

Key concepts:

ComponentPurpose
OpenCode ServerHTTP server hosting all sessions (requires --port flag)
SessionA conversation context - your main chat OR a background agent
opencode attachCLI that opens a TUI connected to an existing session
BackgroundManagerCreates sessions via SDK, tracks status, notifies on completion
TmuxSessionManagerSpawns/closes tmux panes for visual feedback

The flow when you launch a background task:

sequenceDiagram
    participant User
    participant Lead as Lead Agent
    participant BM as BackgroundManager
    participant SDK as OpenCode SDK
    participant Server as OpenCode Server
    participant TM as TmuxManager
    participant Tmux

    User->>Lead: "Run Scout in background"
    Lead->>BM: agentuity_background_task(scout, "find APIs")
    BM->>SDK: session.create()
    SDK->>Server: POST /session
    Server-->>SDK: { id: "ses_abc123" }
    SDK-->>BM: session created

    BM->>TM: onSessionCreated(ses_abc123)
    TM->>Tmux: split-window "opencode attach --session ses_abc123"
    Tmux-->>TM: pane created

    BM->>SDK: session.chat.message.create(prompt)
    SDK->>Server: POST /session/ses_abc123/message
    Note over Server: Scout agent starts working

    Server-->>BM: session.idle event
    BM->>Lead: Task complete with results
    Lead->>User: "Scout found 15 API endpoints"

Why --port is required: Without it, OpenCode runs in standalone TUI mode with no HTTP server. The SDK can't create sessions, and opencode attach has nothing to connect to.

Multiple TUIs, one server: Both your main TUI and the agent panes are just views into sessions managed by the same server. The server does all the actual AI work - the TUIs just display it.

Tmux Integration

When running inside tmux, background agents can spawn in separate panes for visual multi-agent execution.

⚠️ Important: Server Mode Required

Tmux integration requires OpenCode to run with an HTTP server enabled. You must start OpenCode with the --port flag:

# Start OpenCode with server enabled
opencode --port 4096

Without the --port flag, opencode attach (used by spawned panes) cannot connect.

Configuration

Configure in your Agentuity CLI profile (~/.config/agentuity/production.yaml):

coder:
   tmux:
      enabled: true
      maxPanes: 6 # Optional, default 4
OptionDefaultDescription
enabledfalseEnable tmux pane spawning
maxPanes4Max agent panes before rotating oldest out
mainPaneMinWidth100Minimum width for main pane (columns)
agentPaneMinWidth40Minimum width for agent panes (columns)

How It Works

Agents spawn in a dedicated "Agents" window with a tiled grid layout:

  • Detection: Checks if running inside tmux via $TMUX environment variable
  • Separate Window: Creates/reuses an "Agents" window (keeps your main window clean)
  • Tiled Layout: Panes arrange in a grid that auto-adjusts as agents spawn
  • LRU Rotation: When maxPanes is reached, oldest pane closes to make room
  • Cleanup: All agent panes close when the main session ends

Tip: Click a pane to select it, then press Ctrl-b z (where b is your leader key) to zoom/unzoom for full-screen view.

Grid Layout Example

With maxPanes: 6, agents arrange in a tiled grid:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Scout 1 β”‚ Scout 2 β”‚ Builder β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Builder β”‚ Review  β”‚ Expert  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Requirements

  • OpenCode must be started with --port flag
  • Must be running inside a tmux session (TMUX env var present)
  • tmux binary must be in PATH
  • Sufficient window size for panes (based on min width config)

Resources

FAQs

Package last updated on 08 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts