Budget setup
Daily and weekly spend caps, dual-layer enforcement, and what happens when you hit a cap.
Set the caps
# in your shell profile: export SENKANI_BUDGET_DAILY=5.00 export SENKANI_BUDGET_WEEKLY=25.00
Or in ~/.senkani/config.json:
{{
"budget": {{
"daily_usd": 5.00,
"weekly_usd": 25.00
}}
}}
How enforcement fires
Before every tool call, the PreToolUse hook queries costForToday() and costForWeek() from the session DB. If either exceeds the cap, the hook denies the call with a structured message the agent sees.
Dual-layer
Enforcement runs at both the hook AND the MCP server — the agent can't bypass by switching to built-in tools. See three-layer stack.
Reset
Daily resets at midnight local. Weekly resets Monday 00:00 local. There's no manual reset — the cap is a ceiling on lifetime spend, not a bank.
Monitor
senkani stats
Shows lifetime totals plus current-day / current-week spend against each cap.
What happens when you hit a cap
The agent gets a denial message like:
Budget exceeded: daily cap $5.00 reached at $5.04.
Tool call denied. To continue today, raise SENKANI_BUDGET_DAILY or wait until midnight.
The agent typically stops cleanly and tells you. It's not a silent failure.