Documentation
Integrations
CLI Tool
laghav CLI lets you analyze prompt costs in your codebase, compress from stdin, and route queries — all from the terminal. Perfect for CI pipelines.
Installation
bash
npm install -g laghav# orpip install laghav[cli]# orbrew install laghav
Setup
bash
laghav config set api-key lgh_live_...laghav config set aggressiveness 0.6 # default aggressivenesslaghav config show # verify# Test connectionlaghav test
laghav analyze — find expensive prompts
bash
# Analyze a single filelaghav analyze src/agent.py# Recursive scan of a directorylaghav analyze ./src --recursive# Output as JSON for CI integrationlaghav analyze ./src --json > report.json# Fail CI if any prompt exceeds 1000 tokenslaghav analyze ./src --fail-on-large-prompt 1000
Example output:
bash
Found 3 prompts in src/agent.pyLine 24: system_prompt 284 tokens $0.00426/call -68% possible ⚠Line 48: user_prompt 63 tokens $0.00094/call -62% possibleLine 71: error_context 1240 tokens $0.01860/call -94% possible ⚠Total: 1,587 tokens · $0.0238/runAfter optimization: 480 tokens · $0.0072/runEst. monthly savings (1,000 calls/day): $490
laghav compress — pipe-friendly compression
bash
# Compress from stdinecho "Hey I wanted to ask you if..." | laghav compress# Compress a filelaghav compress --file prompt.txt# Pipe to clipboard (macOS)laghav compress --quiet prompt.txt | pbcopy# Set aggressivenesslaghav compress --aggressiveness 0.8 prompt.txt
laghav route — inspect routing
bash
echo "Summarize this quarterly report" | laghav route# Output:# Category: analytical# Model: claude-haiku-3# Confidence: 0.94# Reason: faq_pattern# Savings: 98% vs Opus
Usage statistics
bash
laghav stats # today's usagelaghav stats --today # samelaghav stats --month # this monthlaghav stats --app fara-agent # filter by app
✦GitHub Actions integration
Use
laghav analyze ./src --fail-on-large-prompt 1000 --json in CI to automatically flag expensive prompts on every PR. See the GitHub Action (coming in Phase 3) for automatic PR comments.