Skip to content

feat: report a Claude Code session's own context, rate limits and cost - #31

Merged
omartelo merged 2 commits into
mainfrom
feat/mod-usage
Oct 5, 2026
Merged

omartelo merged 2 commits into
mainfrom
feat/mod-usage

Conversation

@omartelo

@omartelo omartelo commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Client side of lichdotdev/lich#650: hooks/mod-usage.js hooks session.measure and posts context window, rate limits and cost to POST /mod/usage; an older lich answering 404 stops the reports. Registered from hooks/lich.js, the plugin's one modules entry.

Tests: node 260/260, claude plugin test . 14/14. Fixtures read at pushed lich commits until a release ships them; move tests/lich-ref and drop the pins then. Conflicts with feat/ask-session only in tests/refresh-fixtures.sh pins and doc lists.

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
omartelo merged commit 9d2eeb1 into main Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant