Skip to content

feat(daemon): add /clean slash command (strip injections, preserve history)#31613

Merged
siddseethepalli merged 1 commit into
mainfrom
do/add-clean-slash-command
May 22, 2026
Merged

feat(daemon): add /clean slash command (strip injections, preserve history)#31613
siddseethepalli merged 1 commit into
mainfrom
do/add-clean-slash-command

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

Summary

  • Add /clean slash command that strips runtime injection blocks from the message history and clears the memory injection ledger, without an LLM summarization call.
  • Mirrors /compact's non-LLM side effects: re-injects NOW.md / knowledge base / memory v2 static blocks on the next turn, and resets per-turn memory activation dedup.
  • Preserves the entire user / assistant / tool_use / tool_result history verbatim — useful when accumulated injections (not conversation length) have pushed context into pressure.

Original prompt

Add a /clean command that does everything /compact does (strip the same injections from messages, allow them to be re-injected on the next turn, clear the list of injected memories) but leaves the user / assistant / tool_call / tool_response history completely intact, as if the compaction process had decided to keep the whole conversation and summarize nothing.

Test plan

  • `bun test src/tests/conversation-slash-commands.test.ts` — 45 pass (existing + new `/clean` parsing tests + updated `/commands` help listings)
  • `bun test src/tests/conversation-clean-command.test.ts` — 5 pass (formatCleanResult + strip preserves assistant + tool blocks)
  • End-to-end smoke: in a conversation with accumulated injections, run `/context`, then `/clean`, then `/context` again — token count should drop and the next user turn should see fresh NOW.md / memory re-injections.

…thout summarization

`/clean` mirrors the non-LLM side effects of `/compact` — strips runtime
injection blocks from the message history and resets the memory injection
ledger so NOW.md / knowledge base / memory v2 static blocks re-inject on
the next turn — but preserves the entire user/assistant/tool history
verbatim. Useful when accumulated injections (not history length) have
pushed the context window into pressure.
@siddseethepalli siddseethepalli merged commit 5077106 into main May 22, 2026
@siddseethepalli siddseethepalli deleted the do/add-clean-slash-command branch May 22, 2026 00:50
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 161e84ad6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread assistant/src/runtime/routes/conversation-routes.ts
@siddseethepalli
Copy link
Copy Markdown
Contributor Author

Addressed in #32115

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