Claude Code: the session reminder is printed to the user as well as given to the model

Aperta Adatta ai principianti
#296 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript

Direzione di ricerca

Inizia leggendo emitContext() in hooks/guard.mjs e i test esistenti in guard.test.mjs; confronta l’output di detect per --client plugin e --client codex. L’issue descrive il comportamento desiderato specifico per il client e segnala che il controllo delle modifiche HTML deve continuare a rifiutare una modifica non revisionata con codice di uscita 2. Il lavoro è completo quando l’output del plugin omette systemMessage, gli altri client mantengono il comportamento attuale e i test coprono la modifica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I'm a screen reader user, and since moving to 7.x my screen reader reads this out at the start of every Claude Code session, including after every /clear:

UserPromptSubmit says: This project enforces WCAG 2.2 AA. Before editing HTML, JSX, TSX, Vue, Svelte, CSS or a template, dispatch the accessibility-lead skill and let it finish. ...

It comes up in every project, including ones with no web files at all, which is what sent me looking. Once per session is a big improvement over the old per-prompt block from #165 and #199, so this is a much smaller thing. It's still sixty words of speech every time I start fresh.

What's happening

emitContext() in hooks/guard.mjs writes the text to three fields:

hookSpecificOutput: { hookEventName: event || 'UserPromptSubmit', additionalContext: text },
additionalContext: text,
systemMessage: text,

On Claude Code, hookSpecificOutput.additionalContext is what reaches the model. systemMessage is documented in the Claude Code hooks reference as a message shown to the user, so the client prints it in the terminal, and the model gets nothing from it that it doesn't already have.

Suggested fix

Leave systemMessage out for the Claude Code manifest, which is the only one that passes --client plugin:

...(CLIENT === 'plugin' ? {} : { systemMessage: text }),

I left it in for the other clients because I don't know which of them read it as model context.

I've been running that one-line change locally on 7.1.0. The detect output for --client plugin now has only additionalContext and hookSpecificOutput, --client codex is unchanged, and the gate still refuses an unreviewed .html edit with exit 2. In a real session the transcript shows the difference too: before the change it records the reminder as both a hook_system_message and a hook_additional_context attachment, and after it only the hook_additional_context one. Happy to send it as a PR, with a test in guard.test.mjs, if this sounds right.

AI assistance

I used Claude Code to trace this through guard.mjs. The change and the before and after output above were run on my own machine.

Lingua principale
JavaScript
Stelle
429
Fork
52
Merge medio
4h 47m
PR unite (30g)
48

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Community-Access/accessibility-agents

Tutte le issue di Community-Access/accessibility-agents

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.