Task Journal
Reasoning chain memory for AI coding sessions.
Task Journal captures the logical chain of a coding task -- goals, hypotheses, decisions, rejections, evidence, corrections -- as an append-only event log. When you come back to a two-week-old task, the code is still there but the why is gone. Task Journal preserves it.
Unlike session-based memory tools that store raw chat history or flat semantic search, Task Journal records structured reasoning events tied to individual tasks, and renders compact resume packs so an agent (or you) can pick up exactly where work left off.
Installation
From crates.io (recommended)
As a Claude Code plugin
Pre-built binary
Download the right archive for your OS/arch from GitHub Releases, unpack, and place task-journal and task-journal-mcp somewhere in your $PATH.
From source
Quick Start
# 1. Create a task
# => tj-x9rz1f
# 2. Record reasoning events as you work
# 3. Resume later with a context pack
CLI Commands
| Command | Description |
|---|---|
create <title> |
Create a new task (writes an open event) |
event <id> --type X --text Y |
Append a typed event to a task |
close <id> [--reason "..."] |
Close a task |
event-correct --corrects <eid> --task <id> --text "..." |
Append a correction referencing an earlier event |
events list [--limit N] |
List events for the current project (most recent first) |
search <query> [--all-projects] |
Full-text search across events (FTS5) |
pack <id> --mode compact|full |
Render a resume pack for a task |
rebuild-state |
Rebuild SQLite derived state from the JSONL log |
stats |
Show classifier accuracy and event counts |
export [--format md|json] [--task <id>] |
Export tasks to stdout as Markdown or JSON |
backfill [--dry-run] [--limit N] |
Import events from existing Claude Code session history |
ui / tui |
Interactive terminal UI for browsing sessions |
install-hooks [--scope user|project] |
Install Claude Code auto-capture hooks |
ingest-hook |
Hook entry point (called by Claude Code hooks) |
Export
The export command writes task data to stdout so you can pipe it to a file or another tool:
# Export all tasks as Markdown
# Export a specific task as JSON
# Export from a different project directory
TUI
The interactive terminal UI (task-journal ui or task-journal tui) lets you browse Claude Code sessions and read conversation history for the current project. Navigate sessions with arrow keys and inspect individual chat messages.
MCP Integration
Task Journal ships an MCP server (task-journal-mcp) that exposes five tools to Claude Code and other MCP-compatible agents:
| MCP Tool | Description |
|---|---|
task_create |
Create a new task |
event_add |
Append a reasoning event |
task_pack |
Render a resume pack for context restoration |
task_search |
Full-text search across events |
task_close |
Close a task with a reason |
Plugin install (recommended) -- the plugin registers the MCP server automatically:
Manual MCP registration -- add to ~/.claude/settings.json:
The MCP server includes built-in instructions that guide Claude Code through the recommended workflow: search for open tasks at session start, record findings/decisions/rejections during work, and close tasks when done.
Auto-Capture via Hooks
Claude Code hooks can automatically classify chat chunks and record events without manual event commands:
The classifier (powered by claude -p with your Pro/Max subscription, or the Anthropic API with --backend=api) analyzes each chat turn and appends events to the active task:
- Confidence >= 0.85 -- confirmed event (auto-recorded)
- Confidence < 0.85 -- suggested event (marked with
[?])
Hook commands are wrapped with || true so classifier failures (network down, rate limit) never break Claude Code. Failed classifications are queued in pending/ and retried on the next ingest.
Event Types
| Type | Meaning |
|---|---|
open |
Task created with a title and optional context |
hypothesis |
Unverified theory ("I think X might cause Y") |
finding |
Verified observation from reading code, logs, or docs |
evidence |
Result of a test or experiment that proves something |
decision |
Committed choice with rationale ("Use X because Y") |
rejection |
Explicitly rejected approach with reason |
constraint |
External limitation discovered (rate limits, API restrictions) |
correction |
Corrects an earlier event (references corrects event ID) |
reopen |
Reopens a previously closed task |
supersede |
Replaces an earlier event (references supersedes event ID) |
close |
Task completed with outcome summary |
redirect |
Task redirected to a different task or approach |
Architecture
Task Journal is a Rust workspace with three crates:
| Crate | Package | Description |
|---|---|---|
tj-core |
task-journal-core |
Event schema, JSONL storage, SQLite derived state, pack assembler, classifier client |
tj-cli |
task-journal-cli |
task-journal CLI binary |
tj-mcp |
task-journal-mcp |
task-journal-mcp MCP server binary (uses rmcp) |
Source of truth = JSONL event log. SQLite state is derived and fully rebuildable via rebuild-state. Pack output is Markdown wrapped in JSON metadata.
Data Location
| OS | Path |
|---|---|
| Linux / WSL | $XDG_DATA_HOME/task-journal (default ~/.local/share/task-journal) |
| macOS | ~/Library/Application Support/task-journal |
| Windows | %LOCALAPPDATA%\task-journal |
task-journal/
events/<project_hash>.jsonl # source of truth (append-only)
state/<project_hash>.sqlite # derived state (rebuildable)
metrics/<project_hash>.jsonl # classifier telemetry
pending/<id>.json # failed classifications awaiting retry
Each project is identified by a hash of its canonical path, so multiple projects share the same data directory without collision.
Development
Smoke test scripts are available in .beads/hooks/:
License
MIT