How opengigantic/hachi works
Hachi is a governed personal AI agent, surfaced through a CLI/TUI, gateway and web UI, and messaging channels. The principal workflow is a user request entering a surface, reaching the gateway orchestrator, and being handled by the execution loop: model calls and tool use are constrained by budgets and permission/security guards, with skills and memory informing the turn. The repository also includes model routing, integrations, voice, scheduling and durable jobs. Relationships are limited to README architecture statements and source-index references; unsampled implementation details are not inferred.
Main entry points: orchestrator.py Session orchestrator · loop.py Execution loop · fastapi_app.py REST and SSE · router.py Model routing
Components 23
User surfaces
- CLI
src/hachi/cli/main.py - Terminal cockpit
src/hachi/tui/cockpit/app.py - REST and SSE
src/hachi/gateway/fastapi_app.py - Web interface
frontend/src/routes/conversation.tsx - Messaging channels
src/hachi/channels/router.py
Agent runtime
- Session orchestrator
src/hachi/gateway/orchestrator.py - Execution loop
src/hachi/core/loop.py - Durable jobs
src/hachi/core/runtime/job_handlers.py - Session storage
src/hachi/core/session_store.py
Governance and models
- LLM clients
src/hachi/core/llm.py - Model routing
src/hachi/core/routing/router.py - Model registry
src/hachi/core/routing/registry.py - Permission gate
src/hachi/core/permissions.py - Configuration
src/hachi/core/settings.py
Skills and memory
- ObjectGraph skills
src/hachi/og_engine/engine.py - OG parser
src/hachi/og_engine/parser.py - Memory system
src/hachi/core/memory.py - Memory vault
src/hachi/core/memory_vault.py
Tools and integrations
- Built-in tools
src/hachi/tools - MCP connections
src/hachi/core/mcp_client.py - Service integrations
src/hachi/integrations
Other components
- User
- Model providers
Connections 28
- User → CLI: requests
- User → Terminal cockpit: requests
- User → REST and SSE: requests
- User → Web interface: requests
- User → Messaging channels: messages
- CLI → Session orchestrator: starts sessions
src/hachi/cli/main.py - Terminal cockpit → REST and SSE: uses client
src/hachi/tui/cockpit/app.py - REST and SSE → Session orchestrator: routes requests
- Web interface → REST and SSE: uses API
- Messaging channels → Session orchestrator: routes messages
- Session orchestrator → Execution loop: wires session
src/hachi/gateway/orchestrator.py - Session orchestrator → ObjectGraph skills: binds skills
src/hachi/gateway/orchestrator.py - Session orchestrator → Memory system: binds memory
src/hachi/gateway/orchestrator.py - Session orchestrator → Permission gate: binds gate
src/hachi/gateway/orchestrator.py - Session orchestrator → MCP connections: binds MCP
src/hachi/gateway/orchestrator.py - Session orchestrator → Session storage: uses storage
src/hachi/gateway/orchestrator.py - Execution loop → LLM clients: calls model
- Execution loop → Built-in tools: dispatches tools
- Execution loop → Permission gate: checks calls
- Execution loop → Model routing: selects model
- Model routing → Model registry: selects candidates
src/hachi/core/routing/router.py - Model routing → LLM clients: builds client
src/hachi/core/routing/router.py - LLM clients → Model providers: sends completions
- ObjectGraph skills → OG parser: parses skills
src/hachi/og_engine/engine.py - Memory system → Memory vault: uses vault
- Session orchestrator → Service integrations: binds services
src/hachi/gateway/orchestrator.py - Session orchestrator → Durable jobs: coordinates jobs
src/hachi/core/runtime/job_handlers.py - Configuration → Model registry: configures models
src/hachi/core/routing/registry.py