How kunchenguid/gnhf works
gnhf is a CLI for running coding agents in an iterative, Git-backed improvement loop. The user supplies an objective; the run prepares or resumes run state, builds an iteration prompt, invokes an agent, and records successful work as commits and notes. Failures, limits, interruptions, and usage waits are managed by the orchestrator; the CLI presents live status and a final summary. The README also documents worktree and push modes. Some subsystem links reflect README-described behavior because the corresponding source was not sampled.
Main entry points: cli.ts CLI entry · orchestrator.ts Iteration orchestrator · run.ts Run state files · git.ts Git operations
Components 16
CLI and interaction
- CLI entry
src/cli.ts - Config loading
src/core/config.ts - Sleep prevention
src/core/sleep.ts
Run orchestration
- Iteration orchestrator
src/core/orchestrator.ts - Iteration prompt
src/templates/iteration-prompt.ts - Exit summary
src/core/exit-summary.ts - Telemetry
src/core/telemetry.ts
Agent execution
- Agent factory
src/core/agents/factory.ts - Agent adapters
src/core/agents
Git and run state
- Run state files
src/core/run.ts - Git operations
src/core/git.ts
Terminal experience
- Live terminal renderer
src/renderer.ts - Terminal diff rendering
src/renderer-diff.ts
Other components
- User
- Coding agent CLIs
- Git repository
Connections 19
- User → CLI entry: starts run
- CLI entry → Config loading: loads options
- CLI entry → Run state files: creates or resumes
- CLI entry → Iteration orchestrator: starts loop
- CLI entry → Live terminal renderer: displays status
- CLI entry → Sleep prevention: optionally prevents
- Iteration orchestrator → Iteration prompt: builds prompt
- Iteration orchestrator → Agent factory: creates agent
- Agent factory → Agent adapters: selects adapter
- Agent adapters → Coding agent CLIs: invokes agent
- Iteration orchestrator → Git operations: commits or resets
- Git operations → Git repository: updates branch
- Iteration orchestrator → Run state files: records iterations
- Run state files → Git repository: stores run files
- CLI entry → Git operations: checks branch diff
- CLI entry → Exit summary: builds final summary
- Iteration orchestrator → Telemetry: records usage
- Live terminal renderer → Terminal diff rendering: renders cells
- Iteration orchestrator → Live terminal renderer: emits state