Skip to content

fix(deja): skip host-injected notification prompts - #163

Merged
CodeWithJuber merged 6 commits into
masterfrom
fix/deja-skip-harness-prompts
Sep 24, 2026
Merged

CodeWithJuber merged 6 commits into
masterfrom
fix/deja-skip-harness-prompts

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

In a long Claude Code cloud session, the only "prompts" left are often ones the host injects, not ones a person typed. Examples: <task-notification> (a background task finished, a scheduled check-in, PR activity), <system-reminder>, <wake …> and another agent's hand-back.

buildSummary used the first prompt as the session's task. So on the HostLelo repo (CodeWithJuber/my-next-app), every check-in minted a summary claim whose text was the wrapper itself, for example <task-notification> <task-type>queued-remote-notifications</task-type> …. That caused two problems:

  • The repo ledger gained a new untracked claim after every notification, so the git stop hook kept asking the agent to commit ledger noise.
  • The next notification then came back as a déjà-vu hit: Forge déjà vu — similar task seen day …: <task-notification> ….

The fix adds isHarnessPrompt(text) to src/deja.js. It matches a prompt that starts with one of the host wrapper tags, and it is applied on both sides:

  • Recording: buildSummary takes the first prompt a person typed. If there is none, it falls back to the files touched ("touched …"). With no edits either, it records nothing.
  • Lookup: dejaAdvisory returns "" for a host-injected prompt.

A tag in the middle of a sentence ("fix the <Header> overflow") or a JSX name at the start ("<Hero> spacing is off") is still treated as a person's prompt.

Checklist

  • npm test passes (Node 18/20/22). It passed locally on Node 22: 1442 tests, 1439 pass, 0 fail, 3 skipped. CI covers Node 20 and 22.
  • npm run check passes (Biome lint + format)
  • New public functions have a test (isHarnessPrompt, plus the new buildSummary and dejaAdvisory cases)
  • Conventional commit message (feat:/fix:/docs: …)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency (dev deps ok)
  • Substrate/docs updated if this changes forge substrate, forge impact, router/gate, or MCP substrate tools (n/a)

Risk & rollback

  • Risk level: low. It only narrows which prompts deja summarizes or looks up. A person's prompt beginning with one of these exact wrapper tags would now be skipped, which seems unlikely.
  • Rollback plan: revert this commit. FORGE_DEJA=0 still switches deja off entirely.

Extra checks (tick if applicable)

  • npm run typecheck passes
  • Input validated at boundaries; errors handled (no swallowing) (isHarnessPrompt coerces non-strings, and deja stays best-effort)
  • Authorization/ownership checked (if it touches access) (n/a)
  • Logs contain no secrets/PII (no change to redaction)
  • If AI-assisted: I understand it, verified the package APIs, and it has tests (AI-authored; the new test file fails to load on the unfixed code)

Found while driving the HostLelo PRs from a Claude Code cloud session.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UUhB8JaPayd43w37dxiXrW


Generated by Claude Code

In a long cloud session the only prompts left can be ones the host
injects (<task-notification>, <system-reminder>, <wake>, an agent's
hand-back). buildSummary took the first as the session's task, so every
check-in minted a summary claim of the wrapper text, and the next
notification surfaced it as a deja-vu hit. Skip such prompts on both
sides: the summary uses the first prompt a person typed (or the files
touched), and a notification never triggers a lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UUhB8JaPayd43w37dxiXrW
Signed-off-by: Claude <noreply@anthropic.com>
…ss-prompts

Signed-off-by: Claude <noreply@anthropic.com>

# Conflicts:
#	CHANGELOG.md
@CodeWithJuber
CodeWithJuber marked this pull request as ready for review September 24, 2026 04:36
…ss-prompts

Signed-off-by: Claude <noreply@anthropic.com>

# Conflicts:
#	CHANGELOG.md
…ss-prompts

Signed-off-by: Claude <noreply@anthropic.com>

# Conflicts:
#	CHANGELOG.md
…ss-prompts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UUhB8JaPayd43w37dxiXrW
Signed-off-by: Claude <noreply@anthropic.com>
…ss-prompts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UUhB8JaPayd43w37dxiXrW
Signed-off-by: Claude <noreply@anthropic.com>
@CodeWithJuber
CodeWithJuber merged commit f89beb9 into master Sep 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants