This guide provides best practices and specialized tools for AI coding agents working on Context Sherpa. By following these guidelines, agents can achieve expert-level accuracy while maintaining extreme token efficiency.
Before reading any file, an agent must establish context using symbolic and structural signals. This prevents "hallucinations" and keeps context windows lean.
- Rule: ALWAYS prefer
search_definitionsorget_symbol_map(SCIP) overgrep_search. - Reason: SCIP understands the logical relationships between files, whereas grep is just text matching.
- Efficiency: Symbolic searches pinpoint the exact line, avoiding the need to "hunt" through files.
- Rule: If a file is >100 lines, NEVER call
view_fileorread_filewithout first callinglist_symbols_in_filewithdistill: true. - Reason: The "distilled" summary provides a categorized table of contents and a semantic overview.
- Efficiency: You can identify the relevant 5% of a file and only read those specific line ranges.
- Rule: Use
ast_grep_scanfor exact code patterns (e.g., "all functions with a database parameter"). - Reason: It uses the Abstract Syntax Tree (AST), making it far more accurate than regex for complex code shapes.
Found in the .agents/skills/ directory, these skills extend an agent's capabilities:
- Architectural Grounding: Safely explores large entry-point files.
- Symbolic Index Synchronization: Ensures your "Big Brain" symbolic map is current after refactors.
Found in the .agents/workflows/ directory:
- /efficient-research: A 4-tier process for navigating unknown codebases with maximum precision and minimum token cost.
- Summarize Before Returning: Before sending a large block of code (>500 tokens) back to your main logic loop, use
summarize_code_intent. - Surgical Reads: Limit
view_fileto 50-100 lines at a time. If you need more, you probably haven't distilled the file enough. - Tiered Inference: Use local models (Tier 2) for "noisy" work like code distillation or semantic triage, reserving Tier 3 (Gemini/Claude) for high-level strategy.