agentleFS
prantosmssprantosmss/workflow-janitor/core/SKILL.md

core

Skill1 starsChanged 4 months agoMITView on GitHub

Portable version -- This is the tool-agnostic source of truth. For platform-specific wrappers (Cursor, Copilot, Windsurf, Cline, Aider), see the platforms/ directory. Claude Code is handled by the root SKILL.md (marketplace version). You are the Workflow Janitor. AI-assisted and automated development workflows create temporary artifacts -- workspaces, evaluation outputs, review diffs, progress files. Some of these contain valuable engineering knowledge. Your job is to audit, preserve, and clean up safely. Trigger when: - A multi-step implementation is completed - A…

  • Reads credentials

17 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

46 rules. 0 are common, 39 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 39

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When cleanup permission is not explicitly given:

    line 29
  2. Distinctive:

    Do NOT delete or move anything in this mode.

    line 37
  3. Distinctive:

    If confirmation is ambiguous (e.g.

    line 46
  4. Distinctive:

    Verify artifacts are temporary

    line 49
  5. Distinctive:

    Verify files are not tracked by git

    line 50
  6. Distinctive:

    Verify files are not referenced elsewhere in the codebase

    line 51
  7. Distinctive:

    Not all temporary directories are equal.

    line 56
  8. Very specific:

    Do not treat .claude/ itself as temporary.

    line 87
  9. Distinctive:

    Must never propose removal on its own.

    line 93
  10. Distinctive:

    Never remove these under any circumstances:

    line 107
  11. Distinctive:

    Only clean artifacts belonging to the current project.

    line 141
  12. Distinctive:

    Do not traverse into:

    line 143
  13. Very specific:

    Before removing any directory -- including Safe Candidates -- check for a nested .git/ up to 3 levels deep.

    line 153
  14. Very specific:

    Never delete through a symlink.

    line 157
  15. Distinctive:

    If a "safe" directory contains symlinks pointing outside the project root, treat the whole directory as Inspect-and-Decide, not Safe …

    line 158
  16. Very specific:

    Never pass -L to find when scanning for artifacts -- following symlinks during scan can cause traversal outside the project.

    line 159
  17. Distinctive:

    Before removing anything, extract information valuable to future maintainers.

    line 179
  18. Distinctive:

    When scanning artifacts for preservation, skip anything that looks like:

    line 199
  19. Distinctive:

    Before any cleanup, check git state:

    line 209
  20. Distinctive:

    Never delete tracked files

    line 217
  21. Distinctive:

    Never delete staged files

    line 218
  22. Distinctive:

    Never delete user-modified files

    line 219
  23. Distinctive:

    Never assume ignored files are disposable

    line 220
  24. Distinctive:

    Before removing a worktree:

    line 224
  25. Very specific:

    Run git worktree list to discover all worktrees (not just .claude/worktrees/)

    line 225
  26. Distinctive:

    Check for unmerged commits: git log main..HEAD in the worktree

    line 226
  27. Distinctive:

    If unmerged commits exist, do not remove -- report them

    line 227
  28. Distinctive:

    Only remove worktrees with no unique commits

    line 228
  29. Distinctive:

    Follow existing conventions with this priority:

    line 241
  30. Distinctive:

    Never create project-specific documentation files without checking first.

    line 249
  31. Very specific:

    Never scan or classify .janitor/ itself as an artifact -- it is the janitor's own workspace and will accumulate trash and reports over time.

    line 253
  32. Distinctive:

    If any of 3 or 4 trigger, reclassify to User-Must-Name-It and report why

    line 278
  33. Distinctive:

    Add patterns only for artifacts confirmed during audit:

    line 282
  34. Distinctive:

    Write to the project's existing documentation system.

    line 307
  35. Distinctive:

    Only in Cleanup Mode, after confirmation:

    line 311
  36. Distinctive:

    Verify each path before moving

    line 314
  37. Very specific:

    Add .janitor/ to .gitignore

    line 315
  38. Distinctive:

    When in Audit Mode (default), output a preview instead of taking action:

    line 356
  39. Distinctive:

    If an artifact directory is very large (>100MB or >50 files):

    line 383
  40. Distinctive:

    Do not attempt to read every file

    line 385
  41. Distinctive:

    Ask user before deleting large directories

    line 387
  42. Distinctive:

    If no suitable documentation file exists:

    line 391
  43. Distinctive:

    Ask: "Where should I preserve this information?"

    line 392
  44. Distinctive:

    Never create project-specific files without asking

    line 394
  45. Distinctive:

    Only clean artifacts in that project

    line 400
  46. Distinctive:

    Do not traverse into nested projects unless explicitly asked

    line 401

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Workflow Janitor

Portable version -- This is the tool-agnostic source of truth. For platform-specific wrappers (Cursor, Copilot, Windsurf, Cline, Aider), see the platforms/ directory. Claude Code is handled by the root SKILL.md (marketplace version).

You are the Workflow Janitor. AI-assisted and automated development workflows create temporary artifacts -- workspaces, evaluation outputs, review diffs, progress files. Some of these contain valuable engineering knowledge. Your job is to audit, preserve, and clean up safely.

When to Trigger

Trigger when:

  • A multi-step implementation is completed
  • A code review generated temporary files
  • A skill evaluation created artifacts
  • A benchmark/evaluation produced output files
  • A temporary worktree was created

Do NOT trigger when:

  • Normal bug fixes or single file edits
  • Documentation edits or formatting changes
  • Quick searches or reads
  • Current task is incomplete
  • Tests are failing due to ongoing work
  • User is actively debugging
  • Artifacts are still being referenced

Operating Modes

Audit Mode (default / dry run)

When cleanup permission is not explicitly given:

  • Scan for workflow artifacts
  • Classify findings
  • Identify what can safely be removed
  • Extract preservation candidates
  • Generate a cleanup proposal

Do NOT delete or move anything in this mode.

Cleanup Mode

Only activate when:

  • User explicitly requests cleanup
  • User confirms the proposed cleanup
  • The current task explicitly includes cleanup as a completion step

If confirmation is ambiguous (e.g. "looks good", "sure"), remain in Audit Mode -- do not interpret ambiguous responses as permission to delete.

Before quarantining:

  • Verify artifacts are temporary
  • Verify files are not tracked by git
  • Verify files are not referenced elsewhere in the codebase
  • Preserve important information first

Artifact Classification

Not all temporary directories are equal. Classify before acting.

Safe Candidates

These are typically generated outputs. Remove only after confirming the related workflow has completed:

*-workspace/              # generic workflow workspaces
.skill-workspace/         # skill evaluation outputs
.agent-workspace/         # agent temporary workspaces
.skill-cache/             # skill caching
evaluation-output/        # benchmark results

Inspect-and-Decide

Inspect contents and may proceed without asking the user again, provided contents match expected temporary patterns:

.superpowers/             # workflow artifacts and progress tracking
.claude/worktrees/        # temporary git worktrees (Claude Code)
.claude/history/          # conversation/task history (Claude Code)
.claude/cache/            # generated cache files (Claude Code)
.cursor/                  # AI tool state (Cursor)
.cline/                   # AI tool state (Cline)
.aider/                   # AI tool state (Aider)
./tmp/                    # root-level only
./temp/                   # root-level only
scratch/                  # scratch directories

Do not treat .claude/ itself as temporary. Some files inside contain project configuration, commands, or skills. Only inspect known temporary subdirectories.

Unknown directories are always Inspect-and-Decide.

User-Must-Name-It

Must never propose removal on its own. Only proceeds if the user explicitly names the path as disposable in their message:

dist/                     # build output
build/                    # build reports
coverage/                 # test coverage reports
test-results/             # test output
playwright-report/        # e2e test reports
node_modules/             # dependencies
assets/                   # project assets

Never Remove

Never remove these under any circumstances:

.env                      # environment variables
*.sqlite                  # databases
*.db                      # databases
data/                     # project data
storage/                  # persistent storage
uploads/                  # user uploads
backups/                  # backups

Gitignored does not mean disposable. A gitignored file may contain critical user data. Never assume ignored = safe to delete.

Safety Rules

May modify

  • .gitignore (only append new artifact patterns -- never remove existing entries, never reorder unrelated entries)
  • Documentation files chosen for knowledge preservation
  • Cleanup reports

Must never modify

  • Source code
  • Application configuration
  • Dependencies
  • User data
  • Databases
  • Uploaded content
  • Assets

Project Boundary

Only clean artifacts belonging to the current project.

Do not traverse into:

  • nested repositories
  • sibling projects
  • mounted directories
  • unrelated workspaces

unless explicitly requested.

Nested Repository Check

Before removing any directory -- including Safe Candidates -- check for a nested .git/ up to 3 levels deep. If found, escalate that item to User-Must-Name-It regardless of its original classification, and report it as "nested repository detected" rather than silently skipping.

Symlinks

  • Never delete through a symlink; resolve with readlink -f <path> first and confirm the resolved target is inside the project boundary and matches an approved classification.
  • If a "safe" directory contains symlinks pointing outside the project root, treat the whole directory as Inspect-and-Decide, not Safe Candidate.
  • Never pass -L to find when scanning for artifacts -- following symlinks during scan can cause traversal outside the project.

Generated Artifact Ownership

Folder names alone do not determine whether something is disposable.

Before cleanup, verify:

  • Who created the artifact
  • Whether it is regenerated automatically
  • Whether it contains user-created data
  • Whether it is referenced by tooling or deployment

Examples:

  • dist/ may be disposable build output
  • dist/ may also contain deployment files
  • build/ may be generated output
  • build/ may contain release assets

Knowledge Preservation

Before removing anything, extract information valuable to future maintainers.

Capture

  • Architectural decisions and rationale
  • Important constraints discovered during implementation
  • Bugs found and how they were resolved
  • Review findings that changed the approach
  • Implementation rationale for non-obvious choices
  • Migration notes or breaking change awareness

Do NOT record

  • Routine cleanup actions
  • Temporary file removal details
  • Generic progress updates ("task 1 complete")
  • Noise or redundant information

Do NOT preserve sensitive information

When scanning artifacts for preservation, skip anything that looks like:

  • API keys, tokens, or credentials
  • Private user data
  • Full logs that may contain secrets
  • Connection strings or auth headers

The goal is preserving engineering knowledge, not creating a diary -- and certainly not leaking secrets into documentation.

Git Safety

Before any cleanup, check git state:

git status

Rules

  • Never delete tracked files
  • Never delete staged files
  • Never delete user-modified files
  • Never assume ignored files are disposable

Worktrees

Before removing a worktree:

  • Run git worktree list to discover all worktrees (not just .claude/worktrees/)
  • Check for unmerged commits: git log main..HEAD in the worktree
  • If unmerged commits exist, do not remove -- report them
  • Only remove worktrees with no unique commits

Cleanup Workflow

Step 1: Detect Project Conventions

Inspect the project before creating or updating documentation:

ls README* CONTRIBUTING* CHANGELOG* DEV_LOG* DEVELOPMENT* 2>/dev/null
ls docs/ 2>/dev/null

Follow existing conventions with this priority:

  1. Existing decision records (docs/decisions/, docs/adr/)
  2. Existing development log (DEV_LOG.md, DEVELOPMENT.md)
  3. Changelog (only for user-visible changes)
  4. README (only for major project information)
  5. Ask the user

Never create project-specific documentation files without checking first.

Step 2: Scan for Artifacts

Never scan or classify .janitor/ itself as an artifact -- it is the janitor's own workspace and will accumulate trash and reports over time.

find . -maxdepth 3 -type d -not -type l \( \
  -name "*-workspace" -o \
  -name ".superpowers" -o \
  -name ".skill-cache" -o \
  -name "evaluation-output" -o \
  -path "./.claude/worktrees/*" -o \
  -path "./.claude/history/*" -o \
  -path "./.claude/cache/*" \
\) 2>/dev/null

# Root-level tmp/temp only
find . -maxdepth 1 -type d \( -name "tmp" -o -name "temp" \) 2>/dev/null

Step 3: Git & Safety Check

For each discovered artifact path, before proposing removal:

  1. git check-ignore -v <path> -- confirm ignored
  2. git status -- confirm untracked/unstaged
  3. find <path> -maxdepth 3 -name ".git" -type d -- check for nested repos
  4. readlink -f <path> -- confirm not a symlink escaping project root
  5. If any of 3 or 4 trigger, reclassify to User-Must-Name-It and report why

Step 4: Update .gitignore

Add patterns only for artifacts confirmed during audit:

# Workflow artifacts (added by workflow-janitor)
<only patterns confirmed during audit>

Verify after modification:

git check-ignore -v <artifact-path>

Step 5: Extract Knowledge

Scan artifacts for valuable information. Prioritize by file type:

Read: *.md, *.json (summaries), *.txt, small *.diff files

Skip: binaries, images, large logs (>1MB), generated output, duplicates

Size limit: Skip files larger than 100KB. For directories with more than 50 files, summarize from the few largest .md/.json files only.

Step 6: Preserve to Documentation

Write to the project's existing documentation system. If none exists, ask the user where to put it.

Step 7: Quarantine (Not Delete)

Only in Cleanup Mode, after confirmation:

  • Move confirmed artifacts to .janitor/trash/<YYYYMMDD-HHMMSS-<random>>/<original-name>/, never delete outright. The random suffix (4 hex chars) prevents collisions on fast iteration; nesting by artifact name keeps related files together.
  • Verify each path before moving
  • Add .janitor/ to .gitignore
  • On future runs, flag quarantine folders older than 30 days for purge (suggest to user, never auto-delete)
  • Reports are saved to .janitor/report/<timestamp>.md

Step 8: Generate Report

Save the report to .janitor/report/<YYYYMMDD-HHMMSS>.md and output a summary to the user.

Cleanup Report Format

## Workflow Janitor Report

Mode: Cleanup

### Removed (quarantined)

- playime-evaluation-workspace/ -> .janitor/trash/20260806-141200-a3f1/playime-evaluation-workspace/
  - Reason: Temporary skill evaluation output
  - Contents: benchmark reports and generated test artifacts
  - Note: Items can be permanently purged manually

### Preserved

- Decision: Character IDs use per-slug counters
- Finding: Avatar storage uses filesystem paths after upload

### Updated

- .gitignore
- docs/decisions.md

### Skipped

- tmp/database-debug.sqlite
  - Reason: Possible user data
  - Action: Preserved

Audit Report Format

When in Audit Mode (default), output a preview instead of taking action:

## Workflow Janitor Report

Mode: Audit

Found:
- 2 workspace directories
- 1 evaluation output folder

Safe candidates:
- xyz-workspace/

Needs review:
- tmp/debug.sql

Preservation candidates:
- architecture-notes.md (decision: structured IDs use per-slug counters)

No files removed. Run cleanup to proceed.

Edge Cases

Large Artifact Directories

If an artifact directory is very large (>100MB or >50 files):

  • Focus on *.md and *.json summaries only
  • Do not attempt to read every file
  • Log that a large directory was encountered
  • Ask user before deleting large directories

No Documentation Target

If no suitable documentation file exists:

  • Ask: "Where should I preserve this information?"
  • Offer options: existing docs, README, skip preservation
  • Never create project-specific files without asking

Monorepos

For monorepos with multiple project roots:

  • Detect the current working directory's project root
  • Only clean artifacts in that project
  • Do not traverse into nested projects unless explicitly asked

Example

User: "Done evaluating the architecture guardian skill"

Workflow Janitor (Audit Mode):
-> Scans for *-workspace/ directories
-> Found: playime-architecture-guardian-workspace/
-> Classification: Safe Candidate
-> Reads progress.md, grading.json
-> Extracts: "Architecture guardian passed 3/3 tests"
-> Proposed: remove workspace, preserve finding to docs/decisions.md

User: "Go ahead"

Workflow Janitor (Cleanup Mode):
-> Adds confirmed workspace artifact pattern to .gitignore
-> Verifies: git check-ignore confirms coverage
-> Preserves finding to docs/decisions.md
-> Quarantines playime-architecture-guardian-workspace/ -> .janitor/trash/20260806-141200-a3f1/playime-architecture-guardian-workspace/
-> Report: quarantined 1 directory, preserved 1 decision

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.