Skip to main content

Overview

The /share command creates a public URL for your OpenCode session that others can view. This allows you to:
  • Share conversations with teammates
  • Get help by showing your session
  • Document problem-solving workflows
  • Create tutorials and examples
  • Collaborate on code reviews

Usage

/share
The command generates a shareable URL:
https://opncd.ai/s/abc123def456

What Gets Shared

Shared sessions include:
  • Full conversation - All messages and responses
  • Tool executions - Commands run and outputs
  • File contexts - Code and files referenced
  • Metadata - Model, agent, timestamps
Shared sessions are public. Anyone with the link can view the content. Don’t share sensitive information.

Viewing Shared Sessions

Recipients can:
  1. Open in browser - View the conversation
  2. Copy messages - Extract code or content
  3. See tool outputs - Understand what was executed
  4. Import session - Load into their OpenCode

Import a Shared Session

Anyone can import a shared session:
opencode import https://opncd.ai/s/abc123def456
This creates a local copy they can continue working with.

Automatic Sharing

Enable automatic sharing for all sessions:

Via Environment Variable

export OPENCODE_AUTO_SHARE=true
opencode

Via Configuration

In opencode.json:
{
  "share": "auto"
}

Via CLI Flag

With the run command:
opencode run --share "Fix the bug in app.ts"
With auto-share enabled, every session is shared automatically and the URL is displayed:
~ https://opncd.ai/s/abc123def456

Disabling Sharing

To prevent sharing in your organization or workspace:

Via Configuration

{
  "share": "disabled"
}
With sharing disabled:
User: /share
Assistant: ! Sharing is disabled in this workspace

Per-Session Control

Sharing can be controlled per session:
{
  "share": "manual"  // Default, requires /share command
}
Options:
  • "auto" - Share all sessions automatically
  • "manual" - Share only when /share is used (default)
  • "disabled" - Prevent all sharing

Privacy Considerations

Shared sessions are publicly accessible. Review content before sharing.

What NOT to Share

Avoid sharing sessions containing:
  • API keys or credentials
  • Private code or intellectual property
  • Personal information (PII)
  • Internal URLs or infrastructure details
  • Confidential business logic
  • Security vulnerabilities (before they’re fixed)

Redacting Sensitive Data

Before sharing:
  1. Review the full conversation
  2. Undo messages with sensitive content
  3. Fork the session and remove sensitive parts
  4. Use environment variables instead of hardcoded secrets

Revoking Shared Sessions

Currently, shared sessions cannot be deleted after creation. Be cautious about what you share.
Future versions may support revoking or editing shared sessions.

Use Cases

Getting Help

Share your session when asking for help:
User: /share
User: [copies link]

# In Slack/Discord:
"I'm stuck on this error. Here's my OpenCode session: https://opncd.ai/s/..."

Code Review

Share a session showing your problem-solving process:
User: /share
User: "Created PR #123. Here's how we solved it: https://opncd.ai/s/..."

Documentation

Create tutorials by sharing instructional sessions:
User: /share
User: "Tutorial on setting up authentication: https://opncd.ai/s/..."

Bug Reports

Include session links in bug reports:
## Bug Report

**Description**: API endpoint returns 500 error

**Session**: https://opncd.ai/s/abc123def456

OpenCode helped me identify the issue is in the middleware...

Team Collaboration

Share sessions for pair programming:
User: /share

# Team member imports and continues:
opencode import https://opncd.ai/s/abc123def456

Programmatic Sharing

Share sessions via the API:
import { createOpencodeClient } from '@opencode-ai/sdk/v2'

const client = createOpencodeClient({
  baseUrl: 'http://localhost:4096'
})

const result = await client.session.share({
  sessionID: 'session-id'
})

console.log(result.data.share.url)
// https://opncd.ai/s/abc123def456

Share URL Format

Share URLs follow this pattern:
https://opncd.ai/s/<slug>
              │   │
              │   └─ Unique session identifier
              └───── Share path
The slug is:
  • Unique per session
  • URL-safe (alphanumeric + hyphens)
  • Permanent (doesn’t expire)

Import Command

Import shared sessions locally:
# From URL
opencode import https://opncd.ai/s/abc123def456

# Or just the slug
opencode import abc123def456
This:
  1. Downloads the session data
  2. Creates a local session
  3. Preserves all messages and context
  4. Allows you to continue the conversation

Import Options

You can also import from files:
# From local JSON file
opencode import session.json

# From another session export
opencode export <session-id> > backup.json
opencode import backup.json

Export vs Share

Feature/shareexport
Creates public URL
Exports to file
Requires internet
Public access
Local backup
Use /share for collaboration, export for backups.

Troubleshooting

Sharing Failed

Problem: Cannot create share link Solutions:
  • Check internet connectivity
  • Verify sharing isn’t disabled in config
  • Ensure OpenCode can reach opncd.ai
  • Check firewall/proxy settings

Sharing Disabled

Problem: Sharing is disabled error Solutions:
  • Check opencode.json for "share": "disabled"
  • Remove or change to "manual" or "auto"
  • Contact workspace admin if in enterprise
Problem: Link shows 404 or error Solutions:
  • Verify the URL is complete and correct
  • Check internet connectivity
  • Try opening in incognito/private mode
  • The share service may be temporarily down

Import Failed

Problem: Cannot import shared session Solutions:
  • Verify the URL is valid
  • Check internet connectivity
  • Ensure you have disk space
  • Try importing to a different directory

Enterprise Considerations

For organizations:

Disable Public Sharing

Completely disable sharing:
{
  "share": "disabled"
}

Self-Hosted Sharing

Set up internal sharing service:
{
  "share": {
    "url": "https://opencode-share.internal.company.com",
    "enabled": true
  }
}

Audit Trail

Log all share events:
{
  "audit": {
    "share": true
  }
}

import

Import shared sessions

export

Export sessions to files

Sessions

Managing sessions

Share Config

Configure sharing behavior