agent/claude/issues/001-ai-session.md
Snider beb24f71d2 docs: add feature request issues for core CLI migration
12 issue files documenting features needed to replace shell scripts:

Claude Code hooks:
- 001: core ai session (state management)
- 002: core ai context (fact capture)
- 003: core ai hook (command validation)
- 004: core qa debug (debug statement detection)

Data collection:
- 005: core collect github (issues/PRs archive)
- 006: core collect bitcointalk (forum threads)
- 007: core collect market (CMC/CoinGecko)
- 008: core collect papers (whitepapers)
- 009: core collect excavate (project archaeology)
- 010: core collect process (HTML→MD)
- 011: core collect dispatch (event hooks)

000: Overview tracking issue

These will be submitted to host-uk/core when rate limit resets.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 18:49:35 +00:00

1.2 KiB

feat(ai): Add session state management for Claude Code hooks

Summary

Add core ai session subcommands to manage Claude Code session state, replacing shell scripts that currently handle this.

Required Commands

core ai session save              # Save current session state (pre-compact)
core ai session restore           # Restore session state (session-start)
core ai session stats             # Track tool calls, suggest compaction
core ai session clear             # Clear stale session data

Current Shell Scripts Being Replaced

  • claude/scripts/pre-compact.sh - Saves state before auto-compact
  • claude/scripts/session-start.sh - Restores context on startup
  • claude/scripts/suggest-compact.sh - Suggests compaction at intervals

State to Manage

  • Working directory and git branch
  • Git status (modified files)
  • In-progress todos
  • Context facts (decisions, actionables)
  • Tool call counter per session

Storage

State stored in ~/.claude/sessions/:

  • scratchpad.md - Human-readable resume state
  • context.json - Structured context facts
  • stats.json - Session statistics

Output Format

{
  "saved": true,
  "path": "~/.claude/sessions/scratchpad.md",
  "facts": 5,
  "tool_calls": 47
}