Spaces:
Build error
Build error
Commit History
-
fix(learn): pass explicit model in tests to avoid API key requirement
SessionAnalyzer() without a model calls _detect_default_model() which raises when no API keys are set (e.g., in CI). Pass model="test-model" in the three tests that mock _call_llm.a6eefcc -
feat: add `headroom perf` CLI and rewrite `headroom learn` to use LLM analysis
Proxy performance logging (`headroom perf`): - Add always-on RotatingFileHandler to ~/.headroom/logs/proxy.log (10MB x 5 backups) - Replace scattered log lines with structured PERF lines containing model, msgs, tok_before/after/saved, cache_read/write/hit_pct, opt_ms, and transforms - Emit PERF lines from all three response paths (streaming Anthropic, non-streaming Anthropic, Bedrock streaming) - Add `headroom perf` CLI that parses proxy logs and reports token savings, cache hit rates, prefix stability, transform effectiveness, routing breakdown, TOIN status, and actionable recommendations - Support --hours and --raw flags for time filtering and raw record output Learn module rewrite (LLM-based analysis): - Replace all regex/heuristic analyzers with a single LLM call via LiteLLM - New SessionAnalyzer builds compact digests and sends to any of 100+ models - Auto-detect best model from API keys (Anthropic → OpenAI → Gemini) - Add --model flag for explicit model selection - Enric…62d80bc
-
Add multi-agent support, quality gates, and integration tests for headroom learn
- Codex adapter: CodexScanner reads ~/.codex/sessions/*.json, CodexWriter writes to AGENTS.md + instructions.md. Tested on 328 real sessions. - Gemini writer: GeminiWriter writes to GEMINI.md (scanner deferred, sessions stored in protobuf). - CLI --agent flag: auto-detect available agents or specify claude/codex/gemini. - Quality gates: min_evidence, min_confidence, min_total_evidence thresholds prevent weak signals from writing noise to project files. - Integration tests against real Claude Code and Codex session data on disk. Tests skip gracefully if data directories don't exist. - Bash path extraction for Codex (reads files via sed/cat, not Read tool). - Idempotency, false positive filtering, and skip-write-on-empty tests.297230c
-
Add headroom learn: offline failure learning for coding agents
Analyzes past conversation history to find tool call failure patterns, correlates each failure with what eventually succeeded, and writes specific project-level learnings to CLAUDE.md and MEMORY.md. Key design: - Success correlation: extracts the diff between failed and successful inputs as the learning (not generic advice) - Generic architecture: tool-agnostic ToolCall model with pluggable Scanner/Writer adapters (Claude Code first, extensible to Cursor/Codex) - 5 analyzers: Environment, Structure, Commands, Retries, Cross-Session - Dry-run by default, --apply to write, --all for all projects Also fixes mypy errors in litellm_callback, asgi, langchain chat_model, and anthropic provider (AsyncClient typing, ToolCall arg-type, int cast).c14b9ac