bots-garden/mini-mepublic Fork
⑂ feature/mini-me-as-a-sdk
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. cd2a817 · on feature/mini-me-as-a-sdk · k33g · Oct 24, 2026
README.en.md · 92 lines · 6.4 KBmarkdown
Blame HistoryOpen raw

Demo: a Go assistant helped by a decider, with a hook written in Go

Version française

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's type, so the questions of agent.decider.yaml can change without touching it.
  • Another decider: give its file as the argument, relative to the folder of agent.yaml — go run . spell.yaml (default agent.decider.yaml). The hook knows nothing of the questions, so any decider works: with demos/decision-questions/spell.yaml and a chat model playing the party's wizard, it passed spell: fireball (confidence …) and the wizard cast fireball on the goblins, shield against the ogre.
  • DECIDER_DUMP=<folder> (relative to the folder of agent.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=1 hands 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), like demos/wasm-hooks/hooks-src, so go 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.WaitGroup program — but it then suggested go run main.go, not go test -race as the concurrency rule asks. Without the hook: the same program.
  • errors.As, expert: long, with code, and wrong on the substance (it describes a wrapped field 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 TestAdd with four cases and go test -v.
  • go mod tidy: two short paragraphs, without the go commands the modules rule 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

 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
# Demo: a Go assistant helped by a decider, with a hook written in Go

*[Version française](README.fr.md)*

The same flow as [`decision-chat`](../decision-chat/README.en.md), 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.

![The decision-chat-golang flow: the question goes to a preGeneration hook written in Go, which asks the decider and passes its answers to the chat model](decision-chat-golang-flow.svg)

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:

```bash
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`):

```bash
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:

```bash
(cd hooks/ask-decider && go build -o ask-decider .)
```

```yaml
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's `type`, so the questions of `agent.decider.yaml` can change without touching it.
- Another decider: give its file as the argument, relative to the folder of `agent.yaml` — `go run . spell.yaml` (default `agent.decider.yaml`). The hook knows nothing of the questions, so any decider works: with `demos/decision-questions/spell.yaml` and a chat model playing the party's wizard, it passed `spell: fireball (confidence …)` and the wizard cast fireball on the goblins, shield against the ogre.
- `DECIDER_DUMP=<folder>` (relative to the folder of `agent.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=1` hands 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`), like `demos/wasm-hooks/hooks-src`, so `go 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.WaitGroup` program — but it then suggested `go run main.go`, not `go test -race` as the `concurrency` rule asks. Without the hook: the same program.
- **errors.As, expert**: long, with code, and **wrong on the substance** (it describes a `wrapped` field 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 `TestAdd` with four cases and `go test -v`.
- **go mod tidy**: two short paragraphs, without the `go` commands the `modules` rule 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](../../docs/en/how-to/write-decision-questions.md)
- [How to ask a decision model](../../docs/en/how-to/ask-a-decision-model.md)
- [Hooks reference — `preGeneration`](../../docs/en/reference/hooks.md#pregeneration)
- [`decision-chat`](../decision-chat/README.en.md): the same flow for git, with a Node.js hook