Directory Management
Core Rule
Keep less in the working directory. Never copy a file unless it explicitly makes sense to preserve an active artifact in two places. Prefer moving stale, historical, duplicate, temporary, or diagnostic files out of the target directory.
Prefer one canonical, continually updated file over a series of dated files for the same purpose. The canonical file can include a "Last updated: YYYY-MM-DD" line in its contents instead of putting dates in new filenames.
For agent-created scratch work, tmp/... is forbidden because it resolves relative to the current working directory. Use an absolute path such as /tmp/agent-<short-task>-<timestamp>/, including the leading slash, or resolve $TMPDIR to an absolute path first. Treat bundled skill examples that use relative tmp/... as path bugs and reinterpret them under absolute /tmp. The only exception is an existing project-owned tmp/ convention required by the application's runtime or build tooling, or an explicit user request.
Workflow
Inventory before mutating:
- List files with size and modified time.
- Identify families of related files by stem, date, backup marker, extension, and purpose.
- Treat
*.backup.*, *.pre-*, dated intermediate exports, screenshots, logs, scratch notes, generated analysis, and old CSV/XLSX variants as cleanup candidates.
Define the keep set:
- Keep the latest active source of truth.
- In RFQ/RFP workspaces, keep the controlling buyer package, source-material manifest, row/package receipts, amendments, notices, Q&A, pricing forms, incorporated terms, hashes, and supersession chain. These are durable operational evidence, not temporary manifests.
- Keep one canonical same-purpose document when dated report variants can be consolidated.
- Keep only companion exports that are still actively useful.
- Keep files the user named as current deliverables.
- Prefer one workbook plus one canonical CSV export over many backup variants.
Put temporary analysis in /tmp:
- Use
/tmp/agent-<short-task>-<timestamp>/ for manifests, staging notes, old versions, audit output, temporary scripts, rendered previews, and other scratch artifacts.
- Before creating a temporary path, verify it begins with
/tmp/ or is another fully resolved absolute system-temp path. Never run mkdir -p tmp/... for agent scratch work.
- Do not leave temporary scripts, logs, rendered previews, analysis dumps, or scratch manifests in the cleaned directory unless the user explicitly wants them there.
- Never move the current RFQ/RFP source-material manifest or its evidence receipts to
/tmp; archive superseded versions inside the opportunity's source-evidence history when the chain matters.
Move, do not copy:
- Move cleanup candidates to a
/tmp quarantine folder when preserving short-term recoverability is useful.
- Delete only when the user explicitly asks for deletion or the file is unquestionably disposable and recreated by tooling.
- Do not create a new backup in the target directory as part of cleanup.
Verify after cleanup:
- Re-list the target directory.
- Confirm the run did not create a relative
tmp/ directory or leave new scratch files in one.
- Confirm only current active files remain.
- Report what stayed, what moved to
/tmp, and any ambiguous files left untouched.
Decision Heuristics
- If a newer file clearly supersedes an older same-family file, move the older file out.
- If many dated documents serve the same operational purpose, keep or create one canonical filename and update its internal last-updated date; move dated variants out after their useful context is represented.
- If an artifact is only evidence of prior work and no longer drives decisions, move it out.
- Buyer source files and package-completeness evidence continue to drive compliance even after drafting starts; preserve them unless a byte-identical or explicitly superseded copy is proven and the provenance chain remains intact.
- If two files contain the same information in different formats, keep the format the user actually edits plus the export they actively consume.
- If a file looks like a current operational tracker, leave it unless a newer same-purpose tracker exists.
- If uncertain, leave the file in place and call out the ambiguity rather than making a risky deletion.
Final Response
Be concise. Include:
- final active files left in the directory,
- count and
/tmp location of moved files,
- any files intentionally left because they were ambiguous,
- one next cleanup suggestion only if it is directly useful.
1---2name: directory-management3description: Keep working directories clean with minimal files and no unnecessary copies. Use when the agent is asked to clean, organize, declutter, deduplicate, archive, prune, or consolidate folders; create or manage temporary scripts, previews, logs, manifests, generated analysis, backups, CSV/XLSX exports, screenshots, drafts, or stale historical versions; decide where temporary artifacts should live; or prevent a tool or skill from creating a relative project-local `tmp/` folder for scratch work.4---56# Directory Management78## Core Rule910Keep less in the working directory. Never copy a file unless it explicitly makes sense to preserve an active artifact in two places. Prefer moving stale, historical, duplicate, temporary, or diagnostic files out of the target directory.1112Prefer one canonical, continually updated file over a series of dated files for the same purpose. The canonical file can include a "Last updated: YYYY-MM-DD" line in its contents instead of putting dates in new filenames.1314For agent-created scratch work, `tmp/...` is forbidden because it resolves relative to the current working directory. Use an absolute path such as `/tmp/agent-<short-task>-<timestamp>/`, including the leading slash, or resolve `$TMPDIR` to an absolute path first. Treat bundled skill examples that use relative `tmp/...` as path bugs and reinterpret them under absolute `/tmp`. The only exception is an existing project-owned `tmp/` convention required by the application's runtime or build tooling, or an explicit user request.1516## Workflow17181. Inventory before mutating:19 - List files with size and modified time.20 - Identify families of related files by stem, date, backup marker, extension, and purpose.21 - Treat `*.backup.*`, `*.pre-*`, dated intermediate exports, screenshots, logs, scratch notes, generated analysis, and old CSV/XLSX variants as cleanup candidates.22232. Define the keep set:24 - Keep the latest active source of truth.25 - In RFQ/RFP workspaces, keep the controlling buyer package, source-material manifest, row/package receipts, amendments, notices, Q&A, pricing forms, incorporated terms, hashes, and supersession chain. These are durable operational evidence, not temporary manifests.26 - Keep one canonical same-purpose document when dated report variants can be consolidated.27 - Keep only companion exports that are still actively useful.28 - Keep files the user named as current deliverables.29 - Prefer one workbook plus one canonical CSV export over many backup variants.30313. Put temporary analysis in `/tmp`:32 - Use `/tmp/agent-<short-task>-<timestamp>/` for manifests, staging notes, old versions, audit output, temporary scripts, rendered previews, and other scratch artifacts.33 - Before creating a temporary path, verify it begins with `/tmp/` or is another fully resolved absolute system-temp path. Never run `mkdir -p tmp/...` for agent scratch work.34 - Do not leave temporary scripts, logs, rendered previews, analysis dumps, or scratch manifests in the cleaned directory unless the user explicitly wants them there.35 - Never move the current RFQ/RFP source-material manifest or its evidence receipts to `/tmp`; archive superseded versions inside the opportunity's source-evidence history when the chain matters.36374. Move, do not copy:38 - Move cleanup candidates to a `/tmp` quarantine folder when preserving short-term recoverability is useful.39 - Delete only when the user explicitly asks for deletion or the file is unquestionably disposable and recreated by tooling.40 - Do not create a new backup in the target directory as part of cleanup.41425. Verify after cleanup:43 - Re-list the target directory.44 - Confirm the run did not create a relative `tmp/` directory or leave new scratch files in one.45 - Confirm only current active files remain.46 - Report what stayed, what moved to `/tmp`, and any ambiguous files left untouched.4748## Decision Heuristics4950- If a newer file clearly supersedes an older same-family file, move the older file out.51- If many dated documents serve the same operational purpose, keep or create one canonical filename and update its internal last-updated date; move dated variants out after their useful context is represented.52- If an artifact is only evidence of prior work and no longer drives decisions, move it out.53- Buyer source files and package-completeness evidence continue to drive compliance even after drafting starts; preserve them unless a byte-identical or explicitly superseded copy is proven and the provenance chain remains intact.54- If two files contain the same information in different formats, keep the format the user actually edits plus the export they actively consume.55- If a file looks like a current operational tracker, leave it unless a newer same-purpose tracker exists.56- If uncertain, leave the file in place and call out the ambiguity rather than making a risky deletion.5758## Final Response5960Be concise. Include:61- final active files left in the directory,62- count and `/tmp` location of moved files,63- any files intentionally left because they were ambiguous,64- one next cleanup suggestion only if it is directly useful.