Repository navigation
feat: report a Claude Code session's own context, rate limits and cost - #31
Merged
Merged
Conversation
A new mod, hooks/mod-usage.js, hooks session.measure and posts what Claude Code measured to lich's POST /mod/usage (the mod-usage contract), only from an interactive session, one report at a time, dropping a failed one and stopping on a 404. Claude Code takes a single hooks module per plugin and refuses a second modules entry, so hooks/mod.js becomes that module and registers both mods; mod-control.js is unchanged. The fixture is vendored from the lich commit that adds the contract, which is in no release yet.
omartelo
force-pushed
the
feat/mod-usage
branch
from
October 5, 2026 12:33
feb49d0 to
d28bae7
Compare
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.
Client side of lichdotdev/lich#650:
hooks/mod-usage.jshookssession.measureand posts context window, rate limits and cost toPOST /mod/usage; an older lich answering 404 stops the reports. Registered fromhooks/lich.js, the plugin's onemodulesentry.Tests: node 260/260,
claude plugin test .14/14. Fixtures read at pushed lich commits until a release ships them; movetests/lich-refand drop the pins then. Conflicts with feat/ask-session only intests/refresh-fixtures.shpins and doc lists.