Demo: a Go assistant helped by a decider, with a hook written in Go
The same flow as decision-chat, for Go programming, with the hook written in Go. A chat agent (Qwen3.5-4B on llmman, a Go assistant with no tools) and a decider (LiquidAI d1-3B, agent.decider.yaml). Before each question reaches the chat model, a preGeneration hook — the Go program in hooks/ask-decider/ — sends it to the decider and adds its answers under the question. The system prompt says what to do with them.
Editable source: decision-chat-golang-flow.drawio (draw.io); decision-chat-golang-flow.svg is the same picture.
Question (agent.decider.yaml) |
Type | What the system prompt (agent.yaml) does with it |
|---|---|---|
level |
choice: beginner, intermediate, expert |
beginner: plain words, one idea at a time; intermediate: to the point; expert: the exact rule or function, no basics |
topic |
choice: basics, concurrency, errors, testing, modules |
concurrency: check with go test -race; errors: %w, errors.Is / errors.As; testing: table-driven tests; modules: the exact go commands |
wants_code |
noul | yes: a complete, runnable example; no: no code block unless one line helps |
Run it
Pull the models into llmman once:
llmman pull hf.co/LiquidAI/d1-3B-GGUF:Q4_K_M
llmman pull hf.co/unsloth/Qwen3.5-4B-GGUF:Q4_K_M
Then, from this directory (Go must be on the PATH: the hook runs with go run):
mm tui agent.yaml # or mm agent.yaml
mm -config agent.yaml -p "How do I wait for 10 goroutines to finish? Show me the code."
go run compiles the hook on its first question (about 1.7 s here), then uses Go's build cache: the hook took about 0.55 s per question afterwards, the decider included. To skip the compile check, build it once and point the hook at the binary:
(cd hooks/ask-decider && go build -o ask-decider .)
hooks:
preGeneration:
- command: '"$MM_CONFIG_DIR/hooks/ask-decider/ask-decider"'
timeout: 60s
The hook
hooks/ask-decider/main.go reads the hook input on stdin, runs $MM_BIN -config agent.decider.yaml -p "<question>", and writes {"context": "…"} with one line per answer:
level: intermediate (confidence 0.22)
topic: concurrency (confidence 0.97)
wants_code: yes (0.92)
- It reads the answers in the decider's order with a
json.Decoder(a Go map would lose it), and writes each line from the answer'stype, so the questions ofagent.decider.yamlcan change without touching it. - Another decider: give its file as the argument, relative to the folder of
agent.yaml—go run . spell.yaml(defaultagent.decider.yaml). The hook knows nothing of the questions, so any decider works: withdemos/decision-questions/spell.yamland a chat model playing the party's wizard, it passedspell: fireball (confidence …)and the wizard cast fireball on the goblins, shield against the ogre. DECIDER_DUMP=<folder>(relative to the folder ofagent.yaml) keeps one indented JSON file per question, named after its time and its decider —.mm/decider/20261024-062119.306-spell.json— with the question, the decider's whole response, the context handed over, or the error when the decider failed (exit status 1: [config error: …]). For debugging:command: cd "$MM_CONFIG_DIR/hooks/ask-decider" && DECIDER_DUMP=.mm/decider go run .(.mm/is git-ignored).DECIDER_RAW=1hands over the server's JSON answers instead of the lines.- A decider that fails writes nothing: the chat model reads the question alone.
- It is its own Go module (
hooks/ask-decider/go.mod), likedemos/wasm-hooks/hooks-src, sogo build ./...in mini-me does not build it. Its tests:cd hooks/ask-decider && go test ./....
What was measured (2026-10-24, from the sandbox, llmman on the host)
The decider, through the hook:
| Question | level | topic | wants_code |
|---|---|---|---|
| I just started learning Go. What is the difference between an array and a slice? | beginner (0.91) | basics (0.93) | no (0.23) |
| How do I wait for 10 goroutines to finish? Show me the code. | intermediate (0.22) | concurrency (0.97) | yes (0.92) |
| Why does errors.As fail to match my error type when the method Error() has a pointer receiver and I wrapped the value with %w? | expert (0.29) | errors (0.97) | no (0.40) |
| Write a table-driven test for a function Add(a, b int) int. | intermediate (0.23) | testing (0.95) | yes (0.81) |
| go mod tidy removed a dependency I still need, why? | expert (0.31) | modules (0.98) | no (0.36) |
Five topics out of five with a confidence of 0.93 or more, and wants_code right every time. The levels are plausible, but with a low confidence except for the beginner: a system prompt should treat a level below 0.5 as a hint.
The chat model's answers (5 to 22 s per turn):
- array vs slice, beginner, no code: plain-words explanation, inline code only. Without the hook, the same question got a code block.
- 10 goroutines, code: a complete
sync.WaitGroupprogram — but it then suggestedgo run main.go, notgo test -raceas theconcurrencyrule asks. Without the hook: the same program. - errors.As, expert: long, with code, and wrong on the substance (it describes a
wrappedfield read by reflection). The decider shapes the form of an answer, not its correctness: a 4B model stays a 4B model. - table-driven test: a table-driven
TestAddwith four cases andgo test -v. - go mod tidy: two short paragraphs, without the
gocommands themodulesrule asks for.
The rules on the form (code or not, plain words) were followed; the rules that add content (go test -race, the go commands) were not, twice out of two.
Read more
- How to write the questions of a decider
- How to ask a decision model
- Hooks reference —
preGeneration decision-chat: the same flow for git, with a Node.js hook
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 |
|