Working-memory bookmark records a slash-command caveat as the session goal

Aperta Adatta ai principianti
#2,075 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
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
backend

Direzione di ricerca

Inizia da integrations/claude-code-plugin/lib/working-memory.mjs, in corrispondenza di firstUserPrompt, poi confronta il suo filtraggio delle righe con lib/session-brief.mjs:157 e lib/test-gate.mjs:1090. Esegui il comando di riproduzione nell’issue e controlla entrambe le copie del plugin, compreso lib/working-memory.mjs del plugin Codex. Il lavoro è completo quando le righe di caveat e le ripetizioni locali dei comandi vengono ignorate, un comando con argomenti può ancora essere usato come obiettivo e le sessioni senza una richiesta digitata mantengono il fallback del journal.

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

Descrizione

bug good first issue help wanted up-for-grabs
Company

ClickHouse

Component

Agent plugin (Claude Code, Codex, Cursor)

Describe what's wrong

The Stop hook's working-memory bookmark (block session:<project>) records the text Claude Code injects for a local slash command as the session's goal:, not the person's first request. A session that starts with /clear is saved as:

goal: <local-command-caveat>The command below was run directly in Claude Code, not sent to you as a request…

The next session's primer shows that line as the goal of the work it resumes.

firstUserPrompt (integrations/claude-code-plugin/lib/working-memory.mjs:40) skips sidechain rows and tool results. It does not skip rows the client wrote itself: the isMeta: true caveat row, and the <command-name>/clear</command-name> row that echoes the command. lib/session-brief.mjs:157 and lib/test-gate.mjs:1090 already skip isMeta rows. The Codex plugin's lib/working-memory.mjs is the same file.

Does it reproduce on the latest release or main?

Yes

How to reproduce

From the repository root on main:

node --input-type=module -e '
import { firstUserPrompt } from "./integrations/claude-code-plugin/lib/working-memory.mjs";
const rows = [
  { type: "user", isMeta: true, message: { role: "user", content: "<local-command-caveat>Caveat: ...</local-command-caveat>" } },
  { type: "user", message: { role: "user", content: "<command-name>/clear</command-name>\n<command-message>clear</command-message>\n<command-args></command-args>" } },
  { type: "user", message: { role: "user", content: "fix the failing search test" } },
];
console.log(JSON.stringify(firstUserPrompt(rows)));
console.log(JSON.stringify(firstUserPrompt(rows.slice(1))));
'

The first line prints the caveat. The second, with the caveat row removed, prints the /clear echo. Both should print "fix the failing search test".

In a live session: start Claude Code with the plugin, run /clear, send a request, end the session, then read the session:<project> working-memory block.

Expected behavior

goal: holds the first request the person typed. firstUserPrompt skips isMeta rows and the echoes of local commands (<command-name> with empty <command-args>, <local-command-stdout>). A command with arguments, such as /<skill> <args>, is a request and can stand as the goal in that form. A session with no typed request falls back to the turn journal, as it does today.

Environment
  • main at b97367188600bb12a5c3acdd4ac25903019b0b44
  • Claude Code and Codex plugins 1.2.158
  • Node 25.8.0
How this was found

An AI tool found it, and I have not reproduced it myself

Additional context

It happens in every session whose first input is a local slash command such as /clear or /model: the transcript starts with the caveat row, then the command echo, then the request.

Redaction
  • I removed tokens, keys, passwords and personal or customer data from everything above.
Lingua principale
Python
Stelle
263
Fork
47
Merge medio
14h 13m
PR unite (30g)
868

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 ClickHouse/loom

Tutte le issue di ClickHouse/loom

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.