Sindri — Loops de Otimização Iterativa
4KMetrics/sindri
Otimização iterativa automática guiada por métricas e metas
Ver no GitHubAgent Python que automatiza otimizações de código através de loops iterativos bounded, testando mudanças, benchmarkando resultados e mantendo apenas as que melhoram a métrica alvo. Funciona como um plugin Claude Code que scaffolda benchmarks, drafta candidatos de otimização, executa experimentos autônomos e cria PRs com as vitórias.
Instalação
npx convez-ai 4KMetrics/sindri1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Reduzir tamanho de bundle, latência ou consumo de memória em projetos Python
- Autotuning de parâmetros de performance com feedback contínuo
- Refatoração iterativa com validação benchmarkada a cada passo
Veredito

Solução robusta para otimização dirigida por métricas em ciclos fechados. Requer setup inicial cuidadoso (git, gh CLI, Python 3.10+) e benchmarks bem definidos, mas entrega valor alto em projetos que precisam de iteração contínua validada. A integração com Claude Code e versionamento via git é sólida.
README
A tradução para o português deste README ainda está na fila.
sindri
A Claude Code plugin for bounded, target-driven optimization loops.
In the myth, Sindri is the dwarf smith who forged Mjölnir by iterating under adversity — each hammer-strike tested, kept only if it survived. This plugin is the same pattern: make a change, benchmark it, keep it if it's better, revert otherwise, repeat until the target is hit or the pool of ideas is exhausted.
Inspired by karpathy/autoresearch and davebcn87/pi-autoresearch, adapted to Claude Code.
One commit per kept experiment. Git is the audit log. The forge runs one way.
Install
Option 1 — Official Anthropic marketplace (once approved + PyPI live)
Pending Anthropic review via platform.claude.com/plugins/submit. Once approved AND sindri-forge is published on PyPI:
/plugin install sindri@claude-plugins-official
uv pip install sindri-forge
Restart Claude Code. Done.
Option 2 — Community marketplace (works today, once PyPI is live)
No Anthropic review required — the plugin is served directly from this repo's .claude-plugin/marketplace.json:
/plugin marketplace add 4KMetrics/sindri
/plugin install sindri@4kmetrics
uv pip install sindri-forge
The PyPI distribution is sindri-forge (the sindri name was taken by an unrelated ZK-proof SDK). The imported module name is still sindri.
Restart Claude Code.
Option 3 — local dev install (no marketplace, no PyPI dependency)
git clone https://github.com/4KMetrics/sindri.git ~/src/sindri
cd ~/src/sindri && ./scripts/install-plugin.sh
The install script handles the Python package + the ~/.claude/plugins/sindri symlink in one go.
That script installs the sindri Python package into your active environment and symlinks the plugin into ~/.claude/plugins/sindri. Restart Claude Code afterward. Verify: /sindri status should report "no active run" cleanly.
To target a specific Python (e.g. a venv), pass it via env var:
SINDRI_PYTHON=/path/to/venv/bin/python ./scripts/install-plugin.sh
Requirements:
- Python ≥ 3.10 (pydantic 2 is the only runtime dep; pyyaml is dev-only)
git≥ 2.30ghCLI (authenticated) — needed only forsindri-finalizePR creation- Claude Code CLI with
Task+ScheduleWakeuptools uv(optional, faster install) orpip
First-run dogfood: walk through docs/DOGFOOD.md on a throwaway repo before pointing sindri at real code — it verifies every skill path and catches environment gaps before you commit an overnight run.
Quickstart
# In the repo you want to optimize:
/sindri reduce bundle_bytes by 15%
Sindri will:
- Scaffold
.claude/scripts/sindri/benchmark.pyif missing (interactive; asks you to describe the measurement in natural language). - Scan your repo and draft a pool of 10–30 candidates.
- Ask you to approve / edit the pool.
- Check out a new branch
sindri/reduce-bundle-bytes-15pctand run the baseline 3×. - Loop autonomously — one experiment per wakeup, ~60s between them.
- When the target hits (or the pool drains with ≥1 win), push the branch and open a PR.
Check in anytime with /sindri status. Halt with /sindri stop. Abandon with /sindri clear.
Architecture
- Python core (
src/sindri/) — pure functions: statistics, state file I/O, git wrappers, pool ordering, termination predicates, PR body rendering. - Skills (
skills/sindri-*/SKILL.md) — prose prompts for the decisions that need Claude's inference: scaffolding a benchmark, proposing a candidate pool, orchestrating the loop. - Subagent prompt (
prompts/experiment-subagent.md) — the contract every experiment subagent follows. Fresh context per experiment, no context bleed.
See docs/superpowers/specs/2026-04-19-sindri-design.md for the full design.
Development
uv pip install -e ".[dev]"
pytest # all test layers
pytest -m "not e2e" -q # skip the slow end-to-end loop test
pytest tests/unit/test_plugin_artifacts.py -v # just artifact validity checks
./scripts/smoke.sh # plumbing smoke in a throwaway repo
License
MIT