Loading...
Loading...
Commit SpecStory transcripts and Claude/Cursor/OpenCode/Codex plans with feature diffs, derive staged `AI-Assisted-By` plus transcript/plan trailers, prevent secret leaks, and ignore SpecStory machine-local state. Use when asked to commit/save/stage agent sessions, record cross-harness provenance, bootstrap pre-commit, fix `.specstory/statistics.json` churn, scrub a transcript, or remediate accidental secret commits/pushes with rotate-first discipline.
npx skill4agent add daviddwlee84/agent-skills agent-history-hygieneredact-agent-secretsgitleaks| Surface | Question it answers |
|---|---|
| "Which transcript / plan file is my current session?" |
| "Which agent files belong in the next commit?" |
| "Which harness/model + artifact trailers belong in it?" |
| "How do I get pre-commit + gitleaks + redactor into a repo?" |
| "Is there a leaked secret in what I'm about to commit?" |
| "What does SpecStory already redact, so we don't redo it?" |
| "I already pushed a secret — now what?" |
.gitignore.specstory/.project.json.specstory/statistics.json.specstory/.specstory/history/git push --forcenpx skills addtests/fixtures/.agents/skills/detect-private-keyBEGIN … PRIVATE KEYpem_header()tests/conftest.py__SYNTHETIC_PEM_*__exclude:tests/test_shipped_file_hygiene.py.specstory/history/*.md.claude/plans/*.md.cursor/plans/*.mdgit status.specstory/.project.json.specstory/statistics.json.envreferences/remediation.md.gitignoremainreferences/remediation.md.specstory/.claude/plans/core.hooksPath~/.config/git/hooks/pre-commit.pre-commit-config.yamlgitleaks git --staged.gitleaks.tomlassets/gitleaks.toml.template.gitleaksignoreredact-agent-secrets.pre-commit-hooks.yamlpre-commit autoupdatereferences/pre-commit-redaction-stack.mdSKILL.mdreferences/remediation.mdbootstrap-project.shfind-session.sh--newestscan-staged.sh# 1. Take the UUID from Claude Code /status. If SpecStory produced more than
# one alias for it, name the rendered path too.
SESSION_ID=01234567-89ab-4cde-8fab-0123456789ab
TRANSCRIPT='.specstory/history/2026-08-28_08-00-00Z.md'
PLAN='.claude/plans/exact-agent-history-selectors.md'
bash skills/local/agent-history-hygiene/scripts/find-session.sh \
--session-id "$SESSION_ID" --specstory-path "$TRANSCRIPT"
# 2. Stage code, then exactly one validated transcript/plan set.
git add path/to/feature/file.ts
bash skills/local/agent-history-hygiene/scripts/stage-agent-artifacts.sh \
--session-only --session-id "$SESSION_ID" \
--specstory-path "$TRANSCRIPT" --plan "$PLAN"
# Use --no-plan when no plan exists. Use --no-specstory with --session-id when
# rendered history is intentionally absent. The script never chooses a plan.
# 3. Generate the canonical FINAL trailer block from staged artifacts.
bash skills/local/agent-history-hygiene/scripts/agent-commit-metadata.sh
# 4. Belt-and-suspenders secret scan before commit. Exit 0 = clean.
bash skills/local/agent-history-hygiene/scripts/scan-staged.sh || {
# Exit 10/20: leaks found. Jump to references/remediation.md.
echo "Leaks detected — see references/remediation.md before committing." >&2
exit 1
}
# 5. Append that block after any native attribution, validate with the
# git-workflow companion, then commit. pre-commit re-runs redaction/gitleaks.
bash skills/local/git-workflow/scripts/check-commit-msg.sh \
--agentic --staged --file /path/to/commit-message.txt
git commit -F /path/to/commit-message.txtassets/artifact-dirs.txt.pre-commit-config.yaml.gitleaks.tomlcd /path/to/new/project
bash skills/local/agent-history-hygiene/scripts/bootstrap-project.sh \
--install-hook # optional: validation-only exact commit gate
# Verify: shake out any existing issues in the working tree.
pre-commit run --all-filesbootstrap-project.sh.pre-commit-config.yaml.gitleaks.toml--forcerepo: …/agent-skillsrev: ahh-v1.1.0scripts/redact_secrets.pypre-commit autoupdate.specstory/.gitignore/.project.json
/statistics.json.specstory/history/--untrack-specstory-stategit rm --cached--dry-runpre-commit installuvx pre-commit@4 installPATH.gitignore.git/info/exclude~/.claude/settings.jsonplansDirectory--install-hookprepare-commit-msgAGENT_HISTORY_*--check-stagedGIT_INDEX_FILEcommit -a--onlycore.hooksPath.git/hooksscripts/redact_secrets.py- repo: localbash skills/local/agent-history-hygiene/scripts/bootstrap-project.sh --migrate.gitleaks.tomlscan-staged.sh1020git push --forcereferences/remediation.md.gitignore.project.jsonstatistics.json--untrack-specstory-state.specstory/.specstory/history/[REDACTED:<rule-id>]KEY=valuegeneric-api-keyredact_secrets.py[REDACTED:<rule-id>].gitleaks.tomlgit addreferences/specstory-native-redaction.md[redaction] enabledextra_patternsredact_secrets.py --fix --legacyruff format.agents/skills/.agents.claude.codex.cursor.opencode.specify.specstory.claude.agents.claude/skills/<name>.agents^\.specstory/end-of-file-fixertrailing-whitespaceplansDirectoryplansDirectory/planstage-agent-artifacts.sh~/.claude/settings.json"plansDirectory": "./.claude/plans"gitleaks protectgitleaks git --staged --redactgitleaks dir <path>pre-commit installpre-commit installcheck-added-large-files--maxkb=2048specstory run claudespecstory sync claude -s UUIDfind-session.sh --session-id UUID--specstory-pathEnterWorktreecore.hooksPath.pre-commit-config.yaml.pre-commit-config.yamlbootstrap-project.sh--install-hookcore.hooksPath.git/hooks.git/hooks.gitgit add → git commit → pre-commit auto-fixes → re-stage → re-commitspecstory_*_watchps -axo args--cloud-token …grepsed -n '<line>p'cat | head | tailgitleaks-systemgit add && git commitgrep -c '<secret-prefix>' filepython3 -c "<in-place re.sub>" && git add <file> && git commit -m "..."lsof <file>specstory_*pitfalls/redact-secrets-loop-with-active-specstory-writer.mdPRIVATE KEYredact_secrets.pydetect-private-keyredact-agent-secretsgitleaksdetect-private-keygitleaks git --stagedSKIP=redact-agent-secretsscripts/find-session.sh (--session-id UUID | --specstory-path PATH | --newest) [--format specstory|claude|both] [--json]iconvpython3--newestscripts/stage-agent-artifacts.sh [--session-only --check-staged --session-id UUID|--specstory-path PATH (--plan PATH|--no-plan)] [--no-specstory] [--dry-run] [--allow-empty]--check-stagedscripts/agent-commit-metadata.sh [--harness NAME --model NAME] [--format trailers|json]AI-Assisted-ByAgent-TranscriptAgent-Planscripts/scan-staged.sh [--redact] [--verbose]gitleaks git --stagedscripts/probe-specstory-redaction.py [--json] [--keep] [--dry-run]--no-redact-secretsscripts/bootstrap-project.sh [--from-chezmoi] [--migrate] [--install-hook] [--untrack-specstory-state] [--force] [--dry-run].pre-commit-config.yaml.gitleaks.tomlpre-commit install.gitignore~/.claude/settings.json--dry-run--install-hookcore.hooksPathassets/artifact-dirs.txtstage-agent-artifacts.shbootstrap-project.shfiles:assets/pre-commit-config.yaml.template.pre-commit-config.yamlredact-agent-secretsassets/gitleaks.toml.template.gitleaks.tomlassets/redact_secrets.pyredact-agent-secrets.pre-commit-hooks.yaml[REDACTED:<rule-id>]--legacyreferences/pre-commit-redaction-stack.mdreferences/transcript-session-discovery.md$PWD → slugfind-session.shreferences/pre-commit-redaction-stack.mdscan-staged.shreferences/specstory-native-redaction.mdreferences/remediation.mdgit filter-repogit push --forcetests/make test-skilltest_redact_secrets.pytest_gitleaks_corpus.pytest_scan_staged.shscripts/scan-staged.shtest_find_session.shtest_stage_agent_artifacts.shtest_bootstrap_project.pytest_specstory_coverage.py[REDACTED:<label>]test_agent_commit_metadata.shtest_shipped_file_hygiene.pydetect-private-keygitleaksPATHtests/README.mdgit-workflowproject-knowledge-harness.claude/plans/