Skip to content

Record and inspect local Plan usage across subscription Harnesses and User config routes #2181

Closed

Description

@JacobStephens2

Parent

#583

What to build

Make thirdshift record, refresh and display machine-local subscription Plan usage across the five subscription Harnesses (claude, codex, muse, agy and grok), configure ordered User config routes and utilization reserves, and expose local thirdshift plan-usage [--json] [--clear [<harness>]].

Specifically:

  • Add [harness] routes (empty array by default; entries may be "claude" strings inheriting [harness.<name>] Model/Effort or inline tables { harness, model, effort, max_utilization, allow_credits }), [harness] max_utilization = 100 (1–100), and [security] routes = [] to User config and Setup defaults so thirdshift config and Console /config inventory, display and validate them automatically.
  • Exclude API-key Harnesses (opencode and kimi) from subscription Plan usage monitoring.
  • Passively update the machine's saved Plan usage snapshot during every running session from structured Harness wire-frame events: claude rate_limit_event frames across all statuses and utilization percentages (not only >= 85%) plus terminal ClaudeApiError limit/overage facts, codex session token_count rate_limits, and terminal UsageLimit protocol errors across claude, codex, muse, agy and grok.
  • On demand (with a ~60-second view freshness cache, never on an idle background timer), enrich local Plan usage with official zero-token CLI/RPC reads where supported: codex app-server account/rateLimits/read (accountId, planType, ordinaryUsageAllowed, rateLimits / rateLimitsByLimitId, credits, spendControlReached), muse serve usage/read (tier, observedAtMs, window, weekly) and account/read (state, label, credentialRequired), and claude auth status --json (loggedIn, subscriptionType, planTier, orgId, email). Never scrape undocumented web/OAuth endpoints or read Harnesses' private auth tokens.
  • Pass --settings '{"useG1Credits":false}' on headless agy launches unless the active route sets allow_credits = true.
  • Add thirdshift plan-usage [--json] [--clear [<harness>]] showing every Harness named in harness.default, harness.routes, security.harness or security.routes (in route order, marking the currently active primary route and any max_utilization ceiling) plus any other subscription Harness (claude, codex, muse, agy, grok) with a saved observation or signed-in CLI—omitting unconfigured, uninstalled, unobserved Harnesses, and surfacing configured routes whose CLI is missing or signed out. --clear resets recorded cooldown/revalidation state for one or all Harnesses.

Acceptance criteria

  • User config parses and validates [harness] routes, [harness] max_utilization (1–100, default 100), per-route allow_credits (default false), and [security] routes, with defaults exposed automatically in thirdshift config and Console /config.
  • Running sessions passively record claude rate_limit_event windows at all utilization levels (preserving Evals' existing 85% Paused Command stop), codex token_count windows, and terminal UsageLimit / spend-cap facts on claude, codex, muse, agy and grok into the machine's local Plan usage snapshot.
  • thirdshift plan-usage and thirdshift plan-usage --json enrich local state on demand via non-billed codex app-server, muse serve and claude auth status --json reads with a ~60-second TTL cache, omitting opencode and kimi and omitting unconfigured/uninstalled/unobserved subscription Harnesses while flagging missing/signed-out configured routes.
  • Headless agy sessions pass --settings '{"useG1Credits":false}' by default unless allow_credits = true is configured for that route.
  • thirdshift plan-usage --clear [<harness>] clears recorded cooldown and revalidation backoff state for the named Harness (or all subscription Harnesses when omitted).
  • Integration tests with scripted fake Harness CLIs verify passive stream capture across utilization levels, active RPC/CLI enrichment and TTL caching, User config route validation, agy credit-guard settings, row filtering, JSON output, and --clear.

Blocked by

None (can start immediately).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions