sc-codebase-health

sc-codebase-health is a command for coding agents from basher83/lunar-claude. It costs 15 tokens per session (690 once invoked), scanned A, original, MIT.

A command that runs six analysis agents in parallel to check the health of a codebase. A codebase is the collection of source code and related project files.

In plain words
What is it for?
Use it to scan the current directory or a specified project, optionally using an existing context packet to focus the analysis.
Why use it?
It gives a broad review of structural completeness, duplication, abstractions, naming, and dead code in one run.

Command

Part of the git-workflow plugin — 5 skills, 2 commands, 3 agents shipped together

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.

agentmods
npx agentmods add commands/basher83/lunar-claude/codebase-health
Clone the repo
git clone --depth 1 https://github.com/basher83/lunar-claude

Or install git-workflow, the plugin that ships this one along with the rest of its 5 skills, 2 commands, 3 agents.

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 sc-codebase-health

README.md
[![agentmods](https://agentmods.dev/badge/commands/basher83/lunar-claude/codebase-health.svg)](https://agentmods.dev/commands/basher83/lunar-claude/codebase-health)
Your own site
<a href="https://agentmods.dev/commands/basher83/lunar-claude/codebase-health"><img src="https://agentmods.dev/badge/commands/basher83/lunar-claude/codebase-health.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 690 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00015 $0.00690
Opus 5 $0.00008 $0.00345
Sonnet 5 $0.00003 $0.00138
Haiku 4.5 $0.00002 $0.00069

Measured 5d ago against content hash 59ccbe274aa8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sc-codebase-health 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.

plugins/devops/git-workflow/commands/codebase-health.md · 84 lines

How it starts

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

Analyze the codebase at $ARGUMENTS (or current directory if not specified) for code quality issues.

Phase 1: Check Context

If a context packet exists !fd 'context-packet-.*\.md' .agent-history/, use it to focus the analysis. If not, briefly ask: "What areas should I focus on? (or 'all' for comprehensive scan)"

Phase 2: Launch Analysis Agents

Launch ALL 6 agents simultaneously using Task`:

Task(subagent_type: "sc-refactor:sc-structural-reviewer", run_in_background: true,
     prompt: "Analyze [target] for structural completeness. Focus on: [context areas]")

Task(subagent_type: "sc-refactor:sc-duplication-hunter", run_in_background: true,
     prompt: "Analyze [target] for code duplication. Focus on: [context areas]")

Task(subagent_type: "sc-refactor:sc-abstraction-critic", run_in_background: true,
     prompt: "Analyze [target] for unnecessary abstractions. Focus on: [context areas]")

Task(subagent_type: "sc-refactor:sc-naming-auditor", run_in_background: true,
     prompt: "Analyze [target] for naming inconsistencies. Focus on: [context areas]")

Task(subagent_type: "sc-refactor:sc-dead-code-detector", run_in_background: true,
     prompt: "Analyze [target] for dead/unreferenced code. Focus on: [context areas]")

Task(subagent_type: "sc-refactor:sc-test-organizer", run_in_background: true,
     prompt: "Analyze [target] test organization. Focus on: [context areas]")

Phase 3: Collect and Synthesize

Wait for all agents to complete. Consolidate findings:

# Codebase Health Report

## Executive Summary
[3-5 sentences on overall health]

## Quick Wins
[High-confidence issues fixable in < 30 min]

## Recommended Refactors
[Larger changes worth doing]

## Tech Debt Backlog
[Valid but not urgent]

## Skip These
[Not worth the effort - explain why]

Cross-reference findings (e.g., duplication often relates to abstraction issues).

Phase 4: User Choice

Use AskUserQuestion:

Option Label Description
fix-plan Generate fix plan Step-by-step instructions for Quick Wins and Recommended Refactors
auto-fix Auto-fix quick wins Make code changes for quick wins (max 10 iterations)
report-only Just the report Output report and stop

Read the full file on GitHub · 84 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. 5d ago First seen · 84 lines · 15 tokens per session scan A 59ccbe274aa8

Subscribe to this mod's changes

sc-codebase-health is a command published in the GitHub repository basher83/lunar-claude (22 stars, last pushed yesterday), licensed MIT. It adds 15 tokens to every session and 690 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-30.