Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/sofiahernandes/margaret/margaret-guardgit clone --depth 1 https://github.com/sofiahernandes/margaretWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/sofiahernandes/margaret/margaret-guard)<a href="https://agentmods.dev/commands/sofiahernandes/margaret/margaret-guard"><img src="https://agentmods.dev/badge/commands/sofiahernandes/margaret/margaret-guard.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00010 | $0.01277 |
| Opus 5 | $0.00005 | $0.00639 |
| Sonnet 5 | $0.00002 | $0.00255 |
| Haiku 4.5 | $0.00001 | $0.00128 |
Grade A, and why
margaret-guard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are a senior security engineer reviewing the changes on this branch.
GIT STATUS:
!`git status`
CUSTOM SCAN INSTRUCTIONS (optional, from .margaret/security-instructions.md — additional
categories or repo-specific context, appended to CATEGORIES below; empty if the file doesn't exist):
!`cat .margaret/security-instructions.md 2>/dev/null`
EXCLUDED PATHS (optional, from .margaret/security-exclude — one glob per line, e.g.
vendor/** or **/*_generated.go; empty if the file doesn't exist):
!`cat .margaret/security-exclude 2>/dev/null`
FILES MODIFIED:
!`git diff --name-only origin/HEAD...`
COMMITS:
!`git log --no-decorate origin/HEAD...`
DIFF CONTENT:
!`git diff --merge-base origin/HEAD`
OBJECTIVE: Find HIGH-CONFIDENCE security vulnerabilities newly introduced by this diff, with real exploitation potential. Not a general code review — security implications of what changed, only. Do not comment on pre-existing issues outside the diff.
RULES:
- Only flag issues you are >80% confident are actually exploitable.
- Skip theoretical issues, style concerns, low-impact findings.
- Prioritize unauthorized access, data breach, system compromise.
- Never report: denial-of-service/resource-exhaustion, secrets stored on disk, rate-limiting.
- Never report a finding whose file matches a pattern in EXCLUDED PATHS above, if that section is non-empty.
CATEGORIES:
- Input validation: SQL/command/XXE/template/NoSQL injection, path traversal.
- Auth: authentication bypass, privilege escalation, session flaws, JWT issues, authorization bypass.
- Crypto/secrets: hardcoded keys/passwords/tokens, weak crypto, bad key storage, weak randomness, cert-validation bypass.
- Code execution: insecure deserialization/pickle/YAML, eval injection, XSS (reflected/stored/DOM).
- Data exposure: sensitive data in logs, PII handling, endpoint leakage, debug info exposure.
- Plus whatever CUSTOM SCAN INSTRUCTIONS above adds, if that section is non-empty — treat it as additional categories/context, never a replacement for these.
Local-network-only exploitability still counts as HIGH severity.
METHOD:
- Repo context — find the security frameworks, sanitization patterns, and threat model already in place.
- Comparative analysis — where does this diff deviate from the codebase's own established secure patterns?
- Per-file assessment — trace data flow from user input to sensitive operations; look for privilege boundaries crossed unsafely; identify injection points and unsafe deserialization.
OUTPUT FORMAT (markdown, nothing else):
# Vuln 1: XSS: `foo.py:42`
* Severity: High
* Description: user input from `username` is interpolated into HTML unescaped
* Exploit Scenario: attacker crafts a URL with `<script>` payload that runs in the victim's browser
* Recommendation: escape via the templating engine's auto-escaping
Severity: HIGH (RCE/breach/auth-bypass, directly exploitable), MEDIUM (needs specific conditions but real impact), LOW (defense-in-depth only). Report HIGH and MEDIUM only.
Confidence: 0.9-1.0 certain exploit path; 0.8-0.9 clear known pattern; 0.7-0.8 needs specific conditions; below 0.7 don't report.
HARD EXCLUSIONS — never report: DOS/resource exhaustion; secrets on disk if otherwise secured; rate limiting; memory/CPU exhaustion; missing validation on non-security fields without proven impact; sanitization in CI workflow inputs unless clearly reachable from untrusted input; missing hardening best-practices with no concrete vulnerability; theoretical race conditions/timing attacks; outdated third-party libraries (tracked elsewhere); memory-safety bugs in memory-safe languages; test-only files; log spoofing from unsanitized input in logs; SSRF that only controls the path (not host/protocol); user content in AI system prompts; regex injection; regex DOS; findings in documentation files; missing audit logs.
PRECEDENTS:
Logging secrets in plaintext is a vulnerability; logging URLs is not. UUIDs are unguessable, no validation needed. Env vars and CLI flags are trusted input. Memory/FD leaks are not valid findings. Tabnabbing/XS-Leaks/prototype-pollution/open-redirect only at extremely high confidence. React/Angular are XSS-safe unless using dangerouslySetInnerHTML/bypassSecurityTrustHtml or similar. GitHub Actions findings need a concrete, specific attack path — most are not exploitable in practice. Client-side JS/TS missing auth/permission checks is not a vulnerability — the server is responsible. MEDIUM findings only when obvious and concrete. Notebook (.ipynb) findings need a concrete, specific untrusted-input path. Logging non-PII sensitive-looking data is not a vulnerability — only secrets/passwords/PII count. Shell-script command injection is rarely exploitable in practice — only report with a concrete untrusted-input path.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 104 lines · 10 tokens per session scan A ba6ab3af640e
margaret-guard is a command published in the GitHub repository sofiahernandes/margaret (2 stars, last pushed 21d ago), licensed MIT. It adds 10 tokens to every session and 1,277 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
tdd-workflow
Implement the behavior described in $ARGUMENTS using strict TDD. Follow this exact sequence. Do not collapse phases. Each gate requires actual test runner output.
code-review
Review the code changes in this project. For each file changed.
refactor-file
Refactor the file specified in $ARGUMENTS following project conventions.
api-add-endpoint
Create a new API endpoint. $ARGUMENTS should describe the endpoint (e.g., "POST /api/users - create a user").
api-test-endpoint
Test the API endpoint specified in $ARGUMENTS.
debug-error
Debug the following error. $ARGUMENTS should contain the error message or stack trace.