anthropics / anthropics/claude-code
Allow user-defined aliases for built-in slash commands (the internal `aliases` array is not user-configurable)
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
## Summary
Built-in slash commands already carry an `aliases` array internally, but there is no way for a user to add one. Please expose it in settings.
In `2.1.273` the `/clear` entry is:
```js
type:"local",name:"clear",description:"Start a new session with empty context; previous session stays on disk (resumable with /resume)",argumentHint:"[name]",aliases:["reset","new"],supportsNonInteractive:!0,...
```
So `/reset` and `/new` work, but only because they are hardcoded. I wanted `/end` for the same thing and there is no supported way to get it.
## What does not work today
- A custom command at `~/.claude/commands/end.md` is a prompt template. It injects text for the model; it cannot invoke a built-in that resets client session state.
- Keybindings do not cover it. The `chat:*` actions are `attentionDown, attentionUp, cancel, clearInput, clearScreen, cycleMode, cycleProactivity, externalEditor, fastMode, imagePaste, killAgents, modelPicker, newline, queueSubmit, stash, submit, thinkingToggle, undo, workflowKeywordToggle`. `chat:clearScreen` redraws the terminal and does not drop context.
- Hooks do not cover it. `hookSpecificOutput` carries context injection and permission decisions, nothing that resets a session.
## Suggested approach
A settings key that feeds the same alias resolution the built-in `aliases` array already uses:
```json
{
"commandAliases": {
"end": "clear"
}
}
```
Reject an alias that collides with an existing command or built-in alias rather than silently shadowing it.
## Prior issues
- #32785 — same request for `/compact`, closed as not planned after inactivity, now locked.
- #14576 — `/alias` command, closed as not planned, larger scope.
- #23589 — shorthand aliases for plugin commands, closed as duplicate.
## Environment
- Version: 2.1.273
- Platform: darwin 25.6.0
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the CLI's built-in slash-command alias resolution and settings loading; the issue does not name implementation files or tests. Verify that the proposed commandAliases mapping makes /end invoke the existing clear behavior, rejects collisions with commands and built-in aliases, and preserves existing aliases. The custom ~/.claude/commands/end.md path and listed chat actions clarify which mechanisms are out of scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100