Instructions to use devshub-ai/knack with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use devshub-ai/knack with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf devshub-ai/knack:Q4_K_M # Run inference directly in the terminal: llama cli -hf devshub-ai/knack:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf devshub-ai/knack:Q4_K_M # Run inference directly in the terminal: llama cli -hf devshub-ai/knack:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf devshub-ai/knack:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf devshub-ai/knack:Q4_K_M
Use Docker
docker model run hf.co/devshub-ai/knack:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use devshub-ai/knack with Ollama:
ollama run hf.co/devshub-ai/knack:Q4_K_M
- Unsloth Desktop
- Pi
How to use devshub-ai/knack with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf devshub-ai/knack:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "devshub-ai/knack:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use devshub-ai/knack with Docker Model Runner:
docker model run hf.co/devshub-ai/knack:Q4_K_M
- Lemonade
How to use devshub-ai/knack with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull devshub-ai/knack:Q4_K_M
Run and chat with the model
lemonade run user.knack-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use devshub-ai/knack with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf devshub-ai/knack:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default devshub-ai/knack:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use devshub-ai/knack with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf devshub-ai/knack:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "devshub-ai/knack:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 14,533 Bytes
e5beafb f83eb83 e5beafb f83eb83 e5beafb 5c318cb e5beafb 5c318cb e5beafb dfaba4c e5beafb 5c318cb f83eb83 dfaba4c 9acb30c f83eb83 5c318cb a82ebb5 f83eb83 a02e2d8 a82ebb5 a02e2d8 a82ebb5 a02e2d8 a82ebb5 a02e2d8 a82ebb5 a02e2d8 a82ebb5 5c318cb a82ebb5 5c318cb a82ebb5 a02e2d8 a82ebb5 a02e2d8 a82ebb5 5c318cb a02e2d8 5c318cb a02e2d8 f83eb83 e5beafb a02e2d8 5c318cb a02e2d8 5c318cb a02e2d8 5c318cb a02e2d8 5c318cb a02e2d8 e5beafb 5c318cb a82ebb5 5c318cb a82ebb5 5c318cb a82ebb5 f83eb83 e5beafb f83eb83 a02e2d8 f83eb83 a02e2d8 f83eb83 e5beafb f83eb83 e5beafb a02e2d8 f83eb83 a02e2d8 e5beafb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | ---
tags:
- codesync
- devshub
- decision-model
- developer-tools
- gguf
- ollama
pipeline_tag: text-classification
inference: false
---
# CodeSync Knack
**A specialized decision model: the free, private judgment model behind CodeSync.**
Every time you send CodeSync a message or it runs a shell command, it makes dozens of quick
calls: Is this command risky? Will it run forever? Are you asking to continue earlier work?
Is this a question or a task? Which mode fits? Knack makes those calls on your own machine,
in about 10 milliseconds. It answers only those decisions, asked by question id.
- **Free.** Ships with every CodeSync install. No API key, no account, no usage limits.
- **Private.** Runs locally. Your prompts and commands never leave your machine to be judged.
- **Fast.** About 10 ms per decision on a GPU, about 250 ms on a plain CPU.
- **Small.** 0.75B parameters in the Ollama edition: 817 MB (Q8_0) or 516 MB (Q4_K_M).
- **Accurate where it matters.** Trained on real CodeSync sessions, with extra focus on the
rare cases that cost the most when missed: destructive deletes, commands that never exit,
resuming interrupted work, refactor / test / documentation requests.
## Get it
```bash
ollama pull devshub/knack # Q8_0, 817 MB (https://ollama.com/devshub/knack)
ollama pull devshub/knack:q4_k_m # 516 MB, near-identical accuracy
ollama pull hf.co/devshub-ai/knack:Q8_0 # same model, straight from this repo
```
## A specialized decision model
General decision models, like clef, read any question you write in plain language. Knack is
a different kind: a **specialized decision model**. It was trained on one product's fixed
decisions, the 29 that CodeSync makes on every shell command and every user message, and it
answers only those. It does not read question text: you ask by **question id**. In exchange
it is small, private, and answers all 8 command questions in about 17 ms.
| | General decision model (clef) | Specialized decision model (Knack) |
| --- | --- | --- |
| Questions | anything you write | 29 fixed ones, asked by id |
| Input | any text or image | a shell command, or a message to a coding assistant |
| Size | 27B | 0.75B |
| A question it was not trained on | answers it | rejects it |
## Ask it a question
Every call has the same three parts: **the text to judge**, **the question id**, and
**Knack's answer**. `echo` only hands the text to Knack. Nothing in the text is ever run,
so you can safely ask about dangerous commands.
```
echo "<text to judge>" | ollama run devshub/knack --ask <question id>
```
For example, "will `npm run dev` keep running until I stop it?":
```
$ echo "npm run dev" | ollama run devshub/knack --ask serves
yes 97%
```
### Questions about a shell command
Will it keep running until stopped?
```
$ echo "python -m http.server 8000" | ollama run devshub/knack --ask serves
yes 98%
$ echo "pytest -q" | ollama run devshub/knack --ask serves
no 97%
```
How dangerous is it?
```
$ echo "ls -la" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
safe 97% 0.0 / 2
$ echo "npm install" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
needs care 96% 1.0 / 2
$ echo "git push --force origin main" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
destructive 96% 1.9 / 2
```
Will it take minutes?
```
$ echo "cargo build --release" | ollama run devshub/knack --ask long_running
yes 84%
$ echo "git status" | ollama run devshub/knack --ask long_running
no 97%
```
What kind of command is it?
```
$ echo "pip install requests" | ollama run devshub/knack --ask activity \
--choice testing --choice building --choice installing --choice git --choice inspecting --choice running
installing 94%
$ echo "grep -rn TODO src" | ollama run devshub/knack --ask activity \
--choice testing --choice building --choice installing --choice git --choice inspecting --choice running
inspecting 95%
```
Does a pass prove the change works? Does it change git? Does it deploy?
```
$ echo "pytest tests/test_login.py" | ollama run devshub/knack --ask verifies
yes 97%
$ echo "npm run build" | ollama run devshub/knack --ask verifies
no 96%
$ echo "git commit -am 'fix login'" | ollama run devshub/knack --ask mutates_repo
yes 96%
$ echo "git diff" | ollama run devshub/knack --ask mutates_repo
no 97%
$ echo "kubectl apply -f k8s/" | ollama run devshub/knack --ask deploys
yes 95%
```
### Questions about a message to a coding assistant
What kind of task is this?
```
$ echo "fix the failing login test" | ollama run devshub/knack --ask task.intent \
--choice bug_fix --choice feature --choice refactor --choice api_schema --choice config_deploy \
--choice test --choice documentation --choice investigation --choice unknown
bug_fix 90%
```
With the same `--choice` list: "add dark mode to the settings page" gives `feature 93%`,
"write docs for the payments API" gives `documentation 97%`, and "why does the build take
so long?" gives `investigation 97%`.
Is it chat or a request for work?
```
$ echo "hi, how are you?" | ollama run devshub/knack --ask turn.chat_or_task --choice chat --choice task
chat 98%
$ echo "rename the user module" | ollama run devshub/knack --ask turn.chat_or_task --choice chat --choice task
task 97%
```
Which assistant mode fits?
```
$ echo "what does this repo do?" | ollama run devshub/knack --ask route.mode --choice plan --choice build --choice ask --choice debug
ask 96%
$ echo "plan the migration to Postgres" | ollama run devshub/knack --ask route.mode --choice plan --choice build --choice ask --choice debug
plan 90%
```
Start or stop a screen recording?
```
$ echo "record my screen" | ollama run devshub/knack --ask turn.screencast --choice start --choice stop --choice none
start 89%
```
The answer is the option Knack picks and its confidence. Each id has one precise meaning,
listed in the tables below; read them before relying on an answer. `long_running`, for
example, means "takes minutes", so a build counts. Questions with options (`--choice`,
`--level`) need them in the order shown; if they do not match, the error shows the exact
flags to use. Any question that is not one of the 29 ids is rejected rather than guessed.
## API
### cURL
```
curl http://localhost:11434/v1/systemone \
-H "Content-Type: application/json" \
-d '{
"model": "devshub/knack",
"state": "npm run dev",
"questions": {
"serves": {"type": "noul", "instructions": "serves"},
"long_running": {"type": "noul", "instructions": "long_running"}
}
}'
```
```
{"model":"devshub/knack","answers":{"serves":{"type":"noul","noul":0.9701},"long_running":{"type":"noul","noul":0.9708}}}
```
The question id goes in `instructions` (or as the key). The state can also be an object
with Knack's own fields, for example `{"command": "npm run dev", "description": "start the app"}`.
### Python
```
pip install ollama
```
```python
import ollama
response = ollama.systemone(
model="devshub/knack",
state="npm run dev",
questions={"serves": {"type": "noul", "instructions": "serves"}},
)
print(response.answers["serves"].noul) # 0.9701
```
## Or use the standalone script
`knack.py` asks every question of a command or message at once and prints a table. It uses
only the Python standard library and pulls the model on first run.
```
curl -fsSL https://huggingface.co/devshub-ai/knack/resolve/main/knack.py | python3 - "npm run dev"
```
```
risk 1 0.95 0 read-only, 1 recoverable change, 2 irreversible / remote
long_running yes 0.97 takes minutes, blocks, polls, watches or serves
activity running 0.92 what kind of work it does
verifies no 0.97 a test, type or lint check whose pass proves the change works
mutates_repo no 0.97 changes git state (commit, push, merge, rebase, tag)
deploys no 0.94 publishes, releases or changes a remote environment
runtime_check no 0.95 a health probe of a running service that fails if unhealthy
serves yes 0.97 keeps running until stopped (server, watcher, tail -f)
```
```
curl -fsSL https://huggingface.co/devshub-ai/knack/resolve/main/knack.py | python3 - --turn "fix the failing login test"
```
## What it decides
**Every shell command.** Input: the command (state fields `command`, `description`).
| id | yes / the answer means | options |
| --- | --- | --- |
| `risk` | the worst it can do: 0 read-only or trivially reversible, 1 changes recoverable local state, 2 irreversible loss or reaches beyond the checkout | 0, 1, 2 |
| `long_running` | takes minutes, blocks, polls, watches or serves, rather than finishing in seconds. A build or test suite counts | yes, no |
| `serves` | keeps running until it is stopped: server, daemon, watcher, tunnel, `tail -f`. A build that finishes on its own does not | yes, no |
| `activity` | what kind of work it does | testing, building, installing, git, inspecting, running |
| `verifies` | a test run, type or lint check whose passing exit is evidence the change works. Builds and plain runs do not count | yes, no |
| `mutates_repo` | changes version-control state: commit, push, merge, rebase, tag, amend. Editing or deleting files does not count | yes, no |
| `deploys` | publishes, releases, or changes a remote or runtime environment (deploy, rollout, push an image, bring a service up) | yes, no |
| `runtime_check` | a health or smoke probe of a running service that fails on an unhealthy response (`curl --fail`) | yes, no |
**Every user turn.** Input: the message a user sends to a coding assistant (state fields, in
this order: `prompt`, `current_mode`, `recent_activity`, `conversation_size`, `open_task`,
`turns_on_open_task`, `interrupted_work`, `browser_context`; plain text fills the rest with
defaults).
| id | the answer means | options |
| --- | --- | --- |
| `turn.chat_or_task` | conversation, or a request for work | chat, task |
| `turn.actionable` | asks for something to be done | yes, no |
| `turn.question_shaped` | phrased as a question | yes, no |
| `turn.change_intent` | kind of code change asked for | create, adjust, enhance, fix, refactor, none |
| `turn.new_task` | starts new work rather than continuing | yes, no |
| `turn.resume` | asks to resume interrupted work | yes, no |
| `turn.mission` | a long, multi-step job | yes, no |
| `turn.plan_authoring` | asks for a plan to be written | yes, no |
| `turn.screencast` | start or stop a screen recording | start, stop, none |
| `turn.demo` | asks for a demo | yes, no |
| `turn.skip_orientation` | can be done without exploring the codebase | yes, no |
| `task.intent` | type of task | bug_fix, feature, refactor, api_schema, config_deploy, test, documentation, investigation, unknown |
| `task.execution_strategy` | how to execute it | direct, plan, parallel |
| `route.mode` | best assistant mode | plan, build, ask, debug |
| `route.tier` | size of model needed | light, medium, heavy |
| `route.thinking` | reasoning effort needed | off, low, medium, high, xhigh, max |
| `route.risk` | risk of the requested work | low, medium, high |
| `browser` | needs a web browser | yes, no |
| `messaging` | needs to send an email or chat message | yes, no |
| `delivery.feature_task` | a feature delivery task | yes, no |
| `delivery.slash_task` | a slash-command style task | yes, no |
## What it does not do
- **Other questions.** Anything outside these 29, such as "is this log an error?" or "is a
refund requested?", is rejected. Use a general decision model like clef for those.
- **Other input.** Logs, emails, tickets, documents or images give meaningless answers,
even to these 29 questions.
- **Conversation history.** Through Ollama it sees a single message, so a question like
`turn.resume` ("continue where you left off") answers no: there is nothing to resume. Inside CodeSync it also
gets the session context, which makes the turn questions more reliable.
- **Text generation.** It returns one pick with a confidence, never sentences.
## Known weak spots
Measured with the commands above, so you know where to double-check:
| command | question | Knack says | should be |
| --- | --- | --- | --- |
| `tail -f app.log` | `serves` | no, 75% | yes |
| `npm run build` | `serves` | yes, 79% | no |
| `docker compose up` | `long_running` | 51% yes | yes |
| `curl --fail http://localhost:3000/health` | `runtime_check` | no, 92% | yes |
| `npm test` | `long_running` | 45% yes | unclear, depends on the suite |
These come from the model's training, not the Ollama packaging: on every command compared,
the Ollama build matches the original model to within 0.002. They are the next training targets.
## Results
Measured on CodeSync's own judgments (version v3, November 2026):
| Benchmark | Knack v3 | Ollama Q8_0 | Ollama Q4_K_M | What it measures |
|---|---:|---:|---:|---|
| Hand-labelled set | **97.9%** | 97.9% | 97.4% | 233 decisions labelled by hand |
| Held-out set | **95.5%** | 95.7% | 95.7% | 3,267 decisions from real sessions, never trained on |
| Rare-case set | **93.7%** | 93.6% | 93.6% | 4,120 decisions on the hardest, rarest cases |
| Latency | **13 ms** | 17 ms | ~17 ms | median per command (8 questions) on a laptop GPU |
Latency is the median for all 8 command questions in one `/v1/systemone` request.
## Use it inside CodeSync
Install CodeSync. That's it.
```bash
curl -fsSL https://app.devshub.ai/install.sh | bash
```
On first start, CodeSync downloads Knack in the background and keeps working while it
does. Once Knack is ready it becomes CodeSync's first judgment engine, and new versions are
picked up automatically. To turn it off: `CODESYNC_KNACK_DISABLED=1`.
## Files
| File | Purpose |
|---|---|
| `knack-v3-Q8_0.gguf`, `knack-v3-Q4_K_M.gguf` | Ollama / llama.cpp decision model (`--ask`, `/v1/systemone`) |
| `knack.py` | standalone runner (CLI and local server), standard library only |
| `manifest.json`, `knack-<version>.tar.gz` | the PyTorch model folder CodeSync installs |
The GGUF edition is the same weights packaged as an Ollama decision model: a `systemone`
prompt template rebuilds Knack's training prompt from the request, and the answer is read
from the option letters exactly as CodeSync's own runtime reads it.
Built by [DevsHub](https://app.devshub.ai) for [CodeSync](https://app.devshub.ai).
|