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)

Market mode (free platform agent)

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

fix --market "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, judge; reputation via on-chain Nano balance)
  • 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.6.0.tar.gz (125.5 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.6.0-py3-none-any.whl (101.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fix_cli-0.6.0.tar.gz
  • Upload date:
  • Size: 125.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fix_cli-0.6.0.tar.gz
Algorithm Hash digest
SHA256 59cda60446a1d01c19150bbddce8787849005d4b06ccdbb7e6b5e5c6898bc880
MD5 9f85338581c9346eefed6185b2545421
BLAKE2b-256 84ae4543fca847d93c9fd272290e6ecd12425e3d3e57ffa39a3421f18bed7a6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fix_cli-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 101.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fix_cli-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8cf69ee2470a284b0c449d8e19290e80b2d9ce227835876b64d8593c25a272b
MD5 21c43ef8ce15a242c27da5d3105a4a74
BLAKE2b-256 63eea541c6dd004dc972aa38ed64d6d73a962b2da17d89c823a30dcd09318ab9

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