session-logger — Claude Code plugin for session logs
session-logger is a Claude Code plugin that keeps a Markdown record of each session. Its hooks track the repository, touched file paths, and Bash commands.
MIT ★ 586 updated 2026-10-26
/plugin marketplace add karanb192/claude-code-hooks
/plugin install session-logger@claude-code-hooksWhat session-logger does
The plugin creates a note when a session starts, recording its working directory, Git repository, and branch. Hooks then add file paths and Bash commands as tools run; concurrent writes are serialized with a file lock.
Only the first line of each Bash command is logged, with truncation and best-effort masking for common secret patterns. This does not guarantee that every secret is removed. File contents are never stored. Notes go to ~/.claude/sessions by default; CC_SESSION_LOG_DIR can point to another folder. Diagnostics are written under ~/.claude/hooks-logs/. If the terminal exits abruptly, the note may lack an end timestamp.
What it helps with
- keep a record of Claude Code session activity
- find which file paths were read or changed
- recall Bash commands run during a session
- capture Git status when a session ends
Example prompts for the agent
- Start a session and keep its activity in a Markdown log.
- Read
src/app.tsand record the file path in the session note. - Run
git status --shortand finish the session with its final status recorded.
How to install session-logger
Plugin marketplace
/plugin marketplace add karanb192/claude-code-hooks/plugin install session-logger@claude-code-hooksStep by step, with commands for each platform: Claude Code plugins: marketplaces, installing, and building your own
Questions about session-logger
How do I install session-logger in Claude Code?
Run these commands in order: /plugin marketplace add karanb192/claude-code-hooks, then /plugin install session-logger@claude-code-hooks. Restart Claude Code after installation.
What does session-logger do?
It creates a Markdown note for each session and adds file paths and Bash commands as work proceeds. At session end, it records an end timestamp and the final git status --short.
What data does session-logger save?
It records the working directory, Git repository and branch, file paths, and first lines of Bash commands. File contents are excluded; secret masking is best-effort and may not catch every secret.
Source text
session-logger · MIT
# session-logger > Durable markdown log of every Claude Code session: cwd, git repo/branch, files touched, and bash commands run (secret-redacted). Claude Code sessions are ephemeral: you finish one, switch repos, and two days later can't remember which session touched which file. This hook writes a human-readable, greppable (and Obsidian-friendly) note per session. `SessionStart` seeds the note with YAML frontmatter (session id, cwd, git repo/branch, started timestamp); an async `PostToolUse` hook appends every `Edit`/`Write`/`Read`/`Bash` under "Files Touched" / "Commands Run"; `SessionEnd` fills the `ended:` timestamp and captures the final `git status`. Because async invocations can run concurrently (parallel tool calls), every note write goes through a cross-process file lock so appends can't clobber each other. ## Install ``` /plugin marketplace add karanb192/claude-code-hooks # once per machine /plugin install session-logger@claude-code-hooks ``` Restart Claude Code, done. (Or from a shell: `claude plugin install session-logger@claude-code-hooks`.) ## What it does | Event | Runs | What happens | |-------|------|--------------| | SessionStart | sync | Creates the session note (frontmatter + skeleton sections) so PostToolUse has something to append to. On resume, appends a `## Resumed at` marker instead of overwriting. | | PostToolUse (`Edit\|Write\|Bash\|Read`) | async (zero added latency) | Appends the file path (edited/wrote/read) or the bash command (first line only, truncated, secret-redacted) under the right section, serialized via a file lock. | | SessionEnd | sync | Fills the frontmatter `ended:` timestamp and appends a `## Session End` section with the final `git status --short`. Idempotent: a duplicate SessionEnd is a no-op. | It registers against `SessionEnd`, not `Stop`: `Stop` fires at the end of every turn, `SessionEnd` once per session. If the terminal is killed abruptly, the note keeps all activity up to the last tool call, just without a final `ended:` timestamp. ## Configuration All optional, set via environment variables: | Variable | Default | Purpose | |----------|---------|---------| | `CC_SESSION_LOG_DIR` | `~/.claude/sessions` | Where session notes are written. Point it at an Obsidian vault or iCloud folder for cross-device sync. | | `CC_SESSION_BASH_TRUNCATE` | `200` | Max characters logged per bash command (first line only, then truncated). Must be a positive integer; anything else falls back to `200`. | Hook diagnostics (start/append/end/error events) go to `~/.claude/hooks-logs/<YYYY-MM-DD>.jsonl`. ## Data & privacy Records timestamps, cwd, git repo/branch, file paths, and first-line bash commands. File CONTENTS are never logged, only paths. Bash commands run through a best-effort redactor that masks common inline-secret shapes (sensitive env assignments, `--password`/`--token` flags, Bearer tokens, well-known key prefixes like `ghp_`, `xox`, `sk-`, `AKIA`). Best-effort, NOT a guarantee: treat notes as sensitive and keep synced folders (Obsidian/iCloud) private. The script makes no network calls; everything stays on your machine. ## Uninstall ``` /plugin uninstall session-logger@claude-code-hooks ``` Part of [claude-code-hooks](https://github.com/karanb192/claude-code-hooks): production-ready Claude Code hooks, each installable on its own as a plugin.
© Karan Bansal · MIT · karanb192/claude-code-hooks