Skip to content

Add Kimchi to the agents panel - #14166

Open
oleksandrsan wants to merge 3 commits into
omacom:quattrofrom
oleksandrsan:agents-kimchi
Open

oleksandrsan wants to merge 3 commits into
omacom:quattrofrom
oleksandrsan:agents-kimchi

Conversation

@oleksandrsan

Copy link
Copy Markdown

Adds Kimchi as an agent in the agents panel, following the same shape as the Grok collector.

What it shows

  • Plan and prepaid credits from the gateway's /v1/credits — the endpoint Kimchi's own status line reads — as the panel's balance gauge.
  • Spend budgets from /v1/budget as limit lines that reset when the period ends, titled Monthly/Weekly by the period's length, with each capped provider inside a budget drawn as a scoped tick on that line. A personal (USER/API_KEY) budget also supplies the balance's funded figure, since the credits answer doesn't say how much was bought.
  • Tokens, prompts, and sessions from Kimchi's pi session files under ~/.config/kimchi/harness/sessions (honoring KIMCHI_CODING_AGENT_DIR), with cached input kept apart.

Key and gateway resolve the way the CLI does: KIMCHI_API_KEY, then ~/.config/kimchi/config.json; KIMCHI_BASE_URL, then the configured region (us/eu). When the gateway can't be reached, the last answer stays up with limitsStale/limitsFetchedAt and retryAdvised set; the cache is keyed per API key.

On a real account, the local session totals matched Kimchi's server-side analytics to within one 117-token background call out of ~1.9M, so the collector doesn't call the analytics API.

Files

  • bin/omarchy-agent-usage-kimchi — the collector
  • test/shell.d/agent-usage-kimchi-test.sh — 11 checks against a faked gateway
  • shell/plugins/agents/assets/kimchi.svg — the chili mark from Kimchi's logo (orange, works on light and dark surfaces, so no -light twin)
  • shell/plugins/agents/manifest.json, README.md, manual/17-ai.md — registration and docs

Testing

  • test/shell.d/agent-usage-*-test.sh: all pass, including the new one.
  • Ran the collector against a live Coder account and checked the tab in the running panel.
  • ./test/shell: the 11 files that fail on this machine fail identically on a clean quattro checkout (they need an omarchy-pkgs checkout, omasnap, etc.).
  • Separately: omarchy-kernel-migration-test.sh hangs when stdin is left open — its fake pacman reads $2 as the package, but omarchy-pkg-present now calls pacman -Q -- <pkg> (since b72d7e5), so grep waits on stdin. Not touched here.

🤖 Generated with Claude Code

Kimchi's plan, prepaid credits, and spend budgets come from the gateway
endpoints its own status line reads; tokens come from its pi session files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds Kimchi agent to the agents panel.

The PR appears safe to merge, with a non-blocking loss of cached billing fallback immediately after upgrade.

Findings

  1. P2 Existing billing cache is ignored ▶

Summary

The PR adds Kimchi to the agents panel, collecting gateway credits and budgets alongside local session usage. The latest revision separates the two billing caches and marks any failed endpoint stale, with an early retry for non-authentication failures.

  • Adds Kimchi registration, artwork, documentation, and collector tests.
  • Preserves each endpoint’s cached answer independently, but does not carry forward the previous cache format.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Kimchi collector] --> C[Credits endpoint]
  A --> B[Budget endpoint]
  C --> CC[Credits cache]
  B --> BC[Budget cache]
  A --> S[Local session files]
  CC --> P[Agents panel record]
  BC --> P
  S --> P
Loading

Reviews (3) · Last reviewed commit: "Mark missing Kimchi billing stale and ke..."

Comment thread bin/omarchy-agent-usage-kimchi Resolved
Comment thread bin/omarchy-agent-usage-kimchi Resolved
Comment thread bin/omarchy-agent-usage-kimchi Resolved
Comment thread bin/omarchy-agent-usage-kimchi Resolved
Comment thread bin/omarchy-agent-usage-kimchi Resolved
Each endpoint now caches and falls back on its own, keyed by gateway and
key; a spend cap no longer poses as purchased credit; a rejected key no
longer offers the panel's sign-in, which can't sign in to Kimchi; and
capped providers show in budget periods of any length.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread bin/omarchy-agent-usage-kimchi Resolved
Comment thread bin/omarchy-agent-usage-kimchi Resolved
An endpoint that fails with nothing cached now marks the record stale and
asks for a sooner retry, server errors included. Each endpoint caches to
its own file and only replaces an answer fetched before it, so overlapping
refreshes can't roll the cache back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# it actually got.
def billing_cache(key, base, resource):
digest = hashlib.sha256((base + "\n" + key).encode()).hexdigest()[:16]
return cache_root() / f"kimchi-{resource}-{digest}.json"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Existing billing cache is ignored

After an upgrade, if the gateway is unavailable before the first successful refresh, the collector looks only for the new per-endpoint cache files. It does not read the previous kimchi-billing-<digest>.json file, so the panel cannot show the last known credits and budgets during that outage.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No released Omarchy ever wrote kimchi-billing-*.json. That combined cache only existed in this PR's earlier commits (0c7c85a, 370782c), so no install upgrades from it, and a first run simply starts from the per-endpoint files. Leaving out a migration for it on purpose.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’re right — since kimchi-billing-*.json was never present in a released Omarchy version and only existed in earlier commits within this PR, no upgrade migration is required. A first run correctly starts with the per-endpoint caches. This finding does not apply; no change is needed.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@aholbreich

Copy link
Copy Markdown
Contributor

Thanks, @oleksandrsan! The Kimchi panel support this PR proposes is shipped in current quattro: collector, manifest entry and assets landed via #14040 (80e946083), including the gateway credits and budget lines. Triage recommendation: close this PR as delivered, with credit to you.

@omarchybot omarchybot added the enhancement New feature or request label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants