cron job that turns recent claude code sessions into long term memory. every few minutes it looks at your session transcripts. if you have been idle long enough and there is enough new material since the last pass, it runs claude in print mode with a prompt telling it to read the recent transcripts and write anything durable into a memory vault. if the vault is a git repo it commits and pushes afterwards.
the vault is just a folder with a memory subfolder full of small markdown files plus a MEMORY.md index file. point MEMORY_VAULT_DIR at it. transcripts are found under the default claude projects folder, override with TRANSCRIPT_DIR if yours live elsewhere. IDLE_MINS and MIN_LINES tune the two gates. run with --force to skip both gates and consolidate right now.
add a cron line running it every 5 minutes or so. cron has no tty, so if claude cannot edit files when run headless, put whatever permission flag you are comfortable with into CLAUDE_ARGS. state, log and lock files live as dotfiles inside the vault. a lock file keeps two runs from overlapping.