Skip to content

Proxy mode by default: design of record for LLP 0242, plus the missing --json non-interactive pin - #817

Merged
philcunliffe merged 11 commits into
masterfrom
integration/proxy-mode-default-attach
Aug 19, 2026
Merged

Proxy mode by default: design of record for LLP 0242, plus the missing --json non-interactive pin#817
philcunliffe merged 11 commits into
masterfrom
integration/proxy-mode-default-attach

Conversation

@philcunliffe

@philcunliffe philcunliffe commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

⚠️ Merge notes

Closes the coverage gap on issue LLP 0242 (fresh installs still attach Claude by base URL, and old installs have no path to proxy mode).

The headline: this change set adds no production code

The design audit found LLP 0242 is already implemented on master, by human PR #794 ("Proxy mode is the default and hyp attach claude migrates old installs"). Verified symbol by symbol before planning:

  • Composition - gateway_proxy_mode: true in the claude manifest, the composePickerConfig fold in src/core/cli/walkthrough.js, the literal hyp init claude preset key, carry-forward key ownership, and the finale waitForLocalCa wait.
  • Migration - maybeOfferProxyModeMigration in src/core/commands/clients.js (called before endpoint resolution, its failure downgraded to a warning) and enableGatewayProxyMode in src/core/config/gateway_proxy_enable.js, with the no_gateway and central_managed refusals and an injectable CA-wait seam.
  • Gate - all five design-named test files exist and pass, with nine consent and refusal behaviours already pinned in test/core/attach-proxy-migration.test.js (decline, accept, idempotence, non-proxy client, central-managed, non-TTY, dry-run, attach-all, failure downgrade).

So the plan schedules no rebuild of working code. It closes only what the design-versus-tree audit actually found.

The one real gap it found

LLP 0246 section 5 claims the --json pointer line is proven by tests. It is not. The harness plumbs a json opt (test/core/attach-proxy-migration.test.js:76) that no test ever passes. The code gate at src/core/commands/clients.js:886 is correct; only the pin was missing, so the behaviour was asserted and never actually held.

T1 adds it: --json on a TTY issues no prompt, emits exactly the one pointer line on stderr, writes no config, and leaves stdout as valid JSON with nothing interleaved, plus a companion case proving --json with non-TTY still emits the pointer exactly once rather than twice.

T2 adds the corpus cross-links (Related: forward-refs on LLP 0242/0243/0244) and re-verifies that the six anchors the design and code cite all resolve.

Also in this branch: an LLP renumber

The design was minted as LLP 0246 while, concurrently, llp/0246-remote-control-absolute-form-requests.issue.md merged to master. Two live documents at one number produce an ambiguous @ref LLP 0246 and a red ref-hygiene check the moment this branch merges, and neither branch's CI can see it, because each is internally consistent.

Per the repo's renumber rule the later claimant moves above the highest number claimed anywhere (0250), so the design is now LLP 0251. The sweep covers the plan, the design's own title, and the three cross-links T2 added. No prose meaning changed.

Review notes

One test file changed; everything else is llp/. The --json assertion is the part worth reading closely: if it ever fails against the parsed.json gate, that is a production bug to report rather than a test to soften.

Change-Set: proxy-mode-default-attach

test and others added 7 commits August 17, 2026 20:37
… 0242

Design of record for LLP 0242's fix (LLP 0243/0244): the picker fold and
hyp init claude preset compose proxy_mode: true by default, and hyp attach
claude migrates existing base-URL installs behind an explicit consent
prompt via enableGatewayProxyMode.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ign 0246

The design (LLP 0246) is already realized on master by 04330ab (#794);
the plan records the symbol-by-symbol conformance pass, enumerates the
nine consent/refusal pins that exist, and schedules the two outstanding
items: the missing --json non-interactive test pin (T1) and the corpus
cross-links binding 0242/0243/0244 to the design of record (T2).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The design of record for the proxy-mode-default-attach change set
(LLP 0246) landed after the request and decision docs it closes.
Append it to the Related metadata line of LLP 0242 (issue), LLP 0243
and LLP 0244 (decisions) so the corpus forward-links to the design,
per LLP 0156's allowance for trivial editorial forward-refs on
Accepted docs. Re-verified all six anchors LLP 0246 and the annotated
code cite (#composed-default, #user-key-wins in 0243;
#attach-offers, #enable-write, #central-managed, #non-interactive in
0244) resolve, and ran ref-check over llp/ plus every file carrying
an @ref LLP 0243/0244 annotation: zero broken references.

Task-Id: T2
…ractive)

test/core/attach-proxy-migration.test.js was missing coverage for the
--json attach shape: the code gates on parsed.json (clients.js line 886)
but no test exercised it. Add two cases riding the existing harness (its
json opt was plumbed but unused): --json on a TTY, and --json combined
with non-TTY, both asserting the askYesNo seam is never reached, stderr
carries exactly the one pointer line, no config write occurs, and stdout
stays the attach's valid JSON payload with nothing interleaved.

Task-Id: T1
…bsolute-form-requests

The design was minted at 0246 while, concurrently, llp/0246-remote-control-absolute-form-requests.issue.md
merged to master. Two live docs at one number produce an ambiguous @ref and a red
ref-hygiene check once this branch merges, and neither branch's CI can see it.

Per the repo's renumber rule the later claimant moves above the highest number
claimed anywhere (0250), so the design becomes 0251. Reference sweep covers the
plan (LLP 0249), the design's own title, and the three corpus cross-links T2 added
to LLP 0242/0243/0244. No prose meaning changes.
philcunliffe added a commit that referenced this pull request Aug 17, 2026
The number was taken on origin/integration/proxy-mode-default-attach
(llp/0251-proxy-mode-default-attach.design.md, Status Active), so whichever
branch merged second would have gone red on the uniqueness check. 0258 is the
next number free across master and every remote branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… an unanswerable prompt

The new --json-on-a-TTY pin queued no stdin answer and leaned on askYesNo
hanging as its guard. Removing the parsed.json term from the clients.js gate
proved that inverts the guard: runAttach never settles, every assertion after
it (including the one that names the bug) is skipped, withTempHome's cleanup
never runs, and node reports cancelledByParent for the four tests behind it.
Queue a 'y' like the sibling dry-run and attach-all cases, so a reached seam
accepts the migration and trips the question, stderr, and config-unchanged
assertions in place: one clean red test, no cascade.

Also read the json flag off the attach args rather than the harness closure,
the way a real adapter reads it, so the same pins fail if the command stops
propagating --json into client.attach(). Verified both perturbations: gate
removal now fails test 7 alone with testCodeFailure; dropping json from the
attach args fails both new tests, where before this change both stayed green.
@philcunliffe

Copy link
Copy Markdown
Contributor Author

Review round 1: findings, both actionable ones fixed in c3964d4b

Verdict: approve after the pushed fix. The design's central factual claim holds, the renumber is complete, the LLP edits stay inside what immutability allows, and the new --json pin does genuinely go red when the behaviour breaks. Two test-robustness defects were worth fixing; one informational item is a merge-order constraint the PR body already records.

The central claim is true

The design (LLP 0251) and the plan (LLP 0249) both rest on "LLP 0242 is already implemented on master by #794", and the plan schedules no production code on that basis. Spot-checked symbol by symbol against this branch's tree, including the line numbers the plan cites:

Claim Verified
"gateway_proxy_mode": true in the claude picker row hypaware-core/plugins-workspace/claude/hypaware.plugin.json:45; codex manifest declares nothing
the fold in composePickerConfig src/core/cli/walkthrough.js:957 (accumulator), :973 (fold), :1014 (writes proxy_mode: true)
carry-forward lets a prior entry own the key, absence included src/core/cli/walkthrough.js:1277-1278
finale CA wait src/core/cli/walkthrough.js:12 (import), :1535-1537
literal hyp init claude preset hypaware-core/plugins-workspace/claude/src/index.js:413
maybeOfferProxyModeMigration, called before endpoint resolution src/core/commands/clients.js:821, called at :308, failure downgraded at :312
the non-interactive gate src/core/commands/clients.js:886 (parsed.client === 'all' || parsed.json || !isTty(ctx.stdin))
enableGatewayProxyMode, no_gateway / central_managed, injectable waitForCaFn src/core/config/gateway_proxy_enable.js:69, :154, :80 and :251

Every one exists as described. Gate suite green on this branch: 45/45 across the five design-named test files plus attach-enablement-state.test.js. npm run typecheck clean.

Finding 1 (medium, fixed): the --json pin failed by parking, not by asserting

test/core/attach-proxy-migration.test.js:241 deliberately queued no stdin answer and relied on askYesNo hanging as its guard. That inverts the guard. I removed parsed.json from the src/core/commands/clients.js:886 gate to simulate the regression the test exists to catch:

not ok 7 - --json on a TTY: ...
  failureType: 'cancelledByParent'
  error: 'Promise resolution is still pending but the event loop has already resolved'
not ok 8..11  (cancelled)
# pass 6  # fail 0  # cancelled 5

readline awaited a PassThrough that was never written to and never ended, so await runAttach(...) never settled. Every assertion after it was skipped, including !stderr.includes(MIGRATION_QUESTION), the one that would have named the bug; withTempHome's finally never ran, so the temp HOME leaked; and the four tests behind it were cancelled. It exited nonzero only because nothing else in the file holds the event loop open, which is a property a future test with a timer would remove.

Fixed by queueing answer: 'y', the way the sibling --dry-run and attach all cases already do: a reached seam now accepts the migration and trips the question, exact-stderr, and config-unchanged assertions in place. Re-running the same perturbation after the fix:

not ok 7 - --json on a TTY: ...   failureType: 'testCodeFailure'
# pass 10  # fail 1  # cancelled 0

One clean red test, named at its own assertion, no cascade, no leaked temp dir.

Finding 2 (low, fixed): the mock adapter read the harness closure, not args.json

The adapter stub emitted its machine payload from makeCtx's captured json variable rather than from args.json, the flag runClientLifecycle actually passes at src/core/commands/clients.js:457. Since the test's stated subject is the --json attach shape, that left a real gap: dropping json: parsed.json from the client.attach() call, which would make every real adapter print human prose into a --json run, left both new tests green.

Fixed by reading args.json === true, which also retires the harness's json opt rather than reviving the dead-opt pattern the plan itself flagged. Verified: with json: parsed.json deleted from the attach args, both new tests now fail (# pass 9 # fail 2), where before the fix both passed.

Both fixes are test-only; no production code changed.

Informational (not fixed, correctly out of scope): LLP 0245 dangles until #815 lands

LLP 0251 cites LLP 0245 twice (section 0 and section 3) and declares Depends-on: proxy-mode-capture. llp/0245-*.md exists only on integration/proxy-mode-capture. The merge-notes claim checks out: PR #815 is that branch and does carry llp/0245-proxy-mode-capture.design.md; nothing else on any remote branch supplies it. Merging this PR first lands a design of record citing a document not in the tree. Nothing in the PR enforces the ordering, so it rests on the merge notes and a human. Not editable from a review round, and the PR body already states it.

Renumber: complete

  • git grep 0246 on this branch returns nothing, in llp/, src/, test/, hypaware-core/, or bin/.
  • The file is llp/0251-proxy-mode-default-attach.design.md; the title line, the plan's Related: and prose, and the three cross-links in LLP 0242/0243/0244 all read 0251.
  • No other number on this branch collides. Surveyed every remote branch: 0245/0248 belong to integration/proxy-mode-capture, 0246/0247 to master, 0250 to fix/issue-780, and 0249/0251 are claimed only here.

LLP immutability: respected

The diffs to Accepted LLP 0242, 0243, and 0244 are exactly one Related: metadata-line addition each (, LLP 0251). No settled section body is touched. That is the trivial-editorial-forward-ref case the conventions permit.

@ref honesty: all anchors resolve

All six named anchors exist: #composed-default (0243:32), #user-key-wins (0243:44), #attach-offers (0244:32), #enable-write (0244:45), #central-managed (0244:58), #non-interactive (0244:66). Sweeping every @ref LLP 02xx in src/, test/, the claude plugin, and llp/ turns up no other anchor in this range, and no code @ref points at 0245 or 0251, so the dangling-0245 item above is a prose citation only and does not break ref hygiene.

Style

No U+2014 (or any other non-ASCII dash) in any changed file. No semicolons in the new test lines. JSDoc types only.

Left alone

  • LLP 0249's "32/32 across the five named test files" is stale once T1 lands (34/34, 45/45 with the enablement file). It reads as a record of the pre-task audit rather than a claim about the merged tree, and LLP 0249 is Active, so I did not edit it.
  • The second new test (--json plus non-TTY) is near-tautological against a single || gate. It now earns its keep via finding 2's fix, which makes it fail on a broken json propagation, so I kept it.
  • The two new tests use exact assert.equal on stderr.text() where the file's older tests use assert.match. Brittle if materializeClientAssets ever writes to stderr, but that strictness is exactly what "exactly one pointer line" asks for, so it stays.

Fix commit: c3964d4b (test file only).

@philcunliffe

Copy link
Copy Markdown
Contributor Author

Review round 2: approve. Nothing pushed; two findings a human must carry at merge time

Round 1's two fixes both hold under perturbation, the master merge invalidated no substantive claim, and the full suite is green. The findings below are things this branch cannot fix from inside itself: one is a foreseen collision with an open PR, one is cosmetic drift in an Active doc. No commit was pushed this round; head is still ef99b06a.

Did the master merge invalidate anything? Substantively, no

Re-verified every symbol the design rests on at the true head ef99b06a:

Claim At head
"gateway_proxy_mode": true in the claude picker row hypaware-core/plugins-workspace/claude/hypaware.plugin.json:45
composePickerConfig fold src/core/cli/walkthrough.js:994, composed write at :1035
carry-forward lets a prior entry own the key src/core/cli/walkthrough.js:1298
finale CA wait src/core/cli/walkthrough.js:1558, import at :12
literal hyp init claude preset hypaware-core/plugins-workspace/claude/src/index.js:413
maybeOfferProxyModeMigration, before endpoint resolution src/core/commands/clients.js:821, called :308
the non-interactive gate src/core/commands/clients.js:886
enableGatewayProxyMode, refusals, injectable CA seam src/core/config/gateway_proxy_enable.js:75, :154, :80/:251

src/core/cli/walkthrough.js at head is byte-identical to origin/master. Gate suite 45/45 across the five design-named files plus attach-enablement-state.test.js. Full npm test: 4259 pass, 0 fail, 1 skipped, so the plan's "pre-existing failing parquet/iceberg cluster" caveat is now itself stale, in the branch's favour. npm run typecheck clean. All six cited anchors resolve and are referenced from code.

The --json pin still genuinely fails when the behaviour breaks

Two independent perturbations, each reverted:

1. Drop parsed.json from the gate (src/core/commands/clients.js:886):

not ok 7 - --json on a TTY: no prompt, exactly one pointer note, ...
  failureType: 'testCodeFailure'
  error: assert.ok(!stderr.text().includes(MIGRATION_QUESTION))
# pass 10  # fail 1  # cancelled 0     (node --test exit=1)

A clean isolated assertion naming the bug, no hang, no cascade. Round 1's answer: 'y' fix is doing exactly its job.

2. Drop json: parsed.json from the client.attach() call (src/core/commands/clients.js:457):

not ok 7 - --json on a TTY: ...
not ok 8 - --json combined with non-TTY still emits the pointer exactly once, not twice
# pass 9  # fail 2  # cancelled 0

Round 1's finding-2 fix (adapter reads args.json, not a captured closure) also holds: both pins are load-bearing.

Finding 1 (medium): PR #822 collides with this branch, in the docs

Confirmed by trial-merging origin/fix/issue-819 into this head. Two distinct parts.

1a. A real textual merge conflict in llp/0244-attach-migrates-to-proxy-mode.decision.md:

CONFLICT (content): Merge conflict in llp/0244-attach-migrates-to-proxy-mode.decision.md

Both PRs edit the same metadata block: this branch appends , LLP 0251 to the Related: continuation line, while #822 inserts an **Extended-by:** LLP 0259 (...) block immediately after it. Mechanically trivial to resolve (keep both lines; nothing settled is touched), but it will not auto-merge. test/core/attach-proxy-migration.test.js does auto-merge cleanly.

1b. Once #822 lands, two sentences in LLP 0251 §3 become inaccurate. llp/0251-proxy-mode-default-attach.design.md §3 (#migration) says:

The offer is keyed on the config, not the CA

and, under Idempotence:

Once the key is set the offer never appears again; the attach proceeds straight into the LLP 0245 proxy attach.

LLP 0259 settles the opposite for the key-on/CA-missing case. #822's own forward-ref on LLP 0244 states it plainly: "the gate reads the CA as well as the config, so proxy_mode: true with no CA reaches a repair instead of returning". #822 also narrows the corresponding test to proxy_mode already in the config, with the CA on disk: no question, no note.

Not fixable from this PR, deliberately. LLP 0251 is Active; the conventions say to extend rather than edit, and the extending document (LLP 0259) exists only on an unmerged branch. Pre-emptively adding Extended-by: LLP 0259 here would mint a second dangling citation on top of the LLP 0245 one, and pre-emptively rewriting §3 would make the doc wrong against the tree today, where its prose is accurate. The action belongs to whichever of #817 / #822 merges second: append **Extended-by:** LLP 0259 (#attach-offers: ...) to LLP 0251's metadata alongside resolving the 0244 conflict.

The good news: no behavioural conflict. On the trial-merged tree, attach-proxy-migration + gateway-proxy-enable + status-proxy-mode-ca-missing run 36/36 green, and both of this PR's new pins survive intact:

ok 13 - --json on a TTY: no prompt, exactly one pointer note, no write, stdout stays the attach JSON payload
ok 14 - --json combined with non-TTY still emits the pointer exactly once, not twice

#822 preserves the parsed.json short-circuit verbatim (it moves to clients.js:903). The collision is documentation-only.

Finding 2 (low, not fixed): the plan's walkthrough.js line citations drifted in the merge

llp/0249-proxy-mode-default-attach.plan.md:28-46 cites walkthrough.js lines 973 (fold), 1014 (composed write), 1276 (carry-forward @ref), and 1537 (CA wait). At head those resolve to unrelated lines; the real positions are 994, 1035, 1297, and 1558, a uniform +21 shift introduced by the master merge in ef99b06a.

Left alone, on purpose. The section opens "Each design section was checked against the tree at 04330abb", and at 04330abb all four are exactly right, including 1276 pointing deliberately at the @ref line above the guard rather than the guard itself. The numbers are correct relative to the anchor the doc names, so this is not a broken link so much as a commit-relative citation read against a different commit. Rewriting them to head-relative values would contradict the doc's own stated anchor and would re-drift on the next merge, and LLP 0249 is Active. Every non-walkthrough.js citation in the plan still resolves exactly at head (clients.js:821/:308/:886, gateway_proxy_enable.js:154/:80/:251, claude index.js:413, manifest :45, harness :76).

Same section's "32/32 across the five named test files" is now 34/34 with T1's two cases landed. Round 1 noted it; unchanged, and still reads as a record of the pre-task audit.

Everything else re-verified clean

  • Renumber complete. git grep 0246 finds only the genuine master document (llp/0246-remote-control-absolute-form-requests.issue.md) and its two legitimate citers; nothing refers to this design as 0246.
  • No number collisions. Swept every remote branch: 0249 and 0251 are claimed only by this branch. 0245/0248 are integration/proxy-mode-capture, 0246/0247 master, 0250 fix/issue-780, 0252 otel-attach-0245, 0259 fix/issue-819.
  • LLP immutability respected. The diffs to Accepted 0242/0243/0244 are exactly one Related: metadata-line addition each. No settled section body touched.
  • Merge-order claim still true. Proxy-mode capture: design of record for RFC 0231, plus the missing claude_proxy_capture acceptance procedure #815 (integration/proxy-mode-capture) is still open and still the only source of llp/0245-*; it is absent from master and from this branch. The PR body's merge note stands; not edited.
  • Style. No U+2014 or any non-ASCII in the diff; no semicolons in added test lines; JSDoc types only.

Note on process

The code-review skill's run measured src/core/cli/walkthrough.js and src/core/commands/clients.js against a tree that was not this PR's head (it reported the gate at clients.js:903, which is #822's position, and carry-forward at 1292). Its finding 1 was directionally right about the drift but its replacement line numbers were partly wrong. Every number in this review was re-measured in a freshly created worktree pinned to ef99b06a.

@philcunliffe

Copy link
Copy Markdown
Contributor Author

Triage complete at head ef99b06a: both review rounds' residual findings were re-verified against the tree and all are non-blocking. Deferred items (the #822 LLP 0244 conflict and LLP 0251 staleness, the #815-first merge ordering, and LLP 0249's drifted commit-relative citations) are recorded in #830 with merge-time actions. The design's claim that LLP 0242 is implemented on master was re-confirmed symbol by symbol, the gate suite is 45/45 at head, and the new --json pin fails cleanly under perturbation of the clients.js:886 gate. Reminder from the merge notes: merge #815 before this PR.

@philcunliffe philcunliffe added the neutral:approved neutral reviewed this and holds it for a maintainer merge (own or adopted PR; LLP 0025/0030) label Aug 18, 2026
@philcunliffe
philcunliffe marked this pull request as ready for review August 18, 2026 05:31
philcunliffe added a commit that referenced this pull request Aug 18, 2026
…2) (#818)

* RFC 0245: OTEL telemetry replaces proxy attach for Claude Code

The deliberation record for the change set tracked by #798.
Committed unchanged as the branch's design record; status stays Draft because
acceptance is the author's call, not a pipeline step.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* LLP 0251-0256: the decisions RFC 0245 promises on acceptance

One narrow decision per settled choice, so implementation code can cite the
choice it realizes instead of restating the reasoning: the settings env block
as the injection surface, the events-first plus bodies-for-gaps split, the
spool's cap and sweep duties, ingest-time settlement in place of the flush-time
pass, the claude_telemetry_events dataset, and the session-ignore control route
on the listener.

All six are Draft. RFC 0245 gains a Spawns line naming them; nothing here flips
a status, because acceptance is the author's.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* LLP 0257: spec for the claude telemetry listener source

The requirements the listener implementation and its tests answer to: what the
source registers, what its endpoint accepts, how events and body files combine
at ingest, the two datasets it writes, its status and capture-health duties,
its failure modes, and the seams its tests use. Composes decisions 0251-0256
and cites them rather than repeating why.

Draft, like the RFC that spawns it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Forward-ref LLP 0245 from the proxy-attach docs it displaces

Mechanical forward refs only, on the parts the claude client's mode switch
displaces: the RFC (0231), the proxy attach keys (0232), the CA lifecycle and
trust (0235, 0237, 0238), the launchd environment delivery (0239), and the
fresh-install and migration path (0242, 0243, 0244). Each is phrased "on
acceptance of 0245" so it stays honest while 0245 is Draft, and each says what
survives for the clients still routed through the proxy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* RFC 0245 names all six decisions it spawns

The header Spawns line already listed LLP 0251 to 0256 plus 0257, but the
prose "On acceptance" section still enumerated only five choices and left out
session-ignore transport (LLP 0256), the choice open question 4 in the same
file resolves. Name each decision next to its number so the two lists agree.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Carry the 0245 back-reference in Related, not a new header field

The seven new docs each carried a Spawned-by header field that appears nowhere
else in the corpus. The corpus already has a way to say this: LLP 0168, spawned
by RFC 0167, glosses its parent inside Related ("LLP 0167 (the accepted RFC
this decision realizes)"), and the parent RFC carries the one-way Spawns line.
Fold the same gloss into Related here and drop the field. LLP 0256 keeps the
"settled in #798" fact on a Tracker line, which LLP 0245 and LLP 0257 already
use.

No information is lost: every doc already listed LLP 0245 in Related, and the
Spawns line on 0245 records that all seven stay Draft until it is accepted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* LLP 0251 renumbered to 0258: open PR #817 claimed 0251

The number was taken on origin/integration/proxy-mode-default-attach
(llp/0251-proxy-mode-default-attach.design.md, Status Active), so whichever
branch merged second would have gone red on the uniqueness check. 0258 is the
next number free across master and every remote branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* The OTLP http/json listener becomes shared core machinery (LLP 0257)

A second plugin is about to host an OTLP listener of its own, so the
transport half of @hypaware/otel's receiver moves to src/core/otlp:
signal routing, json-only content-type enforcement, gzip and deflate
decoding, the per-signal partialSuccess envelopes, and bind-and-resolve.
The shared server never looks inside `data`, so payload interpretation
stays with whichever plugin hosts the listener.

Pure prefactor. @hypaware/otel keeps its banner text, its bind error
prefix, its config keys, its wire responses and its self-telemetry loop
guard, which never left the collector. The one new option, a signal
subset, defaults to all three signals, so today's listener is unchanged.

The transport contract is now pinned by test/core/otlp-json-server.test.js
rather than only by the two otel smokes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* A live producer that is not the proxy records through the gateway (LLP 0252)

`ai_gateway_messages` is about to have a third producer, so the gateway
capability grows the one call such a producer needs:
`recordProjectedExchange`. It takes a finished
`AiGatewayProjectedExchange` and owns everything after it - the shared
row expansion, `part_id` identity, the schema strip, the table path -
so an OTEL-projected row cannot drift from the proxy's row for the same
content.

The write is preceded by a pre-write `part_id` dedupe seeded from both
committed partitions and the spool, restricted to the batch in hand.
That is what makes producer overlap harmless: a part the proxy or a
backfill run already stored is skipped, not appended a second time. The
spool scan is the same one backfill does and stays forbidden on the
flush path, where the rows being tested ARE the spool.

Purely additive on the capability surface, so every adapter's `^2.0.0`
requirement still resolves and the proxy recorder's path is untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The claude plugin hosts a listener for Claude Code's own telemetry (LLP 0257)

`@hypaware/claude` contributes a `claude-telemetry` source through the
kernel source registry: an OTLP http/json listener on loopback, on its
own port (default 4319, config `claude.telemetry.listen_port`, `0` for
dynamic), built on the shared core server so the transport is not
copied. Only the logs and metrics routes are served; metrics are
accepted and dropped so the exporter is not left retrying a 404, and a
non-json content type is refused exactly as the otel receiver refuses
it.

Payload interpretation is claude-owned. `user_prompt` and
`assistant_response` each carry their own `message.uuid`, so they
project once, with native identity, and no settlement enricher has
anything to repair. `api_request` carries no content and no uuid: it is
the usage record for the `request_id` an assistant response names, and
is folded onto that message's `attributes.usage` in the same shape the
proxy path writes. The index that holds it spans batches, because the
exporter flushes on a timer, and evicts oldest-first at a cap.

Rows go out through the gateway's `recordProjectedExchange`, so OTEL is
a third producer of `ai_gateway_messages`, not a new table. cwd and git
identity still come from the SessionStart hook record; `query_source`
and `agent.name` carry attribution, and parent_uuid,
logical_parent_uuid, user_type and permission_mode read null by design.

The daemon's own exports are dropped by resource marker, and another
exporter that finds the port is ignored by scope rather than
half-parsed. Registration is feature-detected against the capability, so
an older gateway degrades to "no listener" instead of failing boot, and
the source is registered rather than auto-started, so a CLI activation
never binds a port.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* A hermetic smoke drives the telemetry listener end to end (LLP 0257)

Content in at the HTTP endpoint, rows out of `hyp query sql`: the smoke
activates the gateway and the claude plugin in a temp HypAware home,
drives the SessionStart hook, starts the listener on a dynamic port, and
POSTs one real-shaped Claude Code batch (the three content events plus
two behavioral ones the listener does not model yet, so skipping them is
proven rather than assumed).

It then asserts the rows: native uuid identity, prompt and response
text, model, the usage the `api_request` event carried, the cwd the hook
recorded, the OTEL producer marker, and the transcript-only columns
reading null. A replayed batch adds nothing. `hyp backfill claude` over
a transcript carrying the same uuids also adds nothing, which is the
proxy-to-OTEL overlap window in miniature. A `text/plain` POST is
refused with 415. The capture spans and the batch log carry the counts
that prove the intended path ran.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The claude settings writer gains an otel mode behind a version floor (LLP 0258)

A third attach mode beside base_url and proxy: `otel` merges the LLP 0258
#env-keys telemetry block into the settings env block and writes nothing
that routes traffic, so the endpoint stays first party and Remote Control
needs no override keys. The mode reuses the whole marker machinery
unchanged (managed env, prev_env backups, atomic mtime-gated writes, JSONC
refusal, releaseUnmanagedKeys for mode switches), records the spool
directory on the marker for detach and purge to sweep (LLP 0258
#marker-and-spool, LLP 0253), and refuses below Claude Code 2.1.193 with a
`claude update` hint, leaving any existing attach byte-identical (LLP 0258
#version-floor, no fallback to any other mode).

claude_version.js owns the floor: numeric triple parse and compare
("2.1.193" must not sort below "2.1.9"), unknown-is-not-old, a best-effort
`claude --version` probe, and the HYP_CLAUDE_CODE_VERSION override that
keeps hermetic smokes independent of whatever binary the machine carries.
telemetry/spool.js owns the spool path contract: <hyp-home>/spool/
claude-bodies, created 0700 (LLP 0253 #spool-location).

Adopted from the crash-debris-806 stash after review; the malformed mode
doc block in types.d.ts is repaired.

Part of #806 (spec #798, RFC LLP 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp attach claude writes the telemetry env block in otel mode (LLP 0258)

The adapter's attach handler switches its non-proxy branch from base_url
to otel: with no local CA (no proxy-mode gateway) it probes the Claude
Code version, resolves the listener port, and hands the writer the otel
mode. The spool directory is created owner-only right after the settings
write. A CA-bearing install still attaches by proxy; migrating it to otel
is ticket #807.

The endpoint's port resolves in trust order: the live daemon's bound port
from status.json (pid-gated, via the new core
resolveLiveSourceListenPortFromStatus, the generic sibling of the gateway
endpoint resolver), then a configured fixed telemetry.listen_port, then
the well-known default. That is the promise that makes the listener's
default-port bind fallback safe. The marker keeps recording the gateway
port, so the attach-drift check is unchanged.

Smokes pin the new surface: claude_attach_detach golden-compares the
exact nine-key env block, the absence of every routing key (the Remote
Control predicate as absences), the marker's mode and spool_dir, and the
0700 spool; client_attach_idempotent adds a below-floor refusal leg
(exit 1, `claude update` hint, settings byte-identical) beside the
attach/detach cycles; client_attach_on_join proves the daemon's org-driven
attach delivers the same block and that drift now shows in the marker
port; the walkthrough asserts init's real attach lands otel. All four pin
HYP_CLAUDE_CODE_VERSION so no flow depends on the machine's own claude.

Closes #806 (spec #798, RFC LLP 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Spooled body files fill the projection gaps events never carry (LLP 0252)

Body events (api_request_body / api_response_body) join the projection
through their body_ref: the request body supplies system_text, the tools
list, and canonical message ordering; gap blocks (tool_use with
untruncated args, tool_result, thinking with its signature) become their
own projected messages with a minimized pointer-only raw_frame, matching
the proxy path's excerpt policy. Text blocks are never re-projected: the
events already delivered them once under native uuid identity. A ref
outside the spool is refused (the listener deletes what it reads, so an
uncontained ref would be a read-and-delete primitive over the whole
filesystem), a missing body counts as evicted, and an unparseable one is
deleted rather than retried forever. Session-level body facts carry
across exporter batches, bounded oldest-first.

Ticket: #804 (spec #798, RFC 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The daemon caps the body spool and the listener consumes it (LLP 0253)

The listener repairs the spool to owner-only on every start, enforces
the byte cap (telemetry.spool_max_bytes, default 512 MB) at start and on
a timer, and evicts strictly oldest-first (mtime, then name) when the
cap is exceeded: the sweep exists exactly for the window where Claude
Code writes bodies and nothing consumes them. At ingest the referenced
bodies are read, projected, and deleted only after the dataset write
succeeded, so a failed write becomes an HTTP error the exporter retries
against the same files. Status details gain the spool byte size and the
projected / evicted / missing body counts, and eviction is logged with a
count so a machine routinely losing detail to backfill is visible.

Ticket: #804 (spec #798, RFC 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The telemetry smoke joins body fixtures and recovers an evicted session (LLP 0257)

The hermetic flow now drops real-shaped request and response body files
into the spool and proves the join end to end: system_text and the tools
list on every row, the full 600-char tool args the event-side clip would
have truncated, the tool result, the thinking signature, a pointer-only
raw_frame, and both files DELETED after projection. A pre-staged
over-cap body is evicted by the startup sweep (config-driven cap,
oldest-first, visible in status and logs) and its session still
completes: the events land at ingest and transcript backfill recovers
exactly the tool rows the evicted body held, under native identity. The
spool directory a client created loose is tightened to 0700.

Ticket: #804 (spec #798, RFC 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Behavioral events land in their own claude_telemetry_events dataset (LLP 0255)

The first dataset @hypaware/claude owns: a manifest contributes.datasets
entry plus a registration at activation, with the claude_telemetry
source signal so central forwarding never falls back to the dataset
name. One row per event, hot fields typed (event name, timestamp,
session id, tool name, decision, source, cost), every remaining
attribute preserved in a JSON column; a hot key whose value does not
fit its typed column stays in the JSON rather than vanishing, and an
event name we do not model still lands (LLP 0257 S20).

The split is behavioral-vs-conversation: user_prompt and
assistant_response stay in ai_gateway_messages, the body-pointer events
are transport, and everything else becomes a row - including the
metrics half of the exporter config, which the listener previously
dropped: claude-scope metric data points (cost, lines of code, active
time) flatten into the same event shape, one row per data point.

The listener writes the behavioral rows only after the message write
succeeded, so an exporter retry after a failure re-attempts a write
that never happened; there is deliberately no pre-write dedupe (single
producer, one POST per batch), and the lost-success-response window
produces byte-identical rows compaction's content-hash layer collapses.

No localOnlyContentColumns declaration: the LLP 0105 wrapper would null
the attributes column for every ordinary caller (no row here carries a
cwd to prove itself with); this dataset's privacy seam is the inline
ingest drop of LLP 0254 #policy-inline, ticketed as #808.

The activation-context test stubs gain the query registry the real
kernel always wires in.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The telemetry smoke reads behavioral events back from claude_telemetry_events (LLP 0255)

The batch grows tool_decision (reject, with its source) and the hook
execution pair beside the existing permission_mode_changed and
tool_result, then hyp query sql asserts the behavioral half: one row
per event in timestamp order, content and body events absent, hot
fields typed and lifted out of the attributes JSON, the unpromoted
attributes (from_mode/to_mode, hook identity and outcome, token counts)
readable through JSON_VALUE. A /v1/metrics POST lands its two data
points as rows named by their metrics, value and unit joined.

The registration surfaces are asserted too: hyp query status enumerates
the dataset beside ai_gateway_messages, and the registration carries
the claude_telemetry source signal. The replayed batch's behavioral
rows double by design (no pre-write dedupe; compaction's content-hash
layer owns the collapse), asserted explicitly so a future dedupe is a
conscious change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The session-ignore control handler becomes shared core machinery (LLP 0256)

A second recorder is about to host the same /_hypaware/ignore/session
route the gateway proxy hosts, and LLP 0256 wants one route shape with
one set of tests rather than a copy per plugin. So the handler (and the
reserved-prefix recognizer) moves from ai-gateway/src/control.js to
src/core/control/session_ignore.js, the same way LLP 0257 S2 moved the
OTLP http/json server into core. The mutation log's event name and
identity fields become caller-supplied so each host keeps its own signal
shape; the defaults keep the gateway's exactly, and no behavior changes.

The route test moves to test/core with it, per LLP 0256's consequence
that the route's tests live at the shared shape.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The claude listener hosts session ignore and drops the session at ingest (LLP 0256)

The shared OTLP http/json server gains the same reserved-prefix seam the
gateway proxy has: an optional control handler owns /_hypaware/* before
any OTLP routing. The claude telemetry listener registers the shared
session-ignore handler over its own in-memory set (nothing on disk, dies
with the process), so /_hypaware/ignore/session answers identically on
both recorders.

Ingest enforces the set on both signals: events whose session.id is in
the set are partitioned out before the spool is read, so nothing of the
session reaches ai_gateway_messages or claude_telemetry_events, and the
dropped session's spooled bodies are DELETED unread under the same
spool-containment rule as the read path (LLP 0253 delete-on-drop). Each
drop emits the usage_policy_drop signal with policy_source
session_opt_out, and the source status reports the live set size plus
the drop counters.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp session ignore posts to every recorder that offers the route (LLP 0256)

A recorder that hosts the session-ignore route now says so itself: the
claude listener advertises control_routes in its status details, and a
new core resolver reads every such advertisement out of a LIVE daemon
snapshot. The mutations address the gateway (its own two-rung
resolution, unchanged) plus every advertised recorder, so the
client-agnostic verb never carries a list of client plugins, and a
listener that is not running is simply not addressed - it records
nothing, so its absence is not a failure.

Each outcome is reported: the receipt keeps its legacy top-level fields
(the gateway's answer) and gains a recorders array naming every write;
the human output prints one line and one responder-trust disclosure per
addressed endpoint. An addressed recorder that refuses makes the verb
report partial and exit unknown - the refusing recorder is the one still
recording, so the write must not read as done. Single-recorder installs
keep byte-identical receipts apart from the new array.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* A privacy smoke drives session ignore through both recorders (LLP 0257 S25)

claude_telemetry_session_ignore boots the real daemon, ignores a session
through hyp session ignore (asserting the receipt names the gateway and
the claude listener, and that each control route confirms membership
directly, so the gateway's own route is proven undisturbed), then posts
the ignored session's events, bodies, and metrics: zero rows land in
either dataset, the spooled body is deleted unread, and the drop signal
fires with policy_source session_opt_out. unignore restores capture for
the same session, whose resumed body is projected then deleted normally.
A clean session lands beside the drop throughout, isolating the effect.

PRIVACY.md's pausing-a-session passage now names both recorders and the
listener's delete-not-skip duty for spooled bodies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp status renders a capture-health line for otel-attached clients (LLP 0257 S17)

On the otel path capture is best-effort, so a stale endpoint, a down
daemon, and upstream event drift all fail into the same silence while
every other status line stays healthy. This is RFC 0245 open question
1's duty: the gap becomes a line, and past a threshold a diagnostic.

The comparison has two sides. The listener source now publishes
last_event_at unconditionally (null before the first event), so its
presence marks the snapshot as the telemetry listener's, the same
self-advertisement pattern as control_routes; status reads it from
status.json without a liveness gate (the LLP 0164 argument: last seen
at T survives its daemon, and the dead-daemon window is precisely the
gap to surface). The client's own side is a new manifest-declared
activity_probe (dir + file suffix, the settings_file home-relative
contract) that core stats fresh for the newest transcript mtime, so a
daemon that was down while the user worked cannot hide the loss.

assessCaptureHealth is pure: the baseline is the newer of the last
event and the marker's attached_at, so months of pre-attach
transcripts prove nothing right after a migration, and a listener
that never saw an event is measured from the attach. Fifteen minutes
past baseline is a warning; two hours escalates to an error that
degrades overall, because an attached machine silently losing
sessions is an outage, not an unfinished setup. The attach probe also
reads the marker's mode and attached_at, gating the section to
otel-attached configured clients and carrying mode into --json.

Part of #810 (spec #798, RFC LLP 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* A capture-health smoke drives hyp status through lockstep, gap, and detached (LLP 0257 S17)

Modeled on status_diagnostics: one otel-attached claude install (marker
plus transcript trail under a fake $HOME, listener detail under
status.json, no daemon alive - the comparison must survive its daemon)
driven through three states. Lockstep renders the line and stays
healthy; transcripts hours past the last event turn --json's
capture_health entry to gap, fire the capture_gap diagnostic at error
severity with the attach repair hint, and degrade overall while the
text surface tags the line; removing the marker empties the array and
silences the section. Span assertions pin the healthy and degraded
status.render runs.

Part of #810 (spec #798, RFC LLP 0245).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp attach claude migrates a proxy attach to otel in one command (LLP 0245)

The adapter stops choosing proxy mode off the CA on disk: otel is the
claude client's only attach mode now, so an attach on a proxy-attached
machine IS the migration. The settings write releases the proxy keys
through the ordinary mode-switch rule and reports the prior marker mode;
on 'proxy' the adapter unwinds the launchd environment (darwin,
best-effort, mirroring the detach undo's release) and prints the
migration story, ending with the one residue that stays the user's call:
the CA trust, offered as 'hyp detach claude --purge' and never run for
them. Below the version floor the refusal still fires before any I/O, so
a too-old client keeps its working proxy attach byte for byte.

The proxy-only attach machinery this retires from the adapter
(ensureDarwinProxyTrust, the CA preflight read, the Cmd-Q relaunch note)
goes with it; detach's own launchd release and the purge path are
untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp status names the attach mode on the text surface (LLP 0245)

--json has carried client_attach[].mode since the marker grew one; the
text line a human reads still said only 'attached', so a machine the
migration just moved from proxy to otel looked unchanged from the surface
that matters. The mode now rides the attached state ('attached (otel)');
markers that predate modes keep the bare word, and the not-attached and
probe-error shapes are untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The migration overlap window collapses to one row set (LLP 0245)

Sessions started before the mode flip keep proxying while new events
arrive over OTEL, so for a while both producers capture the same session.
These tests pin what makes that harmless: the proxy projector's native
transcript identity and the telemetry projection's message.uuid identity
yield the same part_ids for the same content, and the OTEL producer's
pre-write dedupe therefore drops every part the proxy already stored,
whole or half. Either arrival order collapses, because the proxy's
flush-time dedupe asks the same committed-part_id membership question.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The migration's CA offer stops claiming a trust it never verified (LLP 0245)

A proxy attach whose keychain dialog was refused still ran and still left
the CA on disk, so the migration telling that user their CA "is still
trusted in your login keychain" is the one false line in an otherwise
honest story. The offer now names the CA and any trust it was granted,
which is exactly what 'hyp detach claude --purge' removes either way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp status proves the migrated mode through the real collector (LLP 0245)

The migration tests probed the marker directly and the renderer tests fed
themselves fabricated client rows, so nothing joined the two: the claim
that 'hyp status reflects the new attach mode' held only if the collector
in between happened to carry `mode` through. The rig now writes the
install config a real machine has, and one test drives
collectHypAwareStatus plus renderStatusText over the same temp home before
and after the one command: 'attached (proxy)' becomes 'attached (otel)'.

The three non-migrating attach shapes (floor refusal, re-attach, base-URL
switch) also assert no launchd line, which is what the residue unwind
prints on darwin when it runs at all - the negative half of "the unwind
happens on a proxy migration and nowhere else".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hyp purge and detach empty the raw-body spool (LLP 0253)

The spool holds raw request and response bodies no row has been made from yet,
so the two verbs that exist to get rid of captured data have to reach it: a
purge that leaves it lets the next received batch write back rows the user just
deleted, and a detach that leaves it strands raw prompts in our own directory.

Core learns the root (`<hyp-home>/spool`) and the claude plugin's directory
becomes a child of it, so `hyp purge` empties every client's spool without
naming a plugin. Detach takes the path off the attach marker instead, because
the config that produced it is gone by then - which makes it settings-file
input, so it is honored only when it is a direct child of this install's spool
root. Without that gate, "empty the directory the marker names" would be a
recursive delete pointed anywhere a hand edit chose.

Every purge target sweeps, targeted ones included: a spooled body has not been
read, so nothing about it says which directory or session it belongs to.
Neither sweep can fail its caller - the destructive work has already landed by
the time it runs, so an unreadable entry is a reported count, not a thrown
error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The folder usage policy decides at ingest on the OTEL path (LLP 0254)

.hypignore and the machine-local list are resolved per session from the cwd the
SessionStart hook recorded, before the spool is read and before either dataset
is written. An ignored session's events project nothing and its spooled bodies
are deleted unread, so the transport keeps working and the content goes.

The machine-local list is threaded from the SHARED state root, the same path
the export and query seams read. The per-plugin state directory has no list
file, so a resolver built from it silently sees `.hypignore` dotfiles only, and
a `--private` directory would have recorded here after being dropped everywhere
else.

A session with no hook record has no cwd and so no verdict. It is withheld
rather than recorded: writing first and resolving later is the fail-open window
LLP 0085 exists to patch, and this path has no flush-time late drop to patch it
with. The content is still in the Claude Code transcript, which is what the
signal names as the recovery path, and the withhold is counted in status so a
machine whose hook is missing reads as blind rather than idle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* A privacy smoke drives .hypignore through the telemetry listener (LLP 0257 S25)

The OTEL-path analog of hypignore_capture_drop, with four sessions posted at a
live listener: one clean, one under a `.hypignore`, one on the machine-local
list with no dotfile anywhere near it, and one with no SessionStart record at
all. Only the clean session's rows land, in either dataset, every suppressed
session's staged body is gone from the spool, and each drop signal names what
governed it.

The machine-local case is the one that catches a wiring regression nothing else
would: its verdict is only reachable if the listener reads the list from the
shared state root. The hookless case pins the fail-open window closed.

PRIVACY.md gains the spool as a named surface, since it is a directory of raw
prompts under the user's own home: what it is for, that a dropped session's
bodies are deleted unread, that it is capped, and that purge and detach empty
it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The glossary stops saying attach rewrites a base URL (LLP 0258)

The client-source gloss described one attach mechanism as if it were the
only one; it has been wrong since proxy mode shipped and is wrong twice
over now that the claude client attaches by telemetry. The gloss now says
what attach means and defers the how to a new Attach entry that names the
three modes and what each one costs the user.

Also records the distinction the OTEL path invites a reader to get wrong:
`@hypaware/claude` running an OTLP listener does not make claude an `otel`
source. It stays a client source, autodetected and configured for the
user; the `otel` picker source is what someone turns on for their own app.

Discharges the glossary duty in the RFC's implementation spec
(#798, #811).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* A release gate checks the OTEL shapes against the installed Claude Code

LLP 0245 open question 5 leaves flag stability detected two ways: the
`hyp status` capture-health line in production, and a shape assertion
against the real client at release time (LLP 0257 S21). The second one
had no written form until now.

`claude_otel_shape_check` walks a human through it: assert the nine-key
env block on disk, take a raw body sample with the daemon deliberately
stopped (the only way to read a file the listener otherwise deletes on
sight), assert the body fields the projector fills its column gaps from,
then hold a real conversation and read the event names, the event
attributes, the message columns, and the capture-health line back out.

The event-name query doubles as the drift detector, because an event the
listener does not model is recorded rather than dropped: the step asks
for the whole list in the release notes, not a verdict, so the next
release has something to diff against.

The release checklist now names it for any release touching the claude
adapter, and says why the hermetic smoke cannot stand in for it: a smoke
POSTs a fixture we wrote, so it agrees with itself no matter what
upstream did. Also lists `openclaw_capture`, which has had a written
procedure for a while without appearing here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The README describes the attach Claude Code actually gets (LLP 0245)

The proxy-mode section opened by telling the reader that `hyp attach
claude` points ANTHROPIC_BASE_URL at the gateway and that proxy mode is
the opt-in that saves Remote Control. Neither is true on this branch:
claude has one attach mode, `otel`, and Remote Control survives it for
free because no base URL and no proxy are written at all.

Claude Code gets its own section covering what attach writes, where the
raw bodies go and when they are deleted, the version floor and its
refusal, and the proxy-to-OTEL migration. The proxy-mode section keeps
everything true of a client that still proxies (the CA, the decryption
aperture, the corporate-proxy chain) with the claude-specific framing
taken out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The shape check waits out an export interval before calling it broken

Claude Code batches its OTLP exports, and the metrics exporter runs on a
longer interval than the logs one. Checking the spool or the event list
immediately reads "not yet" as "the listener is not consuming", which is
the one wrong answer a release gate must not give. The two steps now wait
and say why.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* RFC 0245 renumbered to 0262: open PR #815 claimed 0245

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* RFC 0262 and the docs it spawns are Accepted

Phil accepted the RFC and its spawned decisions and spec on 2026-08-17; the
conditional forward-ref phrasing in the displaced proxy-attach docs is firmed
up to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* The 0245 renumber reaches the test tree's @refs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review round 1: the daemon stops minting the body spool, and status stops printing a raw marker mode

Three review findings on the OTEL attach path, all narrow:

- The telemetry listener called `ensureClaudeBodySpool` on every source
  start, so a daemon created `<hyp-home>/spool/claude-bodies` on machines
  that never attached the claude client, against whatever HYP_HOME the
  activation context resolved. `activatePlugins` does not thread the
  daemon's env, so ctx.env is `process.env`: running `npm test` without
  `HYP_HOME` demonstrably created the directory in the developer's real
  `~/.hyp`. Attach is what mints the spool (the same write tells Claude
  Code where to put bodies), so the daemon now repairs a directory it
  finds (`tightenClaudeBodySpool`) and creates none.

- `hyp attach claude` ran the spool mkdir inside the same try as the
  settings write, so an unwritable spool root reported a failed attach
  after the settings file had already been rewritten, and swallowed the
  migration notes with it - including the `hyp detach claude --purge`
  line a migrated machine needs. It is now its own try; the failure rides
  the existing warnings list, counted apart from
  `malformed_blocks_repaired` so that count keeps meaning one thing.

- `hyp status` interpolated the attach marker's `mode` into the clients
  row raw. The mode is read back off the client's own settings file, so
  it is a captured label, not an in-process constant; it now goes through
  the same `printable` every other disk-derived label on that surface
  uses (LLP 0225).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Review round 2: hyp status compares where claude exports against where the listener listens

An `otel` attach writes one `OTEL_EXPORTER_OTLP_ENDPOINT` into the client's
settings and nothing ever rewrites it. Two ordinary sequences move the
listener out from under it:

- attach ran with no live daemon, so `resolveAttachTelemetryPort` could only
  write the well-known default, and the daemon later found that port taken
  and fell back to an ephemeral bind (LLP 0114 #ephemeral-fallback);
- `telemetry.listen_port: 0` plus a daemon-down attach, where the default is
  written for a port the config guarantees will never be bound.

Either way Claude Code keeps POSTing at the port it was told about, with
`OTEL_LOG_USER_PROMPTS` and `OTEL_LOG_ASSISTANT_RESPONSES` on, and every
other line in `hyp status` stays healthy. `client_attach_stale` does not
cover it: that comparison watches the gateway, which this mode never talks
to. The capture-health gap line eventually notices the silence, but only
after fifteen minutes of transcript activity and without naming the cause.

Both ports are already on disk. The probe now lifts the marker's managed
`OTEL_EXPORTER_OTLP_ENDPOINT` port (the live value the client is using, not
a parallel field that could disagree with it), and the capture-health block
compares it against the listener's live `listen_port`, raising a
non-degrading `client_telemetry_stale` naming both ports and the repair.
Liveness-gated, unlike `last_event_at` beside it: a dead daemon's snapshot
cannot say where anything is bound now, and a restart is what moves the port
back. A marker with no endpoint, or one that does not parse to an in-range
port, makes no claim at all.

This is LLP 0114 #fallback-is-visible applied to the new listener - the half
of that decision the listener had adopted the fallback without - and LLP 0257
gains S17b to record it.

Does not prevent the exposure, only makes it loud: whether attach should
refuse to write an endpoint no daemon has confirmed is a design call, left
for a human.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Review round 2: a restarted daemon stops reporting a month-long capture gap, and a failed listener start owns nothing

Two defects in the new listener, both found by re-reading the start path.

The capture-health baseline could not survive a daemon restart.
`state.lastEventAt` lives only in the listener's process, so every restart
republishes `last_event_at: null` however long capture has been healthy.
`assessCaptureHealth` then fell back to the attach timestamp, which on a
machine attached a month ago and used an hour ago yields a month-long gap:
severity `error`, degrading `overall`, on an install that is capturing
perfectly. The first repair the diagnostic prints is `hyp daemon restart`,
so the advice reproduced the finding. The listener now publishes
`listener_started_at`, and the gap is measured from the newest of the last
event, the attach, and a LIVE listener's start - live only, because on a
dead daemon the last one's start bounds nothing and the growing gap is
exactly what the line exists to surface. The null-events message stops
saying "after the attach", which is no longer always the baseline it used.
`listener_started_at` rides the capture-health report and `--json` so the
reason a gap is or is not claimed is readable.

The spool sweep timer was armed before the bind. `stop()` is the only thing
that clears it, and a `start()` that throws never returns a handle to call
`stop()` on, so an explicit-port bind failure (LLP 0114
#explicit-listen-fails-loudly) left an interval scanning the spool every
minute for the life of the daemon on behalf of a source that does not
exist. `unref()` kept it from holding the process open, which is why it
would never have been noticed. The one-shot sweep still runs before the
bind - bodies already on disk are over the cap either way - and only the
repeating one waits for a listener to be behind it.

LLP 0257 gains S17c for the restart baseline. Tests: five in
test/core/status-capture-health.test.js covering the restart, a listener up
long enough for the gap to be real, an event outranking the listener start,
the live-daemon and dead-daemon halves end to end; and a new
test/plugins/claude-telemetry-start-failure.test.js that counts `setInterval`
arming across a failed start, because an unref'd timer does not appear in
process.getActiveResourcesInfo() - verified to fail against the old order.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Review round 2: otel attach names the OTLP keys that outrank the endpoint it wrote

In the OTLP environment-variable contract a per-signal key beats the generic
one, so `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` decides where log records go
whatever `OTEL_EXPORTER_OTLP_ENDPOINT` says. Nothing in the tree mentioned
those keys.

That leaves one shape worth saying out loud: a machine already exporting to
its own collector through a per-signal key gets `OTEL_LOG_USER_PROMPTS`,
`OTEL_LOG_ASSISTANT_RESPONSES` and `OTEL_LOG_TOOL_DETAILS` switched on by
this attach, and its prompts and assistant responses start flowing THERE,
while `hyp status` reports `attached (otel)` and the listener sees nothing.
`OTEL_EXPORTER_OTLP_HEADERS` is the same hazard from the other side: it
carries a collector's credentials and would now ride requests aimed at our
loopback listener.

The managed set is untouched - LLP 0258 #env-keys is "exactly these keys,
and only these", and it is Accepted. Attach now warns per offending key
instead, on the same warnings list every other attach notice rides. A
warning rather than a refusal because attach cannot see a key exported from
the user's shell, so refusing on the half it can see would buy a false sense
of completeness. Values are never echoed: an endpoint or a headers value is
exactly where a collector token lives, and this string is printed, logged,
and serialised into `--json`.

Two tests in test/plugins/claude-settings-otel-attach.test.js: the warning
fires per key, echoes neither the collector nor the credential, and leaves
the keys themselves untouched and unmanaged; and an ordinary attach still
warns about nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* The client hook enforces the body spool cap too, so a down daemon is bounded (LLP 0263)

LLP 0253 #byte-cap named the daemon-down window as the reason the spool's
byte cap exists, then shipped every enforcement inside the listener source,
so the window it named was the one window nothing swept. Claude Code keeps
writing raw request and response bodies whether or not the daemon reads them,
at roughly 145 KB per request, and the daemon is legitimately absent for a
crashed service, a machine where one was never started, an uninstall that
skipped detach, and the attach-before-first-start path the port resolver
deliberately supports. With OTEL_LOG_USER_PROMPTS and
OTEL_LOG_ASSISTANT_RESPONSES on, that is unbounded retention of raw prompts,
not just a disk nit.

`hyp claude-hook session-context` now enforces the same cap on its way out.
It is the right second enforcer because attach already installs it on
SessionStart, CwdChanged, UserPromptSubmit and PostToolUse/Bash (LLP 0085),
so it runs at exactly the cadence bodies are written and the spool cannot
outrun it, and because it needs nothing the daemon owns. It deletes only what
the daemon's sweep would have deleted: the same enforceClaudeBodySpoolCap,
same directory, same oldest-first order, same operator cap read from the same
telemetry.spool_max_bytes key. The hook never widens the rule, it runs the
existing one while the daemon cannot.

The sweep goes last so it can never delay the session-context records the
projector waits on (LLP 0085), and runs on every invocation including the
ones that record nothing, because a malformed event says nothing about
whether the spool is filling. A sweep failure is swallowed, as is the
recording half, so the hook still exits 0.

LLP 0263 carries the decision and 0253 gains the Extended-by forward-ref.
Nine tests drive the hook with no daemon anywhere: four of them fail if the
sweep call is removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* LLP 0263 is Accepted

The last Draft in this change set joins LLP 0252-0258 and 0262 at Accepted,
so every doc PR #818 lands is approved for implementation and the code
already on the branch cites settled decisions rather than a draft.

Accepted, not Active: the lifecycle reserves Active for built AND merged,
and #818 is still an unmerged draft. All nine flip together at merge.

Status only. Nothing 0263 settles was edited, and it carries no [inferred]
claims to retire.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: test <test@test.com>
@philcunliffe philcunliffe removed the neutral:approved neutral reviewed this and holds it for a maintainer merge (own or adopted PR; LLP 0025/0030) label Aug 18, 2026
test added 2 commits August 18, 2026 20:19
# Conflicts:
#	llp/0242-fresh-installs-attach-base-url.issue.md
#	llp/0244-attach-migrates-to-proxy-mode.decision.md
@philcunliffe

Copy link
Copy Markdown
Contributor Author

Deferred non-blocking review findings to #830. Re-triage at the new head 067fa580 (the only branch-side change since the prior triage at ef99b06a is a merge of origin/master, which pulled in #818 / LLP 0262 among others). Verified in a fresh worktree pinned to 067fa580:

Reminder from the merge notes: merge #815 before this PR.

@philcunliffe philcunliffe added the neutral:approved neutral reviewed this and holds it for a maintainer merge (own or adopted PR; LLP 0025/0030) label Aug 19, 2026
@philcunliffe
philcunliffe merged commit 8e8ac2c into master Aug 19, 2026
9 checks passed
@philcunliffe
philcunliffe deleted the integration/proxy-mode-default-attach branch August 19, 2026 07:04
philcunliffe pushed a commit that referenced this pull request Aug 19, 2026
Three textual conflicts, all resolved by keeping both sides:

- docs/PRIVACY.md: master's disclosure of the launchd LaunchAgent stays,
  re-tensed as residue of the proxy-attach releases to match this branch's
  "nothing installs the CA into a system trust store any more"; the lifetime
  paragraph keeps master's added facts (permitted hosts, launchd variable)
  inside this branch's wording about detach and the grant.
- src/core/commands/status.js: master's describePermittedHosts is kept
  verbatim; describeLaunchdEnv keeps this branch's doc comment explaining
  why it states rather than prescribes.
- src/core/daemon/status.js: collectProxyTrust takes both master's
  timeout-bounded probes and this branch's `config` argument, and returns
  both `hosts` and `proxyModeConfigured`.

One semantic conflict, from master's #817 pinning the `--json` shape of the
migration pointer against `claude` while this branch stops the claude row
declaring `compose.gateway_proxy_mode`. Both pins are kept by driving them
through the staged picker row that still declares proxy attach, the way this
branch already converted the rest of the file, plus a new pin that a `--json`
claude attach on a TTY carries no pointer either.

LLP 0251 gains the `Extended-by: LLP 0262` forward-ref LLP 0243 already
carried, since its section 2 names the claude declarers this branch removes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

neutral:approved neutral reviewed this and holds it for a maintainer merge (own or adopted PR; LLP 0025/0030)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant