[BUG] /goal command never written to ~/.claude/history.jsonl (prompt-recall log)

Open 💬 0 comments Opened Jul 1, 2026 by canberksinangil

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet (checked #67011, #59969, #62246, #66448, #70649 — all cover other /goal behavior, none cover history persistence)
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

/goal <condition> never writes an entry to ~/.claude/history.jsonl, the file that backs up-arrow prompt recall and cross-session prompt search. Every other recognized slash command that is intercepted client-side and never forwarded to the model (/clear, /model, /effort, /fast, /usage, /login) does get appended to history.jsonl as its own {"display":"/command",...} line. /goal is the outlier: it goes through a different internal pipeline — a queue-operation event ("content":"Goal set: <condition>") plus a goal_status attachment ({"type":"goal_status","met":false,"sentinel":true,"condition":"<condition>"}) written only into the per-session transcript under ~/.claude/projects/<project>/<session-id>.jsonl — and that pipeline is never wired to the history.jsonl writer.

Net effect: once a /goal invocation scrolls out of the visible session, there is no way to recall it via the normal prompt-history mechanism (up-arrow, or grepping history.jsonl the way you would for any other past prompt). The only way to recover past goal conditions is to grep every raw session transcript file across every project for "type":"goal_status" and reconstruct manually.

I verified this holds for every /goal invocation across ~50 sessions over the past month in my history.jsonl (4.9MB, 14k+ lines) — not one condition string from a goal_status attachment appears anywhere in it, while /clear//model//effort//fast//usage//login all appear reliably.

What Should Happen?

When /goal <condition> is invoked, the CLI should append an entry to ~/.claude/history.jsonl (e.g. {"display":"/goal <condition>", ...}), the same way it does for /clear, /model, /effort, /fast, /usage, and /login. This would let users recall and search past goals the same way they already can for every other command they type.

Steps to Reproduce

  1. Start a session in any project: claude
  2. Type a /goal with a distinctive condition string, e.g.:

``
/goal MARKER_STRING_12345 verify this saves to history
``

  1. Confirm the ❯ Goal set: MARKER_STRING_12345 verify this saves to history banner appears.
  2. In a separate shell, search the prompt-recall log:

``
grep "MARKER_STRING_12345" ~/.claude/history.jsonl
``
No match.

  1. Compare with a plain intercepted command in the same session, e.g. /clear:

``
grep '"display":"/clear' ~/.claude/history.jsonl
`
→ Matches every time
/clear` was typed.

  1. Confirm the goal condition is being persisted, just not where expected — it's only in the session transcript:

``
grep -l "MARKER_STRING_12345" ~/.claude/projects/*/*.jsonl
`
→ Matches, inside a
"type":"goal_status" attachment and a "type":"queue-operation" event, never in history.jsonl`.

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked (checked back to the earliest /goal invocation in my own history, over a month ago — it was never recorded in history.jsonl either)

Claude Code Version

2.1.197 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

  • macOS version: 26.5.2 (BuildVersion 25F84)
  • history.jsonl is otherwise a reliable, append-only JSONL log ({"display", "pastedContents", "timestamp", "project", "sessionId"} per line) — this is specifically about /goal being excluded from it while functionally-similar commands are included.
  • This makes /goal behave inconsistently with its documented sibling commands from a data-durability standpoint: a user who wants to know "what goals have I set over the last month" has no supported way to answer that question, since the per-session transcript files are not designed or documented as a searchable history surface.

View original on GitHub ↗