anomalyco / anomalyco/opencode

Allow bounded parent directory verification without listing contents

Open
#47,380 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. Use a parent directory containing many children.
  2. Ask the agent to create a file beneath that existing parent.
  3. Observe that the Bash tool instructions require ls first, enumerating all children.
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.