[FEATURE] Debug command to view the full chronological content of the context window

Open 💬 3 comments Opened Jun 28, 2026 by gigayaya

Problem Statement

When building and tuning harness systems on top of Claude Code (custom hooks, context injection, subagent orchestration, MCP plumbing), the single most important variable is what actually ends up in the model's context window — the exact content and the exact order it was loaded.

Context is paramount to the model's reasoning and outputs, yet today there is no way to see the real, full context as the model sees it. The existing /context command shows the composition / budget breakdown (how many tokens each category consumes), but it does not show the chronological transcript — the actual messages, tool calls, tool results, system reminders, and injected context in the sequence they were assembled.

That gap makes harness debugging guesswork: I can see that ~30k tokens are "system prompt" or "tool results," but not what those bytes are or where in the timeline a given block landed. When a harness misbehaves (a hook injects the wrong thing, context loads out of order, a reminder appears in an unexpected place), I have no ground-truth view to verify against.

Proposed Solution

A debug command that dumps the complete, ordered content of the current session's context window — the chronological reasoning/assembly history, not just the budget summary.

Ideal experience:

  • A command such as /context --full (or a dedicated /context-dump / claude --debug-context) that renders the full in-context payload in load order: system prompt, tools, memory/CLAUDE.md, each user/assistant turn, every tool_use + tool_result, and any injected <system-reminder> / hook additionalContext blocks.
  • Each entry annotated with its type/source (system, user, assistant, tool_result, hook injection, memory, reminder) and token count, so composition and chronology are visible in one view.
  • An option to export to a file (e.g. JSON or markdown) so the exact context can be diffed across runs while iterating on a harness.

The key addition over /context is the timeline: the verbatim sequence loaded into the window, not an aggregate.

Alternative Solutions

  • /context — shows composition/budget only, no chronological content. This is the closest existing tool and what motivated the request.
  • Inspecting the on-disk session transcript / JSONL — partial and unreliable as a proxy: it isn't guaranteed to reflect exactly what was assembled into the window after hook injection, reminders, compaction, and ordering, which is precisely what needs verifying.
  • Manually instrumenting hooks to log what they inject — only covers hook-sourced content, not the fully assembled window, and is laborious to wire up per harness.

Priority

Medium - Would be very helpful

Feature Category

Developer tools/SDK

Use Case Example

  1. I'm designing a custom harness that uses PreToolUse hooks plus injected additionalContext to feed task state into the model.
  2. The model starts behaving as if it never received that state, or received it at the wrong point in the conversation.
  3. Today I can only see from /context that "hook context" occupies some tokens — not its actual content or position in the timeline.
  4. With this feature I run /context --full, see the exact injected block, its content, and where in the chronological sequence it was placed (e.g. it landed after the tool_result instead of before the next user turn).
  5. I immediately confirm the ordering bug, fix the hook, and re-dump to verify — instead of guessing.

This turns harness debugging from inference into direct observation, and would be critical for anyone building or optimizing harness/agent systems on Claude Code.

Additional Context

  • This is purely a read/inspection capability over context the session already holds — no new data exposure beyond what the model already sees.
  • Most valuable when paired with an export/diff option, so the assembled window can be compared run-to-run while tuning a harness.
  • Related in spirit to other "make the context visible" requests (e.g. surfacing hidden content the model reasons over), but focused specifically on the full chronological context window rather than any single source.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗