PAI Knowledge OS
Claude Code has a memory problem. Every new session starts cold — no idea what you built yesterday, what decisions you made, or where you left off. PAI fixes this.
Install PAI and Claude remembers. Ask it what you were working on. Ask it to find that conversation about the database schema. Ask it to pick up exactly where the last session ended. It knows.
Quick Start
Tell Claude Code:
Clone https://github.com/mnott/PAI and set it up for me
Or install with a single command:
npx @tekmidian/pai install
Or manually:
1. Install
git clone https://github.com/mnott/PAI
cd PAI
bun install
bun run build
2. Run the setup wizard
pai setup
The wizard walks you through: storage mode (SQLite or PostgreSQL), project directories, Obsidian vault path, MCP server registration, CLAUDE.md template, and daemon configuration. It's idempotent — safe to re-run anytime.
3. Start the daemon
pai daemon start
The daemon runs in the background via launchd, indexing your sessions and serving the MCP tools. It starts automatically on login.
4. Verify
pai daemon status # should show "running"
pai memory search "test" # should return results after indexing
That's it. Claude Code now has persistent memory across all sessions.
Command Reference
Every pai command area has its own man page, generated from the live CLI so it never drifts from the actual commands. Read them three ways:
pai help # list all command areas (the index)
pai help memory # the full man page for one area, in your terminal
pai memory --help # terse Commander help for any command
Browse the same pages on GitHub under docs/commands/. Each page lists every subcommand, its arguments and options, and worked examples. The reference below in this README is the guided tour; docs/commands/ is the complete reference.
Automatic Session Notes — by Topic
PAI's headline feature: every session is automatically documented. No manual note-taking, no "pause session" commands, no forgetting to save what you did.
When you work, a background daemon watches your session continuously. Every time Claude's context compacts — which happens automatically as the conversation grows — the daemon reads the JSONL transcript, combines it with your git history, and spawns a headless Claude process to write a structured session note. Not just at session end. Midway through your work, while you're still coding. The notes build up in real time as you go — what was built, what decisions were made, what problems were hit, what's left to do.
When you change topics mid-session, PAI creates a new note. If you start the day debugging audio, then pivot to a Flutter rewrite, you get two notes — not one giant file mixing unrelated work:
Notes/2026/03/
0001 - 2026-03-23 - Phase 1 Research and Architecture.md
0002 - 2026-03-24 - Background Audio and iOS Conflicts.md
0003 - 2026-03-24 - Flutter Rewrite with Whisper.md ← auto-split, same day
Topic detection uses Jaccard word similarity between the new summary's topic and the existing note's title. Below 30% overlap = new note.
Model tiering: Opus for final session summaries (best quality, runs once). Sonnet for mid-session checkpoints (good quality, runs on compaction). All using your Max plan — no API charges.
This is not a template or a skeleton. These are real notes with build error chronologies, architectural decisions with rationale, code snippets, and "what was tried and failed" sections. The kind of notes you'd write yourself if you had time.
What You Can Ask Claude
Searching Your Memory