{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifkuyp2f53rsyvvhissz2v2lhputkwumlfp5lhulsjj4zrllky6oa",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mp3cvt5ib362"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiett6m7mzcpduthhlvejige3tob35s4m6oze6rewufxvljh2vqv4y"
    },
    "mimeType": "image/webp",
    "size": 246220
  },
  "path": "/nayaai/i-built-git-for-ai-prompts-heres-why-and-how-44gn",
  "publishedAt": "2026-06-25T01:14:32.000Z",
  "site": "https://dev.to",
  "tags": [
    "go",
    "ai",
    "opensource",
    "productivity",
    "promptctl",
    "github.com/naya-ai/promptctl"
  ],
  "textContent": "##  I Built Git for AI Prompts — Here's Why and How\n\nEvery 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.\n\n##  What is it?\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\n\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\n##  The full workflow\n\n###  Committing a prompt\n\nYou can pipe from stdin, read from a file, or type interactively:\n\n\n\n    # From stdin\n    echo \"You are a helpful assistant.\" | promptctl commit system -m \"initial\"\n\n    # From a file — best for longer prompts\n    promptctl commit system --file prompts/system.txt -m \"from file\"\n\n    # Tag with the model it was written for\n    promptctl commit classifier -m \"optimized for speed\" --model gpt-4o-mini --tag prod\n\n\n###  Viewing history\n\n\n    $ promptctl log system --preview\n\n    prompt: 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.\"\n\n\n###  Diffing versions\n\n\n    promptctl diff system          # latest vs previous\n    promptctl diff system 2        # v2 vs latest\n    promptctl diff system 1 3      # explicit comparison\n\n\nDiffs are colorized — red for removed lines, green for added.\n\n###  Searching across everything\n\n\n    $ promptctl search \"cite sources\"\n\n    Results 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\n###  Watching a file\n\nThis one's my favorite. Point it at a file and it auto-commits every time you save:\n\n\n\n    promptctl 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###  Other commands\n\n\n    promptctl copy system system-experimental   # fork with full history\n    promptctl show system --copy                # copy to clipboard\n    promptctl show system --version-at 2026-06-01  # time travel\n    promptctl export system > history.md        # full markdown export\n    promptctl stats                             # store-wide overview\n    promptctl prune system --keep 10            # housekeeping\n\n\n##  How it works\n\nEverything is stored in `.promptctl/store.json` in your project directory — similar to how `.git/` works. The store is discovered by walking up parent directories, so commands work from any subdirectory.\n\n\n\n    your-project/\n    ├── .promptctl/\n    │   └── store.json     ← all prompt versions live here\n    ├── src/\n    └── ...\n\n\nCommit `store.json` to git and your whole team shares prompt history. Or add `.promptctl/` to `.gitignore` if 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\n##  Why Go, why zero dependencies?\n\nI wanted promptctl to be a tool you install once and forget about. No runtime required, no `node_modules`, no `pip install`, no version conflicts.\n\nGo's standard library covers everything promptctl needs:\n\n  * JSON serialization\n  * Atomic file writes\n  * Directory traversal\n  * Diff algorithm (LCS, implemented from scratch)\n  * ANSI color detection\n\n\n\nThe result is a single binary you install with:\n\n\n\n    go install github.com/naya-ai/promptctl/cmd/promptctl@latest\n\n\nAnd it works on Mac, Linux, and Windows.\n\n##  Shell completions\n\n\n    # Bash\n    source <(promptctl completion bash)\n\n    # Zsh\n    source <(promptctl completion zsh)\n\n    # Fish\n    promptctl completion fish > ~/.config/fish/completions/promptctl.fish\n\n\nCompletions dynamically suggest your prompt names for every command that takes a `<name>` argument.\n\n##  What's next\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\n  * Remote sync (S3, GitHub Gist) so prompts are backed up and shareable\n  * Side-by-side diff view\n  * VS Code extension\n\n\n\nIf you build with LLMs and prompt management is painful for you, I'd love to hear what's missing.\n\n##  Try it\n\n\n    go install github.com/naya-ai/promptctl/cmd/promptctl@latest\n    promptctl init\n    echo \"You are a helpful assistant.\" | promptctl commit system -m \"initial\"\n    promptctl log system\n\n\nGitHub: 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.",
  "title": "I built Git for AI prompts — here's why and how"
}