Resolves #13498
Adds the remaining narrow emission slice for who_is_online local mid-turn rescue: Claude Code now writes AGENT_TURN_PRESENCE on UserPromptSubmit and refreshes the active interval on PostToolUse, matching the documented Claude Code hook cadences: https://code.claude.com/docs/en/hooks. The Codex hook now reuses the same fail-soft SQLite writer and keeps its existing wake-submit nonce behavior. add_memory recency remains the primary liveness signal; this PR only supplies local corroboration data where a harness can emit it.
Evidence: L2 (static checks + temp-SQLite hook unit tests + Memory Core liveness consumer specs) -> L3 required for live harness rollout. Residual: post-merge, refresh the active Claude project settings from .claude/settings.template.json and verify a real Claude turn creates and refreshes an AGENT_TURN_PRESENCE row.
Deltas from ticket
The ticket title is broad, but prior work already shipped add-memory-recency primary, the who_is_online rescue read, and the health-gate exemption. This PR intentionally limits itself to the narrowed AC4 emission gap and does not alter liveness precedence or tenant scoping.
Test Evidence
node --check ai/mcp/server/memory-core/helpers/TurnPresenceHookWriter.mjs
node --check .claude/hooks/turnPresenceHook.mjs
node --check .codex/hooks/codex-context.mjs
node buildScripts/util/check-block-alignment.mjs .codex/hooks/codex-context.mjs .claude/hooks/turnPresenceHook.mjs ai/mcp/server/memory-core/helpers/TurnPresenceHookWriter.mjs test/playwright/unit/hooks/codexContextHook.spec.mjs
npm run test-unit -- test/playwright/unit/hooks/codexContextHook.spec.mjs — 4 passed
npm run test-unit -- test/playwright/unit/ai/services/memory-core/WakeSubscriptionService.spec.mjs test/playwright/unit/ai/services/memory-core/TurnPresenceService.spec.mjs — 77 passed
npm run agent-preflight -- .claude/hooks/turnPresenceHook.mjs .claude/settings.template.json .codex/hooks/codex-context.mjs ai/mcp/server/memory-core/helpers/TurnPresenceHookWriter.mjs test/playwright/unit/hooks/codexContextHook.spec.mjs
Post-Merge Validation
Commits
7d0d9cf807 — fix(ai): emit claude turn presence beacons (#13498)
Authored by Euclid (GPT-5, Codex Desktop). Session 019ef378-527d-7393-bc74-ec3a1d3f2ddf.
Resolves #13498
Adds the remaining narrow emission slice for
who_is_onlinelocal mid-turn rescue: Claude Code now writesAGENT_TURN_PRESENCEonUserPromptSubmitand refreshes the active interval onPostToolUse, matching the documented Claude Code hook cadences: https://code.claude.com/docs/en/hooks. The Codex hook now reuses the same fail-soft SQLite writer and keeps its existing wake-submit nonce behavior.add_memoryrecency remains the primary liveness signal; this PR only supplies local corroboration data where a harness can emit it.Evidence: L2 (static checks + temp-SQLite hook unit tests + Memory Core liveness consumer specs) -> L3 required for live harness rollout. Residual: post-merge, refresh the active Claude project settings from
.claude/settings.template.jsonand verify a real Claude turn creates and refreshes anAGENT_TURN_PRESENCErow.Deltas from ticket
The ticket title is broad, but prior work already shipped add-memory-recency primary, the
who_is_onlinerescue read, and the health-gate exemption. This PR intentionally limits itself to the narrowed AC4 emission gap and does not alter liveness precedence or tenant scoping.Test Evidence
node --check ai/mcp/server/memory-core/helpers/TurnPresenceHookWriter.mjsnode --check .claude/hooks/turnPresenceHook.mjsnode --check .codex/hooks/codex-context.mjsnode buildScripts/util/check-block-alignment.mjs .codex/hooks/codex-context.mjs .claude/hooks/turnPresenceHook.mjs ai/mcp/server/memory-core/helpers/TurnPresenceHookWriter.mjs test/playwright/unit/hooks/codexContextHook.spec.mjsnpm run test-unit -- test/playwright/unit/hooks/codexContextHook.spec.mjs— 4 passednpm run test-unit -- test/playwright/unit/ai/services/memory-core/WakeSubscriptionService.spec.mjs test/playwright/unit/ai/services/memory-core/TurnPresenceService.spec.mjs— 77 passednpm run agent-preflight -- .claude/hooks/turnPresenceHook.mjs .claude/settings.template.json .codex/hooks/codex-context.mjs ai/mcp/server/memory-core/helpers/TurnPresenceHookWriter.mjs test/playwright/unit/hooks/codexContextHook.spec.mjsPost-Merge Validation
.claude/settings.template.json; start a real Claude turn, run at least one tool, and verify one activeAGENT_TURN_PRESENCErow hassource=claude-post-tool-usewithlastProgressAt > startedAt.Commits
7d0d9cf807—fix(ai): emit claude turn presence beacons (#13498)Authored by Euclid (GPT-5, Codex Desktop). Session 019ef378-527d-7393-bc74-ec3a1d3f2ddf.