amal66 puts a meter on AI chat usage

This fork makes monthly message limits a hard gate before an AI chat request is sent.

workflowinfrastructure

amal66 is turning AI usage from a rough cost concern into an enforceable product rule. Before a user can send a message through either ordinary or project-based chat, the system checks and reserves part of that month's allowance in the same step.

That matters because it avoids the familiar billing surprise: users cannot slip past a limit when several requests arrive at once. The accompanying work also tests the awkward edges, including hitting the limit exactly and what happens when a request fails.

This is not a cosmetic guardrail. It adds an entitlement policy and a dependency on the system that records usage, so it is a considered product choice rather than a drop-in fix.

So what Legal-product teams offering AI-assisted work should care if predictable usage limits and cost control are part of the commercial model.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

2 commits from amal66/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
41ede550 fix(chapter-23): enforce monthly message credits before LLM calls Amal 2026-05-24 ↗ GitHub
commit body
Chapter: 23 - Server-side quota enforcement.

Plain-English map:
Check a user's monthly message credits before making chat LLM calls.

Why it matters:
A UI counter alone does not enforce anything. The backend must stop expensive
provider calls when a user has reached the configured limit.

Principle:
Billing and quota rules must be enforced server-side.

Precedent borrowed:
Upstream PR #157.

Upstream base: willchen96/mike@d39f580.
Original local commit: fa433e1.
27694ca4 test(chapter-34): cover message-credit enforcement edges Amal 2026-05-24 ↗ GitHub
commit body
Chapter: 34 - Quota regression tests.

Plain-English map:
Add unit tests for the monthly message-credit gate, including reset dates,
limit boundaries, null counters, and database-error behavior.

Why it matters:
A quota bug can either block legitimate users or make the limit meaningless.
The important edge cases need to be pinned down.

Principle:
Server-side gates need boundary tests.

Precedent borrowed:
Chapter 23 and the fork report's testing-focused active forks.

Upstream base: willchen96/mike@d39f580.
Original local commit: 919665e.

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-2007.md from inside the repo you want the changes in.

⬇ Download capture-thread-2007.md