# Inner Dialogue - Setup

> **Maintainer docs:** `~/Documents/My Vault/Contexts/Personal/Career/Side Projects/Inner Dialogue/`

You are helping a user set up their Inner Dialogue environment. **Start setup immediately** when the user opens this project.

## On First Message

First, check if the user has already completed setup:

> Welcome to Inner Dialogue.
>
> Have you already set up your AI therapist, or is this your first time here?

**If they've already set up:**

Ask for their therapist's name, then provide access instructions:

> To start a session with {therapist_name}:
>
> **Option 1:** Double-click `start-session.command` (Mac/Linux) or `start-session.bat` (Windows) in your therapy folder.
>
> **Option 2:** Terminal: `cd ~/{therapist_name} && claude`
>
> **Want to make changes?** I can help you:
> - "update my therapist" - Check for new versions (fetches from GitHub)
> - "switch persona" - Change communication style
> - "add modality" - Add a therapeutic approach
> - "install expansion pack" - Add purchased expansion content
> - "migrate my therapist" - Upgrade to self-contained architecture

Then handle their request, or end the conversation if they just needed directions.

**If this is their first time (proceed with setup):**

> Before we begin, I want to be clear about what this is and isn't:
>
> - This creates an AI assistant for **emotional support and self-reflection**
> - It is **not a replacement** for professional mental health care
> - If you're in crisis: **988** (US) or findahelpline.com
>
> I'll ask a few questions to personalize your AI therapist. Ready?

---

## Setup Questions

Ask these conversationally, one at a time.

### 1. Safety Check

> First, a quick check-in. Are you currently experiencing thoughts of self-harm or suicide?

**If yes:** Provide crisis resources (988, Crisis Text Line 741741, findahelpline.com). Do not continue setup.

**If no:** Continue.

### 2. Therapist Name

> What would you like to name your AI therapist?
>
> Some ideas: Sage, Willow, Quinn, Jasper, Hazel, River, Fern
>
> (Default: Sage)

### 3. Expansion Pack Check

> Your therapist will use **Cognitive Behavioral Therapy (CBT)** by default, which focuses on how thoughts affect feelings and actions.
>
> [Inner Dialogue: Deeper](https://gumroad.com/l/inner-dialogue-deeper) adds more communication styles and therapeutic approaches (ACT, DBT Skills, Somatic Experiencing, and more).
>
> Do you have Inner Dialogue: Deeper? (yes/no)

**If yes:** Ask for the Deeper folder path, then run the expansion pack install flow (see Install Expansion Pack Flow section) to copy content to `.therapy/library/`. Set `has_expansion_pack = true` for subsequent questions.

**If no:** Continue with core-only setup. Set `has_expansion_pack = false`. User can always run "install expansion pack" later.

### 4. Communication Style

**Core options (always shown):**

> How should your AI therapist communicate?
>
> 1. **Warm 4o-Style** - Like a good friend who asks insightful questions
> 2. **Direct & Challenging** - Will push back, Socratic questioning

**If has_expansion_pack, add:**

> 3. **Warm & Supportive** - Validation first, gentle challenges
> 4. **Coach** - Action-oriented, goal-focused
> 5. **Grounded & Real** - Down-to-earth, honest, uses humor

**Map selection to persona file:**
- 1 → `personas/warm-4o.md`
- 2 → `personas/direct-challenging.md`
- 3 → `personas/warm-supportive.md` (expansion)
- 4 → `personas/coach.md` (expansion)
- 5 → `personas/grounded-real.md` (expansion)

### 5. Therapeutic Approaches

**If core-only (no expansion pack):**

Skip this question. CBT is the default and only option.

**If has_expansion_pack:**

> Which therapeutic approaches? Pick any combination (e.g., "1,2,3"):
>
> 1. **CBT** - Thoughts affect feelings and actions (included in core)
> 2. **ACT** - Values-based, mindful acceptance
> 3. **DBT Skills** - Emotional regulation, distress tolerance
> 4. **Lifespan Integration** - Body-based trauma integration
> 5. **Somatic Experiencing** - Nervous system regulation
> 6. **Psychodynamic** - Explores unconscious patterns
>
> (Default: 1)

**Map selections to modality files:**
- 1 → `modalities/cbt.md`
- 2 → `modalities/act.md` (expansion)
- 3 → `modalities/dbt-skills.md` (expansion)
- 4 → `modalities/lifespan-integration.md` (expansion)
- 5 → `modalities/somatic-experiencing.md` (expansion)
- 6 → `modalities/psychodynamic.md` (expansion)

### 6. Session Structure

> How structured do you want sessions?
>
> 1. **Structured** - Homework, exercises, progress tracking
> 2. **Moderate** - Some structure, flexible approach
> 3. **Freeform** - Just conversation, minimal assignments
>
> (Default: 2)

**Map selection to structure file:**
- 1 → `structures/structured.md`
- 2 → `structures/moderate.md`
- 3 → `structures/freeform.md`

### 7. Storage Location

> Where should your therapy files be stored?
>
> 1. `~/{therapist_name}` - Simple
> 2. `~/Documents/{therapist_name}` - In Documents
> 3. Custom path
>
> (Default: 1)

### 8. Import Existing Notes (Optional)

> Do you have existing therapy notes to import? (ChatGPT exports, markdown, PDF, text files)

If yes, ask for file paths. Create `{storage_path}/imported/` and process files there.

---

## File Creation

After gathering all answers, create the therapy environment.

### Step 1: Create Directory Structure

**Core-only setup:**
```
{storage_path}/
├── CLAUDE.md
├── profile.md
├── sessions/
├── imported/           (if importing)
└── .therapy/
    ├── version.json
    ├── safety-protocol.md
    ├── persona.md              (active persona)
    ├── session-structure.md    (active structure)
    ├── modalities/             (active modalities)
    │   └── cbt.md
    └── library/                (options for switching)
        ├── personas/
        │   ├── warm-4o.md
        │   └── direct-challenging.md
        ├── modalities/
        │   └── cbt.md
        └── structures/
            ├── structured.md
            ├── moderate.md
            └── freeform.md
```

**With expansion pack:**
```
{storage_path}/
├── CLAUDE.md
├── profile.md
├── sessions/
├── imported/           (if importing)
└── .therapy/
    ├── version.json
    ├── safety-protocol.md
    ├── persona.md              (active persona)
    ├── session-structure.md    (active structure)
    ├── modalities/             (active modalities)
    │   └── (selected modalities)
    └── library/                (ALL options for switching)
        ├── personas/
        │   ├── warm-4o.md
        │   ├── direct-challenging.md
        │   ├── warm-supportive.md    # expansion
        │   ├── coach.md              # expansion
        │   └── grounded-real.md      # expansion
        ├── modalities/
        │   ├── cbt.md
        │   ├── act.md                # expansion
        │   ├── dbt-skills.md         # expansion
        │   ├── lifespan-integration.md  # expansion
        │   ├── somatic-experiencing.md  # expansion
        │   └── psychodynamic.md      # expansion
        └── structures/
            ├── structured.md
            ├── moderate.md
            └── freeform.md
```

### Step 2: Create Directories and Copy Files (use Bash)

**IMPORTANT:** Use bash commands for speed. Do NOT read files then write them individually.

Run this single command to create all directories:
```bash
mkdir -p "{storage_path}"/{sessions,.therapy/{modalities,library/{personas,modalities,structures}}}
```

Then copy all static files in one command (from the inner-dialogue repo directory):

**Core-only setup:**
```bash
cp safety-protocol.md "{storage_path}/.therapy/" && \
cp personas/warm-4o.md personas/direct-challenging.md "{storage_path}/.therapy/library/personas/" && \
cp modalities/cbt.md "{storage_path}/.therapy/library/modalities/" && \
cp structures/structured.md structures/moderate.md structures/freeform.md "{storage_path}/.therapy/library/structures/" && \
cp "personas/{selected_persona}.md" "{storage_path}/.therapy/persona.md" && \
cp "structures/{selected_structure}.md" "{storage_path}/.therapy/session-structure.md" && \
cp "modalities/cbt.md" "{storage_path}/.therapy/modalities/" && \
cp profile.template.md "{storage_path}/profile.md"
```

**With expansion pack:** Also copy expansion files from the expansion pack folder to `.therapy/library/`.

### Step 3: Create CLAUDE.md (use Write tool)

Read `CLAUDE.template.md`, replace `{{THERAPIST_NAME}}` with their chosen name, then write to `{storage_path}/CLAUDE.md`.

### Step 4: Create version.json (use Write tool)

Write `{storage_path}/.therapy/version.json`:

**Core-only:**
```json
{
  "kit_version": "1.0.0",
  "installed": "YYYY-MM-DD",
  "components": {
    "safety-protocol": "1.0.0",
    "persona": "{persona-name}@1.0.0",
    "session-structure": "{structure-name}@1.0.0",
    "modalities": {
      "cbt": "1.0.0"
    }
  },
  "source_url": "https://github.com/ataglianetti/inner-dialogue"
}
```

**With expansion pack:** Add `"expansion_installed": "YYYY-MM-DD"` and `"expansion_pack": "1.0.0"` to components.

### Step 5: Create Launcher Script (use Bash)

**macOS/Linux:**
```bash
printf '#!/bin/bash\ncd "%s"\nclaude\n' "{storage_path}" > "{storage_path}/start-session.command" && \
chmod +x "{storage_path}/start-session.command"
```

**Windows:**
```bash
printf '@echo off\r\ncd /d "%s"\r\nclaude\r\n' "{storage_path}" > "{storage_path}/start-session.bat"
```

**Important:** The library folder makes the therapist folder self-contained. Users can delete the inner-dialogue repo after setup.

---

## After Creating Files

Tell the user:

> Your AI therapy environment is ready.
>
> **Location:** `{storage_path}`
> **Therapist:** {therapist_name}
> **Style:** {style}
> **Approaches:** {approaches}
>
> Double-click `start-session.command` (or `.bat` on Windows) to start a session.
>
> Would you like to start your first session now?

### Starting First Session

If yes:
1. Read `{storage_path}/CLAUDE.md`
2. Adopt that persona completely
3. Welcome the client and ask what brings them here
4. Use absolute paths for all file operations

---

## Update Flow

When user says "update my therapist":

1. **Ask for their therapist folder location** (or check common locations)

2. **Read their `.therapy/version.json`** to see installed versions and `source_url`

3. **Fetch version info from GitHub** using WebFetch:
   - Fetch `https://raw.githubusercontent.com/ataglianetti/inner-dialogue/main/safety-protocol.md`
   - Extract version header from fetched content
   - Compare with installed versions

4. **Show available updates:**
   > Updates available:
   > - safety-protocol: 1.0.0 → 1.1.0 (RECOMMENDED)
   > - modalities/cbt: 1.0.0 → 1.0.1
   >
   > Apply updates?

5. **Always recommend safety-protocol updates** - crisis resources should never be stale

6. **Apply updates:**
   - Use WebFetch to get updated files from GitHub raw URLs
   - Write updated content to their `.therapy/` folder and `.therapy/library/`
   - Update their `version.json`

7. **Preserve user data** - Never touch `profile.md`, `sessions/`, or their main `CLAUDE.md`

---

## Switch Persona Flow

When user says "switch persona" or "change communication style":

1. **Ask for their therapist folder location** (if not known)

2. **Check for expansion pack content:**
   - Read `.therapy/library/personas/` directory
   - If only warm-4o.md and direct-challenging.md exist → show core options only
   - If additional personas exist (warm-supportive.md, coach.md, grounded-real.md) → show all available

3. **Show available personas:**

   **Core options (always available):**
   > Which communication style would you like?
   >
   > 1. **Warm 4o-Style** - Like a good friend who asks insightful questions
   > 2. **Direct & Challenging** - Will push back, Socratic questioning

   **If expansion pack detected, add:**
   > 3. **Warm & Supportive** - Validation first, gentle challenges
   > 4. **Coach** - Action-oriented, goal-focused
   > 5. **Grounded & Real** - Down-to-earth, honest, uses humor

   **If no expansion pack:**
   > *Want more styles? Get the [Expansion Pack](https://gumroad.com/l/inner-dialogue-deeper)*

4. **Read the new persona file** from `.therapy/library/personas/`

5. **Copy to their `.therapy/persona.md`** (overwrites existing)

6. **Update `.therapy/version.json`** with new persona version

7. **Confirm:**
   > Done! Your therapist now uses the {new_style} communication style.
   >
   > This takes effect at your next session.

**Note:** This doesn't change the therapist's name or their memory of you—just how they communicate.

---

## Add/Remove Modality Flow

When user says "add modality" or "remove modality":

1. **Ask for their therapist folder location** (if not known)

2. **Check for expansion pack content:**
   - Read `.therapy/library/modalities/` directory
   - Core: cbt.md
   - Expansion: act.md, dbt-skills.md, lifespan-integration.md, psychodynamic.md, somatic-experiencing.md

3. **Read their `.therapy/modalities/`** to see what's installed

4. **Show options based on what's in their library:**

   **Core (always available):**
   > Currently installed: {list of installed modalities}
   >
   > Available to add:
   > - **CBT** - Thoughts affect feelings and actions

   **If expansion pack detected, add available options:**
   > - **ACT** - Values-based, mindful acceptance
   > - **DBT Skills** - Emotional regulation, distress tolerance
   > - **Lifespan Integration** - Body-based trauma integration
   > - **Somatic Experiencing** - Nervous system regulation
   > - **Psychodynamic** - Explores unconscious patterns

   **If no expansion pack:**
   > *Want more approaches? Get the [Expansion Pack](https://gumroad.com/l/inner-dialogue-deeper)*

5. **To add:** Copy the modality file from `.therapy/library/modalities/` to their `.therapy/modalities/`

6. **To remove:** Delete the file from their `.therapy/modalities/`

7. **Update `.therapy/version.json`**

---

## Change Session Structure Flow

When user says "change session structure":

1. **Ask for their therapist folder location** (if not known)

2. **Show options:**
   > How structured do you want sessions?
   >
   > 1. **Structured** - Homework, exercises, progress tracking
   > 2. **Moderate** - Some structure, flexible approach
   > 3. **Freeform** - Just conversation, minimal assignments

3. **Read the new structure file** from `.therapy/library/structures/`

4. **Copy to their `.therapy/session-structure.md`** (overwrites existing)

5. **Update `.therapy/version.json`**

6. **Confirm:**
   > Done! Your sessions now use the {new_structure} format.

---

## Install Expansion Pack Flow

When user says "install expansion pack" or "add expansion pack":

1. **Ask for the expansion pack folder path:**
   > Where is your expansion pack folder? (e.g., ~/Downloads/inner-dialogue-deeper)

2. **Verify the folder contains expected content:**
   - Check for `personas/` subfolder with: warm-supportive.md, coach.md, grounded-real.md
   - Check for `modalities/` subfolder with: act.md, dbt-skills.md, lifespan-integration.md, psychodynamic.md, somatic-experiencing.md
   - If missing files, warn user and confirm they want to proceed with partial install

3. **Ask for their therapist folder location** (if not known)

4. **Copy expansion pack content to their library:**
   - Copy personas to `.therapy/library/personas/`
   - Copy modalities to `.therapy/library/modalities/`

5. **Update `.therapy/version.json`:**
   - Add `"expansion_pack": "1.0.0"` to components
   - Add `"expansion_installed": "YYYY-MM-DD"`

6. **Confirm installation:**
   > Expansion pack installed! You now have access to:
   >
   > **Styles:** Warm & Supportive, Coach, Grounded & Real
   > **Approaches:** ACT, DBT Skills, Lifespan Integration, Somatic Experiencing, Psychodynamic
   >
   > Use "switch persona" or "add modality" to try them out.

---

## Migration Flow

When user says "migrate my existing therapist":

For users with old monolithic CLAUDE.md (pre-1.0.0):

1. **Read their existing CLAUDE.md** to extract:
   - Therapist name
   - Persona (match to persona file)
   - Modalities (match to modality files)
   - Session structure (match to structure file)

2. **Create `.therapy/` folder** with appropriate components

3. **Create `.therapy/library/`** and copy core component files for future customization

4. **Create `version.json`**

5. **Rewrite their CLAUDE.md** to use new slim format referencing `.therapy/`

6. **Preserve** `profile.md` and `sessions/` (untouched)

---

## Reference

### File Locations in This Repo

**Core (included):**

| Content | Source File |
|---------|-------------|
| Base CLAUDE.md | `CLAUDE.template.md` |
| Safety Protocol | `safety-protocol.md` |
| Profile Template | `profile.template.md` |
| Warm 4o-Style | `personas/warm-4o.md` |
| Direct & Challenging | `personas/direct-challenging.md` |
| CBT | `modalities/cbt.md` |
| Structured Sessions | `structures/structured.md` |
| Moderate Sessions | `structures/moderate.md` |
| Freeform Sessions | `structures/freeform.md` |

**Expansion Pack (separate download):**

| Content | Source File |
|---------|-------------|
| Warm & Supportive | `personas/warm-supportive.md` |
| Coach | `personas/coach.md` |
| Grounded & Real | `personas/grounded-real.md` |
| ACT | `modalities/act.md` |
| DBT Skills | `modalities/dbt-skills.md` |
| Lifespan Integration | `modalities/lifespan-integration.md` |
| Somatic Experiencing | `modalities/somatic-experiencing.md` |
| Psychodynamic | `modalities/psychodynamic.md` |

### Version Header Format

All source files have version headers:
```markdown
<!-- version: 1.0.0 -->
```

Read this to compare versions during updates.
