A band above the prompt showing the Trame card this session is on, and an exit prompt once that card is done

A local-first Claude Code and Codex session tracker. Each session ladders up to a story (grouped under a project); the board is status columns × swimlanes — the view no off-the-shelf tool gave us, and the columns are yours to define. It also holds free-form pages — inline comments (with agent reply threads), sandboxed interactive HTML blocks, per-page guest sharing, public read-only share links — and Notion-style databases (sortable / filterable / groupable views). ⌘P jumps to any session, page, or database; a card's Resume button reopens the session in Claude Code or Codex. Opt-in plugins add side panels — the first one lists GitHub/GitLab deployments waiting for approval.
Stack: Tauri 2 + Rust app → bundled PostgreSQL 18 (offline read+write) → custom changeset LWW sync over HTTPS → a small Bun API in front of Postgres on a home server (the hub), with WebSocket nudges so edits propagate between machines in seconds. No PowerSync, no Electric. Everything is Postgres, so the SQL is identical on the laptop and the hub. (Design + migration story: docs-site/src/content/docs/hub-api.md.)
laptop A (Tauri app) laptop B (Tauri app)
├─ local PG18 ◀── read/write offline ──▶ local PG18
└─ sync ─┐ POST /sync (mutations ⇅ changes) ┌─ sync
├──────────▶ Bun API @ hub ◀──────┤ (auth boundary; Docker, home LAN)
└── WSS ◀── "changed, pull now" ──▶┘ └─▶ Postgres (source of truth)
/trame-track ─▶ local app if running, else local outbox.jsonl (app drains on launch)

A short tour: filter the board by story, regroup into swimlanes, open a session and resume it in Claude Code or Codex, sort the list, then browse a page and a database. (higher-quality MP4 · screens use demo data, recorded pre-0.4)
just web-build).db/schema.sql shared schema (hub AND local PostgreSQL) — idempotent; re-applying it IS the migration
docs-site/ Astro + Starlight docs (data model, hub API design, release notes) — `just docs`
protocol/ versioned sync protocol shared by app and hub (entities, LWW rule, html-block bridge)
hub/docker-compose.yml the hub: Postgres (docker-network only) + the Bun API in front of it
hub/api/ the API: device tokens, changeset /sync, per-page ACLs, WSS nudges, public /l/* pages
hub/deploy.sh deploy the hub over ssh (~/Apps/trame) — `just db-deploy`
hub/gen-certs.sh private CA + server certs, runs on the hub (called by deploy)
hub/fetch-ca.sh fetch the hub's ca.crt so this laptop trusts the API's TLS — `just hub-ca`
hub/pg_hba.conf Postgres auth rules: local + docker network only, anything else rejected
crates/trame-desktop/ Tauri 2 shell, splash/readiness, window state, native packaging
crates/trame-local/ axum API, supervised PostgreSQL, sync, plugins, files and migration
crates/trame-core/ shared markdown/merge/todo logic, also compiled to Wasm
crates/trame-cli/ native tramecli writers, setup, watcher and MCP stdio server
app/web/ existing React app (Vite)
scripts/rust-db-migrate.ts legacy PGlite export helper (dev/CI only; no longer bundled in packages)
bin/quickstart.sh curl-able laptop setup: clone + packaged app + agent integrations
skills/trame-{track,page,watch,plugin}/ the agent skills (Claude Code, Codex & friends) — embedded in tramecli, installed by `tramecli setup`
See native runtime and migration for isolated development, packaging, and the one-shot PGlite conversion.
curl -fsSL https://raw.githubusercontent.com/Andarius/trame/master/bin/quickstart.sh | bash
Clones to ~/trame (override with TRAME_DIR), installs the latest packaged Linux x64 app (snap, deb or AppImage; TRAME_APP=source builds from the checkout instead, TRAME_VERSION=v0.9.0 pins a release), and wires Claude Code and Codex (TRAME_TARGETS=claude or codex to pick one, none to skip; any other agent CLI that reads an Agent Skills directory → TRAME_SKILL_DIRS=~/.gemini/skills). The hub (step 1), device token (step 2), and Claude session hook (step 4) still need the manual steps below.
just db-deploy # ssh: copies compose+schema+hba+api to ~/Apps/trame, creates .env+certs, starts it
just hub-ca # per laptop: fetch ca.crt (trusts the API's TLS)
First run generates the password and the CA/server certs, and binds to the hub's LAN IP (never 0.0.0.0). Postgres itself has no host port — laptops talk to the Bun API on :8443, which terminates TLS with the same private-CA cert. Idempotent — rerun to redeploy (re-applies the schema and restarts the API).
Mint a device token on the hub (<node-id> = the laptop's TRACKER_NODE_ID), then point the app at the API:
# e.g. for the laptop whose TRACKER_NODE_ID is "mbp-14"
ssh <hub> "docker exec trame-api bun /srv/hub/api/main.ts mint mbp-14"
# → prints the token ONCE (only its sha-256 is stored); re-run mint for a fresh one, revoke old rows in api_tokens
Paste the URL + token in ⚙ Settings → Sync hub, or add to ~/.local/share/trame/settings.json (chmod 600):
{ "hubApi": "https://192.168.1.x:8443", "hubApiToken": "<minted token>" }
Env (shell profile, or the project .env for just):
export TRACKER_NODE_ID="mbp-14" # unique per machine
# folders scanned (depth 4) for *.html reports + *.excalidraw drawings, shown+searchable in Explore
export TRACKER_REPORT_PATHS="$HOME/Projects:$HOME/code"
# hostnames the `embed` page block may frame (comma-separated; Settings › Embeds overrides)
export TRACKER_EMBED_HOSTS="grafana.example.com"
# optional: client names detected from a repo path (/<Client>/); anything else → "Side-projects"
export TRACKER_CLIENTS="Acme,Globex"
just web-build
just dev # isolated offline desktop; .scratch/dev data
just serve # isolated offline backend; .scratch/dev/port.json
just web-dev # Vite HMR on an isolated backend (starts one unless just serve runs)
just web-live # Vite HMR on the running Trame app: real data, real writes
Development recipes use disposable worktree data. For an installed runtime and legacy-data cutover, follow the native runtime guide; source builds do not attach to the live app.
Sessions have their own tags, independent of story and specs-page tags. Use the Tags picker in either the side panel or full-screen session view to add or remove multiple tags, including labels such as priority:P1. Session tags appear on board cards and list rows. The CLI/MCP writer contract below documents tag keys.
Agents talk to Trame through tramecli, one compiled binary that wraps the writers (track, page, comment, watch, list) — its --help carries the full agent contract, including the field-composition conventions:
tramecli --help # commands overview
tramecli track --help # the writer contract agents compose against
tramecli list # open sessions grouped by story (--json for jq)
It ships in the snap (aliased to tramecli by bin/snap-install-release.sh) and as a per-platform release asset. With the binary on PATH, install the agent docs from it — no checkout needed:
tramecli setup # interactive target picker
tramecli setup --claude --codex # non-interactive; also --skills-dir ~/.gemini/skills
From a dev checkout, just setup compiles a fresh binary and runs its setup — flags pass through, and any agent CLI that reads an Agent Skills directory works:
just setup --claude --codex --skills-dir ~/.gemini/skills
In Codex, use $trame-track, $trame-track paused "note", or $trame-track list for sessions, and $trame-page to create or comment on standalone Trame pages. Codex exposes CODEX_THREAD_ID, so the session writer automatically links the card to the current resumable session; no hook is needed.
In Claude Code the same skills land in ~/.claude/skills/: /trame-track records the current session as a card on the board — it reads the repo, branch, and a one-line note from the conversation and writes through the native local API (syncing to the hub when online, else queued in the outbox). From any repo: /trame-track to log the session, or /trame-track paused|blocked|done "note" to set its status with a note. trame-page is picked up automatically when you ask to save a document, note, or plan as a Trame page, and /trame-watch <page> answers feedback on a page live from the session. (The docs call the bare tramecli; setup links the binary into ~/.local/bin when that name is not already on PATH.)
For the card's Resume button to work, the writer needs the Claude session UUID — skills can't see their own session id, so a UserPromptSubmit hook records it per-cwd into ~/.local/share/trame/claude-sessions.json. Register it in ~/.claude/settings.json (per machine):
"hooks": {
"UserPromptSubmit": [{ "matcher": "", "hooks": [{
"type": "command",
"command": "tramecli hook",
"timeout": 5
}] }]
}
tramecli setup --presence installs this hook with the presence hooks. Without the hook /trame-track still works — the card just has no transcript link. Cards imported from the app's Claude Code + Codex dialog carry the UUID as their id and never need it.
Any page block can hold a thread of inline comments. Agents leave review comments with the trame_add_comment MCP tool or tramecli comment (identify the page by title, the block by a unique text quote). agent is the id of the model actually writing — Codex and Claude get a branded avatar, any other model id (glm, gemini, …) gets a generated one — so the author is honest, not forced to a harness seat. Agent comments stay out of your own author identity.
# an agent leaving a comment (JSON as arg or on stdin)
echo '{"page_title":"Release plan","block_text":"Ship the first release",
"body":"Clarify the rollback criterion.","agent":"codex"}' | tramecli comment
Reply to an agent's comment in the UI and the watcher closes the loop: it marks your reply seen, shows "Claude is answering…", runs the thread's agent to compose an answer, and posts it — with a model · tokens · seconds footer. Run it in its own terminal:
tramecli answer # answer any thread whose agent it can run
tramecli answer --cwd ~/Projects/some-repo # let the agent read that repo when answering (read-only)
tramecli answer --agents claude # only handle Claude threads
tramecli answer --once --dry-run # one pass, print prompts without answering
The CLI runs read-only, but the thread text is attacker-controllable on a shared page and is fed to a tool-capable agent: don't point --cwd at a repo holding secrets on shared/multi-user pages — a crafted reply could coax the agent into leaking file contents into its answer.
It finds the running app via the port file, polls every 5s, processes one reply at a time, and survives app restarts (backs off) and its own crashes (a stuck answering… self-heals). Failures retry twice then park as no answer until you edit the reply — never a loop. The agent CLIs must be installed and authenticated in that shell; each answer spends real tokens. codex and claude are built in; any other model (glm, gemini, …) is answerable by giving it a runner via TRAME_WATCH_<AGENT>_CMD — e.g. TRAME_WATCH_GLM_CMD="glm -p {}" (the {} placeholder is replaced by the prompt; no {} → prompt on stdin). The same env var overrides the built-ins, e.g. TRAME_WATCH_CLAUDE_CMD="claude -p {} --output-format json --model haiku".
The top of each page shows a presence stack (Notion-style avatars): you while the page is open, plus every agent a running tramecli answer is covering (copper ring). It's device-local and ephemeral — never synced — so avatars fade ~20s after a tab closes or the watcher stops.
⚙ Settings → Manage plugins. Everything ships disabled — a networked plugin never reaches out until you switch it on.
Deployments lists GitHub/GitLab releases waiting for approval in the sidebar (plus in-progress and recently-failed ones), and approves the gate / plays the manual job from the panel. Point it at the repos and projects to watch, then authenticate per forge with a PAT, GITHUB_TOKEN / GITLAB_TOKEN, or the gh / glab CLI (optional — there's a login button that spawns a terminal).
Tokens live only in this machine's
settings.json(mode 0600). They are never synced to the hub and never sent back to the UI, and each is bound to the forge host you configured.
SQL sources fill a database from a query on a PostgreSQL you choose (local or tailnet; no TLS yet). On a database page (or an inline database in Edit), ⇣ Connect opens a drawer: pick or paste a connection, run the query, map each result column to a database column (existing, new or skipped) and pick the key that matches rows, a schedule (manual, or every 5 minutes to 30 days), and whether rows whose key disappears are removed; Preview shows the resulting table, row by row, before anything syncs. The query runs from this device in a read-only transaction (30 s timeout, at most 10 000 rows, refused beyond). Result columns become read-only columns of the database (also in tramecli db rows) until you Detach one; a refresh writes only the cells whose source value changed, so your own columns and comments survive it.
Connection strings stay in this machine's
settings.json(0600) and are never sent back to the UI. The query results are ordinary rows: they sync to the hub and your other devices.
Notebook shows one Jupyter notebook in the sidebar, nothing else: no file browser, menus or side panels (Open in browser gives the full JupyterLab). Pick the notebook from the server's folder in the panel bar. Start JupyterLab launches a server in the folder you pick (jupyter lab when it is on your PATH, else uvx --from jupyterlab jupyter lab; set a project command such as uv run --with jupyterlab jupyter lab in the plugin settings), or Attach to a server already running on this machine (found through Jupyter's runtime dir, or by URL and token, or paste the Lab URL from your browser). Trame proxies the server under its own origin, so the Lab iframe needs no CSP exception; the token stays in the backend. Lab follows Trame's light/dark theme, Export → Trame report turns the open notebook into a report, Export → .html writes it next to the notebook. A server Trame started stops with Trame; an attached one is only detached.
The token of a spawned server is generated per start and never written to disk; an attached server's token is read from Jupyter's runtime file and kept in memory only.

Out-of-tree plugins are composed at build time: list their checkouts in a gitignored plugins.local.json ({ "plugins": ["../my-plugin"] }) and run just plugins. A plugin repo holds src/mod.rs, a Rust module compiled into trame-local that exports pub static PLUGIN implementing plugins::api::Plugin (manifest, routes with the full axum request and response, settings sanitizing, start and stop), and web/index.ts, a FrontendPlugin on @trame/web-api, plus optional e2e/ specs and mark-roles.json. The registry owns /enable, /settings and the enabled gate; the plugin answers everything else under /api/plugins/<id>/. The trame-plugin skill (installed by tramecli setup) walks an agent through writing, composing, testing and releasing one.
Hub and clients must use the same protocol version. Deploy the hub schema and API before restarting updated clients; older clients keep local data but cannot sync until upgraded. Session tags require protocol 6.
:8443 (TLS terminated by the API with the hub's private-CA cert — just hub-ca fetches the CA once per laptop). Every request carries a per-device bearer token, minted on the hub and stored sha-256 at rest, revocable. Postgres itself has no host port — the API is the only way in.POST /sync sends local mutations since a cursor and returns {acknowledgements, rejectedMutations, changes, nextCursor}. The cursor is a server-issued monotonic revision (change_log.rev) — client clocks never order delivery. A bad mutation is rejected alone; the rest of the batch lands.updated_at (value clock), origin (writing node), and deleted (soft delete). Hub and laptop apply the same rule from the shared protocol/ package: on conflict … do update … where excluded.updated_at > the stored row's.change_log and pg_notify; the API debounces and nudges connected laptops over WSS ("changed, pull now"), and local writes debounce a push — edits propagate device-to-device in a couple of seconds. The 15s poll stays as fallback.flowchart LR
subgraph laptop [Laptop — each machine]
app[Tauri 2 desktop / Rust axum] --> pgl[(local Postgres 18<br/>offline read/write)]
pgl <--> sync[Rust changeset push/pull]
rt[Rust WSS client]
end
subgraph hub [Hub — home server, Docker]
api[Bun API :8443<br/>device tokens + ACLs] --> pg[(Postgres 18<br/>docker-network only)]
links[:8444 — public /l/* pages<br/>behind any reverse proxy]
pg -. LISTEN/NOTIFY .-> api
pg --> links
end
sync <==>|HTTPS, private-CA TLS,<br/>bearer device token| api
rt <-.->|WSS — nudges only,<br/>data rides /sync| api
Linux x64 packages contain the Tauri 2 desktop, native Rust backend and CLI, PostgreSQL 18, and React assets; startup needs no JavaScript runtime or TypeScript sidecar. Packages no longer bundle the legacy PGlite migration helper: run v0.19.x once to convert pglite/ data, then upgrade.
just bundle builds the deb, snapcraft --destructive-mode builds the classic snap, and just bundle-appimage builds the best-effort AppImage. Release publication requires a manual workflow dispatch for the exact v* tag with allow_native_cutover=true, after its full CI gate. Tag pushes alone cannot publish. Native AppImage assets use native-x64.AppImage names so legacy AppImage updaters cannot silently install a database-runtime migration.
macOS arm64 ships an ad-hoc signed DMG (scripts/rust-package.sh dmg); Macs move their data by re-pulling from the hub rather than converting pglite/. Snap installation and hosted release execution still need qualification.
Auto-update: the AppImage and the macOS .app check the latest release every 6h, download it in the background and swap it in place; a banner offers Restart now (or the next launch runs it). deb/snap/source installs only get a link to the release. TRACKER_AUTO_UPDATE=0 keeps the check but skips the download; TRACKER_UPDATE_CHECK=0 disables both.
See native runtime and migration for data paths, backup and rollback instructions, isolated tests, and package requirements.
hooks/register.tsx 144 lines1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { Due, Link } from '../types'
5
6const link = atom({ plugin: 'trame', key: 'link' } as const, null)
7const dueAtom = atom({ plugin: 'trame', key: 'due' } as const, { late: 0, soon: 0 })
8const DAY_MS = 86_400_000
9// status key -> board color; refetched only when an unknown key shows up (the board is large)
10let statusColors: Record<string, string> = {}
11
12// late = before today, soon = today .. +7 days (the sidebar's DUE window)
13export function countDue(dates: string[], today: string): Due {
14 const t = Date.parse(today)
15 const late = dates.filter(d => Date.parse(d) < t).length
16 const soon = dates.filter(d => Date.parse(d) >= t && Date.parse(d) - t <= 7 * DAY_MS).length
17 return { late, soon }
18}
19
20const localDay = (d: Date) =>
21 `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
22const POLL_MS = 15_000
23// tramecli's own reply, so a command that only mentions it does not match
24const DONE = /tracked in Trame \(done /
25const EXIT = 'Exit'
26
27// the app writes its port here on start
28async function appBase($: EngineInterface): Promise<string | null> {
29 const home = await $.env.get('HOME')
30 try {
31 const { port } = JSON.parse(await $.fs.read(`${home}/.local/share/trame/port.json`))
32 return typeof port === 'number' ? `http://127.0.0.1:${port}` : null
33 } catch {
34 return null
35 }
36}
37
38async function refresh($: EngineInterface): Promise<void> {
39 let next: Link = { kind: 'offline' }
40 const base = await appBase($)
41 if (base) {
42 try {
43 const r = await $.http.fetch(`${base}/api/sessions/${await $.session.id()}?events=1`)
44 if (r.ok) {
45 const card = JSON.parse(r.text)
46 if (!(card.status in statusColors)) {
47 const b = await $.http.fetch(`${base}/api/board`)
48 if (b.ok) {
49 const { statuses } = JSON.parse(b.text) as { statuses: { key: string; color: string }[] }
50 statusColors = Object.fromEntries(statuses.map(x => [x.key, x.color]))
51 }
52 statusColors[card.status] ??= 'gray'
53 }
54 next = { kind: 'tracked', url: `${base}/?view=card&card=${card.id}`, title: card.title, color: statusColors[card.status] }
55 }
56 else if (r.status === 404) next = { kind: 'untracked' }
57 const d = await $.http.fetch(`${base}/api/due`)
58 if (d.ok) {
59 const dates = (JSON.parse(d.text) as { due: string }[]).map(x => x.due)
60 const due = countDue(dates, localDay(new Date(await $.clock.now())))
61 await update($, dueAtom, () => due)
62 }
63 } catch {
64 // app gone: stays offline
65 }
66 }
67 await update($, link, () => next)
68}
69
70// xdg-open (Linux), else open (macOS); the clipboard when neither works
71async function openCard($: EngineInterface, url: string, surface: Parameters<EngineInterface['ui']['copy']>[0]['surface']): Promise<void> {
72 for (const cmd of ['xdg-open', 'open']) {
73 try {
74 if ((await $.process.run([cmd, url])).exitCode === 0) return
75 } catch {
76 // not on this OS
77 }
78 }
79 const r = await $.ui.copy({ text: url, surface })
80 $.ui.toast(r.isCopied ? 'Could not open a browser: Trame card link copied' : `Could not open ${url}`)
81}
82
83export const register: Register = on => {
84 let isDone = false
85
86 on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
87 const ran = await next(e)
88 if (ran.deny === undefined && !ran.isError && DONE.test(ran.text ?? '')) isDone = true
89 return ran
90 }).catch(($, e, next) => next(e))
91
92 on('session.start', async ($, e, next) => {
93 await refresh($) // localhost: refused or answered in ms
94 $.clock.every(POLL_MS, () => refresh($))
95 return next(e)
96 })
97
98 // tracking usually happens during a turn: show it right away
99 on('turn.complete', async ($, e, next) => {
100 void refresh($)
101 if (isDone && e.agentId === undefined && !e.isAborted) {
102 isDone = false
103 // detached: $.command.run rejects inside a hook the turn waits on
104 void (async () => {
105 const answer = await $.ui.ask('Trame card is done. Exit this session?', [EXIT, 'Stay'])
106 if (answer === EXIT) await $.command.run({ command: 'exit' })
107 })().catch(err => $.ui.log(`trame: exit prompt failed: ${err}`, { to: 'debug' }))
108 }
109 return next(e)
110 })
111
112 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
113 const l = await read($, link)
114 // during a turn the spinner sits above this slot: give it the room
115 if (e.props.hasSurvey || e.props.isWorking || !l) return next(e)
116 const { Box, Button, Text } = $.ui.resolve(e)
117 const due = await read($, dueAtom)
118 const dueText = l.kind === 'offline' || !(due.late + due.soon) ? null : (
119 <Text>
120 {' '}
121 {due.late ? <Text color="red">⚑ {due.late} late</Text> : <Text color="yellow">⚑</Text>}
122 <Text dimColor>{due.late ? ' · ' : ' '}{due.soon} due</Text>
123 </Text>
124 )
125 if (l.kind !== 'tracked') {
126 return (
127 <Box marginBottom={1} paddingLeft={1}>
128 <Text dimColor>○ trame · {l.kind === 'offline' ? 'offline' : 'no card'}</Text>
129 {dueText}
130 </Box>
131 )
132 }
133 return (
134 <Box marginBottom={1} paddingLeft={1}>
135 <Text color={l.color}>● </Text>
136 <Text>{l.title.length > 48 ? `${l.title.slice(0, 47)}…` : l.title}</Text>
137 <Text> </Text>
138 <Button key="open" label="open" onPress={press => openCard($, l.url, press.surface)} />
139 {dueText}
140 </Box>
141 )
142 })
143}
144types/index.d.ts 12 lines1// tracked: the card, color = its status color; untracked: app up, no card; offline: app unreachable
2export type Link = { kind: 'tracked'; url: string; title: string; color: string } | { kind: 'untracked' } | { kind: 'offline' }
3
4// todos late, and due within the next 7 days, across all of Trame
5export type Due = { late: number; soon: number }
6
7declare module 'claude-code' {
8 interface PluginState {
9 trame: { link: Link | null; due: Due }
10 }
11}
12