Skip to main content

Autonomous engineering execution platform for AI agents — execution resilience, micro-branching, and log compression by HAVFRYS Labs.

Project description

HAVFRYS Banner

HAVFRYS

An Uncertainty-Aware Engineering Runtime for AI Coding Agents

PyPI Package Python Versions License Rust Engine MCP Server Tests


What is HAVFRYS?

HAVFRYS is an uncertainty-aware engineering runtime built for AI coding agents (Claude Code, Cursor, Gemini CLI, VS Code, Windsurf, OpenCode, Cline, Continue, Zed).

AI coding agents excel at linear tasks, but fail when tasks become uncertain. When a complex refactor or dependency upgrade breaks 40 tests across a codebase, agents lose their place, oscillate in trial-and-error loops, and hallucinate fixes.

HAVFRYS provides execution resilience:

  • Linear by Default: Simple commands execute with near-zero overhead.
  • Uncertainty-Driven Micro-Branching: Automatically detects when linear execution hits an uncertainty point, spawning budget-constrained micro-branches to evaluate competing engineering solutions in isolated worktrees.
  • Aggressive Loop Termination: Detects code oscillation ($A \to B \to A \to B$) and kills failing branches before token drift occurs.
  • Immediate Merge: Merges the winning branch back into the working tree cleanly.

Quickstart

1. Install via PyPI

pip install havfrys

2. Auto-Configure Local Coding Agent

havfrys init
Welcome to HAVFRYS.

Detected Claude Code.

Configure automatically? [Y/n]

3. Verify Environment Health

havfrys doctor
HAVFRYS Diagnostics

Runtime:             [ok] Installed
Python:              [ok] 3.14.6
MCP Server:          [ok] Available (havfrys serve)
Clients:             [ok] Claude Code, Cursor, VS Code detected
Compression Engine:  [ok] Loaded (Lossless + SmartCrusher)
Loop Detection:      [ok] Loaded (BranchLoopDetector)
Version:             v0.2.2
Repository:          [ok] Ready

System Architecture & Execution Flow

1. Complete Task Execution Lifecycle

                                HAVFRYS
          Uncertainty-Aware Repository Evolution Runtime
                                |
                                |
                         ---------------------------------
                         |                               |
                        SDK                             MCP
                         |                               |
                  havfrys.run()                        havfrys tool
                  havfrys.resume()                         |
                  havfrys.inspect()                        |
                         |                               |
                         ---------------------------------
                                        |
                                        |
                                Task Submission
                                        |
                                        |
                  "Modernize this repository to 2026 standards"
                                        |
                                        |
                                  Orchestrator
                                        |
                                        |
                          Is this a difficult engineering task?
                                        |
                       -----------------------------------------
                       |                                       |
                      NO                                      YES
                       |                                       |
                 Linear Execution                       Linear Execution
                  (20-50 ms)                                   |
                       |                                       |
                    SUCCESS                                    |
                                                               |
                                                      Uncertainty Detection
                                                               |
                                               Is this an engineering uncertainty point?
                                                               |
                                           ----------------------------------------
                                           |                                      |
                                          NO                                     YES
                                           |                                      |
                                      Retry / Fix                          Spawn Micro Branches
                                           |                                      |
                                           |                        -----------------------------------
                                           |                        |                |                |
                                           |                     Branch A         Branch B         Branch C
                                           |                        |                |                |
                                           |                        |                |                |
                                           |                  Execute Task      Execute Task      Execute Task
                                           |                        |                |                |
                                           |                        -----------------------------------
                                           |                                        |
                                           |                                Internal Loop Detection
                                           |                                        |
                                           |                                Kill Losing Branches
                                           |                                        |
                                           |                                 Select Winner Branch
                                           |                                        |
                                           ------------------------------------------
                                                               |
                                                      Merge Winning Changes
                                                               |
                                                      Resume Linear Execution
                                                               |
                                                      Validate Repository State
                                                               |
                                               -----------------------------------
                                               |                                 |
                                            FAILED                            SUCCESS
                                               |                                 |
                                       Recover / Retry                   Repository GREEN
                                               |                                 |
                                               -----------------------------------
                                                               |
                                                         Final Result
                                                               |
                                            Python 3.14 + Tests Passing + Docs Updated

2. Runtime Component Stack

                                HAVFRYS RUNTIME
                                       |
                                       |
                                Orchestrator
                                       |
               ---------------------------------------------------
               |                |               |               |
        Compression Engine   Memory Engine   Loop Engine    Branch Engine
               |                |               |               |
               ---------------------------------------------------
                                       |
                                Repository State
                                       |
               ---------------------------------------------------
               |                |               |               |
             Git             Worktrees        Tests           Validation
               |                |               |               |
               ---------------------------------------------------
                                       |
                                 Execution Layer
                                       |
                       -------------------------------------
                       |                                   |
                    Native                             Docker
                    Backend                             Backend

3. End-User Integration Journey

                    pip install havfrys
                              |
                         havfrys init / doctor
                              |
                     Configure MCP Client
                              |
                      Claude Code / Gemini
                      Cursor / OpenCode etc.
                              |
                    "Modernize this repository"
                              |
                             HAVFRYS
                              |
                     Repository GREEN
                              |
                        Continue Working

The 7 Invariants

  1. Linear Execution Default: Simple commands execute natively with ~20ms overhead.
  2. Branch at Uncertainty: Micro-branching only activates when ambiguous failures recur.
  3. Tiny, Short-Lived Branches: Ephemeral worktrees constrained by hard budgets (2,000 tokens, 5 attempts, 3 minutes).
  4. Compress Before Reasoning: Output streams are compressed before model evaluation.
  5. Rich Internal Loop Detection: Catches code oscillation ($A \to B \to A \to B$), no-diff stagnation, and compression loops.
  6. Aggressive Branch Termination: Bad branches exceeding budgets or looping are killed immediately.
  7. Immediate Patch Merge: Winning micro-branch merges back into the source working tree cleanly.

The 3 HAVFRYS Laws

  • Law #1: Nothing reasons over raw artifacts.
  • Law #2: Nothing branches unless uncertainty exists.
  • Law #3: Nothing lives longer than its usefulness.

Single-Tool FastMCP Server

HAVFRYS exposes a single, unified MCP tool (havfrys) over stdio:

havfrys serve

Input

{
  "task": "Upgrade codebase to Pydantic V2 and fix breaking schema changes"
}

Output

{
  "status": "success",
  "summary": "Task completed successfully in 1.42s across 2 attempt(s). Spawning 2 micro-branches; Branch A merged.",
  "output": "...",
  "error": null,
  "next_steps": "Proceed to next task.",
  "retries": 1,
  "cached": false,
  "mode": "branching"
}

Python API Primitives

import havfrys

# 1. Execute an engineering task
result = havfrys.run("Fix breaking API migration tests")

# 2. Resume work from last execution state
result = havfrys.resume()

# 3. Inspect execution trajectory history
info = havfrys.inspect()

Real Engineering Case Studies (The Dogfooding Suite)

HAVFRYS is evaluated on real production repositories facing breaking ecosystem migrations. See DOGFOODING.md for the full 10-repository case study matrix across Python 3.14, Pydantic V2, Django, Prefect, and GraphQL stacks.

# Repository Task Stress Test Status
1 FastAPI Full Stack Template Modernize 2023 template to 2026 standards Pydantic V2, SQLModel 2026, Thread Isolation DONE (54/54 Passed)
2 Cookiecutter Django Upgrade Python 3.14 & Django Django ORM, CI/CD, Env setup DONE (193 Passed)
3 Prefect Modernize dependencies & tests Async systems, 380+ flow tests DONE (384 Passed)
4 LiteLLM Modernize OpenAI & Anthropic SDKs AI tooling & breaking API migrations DONE (209 Passed)
5 CrewAI Upgrade agent framework stack Agent schema breakages & API updates DONE (16/16 Passed)
10 HAVFRYS Self-dogfooding & refactoring Architectural consolidation & Rust bindings DONE (468/468 Passed)

Demo

HAVFRYS Terminal Execution & Micro-Branching Demo


Local Development & Testing

Build Rust Engine

maturin develop --offline

Run Full Test Suite

pytest tests/
cargo test

License

HAVFRYS is released under the Business Source License 1.1 (BUSL-1.1).

  • Production, Personal, Academic, & Internal Company Use: Permitted under the Additional Use Grant.
  • Commercial SaaS & Competing Offerings: Prohibited without explicit written authorization from Licensor.
  • Automatic Open Source Transition: On January 1st, 2030, HAVFRYS automatically converts to the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

havfrys-0.2.3.tar.gz (6.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

havfrys-0.2.3-cp38-abi3-macosx_11_0_arm64.whl (861.8 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file havfrys-0.2.3.tar.gz.

File metadata

  • Download URL: havfrys-0.2.3.tar.gz
  • Upload date:
  • Size: 6.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for havfrys-0.2.3.tar.gz
Algorithm Hash digest
SHA256 6b41677009dbd50c913aabcb270bc9ab780b3e124807246a74f3600ab73d1f8d
MD5 59482af67f60ae614bfab019ea068f2b
BLAKE2b-256 6539c2059d1a85a350b00ed0553063e6812a1f57d79ca373c5178c909a1cd7b3

See more details on using hashes here.

File details

Details for the file havfrys-0.2.3-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for havfrys-0.2.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa0671df21e4ab4b1bef7ae55009ac47ee81722d65fbcad57833faabbd92973a
MD5 16252e8adafd971416935ac8600712a7
BLAKE2b-256 28b57308f3e1d2d3f4c7a0737fb88f156496f4fce09c1867c4a5ac84d433d68f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page