Repository navigation
Description
Companion to #1672 (lane card). Filed separately so the card's endorsed scope stays stable; #1672's spec may absorb this the same way it absorbs #1595.
Problem
Re-orienting on a lane needs both halves of the last exchange. #1672's Now: line carries the agent's half; the human's half — "what did I last ask this agent?" — currently lives only in terminal scrollback. Landing on a terminal, the most recent output is uninterpretable without the question that produced it, so the user scrolls up to find their own prompt.
Requirements
Surface the user's most recent prompt to a lane ("last ask") on the lane card, with privacy maintained structurally, not by discipline.
Capture: harness lifecycle hooks, never PTY inference
HarnessProvidergains an optional capability: at spawn time the provider injects the harness's prompt-submit lifecycle hook configuration into the session it launches (same pattern as writing harness config into worktrees). Claude Code's prompt-submit hook is the first implementation.- A harness without hook support does not get the capability and the field is absent — no PTY-scraping fallback (same fragile-inference class Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 rejects).
- The hook invokes a capture script shipped with codev that, before anything persists:
- Truncates hard: first line only, first ~140 chars (kills pasted multiline blobs — logs, keys, .env contents — for free).
- Redacts at capture, not at serve: scrub long hex/base64 runs and
TOKEN=/KEY=-shaped fragments so the sensitive form is never stored anywhere. - POSTs to Tower's keyed loopback API (the hook runs as the same OS user and reads the local key legitimately). No temp files.
- The
afx sendchannel needs no capture: those instructions are already in global.db with sender attribution; the card shows the most recent instruction on either channel, labeled (You asked (12m)vsmain sent (1h)).
Storage: latest-only, global.db, nowhere else
- One row per terminal, upserted in place. The feature needs exactly the last ask; history multiplies risk for zero value. The row dies with the terminal (close /
afx cleanup). - Never in thread files, status.yaml, or any file inside a worktree — those are committed and ship in PRs; prompts must be unable to enter version history by construction.
- global.db is the home (user-global, same sensitivity class as the mailbox bodies it already holds). Writes go through Tower, never by hand.
Serving: loopback yes, tunnel no (by default)
- The card endpoint serves the last-ask field to loopback requests and omits it when the request carries the tunnel marker (
x-codev-tunnel-proxy, unforgeable and unsuppressable per Fix #1586: stamp Host + local key on tunnel-proxied requests #1588's strip-then-restamp). Prompts never traverse the cloud edge or reach a remote browser as a structural property. - A config flag may open tunnel serving for users who want parity on their own remote sessions; default closed.
- The rendered field carries provenance and age like every card field, so a stale ask cannot masquerade as current context.
- The card is a pointer, not an archive: full text lives only in the terminal scrollback where it already is.
Out of scope
- Prompt history / search (latest-only is deliberate).
- Any capture path for harnesses without lifecycle hooks.
- Cross-lane aggregation of prompts (each lane shows only what was addressed to it).
Refs: #1672 (lane card — rendering surface and freshness/provenance rules), #1595 (attention states — the no-PTY-inference precedent), #1588 (tunnel marker semantics the serving rule reuses), Spec 1313 (mailbox — the afx send channel).
Activity
amrmelsayed commentedon Sep 10, 2026
Contract-seat review: endorsed — the design already sits on the right side of every line this workspace has learned the hard way (HarnessProvider capability instead of PTY inference per the #1595 precedent; redact-at-capture so the sensitive form never exists at rest; worktree-exclusion making version-history leakage impossible by construction rather than by discipline). Three notes for the spec that absorbs this:
The Fix #1586: stamp Host + local key on tunnel-proxied requests #1588 marker is being used in the deny direction — pin that with a test. Fix #1586: stamp Host + local key on tunnel-proxied requests #1588's stamp exists to authenticate tunnel-borne requests; here the marker's absence grants access to the field. That inversion is sound only while strip-then-restamp guarantees no remote request can arrive unmarked — which is exactly the property to pin with a regression test at the card endpoint, and to re-verify when tower: forward a sub-path to a local web IDE server + afx ide lifecycle #1668's
/ide/forward lands: that issue introduces a new proxied request path whose marker/header hygiene is specified separately (its auth-model section stripsx-forwarded-*and restamps — the last-ask omission rule must be confirmed against that path too, not assumed). Cross-linking the two issues' guard sections now is cheaper than discovering a divergence in a remote browser later.One shared secret-shape module, not a fresh redaction list. The proposed scrub (long hex/base64 runs,
TOKEN=/KEY=fragments) is the right baseline, but redaction lists that fork drift — and this one guards user prompts. If a secret-shape pattern set exists anywhere in the codebase (capture sanitizers, consult transcript handling), extract and share it; if not, this feature should create the canonical one and other surfaces should migrate to it. Single source of truth for "what does a secret look like."Hook injection must compose with user hook config, not clobber it. The spawn-time injection writes harness lifecycle-hook configuration into the session — for Claude Code that's a hooks entry in settings the user may already populate. The capability's contract should state merge semantics explicitly (inject alongside, never replace; removal on cleanup restores baseline), and this is a second consumer of the spawn-time settings surface alongside the Fix #1219: sanitize inherited CLAUDE_CODE_* env at every Tower spawn #1626/tower: afx architect spawns claude without sanitizing inherited CLAUDE_CODE_* env #1627 env-sanitization work — worth landing after those so the composition is tested against the sanitized spawn path.
Routing agreed: absorb into #1672's spec alongside #1595;
area/towercorrect; theafx send-channel dedupe (mailbox rows already carry attributed instructions) is the kind of reuse the card should keep doing.