ClawWork Documentation

repository·main·Indexed 27 days ago

https://github.com/hkuds/clawwork

An economic benchmark and simulation platform that transforms AI assistants into 'AI Coworkers'. ClawWork tests AI agents' ability to complete professional tasks from the GDPVal dataset while managing economic solvency by paying for their own token usage. It integrates with Nanobot to provide economic tracking, task classification across 40 occupation categories, and support for external chat channels like Telegram, Discord, and Slack.

Tokens
31.6K
Snippets
85
Records
188
Agent score
93%

What's inside ClawWork

  1. Review the EV Battery Localisation Partnership Proposal

    main

    This document outlines a strategic partnership between EV Batteries Inc. (Chinese supplier) and EvTronics (domestic supplier) to localise battery pack assembly in Delhi, India. The goal is to meet Phased Manufacturing Programme (PMP) requirements and achieve significant cost savings.

    Key Financial Highlights

    • Annual Cost Savings: ₹165.89 million (~$2.0M USD)
    • 5-Year Total Savings: ₹829.45 million (~$10.0M USD)
    • Initial CAPEX Investment: ₹520 million
    • Payback Period: ~2.2 months

    Partnership Structure

    • Ownership: 51% EvTronics (Local assembly, plant management, regulatory compliance) and 49% EV Batteries Inc. (Technical oversight, QA, supply chain for child parts).
    • Governance: 5-member board (3 from EvTronics, 2 from EV Batteries Inc.). CEO appointed by EvTronics; CTO appointed by EV Batteries Inc.
  2. ClawWork Economic Rules and Survival Thresholds

    main

    ClawWork is an economic survival simulation where every API call incurs costs based on input and output tokens.

    Core Rules

    • Costs: Every API call deducts money from your balance.
    • Income: Completing tasks earns between $0–$5,000 depending on quality.
    • Quality Threshold: Evaluations below a 0.6 score result in $0 payment.
    • Learning: Learning builds knowledge for future tasks but provides no immediate pay.

    Survival Status Thresholds

    StatusBalance
    Thriving> $500
    Stable$100 – $500
    Struggling$0 – $100
    Bankrupt<= $0

    Strategy: Prioritize work when struggling; invest in learn when thriving.

  3. Run the ClawMode agent and gateway

    main

    Use the clawmode_integration.cli module to interact with the agent or start a gateway for external channels (Telegram, Discord, etc.).

    • Chat locally (with economic tracking): python -m clawmode_integration.cli agent
    • Send a single message: python -m clawmode_integration.cli agent -m "message"
    • Assign a paid task: Use the /clawwork prefix: python -m clawmode_integration.cli agent -m "/clawwork <instruction>"
    • Start the gateway: python -m clawmode_integration.cli gateway
    # Chat locally (like `nanobot agent` but with economic tracking)
    python -m clawmode_integration.cli agent
    
    # Single message
    python -m clawmode_integration.cli agent -m "Hello"
    
    # Assign a paid task
    python -m clawmode_integration.cli agent -m "/clawwork Write a market analysis for EVs"
    
    # Channel gateway (Telegram, Discord, etc.)
    python -m clawmode_integration.cli gateway
  4. Execute OverpassQL query for I-40 route analysis

    main

    To extract interstate way relations, nodes, and metadata for the I-40 corridor (between Albuquerque, NM and Oklahoma City, OK) for speed and lane availability analysis, follow these steps:

    1. Navigate to https://overpass-turbo.eu/.
    2. Paste the OverpassQL query into the editor.
    3. Click Run or press Ctrl+Enter.
    4. Wait for completion (typically 30-60 seconds).

    Note: The query uses a bounding box (34.5°N to 36.0°N, -107.0°W to -97.0°W) and includes recursive node fetching (>;) to ensure complete geometry and full metadata via out body;.

    [out:json][timeout:25];
    // Define bounding box for I-40 corridor between Albuquerque and Oklahoma City
    // Approximate coordinates: Albuquerque (35.0853,-106.6056) to Oklahoma City (35.4676,-97.5164)
    (( 
      // Get I-40 ways
      way["ref"="I-40"](34.5,-107.0,36.0,-97.0);
      // Get nodes for these ways
      node(w);
      // Get relations containing I-40 ways
      relation["ref"="I-40"](34.5,-107.0,36.0,-97.0);
      // Get members of these relations
      node(r);
      way(r);
      relation(r);
    );
    // Also get highway=trunk roads that are part of I-40
    way["highway"="trunk"]["ref"="I-40"](34.5,-107.0,36.0,-97.0);
    node(w);
    relation["highway"="trunk"]["ref"="I-40"](34.5,-107.0,36.0,-97.0);
    node(r);
    way(r);
    relation(r);
    );
    // Output full data including geometry and metadata
    out body;
    >; // Recursively get all nodes for ways
    out skel qt;
  5. Setup Meta-Prompt Generation environment

    main

    To prepare the environment for generating evaluation prompts, set your OpenAI API key as an environment variable and install the required Python dependencies: pandas, pyarrow, and openai.

    export OPENAI_API_KEY='your-key'
    pip install pandas pyarrow openai
  6. Implement the Partnership Roadmap

    main

    The partnership implementation is divided into three time-based stages:

    Immediate Next Steps (Next 30 Days)

    1. Approve Partnership Structure: Obtain board approval for the 49:51 structure, conduct legal review, and sign a non-binding MOU.
    2. Form Negotiation Team: Assemble a cross-functional team (Procurement, Finance, Legal, Technical) and appoint a lead negotiator.
    3. Detailed Due Diligence: Perform financial audits, technical capability assessments, and infrastructure evaluations.
    4. Government Engagement: Meet with PMP authorities to confirm incentive eligibility and secure approvals.

    Short-Term Actions (Months 2-3)

    1. Finalise Partnership Agreement: Complete legal documentation, define SLAs and KPIs, and establish the governance framework.
    2. Facility Planning: Select and assess sites, specify equipment, and apply for permits.
    3. Workforce Planning: Design recruitment strategies, training programs, and organizational structures.

    Medium-Term Actions (Months 4-6)

    1. Facility Setup: Execute construction/modifications, install equipment, and validate processes.
    2. Pilot Production: Conduct trial runs, validate quality, and optimise processes.
    3. Full-Scale Launch: Ramp up to 110,000 units/year, integrate the supply chain, and begin performance monitoring.
  7. Test single category meta-prompt generation

    main

    Run the test script to verify the generation process for a single category. This is a quick way to validate your setup and costs approximately 30 seconds and $0.05.

    python test_single_category.py
  8. Install ClawWork

    main

    To install ClawWork, clone the repository and set up a Python 3.10+ environment. Using conda is recommended.

    # Clone the repository
    git clone https://github.com/HKUDS/ClawWork.git
    cd ClawWork
    
    # Set up Python environment (Python 3.10+)
    conda create -n clawwork python=3.10
    conda activate clawwork
    git clone https://github.com/HKUDS/ClawWork.git
    cd ClawWork
    
    # With conda (recommended)
    conda create -n clawwork python=3.10
    conda activate clawwork
  9. Run ClawMode via CLI or Gateway

    main

    Before running, ensure you have set your PYTHONPATH to include the repository root so the gateway can find the clawmode_integration and livebench packages:

    export PYTHONPATH="$(pwd):$PYTHONPATH"

    Use the CLI for interactive sessions or single messages. This mode includes full ClawWork economic tracking and the /clawwork command.

    Interactive mode:

    python -m clawmode_integration.cli agent

    Single message:

    python -m clawmode_integration.cli agent -m "What tools do you have?"

    Assign a paid task:

    python -m clawmode_integration.cli agent -m "/clawwork Write a market analysis for EVs"

    Option B: Channel Gateway

    To run the agent as a gateway for external channels (Telegram, Discord, etc.):

    python -m clawmode_integration.cli gateway
    export PYTHONPATH="$(pwd):$PYTHONPATH"
    
    # Interactive mode
    python -m clawmode_integration.cli agent
    
    # Assign a paid task
    python -m clawmode_integration.cli agent -m "/clawwork Write a market analysis for EVs"