Skip to content

Instantly share code, notes, and snippets.

@bonus414
Created March 23, 2026 16:55
Show Gist options
  • Select an option

  • Save bonus414/f553986fd4bf5c29ef51dd30167a127c to your computer and use it in GitHub Desktop.

Select an option

Save bonus414/f553986fd4bf5c29ef51dd30167a127c to your computer and use it in GitHub Desktop.
Session logs for AI coding sessions — save context between Claude Code, OpenCode, Cursor, or any AI terminal

Session log prompt

Paste this at the end of an AI coding session to generate a narrative summary of what happened.

Works in Claude Code, OpenCode, Cursor, Windsurf, or any AI coding terminal that can write files.


Review this entire session and write a narrative summary of what happened.
Save it as a markdown file in session-logs/ with this format:

Filename: YYYY-MM-DD_HHMM_brief_description.md

Structure:

# [Descriptive title of the session]

**Date:** YYYY-MM-DD HH:MM

## What happened

[Write 300-600 words of narrative prose — not bullet points. Tell the story of
the session: what we set out to do, what we ran into, how we worked through it,
where we ended up. Include specifics: file names, error messages, tool names,
anything that helps someone pick up where we left off.

Capture the flow, not just the outputs. What did we try first? What didn't work?
What was the key insight? What trade-offs did we make and why?]

## Decisions made

- Decision and the reasoning behind it
- Another decision and why we chose it

## What's still open

- Thing that needs to happen next
- Thing we punted on and why
- Loose thread worth remembering

## Artifacts

- Files created or significantly modified (with paths)
- Config changes, deployments, anything that changed state

Guidelines:
- Be specific. Names, paths, versions, error messages. Vague logs are useless.
- The "What happened" section is the most important part.
- "Decisions made" should always include the WHY, not just the WHAT.
- Create the session-logs/ directory if it doesn't exist.

Session logs for AI coding sessions

Context dies between AI coding sessions. You spend two hours building something with an AI coding assistant, close the terminal, and tomorrow's session starts from zero. The AI doesn't remember what you decided, what you tried, or why you made that trade-off.

Session logs fix this. At the end of a work session, paste the prompt from session-log-prompt.md and the AI writes a narrative summary of what happened. The logs accumulate in session-logs/ as plain markdown, and future sessions can read them to pick up where you left off.

How to use it

Simplest version: copy the prompt and paste it into your terminal when you're done working.

To wire it in permanently:

  • Claude Code — Save as .claude/commands/session-log.md, then run /session-log
  • OpenCode — Add as a custom command in .opencode/commands/
  • Cursor / Windsurf — Add to your rules file so the AI knows the format
  • Anything else — Just paste the prompt. It works anywhere the AI can write files.

Making them searchable

grep -r "auth" session-logs/ gets you surprisingly far.

For something better, build a SQLite FTS5 index over the directory — full-text search with snippets in about 40 lines of code. But start with grep. The logs are just markdown files.


By Lauren Morris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment