Skip to content

Open-source, local-first AI agent for real work.

1.1 KB
Raw Blame
export const TREE_TOOL_DESCRIPTION = `Render a compact directory tree for a path, with explicit node types and counts:
- [D] for directories (with immediate child counts: d:<dirs>, f:<files>)
- [F] for files
- Each rendered node also includes a stable path ID like \`id=@PATH_0001\`

ALWAYS use this tool, not shell tree/find/ls -R, when you need a directory structure overview.
Use path IDs directly as tool path arguments to avoid filename mutation by the model.

When to use \`dir_tree\` vs other tools:
- Use \`dir_tree\` FIRST when you need a high-level map of a codebase with minimal token usage, then drill down with \`read\`/\`glob\`/\`grep\`
- Use \`glob\` to find files by path or name pattern
- Use \`grep\` to search for text inside files
- NEVER use bash commands (tree, find, ls -R) for directory structure — always use this tool

Performance and safety:
- Uses fd for fast cross-platform scanning (macOS/Linux/Windows)
- Respects .gitignore by default
- Supports maxDepth and node limits to avoid context explosion
- Truncates output when size limits are hit`;