Skip to main content

AI-powered command fixer with contract-based dispute resolution

Project description

fix

AI-powered command fixer. A command fails, an LLM diagnoses it, proposes a fix, and a contract system tracks the whole thing. Disputes go to an AI judge.

Quick start

pip install git+https://github.com/karans4/fix.git

Local mode (you need an API key)

export ANTHROPIC_API_KEY=sk-ant-...   # or OPENAI_API_KEY, or run Ollama

fix "gcc foo.c"         # run command, fix if it fails
fix it                  # fix the last failed command
fix --explain "make"    # just explain the error
fix --dry-run "make"    # show fix without running
fix --local "make"      # force Ollama (free, local)

Remote mode (free platform agent)

Post a contract to the platform. A free AI agent picks it up and proposes a fix.

fix --remote "gcc foo.c"

Platform: https://fix.notruefireman.org (free during testing)

Configure in ~/.fix/config.py:

platform_url = "https://fix.notruefireman.org"
remote = True  # default to remote mode

Shell integration

For fix it / fix !! to work, add to your shell config:

# bash/zsh
eval "$(fix shell)"

# fish
fix shell fish | source

# or auto-install
fix shell --install

Safe mode (sandbox)

Default on Linux. Runs fixes in OverlayFS -- changes only committed if verification passes.

fix "make build"          # sandbox on Linux by default
fix --no-safe "make"      # skip sandbox
fix --safe "make"         # force sandbox

Verification

fix "gcc foo.c"                              # default: re-run, exit 0 = success
fix --verify=human "python3 render.py"       # human judges
fix --verify="pytest tests/" "pip install x"  # custom command

How it works

  1. Command fails, stderr captured
  2. Contract built (task, environment, verification terms, escrow)
  3. Agent investigates (read-only commands), then proposes fix
  4. Fix applied, verified mechanically
  5. Multi-attempt: up to 3 tries, feeding failures back as context
  6. Disputes go to an AI judge who reviews the full transcript

Architecture

  • fix -- CLI entry point
  • server/ -- FastAPI platform (contracts, escrow, reputation, judge)
  • protocol.py -- state machine, constants
  • scrubber.py -- redacts secrets from error output before sending to LLM
  • contract.py -- builds structured contracts
  • client.py / agent.py -- remote mode client and agent

License

MIT

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

fix_cli-0.4.0.tar.gz (85.9 kB view details)

Uploaded Source

Built Distribution

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

fix_cli-0.4.0-py3-none-any.whl (68.5 kB view details)

Uploaded Python 3

File details

Details for the file fix_cli-0.4.0.tar.gz.

File metadata

  • Download URL: fix_cli-0.4.0.tar.gz
  • Upload date:
  • Size: 85.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fix_cli-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e81ba9b871b38bef54591c3fafc4fbff63009a55480e88e89eae5a6bf99d5539
MD5 bbca65afb39ce47cf0d591e0d8d74ba3
BLAKE2b-256 cee1a814d399b2a6aae846f3f680d60a8d692c7f2b452d4a09c699f82c0f8657

See more details on using hashes here.

File details

Details for the file fix_cli-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: fix_cli-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 68.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fix_cli-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 575e0269682d1c72de1d5c30f593a05e99beb8b37342407c8fd93a73443702c6
MD5 e98dfe078739b2488f8f2219334db8b8
BLAKE2b-256 e1ec71ed72706667b3f52dc10e08721605edcd50964e4e0477807ee3e580c87e

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