Skip to main content
plugin

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

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add karanb192/claude-code-hooks
/plugin install session-logger@claude-code-hooks
Open on GitHub

What 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.ts and record the file path in the session note.
  • Run git status --short and 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-hooks

Step 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

Similar plugins

All plugins for Agent setup: memory, context, orchestration →

From the same set28

The whole set →
provenance provenance previews your session receipt: test outcomes, tool calls, and lines written by the agent. CX Codex +1 ★ 586repo stars receipts receipts — a skill that displays your personal quality card across sessions: failure rate, edit churn, and tokens per task broken down by model version. Runs silently in the background and surfaces shifts in model performance. CX Codex +1 ★ 586repo stars guard-pack guard-pack is a Claude Code plugin that runs seven guard hooks in one Node process. The first blocking verdict stops the chain. ★ 586repo stars notify-permission notify-permission sends Slack cards when Claude Code waits for permissions or user input, freeing you from watching long-running terminal tasks. ★ 586repo stars format-code format-code — a PostToolUse hook that formats each file right after Claude writes or edits it: ruff for Python, prettier for JS, TS, JSON, MD, YAML and HTML. ★ 586repo stars auto-stage auto-stage stages modified files in Git automatically whenever Claude Code writes or edits them, keeping pre-commit reviews clean without manual git add calls. ★ 586repo stars config-watch config-watch makes every mid-session change to settings or skills visible in the session, or blocks it outright. Aimed at installers and npm scripts that rewrite config while the agent works. ★ 586repo stars subagent-spawn-cap subagent-spawn-cap counts subagent spawns per session: asks at 20, asks again every 10, refuses at 60. Puts back the cap Claude dropped in 2.1.224. ★ 586repo stars

Project sponsors

Companies that keep this analytics open