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

5. Configurable Agent Skill System

Manage modular operational skills across your machine. Developers can configure custom machine paths where skills are discovered and saved:

from frontierharness import SkillManager, ToolEngine

# 1. Initialize skill manager with a custom directory on your machine
skills = SkillManager(custom_storage_path="D:/my-agent-skills")

# Or reconfigure dynamically
skills.set_skills_directory("C:/Users/dev/.gemini/config/skills")

# 2. Automatically bind all skill scripts into ToolEngine as callable tools
engine = ToolEngine(skill_manager=skills)

# 3. Generate LLM system prompt addon listing active skills
prompt_context = skills.get_system_prompt_addon()

Or manage skills directly via the CLI:

# List all discovered skills across default or custom paths
python -m frontierharness skills list --path "D:/my-skills"

# Install a new skill folder into machine storage
python -m frontierharness skills install ./new-skill --target "D:/my-skills"

6. Zero-Hallucination System Prompt Synthesis

Synthesize battle-tested, authoritative Markdown system prompts that instruct LLMs (Claude, GPT-4o, Gemini, local models) on exact tool schemas, surgical diffing laws, verification gates, and time-travel rollback:

from frontierharness import ToolEngine, PromptBuilder

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

# 1. Master system prompt (Markdown string)
system_prompt = builder.build(workspace_root="./workspace")

# 2. Specialized subagent triad prompts
explorer_prompt = builder.build(role="explorer")       # Read-only exploration
implementer_prompt = builder.build(role="implementer") # Surgical diffing & edits
verifier_prompt = builder.build(role="verifier")       # Quality gate & test runner

# 3. Standard chat completion format
system_message = builder.to_message(role="implementer")
# {"role": "system", "content": "# System Prompt: Frontier AI Agent..."}

Or generate and export via the CLI:

# Output prompt to terminal
python -m frontierharness prompt --role implementer

# Save directly to a file
python -m frontierharness prompt --role general --output ./SYSTEM_PROMPT.md

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.2

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.2
File Size Uploaded Provenance Actions
frontierharness-0.1.2.tar.gz 42.5 kB With provenance Details for frontierharness-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 82.1 kB

Release files / frontierharness-0.1.2.tar.gz

Download URL frontierharness-0.1.2.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8840b86d049138a3c222deb92f3d0da9c18da50a305fd0939cd5dfb97d23f956
BLAKE2b-256 checksum
How to use checksums
fc765f56f9c5e7b3b3f51fd931924a16a3370629e31d6c160864847772557c52
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.2-py3-none-any.whl

Download URL frontierharness-0.1.2-py3-none-any.whl
Size 39.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe94434b6c9f02a0ee2bc27ebec547e1cdbc11dc25ad0115cab79f94dc539136
BLAKE2b-256 checksum
How to use checksums
8ae27a4c0f54bda5eaf3039622e08e84f658f465f24ec74e2143521fa0d8c9d8
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.2

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.2.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