Skip to content

fix: true ephemeral commands — filter from LLM context instead of sweep#8

Merged
e6qu merged 1 commit intodevfrom
fix/ephemeral-true-filter
Mar 16, 2026
Merged

fix: true ephemeral commands — filter from LLM context instead of sweep#8
e6qu merged 1 commit intodevfrom
fix/ephemeral-true-filter

Conversation

@e6qu
Copy link
Copy Markdown
Owner

@e6qu e6qu commented Mar 16, 2026

Summary

  • Fix schema validation crash: ephemeral commands (/history, /tree, etc.) were failing because afterTurns: 0 violated LifecycleMeta's min(1) constraint
  • Replace sweep-based ephemeral with true filter: ephemeral Q&A is now dropped from the LLM context entirely via filterEphemeral() (like Claude Code's /btw), so it's visible in the TUI but never pollutes the session thread
  • Remove sweep's ephemeral/externalize branch: only discardable remains in sweep logic
  • Add input validation: .int().min(1) on context_edit tool's afterTurns param
  • Cleanup: remove 3 unused imports, 1 unused constant

Test plan

  • tsc --noEmit passes
  • All 1347 tests pass
  • Run /history or /tree in a session — no schema validation error
  • Verify ephemeral command output is visible in TUI but absent from next LLM turn

Ephemeral slash commands (/history, /tree, /threads, /deref, /classify)
were crashing with a schema validation error because afterTurns:0
violated LifecycleMeta's min(1) constraint.

Instead of patching the value, replace the sweep-based ephemeral system
with a true ephemeral filter (like Claude Code's /btw): messages marked
ephemeral are dropped from the LLM context entirely via filterEphemeral(),
so the Q&A is visible in the TUI but never pollutes the session thread.

- Add MessageV2.filterEphemeral() — drops user+assistant pairs where
  all parts have lifecycle.hint === "ephemeral"
- Call filterEphemeral in prompt loop before filterEdited
- Remove sweep's ephemeral/externalize branch (only discardable remains)
- Simplify ephemeral marking: no afterTurns/turnWhenSet needed
- Add .int().min(1) to context_edit tool's afterTurns parameter
- Make turnWhenSet optional in LifecycleMeta schema + SDK type
- Remove unused imports and constants
@e6qu e6qu merged commit 3325763 into dev Mar 16, 2026
1 check passed
@e6qu e6qu deleted the fix/ephemeral-true-filter branch March 16, 2026 09:40
e6qu added a commit that referenced this pull request Mar 18, 2026
…ep (#8)

Ephemeral slash commands (/history, /tree, /threads, /deref, /classify)
were crashing with a schema validation error because afterTurns:0
violated LifecycleMeta's min(1) constraint.

Instead of patching the value, replace the sweep-based ephemeral system
with a true ephemeral filter (like Claude Code's /btw): messages marked
ephemeral are dropped from the LLM context entirely via filterEphemeral(),
so the Q&A is visible in the TUI but never pollutes the session thread.

- Add MessageV2.filterEphemeral() — drops user+assistant pairs where
  all parts have lifecycle.hint === "ephemeral"
- Call filterEphemeral in prompt loop before filterEdited
- Remove sweep's ephemeral/externalize branch (only discardable remains)
- Simplify ephemeral marking: no afterTurns/turnWhenSet needed
- Add .int().min(1) to context_edit tool's afterTurns parameter
- Make turnWhenSet optional in LifecycleMeta schema + SDK type
- Remove unused imports and constants

Co-authored-by: Adrian Mârza <adi11235 at gmail dot com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant