Skip to main content
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
# or
pip install laghav[cli]
# or
brew install laghav

Setup

bash
laghav config set api-key lgh_live_...
laghav config set aggressiveness 0.6 # default aggressiveness
laghav config show # verify
# Test connection
laghav test

laghav analyze — find expensive prompts

bash
# Analyze a single file
laghav analyze src/agent.py
# Recursive scan of a directory
laghav analyze ./src --recursive
# Output as JSON for CI integration
laghav analyze ./src --json > report.json
# Fail CI if any prompt exceeds 1000 tokens
laghav analyze ./src --fail-on-large-prompt 1000

Example output:

bash
Found 3 prompts in src/agent.py
Line 24: system_prompt 284 tokens $0.00426/call -68% possible ⚠
Line 48: user_prompt 63 tokens $0.00094/call -62% possible
Line 71: error_context 1240 tokens $0.01860/call -94% possible ⚠
Total: 1,587 tokens · $0.0238/run
After optimization: 480 tokens · $0.0072/run
Est. monthly savings (1,000 calls/day): $490

laghav compress — pipe-friendly compression

bash
# Compress from stdin
echo "Hey I wanted to ask you if..." | laghav compress
# Compress a file
laghav compress --file prompt.txt
# Pipe to clipboard (macOS)
laghav compress --quiet prompt.txt | pbcopy
# Set aggressiveness
laghav 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 usage
laghav stats --today # same
laghav stats --month # this month
laghav 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.