---
phase: 01-foundation-templates
plan: 02
type: execute
wave: 1
depends_on: []
files_modified:
  - .planning/templates/BOOTLOADER_TEMPLATE.md
  - .planning/templates/SUMMARY_TEMPLATE.md
  - .planning/templates/README.md
autonomous: true

must_haves:
  truths:
    - "User can read BOOTLOADER_TEMPLATE and understand protocol enforcement mechanism"
    - "User can read SUMMARY_TEMPLATE and understand session export format"
    - "User can navigate templates directory and find appropriate template"
    - "Templates directory has clear entry point documentation"
  artifacts:
    - path: ".planning/templates/BOOTLOADER_TEMPLATE.md"
      provides: "Session initialization and sticky note protocol"
      min_lines: 100
      contains: "sticky note template, protocol checklist, agent initialization"
    - path: ".planning/templates/SUMMARY_TEMPLATE.md"
      provides: "Session export format for GTD integration"
      min_lines: 50
      contains: "loops export, context decisions, session metadata"
    - path: ".planning/templates/README.md"
      provides: "Template directory navigation"
      min_lines: 30
      contains: "template purposes, when to use each, workflow overview"
  key_links:
    - from: "BOOTLOADER_TEMPLATE.md"
      to: "sticky note format at response end"
      via: "gsd-status template"
      pattern: "```gsd-status"
    - from: "BOOTLOADER_TEMPLATE.md"
      to: "STATE.md, LOOPS.md, CONTEXT.md"
      via: "artifact references"
      pattern: "@.*/(STATE|LOOPS|CONTEXT)\\.md"
    - from: "SUMMARY_TEMPLATE.md"
      to: "TickTick export format"
      via: "session metadata structure"
      pattern: "session_date|loops_captured|context_decisions"
---

<objective>
Create session management templates (BOOTLOADER, SUMMARY) and directory navigation (README) that complete the template foundation.

Purpose: Enable session initialization (BOOTLOADER enforces protocol), session export (SUMMARY for GTD), and template discovery (README as entry point).

Output: Three templates completing the foundation, enabling full single-session workflow.
</objective>

<execution_context>
@./.claude/get-shit-done/workflows/execute-plan.md
@./.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/01-foundation-templates/01-CONTEXT.md
@.planning/phases/01-foundation-templates/01-RESEARCH.md

# Reference implementation
@gsd_lite/BOOTLOADER_PROMPT.md
@gsd_lite/template_gsd_lite/03_BOOTLOADER_TEMPLATE.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Create BOOTLOADER_TEMPLATE.md with protocol enforcement</name>
  <files>.planning/templates/BOOTLOADER_TEMPLATE.md</files>
  <action>
Create BOOTLOADER template with:

1. **YAML frontmatter**: version, updated date, purpose ("session initialization and protocol enforcement")
2. **Purpose section**: What BOOTLOADER does (initialize session, load artifacts, embed protocol in every response)
3. **Session initialization protocol**:
   - Check for existing STATE.md, LOOPS.md, CONTEXT.md (if exist → resume, if not → create)
   - Set initial context (phase, goals from PROJECT.md/ROADMAP.md)
   - Declare token budget target (default 5000 tokens, adjustable)
4. **Sticky note template** (CRITICAL - this is the protocol enforcement mechanism):
   ```
   ```gsd-status
   📋 UPDATED: [artifact name] ([what changed])

   CURRENT STATE:
   - Phase: [phase/task]
   - Active loops: [count] ([LOOP-IDs])
   - Token budget: [used/total] ([percentage]%)

   AVAILABLE ACTIONS:
   📋 /continue | /pause | /status | /add-loop | /discuss
   [Contextual actions]

   NEXT: [What agent expects from user]
   ```
   ```
5. **Protocol checklist** (agent's self-reminder - embeds in sticky note behavior):
   - After every turn: Update STATE.md with current activity
   - When loop identified: Propose loop in XML → wait for approval
   - When checkpoint reached: Use visual barrier (🛑🛑🛑) → state action required
   - When artifact updated: Show in sticky note UPDATED field
6. **Artifact references**: Where to find STATE, LOOPS, CONTEXT templates (link to .planning/templates/). Add cross-references to LOOPS_TEMPLATE.md, CONTEXT_TEMPLATE.md, STATE_TEMPLATE.md in artifact references section.
7. **MCP vs copy-paste**: Dual instructions:
   - If MCP: Read files directly with tools
   - If copy-paste: Request "Please paste STATE.md contents"
8. **Recovery from drift**: If user says "update artifacts" → read STATE.md, show current state, resume protocol
9. **Educational comments**:
   - WHY sticky note at response end (agent can't dynamically reference long bootloader)
   - WHY protocol checklist (visible compliance, reduces drift)
   - WHY dual instructions (vendor agnostic - works with any agent)
10. **Example session**: Show first 3 agent responses with sticky notes (initialization → task work → loop capture)

Reference RESEARCH.md "Sticky Note Protocol Reminder" pattern.
Reference CONTEXT.md decisions on sticky note format and placement.
Reference gsd_lite/BOOTLOADER_PROMPT.md for tested structure.

CRITICAL: The sticky note template is the core protocol enforcement. Make it copy-pasteable, predictable, parseable.

Do NOT include:
- Template definitions for LOOPS/CONTEXT/STATE (those are in their own files)
- Session handoff between sessions (that's Phase 2)
- Token budget calculation logic (that's in CONTEXT)
  </action>
  <verify>
1. File exists at .planning/templates/BOOTLOADER_TEMPLATE.md
2. Contains sticky note template with ```gsd-status marker
3. Contains protocol checklist (what agent must do after every turn)
4. Contains dual instructions for MCP vs copy-paste workflows
5. Contains recovery protocol ("update artifacts" trigger)
6. Contains example session showing 3 responses with sticky notes
7. grep '```gsd-status' matches sticky note template marker
8. Contains cross-references to LOOPS_TEMPLATE, CONTEXT_TEMPLATE, STATE_TEMPLATE
  </verify>
  <done>
BOOTLOADER_TEMPLATE.md exists with sticky note protocol, checklist for agent compliance, dual workflow support, example session, and cross-references to core templates
  </done>
</task>

<task type="auto">
  <name>Task 2: Create SUMMARY_TEMPLATE.md for session export</name>
  <files>.planning/templates/SUMMARY_TEMPLATE.md</files>
  <action>
Create SUMMARY template with:

1. **YAML frontmatter**: version, updated date, purpose ("session export for GTD integration")
2. **Purpose section**: Why SUMMARY exists (export ephemeral working memory to TickTick, support learning from context decisions)
3. **Structure sections**:
   - **Session metadata**: Date, duration, phase/task worked, token budget peak
   - **Loops captured**: All LOOP-NNN items with status (open/clarifying/closed) and outcome if closed
   - **Context decisions**: What was loaded, what was excluded, why (rationale for future reference)
   - **Artifacts created**: Files written during session
   - **Checkpoints reached**: Decision points, approvals, verifications
   - **Next session prep**: What to load, what context to restore
4. **GTD export format**: TickTick-compatible structure:
   - Closed loops → Achievements
   - Open loops → Next actions (with context)
   - Clarifying loops → Waiting for (with question)
5. **Learning capture**: Section for "What I learned" (context decisions, patterns discovered, mistakes avoided)
6. **Examples**: 2 realistic SUMMARY files:
   - Example 1: dbt refactor session (closed 2 loops, discovered lineage scope pattern, 45% token peak)
   - Example 2: test debugging session (1 loop open, narrowed context from 200 files to 5, root cause identified)
7. **Educational comments**:
   - WHY session metadata (audit trail, velocity tracking)
   - WHY loops export (GTD processing async from session)
   - WHY context decisions (learning what worked, reuse patterns)
   - WHY next session prep (eliminate 15-30 min reconstruction time)

Reference HANDOFF-04 requirement (session summary = loops + context).
Reference PROJECT.md GTD integration section.

Do NOT include:
- How to capture loops during session (that's in LOOPS)
- How to track token budget during session (that's in CONTEXT)
- Cross-session state persistence (that's Phase 2)
  </action>
  <verify>
1. File exists at .planning/templates/SUMMARY_TEMPLATE.md
2. Contains session metadata section
3. Contains loops captured section with open/clarifying/closed status
4. Contains context decisions section
5. Contains GTD export format structure
6. Contains at least 2 example SUMMARY files
7. Contains learning capture section
  </verify>
  <done>
SUMMARY_TEMPLATE.md exists with session export structure, GTD integration format, and learning capture sections
  </done>
</task>

<task type="auto">
  <name>Task 3: Create README.md for template navigation</name>
  <files>.planning/templates/README.md</files>
  <action>
Create README with:

1. **Header**: "Data Engineering Copilot Templates" with brief purpose statement
2. **Quick start**: 3-step workflow:
   - Step 1: Copy BOOTLOADER_TEMPLATE → start session
   - Step 2: Use LOOPS/CONTEXT/STATE during work
   - Step 3: Generate SUMMARY at end
3. **Template index**:
   - **BOOTLOADER_TEMPLATE.md**: Session initialization, protocol enforcement
     When to use: Start of every new session
   - **LOOPS_TEMPLATE.md**: Open questions, parking lot
     When to use: When question arises, when idea needs capture
   - **CONTEXT_TEMPLATE.md**: Token budget management
     When to use: When loading context, when excluding files
   - **STATE_TEMPLATE.md**: Session working memory
     When to use: Continuously updated during session
   - **SUMMARY_TEMPLATE.md**: Session export
     When to use: End of session, before closing
4. **Workflow diagram** (ASCII/markdown):
   ```
   Session Start → BOOTLOADER (initialize)
                    ↓
   During Work   → STATE (track current)
                    ├→ LOOPS (capture questions)
                    └→ CONTEXT (manage budget)
                    ↓
   Session End   → SUMMARY (export to GTD)
   ```
5. **File locations**: Where templates live (.planning/templates/), where session artifacts go (.project/sessions/YYYY-MM-DD-description/)
6. **Phase context**: Templates are Phase 1 foundation, Phase 2 adds session handoff, Phase 3 adds context engineering patterns
7. **Educational note**: Templates teach through use - read inline comments to understand GSD mechanics and data engineering patterns

Reference REQUIREMENTS.md META-01 (heavily commented), META-02 (file-based protocol).
Reference PROJECT.md for project structure decisions.

Do NOT include:
- Full template content (link to files)
- Implementation details (those are in templates themselves)
- Phase 2+ features (session handoff, multi-session state)
  </action>
  <verify>
1. File exists at .planning/templates/README.md
2. Contains quick start 3-step workflow
3. Contains template index with all 5 templates
4. Contains workflow diagram showing template relationships
5. Contains file location guidance
6. Contains phase context (this is Phase 1, more coming)
  </verify>
  <done>
README.md exists as entry point to templates directory with navigation, quick start, and workflow overview
  </done>
</task>

</tasks>

<verification>
After completion, verify:

1. Directory structure: `.planning/templates/` has 6 files (5 templates + README)
2. BOOTLOADER_TEMPLATE.md: Sticky note template copy-pasteable, protocol checklist visible, cross-references to LOOPS/CONTEXT/STATE present
3. SUMMARY_TEMPLATE.md: GTD export format clear, examples from dbt context
4. README.md: All 5 templates listed, workflow diagram present
5. Cross-references: BOOTLOADER links to other templates, README explains relationships
6. Educational value: Each template has inline comments explaining WHY
</verification>

<success_criteria>
Session templates are production-ready when:
- User can start session with BOOTLOADER without external docs
- Agent can follow protocol via sticky note template
- User can export session with SUMMARY to TickTick
- User can navigate templates/ directory via README
- Templates work in both MCP and copy-paste workflows
</success_criteria>

<output>
After completion, create `.planning/phases/01-foundation-templates/01-02-SUMMARY.md`
</output>
