Skip to content

Microindustry/claude-session-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

claude-session-bridge

Claude Code loses context between sessions. This solves it.

Automatically generates a session resume file every time Claude Code stops. On the next session, Claude reads it first — zero context rebuilding, zero "where were we?".

🇮🇹 Versione italiana disponibile in fondo


The problem

Claude Code has no persistent memory between sessions. Every new conversation starts cold:

  • You re-explain what you're building
  • You re-list open threads
  • You re-state decisions already made
  • Claude re-discovers the codebase

For long-running projects this is expensive — both in tokens and in time.


How it works

Claude Code STOP event
        │
        ▼
generate_resume.py
        │
        ├── Reads STATE.json          (project state, milestone, blockers)
        ├── Reads session_context.json  (active topics, open threads, decisions)
        └── Reads git log --oneline -10  (what actually changed)
        │
        ▼
Writes RESUME.txt

Next session: Claude reads RESUME.txt → starts with full context

The stop hook integrates with Claude Code's hook system (.claude/settings.json):

{
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          { "type": "command", "command": "cmd /c generate_resume.bat" }
        ]
      }
    ]
  }
}

Output example

=== SESSION RESUME #15 — 30/05/2026 ===

WE WERE WORKING ON:
Built NEXUS swarm orchestrator v1.0, RAG graph-aware v5.0,
MCP v1.3. Fixed stop hook .bat wrapper for Git Bash.

OPEN THREADS:
  → WhatsApp bot — API setup pending
  → AgentsView: show Claude→agent consultations
  → GitHub profile update

DECISIONS MADE:
  ✓ NEXUS uses ThreadPoolExecutor for agent parallelism
  ✓ Centralized logging — 34 files updated

NEXT ACTION:
  Weld 4x 200mm gussets on left Z column

BLOCKERS:
  ⚠ Spindle 2.2kW ER20 — to order

Setup

pip install gitpython
  1. Create STATE.json with your project state
  2. Create session_context.json (updated mid-session or via MCP tool)
  3. Add the stop hook to .claude/settings.json
  4. Run python generate_resume.py once to verify

MCP integration (optional)

Includes an MCP tool update_session_context for updating context mid-session without leaving Claude Code:

update_session_context(
    topic="switched to database migration",
    decision="use alembic instead of raw SQL",
    open_thread="test coverage for new schema"
)

Changelog

Version Date Status
v1.0 2026-05-30 ACTIVE — stop hook + MCP tool + STATE+git integration
v0.1 2026-05-28 REPLACED by v1.0 — manual only, no hook

Part of

TITANIUM_OS — personal cognitive OS. Full source: generate_restart_prompt.py + DATA/session_context.json + MCP/titanium_mcp_server.py


Versione italiana

Claude Code perde il contesto tra una sessione e l'altra. Questo lo risolve.

Genera automaticamente un file di ripresa sessione ogni volta che Claude Code si ferma. Alla sessione successiva, Claude lo legge per primo — zero ricostruzione del contesto.

Come funziona: al STOP di Claude Code, lo script legge STATE.json (stato progetto), session_context.json (topic attivi, thread aperti, decisioni prese) e git log recente → genera RESUME.txt.

Integrazione MCP opzionale: tool update_session_context per aggiornare il contesto durante la sessione senza uscire da Claude Code.

Codice sorgente: TITANIUM_OSgenerate_restart_prompt.py + MCP/titanium_mcp_server.py

About

Zero-friction session continuity for Claude Code. Auto-generated context file on every stop.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors