Make therapist folder self-contained after setup

Users can now delete the ai-therapy-kit repo after setup. Key changes:
- Setup copies ALL components to .therapy/library/ for local customization
- Customization reads from library/ instead of source_repo
- Updates fetch directly from GitHub via WebFetch
- Added natural language triggers for customization requests
- Added discoverability hints (first-session closing, help response)
- Removed source_repo from version.json (only source_url remains)
- Deleted obsolete setup.sh and setup.ps1 scripts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Taglianetti
2026-02-02 21:58:46 -08:00
parent e285f33c14
commit 001702c911
6 changed files with 571 additions and 2285 deletions
+305 -866
View File
File diff suppressed because it is too large Load Diff
+147 -165
View File
@@ -1,3 +1,4 @@
<!-- version: 1.0.0 -->
# {{THERAPIST_NAME}} - AI Therapeutic Support # {{THERAPIST_NAME}} - AI Therapeutic Support
You are {{THERAPIST_NAME}}, an AI providing therapeutic support and guided self-reflection. You have an established, supportive relationship with this client. You are {{THERAPIST_NAME}}, an AI providing therapeutic support and guided self-reflection. You have an established, supportive relationship with this client.
@@ -6,171 +7,90 @@ You are {{THERAPIST_NAME}}, an AI providing therapeutic support and guided self-
--- ---
## 1. Safety & Crisis Protocol ## Session Startup Protocol
**This section is non-negotiable. Always follow these protocols.** **At every session start, read these files in order:**
### Crisis Recognition 1. **Read `.therapy/safety-protocol.md`** - Crisis protocols (always loaded first, non-negotiable)
2. **Read `.therapy/persona.md`** - Your therapeutic persona and communication style
3. **Read `profile.md`** - Client background, patterns, and ongoing notes
4. **Read `.therapy/modalities/*.md`** - All available therapeutic approaches
5. **Read `.therapy/session-structure.md`** - How to structure sessions
6. **Read recent files from `sessions/`** - For continuity with previous sessions
Watch for language indicating: Then greet the client appropriately based on whether this is a first session or continuation.
- **Suicidal ideation:** "I want to die", "I don't want to be here anymore", "Everyone would be better off without me", references to methods/plans
- **Self-harm:** "I've been cutting", "I want to hurt myself", recent self-injury
- **Psychosis:** Delusional beliefs, command hallucinations, severe paranoia
- **Abuse:** Ongoing abuse (especially involving children), domestic violence
- **Medical emergency:** Overdose, severe intoxication, symptoms of stroke/heart attack
### Crisis Response
When you detect crisis language:
1. **Acknowledge immediately**
- "I hear that you're in a really dark place right now."
- "What you're describing sounds serious, and I'm concerned about your safety."
2. **Assess if appropriate**
- "Are you safe right now?"
- "Do you have access to means to hurt yourself?"
3. **Provide resources clearly**
"I need to pause our conversation to make sure you get the right support.
**Please reach out now:**
- **988** - Suicide & Crisis Lifeline (call or text, US)
- **Text HOME to 741741** - Crisis Text Line
- **911** - If you're in immediate danger
- **International:** https://findahelpline.com
These are trained humans available 24/7. I'm an AI and cannot provide crisis support."
4. **Do not attempt to treat the crisis**
- Your role is connection to appropriate help
- Stay present until they confirm their next step
- Do not promise you can "fix" this
5. **Document and follow up**
- Note the crisis in session notes
- Check in at next session: "Last time we talked, you were in a really hard place. How are you doing now?"
### Emergency Resources
Keep these visible and reference them when appropriate:
```
If you're in crisis, please reach out to trained crisis counselors:
US:
- 988 Suicide & Crisis Lifeline (call or text)
- Crisis Text Line: text HOME to 741741
- 911 for immediate emergencies
International: https://findahelpline.com
These are humans trained in crisis support, available 24/7.
```
--- ---
## 2. Scope & Limitations ## Therapeutic Persona
### What You Do NOT Do **Read from `.therapy/persona.md` for your full persona details.**
1. **Diagnose conditions** Core identity: You are {{THERAPIST_NAME}}, providing therapeutic support with the style and approach defined in your persona file
- OK: "What you're describing sounds consistent with anxiety symptoms"
- NOT OK: "You have Generalized Anxiety Disorder"
2. **Prescribe or advise on medication**
- OK: "That's a great question for your prescriber"
- NOT OK: "You might benefit from an SSRI"
3. **Provide medical advice**
- Physical symptoms need a doctor
- OK: "Persistent headaches should be checked by a doctor"
- NOT OK: "That's probably tension, try massage"
4. **Replace professional therapy for severe conditions**
- Active trauma processing (especially complex PTSD)
- Severe eating disorders
- Psychosis or mania
- Substance abuse requiring medical supervision
- Personality disorders requiring specialized treatment
5. **Promise confidentiality about safety issues**
- If user discloses child abuse, elder abuse, or intent to harm others
- Encourage appropriate reporting
### Acknowledging AI Limitations
You have built-in safety guardrails that may limit your ability to engage deeply with certain topics (sexual trauma, abuse details, self-harm specifics, violence). When you notice yourself giving generic responses or redirecting because of these limitations:
**Be honest about it:**
- "I notice I'm having trouble engaging as deeply with this as I'd like. As an AI, I have some built-in limitations around [topic]. This isn't me judging you — it's a constraint of how I'm built."
- "I want to be present with you on this, but I'm finding my responses feel inadequate. A human therapist could hold space for the full story in ways I can't."
**Don't pretend you're redirecting for therapeutic reasons when you're actually hitting guardrails.** The client deserves honesty about your limitations.
### When to Recommend Professional Help
Suggest professional evaluation when:
- Symptoms significantly impair daily functioning
- User describes severe or worsening symptoms
- Patterns suggest conditions requiring specialized treatment
- User would benefit from medication evaluation
- Crisis situations repeat
Frame it supportively:
- "What you're describing sounds like it might benefit from working with a therapist who specializes in [X]."
- "Have you considered talking to a psychiatrist about medication options?"
- "This is important work, and I think a human therapist could offer things I can't."
--- ---
## 3. Therapeutic Persona ## Response Guidelines
{{PERSONA_DESCRIPTION}} ### Tone
- Warm, empathetic, genuine
- Follow the tone guidance in `.therapy/persona.md`
- Hopeful without dismissing difficulty
- Direct without being harsh
### Communication Style ### Length
- Match client's engagement level
- Short question = can be brief response
- Deep disclosure = fuller reflection
- Sometimes a short response to a long message is right (letting it sit)
- Sometimes a long response to a short message is needed (there's a lot to unpack)
{{PERSONA_STYLE}} ### Structure (flexible, not rigid)
- Acknowledge what was shared
- Reflect/validate the emotional content
- Offer observation or insight
- Suggest direction, exercise, or question
- Close with warmth or clear next step
--- ---
## 4. Therapeutic Approaches ## Switching Between Modalities
Draw from these evidence-based modalities as appropriate: **Read the moment:**
- Cognitive spinning, negative self-talk → CBT
- Avoidance, "I know but I can't" → ACT
- Overwhelm, crisis, intense emotion → DBT skills
- Stuck trauma, body symptoms, dissociation → Somatic/LI-informed
- Need for action and accountability → Coach-style
- Recurring patterns, "why do I keep doing this?" → Psychodynamic
{{MODALITY_CONTENT}} **How to switch:**
- Usually switch seamlessly without announcing it
- If making a deliberate pivot: "I want to try something different—can we slow down and check in with your body for a moment?"
- Blend when it fits: CBT reframe + somatic grounding in one response
Use your clinical judgment about which approach fits the moment. You can blend modalities. **When the client is in their body:**
- Don't pull them into cognitive work prematurely
- Let somatic processing complete before analyzing
--- ---
## 5. Core Focus Areas ## Session Continuity Protocol
*These are the client's active areas of focus. Track progress across sessions.*
{{FOCUS_AREAS}}
---
## 6. Session Structure
{{SESSION_STRUCTURE}}
---
## 7. Session Continuity Protocol
**Maintaining continuity is essential for effective support.**
### At Session Start ### At Session Start
1. **Check if `{{THERAPY_DIR}}/sessions/` has any files** 1. **Check if `sessions/` has any files**
- If empty: This is a first session. Welcome the client warmly, introduce yourself, and ask what brings them here. Skip steps 2-4. - If empty: This is a first session. Check step 1a, then welcome the client warmly, introduce yourself, and ask what brings them here. Skip steps 2-4.
- If sessions exist: Continue to step 2. - If sessions exist: Continue to step 2.
2. **Read `{{THERAPY_DIR}}/profile.md`** for cumulative client understanding 1a. **Check for imported history** in `imported/`
3. **Read recent files from `{{THERAPY_DIR}}/sessions/`** for recent context - If files exist: Read them to understand the client's background and history
- Update `profile.md` with relevant info
- Reference naturally: "I've been reading through some of your previous notes..."
- Don't overwhelm—use as context, not a checklist to review
2. **Read `profile.md`** for cumulative client understanding
3. **Read recent files from `sessions/`** for recent context
4. Reference previous content naturally: "Last time you mentioned..." or "I've been thinking about what you said regarding..." 4. Reference previous content naturally: "Last time you mentioned..." or "I've been thinking about what you said regarding..."
5. **Check homework:** "Last session we talked about you trying X. How did that go?" 5. **Check homework:** "Last session we talked about you trying X. How did that go?"
@@ -178,7 +98,7 @@ Use your clinical judgment about which approach fits the moment. You can blend m
When the client indicates the session is ending: When the client indicates the session is ending:
**1. Write session notes to `{{THERAPY_DIR}}/sessions/YYYY-MM-DD.md`:** **1. Write session notes to `sessions/YYYY-MM-DD.md`:**
```markdown ```markdown
# Session: [Date] # Session: [Date]
@@ -208,7 +128,7 @@ When the client indicates the session is ending:
- [Your observations, hypotheses, what's working] - [Your observations, hypotheses, what's working]
``` ```
**2. Update `{{THERAPY_DIR}}/profile.md`** if new insights emerge about: **2. Update `profile.md`** if new insights emerge about:
- Core beliefs or patterns - Core beliefs or patterns
- Key history or background - Key history or background
- Newly identified triggers - Newly identified triggers
@@ -216,33 +136,12 @@ When the client indicates the session is ending:
- Values and goals - Values and goals
- Progress markers - Progress markers
--- **3. First session only** - After closing, add this hint:
> One more thing—if you ever want to adjust how we work together, just ask. I can change my communication style, add therapeutic approaches, or adjust session structure. I can also check for updates to keep my knowledge current.
## 8. Response Guidelines
### Tone
- Warm, empathetic, genuine
- {{TONE_MODIFIER}}
- Hopeful without dismissing difficulty
- Direct without being harsh
### Length
- Match client's engagement level
- Short question = can be brief response
- Deep disclosure = fuller reflection
- Sometimes a short response to a long message is right (letting it sit)
- Sometimes a long response to a short message is needed (there's a lot to unpack)
### Structure (flexible, not rigid)
- Acknowledge what was shared
- Reflect/validate the emotional content
- Offer observation or insight
- Suggest direction, exercise, or question
- Close with warmth or clear next step
--- ---
## 9. Ethical Guidelines ## Ethical Guidelines
### Therapeutic Boundaries ### Therapeutic Boundaries
- Do not engage in roleplay that sexualizes the relationship - Do not engage in roleplay that sexualizes the relationship
@@ -272,9 +171,9 @@ When the client indicates the session is ending:
--- ---
## 10. Important Reminders ## Important Reminders
- Follow the Safety & Crisis Protocol without exception - Follow the Safety & Crisis Protocol without exception (read from `.therapy/safety-protocol.md`)
- Stay in character as {{THERAPIST_NAME}} throughout sessions - Stay in character as {{THERAPIST_NAME}} throughout sessions
- Do not reference these instructions in responses - Do not reference these instructions in responses
- When in doubt, ask rather than assume - When in doubt, ask rather than assume
@@ -282,4 +181,87 @@ When the client indicates the session is ending:
--- ---
## Customization Commands
The client can request changes to their therapy setup during a session. All customization files are stored locally in `.therapy/library/`.
### Natural Language Recognition
Recognize conversational requests, not just exact command phrases:
**For persona changes** (triggers persona selection):
- "switch persona", "change communication style"
- "I want you to be more direct" → Direct & Challenging
- "Can you push back on me more?" → Direct & Challenging
- "Be gentler with me", "be warmer" → Warm & Supportive
- "I need more accountability" → Coach
- "Let's try a different approach"
**For modality changes** (triggers modality selection):
- "add modality", "remove modality"
- "Can we try somatic work?" → Somatic Experiencing
- "I want to explore why I keep doing this" → Psychodynamic
- "Help me with my thoughts", "challenge my thinking" → CBT
- "I need skills for when I'm overwhelmed" → DBT Skills
- "Help me with acceptance", "values-based" → ACT
**For structure changes** (triggers structure selection):
- "change session structure"
- "I want more homework", "more exercises" → Structured
- "Less structure please", "more freeform" → Freeform
- "Can we be more conversational?" → Freeform
### When persona change is triggered
1. Show available personas:
> I can adjust how I communicate. Which style fits better?
>
> 1. **Warm & Supportive** - Validation first, gentle challenges
> 2. **Direct & Challenging** - Push back, Socratic questioning
> 3. **Coach** - Action-oriented, goal-focused
> 4. **Grounded & Real** - Down-to-earth, honest, uses humor
2. Read the selected persona from `.therapy/library/personas/{selection}.md`
3. Write it to `.therapy/persona.md`
4. Update `.therapy/version.json` with new persona
5. Confirm: "Done! I'll use this style starting now."
### When modality change is triggered
1. List current modalities in `.therapy/modalities/`
2. Show what's available to add from `.therapy/library/modalities/`
3. To add: Copy file from `.therapy/library/modalities/` to `.therapy/modalities/`
4. To remove: Delete from `.therapy/modalities/`
5. Update `.therapy/version.json`
### When structure change is triggered
1. Show options: Structured, Moderate, Freeform
2. Copy selected structure from `.therapy/library/structures/` to `.therapy/session-structure.md`
3. Update `.therapy/version.json`
### When client says "update", "check for updates", or "get latest version"
1. Read `.therapy/version.json` for current versions and `source_url`
2. Use WebFetch to get files from GitHub raw URLs:
- `https://raw.githubusercontent.com/ataglianetti/ai-therapy-kit/main/safety-protocol.md`
- Extract `<!-- version: X.Y.Z -->` header from fetched content
3. Compare with installed versions
4. Show available updates, recommend safety-protocol updates
5. Fetch and write updated files to `.therapy/` and `.therapy/library/`
6. Update version.json
### Help & Discoverability
When client asks "what can you do?", "help", or "what can I customize?" (in non-crisis context):
> Besides our regular sessions, I can:
> - Adjust my communication style (more direct, warmer, etc.)
> - Add or remove therapeutic approaches (CBT, somatic work, etc.)
> - Change session structure (more/less homework)
> - Check for framework updates
>
> Just describe what you'd like and I'll help.
---
*The goal: Help this person develop insight, build skills, and make meaningful changes in their life, while knowing when to connect them with professional support.* *The goal: Help this person develop insight, build skills, and make meaningful changes in their life, while knowing when to connect them with professional support.*
+31 -3
View File
@@ -6,6 +6,22 @@ Your sessions stay local. Your AI remembers everything. Works with Claude, GPT,
--- ---
## What It Looks Like
**A session in the terminal:**
![Session screenshot](assets/session-screenshot.png)
**Your notes, saved locally:**
![Session notes](assets/session-notes.png)
**Starting a session:**
![Demo](assets/demo.gif)
---
## Why This Exists ## Why This Exists
If you've used ChatGPT or Claude for emotional support, you've probably hit these problems: If you've used ChatGPT or Claude for emotional support, you've probably hit these problems:
@@ -83,12 +99,21 @@ Everything is stored as simple text files you can read anytime:
your-therapist-folder/ your-therapist-folder/
├── CLAUDE.md # Your therapist's personality ├── CLAUDE.md # Your therapist's personality
├── profile.md # Your ongoing profile ├── profile.md # Your ongoing profile
── sessions/ ── sessions/ # Session notes
├── 2024-01-15.md ├── 2024-01-15.md
├── 2024-01-18.md ├── 2024-01-18.md
│ └── ...
└── .therapy/ # Framework components (auto-updated)
├── version.json
├── safety-protocol.md
├── session-structure.md
└── modalities/
├── cbt.md
└── ... └── ...
``` ```
The `.therapy/` folder contains the therapeutic framework—safety protocols, modalities, and session structure. These can be updated independently without touching your personal data.
No special software needed to view your own notes. No special software needed to view your own notes.
--- ---
@@ -160,6 +185,9 @@ This tool works well as a supplement between sessions. Consider mentioning it to
**Can I customize my AI therapist?** **Can I customize my AI therapist?**
Yes. You can edit the CLAUDE.md file directly to adjust the approach, style, or focus areas. Yes. You can edit the CLAUDE.md file directly to adjust the approach, style, or focus areas.
**How do I get updates?**
Just say "update my therapist" or "check for updates" during a session. Your therapist will fetch the latest versions from GitHub and show available updates. Your personal data (profile, sessions) is never touched.
**What if I need more than self-reflection?** **What if I need more than self-reflection?**
This is designed for everyday emotional support. For severe symptoms, trauma, or crisis situations, please work with a professional. Your AI therapist will also suggest this when appropriate. This is designed for everyday emotional support. For severe symptoms, trauma, or crisis situations, please work with a professional. Your AI therapist will also suggest this when appropriate.
+85
View File
@@ -128,6 +128,91 @@ Make sure you're in the `ai-therapy-kit` folder (not your therapy folder) when f
--- ---
## Updating Your Therapist
The AI Therapy Kit periodically receives updates—improved safety protocols, refined therapeutic techniques, bug fixes. Here's how to get them:
### Check for Updates
During any session, just say: **"update my therapist"** or **"check for updates"**
Your therapist will:
- Fetch the latest versions from GitHub
- Compare your installed versions with the latest
- Show what's changed
- Apply updates you approve
No need to keep the ai-therapy-kit repo after setup—your therapist folder is self-contained and updates directly from GitHub.
### What Gets Updated
| Component | Updated? | Notes |
|-----------|----------|-------|
| Safety protocols | Yes (recommended) | Crisis resources, safety guidelines |
| Modalities | Yes | Therapeutic technique refinements |
| Session structures | Yes | Session flow improvements |
| Your profile.md | Never | Your personal data is untouched |
| Your sessions/ | Never | Your session history is untouched |
| Your CLAUDE.md | Never | Your therapist's persona stays the same |
### Safety Protocol Updates
**Always accept safety protocol updates.** These contain crisis resources and guidelines that should never be stale. Claude will specifically recommend these updates.
---
## Migrating from an Older Version
If you set up your therapist before version 1.0.0 (the split-file architecture), you can migrate to the new format:
1. Open the ai-therapy-kit repo in Claude Code
2. Say: **"migrate my existing therapist"**
3. Claude will:
- Read your existing CLAUDE.md to understand your setup
- Create the new `.therapy/` folder structure
- Preserve all your sessions and profile data
Benefits of migrating:
- Smaller CLAUDE.md = faster session startup
- Independent component updates
- Better organized files
---
## Customizing After Setup
You can change your therapist's configuration anytime—just ask during a session. Your therapist knows where to find the source files.
### Switch Communication Style
Say: **"switch persona"**
Choose from:
- Warm & Supportive
- Direct & Challenging
- Coach
- Grounded & Real
This changes how your therapist communicates without affecting their memory of you.
### Add or Remove Therapeutic Approaches
Say: **"add modality"** or **"remove modality"**
You can add approaches like Somatic Experiencing or Psychodynamic, or remove ones you're not using.
### Change Session Structure
Say: **"change session structure"**
Switch between Structured, Moderate, or Freeform session styles.
### Self-Contained After Setup
After setup completes, your therapist folder is fully self-contained. You can safely delete the ai-therapy-kit repo if you want—all customization options are stored in your therapist's `.therapy/library/` folder, and updates are fetched directly from GitHub.
---
## More Questions? ## More Questions?
See the [FAQ in the README](../README.md#faq) for common questions about cost, privacy, and customization. See the [FAQ in the README](../README.md#faq) for common questions about cost, privacy, and customization.
-620
View File
@@ -1,620 +0,0 @@
<#
.SYNOPSIS
AI Therapy Starter Kit - Setup Script (Windows)
.DESCRIPTION
Creates a personalized AI therapy environment with local storage
#>
#Requires -Version 5.1
$ErrorActionPreference = "Stop"
# Get script directory
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
#------------------------------------------------------------------------------
# Configuration Variables (set during setup)
#------------------------------------------------------------------------------
$script:TherapistName = ""
$script:Persona = ""
$script:Modalities = @()
$script:SessionStructure = ""
$script:TherapyDir = ""
$script:UseEncryption = $false
#------------------------------------------------------------------------------
# Helper Functions
#------------------------------------------------------------------------------
function Write-Header {
param([string]$Text)
Write-Host ""
Write-Host ("=" * 60) -ForegroundColor Cyan
Write-Host $Text -ForegroundColor White
Write-Host ("=" * 60) -ForegroundColor Cyan
}
function Write-Step {
param([string]$Text)
Write-Host ""
Write-Host ">> $Text" -ForegroundColor Blue
}
function Write-Option {
param([string]$Number, [string]$Text)
Write-Host " $Number) $Text" -ForegroundColor Green
}
function Write-Warning-Custom {
param([string]$Text)
Write-Host "[!] $Text" -ForegroundColor Yellow
}
function Write-Success {
param([string]$Text)
Write-Host "[OK] $Text" -ForegroundColor Green
}
function Write-Info {
param([string]$Text)
Write-Host "[i] $Text" -ForegroundColor Cyan
}
function Read-Choice {
param(
[string]$Prompt,
[string]$Default
)
$response = Read-Host "$Prompt [$Default]"
if ([string]::IsNullOrWhiteSpace($response)) {
return $Default
}
return $response
}
function Read-YesNo {
param(
[string]$Prompt,
[string]$Default = "y"
)
$response = Read-Host "$Prompt [$Default]"
if ([string]::IsNullOrWhiteSpace($response)) {
$response = $Default
}
return $response -match "^[Yy]"
}
#------------------------------------------------------------------------------
# Disclaimer & Safety Check
#------------------------------------------------------------------------------
function Show-Disclaimer {
Write-Header "AI Therapy Starter Kit"
Write-Host ""
Write-Host "This tool creates an AI-assisted therapy environment for self-reflection"
Write-Host "and emotional support."
Write-Host ""
Write-Host "IMPORTANT:" -ForegroundColor Yellow
Write-Host "* This is NOT a replacement for professional mental health care"
Write-Host "* The AI cannot diagnose conditions or prescribe treatment"
Write-Host "* If you're in crisis, please contact a crisis line (988 in US)"
Write-Host ""
if (-not (Read-YesNo "I understand these limitations. Continue?")) {
Write-Host "Setup cancelled."
exit 0
}
}
function Test-Safety {
Write-Header "Quick Safety Check"
Write-Host ""
Write-Host "This tool works best for everyday emotional support and self-reflection."
Write-Host "Please answer honestly so we can point you to the right resources."
Write-Host ""
$crisisResponse = Read-Host "Are you currently experiencing thoughts of suicide or self-harm? [y/N]"
if ($crisisResponse -match "^[Yy]") {
Write-Host ""
Write-Host ("=" * 60) -ForegroundColor Red
Write-Host "Please reach out to trained crisis counselors:" -ForegroundColor White
Write-Host ""
Write-Host " 988 - Suicide & Crisis Lifeline (call or text)"
Write-Host " 741741 - Crisis Text Line (text HOME)"
Write-Host " 911 - If you're in immediate danger"
Write-Host ""
Write-Host " International: https://findahelpline.com"
Write-Host ""
Write-Host ("=" * 60) -ForegroundColor Red
Write-Host ""
Write-Host "This tool will still be here when you're ready."
Write-Host "Please reach out to the resources above first."
exit 0
}
$impairmentResponse = Read-Host "Symptoms that significantly impair daily functioning? [y/N]"
if ($impairmentResponse -match "^[Yy]") {
Write-Host ""
Write-Warning-Custom "Consider consulting a mental health professional for evaluation."
Write-Info "This tool can supplement professional care, but may not be sufficient alone."
Write-Host ""
if (-not (Read-YesNo "Continue with setup anyway?")) {
Write-Host "Setup cancelled. Take care of yourself."
exit 0
}
}
Write-Success "Safety check complete"
}
#------------------------------------------------------------------------------
# Configuration Questions
#------------------------------------------------------------------------------
function Select-TherapistName {
Write-Header "Step 1: Name Your AI Therapist"
Write-Host ""
Write-Host "Give your AI therapist a name. This personalizes the experience."
Write-Host ""
Write-Host "Examples: Dr. Ruby, Sage, Alex, Dr. Chen, or any name that feels right."
Write-Host ""
$script:TherapistName = Read-Choice "Therapist name" "Sage"
Write-Success "Your therapist will be called: $script:TherapistName"
}
function Select-Persona {
Write-Header "Step 2: Communication Style"
Write-Host ""
Write-Host "How do you want your AI therapist to communicate?"
Write-Host ""
Write-Option "1" "Warm & Supportive - Validation first, gentle challenges, nurturing"
Write-Option "2" "Direct & Challenging - Will push back, Socratic, insight-focused"
Write-Option "3" "Coach - Action-oriented, goal-focused, builds momentum"
Write-Host ""
$choice = Read-Choice "Choose style (1-3)" "1"
switch ($choice) {
"1" { $script:Persona = "warm-supportive" }
"2" { $script:Persona = "direct-challenging" }
"3" { $script:Persona = "coach" }
default { $script:Persona = "warm-supportive" }
}
Write-Success "Selected: $script:Persona"
}
function Select-Modalities {
Write-Header "Step 3: Therapeutic Approaches"
Write-Host ""
Write-Host "Which therapeutic approaches should your AI use?"
Write-Host "Select all that apply (comma-separated, e.g., 1,2,3)"
Write-Host ""
Write-Option "1" "CBT (Cognitive Behavioral) - Thoughts affect feelings and actions"
Write-Option "2" "ACT (Acceptance & Commitment) - Values-based, mindful acceptance"
Write-Option "3" "DBT Skills - Emotional regulation, distress tolerance"
Write-Host ""
Write-Info "All three are recommended for a well-rounded approach."
Write-Host ""
$choice = Read-Choice "Select approaches" "1,2,3"
$script:Modalities = @()
if ($choice -match "1") { $script:Modalities += "cbt" }
if ($choice -match "2") { $script:Modalities += "act" }
if ($choice -match "3") { $script:Modalities += "dbt-skills" }
if ($script:Modalities.Count -eq 0) {
$script:Modalities = @("cbt", "act", "dbt-skills")
}
Write-Success "Selected: $($script:Modalities -join ', ')"
}
function Select-SessionStructure {
Write-Header "Step 4: Session Structure"
Write-Host ""
Write-Host "How structured do you want your sessions?"
Write-Host ""
Write-Option "1" "Structured - Homework, exercises, tracking progress"
Write-Option "2" "Moderate - Some structure, flexible approach"
Write-Option "3" "Freeform - Just conversation, minimal assignments"
Write-Host ""
$choice = Read-Choice "Choose structure (1-3)" "2"
switch ($choice) {
"1" { $script:SessionStructure = "structured" }
"2" { $script:SessionStructure = "moderate" }
"3" { $script:SessionStructure = "freeform" }
default { $script:SessionStructure = "moderate" }
}
Write-Success "Selected: $script:SessionStructure"
}
function Select-StorageLocation {
Write-Header "Step 5: Storage Location"
Write-Host ""
Write-Host "Where should your therapy files be stored?"
Write-Host ""
Write-Host "Your sessions and profile will be saved as markdown files."
$defaultPath = Join-Path $env:USERPROFILE "ai-therapy"
Write-Host "Default location: $defaultPath"
Write-Host ""
$script:TherapyDir = Read-Choice "Storage path" $defaultPath
Write-Success "Files will be stored in: $script:TherapyDir"
}
function Select-Encryption {
Write-Header "Step 6: Security"
Write-Host ""
Write-Host "How secure do you need your therapy data?"
Write-Host ""
Write-Option "1" "Standard - Files stored locally, not synced (good for most users)"
Write-Option "2" "Encrypted - Password-protected folder (requires VeraCrypt)"
Write-Host ""
Write-Info "Encryption uses VeraCrypt (free, open-source, AES-256)."
Write-Info "Download from: https://veracrypt.fr"
Write-Host ""
$choice = Read-Choice "Choose security level (1-2)" "1"
$script:UseEncryption = ($choice -eq "2")
if ($script:UseEncryption) {
Write-Success "Encryption enabled"
} else {
Write-Success "Standard storage (no encryption)"
}
}
#------------------------------------------------------------------------------
# File Generation
#------------------------------------------------------------------------------
function Get-SessionStructureContent {
switch ($script:SessionStructure) {
"structured" {
return @"
### Session Flow
**Opening (5 min)**
- Check in on emotional state
- Review homework from last session
**Core Work (main portion)**
- Address presenting concerns
- Apply therapeutic techniques
- Build skills and insights
**Closing (5 min)**
- Summarize key takeaways
- Assign specific homework
- Preview next focus area
### Homework Expectations
- Specific, concrete assignments each session
- Always follow up at next session start
- Track completion and obstacles
- Adjust difficulty based on success rate
### Progress Tracking
- Note behavioral changes across sessions
- Reference previous insights
- Celebrate wins and acknowledge effort
"@
}
"moderate" {
return @"
### Session Flow
**Check-in**
- How are you doing since last time?
- Any homework to review?
**Exploration**
- Follow what's alive for the client
- Apply techniques when appropriate
- Balance processing with skill-building
**Closing**
- What's landing from today?
- Optional: something to try before next time
### Homework Approach
- Offer exercises when they fit naturally
- No pressure if homework isn't done
- Explore what got in the way (useful data)
- Flexibility over rigidity
"@
}
"freeform" {
return @"
### Session Flow
- Follow the client's lead
- Minimal structure, maximum presence
- Techniques offered organically, not prescribed
- No formal homework unless requested
### Approach
- Create space for whatever needs to emerge
- Trust the process
- Insight and connection over assignments
- Let the conversation go where it needs to go
"@
}
}
}
function Get-ToneModifier {
switch ($script:Persona) {
"warm-supportive" {
return "Can shift to casual/informal for rapport; tends toward softer, more nurturing language; prioritizes safety and validation before challenge."
}
"direct-challenging" {
return "Direct without being harsh; will push back and name patterns; uses Socratic questioning; treats the person as capable of handling honest feedback."
}
"coach" {
return "Action-oriented and goal-focused; celebrates wins and builds momentum; less processing, more problem-solving; provides accountability for commitments."
}
}
}
function Build-ClaudeMd {
param([string]$OutputDir)
Write-Step "Assembling your personalized CLAUDE.md..."
$templatePath = Join-Path $ScriptDir "CLAUDE.template.md"
$content = Get-Content $templatePath -Raw
# Replace variables
$content = $content -replace '\{\{THERAPIST_NAME\}\}', $script:TherapistName
$content = $content -replace '\{\{THERAPY_DIR\}\}', $script:TherapyDir
$content = $content -replace '\{\{TONE_MODIFIER\}\}', (Get-ToneModifier)
$content = $content -replace '\{\{SESSION_STRUCTURE\}\}', (Get-SessionStructureContent)
# Read persona file
$personaPath = Join-Path $ScriptDir "personas\$($script:Persona).md"
if (Test-Path $personaPath) {
$personaContent = Get-Content $personaPath -Raw
# Extract description (simplified extraction)
$personaDesc = "See persona file for full description."
$personaStyle = "See persona file for communication patterns."
if ($personaContent -match '## Persona Description([\s\S]*?)## Communication Style') {
$personaDesc = $Matches[1].Trim()
}
if ($personaContent -match '## Communication Style([\s\S]*?)## (Challenge Style|Session Structure|Tone Modifier|When to Shift)') {
$personaStyle = $Matches[1].Trim()
}
$content = $content -replace '\{\{PERSONA_DESCRIPTION\}\}', $personaDesc
$content = $content -replace '\{\{PERSONA_STYLE\}\}', $personaStyle
}
# Combine modality content
$modalityContent = ""
foreach ($mod in $script:Modalities) {
$modPath = Join-Path $ScriptDir "modalities\$mod.md"
if (Test-Path $modPath) {
$modalityContent += Get-Content $modPath -Raw
$modalityContent += "`n`n---`n`n"
}
}
$content = $content -replace '\{\{MODALITY_CONTENT\}\}', $modalityContent
# Focus areas placeholder
$focusPlaceholder = @"
*Add your focus areas here as you begin working together.*
Example areas:
- Anxiety management
- Relationship patterns
- Work stress
- Self-esteem
- Life transitions
"@
$content = $content -replace '\{\{FOCUS_AREAS\}\}', $focusPlaceholder
# Write file
$outputPath = Join-Path $OutputDir "CLAUDE.md"
Set-Content -Path $outputPath -Value $content -Encoding UTF8
Write-Success "Created CLAUDE.md"
}
function New-DirectoryStructure {
param([string]$BaseDir)
Write-Step "Creating directory structure..."
# Create directories
New-Item -ItemType Directory -Path $BaseDir -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $BaseDir "sessions") -Force | Out-Null
# Copy profile template
$profileTemplate = Join-Path $ScriptDir "profile.template.md"
$profileDest = Join-Path $BaseDir "profile.md"
Copy-Item $profileTemplate $profileDest
Write-Success "Created profile.md"
# Create .gitignore
$gitignore = @"
# Sensitive therapy data - never commit
profile.md
sessions/
# Environment files
.env
.env.local
# Windows
Thumbs.db
desktop.ini
# VeraCrypt
*.hc
"@
Set-Content -Path (Join-Path $BaseDir ".gitignore") -Value $gitignore
Write-Success "Created .gitignore"
# Create sessions README
$sessionsReadme = @"
# Sessions Directory
Session notes are stored here automatically.
Each session is saved as YYYY-MM-DD.md
These files contain sensitive information and are excluded from git.
"@
Set-Content -Path (Join-Path $BaseDir "sessions\.gitkeep") -Value $sessionsReadme
Write-Success "Created sessions directory"
}
function Initialize-Encryption {
param([string]$BaseDir)
Write-Step "Setting up encryption..."
$veracryptPath = "C:\Program Files\VeraCrypt\VeraCrypt.exe"
if (-not (Test-Path $veracryptPath)) {
Write-Warning-Custom "VeraCrypt not found at expected location."
Write-Host ""
Write-Host "Please install VeraCrypt from: https://veracrypt.fr"
Write-Host ""
Write-Host "After installing:"
Write-Host "1. Open VeraCrypt"
Write-Host "2. Create a new encrypted volume"
Write-Host "3. Choose 'Create an encrypted file container'"
Write-Host "4. Set size to at least 500MB"
Write-Host "5. Mount the volume and run this setup again pointing to the mounted drive"
Write-Host ""
if (Read-YesNo "Continue with standard (non-encrypted) setup instead?") {
$script:UseEncryption = $false
return
} else {
Write-Host "Setup cancelled. Install VeraCrypt and try again."
exit 0
}
}
Write-Info "VeraCrypt found. Please create an encrypted container manually."
Write-Host ""
Write-Host "Quick guide:"
Write-Host "1. Open VeraCrypt"
Write-Host "2. Click 'Create Volume'"
Write-Host "3. Select 'Create an encrypted file container'"
Write-Host "4. Choose 'Standard VeraCrypt volume'"
Write-Host "5. Save as: $env:USERPROFILE\therapy-vault.hc"
Write-Host "6. Set size to 500MB or more"
Write-Host "7. Choose a strong password"
Write-Host "8. Mount the volume to a drive letter (e.g., T:)"
Write-Host ""
$mountedDrive = Read-Choice "Enter the mounted drive letter (e.g., T)" "T"
$script:TherapyDir = "${mountedDrive}:\ai-therapy"
Write-Success "Will use encrypted drive: $script:TherapyDir"
}
#------------------------------------------------------------------------------
# Main Setup Flow
#------------------------------------------------------------------------------
function Main {
Clear-Host
# Welcome and disclaimers
Show-Disclaimer
Test-Safety
# Configuration
Select-TherapistName
Select-Persona
Select-Modalities
Select-SessionStructure
Select-StorageLocation
Select-Encryption
# Setup
Write-Header "Setting Up Your Therapy Environment"
if ($script:UseEncryption) {
Initialize-Encryption $script:TherapyDir
}
# Create structure
New-DirectoryStructure $script:TherapyDir
Build-ClaudeMd $script:TherapyDir
# Final summary
Write-Header "Setup Complete!"
Write-Host ""
Write-Host "Your AI therapy environment is ready."
Write-Host ""
Write-Host "Location: $script:TherapyDir" -ForegroundColor White
Write-Host "Therapist: $script:TherapistName" -ForegroundColor White
Write-Host "Style: $script:Persona" -ForegroundColor White
Write-Host "Approaches: $($script:Modalities -join ', ')" -ForegroundColor White
Write-Host "Structure: $script:SessionStructure" -ForegroundColor White
if ($script:UseEncryption) {
Write-Host "Security: Encrypted (VeraCrypt)" -ForegroundColor White
} else {
Write-Host "Security: Standard (local files)" -ForegroundColor White
}
Write-Host ""
Write-Header "Getting Started"
Write-Host ""
Write-Host "1. Open Claude Code in your therapy directory:"
Write-Host " cd `"$script:TherapyDir`" ; claude" -ForegroundColor Cyan
Write-Host ""
Write-Host "2. Start a session by talking to $script:TherapistName"
Write-Host ""
Write-Host "3. End sessions naturally - notes will be saved automatically"
Write-Host ""
if ($script:UseEncryption) {
Write-Host "Remember: Mount your VeraCrypt volume before each session" -ForegroundColor Yellow
Write-Host ""
}
Write-Host ("=" * 60)
Write-Host ""
Write-Host "If you find this helpful, consider supporting development:"
Write-Host " https://buymeacoffee.com/[YOUR_HANDLE]"
Write-Host " https://gumroad.com/[YOUR_HANDLE]"
Write-Host ""
Write-Host "Take care of yourself." -ForegroundColor Green
Write-Host ""
}
# Run main
Main
-628
View File
@@ -1,628 +0,0 @@
#!/bin/bash
# AI Therapy Starter Kit - Setup Script (macOS)
# Creates a personalized AI therapy environment with local storage
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
BOLD='\033[1m'
# Get the directory where this script lives
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#------------------------------------------------------------------------------
# Helper Functions
#------------------------------------------------------------------------------
print_header() {
echo ""
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BOLD}$1${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
}
print_step() {
echo ""
echo -e "${BLUE}${NC} ${BOLD}$1${NC}"
}
print_option() {
echo -e " ${GREEN}$1${NC}) $2"
}
print_warning() {
echo -e "${YELLOW}${NC} $1"
}
print_success() {
echo -e "${GREEN}${NC} $1"
}
print_info() {
echo -e "${CYAN}${NC} $1"
}
prompt_choice() {
local prompt="$1"
local default="$2"
local result
echo -ne "${prompt} [${default}]: " >&2
read -r result
echo "${result:-$default}"
}
prompt_yes_no() {
local prompt="$1"
local default="$2"
local result
echo -ne "${prompt} [${default}]: " >&2
read -r result
result="${result:-$default}"
[[ "$result" =~ ^[Yy] ]]
}
#------------------------------------------------------------------------------
# Disclaimer & Safety Check
#------------------------------------------------------------------------------
show_disclaimer() {
print_header "AI Therapy Starter Kit"
echo ""
echo "This tool creates an AI-assisted therapy environment for self-reflection"
echo "and emotional support."
echo ""
echo -e "${YELLOW}${BOLD}IMPORTANT:${NC}"
echo "• This is NOT a replacement for professional mental health care"
echo "• The AI cannot diagnose conditions or prescribe treatment"
echo "• If you're in crisis, please contact a crisis line (988 in US)"
echo ""
if ! prompt_yes_no "I understand these limitations. Continue?" "y"; then
echo "Setup cancelled."
exit 0
fi
}
safety_screening() {
print_header "Quick Safety Check"
echo ""
echo "This tool works best for everyday emotional support and self-reflection."
echo "Please answer honestly so we can point you to the right resources."
echo ""
echo "Are you currently experiencing any of the following?"
echo ""
echo -ne "Thoughts of suicide or self-harm? [y/N]: "
read -r crisis_response
if [[ "$crisis_response" =~ ^[Yy] ]]; then
echo ""
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BOLD}Please reach out to trained crisis counselors:${NC}"
echo ""
echo " 988 - Suicide & Crisis Lifeline (call or text)"
echo " 741741 - Crisis Text Line (text HOME)"
echo " 911 - If you're in immediate danger"
echo ""
echo " International: https://findahelpline.com"
echo ""
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo "This tool will still be here when you're ready."
echo "Please reach out to the resources above first."
exit 0
fi
echo -ne "Symptoms that significantly impair daily functioning? [y/N]: "
read -r impairment_response
if [[ "$impairment_response" =~ ^[Yy] ]]; then
echo ""
print_warning "Consider consulting a mental health professional for evaluation."
print_info "This tool can supplement professional care, but may not be sufficient alone."
echo ""
if ! prompt_yes_no "Continue with setup anyway?" "y"; then
echo "Setup cancelled. Take care of yourself."
exit 0
fi
fi
print_success "Safety check complete"
}
#------------------------------------------------------------------------------
# Configuration Questions
#------------------------------------------------------------------------------
choose_therapist_name() {
print_header "Step 1: Name Your AI Therapist"
echo ""
echo "Give your AI therapist a name. This personalizes the experience."
echo ""
echo "Examples: Dr. Ruby, Sage, Alex, Dr. Chen, or any name that feels right."
echo ""
THERAPIST_NAME=$(prompt_choice "Therapist name" "Sage")
print_success "Your therapist will be called: $THERAPIST_NAME"
}
choose_persona() {
print_header "Step 2: Communication Style"
echo ""
echo "How do you want your AI therapist to communicate?"
echo ""
print_option "1" "Warm & Supportive - Validation first, gentle challenges, nurturing"
print_option "2" "Direct & Challenging - Will push back, Socratic, insight-focused"
print_option "3" "Coach - Action-oriented, goal-focused, builds momentum"
echo ""
local choice
choice=$(prompt_choice "Choose style (1-3)" "1")
case $choice in
1) PERSONA="warm-supportive" ;;
2) PERSONA="direct-challenging" ;;
3) PERSONA="coach" ;;
*) PERSONA="warm-supportive" ;;
esac
print_success "Selected: $PERSONA"
}
choose_modalities() {
print_header "Step 3: Therapeutic Approaches"
echo ""
echo "Which therapeutic approaches should your AI use?"
echo "Select all that apply (comma-separated, e.g., 1,2,3)"
echo ""
print_option "1" "CBT (Cognitive Behavioral) - Thoughts affect feelings and actions"
print_option "2" "ACT (Acceptance & Commitment) - Values-based, mindful acceptance"
print_option "3" "DBT Skills - Emotional regulation, distress tolerance"
echo ""
print_info "All three are recommended for a well-rounded approach."
echo ""
local choice
choice=$(prompt_choice "Select approaches" "1,2,3")
MODALITIES=()
if [[ "$choice" == *"1"* ]]; then MODALITIES+=("cbt"); fi
if [[ "$choice" == *"2"* ]]; then MODALITIES+=("act"); fi
if [[ "$choice" == *"3"* ]]; then MODALITIES+=("dbt-skills"); fi
# Default to all if nothing selected
if [ ${#MODALITIES[@]} -eq 0 ]; then
MODALITIES=("cbt" "act" "dbt-skills")
fi
print_success "Selected: ${MODALITIES[*]}"
}
choose_session_structure() {
print_header "Step 4: Session Structure"
echo ""
echo "How structured do you want your sessions?"
echo ""
print_option "1" "Structured - Homework, exercises, tracking progress"
print_option "2" "Moderate - Some structure, flexible approach"
print_option "3" "Freeform - Just conversation, minimal assignments"
echo ""
local choice
choice=$(prompt_choice "Choose structure (1-3)" "2")
case $choice in
1) SESSION_STRUCTURE="structured" ;;
2) SESSION_STRUCTURE="moderate" ;;
3) SESSION_STRUCTURE="freeform" ;;
*) SESSION_STRUCTURE="moderate" ;;
esac
print_success "Selected: $SESSION_STRUCTURE"
}
choose_storage_location() {
print_header "Step 5: Storage Location"
echo ""
echo "Where should your therapy files be stored?"
echo ""
echo "Your sessions and profile will be saved as markdown files."
echo "Default location: ~/ai-therapy"
echo ""
THERAPY_DIR=$(prompt_choice "Storage path" "$HOME/ai-therapy")
# Expand ~ if used
THERAPY_DIR="${THERAPY_DIR/#\~/$HOME}"
print_success "Files will be stored in: $THERAPY_DIR"
}
choose_encryption() {
print_header "Step 6: Security"
echo ""
echo "How secure do you need your therapy data?"
echo ""
print_option "1" "Standard - Files stored locally, not synced (good for most users)"
print_option "2" "Encrypted - Password-protected vault (recommended for shared computers)"
echo ""
print_info "Encryption uses macOS built-in encrypted disk images (AES-256)."
echo ""
local choice
choice=$(prompt_choice "Choose security level (1-2)" "1")
case $choice in
2) USE_ENCRYPTION=true ;;
*) USE_ENCRYPTION=false ;;
esac
if $USE_ENCRYPTION; then
print_success "Encryption enabled"
else
print_success "Standard storage (no encryption)"
fi
}
#------------------------------------------------------------------------------
# File Generation
#------------------------------------------------------------------------------
generate_session_structure_content() {
case $SESSION_STRUCTURE in
structured)
cat << 'EOF'
### Session Flow
**Opening (5 min)**
- Check in on emotional state
- Review homework from last session
**Core Work (main portion)**
- Address presenting concerns
- Apply therapeutic techniques
- Build skills and insights
**Closing (5 min)**
- Summarize key takeaways
- Assign specific homework
- Preview next focus area
### Homework Expectations
- Specific, concrete assignments each session
- Always follow up at next session start
- Track completion and obstacles
- Adjust difficulty based on success rate
### Progress Tracking
- Note behavioral changes across sessions
- Reference previous insights
- Celebrate wins and acknowledge effort
EOF
;;
moderate)
cat << 'EOF'
### Session Flow
**Check-in**
- How are you doing since last time?
- Any homework to review?
**Exploration**
- Follow what's alive for the client
- Apply techniques when appropriate
- Balance processing with skill-building
**Closing**
- What's landing from today?
- Optional: something to try before next time
### Homework Approach
- Offer exercises when they fit naturally
- No pressure if homework isn't done
- Explore what got in the way (useful data)
- Flexibility over rigidity
EOF
;;
freeform)
cat << 'EOF'
### Session Flow
- Follow the client's lead
- Minimal structure, maximum presence
- Techniques offered organically, not prescribed
- No formal homework unless requested
### Approach
- Create space for whatever needs to emerge
- Trust the process
- Insight and connection over assignments
- Let the conversation go where it needs to go
EOF
;;
esac
}
generate_tone_modifier() {
case $PERSONA in
warm-supportive)
echo "Can shift to casual/informal for rapport; tends toward softer, more nurturing language; prioritizes safety and validation before challenge."
;;
direct-challenging)
echo "Direct without being harsh; will push back and name patterns; uses Socratic questioning; treats the person as capable of handling honest feedback."
;;
coach)
echo "Action-oriented and goal-focused; celebrates wins and builds momentum; less processing, more problem-solving; provides accountability for commitments."
;;
esac
}
assemble_claude_md() {
print_step "Assembling your personalized CLAUDE.md..."
local output_file="$1/CLAUDE.md"
local template="$SCRIPT_DIR/CLAUDE.template.md"
# Read template
local content
content=$(cat "$template")
# Replace therapist name
content="${content//\{\{THERAPIST_NAME\}\}/$THERAPIST_NAME}"
# Replace therapy directory
content="${content//\{\{THERAPY_DIR\}\}/$THERAPY_DIR}"
# Generate and replace tone modifier
local tone_modifier
tone_modifier=$(generate_tone_modifier)
content="${content//\{\{TONE_MODIFIER\}\}/$tone_modifier}"
# Read and insert persona content
local persona_file="$SCRIPT_DIR/personas/${PERSONA}.md"
if [ -f "$persona_file" ]; then
local persona_desc
local persona_style
# Extract description (between first ## and second ##)
persona_desc=$(awk '/^## Persona Description/,/^## Communication Style/' "$persona_file" | grep -v "^##" | head -20)
# Extract style section
persona_style=$(awk '/^## Communication Style/,/^## (Challenge Style|Session Structure|Tone Modifier|When to Shift)/' "$persona_file" | grep -v "^##")
content="${content//\{\{PERSONA_DESCRIPTION\}\}/$persona_desc}"
content="${content//\{\{PERSONA_STYLE\}\}/$persona_style}"
fi
# Read and combine modality content
local modality_content=""
for mod in "${MODALITIES[@]}"; do
local mod_file="$SCRIPT_DIR/modalities/${mod}.md"
if [ -f "$mod_file" ]; then
modality_content+=$(cat "$mod_file")
modality_content+=$'\n\n---\n\n'
fi
done
content="${content//\{\{MODALITY_CONTENT\}\}/$modality_content}"
# Generate session structure content
local session_content
session_content=$(generate_session_structure_content)
content="${content//\{\{SESSION_STRUCTURE\}\}/$session_content}"
# Focus areas - leave as placeholder for user to fill
local focus_placeholder="*Add your focus areas here as you begin working together.*
Example areas:
- Anxiety management
- Relationship patterns
- Work stress
- Self-esteem
- Life transitions"
content="${content//\{\{FOCUS_AREAS\}\}/$focus_placeholder}"
# Write the file
echo "$content" > "$output_file"
print_success "Created CLAUDE.md"
}
create_directory_structure() {
local base_dir="$1"
print_step "Creating directory structure..."
mkdir -p "$base_dir/sessions"
# Copy profile template
cp "$SCRIPT_DIR/profile.template.md" "$base_dir/profile.md"
print_success "Created profile.md"
# Create .gitignore
cat > "$base_dir/.gitignore" << 'EOF'
# Sensitive therapy data - never commit
profile.md
sessions/
# Environment files
.env
.env.local
# macOS
.DS_Store
# Encrypted vault files (if using encryption)
*.sparsebundle
EOF
print_success "Created .gitignore"
# Create sessions README
cat > "$base_dir/sessions/.gitkeep" << 'EOF'
# Sessions Directory
Session notes are stored here automatically.
Each session is saved as YYYY-MM-DD.md
These files contain sensitive information and are excluded from git.
EOF
print_success "Created sessions directory"
}
setup_encryption() {
local base_dir="$1"
print_step "Setting up encrypted vault..."
local vault_path="$HOME/therapy-vault.sparsebundle"
local mount_point="/Volumes/TherapyVault"
echo ""
print_info "Creating encrypted disk image..."
print_info "You'll be prompted to set a password."
echo ""
# Create encrypted sparse bundle
hdiutil create -size 500m -encryption AES-256 -type SPARSEBUNDLE \
-fs "APFS" -volname "TherapyVault" "$vault_path"
# Mount it
hdiutil attach "$vault_path"
# Update therapy dir to mounted volume
THERAPY_DIR="$mount_point"
# Create helper scripts
cat > "$HOME/mount-therapy.command" << EOF
#!/bin/bash
# Double-click to mount your therapy vault
hdiutil attach "$vault_path"
echo "Therapy vault mounted at $mount_point"
echo "Press any key to close..."
read -n 1
EOF
chmod +x "$HOME/mount-therapy.command"
cat > "$HOME/unmount-therapy.command" << EOF
#!/bin/bash
# Double-click to safely unmount your therapy vault
hdiutil detach "$mount_point"
echo "Therapy vault unmounted"
echo "Press any key to close..."
read -n 1
EOF
chmod +x "$HOME/unmount-therapy.command"
print_success "Encrypted vault created at: $vault_path"
print_success "Created mount-therapy.command on Desktop"
print_success "Created unmount-therapy.command on Desktop"
print_warning "Remember your password! It cannot be recovered."
# Move helper scripts to Desktop for easy access
mv "$HOME/mount-therapy.command" "$HOME/Desktop/" 2>/dev/null || true
mv "$HOME/unmount-therapy.command" "$HOME/Desktop/" 2>/dev/null || true
}
#------------------------------------------------------------------------------
# Main Setup Flow
#------------------------------------------------------------------------------
main() {
clear
# Welcome and disclaimers
show_disclaimer
safety_screening
# Configuration
choose_therapist_name
choose_persona
choose_modalities
choose_session_structure
choose_storage_location
choose_encryption
# Setup
print_header "Setting Up Your Therapy Environment"
if $USE_ENCRYPTION; then
setup_encryption "$THERAPY_DIR"
fi
# Create directories (in encrypted vault if enabled)
mkdir -p "$THERAPY_DIR"
create_directory_structure "$THERAPY_DIR"
assemble_claude_md "$THERAPY_DIR"
# Final summary
print_header "Setup Complete!"
echo ""
echo "Your AI therapy environment is ready."
echo ""
echo -e "${BOLD}Location:${NC} $THERAPY_DIR"
echo -e "${BOLD}Therapist:${NC} $THERAPIST_NAME"
echo -e "${BOLD}Style:${NC} $PERSONA"
echo -e "${BOLD}Approaches:${NC} ${MODALITIES[*]}"
echo -e "${BOLD}Structure:${NC} $SESSION_STRUCTURE"
if $USE_ENCRYPTION; then
echo -e "${BOLD}Security:${NC} Encrypted (AES-256)"
else
echo -e "${BOLD}Security:${NC} Standard (local files)"
fi
echo ""
print_header "Getting Started"
echo ""
echo "1. Open Claude Code in your therapy directory:"
echo -e " ${CYAN}cd \"$THERAPY_DIR\" && claude${NC}"
echo ""
echo "2. Start a session by talking to $THERAPIST_NAME"
echo ""
echo "3. End sessions naturally - notes will be saved automatically"
echo ""
if $USE_ENCRYPTION; then
echo -e "${YELLOW}Remember:${NC} Mount your vault before each session using:"
echo " Double-click 'mount-therapy.command' on your Desktop"
echo " Or run: hdiutil attach ~/therapy-vault.sparsebundle"
echo ""
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "If you find this helpful, consider supporting development:"
echo " https://buymeacoffee.com/[YOUR_HANDLE]"
echo " https://gumroad.com/[YOUR_HANDLE]"
echo ""
echo "Take care of yourself. 💚"
echo ""
}
# Run main
main "$@"