Runtime Architecture
Hamr is the coding agent for local models, and the runtime is still evolving. This page is a current map, not a frozen spec. File paths and boundaries will keep moving while the runtime is being built out.
Current Map
Runtime Notes
packages/coding-agentowns the CLI, session lifecycle, settings, extensions, and persistence.packages/agentprovides lower-level execution harness primitives.packages/aiowns provider adapters, streaming, and model metadata.- The current layout is intentionally flexible. Expect module boundaries to change as the runtime is refactored.
Turn Flow
- The CLI parses args in
packages/coding-agent/src/cli.tsand hands off to the main runtime inpackages/coding-agent/src/main.ts. AgentSessionRuntimeassembles cwd-bound services, session state, and trust context.AgentSessionruns the turn loop, streams provider output, executes tools, and persists session entries.- The event bus and extension runner fan out lifecycle events to the UI and plugins.
- Compaction, memory, and session storage kick in as context fills up or sessions branch.
Working Areas
Session and storage
SessionManager owns session files and tree structure. AgentSession uses it for branching, replay, export, and persistence.
Tool execution
Tool execution is split between the Hamr-specific tool registry and the lower-level harness in packages/agent. This split is still being reshaped, so treat it as implementation detail rather than design law.
Providers and parsing
Provider adapters live in packages/ai. Hamr-specific parsing and repair live under packages/coding-agent/src/hamr/providers/.
Memory and compaction
SQLite-backed memory and compaction are active, but the surrounding orchestration is still in motion.
Historical Note
Legacy Pi-era docs and design notes are kept in packages/coding-agent/docs/ and the repo history. They are useful for attribution and context, but this page reflects the current Hamr runtime.