[PR #5228] [CLOSED] feat: Add File Search agent skill #5362

Closed
opened 2026-06-05 15:21:07 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5228
Author: @angelplusultra
Created: 3/18/2026
Status: Closed

Base: masterHead: feat-file-search-agent-tool


📝 Commits (10+)

  • f4682cc initialize file search tool
  • 1357586 migrate native file searching to ripgrep
  • 33fa168 simplify logic
  • 146e740 implement result pattern
  • 8b4f120 simplify file search plugin and add comments
  • 61543e8 comment out max depth limit and add example of recent files requests
  • cca045f improve tool description
  • 258e1b8 change development storage path to /anythingllm-files
  • 6c7a54d remove max search depth comments
  • 383b4e8 merge master

📊 Changes

9 files changed (+645 additions, -2 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 docker/Dockerfile (+4 -2)
📝 frontend/src/locales/en/common.js (+5 -0)
📝 frontend/src/pages/Admin/Agents/skills.js (+9 -0)
📝 server/.gitignore (+1 -0)
📝 server/package.json (+1 -0)
server/utils/agents/aibitat/plugins/file-search.js (+574 -0)
📝 server/utils/agents/aibitat/plugins/index.js (+3 -0)
📝 server/yarn.lock (+47 -0)

📄 Description

Pull Request Type

  • feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

resolves #

Description

Adds a new File Search agent skill that allows the agent to search and read files from a mounted file storage directory (/anythingllm-files in Docker, <repo>/anythingllm-files in development).

How it works:

  • The agent receives search_terms, optional file_types, and max_results parameters from user queries
  • Files are discovered and searched using ripgrep (@vscode/ripgrep) for fast filename listing and content searching
  • Results are ranked using a multi-strategy scoring system: filename match (+2), path match (+1), content match (+3), and a recency bonus for files modified within the last 7 days (+1)
  • File content is extracted through the existing collector document parsing pipeline, supporting all formats the collector already handles (PDF, DOCX, XLSX, etc.)
  • Token-aware output budgets context per file and will truncate or summarize if the total exceeds the model's context limit
  • A wildcard * search term returns all files sorted by recency

How @vscode/ripgrep works:

  • The package has a postinstall hook that downloads a platform-specific prebuilt ripgrep binary
  • The binary is stored at server/node_modules/@vscode/ripgrep/bin/rg
  • The package exports rgPath which points to this binary — no app-level ripgrep installation required

Security:

  • Path traversal protection via isWithin() validation on all resolved paths
  • Search is sandboxed to the configured FILE_SEARCH_PATH only

Changes:

  • New plugin: server/utils/agents/aibitat/plugins/file-search.js
  • Registered in plugin index with slug alias
  • Frontend skill toggle added to Admin > Agents settings
  • Dockerfile updated to create and own /anythingllm-files directory in both build stages
  • Added @vscode/ripgrep dependency

Translations PR: #5229

Visuals (if applicable)

Additional Information

  • File content extraction reuses the collector's /parse endpoint, so parsed files land in direct-uploads/ and are cleaned up by the existing orphan job
  • The skill reports citations for each file whose content is extracted

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated (if applicable)
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/5228 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 3/18/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feat-file-search-agent-tool` --- ### 📝 Commits (10+) - [`f4682cc`](https://github.com/Mintplex-Labs/anything-llm/commit/f4682cca0cc8e9185519f78f1094ea8f60c178ad) initialize file search tool - [`1357586`](https://github.com/Mintplex-Labs/anything-llm/commit/135758616a4f8579297eac61df1c8a1c75a784e3) migrate native file searching to ripgrep - [`33fa168`](https://github.com/Mintplex-Labs/anything-llm/commit/33fa168854428495e17fbba96cfedbf06ffdc704) simplify logic - [`146e740`](https://github.com/Mintplex-Labs/anything-llm/commit/146e740328258a983d013ecad43004e853dcbe73) implement result pattern - [`8b4f120`](https://github.com/Mintplex-Labs/anything-llm/commit/8b4f1206973090fa4168d6ba7b18e352e93fc584) simplify file search plugin and add comments - [`61543e8`](https://github.com/Mintplex-Labs/anything-llm/commit/61543e80fff19b626e61ceecfb9cf05bb71d8e1b) comment out max depth limit and add example of recent files requests - [`cca045f`](https://github.com/Mintplex-Labs/anything-llm/commit/cca045f20e8c38a47d881f4396cc882b918f307a) improve tool description - [`258e1b8`](https://github.com/Mintplex-Labs/anything-llm/commit/258e1b8d3383d8cba711f46054b1fc5afb996f00) change development storage path to <repo>/anythingllm-files - [`6c7a54d`](https://github.com/Mintplex-Labs/anything-llm/commit/6c7a54dbd0f9f4adafec82c98a7d5203d2b5cbc5) remove max search depth comments - [`383b4e8`](https://github.com/Mintplex-Labs/anything-llm/commit/383b4e8d478659109ef8d2620446b95b7208fcd3) merge master ### 📊 Changes **9 files changed** (+645 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `docker/Dockerfile` (+4 -2) 📝 `frontend/src/locales/en/common.js` (+5 -0) 📝 `frontend/src/pages/Admin/Agents/skills.js` (+9 -0) 📝 `server/.gitignore` (+1 -0) 📝 `server/package.json` (+1 -0) ➕ `server/utils/agents/aibitat/plugins/file-search.js` (+574 -0) 📝 `server/utils/agents/aibitat/plugins/index.js` (+3 -0) 📝 `server/yarn.lock` (+47 -0) </details> ### 📄 Description ### Pull Request Type - [x] ✨ feat (New feature) - [ ] 🐛 fix (Bug fix) - [ ] ♻️ refactor (Code refactoring without changing behavior) - [ ] 💄 style (UI style changes) - [ ] 🔨 chore (Build, CI, maintenance) - [ ] 📝 docs (Documentation updates) ### Relevant Issues resolves # ### Description Adds a new **File Search** agent skill that allows the agent to search and read files from a mounted file storage directory (`/anythingllm-files` in Docker, `<repo>/anythingllm-files` in development). **How it works:** - The agent receives `search_terms`, optional `file_types`, and `max_results` parameters from user queries - Files are discovered and searched using [ripgrep](https://github.com/BurntSushi/ripgrep) (`@vscode/ripgrep`) for fast filename listing and content searching - Results are ranked using a multi-strategy scoring system: filename match (+2), path match (+1), content match (+3), and a recency bonus for files modified within the last 7 days (+1) - File content is extracted through the existing collector document parsing pipeline, supporting all formats the collector already handles (PDF, DOCX, XLSX, etc.) - Token-aware output budgets context per file and will truncate or summarize if the total exceeds the model's context limit - A wildcard `*` search term returns all files sorted by recency **How `@vscode/ripgrep` works:** - The package has a postinstall hook that downloads a platform-specific prebuilt ripgrep binary - The binary is stored at `server/node_modules/@vscode/ripgrep/bin/rg` - The package exports `rgPath` which points to this binary — no app-level ripgrep installation required **Security:** - Path traversal protection via `isWithin()` validation on all resolved paths - Search is sandboxed to the configured `FILE_SEARCH_PATH` only **Changes:** - New plugin: `server/utils/agents/aibitat/plugins/file-search.js` - Registered in plugin index with slug alias - Frontend skill toggle added to Admin > Agents settings - Dockerfile updated to create and own `/anythingllm-files` directory in both build stages - Added `@vscode/ripgrep` dependency Translations PR: #5229 ### Visuals (if applicable) <!-- Add screenshots of the skill toggle in the Agents settings UI --> ### Additional Information - File content extraction reuses the collector's `/parse` endpoint, so parsed files land in `direct-uploads/` and are cleaned up by the existing orphan job - The skill reports citations for each file whose content is extracted ### Developer Validations - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated (if applicable) - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:21:07 -04:00
yindo closed this issue 2026-06-05 15:21:07 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5362