specstory-guard

specstory-guard is a skill for Claude Code from specstoryai/agent-skills. It costs 49 tokens per session (1,222 once invoked), scanned A, original, Apache-2.0.

A Git pre-commit hook that scans SpecStory history files for likely secrets before allowing a commit. A pre-commit hook is an automatic check that runs when you try to save changes to Git.

In plain words
What is it for?
It is for installing, manually running, checking, or removing secret scans for the .specstory/history directory.
Why use it?
AI coding sessions can record API keys, tokens, private keys, or other credentials in their history. The guard blocks the commit and shows redacted findings so they can be removed or hidden.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit It is for installing, manually running, checking, or removing secret scans for the .specstory/history directory.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/specstoryai/agent-skills/specstory-guard
Install

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.

Any agent
npx skills add specstoryai/agent-skills --skill specstory-guard
Clone the repo
git clone --depth 1 https://github.com/specstoryai/agent-skills

Made for: Claude Code.

Wrote 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.

agentmods badge for specstory-guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/specstoryai/agent-skills/specstory-guard/github.svg)](https://agentmods.dev/skills/specstoryai/agent-skills/specstory-guard)
Your own site
<a href="https://agentmods.dev/skills/specstoryai/agent-skills/specstory-guard"><img src="https://agentmods.dev/badge/skills/specstoryai/agent-skills/specstory-guard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for specstory-guard

Your own site · 80×15
<a href="https://agentmods.dev/skills/specstoryai/agent-skills/specstory-guard"><img src="https://agentmods.dev/badge/skills/specstoryai/agent-skills/specstory-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,222 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.01222
Opus 5 $0.00024 $0.00611
Sonnet 5 $0.00010 $0.00244
Haiku 4.5 $0.00005 $0.00122

Measured 12d ago against content hash 170d30b32302, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

specstory-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 12d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/guard.py, scripts/patterns.py, scripts/scan.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/specstory-guard/SKILL.md · 168 lines

How it starts

The opening of the file, as written. The whole thing — 168 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SpecStory Guard

A pre-commit guardrail that scans .specstory/history for potential secrets and blocks commits until they are removed or redacted.

How It Works

  1. Installs a git pre-commit hook in your repository
  2. Scans .specstory/history files on every commit
  3. Detects common secret patterns (API keys, tokens, private keys)
  4. Blocks the commit if secrets are found
  5. Reports findings with redacted previews for safe review

Why Use Guard?

AI coding sessions may inadvertently capture sensitive data:

  • API keys you pasted into chat
  • Environment variables in command output
  • Private keys or tokens in error messages
  • Credentials in configuration examples

Guard prevents accidental commits of these secrets.

Usage

Slash Command

User says Action
/specstory-guard Install the pre-commit hook
/specstory-guard install Install the pre-commit hook
/specstory-guard scan Run a manual scan without installing
/specstory-guard check Alias for scan
/specstory-guard uninstall Remove the pre-commit hook

Direct Script Usage

# Install the pre-commit hook
python skills/specstory-guard/scripts/guard.py install

# Run a manual scan
python skills/specstory-guard/scripts/guard.py scan --root .

# Uninstall the hook
python skills/specstory-guard/scripts/guard.py uninstall

# Scan with custom allowlist
SPECSTORY_GUARD_ALLOWLIST='example-key,PLACEHOLDER_.*' \
  python skills/specstory-guard/scripts/guard.py scan --root .

Output

Scan with findings:

SpecStory Guard - Security Scan
===============================

Scanning .specstory/history/...

ALERT: Potential secrets found!

File: .specstory/history/2026-01-22_19-20-56Z-api-setup.md
  Line 142: AWS_SECRET_ACCESS_KEY=AKIA...redacted...XYZ
  Line 289: private_key: "-----BEGIN RSA PRIVATE KEY-----..."

File: .specstory/history/2026-01-20_10-15-33Z-debug-auth.md
  Line 56: Authorization: Bearer eyJhbG...redacted...

Total: 3 potential secrets in 2 files

Commit blocked. Please redact or remove these secrets before committing.

Read the full file on GitHub · 168 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. 12d ago First seen · 168 lines · 49 tokens per session scan A 170d30b32302

Subscribe to this mod's changes

specstory-guard is a skill published in the GitHub repository specstoryai/agent-skills (35 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 49 tokens to every session and 1,222 once invoked, about $0.0002 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-30.