How it works

Architecture, data flow, and the capture model

Architecture

PCR has three components: the pcr CLI on your machine, a Supabase backend, and the Next.js dashboard at pcr.dev.

The CLI

Two responsibilities: watch AI tool session files for new prompts, and ship those prompts to the backend when you bundle and push them.

Session transcripts are JSONL files that Cursor, Claude Code, and VS Code Copilot write to your home directory as you work. The watcher monitors:

ToolPath
Cursor~/.cursor/projects/<slug>/agent-transcripts/**/*.jsonl + the Cursor SQLite session store
Claude Code~/.claude/projects/<slug>/*.jsonl
VS Code CopilotCopilot session files under the VS Code workspace storage directory

Project scoping

When you run pcr init, PCR computes a slug from the directory path and registers it in ~/.pcr-dev/projects.json. The watcher only captures prompts from registered slugs — sessions from any other directory are ignored.

Authentication

The CLI authenticates via a long-lived CLI token created in pcr.dev's Settings page. Tokens live in ~/.pcr-dev/auth.json and survive machine restarts. The Supabase anon key is bundled in the CLI and protected by Row Level Security.

Data flow

  • Your editor writes a session transcript
  • pcr start notices the change (fsnotify with a periodic safety scan) and saves new prompts as drafts in ~/.pcr-dev/drafts.db
  • Tool call file paths are matched against your registered projects so a single Claude Code or Copilot session that touches multiple repos surfaces in pcr show for each of them
  • You open pcr show (or pcr bundle), multi-select the drafts you want to ship, give the bundle a name, and confirm
  • pcr push uploads each bundle's prompts plus the incremental git diffs each prompt produced
  • Teammates registered against the same repo see the bundles in the dashboard

Drafts are local-only until you push. You can delete them at any time with d in the TUI or in bulk with pcr gc --drafts.