A Comma and a Question Mark, Redux: Quick Terminal Helpers Using Pi
Recorded: May 27, 2026, 5 p.m.
| Original | Summarized |
A Comma and a Question Mark Redux Python Monty Leave it better than you found it. Home © 2026. All rights reserved. A Comma and a Question Mark Redux A second later: is 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. The 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”. echo -n "$command" | pbcopy Pi 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. The q command also invokes Pi, but now Pi can use a narrow toolset including from some extensions: You can find the script files in my dotfiles repo on GitHub. Previous: |
The author explores an innovative approach to enhancing command-line interaction by integrating simple punctuation marks, the comma and the question mark, to facilitate the generation of shell commands and direct answers using a command-line agent, specifically leveraging a system named Pi. This method aims to bridge the gap between natural language instruction and executable terminal commands. The comma feature is designed to provide context-aware shell command suggestions. When the user types a comma followed by a plain English description of a desired action, the system immediately suggests a command. This suggestion process involves executing a thin shell script located in the user's PATH. This script interfaces with Pi, which runs a local model, such as Qwen via llama.cpp, typically accessed through services like OpenRouter using cost-effective models such as DeepSeek v4 Flash or Gemini 3.5 Flash. Critically, the system prompt used by Pi is tightly constrained to output only the raw shell command, excluding explanations or markdown, ensuring the output is ready for immediate use. The suggested command is copied to the clipboard and then printed to the terminal, allowing the user to review the command before manually executing it. This structure makes the suggestion mechanism safe, as it delegates the execution decision to the user. The question mark feature extends this functionality to direct question-and-answer queries. Instead of requiring a lengthy session with the agent, typing a question followed by the question allows the system to invoke Pi with a defined set of tools. This setup permits Pi to utilize a narrow, context-specific toolset, including capabilities for reading files from disk and performing web searches or fetching URLs when context demands current or file-specific information. The system prompt for this mode instructs Pi to act as a helpful and concise assistant operating within the macOS terminal, thereby streamlining the interaction for retrieving information. The scripts enabling these features are made available in the author's dotfiles repository on GitHub. |