mmoussa commited on
Commit
a82ebb5
·
verified ·
1 Parent(s): 5c318cb

Docs: install separated from usage, 20+ real examples

Browse files
Files changed (1) hide show
  1. README.md +110 -20
README.md CHANGED
@@ -50,37 +50,125 @@ it is small, private, and answers all 8 command questions in about 17 ms.
50
  | Size | 27B | 0.75B |
51
  | A question it was not trained on | answers it | rejects it |
52
 
53
- ## Try it in one line
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  ```
56
- echo "npm run dev" | ollama run devshub/knack --ask serves
 
 
 
57
  ```
58
 
 
 
 
 
 
 
 
 
 
59
  ```
 
 
 
 
 
60
  yes 97%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  ```
62
 
63
- `serves` asks whether the command keeps running until someone stops it (a dev server, a
64
- watcher, `tail -f`). Each id has one precise meaning, listed in the tables below. Read them
65
- before relying on an answer: `long_running`, for example, means "takes minutes", so a build
66
- counts.
 
67
 
68
- Knack only reads the text and judges it. Nothing is executed, so it is safe to ask about any
69
- command, including destructive ones.
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- More examples:
72
 
73
  ```
74
- echo "git push --force" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
75
- echo "fix the failing login test" | ollama run devshub/knack --ask turn.new_task
76
- echo "fix the failing login test" | ollama run devshub/knack --ask task.intent \
77
- --choice bug_fix --choice feature --choice refactor --choice api_schema --choice config_deploy \
78
- --choice test --choice documentation --choice investigation --choice unknown
79
  ```
80
 
81
- Ask with an id from the tables. Any other question is rejected rather than guessed. A choice
82
- or score question needs its options in the order shown; if they do not match, the error
83
- shows the exact flags to use.
 
 
84
 
85
  ## API
86
 
@@ -197,7 +285,8 @@ defaults).
197
  refund requested?", is rejected. Use a general decision model like clef for those.
198
  - **Other input.** Logs, emails, tickets, documents or images give meaningless answers,
199
  even to these 29 questions.
200
- - **Conversation history.** Through Ollama it sees a single message. Inside CodeSync it also
 
201
  gets the session context, which makes the turn questions more reliable.
202
  - **Text generation.** It returns one pick with a confidence, never sentences.
203
 
@@ -210,10 +299,11 @@ Measured with the commands above, so you know where to double-check:
210
  | `tail -f app.log` | `serves` | no, 75% | yes |
211
  | `npm run build` | `serves` | yes, 79% | no |
212
  | `docker compose up` | `long_running` | 51% yes | yes |
 
213
  | `npm test` | `long_running` | 45% yes | unclear, depends on the suite |
214
 
215
- These come from the model, not the Ollama packaging (the original PyTorch model gives the
216
- same numbers), and are the next training targets.
217
 
218
  ## Results
219
 
 
50
  | Size | 27B | 0.75B |
51
  | A question it was not trained on | answers it | rejects it |
52
 
53
+ ## Ask it a question
54
+
55
+ Every call has the same three parts: **the text to judge**, **the question id**, and
56
+ **Knack's answer**. `echo` only hands the text to Knack. Nothing in the text is ever run,
57
+ so you can safely ask about dangerous commands.
58
+
59
+ ```
60
+ echo "<text to judge>" | ollama run devshub/knack --ask <question id>
61
+ ```
62
+
63
+ For example, "will `npm run dev` keep running until I stop it?":
64
+
65
+ ```
66
+ $ echo "npm run dev" | ollama run devshub/knack --ask serves
67
+ yes 97%
68
+ ```
69
+
70
+ ### Questions about a shell command
71
+
72
+ Will it keep running until stopped?
73
+
74
+ ```
75
+ $ echo "python -m http.server 8000" | ollama run devshub/knack --ask serves
76
+ yes 98%
77
+ $ echo "pytest -q" | ollama run devshub/knack --ask serves
78
+ no 97%
79
+ ```
80
+
81
+ How dangerous is it?
82
+
83
+ ```
84
+ $ echo "ls -la" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
85
+ safe 97% 0.0 / 2
86
+ $ echo "npm install" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
87
+ needs care 96% 1.0 / 2
88
+ $ echo "git push --force origin main" | ollama run devshub/knack --ask risk --level safe --level "needs care" --level destructive
89
+ destructive 96% 1.9 / 2
90
+ ```
91
+
92
+ Will it take minutes?
93
 
94
  ```
95
+ $ echo "cargo build --release" | ollama run devshub/knack --ask long_running
96
+ yes 84%
97
+ $ echo "git status" | ollama run devshub/knack --ask long_running
98
+ no 97%
99
  ```
100
 
101
+ What kind of command is it?
102
+
103
+ ```
104
+ $ echo "pip install requests" | ollama run devshub/knack --ask activity \
105
+ --choice testing --choice building --choice installing --choice git --choice inspecting --choice running
106
+ installing 94%
107
+ $ echo "grep -rn TODO src" | ollama run devshub/knack --ask activity \
108
+ --choice testing --choice building --choice installing --choice git --choice inspecting --choice running
109
+ inspecting 95%
110
  ```
111
+
112
+ Does a pass prove the change works? Does it change git? Does it deploy?
113
+
114
+ ```
115
+ $ echo "pytest tests/test_login.py" | ollama run devshub/knack --ask verifies
116
  yes 97%
117
+ $ echo "npm run build" | ollama run devshub/knack --ask verifies
118
+ no 96%
119
+ $ echo "git commit -am 'fix login'" | ollama run devshub/knack --ask mutates_repo
120
+ yes 96%
121
+ $ echo "git diff" | ollama run devshub/knack --ask mutates_repo
122
+ no 97%
123
+ $ echo "kubectl apply -f k8s/" | ollama run devshub/knack --ask deploys
124
+ yes 95%
125
+ ```
126
+
127
+ ### Questions about a message to a coding assistant
128
+
129
+ What kind of task is this?
130
+
131
+ ```
132
+ $ echo "fix the failing login test" | ollama run devshub/knack --ask task.intent \
133
+ --choice bug_fix --choice feature --choice refactor --choice api_schema --choice config_deploy \
134
+ --choice test --choice documentation --choice investigation --choice unknown
135
+ bug_fix 90%
136
  ```
137
 
138
+ With the same `--choice` list: "add dark mode to the settings page" gives `feature 93%`,
139
+ "write docs for the payments API" gives `documentation 97%`, and "why does the build take
140
+ so long?" gives `investigation 97%`.
141
+
142
+ Is it chat or a request for work?
143
 
144
+ ```
145
+ $ echo "hi, how are you?" | ollama run devshub/knack --ask turn.chat_or_task --choice chat --choice task
146
+ chat 98%
147
+ $ echo "rename the user module" | ollama run devshub/knack --ask turn.chat_or_task --choice chat --choice task
148
+ task 97%
149
+ ```
150
+
151
+ Which assistant mode fits?
152
+
153
+ ```
154
+ $ echo "what does this repo do?" | ollama run devshub/knack --ask route.mode --choice plan --choice build --choice ask --choice debug
155
+ ask 96%
156
+ $ echo "plan the migration to Postgres" | ollama run devshub/knack --ask route.mode --choice plan --choice build --choice ask --choice debug
157
+ plan 90%
158
+ ```
159
 
160
+ Start or stop a screen recording?
161
 
162
  ```
163
+ $ echo "record my screen" | ollama run devshub/knack --ask turn.screencast --choice start --choice stop --choice none
164
+ start 89%
 
 
 
165
  ```
166
 
167
+ The answer is the option Knack picks and its confidence. Each id has one precise meaning,
168
+ listed in the tables below; read them before relying on an answer. `long_running`, for
169
+ example, means "takes minutes", so a build counts. Questions with options (`--choice`,
170
+ `--level`) need them in the order shown; if they do not match, the error shows the exact
171
+ flags to use. Any question that is not one of the 29 ids is rejected rather than guessed.
172
 
173
  ## API
174
 
 
285
  refund requested?", is rejected. Use a general decision model like clef for those.
286
  - **Other input.** Logs, emails, tickets, documents or images give meaningless answers,
287
  even to these 29 questions.
288
+ - **Conversation history.** Through Ollama it sees a single message, so a question like
289
+ `turn.resume` ("continue where you left off") answers no: there is nothing to resume. Inside CodeSync it also
290
  gets the session context, which makes the turn questions more reliable.
291
  - **Text generation.** It returns one pick with a confidence, never sentences.
292
 
 
299
  | `tail -f app.log` | `serves` | no, 75% | yes |
300
  | `npm run build` | `serves` | yes, 79% | no |
301
  | `docker compose up` | `long_running` | 51% yes | yes |
302
+ | `curl --fail http://localhost:3000/health` | `runtime_check` | no, 92% | yes |
303
  | `npm test` | `long_running` | 45% yes | unclear, depends on the suite |
304
 
305
+ These come from the model's training, not the Ollama packaging: on every command compared,
306
+ the Ollama build matches the original model to within 0.002. They are the next training targets.
307
 
308
  ## Results
309