{"slug": "a-comma-and-a-question-mark-redux", "title": "A Comma and a Question Mark Redux", "summary": "A developer adapted Rémi Louf's shell-based AI assistant concept to work with the CLI agent Pi and OpenRouter, creating two custom commands that generate shell commands from plain English descriptions and answer terminal questions. The comma command copies suggested commands to the clipboard without automatic execution, while the question mark command provides concise AI answers using web search and file-reading tools.", "body_md": "I am a decent user of the terminal, but I am not strong at remembering `find`\n\nflags - or `rsync`\n\n, or `grep`\n\nfor that matter.\n\nI read [Rémi Louf’s post](https://www.thetypicalset.com/blog/a-comma-and-a-question-mark) about wiring a comma and a question mark into his shell and immediately wanted the same thing. The idea is simple: type `, <description>`\n\nand get a shell command that does what you described. Type `? <question>`\n\nand get an AI answer right in your terminal.\n\nRémi runs a local Qwen model through llama.cpp. I don’t have a local model, but I do have [pi](https://pi.dev), a CLI chat agent, and I have my routing set through OpenRouter. Pi was already configured and working on my machine. So I took the idea and adapted it.\n\nWhen I want nice shell commands, now all I have to do is type a comma followed by a plain English description of what I want to do. A few seconds later I get a suggested command copied to my clipboard. For example:\n\n```\n, find the 5 largest files in the current directory\n```\n\nA second later:\n\n```\nls -lS\n```\n\nis copied to my clipboard. I press Cmd+V, the command lands on my prompt line. I read it, maybe edit it, then press Enter myself.\n\n``` bash\n$ ls -lS\n```\n\nThe comma is slightly safe because it won’t automatically execute. It copies to my clipboard and prints the command - so that I can judge and apply the keystroke between “here’s a suggestion” and “yes, do that”.\n\nUnder the hood it’s a thin shell script in `~/.dotfiles/bin/,`\n\non my PATH:\n\n``` bash\n#!/usr/bin/env zsh\nlocal command\ncommand=$(pi --print -p --no-tools --thinking off \\\n  --system-prompt \"output exactly one shell command —\n  the best one — with no numbering, no explanation,\n  no markdown, no backticks. Just the raw command\n  on a single line.\" \"$desc\" 2>/dev/null)\n\necho -n \"$command\" | pbcopy\necho \"$command\"\n```\n\nPi uses whichever model is currently selected. Typically for me this is on OpenRouterusing DeepSeek v4 Flash or Gemini 3.5 Flash. These have low or free API cost.\n\nI skipped the JSON Schema trick from the original. I don’t think pi exposes a structured output mode, so I just made the prompt tight and stripped backticks in post.\n\nLikewise, when I just have a short question, I now have the `q`\n\nscript. Instead of launching a whole `pi`\n\nsession, I can get a quick answer with minimal fuss:\n\n```\nq what's the weather like today in Brutus, MI?\n```\n\nThe `q`\n\ncommand also invokes Pi, but now Pi can use a narrow toolset including from some extensions:\n\n```\npi --print -p \\\n  --system-prompt \"You are a helpful, concise assistant\n  running in a macOS terminal. Answer clearly and accurately.\n  You can read files from disk and search the web — use those\n  when you need current or file-specific information.\" \\\n  --tools \"read,web_search,url_extract,web_fetch,batch_web_fetch\" \\\n  \"$question\"\n```\n\nYou can find the script files [in my dotfiles repo on GitHub](https://github.com/z3ugma/.dotfiles/commit/a1453d02b3da53af4a442f45ddc3a938406cc5d2).", "url": "https://wpnews.pro/news/a-comma-and-a-question-mark-redux", "canonical_source": "http://z3ugma.github.io/2026/05/25/a-comma-and-a-question-mark/", "published_at": "2026-05-25 15:00:00+00:00", "updated_at": "2026-05-25 20:09:27.546431+00:00", "lang": "en", "topics": ["ai-tools", "ai-products", "large-language-models", "generative-ai", "natural-language-processing"], "entities": ["Rémi Louf", "Qwen", "llama.cpp", "pi", "OpenRouter", "Cmd+V", "Enter"], "alternates": {"html": "https://wpnews.pro/news/a-comma-and-a-question-mark-redux", "markdown": "https://wpnews.pro/news/a-comma-and-a-question-mark-redux.md", "text": "https://wpnews.pro/news/a-comma-and-a-question-mark-redux.txt", "jsonld": "https://wpnews.pro/news/a-comma-and-a-question-mark-redux.jsonld"}}