Turn your own Claude Code session history into a searchable personal knowledge base — ingest, extract, synthesize, and render a wiki plus ADRs.
pks brain <command> [options]$ pks brain initCreate the global and per-project brain layout
$ pks brain ingestParse Claude session logs into the raw firehoses
$ pks brain statusShow what the brain currently knows
$ pks brain refresh --dry-runPlan the whole pipeline and print a cost estimate
$ pks brain search Keycloak --since 7dFull-text search recent prompts, tools, and errors
pks brain is a personal knowledge base built from the Claude Code session logs already sitting on your machine. It reads ~/.claude/projects/**/*.jsonl, turns those sessions into structured data, and — with a few AI passes — writes per-session extracts, cross-session themes, wiki pages, and architecture decision records into the git repo you are standing in.
Every Claude Code session you run leaves a JSONL transcript on disk: your prompts, the assistant's replies, every tool call, every file it touched, every error it hit. That history is complete and local, and it is unreadable by hand. pks brain is the pipeline that makes it readable.
~/.pks-cli/brain/. Generated artifacts are per-repo at ./.pks/brain/.themes.md and bad-habits.md, plus a machine-readable clusters.json.The pipeline runs in five phases, each consuming the previous one's output. ingest walks the Claude session logs and writes the global raw layer. extract summarizes each ingested session into ./.pks/brain/extracts/. synth clusters those extracts and writes ./.pks/brain/synthesis/, including the clusters.json that both later phases read. wiki and adr each render from those clusters, with different evidence thresholds — a wiki page needs 3 sessions by default, an ADR needs 5.
pks brain refresh runs all five in order with a single combined cost estimate and one confirmation prompt, and skips the downstream phases when extract produced nothing new. The remaining commands sit outside the pipeline: search, scan filepath, conversation, and commit-plan are ad-hoc tools, and skill manages the editable prompts that drive the four AI phases.
~/.pks-cli/brain/ — the raw ingested firehoses../.pks/brain/ — extracts, synthesis, wiki, adr, conversations. pks brain init adds it to .gitignore.init · ingest · extract · synth · wiki · adr · refresh · status · search · commit-plan · scan filepath · conversation · skill list · skill init · skill show
| Command | Phase | What it does |
|---|---|---|
pks brain init | setup | Creates the global and per-project layout, and gitignores the project directory. |
pks brain ingest | 1 | Parses Claude session JSONL into the global raw firehoses. Deterministic. |
pks brain extract | 2 | AI-summarizes each session into a per-session markdown extract. |
pks brain synth | 3 | Clusters extracts and narrates cross-session themes and bad habits. |
pks brain wiki | 4 | Renders one wiki page per qualifying cluster, plus an index. |
pks brain adr | 5 | Distils architectural clusters into ADRs, plus an index. |
pks brain refresh | 1–5 | Runs the whole pipeline with one combined estimate and gate. |
pks brain status | — | Dashboard of raw totals, extract stats, and refresh suggestions. |
pks brain search | — | Full-text search across the firehoses and the project's extracts. |
pks brain commit-plan | — | Groups uncommitted files by the session that produced them. |
pks brain scan filepath | — | Finds every session whose tool calls touched a path. |
pks brain conversation | — | Exports one session as readable markdown. |
pks brain skill | — | Lists, installs, and shows the editable prompts behind the AI phases. |
For the full flag surface of every command in one place, read the pks brain CLI reference.
| Setting | Value |
|---|---|
| Global root | ~/.pks-cli/brain/ |
| Per-project root | ./.pks/brain/ |
| Session source | ~/.claude/projects |
| AI model | haiku |
| Parallel AI calls | 10 |
| Summarizer backend | pks |
These are resolved from your home directory and the current git repository. There is no PKS_HOME or PKS_CONFIG override for the brain root — HOME (or USERPROFILE on Windows) determines both paths.
Distil architectural clusters into standard decision records — status, context, decision, alternatives, consequences, and the sessions that evidence them.
pks brain adr [options]
Group a pile of uncommitted files by the Claude session that produced them, so one messy working tree becomes several focused, session-coherent commits.
pks brain commit-plan (--files <paths> | --files-from <path> | --uncommitted) [options]
Export a single Claude session as readable markdown — human prompts and assistant replies, with tool traffic collapsed into references instead of inlined.
pks brain conversation <session> [options]
Summarize each ingested Claude session into a per-session markdown extract with a cost sidecar, planning and gating the spend before any model runs.
pks brain extract [options]
Parse every Claude Code session log into four append-only firehose files under the global brain root — deterministic, cursor-based, and free to run.
pks brain ingest [options]
Go from zero to a readable wiki page in five steps — initialize the layout, ingest your Claude session logs, extract, synthesize, and render.
pks brain init && pks brain ingest && pks brain refresh
Complete command, flag, argument, and path reference for the pks brain group — the pipeline phases plus search, scan, conversation, commit-plan, and skills.
pks brain <command> [options]
Run ingest, extract, synth, wiki, and adr in one pass with a single combined cost estimate, one confirmation gate, and automatic downstream skipping.
pks brain refresh [options]
Find every Claude session whose tool calls touched a file or directory, scanning the raw session logs directly with no ingest and no model calls.
pks brain scan filepath <path> [options]
Grep across every prompt, tool call, file operation, and error you ever ran through Claude Code, plus the current project's session extracts.
pks brain search <query> [options]
List, install, and inspect the editable prompts behind the brain's AI phases, so extract, synth, wiki, and adr produce the shape of output you want.
pks brain skill <list|init|show> [options]
Show what the brain currently knows — global raw totals, per-project extract cost and token stats, and the sessions that are due for a refresh.
pks brain status
Cluster per-session extracts by theme and narrate the cross-session story into themes.md, bad-habits.md, and the clusters.json that wiki and adr read.
pks brain synth [options]
Render one wiki page per synthesized cluster — overview, user stories, what is built, open threads, and hot files — plus an index linking them all.
pks brain wiki [options]