Skip to content

Latest commit

 

History

History
119 lines (82 loc) · 5.37 KB

buddy.md

File metadata and controls

119 lines (82 loc) · 5.37 KB

Buddy Companion

The buddy is an optional companion that lives in the sidebar of the TUI. It reacts to events (tool runs, message completions, idle time) with short in-character quips, powered by a local Ollama model.

Setup

The buddy requires Ollama running locally. Install it, pull a model, then use /buddy in dreb to hatch your companion.

# Install Ollama and pull a model
ollama pull llama3.2

# In dreb, hatch your buddy
/buddy

After hatching, set which Ollama model the buddy should use for reactions:

/buddy model              # show current model + available models
/buddy model llama3.2     # set the buddy's model

The buddy won't react until a model is configured. The choice is persisted across sessions.

Commands

Command Description
/buddy Hatch a new buddy (or show an existing one — also brings back a buddy hidden via /buddy off)
/buddy model Show current Ollama model and available models
/buddy model <name> Set the Ollama model for buddy reactions
/buddy pet Pet your buddy
/buddy reroll Reroll for a new buddy (new species, name, personality)
/buddy stats Show buddy stats panel
/buddy off Hide the buddy (persists across sessions, and syncs to any other dreb instance running concurrently — see Persistence & multiple instances)

How It Works

  • Bones (species, rarity, stats, shiny) are deterministic from your username + hostname + a reroll counter
  • Soul (name, personality, backstory) is generated once by your main model on first hatch and persisted
  • Reactions are generated by the local Ollama model — short, in-character quips based on what just happened
  • Activity indicator shows "thinking..." in the buddy panel while waiting for Ollama to respond

Persistence & multiple instances

The buddy's state — including whether it's hidden via /buddy off — lives in a shared file at ~/.dreb/agent/buddy.json. All dreb instances on the machine (multiple TUIs, and the Telegram bridge) read and write the same file.

Because the state is shared, /buddy off (and bringing the buddy back with /buddy) converges across every concurrently-running instance: each instance re-checks the persisted flag at turn boundaries (when you send a message and when the agent finishes responding), so a buddy you hide in one terminal disappears from the others within one interaction — no restart required. Deleting ~/.dreb/agent/buddy.json removes the buddy entirely on the next interaction everywhere.

Note: convergence happens on the next interaction in each instance, not instantly while an instance sits completely idle.

Troubleshooting

Buddy never reacts / always shows fallback message

Check that Ollama is running and has at least one model installed:

ollama list

If no models are listed, pull one:

ollama pull llama3.2

Reasoning model shows chain-of-thought in speech bubbles

If you're using a reasoning model (e.g. phi4-mini-reasoning, deepseek-r1, qwen3) and the buddy's speech bubbles show the model's internal reasoning instead of just the final answer, the model's Ollama configuration likely doesn't declare thinking support properly.

How Ollama detects thinking models: Ollama checks the model's template for a {{.Thinking}} field reference, or looks for a registered parser, or checks the model family. If none of these match, Ollama treats reasoning output as regular content — meaning <think>...</think> tags get passed through as literal text.

Check your model's capabilities:

ollama show your-model-name

Look for thinking in the Capabilities section. If it's missing, the model isn't configured as a thinking model.

Fix: Create a custom Modelfile that adds {{.Thinking}} to the template. Here's an example for phi4-mini-reasoning:

FROM phi4-mini-reasoning:latest
TEMPLATE """{{- if .System }}<|system|>{{ .System }}
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if ne .Role "system" }}<|{{ .Role }}|>
{{- if and (eq .Role "assistant") .Thinking }}<think>
{{ .Thinking }}</think>
{{- end }}{{ .Content }}
{{- if not $last }}<|end|>
{{- end }}
{{- if and (ne .Role "assistant") $last }}<|end|><|assistant|>{{ end }}
{{- end }}
{{- end }}"""

Then create the fixed model:

ollama create phi4-mini-reasoning-fixed -f Modelfile

Verify it now has thinking capability:

ollama show phi4-mini-reasoning-fixed
# Should show "thinking" in Capabilities

Why this happens: Many community and smaller reasoning models on Ollama ship with templates that don't include {{.Thinking}}. Without this, Ollama's thinking.InferTags heuristic can't detect the model's thinking tags, so it doesn't separate reasoning from the final answer. The model still outputs <think>...</think> tags, but they end up in the content field instead of a structured reasoning field.

Reasoning model thinks but never responds

If the buddy shows the activity indicator for a while but never produces a quip, the model may be spending its entire token budget on reasoning. dreb allocates 2048 tokens for buddy responses, which should be enough for most models, but very verbose reasoners may still exhaust it. Consider using a non-reasoning model for the buddy, or a smaller/faster one.