diff --git a/bin/sync-skills b/bin/sync-skills index e7d6ec4..628d3cb 100755 --- a/bin/sync-skills +++ b/bin/sync-skills @@ -8,11 +8,17 @@ import sys 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): - 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): diff --git a/bin/validate-skills b/bin/validate-skills index 23f8e40..43963a8 100755 --- a/bin/validate-skills +++ b/bin/validate-skills @@ -51,7 +51,7 @@ def metadata(text): def local_links(path): 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(('```', '~~~')): fenced = not fenced continue diff --git a/protocols/workflow.md b/protocols/workflow.md index a12142f..a52163a 100644 --- a/protocols/workflow.md +++ b/protocols/workflow.md @@ -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 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. diff --git a/skills/cleanup-artifacts/SKILL.md b/skills/cleanup-artifacts/SKILL.md new file mode 100644 index 0000000..38da331 --- /dev/null +++ b/skills/cleanup-artifacts/SKILL.md @@ -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.