@tekmidian/pai
v0.66.11
Published
PAI Knowledge OS — Personal AI Infrastructure with federated memory and project management
Maintainers
Readme
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, find that conversation about the database schema, or pick up exactly where the last session ended.
- Automatic session notes, split by topic, written by a background daemon
- Federated keyword and semantic search across sessions, notes and vaults
- Workers on any provider, orchestrated from one Claude Code session
- Everything runs locally
Install
The easy way, on macOS and Linux: open Claude Code and say
"Clone https://github.com/mnott/PAI and set it up for me"
Claude installs PAI, runs the setup wizard and checks the daemon.
Prerequisites: Claude Code, Node.js 20 or newer, and Docker if you choose PostgreSQL.
By hand, the same on macOS and Linux:
npm i -g @tekmidian/pai
pai setup --yes --storage postgres # keyword + semantic search (pgvector in Docker); or: --storage sqlite
pai daemon status # should show "running"pai setup without --yes asks every question interactively. It installs the daemon as a LaunchAgent on macOS and a systemd user service on Linux. From a source checkout: git clone https://github.com/mnott/PAI && cd PAI && bun install && bun run build.
→ docs/install.md · docs/install-linux.md (both storage paths, Docker, systemd)
Command Reference
Every pai command area has a man page generated from the live CLI: pai help, pai help memory, pai memory --help.
→ docs/command-reference.md · docs/commands/
Worker Providers
Only the orchestrator session runs on Anthropic; every worker runs on a provider you choose, routed by class. Providers and classes live in one workers.yaml.
→ docs/worker-providers.md · docs/worker.md · docs/workers-config.md · docs/provider-independence.md
Automatic Session Notes
A background daemon documents every session as it happens, from the transcript and git history, and starts a new note when the topic changes.
What You Can Ask Claude
Search your memory, manage projects, navigate sessions, review your week, keep things safe, work with Obsidian and manage your budget, all in plain language.
Skills
On-demand skills for productivity, session management, Obsidian vaults and system tools.
Budget-Aware Advisor Mode
Adapts how much work Claude delegates to cheaper models as your usage limits fill up, with thresholds and a statusline label.
Context Preservation
State is saved before compaction and injected afterwards, so a compaction, a restart or a crash does not cost you the thread.
→ docs/context-preservation.md
Session Management
One entry point, pai <topic>: an interactive picker over projects and sessions, topic search, pausing all sessions at once.
Memory
Progressive memory loading in four layers, a temporal knowledge graph, and a three-tier hybrid store with graph-completion search and a relevance feedback loop.
Automatic Observation Capture
Tool calls are classified into structured observations and injected back as progressive context.
Whisper Rules and Privacy Tags
Rules injected into every prompt so they survive compaction, and <private> tags that keep content out of the index.
Search
Keyword, semantic and hybrid search with cross-encoder reranking, recency boost, a compact token-efficient format and section-aware retrieval.
Auto-Compact Context Window
The durable way to make Claude Code compact automatically, via CLAUDE_AUTOCOMPACT_PCT_OVERRIDE.
Zettelkasten Intelligence
Graph operations over your Obsidian vault: connections, themes, god notes, communities, latent ideas.
How It Works
Storage options (SQLite or PostgreSQL + pgvector), prerequisites and the indexing loop. Deep dive: ARCHITECTURE.md.
Use Cases
Solo developer, team lead, researcher: what changes with persistent memory.
Release History
→ docs/release-history.md · CHANGELOG.md
Companion Projects
AIBroker, Whazaa, Telex, Coogle and DEVONthink MCP.
Acknowledgments
PAI Knowledge OS is inspired by Daniel Miessler's concept of Personal AI Infrastructure and his Fabric project — a Python CLI for augmenting human capabilities with reusable AI prompt patterns. Fabric is excellent and solves a different problem; PAI takes the same philosophy in a different direction: persistent memory, session continuity, and deep Claude Code integration. See FEATURE.md for a detailed comparison.
The automatic observation capture system — classifying tool calls into structured observations with progressive context injection — is inspired by claude-mem by thedotmack. claude-mem demonstrated that automatic memory capture during Claude Code sessions dramatically improves continuity. PAI adapts this concept with a rule-based classifier, PostgreSQL storage, and three-layer progressive disclosure.
The three-store hybrid memory architecture — combining SQLite/PostgreSQL chunks with a knowledge graph and vector embeddings, graph-completion search (vector seeds → graph traversal → re-rank), and the feedback EMA relevance loop — is inspired by Cognee by topoteretes. Cognee showed that unifying structured knowledge graphs with unstructured vector retrieval produces dramatically better recall. PAI adapts this pattern to the personal knowledge OS context with project-scoped multi-tenancy and content-address entity deduplication.
Section-aware retrieval (heading paths on chunks, memory_outline) borrows from PageIndex by VectifyAI, which retrieves from long documents by navigating a heading tree rather than by similarity alone. PAI keeps its keyword, vector and graph search and adds the tree as structure the model can navigate, without an LLM call per query.
License
MIT
