Skip to content

fix: wire Claude /context and /compact through to the Agent SDK#905

Open
xukaaaa wants to merge 1 commit into
dohooo:mainfrom
xukaaaa:xukaaaa/fix-claude-context-compact
Open

fix: wire Claude /context and /compact through to the Agent SDK#905
xukaaaa wants to merge 1 commit into
dohooo:mainfrom
xukaaaa:xukaaaa/fix-claude-context-compact

Conversation

@xukaaaa

@xukaaaa xukaaaa commented Jun 27, 2026

Copy link
Copy Markdown

Problem

Claude /context and /compact were silent no-ops. Helmor wraps every user prompt as {helmor preamble}\n\nUser request:\n{prompt} (Rust) plus a [Linked directories…] block (sidecar), so the Agent SDK never received a bare root slash command and treated /compact / /context as literal text. /compact was also suppressed in the composer as a "dead command" (#898).

Fix

  • sidecar session-manager.tsnormalizeRootSlashCommand strips the wrapping (via the User request: marker) and returns the bare command the SDK needs (/compact, /context all); normal prompts keep the linked-dirs hint.
  • sidecar compact-filter.ts (new) — drop the redundant synthetic ## Context Usage assistant reply after /compact (kept for /context, whose output is useful).
  • composer container.tsx — stop suppressing the SDK-reported /compact for Claude (now wired through). Supersedes the /compact suppression from Hide inert slash commands #898.
  • pipeline — collect status:"compacting" + compact_boundary into one system turn; event_filter lets the compacting status through; adapter renders Compacting context / Context compacted notices.
  • system-message.tsx — spinner while compacting, check icon when compacted.
  • catalog.rs — claude custom-provider models report supports_context_usage: true.

Tests (TDD, red-first)

  • sidecar/src/claude/compact-filter.test.ts, session-manager.test.ts (incl. wrapped-prompt root-cause case)
  • system-message.test.tsx (spinner/check), container.test.tsx (suppress->show /compact)
  • Rust pipeline_streams compact-boundary snapshot updated

clippy -D warnings, fmt, typecheck, biome clean. cargo test --tests 1555 pass. Manually verified in bun run dev: /compact triggers compaction lifecycle notices, /context shows usage, /compact appears in the slash popup.

Strip the wrapped prompt so the SDK recognises the root command, and surface the compact lifecycle as system notices. Supersedes the /compact suppression from dohooo#898.
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@xukaaaa is attempting to deploy a commit to the Caspian's Team Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant