Artificial intelligence (AI), Perplexity.ai

NerdPrompt: Perplexity.AI Made Beautiful For The Terminal

I built NerdPrompt to make Perplexity.AI (and other LLM’s ) chat accessible in a terminal workflow, with beautiful formatting. Later, it had the added advantage of giving my local AI agents a search tool (using raw output mode).

Some other cool features:

  • Threaded so you can stay on topic to answer multiple questions about the same topic.
  • Return just a command with `nerdprompt -p command “git how to remove last 3 commits from local repo”`
  • AI Agents can use NerdPrompt! You can use raw mode and the ‘concise’ prompt to allow your Agent to get answers in plain markdown w/ the fewest tokens possible to preserve context window.
  • Paste mode for piping / pasting in code and text interactively. Just skip to blank ending line and press CTRL-D to submit your pasted content. This running in NeoVIM windows or even inside Tmux panes and with NeoVIM clipboard integration you can ‘y’ yank from VIM then just CTRL-V into your Nerdprompt pane. Type your prompt question on the last line and send it off with CTRL-D. Running Nerdprompt inside NeoVIM windows lets you yank content from window to window back and forth from code to Nerdprompt.
  • Create your own system prompt! return only JSON formatted data. Respond professionally to email using tech details to explain to a layman whats happening and the approx. time itll take to fix , translate code or spoken languages to diff languages, reply with steps to fix error or network message to customer, whatever you want! System prompt explains what to do with the main User prompt. Sky is the limit here.

Terminal Rendering

NerdPrompt takes markdown from LLM responses (tested with Perplexity.AI, OpenAI API LLMS) and transforms it for practical terminal use:

  • ANSI terminal color support, customizable in config.
  • Titles, headers, bold, italicized, and bullet lists styled headers follow terminal color schemes (see config.yaml).
  • bold, italic, and combined formatting are translated to terminals
  • Optional emoji or ASCII art style bullet points
  • Code blocks auto-detected and syntax highlighted with Pygments (40+ supported themes, Default is Dracula theme. Matches theme of headers and dividers by default).
  • Code sections have their own dividers using ascii or unicode (to include emojis)

Output Controls

Several command flags control output:

  • NEW ! –model (-m): Give you the ability to choose your model outside of the default setting in config.yaml
  • --nothread (-n): disables context retention and exits immediately after the answer (suits command pipelines, AI Agents, and scripts).
  • –prompt (-p) : ‘default’, ‘concise’, ‘command’, and ‘markdown’ to choose from, but you can set your own!
  • --raw (-r): outputs plaintext markdown without the NerdPrompt magic. I use this for AI agents since they speak markdown.
  • --paste: enables multiline input for analysis and code review; supports direct piping, batch queries, or manual paste. great way to pipe in a file using bash.

System Prompt and Customization

Prompt style is selectable with -p (--prompt) flag:

  • default: outputs color-formatted, full markdown (default). This is returned no need to select it
  • concise: trims responses for minimalism and speed.
  • Markdown: Forces marking sections with headers of different sizes which correlate to different colors in terminal. Forces Citations to be displayed in certain way. Can take longer to return a response.
  • command: Only returns the command you ask for w/ no formatting. Great for remembering commands! Example below:

You can create custom system prompts and formatting templates in the YAML config.

Hope you like. Please let me know if there are other feature you would like to see. Im always open to approving your PR’s!

Find the repo HERE

More Examples