agentleFS
EnakoneschniyEnakoneschniy/claude-dev-stack/skills/session-manager/SKILL.md

session-manager

Skill5 starsChanged 8 months agoMITView on GitHub

Fallback for manual session logging when auto-capture is disabled or fails, plus explicit resume/handoff/status requests. Auto-capture via hooks/session-end-capture.mjs is the primary Stop-time path — this skill is a safety net. Triggers on end-of-session signals ("done", "end", "всё", "хватит", "finish", "конец") and resume-intent requests ("resume", "продолжи", "что делали", "handoff", "what did we do").

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. bivex/hu-claude★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create session log and update context.

    line 60
  2. Distinctive:

    After session log and context.md are updated, auto-ADR capture runs (Phase 26 — D-04).

    line 124
  3. Very specific:

    After the /end bash block runs, $ADR_RESULT contains a JSON summary of ADRs created or superseded during the session.

    line 173
  4. Very specific:

    If newAdrs or superseded is non-empty: Session logged.

    line 175
  5. Very specific:

    If both empty: Session logged.

    line 176
  6. Very specific:

    If error is non-null: Session logged.

    line 177
  7. Distinctive:

    Never block /end on ADR capture.

    line 179
  8. Distinctive:

    When an architectural decision is made during the session:

    line 186
  9. Distinctive:

    Always use /end at session end — future you will thank you

    line 216

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Session Manager Skill

Context is loaded at SessionStart by hooks/session-start-context.sh. This skill only handles end-of-session logging (/end) and explicit resume requests (/resume).

Manage development session lifecycle for multi-project work. Eliminates Claude Code "amnesia" by maintaining session logs and project context in an Obsidian vault.

Vault Location

Default: ~/vault/ Override with env var: VAULT_PATH

Commands

/resume

Explicit re-load of project context. The SessionStart hook (hooks/session-start-context.sh) already loads context at session start — use this command only to force a re-read mid-session (e.g., after manually editing context.md or after switching projects).

VAULT="${VAULT_PATH:-$HOME/vault}"
PROJECT_NAME=$(basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")
PROJECT_DIR="$VAULT/projects/$PROJECT_NAME"
CURRENT_DIR=$(git rev-parse --show-toplevel 2>/dev/null || pwd)

# SSR-01: if the SessionStart hook already loaded context <60 min ago,
# skip redundant cat — context is already in the model's prompt.
MARKER="$CURRENT_DIR/.claude/.session-loaded"
if [ -f "$MARKER" ]; then
  NOW=$(date +%s)
  MTIME=$(stat -f %m "$MARKER" 2>/dev/null || stat -c %Y "$MARKER" 2>/dev/null || echo 0)
  AGE=$(( NOW - MTIME ))
  if [ "$AGE" -lt 3600 ] && [ "$AGE" -ge 0 ]; then
    echo "📋 Context pre-loaded at $(cat "$MARKER" 2>/dev/null) by SessionStart hook — skipping redundant cat."
    return 0 2>/dev/null || exit 0
  fi
fi

cat "$PROJECT_DIR/context.md" 2>/dev/null || echo "No context.md found for $PROJECT_NAME"

# Last 3 session logs
for f in $(ls -t "$PROJECT_DIR/sessions/"*.md 2>/dev/null | head -3); do
  echo "=== $(basename "$f") ==="
  cat "$f"
  echo ""
done

/end or /done

Create session log and update context.

PROJECT_NAME=$(basename $(git rev-parse --show-toplevel 2>/dev/null || pwd))
VAULT=${VAULT_PATH:-~/vault}
PROJECT_DIR="$VAULT/projects/$PROJECT_NAME"
SESSION_FILE="$PROJECT_DIR/sessions/$(date +%Y-%m-%d)-SESSION_SLUG.md"

# Create session log
cat > "$SESSION_FILE" << 'EOF'
# Session: DATE — DESCRIPTION

## Что сделано
- (list concrete changes: files modified, features added, bugs fixed)

## Решения
- (architectural decisions made, if any)

## TODO на следующую сессию
- [ ] (specific actionable items)

## Проблемы
- (bugs encountered, workarounds used, tech debt noted)

## Изменённые файлы
- (list key files that were modified)

## Зависимости
- (new packages added, version changes)
EOF

# Update context.md "Session History" section (D-01, D-02)
# Invokes the same Node wrapper the Stop hook uses — idempotent by filename.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" && pwd)"
UPDATER="$REPO_ROOT/hooks/update-context.mjs"
if [ -f "$UPDATER" ]; then
  VAULT_PATH="$VAULT" CDS_PROJECT_NAME="$PROJECT_NAME" \
    node "$UPDATER" "$(basename "$SESSION_FILE")" 2>/dev/null || true
fi

# ── Auto-ADR Capture (Phase 26, ADR-02) ────────────────────────
# Scans the session transcript and writes architectural decisions to vault.
# Fail-open: never blocks /end if the bridge errors.
ADR_BRIDGE="$REPO_ROOT/lib/adr-bridge-session.mjs"
if [ -f "$ADR_BRIDGE" ]; then
  # SESSION_ID may be substituted by Claude from its runtime context.
  # If unset, the bridge falls back to most-recent-mtime JSONL detection.
  ADR_RESULT=$(VAULT_PATH="$VAULT" CDS_PROJECT_NAME="$PROJECT_NAME" \
    node "$ADR_BRIDGE" \
    --session-log "$(basename "$SESSION_FILE")" \
    --cwd "$REPO_ROOT" \
    ${SESSION_ID:+--session-id "$SESSION_ID"} \
    2>/dev/null) || ADR_RESULT='{"newAdrs":[],"superseded":[],"error":"bridge failed"}'
  # ADR_RESULT is valid JSON: {"newAdrs":[...],"superseded":[...],"error":null|string}
  # Claude reads this variable and formats a one-line summary for the user.
  echo "$ADR_RESULT"
fi
# ────────────────────────────────────────────────────────────

Replace SESSION_SLUG with a kebab-case summary (e.g., "fix-auth-flow", "add-telegram-pipeline"). Replace placeholders with actual session data.

After session log and context.md are updated, auto-ADR capture runs (Phase 26 — D-04).

/handoff

Generate a comprehensive handoff document for continuing work in a new session or by another developer.

PROJECT_NAME=$(basename $(git rev-parse --show-toplevel 2>/dev/null || pwd))
VAULT=${VAULT_PATH:-~/vault}

# Generate handoff
echo "# Handoff: $PROJECT_NAME — $(date +%Y-%m-%d)"
echo ""
echo "## Current State"
cat "$VAULT/projects/$PROJECT_NAME/context.md"
echo ""
echo "## Recent Changes (git)"
git log --oneline -10 2>/dev/null
echo ""
echo "## Uncommitted Changes"
git diff --stat 2>/dev/null
echo ""
echo "## Active TODO"
grep -r "TODO" "$VAULT/projects/$PROJECT_NAME/sessions/" 2>/dev/null | tail -20

/status

Quick overview of all projects.

VAULT=${VAULT_PATH:-~/vault}
echo "# Project Status Overview"
echo ""
for dir in "$VAULT/projects"/*/; do
  [ "$(basename $dir)" = "_template" ] && continue
  project=$(basename "$dir")
  last_session=$(ls -t "$dir/sessions/"*.md 2>/dev/null | head -1)
  if [ -n "$last_session" ]; then
    last_date=$(basename "$last_session" | cut -d'-' -f1-3)
    echo "## $project (last: $last_date)"
    grep "^- \[ \]" "$last_session" 2>/dev/null | head -5
  else
    echo "## $project (no sessions yet)"
  fi
  echo ""
done

Auto-ADR Capture (Phase 26 — D-04, D-05)

After the /end bash block runs, $ADR_RESULT contains a JSON summary of ADRs created or superseded during the session. Claude reads this and reports a one-line summary to the user:

  • If newAdrs or superseded is non-empty: Session logged. {N} new ADRs (#NNNN topic, ...). {M} superseded (#NNNN topic, ...).
  • If both empty: Session logged. (stay silent about ADRs)
  • If error is non-null: Session logged. (ADR capture unavailable: {reason})

Never block /end on ADR capture. If the bridge errors, complete the flow silently.

The bridge is lib/adr-bridge-session.mjs in the project repo. It uses Claude Haiku 4.5 via claude -p subprocess to extract decisions from the session transcript and writes them to vault/projects/{project}/decisions/ following the template in D-10.

ADR Creation

When an architectural decision is made during the session:

VAULT=${VAULT_PATH:-~/vault}
PROJECT_NAME=$(basename $(git rev-parse --show-toplevel 2>/dev/null || pwd))
ADR_DIR="$VAULT/projects/$PROJECT_NAME/decisions"
NEXT_NUM=$(printf "%04d" $(($(ls "$ADR_DIR"/*.md 2>/dev/null | wc -l) + 1)))

cat > "$ADR_DIR/${NEXT_NUM}-DECISION_SLUG.md" << 'EOF'
# ADR-NNNN: Title

**Дата**: YYYY-MM-DD
**Статус**: accepted

## Контекст
Why the question arose

## Решение
What we chose

## Альтернативы
What we considered and why we rejected it

## Последствия
What this changes in the project
EOF

Best Practices

  1. Context loads automatically at SessionStart — use /resume only to force a re-read mid-session
  2. Always use /end at session end — future you will thank you
  3. ADRs are cheap to write and expensive to not have
  4. Session logs should be specific: file names, function names, not vague descriptions
  5. TODOs should be actionable: "implement X in file Y" not "finish feature"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.