
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
opencode-sessions
Advanced tools
Session management plugin for OpenCode with multi-agent collaboration support
Multi-agent collaboration and workflow orchestration for OpenCode
Enable turn-based agent collaboration, clean phase transitions, manual compression control, and parallel exploration—all through a single elegant tool.
Agents work together in the same conversation, passing the torch back and forth. Perfect for complex problems requiring multiple perspectives.
session({
mode: "message",
agent: "plan",
text: "Should we use microservices here?",
})
// Plan agent reviews architecture and responds
// Can pass back to build agent for implementation
sequenceDiagram
participant Build as Build Agent
participant User as Session
participant Plan as Plan Agent
Build->>User: "Implemented feature X"
Note over Build: Tool: session(mode: "message", agent: "plan")
Build->>Build: Finishes turn
User->>Plan: "Implemented feature X"
Plan->>User: "Let me review that..."
Note over Plan: Reviews and provides feedback
Plan->>Build: Passes back via session tool
Use Cases:
Complete one work phase, hand off to another agent with a fresh slate. No context baggage from previous work.
session({
mode: "new",
agent: "researcher",
text: "Research API design best practices for 2025",
})
// Fresh session, clean context
// Previous implementation details don't influence research
graph LR
A[Research Phase] -->|Clean Handoff| B[Planning Phase]
B -->|Clean Handoff| C[Implementation Phase]
C -->|Clean Handoff| D[Validation Phase]
Use Cases:
Trigger compaction when needed, include a message, and optionally hand off to a different agent. Maintain long conversations without token limits.
session({
mode: "compact",
agent: "plan",
text: "Continue architecture review",
})
// Compacts history, injects handoff context, plan agent responds
sequenceDiagram
participant Build as Build Agent
participant Session as Session
participant Plan as Plan Agent
Note over Build: Long conversation...
Build->>Session: Tool: session(mode: "compact", agent: "plan")
Session->>Session: Inject: "[Compacting - plan will respond]"
Session->>Session: Compress history
Session->>Session: Wait for idle
Session->>Plan: "Continue architecture review"
Plan->>Session: Reviews compacted context and responds
What survives compaction:
[Compacting session - plan agent will respond after completion]Use Cases:
Branch into independent sessions to try different solutions. Full primary agent capabilities in each fork.
// Try approach A
session({
mode: "fork",
agent: "build",
text: "Implement using Redux",
})
// Try approach B
session({
mode: "fork",
agent: "build",
text: "Implement using Context API",
})
// Compare results, pick the best
graph TD
A[Main Session] -->|Fork| B[Approach A: Redux]
A -->|Fork| C[Approach B: Context API]
A -->|Fork| D[Approach C: Zustand]
B --> E[Compare Results]
C --> E
D --> E
Use Cases:
Requirements: OpenCode ≥ 0.15.18
Add to your opencode.json or ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-sessions"]
}
OpenCode auto-installs plugins on startup.
Pin to a specific version:
{
"plugin": ["opencode-sessions@x.y.z"]
}
Check installed version:
cat ~/.cache/opencode/node_modules/opencode-sessions/package.json | grep version
Force update to latest:
rm -rf ~/.cache/opencode && opencode
session({
text: string, // Required - message to send
mode: string, // Required - "message" | "new" | "compact" | "fork"
agent?: string // Optional - target agent name
})
The plugin automatically discovers your configured agents:
// Built-in agents (always available):
- build - // Full development capabilities with all tools
- plan - // Analysis and planning (read-only tools)
// Plus any custom agents from your configuration
- researcher - // Research and investigation
- implement - // Implementation-focused
Use Tab in OpenCode to see all available agents.
// Build agent implements
session({
mode: "message",
agent: "build",
text: "Implemented the user authentication system",
})
// Build passes to plan for review
session({
mode: "message",
agent: "plan",
text: "Review the authentication implementation for security issues",
})
// Plan provides feedback, passes back to build
session({
mode: "message",
agent: "build",
text: "Address the CSRF vulnerability mentioned above",
})
// Phase 1: Research (clean start)
session({
mode: "new",
agent: "researcher",
text: "Research best practices for API rate limiting in 2025",
})
// Phase 2: Planning (clean handoff)
session({
mode: "new",
agent: "plan",
text: "Design a rate limiting system based on the research",
})
// Phase 3: Implementation (clean handoff)
session({
mode: "new",
agent: "build",
text: "Implement the rate limiting system per the plan",
})
// After extensive back-and-forth implementation discussion...
// Compress and hand off to plan for architectural review
session({
mode: "compact",
agent: "plan",
text: "Review the overall architecture we've built so far",
})
// Plan sees:
// [Compacted history of implementation]
// User: [Compacting session - plan agent will respond after completion]
// User: Review the overall architecture we've built so far
// Current session: discussing database choice
// Fork A: Try PostgreSQL approach
session({
mode: "fork",
agent: "build",
text: "Implement data layer using PostgreSQL with Prisma",
})
// Fork B: Try MongoDB approach
session({
mode: "fork",
agent: "build",
text: "Implement data layer using MongoDB with Mongoose",
})
// Fork C: Try serverless approach
session({
mode: "fork",
agent: "build",
text: "Implement data layer using DynamoDB",
})
// Each fork explores independently with full context
// Compare results using <leader>l to switch between sessions
When you call the session tool with mode: "message" or mode: "compact":
session.idle event fires after the session unlocksThis pattern ensures:
Agents don't interrupt each other. Each agent gets a complete turn to:
This creates structured collaboration rather than chaotic multi-agent interference.
Arguments:
| Argument | Type | Required | Description |
|---|---|---|---|
text | string | ✅ Yes | Message to send |
mode | enum | ✅ Yes | Operation mode: "message" | "new" | "compact" | "fork" |
agent | string | ❌ No | Target agent name (defaults to current agent) |
Returns: Status message describing the operation
Mode Details:
| Mode | Creates New Session | Agent Switching | Context Preserved | Use Case |
|---|---|---|---|---|
message | No | Yes | Yes | Agent collaboration |
new | Yes | Yes | No | Phase transitions |
compact | No | Yes | Compressed | Token optimization |
fork | Yes (child) | Yes | Yes | Parallel exploration |
Tool not appearing?
ls ~/.cache/opencode/node_modules/opencode-sessionsAgent switching not working?
Session operations failing?
Contributions welcome! See CONTRIBUTING.md for guidelines.
MIT - see LICENSE
Not affiliated with Anthropic or OpenCode.
This is an independent open-source project.
Made with ❤️ for the OpenCode community
FAQs
Session management plugin for OpenCode with multi-agent collaboration support
The npm package opencode-sessions receives a total of 181 weekly downloads. As such, opencode-sessions popularity was classified as not popular.
We found that opencode-sessions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.