Setting Up Sublime Text for Rhema Development
This guide will help you configure Sublime Text to work effectively with Rhema (Git-Based Agent Context Protocol) projects. Sublime Text’s speed, extensibility, and powerful text editing capabilities make it an excellent choice for Rhema development.
Prerequisites
-
Sublime Text installed on your system
-
Rhema CLI installed
-
A Git repository (or create one for testing)
Installation
1. Install Rhema CLI
First, ensure you have the Rhema CLI installed:
# From Cargo (recommended)
cargo install rhema
# Or build from source
git clone https://github.com/fugue-ai/rhema.git
cd rhema
cargo build --release2. Verify Installation
rhema --versionSublime Text Configuration
1. Install Package Control
Package Control is essential for managing Sublime Text packages:
-
Open Sublime Text
-
Go to Tools → Install Package Control
-
Restart Sublime Text
2. Install Recommended Packages
Install these packages via Package Control (Preferences → Package Control → Install Package):
Essential Packages
-
Package Control - Package manager (usually pre-installed)
-
Git - Git integration
-
GitGutter - Git diff indicators
-
YAML - YAML syntax highlighting and validation
-
Rust Enhanced - Rust language support
Recommended Packages
-
SideBarEnhancements - Enhanced sidebar functionality
-
BracketHighlighter - Bracket and tag highlighting
-
AutoFileName - Auto-complete filenames
-
Color Highlighter - Color value highlighting
-
TrailingSpaces - Highlight trailing spaces
-
Alignment - Align text and code
3. Configure Sublime Text Settings
User Settings
Open Preferences → Settings and add these settings:
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 50,
"auto_complete_selector": "source - comment",
"auto_complete_triggers": [
{
"selector": "source.yaml",
"characters": ":"
}
],
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"font_face": "JetBrains Mono",
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages": [
"Vintage"
],
"indent_guide_options": [
"draw_normal",
"draw_active"
],
"line_numbers": true,
"margin": 0,
"match_brackets": true,
"match_selection": true,
"match_tags": true,
"rulers": [80, 100],
"save_on_focus_lost": true,
"scroll_past_end": false,
"show_encoding": true,
"show_line_endings": true,
"spell_check": false,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": false
}YAML-Specific Settings
Create a YAML syntax-specific settings file:
-
Open a YAML file
-
Go to View → Syntax → YAML
-
Go to Preferences → Settings - More → Syntax Specific - User
Add these settings:
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"rulers": [80, 100],
"word_wrap": false,
"auto_complete_triggers": [
{
"selector": "source.yaml",
"characters": ":"
}
]
}4. Configure Package Settings
GitGutter Settings
Open Preferences → Package Settings → GitGutter → Settings - User:
{
"show_line_annotation": true,
"show_untracked": true,
"show_deleted": true,
"show_modified": true,
"show_inserted": true,
"show_ignored": false,
"show_untracked_file_icon": true,
"show_deleted_file_icon": true,
"show_modified_file_icon": true,
"show_inserted_file_icon": true,
"show_ignored_file_icon": false,
"show_status_bar_text": true,
"show_status_bar_icon": true,
"show_minimap": true,
"show_in_minimap": true,
"show_in_side_bar": true,
"show_in_status_bar": true,
"show_in_gutter": true,
"show_in_overview": true,
"show_in_quick_panel": true,
"show_in_command_palette": true,
"show_in_menu": true,
"show_in_context_menu": true,
"show_in_sidebar_context_menu": true,
"show_in_tab_context_menu": true,
"show_in_gutter_context_menu": true,
"show_in_overview_context_menu": true,
"show_in_quick_panel_context_menu": true,
"show_in_command_palette_context_menu": true,
"show_in_menu_context_menu": true
}Rust Enhanced Settings
Open Preferences → Package Settings → Rust Enhanced → Settings - User:
{
"rust_syntax_checking": true,
"rust_syntax_checking_method": "check",
"rust_syntax_checking_extra_env": {
"RUST_BACKTRACE": "1"
},
"rust_format_on_save": true,
"rust_clippy": true,
"rust_clippy_extra_env": {
"RUST_BACKTRACE": "1"
}
}Workflow Integration
1. Initialize a Rhema Scope
-
Open your project in Sublime Text
-
Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
-
Type “Terminal” and select Terminal: Open Default
-
Run
rhema init
This creates the initial .rhema/ directory with template files.
2. Configure AI Context
Create a .copilot file in your project root:
# Rhema Context Integration
This project uses Rhema (Git-Based Agent Context Protocol) for structured context management.
## Key Files to Reference:
- .rhema/rhema.yaml - Scope definition and metadata
- .rhema/knowledge.yaml - Domain knowledge and insights
- .rhema/todos.yaml - Work items and tasks
- .rhema/decisions.yaml - Architecture decisions
- .rhema/patterns.yaml - Design patterns
- .rhema/conventions.yaml - Coding standards
## When Providing Assistance:
1. Check .rhema/knowledge.yaml for existing insights and domain knowledge
2. Review .rhema/decisions.yaml for architectural decisions
3. Consider .rhema/patterns.yaml for established design patterns
4. Follow .rhema/conventions.yaml for coding standards
5. Update relevant Rhema files when making significant changes
## Common Rhema Commands:
- rhema query "todos WHERE status='in_progress'" - Find active work
- rhema insight record "finding" - Record new insights
- rhema decision record "title" - Record architectural decisions
- rhema validate --recursive - Validate all Rhema files3. Create Custom Snippets
Rhema Todo Snippet
-
Go to Tools → Developer → New Snippet
-
Replace the content with:
<snippet>
<content><![CDATA[
- id: "todo-${1:001}"
title: "${2:Todo title}"
description: "${3:Detailed description}"
status: ${4|pending,in_progress,completed,blocked|}
priority: ${5|low,medium,high,critical|}
assigned_to: "${6:assignee}"
created_at: "${7:$CURRENT_YEAR}-${8:$CURRENT_MONTH}-${9:$CURRENT_DATE}T${10:$CURRENT_HOUR}:${11:$CURRENT_MINUTE}:00Z"
tags: [${12:tag1, tag2}]
related_components: [${13:component1, component2}]
]]></content>
<tabTrigger>rhema-todo</tabTrigger>
<scope>source.yaml</scope>
<description>Create a new Rhema todo item</description>
</snippet>Rhema Insight Snippet
Create another snippet:
<snippet>
<content><![CDATA[
- finding: "${1:Insight finding}"
impact: "${2:Impact description}"
solution: "${3:Proposed solution}"
confidence: ${4|low,medium,high|}
evidence: [${5:evidence1, evidence2}]
related_files: [${6:file1, file2}]
category: ${7|performance,security,architecture,user_experience|}
recorded_at: "${8:$CURRENT_YEAR}-${9:$CURRENT_MONTH}-${10:$CURRENT_DATE}T${11:$CURRENT_HOUR}:${12:$CURRENT_MINUTE}:00Z"
]]></content>
<tabTrigger>rhema-insight</tabTrigger>
<scope>source.yaml</scope>
<description>Record a new Rhema insight</description>
</snippet>Rhema Decision Snippet
Create another snippet:
<snippet>
<content><![CDATA[
- id: "decision-${1:001}"
title: "${2:Decision title}"
description: "${3:Detailed description}"
status: ${4|proposed,approved,rejected,deprecated|}
rationale: "${5:Decision rationale}"
alternatives_considered: [${6:alt1, alt2}]
impact: "${7:Impact description}"
decided_at: "${8:$CURRENT_YEAR}-${9:$CURRENT_MONTH}-${10:$CURRENT_DATE}T${11:$CURRENT_HOUR}:${12:$CURRENT_MINUTE}:00Z"
]]></content>
<tabTrigger>rhema-decision</tabTrigger>
<scope>source.yaml</scope>
<description>Record a new Rhema architectural decision</description>
</snippet>4. Save the Snippets
Save these snippets in your User snippets directory:
-
Windows:
%APPDATA%\Sublime Text 3\Packages\User\ -
macOS:
~/Library/Application Support/Sublime Text 3/Packages/User/ -
Linux:
~/.config/sublime-text-3/Packages/User/
Git Integration
1. Git Package Configuration
The Git package provides basic Git functionality:
-
Git: Status - Show Git status
-
Git: Add - Stage files
-
Git: Commit - Commit changes
-
Git: Push - Push to remote
-
Git: Pull - Pull from remote
-
Git: Log - Show commit history
2. GitGutter Features
GitGutter provides visual indicators:
-
Modified lines - Yellow dots
-
Added lines - Green dots
-
Deleted lines - Red dots
-
Ignored lines - Gray dots
3. Git Hooks Setup
Configure Git hooks for Rhema validation:
Pre-commit Hook
Create a .git/hooks/pre-commit file:
#!/bin/sh
# Rhema Pre-commit Hook
echo "Running Rhema validation..."
# Run Rhema validation
if command -v rhema >/dev/null 2>&1; then
if ! rhema validate --recursive; then
echo "Rhema validation failed. Please fix issues before committing."
exit 1
fi
echo "Rhema validation passed."
else
echo "Rhema CLI not found. Skipping validation."
fiMake it executable:
chmod +x .git/hooks/pre-commitCustom Build Systems
1. Rhema Build System
Create a custom build system for Rhema commands:
-
Go to Tools → Build System → New Build System
-
Add this configuration:
{
"cmd": ["rhema", "$file_name"],
"selector": "source.yaml",
"working_dir": "$file_path",
"variants": [
{
"name": "Validate",
"cmd": ["rhema", "validate", "--recursive"],
"working_dir": "$project_path"
},
{
"name": "Health",
"cmd": ["rhema", "health"],
"working_dir": "$project_path"
},
{
"name": "Scopes",
"cmd": ["rhema", "scopes"],
"working_dir": "$project_path"
},
{
"name": "Query",
"cmd": ["rhema", "query", "$file_name"],
"working_dir": "$project_path"
}
]
}- Save as
Rhema.sublime-build
2. Rust Build System
For Rust development, create a Rust build system:
{
"cmd": ["cargo", "build"],
"working_dir": "$project_path",
"variants": [
{
"name": "Run",
"cmd": ["cargo", "run"]
},
{
"name": "Test",
"cmd": ["cargo", "test"]
},
{
"name": "Check",
"cmd": ["cargo", "check"]
},
{
"name": "Clippy",
"cmd": ["cargo", "clippy"]
}
]
}Keyboard Shortcuts
1. Custom Key Bindings
Create custom key bindings:
-
Go to Preferences → Key Bindings
-
Add these bindings:
[
{
"keys": ["ctrl+shift+g", "v"],
"command": "exec",
"args": {
"cmd": ["rhema", "validate", "--recursive"],
"working_dir": "$project_path"
}
},
{
"keys": ["ctrl+shift+g", "h"],
"command": "exec",
"args": {
"cmd": ["rhema", "health"],
"working_dir": "$project_path"
}
},
{
"keys": ["ctrl+shift+g", "s"],
"command": "exec",
"args": {
"cmd": ["rhema", "scopes"],
"working_dir": "$project_path"
}
},
{
"keys": ["ctrl+shift+g", "i"],
"command": "exec",
"args": {
"cmd": ["rhema", "init"],
"working_dir": "$project_path"
}
}
]2. Useful Default Shortcuts
-
Ctrl+Shift+P - Command Palette
-
Ctrl+P - Quick Open
-
Ctrl+Shift+F - Find in Files
-
Ctrl+R - Goto Symbol
-
Ctrl+G - Goto Line
-
Ctrl+D - Select Next Occurrence
-
Ctrl+L - Select Line
-
Ctrl+Shift+K - Delete Line
-
Ctrl+Shift+D - Duplicate Line
-
Ctrl+J - Join Lines
-
Ctrl+Shift+J - Split Selection into Lines
Best Practices
1. Regular Context Maintenance
-
Run
rhema validate --recursivebefore commits -
Update knowledge files when discovering new insights
-
Record decisions as they’re made, not after the fact
-
Keep todos current and accurate
2. Sublime Text Specific
-
Use multiple cursors for repetitive edits
-
Leverage Sublime Text’s powerful search and replace
-
Use snippets for consistent Rhema file creation
-
Take advantage of the command palette for quick access
3. Team Coordination
-
Commit Rhema files with related code changes
-
Use Rhema context in code reviews
-
Share insights and decisions through Rhema files
-
Use cross-scope queries for project-wide coordination
Troubleshooting
Common Issues
-
YAML validation errors: Ensure your Rhema files follow the schema in
schemas/rhema.json -
Missing context: Run
rhema healthto check scope completeness -
Package not working: Check package installation and configuration
-
Build system errors: Ensure Rhema CLI is in your PATH
-
Git integration issues: Check Git package settings
Getting Help
-
Run
rhema --helpfor command documentation -
Check the Rhema README for protocol details
-
Use
rhema validate --recursiveto identify issues -
Review the protocol schemas for file formats
-
Check Sublime Text documentation and package help
Next Steps
-
Initialize your first scope:
rhema init -
Explore existing context:
rhema scopesandrhema query -
Start recording knowledge: Use
rhema insight record -
Set up team workflows: Share Rhema practices with your team
-
Integrate with CI/CD: Add Rhema validation to your build pipeline
For more advanced usage, see the Rhema CLI Reference, Protocol Documentation, and Rust Development Setup.