session-end

Mandatory session close-out with IG audit, AAR, and optional HISTORIAN. Enforces clean session handoff.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026⬇️1downloads

When & Why to Use This Skill

The Session-End skill is a comprehensive governance and handoff framework designed to ensure AI agents maintain high code quality and contextual continuity. It automates the transition between development sessions by enforcing mandatory health checks, git state audits, and knowledge preservation protocols. By integrating After Action Reviews (AAR) and RAG (Retrieval-Augmented Generation) updates, it transforms ephemeral session data into persistent, searchable institutional knowledge.

Use Cases

  • Standardized Handoffs: Automatically generating detailed session reports and 'Next Steps' for human collaborators or subsequent AI agent sessions to ensure zero context loss.
  • Governance & Compliance: Enforcing mandatory audit logs (IG audit) and stack health checks to ensure no session closes with failing tests or uncommitted technical debt.
  • Knowledge Base Maintenance: Using the G-Staff integration to update vector databases and documentation (like PATTERNS.md) immediately after work is completed.
  • Continuous Improvement: Conducting automated After Action Reviews (AAR) to capture lessons learned and architectural decisions, improving the agent's performance over time.
namesession-end
descriptionMandatory session close-out with IG audit, AAR, and optional HISTORIAN. Enforces clean session handoff.
model_tiersonnet
can_parallel_with[]
must_serialize_with[startup, startupO]
preferred_batch_size1
max_file_context60
compression_level1
requires_git_contexttrue
requires_db_contextfalse
- pattern"failing.*tests"
reason"Test failures need human review before session close"

Session End Skill

Purpose: Clean session close-out with governance checks Trigger: /session-end or /bye or /done Enforcement: Controlled by .claude/Governance/config.json

Checklist (Required)

1. Stack Health

  • Run ./scripts/stack-health.sh - all services GREEN
  • Run ./scripts/stack-health.sh --full - lint/typecheck clean

2. Work State

  • All changes committed or stashed
  • No failing tests introduced
  • Linters pass (ruff, eslint)

4. Documentation

  • CHANGELOG updated if features added
  • TODOs resolved or documented in HUMAN_TODO.md

5. Governance (if enabled)

Invoke DELEGATION_AUDITOR (IG):

  • Spawn count for session
  • Chain-of-command violations
  • Bypass justifications

Invoke COORD_AAR (After Action Review):

  • What went well
  • What could improve
  • Patterns discovered
  • Lessons learned

Invoke HISTORIAN (if significant session):

  • Major features completed
  • Architectural decisions
  • Notable incidents

4. Knowledge Preservation (G-Staff Integration)

Invoke G4_CONTEXT_MANAGER (RAG/Vector Updates):

  • Index new session artifacts for retrieval
  • Update embeddings for modified documentation
  • Ensure next session has full context access

Invoke KNOWLEDGE_CURATOR (via COORD_OPS):

  • Extract cross-session patterns
  • Update PATTERNS.md, DECISIONS.md
  • Create session handoff documentation

Invoke G4_LIBRARIAN (optional):

  • Archive session transcripts
  • Catalog new skills/agents created
  • Update knowledge graph relationships

Toggle

If governance_enabled: false in config.json:

  • Checklist still shown
  • IG/AAR/HISTORIAN invocation optional
  • No blocking

Quick Exit (Emergency)

/session-end --force

Skips all checks. Logs bypass.

Output Format

================================================================================
                           SESSION END REPORT
================================================================================

## Stack Health
[output of ./scripts/stack-health.sh --full]

## Work Summary
- Commits: [count]
- Files Modified: [count]
- Tests Added/Modified: [count]

## Git Status
[output of git status]

## IG Report (DELEGATION_AUDITOR)
- Total Spawns: [count]
- Chain-of-Command Violations: [count]
- Bypasses: [list with justifications]

## After Action Review (AAR)
### What Went Well
- [item]

### What Could Improve
- [item]

### Patterns Discovered
- [item]

### Lessons Learned
- [item]

## HISTORIAN Entry (if significant)
[Summary for session history]

## Knowledge Preservation (G-Staff)
- G4_CONTEXT_MANAGER: [documents indexed for RAG]
- KNOWLEDGE_CURATOR: [patterns extracted, handoff created]
- G4_LIBRARIAN: [artifacts cataloged] (if invoked)

## Recommendations for Next Session
- [item]

================================================================================
                              SESSION CLOSED
================================================================================

Execution Steps

  1. Stack Health Check

    ./scripts/stack-health.sh --full
    
    • Must be GREEN to proceed
    • YELLOW acceptable with justification
    • RED blocks session end (fix issues first)
  2. Check Git State

    git status
    git diff --stat
    
  3. Run Linters (if not already done by stack-health)

    cd backend && ruff check . --fix
    cd frontend && npm run lint:fix
    
  4. Verify Tests

    cd backend && pytest --tb=no -q
    cd frontend && npm test -- --passWithNoTests
    
  5. Check Governance Config

    cat .claude/Governance/config.json
    
  6. Generate IG Report (if governance enabled)

    • Review session for agent spawns
    • Check for chain-of-command violations
    • Document any bypasses
  7. Conduct AAR (if governance enabled)

    • Reflect on session outcomes
    • Identify improvements
    • Capture patterns and lessons
  8. Update HISTORIAN (if significant session)

    • Write to .claude/History/sessions/
    • Include major decisions and outcomes
  9. Knowledge Preservation (G-Staff)

    • Spawn G4_CONTEXT_MANAGER for RAG/vector updates
    • Spawn KNOWLEDGE_CURATOR for pattern synthesis
    • Optionally spawn G4_LIBRARIAN for archival
  10. Final Handoff

  • Summarize state for next session
  • Note any pending work
  • Verify RAG index updated

Integration with Other Skills

  • startup/startupO: Session-end complements startup for session lifecycle
  • code-review: Can be invoked before session-end for final review
  • pre-pr-checklist: Session-end incorporates similar checks

Aliases

  • /session-end - Full protocol
  • /bye - Alias for /session-end
  • /done - Alias for /session-end
  • /session-end --force - Emergency exit, skips checks
  • /session-end --quick - Minimal checks, no AAR