Home
cd ../playbooks
Academic ResearchBeginner

Session Logging Protocol

Automatically log design decisions, progress, and context at key moments. Create a searchable history of why things were done, not just what changed.

5 minutes
By communitySource
#logging#documentation#decisions#history#context

Six months from now, you'll wonder why a certain architectural decision was made — but the reasoning died with the session. This playbook automatically logs design decisions, progress milestones, and context at key moments, creating a searchable history of why things were done.

Who it's for: software architects who need to document design decision rationale for future reference, solo developers maintaining long-running projects where context gets lost between sessions, engineering managers building institutional knowledge from development sessions, researchers documenting experimental decisions and methodology evolution, team leads creating audit trails of technical choices for onboarding new members

Example

"Log all architectural decisions from this refactoring session" → Logging protocol: automatic detection of key decision points during development, structured log entries capturing the decision, alternatives considered, and rationale, progress milestones with timestamps and context snapshots, searchable log file organized by topic and date, and cross-session index linking related decisions

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Session Logging Protocol

## Purpose

Session logs answer: "Why did we do it this way?" six months later when no one remembers. They capture reasoning, not just output.

## Logging Triggers

Create a log entry when:
1. **Design decision** — Chose approach A over B
2. **Problem solved** — Fixed non-obvious bug or issue
3. **Session end** — Summary of work done
4. **Context switch** — Before moving to different task

## Log File Structure

```
logs/
├── YYYY-MM-DD-session-N.md    # Daily session logs
├── decisions/
│   └── ADR-NNN-[title].md     # Architecture Decision Records
└── index.md                   # Log index/table of contents
```

## Session Log Format

```markdown
# Session Log: YYYY-MM-DD Session N

## Context
[What were we working on? What state were we starting from?]

## Goals
- [ ] Goal 1
- [ ] Goal 2

## Work Done

### [Time/Phase 1]
[What was done]
[Why we did it this way]
[Alternatives considered]

### [Time/Phase 2]
...

## Decisions Made
- **Decision**: [What we chose]
  - **Why**: [Reasoning]
  - **Alternatives**: [What we didn't choose and why]

## Problems Encountered
- **Problem**: [Issue]
  - **Cause**: [Root cause]
  - **Fix**: [How we solved it]
  - **Learning**: [What to remember]

## Open Questions
- [Question 1]
- [Question 2]

## Next Session
- [What to do next]
- [What to remember]
```

## Decision Record Format

For significant architectural decisions:

```markdown
# ADR-NNN: [Title]

## Status
[Proposed | Accepted | Deprecated | Superseded]

## Context
[What is the situation that requires a decision?]

## Decision
[What is the decision that was made?]

## Consequences
[What are the positive and negative consequences?]

## Alternatives Considered
- [Alternative 1]: [Why rejected]
- [Alternative 2]: [Why rejected]
```

## When to Log (Rules)

**Always log:**
- Anything that took more than 30 minutes to figure out
- Choices between multiple valid approaches
- Non-obvious fixes (root cause wasn't immediately clear)
- Session endings (even if brief)

**Don't log:**
- Trivial changes
- Obvious fixes
- Routine work with no decisions

## Commands

- "Log this session" — Create session log for current work
- "Create decision record for [topic]" — Create ADR
- "Summarize today's work" — End-of-day summary

## Log Quality Standards

Good log entries:
- Explain **why**, not just **what**
- Are searchable (include relevant keywords)
- Can be understood by future-you who forgot everything
- Include alternatives considered, not just choice made

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

This playbook creates structured session logs that capture not just what changed, but why. Unlike git commits (which record changes) or READMEs (which describe current state), session logs document the journey — decisions made, alternatives considered, problems solved.

Prerequisites

  • Claude Code installed and configured
  • A project where you want decision history logs/ ├── YYYY-MM-DD-session-N.md # Daily session logs ├── decisions/ │ └── ADR-NNN-[title].md # Architecture Decision Records └── index.md # Log index/table of contents

## Session Log Format

```markdown
# Session Log: YYYY-MM-DD Session N

## Context
[What were we working on? What state were we starting from?]

## Goals
- [ ] Goal 1
- [ ] Goal 2

## Work Done

### [Time/Phase 1]
[What was done]
[Why we did it this way]
[Alternatives considered]

### [Time/Phase 2]
...

## Decisions Made
- **Decision**: [What we chose]
  - **Why**: [Reasoning]
  - **Alternatives**: [What we didn't choose and why]

## Problems Encountered
- **Problem**: [Issue]
  - **Cause**: [Root cause]
  - **Fix**: [How we solved it]
  - **Learning**: [What to remember]

## Open Questions
- [Question 1]
- [Question 2]

## Next Session
- [What to do next]
- [What to remember]

Decision Record Format

For significant architectural decisions:

# ADR-NNN: [Title]

## Status
[Proposed | Accepted | Deprecated | Superseded]

## Context
[What is the situation that requires a decision?]

## Decision
[What is the decision that was made?]

## Consequences
[What are the positive and negative consequences?]

## Alternatives Considered
- [Alternative 1]: [Why rejected]
- [Alternative 2]: [Why rejected]

When to Log (Rules)

Always log:

  • Anything that took more than 30 minutes to figure out
  • Choices between multiple valid approaches
  • Non-obvious fixes (root cause wasn't immediately clear)
  • Session endings (even if brief)

Don't log:

  • Trivial changes
  • Obvious fixes
  • Routine work with no decisions

Commands

  • "Log this session" — Create session log for current work
  • "Create decision record for [topic]" — Create ADR
  • "Summarize today's work" — End-of-day summary

Log Quality Standards

Good log entries:

  • Explain why, not just what
  • Are searchable (include relevant keywords)
  • Can be understood by future-you who forgot everything
  • Include alternatives considered, not just choice made

## Step-by-Step Setup

### Step 1: Create log structure

```bash
mkdir -p logs/decisions
touch logs/index.md

Step 2: Add to your CLAUDE.md

Add the session logging protocol above to your CLAUDE.md.

Step 3: Create your first log

At the end of your next work session:

Log this session. Include decisions made and problems solved.

Example Usage

User (end of session):

"Log this session"

Claude:

Session Log: 2024-01-15 Session 2

Context

Continuing work on the payment integration. Previous session identified Stripe as payment provider.

Goals

  • Implement checkout flow
  • Handle payment failures
  • Add subscription support (deferred)

Work Done

Checkout Flow Implementation

Implemented /api/checkout endpoint with Stripe Checkout Sessions.

Decision: Server-side vs Client-side Checkout

  • Chose server-side Checkout Sessions over client-side Elements
  • Why: Simpler PCI compliance (no card data touches our servers)
  • Alternative: Elements would give more UI control but require PCI SAQ A-EP

Payment Failure Handling

Added webhook handler for payment_intent.payment_failed events.

Problem Solved: Webhook Signature Verification Failing

  • Issue: All webhooks returning 400
  • Root cause: Using wrong signing secret (test vs live mode)
  • Fix: Added STRIPE_WEBHOOK_SECRET to .env.local
  • Learning: Stripe uses different webhook secrets for test vs live

Decisions Made

  • Webhook endpoint path: /api/webhooks/stripe
    • Why: Keeps all webhook handlers in consistent location
    • Alternatives: /api/stripe/webhook (rejected: inconsistent with other webhooks)

Open Questions

  • How to handle subscription upgrades mid-cycle? Need to research proration.

Next Session

  • Implement subscription creation flow
  • Add customer portal for self-service subscription management

User (design decision):

"Create a decision record for choosing PostgreSQL over MongoDB"

Claude:

ADR-001: PostgreSQL for Primary Database

Status

Accepted

Context

We need a primary database for the application. The data model includes users, orders, products, and reviews with clear relationships. We expect moderate scale (thousands of users) with complex queries (sales reports, user analytics).

Decision

Use PostgreSQL as the primary database.

Consequences

Positive:

  • Strong relational model for our data
  • ACID compliance for order transactions
  • Excellent query optimizer for complex analytics
  • Wide ecosystem (ORMs, hosting, tooling)

Negative:

  • Requires schema migrations for changes
  • Less flexible for unstructured data
  • Horizontal scaling more complex than MongoDB

Alternatives Considered

  • MongoDB: Rejected because our data is clearly relational. Would require denormalization and lose transaction guarantees across documents.

  • MySQL: Viable alternative. Chose Postgres for better JSON support (we have some semi-structured data) and superior analytics query performance.

  • SQLite: Too limited for production multi-user access.

Tips

  • Log decisions when fresh: Do it immediately after deciding, not at end of day when you've forgotten the reasoning.
  • Include the "alternatives considered": This is the most valuable part. Future-you will wonder "why didn't we do X?" having the answer documented is gold.
  • Make logs searchable: Include relevant keywords even if slightly redundant.
  • Review logs periodically: Old logs surface patterns ("we keep hitting this problem").

Troubleshooting

Problem: Logs are too detailed/too brief

Solution: Follow the 3-minute rule. If it takes more than 3 minutes to write, you're over-documenting. If it takes less than 30 seconds, you're probably missing the "why."

Problem: Nobody reads the logs

Solution: Make them useful. When someone asks "why did we do X?", point them to the log. Build the habit of checking logs before making related decisions.

Problem: Logging feels like overhead

Solution: Log at natural breakpoints (end of session, after major decisions). Don't log during flow state. 2-3 minutes at session end is sufficient.

$Related Playbooks

Academic Research

Universal LaTeX Document Generator

Create, compile, and convert any document to a professional PDF with LaTeX — resumes, theses, papers, posters, invoices, fillable forms, mail-merged letters — plus a pipeline for converting handwritten or scanned PDFs into clean LaTeX source.

10 minutes
Intermediate
Academic Research

Quality Gates System

Implement a scoring system (0-100) that blocks commits below threshold. 80+ to commit, 90+ for PR, 95+ for excellence. Prevents shipping subpar work.

5 minutes
Beginner
Academic Research

Verification Before Done

Never report a task as complete without actually verifying it works. Compile, render, test, or check every output before saying 'done'.

5 minutes
Beginner
Academic Research

Academic Rebuttal Writer

Classify reviewer comments, choose a deliberate response strategy per comment (Accept/Defend/Clarify/Experiment), and draft a professional rebuttal using success patterns distilled from spotlight-accepted papers.

10 minutes
Intermediate
Academic Research

AlphaXiv Paper Lookup

Look up any arxiv paper via alphaxiv.org to get a structured AI-generated overview instead of parsing raw PDFs.

2 minutes
Beginner
Academic Research

Academic Literature Research

Search and analyze academic literature. Find papers, understand research methodologies, and synthesize academic findings for research projects.

10 minutes
Advanced
Academic Research

Academic Research Assistant

Automate literature reviews with structured search strategies, abstract screening, citation management, methodology comparison, and research gap identification.

10 minutes
Intermediate
Academic Research

Adversarial QA Loop

Use a Critic + Fixer pattern where one agent finds issues (read-only) and another fixes them, with re-audits until quality passes. Prevents Claude from approving its own work.

10 minutes
Intermediate
Academic Research

Clinical Trial Emulator

Emulate published clinical trials against real-world EHR data using a structured pipeline — from protocol parsing through cohort assembly, effect estimation, and discrepancy diagnosis.

15 minutes
Advanced
Academic Research

Comprehensive Excellence Review

Run 6+ specialized review agents in parallel across code quality, security, performance, accessibility, documentation, and style. Get a synthesized quality score with prioritized fixes.

15 minutes
Advanced
Academic Research

Deep Research Coordinator

Orchestrate complex multi-source research projects — from question decomposition to source prioritization to final synthesis and recommendations.

10 minutes
Intermediate
Academic Research

Deploy Workflow Automation

Automate your deployment pipeline: build, test, lint, version bump, and deploy to any target. Includes pre-deploy checks, rollback handling, and post-deploy verification.

15 minutes
Intermediate

Browse all Academic Research playbooks →