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
Glob tool does not match files under dot directories #32669
The glob tool appears to skip files under dot directories, even when the pattern explicitly includes the dot directory name.
In my workspace, .ai/current-task.md exists and can be read directly, but glob returns no matches.
Plugins
No response
OpenCode version
1.17.7
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal
Reacted by Robert Dailey, Milan Simek, German Swan, Millio345 and Peter Davis
This issue might be a duplicate of or related to existing issues. Please check:
glob tool respects .gitignore #31994: The glob tool skips files matching .gitignore patterns — dot directories like .ai/ may also be affected by the same underlying rg invocation not passing --hidden by default, which causes files under hidden directories to be silently excluded.
I traced through the code and I think the fix is straightforward.
The grep tool already passes --hidden unconditionally to ripgrep (packages/core/src/ripgrep.ts, line ~224), so it searches dot directories without issues. The glob tool does not, even though the plumbing supports it.
In packages/core/src/ripgrep.ts, the glob method conditionally adds --hidden only when input.hidden is truthy (line ~163):
...(input.hidden ? ["--hidden"] : []),
But the glob tool in packages/core/src/tool/glob.ts (line ~75) never passes hidden: true:
returnyield*ripgrep.glob({
cwd,pattern: input.pattern,limit: input.limit??Number.MAX_SAFE_INTEGER,// hidden is not set, defaults to false})
Adding hidden: true to that call would fix it. .git is already excluded separately via --glob=!**/.git/**.
From a19209c658e65d5840278860380bcc661e230b09 Mon Sep 17 00:00:00 2001
From: user <[email protected]>
Date: Wed, 1 Jul 2026 12:33:41 +0300
Subject: [PATCH] hidden search
---
packages/core/src/tool/glob.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/packages/core/src/tool/glob.ts b/packages/core/src/tool/glob.ts
index ea27dfe88..b55625aab 100644
--- a/packages/core/src/tool/glob.ts
+++ b/packages/core/src/tool/glob.ts
@@ -14,9 +14,9 @@ import { Tools } from "./tools"
export const name = "glob"
export const Input = Schema.Struct({
- pattern: FileSystem.GlobInput.fields.pattern.annotate({ description: "Glob pattern to match files against" }),
+ pattern: FileSystem.GlobInput.fields.pattern.annotate({ description: "Glob pattern to match files against. Do not include paths to hidden directories; use 'path' instead." }),
path: RelativePath.pipe(Schema.optional).annotate({
- description: "Relative directory to search. Defaults to the active Location.",
+ description: "Relative directory to search. Defaults to the active Location. Required for searching in hidden directories.",
}),
limit: FileSystem.GlobInput.fields.limit.annotate({
description: "Maximum results to return",
@@ -44,7 +44,7 @@ export const layer = Layer.effectDiscard(
.register({
[name]: Tool.make({
description:
- "Find files by glob pattern within the active Location. Returns concise relative file resources. Use a relative path to narrow the search and limit to bound the result count.",
+ "Find files by glob pattern within the active Location. Returns concise relative file resources. Use a relative path to narrow the search and limit to bound the result count. NOTE: To find files in hidden directories (e.g., starting with '.'), you MUST use 'path' instead of including them in the 'pattern'.",
input: Input,
output: Output,
toModelOutput: ({ output }) => [
--
2.43.0
From 4c93a1ca17c43ccdf0b317b072af46e6bd4b04ce Mon Sep 17 00:00:00 2001
From: user <[email protected]>
Date: Wed, 1 Jul 2026 13:54:20 +0300
Subject: [PATCH] glob instruction
---
packages/opencode/src/tool/glob.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/opencode/src/tool/glob.txt b/packages/opencode/src/tool/glob.txt
index 9c01f3d50..9a85d3810 100644
--- a/packages/opencode/src/tool/glob.txt
+++ b/packages/opencode/src/tool/glob.txt
@@ -2,5 +2,6 @@
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
- Returns matching file paths
- Use this tool when you need to find files by name patterns
+- ⚠️ CRITICAL: To search in hidden directories (e.g., starting with '.'), you MUST use the 'path' parameter instead of including them in the 'pattern'. Using a path in the pattern for hidden folders will return no results.
- When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
--
2.43.0
Activity
github-actions commentedon Jun 17, 2026
This issue might be a duplicate of or related to existing issues. Please check:
.gitignorepatterns — dot directories like.ai/may also be affected by the same underlyingrginvocation not passing--hiddenby default, which causes files under hidden directories to be silently excluded.rcdailey commentedon Jun 27, 2026
I traced through the code and I think the fix is straightforward.
The grep tool already passes
--hiddenunconditionally to ripgrep (packages/core/src/ripgrep.ts, line ~224), so it searches dot directories without issues. The glob tool does not, even though the plumbing supports it.In
packages/core/src/ripgrep.ts, theglobmethod conditionally adds--hiddenonly wheninput.hiddenis truthy (line ~163):But the glob tool in
packages/core/src/tool/glob.ts(line ~75) never passeshidden: true:Adding
hidden: trueto that call would fix it..gitis already excluded separately via--glob=!**/.git/**.sergDash commentedon Jul 1, 2026
sergDash commentedon Jul 1, 2026
github-actions commentedon Aug 31, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.