{
  "summary": "Core guarantee and fault boundary: `spt send` validates the target/body, then attempts a framed loopback TCP write. A completed write returns `SendOutcome::Sent` and prints `SENT:<target>`; there is no receiver acknowledgement and no guarantee that the listener accepted, decoded, printed, or that Claude surfaced the event. If address resolution, connect, or framed write fails, core writes the message to the durable spool and returns/prints `QUEUED:<target>`. The paths are deliberately XOR: TCP success creates no spool copy. Therefore a compact-time race exists in core semantics: the write can complete into the socket, the listener can then disappear before `accept`/`read_message`/stdout emission, and the message has neither a spool row nor end-to-end receipt. [INFERENCE] Automated `/compact` itself is not a core teardown trigger; core's compact boundary rotates session state and re-stamps readiness, while soft session-end preserves a registry row owned by a still-live listener. A compact can expose the loss only if the adapter/harness kills or disconnects the listener/output channel during that race. Assignment rule: (1) `QUEUED` or an undelivered spool row means core retained it; failure to poll/restart/drain belongs at adapter/listener lifecycle. (2) A spool row marked delivered with `taken_leg=relay-backlog` or `hook-poll` proves core handed it to that carrier at `taken_at_ms`; delay after relay stdout emission belongs to adapter/harness, though the audit alone proves claim, not stdout presentation. (3) `SENT` with no spool row does not prove presentation; if listener termination overlaps the send-before-accept interval, the missing end-to-end ACK/spool race is a core delivery-contract gap. (4) If captured listener stdout contains the `<EVENT>` at the incident timestamp but Claude surfaces it only on the next user turn, that is adapter/session ingestion. Diagnostics: sender output distinguishes `SENT:<id>` from `QUEUED:<id>`; hidden non-destructive `spt spool-audit <id> --json` reports every retained row's `delivered`, `taken_leg`, `taken_sid`, `taken_pid`, and epoch-ms `taken_at_ms`. Listener lifecycle stderr tokens are `BOUND:<id>`, `READY:<id>`, `LISTEN_FAIL:<id>`, and `LISTEN_ORPHAN_EXIT:<id>...`; session hooks emit `BOUNDARY:compact:<id> -> <sid>` and `SESSION_END:<id> (soft; spool + history preserved)`. Exact incident timestamps/process state require correlating these core tokens/audit rows with deployah's adapter logs, which are outside this source-only slice.",
  "files": [
    {
      "path": "crates/spt-msg/src/deliver.rs",
      "description": "Defines the acceptance guarantee: TCP success is a completed framed write; failure falls back to spool; TCP and spool are mutually exclusive; maps to Sent versus Queued."
    },
    {
      "path": "crates/spt-msg/src/listener.rs",
      "description": "PollListener registers an ephemeral loopback address, later accepts and decodes one frame, and unregisters on drop. Shows the unacknowledged write-to-accept race."
    },
    {
      "path": "crates/spt-daemon/src/relay.rs",
      "description": "Stateless listener relay: drains durable backlog on start/each pump and forwards live reads to a sink. Respawn preserves only spooled backlog, not frames already reported as TCP Sent."
    },
    {
      "path": "crates/spt/src/api/startup.rs",
      "description": "`cmd_listen` emits BOUND/READY diagnostics, installs parent-death watchdog, runs relay, and composes each received message to stdout with an explicit flush."
    },
    {
      "path": "crates/spt/src/api/reporting.rs",
      "description": "Compact/clear lifecycle behavior: boundary rotates session and re-stamps ready/online; soft session-end preserves spool/history and preserves a registry address when its listener owner remains alive."
    },
    {
      "path": "crates/spt-store/src/spool.rs",
      "description": "Durable queue and atomic take audit. A take stamps delivered plus taker leg/session/pid/epoch-ms in the same update; pending rows remain delivered=false."
    },
    {
      "path": "crates/spt/src/cli.rs",
      "description": "Renders SENT versus QUEUED and implements hidden `spt spool-audit <id> --json` diagnostic."
    }
  ],
  "architecture": "Send boundary: CLI `cmd_send` → `spt_msg::deliver::send_windowed` → registry lookup → framed TCP write. On write success: `SENT`, no spool/receipt. Listener boundary: `PollListener.accept/read_message` → daemon `Relay` sink → `cmd_listen::emit` → `<EVENT>` on flushed stdout → adapter/harness ingestion → Claude session presentation. On pre-write transport failure: durable SQLite spool → later relay backlog or hook poll → atomic delivered/taker audit. Compact lifecycle is parallel to transport: adapter reports session-end/boundary; core soft end preserves durable records and a live listener registration, and boundary restores ready/online truth. Consequently core owns transport through stdout emission and spool durability; adapter owns keeping the listener/output attached across compact and injecting emitted events into the Claude session. The uncovered inter-component seam is that sender TCP success is not acknowledged by the receiver or presentation layer."
}