Skip to content

feat: /agent-guard simulate shows what a rule does - #51

Open
rbartoli wants to merge 1 commit into
mainfrom
feat/simulate-command
Open

rbartoli wants to merge 1 commit into
mainfrom
feat/simulate-command

Conversation

@rbartoli

Copy link
Copy Markdown
Owner

This is steal (5) from the 2026-10-23 competitor check (internal note, Q3), and a distribution step: a new user can see the guard ask within a minute of installing it, without staging a burst.

/agent-guard simulate <rule> builds made-up state that trips the rule (core/simulate.ts) and runs the real gate on it, using your thresholds.

  • Where someone can answer: the real question opens in Claude Code's dialog, prefixed Simulation, nothing changes:, and the reply says what you answered.
  • Where nobody can answer, or the dialog fails: it prints the refusal Claude would read, or the reason a prompt would be held.
  • Nothing is held, the session's state is untouched, the journal records nothing, and no usage is spent, because a command starts no model turn.
  • Claude reads a command's reply with its next request, so every reply opens by saying it's a simulation and that none of it applies to the current work.

Rules: concurrency, starts, agent-tokens, burn, limit, limit-deny, depth, retry, tool-budget, prompt-context, dormant. With no rule, or an unknown one, it replies with the list.

The README's install step now ends with /agent-guard simulate concurrency, and the command list and help include it.

Test plan

  • Core: every rule trips with the default config, asking where canAsk is true and refusing or holding where it's false; parsing, including a missing or unknown rule
  • Mod: the dialog opens with the simulated question, the answer is reported, and the next real spawn is unaffected with an empty journal; headless prints the retry refusal and the held-prompt reason
  • claude plugin test . on 2.1.310: 106 pass. With the code removed, both mod tests fail and the core file doesn't load.
  • Live in the real UI (2.1.310, tmux, --plugin-dir with the installed copy switched off): /agent-guard simulate concurrency opened the dialog, and "Allow" printed the simulation reply. simulate retry printed the refusal. No model turn ran.
  • claude plugin validate . --strict and tsc are clean
  • CI is green

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