Skip to content

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

♾️ InfinitySnap πŸ«°πŸ»πŸ’œ

InfinitySnap is a supervised autonomous code-fixing system with explicit policy enforcement, verification, rollback, and full replayability.

InfinitySnap wraps the Cline CLI inside a strict, auditable control loop designed for correctness, transparency, and restraint β€” unlike blind automation.

Correctness > speed
Transparency > magic


πŸ” What Problem InfinitySnap Solves

Most autonomous β€œauto-fix” tools:

  • silently modify code
  • apply unverified changes
  • fail without explanation
  • cannot be audited after execution

InfinitySnap is intentionally different.

It treats autonomy as a controlled capability, not a default behavior.

Every fix is:

  • confidence-gated
  • policy-constrained
  • verified deterministically
  • recorded step-by-step

Nothing is hidden.


🧠 Core Philosophy

InfinitySnap is not a coding assistant.
It is a supervised autonomous system.

The agent:

  • cannot act freely
  • cannot bypass policy
  • cannot apply unverified changes
  • cannot hide failures or reasoning

Judges and reviewers can inspect every artifact.


🧬 End-to-End Lifecycle

A single InfinitySnap run follows this lifecycle:

  1. Sandbox Execution
    Run the command (direct or isolated).

  2. Failure Analysis
    Parse stdout/stderr, stack traces, error signals.

  3. Confidence Gate
    If confidence < threshold β†’ refuse (no edits).

  4. Supervised Fix (Cline)
    Generate a patch under strict policy constraints.

  5. Verification
    Re-run the original command.

  6. Rollback (if needed)
    Failed verification or policy violation β†’ revert.

  7. Replay & Artifacts
    Persist logs, diffs, metrics, and a full timeline.


πŸ—οΈ System Architecture

Developer / CI / Judge
        |
        v
InfinitySnap CLI (optional)
        |
        v
Backend API (Express)
        |
        +-- Sandbox Runner
        |   - direct mode
        |   - sandbox copy mode
        |
        +-- Analyzer
        |   - error extraction
        |   - confidence scoring
        |
        +-- Policy Engine
        |   - command restrictions
        |   - patch constraints
        |
        +-- Cline Executor (supervised)
        |   - constrained autonomy
        |
        +-- Verifier
        |   - deterministic re-run
        |
        +-- Artifact Store
            - logs
            - patch / diff
            - timeline (txt + json)

Artifacts are stored on disk and served via explicit HTTP endpoints.
There is no hidden state.


πŸ§ͺ Execution Modes

InfinitySnap supports two execution modes:

Direct Mode (Fast)

  • Runs commands directly in the repository
  • Used for demos and trusted code
  • No repository copy (copyMs = 0)

Sandbox Mode (Safe)

  • Copies repository (with excludes)
  • Executes in a temporary directory
  • Cleanup is timed and logged

The execution mode is always recorded in the timeline.


🚦 Confidence-Gated Autonomy

Before any fix is attempted:

  • failure signals are analyzed
  • a confidence score is computed
  • a threshold is enforced

If confidence is below threshold:

status: refused_low_confidence
  • No patch is generated
  • No files are touched

This restraint is intentional.


πŸ” Policy & Safety Guarantees

InfinitySnap enforces safety through explicit gates:

Command Policy

  • Blocks destructive or unsafe commands
  • Optional allowlist enforcement

Patch Policy

  • Blocks sensitive paths (.env, .ssh, credentials)
  • Limits scope of modifications

Verification Requirement

  • Changes persist only if verification passes
  • Failure triggers automatic rollback

Every decision is:

  • logged
  • timestamped
  • replayable

πŸ€– AI Model & Provider

InfinitySnap does not directly call OpenAI APIs in its backend logic.
Instead, it delegates reasoning to Cline, operating in ACT mode.

Typical demo configuration (via Cline):

  • Provider: OpenAI (native)
  • Model: gpt-5-mini
  • Mode: ACT (execution-focused)
  • Reasoning Effort: medium
  • Planning: bounded
  • Thinking Budget: capped

Authentication Configuration

Model configuration is explicit and inspectable:

cline config list --output-format json

InfinitySnap treats the model as a tool, not a decision-maker.


🧾 Artifacts & Replay

Each run produces complete, inspectable artifacts:

  • sandbox stdout / stderr
  • analyzer output
  • generated patch
  • git diff
  • verification logs
  • execution timeline

Timeline (Human-readable)

GET /api/v1/runs/:id/timeline

Example:

[0.00s] fix.start β†’ start
[0.01s] fix.cline β†’ start
[163.35s] fix.cline β†’ ok
[163.51s] fix.verify β†’ start
[164.52s] fix.verify β†’ ok
[164.52s] fix.complete β†’ verified

Timeline (Machine-readable)

GET /api/v1/runs/:id/timeline.json

πŸ“Έ Screenshots

CLI Fix Pipeline

End-to-end execution showing SNAP β†’ ANALYZE β†’ FIX β†’ VERIFY with confidence gating.

CLI Fix Pipeline

Timeline Replay

Human-readable execution timeline with precise step durations.

Timeline Replay

Artifact Index

All persisted run artifacts (logs, diff, patch, timeline) exposed via API.

Artifact Index


πŸ“‚ Repository Structure

infinity-snap/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ analyzer.ts
β”‚   β”‚   β”œβ”€β”€ sandboxRunner.ts
β”‚   β”‚   β”œβ”€β”€ policy.ts
β”‚   β”‚   β”œβ”€β”€ routes.ts
β”‚   β”‚   β”œβ”€β”€ timeline.ts
β”‚   β”‚   β”œβ”€β”€ runStore.ts
β”‚   β”‚   β”œβ”€β”€ verifier.ts
β”‚   β”‚   └── start.ts
β”‚   β”œβ”€β”€ .data/
β”‚   β”‚   β”œβ”€β”€ runs/
β”‚   β”‚   β”œβ”€β”€ logs/
β”‚   β”‚   β”œβ”€β”€ diffs/
β”‚   β”‚   └── artifacts/
β”‚   └── package.json
β”‚
β”œβ”€β”€ infinitysnap-dashboard/    # Next.js dashboard UI
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── lib/
β”‚   └── package.json
β”‚ 
β”œβ”€β”€ cli/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ apiClient.ts
β”‚   β”‚   β”œβ”€β”€ commands/
β”‚   β”‚   β”œβ”€β”€ config.ts
β”‚   β”‚   └── ui/
β”‚   └── package.json
β”‚
β”œβ”€β”€ samples/
β”‚   └── infinitysnap-demo/
β”‚       β”œβ”€β”€ src/
β”‚       β”œβ”€β”€ tests/
β”‚       └── package.json
β”‚
β”œβ”€β”€ scripts/
β”‚   └── cline.sh
β”‚
└── README.md

πŸš€ Quickstart

Start Backend

cd backend
npm install
npm run dev

Health checks:

curl http://localhost:4000/health
curl http://localhost:4000/api/v1/health

πŸ–₯️ Start Dashboard (Frontend)

InfinitySnap includes a Next.js dashboard for inspecting runs, timelines, logs, diffs, and artifacts.

Start Dashboard

cd infinitysnap-dashboard
npm install
npm run dev

Open in Browser

http://localhost:3000

The dashboard automatically connects to the backend API and provides:

  • run list & status overview
  • timeline replay
  • log, diff, and patch viewers
  • confidence & verification visibility

πŸ§ͺ Run Demo

cd samples/infinitysnap-demo
npm test
infinitysnap fix . --command "npm test"

πŸ”Œ API Reference

Base URL:

http://localhost:4000/api/v1

List runs

GET /runs

Run artifacts

GET /runs/:id/artifacts

Logs

GET /runs/:id/logs
GET /runs/:id/logs?name=sandbox.stdout
GET /runs/:id/logs?name=sandbox.stderr

Fix pipeline

POST /runs/:id/fix

Triggers the supervised fix β†’ verify pipeline for a failed run.

Possible outcomes:

  • verified
  • rolled_back
  • refused_low_confidence
  • refused_not_git

⏱️ Performance Notes

  • Snap and Verify are usually fast (command execution time).
  • Fix duration depends on model reasoning and repository scope.
  • Timeline explicitly shows where time is spent (fix.cline).
  • InfinitySnap prioritizes correctness and auditability over raw speed.

⏱️ Timeout Diagnostics & Fix

InfinitySnap is designed to never hang silently. If a backend fix takes too long, the CLI intentionally falls back to a local, supervised Cline execution.

This section documents how to diagnose timeout issues and how they were fixed.

πŸ” Problem Observed

During early runs, the CLI showed:

  • βœ– Calling /runs/:id/fix …
  • ⚠ Backend /runs/:id/fix threw β€” falling back to local Cline.

Even though the backend fix eventually succeeded when triggered manually.

πŸ§ͺ Diagnostic Step β€” Prove Where the Timeout Occurs

Run the fix with all FIX-related timeouts disabled:

export INFINITYSNAP_FIX_HTTP_TIMEOUT_MS=0
export INFINITYSNAP_FIX_TIMEOUT_MS=0
infinitysnap fix . --command "npm test"

πŸŽ₯ Demo Video

▢️ InfinitySnap β€” End-to-End Demo (2 minutes)

InfinitySnap Demo Video


Dashboard

Dashboard Dashboard

πŸ™ Acknowledgements

Built using Cline, OpenAI models (via Cline), and the Node.js / TypeScript ecosystem.

About

Supervised autonomous code fixing tool with verification, rollback, and full execution replay.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

Contributors

Languages