"""Templates for Mind files (v2: daemon-free, MCP-driven)."""

SESSION_TEMPLATE = """# Session: {date}

## Experience
<!-- Raw moments, thoughts, what's happening -->

## Blockers

## Rejected
<!-- What didn't work and why -->

## Assumptions
<!-- What I'm assuming true -->

"""

MEMORY_TEMPLATE = """<!-- MIND MEMORY - Append as you work. Write naturally.
Keywords: decided, problem, learned, tried, fixed, blocked, KEY, important
Wikilinks: Use [[MEMORY#L123]] to link to specific lines (Obsidian-compatible)
Sync: To sync across devices, add .mind/ folder to your Obsidian vault -->

# {project_name}

## Project State
- Goal:
- Stack: {stack}
- Blocked: None

## Gotchas
<!-- Project-specific gotchas -->

---

## Session Log

## {date}

(Start writing here)

<!-- End session with: ## DATE | summary of what happened | mood: X -->
---
"""

CONTEXT_TEMPLATE = """## Memory (Mind)

This project uses Mind for persistent memory across sessions.

### Required Protocol

1. **Session Start**: ALWAYS call `mind_recall()` before responding to the first message.

2. **During Work**: Log actively to SESSION.md (ephemeral) and MEMORY.md (permanent):

   **SESSION.md types - USE FREQUENTLY (cleared between sessions):**
   - `mind_log("reading auth module", type="experience")` - What you're doing NOW
   - `mind_log("can't find token validation", type="blocker")` - What's blocking you
   - `mind_log("tried Redis - overkill", type="rejected")` - What didn't work
   - `mind_log("assuming stable internet", type="assumption")` - What you're assuming

   **MEMORY.md types - For important discoveries:**
   - `mind_log("chose X over Y - simpler", type="decision")`
   - `mind_log("Safari needs vendor prefix", type="learning")`
   - `mind_log("API returns 500 on large payloads", type="problem")`
   - `mind_log("resolved by increasing timeout", type="progress")`

### SESSION.md Logging (IMPORTANT)

**Log to SESSION.md frequently as you work.** This prevents loops - repeating failed fixes, forgetting what you tried.

| When | Type | Example |
|------|------|---------|
| Starting a task | `experience` | "investigating login bug" |
| Making an assumption | `assumption` | "assuming user wants client-side validation" |
| Trying an approach | `experience` | "trying Redis for caching" |
| Something didn't work | `rejected` | "Redis too complex for this use case" |
| Getting stuck | `blocker` | "can't find where session is stored" |

**Rule: Log every 2-3 tool calls. If in doubt, log it - SESSION.md clears anyway.**

### Tools Available

- `mind_recall()` - Load context (CALL FIRST!)
- `mind_log(msg, type)` - Log to SESSION.md or MEMORY.md
- `mind_session()` - Check current session state
- `mind_blocker(desc)` - Log blocker + auto-search for solutions
- `mind_search(query)` - Find specific memories
- `mind_remind(msg, when)` - Set reminders

---

<!-- MIND:CONTEXT - Auto-generated by Mind. Do not edit. -->
## Stack
{stack}

## Gotchas
(None yet - add to .mind/MEMORY.md Gotchas section)
<!-- MIND:END -->"""

GITIGNORE_CONTENT = """# Mind files are personal/local - don't commit
*
!.gitignore
"""

REMINDERS_TEMPLATE = """<!-- MIND REMINDERS - Time and context-based reminders
Use mind_remind(message, when) to add reminders.

Time-based: "next session", "tomorrow", "in 3 days", "2025-12-25"
Context-based: "when I mention auth", "when we work on database"

Format: - [ ] message | due: DATE | type: TYPE
Mark done: - [x] message | due: DATE | type: TYPE | done: DATE -->

# Reminders

"""

SELF_IMPROVE_TEMPLATE = """<!-- MIND SELF-IMPROVEMENT - Cross-project patterns about YOU
This file lives in ~/.mind/ and persists across all projects.
It helps Claude remember your patterns, preferences, and blind spots. -->

# Self-Improvement Patterns

## Preferences
<!-- How you like to work: coding style, workflow, communication -->
<!-- Format: PREFERENCE: [category] description -->

## Skills
<!-- What you're good at in specific contexts -->
<!-- Format: SKILL: [stack:context] description -->

## Blind Spots
<!-- Things you consistently miss or forget -->
<!-- Format: BLIND_SPOT: [category] description -->

## Anti-Patterns
<!-- Approaches that don't work for you -->
<!-- Format: ANTI_PATTERN: [category] description -->

## Learning Styles
<!-- How you learn best - extracted from feedback patterns -->
<!-- Format: LEARNING_STYLE: [context] description -->

---

## Feedback Log
<!-- Raw corrections for pattern extraction (3+ occurrences = pattern) -->
<!-- Format: FEEDBACK: [date] context -> correction -->

"""
