Git-temp: A Git scratchpad tool designed for AI agents—zero-Git-status clutter, zero configuration

git-temp is a lightweight CLI tool that enables AI agents to safely generate and manage temporary files (e.g., LLM outputs, debug logs, code drafts) inside Git repositories by isolating them in a `.git-temp/` directory and automatically synchronizing its exclusion into `.gitignore`, without modifying Git config, hooks, or index state.
Core Purpose: Solving the 'write-and-pollute' engineering pain point for AI agents in Git repos
Modern AI agents—including DevOps automation scripts, RAG post-retrieval rerankers, and LLM-based code generators—frequently need to write transient artifacts (e.g., unvalidated code snippets, JSON intermediate states, diff snapshots) directly into local Git working directories. Conventional approaches rely on git update-index --skip-worktree or manual .gitignore edits, which are error-prone, hard to automate, and conflict with agent statelessness. git-temp addresses this by defining a convention-over-configuration protocol for ephemeral files.
Implementation: Isolated directory + intelligent .gitignore synchronization
- All temporary files are written exclusively under
.git-temp/at the repo root (configurable, but default-conforming); - On first
git-temp init, it auto-detects and appends/\.git-temp/to the project’s.gitignore(creates it if absent), guaranteeing full Git invisibility; - Provides semantic commands:
git-temp add <file>,git-temp rm <file>,git-temp list; all operate via filesystem moves and line-level.gitignorevalidation—no Git internals invoked; - Bypasses Git index entirely: no
git statuschanges, no untracked file warnings, no interference withgit commit -a; - Compatible with all Git ≥2.0; requires no hooks, no global config, no
.git/configedits.
Technical boundaries and intentional minimalism
What it doesn’t do is precisely why it’s reliable
- ❌ No
git stashorgit worktreewrappers: avoids Git internal state coupling; - ❌ No filesystem event listeners (inotify/fsevents): eliminates background process contention;
- ❌ No web UI or daemon: pure CLI, single Go binary (<500KB);
- ❌ No filesystem abstraction layer: all I/O uses native
ospackage—zero third-party FS libraries.
This minimalism makes git-temp an invisible infrastructure in AI agent workflows—for example, calling git-temp add output.py inside a LangChain Tool, or writing reasoning_trace.json to .git-temp/trace/ during multi-step Ollama + OpenAI function calling—all transparent to both developers and Git.
Use cases and integration patterns
- Agent-driven development (ADD): LLM-generated unit tests staged in
.git-temp/test_scaffold/, moved totests/only after human review; - RAG pipeline debugging: Raw embedding vectors (e.g.,
numpy.savedumps) stored in.git-temp/embeddings_debug/, keepingdata/clean; - CI/CD LLM validation steps: GitHub Actions job uses
sebmellen/git-temp@v0.3.1action to auto-clean.git-temp/for build reproducibility; - Local LLM serving (e.g., llama.cpp + REST API): Server saves token-level attention maps to
.git-temp/attn_viz/for downstream visualization—no impact on repo state.
Open-source status and roadmap
Maintained by Seb Mellen, current version v0.3.1 (released 2024-07-12), hosted at https://github.com/sebmellen/git-temp, MIT licensed. Already validated for compatibility with Hugging Face transformers and langchain. Next milestones include: .git-temp/.keep semantic support (for empty-directory preservation), --dry-run mode for CI safety checks, and Python bindings (pip install git-temp) for broader agent runtimes (e.g., AutoGen, CrewAI).