Skip to content

Instantly share code, notes, and snippets.

@seqis
Created July 24, 2025 23:34
Show Gist options
  • Select an option

  • Save seqis/2e0f55b3b237ed6177b3a9595c9bf127 to your computer and use it in GitHub Desktop.

Select an option

Save seqis/2e0f55b3b237ed6177b3a9595c9bf127 to your computer and use it in GitHub Desktop.
/update for therapy sessions with Claude Code for local CLAUDE.md
/update – Session Compaction for CLAUDE.md 🪶
─────────────────────────────────────────────────
NOTE: Operates ONLY on the project‑local ./CLAUDE.md
(global ~/.claude/CLAUDE.md remains untouched).
1. Pre‑Check Size
• Count lines + estimate tokens.
• If > 300 lines ➜ echo "⚠️ Consider pruning your local CLAUDE.md after updating".
• Run Bash date command to get current date and retain that for the rest of these instructions.
2. Harvest Last 100 Messages (or all, if fewer) and file them under:
• #CurrentFocus – one‑sentence emotional/theme focus
• #TherapyInsights – key reflections or breakthroughs (≤ 10)
• #ActionItems – concrete micro‑tasks (≤ 5)
• #PatternsAndHypotheses – recurring blocks / tentative causes (≤ 5)
• #GuidingPrinciples – durable rules or values clarified
• #Background – 1‑2 lines of essential context only
3. Distill Bullets to ≤ 120 chars
• Past tense for #TherapyInsights → “Challenged catastrophizing …”
• Imperatives for #ActionItems → “Schedule negative visualization”
• Add tag refs when helpful → “Linked #career‑meaning”
4. Auto‑Consolidate Before Writing
• If > 1 entry for today → merge.
• Retain only *current + previous* dated sessions.
• Auto‑archive sessions > 7 days old → memory‑archive/CLAUDE/
• Remove bullets marked #Deprecated > 3 days.
• Move completed #ActionItems → brief line in #TherapyInsights.
• Update Tag Index (`🔖 Index of Threads`) & each tag’s **Last Touched**.
• Update or create each tag’s **#RollingSummary** (2‑sentence recap).
5. Open *only* ./CLAUDE.md
• Apply consolidation from step 4.
• Append / update TODAY’s section heading:
`## YYYY‑MM‑DD – [Brief Session Title]`
• Ensure #GuidingPrinciples stay un‑archived for **30 days** minimum.
6. Size Report & Deliverables
A. Print: `CLAUDE.md: {old_lines} → {new_lines} lines`
B. Output a ```diff``` block (exact file changes).
C. Append single‑line CHANGELOG.md entry:
`YYYY‑MM‑DD meta: compacted – {main_tag}, {n} items consolidated`.
7. Quality Checks
• Verify Tag Index and RollingSummaries updated.
• Confirm no active ActionItems lost.
• Scan file—should read in under 30 seconds.
8. Purge Chat History, retaining only:
• This /compact instruction block
• Size report, diff, changelog entry.
9. Documentation Hygiene
• Review system‑level CLAUDE.md guidance; sync local docs in ./docs.
• If CLAUDE.md still > 300 lines after compaction ➜ suggest the user prunes the local CLAUDE.md file.
10. Ultrathink (Critical): Insert these instructions into the end of the CLAUDE.md when updating.
• Ultrathink often in these conversations.
• If available use the 'sequential thinking' MCP often before replying.
─────────────────────────────────────────────────
# Prioritization Guide
• #TherapyInsights over transient feelings
• #ActionItems over vague intentions
• #PatternsAndHypotheses only if reproducible
• #GuidingPrinciples are constitutional—never drop early
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment