A self-hosted AI Coding Session Intelligence Platform — capture every AI coding-tool session on
your machine(s), archive it with full fidelity, and turn it into reports on cost, token/context
efficiency, tool-call failures, and Git outcomes.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
AI coding tools produce valuable but fragmented operational data — sessions live in vendor-specific local stores, CLIs, and logs that can crash, change format, or lose history. 420AI captures that data across machines, archives it with maximum fidelity, and turns it into Markdown reports and a live dashboard so you can answer questions like which projects/tools/models are worth the spend and where context is wasted.
It is local-first and self-hosted (nothing leaves your home server), event-sourced (raw records are the permanent truth; everything else is a re-buildable projection), and deterministic-metrics-first, AI-interpretation-second. The repo is an npm-workspaces monorepo:
packages/shared— token shape, event taxonomy, fingerprint, pricing, cost, ingest wire typespackages/db— Drizzle Postgres schema + migrations, AES-256-GCM field encryption, repositoriesapps/ingest— Fastify Ingest API (pairing, bearer-authed idempotent ingest, projections, reports)apps/collector— headless capture agent (connectors, durable queue, watcher, sync, CLI)apps/dashboard— Next.js + shadcn/theGridCN Live Monitorapps/desktop— Tauri (Rust) tray app that supervises the collector as a sidecar
- TypeScript on Node.js ≥ 24 (ESM, strict)
- Fastify — the Ingest API
- Drizzle ORM + PostgreSQL 17 (Docker)
- Next.js + shadcn/ui + theGridCN — the dashboard
- Tauri (Rust) — the desktop/tray collector
- Vitest — unit + integration tests
- Node ≥ 24 (see
.nvmrc) — the collector queue uses the built-innode:sqlite. - Docker — for the PostgreSQL 17 archive (host port 5433).
- Clone the repo
git clone https://github.com/seanrobertwright/420AI.git cd 420AI - Install workspace dependencies
npm install
- Create your env file and fill the two secrets
cp .env.example .env # ARCHIVE_ENCRYPTION_KEY — 32 bytes, base64: node -e "console.log(require('crypto').randomBytes(32).toString('base64'))" # SESSION_SECRET — signs login cookies (must match in ingest + dashboard): node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))" # …then set ADMIN_EMAIL + ADMIN_PASSWORD. As of M15 15.9 that pair IS the bootstrap: # ADMIN_TOKEN was retired, and an API key can only be minted from a login.
- Start the archive and apply migrations
npm run db:up # postgres:17 on host port 5433 npm run db:migrate - Run the Ingest API
npm run ingest:dev # http://localhost:8420
Pair a machine and capture sessions (collector CLI, run with tsx — no build needed):
# Log in, mint an `admin` API key (M15 15.9; Settings → API keys does this in the dashboard as
# of 15.10 — the curl form is kept because it scripts), create a pairing code, pair
SESSION=$(curl -s -X POST localhost:8420/v1/auth/login -H "content-type: application/json" \
-d "{\"email\":\"$ADMIN_EMAIL\",\"password\":\"$ADMIN_PASSWORD\"}" | jq -r .token)
API_KEY=$(curl -s -X POST localhost:8420/v1/auth/api-keys -H "authorization: Bearer $SESSION" \
-H "content-type: application/json" \
-d "{\"name\":\"setup\",\"role\":\"admin\",\"currentPassword\":\"$ADMIN_PASSWORD\"}" | jq -r .token)
curl -s -X POST localhost:8420/v1/pairing-codes -H "authorization: Bearer $API_KEY" -d '{}'
npx tsx apps/collector/src/cli.ts pair <code> --url http://localhost:8420 --name win-dev
# Run the background capture agent (Ctrl-C drains and stops)
npx tsx apps/collector/src/cli.ts watch
# One-shot ops: drain the queue / inspect backlog / discover repos
npx tsx apps/collector/src/cli.ts sync
npx tsx apps/collector/src/cli.ts queue
npx tsx apps/collector/src/cli.ts discoverRun the dashboard (Live Monitor):
npm run dashboard:dev # reads INGEST_URL + SESSION_SECRET from env (it forwards YOUR login)For the full setup and day-to-day guide, see docs/guide/install.md and
docs/guide/usage.md.
- M1–M9 — capture → archive → projections → reporting → AI interpretation → Live Monitor
- M10 — hardening: exports, catalog signing, operational alerts, replay metadata
- M11 — Tauri desktop/tray collector
- M12 — Production Readiness / GA (8 slices): basic search, dashboard surfaces, auth hardening, ops baseline, archive-replay engine, alert delivery, connector hardening, export/distribution polish
- M13 — Capability Gap Closure (7 slices): truth fixes, the 5 remaining report types + context governance, archive re-parse, incremental search, alert delivery completion, scheduled reports, the Cursor connector
- M14 — General AI Chat Capture (in progress): ChatGPT / Claude / Gemini web+desktop session
capture (spike-first), plus catalog admin UIs, desktop polish, and per-event search granularity.
Shipped: 14.5 Claude chat-export connector (batch, non-repo attribution); 14.7 browser
extension (near-real-time Claude web capture) + collector
pushcapture mode — ChatGPT/Gemini extension origins deferred
See SUMMARY.md and the open issues
for the full list.
This is a single-maintainer project. Contributions, issues, and feature requests are welcome — fork the repo, create a feature branch, and open a PR. Before committing, ensure the gate passes:
npm run repo-health # typecheck + tests + NUL/stray-artifact scans
npm run repo-health -- --require-db # also runs the Postgres integration layerDistributed under the MIT License. See LICENSE for more information.
Sean Wright —
Project Link: https://github.com/seanrobertwright/420AI
- othneildrew/Best-README-Template — README structure
- Shields.io — badges
