feat(core): add reset-only /clear command#379
Open
xukp20 wants to merge 4 commits intochenhg5:mainfrom
Open
Conversation
chenhg5
approved these changes
Apr 1, 2026
Owner
chenhg5
left a comment
There was a problem hiding this comment.
LGTM. Useful feature for session management.
Review summary:
- ✅
/clearresets session context without creating new session entry - ✅ Preserves session identity/name
- ✅ Conservative implementation (cc-connect layer only)
- ✅ Tests added
- ✅ i18n updated
- ✅ Fixes #354
Good addition to session management options.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a reset-only
/clearcommand for the current session.This implements the original request from #354: clear the current session context in place without creating a new session entry like
/new.What changed
/clearas a first-class command/clear/clearusageWhy
Today, the only way to start fresh is
/new, which creates a brand new session.That makes
/listgrow quickly even in cases where the user does not want a new logical session, and only wants to clear the current conversation context while keeping the same session identity.This PR addresses the original feature request in #354.
Maintainer context on #354:
Scope decision
While implementing
/clear, I also evaluated whether cc-connect should support a native clear path in the underlying CLI session.That native path is intentionally not included in this PR.
Reasons:
Codex native slash commands are not reliable enough in
exec/resume --jsonmodeRelated investigation: [Bug] Codex native slash commands are not reliable in exec/resume mode (
/compactand/clear) #378In particular:
/clearis not behaviorally reliable in direct Codex CLI testing/compactalso does not appear stable enough to treat as a guaranteed native capability in the current integration modeClaude Code native
/clearshould be validated separately before exposing it in cc-connectClaude Code does support native slash commands in general, but
/clearbehavior in the current cc-connect integration path still needs separate validation, including Claude-side session/control semantics.Because of that, this PR keeps the implementation conservative:
/clearonly resets the session at the cc-connect layerValidation
go build ./...go test ./... -v -racego test ./... -coverprofile=coverage.out -covermode=atomic$(go env GOPATH)/bin/staticcheck ./...$(go env GOPATH)/bin/actionlint -colorRelated issues
/compactand/clear) #378