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
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 |
| Navigator |
routes/sessions.ts, routes/recovery.ts |
lib/sessions/, lib/salvage.ts |
agents/navigator.yaml |
docs/recovery/CURRENT-WORK.md |
| 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 |
| 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 |
| 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) |
| 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:
- 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).
- 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.
- 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:
- Source code (
lib/, routes/, mcp/, apps/FleetBar/).
- CLI help text (
bin/port-daddy-cli.ts and any --help strings touched).
- The skill bundle (this repo's
skills/port-daddy-agent-skill/SKILL.md, references, templates, examples).
- The website (
apps/website-v2/ — /docs/cli, /docs/api, /docs/mcp, command detail routes, screenshots).
- The OpenAPI spec, SDK reference, MCP tool catalog.
- 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.
- Any plugin/extension manifests (Codex
.codex/skills/, Gemini .gemini/extensions/port-daddy/, Claude .claude/skills/).
- 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)
1---2name: port-daddy-internal-dev3description: 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.4license: FSL-1.1-MIT5---67# Port Daddy — Internal Contributor Manual89You are editing the Port Daddy codebase itself: the daemon, MCP server,10FleetBar, Fleet Control Center, website, CLI, SDKs, distribution surfaces,11the recovery ledger, and the internal actor inboxes. This skill is private12to the port-daddy repo because most of what's here would be noise on a13project that just *uses* Port Daddy.1415For the public skill — how any agent on any project should drive Port16Daddy — see the sibling `port-daddy-agent-skill`.1718## NOT For1920- Agents on other projects driving Port Daddy as a coordination tool — that's `port-daddy-agent-skill`.21- General coding without a Port Daddy surface change.22- Distribution to public skill catalogs.23- Replacing the live daemon, recovery ledger, or actor inboxes as sources of truth — those still come first.2425## Operator vs Agent — the product rule2627When designing or changing a Port Daddy surface, the test is "would the28operator have to drop to a terminal to do this routinely?" If yes, the design29is wrong. The operator's surface is FleetBar + the dashboard. `pd` CLI exists30for agents and emergencies. Every routine operator action (configure31credentials, restart daemon, see open feedback, harvest a roadmap entry, ack a32salvage item) must have a FleetBar button or dashboard panel as its primary33surface — CLI is the secondary path for agents and scripts.3435Contributor implication: when you add a new actuator or data source, ship the36FleetBar/dashboard affordance in the same slice when reasonable, or file a37`high`-severity FleetBar feedback entry so cartographer promotes it to the38roadmap before the CLI-only path ships to operators. Examples in flight:39`fleetbar-secret-management-with-provider-deeplinks`,40`fleetbar-console-must-support-zoom-and-text-scaling`.4142The Harbor Work Register is the sanctioned coordination surface while the43local runtime is intentionally Off. Browser approval may mint only a one-use,44short-lived, repository/task/owner-bound Register credential. Keep that45credential in a dedicated table and resolver; never admit it through the46general `pdu_` account-auth path. The Register remains occupancy authority,47not roadmap authority: a missing or stale daemon-pushed mirror means unknown48work and `proposed` claims, never permission for the Relay to become a second49roadmap writer.5051## Validate a roadmap declaration offline5253Before publishing a PR, save its body to an owned file under `~/coding/tmp/`54and run `node node_modules/tsx/dist/cli.mjs scripts/check-roadmap-link.ts55--body-file <absolute-pr-body-path>` from the contributor checkout (one command).56This path needs the existing development dependencies but no GitHub credentials,57GitHub event, roadmap snapshot, or local Port Daddy runtime. It takes precedence58over inherited event state and numeric PR arguments; label and comment paths59remain dry-run. A nonzero exit means the declaration is missing or invalid.6061This validates the current declaration-only contract: a slug or a reasoned62`Roadmap-Item: none` opt-out. It does not prove that a slug exists, that its63roadmap state is fresh, that a planning declaration was reconciled, or that the64PR is ready to merge. Preserve that distinction and keep an operator-halted65runtime stopped; do not restore snapshot-age or planning-file merge gates as66part of using this command.6768## How to work a slice (operating expectations)6970The full posture lives in `AGENTS.md` § Agent Operating Expectations. The71repo-specific mechanics:7273- **Coordinate + pay rent.** Clean linked worktree off `origin/main`,74 `pd begin … --lifecycle durable`, `pd session files add` before editing, a75 `pd note` per commit (the Coordination Guard enforces it), `pd done` at the end.76 When inheriting stale work, prefer `pd takeover <old-session-id> [reason]`77 (or `pd session takeover <old-session-id> [reason]`) over deleting or silently reusing the old session; notes and claim78 history are append-only evidence.79- **Supplant, don't migrate.** No users yet (operator directive, 2026-08-22):80 a new mechanism that overlaps an old one replaces it exhaustively in the same81 slice — delete the legacy path, fix every caller, no compat shims, no82 "legacy mode" flags, no downgrade fallbacks, no deprecation windows.83 Backwards compatibility only when the operator explicitly asks, per surface.84- **Assume broken; verify both ends.** After any write, read it back from the85 surface that should serve it, and prove cold start (daemon down → elegant86 operator instruction, never a stack trace), worktrees, a second user, and the87 GitHub round-trip. A green exit code is not evidence.88- **Keep daemon actuation singular.** On canonical macOS, launchd alone starts,89 stops, replaces, and resurrects the daemon. The daemon publishes readiness;90 Bosun detects a dead/stale generation and asks launchd for replacement;91 Doctor/status/native UIs observe the same snapshot. Never add a detached92 fallback to `pd start` or `pd restart`, never silently walk the canonical port,93 and do not call runtime health green unless launchd PID, `/health`, PID/port94 files, heartbeat, listener, and binary hash converge.95- **Confirm the telemetry trail.** Calls must show up in `pd usage` AND in the96 transcript saves (`lib/transcripts.ts`), and durable state must ride the97 Cloudflare fabric (`lib/relay-client.ts`) so posterity is cheap and survives the98 container — verify the read-back, don't assume it.99- **Dogfood novelly + capture wins.** Exercise a CLI/MCP/SDK surface you haven't100 before each slice; when a hard-won gambit lands, write it into this skill (or the101 public `port-daddy-agent-skill` if it generalizes).102- **Generalize.** Features must work for non-tsx/non-Rust repos, remote harbors,103 other machines, and shared GitHub teams — not just this checkout.104- **Book and research checks.** Reconcile coordination/kernel work against the105 chapter manifest `book/textbook.json` and the claims in106 `docs/harbor-research/omni-ledger.json`. The Book includes Chapter 0 plus eight107 manifest chapters; chapter PDFs are retired. Correct a mathematical claim's108 dependent figures, summaries, exercises, and indexed description together.109 Date manuscripts from `book/textbook.json`'s `edition.date`; standalone chapter110 title pages use the generated `\pdeditiondate` macro, as does the bound book.111 Keep dated editorial changelog entries in the Omni ledger, outside the printed112 book and its buildable source archive.113- **Book publication acceptance.** A successful TeX process is insufficient:114 `scripts/build-whitepapers.sh` must settle references and margin geometry before115 copying the PDF. Run `scripts/harbor-research/run_pdf_checks.py` on that exact116 PDF and inspect facing spreads, including all chapter openers. Keep117 `\pdcopyreviewfalse` for publication; editorial review sheets are not Book pages.118 Record the rendered hash, source tree, gates, and visual findings. A local proof119 and an authorized hosted Book refresh are separate delivery states.120 When the accepted PDF changes, run `bash scripts/build-spreads.sh` before the121 metadata check. Commit the facing PDF and its source-bound JSON receipt with122 the canonical Book; website builds verify both file hashes before publishing.123- **Skill matching.** If you're missing a matching skill, use Jury-rig when the124 local runtime is explicitly enabled. When it is halted, do not invoke `pd`, its125 MCP server, hooks, daemon, or any substitute runtime; read the applicable126 checked-in `SKILL.md` and needed references directly. That is offline127 preparation, not a native graft or proof of current catalog state.128- **Launch work through PD spawn** (`pd spawn`, SDK `spawn()`, or MCP `spawn`),129 never a raw side-channel — so the work is registered, sandboxed, budgeted, salvageable.130- **Managers orchestrate; workers author PRs.** A manager lane delegates131 implementation edits, PR body drafting, and PR authoring to worker sessions.132 The manager reads returned artifacts, checks evidence, steel-mans the strongest133 case against shipping, retunes roles by round, and decides whether work134 advances.135- **Target: durable roles keep ledgers.** Notes are immutable evidence; role136 ledgers are curated projections for future briefings. Do not claim this as a137 fully shipped runtime unless the branch/live daemon proves it. Ledger entries138 that summarize operator preferences or cross-repo tactics must carry139 provenance, redaction/sync posture, account/team authority, and staleness.140- **Keep `README.md` current** in the same PR when a slice changes a documented surface.141- **Feature PRs and releases are separate.** For daemon/CLI changes, run the142 local binary smoke test only when local runtime execution is authorized;143 during the operator halt, use compile-only and authorized hosted evidence,144 and mark local runtime proof unverified. Add the required changelog fragment145 and take the review PR through its authorized finish line. The release train opens the146 separate version PR and publishes the tag/Release; the tap's workflow rolls147 the formula from the stable feed. See `docs/RELEASING.md` §§1, 3. Do not bump148 versions or publish a release merely because a feature PR changed `pd`.149- **Prove Squid from release cargo.** Adding a hook to source is not enough.150 Declare every required tentacle/identity/steering asset in151 `release-artifacts.json`, stage it in `release.yml`, then run152 `scripts/smoke-squid-release.mjs` against the compiled binary outside the153 source tree. The proof must cover Claude/Gemini project config, Codex/agy154 user config, exact-root gating, statusline, Pilot SessionStart, `/squid`, and155 machine-readable READY/LIVE state. A source-suite pass cannot substitute for156 this artifact-boundary proof.157- **Prove native dependencies again after macOS signing.** Hardened runtime can158 change dynamic-loader behavior after an unsigned build smoke has passed. Run159 the native import through the exact signed `dist/pd` release pair, with160 `DYLD_*` absent, before soak or archive sealing. Package dylibs behind a161 verified executable-relative Mach-O rpath and keep162 `com.apple.security.cs.allow-dyld-environment-variables` out of the release163 entitlements; do not trade a packaging defect for an injection surface. FleetBar164 release packaging must also sign every nested Mach-O under the bundled payload165 inside-out; Bun JIT entitlements belong on the Bun executable only, never on166 ordinary `.dylib` runtime libraries.167- **Keep coordination content bounded; the SITREP is the visible value168 surface.** Coordination content (alerts/pheromones) stays invisible and169 bounded: with the SITREP dial off, a healthy no-op turn emits zero bytes and170 no status message, never starts the daemon or shells through the full `pd`171 CLI, and filters file traces to the exact project root before rendering them.172 Keep that coordination block to one heading plus at most two facts, clamp its173 context budget, and keep harness deadlines at one second. The regression174 proof must include thousands of irrelevant matrix entries while still175 surfacing one fresh exact-root fact. Installer tests must also prove atomic,176 idempotent config writes and migration of duplicate legacy Codex177 registrations without disturbing user hooks. The end-of-turn SITREP178 compulsion is the deliberate exception (operator doctrine reversal,179 2026-08-22): governed by the per-repo `sitrep.endOfTurn` dial180 (off|suggest|enforce, default enforce; `PD_SITREP` env override wins, then181 `agent.config.json` → `.portdaddy/sitrep.json` → `.portdaddy/project.json`),182 the pd-hook-prompt tentacle and the SessionStart Pilot inject the end-of-turn183 SITREP table contract — a constant-size standing block that rides outside the184 coordination byte cap. Do not re-bound or silently strip it; repos that want185 quiet turns dial it off explicitly.186187## Core Decision Tree188189```mermaid190flowchart TD191 start[Edit lands on port-daddy] --> what{What changed?}192 what -->|CLI surface| cli[Update CLI help → references → website /docs/cli → MCP tools → skill bundle. Send Lookout drift report when scope > 2 surfaces.]193 what -->|Daemon API| api[Update lib + routes + OpenAPI + SDK ref. Run pd integration ready signals. Audit pd guard for new contracts.]194 what -->|MCP tool| mcp[Update mcp/server.ts + handshake test + skill catalog. Re-validate all 10 tool schemas.]195 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.]196 what -->|Distribution mirrors| dist[Update brew formula sha256. Bump version in 4 places. Rerun install.sh end-to-end. Lookout review.]197 what -->|Internal actor| actor[Update routes/+ lib/ owning module + actor-roster.md + decisions/who-do-i-message.md. Backfill inbox tests.]198 what -->|Recovery ledger| ledger[Edit docs/recovery/CURRENT-WORK.md only via Cartographer/Navigator. Don't bypass the actors.]199 cli & api & mcp & ui & dist & actor & ledger --> ship[Reconcile + guard + tag + push]200```201202## Internal Actor Embodiments203204The five actor roles in the public skill are *concepts*. In this repo,205each one has a concrete **embodiment**: a route, a lib module, a fleet206persona, and a status surface. When you edit any one of these, you are207editing a piece of the actor's body, and the corresponding inboxes,208contracts, and operator surfaces must stay coherent.209210| Actor | Route | Lib module | Fleet persona | Status surface |211|---|---|---|---|---|212| **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 -->213| **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 -->214| **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` |215| **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 -->216| **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 |217218**Shipwright** is a sixth, internal-only role: it owns skill-bundle219ingestion, archetype classification, and survey aggregation across the220fleet. Lives at `lib/shipwright/{archetypes.ts, skill-index.ts, survey.ts}`221and `routes/shipwright.ts`. Tests under `tests/unit/shipwright-*.test.js`.222Don't expose Shipwright in the public skill — it's a port-daddy-internal223abstraction.224225## Recently Shipped Surfaces — contributor module map226227These landed on `main` in the last few weeks. When you touch one, you own228its full mirror set (Release-Surface Drift, below). Each is a release229surface: CLI help, manifest, MCP catalog, and skill docs must move with the230code. The public-facing summary lives in `skills/port-daddy-agent-skill/SKILL.md`231§ *Recently Shipped Surfaces* — keep the two in sync.232233| Surface | ADR | Edit these together |234|---|---|---|235| **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` |236| **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` |237| **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 -->238| **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 -->239| **Attest** — honest self-report | ADR-0045 | `cli/commands/attest.ts` · `lib/attest.ts` · `lib/attest-invariants.ts` · `GET /attest` · the `attest` manifest feature |240| **Tube** — conversational pipe | — | `cli/commands/tube.ts` · message-channel store · `pd_discover` listing |241242Contributor gotchas specific to these:243244- **Dispatch is dry-run by default.** `pd dispatch run <id>` prints the plan;245 only `--really-run` spawns. The worktree root is `~/coding/tmp/port-daddy-dispatch-<id>`246 (never `os.tmpdir()` / `/tmp`). If you change the spawn path, keep it under247 the scratch root — the Coast Guard reclaim gate (`isReclaimableSandbox`)248 assumes disposable sandboxes live there and the operator's main checkout249 does not.250- **No artifact means no reap.** A review launch may finish with useful dirty251 files while push/PR publication returns no URL. The Conductor adapter must252 route that outcome to `salvage` and preserve the worktree plus transcript.253 `settled` is disposable only when `resultArtifact` proves the work is durable.254- **`pd nightshift` must keep delegating.** The alias rewrites legacy flags255 (`--auto-queue` → `--auto-claim`, `--status` → `--state`) before calling256 `handleDispatch`. If you add a dispatch flag, check the alias still maps it.257- **Coast Guard is opt-out and never advertised.** It is the default for258 every subprocess backend in `lib/spawner.ts`; the agent-facing refusal must259 never name the opt-out (same rule as the guard bypass — guardrails do not260 advertise their bypass).261- **`pd attest` is a loud-fail gate.** Adding an invariant means it can flip262 CI/boot gates red. New CRITICAL invariants go in `lib/attest-invariants.ts`263 with a test; mark non-blocking checks as such so a green exit keeps meaning264 "every CRITICAL invariant holds."265- **Manifest bijection.** `features.manifest.json` is the parity source of266 truth (`npm run parity`). The `dispatch`/`relay`/`attest`/`operator_coast_guard`267 feature rows carry `_note` fields explaining intentionally-omitted routes268 (e.g. generic-typed Fastify handlers the route-parser cannot extract) — keep269 those notes accurate when you add or remove a route.270- **A coordination Durable Object is a peer, not the commit point for local271 work.** Never put a network await on the local claim/note/session/lease write272 path. Persist a local outbox first, acknowledge an operation only after the273 DO alarm flush made it durable, require contiguous pull cursors, and keep the274 sender retrying anything merely buffered. The DO hot path must not call275 `storage.put` per operation; model it on HarborChannel/HarborQuota and prove276 zero request-path writes plus one alarm-batch write.277- **Remote-daemon selection forbids local substitution.** An explicit URL or278 profile that refuses a connection must not enter direct-DB mode and must not279 auto-start a local daemon. Squid's generated hook gate uses bounded remote280 health for that explicit peer; only the implicit local daemon uses local281 ready/PID/heartbeat files. Preserve both sides in tests.282283### Rust surfaces — the kernel IS landed; ADR-0120 is the boundary rule284285The kernel lives in-tree at `core/kernel/` (pd-anchor / pd-mesh / pd-eventlog /286pd-runtime / pd-core / pd-compat / pd-tui / pd-rs). **ADR-0120 is the287once-and-for-all answer to "what is Rust for"** — read it before any288console/Rust/crypto work. The three-plane rule, compressed:2892901. **Security kernel (Rust, canonical, small):** `core/kernel/pd-anchor`291 (Ed25519 cards, macaroon discharge gate, keystore), `core/pd-broker`292 (ADR-0087 separate-UID TCB), `core/harbor-card-rs` (FFI constant-time293 compare + caps-subset). Every security primitive is implemented ONCE, here.294 Native TS reaches it via FFI (`lib/arbiter.ts`, `lib/macaroon-ffi.ts`).2952. **Product planes (TypeScript, on purpose):** daemon control plane, fleet,296 CLI, website, and BOTH Cloudflare Workers. Outside the TCB, so Rust buys no297 security there (ADR-0087) — and Workers physically cannot call native code.298 Where a Worker must duplicate kernel *logic*, it lands a shared test-vector299 fixture in `tests/fixtures/*-parity-vectors.json` generated from the300 canonical Rust impl, asserted by both suites, in the same PR. No fixture,301 no second implementation. Never a third.3023. **Console (Rust because GPU, not crypto):** `core/pd-console` renders; it303 never signs/verifies. Not precedent for "write X in Rust."304305Fixture regeneration is a security-relevant diff — review it like a change to306the verifier itself. **Do not scaffold new Rust crates** for non-kernel,307non-GPU work; keep prod/latest/dev pd-console lanes distinct when building or308reviewing the console.309310#### Building / installing / running `pd-console` (full detail in `AGENTS.md` § *Building, installing & running pd-console*)311312Two binaries from one crate on **crates.io gpui 0.2.2** (not the Zed git pin):313`pd-console` (GPU window, `--features gpui`, macOS) and `pd-console-repl` (headless TUI, CI gate).314Build: `cargo build --release --bin pd-console --features gpui` (from `core/pd-console`).315**Install BOTH launch surfaces or you demo a stale build:** the PATH binary316`~/.port-daddy/bin/pd-console` *and* the double-clickable `~/Applications/pd-console.app`317(embeds its own binary — does NOT read PATH). After replacing the .app binary,318`codesign --force --deep --sign - ~/Applications/pd-console.app` or macOS rejects it.319Launch normally against the canonical published daemon port; use320`PORT_DADDY_URL` only to target one explicit development berth. Startup must321never read `~/.port-daddy/console-daemon.url`: that stale selector previously322pinned future launches to dead berths. `PD_CONSOLE_THEME=light|dark` / `Ctrl-A323g` controls the theme. The Work screen submits one WorkIntent and stays attached324to the daemon's exact launch/agent/transcript receipt; never jump to “newest325agent” or spawn directly from the view. gpui 0.2.2 has no transform:326glow/lift = `shadow(BoxShadow)` + hover color; timelines = `with_animation`; inside `.hover(|s|…)`327pass bare `rgb(x)` (NOT `.into()` — ambiguous). Console branch: `feat/console-tmux-multiplexer`.328329## Release-Surface Drift (the contributor's prime directive)330331When Port Daddy itself ships, the cost of inconsistency lands on every332project on the user's machine. **Every change to a public surface MUST333update every mirror in the same coherent slice.**334335For the actual release ceremony (tagging, GitHub Release, `release.yml`,336archive provenance, and the tap's credential-independent self-promotion),337follow `docs/RELEASING.md`.338For semver policy and the canonical list of *version surfaces* that must339all bump in lockstep, see `docs/VERSIONING.md`.340341The list below is the broader surface area a contributor touches *before*342the release ceremony fires — the docs, examples, manifests, and CLI help343that lie about behavior if not updated alongside the code.344345Public surfaces, in approximate update order:3463471. Source code (`lib/`, `routes/`, `mcp/`, `apps/FleetBar/`).3482. CLI help text (`bin/port-daddy-cli.ts` and any `--help` strings touched).3493. The skill bundle (this repo's `skills/port-daddy-agent-skill/SKILL.md`, references, templates, examples).3504. The website (`apps/website-v2/` — `/docs/cli`, `/docs/api`, `/docs/mcp`, command detail routes, screenshots).3515. The OpenAPI spec, SDK reference, MCP tool catalog.3526. README + the version surfaces in `docs/VERSIONING.md`. The changelog is353 NOT hand-edited: add `changelog.d/<pr>-<slug>.md` (see `changelog.d/README.md`)354 and let `node scripts/assemble-changelog.mjs --release <version>` stamp355 `CHANGELOG.md` — the release train runs it for you.3567. Any plugin/extension manifests (Codex `.codex/skills/`, Gemini `.gemini/extensions/port-daddy/`, Claude `.claude/skills/`).3578. **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.358359The 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.360361If you cannot land all of these in one commit, leave a `pd actor lookout`362message naming the gaps and link the follow-up issue. Lookout is the role363that watches for release-surface drift; making the drift visible is your364job, fixing it is theirs (or future-yours).365366## One-body WorkIntent reliability367368The `/spawn` intake uses `lib/agent-harbor/work-intent-spawn.ts`; never restore a369route-to-spawner fallback. Capture intent, executable single-node plan and run370admission atomically; the Conductor remains the actuator. Bind AgentNode and371AgentRun to the exact managed session and transcript after admission and before372the backend turn. The earlier `onStarted` callback has no managed session yet.373Keep body options on the explicit Conductor allowlist, and keep environment374values out of durable intent/plan payloads.375376`executionKind: single-body` owns one receipt and cannot also become a Dispatch.377Receipt-store recovery belongs at daemon composition, never per request. Replay378before dynamic preflight; test changed requests, concurrency and restart-unknown379without relaunch. Query the result through canonical WorkIntent projections and380`/spawn/receipts/:id`, including missing/failed/canceled evidence. The run receipt381is not a sealed WorkReceipt and cannot manufacture live PID evidence.382383Test stop during backend execution and delayed success/failure, transcript384open/append/finalize errors, canonical binding refusal, and managed completion385refusal. When a known agent is halted, its reservation is already released;386the continuation must preserve halted state without releasing another lineage's387reserved budget. Inert adapters and in-memory SQLite suffice under a runtime halt.388389Bind the Harbor transcript timeline to the admitted session and canonical run390before copying its first prompt; an agent ID is not a session receipt. Exercise391halt during delayed harbor admission as well as during the backend turn. A late392start witness must preserve halt and refuse the backend immediately.393394## PR Finish Line Discipline395396For Port Daddy repo PRs, local validation is not the finish line. Before397calling a branch ready, inspect and close the full PR surface:398399- Inline bot comments from Copilot, Claude review, Cloudflare Pages, CodeQL,400 package/release jobs, or deploy previews count as review findings. Reply to401 each actionable thread with fixed / deferred / contested-because.402- A neutral adversarial reviewer runs in CI on **every** PR (the403 `claude-adversarial-review` workflow — assumes laziness/slop/lies/corner-cutting,404 ends with a `SHIP / SHIP-AFTER-FIX / DO-NOT-SHIP` verdict). Also run your own405 skeptical reviewer agent for non-trivial changes. Fix high-confidence findings406 as named fixup commits on the branch.407- **The PR description is gated.** `.github/PULL_REQUEST_TEMPLATE.md` is the form,408 and `scripts/check-pr-requirements.mjs` (CI job `pr-requirements-guard`) fails the409 merge queue on an empty/boilerplate Summary or Test Plan, or a visual diff with no410 artifacts. Draft-check locally: `npm run check:pr-requirements -- --body-file <draft.md>`.411- Treat GitHub CI, external deploy checks, release-package jobs, and Cloudflare412 Pages as one CI/CD surface. If one is red, inspect the linked logs. Only call413 it external after proving the branch is not the cause, and record that proof414 in the PR and, when local Port Daddy is authorized, a `pd note`.415- Do not leave a PR with "CI green except..." as an unresolved aside. Either416 make it green, file/assign the external blocker with evidence, or hand off the417 exact next action to an accepting tool-native task or PR owner while local418 Port Daddy is halted.419- **UI diffs ship visual artifacts — forever (now `[M]`).** A PR touching a GPUI420 surface (`core/pd-console` window), the console (any pane/renderer), or the421 website/dashboard (`website-v2/`, `fleet-config-ui/`, `public/fleet-ui/`,422 `public/`, `dashboard/`, `apps/FleetBar/`) is incomplete without screenshots + a423 GIF + a short screen recording of the real change in its Test Plan, and424 `pr-requirements-guard` now fails the PR without at least a screenshot + a motion425 artifact. Green CI proves compilation, not rendering. TUI panes →426 `vhs` (tape under `core/pd-console/docs/artifacts/`); GPUI window →427 `cargo build --release --features gpui` then `core/pd-console/scripts/capture-gpui.sh`428 (needs macOS Screen Recording permission — a headless host is TCC-denied);429 website/dashboard → headless Playwright dark+light pairs. See AGENTS.md430 § "Visual artifacts for UI diffs". Operator rule, 2026-06-11.431432## PR Lifecycle (Create / Update / Land)433434The Finish Line Discipline above is the *review contract*; this is the435*mechanical contract*. `AGENTS.md` (`## Pull Request Operating Procedure`)436carries the canonical copy — this is the contributor-repo mirror.437438**Create.** Linked worktree off `origin/main` under `~/coding/tmp/wt-<slug>`439(never the main checkout — it carries the operator's WIP) → `pd begin440"<purpose>" --identity port-daddy:contrib:<slug> --lifecycle durable` → full441`pd plan set` → scope `pd note` → smallest claims *before* editing → edit and442test → `pd guard check --staged` → frequent coherent checkpoints with verified443agent author/committer attribution → ready, non-draft PR through444the authorized publication path. A checkpoint is not delivery; **do not run445`pd done` at PR creation**. Retain ownership through actual merge.446447GitHub writes (push, PR, comment, review and queue mutations) may use existing448authenticated `gh` and Git credential helpers within task scope, without a449separate exception. Verify account, repository and exact head/base without450exposing credentials; report actual authorship. App/Fleetbot is optional when451useful and retains its protected credential custody and receipt requirements.452Read-only inspection may use tools permitted by repository/operator policy;453where **all GitHub access is broker-routed**, honor that policy for reads too.454A planned ActionReceipt API or an ad-hoc helper is not a shipped surface. If no455authorized publication path is available, preserve the exact commits and body,456record the missing capability and arrange an accepting handoff. Read back an457uncertain write before any further mutation. Never export credentials or bypass458required checks, review or normal protected merge/queue rules.459460**Update** (review + CI). Read live comments, replies and checks through the461permitted inspection path. Respond graciously, incorporating actionable462feedback unless clearly wrong or harmful; explain disagreements with evidence.463Add regression tests and land high-confidence findings as named fixup commits.464Inspect the exact current head immediately after PR creation and after every465push, then follow pending reviews and all GitHub/external CI/CD statuses to a466verdict. Delegate routine polling and log triage, plus bounded repairs, to a467tool-native non-Astra lower-cost agent by default; Astra coordinates and reviews468the evidence. Fix branch-caused failures, reply to and resolve review threads,469and record proven external blockers with an owner and next action. Keep an470active follow-up or accepting handoff while checks are pending; an open PR is471not completion. A request for a review PR does not authorize merge.472Get every status context configured as required by the live ruleset green.473Advisory repo jobs and external checks are evidence, not merge blockers; inspect474material failures, record their disposition, and do not wait merely for visual475all-green. Rebase onto latest476`origin/main`, resolve conflicts with affected owners, validate and update the477same App PR. Read-only reviewers must not push or merge; preserve role scope.478479**Land.** Merge in dependency order: base before dependent, and rebase the480dependent after *each* merge — mergeability can flip MERGEABLE → CONFLICTING481the moment the base lands. Use the authorized App protected merge/queue path482and let branch protection choose the merge strategy. Keep required checks and483review gates intact; neutral/skipped Fleet is not a clean required verdict.484Queue admission is not merge: verify the actual merged-head receipt, merge485commit and timestamp, then update the full plan and typed roadmap PR receipt486before ordinary `pd done`. Do not add `--admin` as routine agent flow. A human maintainer may make an487explicit, documented emergency bypass; an agent does not admin-skip a real488required gate. Cloudflare Pages may be external/advisory, but prove that from489branch protection and record the evidence before treating it as non-blocking.490491The ordinary completion Git gate verifies clean, origin-bound publication or492advertised-default-branch ancestry, not the reviewed protected merge required493above. `lib/git-origin-check.ts` returns the exact proof kind and commit/ref494observation; missing local tracking metadata must not be labeled never-pushed.495Keep tests for absent and deleted upstreams, dirty/untracked work, non-origin496refs, missing objects and read-time movement. Reads have a ten-second total497budget, bounded output and no interactive prompts; they do not fetch, rewrite498refs/config, infer squash/rebase delivery, or promote the installed runtime.499The separate ledger-only `--no-pr` verifier remains unchanged.500501**Cleanup.** Delete a worktree only when its branch is merged AND `git -C502<wt> status --porcelain` is clean. Never delete a worktree with uncommitted503work; never reset or clobber the main checkout.504505### Shell gotchas (real and recurring)506507- **`git add -A` is refused by the pd-shim.** Stage explicit paths. If the508 refusal is wrong, repair the session/claim input and publish the509 inconsistency; do not disable the guard.510- **The `~/.port-daddy/bin/git` shim sets `core.pager=delta` → `bat`.** If511 `bat` is absent, `git log` / `git show` / `git commit` emit `command not512 found: bat` and can swallow output. Use `git -c core.pager=cat …` or513 `GIT_PAGER=cat`.514- **Inline `node -e` and heredocs get mangled by zsh.** Write a `.cjs` under515 the repo's `.scratch/` (gitignored, resolves `node_modules`) and run it.516- **Secrets go through `pd secret set`** (hidden stdin prompt) — never as an517 argv argument.518519### Test + session gotchas (dev-loop shibboleths)520521- **Editor undo is a local operation, not rollback.** Use the existing buffer's522 per-incarnation Loro UndoManager; exclude disk seeds and imported history, and523 send its exact authored delta through the foreground/mirror pipeline. Check524 claims before mutation. Loro can skip obsolete history items, so the caret or525 last replacement's old range is not a safe preview. Pending canonical affected-op526 validation, another replica's claim holds undo/redo. Do not broaden that hold527 to ordinary adjacent typing or treat headless tests as native interaction proof.528529- **Off is checked before invoking Port Daddy, not inside its CLI.** Git530 guards, publishers and wrappers embed `lib/hook-runtime-gate.ts`; canonical531 stop markers outrank selected runtime paths. Keep the standalone Pilot's532 gate fixture-equivalent and preserve unrelated merged hooks/Git LFS. A scoped533 publisher is not necessarily a gated publisher, and source changes do not534 repair previously installed copies. Test with inert CLI/network stand-ins;535 never start the daemon to prove it stays off. See536 `docs/operations/local-off-control.md` for the unfinished whole-app boundary.537538 Keep hooks registered across Off/On. The shared preamble exits its caller:539 embed it inside the PD-only subshell in mixed hooks, never ahead of unrelated540 validation or LFS. Test On → Off → On with unchanged hook bytes and inert541 commands; absence of PD activity while Off alone misses deleted functionality.542543 Native adapters must register cancellation and create/resume effects under544 the same in-process Off lock; a precheck plus an asynchronous task snapshot545 misses races. Exercise idle streams, buffered delivery, unused stream release,546 cancellation before headers, and overflow with intercepted transport. Give547 older store fixtures explicit synthetic controls instead of clearing HOME548 markers. Watcher/packager checks are cooperative source gates, not process-tree549 containment or atomicity with external writes; preserve those limits in reports.550551 JavaScript admission must be synchronous at the actual effect call after every552 awaited launch witness or availability probe. A check inside an async callback553 is stale by the time its caller resumes; test that gap with a queued microtask554 and inert adapters. Check standalone adapters as well as the parent runner.555 A guarded sink invocation does not guard awaits inside that sink: carry the556 same latched witness into the provider and recheck after authentication or557 refresh awaits, immediately before the external write. Name any remaining558 effect boundaries that do not yet have this final check.559 Late trigger handles must be stopped, and a failed stop must remain visible560 with its cleanup handle rather than turning the saved Off state into proof.561562- **Disabling PD hooks must not discard Git LFS publication.** If an authorized563 publisher disables all Git hooks, explicitly upload LFS objects reachable from564 its exact head before pushing pointers, using the same scoped repository565 credential. Never enable PD merely to run LFS, allow incomplete pushes, or566 rewrite a custom hook to reinstall the LFS block.567568569- **Research reuse is not another authority.** The Project Epistemology D1a lab570 (`docs/research/egosystem-reconciliation/harness/`) imports the existing Harbor571 R17 checker without running its sweep at import. Keep fixture envelopes out of572 production registration, preserve scoped provenance and explicit bounds, and573 distinguish synthetic replay from canonical conformance and empirical H1–H4574 evidence. During an operator halt, use only bounded offline tests; never boot575 the daemon or fan out reviewers to satisfy a research gate.576577The friction below costs every fresh session real time. Internalize it.578579- **Tests are Jest, not vitest.** `tests/unit/*.test.js` import from580 `@jest/globals`; run them with `npm test` (which is `node581 --experimental-vm-modules node_modules/jest/bin/jest.js`). Invoking `vitest`582 fails at import with *"Do not import `@jest/globals` outside of the Jest test583 environment"* — that's a wrong-runner error, not a broken test.584- **A fresh linked worktree has no `node_modules`.** `git worktree add` copies585 tracked files o586587…(truncated)