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, 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.5.0.tar.gz (88.3 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.5.0-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fix_cli-0.5.0.tar.gz
  • Upload date:
  • Size: 88.3 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.5.0.tar.gz
Algorithm Hash digest
SHA256 2435486e4b5297215be7f59851a41abfa1049647d50cd39a7da835ff4dea5b21
MD5 1c14c5aad3489bcd0e2d2df46a1ac4eb
BLAKE2b-256 2920e5c0c90242db53a9b3c558c07a0b313fcc27f6c9797564838cd0e2761c79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fix_cli-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 70.4 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dec4d28294869153e785a187bcba239fcf948a65ba9c6656d379f6429931b4b9
MD5 850f0a254c18fda49fa5bf6e705dbc49
BLAKE2b-256 71866ec22135efd6e3054b1413b696da88a50ddcc152ff24ca54bb07a10d16c4

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