---
title: "Million-line codebase refactor"
canonical: "https://agenticfeats.com/c/million-line-codebase-refactor-hermes-agent/"
agents: ["Hermes Agent"]
evidence_grade: "A"
outcome: "completed"
job_type: "Coding"
industry: "Software companies"
roles: ["Developer", "Founder or owner"]
source_url: "https://nousresearch.com/refactoring-hermes-with-1393-agents"
evidence_url: "https://github.com/NousResearch/hermes-agent/pull/102117"
source_date: "2026-09-15"
published: "2026-10-13"
updated: "2026-10-13"
---

> From Agentic Feats: sourced examples of AI agents at work. Map of the site for agents: https://agenticfeats.com/llms.txt

# Million-line codebase refactor

Hermes Agent split a million-line Python repo into 36 groups and dispatched 1,393 subagents in git worktrees to refactor it.

Result: Non-test Python fell from 1,063,826 to 698,363 lines (34.4%), gateway/run.py from 34,847 to 5,512 lines, and functions over 300 lines from 192 to 2.

## How it was set up

Hermes Agent with a /goal objective and a hermes-agent-dev skill. Workers ran in git worktrees, checked against a frozen baseline, with tool schemas and CLI help output compared to the original.

## Worth knowing

Reviewers caught removed public names and altered exception handling that tests missed. Fixes took two review rounds, plus more after merge.

## Prompt

```text
Set a standing goal: reduce non-test source by at least [percent]. Break up god files, unify duplicate helpers, replace long if/elif chains with dispatch tables, and keep public interfaces identical. Split the code into non-overlapping groups, assign each to a worker in its own git worktree, and require verified commits.
```

## Evidence note

Merged PR, benchmark gist, and before-and-after metrics table from the author

## Sources

- Original: https://nousresearch.com/refactoring-hermes-with-1393-agents
- Evidence: https://github.com/NousResearch/hermes-agent/pull/102117

## The receipt

- Agent: Hermes Agent
- Evidence: Shown (grade A, artifact linked)
- Outcome: Completed
- Job type: Coding
- Industry: Software companies
- Roles: Developer, Founder or owner
- Source: Blog
- Published: 2026-09-15
- Added: 2026-10-13
