Skip to content

Conversation

@robotdad
Copy link
Member

Summary

Adds support for extensible custom slash commands in the interactive CLI, enabling users to define reusable prompt templates as /commands.

Changes

Core Integration (main.py)

  • CommandProcessor now loads custom commands from slash_command tool at startup
  • Custom commands appear in /help under "Custom Commands:" section
  • /reload-commands built-in command to refresh commands without restart
  • Template execution returns substituted prompt to REPL for LLM processing

Behavior Composition (config.py)

  • New _build_cli_behaviors() consolidates CLI-specific behaviors
  • Always composes slash-command behavior for interactive sessions
  • Refactored notification behaviors to be called from new function

Documentation (README.md)

  • Quick start guide for creating custom commands
  • Command locations and precedence rules
  • Template syntax documentation

How It Works

  1. Users create .md files in .amplifier/commands/ or ~/.amplifier/commands/
  2. Files define prompt templates with $ARGUMENTS, $1, $2, etc.
  3. Typing /commandname args substitutes and executes the template

Example

<!-- ~/.amplifier/commands/review.md -->
---
name: review
description: Code review for a file
---
Review this file for bugs, security issues, and improvements: $ARGUMENTS

Usage: /review src/auth.py

Dependencies

Testing

  • Shadow environment validation confirmed feature branch structure
  • Existing unit tests pass

🤖 Generated with Amplifier

Co-Authored-By: Amplifier 240397093+microsoft-amplifier@users.noreply.github.com

robotdad and others added 4 commits January 22, 2026 10:18
Integrate with slash_command module to support user-defined commands:

- CommandProcessor now loads custom commands from slash_command tool
- Custom commands appear in /help alongside built-in commands
- Add /reload-commands to refresh commands from disk
- Custom command templates are substituted and executed as prompts

Commands are discovered from:
- .amplifier/commands/ (project-level)
- ~/.amplifier/commands/ (user-level)

Requires: robotdad/amplifier-module-tool-slash-command
Fixes 'No module named pygments.lexers.markup' error.
The markup lexers module requires Pygments 2.12+.
Documents:
- Quick start for creating custom commands
- Command locations and precedence
- Template syntax (, , {{default}})
- Built-in commands (/help, /reload-commands)
- Link to full documentation
Adds slash-command behavior to CLI's compose_behaviors, enabling
extensible /commands for interactive sessions.

Changes:
- Add _build_cli_behaviors() to consolidate CLI-specific behaviors
- Always compose slash-command behavior for interactive CLI
- Refactor to call _build_notification_behaviors() from new function

The slash_command tool is now automatically available, providing:
- Custom commands from .amplifier/commands/ (project) and ~/.amplifier/commands/ (user)
- Template substitution with $ARGUMENTS, $1, $2, etc.
- Integration with existing CommandProcessor in main.py

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@robotdad robotdad force-pushed the feat/custom-slash-commands branch from 3a98864 to 879a005 Compare January 22, 2026 18:19
@robotdad
Copy link
Member Author

✅ Smoke Test Validation

This change has been validated with the amplifier-bundle-smoke-test recipe.

Results

Phase Status
CLI Core ✅ PASS
CLI Config ✅ PASS
CLI Resources ✅ PASS
Recipe Validation ✅ PASS
Source Override ✅ PASS
Multi-Provider ✅ PASS (anthropic, openai)
Session CRUD ✅ PASS
Mention Validation ✅ PASS
Provider Responds ✅ PASS
Tool Execution ✅ PASS
Agent Delegation ✅ PASS

Summary: 11/11 core tests passed

Note: Ollama and Azure OpenAI were skipped (not configured in test environment) - this is expected behavior.


🤖 Validated with Amplifier smoke-test bundle

robotdad and others added 2 commits January 22, 2026 13:36
The CommandExecutor.execute() method is async but was being called
without await, causing the coroutine object to be returned instead
of the actual result.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
registry.get_command_dict() already returns keys with / prefix,
so adding another / resulted in //review instead of /review.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@robotdad
Copy link
Member Author

Smoke Test Results (Post-Changes)

All core functionality passed. Summary:

Test Result
CLI Core ✅ PASS
CLI Config ✅ PASS
CLI Resources ✅ PASS
Recipe Validation ✅ PASS
Source Override ✅ PASS
Session CRUD ✅ PASS
Mention Validation ✅ PASS
Provider Responds ✅ PASS
Tool Execution ✅ PASS
Agent Delegation ✅ PASS

Multi-Provider

Provider Result
OpenAI ✅ PASS
Anthropic ✅ PASS
Azure OpenAI ⏭️ SKIPPED (not configured)
Ollama ⏭️ SKIPPED (not configured)

Summary: 12 passed, 0 failed, 2 skipped

Verdict: ✅ PASS - All configured providers working correctly. Azure and Ollama skipped as expected (not configured on test machine).

robotdad and others added 2 commits January 22, 2026 16:12
Add support for the custom slash commands directory (~/.amplifier/commands/)
in the reset command:

- Add "commands" to RESET_CATEGORIES mapping
- Include in CATEGORY_ORDER between keys and cache
- Add description for interactive UI display
- Add to DEFAULT_PRESERVE set (user content preserved by default)
- Update docstring and help text examples

This ensures user-created custom commands are recognized by reset and
protected from accidental deletion unless explicitly requested.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Refactor to follow upstream's pattern of separate behavior builder functions
for each category, making future syncs easier.

Before: A unified _build_cli_behaviors() function returned all CLI behaviors
(modes, slash-commands, notifications) in one list.

After: Separate functions following upstream's convention:
- _build_modes_behaviors() - returns modes behavior URI
- _build_slash_command_behaviors() - returns slash command behavior URI
- _build_notification_behaviors() - already existed, unchanged

The caller in resolve_bundle_config() now uses extend() calls for each
function, matching upstream's architectural pattern.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@robotdad
Copy link
Member Author

Today's Changes Summary

The following commits were added today to address issues discovered during testing and improve code organization:

Bug Fixes

  • fix: await async executor.execute (6e94f88) - Fixed missing await on the async CommandExecutor.execute() method, which was causing coroutine objects to be returned instead of actual results
  • fix: remove duplicate slash prefix (71928c7) - Fixed double-slash issue where commands appeared as //review instead of /review since registry.get_command_dict() already returns keys with the / prefix

Features

  • feat: add commands category to reset command (43b3c85) - Added recognition of the custom slash commands directory (~/.amplifier/commands/) in the reset command, with appropriate protection from accidental deletion

Refactoring

  • refactor: split _build_cli_behaviors (5f97475) - Split unified _build_cli_behaviors() into separate builder functions (_build_modes_behaviors(), _build_slash_command_behaviors()) to follow upstream's architectural pattern and ease future syncs

Smoke Test Results

============================================================
AMPLIFIER SMOKE TEST RESULTS
============================================================

CLI Core:                 ✅ PASS
CLI Config:               ✅ PASS
CLI Resources:            ✅ PASS
Recipe Validation:        ✅ PASS
Source Override:          ✅ PASS
Multi-Provider:           ⏭️ SKIP (Ollama not configured)
Session CRUD:             ✅ PASS
Mention Validation:       ✅ PASS
Provider Responds:        ✅ PASS
Tool Execution:           ✅ PASS
Agent Delegation:         ✅ PASS

------------------------------------------------------------
SUMMARY: 10 passed, 0 failed, 1 skipped (of 11)
------------------------------------------------------------

SMOKE TEST: PASS ✅

Note: The Multi-Provider skip is due to Ollama not being configured on the test machine. Both OpenAI and Anthropic providers passed successfully.

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