You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom tools don't receive project directory in ToolContext #10477
Custom tools defined via @opencode-ai/plugin have no way to access the project's working directory at execution time. The ToolContext passed to execute() contains sessionID, messageID, agent, abort, callID, extra, metadata(), and ask() - but no directory or worktree.
This works fine when running opencode directly in a project directory (where process.cwd() happens to be correct), but fails when using opencode web as a daemon serving multiple projects.
Steps to reproduce
Run opencode web as a daemon (e.g., via launchd with a fixed WorkingDirectory)
Create a custom tool that needs the project directory:
import{tool}from"@opencode-ai/plugin";exportdefaulttool({description: "Get git status",args: {},asyncexecute(args,context){// context has no directory property// process.cwd() returns the daemon's cwd, not the projectconstresult=awaitBun.$`git status`.text();returnresult;},});
Open a project in the web UI and invoke the tool
The tool runs in the wrong directory
Debug output
Logging the full context and environment from a custom tool shows:
Activity
github-actions commentedon Jan 25, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
adamdotdevin commentedon Jan 27, 2026
This will be resolved in today's release:
a8c18db
1f93138