GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [FEATURE]: Add systemPrompt option to SDK like Claude Agent SDK · Issue #7351 · anomalyco/opencode

[FEATURE]: Add systemPrompt option to SDK like Claude Agent SDK #7351

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[FEATURE]: Add systemPrompt option to SDK like Claude Agent SDK#7351
Copy link
Assignees
thdxr

Description

@ysm-dev
ysm-dev
opened on Jan 8, 2026
Issue body actions

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

Add a systemPrompt option to the OpenCode SDK (@opencode-ai/sdk) that allows developers to directly customize or replace the system prompt, similar to how the Claude Agent SDK (@anthropic-ai/claude-agent-sdk) implements this feature.

Background

The Claude Agent SDK provides flexible system prompt customization through the systemPrompt option:

// Option 1: Complete replacement with custom prompt
for await (const message of query({
  prompt: "Help me write code",
  options: {
    systemPrompt: "You are a Python specialist...",
  },
})) {
  console.log(message);
}

// Option 2: Use preset with append
for await (const message of query({
  prompt: "Help me write code",
  options: {
    systemPrompt: {
      type: "preset",
      preset: "claude_code",
      append: "Always include docstrings and type hints.",
    },
  },
})) {
  console.log(message);
}

Current OpenCode SDK Limitation

Currently, the OpenCode SDK does not provide a direct way to modify the system prompt. Available workarounds include:

  1. Agent configuration with prompt option - Requires file-based configuration
  2. AGENTS.md files - Project-level only, not programmatic
  3. noReply: true context injection - Only appends to conversation, doesn't modify system prompt

None of these provide the flexibility of directly setting systemPrompt in SDK calls.

Proposed API

import { createOpencode } from "@opencode-ai/sdk";

const { client } = await createOpencode();

// Option 1: Direct system prompt replacement
const session = await client.session.create({
  body: { 
    title: "My session",
    systemPrompt: "You are a specialized assistant for..."
  },
});

// Option 2: Append to default system prompt
const session = await client.session.create({
  body: { 
    title: "My session",
    systemPrompt: {
      type: "preset",
      preset: "default",
      append: "Additional instructions here..."
    }
  },
});

// Option 3: Per-prompt system prompt override
await client.session.prompt({
  path: { id: session.id },
  body: {
    systemPrompt: "Custom system prompt for this interaction",
    parts: [{ type: "text", text: "Hello!" }],
  },
});

Benefits

  1. Programmatic control - Dynamically generate system prompts based on runtime conditions
  2. SDK parity with Claude Agent SDK - Easier migration and consistent developer experience
  3. Flexibility - No need for file-based configuration for simple customizations
  4. Use cases:
    • Building custom agents with specialized behaviors
    • A/B testing different system prompts
    • Multi-tenant applications with different prompts per user/org
    • Reducing token usage by removing unnecessary default instructions

Related Issues

  • Dynamic system prompts for custom agents #3195 - Dynamic system prompts for custom agents
  • [FEATURE]: Allow custom system prompts in global, project or custom directories #7101 - Allow custom prompts in global, project or custom directories
  • add optional system prompt environment injection #1894 - Add optional system prompt environment injection
  • Allow for system prompts for models hosted elsewhere #6105 - Allow for system prompts for models hosted elsewhere

This feature would address many of the concerns raised in these issues from an SDK perspective.

Reacted by jinyang, Tom, Chris Yang, Gary Thung, Filip Sobol, Raúl Fernández Fernández, Ashu, ZheNing Hu and Mohammad Hosein Bahmani

Activity

  1. github-actions
    assigned
    thdxr
    on Jan 8, 2026
  2. github-actions commented on Jan 8, 2026

    @github-actions
    github-actionsBot
    on Jan 8, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • [FEATURE]: Use OpenCode AI as a runtime and have an SDK? Like Claude Agents SDK? #6182: [FEATURE]: Use OpenCode AI as a runtime and have an SDK? Like Claude Agents SDK? - A broader request for SDK parity with Claude Agent SDK, which would include systemPrompt customization
    • add optional system prompt environment injection #1894: add optional system prompt environment injection - Requests optional/customizable system prompt functionality to reduce tokens and increase prompt adherence
    • Dynamic system prompts for custom agents #3195: Dynamic system prompts for custom agents - Earlier request for dynamic system prompt capabilities
    • [FEATURE]: Allow custom system prompts in global, project or custom directories #7101: [FEATURE]: Allow custom prompts in global, project or custom directories - Related feature request for custom prompt configuration

    Feel free to ignore if this issue addresses your specific systemPrompt SDK API design in ways these don't.

  3. monotykamary
    added a commit that references this issue on Feb 17, 2026

    feat(task): allow runtime systemPrompt for subtasks

    4c41eb9
  4. thdxr commented on Mar 25, 2026

    @thdxr
    thdxr
    on Mar 25, 2026
    Member
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. rekram1-node
    closed this as not plannedon May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.