Skip to content

feat: Session Task Journal — auto-capture DA responses to dated Markdown logs #1331

@rfdiazpr

Description

@rfdiazpr

Problem

Every DA response is ephemeral. When a session ends, all task output — findings, decisions, changes, verification results — is gone. Only Algorithm-mode tasks generate any persistent record (algorithm-reflections.jsonl), and only as metadata (task description + 3 reflection questions), never the actual response content.

Users cannot search, revisit, or build on prior work without redoing it from scratch or relying on memory.

Proposed Solution

A per-day session journal: PAI/USER/SESSION_LOG/YYYY-MM-DD.md.

Every DA response — NATIVE, ALGORITHM, MINIMAL — is automatically appended as a timestamped entry. No manual action required.

Implementation

PAI/TOOLS/SessionLog.ts — CLI tool:

  • --append --task "..." --mode "NATIVE|ALGORITHM" — write entry (reads stdin)
  • --today — print today's log
  • --search <query> — grep across all log files
  • --retroactive — backfill skeleton entries from algorithm-reflections.jsonl

hooks/SessionLogCapture.hook.ts — automatic capture:

  • UserPromptSubmit (async): scans transcript for last PAI-formatted response, appends to today's log
  • Stop: captures final response via last_assistant_message, with transcript fallback
  • Dedup via per-session fingerprint file (MEMORY/STATE/session-log-fp-{id}.txt)
  • Skips responses < 80 chars or without a PAI mode header

Entry format:

## HH:MM | MODE | Task name

[full response content]

Toggle: PAI_SESSION_LOG=false env var disables all writes.

Benefits

  • Searchable historySessionLog.ts --search <query> across all days
  • Obsidian-compatible — plain Markdown, indexes out of the box
  • fabric-ready — each day's file can be piped through extract_wisdom
  • Retroactive--retroactive backfills skeleton entries from existing algorithm-reflections.jsonl for all prior dates
  • Closes a Memory architecture gap — PAI has LEARNING (ratings/reflections) and KNOWLEDGE (harvested notes) but no SESSION_LOG surface

Optional Pulse Integration

A /session-log viewer route can be added to pulse.ts:

  • Sidebar date list + rendered Markdown panel
  • AJAX date switching + client-side search with highlight
  • Routes: GET /session-log, GET /api/session-log?date=YYYY-MM-DD, GET /api/session-log/dates

Files

  • PAI/TOOLS/SessionLog.ts (new)
  • hooks/SessionLogCapture.hook.ts (new)
  • settings.json — wire hook to Stop + UserPromptSubmit
  • PAI/USER/SESSION_LOG/ — storage directory

Toggle

PAI_SESSION_LOG=false in env or .env — no writes at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions