feat: show local plan usage for Claude, Cursor, Codex, and more signed-in CLIs - #8679
Open
marcelocecin wants to merge 13 commits into
Open
marcelocecin wants to merge 13 commits into
marcelocecin wants to merge 13 commits into
Conversation
|
@marcelocecin is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
The daemon reads Claude, Cursor, and Codex usage on the machine where those tools are already signed in, and uploads only derived percent, reset, plan, and collected-at fields. The server stores one snapshot per runtime and rejects token-like fields. Collection failure keeps the last good snapshot and does not fail agent tasks. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
Render the daemon's plan-limit snapshot on the existing runtime usage section and on an agent's activity tab when a runtime is bound. The client parses the response with zod and parseWithFallback so a partial or malformed payload degrades to an empty state. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
Concurrent snapshot indexes need an invalid-index cleanup hook, and the workspace deletion manifest must classify the new runtime-scoped table. Rows are already removed with the workspace. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
Add a Usage column to the shared machine runtimes table. Claude, Cursor, and Codex rows show the headline plan percent from one batch read of the existing snapshots. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
The detail block rendered every snapshot stored for the machine, so Claude also listed Codex and Cursor. Keep snapshots for that runtime's protocol family and stop the subtitle from naming the other vendors.
Read GitHub Copilot, Antigravity, Grok, Kimi, Kiro, and OpenCode from the local session already on the daemon machine. Upload only percent, reset, plan, and collected_at. A missing or expired session stays an empty snapshot and does not fail agent tasks. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
cursor
Bot
force-pushed
the
feat/provider-plan-usage
branch
from
September 23, 2026 14:03
bb79158 to
830795a
Compare
Bring in v0.5.3 migrations 545-547 so provider usage snapshots can be renumbered after them. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
Upstream main owns 545-547. The snapshot table and its concurrent indexes move to the next free prefixes. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
Renumber provider usage migrations from 548-550 to 564-566 so they follow main's 563 search-index migrations. Collector behavior and the no-tokens-on-server contract are unchanged. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
cursor Bot
pushed a commit
to marcelocecin/multica
that referenced
this pull request
Sep 28, 2026
…> 567 v0.6.0 main took prefixes 548-563, and open PR multica-ai#8679 reserves 564-566 for runtime_provider_usage_snapshot. 567 stays clear of both. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
OpenCode 1.18+ stores the Go or OAuth credential in opencode.db instead of auth.json. Read that table read-only, keep the auth.json fallbacks, and pair each credential with the usage route that accepts it. An expired token uploads an empty snapshot and is not refreshed. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
6 of 7 tasks
Include multica-ai/multica main through v0.6.1 (2ea01ae). Provider-usage migrations stay 564/565/566. Co-authored-by: Marcelo Cecin <marcelocecin@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Shows plan usage for signed-in local CLIs/editors inside Multica. The daemon on the host reads the session already present on that machine and uploads only derived fields: provider, window, percent used, reset time, plan name, and
collected_at. The server does not call vendor APIs and does not store bearer tokens, cookies, or auth files.A missing or unusable session (not signed in, API-key-only auth, CLI missing, expired local token) is an empty snapshot. It does not fail agent tasks. An expired token is not refreshed and does not replace the last good snapshot.
Related Issue
Closes #
Type of Change
Changes Made
claude --print --no-session-persistence --strict-mcp-config /usage. No keychain read and no login refresh.GET https://cursor.com/api/usage-summary. UploadautoPercentUsed/apiPercentUsed, billing-cycle end, and membership type. Cookie stays in process memory.GET https://chatgpt.com/backend-api/wham/usageusing~/.codex/auth.json. Mapprimary_windowandsecondary_window. API-key-only auth reports empty and does not call the API.ghhosts file orgh auth token, then the Copilot quota API.GH_TOKEN/GITHUB_TOKENare ignored.~/.gemini/oauth_creds.jsononly, then Cloud Code quota. No keychain prompt and no language-server scan.https://auth.x.aientry in~/.grok/auth.json. Expired tokens are not refreshed (unlike CodeNotch fix(daemon): support Windows by extracting platform-specific SysProcAttr #393 in-memory refresh).~/.kimi-code/credentials/kimi-code.json(KIMI_CODE_HOME).kiro-cli chat --no-interactive /usagestdout. The sqlite token store is not opened.auth.jsonkeyopencode-go, then SQLiteopencode.dbtablecredential(read-only), then the mirroredopencodeOAuth entry inauth.json. Go key →https://opencode.ai/zen/go/v1/usage; OAuth →https://opencode.ai/inference/go/v1/usagewithx-opencode-org-idwhenmetadata.orgIDis present. Expired credentials uploadcredential_expiredand are not refreshed (needed for OpenCode 1.18+ / 2.x, which stopped writingauth.jsonon sign-in — CodeNotch v1.20.0 / fix(inbox): archive at issue level instead of event level #398).runtime_provider_usage_snapshotrows, separate fromtask_usage. No foreign keys.564creates the table; concurrent indexes are565and566. Upstreammainoccupies 548–563; open PR feat(agent): add Prime Agent as a native ACP provider #6641 uses 567.POST /api/daemon/runtimes/{runtimeId}/provider-usageandGET /api/runtimes/{runtimeId}/provider-usage, plusGET /api/runtimes/provider-usagefor the list. The handler rejects token-like fields.Sync with main
Merged current
multica-ai/multicamainthrough2ea01ae4e(changelog v0.6.1, 2026-10-01) intofeat/provider-plan-usageas17d4f775a. Catch-up merges; no content conflicts on the latest sync.Provider-usage migrations stay 564 / 565 / 566. Main still ends at 563. Sibling PR #6641 owns 567.
Contracts kept: derived upload fields only; token-like fields rejected; OpenCode order above; no token refresh.
CodeNotch follow-ups
How to Test
cd server && go test -count=1 -timeout 180s ./internal/daemon/providerusage/cd server && go test -count=1 -timeout 120s ./internal/handler/ -run 'TestRejectCredentialFields|TestNormalizeProviderUsageReport|TestProviderUsageErrorDoesNotEchoSecrets|TestWorkspaceDeletionManifestCoversPublicSchema|TestProviderUsageBatchGroupsByRuntime'cd server && go test -count=1 -timeout 60s ./cmd/migrate/ -run TestEveryConcurrentUpBuildHasCleanuppnpm --filter @multica/core exec vitest run api/schemas.test.tspnpm --filter @multica/views exec vitest run runtimes/components/provider-usage-block.test.tsx runtimes/components/runtime-plan-usage-cell.test.tsx locales/parity.test.tsDefault tests use fixture stdout and HTTP responses. They do not run a real CLI or call vendor APIs.
Checklist
apps/web/features/landing/i18n/) and relevant docs (apps/docs/content/docs/)apps/docs/content/docs/developers/conventions.zh.mdx(terminology, mixed-rule fortask/issue/skill)AI Disclosure
AI tool used: Cursor
Prompt / approach:
Collect plan limits only on the local daemon from the already signed-in CLI or editor session. Extend collectors for additional Multica-relevant providers that expose a local session (inspired by CodeNotch’s provider surface). Upload derived percents, reset time, and plan name. Keep vendor tokens off the server. Show one usage cell per runtime in the list, and only that runtime on its detail page.
Screenshots (optional)
Risks
/usagetext, which can change format.cli_unavailable,session_unavailable,credential_expired, orunsupported).