Teaching My Terminal to Answer Its Own Questions
A MacBook Pro, 64 GB of RAM, and a stubborn refusal to man ps one more time.
The outcome, first
I now have two commands that answer questions about my own machine in plain English:
bash
goose run -t "what is using all my ram?"
gptme 'where is the folder chat?'
No API keys, no cloud, no data leaving the laptop. A local model — qwen3:30b, running on Metal — reads the question, decides which commands to run, runs them, reads the output, and comes back with an answer. It knows mdfind exists. It knows top -l 1 is the non-interactive way to get a one-shot process snapshot on macOS. It does the boring little archaeology I keep putting off.
The whole stack is free, open source, and took about forty minutes to set up — twenty of which I spent fighting a config bug I’ll show you in detail, because you’ll hit it too.
This is the write-up I wish I’d had.
What I wanted, and why
I don’t want an AI that writes code for me. I already have editors that do that, and honestly they’re fine.
What I wanted was something narrower and more annoying: a shell that understands the question instead of the command.
Here’s the actual friction. I type these things into my terminal constantly:
- “Where is the folder
chat?” → I know it’smdfind -name chat, but I forget whether it’s-nameor-onlyinor whether I should be usinglocate, and by the time I’ve remembered I’ve lost the thread of what I was doing. - “What is using all my RAM?” →
topscrolls.ps aux | sort -k4 -nr | headgives me a wall of columns.vm_statgives me pages and a ratio nobody can hold in their head. I just want a sentence: Chrome is using 6 GB across eleven helpers, and Docker is holding 4. - “Why is my disk full?” → this is a fifteen-minute
du -sh *descent into/Users/me/Library/Cachesevery single time.
None of these are hard. They’re just interruptions. Each one costs me two minutes of context-switching to answer a question I’ll have again next month.
I tried the obvious fix first — the “natural language to command” tools. They’re a whole category now. You type a sentence, you get a command back, you press enter. Useful, and I still keep one around.
But they don’t solve my problem, and it took me a while to articulate why. A translator gives you a command. It doesn’t give you an answer. When I ask “what’s using my RAM,” I don’t want a command that might tell me — I want to be told. That means the model has to see the output of what it ran, and be able to run something else based on that. It needs a loop.
So what I actually needed was an agent: a program that gives a local model a toolbox and lets it work the problem.
Two of them are worth your time.
The two tools
Goose — the agent framework
Goose is Block’s open-source terminal agent. It’s the heavier, more structured of the two: a provider-agnostic agent loop, a large extension system built on MCP, and a desktop app that shares sessions with the CLI.
What it is: a general-purpose agent harness. You ask a question, it plans, picks tools, executes, observes, iterates. Tool calling is not a feature of Goose — it’s the substrate. The docs are blunt about this: without tool calling, a model “can only do chat completion,” and every extension has to be switched off.
What it isn’t: a shell one-liner generator. It’s not lightweight — it boots a session, loads extensions, and maintains a conversation. And it’s not a security sandbox. Autonomous mode is the default, meaning it will run commands, edit files, and delete things without asking. For a local model that occasionally hallucinates a rm, that’s the detail to fix before anything else.
gptme — the terminal assistant
gptme is the opposite trade-off: a single Python CLI, one-shot by default, opinionated about being in your terminal rather than managing it.
What it is: “your agent in your terminal, equipped with local tools: writes code, uses the terminal, browses the web.” It’s happy as gptme 'do the thing', it keeps logs, and it has a genuinely clever escape hatch: it supports three different tool-calling formats (markdown, xml, tool) selected with --tool-format. That means it can drive models that have no native tool template at all — the ones Goose refuses to touch.
What it isn’t: as extensible. No MCP ecosystem worth mentioning, no session browser, no desktop app. It’s a well-built tool, not a platform. Its config surface is a TOML file and that’s mostly the end of it.
The difference that actually matters
| Goose | gptme | |
|---|---|---|
| Shape | Agent platform | Single-terminal assistant |
| Invocation | goose session / goose run -t | gptme 'prompt' |
| Requires native tool calling | Yes, strictly | No — markdown/XML fallback |
| Context length control | Per-request (GOOSE_INPUT_LIMIT) | None; inherits server default |
| Extensibility | MCP extensions, recipes | Plugins, shell tools, Python API |
| Default safety | Autonomous | Approval-based |
| Best for | Ongoing work in a directory | One-shot questions |
That third row is the practical fork in the road. Goose demands a model whose tool template is correct. gptme will limp along with a model that isn’t. When a model’s tool format is broken — which, as you’ll see, is a live problem in late 2026 — gptme still works and Goose does not.
I run both. Goose for the questions I want to sit with, gptme for the ones I want answered and forgotten.
Installing the three pieces
You need Homebrew and Python 3.10+ for gptme. That’s it.
1. Ollama
bash
brew install ollama
Then either launch the app (open -a Ollama) or run ollama serve in its own terminal tab. Do not do both — they’ll fight over port 11434.
Confirm:
bash
ollama --version
Mine reads 0.40.7. The number matters — see the version warning further down.
2. Goose
The CLI and the desktop app are separate Homebrew formulae:
bash
brew install block-goose-cli # the CLI
brew install --cask block-goose # optional: desktop app
Two notes from the formula page: it’s Apple Silicon only, and it conflicts with an older goose formula because both install a binary named goose 1. If Homebrew complains, brew uninstall goose first. There’s also a one-line install script on the official install page if you’d rather not use Homebrew 2.
3. gptme
Three ways, in increasing order of control:
bash
curl -sSf https://gptme.ai/install.sh | sh # auto-detects uv or pipx
brew install gptme # what I used
pipx install gptme # most isolated
The one-line installer is what the docs recommend and it pulls in browser support 3. I used Homebrew because I like brew upgrade to handle everything at once.
⚠️ And that’s how I ended up on gptme 0.35.1, which has a config-writing bug. More on that in a moment — it’s the most useful part of this post.
Picking and pulling a model
The hardware, and what it buys you
MacBook Pro, 64 GB unified memory, October 2026.
That’s a genuinely good place to be for local agents, and it’s worth understanding why. Unified memory means the GPU can address the whole 64 GB, so model size is limited by total RAM rather than by a discrete VRAM pool. Concretely:
- Dense 27–32B at 4-bit (~17–19 GB) — comfortable, with room for long context.
- Dense 70B at 4-bit (~43 GB) — fits, but leaves little headroom for context.
- MoE models — the real unlock. A 30B mixture-of-experts with ~3B active parameters gives you 30B quality at near-3B speed and memory pressure.
Which model, and why
bash
ollama pull qwen3:30b
That’s the pick. Here’s the reasoning, because “just use the biggest one” is wrong.
qwen3:30b is a 30.5B mixture-of-experts, Q4_K_M, only ~19 GB on disk, with a 262,144-token native context. Your ollama show should confirm:
Capabilities
completion
tools ← this is the one that matters
thinking
levels true
default true
Three things made it the winner:
toolsis in the capabilities list. Not “the model card says it supports tools” — the packaged template declares it. Those are different things, and conflating them is the single most common way to waste an afternoon. A Hugging Face tools badge describes the weights; an Ollama tools badge describes the template. Importing a GGUF withollama run hf.co/...routinely drops the tool branch.- MoE means it’s fast. ~3B active parameters per token. On an M-series chip this feels like a small model and reasons like a mid-size one.
- 19 GB leaves ~45 GB for context and everything else. That headroom is where agents live or die.
A shortlist if you want alternatives:
| Model | Pull | Size | Note |
|---|---|---|---|
qwen3:30b | ollama pull qwen3:30b | ~19 GB | My pick. MoE, native tools, huge context |
qwen3:8b | ollama pull qwen3:8b | ~5 GB | The safe default; fast, well-behaved tools |
gemma4:26b | ollama pull gemma4:26b | ~18 GB | Highest measured tool-call reliability in one benchmark (~93%) |
qwen3.6:27b | ollama pull qwen3.6:27b | ~17 GB | Newest Qwen confirmed working in agent loops |
llama3-groq-tool-use:8b | ollama pull llama3-groq-tool-use:8b | 4.7 GB | Best published BFCL score for a small finetune (89%), older reasoning |
gpt-oss:20b | ollama pull gpt-oss:20b | ~13 GB | OpenAI’s open weights, tools + thinking |
llama3.3:70b | ollama pull llama3.3:70b | ~43 GB | Fits your 64 GB. Tight on context |
⚠️ The Qwen trap
You’d think “qwen3:30b works, so qwen3.5:35b must work better.” It doesn’t. This is worth the paragraph.
Ollama assigned Qwen 3.5 the wrong tool-calling format — the Qwen3 Hermes-style JSON renderer when the model was trained on the Qwen3-Coder XML format. The parser side got patched in v0.17.3; the renderer side stayed broken for a long stretch. In a controlled same-weights A/B test, the stock renderer made the correct tool call 2 times out of 5, and one trial “claimed success with no call at all.” Overriding the Modelfile to RENDERER qwen3-coder / PARSER qwen3-coder took it to 4/5.
Qwen3.8 had a different bug: tool calls hanging in agents because a cancelled long prefill corrupted the prefix cache. Fixed in Ollama v0.33.0 (August 2026). As of 0.40.3, two tool-calling issues remain open on GitHub.
So: ollama --version must be ≥ 0.33.0. Mine is 0.40.7 — fine. And for agent work, stay on qwen3:30b or qwen3:8b, or move up to qwen3.6:27b. Avoid qwen3.5 and qwen3.8 in agent loops until the issue tracker quiets down.
Models to skip entirely
| Model | Why |
|---|---|
gemma3 (all sizes) | No tool calling at all. Vision only — Google left function calling out of the family |
mistral-nemo | Prompt-based tools, ~30% reliability, never emits parallel calls |
phi4 | ~40% reliability. (phi4-mini does support tools) |
deepseek-r1 distills | Misleading badge — only the 671B has the template |
llama3 (original) | No tools. You need llama3.1+. One character decides your afternoon |
The one verification command
bash
ollama show qwen3:30b
Look for tools under Capabilities. If it’s absent, you have completion only and every agent call will fail with “does not support tools.”
Setting up Goose
Wire it to Ollama
bash
goose configure
→ Configure Providers → Ollama → model name qwen3:30b.
Or skip the wizard, which I prefer because it lets me version the settings. Goose reads environment variables, and env vars take precedence over its config files:
bash
export GOOSE_PROVIDER="ollama"
export GOOSE_MODEL="qwen3:30b"
The settings that matter
Context length. This is the highest-value change on a 64 GB machine, and the reason is non-obvious.
Ollama no longer defaults to a flat 4096 tokens. It auto-scales context to available VRAM: under 24 GiB → 4K, 24–48 GiB → 32K, 48 GiB and up → 256K. Your 64 GB MacBook Pro lands in the top tier, so Ollama may hand you a 262,144-token window by default. Your ollama show confirms the model supports it.
That’s a trap, because the KV cache is what eats your RAM, not the weights. For qwen3:30b — 48 layers, 4 KV heads, 128 head dim — expect roughly 96 KB per token at f16:
| Context | KV cache | + 19 GB weights | Verdict |
|---|---|---|---|
| 32K | ~3 GB | ~22 GB | ✓ comfortable |
| 64K | ~6 GB | ~25 GB | ✓ fine |
| 256K | ~25 GB | ~44 GB | ⚠️ at the GPU wired-memory ceiling |
Pinning to 32K reclaims about 22 GB. Set it:
bash
export GOOSE_INPUT_LIMIT=32768 # maps directly to Ollama's num_ctx
export GOOSE_CONTEXT_LIMIT=32768 # what Goose *thinks* its window is
Goose has a dedicated variable for this — no Modelfile surgery required. But you need both, and the second one is the one people miss. GOOSE_CONTEXT_LIMIT drives Goose’s compaction math, and it defaults to 128,000. Leave it there while GOOSE_INPUT_LIMIT is 32K and Goose will happily fill a window twice the size it actually has, trusting a budget it doesn’t own — then Ollama silently truncates your conversation and the agent starts forgetting the beginning of the task.
Safety. Autonomous is the default and that’s a bad default for a hallucinating local model:
| Mode | Behaviour |
|---|---|
auto | Fully autonomous, no approval (default) |
smart_approve | Auto-approves low-risk, flags risky |
approve | Asks before every tool use |
chat | No tools at all |
Start in approve while you learn how your model behaves. Loosen to smart_approve. Switch mid-session with /mode.
The full ~/.zshrc block
bash
# --- Goose + local Ollama ---
export GOOSE_PROVIDER="ollama"
export GOOSE_MODEL="qwen3:30b"
export GOOSE_INPUT_LIMIT=32768
export GOOSE_CONTEXT_LIMIT=32768
export GOOSE_AUTO_COMPACT_THRESHOLD=0.7
export GOOSE_MODE="smart_approve"
export GOOSE_CLI_SHOW_THINKING=1
That last one surfaces qwen3’s reasoning in the CLI. Genuinely useful for the first week — you see why it picked vm_stat over top — then turn it off for cleaner output.
Setting up gptme (and the bug you’ll hit)
The good path
~/.config/gptme/config.toml:
toml
[[providers]]
name = "ollama"
base_url = "http://127.0.0.1:11434/v1"
default_model = "qwen3:30b"
[models]
default = "ollama/qwen3:30b"
Note the double brackets. [[providers]] is TOML’s array-of-tables syntax, which is what the field expects.
Then:
bash
gptme providers list
That does a real HTTP GET /v1/models against port 11434 rather than just checking whether the port is open, so a green result means gptme genuinely reached Ollama.
The bug I hit instead
I used the wizard:
bash
gptme providers add
It walked me through name, base URL, model, and then crashed:
UnexpectedCharError: Unexpected character: 'n' at line 1 col 13
The cause: save_provider_config() wrote this to the top of the file:
toml
providers = [name = "ollama"
base_url = "http://127.0.0.1:11434/v1"
default_model = "qwen3:30b"
]
That isn’t valid TOML. It’s a hybrid that looks like an array literal but isn’t one. Then it immediately re-parsed its own output to verify the write and died on it. The traceback pointed at homebrew/Cellar/gptme/0.35.1/....
The failure is cosmetic — every input I gave was correct, only the serialization is wrong — but it leaves your config file malformed, so every subsequent gptme command fails identically. Worth knowing: you are not misconfiguring anything. Just replace those four lines with the correct [[providers]] block from above.
Validate without relying on gptme’s own loader:
bash
python3 -c "import tomllib;tomllib.load(open('$HOME/.config/gptme/config.toml.p','rb'));print('TOML OK')"
What the settings mean
Two more things in my file deserve comment.
toml
[context.selector]
enabled = true
llm_model = "openai/gpt-4o-mini"
Harmless now, because [context] enabled = false gates the whole subsystem. But if you ever enable context selection, this will try to reach gpt-4o-mini through your OPENAI_BASE_URL — which now points at Ollama — and fail with a model-not-found. Point it at ollama/qwen3:30b or delete the block.
And if you have both:
toml
[env]
OPENAI_BASE_URL = "http://127.0.0.1:11434/v1"
…plus a [[providers]] block with the same URL, you’ve created a global override that shadows the openai provider. Same value, so it works — but it’s the kind of thing that confuses you six months from now.
The asymmetry nobody warns you about
gptme cannot set num_ctx. At all. There’s no config key.
The reason is structural: gptme connects via Ollama’s OpenAI-compatible /v1 API, and that API has no num_ctx field. So gptme inherits whatever the server defaults to.
Goose has its own per-request override. gptme doesn’t. Which means you must set the server default — and on macOS, that’s the fiddly part.
Setting Ollama’s server-side defaults on macOS
If you run Ollama.app, exporting in your shell does nothing. The app is launched by launchd, not your terminal, so it never sees .zshrc. Use launchctl:
bash
launchctl setenv OLLAMA_KEEP_ALIVE 30m
launchctl setenv OLLAMA_CONTEXT_LENGTH 32768
launchctl setenv OLLAMA_KV_CACHE_TYPE q8_0
Then quit Ollama from the menu bar and relaunch it. Not optional — the environment is read at process start.
| Variable | What it does |
|---|---|
OLLAMA_KEEP_ALIVE=30m | Model stays loaded 30 min instead of the 5-min default. No cold-load tax per turn |
OLLAMA_CONTEXT_LENGTH=32768 | Server default window. This is what governs gptme |
OLLAMA_KV_CACHE_TYPE=q8_0 | Halves KV cache memory, negligible quality loss |
Two caveats:
launchctl setenvdoes not survive a reboot. This is a known complaint, not a mistake on your part. Re-run the three commands after restarting, or make a~/Library/LaunchAgentsplist.- Leave
OLLAMA_NUM_PARALLELat 1. Each parallel slot gets its own context window — 32K × 2 slots = 64K of KV cache.
Verify:
bash
ollama ps
The CONTEXT column shows the actually-allocated window. PROCESSOR should read 100% GPU. If CONTEXT says 262144, your launchctl didn’t take.
Using them
The test that actually proves it works
Text generation working proves nothing. Do this first, in both tools:
bash
gptme 'list the files in the current directory'
- ✅ It runs
lsand shows real filenames → working - ❌ It describes what it would do → the model isn’t following the tool protocol
Everything downstream depends on this one check.
Goose
bash
cd ~ # goose operates on its launch directory
goose session # interactive
goose session --name mac-diag # named, findable later
Inside a session, just ask:
> what is using all my ram?
> where is the folder chat?
> why is my disk full?
Expected output — something like:
I'll check memory usage. Running vm_stat and top for a snapshot.
🔧 shell: top -l 1 -o mem -n 10
Processes: 412 total, 3 running, 409 sleeping
PID COMMAND %CPU MEM
1842 Google Chrom 12.3 6.4G
2210 Docker 4.1 4.2G
...
Your RAM is being consumed mainly by Chrome (6.4 GB across helper
processes) and Docker (4.2 GB). Physical memory is 64 GB with
roughly 2.1 GB free and 9 GB in the compressor — so you're not
under real pressure, but Chrome's GPU helpers are the biggest
single consumer.
That last sentence is the whole point. I didn’t ask for a table. I asked for a conclusion.
For one-shots:
bash
goose run -t "what is using all my ram?"
goose run -t "where is the folder chat?" -q # quiet: answer only
goose run -t "why is my disk full?" --no-session # don't save
-q prints only the model’s answer with no tool chatter — perfect for piping or aliasing.
Slash commands worth knowing (all tab-completing):
| Command | Does |
|---|---|
/mode approve | Switch permission mode mid-session |
/r | Toggle full, untruncated tool output — use this to see what it actually ran |
/compact | Summarise history to free context |
/clear | Wipe the conversation |
/model | Show/switch active model |
Resume later:
bash
goose session -r # most recent
goose session list # everything saved
Bonus — ask from your normal prompt:
bash
goose term init
Now @g what is using all my ram? works from any directory, with your recent shell history as context.
gptme
bash
gptme 'what is using all my ram?'
gptme 'where is the folder chat?'
gptme 'why is my disk full?' -m ollama/qwen3:30b # override model
Expected output:
I'll search the Spotlight index for a folder named "chat".
$ mdfind -name chat | head -20
/Users/me/Documents/Projects/chat
/Users/me/Library/Caches/com.apple.chat
Found it. There's a project folder at
/Users/me/Documents/Projects/chat and an unrelated cache
directory in Library/Caches.
If it fails with a tool error, that’s your cue to try the fallback:
bash
gptme --tool-format xml 'what is using all my ram?'
Making both behave like macOS tools
One thing worth doing once, in Goose’s system prompt or a gptme [prompt] fragment:
Prefer macOS-native tools:
mdfind,mdls,du -sh,top -l 1,vm_stat,sysctl,lsof. This is a BSD userland, not GNU.
Without this, models default to Linux syntax. mdfind -name chat searches the Spotlight index and returns in milliseconds; find / -name chat takes minutes and floods the context with permission errors. Same question, wildly different experience.
Troubleshooting, condensed
| Symptom | Cause | Fix |
|---|---|---|
Connection refused :11434 | Ollama not running | Launch the app or ollama serve |
| “does not support tools” | Template lacks tools | ollama show <model>, pick another |
| Agent describes instead of acting | Model too small or broken template | 7B+, or --tool-format xml in gptme |
Unknown model warning | Not in gptme’s known list | Harmless |
| Agent loops forever | Context corrupted | /compact or start a fresh session |
UnexpectedCharError in gptme | The config bug above | Fix [[providers]] manually |
| Slow after a few turns | KV cache filling | Check ollama ps, lower context |
One operational habit: start a new session per task. Local models degrade badly once context fills with dead ends. /compact helps; a fresh session helps more.
Thoughts
The gap between “translator” and “agent” is the whole story. Every “natural language to shell command” tool I tried left me unsatisfied and I couldn’t say why. Now I can: they answer “what command would do this?” when I’m asking “what’s going on?” The loop is what closes that gap. The model seeing its own output is what turns a command generator into something that can investigate.
Local finally feels viable for agents, and MoE is why. Six months ago, a model good enough at tool calling needed cloud inference or a workstation. A 30B MoE at 4-bit runs in 19 GB, leaves 45 GB for context, and emits valid tool calls reliably. The remaining friction isn’t compute — it’s packaging.
The packaging is the actual problem. Look at what I spent time on: a Qwen 3.5 template wired to the wrong renderer, a Qwen3.8 prefix-cache bug, a gptme wizard that writes invalid TOML, and a launchctl quirk where environment variables vanish on reboot. Not one of those is a model-quality issue. The models are fine. The glue is immature, and the failure modes are silent — a broken tool template doesn’t error, it just makes the agent narrate a command instead of running it. You get plausible-sounding nothing. That’s the worst kind of bug, because it looks like a bad model rather than a bad config.
The tools capability check is the single highest-leverage diagnostic I know for this stack. Two seconds, saves hours.
Context length is the setting almost nobody tunes, and it’s the one that matters most. Ollama’s VRAM-based auto-scaling is a sensible default that quietly hands a 64 GB Mac a 256K window — and then the KV cache eats 25 GB you didn’t know you’d spent. Agents are context-hungry in a way chat isn’t, so you’ll hit this. Pin it. Both values, not one.
I’m running two agents and that’s not redundancy. Goose is the better tool and it’s stricter. gptme is the more forgiving one and it’s lighter. When a model’s tool template breaks — and it will — gptme’s XML fallback keeps working while Goose goes quiet. Two tools, two failure modes, one of them always available. That’s cheap insurance.
And the honest caveat. These agents still get things wrong. They’ll pick du -sh * where mdfind was right, and they’ll sound certain while doing it. That’s why I run Goose in smart_approve and why I read the commands before they run. The win isn’t that it’s infallible — it’s that checking its work is faster than doing the work. For a question I’d otherwise postpone for a month, that’s everything.
The terminal has been asking me questions for twenty years. It’s nice to finally get some answers.
Sources
Install and configuration details: Goose installation docs, Homebrew block-goose-cli formula, gptme getting started, Homebrew gptme formula, gptme downloads. Model capabilities and tool-format behaviour verified against ollama show output on Ollama 0.40.7 and public Ollama issue reports (#18913, #18872). Reliability percentages come from a single ~20-request-per-model benchmark and should be read as directional, not definitive.
References(3 total)
- Homebrew Formulae: block-goose-cli
formulae.brew.sh 41%
- Install goose | goose | Your open source AI agent
goose-docs.ai 32%
- Getting Started — gptme
gptme.org 26%