xarmian 5dc42b60df feat(collab): wire Yjs WebSocket provider + Y.Doc lifecycle (TASK-1259) (#457)
* feat(collab): wire Yjs WebSocket provider + Y.Doc lifecycle (TASK-1259)

Adds a thin y-websocket-style provider speaking the binary protocol
already implemented server-side in internal/collab/room.go. The
provider lives in a Svelte 5 .svelte.ts module so connection state
(`connected`, `synced`) can be consumed reactively by upcoming UX
tasks (TASK-1264 pending-sync indicator, TASK-1265 mobile reconnect).

Wire format mirrors the server's first-byte discriminator:
  0x00 → y-protocols/sync (persisted to op-log + broadcast)
  0x01 → y-protocols/awareness (broadcast only, ephemeral)

Lifecycle is bound to the item-detail page via $effect keyed on
`${item.id}:${canEdit}` — same key the <Editor> already re-mounts on,
so the Y.Doc and provider tear down in lockstep with the editor.
View-only viewers (canEdit === false) keep the legacy non-collab
editor; their read-only y-binding is deferred to TASK-1266.

Reconnect uses 1s/2s/4s/...30s exponential backoff. Sophisticated
mobile reconnect (visibility, network state) is TASK-1265.

KNOWN TEMPORARY REGRESSION: existing items with non-empty
items.content render an empty editor on first open under collab,
because the Y.Doc starts empty and TASK-1259 doesn't seed from
markdown. TASK-1261 (next in Phase 2) adds the lazy seed-after-
initial-sync path. New items + items already round-tripped through
collab are unaffected.

Drive-by lint cleanup of dead code that escaped Phase 1's
make-install-skips-lint loophole:
- gofmt -w on internal/collab/{applier,bus,manager}.go
- removed unused test/debug helpers Room.peerCount and
  Room.applierConnCount (re-add with real callers when needed)

Parent: PLAN-1248

* fix(collab): gate Editor mount on ydoc + handle applier_request + catch-up state per Codex review (round 1)

Three findings from round 1:

1) [P1] $effect constructs ydoc AFTER Editor's onMount runs, so the
   first mount on an editable item registered StarterKit history
   instead of the Collaboration extension. The {#key} excluded ydoc,
   so the editor never re-mounted when ydoc later became truthy →
   editable users got a non-collab editor while the provider connected
   to an unused Y.Doc.

   Fix: gate the editable Editor mount on `ydoc` being ready
   (`{#if !canEdit} ... {:else if ydoc} ...`). Adds at most one
   reactive tick of delay; guarantees the first mount has the binding
   registered.

2) [P1] Provider dropped non-binary WebSocket frames, but the server
   sends `applier_request` as TextMessage. With TASK-1259 minting
   active rooms, every concurrent CLI/MCP/API content PATCH would
   sit blocked for 30s waiting for an ack, then fall back to a
   direct write — and the in-memory Y.Doc would still hold stale
   state and clobber it on the next 5s flush. Silent data loss.

   Fix: parse TextMessage frames as JSON ControlMessage. On
   `applier_request`, invoke an `onApplierRequest` callback (the
   page passes `editor.commands.setContent(markdown)`) and send
   `applier_ack` on success. The ExpiresAtMillis-driven late-apply
   guard remains TASK-1262's full scope.

3) [P2] Local Y.Doc updates were silently dropped if the socket was
   closed when handleDocUpdate fired. On reconnect the dumb-relay
   server can't reconstruct missing updates from a state vector, so
   any edits made before the first open or during a disconnect
   could be lost.

   Fix: after sending syncStep1 in onOpen, also send the current
   doc state as a single update via `Y.encodeStateAsUpdate(ydoc)`.
   CRDT idempotency makes this safe on initial open (server already
   has these ops via op-log replay → sees a no-op update). Larger
   docs incur a one-time cost on each connection; TASK-1265's
   mobile-reconnect work can replace this with a buffered queue.

* fix(collab): destroy provider during rawMode + enforce ExpiresAtMillis on applier requests per Codex review (round 2)

Two findings from round 2:

1) [P1] collabKey ignored rawMode, leaving the WS provider connected
   while the user edited via RawMarkdownEditor. Raw saves bypass the
   y-binding (PATCH writes items.content directly), but the server
   sees an active room → routes the PATCH through the applier flow
   → no editor mounted → 30s timeout fallback → direct write. The
   stale Y.Doc still in memory then overwrote the raw save on the
   next 5s flush after toggling back.

   Fix: include rawMode in the collabKey derivation so toggling raw
   destroys the provider (and the in-memory Y.Doc), and toggling back
   mints a fresh pair that re-seeds from the op-log + TASK-1261's
   lazy markdown seed.

2) [P1] Provider passed expires_at_millis to the handler but never
   gated on it. A backgrounded tab that wakes after the server
   retried or fell back could still apply setContent and overwrite
   newer peer edits.

   Fix: enforce the expiry in CollabProvider — check before
   invoking the handler AND re-check before acking (handlers are
   awaited and could span the deadline). Suppress the ack if either
   gate trips; the server interprets "no ack" as "applier
   unavailable" and falls back cleanly.

* fix(collab): prune op-log on direct-write fallback + pre-mutation expiry check per Codex review (round 3)

Two findings from round 3:

1) [P1] rawMode toggle to/from rich left a stale op-log: raw saves
   wrote items.content directly while the destroyed provider's old
   op-log persisted. Toggling back minted a fresh Y.Doc that
   replayed the old log → showed pre-raw content → silently
   overwrote the raw save on the next 5s flush.

   Fix server-side: when ApplyExternalContent returns ErrNoActiveRoom
   (no peers in memory, no in-flight Y.Doc state to corrupt), prune
   the op-log alongside the direct items.content write so future
   collab sessions start from a clean slate seeded by items.content
   (TASK-1261's lazy seed). Pruning is intentionally NOT applied to
   ErrNoApplierAvailable / ErrAllAppliersTimedOut — those paths
   may have live peers whose Y.Doc state would diverge.

2) [P2] Provider's post-handler expiry check only suppressed the
   ack, not the actual setContent mutation owned by the page
   handler. An async handler that crossed the deadline could still
   write stale markdown into the Y.Doc.

   Fix: page handler now does its own pre-mutation expiry check
   inside onApplierRequest before calling setContent. Documented
   the contract on ApplierRequestHandler — handlers MUST honour
   expiresAtMillis BEFORE mutating state.

* fix(collab): prune op-log on grace-TTL applier-unavailable + suppress autosave when collab active per Codex review (round 4)

Two findings from round 4:

1) [HIGH] op-log pruning still skipped ErrNoApplierAvailable. When
   raw-mode destroys the in-tab provider, the room remains in its
   60s grace TTL with zero conns, so the next direct-write PATCH
   returns ErrNoApplierAvailable (not ErrNoActiveRoom). Stale op-log
   rows persisted; toggling back within the grace window resurrected
   pre-raw-save Y.Doc state.

   Fix: prune op-log on ErrNoApplierAvailable too — the "no live
   conns" condition makes pruning safe (no peers to corrupt).
   ErrAllAppliersTimedOut still preserves op-log because peers may
   still be alive there.

2) [HIGH] Once the WS provider is active the legacy 1.2s content
   autosave PATCH gets intercepted by the applier path
   (handleUpdateItem branch added in TASK-1252). On applier success
   input.Content is nil'd out, so UpdateItem never writes the
   markdown snapshot. The page's autosave was the only canonical
   items.content flush in this diff — search / share-page / API
   consumers would see stale content forever.

   Fix: short-circuit handleContentUpdate when collabProvider is
   set. The Y.Doc + op-log are canonical; items.content stays at
   its pre-collab snapshot until TASK-1260 introduces the proper
   5s idle flush with applier-bypass semantics. This is a known
   Phase-2-internal regression closed by the very next task in
   this run.

* fix(collab): tighten error classification + per-item lock + raw-mode flush per Codex review (round 5)

Three findings from round 5:

1) [HIGH] applier.go could return ErrAllAppliersTimedOut even when
   no applier_request was ever successfully written (a row of write
   failures followed by no remaining candidates). The handler-side
   prune skipped that case, leaving stale op-log rows even though
   no peer received the request.

   Fix: track `anyWriteSucceeded` across the attempts and return
   ErrNoApplierAvailable (which prunes) when the loop exits without
   ever putting bytes on the wire.

2) [HIGH] Race between ApplyExternalContent's no-room classification
   and the subsequent Prune/UpdateItem: a fresh Join could mint a
   room and replay the soon-to-be-pruned op-log into a new client,
   leaving it with stale Y.Doc state that overwrites the
   freshly-written items.content on the next idle flush.

   Fix: introduce per-item setup mutex on RoomManager. Join holds
   the lock across addConn + replayTo and releases it before the
   long-lived readLoop. New PruneAndApply method wraps the
   prune+direct-write in the same per-item lock and re-verifies
   "no live peers" under it (returns ErrRoomActiveDuringPrune if a
   peer slipped in, in which case the caller falls through to a
   plain direct write without pruning). Lock order: per-item lock
   > m.mu > r.mu — Join and PruneAndApply both follow it.

3) [MEDIUM] Raw-mode 1.2s debounce timer could outlive the toggle
   to rich mode: the deferred PATCH fired post-collab-mint and got
   routed through the applier path (potentially overwriting newer
   peer state).

   Fix: track the latest pending raw markdown in
   `rawPendingMarkdown`. The Rich-mode button is now an async
   onclick that awaits a `flushRawIfPending()` synchronous PATCH
   before flipping `rawMode = false` (which is what activates the
   collab provider via the collabKey derivation).

* fix(collab): evict broken applier conn + retry on prune-race + retain raw pending on PATCH failure per Codex review (round 6)

Three findings from round 6:

1) [HIGH] When applier_request write failed, the broken roomConn
   stayed in r.conns, defeating PruneAndApply's "no live peers"
   check (which then returned ErrRoomActiveDuringPrune and the
   handler skipped pruning). Net effect: the prune-safety
   classification reverted to the round-5 hazard.

   Fix: in the applier write-failure branch, force-close the conn
   and call removeConn before continuing to the next applier. Both
   are idempotent with the readLoop's natural cleanup path
   (bus.Unsubscribe, conn map delete, conn.Close all tolerate
   double-invocation).

2) [HIGH] On ErrRoomActiveDuringPrune the handler fell through to a
   plain direct-write to items.content, bypassing the now-active
   peer's applier. The peer's stale Y.Doc could still overwrite
   items.content on the next idle flush.

   Fix: surface ErrRoomActiveDuringPrune from
   applyContentViaCollabOnce so the new applyContentViaCollab
   wrapper can retry the full ApplyExternalContent flow against
   the freshly-active room. Capped at applyContentMaxRetries=3 to
   prevent runaway loops if joins keep landing during prune
   attempts. After exhaustion, returns the same sentinel — the
   handler's existing `if err == nil { input.Content = nil }`
   gate falls through to direct write, which is the correct
   degraded-mode behavior.

3) [MEDIUM] flushRawIfPending cleared rawPendingMarkdown before
   the PATCH succeeded and the Rich-mode toggle always set
   rawMode = false regardless of flush outcome. A failed flush
   could activate collab with unsaved raw edits.

   Fix: rework flushRawIfPending to return success bool, retain
   rawPendingMarkdown on PATCH failure, and gate the Rich-button
   transition on `ok`. Added a re-entrancy guard
   (rawFlushInFlight) so a rapid double-click waits for the
   in-flight flush to settle instead of issuing a duplicate PATCH.

* fix(collab): drain-loop flushRawIfPending to handle fast-typist edge per Codex review (round 7)

[P1] flushRawIfPending snapshotted rawPendingMarkdown then awaited
the PATCH; if the user typed during the await, the equality check
preserved the newer edit but the function still returned `true` and
the Rich-mode handler flipped collab on. The newly-active provider
then raced the un-flushed pending raw save — exactly the hazard
the guard is meant to close.

Fix: rework flushRawIfPending into a bounded drain loop. Each
iteration snapshots-PATCHes-clears (with the equality check). The
loop runs up to RAW_FLUSH_DRAIN_CAP=5 iterations, returning `true`
ONLY when rawPendingMarkdown is null on exit AND no PATCH failed.
A fast typist who keeps the queue non-null across the cap returns
`false`, leaving the user in raw mode (next click retries).
PATCH failure short-circuits with `false` so the toggle stays in
raw mode and the unsaved markdown is preserved for retry.

* fix(collab): atomic prune+content-write + preserve newer raw edit on stale PATCH response per Codex review (round 8)

Two findings from round 8:

1) [P1] PruneAndApply ran the op-log prune under the per-item lock
   but the items.content write happened later in the post-loop
   UpdateItem call, OUTSIDE the lock. A fresh Join landing in that
   gap could replay the now-empty op-log, mint a peer with stale
   Y.Doc state, and then overwrite the freshly-written
   items.content on the next idle flush.

   Fix: applyContentViaCollab now takes a `directWrite` callback
   that the caller (handleUpdateItem) implements as a content-only
   UpdateItem. PruneAndApply's applyFn invokes it AFTER the prune
   so both run inside the same per-item critical section. The
   trade-off is two DB round-trips when a PATCH carries content +
   other fields together (rare): the content-only update happens
   inside the lock; the rest (title, fields, status) flows through
   the post-loop UpdateItem with input.Content nil'd to suppress
   the duplicate write.

2) [P1] In flushRawIfPending's drain loop, `item = updated`
   assigned the server-side snapshot from the just-PATCHed
   markdown even when a newer raw edit had landed in the meantime.
   RawMarkdownEditor mirrors `item.content` into its textarea
   unconditionally (line 16), so the stale assignment would reset
   the textarea mid-keystroke and lose the queued edit.

   Fix: only swap in the full updated snapshot when
   `rawPendingMarkdown === markdown` (no newer edit). Otherwise
   keep our local content and adopt only the server-side metadata
   (timestamps, version, modified_by) via spread.

* fix(collab): atomic mixed PATCH + raw autosave stale guard + rich→raw seeding per Codex review (round 9)

Three findings from round 9:

1) [P1] Toggling FROM rich+collab TO raw mode seeded
   RawMarkdownEditor from items.content, which is intentionally
   stale under collab (handleContentUpdate is suppressed while the
   provider is connected; TASK-1260 closes that gap with a 5s
   flush). Saving from raw mode would overwrite the live Y.Doc
   state with a pre-collab snapshot.

   Fix: when toggling to raw with a connected provider, capture
   the editor's current Y.Doc-derived markdown via
   `editor.storage.markdown.getMarkdown()` into a one-shot
   `rawSeedMarkdown` slot and pre-populate `rawPendingMarkdown` so
   the first auto-save persists it. RawMarkdownEditor seeds from
   `rawSeedMarkdown ?? item.content`. Cleared on rich-mode toggle.

2) [P1] The regular debounced raw autosave still assigned
   `item = updated` from a stale PATCH response. Same
   stale-snapshot hazard the Round 8 fix closed in
   flushRawIfPending.

   Fix: equality-check `rawPendingMarkdown === toSave` before
   swapping in the server snapshot. On stale, keep local content
   and adopt only the server-side metadata via spread.

3) [P2] Round 8 split the items.content write (under per-item
   lock) from the rest of UpdateItem (post-loop), losing
   atomicity for mixed PATCHes (content + title) and breaking
   Store.UpdateItem's content-versioning peek at Title.

   Fix: directWrite callback now invokes the FULL UpdateItem
   inside the per-item lock. A `fullWriteHandled` flag tells the
   handler to skip the post-loop UpdateItem entirely (otherwise
   we'd duplicate the write and create two version-history rows).
   Mixed PATCHes are atomic again under the lock.

* fix(collab): clear raw seed/pending on item navigation per Codex review (round 10)

[P1] Navigating between items left rawSeedMarkdown,
rawPendingMarkdown, and the contentDebounceTimer set from the
previous item. This caused two concrete hazards:

  (a) Item B's raw editor mounted with item A's live markdown via
      `rawSeedMarkdown ?? item.content`.
  (b) Clicking Rich on item B fired flushRawIfPending which
      PATCHed A's queued markdown INTO item B (cross-item data
      bleed).

Fix: at the top of loadData(), clear contentDebounceTimer,
rawSeedMarkdown, and rawPendingMarkdown so each navigation starts
from a clean slate. The collab provider's own lifecycle is
already keyed on item.id via $effect cleanup, so it doesn't need
the same explicit reset.

* fix(collab): item-id race guard on raw PATCH responses per Codex review (round 11)

[P1] In-flight raw PATCH responses (debounced autosave AND drain
loop) could clobber a newly navigated item. Clearing
contentDebounceTimer in loadData only cancels timers that have
not fired; an awaiting fetch keeps running and its `.then` /
`.catch` would assign back to the new page's `item` state.

Fix: mirror the existing TASK-754-style race guard pattern
(already used in the SSE / sync handlers above). Capture
`reqItemId = item.id` BEFORE the PATCH, then in the response
handler bail if `!item || item.id !== reqItemId`. Applied to
both handleRawContentUpdate's setTimeout body and
flushRawIfPending's drain loop.

* fix(collab): reset saveStatus on item navigation per Codex review (round 12)

[P2] After Round 11's race guard, a stale raw PATCH response that
matched a now-different item.id was correctly discarded — but
saveStatus had already been set to 'saving' before the await. With
loadData not resetting it, the next item could mount with
saveStatus pinned at 'saving' indefinitely, which then suppressed
all SSE/sync refreshes via the `if (saveStatus === 'saving')`
guards above.

Fix: in loadData's per-item state reset, clear saveStatusTimer
and reset saveStatus to 'idle' alongside the other transient
state. Cheap, scoped, no impact on the in-flight save's eventual
discard path.
2026-05-08 20:48:57 -04:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00

Pad

Project Management for the agent era.

CI Release Go Report Card Container image on GHCR License GitHub Sponsors


One binary. Local-first. No accounts required. Pad gives you a CLI, a web UI, and an AI agent skill — all backed by SQLite, all running on your machine. Your project data never leaves your laptop.

Pad dashboard showing collection summaries, active work, an active plan with progress, and a recent activity feed

Quick Start

brew install PerpetualSoftware/tap/pad
cd your-project
pad init                    # configure, auth, workspace, AI skill — all in one
pad server open             # opens the web UI at localhost:7777

pad init is the smart entry point — it auto-detects what's needed, walks you through each step, and is safe to re-run anytime (it skips finished steps and prints a status summary).

Then, in a fresh agent session in your project, say:

use pad to get IDEA-1

Your new workspace ships with a thoughtful first idea — IDEA-1 — that the agent reads and uses to help you get set up around your actual project. It's the fastest way to go from empty workspace to "okay, this is mine."

Why Pad?

Tools like Linear, Jira, and Notion are built for teams on the cloud. Pad is built for developers on their machine — and for the AI agents working alongside them.

Pad Linear / Jira Notion
Setup pad init Create account, invite team, configure Create account, pick template
AI agents Native /pad skill for 7+ tools Third-party integrations Third-party integrations
Data Local SQLite, you own it Their cloud Their cloud
Offline Full functionality Read-only cache at best Limited
CLI First-class Afterthought None
Price Free, open source Per-seat pricing Per-seat pricing

Features

For Developers

CLI that doesn't get in your way. Create tasks, search items, check status — without leaving the terminal.

pad item create task "Fix OAuth redirect" --priority high
pad item create idea "Real-time collaboration" --category infrastructure
pad item list tasks --status in-progress
pad item search "authentication"
pad project dashboard                   # Project dashboard
pad project next                        # What should I work on?
pad server info                         # How this client is connected to Pad

Web UI that stays out of your way. A clean, dark-themed interface at localhost:7777 with:

  • Board, list, and table views — drag-and-drop between status columns
  • Keyboard navigationj/k to move, Enter to open, Esc to go back, Cmd+K to search
  • Rich text editor — Tiptap-based with markdown, formatting toolbar, and auto-save
  • Wiki-links — type [[Title]] to link between items
  • Real-time updates — agent creates a task in the terminal, it appears in the browser instantly (via SSE)
  • Dashboard — collection overview, active work, plan tracking, activity feed

Pad tasks board view: kanban columns for Open, In-Progress, Done, Cancelled with task cards in each

For AI Agents

Your agent becomes a project partner. Install the /pad skill once, and your AI coding tool can read, create, and update project items through natural language.

pad agent install        # Auto-detects your tools and installs the skill

Works with Claude Code, Cursor, Windsurf, Codex, GitHub Copilot, Amazon Q, and JetBrains Junie.

Then just talk to your project:

> /pad what should I work on next?
> /pad I finished the OAuth fix
> /pad create a task to add rate limiting
> /pad let's brainstorm about the API redesign

Conventions and playbooks teach agents how your project works:

  • Conventions — trigger-based rules like "run tests before marking a task done" or "use conventional commits"
  • Playbooks — multi-step workflows like "when implementing a feature: read the spec, create a branch, write tests first, then implement"
pad item create convention "Run tests before completing tasks" \
  --field trigger=on-task-complete \
  --field scope=all \
  --field priority=must

Agents load relevant conventions automatically. All agent actions are attributed in the activity feed, so you always know what the AI changed.

Onboard agents to a new codebase:

pad workspace onboard    # Analyzes project structure, saves workspace context, and suggests conventions

Collections & Custom Fields

Pad organizes work into collections — typed containers with structured fields.

Built-in collections:

Collection Purpose
Tasks Work items with status, priority, assignee, effort, due date
Ideas Feature ideas with impact and category
Plans Project milestones with progress tracking
Docs Documentation, decisions, reference material
Conventions Project rules that guide agent behavior
Playbooks Multi-step workflows for agents to follow

Create your own with typed fields — select, text, date, number, url, relation, checkbox:

pad collection create "Bug Reports" \
  --fields "severity:select:low,medium,high,critical; browser:text; reproducible:checkbox"

Items get reference numbers automatically (TASK-5, BUG-12) and can be moved between collections with field migration.

Installation

Homebrew (macOS and Linux)

brew install PerpetualSoftware/tap/pad

Build from Source

git clone https://github.com/PerpetualSoftware/pad
cd pad
make build
cp pad ~/.local/bin/   # or /usr/local/bin/

Requires Go 1.26+ and Node.js 22+.

The go install github.com/PerpetualSoftware/pad/cmd/pad@latest path is not supported for the full Pad binary, because the web UI must be built and embedded during the source build.

Docker

docker run -p 127.0.0.1:7777:7777 -v pad-data:/data ghcr.io/perpetualsoftware/pad

This publishes Pad to localhost:7777 on the host machine, which is the recommended default for local use.

Single user, more than one device? Publish to all interfaces so you can reach Pad from your phone, tablet, or another machine on the same LAN, Tailscale network, or home VPN:

docker run -p 7777:7777 -v pad-data:/data ghcr.io/perpetualsoftware/pad

For multi-instance deployments, Pad supports Postgres + Redis via docker-compose.yml — see docs/deployment.md for the full setup.

Binary Download

Pre-built binaries for macOS, Linux, and Windows are available on the releases page.

Getting Started

1. Set up Pad

cd ~/projects/myapp
pad init "My App"

pad init is the smart entry point that handles everything in one command:

  • Configures this client's connection (local server, remote, or Docker)
  • Auto-starts the local server
  • Creates the first admin account on a fresh local install (Docker / remote hosts run pad auth setup on the server instead)
  • Logs you in if needed
  • Creates or links a workspace for the current directory (writes .pad.toml)
  • Installs the /pad skill for any AI tools detected in the project

Run from your project root. Safe to re-run anytime — it skips finished steps and prints a status summary if nothing's needed.

Choose a template with --template, or omit it for an interactive picker grouped by category (Software / People / …):

pad workspace init --list-templates                   # See the full catalog grouped by category
pad init "My App" --template scrum                    # Scrum-style with sprints
pad init "My App" --template product                  # Product management focused
pad init "My Hiring" --template hiring                # Company-side: requisitions, candidates, interview loops, feedback
pad init "Job Search" --template interviewing         # Candidate-side: applications, interviews, companies, contacts

Pad ships templates for software (startup / scrum / product), people workflows (hiring, interviewing), and has reserved categories for research, content, operations, and personal use so the same project-management primitives fit well beyond code projects.

2. Start working

# From the CLI
pad item create task "Set up CI pipeline" --priority high
pad item create idea "Add WebSocket support" --category infrastructure
pad project dashboard

# From the web UI
pad server open              # Opens localhost:7777 in your browser

# From your AI agent
# Just use /pad in Claude Code, Cursor, etc.

3. Teach your agents the rules

pad workspace onboard        # Auto-analyze project, save workspace context, and suggest conventions
# Or browse the convention library
pad library list --type conventions  # Pre-built conventions you can adopt
pad library list --type playbooks    # Pre-built multi-step workflows

4. Optional — connect a desktop AI app via MCP

Pad ships an MCP (Model Context Protocol) server so Claude Desktop, Cursor, or Windsurf can manage items, plans, ideas, and dependencies as native tools, read workspace state by URL, and load multi-step workflows as prompts.

pad mcp install claude-desktop   # or: cursor, windsurf, --all
# Restart the client; pad shows up as the "pad" MCP server.

Tool catalog (v0.2) — eight resource × action tools, no flat verb explosion:

Tool Actions
pad_item create, update, delete, get, list, move, link, unlink, deps, star, unstar, starred, comment, list-comments, bulk-update, note, decide
pad_workspace list, members, invite, storage, audit-log
pad_collection list, create
pad_project dashboard, next, standup, changelog
pad_role list, create, delete
pad_search query
pad_meta server-info, version, tool-surface
pad_set_workspace session-default workspace pinning

Plus resources at pad://workspaces, pad://workspace/{ws}/dashboard, pad://workspace/{ws}/items, pad://workspace/{ws}/items/{ref}, pad://workspace/{ws}/collections, and pad://_meta/version.

Stability contract — two version constants, both advertised in the initialize handshake under capabilities.experimental.padCmdhelp and capabilities.experimental.padToolSurface (and queryable at pad://_meta/version):

  • cmdhelp_version: "0.1" — CLI help-tree contract (used at dispatch time)
  • tool_surface_version: "0.2" — MCP tool catalog contract

External agents pin against these so a future rename doesn't break them silently. Errors come back as structured envelopes ({error: {code, message, hint, available_workspaces, ...}}) with a closed eight-code taxonomy.

Full guide at getpad.dev/mcp/local — install paths, action enums per tool, error taxonomy, troubleshooting.

CLI Reference

pad auth configure                    Configure how this client connects to Pad
pad auth setup                        Initialize the first admin account
pad auth login                        Sign in
pad auth whoami                       Show current user

pad server start                      Start the Pad API server
pad server stop                       Stop the Pad server
pad server info                       Show client, connection, and local server status
pad server open                       Open web UI in browser

pad workspace init [name]             Initialize workspace in current directory
pad workspace link <workspace>        Link current directory to an existing workspace
pad workspace list                    List all workspaces
pad workspace switch <workspace>      Switch active workspace
pad workspace context                 Show structured workspace context
pad workspace context set --file X    Update structured workspace context from JSON
pad workspace onboard                 Analyze project, save workspace context, and suggest conventions
pad workspace members                 List workspace members
pad workspace invite <email>          Invite a workspace member
pad workspace join <code>             Accept an invitation
pad workspace export                  Export workspace data
pad workspace import <file>           Import workspace data

pad project dashboard                 Project dashboard
pad project next                      Recommended next task
pad project ready                     Query actionable next items
pad project stale                     Query stalled or attention-worthy items
pad project standup [--days N]        Daily standup report
pad project changelog [--days N]      Release notes from completed items
pad project watch                     Real-time activity stream
pad project reconcile                 Reconcile item and PR state

pad item create <coll> "title"        Create item (task, idea, plan, doc, ...)
pad item list [collection]            List items (filters: --status, --priority, --all)
pad item show <ref>                   Show item detail
pad item update <ref>                 Update item fields
pad item delete <ref>                 Delete item
pad item move <ref> <collection>      Move item between collections
pad item edit <ref>                   Open item in $EDITOR
pad item search "query"               Full-text search across all items
pad item comment <ref> "text"         Add comment to an item
pad item comments <ref>               View item comments
pad item note <ref> "summary"         Append an implementation note to an item
pad item decide <ref> "decision"      Append a decision log entry to an item
pad item block <src> <target>         Create dependency
pad item blocked-by <item> <blk>      Mark item as blocked
pad item deps <ref>                   Show dependencies
pad item unblock <src> <target>       Remove dependency
pad item related <ref>                Show direct relationships for an item
pad item implemented-by <ref>         Show incoming implementers for an item
pad item bulk-update --status X       Batch update multiple items

pad collection list                   List collections with item counts
pad collection create <name>          Create a custom collection

pad library list                      Browse convention and playbook library
pad library activate <title>          Activate a convention or playbook

pad agent install [tool]              Install /pad skill for AI coding tools
pad agent status                      Show supported tools and installation status
pad agent update                      Update installed tool integrations

pad github link [item-ref]            Link current branch's PR to item
pad github status [item-ref]          Show PR status for linked items
pad github unlink <item-ref>          Remove PR link from item

pad webhook list             List workspace webhooks
pad webhook create <url>     Create webhook

All commands accept --format json for machine-readable output and --workspace to target a specific workspace.

Authentication

Pad runs without authentication by default for frictionless local use. For local installs, pad init creates the first admin account inline. The lower-level commands are useful when you're hosting a Pad server (Docker / remote) and need to set up auth on the server host directly:

pad auth setup         # Initialize the first admin account (server host, non-local mode)
pad auth login         # Sign in
pad auth whoami        # Show current user
pad auth logout        # Sign out

Once a user exists, all API requests and web UI access require authentication. Credentials are stored in ~/.pad/credentials.json. Multiple users can be invited to workspaces with role-based access control (owner, editor, viewer).

pad workspace members               # List workspace members
pad workspace invite user@example.com
pad workspace join <code>

Architecture

┌──────────────────────────────────────────────┐
│              pad (single binary)              │
│                                               │
│  ┌──────────┐  ┌──────────┐  ┌────────────┐  │
│  │   CLI    │  │  REST    │  │  Embedded  │  │
│  │ (Cobra)  │  │  API     │  │  Web UI    │  │
│  └────┬─────┘  └────┬─────┘  │ (SvelteKit)│  │
│       │    HTTP      │        └────────────┘  │
│       └──────────────┤                        │
│                ┌─────▼─────┐                  │
│                │  SQLite   │                  │
│                │  + FTS5   │                  │
│                └───────────┘                  │
└───────────────────────────────────────────────┘
  • Go backend — chi router, SQLite via modernc.org/sqlite (pure Go, no CGO), FTS5 full-text search, SSE for real-time updates
  • SvelteKit frontend — Svelte 5, Tiptap editor, drag-and-drop, adapter-static, embedded via go:embed
  • Single binary — serves the API and web UI, runs on macOS, Linux, and Windows
  • Workspace-per-project — each project gets its own workspace linked by a .pad.toml file

All data lives in ~/.pad/pad.db. Your data. Your machine. No telemetry, no cloud, no accounts required.

Contributing

See CONTRIBUTING.md for the development guide.

make build      # Build web UI + Go binary
make test       # Run Go tests
make dev-web    # SvelteKit dev server with hot reload
make install    # Build, install to ~/.local/bin, restart server

Security

See SECURITY.md for reporting vulnerabilities.

License

Apache License 2.0

Languages
Go 64.8%
TypeScript 21.5%
Svelte 13.1%
Shell 0.3%
CSS 0.1%