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

Abierto Apto para principiantes
#2,075 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, node.js
Área
backend

Línea de trabajo

Empieza en integrations/claude-code-plugin/lib/working-memory.mjs, en firstUserPrompt, y luego compara su filtrado de filas con lib/session-brief.mjs:157 y lib/test-gate.mjs:1090. Ejecuta el comando de reproducción del issue y comprueba ambas copias del plugin, incluido lib/working-memory.mjs del plugin de Codex. El trabajo estará terminado cuando se omitan las filas de caveat y las repeticiones locales de comandos, pero un comando con argumentos todavía pueda usarse como objetivo y las sesiones sin una solicitud escrita mantengan el fallback del journal.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Python
Estrellas
263
Forks
47
Merge medio
14 h 13 min
PR fusionados (30 d)
868

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ClickHouse/loom

Todos los issues de ClickHouse/loom

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.