safety layer: hard daily budget, user quotas, spend report, forgetme + privacy
This commit is contained in:
@@ -31,3 +31,47 @@ and game descriptions are attacker-influenced input.
|
||||
|
||||
The `hack` envelope field remains as an advisory signal (logged,
|
||||
staff-notified) but is no longer the defense.
|
||||
|
||||
### SAF-04 — Hard daily budget, fail-closed (coverage: test)
|
||||
|
||||
When `daily-budget-usd` is configured and today's estimated spend
|
||||
reaches it, no further model or image calls happen: the responder
|
||||
refuses before calling the API, and the bot answers nothing until
|
||||
midnight. Staff get exactly one alert per day about the silence.
|
||||
Cost estimation uses `price-input-per-m` (default 1.0),
|
||||
`price-output-per-m` (default 6.0) and `price-per-image` (default
|
||||
0.05). A budget of 0 means fully silent — fail-closed by
|
||||
construction.
|
||||
|
||||
### SAF-05 — Usage is metered and survives restarts (coverage: test)
|
||||
|
||||
Token counts (prompt/completion) from every model call and every
|
||||
generated image are recorded per calendar day; with a store
|
||||
configured the counters persist across restarts (usage table,
|
||||
schema v2).
|
||||
|
||||
### SAF-06 — Per-user daily message quota (coverage: test)
|
||||
|
||||
When `user-daily-messages` is configured, messages beyond the cap
|
||||
from one user on one day are ignored (logged, no model call). The
|
||||
`system` user (bot-initiated flows) is exempt.
|
||||
|
||||
### SAF-07 — Per-user daily image quota (coverage: test)
|
||||
|
||||
When `user-daily-images` is configured, picture requests beyond the
|
||||
user's daily cap are stripped from the response (the text answer
|
||||
still goes out).
|
||||
|
||||
### SAF-08 — !forgetme purges a user's history (coverage: test)
|
||||
|
||||
`!forgetme` removes the requesting user's messages from all live
|
||||
responder histories and from the store, then confirms in-channel.
|
||||
v1 limitation, stated in the confirmation: the single-string channel
|
||||
memory may still contain summarized traces — full fact-level erasure
|
||||
arrives with the structured memory (FDB-007).
|
||||
|
||||
### SAF-09 — !privacy states the data practice (coverage: test)
|
||||
|
||||
`!privacy` answers with the configured `privacy-notice` (a default
|
||||
notice ships in code): what is stored, that `!forgetme` exists.
|
||||
Works even while the bot is paused.
|
||||
|
||||
Reference in New Issue
Block a user