# turlockmike/hataraku architecture

> Architecture diagram of the GitHub repository turlockmike/hataraku, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/turlockmike/hataraku
- Repository: https://github.com/turlockmike/hataraku

## Overview

- Autonomous Coding Agent & Task Engine: This is at the heart of Hataraku. Represent modules such as:
- Agent creation and management (e.g., src/core/agents)
- Task creation and execution (e.g., src/core/task.ts, sample tasks, and task history)
- Workflow Orchestration: Capture how multi-step operations are coordinated (e.g., src/core/workflow).
- CLI Interface: Indicate the CLI module (e.g., src/cli and related commands) which interacts with the core.
- Configuration & SDK Integration: Show components handling configuration (e.g., src/config, profile manager), environment setup, and integration logic.
- Tool & Provider Integration: Include the built-in tool integration system and external AI providers (e.g., src/core/providers for OpenRouter, Anthropic, Bedrock, etc.).
- Auxiliary Services & Utilities: Represent supporting services such as file system utilities (src/utils), diff and thread management, and experimental features.

- Data flow from configuration modules to the Agent and Task Engine, ensuring system initialization.
- Interactions between the agent responsible for autonomous decision-making and the providers’ modules that supply AI responses.
- Connections between the workflow module and individual tasks to highlight orchestrated operations.
- Auxiliary communication, such as logging, error handling, and unit tests, which support the core functionality.

##### Architectural Patterns and Design Principles
- Modular Separation: Use clear divisions between core modules, configuration, CLI, and external integrations. Emphasize modularity (each directory like “core,” “config,” “cli,” and “providers” is an individual component).
- Extensibility & Flexibility: Note how the system supports multiple AI providers and tool integrations, reflecting a plug-in based architecture.
- Testing and Mocks: Represent the emphasis on robust testing (the __tests__ directories and mocks under src/__mocks__) as important supporting infrastructure.

##### Relevant Technologies and Frameworks
- Node.js/TypeScript Environment: Note the presence of tsconfig files and extensive TypeScript usage.
- CLI and SDK Libraries: Include how the CLI commands (src/cli/commands) are the entry point for both SDK and autonomous agent execution.

##### Elements
- Use clear, descriptive labels for each major component (e.g., “Autonomous Agent Module,” “Task Engine,” “Workflow Orchestrator,” “CLI Interface,” “Configuration Manager,” “Provider Integrations”).

##### Detailed Breakdown
- Agent & Task Management submodules.
- Workflow orchestration.
- Diff, thread, and tool support.
- Above or to one side, illustrate “Configuration” and “Environment Setup,” showing how files like tsconfig, .eslintrc, and other configurations feed into the core.
- To the right, place “External Integrations” and “Providers” (each labeled with names like OpenRouter, Anthropic, Bedrock).
- “Testing & Mocks” as a support area that interfaces with the core engine; this adds clarity that a robust test infrastructure is in place.
- Optionally, add a “Documentation/Examples” panel (tying the docs/ and examples/ directories) which demonstrates usage and reinforces how the design supports extensibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    ConfigManager["Configuration Manager"]:::config
    CLIInterface["CLI Interface"]:::cli
    Docs["Docs/Examples"]:::docs
    TestMocks["Testing & Mocks"]:::test

    %% Core Engine Subgraph
    subgraph "Core Engine"
        AgentModule["Autonomous Agent Module"]:::core
        TaskEngine["Task Engine"]:::core
        WorkflowOrchestrator["Workflow Orchestrator"]:::core
        AuxServices["Auxiliary Services & Utilities"]:::utility
    end

    %% External Integrations Subgraph
    subgraph "External Integrations & Providers"
        ORProvider["OpenRouter Provider"]:::provider
        AnthropicProvider["Anthropic Provider"]:::provider
        BedrockProvider["Bedrock Provider"]:::provider
        VertexProvider["Vertex Provider"]:::provider
    end

    %% Connections between layers
    CLIInterface -->|"triggers"| AgentModule
    ConfigManager -->|"configures"| AgentModule

    AgentModule -->|"sendsTasks"| TaskEngine
    TaskEngine -->|"orchestrates"| WorkflowOrchestrator
    AuxServices -->|"supports"| AgentModule
    AuxServices -->|"supports"| TaskEngine

    WorkflowOrchestrator -->|"calls"| ORProvider
    WorkflowOrchestrator -->|"calls"| AnthropicProvider
    WorkflowOrchestrator -->|"calls"| BedrockProvider
    WorkflowOrchestrator -->|"calls"| VertexProvider

    TestMocks -->|"validates"| AuxServices
    Docs -->|"guides"| CLIInterface

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef cli fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef config fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef provider fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef utility fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef test fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef docs fill:#FFFACD,stroke:#000,stroke-width:2px;

    %% Click Events
    click AgentModule "https://github.com/turlockmike/hataraku/tree/main/src/core/agents"
    click TaskEngine "https://github.com/turlockmike/hataraku/blob/main/src/core/task.ts"
    click TaskEngine "https://github.com/turlockmike/hataraku/blob/main/src/core/task-history.ts"
    click WorkflowOrchestrator "https://github.com/turlockmike/hataraku/tree/main/src/core/workflow"
    click CLIInterface "https://github.com/turlockmike/hataraku/tree/main/src/cli"
    click CLIInterface "https://github.com/turlockmike/hataraku/tree/main/src/cli/commands"
    click ConfigManager "https://github.com/turlockmike/hataraku/blob/main/src/config/agent-config.ts"
    click ConfigManager "https://github.com/turlockmike/hataraku/blob/main/src/config/profile-manager.ts"
    click ORProvider "https://github.com/turlockmike/hataraku/blob/main/src/core/providers/openrouter.ts"
    click AnthropicProvider "https://github.com/turlockmike/hataraku/blob/main/src/core/providers/anthropic.ts"
    click BedrockProvider "https://github.com/turlockmike/hataraku/blob/main/src/core/providers/bedrock.ts"
    click VertexProvider "https://github.com/turlockmike/hataraku/blob/main/src/core/providers/vertex.ts"
    click AuxServices "https://github.com/turlockmike/hataraku/tree/main/src/utils"
    click AuxServices "https://github.com/turlockmike/hataraku/tree/main/src/core/lib/utils"
    click AuxServices "https://github.com/turlockmike/hataraku/tree/main/src/core/lib/testing"
```
