feat(skills): add cleanup-artifacts skill and session hygiene protocol

This commit is contained in:
Ajasra committed 2026-10-31 15:10:49 +08:00
1 parent 418792d1ec
commit 14cc1ab6f0
4 files changed
+59 -3

No files matched your search

+8 -2
View File
@@ -8,11 +8,17 @@ import sys
def lexical(path): def lexical(path):
return Path(os.path.abspath(path)) s = str(os.path.abspath(path))
if s.startswith('\\\\?\\'):
s = s[4:]
return Path(s)
def link_target(path): def link_target(path):
return lexical(path.parent / os.readlink(path)) target = os.readlink(path)
if os.path.isabs(target):
return lexical(target)
return lexical(path.parent / target)
def inside(path, root): def inside(path, root):
+1 -1
View File
@@ -51,7 +51,7 @@ def metadata(text):
def local_links(path): def local_links(path):
fenced = False fenced = False
for number, line in enumerate(path.read_text().splitlines(), 1): for number, line in enumerate(path.read_text(encoding='utf-8').splitlines(), 1):
if line.lstrip().startswith(('```', '~~~')): if line.lstrip().startswith(('```', '~~~')):
fenced = not fenced fenced = not fenced
continue continue
+7
View File
@@ -43,3 +43,10 @@ Choose checks that can detect a real failure in the changed behavior.
Complete means the requested behavior is implemented and supported by empirical Complete means the requested behavior is implemented and supported by empirical
evidence. A successful command exit alone does not prove the user-facing outcome. evidence. A successful command exit alone does not prove the user-facing outcome.
## Session Hygiene
After task verification and handoff are complete, offer or execute (upon user
confirmation) session cleanup via `cleanup-artifacts`. Purge scratch scripts,
stale test caches, and harness session bloat across Antigravity, Claude Code,
Codex, and OpenCode while strictly preserving rules, custom skills, and MCP tools.
+43
View File
@@ -0,0 +1,43 @@
---
name: cleanup-artifacts
description: >
Clean up temporary session files, tool caches, browser recordings, and conversation bloat across agent harnesses after user confirmation.
scope: global
---
# Cleanup Artifacts & Session Hygiene
Use this skill after task implementation and verification are complete, when the user requests or confirms cleaning up session bloat across agent harnesses (Antigravity, Claude Code, Codex, OpenCode/Aider).
## Principles
1. **User Confirmation Required**: Never purge conversation histories, scratch files, or caches without explicit user intent.
2. **Preserve Rules, Agents, MCPs & Projects**: Never remove configuration files, rules, custom agents, MCP tool schemas, database migrations, or project repositories.
3. **Preserve Active Session**: If operating inside an active agent conversation, preserve the active session ID's brain and transcript.
## Targets by Harness
### 1. Antigravity
- **Past Conversations**: Purge inactive conversation databases in `%USERPROFILE%\.gemini\antigravity\conversations\`.
- **Inactive Brains**: Purge non-active UUID folders in `%USERPROFILE%\.gemini\antigravity\brain\`.
- **Temporary Tool & Browser Traces**: Purge `%USERPROFILE%\.gemini\antigravity\browser_recordings\*`, `cache\*`, `artifacts\*`, `implicit\*`, and `sidecar_data\*`.
- **Installers & Staged Updates**: Purge `%LOCALAPPDATA%\Temp\antigravity-stable-user-x64` and `%LOCALAPPDATA%\antigravity-updater\*`.
- **Web & GPU Caches (Deep Clean)**: Optionally flush `Cache`, `Code Cache`, `GPUCache`, and `CachedData` inside `%APPDATA%\Antigravity` and `%APPDATA%\Antigravity IDE`.
### 2. Claude Code
- **Caches & Transcripts**: Clear inactive sessions in `~/.claude/artifacts/`, ephemeral scratchpads, and debug log files.
- **Preserve**: Keep `~/.claude/settings.json`, configured skills, and authenticated profiles.
### 3. Codex & OpenCode / Aider
- **Scratch & Diffs**: Purge stale patch chunks (`.patch`, `.diff.tmp`), transient tool logs, and cached completions in `.codex/cache/` or `.opencode/`.
### 4. Workspace Level
- Purge intermediate scratch test scripts (`scratch/*.ps1`, `scratch/*.py`) created solely for one-off debugging.
- Purge standard build/test cache directories generated during task verification (e.g., `.pytest_cache`, `.coverage`, `__pycache__`, `node_modules/.cache`) when confirmed.
## Workflow
1. **Assess & Report**: Check current file counts and sizes in the relevant harness locations. Present the summary to the user.
2. **Confirm Scope**: Clarify whether to run standard cleanup (session data, past artifacts, temp files) or deep cleanup (including IDE/browser GPU caches).
3. **Execute**: Remove the target paths cleanly using non-interactive commands.
4. **Report Outcome**: Output a before-and-after reclaimed disk space summary.