Skip to content

Comments

feat(commands): add dynamic /<alias> model switching#393

Closed
azade-c wants to merge 2 commits intoopenclaw:mainfrom
azade-c:fix/codex-exp-and-model-alias
Closed

feat(commands): add dynamic /<alias> model switching#393
azade-c wants to merge 2 commits intoopenclaw:mainfrom
azade-c:fix/codex-exp-and-model-alias

Conversation

@azade-c
Copy link
Contributor

@azade-c azade-c commented Jan 7, 2026

Summary

Add support for /<alias> as a shorthand for /model <alias>.

Many users naturally type /gpt, /sonnet, /haiku etc. to switch models. Today only /model <name> is recognized, so those commands are silently ignored.

How it works

Aliases are read dynamically from cfg.agent.models[*].alias at runtime — nothing is hard-coded.

Example config:

{
  "agent": {
    "models": {
      "anthropic/claude-opus-4-5": { "alias": "opus" },
      "anthropic/claude-sonnet-4-5": { "alias": "sonnet" },
      "openai-codex/gpt-5.2": { "alias": "gpt" }
    }
  }
}

With this config, /opus, /sonnet, and /gpt all work as model switches.

Command collision handling

If an alias collides with an existing command (e.g. /status, /help, /reset), the existing command takes priority. The alias is filtered out and won't be recognized as a model switch.

This prevents accidental shadowing of built-in commands.

Changes

  • src/auto-reply/model.tsextractModelDirective() now accepts an optional aliases array and matches /<alias> patterns
  • src/auto-reply/reply/directive-handling.ts — passes aliases to the directive parser
  • src/auto-reply/reply.ts — collects aliases from config, filters out reserved commands, and passes them through
  • src/auto-reply/model.test.tsnew: 17 tests covering alias matching, edge cases, and priority

Notes

  • No breaking changes — /model <name> still works exactly as before
  • Only configured aliases are recognized (arbitrary /foo won't be treated as a model switch)
  • Reserved commands are never shadowed by aliases

@azade-c azade-c force-pushed the fix/codex-exp-and-model-alias branch from b2373ea to ed26022 Compare January 7, 2026 13:36
@azade-c azade-c changed the title Fix Codex CLI OAuth expiry + dynamic /alias model switching feat(commands): add dynamic /<alias> model switching Jan 7, 2026
@steipete
Copy link
Contributor

steipete commented Jan 7, 2026

Azade, love this feature! Thanks!

@steipete steipete self-assigned this Jan 7, 2026
@steipete
Copy link
Contributor

steipete commented Jan 7, 2026

Landed on main via ff merge.\n\nCommits:\n- bebe3dc2 feat(commands): add dynamic / model switching\n- 9e51c2c2 fix: filter reserved commands from model aliases + add tests\n- 2f8ade96 fix(onboarding): widen WhatsApp config helpers (build type fix)\n- 64f0aeee fix(commands): harden model alias parsing + docs/changelog/test for trimmed reserved aliases\n\nGate: pnpm lint && pnpm build && pnpm test

@steipete steipete closed this Jan 7, 2026
@azade-c azade-c deleted the fix/codex-exp-and-model-alias branch January 9, 2026 11:42
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
Add a new "Debug & Logging" section in the Admin/Power User settings
that provides a full UI for tuning openclaw.json logging and debugging
configuration. Gated behind Power User Mode.

Covers:
- Log level / console level / console style selectors
- Redact sensitive toggle
- Enhanced logging feature toggles (tool errors, perf outliers, etc.)
- Performance threshold sliders (tool call, agent turn, gateway, db op)
- Token warning threshold sliders
- Tool journal config (enable, file path, retention, redaction)
- Suppress subsystem debug logs tag list
- Channel debug overrides (add/remove with verbose/debug/trace/suppress)
- Feature debug overrides (add/remove with verbose/debug/trace/suppress)
- Sticky save/reset bar with dirty state tracking

https://claude.ai/code/session_011WdpEacHmK1fMQMFiD3Szu

Co-authored-by: Claude <[email protected]>
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.

2 participants