Skip to content

Implement session:start command - AI-powered session initialization #61

@jordanpartridge

Description

@jordanpartridge

Overview

Create session:start command that provides intelligent, interactive context when starting a new Claude Code session.

The Smart Hook Experience

User starts Claude Code → Hook displays full context + AI analysis + interactive options

Example Output:

╔══════════════════════════════════════════════════════════════════════════════╗
║                      🚀 Session Start - knowledge                            ║
╚══════════════════════════════════════════════════════════════════════════════╝

📍 Current Context
  Project: knowledge
  Branch: feature/61-session-start
  Last Session: 2 hours ago

✅ Recent Milestones (Last 7 Days)
  • PR #47 merged - Bidirectional sync
  • 100% test coverage on sync commands

🚧 Active Blockers
  ⚠️  ChromaDB v2 API migration (3 days old)
  ⚠️  Session hooks storage inconsistent

📋 Recent Decisions
  • Keep both endpoints vs choosing one
  • Use Laravel type system for coverage

💬 Recent User Intents (Last 10)
  1. Deploy agent teams for new commands
  2. Make startup hook intelligent
  [... 8 more]

🎯 AI Analysis (Ollama)
  Strong momentum on knowledge improvements. ChromaDB blocker 3 days old
  preventing semantic search. Recommend: Deploy agents (quick wins) or
  tackle ChromaDB (foundational).

❓ What would you like to work on?

  1. 🎯 Deploy agent teams for new commands (HIGH MOMENTUM)
  2. 🔧 Continue ChromaDB v2 migration (BLOCKER REMOVAL)
  3. 📊 Review and update recent work
  4. 🆕 Something else

Your choice [1-4]: _

Acceptance Criteria

Context Display

  • Shows current project/branch/last session time
  • Shows recent milestones (last 7 days, ✅ emoji)
  • Shows active blockers (with age, ⚠️ emoji, last attempt info)
  • Shows recent decisions (last 7 days, 📋 emoji)
  • Shows recent user intents (last 10, 💬 emoji)

AI Analysis

  • Optional --ai flag integrates local LLM (Ollama/LM Studio)
  • AI synthesizes patterns from context
  • AI provides recommendations with reasoning
  • Falls back to rule-based suggestions if no AI

Interactive Options

  • Presents 3-4 smart options based on context
  • Each option shows: emoji, title, description, estimated impact
  • Options prioritized by: blockers > momentum > maintenance
  • "Something else" option always available
  • User selection persists to session context

Technical Requirements

  • 100% test coverage
  • Passes PHPStan level 8
  • Passes Laravel Pint
  • PR must pass Sentinel Gate to auto-merge
  • Uses SessionService for session queries
  • Uses Entry model for knowledge queries
  • Integrates with AskUserQuestion pattern for choices

Agent Team Workflow

Agent 1 - Architect:

  • Analyze SessionService, Entry model, user-intent tagging patterns
  • Design context aggregation strategy (milestones/decisions/blockers queries)
  • Design AI integration interface (local LLM via Process/HTTP)
  • Create detailed recommendation for option generation logic

Agent 2 - Test Writer:

  • Define contracts through unit tests (TDD approach)
  • Test context display formatting
  • Test option generation logic
  • Test AI integration (with mocks)
  • Test user choice handling

Agent 3 - Implementer:

  • Implement to pass all unit tests
  • Ensure 100% coverage
  • Pass PHPStan level 8 + Laravel Pint
  • Create PR that passes Sentinel Gate

Data Sources

  • Entry model (tags: user-intent, milestone, blocker, decision)
  • Session model (started_at, ended_at, summary)
  • Git status (Process facade)
  • Local AI (optional, Ollama API)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions