A Python port of hoocode — a deterministic terminal coding agent — rebuilt as an ultra-modular monorepo of small, independently versioned, independently testable packages.
Status: migration in progress. Phase 1 is a faithful port of the TypeScript core with no new features; enhancements come after the port is green. 354 modules and 118 test files are in the tree today.
hoocode is 828 commits of TypeScript. Porting it to Python is an exercise in doing a large migration properly rather than quickly:
- Ultra-modular. Every package has one responsibility, its own
pyproject.toml, its own tests, and minimal dependencies. Leaves publish to PyPI first. - Stability-ordered. Port order is derived from measured churn in the hoocode git history — the least volatile code moves first and ships early; the code that still changes weekly stays in-repo until it settles.
- Never broken. Every step ends with the full suite green and the workspace importable. Steps are small, atomic and independently revertable.
- No API keys to test. A fake provider layer stands in for every model backend.
- An executable plan.
docs/04-migration-plan.mdis a machine-readable checklist; amigrate-nextskill reads it, executes the next unchecked step, runs the gates and ticks it off. Humans and agents share one source of truth.
packages/
ai/ provider abstraction, tool calling, streaming
agent/ the agent loop, sessions, permissions, subagents
code/ the coding tools — edit, search, shell, MCP, extensions
tui/ terminal UI — rendering, keys, components, fuzzy match, testkit
docs/ source analysis, target architecture, release pipeline, the plan
A uv workspace; Python 3.11+; ruff and pyright in the gates.
uv sync
uv run pytest| Doc | Contents |
|---|---|
| 00-migration-overview | Goals, principles, index |
| 01-source-analysis | hoocode inventory, dependency graph, churn analysis, stability tiers |
| 02-target-architecture | Python monorepo layout, package map, TS→Py dependency mapping |
| 03-release-pipeline | CI, versioning, PyPI publishing |
| 04-migration-plan | The executable, checkbox-driven plan |
| 06-python-architecture | How the Python side is shaped |
| 07-extension-plugin-api | Extension and plugin surface |
A Rust equivalent of the same exercise lives at cortexcode.