Skip to main content

frontierharness

PyPI Version Python License Dependencies

frontierharness is an industry-grade, zero-dependency core tool execution, safety, and cognitive orchestration engine for autonomous AI agents. Built to power frontier agent harnesses like Antigravity and Claude Code, it provides the low-level nervous system and guardrails: path-isolated filesystem manipulation, surgical diffing, process supervision, context compaction, a specialized subagent triad (Explorer, Implementer, Verifier), and automated self-healing loops.


Architecture Overview

flowchart TD
    User["User Goal / Task"] --> Session["SessionManager<br/>(JSONL Persistence & Token Compaction)"]
    Session --> Orchestrator["AdaptiveOrchestrator<br/>(Role RBAC & Self-Healing Loop)"]
    
    subgraph Subagents ["Specialized Subagent Triad"]
        Explorer["1. Explorer Subagent<br/>(Read-only search & index)"]
        Implementer["2. Implementer Subagent<br/>(Surgical diffs & writes)"]
        Verifier["3. Verifier Subagent<br/>(Syntax check & test gate)"]
    end
    
    Orchestrator --> Explorer
    Explorer --> Implementer
    Implementer --> Verifier
    
    subgraph Engine ["agentharness Core Engine"]
        FS["SafeFilesystem<br/>(Path Traversal Guard)"]
        Proc["SubprocessManager<br/>(Timeouts & Background Tasks)"]
        Loop["loopcircuit Hook<br/>(Anti-Thrash Circuit Breaker)"]
    end
    
    Implementer --> FS
    Verifier --> Proc
    Proc --> Loop
    Verifier -->|Verification Failed| Orchestrator
    Verifier -->|Verification Passed| Done["Complete & Verified"]

Key Capabilities

  1. Path Traversal Protection: Enforces strict workspace root boundaries, preventing unauthorized path escapes and system tampering.
  2. Surgical Diff Engine: Replaces exact character sequences rather than rewriting entire files, eliminating hallucinated line drifts.
  3. Subagent Triad & Security RBAC: Specialized subagent roles with enforced tool permissions (Explorer read-only, Implementer modifying, Verifier test-only).
  4. Self-Healing Verification Gate: Automatically validates code syntax and executes automated test suites on modified files, injecting recovery steps if tests fail.
  5. Interactive Diff Viewer & Approval Gate: Displays color-coded terminal diffs (+6 -1) with line numbers and human confirmation prompts (Accept this file edit? [y/n/a]) before committing changes to disk.
  6. Live Plan Checklist Renderer: Visualizes task progress in the terminal (L ✓, ●, ○) matching frontier standards.
  7. Time-Travel Checkpoint & Rewind: Automatically snapshots pre-mutation file states, allowing instant undo or rollback of both physical files and agent memory back to any checkpoint.
  8. Docker Container Sandboxing: Optional isolated container execution with network isolation (--network none) and memory/CPU limits.
  9. Session Persistence & Smart Compaction: Incrementally records sessions to .harness/sessions/<id>.jsonl with automatic context compaction when approaching context limits.
  10. Zero External Dependencies: Built 100% on Python 3.10+ standard library. Optional hooks for loopcircuit and groundanchor.

Installation

pip install frontierharness

Optional safety integrations:

pip install "frontierharness[all]"

Quickstart

1. High-Level Adaptive Orchestrator with Subagents

from frontierharness import ToolEngine, SessionManager, AdaptiveOrchestrator

# Initialize core engine and session persistence
engine = ToolEngine(workspace_roots=["./workspace"])
session = SessionManager(session_id="build_feature_01")
orchestrator = AdaptiveOrchestrator(engine=engine, session=session)

# 1. Define adaptive plan
orchestrator.set_plan([
    {"title": "Explore existing codebase", "role": "explorer"},
    {"title": "Implement feature code", "role": "implementer"},
    {"title": "Run automated verification", "role": "verifier"},
])

# 2. Explorer reads files safely (Explorer cannot modify files)
explore_res = orchestrator.execute_as_role(
    role="explorer",
    tool_name="read_file",
    args={"path": "./workspace/main.py"},
)

# 3. Implementer performs surgical exact edit
edit_res = orchestrator.execute_as_role(
    role="implementer",
    tool_name="edit_file",
    args={
        "path": "./workspace/main.py",
        "target": "return 100",
        "replacement": "return 200",
    },
)

# 4. Verifier gate checks syntax and runs test suite
report = orchestrator.verify_and_heal(test_command="pytest ./workspace/tests")
if not report.passed:
    print("Verification failed! Self-healing step injected:", orchestrator.plan[-1].title)
else:
    print("Task verified and complete!")

2. Standalone Core Tool Engine

from frontierharness import ToolEngine

engine = ToolEngine(workspace_roots=["./workspace"])

# Atomic write
engine.execute("write_file", {
    "path": "./workspace/app.py",
    "content": "def run():\n    return True\n",
    "overwrite": True,
})

# Supervised command execution
cmd = engine.execute("run_command", {
    "command": "python ./workspace/app.py",
    "timeout_seconds": 15.0,
})
print("Output:", cmd.output)

3. Interactive CLI with Live Diffs & Approval Prompts

Run tools interactively in the terminal with human-in-the-loop approval:

python -m frontierharness run edit_file '{"path": "./main.py", "target": "port = 8080", "replacement": "port = 9000"}' --interactive

Output:

Pending edit
main.py  +1 -1
  41 - port = 8080
  41 + port = 9000
Reason: Surgical string edit

Accept this file edit? [y]es / [n]o / [a]lways allow:

4. Time-Travel Undo & Rewind

Instant rollback of file changes and newly created files to a clean checkpoint:

# Instant undo of the last step
python -m frontierharness undo

# Rewind to a specific checkpoint ID
python -m frontierharness rewind cp_002_a1b2c3

Empirical Benchmarks

Measured on Windows 11 / Python 3.11 over 500 iterations:

Operation Metric Latency
read_file (windowed slice) P50 ~1.0 ms
write_file (atomic commit) P50 ~2.1 ms
edit_file (surgical diff) P50 ~8.0 ms
Dispatch & RBAC overhead P50 < 0.05 ms

Run benchmarks locally:

python -m frontierharness benchmark

License

Licensed under the MIT License. Open-source runtime infrastructure for autonomous AI agents.

Metadata

Release files for frontierharness 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frontierharness 0.1.0
File Size Uploaded Provenance Actions
frontierharness-0.1.0.tar.gz 33.7 kB With provenance Details for frontierharness-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for frontierharness 0.1.0
File Interpreter ABI Platform Actions
frontierharness-0.1.0-py3-none-any.whl Python 3 none any Details for frontierharness-0.1.0-py3-none-any.whl

Total release size: 65.2 kB

Release files / frontierharness-0.1.0.tar.gz

Download URL frontierharness-0.1.0.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
028426f557eed256a0ab4901d23068a2b4d476b83f2bdb9d4efbf9b14fdc6823
BLAKE2b-256 checksum
How to use checksums
74a311d9332e7ba8e6c75e93a0ca076c620478af6fa320485ac4bf51c5f7bfaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / frontierharness-0.1.0-py3-none-any.whl

Download URL frontierharness-0.1.0-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1414eeabc30fd194422075babb12ed49513f66bdbbfd5e9f0a50f8d4cff2295
BLAKE2b-256 checksum
How to use checksums
79beca3051db693bac09b9c83fd31174917827891d061cfa7a907d4c3bff2bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for frontierharness 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for frontierharness-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page