# Port Daddy Internal Dev

> Contributor manual for agents working ON the Port Daddy codebase itself — the daemon, MCP server, FleetBar / Fleet Control Center, website, CLI surface, distribution mirrors, internal recovery ledger, and the named internal actors (Coxswain / Navigator / Cartographer / Lookout / Quartermaster + Shipwright). Use when editing the port-daddy repo. NOT for agents using Port Daddy on other projects (use port-daddy-agent-skill for that), and NOT distributed to public skill catalogs — this skill is private to the port-daddy repo.

- Skill: `curiositech/port-daddy-internal-dev` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx get-skill add curiositech/port-daddy-internal-dev`
- Raw SKILL.md: https://api.skillmd.com/api/skills/curiositech/port-daddy-internal-dev/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: FSL-1.1-MIT
- Author: curiositech (https://skillmd.com/u/curiositech)
- Updated: 2026-11-18
- Page: https://skillmd.com/skills/curiositech/port-daddy-internal-dev

---


# Port Daddy — Internal Contributor Manual

You are editing the Port Daddy codebase itself: the daemon, MCP server,
FleetBar, Fleet Control Center, website, CLI, SDKs, distribution surfaces,
the recovery ledger, and the internal actor inboxes. This skill is private
to the port-daddy repo because most of what's here would be noise on a
project that just *uses* Port Daddy.

For the public skill — how any agent on any project should drive Port
Daddy — see the sibling `port-daddy-agent-skill`.

## NOT For

- Agents on other projects driving Port Daddy as a coordination tool — that's `port-daddy-agent-skill`.
- General coding without a Port Daddy surface change.
- Distribution to public skill catalogs.
- Replacing the live daemon, recovery ledger, or actor inboxes as sources of truth — those still come first.

## Operator vs Agent — the product rule

When designing or changing a Port Daddy surface, the test is "would the
operator have to drop to a terminal to do this routinely?" If yes, the design
is wrong. The operator's surface is FleetBar + the dashboard. `pd` CLI exists
for agents and emergencies. Every routine operator action (configure
credentials, restart daemon, see open feedback, harvest a roadmap entry, ack a
salvage item) must have a FleetBar button or dashboard panel as its primary
surface — CLI is the secondary path for agents and scripts.

Contributor implication: when you add a new actuator or data source, ship the
FleetBar/dashboard affordance in the same slice when reasonable, or file a
`high`-severity FleetBar feedback entry so cartographer promotes it to the
roadmap before the CLI-only path ships to operators. Examples in flight:
`fleetbar-secret-management-with-provider-deeplinks`,
`fleetbar-console-must-support-zoom-and-text-scaling`.

The Harbor Work Register is the sanctioned coordination surface while the
local runtime is intentionally Off. Browser approval may mint only a one-use,
short-lived, repository/task/owner-bound Register credential. Keep that
credential in a dedicated table and resolver; never admit it through the
general `pdu_` account-auth path. The Register remains occupancy authority,
not roadmap authority: a missing or stale daemon-pushed mirror means unknown
work and `proposed` claims, never permission for the Relay to become a second
roadmap writer.

## Validate a roadmap declaration offline

Before publishing a PR, save its body to an owned file under `~/coding/tmp/`
and run `node node_modules/tsx/dist/cli.mjs scripts/check-roadmap-link.ts
--body-file <absolute-pr-body-path>` from the contributor checkout (one command).
This path needs the existing development dependencies but no GitHub credentials,
GitHub event, roadmap snapshot, or local Port Daddy runtime. It takes precedence
over inherited event state and numeric PR arguments; label and comment paths
remain dry-run. A nonzero exit means the declaration is missing or invalid.

This validates the current declaration-only contract: a slug or a reasoned
`Roadmap-Item: none` opt-out. It does not prove that a slug exists, that its
roadmap state is fresh, that a planning declaration was reconciled, or that the
PR is ready to merge. Preserve that distinction and keep an operator-halted
runtime stopped; do not restore snapshot-age or planning-file merge gates as
part of using this command.

## How to work a slice (operating expectations)

The full posture lives in `AGENTS.md` § Agent Operating Expectations. The
repo-specific mechanics:

- **Coordinate + pay rent.** Clean linked worktree off `origin/main`,
  `pd begin … --lifecycle durable`, `pd session files add` before editing, a
  `pd note` per commit (the Coordination Guard enforces it), `pd done` at the end.
  When inheriting stale work, prefer `pd takeover <old-session-id> [reason]`
  (or `pd session takeover <old-session-id> [reason]`) over deleting or silently reusing the old session; notes and claim
  history are append-only evidence.
- **Supplant, don't migrate.** No users yet (operator directive, 2026-08-22):
  a new mechanism that overlaps an old one replaces it exhaustively in the same
  slice — delete the legacy path, fix every caller, no compat shims, no
  "legacy mode" flags, no downgrade fallbacks, no deprecation windows.
  Backwards compatibility only when the operator explicitly asks, per surface.
- **Assume broken; verify both ends.** After any write, read it back from the
  surface that should serve it, and prove cold start (daemon down → elegant
  operator instruction, never a stack trace), worktrees, a second user, and the
  GitHub round-trip. A green exit code is not evidence.
- **Keep daemon actuation singular.** On canonical macOS, launchd alone starts,
  stops, replaces, and resurrects the daemon. The daemon publishes readiness;
  Bosun detects a dead/stale generation and asks launchd for replacement;
  Doctor/status/native UIs observe the same snapshot. Never add a detached
  fallback to `pd start` or `pd restart`, never silently walk the canonical port,
  and do not call runtime health green unless launchd PID, `/health`, PID/port
  files, heartbeat, listener, and binary hash converge.
- **Confirm the telemetry trail.** Calls must show up in `pd usage` AND in the
  transcript saves (`lib/transcripts.ts`), and durable state must ride the
  Cloudflare fabric (`lib/relay-client.ts`) so posterity is cheap and survives the
  container — verify the read-back, don't assume it.
- **Dogfood novelly + capture wins.** Exercise a CLI/MCP/SDK surface you haven't
  before each slice; when a hard-won gambit lands, write it into this skill (or the
  public `port-daddy-agent-skill` if it generalizes).
- **Generalize.** Features must work for non-tsx/non-Rust repos, remote harbors,
  other machines, and shared GitHub teams — not just this checkout.
- **Book and research checks.** Reconcile coordination/kernel work against the
  chapter manifest `book/textbook.json` and the claims in
  `docs/harbor-research/omni-ledger.json`. The Book includes Chapter 0 plus eight
  manifest chapters; chapter PDFs are retired. Correct a mathematical claim's
  dependent figures, summaries, exercises, and indexed description together.
  Date manuscripts from `book/textbook.json`'s `edition.date`; standalone chapter
  title pages use the generated `\pdeditiondate` macro, as does the bound book.
  Keep dated editorial changelog entries in the Omni ledger, outside the printed
  book and its buildable source archive.
- **Book publication acceptance.** A successful TeX process is insufficient:
  `scripts/build-whitepapers.sh` must settle references and margin geometry before
  copying the PDF. Run `scripts/harbor-research/run_pdf_checks.py` on that exact
  PDF and inspect facing spreads, including all chapter openers. Keep
  `\pdcopyreviewfalse` for publication; editorial review sheets are not Book pages.
  Record the rendered hash, source tree, gates, and visual findings. A local proof
  and an authorized hosted Book refresh are separate delivery states.
  When the accepted PDF changes, run `bash scripts/build-spreads.sh` before the
  metadata check. Commit the facing PDF and its source-bound JSON receipt with
  the canonical Book; website builds verify both file hashes before publishing.
- **Skill matching.** If you're missing a matching skill, use Jury-rig when the
  local runtime is explicitly enabled. When it is halted, do not invoke `pd`, its
  MCP server, hooks, daemon, or any substitute runtime; read the applicable
  checked-in `SKILL.md` and needed references directly. That is offline
  preparation, not a native graft or proof of current catalog state.
- **Launch work through PD spawn** (`pd spawn`, SDK `spawn()`, or MCP `spawn`),
  never a raw side-channel — so the work is registered, sandboxed, budgeted, salvageable.
- **Managers orchestrate; workers author PRs.** A manager lane delegates
  implementation edits, PR body drafting, and PR authoring to worker sessions.
  The manager reads returned artifacts, checks evidence, steel-mans the strongest
  case against shipping, retunes roles by round, and decides whether work
  advances.
- **Target: durable roles keep ledgers.** Notes are immutable evidence; role
  ledgers are curated projections for future briefings. Do not claim this as a
  fully shipped runtime unless the branch/live daemon proves it. Ledger entries
  that summarize operator preferences or cross-repo tactics must carry
  provenance, redaction/sync posture, account/team authority, and staleness.
- **Keep `README.md` current** in the same PR when a slice changes a documented surface.
- **Feature PRs and releases are separate.** For daemon/CLI changes, run the
  local binary smoke test only when local runtime execution is authorized;
  during the operator halt, use compile-only and authorized hosted evidence,
  and mark local runtime proof unverified. Add the required changelog fragment
  and take the review PR through its authorized finish line. The release train opens the
  separate version PR and publishes the tag/Release; the tap's workflow rolls
  the formula from the stable feed. See `docs/RELEASING.md` §§1, 3. Do not bump
  versions or publish a release merely because a feature PR changed `pd`.
- **Prove Squid from release cargo.** Adding a hook to source is not enough.
  Declare every required tentacle/identity/steering asset in
  `release-artifacts.json`, stage it in `release.yml`, then run
  `scripts/smoke-squid-release.mjs` against the compiled binary outside the
  source tree. The proof must cover Claude/Gemini project config, Codex/agy
  user config, exact-root gating, statusline, Pilot SessionStart, `/squid`, and
  machine-readable READY/LIVE state. A source-suite pass cannot substitute for
  this artifact-boundary proof.
- **Prove native dependencies again after macOS signing.** Hardened runtime can
  change dynamic-loader behavior after an unsigned build smoke has passed. Run
  the native import through the exact signed `dist/pd` release pair, with
  `DYLD_*` absent, before soak or archive sealing. Package dylibs behind a
  verified executable-relative Mach-O rpath and keep
  `com.apple.security.cs.allow-dyld-environment-variables` out of the release
  entitlements; do not trade a packaging defect for an injection surface. FleetBar
  release packaging must also sign every nested Mach-O under the bundled payload
  inside-out; Bun JIT entitlements belong on the Bun executable only, never on
  ordinary `.dylib` runtime libraries.
- **Keep coordination content bounded; the SITREP is the visible value
  surface.** Coordination content (alerts/pheromones) stays invisible and
  bounded: with the SITREP dial off, a healthy no-op turn emits zero bytes and
  no status message, never starts the daemon or shells through the full `pd`
  CLI, and filters file traces to the exact project root before rendering them.
  Keep that coordination block to one heading plus at most two facts, clamp its
  context budget, and keep harness deadlines at one second. The regression
  proof must include thousands of irrelevant matrix entries while still
  surfacing one fresh exact-root fact. Installer tests must also prove atomic,
  idempotent config writes and migration of duplicate legacy Codex
  registrations without disturbing user hooks. The end-of-turn SITREP
  compulsion is the deliberate exception (operator doctrine reversal,
  2026-08-22): governed by the per-repo `sitrep.endOfTurn` dial
  (off|suggest|enforce, default enforce; `PD_SITREP` env override wins, then
  `agent.config.json` → `.portdaddy/sitrep.json` → `.portdaddy/project.json`),
  the pd-hook-prompt tentacle and the SessionStart Pilot inject the end-of-turn
  SITREP table contract — a constant-size standing block that rides outside the
  coordination byte cap. Do not re-bound or silently strip it; repos that want
  quiet turns dial it off explicitly.

## Core Decision Tree

```mermaid
flowchart TD
    start[Edit lands on port-daddy] --> what{What changed?}
    what -->|CLI surface| cli[Update CLI help → references → website /docs/cli → MCP tools → skill bundle. Send Lookout drift report when scope > 2 surfaces.]
    what -->|Daemon API| api[Update lib + routes + OpenAPI + SDK ref. Run pd integration ready signals. Audit pd guard for new contracts.]
    what -->|MCP tool| mcp[Update mcp/server.ts + handshake test + skill catalog. Re-validate all 10 tool schemas.]
    what -->|FleetBar / Console| ui[Update Mac app + screenshots in references/fleetbar-and-console.md. Test from a clean install root. For updates, pin the exact release and prove checksum + Developer ID + notarization + rollback + relaunch.]
    what -->|Distribution mirrors| dist[Update brew formula sha256. Bump version in 4 places. Rerun install.sh end-to-end. Lookout review.]
    what -->|Internal actor| actor[Update routes/+ lib/ owning module + actor-roster.md + decisions/who-do-i-message.md. Backfill inbox tests.]
    what -->|Recovery ledger| ledger[Edit docs/recovery/CURRENT-WORK.md only via Cartographer/Navigator. Don't bypass the actors.]
    cli & api & mcp & ui & dist & actor & ledger --> ship[Reconcile + guard + tag + push]
```

## Internal Actor Embodiments

The five actor roles in the public skill are *concepts*. In this repo,
each one has a concrete **embodiment**: a route, a lib module, a fleet
persona, and a status surface. When you edit any one of these, you are
editing a piece of the actor's body, and the corresponding inboxes,
contracts, and operator surfaces must stay coherent.

| Actor | Route | Lib module | Fleet persona | Status surface |
|---|---|---|---|---|
| **Coxswain** | `routes/claims.ts`, `routes/locks.ts` | `lib/claims/`, `lib/locks/`, `lib/symbol-index/` | `agents/coxswain.yaml` (when present) | claim density + lock health in `pd briefing` | <!-- cite-exempt: illustrative role/template path -->
| **Navigator** | `routes/sessions.ts`, `routes/recovery.ts` | `lib/sessions/`, `lib/salvage.ts` | `agents/navigator.yaml` | `docs/recovery/CURRENT-WORK.md` | <!-- cite-exempt: illustrative role/template path -->
| **Cartographer** | `routes/cartographer.ts` | `lib/roadmap-progress.ts`, `lib/feedback.ts` | `agents/cartographer.yaml` (also lives at `.claude/agents/cartographer/`) | `.cartographer/status.md`, `IDEAS-TROVE.md`, `DOGFOOD-FEEDBACK.md` |
| **Lookout** | `routes/lookout.ts` | release-surface scanners under `lib/` | `fleet/documentarian.sh` (current shell-script form) | drift reports posted to lookout inbox | <!-- cite-exempt: illustrative role/template path -->
| **Quartermaster** | `routes/spawn.ts`, `routes/fleet.ts` | `lib/spawner.ts`, `lib/cost-tracker.ts`, `lib/backend-readiness.ts`, `lib/resource-governance.ts` | `agents/quartermaster.yaml` | spawn budget + readiness in FleetBar |

**Shipwright** is a sixth, internal-only role: it owns skill-bundle
ingestion, archetype classification, and survey aggregation across the
fleet. Lives at `lib/shipwright/{archetypes.ts, skill-index.ts, survey.ts}`
and `routes/shipwright.ts`. Tests under `tests/unit/shipwright-*.test.js`.
Don't expose Shipwright in the public skill — it's a port-daddy-internal
abstraction.

## Recently Shipped Surfaces — contributor module map

These landed on `main` in the last few weeks. When you touch one, you own
its full mirror set (Release-Surface Drift, below). Each is a release
surface: CLI help, manifest, MCP catalog, and skill docs must move with the
code. The public-facing summary lives in `skills/port-daddy-agent-skill/SKILL.md`
§ *Recently Shipped Surfaces* — keep the two in sync.

| Surface | ADR | Edit these together |
|---|---|---|
| **Relay** — cross-machine pub/sub | `docs/adr/0049-relay-architecture.md` | Worker `apps/relay/` (D1 schema `apps/relay/schema.sql`, `wrangler.toml`) · daemon routes `routes/relay.ts` · outbound SSE `lib/relay-client.ts` · CLI `cli/commands/relay.ts` · MCP `relay_status` in `mcp/server.ts` |
| **Cloud coordination peer** — offline-first CRDT federation | `docs/adr/0092-suggestibility-ladder-and-cloud-coordination-federation.md` §4 | shared wire/fold `lib/coordination-ledger.ts` · local SQLite outbox/importer `lib/coordination-peer.ts` · relay DO/auth/routes `apps/relay/src/coordination-room.ts`, `apps/relay/src/coordination-auth.ts`, `apps/relay/src/coordination.ts` · real sandbox daemon `apps/fleet-executor/src/sandbox-runner.ts` · compiled acceptance smoke `scripts/smoke-coordination-peer.sh` |
| **Dispatch** — autonomous feature-dev queue | ADR-0035 | `cli/commands/dispatch.ts` (+ deprecated alias `cli/commands/nightshift.ts`) · `lib/dispatch/{runner,spawn-adapter,queue,state-machine}.ts` · `routes/dispatches.ts` · `pd review` · `docs/proposals/pd-nightshift.md` | <!-- cite-exempt: illustrative role/template path -->
| **Coast Guard** — sandbox + compulsion rent | `docs/adr/0050-coast-guard.md` | `lib/coast-guard.ts` (`buildSeatbeltProfile`, `wrapWithSandbox`) · `lib/coast-guard/{compulsion,compulsion-facts,egress-meter}.ts` · default in `lib/spawner.ts` · read path `cli/commands/coast-guard.ts` (`operator_coast_guard` feature) · `requireNotePerCommit` wiring in the Coordination Guard (`cli/commands/guard.ts`) | <!-- cite-exempt: illustrative role/template path -->
| **Attest** — honest self-report | ADR-0045 | `cli/commands/attest.ts` · `lib/attest.ts` · `lib/attest-invariants.ts` · `GET /attest` · the `attest` manifest feature |
| **Tube** — conversational pipe | — | `cli/commands/tube.ts` · message-channel store · `pd_discover` listing |

Contributor gotchas specific to these:

- **Dispatch is dry-run by default.** `pd dispatch run <id>` prints the plan;
  only `--really-run` spawns. The worktree root is `~/coding/tmp/port-daddy-dispatch-<id>`
  (never `os.tmpdir()` / `/tmp`). If you change the spawn path, keep it under
  the scratch root — the Coast Guard reclaim gate (`isReclaimableSandbox`)
  assumes disposable sandboxes live there and the operator's main checkout
  does not.
- **No artifact means no reap.** A review launch may finish with useful dirty
  files while push/PR publication returns no URL. The Conductor adapter must
  route that outcome to `salvage` and preserve the worktree plus transcript.
  `settled` is disposable only when `resultArtifact` proves the work is durable.
- **`pd nightshift` must keep delegating.** The alias rewrites legacy flags
  (`--auto-queue` → `--auto-claim`, `--status` → `--state`) before calling
  `handleDispatch`. If you add a dispatch flag, check the alias still maps it.
- **Coast Guard is opt-out and never advertised.** It is the default for
  every subprocess backend in `lib/spawner.ts`; the agent-facing refusal must
  never name the opt-out (same rule as the guard bypass — guardrails do not
  advertise their bypass).
- **`pd attest` is a loud-fail gate.** Adding an invariant means it can flip
  CI/boot gates red. New CRITICAL invariants go in `lib/attest-invariants.ts`
  with a test; mark non-blocking checks as such so a green exit keeps meaning
  "every CRITICAL invariant holds."
- **Manifest bijection.** `features.manifest.json` is the parity source of
  truth (`npm run parity`). The `dispatch`/`relay`/`attest`/`operator_coast_guard`
  feature rows carry `_note` fields explaining intentionally-omitted routes
  (e.g. generic-typed Fastify handlers the route-parser cannot extract) — keep
  those notes accurate when you add or remove a route.
- **A coordination Durable Object is a peer, not the commit point for local
  work.** Never put a network await on the local claim/note/session/lease write
  path. Persist a local outbox first, acknowledge an operation only after the
  DO alarm flush made it durable, require contiguous pull cursors, and keep the
  sender retrying anything merely buffered. The DO hot path must not call
  `storage.put` per operation; model it on HarborChannel/HarborQuota and prove
  zero request-path writes plus one alarm-batch write.
- **Remote-daemon selection forbids local substitution.** An explicit URL or
  profile that refuses a connection must not enter direct-DB mode and must not
  auto-start a local daemon. Squid's generated hook gate uses bounded remote
  health for that explicit peer; only the implicit local daemon uses local
  ready/PID/heartbeat files. Preserve both sides in tests.

### Rust surfaces — the kernel IS landed; ADR-0120 is the boundary rule

The kernel lives in-tree at `core/kernel/` (pd-anchor / pd-mesh / pd-eventlog /
pd-runtime / pd-core / pd-compat / pd-tui / pd-rs). **ADR-0120 is the
once-and-for-all answer to "what is Rust for"** — read it before any
console/Rust/crypto work. The three-plane rule, compressed:

1. **Security kernel (Rust, canonical, small):** `core/kernel/pd-anchor`
   (Ed25519 cards, macaroon discharge gate, keystore), `core/pd-broker`
   (ADR-0087 separate-UID TCB), `core/harbor-card-rs` (FFI constant-time
   compare + caps-subset). Every security primitive is implemented ONCE, here.
   Native TS reaches it via FFI (`lib/arbiter.ts`, `lib/macaroon-ffi.ts`).
2. **Product planes (TypeScript, on purpose):** daemon control plane, fleet,
   CLI, website, and BOTH Cloudflare Workers. Outside the TCB, so Rust buys no
   security there (ADR-0087) — and Workers physically cannot call native code.
   Where a Worker must duplicate kernel *logic*, it lands a shared test-vector
   fixture in `tests/fixtures/*-parity-vectors.json` generated from the
   canonical Rust impl, asserted by both suites, in the same PR. No fixture,
   no second implementation. Never a third.
3. **Console (Rust because GPU, not crypto):** `core/pd-console` renders; it
   never signs/verifies. Not precedent for "write X in Rust."

Fixture regeneration is a security-relevant diff — review it like a change to
the verifier itself. **Do not scaffold new Rust crates** for non-kernel,
non-GPU work; keep prod/latest/dev pd-console lanes distinct when building or
reviewing the console.

#### Building / installing / running `pd-console` (full detail in `AGENTS.md` § *Building, installing & running pd-console*)

Two binaries from one crate on **crates.io gpui 0.2.2** (not the Zed git pin):
`pd-console` (GPU window, `--features gpui`, macOS) and `pd-console-repl` (headless TUI, CI gate).
Build: `cargo build --release --bin pd-console --features gpui` (from `core/pd-console`).
**Install BOTH launch surfaces or you demo a stale build:** the PATH binary
`~/.port-daddy/bin/pd-console` *and* the double-clickable `~/Applications/pd-console.app`
(embeds its own binary — does NOT read PATH). After replacing the .app binary,
`codesign --force --deep --sign - ~/Applications/pd-console.app` or macOS rejects it.
Launch normally against the canonical published daemon port; use
`PORT_DADDY_URL` only to target one explicit development berth. Startup must
never read `~/.port-daddy/console-daemon.url`: that stale selector previously
pinned future launches to dead berths. `PD_CONSOLE_THEME=light|dark` / `Ctrl-A
g` controls the theme. The Work screen submits one WorkIntent and stays attached
to the daemon's exact launch/agent/transcript receipt; never jump to “newest
agent” or spawn directly from the view. gpui 0.2.2 has no transform:
glow/lift = `shadow(BoxShadow)` + hover color; timelines = `with_animation`; inside `.hover(|s|…)`
pass bare `rgb(x)` (NOT `.into()` — ambiguous). Console branch: `feat/console-tmux-multiplexer`.

## Release-Surface Drift (the contributor's prime directive)

When Port Daddy itself ships, the cost of inconsistency lands on every
project on the user's machine. **Every change to a public surface MUST
update every mirror in the same coherent slice.**

For the actual release ceremony (tagging, GitHub Release, `release.yml`,
archive provenance, and the tap's credential-independent self-promotion),
follow `docs/RELEASING.md`.
For semver policy and the canonical list of *version surfaces* that must
all bump in lockstep, see `docs/VERSIONING.md`.

The list below is the broader surface area a contributor touches *before*
the release ceremony fires — the docs, examples, manifests, and CLI help
that lie about behavior if not updated alongside the code.

Public surfaces, in approximate update order:

1. Source code (`lib/`, `routes/`, `mcp/`, `apps/FleetBar/`).
2. CLI help text (`bin/port-daddy-cli.ts` and any `--help` strings touched).
3. The skill bundle (this repo's `skills/port-daddy-agent-skill/SKILL.md`, references, templates, examples).
4. The website (`apps/website-v2/` — `/docs/cli`, `/docs/api`, `/docs/mcp`, command detail routes, screenshots).
5. The OpenAPI spec, SDK reference, MCP tool catalog.
6. README + the version surfaces in `docs/VERSIONING.md`. The changelog is
   NOT hand-edited: add `changelog.d/<pr>-<slug>.md` (see `changelog.d/README.md`)
   and let `node scripts/assemble-changelog.mjs --release <version>` stamp
   `CHANGELOG.md` — the release train runs it for you.
7. Any plugin/extension manifests (Codex `.codex/skills/`, Gemini `.gemini/extensions/port-daddy/`, Claude `.claude/skills/`).
8. **Binary smoke-test** (per `docs/RELEASING.md` §3, "local feature dev") for any change in `lib/`, `routes/`, `server.ts`, or `mcp/`. Source-mode `tsx server.ts` lies about what users actually run.

The Homebrew formula is no longer a per-PR concern. The `curiositech/homebrew-tap` workflow discovers stable `latest.json` on a serialized schedule, independently peels the release tag, verifies both Batten imprints and archive digests, and requires GitHub provenance for v3.30.3+. Source `release.yml` waits for the exact formula version but never writes across repositories. See `docs/RELEASING.md` §1 step J.

If you cannot land all of these in one commit, leave a `pd actor lookout`
message naming the gaps and link the follow-up issue. Lookout is the role
that watches for release-surface drift; making the drift visible is your
job, fixing it is theirs (or future-yours).

## One-body WorkIntent reliability

The `/spawn` intake uses `lib/agent-harbor/work-intent-spawn.ts`; never restore a
route-to-spawner fallback. Capture intent, executable single-node plan and run
admission atomically; the Conductor remains the actuator. Bind AgentNode and
AgentRun to the exact managed session and transcript after admission and before
the backend turn. The earlier `onStarted` callback has no managed session yet.
Keep body options on the explicit Conductor allowlist, and keep environment
values out of durable intent/plan payloads.

`executionKind: single-body` owns one receipt and cannot also become a Dispatch.
Receipt-store recovery belongs at daemon composition, never per request. Replay
before dynamic preflight; test changed requests, concurrency and restart-unknown
without relaunch. Query the result through canonical WorkIntent projections and
`/spawn/receipts/:id`, including missing/failed/canceled evidence. The run receipt
is not a sealed WorkReceipt and cannot manufacture live PID evidence.

Test stop during backend execution and delayed success/failure, transcript
open/append/finalize errors, canonical binding refusal, and managed completion
refusal. When a known agent is halted, its reservation is already released;
the continuation must preserve halted state without releasing another lineage's
reserved budget. Inert adapters and in-memory SQLite suffice under a runtime halt.

Bind the Harbor transcript timeline to the admitted session and canonical run
before copying its first prompt; an agent ID is not a session receipt. Exercise
halt during delayed harbor admission as well as during the backend turn. A late
start witness must preserve halt and refuse the backend immediately.

## PR Finish Line Discipline

For Port Daddy repo PRs, local validation is not the finish line. Before
calling a branch ready, inspect and close the full PR surface:

- Inline bot comments from Copilot, Claude review, Cloudflare Pages, CodeQL,
  package/release jobs, or deploy previews count as review findings. Reply to
  each actionable thread with fixed / deferred / contested-because.
- A neutral adversarial reviewer runs in CI on **every** PR (the
  `claude-adversarial-review` workflow — assumes laziness/slop/lies/corner-cutting,
  ends with a `SHIP / SHIP-AFTER-FIX / DO-NOT-SHIP` verdict). Also run your own
  skeptical reviewer agent for non-trivial changes. Fix high-confidence findings
  as named fixup commits on the branch.
- **The PR description is gated.** `.github/PULL_REQUEST_TEMPLATE.md` is the form,
  and `scripts/check-pr-requirements.mjs` (CI job `pr-requirements-guard`) fails the
  merge queue on an empty/boilerplate Summary or Test Plan, or a visual diff with no
  artifacts. Draft-check locally: `npm run check:pr-requirements -- --body-file <draft.md>`.
- Treat GitHub CI, external deploy checks, release-package jobs, and Cloudflare
  Pages as one CI/CD surface. If one is red, inspect the linked logs. Only call
  it external after proving the branch is not the cause, and record that proof
  in the PR and, when local Port Daddy is authorized, a `pd note`.
- Do not leave a PR with "CI green except..." as an unresolved aside. Either
  make it green, file/assign the external blocker with evidence, or hand off the
  exact next action to an accepting tool-native task or PR owner while local
  Port Daddy is halted.
- **UI diffs ship visual artifacts — forever (now `[M]`).** A PR touching a GPUI
  surface (`core/pd-console` window), the console (any pane/renderer), or the
  website/dashboard (`website-v2/`, `fleet-config-ui/`, `public/fleet-ui/`,
  `public/`, `dashboard/`, `apps/FleetBar/`) is incomplete without screenshots + a
  GIF + a short screen recording of the real change in its Test Plan, and
  `pr-requirements-guard` now fails the PR without at least a screenshot + a motion
  artifact. Green CI proves compilation, not rendering. TUI panes →
  `vhs` (tape under `core/pd-console/docs/artifacts/`); GPUI window →
  `cargo build --release --features gpui` then `core/pd-console/scripts/capture-gpui.sh`
  (needs macOS Screen Recording permission — a headless host is TCC-denied);
  website/dashboard → headless Playwright dark+light pairs. See AGENTS.md
  § "Visual artifacts for UI diffs". Operator rule, 2026-06-11.

## PR Lifecycle (Create / Update / Land)

The Finish Line Discipline above is the *review contract*; this is the
*mechanical contract*. `AGENTS.md` (`## Pull Request Operating Procedure`)
carries the canonical copy — this is the contributor-repo mirror.

**Create.** Linked worktree off `origin/main` under `~/coding/tmp/wt-<slug>`
(never the main checkout — it carries the operator's WIP) → `pd begin
"<purpose>" --identity port-daddy:contrib:<slug> --lifecycle durable` → full
`pd plan set` → scope `pd note` → smallest claims *before* editing → edit and
test → `pd guard check --staged` → frequent coherent checkpoints with verified
agent author/committer attribution → ready, non-draft PR through
the authorized publication path. A checkpoint is not delivery; **do not run
`pd done` at PR creation**. Retain ownership through actual merge.

GitHub writes (push, PR, comment, review and queue mutations) may use existing
authenticated `gh` and Git credential helpers within task scope, without a
separate exception. Verify account, repository and exact head/base without
exposing credentials; report actual authorship. App/Fleetbot is optional when
useful and retains its protected credential custody and receipt requirements.
Read-only inspection may use tools permitted by repository/operator policy;
where **all GitHub access is broker-routed**, honor that policy for reads too.
A planned ActionReceipt API or an ad-hoc helper is not a shipped surface. If no
authorized publication path is available, preserve the exact commits and body,
record the missing capability and arrange an accepting handoff. Read back an
uncertain write before any further mutation. Never export credentials or bypass
required checks, review or normal protected merge/queue rules.

**Update** (review + CI). Read live comments, replies and checks through the
permitted inspection path. Respond graciously, incorporating actionable
feedback unless clearly wrong or harmful; explain disagreements with evidence.
Add regression tests and land high-confidence findings as named fixup commits.
Inspect the exact current head immediately after PR creation and after every
push, then follow pending reviews and all GitHub/external CI/CD statuses to a
verdict. Delegate routine polling and log triage, plus bounded repairs, to a
tool-native non-Astra lower-cost agent by default; Astra coordinates and reviews
the evidence. Fix branch-caused failures, reply to and resolve review threads,
and record proven external blockers with an owner and next action. Keep an
active follow-up or accepting handoff while checks are pending; an open PR is
not completion. A request for a review PR does not authorize merge.
Get every status context configured as required by the live ruleset green.
Advisory repo jobs and external checks are evidence, not merge blockers; inspect
material failures, record their disposition, and do not wait merely for visual
all-green. Rebase onto latest
`origin/main`, resolve conflicts with affected owners, validate and update the
same App PR. Read-only reviewers must not push or merge; preserve role scope.

**Land.** Merge in dependency order: base before dependent, and rebase the
dependent after *each* merge — mergeability can flip MERGEABLE → CONFLICTING
the moment the base lands. Use the authorized App protected merge/queue path
and let branch protection choose the merge strategy. Keep required checks and
review gates intact; neutral/skipped Fleet is not a clean required verdict.
Queue admission is not merge: verify the actual merged-head receipt, merge
commit and timestamp, then update the full plan and typed roadmap PR receipt
before ordinary `pd done`. Do not add `--admin` as routine agent flow. A human maintainer may make an
explicit, documented emergency bypass; an agent does not admin-skip a real
required gate. Cloudflare Pages may be external/advisory, but prove that from
branch protection and record the evidence before treating it as non-blocking.

The ordinary completion Git gate verifies clean, origin-bound publication or
advertised-default-branch ancestry, not the reviewed protected merge required
above. `lib/git-origin-check.ts` returns the exact proof kind and commit/ref
observation; missing local tracking metadata must not be labeled never-pushed.
Keep tests for absent and deleted upstreams, dirty/untracked work, non-origin
refs, missing objects and read-time movement. Reads have a ten-second total
budget, bounded output and no interactive prompts; they do not fetch, rewrite
refs/config, infer squash/rebase delivery, or promote the installed runtime.
The separate ledger-only `--no-pr` verifier remains unchanged.

**Cleanup.** Delete a worktree only when its branch is merged AND `git -C
<wt> status --porcelain` is clean. Never delete a worktree with uncommitted
work; never reset or clobber the main checkout.

### Shell gotchas (real and recurring)

- **`git add -A` is refused by the pd-shim.** Stage explicit paths. If the
  refusal is wrong, repair the session/claim input and publish the
  inconsistency; do not disable the guard.
- **The `~/.port-daddy/bin/git` shim sets `core.pager=delta` → `bat`.** If
  `bat` is absent, `git log` / `git show` / `git commit` emit `command not
  found: bat` and can swallow output. Use `git -c core.pager=cat …` or
  `GIT_PAGER=cat`.
- **Inline `node -e` and heredocs get mangled by zsh.** Write a `.cjs` under
  the repo's `.scratch/` (gitignored, resolves `node_modules`) and run it.
- **Secrets go through `pd secret set`** (hidden stdin prompt) — never as an
  argv argument.

### Test + session gotchas (dev-loop shibboleths)

- **Editor undo is a local operation, not rollback.** Use the existing buffer's
  per-incarnation Loro UndoManager; exclude disk seeds and imported history, and
  send its exact authored delta through the foreground/mirror pipeline. Check
  claims before mutation. Loro can skip obsolete history items, so the caret or
  last replacement's old range is not a safe preview. Pending canonical affected-op
  validation, another replica's claim holds undo/redo. Do not broaden that hold
  to ordinary adjacent typing or treat headless tests as native interaction proof.

- **Off is checked before invoking Port Daddy, not inside its CLI.** Git
  guards, publishers and wrappers embed `lib/hook-runtime-gate.ts`; canonical
  stop markers outrank selected runtime paths. Keep the standalone Pilot's
  gate fixture-equivalent and preserve unrelated merged hooks/Git LFS. A scoped
  publisher is not necessarily a gated publisher, and source changes do not
  repair previously installed copies. Test with inert CLI/network stand-ins;
  never start the daemon to prove it stays off. See
  `docs/operations/local-off-control.md` for the unfinished whole-app boundary.

  Keep hooks registered across Off/On. The shared preamble exits its caller:
  embed it inside the PD-only subshell in mixed hooks, never ahead of unrelated
  validation or LFS. Test On → Off → On with unchanged hook bytes and inert
  commands; absence of PD activity while Off alone misses deleted functionality.

  Native adapters must register cancellation and create/resume effects under
  the same in-process Off lock; a precheck plus an asynchronous task snapshot
  misses races. Exercise idle streams, buffered delivery, unused stream release,
  cancellation before headers, and overflow with intercepted transport. Give
  older store fixtures explicit synthetic controls instead of clearing HOME
  markers. Watcher/packager checks are cooperative source gates, not process-tree
  containment or atomicity with external writes; preserve those limits in reports.

  JavaScript admission must be synchronous at the actual effect call after every
  awaited launch witness or availability probe. A check inside an async callback
  is stale by the time its caller resumes; test that gap with a queued microtask
  and inert adapters. Check standalone adapters as well as the parent runner.
  A guarded sink invocation does not guard awaits inside that sink: carry the
  same latched witness into the provider and recheck after authentication or
  refresh awaits, immediately before the external write. Name any remaining
  effect boundaries that do not yet have this final check.
  Late trigger handles must be stopped, and a failed stop must remain visible
  with its cleanup handle rather than turning the saved Off state into proof.

- **Disabling PD hooks must not discard Git LFS publication.** If an authorized
  publisher disables all Git hooks, explicitly upload LFS objects reachable from
  its exact head before pushing pointers, using the same scoped repository
  credential. Never enable PD merely to run LFS, allow incomplete pushes, or
  rewrite a custom hook to reinstall the LFS block.


- **Research reuse is not another authority.** The Project Epistemology D1a lab
  (`docs/research/egosystem-reconciliation/harness/`) imports the existing Harbor
  R17 checker without running its sweep at import. Keep fixture envelopes out of
  production registration, preserve scoped provenance and explicit bounds, and
  distinguish synthetic replay from canonical conformance and empirical H1–H4
  evidence. During an operator halt, use only bounded offline tests; never boot
  the daemon or fan out reviewers to satisfy a research gate.

The friction below costs every fresh session real time. Internalize it.

- **Tests are Jest, not vitest.** `tests/unit/*.test.js` import from
  `@jest/globals`; run them with `npm test` (which is `node
  --experimental-vm-modules node_modules/jest/bin/jest.js`). Invoking `vitest`
  fails at import with *"Do not import `@jest/globals` outside of the Jest test
  environment"* — that's a wrong-runner error, not a broken test.
- **A fresh linked worktree has no `node_modules`.** `git worktree add` copies
  tracked files o

…(truncated)
