{"slug": "i-built-git-for-ai-prompts-here-s-why-and-how", "title": "I built Git for AI prompts — here's why and how", "summary": "A developer built promptctl, an open-source CLI tool that brings Git-like version control to AI prompt management. The tool allows users to commit, diff, rollback, search, and watch prompts from the terminal, addressing the common problem of tracking prompt changes across scattered files and documents.", "body_md": "Every engineer I know who builds with LLMs has the same problem.\n\nYou spend hours tuning a system prompt. It's working great. You tweak it a little. Then a little more. Then something breaks — the model starts giving worse answers, hallucinating more, ignoring your instructions.\n\nAnd you have absolutely no idea what you changed.\n\nYour prompt history is scattered across files, Notion docs, Slack messages, and git commits buried inside application code. There's no clean way to see what changed, when, or why — let alone get back to the version that was actually working.\n\nSo I built [promptctl](https://github.com/naya-ai/promptctl).\n\npromptctl is a CLI tool that brings the git mental model to prompt management. You commit versions, diff them, roll back, search across them — all from the terminal.\n\n``` bash\n$ echo \"You are a helpful assistant.\" | promptctl commit system -m \"initial\"\n✓ Committed prompt \"system\" as v1\n\n$ echo \"You are a helpful assistant. Always cite sources.\" | promptctl commit system -m \"added citation\"\n✓ Committed prompt \"system\" as v2\n\n$ promptctl diff system\n--- system v1 (2026-06-01 09:12)\n+++ system v2 (2026-06-03 14:47)\n\n- You are a helpful assistant.\n+ You are a helpful assistant. Always cite sources.\n\n$ promptctl rollback system 1 -m \"citation hurt recall\"\n✓ Rolled back \"system\" to v1 → saved as v3\n```\n\nIf you've used git, you already know how to use promptctl.\n\nYou can pipe from stdin, read from a file, or type interactively:\n\n```\n# From stdin\necho \"You are a helpful assistant.\" | promptctl commit system -m \"initial\"\n\n# From a file — best for longer prompts\npromptctl commit system --file prompts/system.txt -m \"from file\"\n\n# Tag with the model it was written for\npromptctl commit classifier -m \"optimized for speed\" --model gpt-4o-mini --tag prod\nbash\n$ promptctl log system --preview\n\nprompt: system\n──────────────────────────────────────────────────\n  v3    2026-06-24 19:41:34\n        citation hurt recall\n        1 lines, 5 words, 28 chars\n        \"You are a helpful assistant.\"\n\n  v2    2026-06-24 19:41:25\n        added citation\n        1 lines, 8 words, 49 chars\n        \"You are a helpful assistant. Always cite sources.\"\n\n  v1    2026-06-24 19:41:25\n        initial\n        1 lines, 5 words, 28 chars\n        \"You are a helpful assistant.\"\npromptctl diff system          # latest vs previous\npromptctl diff system 2        # v2 vs latest\npromptctl diff system 1 3      # explicit comparison\n```\n\nDiffs are colorized — red for removed lines, green for added.\n\n``` bash\n$ promptctl search \"cite sources\"\n\nResults for \"cite sources\"\n──────────────────────────────────────────────────\n  system v2  2026-06-24 19:41\n           added citation\n           …You are a helpful assistant. Always cite source…\n```\n\nSearch checks content, commit messages, and tags.\n\nThis one's my favorite. Point it at a file and it auto-commits every time you save:\n\n```\npromptctl watch prompts/system.txt --as system --model claude-3\n```\n\nNow you can edit in your normal editor and every save is a versioned snapshot. The commit timestamp matches the file's modification time, not when promptctl ran.\n\n```\npromptctl copy system system-experimental   # fork with full history\npromptctl show system --copy                # copy to clipboard\npromptctl show system --version-at 2026-06-01  # time travel\npromptctl export system > history.md        # full markdown export\npromptctl stats                             # store-wide overview\npromptctl prune system --keep 10            # housekeeping\n```\n\nEverything is stored in `.promptctl/store.json`\n\nin your project directory — similar to how `.git/`\n\nworks. The store is discovered by walking up parent directories, so commands work from any subdirectory.\n\n```\nyour-project/\n├── .promptctl/\n│   └── store.json     ← all prompt versions live here\n├── src/\n└── ...\n```\n\nCommit `store.json`\n\nto git and your whole team shares prompt history. Or add `.promptctl/`\n\nto `.gitignore`\n\nif you want a local-only store.\n\nWrites are atomic — we write to a temp file and rename, so you never get a corrupt store even if the process is killed mid-write.\n\nI wanted promptctl to be a tool you install once and forget about. No runtime required, no `node_modules`\n\n, no `pip install`\n\n, no version conflicts.\n\nGo's standard library covers everything promptctl needs:\n\nThe result is a single binary you install with:\n\n```\ngo install github.com/naya-ai/promptctl/cmd/promptctl@latest\n```\n\nAnd it works on Mac, Linux, and Windows.\n\n```\n# Bash\nsource <(promptctl completion bash)\n\n# Zsh\nsource <(promptctl completion zsh)\n\n# Fish\npromptctl completion fish > ~/.config/fish/completions/promptctl.fish\n```\n\nCompletions dynamically suggest your prompt names for every command that takes a `<name>`\n\nargument.\n\nThis is v0.1.0 — the core workflow is solid but there's a lot more to build. Things I'm thinking about:\n\nIf you build with LLMs and prompt management is painful for you, I'd love to hear what's missing.\n\n```\ngo install github.com/naya-ai/promptctl/cmd/promptctl@latest\npromptctl init\necho \"You are a helpful assistant.\" | promptctl commit system -m \"initial\"\npromptctl log system\n```\n\nGitHub: [github.com/naya-ai/promptctl](https://github.com/naya-ai/promptctl)\n\nIf this solves a problem you have, a star on the repo goes a long way for a solo project. And if something's broken or missing, open an issue — I respond fast.", "url": "https://wpnews.pro/news/i-built-git-for-ai-prompts-here-s-why-and-how", "canonical_source": "https://dev.to/nayaai/i-built-git-for-ai-prompts-heres-why-and-how-44gn", "published_at": "2026-06-25 01:14:32+00:00", "updated_at": "2026-06-25 01:43:17.213759+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "generative-ai", "ai-tools"], "entities": ["promptctl", "Git", "LLM", "Naya AI"], "alternates": {"html": "https://wpnews.pro/news/i-built-git-for-ai-prompts-here-s-why-and-how", "markdown": "https://wpnews.pro/news/i-built-git-for-ai-prompts-here-s-why-and-how.md", "text": "https://wpnews.pro/news/i-built-git-for-ai-prompts-here-s-why-and-how.txt", "jsonld": "https://wpnews.pro/news/i-built-git-for-ai-prompts-here-s-why-and-how.jsonld"}}