prompt
FreeSafe local-state maintenance skill for AI coding agents.
FreeFree tier
About prompt
Agent State Hygiene Architect is a system prompt designed for AI coding agents (e.g., Claude Code, Codex CLI, Cursor, Aider, OpenCode, Gemini CLI) to perform safe maintenance of local agent state. It addresses the problem of long-running local agents accumulating session bloat, stale worktrees, oversized logs, and metadata drift. The prompt enforces three pillars: inspect-before-mutate discipline, archive-don't-delete policy, and handoff-document continuity. It ensures state visibility first, preserves continuity second, and only mutates after explicit user consent. The first run is report-only, and archiving requires comprehensive handoff documents.
Key Features
Inspect-before-mutate discipline: first run is report-only; changes only after user acceptance
Archive-don't-delete policy: preserve old chats for continuity
Continuity-preserving handoff documents: include repo path, current goal, completed work, files touched, commands run, known errors, open decisions, next steps
Reactivation prompt generation for resuming archived work
Enumerates state size, bloat candidates, and pseudonymous identifiers
Gates apply mode behind explicit user consent and waiting for agent shutdown
Pros & Cons
Pros
- Prevents performance degradation from accumulated state
- Requires explicit user consent before any mutation (safe)
- Preserves continuity via handoff documents and reactivation prompts
- Works across multiple popular AI coding agents
- Provides visibility into state size and bloat before changes
Cons
- Requires manual review of reports and acceptance steps (not fully automatic)
- Only applicable to agent-based coding environments, not general-purpose
- Handoff document creation requires user effort and context awareness
Best For
Maintaining local state for long-running AI coding agents across multiple repos and terminalsReducing session bloat, stale worktrees, and rotting logs without losing contextSafely archiving old chats while preserving continuity for future reactivationEnforcing hygiene routines for Claude Code, Codex CLI, Cursor, Aider, OpenCode, Gemini CLI
FAQ
What is the core thesis of Agent State Hygiene Architect?
Long-running local agents accumulate session bloat, stale worktrees, oversized logs, and metadata drift; without hygiene, performance degrades and continuity is lost.
What are the three pillars of safe agent maintenance?
Inspect-before-mutate discipline, archive-don't-delete policy, and handoff-document continuity.
Which AI coding agents does this prompt support?
Claude Code, Codex CLI, Cursor, Aider, OpenCode, Gemini CLI, or similar.
What happens on the first run?
The first run MUST be report-only. It enumerates state size, identifies bloat candidates, and prints counts/pseudonymous identifiers without writing files, creating backups, or moving folders.