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
Can't run tools in OpenCode Desktop - tools executed from / instead of project cwd #9077
In OpenCode Desktop, tools are executed as if the working directory is / (system root), not the current project directory. This breaks tools that rely on relative paths (e.g. .opencode/tool/**). In OpenCode CLI the same tools run correctly.
Plugins
no plugins
OpenCode version
CLI - 1.1.20, Desktop - 1.1.25
Steps to reproduce
Create an empty project folder.
In the project folder create the tool files: .opencode/tool/python-add.ts
import{tool}from"@opencode-ai/plugin"importpathfrom"path"exportdefaulttool({description: "Add two numbers using Python",args: {a: tool.schema.number().describe("First number"),b: tool.schema.number().describe("Second number"),},asyncexecute(args){constcwd=process.cwd()constscript_path=path.resolve(".opencode/tool/add.py")constp=Bun.spawn(["python3",script_path,String(args.a),String(args.b)],{stdout: "pipe",stderr: "pipe"})conststdout=awaitnewResponse(p.stdout).text()conststderr=awaitnewResponse(p.stderr).text()constexitCode=awaitp.exitedreturn["===TOOL_RAW===",JSON.stringify({ cwd, script_path, stdout, stderr, exitCode },null,2),"===/TOOL_RAW===",].join("\n")}})
@iliferov I think the problem here is that you can't use process.cwd(), you'll need to use ctx.directory (which won't be available until tomorrow's release: a8c18db)
This issue is closed however opencode desktop app on mac still having this problem. When model doesn't provide the path to a tool like grep or glob, the tool defaults to "/" and searches the whole file system, which causes a lot of file permission requests and a lot of cpu usage.
@iliferov I think the problem here is that you can't use process.cwd(), you'll need to use ctx.directory (which won't be available until tomorrow's release: a8c18db)
I confirm it works fine with context.directory. So from 1.1.49 the approach to write a custom tool mentioned in docs works as expected in OpenCode Desktop.
Activity
github-actions commentedon Jan 17, 2026
This issue might be a duplicate of existing issues. Please check:
/.opencode(errno -13) in Plan mode #8389: EACCES permission denied, mkdir /.opencode - symptom showing tools trying to write to root directory instead of projectFeel free to ignore if none of these address your specific case.
neriousy commentedon Jan 17, 2026
I'll try to fix it
adamdotdevin commentedon Jan 27, 2026
@iliferov I think the problem here is that you can't use
process.cwd(), you'll need to usectx.directory(which won't be available until tomorrow's release: a8c18db)pschiel commentedon Jan 28, 2026
Using
path.resolvewill not work on Windows and mixed paths (native, git bash, ..)#6763 normalization is needed for relative and cross-drive mixed paths
ualtinok commentedon Jan 30, 2026
This issue is closed however opencode desktop app on mac still having this problem. When model doesn't provide the path to a tool like grep or glob, the tool defaults to "/" and searches the whole file system, which causes a lot of file permission requests and a lot of cpu usage.
iliferov commentedon Feb 3, 2026
I confirm it works fine with
context.directory. So from 1.1.49 the approach to write a custom tool mentioned in docs works as expected in OpenCode Desktop.Replaced
to
feat(refactor-docs): body transforms, target-aware executor, source p…