My LLM tooling
Part of the series "One month of LLMs"
I have my own set of command-line tools for interacting with LLMs. One advantage is that I have system prompts specialized for different tasks; another is that all conversations are saved to my personal database, in a normalized format across models, in case I want to inspect or analyze them in the future.
kgpt chat
is a chat-style, turn-based interface.
kgpt oneshot 'what is the capital of Madagascar?'
– self-explanatory.
kgpt shell 'find all python files containing the string "psycopg"'
– like kgpt oneshot
, except with a system prompt customized for shell commands, and it will actually run the command that the LLM generates (after you confirm it!).
kgpt implement
takes in a source-code file and has the LLM implement any instructions in # LLM:
comments. It's non-interactive, and the LLM can only replace text in the file.
kgpt refactor
accepts a list of files from standard input (e.g., pipe rg -l
into it) and a prompt as a command-line argument. For each file, the LLM is invoked with the prompt, and a tool that lets it edit the file. It's faster and cheaper than having the LLM find all the files itself.
kgpt agent
is my custom agent for writing code. It's not a replacement for Claude Code, which has a much more polished interface and is great for interactive use. kgpt agent
is for non-interactive, background tasks. I wrote my own set of tools (read and edit files, search for text, etc.) with a set of safeguards that make me comfortable running it without explicit approval. For example, it cannot access files outside of the repository, and it can only edit files that are tracked by Git. It cannot run shell commands. When it's done, it sends me an email with the diff.