claude-code-from-scratch  by FareedKhan-dev

Harness engineering for production AI agents

Created 3 months ago
259 stars

Top 97.6% on SourcePulse

GitHubView on GitHub
Project Summary

Summary This repository reconstructs Anthropic's Claude Code "harness engineering" architecture for engineers and power users. It provides a reproducible framework for building sophisticated AI agent systems by focusing on the execution environment, tool integration, and context management around an LLM. The benefit is a modular, extensible system for understanding and deploying advanced agent capabilities.

How It Works The project employs a phased, modular approach, starting with a minimal agent loop and progressively adding complexity. It adheres to harness engineering principles: model-driven decisions, tool-based interfaces, managed context, and declarative permissions. Each phase introduces specific mechanisms—from tool dispatch and context compression to multi-agent systems and production hardening—with individual Python files demonstrating distinct concepts, all unified by a central core.py.

Quick Start & Requirements Clone the repo, set up a Python 3.10+ virtual environment, and install dependencies (pip install -r requirements.txt). Configure API keys and model IDs in .env. The system supports any LLM provider via LiteLLM proxy integration, requiring pip install litellm[proxy] and configuration in litellm_config.yaml. Detailed explanations are available in the companion Medium blog post: https://medium.com/@fareedkhandev/building-claude-code-using-harness-engineering-d2e8c0da85f0.

Highlighted Details

  • Phased Architecture: Six phases progressively build features from a basic loop to production-grade systems.
  • Modular Design: Core logic in core.py; individual session files demonstrate specific concepts (e.g., s06_context_compact.py).
  • Harness Engineering Focus: Emphasizes execution environments, tool dispatch, context management, and permissions.
  • Production Features: Includes streaming, parallel tool execution, session persistence, declarative permissions, and optional Redis mailboxes.
  • Extensibility: Supports custom tools and models via LiteLLM; includes built-in skills for agent building, code review, and PDF processing.

Maintenance & Community The README prioritizes technical details over community or maintenance specifics. No explicit links to community channels or roadmap information are provided.

Licensing & Compatibility Released under the MIT License, permitting commercial use and integration into closed-source projects. LiteLLM support enhances compatibility with diverse LLM providers.

Limitations & Caveats Areas for future improvement include refactoring parallel subagent spawning, migrating memory to a vector store, implementing fine-grained token accounting, and adding webhook event bus capabilities. The absence of an LLM-as-a-Judge evaluation layer limits its utility as a benchmark system.

Health Check
Last Commit

3 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
94 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.