-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Labels
discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
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
Feature: Allow sessions to have custom working directories
Problem
Currently, all sessions share the same working directory (Instance.directory). This limits the ability to run multiple sessions in parallel when they need isolated file systems, such as:
- Working on different git branches simultaneously
- Running sessions in sandboxed environments
- Supporting non-standard project layouts
Proposed Solution
- Add a
session.creatingplugin hook - Allow plugins to customize session creation, including setting a custom working directory - Add
Session.directoryaccessor - Allow sessions to have their own working directory that tools respect, falling back toInstance.directoryif not set
Use Cases
- Git worktrees: A plugin could create a separate worktree for each session, enabling parallel work on different branches without conflicts
- Sandboxing: Sessions could operate in isolated directories for security or testing
- Monorepos: Sessions could target different packages within a monorepo
Implementation
I already started playing around to add this feature and opened these two PRs that would complete the feature:
- feat(plugin): add session.creating hook for customizing session creation #9361
- feat(session): add support for per-session working directories #9365
Let me know what you think and thanks for making opencode! 🫡
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion