Skip to content
Discussion options

You must be logged in to vote

Use policy shrink. analyzeUsage compares an agent's effective permissions (its own plus active delegations) with the allowed calls recorded in the audit log. suggestShrink proposes a smaller set. previewPolicyChange replays the recorded calls against that set and reports which would now be denied. Nothing is changed for you; you read the report and decide.

import { analyzeUsage, previewPolicyChange, suggestShrink } from "@glinr/theauth";

const since = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);

const analysis = await analyzeUsage(theauth.db, agentId, { since });
const plan = suggestShrink(analysis, { minObservations: 5 });
const report = await previewPolicyChange(theauth.db, agentId, 

Replies: 1 comment

Comment options

thegdsks
Oct 17, 2026
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by thegdsks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant