Allow separate config directory and working directory in SDK #4291

Open
opened 2026-02-16 17:43:18 -05:00 by yindo · 1 comment
Owner

Originally created by @gilisho on GitHub (Jan 6, 2026).

Originally assigned to: @thdxr on GitHub.

Problem

When using the OpenCode SDK programmatically, there's no clean way to specify where custom tools, plugins, and agent files are located when they're in a different directory from where code is being generated.

Use Case

I'm building a code generation service that:

  • Has custom tools, plugins, and agents in my package's .opencode/ directory
  • Generates code into other given output directories

I need the SDK to load config (tools+agents+plugins) from one location while writing generated code to another.

Proposed Solution

Add an explicit outputPath option to createOpencodeServer():

const server = await sdk.createOpencodeServer({
outputPath: "/path/to/where/my/code/should/be/generated",
});

Environment

  • OpenCode SDK version: 1.0.184
Originally created by @gilisho on GitHub (Jan 6, 2026). Originally assigned to: @thdxr on GitHub. ### Problem When using the OpenCode SDK programmatically, there's no clean way to specify where custom tools, plugins, and agent files are located when they're in a different directory from where code is being generated. ### Use Case I'm building a code generation service that: - Has custom tools, plugins, and agents in my package's `.opencode/` directory - Generates code into other given output directories I need the SDK to load config (tools+agents+plugins) from one location while writing generated code to another. ### Proposed Solution Add an explicit `outputPath` option to `createOpencodeServer()`: const server = await sdk.createOpencodeServer({ outputPath: "/path/to/where/my/code/should/be/generated", }); ### Environment - OpenCode SDK version: 1.0.184
Author
Owner

@github-actions[bot] commented on GitHub (Jan 6, 2026):

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

  • #3321: [FEATURE]: Add cwd option to createOpencodeServer - This feature request also addresses SDK working directory configuration, though it focuses on cwd rather than separate config and output directories.

Feel free to ignore if your specific case requires separation of config directory from output path rather than just setting a working directory.

@github-actions[bot] commented on GitHub (Jan 6, 2026): This issue might be a duplicate of existing issues. Please check: - #3321: [FEATURE]: Add `cwd` option to `createOpencodeServer` - This feature request also addresses SDK working directory configuration, though it focuses on `cwd` rather than separate config and output directories. Feel free to ignore if your specific case requires separation of config directory from output path rather than just setting a working directory.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4291