mahawi1992
700dca22b0
feat(mcp): Add context engineering optimizations (#481)
Reduce context window usage by ~80-90% through:
1. Lazy Tool Schema Loading
- discover_tools(): List tool names only (~500 bytes vs ~15KB)
- get_tool_info(name): Get specific tool details on-demand
2. Minimal Issue Models
- IssueMinimal: Lightweight model for list views (~80 bytes vs ~400 bytes)
- Full Issue model preserved for show() command
3. Result Compaction
- Auto-compact results with >20 issues
- Returns preview (5 items) + total count + hint
- Prevents unbounded context growth
4. Documentation
- Updated CONTEXT_ENGINEERING.md with patterns and examples
Context savings:
- Tool schemas: 97% reduction (15KB → 500 bytes)
- List 50 issues: 80% reduction (20KB → 4KB)
- Ready work: 80% reduction (4KB → 800 bytes)
Inspired by MCP Bridge (github.com/mahawi1992/mwilliams_mcpbridge)
and Manus context engineering patterns.
Co-authored-by: Heal Smartly <marty@MacBook-Pro.local>