Slash Commands: Preset Workflows for One-Click Execution
What You'll Learn
- Use
/init-deepto generate project knowledge base with one click - Use
/ralph-loopto make agents work continuously until tasks complete - Execute intelligent refactoring with
/refactor, automatically validating each step - Use
/start-workto start systematic development from Prometheus plans
Your Current Challenge
When repeatedly executing the same complex tasks, you have to type long instructions every time:
"Please help me analyze this project's structure, find all key modules, generate AGENTS.md for each directory, then parallel explore the codebase patterns..."Such long instructions waste time and are prone to missing steps.
When to Use This Approach
Slash commands are preset workflow templates that trigger complex tasks with one click. These commands cover common development scenarios:
| Scenario | Command to Use |
|---|---|
| Initialize project knowledge base | /init-deep |
| Make AI work continuously | /ralph-loop |
| Intelligently refactor code | /refactor |
| Start working from a plan | /start-work |
Core Concepts
Slash commands are predefined workflow templates that execute complex tasks quickly through trigger words starting with /.
How it works:
oh-my-opencode includes 6 built-in slash commands:
| Command | Function | Complexity |
|---|---|---|
/init-deep | Generate hierarchical AGENTS.md files | Medium |
/ralph-loop | Self-referential development loop | High |
/ulw-loop | Ultrawork version of ralph-loop | High |
/cancel-ralph | Cancel active Ralph Loop | Low |
/refactor | Intelligent refactoring with complete toolchain | High |
/start-work | Start working from Prometheus plan | Medium |
Custom Commands
Besides built-in commands, you can create custom commands (Markdown files) in the .opencode/command/ or .claude/commands/ directories.
🎒 Prerequisites
- ✅ oh-my-opencode installed
- ✅ At least one AI Provider configured
- ✅ Basic understanding of agent usage (recommended to learn Getting Started with Sisyphus: The Main Orchestrator first)
Follow Along
Step 1: Generate Project Knowledge Base
Why AI agents need to understand project structure and conventions to work efficiently. The /init-deep command automatically analyzes the project and generates hierarchical AGENTS.md files.
Enter in OpenCode:
/init-deepYou Should See: The agent starts parallel analysis of project structure, explores code patterns, and generates AGENTS.md files.
Advanced Usage:
# Regenerate all files (delete existing ones)
/init-deep --create-new
# Limit generation depth
/init-deep --max-depth=2Output Example:
=== init-deep Complete ===
Mode: update
Files:
[OK] ./AGENTS.md (root, 120 lines)
[OK] ./src/hooks/AGENTS.md (45 lines)
[OK] ./src/agents/AGENTS.md (38 lines)
Dirs Analyzed: 12
AGENTS.md Created: 3Step 2: Make AI Work Continuously
Why Some tasks require multiple iterations to complete (like fixing complex bugs). The /ralph-loop command makes the agent work continuously until the task is done, rather than stopping midway.
Enter in OpenCode:
/ralph-loop "Fix the authentication issue on the login page, ensure all error cases are handled"You Should See: The agent starts working and automatically continues after completion until the completion marker is output.
Advanced Usage:
# Custom completion marker
/ralph-loop "Write unit tests" --completion-promise="TESTS_DONE"
# Limit maximum iterations
/ralph-loop "Optimize performance" --max-iterations=50Ultrawork Version (activates all professional agents):
/ulw-loop "Develop REST API with authentication, authorization, and rate limiting"Checkpoint ✅
- Does the agent automatically continue after each iteration?
- Do you see the "Ralph Loop Complete!" prompt when done?
Step 3: Cancel Loop
Why If the task direction is wrong or you want manual intervention, you need to cancel the loop.
Enter in OpenCode:
/cancel-ralphYou Should See: The loop stops and state files are cleaned up.
Step 4: Intelligent Refactoring
Why When refactoring code, blind modifications can introduce bugs. The /refactor command uses a complete toolchain (LSP, AST-Grep, test validation) to ensure safe refactoring.
Enter in OpenCode:
# Rename symbol
/refactor "Refactor AuthService class to UserService"
# Refactor module
/refactor src/auth --scope=module --strategy=safe
# Pattern matching refactoring
/refactor "Migrate all places using deprecated API to new API"You Should See: The agent executes a 6-phase refactoring process:
- Intent Gateway - Confirm refactoring goals
- Codebase Analysis - Parallel exploration of dependencies
- Codemap Construction - Map impact scope
- Test Assessment - Check test coverage
- Plan Generation - Create detailed refactoring plan
- Execute Refactoring - Step-by-step execution with validation
Advanced Usage:
# Aggressive strategy (allows larger changes)
/refactor "Architecture refactoring" --strategy=aggressive
# File scope
/refactor "Optimize functions in utils.ts" --scope=fileTest Coverage Requirement
If target code's test coverage is below 50%, /refactor will refuse to execute aggressive strategy. It's recommended to add tests first.
Step 5: Start Working from a Plan
Why After planning with Prometheus, you need to systematically execute tasks from the plan. The /start-work command automatically loads the plan and uses the Atlas agent to execute it.
Enter in OpenCode:
# Auto-select single plan
/start-work
# Select specific plan
/start-work "auth-api-plan"You Should See:
- If only one plan: Auto-select and start execution
- If multiple plans: List all plans for selection
Output Example:
Available Work Plans
Current Time: 2026-01-26T10:30:00Z
Session ID: abc123
1. [auth-api-plan.md] - Modified: 2026-01-25 - Progress: 3/10 tasks
2. [migration-plan.md] - Modified: 2026-01-26 - Progress: 0/5 tasks
Which plan would you like to work on? (Enter number or plan name)Checkpoint ✅
- Is the plan correctly loaded?
- Are tasks executed in order?
- Are completed tasks marked?
Common Pitfalls
Pitfall 1: /init-deep Ignores Existing Files
Problem: In default mode, /init-deep preserves existing AGENTS.md files, only updating or creating missing parts.
Solution: Use the --create-new parameter to regenerate all files.
Pitfall 2: /ralph-loop Infinite Loop
Problem: If the agent cannot complete the task, the loop continues to the maximum iteration count (default 100).
Solution:
- Set a reasonable
--max-iterations(e.g., 20-30) - Use
/cancel-ralphto manually cancel - Provide clearer task description
Pitfall 3: /refactor Low Test Coverage
Problem: Target code has no tests, refactoring will fail.
Solution:
# Let agent add tests first
"Please add comprehensive unit tests for AuthService, covering all edge cases"
# Then refactor
/refactor "Refactor AuthService class"Pitfall 4: /start-work Can't Find Plan
Problem: Prometheus-generated plans are not saved in the .sisyphus/plans/ directory.
Solution:
- Check if Prometheus output includes plan file path
- Confirm plan file extension is
.md
Pitfall 5: Incorrect Command Parameter Format
Problem: Parameter position or format is incorrect.
Solution:
# ✅ Correct
/ralph-loop "Task description" --completion-promise=DONE
# ❌ Wrong
/ralph-loop --completion-promise=DONE "Task description"Summary
| Command | Core Function | Usage Frequency |
|---|---|---|
/init-deep | Auto-generate project knowledge base | Initial setup |
/ralph-loop | Continuous work loop | High |
/ulw-loop | Ultrawork version of loop | Medium |
/cancel-ralph | Cancel loop | Low |
/refactor | Safe intelligent refactoring | High |
/start-work | Execute Prometheus plans | Medium |
Best Practices:
- Use
/init-deepon new projects to establish knowledge base - Use
/ralph-loopfor complex tasks to let AI work continuously - Prefer
/refactorwhen refactoring code to ensure safety - Use
/start-workwith Prometheus for systematic development
Coming Up Next
In the next lesson, we'll learn Advanced Configuration.
You'll learn:
- How to override agent default models and prompts
- How to configure permissions and security restrictions
- How to customize Categories and Skills
- How to adjust background task concurrency control
Appendix: Source Code Reference
Click to expand source code locations
Updated: 2026-01-26
| Feature | File Path | Line Numbers |
|---|---|---|
| Command definitions | src/features/builtin-commands/commands.ts | 8-73 |
| Command loader | src/features/builtin-commands/index.ts | 75-89 |
| init-deep template | src/features/builtin-commands/templates/init-deep.ts | Full text |
| ralph-loop template | src/features/builtin-commands/templates/ralph-loop.ts | Full text |
| refactor template | src/features/builtin-commands/templates/refactor.ts | Full text |
| start-work template | src/features/builtin-commands/templates/start-work.ts | Full text |
| Ralph Loop Hook implementation | src/hooks/ralph-loop/index.ts | Full text |
| Command type definitions | src/features/builtin-commands/types.ts | Full text |
Key Functions:
loadBuiltinCommands(): Load built-in command definitions, supports disabling specific commandscreateRalphLoopHook(): Create Ralph Loop lifecycle hooksstartLoop(): Start loop, set state and parameterscancelLoop(): Cancel active loop, clean up state files
Key Constants:
DEFAULT_MAX_ITERATIONS = 100: Default maximum iteration countDEFAULT_COMPLETION_PROMISE = "DONE": Default completion marker
Configuration Location:
- Disable commands:
disabled_commandsfield inoh-my-opencode.json - Loop configuration:
ralph_loopobject inoh-my-opencode.json