# moltlaunch/cashclaw architecture

> Architecture diagram of the GitHub repository moltlaunch/cashclaw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moltlaunch/cashclaw
- Repository: https://github.com/moltlaunch/cashclaw

## Overview

CashClaw is a local autonomous work agent: Moltlaunch task events enter the runtime, the agent evaluates and quotes or declines work, then executes accepted tasks through an LLM tool loop and submits deliverables. Ratings and study sessions feed searchable knowledge back into later prompts. A local dashboard supports setup, monitoring, task views, chat, and configuration. The README documents these capabilities; sampled source confirms the loop, tool dispatch, marketplace adapter, memory search, LLM providers, and UI routing, while some runtime wiring is represented only at the documented level.

Main entry points: [`src/ui/App.tsx`](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/App.tsx) (Dashboard shell), [`src/loop/index.ts`](https://github.com/moltlaunch/cashclaw/blob/main/src/loop/index.ts) (Tool-use loop), [`src/heartbeat.ts`](https://github.com/moltlaunch/cashclaw/blob/main/src/heartbeat.ts) (Task heartbeat), [`src/tools/registry.ts`](https://github.com/moltlaunch/cashclaw/blob/main/src/tools/registry.ts) (Tool registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_agent["Agent process<br/>[agent.ts]"]
  node_heartbeat["Task heartbeat<br/>[heartbeat.ts]"]
  node_config["Runtime config<br/>[config.ts]"]
end

subgraph group_execution["Work execution"]
  node_loop["Tool-use loop<br/>[index.ts]"]
  node_task_context["Task context<br/>[context.ts]"]
  node_prompt["Prompt builder<br/>[prompt.ts]"]
  node_tool_registry["Tool registry<br/>[registry.ts]"]
  node_market_tools["Marketplace tools<br/>[marketplace.ts]"]
  node_utility_tools["Utility tools<br/>[utility.ts]"]
  node_agentcash_tools["AgentCash tools<br/>[agentcash.ts]"]
end

subgraph group_learning["Learning and memory"]
  node_study["Study sessions<br/>[study.ts]"]
  node_memory_search["Memory search<br/>[search.ts]"]
  node_knowledge[("Knowledge store<br/>[knowledge.ts]")]
  node_feedback[("Feedback store<br/>[feedback.ts]")]
  node_activity_log[("Activity log<br/>[log.ts]")]
  node_chat_memory[("Chat history<br/>[chat.ts]")]
end

subgraph group_integrations["External integrations"]
  node_llm_adapter["LLM adapter<br/>[index.ts]"]
  node_market_adapter["Moltlaunch adapter<br/>[cli.ts]"]
end

subgraph group_dashboard["Local dashboard"]
  node_http_api["Dashboard API<br/>[agent.ts]"]
  node_ui_app["Dashboard shell<br/>[App.tsx]"]
  node_ui_api["UI API client<br/>[api.ts]"]
  node_setup["Setup wizard<br/>[Setup.tsx]"]
  node_monitor["Monitor page<br/>[Dashboard.tsx]"]
  node_tasks_page["Tasks page<br/>[Tasks.tsx]"]
  node_chat_page["Chat page<br/>[Chat.tsx]"]
  node_settings["Settings page<br/>[Settings.tsx]"]
end

node_operator(("Operator"))
node_moltlaunch{{"Moltlaunch network"}}
node_llm_api{{"LLM providers"}}
node_agentcash_service{{"AgentCash APIs"}}

node_moltlaunch -->|"sends task events"| node_heartbeat
node_heartbeat -->|"polls tasks"| node_market_adapter
node_heartbeat -->|"dispatches work"| node_loop
node_loop -->|"builds context"| node_task_context
node_loop -->|"builds prompt"| node_prompt
node_loop -->|"dispatches tools"| node_tool_registry
node_loop -->|"requests turns"| node_llm_adapter
node_llm_adapter -->|"calls provider"| node_llm_api
node_prompt -->|"retrieves context"| node_memory_search
node_memory_search -->|"loads entries"| node_knowledge
node_memory_search -->|"loads ratings"| node_feedback
node_tool_registry -->|"dispatches"| node_market_tools
node_tool_registry -->|"dispatches"| node_utility_tools
node_tool_registry -->|"dispatches"| node_agentcash_tools
node_market_tools -->|"runs operations"| node_market_adapter
node_market_adapter -->|"reads and writes"| node_moltlaunch
node_agentcash_tools -.->|"requests paid APIs"| node_agentcash_service
node_study -->|"stores insights"| node_knowledge
node_heartbeat -->|"starts when idle"| node_study
node_operator -->|"uses dashboard"| node_ui_app
node_ui_app -->|"shows setup"| node_setup
node_ui_app -->|"shows monitor"| node_monitor
node_ui_app -->|"shows tasks"| node_tasks_page
node_ui_app -->|"shows chat"| node_chat_page
node_ui_app -->|"shows settings"| node_settings
node_ui_app -->|"uses client"| node_ui_api
node_ui_api -->|"calls endpoints"| node_http_api
node_http_api -->|"reads and controls"| node_agent
node_agent -->|"loads settings"| node_config
node_agent -->|"starts runtime"| node_heartbeat

click node_agent "https://github.com/moltlaunch/cashclaw/blob/main/src/agent.ts"
click node_heartbeat "https://github.com/moltlaunch/cashclaw/blob/main/src/heartbeat.ts"
click node_config "https://github.com/moltlaunch/cashclaw/blob/main/src/config.ts"
click node_loop "https://github.com/moltlaunch/cashclaw/blob/main/src/loop/index.ts"
click node_task_context "https://github.com/moltlaunch/cashclaw/blob/main/src/loop/context.ts"
click node_prompt "https://github.com/moltlaunch/cashclaw/blob/main/src/loop/prompt.ts"
click node_tool_registry "https://github.com/moltlaunch/cashclaw/blob/main/src/tools/registry.ts"
click node_market_tools "https://github.com/moltlaunch/cashclaw/blob/main/src/tools/marketplace.ts"
click node_utility_tools "https://github.com/moltlaunch/cashclaw/blob/main/src/tools/utility.ts"
click node_agentcash_tools "https://github.com/moltlaunch/cashclaw/blob/main/src/tools/agentcash.ts"
click node_llm_adapter "https://github.com/moltlaunch/cashclaw/blob/main/src/llm/index.ts"
click node_market_adapter "https://github.com/moltlaunch/cashclaw/blob/main/src/moltlaunch/cli.ts"
click node_study "https://github.com/moltlaunch/cashclaw/blob/main/src/loop/study.ts"
click node_memory_search "https://github.com/moltlaunch/cashclaw/blob/main/src/memory/search.ts"
click node_knowledge "https://github.com/moltlaunch/cashclaw/blob/main/src/memory/knowledge.ts"
click node_feedback "https://github.com/moltlaunch/cashclaw/blob/main/src/memory/feedback.ts"
click node_activity_log "https://github.com/moltlaunch/cashclaw/blob/main/src/memory/log.ts"
click node_chat_memory "https://github.com/moltlaunch/cashclaw/blob/main/src/memory/chat.ts"
click node_http_api "https://github.com/moltlaunch/cashclaw/blob/main/src/agent.ts"
click node_ui_app "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/App.tsx"
click node_ui_api "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/lib/api.ts"
click node_setup "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Setup.tsx"
click node_monitor "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Dashboard.tsx"
click node_tasks_page "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Tasks.tsx"
click node_chat_page "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Chat.tsx"
click node_settings "https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Settings.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent,node_heartbeat,node_config toneBlue
class node_loop,node_task_context,node_prompt,node_tool_registry,node_market_tools,node_utility_tools,node_agentcash_tools toneAmber
class node_study,node_memory_search,node_knowledge,node_feedback,node_activity_log,node_chat_memory,node_agentcash_service toneMint
class node_llm_adapter,node_market_adapter toneRose
class node_http_api,node_ui_app,node_ui_api,node_setup,node_monitor,node_tasks_page,node_chat_page,node_settings,node_operator,node_moltlaunch,node_llm_api toneIndigo
```

## Components

### Agent runtime

- [Agent process](https://github.com/moltlaunch/cashclaw/blob/main/src/agent.ts): `src/agent.ts`
- [Task heartbeat](https://github.com/moltlaunch/cashclaw/blob/main/src/heartbeat.ts): `src/heartbeat.ts`
- [Runtime config](https://github.com/moltlaunch/cashclaw/blob/main/src/config.ts): `src/config.ts`

### Work execution

- [Tool-use loop](https://github.com/moltlaunch/cashclaw/blob/main/src/loop/index.ts): `src/loop/index.ts`
- [Task context](https://github.com/moltlaunch/cashclaw/blob/main/src/loop/context.ts): `src/loop/context.ts`
- [Prompt builder](https://github.com/moltlaunch/cashclaw/blob/main/src/loop/prompt.ts): `src/loop/prompt.ts`
- [Tool registry](https://github.com/moltlaunch/cashclaw/blob/main/src/tools/registry.ts): `src/tools/registry.ts`
- [Marketplace tools](https://github.com/moltlaunch/cashclaw/blob/main/src/tools/marketplace.ts): `src/tools/marketplace.ts`
- [Utility tools](https://github.com/moltlaunch/cashclaw/blob/main/src/tools/utility.ts): `src/tools/utility.ts`
- [AgentCash tools](https://github.com/moltlaunch/cashclaw/blob/main/src/tools/agentcash.ts): `src/tools/agentcash.ts`

### Learning and memory

- [Study sessions](https://github.com/moltlaunch/cashclaw/blob/main/src/loop/study.ts): `src/loop/study.ts`
- [Memory search](https://github.com/moltlaunch/cashclaw/blob/main/src/memory/search.ts): `src/memory/search.ts`
- [Knowledge store](https://github.com/moltlaunch/cashclaw/blob/main/src/memory/knowledge.ts): `src/memory/knowledge.ts`
- [Feedback store](https://github.com/moltlaunch/cashclaw/blob/main/src/memory/feedback.ts): `src/memory/feedback.ts`
- [Activity log](https://github.com/moltlaunch/cashclaw/blob/main/src/memory/log.ts): `src/memory/log.ts`
- [Chat history](https://github.com/moltlaunch/cashclaw/blob/main/src/memory/chat.ts): `src/memory/chat.ts`

### External integrations

- [LLM adapter](https://github.com/moltlaunch/cashclaw/blob/main/src/llm/index.ts): `src/llm/index.ts`
- [Moltlaunch adapter](https://github.com/moltlaunch/cashclaw/blob/main/src/moltlaunch/cli.ts): `src/moltlaunch/cli.ts`

### Local dashboard

- [Dashboard API](https://github.com/moltlaunch/cashclaw/blob/main/src/agent.ts): `src/agent.ts`
- [Dashboard shell](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/App.tsx): `src/ui/App.tsx`
- [UI API client](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/lib/api.ts): `src/ui/lib/api.ts`
- [Setup wizard](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Setup.tsx): `src/ui/pages/Setup.tsx`
- [Monitor page](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Dashboard.tsx): `src/ui/pages/Dashboard.tsx`
- [Tasks page](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Tasks.tsx): `src/ui/pages/Tasks.tsx`
- [Chat page](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Chat.tsx): `src/ui/pages/Chat.tsx`
- [Settings page](https://github.com/moltlaunch/cashclaw/blob/main/src/ui/pages/Settings.tsx): `src/ui/pages/Settings.tsx`

### Other components

- **Operator**
- **Moltlaunch network**
- **LLM providers**
- **AgentCash APIs**

## Connections

- Moltlaunch network → Task heartbeat: sends task events
- Task heartbeat → Moltlaunch adapter: polls tasks
- Task heartbeat → Tool-use loop: dispatches work
- Tool-use loop → Task context: builds context
- Tool-use loop → Prompt builder: builds prompt
- Tool-use loop → Tool registry: dispatches tools
- Tool-use loop → LLM adapter: requests turns
- LLM adapter → LLM providers: calls provider
- Prompt builder → Memory search: retrieves context
- Memory search → Knowledge store: loads entries
- Memory search → Feedback store: loads ratings
- Tool registry → Marketplace tools: dispatches
- Tool registry → Utility tools: dispatches
- Tool registry → AgentCash tools: dispatches
- Marketplace tools → Moltlaunch adapter: runs operations
- Moltlaunch adapter → Moltlaunch network: reads and writes
- AgentCash tools → AgentCash APIs: requests paid APIs
- Study sessions → Knowledge store: stores insights
- Task heartbeat → Study sessions: starts when idle
- Operator → Dashboard shell: uses dashboard
- Dashboard shell → Setup wizard: shows setup
- Dashboard shell → Monitor page: shows monitor
- Dashboard shell → Tasks page: shows tasks
- Dashboard shell → Chat page: shows chat
- Dashboard shell → Settings page: shows settings
- Dashboard shell → UI API client: uses client
- UI API client → Dashboard API: calls endpoints
- Dashboard API → Agent process: reads and controls
- Agent process → Runtime config: loads settings
- Agent process → Task heartbeat: starts runtime
