April 7, 2026
2 pull requests merged across 1 repo
bahdotsh/indxr
- Replace
sh -cinvocation insrc/llm/command.rswithshlex::split()+ direct execution to prevent shell metacharacter injection via--execflag andINDXR_LLM_COMMANDenv var - Add
shlexas a direct dependency (already a transitive dep) - Commands with arguments (e.g.
my-llm --model gpt4) still work correctly via shlex tokenization
Closes #23
Test plan
-
cargo clippy --features wiki— clean -
cargo fmt— clean -
cargo test— all 358 tests pass - Manual:
indxr wiki generate --exec 'echo test; echo injected'fails to find binary instead of executing injection
- Adds
FailurePatternstruct to wiki page frontmatter for recording failed fix attempts (symptom, attempted_fix, diagnosis, actual_fix, source_files, timestamps) - New
wiki_record_failureMCP tool with auto-routing to best matching wiki page via existingscore_pages(), or creates a new topic page - Extends
wiki_contributewithfailuresandresolve_failuresparams (mirrors existing contradiction resolution pattern) - Enhances
wiki_searchto score against failure symptoms and surface failure counts in results (+include_failures: truefor full details) - Enhances
wiki_readandwiki_statusto display failure data
Motivation
When AI agents fail at fixing issues, that failure context is lost when the conversation ends. The next agent starts from scratch and may repeat the same mistakes. This feature lets agents record structured failure patterns into the wiki so future agents can learn from past failures before attempting similar fixes.
Changes
| File | Changes |
|---|---|
src/wiki/page.rs | FailurePattern struct, failures field on Frontmatter, 2 new tests |
src/wiki/mod.rs | Preserve failures in compound_into_wiki |
src/wiki/generate.rs | Add failures field to 3 Frontmatter constructions |
src/mcp/tools.rs | wiki_record_failure tool def + impl, wiki_contribute extension, wiki_search/wiki_read/wiki_status enhancements |
src/mcp/mod.rs | Dispatch + import for wiki_record_failure |
src/mcp/tests.rs | 12 new tests, fixture updates, tool count assertion |
CLAUDE.md | Document new tool (#34), update tool count |
Test plan
-
cargo build --features wikicompiles cleanly -
cargo build(without wiki) compiles cleanly -
cargo test --features wiki— all 432 unit + 7 integration = 439 tests pass - New tests cover: auto-routing, explicit page targeting, new page creation, missing params, contribute with failures, failure resolution, search counts/symptoms/include_failures flag, read display
- Manual MCP test: start server, call
wiki_record_failure, verify viawiki_search/wiki_read/wiki_status