How swsgbl/hmharness works
hmharness is a HarmonyOS-focused, self-evolving agent framework. A user starts work through the CLI/REPL, TUI, or Web UI; the agent runs a tool-using kernel loop, records a session, and returns results. Harmony development spans project creation, build, device install/launch/logs, with emulator and Cangjie/lint capabilities. Separate evolution workflows use insights, skill candidates, benchmark gates, promotion/rollback, and memory distillation; ops scans ecosystem sources and produces briefs. Paths and links reflect the README and sampled code; unsampled subsystem wiring is omitted where it cannot be established.
Main entry points: loop.ts Agent loop · index.ts Harmony toolchain · runner.ts Agent runner · main.ts CLI and REPL
Components 26
User interfaces
- CLI and REPL
packages/cli/src/main.ts - Full-screen TUI
packages/cli/src/tui.ts - Web interface
packages/web/src/server.ts - MCP server
packages/cli/src/mcp-server.ts
Agent runtime
- Agent runner
packages/agent/src/runner.ts - Agent tools
packages/agent/src/tools.ts - Staged pipeline
packages/agent/src/pipeline.ts - Agent loop
packages/kernel/src/loop.ts - Model routing
packages/kernel/src/router.ts - Session history
packages/kernel/src/session.ts - Approval gate
packages/kernel/src/shellgate.ts
Harmony development
- Harmony toolchain
packages/domain-harmony/src/index.ts - Project scaffolding
packages/domain-harmony/src/project.ts - Device lifecycle
packages/domain-harmony/src/index.ts - Emulator management
packages/domain-harmony/src/emulator.ts - Cangjie and lint
packages/domain-harmony/src/cangjie.ts
Evolution and evaluation
- Evolution cycle
packages/evolution/src/evolve.ts - Skills and memory
packages/evolution/src/skills.ts - Benchmark gates
packages/evaluation/src/harmonybench.ts - Run observability
packages/observability/src/recorder.ts
External integrations
- Model provider
packages/kernel/src/provider.ts - Ecosystem radar
packages/domain-ops/src/index.ts
Other components
- User
- MCP host
- Device or emulator
- Release sources
Connections 28
- User → CLI and REPL: submits task
- User → Full-screen TUI: submits task
- User → Web interface: submits task
- CLI and REPL → Agent runner: runs task
- Full-screen TUI → Agent runner: runs task
- Web interface → Agent runner: starts agent
- Agent runner → Agent loop: runs loop
- Agent loop → Model provider: requests completion
- Agent loop → Agent tools: dispatches tools
- Agent loop → Model routing: routes requests
- Agent loop → Session history: appends audit
- Agent loop → Approval gate: checks approval
- Agent runner → Staged pipeline: runs staged work
- Agent tools → Harmony toolchain: invokes domain tools
- Harmony toolchain → Project scaffolding: creates projects
- Harmony toolchain → Device lifecycle: builds and operates
- Harmony toolchain → Emulator management: manages emulator
- Harmony toolchain → Cangjie and lint: runs checks
- Device lifecycle → Device or emulator: installs and launches
- CLI and REPL → Evolution cycle: starts evolution
- Evolution cycle → Skills and memory: updates skills and memory
- Evolution cycle → Benchmark gates: gates candidates
- CLI and REPL → Benchmark gates: runs benchmarks
- Agent runner → Run observability: records runs
- CLI and REPL → Ecosystem radar: runs ops commands
- Ecosystem radar → Release sources: fetches release data
- MCP host → MCP server: calls tools
- MCP server → Harmony toolchain: exposes Harmony tools