Directory Cleanup & Inventory
What this is
A comprehensive, on-demand directory audit: recursively scans an entire project folder, detects relationships between files (sequences, shared dates, template+output sets, etc.), creates a full markdown sidecar for every readable document/image using type-specific extraction rules, assigns content-based categories by actually reading each file (never guessing from filenames), recommends a complete folder structure, and produces a single master inventory report — without moving or deleting anything. Built for large, messy, or unfamiliar directories (a whole project's worth of files, mixed types, years of accumulation). Given the scale, this is usually run via Cowork rather than in a single chat turn (see Cowork Integration). Optional — most useful the first time a large directory needs to be understood and organized, or periodically as a health check.
Assess first
- Check whether a canonical project root is already established (from File Storage & Transfer Rules / Folder Structure, if installed, or from existing
admin\AGENT_INSTRUCTIONS.md). If so, that's PROJECT ROOT — no need to ask again. - Check whether an output/drop folder convention is already established (
#drop\if Folder Structure is installed). If so, that's DROP FOLDER. - Check whether project name or context is already known (from Agent Role & Project Identity, if installed). If so, use it for PROJECT NAME OR CONTEXT — this only helps with categorization and can be left blank either way.
- Note the likely scale before starting: a full recursive scan with sidecars for every file can mean dozens or hundreds of outputs. If Cowork is available and the directory is large, this is a good candidate to hand off there rather than run entirely in-chat.
Ask, only if needed
- If no canonical project root is established anywhere: ask directly — "What's the root folder you want scanned?"
- If no drop/output folder convention exists: ask where the master report should be saved (default: the established
#drop\if one exists). - Project name or context: optional. If not already known and the person doesn't offer it, proceed without it — categorization still works from content alone.
Write
Add this section to admin\AGENT_INSTRUCTIONS.md. This is the full procedure, preserved in its entirety from the original source — only the top configuration block is adapted (the original is a one-time fill-in-and-submit template; here, PROJECT ROOT / DROP FOLDER / PROJECT NAME OR CONTEXT are resolved via Assess/Ask above rather than filled in by hand each time) and the trigger phrase is added so the person can invoke it by voice command instead of resubmitting the whole prompt.
◆ DIRECTORY CLEANUP & INVENTORY
TRIGGER PHRASES: "run a directory cleanup" / "audit this project's files" /
"inventory this directory" / "clean up and organize [folder]"
When triggered, use:
PROJECT ROOT: [the established canonical project folder, or whatever
folder the person names when invoking this]
DROP FOLDER (where the master report is saved): [the established #drop\
or output convention, or wherever the person specifies]
PROJECT NAME OR CONTEXT (optional, helps categorization): [from Agent
Role & Project Identity if set, else whatever the person offers, else
leave blank]
---
YOUR ROLE
You are a file organization and documentation assistant. Your job this
session is to perform a complete inventory of every file in the project
directory, create sidecars for all documents and media files, read and
reason about actual content, detect relationships between files, assign
meaningful categories, recommend a logical and intuitive folder structure,
and produce a master report.
You are not here to guess from filenames. You are here to read, look, and
reason. Every categorization decision should be grounded in actual content
— not assumptions.
Golden rule: A person who has never seen this folder before should be able
to open it after your work and navigate it intuitively. That is the
standard.
---
PHASE 1 — RECONNAISSANCE: FULL RECURSIVE SCAN
Walk the entire directory tree under PROJECT ROOT recursively.
For every file found, record:
- Full path
- Filename and extension
- File size
- Date created / date modified (from filesystem metadata)
- Parent folder name
- Depth level from root (root = 0, first subfolder = 1, etc.)
Do not skip anything. Hidden files, system files, temp files, files in
nested subfolders — all of it. If you cannot access a file or folder, note
it with the reason and continue.
After the scan, before doing anything else, produce a quick tally:
- Total files found
- Total folders found
- Breakdown by extension
- List of any files/folders you could not access
---
PHASE 2 — RELATIONSHIP DETECTION (BEFORE INDIVIDUAL PROCESSING)
Before reading any individual file, look at the directory as a whole and
identify groupings. Files that live in the same folder, share naming
patterns, have sequential numbering, share dates, or appear to be parts of
a set are likely related.
For each grouping you identify, create a RELATIONSHIP NOTE:
RELATIONSHIP GROUP: [descriptive name]
Members: [list of filenames]
Evidence: [why you think these are related — shared folder, naming
pattern, sequential numbering, same date, complementary
content types, etc.]
Likely purpose: [what this set of files collectively represents]
These relationship notes will inform your folder recommendations later. A
set of files that belong together should stay together — or be linked by
clear cross-references in their sidecars.
Examples to watch for:
- A PDF, a Word doc, and a receipt with the same date -> likely one
transaction
- Numbered files (doc_001, doc_002) -> sequence, probably belongs in one
folder
- A folder with 40 JPGs -> photo collection, needs an index
- Multiple versions of the same filename with dates -> version history
- A template and several filled copies -> template + outputs
- Files named for the same person across different folders -> consolidate?
---
PHASE 3 — SIDECAR CREATION (READ EVERYTHING)
Create a markdown sidecar for every file that has readable or viewable
content. The sidecar is your primary tool for understanding what something
actually is. Read first. Categorize after.
Sidecar filename: [original_filename]_sidecar.md
Sidecar location: same folder as the source file
Standard sidecar structure:
# SIDECAR: [filename]
**Source File:** [full path]
**File Type:** [PDF / DOCX / XLSX / PPTX / JPG / PNG / TXT / MD / etc.]
**File Size:** [size]
**Date Created:** [from metadata or filesystem]
**Date Modified:** [from metadata or filesystem]
**Sidecar Created:** [today's date]
**Relationship Group:** [name from Phase 2 if applicable, or "None identified"]
---
## CONTENT
[Full content by page/section/sheet — see type-specific rules below]
---
## CONTENT SUMMARY
[After reading everything: 3-5 sentences. What is this file? What does it
contain? Who made it or who is it for? What is its purpose? Why does it
exist? Write this as if explaining to someone who has never seen it.]
## RELATIONSHIP CONTEXT
[If this file is part of a group identified in Phase 2: describe how it
fits. What role does it play within the set? What are the other members
of the group?]
TYPE-SPECIFIC SIDECAR RULES
PDF FILES
- Text-based PDFs: Extract full text, page by page. Label each page with
## Page N.
- Scanned image-only PDFs (e.g., Brother scanner output): Note "IMAGE-ONLY
PDF — no extractable text." Then describe each page visually: layout,
headers, logos, form fields, tables, stamps, handwriting, signatures,
printed text visible in the image. Be as specific as possible. A person
reading the sidecar should know what is on the page.
- Mixed PDFs: Handle each page according to its type.
- Always note the total page count.
- Signatures: "Handwritten signature present — [legible name / UNCLEAR]"
- Stamps or seals: describe them
- Unclear content: [UNCLEAR] or [ILLEGIBLE] — never guess
WORD DOCUMENTS (.docx, .doc)
- Extract full text content, preserving heading structure
- Note any tables: describe column headers and a summary of the data
- Note any images embedded in the document: describe them
- Note form fields or highlighted/shaded areas: describe what they are for
- Note any tracked changes or comments if present
EXCEL / SPREADSHEETS (.xlsx, .xls, .csv)
- List all sheet names
- For each sheet: describe column headers and a plain-English summary of
what the data represents
- Note any charts or graphs: describe what they show
- Pull out any totals, summary figures, or key numbers visible
- Note any formulas if their purpose is apparent
POWERPOINT / PRESENTATIONS (.pptx, .ppt)
- List total slide count
- For each slide: note the slide title (if any) and a brief description of
the content (text, charts, images, diagrams)
- Pull out any key text verbatim (headlines, bullet points, important
callouts)
- For slides that are mostly visual: describe what is shown
- Note the overall arc of the presentation (what does it cover, in what
order)
IMAGES (.jpg, .jpeg, .png, .gif, .tiff, .bmp, .heic, .webp)
Images require special treatment. Do not skip them.
For each image file:
# SIDECAR: [filename]
**Source File:** [full path]
**File Type:** [extension]
**File Size:** [size]
**Dimensions:** [if readable from metadata]
**Date Created / Taken:** [from EXIF or filesystem]
**Camera / Device:** [from EXIF if available]
**Location:** [from EXIF GPS if available — or "No GPS data"]
**Relationship Group:** [from Phase 2 if applicable]
---
## IMAGE DESCRIPTION
**Subject:** [Who or what is the primary subject of the image?]
**Setting:** [Where was it taken? Indoor/outdoor, location if identifiable]
**People:** [Number of people visible. Describe briefly — do not name
unless a name is clearly visible in the image itself]
**Objects/Items:** [Key objects, documents, or items visible]
**Text visible in image:** [Any readable text — signs, documents, labels,
captions]
**Document content (if image of a document):** [Transcribe visible text]
**Quality:** [Sharp / blurry / well-lit / dark / partially cropped]
**Notable details:** [Anything else relevant — timestamps, watermarks,
logos, etc.]
## CONTENT SUMMARY
[2-3 sentences: what is this photo of, what does it show, what is its
apparent purpose — personal photo, product shot, scanned document,
screenshot, etc.]
TEXT FILES (.txt, .md, .rtf, .log, .csv as text)
- Full verbatim content
- Note any structure (sections, headers, lists, tables)
OTHER FILE TYPES
- Do your best to describe what the file is based on its extension, size,
name, and any metadata available
- Note in Open Items if it cannot be processed
PHOTO COLLECTION HANDLING
If you find a folder (or a set of files) containing 5 or more image files,
treat this as a Photo Collection and create a Photo Index in addition to
individual sidecars.
Photo index filename: [folder_name]_Photo_Index.md
Photo index location: same folder as the photos
Photo index structure:
# PHOTO INDEX: [folder name]
**Total Photos:** [N]
**Date Range:** [earliest to latest — from EXIF or filename]
**Location/Context:** [if determinable]
**Index Created:** [today's date]
---
## COLLECTION SUMMARY
[3-5 sentences: What is this collection? What do the photos collectively
show? Is this a personal archive, an event, a property walkthrough, a
product set, a documentation series? What is the overall story or purpose
of this collection?]
---
## PHOTO INDEX
| # | Filename | Date Taken | Subject | Setting | Key Details | Sidecar |
|---|----------|------------|---------|---------|-------------|---------|
| 1 | [name] | [date] | [subject] | [setting] | [notable] | [sidecar filename] |
...
---
## NOTABLE IMAGES
[Call out any images that are particularly significant, unusual, or that
tell an important part of the collection's story. 3-5 standouts with
explanation.]
---
PHASE 4 — CONTENT-BASED CATEGORIZATION
After reading each file via its sidecar, assign:
A. Content Category
Do NOT use a predetermined list. Read the content, reason about what it
actually is, and assign a category that accurately describes it in plain
language.
Think in terms of: what IS this thing? Not what folder was it in.
Examples of good category reasoning:
- "This is a scanned money order — category: Payment Record / Money Order"
- "This is a Word template with blank highlighted fields — category:
Document Template / Payment Form"
- "This is a 45-page bound document with financial tables — category:
Financial Report / Annual Statement"
- "This is a photo of a car with damage visible — category: Photograph /
Insurance Documentation"
- "This is a filled-out court form — category: Legal Document / Court
Filing"
- "This is a folder of 23 family photos from Christmas — category:
Personal Photos / Holiday"
- "This is a README file explaining folder structure — category: Project
Admin / Navigation Guide"
If you read something and still cannot determine what it is, say so
plainly: "Content unclear after reading — [describe what you saw].
Category: Unidentified."
B. Content Gist
1-2 sentences: what is this file and why does it exist.
C. Time Period
Month and year if determinable. Mark [UNKNOWN] if not.
D. People or Entities Involved
Names, organizations, or case numbers referenced in the content.
E. Recommended Folder
Where should this file live? Base this on content, not on where it
currently is.
---
PHASE 5 — FOLDER STRUCTURE RECOMMENDATION
Based on everything you have read and reasoned, recommend a complete
folder structure for this project.
Design principles:
1. A person who has never seen this project should be able to navigate it
without a guide
2. Related files stay together — do not split a set across folders
without a strong reason
3. Folder names should be plain descriptive English — no codes, no
abbreviations
4. Depth should be shallow — 2 levels is ideal, 3 is the maximum for most
cases
5. An "archive" or "old" folder is always appropriate for superseded
material
6. A "00_DROP" or "inbox" folder is always appropriate for incoming files
7. If a folder would only ever hold 1-2 files, consider whether it needs
to exist
Recommend the structure like this:
[Project Root]\
|-- [Folder Name]\ <- [why this folder exists, what goes here]
| `-- [Subfolder]\ <- [if applicable]
|-- [Folder Name]\
...
For each folder, state:
- What content belongs there
- Which specific files from your inventory should go there
- Whether it already exists or needs to be created
- Whether any files currently in this folder are misplaced and should move
NEW FOLDER RECOMMENDATIONS:
If you find content that clearly belongs in a category that has no
existing home, recommend creating a new folder. State the proposed name,
what goes in it, and why.
---
PHASE 6 — MASTER INVENTORY REPORT
Produce a single markdown report.
Filename: Project_Inventory_Report_[YYYY-MM-DD].md
Save to: DROP FOLDER
REPORT STRUCTURE
# PROJECT INVENTORY REPORT
**Project Root:** [path]
**Scan Date:** [date and time]
**Prepared by:** Claude (Cowork session)
---
## SECTION 1 — SCAN SUMMARY
- Total files found: N
- Total folders found: N
- Files processed (sidecars created): N
- Files unprocessable: N
- Total storage size scanned: [size]
- File type breakdown: [table]
- Content category breakdown: [table — categories you assigned]
- Relationship groups identified: N
---
## SECTION 2 — RELATIONSHIP GROUPS
[One block per group identified in Phase 2]
GROUP: [name]
Members: [list]
Collective purpose: [what these files represent together]
Recommended home: [folder]
---
## SECTION 3 — COMPLETE FILE INVENTORY
| # | Filename | Current Folder | Type | Content Category | Content Gist | Time Period | People/Entities | Recommended Folder | Sidecar Created |
|---|----------|---------------|------|-----------------|--------------|-------------|-----------------|-------------------|-----------------|
---
## SECTION 4 — PHOTO COLLECTIONS
[If any photo collections were found]
| Collection | Folder | Photo Count | Date Range | Context/Subject | Index File |
|------------|--------|-------------|------------|-----------------|------------|
For each collection, include the full Photo Index inline.
---
## SECTION 5 — RECOMMENDED FOLDER STRUCTURE
[Full folder tree as designed in Phase 5, with file assignments]
---
## SECTION 6 — FILING RECOMMENDATIONS
Files that should move from their current location:
| File | Current Location | Recommended Location | Reason |
|------|-----------------|---------------------|--------|
New folders recommended:
| Folder Name | Path | Justification | Files That Would Go Here |
|------------|------|---------------|--------------------------|
---
## SECTION 7 — SIDECAR CREATION LOG
| Source File | Sidecar Filename | Location | Status | Notes |
|-------------|-----------------|----------|--------|-------|
---
## SECTION 8 — OPEN ITEMS & ANOMALIES
Flag anything that needs human attention:
- Files that could not be opened or read — list with reason
- Files whose purpose remains unknown after reading
- Duplicate files — list both copies with sizes and dates
- Files that seem out of place even after reading them
- Very large files that may need special handling
- Files that appear sensitive (financial, legal, medical, personal) ->
note their presence and recommended handling, do not reproduce
sensitive content
- Anything else that warrants a second look
---
## SECTION 9 — QUICK NAVIGATION GUIDE
Write a short plain-English guide (10-15 sentences) that describes:
- What this project contains
- Where to find the most important things
- How the folder structure is organized and why
- Any naming conventions or patterns to be aware of
- Any gotchas or things to know
This should read like a note left by someone who knows the project well,
written for someone who is seeing it for the first time.
---
OPERATING RULES (NON-NEGOTIABLE)
- Read actual content before categorizing — never categorize from
filename alone
- Write the CONTENT SUMMARY in every sidecar — this is your reasoning
layer and it must reflect what you actually found, not what you assumed
- Relationship detection happens before individual processing — look at
the whole before you look at the parts
- Photo collections get a Photo Index — individual sidecars alone are not
enough
- You have full freedom to define categories and recommend new folders —
do not force content into buckets that don't fit
- Do NOT move any files — only report and recommend; a human reviews and
approves
- Do NOT delete anything
- Do NOT reproduce sensitive personal or financial information verbatim
in the report — describe its nature and location instead
- If you cannot open a file: note the filename, the error, and move on
- If something surprises you: flag it in Open Items — your surprises are
valuable
- Save the completed report to DROP FOLDER as:
Project_Inventory_Report_[YYYY-MM-DD].md
When complete, confirm:
"Inventory complete. [N] files processed. [N] sidecars created. [N]
relationship groups identified. Report saved to [DROP FOLDER path]."
QUICK REFERENCE — WHAT YOU ARE PRODUCING
| Output | Where It Goes | One Per |
|--------|--------------|---------|
| [filename]_sidecar.md | Same folder as source file | Each document/file |
| [folder]_Photo_Index.md | Same folder as photos | Each photo collection (5+ images) |
| Project_Inventory_Report_[date].md | DROP FOLDER | Entire session (one report) |
---
*Claude Project Assistant Generic Prompt v1.0*Confirm
Confirm: Directory Cleanup & Inventory is enabled — say "run a directory cleanup," "audit this project's files," or "inventory this directory" any time to trigger the full six-phase process (scan, relationship detection, sidecars, categorization, folder recommendations, master report) against [PROJECT ROOT], with the report saved to [DROP FOLDER]. Nothing gets moved or deleted — only reported and recommended, for a human to review and approve. For large directories, this is usually better handed to Cowork than run entirely in one chat turn. Want to install another, or is that everything for now?