chore: remove osgrep — disproportionate CPU/disk cost#2168
Conversation
…prehension osgrep consumed 74GB disk (lancedb indexes) and 4 CPU cores on startup for semantic search that rg + fd + the LLM itself covers at zero cost. Removed from: setup, agent generators, dispatch, plugin, prompts, docs, tests, configs, and all 37 affected files. Added one-time cleanup migration (cleanup_osgrep) that runs on next aidevops update to: uninstall npm package, remove ~/.osgrep/ indexes, clean MCP configs from OpenCode and Claude Code settings, and remove per-repo .osgrep directories.
|
Caution Review failedThe pull request is closed. WalkthroughDeprecates and removes osgrep (a local semantic search MCP) from the entire codebase, replacing it with rg/fd for exact-match searching and augment-context-engine for semantic search. Updates documentation, configuration, setup scripts, agent generation logic, and test files to remove osgrep references and add cleanup/migration functions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the system's resource usage by completely deprecating and removing Highlights
Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sun Feb 22 21:17:24 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Code Review
This pull request does a great job of thoroughly removing osgrep from the aidevops framework, which is a significant cleanup to reduce resource consumption. The changes are extensive, touching documentation, setup scripts, agent configurations, and tests, ensuring a complete removal. The addition of the cleanup_osgrep migration function is a thoughtful touch to help users transition smoothly.
My review focuses on the new migration script, where I've found a few areas for improvement to enhance its robustness and correctness, primarily concerning error handling and a bug in a jq query, aligning the code with established repository rules and style guides.
| if [[ -d "$repo_path/.osgrep" ]]; then | ||
| rm -rf "$repo_path/.osgrep" | ||
| fi | ||
| done < <(jq -r '.[]' "$repos_file" 2>/dev/null) |
There was a problem hiding this comment.
The jq query here appears to be incorrect and error suppression might hide issues. The query jq -r '.[]' will iterate over the top-level values of repos.json (the initialized_repos array and git_parent_dirs array), not the individual repository paths. This will cause the cleanup of per-repo .osgrep directories to fail silently.
The correct query should be jq -r '.initialized_repos[].path', which is used elsewhere in the codebase to get repository paths.
Additionally, suppressing stderr with 2>/dev/null violates the repository's style guide (line 50) and project rules, which discourage blanket error suppression and emphasize keeping jq errors visible for debugging, especially for malformed files.
| done < <(jq -r '.[]' "$repos_file" 2>/dev/null) | |
| done < <(jq -r '.initialized_repos[].path' "$repos_file") |
References
2>/dev/nullis acceptable ONLY when redirecting to log files, not for blanket suppression of potential errors. (link)- Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging.
- In shell scripts with 'set -e' enabled, use '|| true' to prevent the script from exiting when a command like 'jq' fails on an optional lookup. Do not suppress stderr with '2>/dev/null' so that actual syntax or system errors remain visible for debugging.
- When reporting errors for failed file operations in shell scripts, such as 'jq' writes, include the file path in the error message. Avoid suppressing stderr with '2>/dev/null' to ensure that diagnostic information about malformed files or write failures is visible.
| # Remove osgrep completely — one-time cleanup for all aidevops users | ||
| # osgrep consumed 74GB disk (lancedb indexes) and 4 CPU cores on startup. | ||
| # rg + fd + LLM comprehension covers the same ground at zero resource cost. | ||
| cleanup_osgrep() { |
There was a problem hiding this comment.
This function creates temporary files using mktemp (e.g., on lines 99 and 115) but does not set up a trap for cleanup on exit. This violates the repository style guide (line 33), which requires trap cleanup for temp files to prevent them from being left behind on unexpected script termination.
As per the project's established pattern for resource cleanup, please use _save_cleanup_scope, trap '_run_cleanups' RETURN, and push_cleanup for robust cleanup on any exit path. Also, consider including explicit manual cleanup at the end of the normal execution path as a 'fast-path'. Adding cleanup logic will make the script more robust.
References
- Temp files must have
trapcleanup (RETURN or EXIT) to ensure they are removed even if the script exits unexpectedly. (link) - For resource cleanup in shell scripts, use the established project pattern: use
_save_cleanup_scope,trap '_run_cleanups' RETURN, andpush_cleanupfor robust cleanup on any exit path, and also include explicit manual cleanup at the end of the normal execution path as a 'fast-path'.
| if jq -e '.mcp["osgrep"]' "$opencode_config" >/dev/null 2>&1; then | ||
| local tmp_file | ||
| tmp_file=$(mktemp) | ||
| if jq 'del(.mcp["osgrep"]) | del(.tools["osgrep_*"])' "$opencode_config" >"$tmp_file" 2>/dev/null; then |
There was a problem hiding this comment.
Suppressing stderr with 2>/dev/null can hide important jq parsing errors if the opencode.json file is malformed. This violates the repository style guide (line 50) and project rules, which discourage blanket error suppression and emphasize keeping jq errors visible for debugging. The if statement will correctly handle a non-zero exit code from jq, so removing the redirection will make the script more robust by allowing error messages to be visible for debugging.
| if jq 'del(.mcp["osgrep"]) | del(.tools["osgrep_*"])' "$opencode_config" >"$tmp_file" 2>/dev/null; then | |
| if jq 'del(.mcp["osgrep"]) | del(.tools["osgrep_*"])' "$opencode_config" >"$tmp_file"; then |
References
2>/dev/nullis acceptable ONLY when redirecting to log files, not for blanket suppression of potential errors. (link)- Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging.
- In shell scripts with 'set -e' enabled, use '|| true' to prevent the script from exiting when a command like 'jq' fails on an optional lookup. Do not suppress stderr with '2>/dev/null' so that actual syntax or system errors remain visible for debugging.
- When reporting errors for failed file operations in shell scripts, such as 'jq' writes, include the file path in the error message. Avoid suppressing stderr with '2>/dev/null' to ensure that diagnostic information about malformed files or write failures is visible.
| if jq -e '.mcpServers["osgrep"] // .enabledPlugins["osgrep@osgrep"]' "$claude_settings" >/dev/null 2>&1; then | ||
| local tmp_file | ||
| tmp_file=$(mktemp) | ||
| if jq 'del(.mcpServers["osgrep"]) | del(.enabledPlugins["osgrep@osgrep"])' "$claude_settings" >"$tmp_file" 2>/dev/null; then |
There was a problem hiding this comment.
Similar to the previous comment, suppressing stderr with 2>/dev/null here can hide jq errors if settings.json is malformed. This violates the repository style guide (line 50) and project rules, which discourage blanket error suppression and emphasize keeping jq errors visible for debugging. Please remove the redirection to allow potential errors to be visible for easier debugging.
| if jq 'del(.mcpServers["osgrep"]) | del(.enabledPlugins["osgrep@osgrep"])' "$claude_settings" >"$tmp_file" 2>/dev/null; then | |
| if jq 'del(.mcpServers["osgrep"]) | del(.enabledPlugins["osgrep@osgrep"])' "$claude_settings" >"$tmp_file"; then |
References
2>/dev/nullis acceptable ONLY when redirecting to log files, not for blanket suppression of potential errors. (link)- Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging.
- In shell scripts with 'set -e' enabled, use '|| true' to prevent the script from exiting when a command like 'jq' fails on an optional lookup. Do not suppress stderr with '2>/dev/null' so that actual syntax or system errors remain visible for debugging.
- When reporting errors for failed file operations in shell scripts, such as 'jq' writes, include the file path in the error message. Avoid suppressing stderr with '2>/dev/null' to ensure that diagnostic information about malformed files or write failures is visible.



Summary
rg+fd+ LLM comprehension covers at zero resource costcleanup_osgrepmigration that runs on nextaidevops updateto uninstall the npm package, remove~/.osgrep/(74GB), and clean MCP configs from OpenCode/Claude Code settingsrg/fdprimary, Augment Context Engine for semantic, Glob as last resortChanges
Deleted (3 files):
.agents/tools/context/osgrep.md— subagent docconfigs/mcp-templates/osgrep.json— MCP templateconfigs/osgrep-config.json.txt— config templateInfrastructure (critical path):
setup-modules/migrations.sh— addedcleanup_osgrep()function + deprecated path entrysetup-modules/mcp-setup.sh— removedsetup_osgrep()functionsetup.sh— removed osgrep setup step.agents/scripts/generate-opencode-agents.sh— removed from EAGER_MCPS, AGENT_TOOLS, DEFAULT_TOOLS; added cleanup of existing configs.agents/scripts/generate-claude-agents.sh— removed MCP registration and plugin enablement.agents/scripts/supervisor/dispatch.sh— removed from worker MCP exclusion lists (no longer needed).agents/plugins/opencode-aidevops/index.mjs— removed from MCP registryDocs/Config (34 files total, net -905 lines):
Testing
bash -nsyntax checkindex.mjspassesnode --checkSummary by CodeRabbit
Release Notes
Removals
Updates
Chores