code-improve

code-improve is a command for Claude Code from gonzalezpazmonica/savia. It costs 21 tokens per session (683 once invoked), scanned A, original, MIT.

An automated code-improvement loop that finds selected maintenance opportunities, applies changes, and creates pull requests for human review. It can target coverage, code complexity, lint warnings, dependencies, or TODO items.

In plain words
What is it for?
Use it to scan a project or path, preview possible improvements, limit the number of attempted tasks, and submit changes as reviewable pull requests.
Why use it?
It reduces the manual work of finding and addressing routine code maintenance while requiring existing tests to pass before it starts.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions OpenCode.

Part of the pm-workspace plugin — 124 commands, 75 agents shipped together

Good fit Use it to scan a project or path, preview possible improvements, limit the number of attempted tasks, and submit changes as reviewable pull requests.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/gonzalezpazmonica/savia/code-improve
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/gonzalezpazmonica/savia

Made for: Claude Code.

Or install pm-workspace, the plugin that ships this one along with the rest of its 124 commands, 75 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 code-improve

README.md
[![agentmods](https://agentmods.dev/badge/commands/gonzalezpazmonica/savia/code-improve/github.svg)](https://agentmods.dev/commands/gonzalezpazmonica/savia/code-improve)
Your own site
<a href="https://agentmods.dev/commands/gonzalezpazmonica/savia/code-improve"><img src="https://agentmods.dev/badge/commands/gonzalezpazmonica/savia/code-improve/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 code-improve

Your own site · 80×15
<a href="https://agentmods.dev/commands/gonzalezpazmonica/savia/code-improve"><img src="https://agentmods.dev/badge/commands/gonzalezpazmonica/savia/code-improve.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 683 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.00021 $0.00683
Opus 5 $0.00010 $0.00342
Sonnet 5 $0.00004 $0.00137
Haiku 4.5 $0.00002 $0.00068

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

Security

Grade A, and why

code-improve 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 2d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/commands/code-improve.md · 81 lines

How it starts

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

/code-improve

Lanza un bucle autónomo de mejora de código inspirado en autoresearch. Detecta oportunidades, aplica mejoras medibles, y genera PRs pendientes de revisión humana.

1. Cargar configuración

  1. Leer @docs/rules/domain/autonomous-safety.md — reglas de seguridad (OBLIGATORIO)
  2. Leer @docs/rules/domain/pm-config.md + pm-config.local.md
  3. Leer .opencode/skills/code-improvement-loop/SKILL.md

2. Uso

/code-improve [--project {nombre}] [--scope {path}] [--tipo {coverage|complexity|lint|deps|todos|all}] [--max-tasks {n}] [--dry-run]
  • --project: Proyecto específico (default: proyecto activo)
  • --scope: Limitar a una ruta específica (default: todo el proyecto)
  • --tipo: Tipo de mejora (default: all)
  • --max-tasks: Máximo de mejoras a intentar
  • --dry-run: Solo detectar oportunidades sin aplicar

3. Gate de arranque

✅ AUTONOMOUS_REVIEWER configurado    → si no: ❌ ABORT
✅ Tests del proyecto pasan            → si no: ❌ "Baseline roto"

4. Detección y confirmación

Mostrar oportunidades detectadas:

🔄 Code Improvement Loop — {proyecto}

📊 Métricas baseline:
  Cobertura: 67.3%
  Complejidad máx: 18 (src/api/handler.ts)
  Warnings linter: 42
  TODOs sin ticket: 8
  Deps desactualizadas: 3

📋 Oportunidades detectadas: {n}
  1. [coverage] src/auth/ — cobertura 42% → objetivo 80%
  2. [complexity] src/api/handler.ts — complejidad 18 → objetivo ≤10
  3. [lint] src/ — 42 warnings corregibles
  ...

👤 Reviewer: {AUTONOMOUS_REVIEWER}
⏱️ Time-box por tarea: {AGENT_TASK_TIMEOUT_MINUTES} min

¿Confirmar arranque? (s/n)

5. Output

🔄 Code Improvement — Completado

✅ PRs creados: {n}
⚠️ Descartados (métricas no mejoraron): {n}
❌ Crashes: {n}

📊 Mejoras propuestas:
  Cobertura: 67.3% → 78.1% (+10.8%) [3 PRs]
  Complejidad máx: 18 → 12 (-6) [1 PR]
  Warnings: 42 → 15 (-27) [2 PRs]

📄 Resultados: output/improvement-results-{fecha}.tsv
📝 Audit log: output/agent-runs/improvement-{fecha}-audit.log

⚡ /compact

Read the full file on GitHub · 81 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. 2d ago First seen · 81 lines · 21 tokens per session scan A 2e98cbc8a170

Subscribe to this mod's changes

code-improve is a command published in the GitHub repository gonzalezpazmonica/savia (50 stars, last pushed today), licensed MIT. It adds 21 tokens to every session and 683 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-09-06.