How kkkkhazix/agent-autoloop works
Agent Autoloop is a local automation hub that routes scheduled or external events through user-defined rules to command-line agents, then delivers approval cards and resumes work after a response. Its core stages are event intake, rule-based scheduling and dispatch, agent execution, receipt processing, and human approval; the hub also maintains an event-sourced state view. The README documents event, agent, channel, and delivery plugin families. Some plugin wiring and subsystems were not sampled, so those relationships are cited to the README rather than treated as inspected implementation details.
Main entry points: client.ts HTTP client · channels.ts Channel dispatch · runtime.ts Hub runtime · evolve.ts Fact projections
Components 23
Operator interface
- CLI
cli/main.ts
Hub runtime
- HTTP hub
host/server.ts - Hub runtime
host/runtime.ts - HTTP client
protocol/client.ts
Decision kernel
- Rule parsing
protocol/rules.ts - Input validation
protocol/validate.ts - Event decisions
kernel/decide.ts - State queries
kernel/query.ts - Fact projections
kernel/evolve.ts
Agent execution
- Worker loop
worker/worker.ts - Agent adapters
worker/agents.ts
Pluggable integrations
- Agent plugins
plugins - Event sources
plugins/github/source.ts - Channel dispatch
host/channels.ts - Desktop channel
plugins/desktop/channel.ts - Feishu channel
plugins/feishu/channel.ts - Webhook channels
plugins/webhook/channel.ts - PR delivery
plugins/delivery/delivery.ts
Other components
- Operator
- Event systems
- CLI agents
- Approval recipient
- SQLite
Connections 27
- Operator → CLI: runs commands
- CLI → HTTP client: calls hub
cli/main.ts - CLI → Rule parsing: parses rules
cli/main.ts - HTTP hub → Hub runtime: delegates requests
host/server.ts - Hub runtime → Event decisions: decides actions
host/runtime.ts - Hub runtime → State queries: reads state
host/runtime.ts - Hub runtime → Fact projections: persists facts
host/runtime.ts - Event decisions → Input validation: validates events
kernel/decide.ts - Event decisions → Fact projections: records facts
kernel/evolve.ts - State queries → Fact projections: reads projections
kernel/query.ts - Fact projections → SQLite: stores log
kernel/evolve.ts - Worker loop → HTTP client: claims work
worker/worker.ts - Worker loop → Agent adapters: selects adapter
worker/worker.ts - Worker loop → Input validation: checks receipt
protocol/validate.ts - Agent adapters → Agent plugins: loads plugin
worker/agents.ts - Agent plugins → CLI agents: launches process
- Event systems → Event sources: emits events
- Event sources → HTTP client: submits events
- Channel dispatch → HTTP client: fetches cards
host/channels.ts - Channel dispatch → Desktop channel: loads channel
plugins/desktop/channel.ts - Channel dispatch → Feishu channel: loads channel
plugins/feishu/channel.ts - Channel dispatch → Webhook channels: loads channel
plugins/webhook/channel.ts - Desktop channel → Approval recipient: delivers cards
- Feishu channel → Approval recipient: delivers cards
- Webhook channels → Approval recipient: delivers cards
- Approval recipient → HTTP client: submits answer
- Event systems → PR delivery: triggers delivery