On my always-on computer there’s a folder called Share, and it’s how files move between me and AI. It has two main folders:
- Inbox: anything I want kept goes here: a document, a picture, a note.
- Outbox: any file AI makes for me lands here.
Three small jobs look after it.
Filing: three times a day
At 12:00, 17:00 and 21:00, a script checks the Inbox. If nothing is new, it stops right there without starting the AI, so an empty Inbox costs nothing. If something is new, it starts Claude, which files each item in the right place in my notes by my rules, moves it to _done, and sends me a short summary on Telegram.
Pings: when files arrive
A second script watches the folders and pings me on Telegram. When AI puts something in the Outbox, the message has the file’s name and a link, and if lots of files land in one folder, they’re folded into one line. When something reaches my Inbox, I get its name. Files that were already there, or are still being written, don’t trigger a ping.
The tidy: every week
Early every Saturday, a third script cleans up:
- Anything in the Outbox for 30 days moves to
_old. - Anything in
_oldor_doneis deleted 30 days after it got there. That clock starts when the file arrives, so an old file never gets moved and deleted in the same run. - Files over 1 GB are never deleted; it lists them for me instead.
- Files waiting in the Inbox to be filed are never deleted. If one has sat there for 14 days, it shows up in my morning brief and I decide.
If the disk passes 80% full, that shows up in the brief too.
How to set one up
First, install and sign in to Claude Code, and write your filing rules (what goes where in your notes) in ~/notes/AGENTS.md.
The folders
mkdir -p ~/Share/Inbox/_done ~/Share/Outbox/_oldFiling
The script checks first and only starts Claude when there’s something new. The run itself is one command, from inside your notes folder:
cd ~/notes || exit 1
claude -p "File every new item in ~/Share/Inbox according to the rules in AGENTS.md, then move it to ~/Share/Inbox/_done, and write a short summary of what you did." \
--add-dir ~/Share/Inbox \
--allowedTools "Read" "Write" "Edit" "Glob" "Grep" "Bash(mv:*)" "Bash(mkdir:*)"--allowedTools approves those tools in advance, so the job never stops to ask while nobody is watching. It isn’t a fence: to truly limit what the job can touch, also restrict the available tools (--tools) and the folders in your permission settings. Image-only scans need OCR first (for example OCRmyPDF); pdftotext works once a PDF has a text layer.
Let Claude write the full script:
Write me a script called inbox-filing.sh. It checks whether ~/Share/Inbox has anything new (ignoring _done and hidden files). If not, it stops without starting you. If so, it runs claude -p from ~/notes to file the items and move them to _done, then sends the summary to Telegram. Only one copy may run at a time. Then create a systemd timer for 12:00, 17:00 and 21:00.
Pings
Create a Telegram bot first, and keep its token in a private file, never in the script.
Write me a script that watches ~/Share/Inbox and ~/Share/Outbox and sends me a Telegram message for each new file: its name, plus a link for Outbox files if I've set up a private file viewer (here is its address: [address]); otherwise names only. Skip files that were already there on the first run and files still being written. If many files arrive in one folder, send one line for the folder. Read the bot token from a private file. Run it on a timer every few minutes.
The tidy
Write me a weekly tidy script for ~/Share:
1. Anything in Outbox older than 30 days moves to _old. Skip _old, _done, hidden files and these folders: [protected folders].
2. Anything in _old or _done is deleted 30 days after it arrived there. Record the arrival time yourself; never use the file's own date.
3. Never delete anything over 1 GB; list it for me.
4. Never delete files waiting in Inbox; list the ones that have waited 14 days.
5. Never follow links, and never overwrite a file with the same name.
6. Write the result to a status file.
Run it once in dry-run mode, showing what it would do, before it deletes anything.
What I learned
- Check before starting the AI. A plain script can tell whether anything is new; AI only runs when there’s work.
- Unfiled files are never deleted. What I put in the Inbox, I decide about.
- A deletion clock starts on arrival. Otherwise an old file can be archived and deleted in one go.
- A ping has to be short. A name, a link, and one line when many files arrive.
Tools
Next in the series: the start page.