This tutorial was AI-generated and is being fleshed out. Content may be incomplete or change.

Session Recovery

Context compaction is inevitable. Sessions end. But the decision graph survives.

The Problem

When you start a new Claude session—or when the context window compacts—Claude loses memory of previous work. Without deciduous, this means:

With deciduous, Claude can query the graph and recover all of this.

The /context Command

At the start of a new session, the user (or Claude) runs /context:

Claude Code Session (New Session)
> /context Let me recover context from the decision graph... deciduous nodes --branch feature/rate-limiting ID Type Title Status Confidence ───────────────────────────────────────────────────────────────────── 47 goal Add rate limiting to API active 90 48 decision Choose rate limiting strategy active 75 49 option Redis-based with sliding window active 80 50 option In-memory with token bucket active 70 51 action Implementing Redis rate limiter active 85 52 outcome Rate limiting working active 95 deciduous edges From To Type Rationale ──────────────────────────────────────────────────────────────── 47 48 leads_to Deciding implementation approach 48 49 leads_to Scales across instances, persistent 48 50 leads_to Simpler, but single-instance only 48 51 chosen Redis already in stack, needs horizontal scaling 51 52 leads_to Implementation verified with tests git log --oneline -5 abc123 feat: add Redis-based rate limiting def456 fix: user validation edge case ... Context Recovered:Current branch: feature/rate-limiting • Goal: Add rate limiting to the API • Decision made: Redis-based sliding window approach • Rationale: Redis already in use, needed to scale horizontally • Rejected: In-memory token bucket (single-instance only) • Status: Implementation complete (commit abc123) The rate limiting feature appears complete. What would you like to work on next?

What Gets Recovered

From the decision graph, Claude can recover:

Information Source
Goals being worked on goal nodes
Decisions made decision nodes + chosen edges
Alternatives rejected option nodes + edge rationales
Why decisions were made Edge rationales (-r)
User's original request -p prompt on goal nodes
Current status outcome nodes + linked commits

Branch-Scoped Context

When working on a feature branch, filter context to that branch:

$ deciduous nodes --branch feature/auth

This shows only decisions relevant to the current feature, reducing noise from other work.

The Recovery Loop

Here's the full session lifecycle:

SESSION START
    │
    ▼
Run /context → Query decision graph
    │
    ▼
Claude reports: goals, decisions, status
    │
    ▼
DO WORK → Log as you go (goals, decisions, actions)
    │
    ▼
BEFORE PUSH → deciduous sync
    │
    ▼
SESSION END → Graph survives
    │
    ▼
(New session starts, repeat)

The graph acts as persistent memory that bridges session boundaries.

Context Mid-Session

You can also run /context mid-session if Claude seems to have lost track:

Mid-Session Context Recovery
> Wait, what were we doing? Run /context Let me check the decision graph... deciduous nodes | head -20 deciduous commands | tail -10 I see we were working on rate limiting. The last action was "Implementing Redis rate limiter" and we completed it with outcome #52. The commit is abc123. Would you like to continue with something else, or is there more to do on rate limiting?

Recovering from Compaction

When context compacts during a long session, the decision graph provides continuity:

What Context Compaction Means

Long Claude sessions may "compact" older messages to make room for new ones. This is normal, but it means Claude loses the detailed reasoning from earlier in the session. The decision graph preserves it.

Even after compaction, Claude can query the graph to recall:

The Audit Step

Part of context recovery includes checking for orphan nodes:

# Find nodes without incoming edges (potential orphans)
$ deciduous edges | cut -d'>' -f2 | sort -u > /tmp/has_parent.txt
$ deciduous nodes | awk '{print $1}' | while read id; do
    grep -q "^$id$" /tmp/has_parent.txt || echo "CHECK: $id"
  done

Root goal nodes are valid orphans. But outcome or action nodes without parents indicate missing connections that should be fixed.