agentleFS
valperevalpere/session-indexer/.claude/skills/session-end/SKILL.md

session-end

Skill42 starsChanged 5 months agoApache-2.0View on GitHub

Manages .claude/session-log.md — a per-project rolling log of session summaries, one entry per day, last 10 days kept. Review the current conversation and write today's entry to .claude/session-log.md. Use this before switching projects or closing Claude Code. The Stop hook (if configured) auto-generates a summary on exit, but /session-end produces better output — full session context, not transcript extraction. If an entry for today already exists it is replaced, not duplicated. After write, the log is rotated to keep the…

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If an entry for today already exists it is replaced, not duplicated.

    line 22
  2. Distinctive:

    After write, the log is rotated to keep the last 10 day-entries.

    line 23

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “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-end

Manages .claude/session-log.md — a per-project rolling log of session summaries, one entry per day, last 10 days kept.

/session-end          → write today's summary (manual, high quality)
/session-end show     → print the last entry
/session-end all      → print all entries (oldest → newest)

/session-end (no args) — write today's summary

Review the current conversation and write today's entry to .claude/session-log.md. Use this before switching projects or closing Claude Code. The Stop hook (if configured) auto-generates a summary on exit, but /session-end produces better output — full session context, not transcript extraction.

If an entry for today already exists it is replaced, not duplicated. After write, the log is rotated to keep the last 10 day-entries.

Entry format

## YYYY-MM-DD

### Що зробили
- completed item

### Поточний стан
- current branch / open PR number
- what is working / what is broken

### Відкриті питання
- unresolved question (omit section if none)

### Наступні кроки
- next item, in priority order

Rules: 10–20 bullets total · Ukrainian for content · English for code/files/identifiers · include PR number and branch in Поточний стан · omit Відкриті питання if none.

Write logic

Build the entry text (starting with ## YYYY-MM-DD, following the format above), then call the shared rotation helper — same one used by the session-end.sh Stop hook, so both paths behave identically:

source .claude/hooks/_lib/hook-common.sh

ENTRY="## $(date '+%Y-%m-%d')

### Що зробили
- ...

### Поточний стан
- ...

### Наступні кроки
- ..."

hook_rotate_log .claude/session-log.md "$ENTRY"

After writing, report:

"Session log updated — .claude/session-log.md, entry for {today}."


/session-end show — print last entry

source .claude/hooks/_lib/hook-common.sh

if [[ ! -f .claude/session-log.md ]]; then
  echo 'No session log found. Run `/session-end` to create one.'
else
  hook_read_log_entries .claude/session-log.md
  if (( ${#LOG_ENTRIES[@]} > 0 )); then
    printf '%s\n' "${LOG_ENTRIES[-1]}"
  else
    echo '(no entries)'
  fi
fi

/session-end all — print all entries

source .claude/hooks/_lib/hook-common.sh

if [[ ! -f .claude/session-log.md ]]; then
  echo 'No session log found.'
else
  hook_read_log_entries .claude/session-log.md
  for entry in "${LOG_ENTRIES[@]}"; do
    printf '%s\n\n' "$entry"
  done
  if (( ${#LOG_ENTRIES[@]} > 0 )); then
    first_date=$(head -1 <<< "${LOG_ENTRIES[0]}" | sed 's/^## //')
    last_date=$(head -1 <<< "${LOG_ENTRIES[-1]}" | sed 's/^## //')
    echo "${#LOG_ENTRIES[@]} entries: $first_date → $last_date"
  fi
fi

How the full system works

Session ends (exit / /exit)
  └─ Stop hook: .claude/hooks/session-end.sh   (configured ✓)
       ├─ Skip if /session-end ran within 2h (file mtime check)
       ├─ Try agy -p  — Gemini 3.5 Flash (Low → Medium → High), Gemini 3.1 Pro (Low → High)
       ├─ Try opencode run --format json  — ollama/glm-5.2:cloud, kimi-k2.7-code:cloud,
       │                                    minimax-m3:cloud, qwen3.5:cloud
       └─ Fallback: raw transcript excerpt

Next session opens
  └─ SessionStart hook: .claude/hooks/session-last.sh   (configured ✓)
       ├─ Reads last ## YYYY-MM-DD entry from session-log.md
       ├─ Skips if entry is >30 days old
       └─ Injects as additionalContext: "Previous session context (Xd Yh ago): ..."

LLM fallback chain (Stop hook):

  1. agy — Gemini 3.5 Flash (cheapest first), Gemini 3.1 Pro
  2. opencode — glm-5.2:cloud, kimi-k2.7-code:cloud, minimax-m3:cloud, qwen3.5:cloud
  3. Raw transcript excerpt (fallback)

The skill works standalone (without hooks) — you just run /session-end manually. The hooks add automation.

Log file: .claude/session-log.md (gitignored ✓)

Troubleshooting (if hooks misbehave):

tail -30 ~/.cache/session-indexer/hooks.log
cat .claude/session-log.md

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.