anomalyco / anomalyco/opencode
Allow bounded parent directory verification without listing contents
@nexxeln is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The shell tool instructions require ls before any command that creates files or directories. When the parent has many children, this can emit a very large result even though the agent only needs to verify that the parent exists and is a directory.
For existence/type-only checks, the prompt should allow a bounded probe such as test -d "$parent" or stat. It should keep ls when child names are actually needed and retain path quoting and wrong-parent checks.
The current wording is in packages/opencode/src/tool/shell/prompt.ts:81-83.
Plugins
opencode-aidevops
OpenCode version
1.18.28
Steps to reproduce
- Use a parent directory containing many children.
- Ask the agent to create a file beneath that existing parent.
- Observe that the Bash tool instructions require
lsfirst, enumerating all children. - Compare with
test -d "$parent", which verifies the required existence/type condition without listing contents.
Screenshot and/or share link
Not applicable.
Operating System
macOS
Terminal
OpenCode TUI
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.