ops-codegraph-tool: Skill for Claude Code

.claude/skills/housekeep/SKILL.md

housekeep is a skill for Claude Code from optave/ops-codegraph-tool. It costs 31 tokens per session (6,805 once invoked), scanned C, original, Apache-2.0.

A local Git repository cleanup routine. A Git repository stores a project's code and its change history; this routine removes stale working copies and temporary files, updates the repository, and checks its health.

In plain words
What is it for?
Use it to clean worktrees, prune merged branches, sync with the main branch, update codegraph, and review repository status. A dry-run can show proposed cleanup first.
Why use it?
It reduces leftover files, unused branches, and outdated local data that can waste disk space or make repository work confusing.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument; mentions Claude Code.

This is optave/ops-codegraph-tool's own configuration. It tells Claude Code how to work on ops-codegraph-tool itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ops-codegraph-tool configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is bash .claude/scripts/gc-worktrees.sh --dry-run.

Reuse

Borrowing it

Nothing to install: this file belongs to optave/ops-codegraph-tool. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/optave/ops-codegraph-tool/main/.claude/skills/housekeep/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/optave/ops-codegraph-tool

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 housekeep

README.md
[![agentmods](https://agentmods.dev/badge/skills/optave/ops-codegraph-tool/housekeep/github.svg)](https://agentmods.dev/skills/optave/ops-codegraph-tool/housekeep)
Your own site
<a href="https://agentmods.dev/skills/optave/ops-codegraph-tool/housekeep"><img src="https://agentmods.dev/badge/skills/optave/ops-codegraph-tool/housekeep/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 housekeep

Your own site · 80×15
<a href="https://agentmods.dev/skills/optave/ops-codegraph-tool/housekeep"><img src="https://agentmods.dev/badge/skills/optave/ops-codegraph-tool/housekeep.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,805 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00031 $0.06805
Opus 5.5 $0.00012 $0.02722
Sonnet 5.5 $0.00006 $0.01361
Haiku 4.5 $0.00003 $0.00681

Measured 2mo ago against content hash 5a9a005f7bad, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

housekeep scanned grade C with 1 finding 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 2mo 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

> **Critical: orphaned directories may still contain uncommitted work.** A worktree's git registration can be dropped (failed `git worktree add`, manual `git worktree prune`, etc.) while the user's source edits remain on
.claude/skills/housekeep/SKILL.md · 450 lines

How it starts

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

/housekeep — Local Repository Maintenance

Clean up the local repo: remove stale worktrees, delete dirt/temp files, sync with main, update codegraph to latest, prune merged branches, and verify repo health. The "spring cleaning" routine.

Arguments

  • $ARGUMENTS may contain:
    • --full — run all phases (default behavior)
    • --dry-run — show what would be cleaned without actually doing it
    • --skip-update — skip the codegraph npm update phase
    • No arguments — full cleanup

Phase 0 — Pre-flight

  1. Confirm we're in the codegraph repo root (check package.json with "name": "@optave/codegraph")
  2. Parse $ARGUMENTS:
    • DRY_RUN=true if --dry-run
    • SKIP_UPDATE=true if --skip-update
  3. Record current branch: git branch --show-current
  4. Record current git status: git status --short
  5. Warn the user if there are uncommitted changes — housekeeping works best from a clean state

Exit condition: repo identity confirmed (@optave/codegraph); DRY_RUN/SKIP_UPDATE are known; current branch and status recorded.

Phase 1 — Audit & Clean Worktrees

Always report disk usage first. Worktree bloat (per-worktree node_modules/, target/, dist/) is the single largest source of disk waste in this repo — a fresh worktree with npm install + a Rust build is ~3GB. Even when no worktree is technically "stale" by branch criteria, the disk footprint must be surfaced so the user can decide what to keep.

1a. Total worktree disk usage

Always print this, even on --dry-run. Use du -sk (kilobytes) so the pipeline is portable across BSD (macOS) and GNU (Linux) — sort -h is a GNU coreutils extension and is rejected by stock macOS sort.

# 2>/dev/null suppress: .claude/worktrees/ may not exist yet on a fresh repo — zero worktrees, not an error
du -sh .claude/worktrees 2>/dev/null
# Portable per-worktree sort: kilobytes through sort -n, then format back to human-readable.
du -sk .claude/worktrees/*/ 2>/dev/null | sort -n | awk '{
  k=$1; $1=""; sub(/^ /, "");
  if (k >= 1048576)      printf "%.1fG\t%s\n", k/1048576, $0;
  else if (k >= 1024)    printf "%.1fM\t%s\n", k/1024, $0;
  else                   printf "%dK\t%s\n", k, $0;
}'

Read the full file on GitHub · 450 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. 2mo ago First seen · 450 lines · 31 tokens per session scan C 5a9a005f7bad

Subscribe to this mod's changes

housekeep is a skill published in the GitHub repository optave/ops-codegraph-tool (99 stars, last pushed 5d ago), licensed Apache-2.0. It adds 31 tokens to every session and 6,805 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

review

The definitive code review, for any codebase. Five-phase workflow: git context detection (worktree, branch, base, changed files), Pharaoh recon (architecture map, module context, blast radius in one call, with a fallback when the repo isn't mapped), parallel specialized agent dispatch (code quality, security against…

Pharaoh-so/pharaoh-mcp · 131 tokens

repo-hygiene

Use when the scheduled repo-hygiene workflow runs from GitHub Actions (or an operator dry-run) to scan the repository for small, certain docs/test/code hygiene issues and fix them as one batched branch.

QwenLM/qwen-code · 48 tokens

gh-skill

Manage agent skills with gh skill. Use this skill to discover, preview, install, update, and publish Agent Skills so an agent can self-manage the skills available in its environment.

cli/cli · 41 tokens

cw-gates

Use before claiming any Codewhale change is done, green, or ready to land: the focused-to-broad verification ladder, the budget checks CI enforces, and the rules for what counts as a passing test.

Hmbown/Codewhale · 48 tokens

atmos-hooks

Atmos hooks: lifecycle events, hook kinds, command/store/git/security hooks, step/steps hooks, when: conditions, scoping and overrides, toolchain integration, --skip-hooks, and Atmos Pro/local output.

cloudposse/atmos · 46 tokens

conventional-commit

Conventional Commit - Generate Conventional Commits 1.0.0 compliant messages. MANDATORY for all git commits. Invoke when user says 'commit', 'commit this', or asks to commit code.

termio-sh/termio · 47 tokens