samayly.com is live. Hosted plans open soon. Join the waitlist →
Guide 1230 min11 min read

/prep: real study material, routed by subject

/prep <topic> returns a study guide for a topic: what it is, basics, core concepts, in-depth points, pitfalls and links. When the topic matches a subject folder in Google Drive, the answer is grounded in that folder's real slides and books and names the file it used. Otherwise it falls back to a general guide.

Members still run in the zero-tool sandbox. They never touch Drive. They read a local JSON file that the owner's indexer refreshes.

1. Pipeline

Pipeline: Drive to reply

Google Drive folders
GPU, Innovation and IP Management

ts03-material-index
owner, full tools, 05:00 daily

Local cache
~/.cache/ts03-material/*.json

/prep in ts03-bot
zero-tool sandbox

Reply in WhatsApp

Green marks the zero-tool sandbox. Only the indexer has Drive access, and it runs as the owner.

2. Routing, inside /prep

Routing inside /prep

yes

no

User message

Alias match
in routes.json

Grounded in material
cites the Drive file

General knowledge
Claude's own training

Reply in chat

The match is whole-word and the longest alias wins, so advanced ai beats ai. Bare ip is deliberately not an alias, so "IP address" does not route to IP Management.

3. Folders

Drive folder Routes to State
GPU gpu, gpu programming, cuda, warp indexed
Innovation and IP Management (IPM) ipm, ip management, intellectual property, patent(s), copyright, trademark(s), trade secret(s) add routes, then index
NLP, AI, DL see templates/subject-routes.json.example add files, then index

The folder name in ~/.config/ts03-subject-routes.json must match the Drive folder name exactly. A trailing slash in Drive (GPU/) is fine.

4. Setup

  1. Connect the Drive MCP to Claude Code at user scope, and allow it in ~/.claude/settings.json ("mcp__google-drive" in permissions.allow). Without that allow-list entry, headless claude -p silently blocks the Drive tools.
  2. Routes file: bash cp templates/subject-routes.json.example ~/.config/ts03-subject-routes.json
  3. Index: bash ./scripts/ts03-material-index # every folder in the routes file ./scripts/ts03-material-index GPU # one folder
  4. Schedule it with templates/com.ts03.material-index.plist.example (daily at 05:00).
  5. Sandbox rule file: bash mkdir -p ~/.cache/ts03-public cp templates/ts03-sandbox-CLAUDE.md.example ~/.cache/ts03-public/CLAUDE.md scripts/ts03-bot selftest

5. What keeps the indexer reliable

Behaviour Why
Lists files first, then extracts one file per call a huge textbook failing must not lose the lecture slides
Retries an empty listing up to 3 times the model has returned an empty list for a non-empty folder
Keeps the previous cache if the listing is empty or one file fails a bad run must never wipe good text
Runs claude in ~/.cache/ts03-material/_work, wiped after every run downloaded book PDFs must never land in a git checkout
Tells the model to delete any temporary converted copy it creates otherwise a daily run leaves a duplicate in Drive every day
Does not force a --model a forced model once resolved to a retired snapshot and failed

6. Academic integrity

/prep teaches concepts. If the topic looks like a pasted quiz, exam or assignment question, it declines to solve it and explains the concept instead. Two layers enforce this, and both are behavioural:

  • an explicit rule in the /prep prompt
  • ~/.cache/ts03-public/CLAUDE.md, loaded by every sandboxed call

The security boundary is separate: scripts/ts03-bot selftest proves the sandbox has no tools, no MCP servers and cannot read files. Run it after every change.

7. Restarting and deploying

bash
./scripts/install-bot.sh whatsapp        # deploy new code (copies scripts/ts03-bot to ~/.local/bin)
launchctl kickstart -k gui/$(id -u)/com.ts03.bot.whatsapp   # restart only

Do not use install-bot.sh whatsapp --uninstall to restart. It removes the service and any launchd digest. The routes file is read once at start, so restart after editing it.

8. Troubleshooting

Symptom Check
/prep answers from general knowledge although the folder is populated python3 -m json.tool ~/.cache/ts03-material/GPU.json \| head should list files
Indexer prints no files found, keeping the previous cache Drive folder name vs routes value; Drive MCP connected (claude mcp list) and allowed in settings
nothing extracted (scanned, no text layer) the PDF is page images; export a text PDF instead
.pptx decks fail to extract save the deck as PDF into the same folder and re-run
/prep says it is capped PREP_DAILY_CAP in ~/.config/ts03-bot.env (default 20 per day, whole group)
Stray .tmp_* files in the repo should not happen any more; .gitignore covers .tmp_*; never git add -A

9. Limits

  • Each file is capped at 12,000 characters of extracted text, so a whole textbook is represented by its most exam-relevant parts.
  • File ranking is keyword overlap, not semantic search.
  • Links in answers come from the model's knowledge and are not checked live.
  • Keep Drive material and ~/.cache/ts03-material/ out of the repo. They are copyrighted course content.

Questions or corrections: [email protected]