Skip to content

Added recursive AGENTS.md loading from child dirs - #952

Closed
opencode-agent[bot] wants to merge 1 commit into
devfrom
opencode/issue847-20250713_205033
Closed

Added recursive AGENTS.md loading from child dirs#952
opencode-agent[bot] wants to merge 1 commit into
devfrom
opencode/issue847-20250713_205033

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

I've successfully implemented recursive loading of AGENTS.md files from child folders. Here's what I did:

Changes Made:

  1. Added findDown function in /home/runner/work/opencode/opencode/packages/opencode/src/util/filesystem.ts:69-84:

    • Searches for files recursively in child directories using Bun's glob functionality
    • Includes a configurable maxDepth parameter (default: 3) to prevent performance issues
    • Uses the pattern **/${target} to find files at any depth
  2. Updated custom() function in /home/runner/work/opencode/opencode/packages/opencode/src/session/system.ts:53-84:

    • Now searches both upward (existing functionality) and downward (new functionality) for AGENTS.md files
    • Maintains backward compatibility with existing behavior
    • Limits search depth to 3 levels to avoid performance issues in large codebases

Key Features:

  • Backward Compatible: Existing upward search functionality remains unchanged
  • Performance Optimized: Limited to 3 levels of depth by default to prevent scanning entire large codebases
  • Comprehensive Coverage: Now finds AGENTS.md files in:
    • Current directory and parent directories (existing)
    • Child directories up to 3 levels deep (new)
    • Global config directory (existing)
    • Home directory .claude folder (existing)

Testing:

The implementation was tested and verified to correctly find AGENTS.md files at different directory levels, respecting the depth limit parameter.

This should resolve the issue where AGENTS.md files in child folders were being ignored, allowing for more granular project-specific instructions at different directory levels.

Closes#847

view session | view log

Co-authored-by: thdxr <thdxr@users.noreply.github.com>
@opencode-agentopencode-agentBot mentioned this pull request Jul 13, 2025
@adamdotdevin
adamdotdevin requested a review from thdxrJuly 14, 2025 12:06
teamgroove pushed a commit to teamgroove/opencode that referenced this pull request Aug 3, 2025
…dirs
Merged from: anomalyco#952
Author: @opencode-agent[bot]
Auto-merged by opencode-fork integration system
@github-actions
github-actionsBotforce-pushed the dev branch 3 times, most recently from f1dc981 to 3e15a39CompareNovember 22, 2025 18:07
@github-actions
github-actionsBotforce-pushed the dev branch 3 times, most recently from f8ee907 to 6a9856dCompareNovember 27, 2025 01:29
@thdxr
thdxrforce-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7CompareJanuary 30, 2026 14:37
@thdxrthdxr closed this Feb 1, 2026
@thdxr
thdxr deleted the opencode/issue847-20250713_205033 branch February 1, 2026 03:30
andreipromarketing-dev pushed a commit to andreipromarketing-dev/opencode that referenced this pull request Apr 7, 2026
docs: refine ecc2 analysis report recommendations
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGENTS.md is being ignored.

1 participant

@thdxr