AH-Mechanic-1-4B · Apache-2.0

A 4B model that repairs Linux machines, one command at a time.

AH-Mechanic-1-4B is a specially trained version of Qwen3.5-4B for Linux administration. It runs a bash command, reads the output, and decides the next step. It can also answer a request with one shell command.

The Q8_0 file is 4.6 GB and the Q4_K_M file is 2.8 GB, so it runs on one consumer GPU or on a CPU.

  • 82.0%live sandbox tasks passed (Qwen3.5-4B: 73.0%)
  • 4.6 GBQ8_0 file for llama.cpp
  • Apache-2.0license

How it works

It inspects the machine before it changes anything

Give it a task in plain words. Before it deletes, kills or overwrites, it lists what the action will affect. When it is not sure that an option exists, it reads the tool's --help text or man page. When a command fails, it reads the error and fixes the cause.

  1. You describe the problem

    For example, nginx fails to start after last night's edit.

  2. It inspects

    It reads configuration, logs and listening ports, and changes nothing yet.

    $ nginx -t
  3. It runs commands

    One bash command at a time, with the output read before the next step.

    $ sed -i '4s/1024$/1024;/'
  4. It verifies

    It checks the result and writes a short summary of what it changed.

    $ curl -sI localhost

Recorded runs

Live Recorded Mechanic Demos

These are real recordings from a disposable Docker container (Ubuntu 24.04), with opencode 1.19.5 driving AH-Mechanic-1-4B (Q8_0, llama-server, one RTX 3090). Play, pause and scrub a run, or select text in the terminal to copy it.

nginx: config error, port conflict and permissions → HTTP 200

The ticket: nginx will not start, and the site must return HTTP 200. A syntax error in the site configuration, a retired status daemon that still holds port 80, and a web root that the nginx workers cannot read. In this run the model fixed all three faults.

Order of actions: it fixed the missing semicolon in the site configuration and the web-root directory permissions in one command (0:08), found that a status daemon held port 80 and stopped it (0:15 to 0:20), worked through nginx not starting, and made the page file readable (1:08), which gave HTTP 200.

  • Run 2 of 5 recorded runs
  • Time on screen 1:12
  • Outcome HTTP 200, all three faults fixed
  • Pauses over 2 s are shortened to 2 s; no model action was cut

3 of 5 recorded runs fixed all three faults. In 1 run, the model reached HTTP 200 by pointing nginx at a copy of the page in another directory instead of fixing the permissions. In 1 run, it repeated the same check in a loop and stopped at the 15-minute limit. The three runs shown are the ones that fixed all three faults.

Watch run 2 as a video (MP4)

Results

Against the untrained Qwen3.5-4B

Each test runs both models with greedy decoding and bf16 weights. Qwen3.5-4B gets a strong one-command prompt; AH-Mechanic-1-4B gets the prompts it was trained with.

Live sandbox

200 multi-step tasks in a fresh container; a check script decides pass or fail

AH-Mechanic-1-4B82.0%
Qwen3.5-4B, untrained73.0%

One command, held-out requests

370 requests; the command is the same as the reference or judged equivalent

AH-Mechanic-1-4B65.4%
Qwen3.5-4B, untrained45.7%

One command, unseen programs

264 requests for programs that are not in the training data

AH-Mechanic-1-4B63.6%
Qwen3.5-4B, untrained47.0%
All results
TestSizeAH-Mechanic-1-4BQwen3.5-4B
Live sandbox: multi-step tasks, pass200 tasks82.0% (164)73.0% (146)
One command: held-out requests, equivalent37065.4%45.7%
One command: programs never seen in training, equivalent26463.6%47.0%
One command: loosely worded requests, equivalent21021.4%21.0%
One command, held-out requests: right program37095.9%85.7%

Live sandbox: each task starts in a fresh Ubuntu 24.04 container without network access, with an agent system prompt and the bash tool, at most 12 steps. One command: the model answers a request with one command, and it scores when the command is the same as the reference or when a larger model judges it equivalent. On 200 tasks, the 95% confidence interval is about ±5.5 points. The sandbox tasks are separate from the training tasks but similar in kind to the training sessions, and the equivalence judge is a model that can make mistakes. For rare options and for programs it did not see in training, the model is less reliable.

Run it

llama.cpp and the mechanic command

Serve the GGUF file with llama.cpp. Use the Q8_0 file when you can: on five check prompts its output matched the bf16 model every time, and Q4_K_M matched four times. A recent llama.cpp build is necessary for the Qwen3.5 architecture, and thinking is turned off, the mode the model was trained and tested in.

llama-server -m AH-Mechanic-1-4B-Q8_0.gguf --jinja -ngl 99 -c 32768 --port 8090 \
  --chat-template-kwargs '{"enable_thinking": false}'

This gives an OpenAI-compatible API at http://localhost:8090/v1, with tool calls. Ollama does not load these files yet: its Qwen3.5 loader expects other tensor names than current llama.cpp writes. Use llama-server until that changes.

mechanic is our open-source command-line agent for this model. It works with any OpenAI-compatible endpoint (llama.cpp, vLLM, Kindi and others).

pip install git+https://github.com/ahtx/mechanic
mechanic --endpoint http://localhost:8090/v1 "Find what fills /var and tell me before you delete anything."

Safety

Commands are shown before they run

You approve each command

mechanic shows each command before it runs, and you approve, edit or reject it. It marks commands that delete, overwrite, kill or stop things that you did not name, and it checks every option against the local man page and --help text before the command runs.

The --auto guard

mechanic --auto runs without asking, so it refuses to run outside a container or a virtual machine unless you pass --allow-auto-on-host. Run unattended only in a sandbox.

mechanic --auto --endpoint http://localhost:8090/v1 "..."   # inside a container or virtual machine

The model can make mistakes, and a wrong command can damage a system. In one of the failures on the model card, it deleted a file that the task did not ask it to delete. Commands and their outputs go to the model, so do not run it where outputs can contain secrets that must not reach the model's host.

Contribute

Share sessions under CC0

mechanic can log your sessions locally if you turn logging on; it is off by default. With mechanic contribute, you can share sessions to help train the next version. mechanic removes secrets and identifying details, shows you the exact payload, and sends nothing until you agree.

Contributed sessions are released under CC0 1.0. We acknowledge every valid contributor on this page.

Kindi edition

In progress

A Kindi edition of AH-Mechanic is in progress. Kindi is our inference engine for low-cost GPUs, and mechanic already works with any OpenAI-compatible endpoint.

License

Apache-2.0, built on Qwen3.5-4B

AH-Mechanic-1-4B is released under the Apache License 2.0, the license of its base model, Qwen/Qwen3.5-4B by the Qwen team. Their work makes this release possible. The change from the base model is our training: a LoRA adapter, merged into the weights. The GGUF files are quantized with llama.cpp.