agentcap-cli 0.5.2__tar.gz → 0.5.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/PKG-INFO +49 -14
  2. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/README.md +48 -13
  3. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/landing/v2/README.md +4 -3
  4. agentcap_cli-0.5.4/plugin/README.md +90 -0
  5. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/pyproject.toml +1 -1
  6. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/__init__.py +1 -1
  7. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/cli_history.py +24 -1
  8. agentcap_cli-0.5.4/src/agentcap/fixes.py +336 -0
  9. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/quota.py +2 -2
  10. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/waste.py +299 -52
  11. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_agents.py +137 -0
  12. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_cc_plugin.py +61 -0
  13. agentcap_cli-0.5.4/tests/test_fixes.py +166 -0
  14. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/.gitignore +0 -0
  15. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/LICENSE +0 -0
  16. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/codex-plugin/LICENSE +0 -0
  17. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/plugin/LICENSE +0 -0
  18. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/_lifeline_exec.py +0 -0
  19. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/_lifeline_watch.py +0 -0
  20. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/adapters.py +0 -0
  21. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/alerts.py +0 -0
  22. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/analytics.py +0 -0
  23. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/budget.py +0 -0
  24. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/clamp.py +0 -0
  25. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/cli.py +0 -0
  26. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/data/pricing.json +0 -0
  27. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/demo.py +0 -0
  28. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/devtools/__init__.py +0 -0
  29. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/devtools/fake_upstream.py +0 -0
  30. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/estimate.py +0 -0
  31. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/eta.py +0 -0
  32. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/failsafe.py +0 -0
  33. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/harness.py +0 -0
  34. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/history.py +0 -0
  35. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/ledger.py +0 -0
  36. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/license.py +0 -0
  37. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/lifeline.py +0 -0
  38. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/live_quota.py +0 -0
  39. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/logschema.py +0 -0
  40. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/loop.py +0 -0
  41. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/plans.py +0 -0
  42. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/pricing.py +0 -0
  43. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/private.py +0 -0
  44. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/procstop.py +0 -0
  45. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/proxy.py +0 -0
  46. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/report.py +0 -0
  47. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/runner.py +0 -0
  48. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/upstreams.py +0 -0
  49. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/src/agentcap/usage.py +0 -0
  50. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/conftest.py +0 -0
  51. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/agents/claude/projects/-home-dev-shop/sess-p/subagents/agent-a1b2c3.jsonl +0 -0
  52. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/agents/claude/projects/-home-dev-shop/sess-p/subagents/agent-d4e5f6.jsonl +0 -0
  53. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/agents/claude/projects/-home-dev-shop/sess-p.jsonl +0 -0
  54. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/agents/codex/sessions/2026/10/29/rollout-2026-10-29T09-00-00-thr-parent.jsonl +0 -0
  55. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/agents/codex/sessions/2026/10/29/rollout-2026-10-29T09-00-50-thr-child.jsonl +0 -0
  56. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/agents/codex/sessions/2026/10/29/rollout-2026-10-29T09-01-20-thr-fork.jsonl +0 -0
  57. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/harness_logs/agy-1.4.11-2026-10-30.jsonl +0 -0
  58. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/harness_logs/claude-2.1.316-pretooluse.json +0 -0
  59. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/harness_logs/claude-2.1.316-statusline.json +0 -0
  60. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/harness_logs/codex-rollout-2026-10-29.jsonl +0 -0
  61. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/harness_logs/opencode-2026-10-30.jsonl +0 -0
  62. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/history/claude/.credentials.json +0 -0
  63. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/history/claude/projects/-home-dev-shop/1f0c-sess-a.jsonl +0 -0
  64. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/history/codex/auth.json +0 -0
  65. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/history/codex/sessions/2026/10/29/rollout-2026-10-29T10-00-00-0199aaaa-bbbb-cccc-dddd-eeeeeeeeeeee.jsonl +0 -0
  66. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/upstream/README.md +0 -0
  67. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/upstream/anthropic_403_permission_error.json +0 -0
  68. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/upstream/openai_403_region_blocked.json +0 -0
  69. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/upstream/openrouter_401_user_not_found.json +0 -0
  70. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/upstream/openrouter_403_moderation.json +0 -0
  71. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/fixtures/upstream/openrouter_429_rate_limited.json +0 -0
  72. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/license_support.py +0 -0
  73. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/proxy_support.py +0 -0
  74. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_adapters.py +0 -0
  75. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_agent_set.py +0 -0
  76. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_alerts.py +0 -0
  77. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_analytics.py +0 -0
  78. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_anthropic_proxy.py +0 -0
  79. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_anthropic_units.py +0 -0
  80. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_budget.py +0 -0
  81. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_child_status.py +0 -0
  82. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_clamp.py +0 -0
  83. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_claude_adapter_and_tiers.py +0 -0
  84. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_cli.py +0 -0
  85. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_codex_plugin.py +0 -0
  86. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_concurrent_forgive.py +0 -0
  87. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_e2e_claude.py +0 -0
  88. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_estimate.py +0 -0
  89. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_exit_codes.py +0 -0
  90. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_failsafe.py +0 -0
  91. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_harness.py +0 -0
  92. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_history.py +0 -0
  93. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_ledger.py +0 -0
  94. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_license.py +0 -0
  95. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_lifeline.py +0 -0
  96. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_live_quota.py +0 -0
  97. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_log_contract.py +0 -0
  98. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_log_contract_live.py +0 -0
  99. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_loop.py +0 -0
  100. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_plugin_package.py +0 -0
  101. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_pricing.py +0 -0
  102. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_private_dirs.py +0 -0
  103. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_procstop.py +0 -0
  104. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_prompt_block.py +0 -0
  105. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_proxy_auth.py +0 -0
  106. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_proxy_cancel.py +0 -0
  107. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_proxy_core.py +0 -0
  108. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_proxy_extras.py +0 -0
  109. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_proxy_streaming.py +0 -0
  110. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_quota.py +0 -0
  111. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_release.py +0 -0
  112. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_report_cli.py +0 -0
  113. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_runaway.py +0 -0
  114. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_runner.py +0 -0
  115. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_self_approve.py +0 -0
  116. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_stop_matrix.py +0 -0
  117. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_upstream_refusals.py +0 -0
  118. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_upstreams.py +0 -0
  119. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_usage.py +0 -0
  120. {agentcap_cli-0.5.2 → agentcap_cli-0.5.4}/tests/test_zombie_collector.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentcap-cli
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: Local-first quota and cost guard for coding agents: per-job share of Claude Code/Codex/Gemini subscription quota, loop breaker, evidence receipt.
5
5
  Project-URL: Homepage, https://agentcap.launchbench.studio
6
6
  Project-URL: Repository, https://github.com/Blitz00X/agentcap
@@ -39,7 +39,7 @@ tool loops and error streaks.
39
39
  ```text
40
40
  $ agentcap waste --since 7d
41
41
  SUBAGENTS $41.20 25% of spend in 31 subagent/forked threads
42
- OPUS $38.90 24% of spend
42
+ OPUS $38.90 24% of spend (model choice, not counted as waste)
43
43
  CACHE MISSES $6.10 57 cache re-writes after the TTL ran out (5 min since the last request, or 1 h)
44
44
  main session $2.30 21x subagents $3.80 36x
45
45
  Tip: idle subagents re-wrote their own context 36x (~$3.80). Set subagentPromptCacheTtl: "1h" ...
@@ -50,6 +50,37 @@ Pro would have stopped this run at $3.12 / at 4 repeats (Bash x11 in 7f3a91c2, $
50
50
  ```
51
51
  *(illustrative numbers; run it on your own logs, it is read-only)*
52
52
 
53
+ **Try it first, nothing installed.** With [uv](https://docs.astral.sh/uv/), this downloads the
54
+ package into a throwaway environment and reads your local Claude Code / Codex logs. It installs
55
+ no hook, changes no settings, makes no model call and sends nothing anywhere:
56
+
57
+ ```bash
58
+ uvx --from agentcap-cli agentcap waste --since 7d
59
+ ```
60
+
61
+ The hooks, the statusline and the Pro licence come later, only if you install the plugin or the
62
+ command (see "Install").
63
+
64
+ **Where do you keep correcting your agent?** `agentcap fixes` reads the same logs and counts your
65
+ corrections, interrupts, rejected tool calls, churning files and "done" claims with no test run,
66
+ then says which ones to turn into a check (a hook, a permission rule, a test) instead of one more
67
+ line in CLAUDE.md:
68
+
69
+ ```bash
70
+ uvx --from agentcap-cli agentcap fixes --since 30d
71
+ ```
72
+
73
+ ```text
74
+ CORRECTIONS 47 5.3 per 100 of your messages (wrong / undo / stop / still broken)
75
+ right after done 7 the agent said it was finished, your next message corrected it
76
+ INTERRUPTS 67 you stopped a turn
77
+ DONE, NO TEST 14 "done" after editing, no test/lint/build run since the edit
78
+ EDIT CHURN 38 files edited >= 5x in one session
79
+ TURN THESE INTO CHECKS (a check runs every time; a line in CLAUDE.md is only a request)
80
+ 1. 14x "done" after editing with no test/lint/build since -> a Stop hook that runs your test command ...
81
+ ```
82
+ *(our own 30 days; your words appear on your screen only, `--json` has counts and no text)*
83
+
53
84
  ## Stop loops and quota burn (Pro)
54
85
 
55
86
  ```bash
@@ -85,10 +116,13 @@ your subscription quota % and Codex support.
85
116
  approve refused). With whole-percent quota steps a 1.5% limit stops at the next step, 2%.
86
117
  - **Free** runs the same detectors in observe-only mode and prints what Pro would have done.
87
118
 
88
- Honest limits: Claude tool-error streaks are only caught on API-key runs (the subscription hook sees
89
- the call, not its result); the stop can be one request late; quota % is account-level; verified on
90
- fixtures, fake CLIs and real Claude Code hooks; quota stops verified on real Claude Pro and ChatGPT
91
- Plus accounts (see "Supported & tested").
119
+ Honest limits: the stop can be one request late (headless `claude -p` reads `/usage` every 30 s:
120
+ in a live test a 2-point limit ended at 4 points, and a headless turn can exit 0 after a denial);
121
+ quota % is account-level, so other sessions and devices count; macOS is not yet tested on a real
122
+ Mac. Claude tool-error streaks are caught on subscriptions too: the plugin and
123
+ `agentcap run --quota -- claude` both use a `PostToolUseFailure` hook (8 failing calls in a row). Verified on fixtures, fake CLIs and real
124
+ Claude Code hooks; quota stops verified on real Claude Pro and ChatGPT Plus accounts (see
125
+ "Supported & tested").
92
126
 
93
127
  ## The API-key cap
94
128
 
@@ -789,10 +823,11 @@ fingerprint hash (SHA-256; it contains no hostname and no username) to Polar's
789
823
  public licence API at `api.polar.sh`. Free users make no licence requests at
790
824
  all.
791
825
 
792
- ## `agentcap waste` and usage history (Free, new in 0.2)
826
+ ## `agentcap waste`, `agentcap fixes` and usage history (Free)
793
827
 
794
828
  ```bash
795
- agentcap waste # subagent + Opus share, cache misses, tool loops, error streaks ($ each)
829
+ agentcap waste # where it went (new work / checks / rework / loops), subagents, cache misses, streaks
830
+ agentcap fixes # your corrections, interrupts, rejections, churn -> checks to add (Claude Code)
796
831
  agentcap report --by agent # session -> subagent tree with $ and Opus share
797
832
  agentcap import # read-only: ~/.claude/projects, ~/.codex/sessions, AgentCap's ledger
798
833
  agentcap report --by day # Free: day | session | model | project, tokens + API-equivalent $
@@ -846,7 +881,7 @@ steps are noisy. No team aggregation: everything stays on your machine.
846
881
 
847
882
  ## Free vs Pro (0.2)
848
883
 
849
- **Free (MIT License, forever):** the per-run spend cap.
884
+ **Free (MIT License):** the per-run spend cap.
850
885
  - Per-run `--cap` (`--hour-cap` / `--day-cap` exit 2 on Free with a clear message)
851
886
  - Output clamping, fail-closed metering, terminal alerts
852
887
  - Claude Code, Codex, any SDK script (and Gemini CLI)
@@ -855,7 +890,7 @@ steps are noisy. No team aggregation: everything stays on your machine.
855
890
  When the Pro detectors below would have fired on a Free run, AgentCap does not stop it.
856
891
  It prints one line: `Pro's loop breaker would have stopped this at $X.XX`.
857
892
 
858
- **Pro, $12 one-time (launch week; $19 after): stop runs that loop or eat your quota.**
893
+ **Pro, $7 one-time during the beta ($12 after): stop runs that loop or eat your quota.**
859
894
 
860
895
  **Get Pro:** buy at https://agentcap.launchbench.studio/#pricing (Polar checkout). Polar then
861
896
  emails you an **Access purchase** link; the key is in the Polar customer portal (not in the
@@ -880,11 +915,11 @@ The VS Code/Cursor extension and the Claude Code plugin use the same CLI licence
880
915
  `AGENTCAP_RECEIPT_DIR`) with requests, spend, caps, the stop reason and the exit code. It contains
881
916
  numbers only, never prompts. The same one-line receipt is sent to Telegram and the webhook.
882
917
 
883
- [Buy AgentCap Pro — $12 launch week](https://buy.polar.sh/polar_cl_qagsvUdwQ0dRvaW7X5ynEJg5md27pEctIRAr40MBeLi)
918
+ [Buy AgentCap Pro — $7 beta price](https://buy.polar.sh/polar_cl_qagsvUdwQ0dRvaW7X5ynEJg5md27pEctIRAr40MBeLi)
884
919
 
885
920
  ### Purchase terms
886
921
 
887
- - Pro is $12 one-time (launch week; $19 after), no subscription. The current launch-week end date is on the pricing page.
922
+ - Pro is $7 one-time during the beta ($12 after), no subscription.
888
923
  - 14-day no-questions refund — email
889
924
  [kutaykarahan6@gmail.com](mailto:kutaykarahan6@gmail.com).
890
925
  - One licence key activates on up to 3 machines.
@@ -912,7 +947,7 @@ Polar customer portal.
912
947
  | LoopGuard | [tryloopguard.com](https://tryloopguard.com): free MIT CLI that integrates with Claude Code, Codex CLI and Cursor (no proxy, works with subscriptions) with per-session/daily caps and a no-progress loop killer; paid tier ($9/month) adds phone/Slack alerts and remote pause. A good fit if you use subscriptions or Claude Code. |
913
948
  | LiteLLM budgets | Budgets per key, user or team in the LiteLLM proxy; budgets need its database. A good fit if you already run a LiteLLM gateway; it is a server you deploy and configure. |
914
949
  | OpenRouter credit limits / provider spend caps | Account- or key-level and typically monthly (OpenRouter credit limits, OpenAI and Google spend caps). Provider caps are evaluated with a delay — Google has described about 10 minutes for the Gemini API cap — so a fast loop can overshoot. |
915
- | AgentCap | Local proxy for API-key traffic from Claude Code, Codex CLI, Gemini CLI or your own script: run cap (Free) with conservative reservation and output clamping, kills the process group at the cap and prints why. Pro (unattended pack): hour/day caps, loop/burn breaker, Telegram/webhook alerts, spend receipt, $19 one-time. |
950
+ | AgentCap | Local proxy for API-key traffic from Claude Code, Codex CLI, Gemini CLI or your own script: run cap (Free) with conservative reservation and output clamping, kills the process group at the cap and prints why. Pro (unattended pack): hour/day caps, loop/burn breaker, Telegram/webhook alerts, spend receipt, $7 one-time during the beta ($12 after). |
916
951
 
917
952
  The comparison above is from public pages; see the RelayPlane detail below.
918
953
 
@@ -953,7 +988,7 @@ prices and reported usage; when usage is missing it charges the full reservation
953
988
  **Is the day cap shared across machines?** No. Hour/day caps are per machine
954
989
  (local SQLite ledger). A license covers 3 machines, each with its own budget.
955
990
 
956
- **What does one-time purchase include?** $12 once in launch week ($19 after), all 0.x updates; not a
991
+ **What does one-time purchase include?** $7 once during the beta ($12 after), all 0.x updates; not a
957
992
  promise of future major versions. 14-day refund window per purchase terms.
958
993
 
959
994
  ## License
@@ -9,7 +9,7 @@ tool loops and error streaks.
9
9
  ```text
10
10
  $ agentcap waste --since 7d
11
11
  SUBAGENTS $41.20 25% of spend in 31 subagent/forked threads
12
- OPUS $38.90 24% of spend
12
+ OPUS $38.90 24% of spend (model choice, not counted as waste)
13
13
  CACHE MISSES $6.10 57 cache re-writes after the TTL ran out (5 min since the last request, or 1 h)
14
14
  main session $2.30 21x subagents $3.80 36x
15
15
  Tip: idle subagents re-wrote their own context 36x (~$3.80). Set subagentPromptCacheTtl: "1h" ...
@@ -20,6 +20,37 @@ Pro would have stopped this run at $3.12 / at 4 repeats (Bash x11 in 7f3a91c2, $
20
20
  ```
21
21
  *(illustrative numbers; run it on your own logs, it is read-only)*
22
22
 
23
+ **Try it first, nothing installed.** With [uv](https://docs.astral.sh/uv/), this downloads the
24
+ package into a throwaway environment and reads your local Claude Code / Codex logs. It installs
25
+ no hook, changes no settings, makes no model call and sends nothing anywhere:
26
+
27
+ ```bash
28
+ uvx --from agentcap-cli agentcap waste --since 7d
29
+ ```
30
+
31
+ The hooks, the statusline and the Pro licence come later, only if you install the plugin or the
32
+ command (see "Install").
33
+
34
+ **Where do you keep correcting your agent?** `agentcap fixes` reads the same logs and counts your
35
+ corrections, interrupts, rejected tool calls, churning files and "done" claims with no test run,
36
+ then says which ones to turn into a check (a hook, a permission rule, a test) instead of one more
37
+ line in CLAUDE.md:
38
+
39
+ ```bash
40
+ uvx --from agentcap-cli agentcap fixes --since 30d
41
+ ```
42
+
43
+ ```text
44
+ CORRECTIONS 47 5.3 per 100 of your messages (wrong / undo / stop / still broken)
45
+ right after done 7 the agent said it was finished, your next message corrected it
46
+ INTERRUPTS 67 you stopped a turn
47
+ DONE, NO TEST 14 "done" after editing, no test/lint/build run since the edit
48
+ EDIT CHURN 38 files edited >= 5x in one session
49
+ TURN THESE INTO CHECKS (a check runs every time; a line in CLAUDE.md is only a request)
50
+ 1. 14x "done" after editing with no test/lint/build since -> a Stop hook that runs your test command ...
51
+ ```
52
+ *(our own 30 days; your words appear on your screen only, `--json` has counts and no text)*
53
+
23
54
  ## Stop loops and quota burn (Pro)
24
55
 
25
56
  ```bash
@@ -55,10 +86,13 @@ your subscription quota % and Codex support.
55
86
  approve refused). With whole-percent quota steps a 1.5% limit stops at the next step, 2%.
56
87
  - **Free** runs the same detectors in observe-only mode and prints what Pro would have done.
57
88
 
58
- Honest limits: Claude tool-error streaks are only caught on API-key runs (the subscription hook sees
59
- the call, not its result); the stop can be one request late; quota % is account-level; verified on
60
- fixtures, fake CLIs and real Claude Code hooks; quota stops verified on real Claude Pro and ChatGPT
61
- Plus accounts (see "Supported & tested").
89
+ Honest limits: the stop can be one request late (headless `claude -p` reads `/usage` every 30 s:
90
+ in a live test a 2-point limit ended at 4 points, and a headless turn can exit 0 after a denial);
91
+ quota % is account-level, so other sessions and devices count; macOS is not yet tested on a real
92
+ Mac. Claude tool-error streaks are caught on subscriptions too: the plugin and
93
+ `agentcap run --quota -- claude` both use a `PostToolUseFailure` hook (8 failing calls in a row). Verified on fixtures, fake CLIs and real
94
+ Claude Code hooks; quota stops verified on real Claude Pro and ChatGPT Plus accounts (see
95
+ "Supported & tested").
62
96
 
63
97
  ## The API-key cap
64
98
 
@@ -759,10 +793,11 @@ fingerprint hash (SHA-256; it contains no hostname and no username) to Polar's
759
793
  public licence API at `api.polar.sh`. Free users make no licence requests at
760
794
  all.
761
795
 
762
- ## `agentcap waste` and usage history (Free, new in 0.2)
796
+ ## `agentcap waste`, `agentcap fixes` and usage history (Free)
763
797
 
764
798
  ```bash
765
- agentcap waste # subagent + Opus share, cache misses, tool loops, error streaks ($ each)
799
+ agentcap waste # where it went (new work / checks / rework / loops), subagents, cache misses, streaks
800
+ agentcap fixes # your corrections, interrupts, rejections, churn -> checks to add (Claude Code)
766
801
  agentcap report --by agent # session -> subagent tree with $ and Opus share
767
802
  agentcap import # read-only: ~/.claude/projects, ~/.codex/sessions, AgentCap's ledger
768
803
  agentcap report --by day # Free: day | session | model | project, tokens + API-equivalent $
@@ -816,7 +851,7 @@ steps are noisy. No team aggregation: everything stays on your machine.
816
851
 
817
852
  ## Free vs Pro (0.2)
818
853
 
819
- **Free (MIT License, forever):** the per-run spend cap.
854
+ **Free (MIT License):** the per-run spend cap.
820
855
  - Per-run `--cap` (`--hour-cap` / `--day-cap` exit 2 on Free with a clear message)
821
856
  - Output clamping, fail-closed metering, terminal alerts
822
857
  - Claude Code, Codex, any SDK script (and Gemini CLI)
@@ -825,7 +860,7 @@ steps are noisy. No team aggregation: everything stays on your machine.
825
860
  When the Pro detectors below would have fired on a Free run, AgentCap does not stop it.
826
861
  It prints one line: `Pro's loop breaker would have stopped this at $X.XX`.
827
862
 
828
- **Pro, $12 one-time (launch week; $19 after): stop runs that loop or eat your quota.**
863
+ **Pro, $7 one-time during the beta ($12 after): stop runs that loop or eat your quota.**
829
864
 
830
865
  **Get Pro:** buy at https://agentcap.launchbench.studio/#pricing (Polar checkout). Polar then
831
866
  emails you an **Access purchase** link; the key is in the Polar customer portal (not in the
@@ -850,11 +885,11 @@ The VS Code/Cursor extension and the Claude Code plugin use the same CLI licence
850
885
  `AGENTCAP_RECEIPT_DIR`) with requests, spend, caps, the stop reason and the exit code. It contains
851
886
  numbers only, never prompts. The same one-line receipt is sent to Telegram and the webhook.
852
887
 
853
- [Buy AgentCap Pro — $12 launch week](https://buy.polar.sh/polar_cl_qagsvUdwQ0dRvaW7X5ynEJg5md27pEctIRAr40MBeLi)
888
+ [Buy AgentCap Pro — $7 beta price](https://buy.polar.sh/polar_cl_qagsvUdwQ0dRvaW7X5ynEJg5md27pEctIRAr40MBeLi)
854
889
 
855
890
  ### Purchase terms
856
891
 
857
- - Pro is $12 one-time (launch week; $19 after), no subscription. The current launch-week end date is on the pricing page.
892
+ - Pro is $7 one-time during the beta ($12 after), no subscription.
858
893
  - 14-day no-questions refund — email
859
894
  [kutaykarahan6@gmail.com](mailto:kutaykarahan6@gmail.com).
860
895
  - One licence key activates on up to 3 machines.
@@ -882,7 +917,7 @@ Polar customer portal.
882
917
  | LoopGuard | [tryloopguard.com](https://tryloopguard.com): free MIT CLI that integrates with Claude Code, Codex CLI and Cursor (no proxy, works with subscriptions) with per-session/daily caps and a no-progress loop killer; paid tier ($9/month) adds phone/Slack alerts and remote pause. A good fit if you use subscriptions or Claude Code. |
883
918
  | LiteLLM budgets | Budgets per key, user or team in the LiteLLM proxy; budgets need its database. A good fit if you already run a LiteLLM gateway; it is a server you deploy and configure. |
884
919
  | OpenRouter credit limits / provider spend caps | Account- or key-level and typically monthly (OpenRouter credit limits, OpenAI and Google spend caps). Provider caps are evaluated with a delay — Google has described about 10 minutes for the Gemini API cap — so a fast loop can overshoot. |
885
- | AgentCap | Local proxy for API-key traffic from Claude Code, Codex CLI, Gemini CLI or your own script: run cap (Free) with conservative reservation and output clamping, kills the process group at the cap and prints why. Pro (unattended pack): hour/day caps, loop/burn breaker, Telegram/webhook alerts, spend receipt, $19 one-time. |
920
+ | AgentCap | Local proxy for API-key traffic from Claude Code, Codex CLI, Gemini CLI or your own script: run cap (Free) with conservative reservation and output clamping, kills the process group at the cap and prints why. Pro (unattended pack): hour/day caps, loop/burn breaker, Telegram/webhook alerts, spend receipt, $7 one-time during the beta ($12 after). |
886
921
 
887
922
  The comparison above is from public pages; see the RelayPlane detail below.
888
923
 
@@ -923,7 +958,7 @@ prices and reported usage; when usage is missing it charges the full reservation
923
958
  **Is the day cap shared across machines?** No. Hour/day caps are per machine
924
959
  (local SQLite ledger). A license covers 3 machines, each with its own budget.
925
960
 
926
- **What does one-time purchase include?** $12 once in launch week ($19 after), all 0.x updates; not a
961
+ **What does one-time purchase include?** $7 once during the beta ($12 after), all 0.x updates; not a
927
962
  promise of future major versions. 14-day refund window per purchase terms.
928
963
 
929
964
  ## License
@@ -13,9 +13,10 @@ python3 -m http.server 8787
13
13
 
14
14
  ## What is here
15
15
 
16
- - `index.html` — the page. No build step, no framework, no trackers.
17
- - `style.css` — the whole design.
18
- - `script.js` — the copy-to-clipboard button only.
16
+ - `index.html` — the page (new design 26 November 2026; plain three-part hero and quota meter 27 November). No build step, no framework. Cookieless Umami from the same origin (`/u/script.js`).
17
+ - `landing.css` — the page design. No inline styles: the live CSP is `style-src 'self'; script-src 'self'`.
18
+ - `app.js` — the hero quota meter, the usage / quota / loop demo, tabs and copy buttons. Sets widths through CSSOM, never `style=""` attributes.
19
+ - `style.css` / `script.js` — the previous design, still used by `privacy/`.
19
20
  - `fonts.css` / `fonts/` — self-hosted Instrument Serif and IBM Plex.
20
21
  - `agentcap-0.2.0.vsix` — served from the site root, not from this folder.
21
22
 
@@ -0,0 +1,90 @@
1
+ # AgentCap for Claude Code
2
+
3
+ Stop a Claude Code session before it loops or eats your Max/Pro quota.
4
+
5
+ AgentCap watches every tool call through Claude Code hooks. It warns, and on Pro ends the turn,
6
+ when a session reaches its share of your weekly or 5-hour quota, repeats the same tool call 4 times
7
+ in a row, or fails 8 tool calls in a row. Every stop says why, in plain numbers.
8
+
9
+ ## Install
10
+
11
+ ```
12
+ /plugin marketplace add Blitz00X/agentcap
13
+ /plugin install agentcap@agentcap
14
+ /agentcap:setup # once: adds AgentCap's read-only statusLine (your own line keeps showing)
15
+ ```
16
+
17
+ Needs `python3` on PATH. No pip install, no account, no network access.
18
+
19
+ ## Use
20
+
21
+ ```
22
+ /agentcap:quota 5% # this session may use 5 more points of the weekly quota
23
+ /agentcap:quota 2% 5h # or 2 more points of the 5-hour window
24
+ /agentcap:quota until 70% 5h # or stop when the 5-hour window reaches 70%
25
+ /agentcap:status # where this session stands and where it stops
26
+ /agentcap:default 10% 5h # give every new session (also claude -p) a limit; `off` removes it
27
+ /agentcap:approve # Pro, after a stop: raise the limit by 50% (at most twice)
28
+ /agentcap:off # clear this session's limit
29
+ /agentcap:unsetup # restore your previous statusLine and delete AgentCap's settings backup
30
+ ```
31
+
32
+ You can also ask in plain words. Claude Code shows a permission prompt with the stop point, and
33
+ the limit is set only after you approve:
34
+
35
+ - "Use at most 10% of the weekly quota in this session."
36
+ - "Stop when the 5-hour limit reaches 70%."
37
+ - "Why did AgentCap stop my last turn?"
38
+
39
+ The agent may only set or tighten a limit. Raising it, clearing it and approving a stop stay
40
+ yours: AgentCap denies any tool call by the agent that would run its script or edit its state.
41
+
42
+ ## Free and Pro
43
+
44
+ - **Free (MIT):** the live quota meter, a warning at 80% of the limit, and one notice when a limit,
45
+ a loop or an error streak is reached ("AgentCap Pro would stop the agent here"). Nothing is
46
+ blocked.
47
+ - **Pro ($7 one-time during the beta, $12 after):** the same detectors end the turn
48
+ (`PreToolUse` deny with `continue: false`), block new prompts while the session is over its
49
+ limit, and write a receipt. Pro is unlocked by a licence key that you activate with the separate
50
+ `agentcap` CLI (`pipx install agentcap-cli`, then `agentcap license activate`). Buy at
51
+ https://agentcap.launchbench.studio/#pricing. 14-day refund.
52
+
53
+ ## What the plugin runs, changes, stores and sends
54
+
55
+ - **Runs:** `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/agentcap_cc.py` on SessionStart,
56
+ UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure and Stop, and for the slash
57
+ commands above. Standard library only. While a limit is set it may start
58
+ `claude -p /usage` in the background, at most every 30 seconds, to read the current quota
59
+ (a local Claude Code command; no model call). Its statusLine command also runs your previous
60
+ user-level statusLine command, unchanged, so your own line keeps showing.
61
+ - **Changes:** `/agentcap:setup` sets only the `statusLine` key in `~/.claude/settings.json` and
62
+ keeps an owner-only backup of that file (`settings.json.agentcap-backup`).
63
+ `/agentcap:unsetup` restores your previous statusLine and deletes the backup.
64
+ - **Stores, on your machine only** (`~/.local/state/agentcap/quota/`): session ids, quota
65
+ percentages and reset times, counters, the tool name and a 16-character hash of each tool call,
66
+ and receipts (numbers and the last tool name). Never prompts, tool inputs, tool output, tokens or
67
+ credentials. Loop counters are deleted after 7 days, session files after 30 days, receipts after
68
+ 90 days.
69
+ - **Reads:** the `rate_limits` values Claude Code passes to the statusLine, Claude Code's own
70
+ `/usage` output, and the licence file `~/.config/agentcap/license.json` if it exists.
71
+ - **Sends:** nothing. The plugin makes no network requests. The separate `agentcap` CLI checks a
72
+ Pro key with Polar's licence API about once a week; Free users make no licence requests at all.
73
+
74
+ Privacy policy: https://agentcap.launchbench.studio/privacy
75
+
76
+ ## Limits
77
+
78
+ - The quota % is account-level: other sessions, devices and claude.ai use in the same window count
79
+ against this session's limit.
80
+ - A stop can be one response (or one 30-second `/usage` check) late, so a session can pass its
81
+ limit by a few points.
82
+ - macOS and Windows are not tested yet; Windows needs WSL.
83
+
84
+ ## Support
85
+
86
+ - Issues: https://github.com/Blitz00X/agentcap/issues
87
+ - Security reports: https://github.com/Blitz00X/agentcap/security/policy
88
+ - Source and the full CLI documentation: https://github.com/Blitz00X/agentcap
89
+
90
+ MIT License. Copyright (c) 2026 Kutay Karahan.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "agentcap-cli"
7
- version = "0.5.2"
7
+ version = "0.5.4"
8
8
  description = "Local-first quota and cost guard for coding agents: per-job share of Claude Code/Codex/Gemini subscription quota, loop breaker, evidence receipt."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -2,6 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "0.5.2"
5
+ __version__ = "0.5.4"
6
6
 
7
7
  __all__ = ["__version__"]
@@ -47,6 +47,16 @@ def register(subparsers: argparse._SubParsersAction) -> None:
47
47
  wst.add_argument("--top", type=int, default=3)
48
48
  wst.add_argument("--json", action="store_true")
49
49
 
50
+ fx = subparsers.add_parser(
51
+ "fixes", help="where you keep correcting your agent, and what to turn into a check (Free, read-only)"
52
+ )
53
+ fx.add_argument("--since", default="30d", help="all, 7d, 24h or YYYY-MM-DD (default 30d)")
54
+ fx.add_argument("--claude-dir", type=Path, help="default ~/.claude/projects")
55
+ fx.add_argument("--top", type=int, default=3)
56
+ fx.add_argument("--examples", type=int, default=5, help="latest corrections to show (0: none)")
57
+ fx.add_argument("--json", action="store_true", help="counts only; add --include-text for your words")
58
+ fx.add_argument("--include-text", action="store_true", help="with --json: include the first 70 characters")
59
+
50
60
  bud = subparsers.add_parser("budget", help="set task/hour/day $ caps and per-job quota %% in one place")
51
61
  bsub = bud.add_subparsers(dest="budget_action")
52
62
  bset = bsub.add_parser("set", help="set or change budget values (others are kept)")
@@ -180,7 +190,20 @@ def dispatch(args: argparse.Namespace) -> int | None:
180
190
  return 2
181
191
  rep = waste.scan(since=since, claude_dir=args.claude_dir, codex_dir=args.codex_dir)
182
192
  period = "all time" if since is None else f"since {args.since}"
183
- print(waste.render_json(rep) if args.json else waste.render(rep, period, args.top))
193
+ print(waste.render_json(rep) if args.json
194
+ else waste.render(rep, period, args.top, color=waste.color_enabled(sys.stdout)))
195
+ return 0
196
+ if args.subcommand == "fixes":
197
+ from . import fixes
198
+ try:
199
+ since = report.parse_since(args.since)
200
+ except ValueError as exc:
201
+ print(f"agentcap: {exc}", file=sys.stderr)
202
+ return 2
203
+ rep = fixes.scan(since=since, claude_dir=args.claude_dir)
204
+ period = "all time" if since is None else f"since {args.since}"
205
+ print(fixes.render_json(rep, args.include_text) if args.json
206
+ else fixes.render(rep, period, args.top, max(args.examples, 0)))
184
207
  return 0
185
208
  if args.subcommand == "import":
186
209
  _do_import(args, history.HistoryStore(args.db))