agentcap-cli 0.3.1__tar.gz → 0.4.0__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 (113) hide show
  1. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/PKG-INFO +76 -22
  2. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/README.md +75 -21
  3. agentcap_cli-0.4.0/landing/v2/README.md +68 -0
  4. agentcap_cli-0.4.0/plugin/LICENSE +21 -0
  5. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/pyproject.toml +1 -1
  6. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/__init__.py +1 -1
  7. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/alerts.py +25 -1
  8. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/cli.py +27 -5
  9. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/harness.py +63 -3
  10. agentcap_cli-0.4.0/src/agentcap/live_quota.py +251 -0
  11. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/quota.py +735 -40
  12. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/conftest.py +6 -0
  13. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_cc_plugin.py +93 -0
  14. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_harness.py +55 -4
  15. agentcap_cli-0.4.0/tests/test_live_quota.py +531 -0
  16. agentcap_cli-0.4.0/tests/test_plugin_package.py +112 -0
  17. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_procstop.py +40 -0
  18. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_proxy_auth.py +1 -1
  19. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_quota.py +357 -10
  20. agentcap_cli-0.4.0/tests/test_stop_matrix.py +292 -0
  21. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/.gitignore +0 -0
  22. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/LICENSE +0 -0
  23. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/_lifeline_exec.py +0 -0
  24. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/_lifeline_watch.py +0 -0
  25. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/adapters.py +0 -0
  26. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/analytics.py +0 -0
  27. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/budget.py +0 -0
  28. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/clamp.py +0 -0
  29. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/cli_history.py +0 -0
  30. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/data/pricing.json +0 -0
  31. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/demo.py +0 -0
  32. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/devtools/__init__.py +0 -0
  33. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/devtools/fake_upstream.py +0 -0
  34. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/estimate.py +0 -0
  35. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/eta.py +0 -0
  36. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/failsafe.py +0 -0
  37. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/history.py +0 -0
  38. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/ledger.py +0 -0
  39. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/license.py +0 -0
  40. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/lifeline.py +0 -0
  41. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/logschema.py +0 -0
  42. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/loop.py +0 -0
  43. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/plans.py +0 -0
  44. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/pricing.py +0 -0
  45. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/private.py +0 -0
  46. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/procstop.py +0 -0
  47. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/proxy.py +0 -0
  48. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/report.py +0 -0
  49. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/runner.py +0 -0
  50. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/upstreams.py +0 -0
  51. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/usage.py +0 -0
  52. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/src/agentcap/waste.py +0 -0
  53. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/agents/claude/projects/-home-dev-shop/sess-p/subagents/agent-a1b2c3.jsonl +0 -0
  54. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/agents/claude/projects/-home-dev-shop/sess-p/subagents/agent-d4e5f6.jsonl +0 -0
  55. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/agents/claude/projects/-home-dev-shop/sess-p.jsonl +0 -0
  56. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/agents/codex/sessions/2026/10/29/rollout-2026-10-29T09-00-00-thr-parent.jsonl +0 -0
  57. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/agents/codex/sessions/2026/10/29/rollout-2026-10-29T09-00-50-thr-child.jsonl +0 -0
  58. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/agents/codex/sessions/2026/10/29/rollout-2026-10-29T09-01-20-thr-fork.jsonl +0 -0
  59. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/harness_logs/agy-1.4.11-2026-10-30.jsonl +0 -0
  60. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/harness_logs/claude-2.1.316-pretooluse.json +0 -0
  61. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/harness_logs/claude-2.1.316-statusline.json +0 -0
  62. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/harness_logs/codex-rollout-2026-10-29.jsonl +0 -0
  63. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/harness_logs/opencode-2026-10-30.jsonl +0 -0
  64. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/history/claude/.credentials.json +0 -0
  65. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/history/claude/projects/-home-dev-shop/1f0c-sess-a.jsonl +0 -0
  66. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/history/codex/auth.json +0 -0
  67. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/history/codex/sessions/2026/10/29/rollout-2026-10-29T10-00-00-0199aaaa-bbbb-cccc-dddd-eeeeeeeeeeee.jsonl +0 -0
  68. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/upstream/README.md +0 -0
  69. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/upstream/anthropic_403_permission_error.json +0 -0
  70. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/upstream/openai_403_region_blocked.json +0 -0
  71. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/upstream/openrouter_401_user_not_found.json +0 -0
  72. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/upstream/openrouter_403_moderation.json +0 -0
  73. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/fixtures/upstream/openrouter_429_rate_limited.json +0 -0
  74. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/license_support.py +0 -0
  75. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/proxy_support.py +0 -0
  76. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_adapters.py +0 -0
  77. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_agents.py +0 -0
  78. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_alerts.py +0 -0
  79. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_analytics.py +0 -0
  80. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_anthropic_proxy.py +0 -0
  81. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_anthropic_units.py +0 -0
  82. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_budget.py +0 -0
  83. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_child_status.py +0 -0
  84. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_clamp.py +0 -0
  85. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_claude_adapter_and_tiers.py +0 -0
  86. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_cli.py +0 -0
  87. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_concurrent_forgive.py +0 -0
  88. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_e2e_claude.py +0 -0
  89. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_estimate.py +0 -0
  90. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_exit_codes.py +0 -0
  91. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_failsafe.py +0 -0
  92. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_history.py +0 -0
  93. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_ledger.py +0 -0
  94. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_license.py +0 -0
  95. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_lifeline.py +0 -0
  96. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_log_contract.py +0 -0
  97. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_log_contract_live.py +0 -0
  98. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_loop.py +0 -0
  99. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_pricing.py +0 -0
  100. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_private_dirs.py +0 -0
  101. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_proxy_cancel.py +0 -0
  102. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_proxy_core.py +0 -0
  103. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_proxy_extras.py +0 -0
  104. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_proxy_streaming.py +0 -0
  105. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_release.py +0 -0
  106. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_report_cli.py +0 -0
  107. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_runaway.py +0 -0
  108. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_runner.py +0 -0
  109. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_self_approve.py +0 -0
  110. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_upstream_refusals.py +0 -0
  111. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_upstreams.py +0 -0
  112. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/tests/test_usage.py +0 -0
  113. {agentcap_cli-0.3.1 → agentcap_cli-0.4.0}/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.3.1
3
+ Version: 0.4.0
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
@@ -75,17 +75,20 @@ your subscription quota % and Codex support.
75
75
  proxy also catches identical requests and `--max-burn` $/min spikes.
76
76
  - **Per-job quota %.** Stop one job at its share of the account's weekly or 5-hour limit.
77
77
  - **Evidence receipt.** Each stop prints and saves why (`same tool call 4 times in a row (Bash)`,
78
- `this job used 5.1% of the weekly quota`) and the last tool call's name, as numbers and tool
78
+ `the account's weekly quota rose 5.1% while this job ran`) and the last tool call's name, as numbers and tool
79
79
  names only, never prompts or tool inputs.
80
80
  - **Approve.** After a stop, `agentcap approve` (or `/agentcap:approve` in the plugin) raises the
81
81
  limit by 50%, at most twice, and the run continues. This works for interactive Claude Code,
82
82
  which stays open after a stop. Codex and headless `claude -p` jobs are stopped with SIGINT, so
83
83
  there approve only helps before the limit is hit; after a stop it says so and changes nothing.
84
+ Run it from your own shell while the job runs (live Codex test: `1% -> 1.5% -> 2.25%`, the third
85
+ approve refused). With whole-percent quota steps a 1.5% limit stops at the next step, 2%.
84
86
  - **Free** runs the same detectors in observe-only mode and prints what Pro would have done.
85
87
 
86
88
  Honest limits: Claude tool-error streaks are only caught on API-key runs (the subscription hook sees
87
89
  the call, not its result); the stop can be one request late; quota % is account-level; verified on
88
- fixtures, fake CLIs and real Claude Code 2.1.197 hooks, **not yet on a real Max/ChatGPT account.**
90
+ fixtures, fake CLIs and real Claude Code hooks; quota stops verified on real Claude Pro and ChatGPT
91
+ Plus accounts (see "Supported & tested").
89
92
 
90
93
  ## The API-key cap
91
94
 
@@ -279,7 +282,11 @@ The easiest path on a Claude Max or Pro plan. Inside Claude Code:
279
282
  /agentcap:off # clear it; /agentcap:unsetup restores your old statusLine
280
283
  ```
281
284
 
282
- No pip install: the plugin is stdlib Python (`python3` on PATH). How it works:
285
+ No pip install: the plugin is stdlib Python (`python3` on PATH). The marketplace installs only
286
+ the self-contained `plugin/` folder (commands, hooks, the script and the few `agentcap` modules it
287
+ imports), not the whole repo. Contributors: `plugin/` is generated, edit the sources and run
288
+ `python3 scripts/build_plugin.py` (`--check` verifies; `claude --plugin-dir plugin` loads it locally).
289
+ How it works:
283
290
 
284
291
  - Claude Code only exposes the subscription `rate_limits` % to the **statusLine** command, and a
285
292
  plugin can't set the main statusLine. So `/agentcap:setup` asks once and writes it to
@@ -296,13 +303,20 @@ No pip install: the plugin is stdlib Python (`python3` on PATH). How it works:
296
303
  tool calls: 8 in a row stops the agent on Pro (`continue: false`), Free gets a notice.
297
304
  Tool input and output are never stored, only a 16-char hash and counts; these per-session
298
305
  files are deleted after 7 days (on `SessionStart`).
306
+ - `/usage` as well: `/agentcap:quota` takes its baseline from Claude Code's own
307
+ `claude -p /usage` (a local command, no model call, no quota), and while a quota is set the
308
+ `PreToolUse` hook starts a background `/usage` read at most once a minute. The share is the
309
+ higher of the statusline and `/usage` (the statusline lagged `/usage` by 1-2 points in live
310
+ tests, and a stale first value once looked like 1% of use). Without `/usage` the baseline is
311
+ only this session's own statusline reading, never another session's.
299
312
  - Read-only: no OAuth token, credentials file or API traffic is touched.
300
313
 
301
- Honest limits: the % is account-level (parallel sessions count), the stop can be one request
302
- late, and the share updates when the statusLine refreshes. Verified with real Claude Code
303
- 2.1.197 (plugin install from the marketplace, hooks loaded, `/agentcap:quota` executed,
304
- PreToolUse deny blocked the tool) against a local fake API and synthetic `rate_limits`;
305
- **not yet checked against a real Max account.**
314
+ Honest limits: the % is account-level (parallel sessions and other devices count), the stop can
315
+ be one request late (a `/usage` check runs at most once a minute), and the share updates when the
316
+ statusLine refreshes. Verified live on a real Claude Pro account with Claude Code 2.1.323
317
+ (13 Nov 2026): `/agentcap:setup`, `/agentcap:quota 2% 5h` with its baseline from `/usage`,
318
+ the stop at the limit, `/agentcap:approve`, `/agentcap:unsetup`, and the self-guard denying
319
+ `env -u CLAUDECODE agentcap approve` from the model.
306
320
 
307
321
  ## Works with Claude Max / ChatGPT subscriptions (quota mode)
308
322
 
@@ -312,7 +326,7 @@ Quota mode caps **one job's share** of it:
312
326
  ```bash
313
327
  agentcap run --quota 5% -- claude # stop this job after 5% of the weekly quota
314
328
  agentcap run --quota 10% --window 5h -- codex # or 10% of the 5-hour window
315
- agentcap quota # read-only: last seen usage (Free)
329
+ agentcap quota # read-only: current usage, asked from claude/codex (Free)
316
330
  ```
317
331
 
318
332
  - **Read-only, ToS-safe.** AgentCap never proxies, reads or reuses your subscription login
@@ -325,24 +339,64 @@ agentcap quota # read-only: last seen usage (Fre
325
339
  plus a `PreToolUse` hook that denies further tool calls with a clear reason once the job's
326
340
  share reaches the limit and ends the turn (`continue: false`). An interactive session stays open
327
341
  (run `agentcap approve` to continue, or quit); a session where the hook never fired gets
328
- SIGINT. Exit code 3. **Quota % is interactive-only:** headless `claude -p` exposes no usage %
329
- to AgentCap, so `--quota` warns and only the loop/error breakers are active there.
342
+ SIGINT. Exit code 3.
343
+ AgentCap also asks `claude -p /usage` (a local command: no model call, no quota) at start,
344
+ every minute and once after exit. The statusline % and `/usage` differ by one point at both
345
+ ends of a job (live: 26/27 at start, 31/32 at the end), so the statusline is only compared
346
+ with itself, the hook also denies when `/usage` shows the limit first, and the receipt is the
347
+ `/usage` difference (`measured_by: usage`).
348
+ The hook can stop Claude only before a tool call, so one large response overshoots: live, a
349
+ 3% limit ended at 5% after one response with 7 parallel file reads used 3%. Usage on the same
350
+ account from anywhere else (claude.ai, the desktop or phone app, another terminal) counts
351
+ toward the job too. **Headless `claude -p`** has no statusline, so there `/usage` is the only
352
+ source: it is checked every 30 s and the hook ends the run at the limit (SIGINT if it keeps
353
+ going). Usage between two checks can overshoot. If `/usage` does not answer at start,
354
+ `--quota` warns and only the loop/error breakers are active.
330
355
  - **Codex CLI:** AgentCap tails the `token_count` events Codex writes to
331
356
  `~/.codex/sessions/**/rollout-*.jsonl` (`rate_limits.primary/secondary.used_percent`,
332
357
  `window_minutes`, `resets_at`) and sends SIGINT at the limit. Exit code 3.
358
+ The % in a rollout is the value Codex got *with* a response, before that response was
359
+ charged, so it lags one response (live: the rollout said 3% after a job, the server 4%).
360
+ AgentCap therefore also asks Codex's own `codex app-server` (`account/rateLimits/read`, the
361
+ protocol the IDE extension uses; no model call, no quota spent, Codex handles its own login):
362
+ for the baseline at start, every 30 s during the job, and once after the agent exits, so the
363
+ last response is in the receipt (`baseline_live`, `final_live`). If the server does not answer,
364
+ the rollout readings are used as before.
365
+ Codex writes usage only when a model response ends, so one long response (xhigh/max effort
366
+ ran 6+ minutes in our tests) is invisible until it finishes. In quota mode AgentCap therefore
367
+ stops the job when a single response runs longer than `--response-timeout` (default `5m`,
368
+ `off` disables; time spent running tools does not count) and notes xhigh/max effort at start.
369
+ The interrupted response's usage is read before the receipt is written. Exit code 4,
370
+ reason `response_timeout`.
371
+ **Fail-closed (Pro):** if Codex's `token_count` events carry no `rate_limits` (API-key login, a
372
+ changed log format) or `codex exec` writes no session log within 90 s, the job is stopped
373
+ (exit 5); Free only warns. The interactive TUI is never stopped just for being idle.
333
374
  - Baseline at job start (exact when a reading from the last 15 minutes exists, otherwise the
334
375
  first response is not counted), window resets mid-job are handled, 80% warning,
335
- per-job receipt: `this job used 4.2% of the weekly quota`. Pro alerts (Telegram/webhook)
336
- and receipt files work the same as for dollar caps.
376
+ per-job receipt: `the account's weekly quota rose 4.2% while this job ran`. Pro alerts
377
+ (Telegram/webhook) and receipt files work the same as for dollar caps. `agentcap` stopped by
378
+ Ctrl+C, SIGTERM (`timeout`) or SIGHUP (closed terminal) stops the agent and still writes the
379
+ receipt (reason `interrupted` / `terminated`).
380
+ - **`agentcap quota`** asks each agent's own client for the current values: `codex app-server`
381
+ for Codex and `claude -p /usage` for Claude Code (both read-only, no model call). Lines from a
382
+ live answer end in `(live from codex)` / `(live from claude)`; otherwise the last local
383
+ reading is shown with its age. `agentcap quota --local` never starts claude/codex.
384
+ `AGENTCAP_LIVE_QUOTA=0` turns live reads off everywhere.
337
385
  - **Free:** `agentcap quota` and observe-only runs that print the job's share and
338
386
  `Pro's quota mode would have stopped this job at 5%`. **Pro:** stopping at the limit.
339
387
 
340
388
  **Honest limits.** The percentage is **account-level**: a parallel session or claude.ai/chatgpt.com
341
389
  use in the same window counts against the job (AgentCap warns when it sees another session).
342
390
  Values arrive once per model response, so a job **can overshoot by up to one request**.
343
- Claude Code only reports `rate_limits` for Pro/Max logins and only in interactive sessions
344
- (the statusline does not run in `claude -p`). Codex's rollout format is undocumented and may change. Codex reports `used_percent` in whole percent, so a Codex cap under 1% cannot trigger until the job has used a full 1% (AgentCap warns at start). Use `--quota 1%` or more for Codex.
391
+ Claude Code only reports `rate_limits` to the statusline for Pro/Max logins and only in
392
+ interactive sessions (the statusline does not run in `claude -p`; there AgentCap reads `/usage`). Codex's rollout format is undocumented and may change. Codex reports `used_percent` in whole percent, so a Codex cap under 1% cannot trigger until the job has used a full 1% (AgentCap warns at start). Use `--quota 1%` or more for Codex.
345
393
  Claude Code reports whole percents too: a cap under 1% trips at the next 1% step (AgentCap warns).
394
+ One response can move the account by a full step, so a 2.25% limit can end at 3%.
395
+ The interactive Codex TUI ignores SIGINT mid-turn, so AgentCap escalates to SIGTERM; the
396
+ interrupted response's usage may then be missing from the receipt (`final_read: incomplete`),
397
+ while the account increase it reports stays correct. AgentCap restores the terminal afterwards.
398
+ Codex's own sandbox (bubblewrap) fails inside some agent shells on Ubuntu
399
+ (`kernel.apparmor_restrict_unprivileged_userns=1`); in a normal terminal it works.
346
400
  Verified on real accounts: see the harness support matrix under "Supported & tested".
347
401
 
348
402
  ## opencode and agy (Antigravity CLI)
@@ -420,10 +474,10 @@ Legend: ✅ verified on a real account/endpoint · ⚠️ works with a limitatio
420
474
 
421
475
  | Harness + auth | Loop breaker (4x same call, exit 4) | Error breaker (8 failures, exit 4) | Quota % stop (exit 3) | $ / token cap |
422
476
  | --- | --- | --- | --- | --- |
423
- | Claude Code, Pro/Max sub, interactive | ✅ (deny keeps the session; resumes after approve) | ✅ | ✅ whole-% steps (deny keeps the session); `agentcap approve` ✅ | ❌ by design (no proxy on a subscription login; AgentCap refuses) |
424
- | Claude Code, Pro/Max sub, headless `claude -p` | ✅ (exit 4) | ✅ (exit 4) | ❌ interactive only (warns at start) | ❌ by design (refused) |
425
- | Codex, ChatGPT sub | ✅ | ✅ | ✅ (whole %; warns under 1%) | ❌ by design (no proxy on a subscription) |
426
- | opencode Go | ✅ | ✅ | ❌ opencode exposes no quota % | ✅ `--tokens`; `--log-cap` uses opencode's own price table |
477
+ | Claude Code, Pro/Max sub, interactive | ✅ (deny keeps the session; resumes after approve) | ✅ | ✅ statusline + `/usage` every minute (deny keeps the session); `agentcap approve` ✅. Live, Claude Code 2.1.322/323, Pro, 12-13 Nov 2026 | ❌ by design (no proxy on a subscription login; AgentCap refuses) |
478
+ | Claude Code, Pro/Max sub, headless `claude -p` | ✅ (exit 4) | ✅ (exit 4) | ✅ via `/usage` every 30 s (coarser; live: a 2% cap ended at 4%) | ❌ by design (refused) |
479
+ | Codex, ChatGPT sub | ✅ | ✅ | ✅ `exec` and interactive TUI (whole %; warns under 1%; one-response timeout, default 5m; terminal restored after a TUI stop; approve mid-run; live % from `codex app-server` at start, every 30 s and after exit). Live, Codex 0.167.1, Plus, 11-12 Nov 2026 | ❌ by design (no proxy on a subscription) |
480
+ | opencode Go | ✅ | ✅ | ❌ not yet: opencode 1.x's session log reports Go cost as 0 and leaves out subagents (live test, 11 Nov 2026), so a Go % cap cannot be measured; do not rely on `--quota` with opencode | ✅ `--tokens`; `--log-cap` uses opencode's own price table |
427
481
  | agy, Google sub (plain `agentcap run -- agy` needs no key: breakers only) | ✅ | ✅ | ✅ (tested at 0.5%; ~10 s polling, can overshoot) | ❌ (sub); $ only via Gemini API |
428
482
  | opencode + OpenRouter (free model) | ✅ | ✅ | n/a | ✅ $ cap |
429
483
  | opencode + Ollama Cloud | ✅ | ✅ | n/a | ⚠️ needs a user price (`AGENTCAP_PRICING_FILE`): Ollama publishes none |
@@ -509,7 +563,7 @@ output limit, so a clamp also caps them.
509
563
  | --- | --- |
510
564
  | `2` | Setup or auth refusal: bad flags, a Pro-only flag on Free, a conflicting CLI config, a second quota job, the provider rejected the credentials (`upstream_auth_failed`), or it refused the request for another reason (`upstream_refused`). |
511
565
  | `3` | A cap stopped the agent (`--cap`, `--quota`, `--tokens`, `--log-cap`). |
512
- | `4` | Pro's loop/error/burn breaker stopped the agent. |
566
+ | `4` | Pro's loop/error/burn breaker stopped the agent, or (Codex quota mode) one model response ran past `--response-timeout`. |
513
567
  | `5` | Internal error: AgentCap could not use its own state (HOME, `quota.lock`, ledger, license or job files), its proxy could not start, an opencode/agy log schema or Codex rollout log could not be read (fail-closed), or AgentCap hit an internal fault. The message names the failed action and path (`internal state error: could not open the quota lock ...`); the agent was not started, or was stopped (reason `internal_error`). |
514
568
  | `127` | The command itself could not be started (not found, not executable): `could not start the command (...)`. |
515
569
 
@@ -545,7 +599,7 @@ Request bodies are billed at price-book rates; embeddings are input-only.
545
599
  - The ledger lives at `~/.local/state/agentcap/ledger.sqlite3`
546
600
  (override with `$AGENTCAP_DB`).
547
601
 
548
- ### Stopping, fail-closed and self-approval (0.3, Linux-verified)
602
+ ### Stopping, fail-closed and self-approval (0.3+, Linux-verified)
549
603
 
550
604
  - **Whole process tree.** A quota/harness stop (`--quota`, `--tokens`, `--log-cap`) sends SIGINT
551
605
  to the agent's process group, then SIGTERM, then SIGKILL (5 s / 3 s / 2 s); a proxy (`--cap`)
@@ -45,17 +45,20 @@ your subscription quota % and Codex support.
45
45
  proxy also catches identical requests and `--max-burn` $/min spikes.
46
46
  - **Per-job quota %.** Stop one job at its share of the account's weekly or 5-hour limit.
47
47
  - **Evidence receipt.** Each stop prints and saves why (`same tool call 4 times in a row (Bash)`,
48
- `this job used 5.1% of the weekly quota`) and the last tool call's name, as numbers and tool
48
+ `the account's weekly quota rose 5.1% while this job ran`) and the last tool call's name, as numbers and tool
49
49
  names only, never prompts or tool inputs.
50
50
  - **Approve.** After a stop, `agentcap approve` (or `/agentcap:approve` in the plugin) raises the
51
51
  limit by 50%, at most twice, and the run continues. This works for interactive Claude Code,
52
52
  which stays open after a stop. Codex and headless `claude -p` jobs are stopped with SIGINT, so
53
53
  there approve only helps before the limit is hit; after a stop it says so and changes nothing.
54
+ Run it from your own shell while the job runs (live Codex test: `1% -> 1.5% -> 2.25%`, the third
55
+ approve refused). With whole-percent quota steps a 1.5% limit stops at the next step, 2%.
54
56
  - **Free** runs the same detectors in observe-only mode and prints what Pro would have done.
55
57
 
56
58
  Honest limits: Claude tool-error streaks are only caught on API-key runs (the subscription hook sees
57
59
  the call, not its result); the stop can be one request late; quota % is account-level; verified on
58
- fixtures, fake CLIs and real Claude Code 2.1.197 hooks, **not yet on a real Max/ChatGPT account.**
60
+ fixtures, fake CLIs and real Claude Code hooks; quota stops verified on real Claude Pro and ChatGPT
61
+ Plus accounts (see "Supported & tested").
59
62
 
60
63
  ## The API-key cap
61
64
 
@@ -249,7 +252,11 @@ The easiest path on a Claude Max or Pro plan. Inside Claude Code:
249
252
  /agentcap:off # clear it; /agentcap:unsetup restores your old statusLine
250
253
  ```
251
254
 
252
- No pip install: the plugin is stdlib Python (`python3` on PATH). How it works:
255
+ No pip install: the plugin is stdlib Python (`python3` on PATH). The marketplace installs only
256
+ the self-contained `plugin/` folder (commands, hooks, the script and the few `agentcap` modules it
257
+ imports), not the whole repo. Contributors: `plugin/` is generated, edit the sources and run
258
+ `python3 scripts/build_plugin.py` (`--check` verifies; `claude --plugin-dir plugin` loads it locally).
259
+ How it works:
253
260
 
254
261
  - Claude Code only exposes the subscription `rate_limits` % to the **statusLine** command, and a
255
262
  plugin can't set the main statusLine. So `/agentcap:setup` asks once and writes it to
@@ -266,13 +273,20 @@ No pip install: the plugin is stdlib Python (`python3` on PATH). How it works:
266
273
  tool calls: 8 in a row stops the agent on Pro (`continue: false`), Free gets a notice.
267
274
  Tool input and output are never stored, only a 16-char hash and counts; these per-session
268
275
  files are deleted after 7 days (on `SessionStart`).
276
+ - `/usage` as well: `/agentcap:quota` takes its baseline from Claude Code's own
277
+ `claude -p /usage` (a local command, no model call, no quota), and while a quota is set the
278
+ `PreToolUse` hook starts a background `/usage` read at most once a minute. The share is the
279
+ higher of the statusline and `/usage` (the statusline lagged `/usage` by 1-2 points in live
280
+ tests, and a stale first value once looked like 1% of use). Without `/usage` the baseline is
281
+ only this session's own statusline reading, never another session's.
269
282
  - Read-only: no OAuth token, credentials file or API traffic is touched.
270
283
 
271
- Honest limits: the % is account-level (parallel sessions count), the stop can be one request
272
- late, and the share updates when the statusLine refreshes. Verified with real Claude Code
273
- 2.1.197 (plugin install from the marketplace, hooks loaded, `/agentcap:quota` executed,
274
- PreToolUse deny blocked the tool) against a local fake API and synthetic `rate_limits`;
275
- **not yet checked against a real Max account.**
284
+ Honest limits: the % is account-level (parallel sessions and other devices count), the stop can
285
+ be one request late (a `/usage` check runs at most once a minute), and the share updates when the
286
+ statusLine refreshes. Verified live on a real Claude Pro account with Claude Code 2.1.323
287
+ (13 Nov 2026): `/agentcap:setup`, `/agentcap:quota 2% 5h` with its baseline from `/usage`,
288
+ the stop at the limit, `/agentcap:approve`, `/agentcap:unsetup`, and the self-guard denying
289
+ `env -u CLAUDECODE agentcap approve` from the model.
276
290
 
277
291
  ## Works with Claude Max / ChatGPT subscriptions (quota mode)
278
292
 
@@ -282,7 +296,7 @@ Quota mode caps **one job's share** of it:
282
296
  ```bash
283
297
  agentcap run --quota 5% -- claude # stop this job after 5% of the weekly quota
284
298
  agentcap run --quota 10% --window 5h -- codex # or 10% of the 5-hour window
285
- agentcap quota # read-only: last seen usage (Free)
299
+ agentcap quota # read-only: current usage, asked from claude/codex (Free)
286
300
  ```
287
301
 
288
302
  - **Read-only, ToS-safe.** AgentCap never proxies, reads or reuses your subscription login
@@ -295,24 +309,64 @@ agentcap quota # read-only: last seen usage (Fre
295
309
  plus a `PreToolUse` hook that denies further tool calls with a clear reason once the job's
296
310
  share reaches the limit and ends the turn (`continue: false`). An interactive session stays open
297
311
  (run `agentcap approve` to continue, or quit); a session where the hook never fired gets
298
- SIGINT. Exit code 3. **Quota % is interactive-only:** headless `claude -p` exposes no usage %
299
- to AgentCap, so `--quota` warns and only the loop/error breakers are active there.
312
+ SIGINT. Exit code 3.
313
+ AgentCap also asks `claude -p /usage` (a local command: no model call, no quota) at start,
314
+ every minute and once after exit. The statusline % and `/usage` differ by one point at both
315
+ ends of a job (live: 26/27 at start, 31/32 at the end), so the statusline is only compared
316
+ with itself, the hook also denies when `/usage` shows the limit first, and the receipt is the
317
+ `/usage` difference (`measured_by: usage`).
318
+ The hook can stop Claude only before a tool call, so one large response overshoots: live, a
319
+ 3% limit ended at 5% after one response with 7 parallel file reads used 3%. Usage on the same
320
+ account from anywhere else (claude.ai, the desktop or phone app, another terminal) counts
321
+ toward the job too. **Headless `claude -p`** has no statusline, so there `/usage` is the only
322
+ source: it is checked every 30 s and the hook ends the run at the limit (SIGINT if it keeps
323
+ going). Usage between two checks can overshoot. If `/usage` does not answer at start,
324
+ `--quota` warns and only the loop/error breakers are active.
300
325
  - **Codex CLI:** AgentCap tails the `token_count` events Codex writes to
301
326
  `~/.codex/sessions/**/rollout-*.jsonl` (`rate_limits.primary/secondary.used_percent`,
302
327
  `window_minutes`, `resets_at`) and sends SIGINT at the limit. Exit code 3.
328
+ The % in a rollout is the value Codex got *with* a response, before that response was
329
+ charged, so it lags one response (live: the rollout said 3% after a job, the server 4%).
330
+ AgentCap therefore also asks Codex's own `codex app-server` (`account/rateLimits/read`, the
331
+ protocol the IDE extension uses; no model call, no quota spent, Codex handles its own login):
332
+ for the baseline at start, every 30 s during the job, and once after the agent exits, so the
333
+ last response is in the receipt (`baseline_live`, `final_live`). If the server does not answer,
334
+ the rollout readings are used as before.
335
+ Codex writes usage only when a model response ends, so one long response (xhigh/max effort
336
+ ran 6+ minutes in our tests) is invisible until it finishes. In quota mode AgentCap therefore
337
+ stops the job when a single response runs longer than `--response-timeout` (default `5m`,
338
+ `off` disables; time spent running tools does not count) and notes xhigh/max effort at start.
339
+ The interrupted response's usage is read before the receipt is written. Exit code 4,
340
+ reason `response_timeout`.
341
+ **Fail-closed (Pro):** if Codex's `token_count` events carry no `rate_limits` (API-key login, a
342
+ changed log format) or `codex exec` writes no session log within 90 s, the job is stopped
343
+ (exit 5); Free only warns. The interactive TUI is never stopped just for being idle.
303
344
  - Baseline at job start (exact when a reading from the last 15 minutes exists, otherwise the
304
345
  first response is not counted), window resets mid-job are handled, 80% warning,
305
- per-job receipt: `this job used 4.2% of the weekly quota`. Pro alerts (Telegram/webhook)
306
- and receipt files work the same as for dollar caps.
346
+ per-job receipt: `the account's weekly quota rose 4.2% while this job ran`. Pro alerts
347
+ (Telegram/webhook) and receipt files work the same as for dollar caps. `agentcap` stopped by
348
+ Ctrl+C, SIGTERM (`timeout`) or SIGHUP (closed terminal) stops the agent and still writes the
349
+ receipt (reason `interrupted` / `terminated`).
350
+ - **`agentcap quota`** asks each agent's own client for the current values: `codex app-server`
351
+ for Codex and `claude -p /usage` for Claude Code (both read-only, no model call). Lines from a
352
+ live answer end in `(live from codex)` / `(live from claude)`; otherwise the last local
353
+ reading is shown with its age. `agentcap quota --local` never starts claude/codex.
354
+ `AGENTCAP_LIVE_QUOTA=0` turns live reads off everywhere.
307
355
  - **Free:** `agentcap quota` and observe-only runs that print the job's share and
308
356
  `Pro's quota mode would have stopped this job at 5%`. **Pro:** stopping at the limit.
309
357
 
310
358
  **Honest limits.** The percentage is **account-level**: a parallel session or claude.ai/chatgpt.com
311
359
  use in the same window counts against the job (AgentCap warns when it sees another session).
312
360
  Values arrive once per model response, so a job **can overshoot by up to one request**.
313
- Claude Code only reports `rate_limits` for Pro/Max logins and only in interactive sessions
314
- (the statusline does not run in `claude -p`). Codex's rollout format is undocumented and may change. Codex reports `used_percent` in whole percent, so a Codex cap under 1% cannot trigger until the job has used a full 1% (AgentCap warns at start). Use `--quota 1%` or more for Codex.
361
+ Claude Code only reports `rate_limits` to the statusline for Pro/Max logins and only in
362
+ interactive sessions (the statusline does not run in `claude -p`; there AgentCap reads `/usage`). Codex's rollout format is undocumented and may change. Codex reports `used_percent` in whole percent, so a Codex cap under 1% cannot trigger until the job has used a full 1% (AgentCap warns at start). Use `--quota 1%` or more for Codex.
315
363
  Claude Code reports whole percents too: a cap under 1% trips at the next 1% step (AgentCap warns).
364
+ One response can move the account by a full step, so a 2.25% limit can end at 3%.
365
+ The interactive Codex TUI ignores SIGINT mid-turn, so AgentCap escalates to SIGTERM; the
366
+ interrupted response's usage may then be missing from the receipt (`final_read: incomplete`),
367
+ while the account increase it reports stays correct. AgentCap restores the terminal afterwards.
368
+ Codex's own sandbox (bubblewrap) fails inside some agent shells on Ubuntu
369
+ (`kernel.apparmor_restrict_unprivileged_userns=1`); in a normal terminal it works.
316
370
  Verified on real accounts: see the harness support matrix under "Supported & tested".
317
371
 
318
372
  ## opencode and agy (Antigravity CLI)
@@ -390,10 +444,10 @@ Legend: ✅ verified on a real account/endpoint · ⚠️ works with a limitatio
390
444
 
391
445
  | Harness + auth | Loop breaker (4x same call, exit 4) | Error breaker (8 failures, exit 4) | Quota % stop (exit 3) | $ / token cap |
392
446
  | --- | --- | --- | --- | --- |
393
- | Claude Code, Pro/Max sub, interactive | ✅ (deny keeps the session; resumes after approve) | ✅ | ✅ whole-% steps (deny keeps the session); `agentcap approve` ✅ | ❌ by design (no proxy on a subscription login; AgentCap refuses) |
394
- | Claude Code, Pro/Max sub, headless `claude -p` | ✅ (exit 4) | ✅ (exit 4) | ❌ interactive only (warns at start) | ❌ by design (refused) |
395
- | Codex, ChatGPT sub | ✅ | ✅ | ✅ (whole %; warns under 1%) | ❌ by design (no proxy on a subscription) |
396
- | opencode Go | ✅ | ✅ | ❌ opencode exposes no quota % | ✅ `--tokens`; `--log-cap` uses opencode's own price table |
447
+ | Claude Code, Pro/Max sub, interactive | ✅ (deny keeps the session; resumes after approve) | ✅ | ✅ statusline + `/usage` every minute (deny keeps the session); `agentcap approve` ✅. Live, Claude Code 2.1.322/323, Pro, 12-13 Nov 2026 | ❌ by design (no proxy on a subscription login; AgentCap refuses) |
448
+ | Claude Code, Pro/Max sub, headless `claude -p` | ✅ (exit 4) | ✅ (exit 4) | ✅ via `/usage` every 30 s (coarser; live: a 2% cap ended at 4%) | ❌ by design (refused) |
449
+ | Codex, ChatGPT sub | ✅ | ✅ | ✅ `exec` and interactive TUI (whole %; warns under 1%; one-response timeout, default 5m; terminal restored after a TUI stop; approve mid-run; live % from `codex app-server` at start, every 30 s and after exit). Live, Codex 0.167.1, Plus, 11-12 Nov 2026 | ❌ by design (no proxy on a subscription) |
450
+ | opencode Go | ✅ | ✅ | ❌ not yet: opencode 1.x's session log reports Go cost as 0 and leaves out subagents (live test, 11 Nov 2026), so a Go % cap cannot be measured; do not rely on `--quota` with opencode | ✅ `--tokens`; `--log-cap` uses opencode's own price table |
397
451
  | agy, Google sub (plain `agentcap run -- agy` needs no key: breakers only) | ✅ | ✅ | ✅ (tested at 0.5%; ~10 s polling, can overshoot) | ❌ (sub); $ only via Gemini API |
398
452
  | opencode + OpenRouter (free model) | ✅ | ✅ | n/a | ✅ $ cap |
399
453
  | opencode + Ollama Cloud | ✅ | ✅ | n/a | ⚠️ needs a user price (`AGENTCAP_PRICING_FILE`): Ollama publishes none |
@@ -479,7 +533,7 @@ output limit, so a clamp also caps them.
479
533
  | --- | --- |
480
534
  | `2` | Setup or auth refusal: bad flags, a Pro-only flag on Free, a conflicting CLI config, a second quota job, the provider rejected the credentials (`upstream_auth_failed`), or it refused the request for another reason (`upstream_refused`). |
481
535
  | `3` | A cap stopped the agent (`--cap`, `--quota`, `--tokens`, `--log-cap`). |
482
- | `4` | Pro's loop/error/burn breaker stopped the agent. |
536
+ | `4` | Pro's loop/error/burn breaker stopped the agent, or (Codex quota mode) one model response ran past `--response-timeout`. |
483
537
  | `5` | Internal error: AgentCap could not use its own state (HOME, `quota.lock`, ledger, license or job files), its proxy could not start, an opencode/agy log schema or Codex rollout log could not be read (fail-closed), or AgentCap hit an internal fault. The message names the failed action and path (`internal state error: could not open the quota lock ...`); the agent was not started, or was stopped (reason `internal_error`). |
484
538
  | `127` | The command itself could not be started (not found, not executable): `could not start the command (...)`. |
485
539
 
@@ -515,7 +569,7 @@ Request bodies are billed at price-book rates; embeddings are input-only.
515
569
  - The ledger lives at `~/.local/state/agentcap/ledger.sqlite3`
516
570
  (override with `$AGENTCAP_DB`).
517
571
 
518
- ### Stopping, fail-closed and self-approval (0.3, Linux-verified)
572
+ ### Stopping, fail-closed and self-approval (0.3+, Linux-verified)
519
573
 
520
574
  - **Whole process tree.** A quota/harness stop (`--quota`, `--tokens`, `--log-cap`) sends SIGINT
521
575
  to the agent's process group, then SIGTERM, then SIGKILL (5 s / 3 s / 2 s); a proxy (`--cap`)
@@ -0,0 +1,68 @@
1
+ # AgentCap landing — v2
2
+
3
+ Live since 8 November 2026 at https://agentcap.launchbench.studio/.
4
+ The previous design in `landing/index.html` is kept untouched.
5
+
6
+ ## Preview
7
+
8
+ ```bash
9
+ cd landing
10
+ python3 -m http.server 8787
11
+ # open http://127.0.0.1:8787/v2/
12
+ ```
13
+
14
+ ## What is here
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.
19
+ - `fonts.css` / `fonts/` — self-hosted Instrument Serif and IBM Plex.
20
+ - `agentcap-0.2.0.vsix` — served from the site root, not from this folder.
21
+
22
+ ## Deploy target (verified 8 November 2026)
23
+
24
+ Caddy serves the `agentcap.launchbench.studio` block from `/data/agentcap-site`
25
+ inside the `qpa-caddy-1` container. On the host that volume is:
26
+
27
+ ```
28
+ /var/lib/docker/volumes/qpa_caddy_data/_data/agentcap-site
29
+ ```
30
+
31
+ The canonical copy is `/srv/agentcap`. Deploy to both:
32
+
33
+ ```bash
34
+ # from the repo root
35
+ rsync -av --exclude README.md --exclude '*.vsix*' --exclude '*.gif' \
36
+ landing/v2/ quilt-vps:/srv/agentcap/
37
+
38
+ ssh quilt-vps \
39
+ 'sudo rsync -a /srv/agentcap/ /var/lib/docker/volumes/qpa_caddy_data/_data/agentcap-site/'
40
+ ```
41
+
42
+ Do not use `--delete`: the root also holds `agentcap-0.2.0.vsix`, its
43
+ `.sha256`, and the two demo GIFs.
44
+
45
+ `~/agentcap-staging` is a separate staging copy. It is not the live root; do not
46
+ deploy there expecting the site to change.
47
+
48
+ The Caddyfile is at
49
+ `/home/ubuntu/apps/quilt-pattern-draft-auditor/Caddyfile`. Its CSP for this
50
+ site must include `font-src 'self'` and `script-src 'self'`; without them the
51
+ self-hosted fonts and `script.js` are blocked. Reload with:
52
+
53
+ ```bash
54
+ ssh quilt-vps 'sudo docker exec qpa-caddy-1 caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile'
55
+ ```
56
+
57
+ Backup made before the 8 November deploy:
58
+ `/home/ubuntu/backups/agentcap-live-20261108-0030/`.
59
+
60
+ ## Direction
61
+
62
+ Warm paper, ink, one signal red. Editorial serif display, IBM Plex for text and
63
+ evidence. The hero is a real `agentcap demo` receipt, not a stock illustration.
64
+ No gradients, no glass, no icon grid, no fake logos or testimonials.
65
+
66
+ Content was checked against the 0.3.x tree. Product claims, pricing and limits
67
+ are the same as the previous landing page; the OAuth FAQ answer distinguishes
68
+ the dollar proxy from quota mode.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kutay Karahan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "agentcap-cli"
7
- version = "0.3.1"
7
+ version = "0.4.0"
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.3.1"
5
+ __version__ = "0.4.0"
6
6
 
7
7
  __all__ = ["__version__"]
@@ -301,6 +301,22 @@ class AlertDispatcher:
301
301
  self._threads: list[threading.Thread] = []
302
302
  self._lock = threading.Lock()
303
303
  self._seen_once: set[tuple[str, object]] = set()
304
+ self._held: list[str] | None = None
305
+
306
+ # ------------------------------------------------------ terminal hold
307
+ def hold_terminal(self) -> None:
308
+ """Keep terminal lines while an interactive agent owns the screen: written
309
+ into it they overlap its input box and are erased on redraw (live C3,
310
+ 12 Nov 2026). Webhook/Telegram delivery is not held."""
311
+ with self._lock:
312
+ if self._held is None:
313
+ self._held = []
314
+
315
+ def release_terminal(self) -> None:
316
+ with self._lock:
317
+ held, self._held = self._held, None
318
+ for line in held or []:
319
+ self._write(line)
304
320
 
305
321
  # --------------------------------------------------------------- sending
306
322
  def __call__(self, event: Mapping[str, Any]) -> None:
@@ -348,8 +364,16 @@ class AlertDispatcher:
348
364
  self._deliver(self._post_telegram, payload)
349
365
 
350
366
  def _terminal(self, message: str, *, color: str = RED) -> None:
367
+ line = f"{color}{redact(message)}{RESET}"
368
+ with self._lock:
369
+ if self._held is not None:
370
+ self._held.append(line)
371
+ return
372
+ self._write(line)
373
+
374
+ def _write(self, line: str) -> None:
351
375
  try:
352
- print(f"{color}{redact(message)}{RESET}", file=self.stderr, flush=True)
376
+ print(line, file=self.stderr, flush=True)
353
377
  except Exception:
354
378
  pass
355
379
 
@@ -190,13 +190,18 @@ def _build_parser() -> argparse.ArgumentParser:
190
190
  const="budget",
191
191
  help="subscription quota mode (Pro): stop this job after it used this "
192
192
  "share of your Claude Pro/Max, ChatGPT or Antigravity (agy) quota, e.g. 5%% "
193
- "(claude/codex/agy; opencode exposes no quota; "
193
+ "(claude/codex/agy; opencode Go: estimated from its cost field and Go's $ limits; "
194
194
  "bare --quota uses `agentcap budget`)",
195
195
  )
196
196
  run.add_argument(
197
- "--window", default=None, choices=("week", "5h"),
197
+ "--window", default=None, choices=("week", "5h", "month"),
198
198
  help="quota window for --quota (default: budget window or week)",
199
199
  )
200
+ run.add_argument(
201
+ "--response-timeout", default=None, metavar="DURATION",
202
+ help="Codex quota mode: stop the job when one model response runs longer than this "
203
+ "with no usage reading, e.g. 5m, 90s, off (default 5m)",
204
+ )
200
205
  run.add_argument(
201
206
  "--tokens", type=int, default=None,
202
207
  help="opencode/agy (Pro): stop after this many tokens, read from the agent's own event log",
@@ -236,8 +241,12 @@ def _build_parser() -> argparse.ArgumentParser:
236
241
  "--db", action="store_true", help="read the local ledger file instead of a proxy"
237
242
  )
238
243
 
239
- subparsers.add_parser(
240
- "quota", help="show subscription quota usage seen locally (read-only)"
244
+ quota_p = subparsers.add_parser(
245
+ "quota", help="show the subscription quota (asks claude/codex; read-only, spends no quota)"
246
+ )
247
+ quota_p.add_argument(
248
+ "--local", action="store_true",
249
+ help="only show readings already saved locally; do not start claude/codex",
241
250
  )
242
251
  subparsers.add_parser(
243
252
  "approve", help="raise the running quota job's limit by 50%% (Pro, at most twice)"
@@ -632,6 +641,10 @@ def _run_quota(args: argparse.Namespace, argv: list[str]) -> int:
632
641
  return 2
633
642
  raw_quota = f"{plan.task_quota:g}%"
634
643
  window = args.window or plan.window or "week"
644
+ if window == "month":
645
+ print("agentcap: --window month is only for opencode Go; Claude and Codex use 5h or week",
646
+ file=sys.stderr)
647
+ return 2
635
648
  try:
636
649
  quota = parse_quota(raw_quota)
637
650
  except ValueError as exc:
@@ -640,6 +653,13 @@ def _run_quota(args: argparse.Namespace, argv: list[str]) -> int:
640
653
  if detect_quota_agent(argv) is None:
641
654
  print("agentcap: quota mode supports `claude` and `codex` only.", file=sys.stderr)
642
655
  return 2
656
+ from .quota import RESPONSE_TIMEOUT_S, parse_duration
657
+ try:
658
+ response_timeout = (RESPONSE_TIMEOUT_S if args.response_timeout is None
659
+ else parse_duration(args.response_timeout))
660
+ except ValueError as exc:
661
+ print(f"agentcap: {exc}", file=sys.stderr)
662
+ return 2
643
663
  active_features = set(features(status_from_environment().tier))
644
664
  enforce = "quota_mode" in active_features
645
665
  from .quota import is_headless_claude
@@ -658,6 +678,7 @@ def _run_quota(args: argparse.Namespace, argv: list[str]) -> int:
658
678
  window=window,
659
679
  enforce=enforce,
660
680
  alerts=alerts.emit if enforce else None,
681
+ response_timeout_s=response_timeout,
661
682
  quiet=args.quiet,
662
683
  receipt_dir=default_receipt_dir() if "spend_receipt" in active_features else None,
663
684
  )
@@ -742,9 +763,10 @@ def _run_harness(args: argparse.Namespace, argv: list[str], *, breakers_only: bo
742
763
 
743
764
 
744
765
  def _quota(_args: argparse.Namespace) -> int:
766
+ from .live_quota import live_readings
745
767
  from .quota import quota_status
746
768
 
747
- for line in quota_status():
769
+ for line in quota_status(live=None if getattr(_args, "local", False) else live_readings):
748
770
  print(line)
749
771
  return 0
750
772