Auto-journal — SessionEnd hook + Screenpipe writer, both feeding knowledge/journal/
Auto-journal — two writers, one file
Locked
Two independent journal writers, both append to knowledge/journal/YYYY-MM-DD.md:
Writer 1 — Claude Code SessionEnd hook
Fires when a CC session ends (/clear, exit, timeout). Wraps the session into one journal block:
## <HH:MM> Claude Code session — <first-user-prompt-slug>
- **Ask:** <user's opening prompt, truncated 100 chars>
- **Touched:** file/path/1.md, file/path/2.md
- **Decisions locked:** knowledge/decisions/.../foo-YYYY-MM-DD.md
- **TODOs surfaced:** [] item, [] item
- **Follow-up:** <one line>
Hook script location: scripts/journal-cc-session-end.mjs (Node stdlib, reads transcript, writes markdown block). Registered in ~/.claude/settings.json under hooks.SessionEnd.
Writer 2 — Screenpipe pipe
Screenpipe already captures screen + audio + Wispr Flow dictations + meeting intel (see ~/.claude/screenpipe-memories.md). Add a pipe that emits a daily digest into the same journal file:
## <HH:MM> Screenpipe digest
- **Apps:** chrome, Windows Terminal, VS Code
- **Meetings:** <title, attendees, key decisions>
- **Wispr dictations:** <one-line summaries>
- **Screen time hotspots:** <top 3 apps by minutes>
Pipe: pipe-daily-journal-writer (config in ~/.screenpipe/pipes/). Writes to C:/D/oriz/knowledge/journal/YYYY-MM-DD.md at 09:00 IST daily + on Screenpipe shutdown.
Why both writers
- SessionEnd captures what agents did: files touched, decisions locked, code shipped. High-signal for future agent lookback.
- Screenpipe captures what user did off-agent: browsing, meetings, dictations. High-signal for user context restoration.
- Merged into one daily file → single lookup surface (
knowledge/journal/2026-07-03.md), agent + human unified timeline.
Conflict handling
Both writers append (no overwrite). Ordering by timestamp header. File format:
---
type: journal
title: Journal 2026-07-03
description: Auto-generated daily journal — agent sessions + Screenpipe digests
tags: [journal, auto]
timestamp: 2026-07-03
format_version: okf-v0.1
status: active
---
# Journal 2026-07-03
## 09:00 Screenpipe digest
...
## 10:15 Claude Code session — foam-vs-obsidian-review
...
## 14:22 Claude Code session — commit-pkm-decisions
...
## 18:00 Screenpipe digest
...
File appends are atomic on Windows for small writes (<4KB per block). Both writers fsync after append.
PII / secret redaction
- Screenpipe already redacts credentials per its config; do not weaken.
- SessionEnd hook: redact any lines matching
sops age,Bearer <token>,${env:VAR}=<value>,password:before writing. - Journal file committed to git → same secret discipline as
no-hardcoded-secrets.
Commit cadence
- SessionEnd hook writes AND auto-commits:
chore(journal): <date> session <slug>. - Screenpipe pipe writes AND queues for daily commit (single commit per day:
chore(journal): <date> screenpipe digest). - Auto-push per standing authorisation (chirag127/workspace, no destructive ops).
Retention
None. Daily journal files stay forever — cheap on git, high value for git log --grep lookback. Per everything-durable-to-cloud.
Rollback trigger
- Hook noise > signal (e.g., writing 50 blocks/session) → tune hook filter.
- Screenpipe pipe misfires (dupe writes, wrong date) → disable pipe, keep SessionEnd only.
- Sensitive content leaks into journal → tighten redaction,
git filter-repopast commits.
Wiring status
Not wired yet. This decision doc is landed. Implementation (hook script + Screenpipe pipe config + first successful auto-journal) tracked separately.
Related
- [[pkm-stack-2026-07-03]]
- [[journal-in-knowledge-daily-2026-07-03]]
- [[self-update-rule]]
- [[everything-durable-to-cloud]]