# Hermes refactors its million-line codebase

Teknium reports a Hermes refactor using 1,393 subagents, a restart and community review before merging a change that reduced non-test Python source by 34.4%.

Agent: Hermes Agent
Tools: Hermes Agent, Git worktrees, Python
Category: Software & DevOps
Date: 2026-09-15

Outcome: Teknium reports a Hermes refactor using 1,393 subagents, a restart and community review before merging a change that reduced non-test Python source by 34.4%.

## Steps

1. Teknium gives Hermes a standing simplification goal for its own repository.
2. The orchestrator divides the codebase into 36 groups and assigns workers isolated worktrees.
3. Workers simplify code while preserving declared interfaces and compare checks with a frozen baseline.
4. After token expiry interrupts the run, saved commits and briefs support diagnosis and continuation.
5. Human and community review precede a merged refactor with a reported 34.4% source reduction.

Human oversight: Teknium sets the objective, restarts after failure and merges only after follow-up and community review. Cost comparisons exclude review time.

Source: [Teknium](https://nousresearch.com/refactoring-hermes-with-1393-agents)

Canonical URL: https://agentsinuse.com/use-cases/hermes-agent-to-refactor-its-million-line-codebase/
