Conversation
Legiani
force-pushed
the
feat/kun-usage-provider
branch
from
August 31, 2026 20:21
3288410 to
45829f5
Compare
chattymin
requested changes
Sep 24, 2026
chattymin
left a comment
Owner
There was a problem hiding this comment.
Please preserve already observed usage when Kun threads disappear. Merge cache entries by a stable entry ID, keep the larger cumulative value for an existing thread, and retain previously observed entries that are absent from a later scan instead of replacing the cache wholesale. Please add a regression test proving that deleting a thread cannot reduce historical totals, update the data-source documentation, and rebase onto current main.
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.
Summary
Adds Kun CLI (
kun) as a 13th local usage source. Kun persists session usage in an SQLite database under~/.kun/data/index.sqlite3in theusage_eventstable with(thread_id, seq, timestamp, model, usage_json).Key details:
usage_json(promptTokens,completionTokens,cachedTokens,totalTokens,costUsd); the reader calculates per-turn token and cost deltas across sequential events in each thread.~/.kun/data/index.sqlite3withKUN_DATA_DIRoverride support registered inUsageEnvironment,CustomScanRoots, and tests.UsageProviderand registers inUsageStore.initproviders:array without provider-specific logic in generic paths.Type of change
UI changes
No UI structure changes. Users with a Kun database get a
Kuncapsule in the provider tab bar and an entry in Settings → Additional scan folders; Kun token usage and cost join today's aggregate totals.Checklist
swift buildandswift testpass locally (907 tests, 0 failures)KunUsageTests.swiftand registry tests updated