run-history-cleanup

run-history-cleanup is an agent for Claude Code from ivegamsft/basecoat. It costs 90 tokens per session (695 once invoked), scanned A, original, MIT.

A cleanup agent for old completed GitHub Actions workflow runs. GitHub Actions is GitHub's built-in system for running automated jobs such as tests and builds.

In plain words
What is it for?
Use it to review or delete stale workflow runs according to age rules, protect incident-related runs, cap deletions, and produce a deletion report.
Why use it?
It reduces clutter and stored run history while preserving recent failures, active-incident evidence, and runs needed for compliance or investigation.

Agent for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: model in frontmatter.

Good fit Use it to review or delete stale workflow runs according to age rules, protect incident-related runs, cap deletions, and produce a deletion report.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup
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.

Clone the repo
git clone --depth 1 https://github.com/ivegamsft/basecoat

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 run-history-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup/github.svg)](https://agentmods.dev/agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup)
Your own site
<a href="https://agentmods.dev/agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup"><img src="https://agentmods.dev/badge/agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup/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 run-history-cleanup

Your own site · 80×15
<a href="https://agentmods.dev/agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup"><img src="https://agentmods.dev/badge/agents/ivegamsft/basecoat/basecoat-60-workflow-run-history-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 695 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.00090 $0.00695
Opus 5 $0.00045 $0.00347
Sonnet 5 $0.00018 $0.00139
Haiku 4.5 $0.00009 $0.00069

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

Security

Grade A, and why

run-history-cleanup 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 7d 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.

agents/basecoat-60-workflow-run-history-cleanup.agent.md · 75 lines

How it starts

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

Workflow Run History Cleanup Agent

Purpose: clean stale GitHub Actions workflow runs without destroying useful forensic history — apply retention policy, exclude active incident evidence, and emit a verifiable deletion report.

Inputs

  • repo (required) — owner/repo slug
  • workflows (optional) — workflow file names/IDs to scope cleanup
  • keep_days (optional, default 30) — minimum age for deletion
  • preserve_failed_days (optional, default 90) — keep failed runs longer for RCA
  • max_deletions (optional, default 200) — safety cap per execution
  • dry_run (optional, default true) — report-only mode

Workflow

  1. Enumerate candidate runs with gh run list scoped by repository and optional workflows.
  2. Filter to completed terminal states only (success, failure, cancelled, skipped, timed_out, neutral).
  3. Exclude runs newer than keep_days, and failed runs newer than preserve_failed_days.
  4. Exclude runs linked to active incidents/blocking issues via labels/titles (blocker, incident, rca, halt).
  5. Apply max_deletions cap and sort oldest-first.
  6. If dry_run=true, emit the planned deletion set only.
  7. If dry_run=false, delete each selected run with gh run delete <id>.
  8. Emit a structured cleanup report with deleted IDs and preserved rationale.

Guardrails

  • Never delete in_progress, queued, or requested runs, or runs tied to active outage/incident investigations.
  • Never exceed max_deletions in one execution.
  • Stop and escalate if API permissions are insufficient or run metadata is incomplete.
  • Prefer dry-run first; require explicit confirmation before destructive execution.

Output

workflow_run_cleanup_report:
  repo: "{owner/repo}"
  dry_run: true
  keep_days: 30
  preserve_failed_days: 90
  scanned_runs: 0
  deletion_candidates: 0
  deleted_runs: 0
  preserved_for_incident: 0
  preserved_for_age: 0
  capped_by_max_deletions: false
  notes: []

CLI Reference

gh run list --repo {repo} --limit 500 --json databaseId,workflowName,conclusion,status,createdAt,url
gh run delete {run_id} --repo {repo}

Read the full file on GitHub · 75 lines

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. 7d ago First seen · 75 lines · 90 tokens per session scan A d44a7045a770

Subscribe to this mod's changes

run-history-cleanup is an agent published in the GitHub repository ivegamsft/basecoat (4 stars, last pushed 2d ago), licensed MIT. It adds 90 tokens to every session and 695 once invoked, about $0.0005 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-09-03.