惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
S
Securelist
Attack and Defense Labs
Attack and Defense Labs
T
Threat Research - Cisco Blogs
L
LINUX DO - 最新话题
The GitHub Blog
The GitHub Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Security Affairs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
美团技术团队
量子位
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
GbyAI
GbyAI
O
OpenAI News
IT之家
IT之家
F
Full Disclosure
W
WeLiveSecurity
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Palo Alto Networks Blog
P
Privacy International News Feed
Webroot Blog
Webroot Blog
C
CERT Recently Published Vulnerability Notes
Latest news
Latest news
月光博客
月光博客
博客园 - 【当耐特】
N
News | PayPal Newsroom
Cloudbric
Cloudbric
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Exploit Database - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
K
Kaspersky official blog
云风的 BLOG
云风的 BLOG
宝玉的分享
宝玉的分享
博客园 - 叶小钗
TaoSecurity Blog
TaoSecurity Blog
Martin Fowler
Martin Fowler
Simon Willison's Weblog
Simon Willison's Weblog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
D
Docker
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
PCI Perspectives
PCI Perspectives
Microsoft Azure Blog
Microsoft Azure Blog
雷峰网
雷峰网

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
AI Agent Scratchpad: Keep Coding Agents Fast Without Polluting Git
Jack M · 2026-06-28 · via DEV Community

Coding agents are fast enough to create a mess before you notice it. One prompt can leave behind debug scripts, JSON dumps, half-finished notes, copied stack traces, and helper files that sit beside production code like they belong there.

The risky part is not the mess itself. The risky part is when that mess becomes invisible. A noisy git status trains you to ignore changes, while a hidden .gitignore rule can make useful agent context disappear from your editor. If you build AI-assisted products, you need a better pattern: a visible scratchpad that agents can use freely, Git can ignore safely, and reviewers can clean without guessing.

This guide shows how to design an AI agent scratchpad for real development work.

Why Agent Scratchpads Matter Now

Recent AI developer tooling is moving in the same direction: agents are getting longer-running, more tool-aware, and more deeply connected to repos, Slack, issue trackers, browsers, and local files. That is useful. It also means temporary work is no longer just a human habit.

An agent may create:

  • one-off reproduction scripts
  • API response dumps
  • benchmark outputs
  • migration drafts
  • screenshots or UI notes
  • local test fixtures
  • prompt experiments
  • failed implementation attempts
  • summaries of files it read

None of these belong in the main source tree forever. Some are valuable for review. Some are sensitive. Some are pure junk. Without a deliberate scratchpad, they all end up scattered across the project.

The core problem is simple:

Agents need room to think, test, and collect evidence. Production repos need clean boundaries.

A scratchpad gives both sides what they need.

The Bad Pattern: Random Temporary Files Everywhere

Most teams start with the default pattern: let the agent write wherever it wants, then clean up before commit.

That works for tiny tasks. It breaks down when agents handle larger workflows.

Imagine a coding agent debugging a failing billing sync. It creates:

scripts/test_sync.py
response.json
notes.md
debug.log
billing_dump.csv
new_test.py
old_handler_backup.ts

A human comes back later and sees a wall of unrelated changes. Some files are real. Some are experiments. Some contain customer-like test data. Some are needed to understand the fix.

Now review quality drops because the reviewer has to ask basic questions:

  • Is this file part of the feature?
  • Was this generated by the agent?
  • Can I delete it?
  • Does it contain secrets or private data?
  • Did the agent accidentally change shared ignore rules?
  • Why is the diff so noisy?

A messy repo does not just waste time. It weakens trust in the AI workflow.

The Better Pattern: A Local, Visible, Ignored Scratchpad

A good agent scratchpad has three properties:

  1. Visible to humans and AI tools so files can be referenced, inspected, and reused.
  2. Ignored by Git locally so temporary files do not clutter commits.
  3. Structured by purpose so cleanup and review are predictable.

The important detail is local ignore. Instead of adding a shared .gitignore rule, use .git/info/exclude.

.git/info/exclude behaves like .gitignore, but it only applies to your local clone. It does not affect teammates, CI, or the shared repository.

That makes it ideal for agent scratch work.

Recommended Folder Structure

Use one top-level directory, such as temp/, scratch/, or .agent-scratch/. I prefer temp/ because it is obvious and short.

A practical layout looks like this:

temp/
  README.md
  scripts/
  dumps/
  drafts/
  traces/
  fixtures/
  screenshots/
  review-notes/

Each subfolder has a job:

Folder Use it for
scripts/ one-off debugging and migration helpers
dumps/ JSON, CSV, logs, API responses, benchmark outputs
drafts/ rough specs, prompt notes, article drafts, implementation plans
traces/ agent traces, tool-call summaries, evaluation output
fixtures/ temporary test data that is not ready for committed tests
screenshots/ UI evidence and browser captures
review-notes/ human-readable summaries of what changed and why

The structure matters because agents follow visible conventions. If the scratchpad explains where to put things, the agent is less likely to scatter files across the repo.

Set Up the Scratchpad Manually

You do not need a special tool. You can create the pattern with plain Git and a few shell commands.

mkdir -p temp/{scripts,dumps,drafts,traces,fixtures,screenshots,review-notes}
cat > temp/README.md <<'EOF'
# Local AI Scratchpad

This folder is for temporary agent and developer work.

Use it for:
- one-off scripts
- logs and API dumps
- draft notes
- trace evidence
- temporary fixtures
- screenshots

Rules:
- Do not store secrets here.
- Do not depend on files here from production code.
- Promote useful files into the repo intentionally.
- Clean this folder before major merges.
EOF
printf "\n# Local AI/developer scratchpad\ntemp/\n" >> .git/info/exclude

Now temp/ stays visible in your editor but does not appear in git status.

Check it:

git status --short

If the scratchpad does not show up, the local exclude is working.

Add Agent Instructions

The scratchpad only works if agents know how to use it. Add a short instruction to your repo’s agent guidance file. Depending on your tools, that might be AGENTS.md, CLAUDE.md, .cursorrules, or another project instruction file.

Example:

## AI Scratchpad

Use `temp/` for temporary scripts, logs, API dumps, traces, and drafts.
Do not create random temporary files in the project root.
Do not store secrets, tokens, private customer data, or credentials in `temp/`.
If a scratchpad file becomes useful, explain why and ask before promoting it into tracked source.
Before finishing a task, summarize anything important left in `temp/review-notes/`.

This small block prevents a surprising amount of clutter. It also gives reviewers a stable place to look for evidence.

What Should Go Into the Scratchpad?

Use the scratchpad for work that helps solve the task but should not be committed by default.

Good scratchpad candidates:

  • a script that reproduces a bug once
  • a curl response from a local API
  • a model output comparison
  • a quick benchmark result
  • a temporary SQLite database
  • a browser screenshot for a UI check
  • notes from inspecting a third-party SDK
  • a failed approach the reviewer may want to understand

Bad scratchpad candidates:

  • production code
  • real migration files
  • committed test fixtures
  • secrets
  • .env files
  • user exports
  • private customer data
  • files that CI must read
  • anything the app imports at runtime

A useful rule:

If the app needs it, it does not belong in the scratchpad. If the reviewer may need it, it might.

Promote Files Intentionally

Sometimes a scratchpad file becomes real work. A debug script becomes a regression test. A draft schema becomes a migration. A temporary fixture becomes a stable test fixture.

That is fine. The promotion should be explicit.

Before moving a file out of temp/, ask four questions:

  1. Does this file support the product, tests, docs, or operations long term?
  2. Is it free of secrets and private data?
  3. Is the name clear enough for future maintainers?
  4. Did we remove throwaway assumptions from the agent’s experiment?

Example promotion flow:

# From temporary reproduction script
mv temp/scripts/repro-billing-sync.ts tests/regression/billing-sync-retry.test.ts

# Then edit it into a real test before committing
git add tests/regression/billing-sync-retry.test.ts

Do not blindly move agent-created files into tracked folders. Treat scratchpad promotion like code review.

Add a Cleanup Command

A scratchpad that never gets cleaned becomes a junk drawer. Give developers and agents a safe cleanup command.

Create scripts/clean-scratchpad.sh:

#!/usr/bin/env bash
set -euo pipefail

ROOT="$(git rev-parse --show-toplevel)"
SCRATCH="$ROOT/temp"

if [ ! -d "$SCRATCH" ]; then
  echo "No temp/ scratchpad found."
  exit 0
fi

find "$SCRATCH" -mindepth 1 -maxdepth 1 \
  ! -name README.md \
  -exec rm -rf {} +

mkdir -p "$SCRATCH"/{scripts,dumps,drafts,traces,fixtures,screenshots,review-notes}

echo "Scratchpad cleaned."

If your team avoids direct deletes, replace rm -rf with a trash command on local machines. The point is to make cleanup boring and repeatable.

Protect Against Secret Leaks

Ignoring scratch files is not enough. Ignored files can still be read by local tools, copied into prompts, uploaded by extensions, or pasted into issues.

Add guardrails.

At minimum:

  • never store .env files in the scratchpad
  • never dump real customer records
  • mask tokens before saving API responses
  • keep browser session exports out of the repo
  • run secret scans before promoting any scratch file

A simple local check can catch obvious mistakes:

rg -n "(api_key|secret|token|password|BEGIN PRIVATE KEY)" temp/ || true

For stronger protection, use a secret scanner in pre-commit and CI. The scratchpad itself is local, but promoted files still need normal security checks.

Keep Evidence Without Keeping Noise

One of the best uses of an agent scratchpad is evidence collection. Instead of asking the agent to merely say “tests pass,” ask it to save small proof artifacts.

For example:

temp/review-notes/fix-summary.md
temp/traces/test-run.txt
temp/screenshots/settings-page-after.png

The review note can be short:

# Review Notes

Task: Fix retry behavior for billing sync timeout.

Changed:
- Added idempotency key reuse during retry.
- Added regression test for timeout after provider accepted request.
- Confirmed existing webhook dedupe still passes.

Evidence:
- `temp/traces/test-run.txt`
- `temp/screenshots/billing-retry-log.png`

Not promoted:
- `temp/scripts/repro-billing-timeout.ts` was only used for local reproduction.

This gives the reviewer context without polluting the final commit.

Use Scratchpads With Evals and Agent Harnesses

As AI agents move from simple code completion to longer workflows, verification becomes the hard part. The agent can generate a plausible fix quickly. Proving the fix matches human intent is slower.

A scratchpad helps by keeping verification artifacts close to the work:

  • failing inputs before the fix
  • passing outputs after the fix
  • model comparison notes
  • trace summaries
  • edge cases the agent considered
  • cases the agent skipped

For AI product builders, this is especially useful when testing model behavior. You can store temporary eval output in temp/traces/ before deciding whether it belongs in a permanent evaluation suite.

Example:

temp/traces/rag-answer-regression-raw.json
temp/traces/agent-tool-call-sample.json
temp/review-notes/eval-findings.md

Then promote only the stable cases:

evals/fixtures/billing-policy-denial.json
evals/rubrics/source-grounding.yml

This keeps your evaluation system clean while still giving agents room to explore.

A Practical Workflow for Solo Builders

If you are building alone, you may not need heavy process. You still need boundaries.

Use this lightweight workflow:

  1. Start every agent task by telling it to use temp/ for experiments.
  2. Ask it to keep production changes outside temp/ clean and minimal.
  3. Ask for a short summary in temp/review-notes/ when the task is done.
  4. Run tests and inspect git diff.
  5. Promote only useful scratch files.
  6. Clean the scratchpad after merge.

A good prompt looks like this:

Use temp/ for scratch scripts, dumps, and notes. Do not create temporary files in the repo root. Keep the final diff focused. Before finishing, write a short review note listing tests run, files changed, and any scratch files that should be deleted or promoted.

This works well for solo developers, micro product teams, and technical founders who want agent speed without losing repo hygiene.

A Practical Workflow for Teams

Teams need the same pattern, plus stricter handoff rules: document the scratchpad path, require review before promoting scratch files, scan promoted artifacts for secrets, and clean task folders before merging long-running branches. For shared work, use task-specific folders like temp/tasks/billing-retry/ so evidence from different agents does not blend together.

Common Mistakes

Mistake 1: Putting temp/ in shared .gitignore

This is tempting, but it can hide useful conventions from other contributors. Local excludes are safer for personal scratch work. If the whole team truly standardizes on a scratchpad, document it clearly.

Mistake 2: Letting production code depend on scratch files

If an import points into temp/, something went wrong. Scratchpad files are disposable.

Mistake 3: Saving raw customer data

Agents often ask for examples. Give them synthetic data. If you must inspect real data, keep it outside the repo and follow your data handling rules.

Mistake 4: Cleaning without review

Sometimes the scratchpad contains useful evidence. Review before deleting, especially after complex debugging or model evaluation work.

Mistake 5: Treating the scratchpad as a replacement for tests

A trace is not a test. A debug script is not a regression suite. Use scratch artifacts to discover what should become permanent.

Implementation Checklist

Use this checklist to add the pattern today:

  • [ ] Create temp/ with clear subfolders.
  • [ ] Add temp/ to .git/info/exclude.
  • [ ] Add temp/README.md with rules.
  • [ ] Update agent instructions to use the scratchpad.
  • [ ] Add a cleanup script.
  • [ ] Add secret-scan reminders before promotion.
  • [ ] Ask agents to write review notes for complex tasks.
  • [ ] Promote only stable tests, docs, fixtures, and scripts.

This is not fancy infrastructure. It is a small workflow boundary. That is why it works.

Final Takeaway

AI coding agents work better when they have space to explore. Repositories work better when every tracked file has a reason to exist.

An AI agent scratchpad gives you both. It keeps experiments visible, prevents temporary files from polluting Git, creates a home for review evidence, and makes cleanup routine instead of stressful.

The goal is not to make agents perfectly tidy. The goal is to make their mess safe, inspectable, and disposable.

FAQ

What is an AI agent scratchpad?

An AI agent scratchpad is a local folder where coding agents and developers can store temporary scripts, logs, drafts, traces, and test outputs without adding them to the committed source tree.

Should I use .gitignore or .git/info/exclude for scratch files?

Use .git/info/exclude for local scratch work. It ignores files only in your clone, so you avoid changing shared repository rules. Use .gitignore only when the whole team agrees that a pattern should be ignored everywhere.

Can coding agents read files in an ignored scratchpad?

Usually yes. Git ignoring a file does not hide it from your editor or local AI tools. That is why a local scratchpad is useful: it stays visible for context but does not clutter commits.

Is it safe to store API responses in a scratchpad?

Only if they are sanitized. Do not store secrets, tokens, private user records, or customer exports. Mask sensitive fields before saving responses, and scan files before promoting anything into tracked code.

When should a scratchpad file become a real repo file?

Promote it when it has long-term value as a test, fixture, script, document, or operational artifact. Before promoting, rename it clearly, remove temporary assumptions, check for secrets, and review it like normal code.

Does this replace agent observability or eval tooling?

No. A scratchpad is a local workflow pattern. Observability and eval tooling are still needed for production agents. The scratchpad helps during development by keeping temporary evidence organized before it becomes permanent instrumentation or evaluation data.