Skip to Content
Nextra 2 Alpha
Development SetupEditor SetupSetting Up Sublime Text for Rhema Development

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

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 --release

2. Verify Installation

rhema --version

Sublime Text Configuration

1. Install Package Control

Package Control is essential for managing Sublime Text packages:

  1. Open Sublime Text

  2. Go to ToolsInstall Package Control

  3. Restart Sublime Text

Install these packages via Package Control (PreferencesPackage ControlInstall Package):

Essential Packages

3. Configure Sublime Text Settings

User Settings

Open PreferencesSettings 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:

  1. Open a YAML file

  2. Go to ViewSyntaxYAML

  3. Go to PreferencesSettings - MoreSyntax 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 PreferencesPackage SettingsGitGutterSettings - 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 PreferencesPackage SettingsRust EnhancedSettings - 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

  1. Open your project in Sublime Text

  2. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)

  3. Type “Terminal” and select Terminal: Open Default

  4. 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 files

3. Create Custom Snippets

Rhema Todo Snippet

  1. Go to ToolsDeveloperNew Snippet

  2. 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." fi

Make it executable:

chmod +x .git/hooks/pre-commit

Custom Build Systems

1. Rhema Build System

Create a custom build system for Rhema commands:

  1. Go to ToolsBuild SystemNew Build System

  2. 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" } ] }
  1. 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:

  1. Go to PreferencesKey Bindings

  2. 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 --recursive before 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

  1. YAML validation errors: Ensure your Rhema files follow the schema in schemas/rhema.json

  2. Missing context: Run rhema health to check scope completeness

  3. Package not working: Check package installation and configuration

  4. Build system errors: Ensure Rhema CLI is in your PATH

  5. Git integration issues: Check Git package settings

Getting Help

  • Run rhema --help for command documentation

  • Check the Rhema README for protocol details

  • Use rhema validate --recursive to identify issues

  • Review the protocol schemas for file formats

  • Check Sublime Text documentation and package help

Next Steps

  1. Initialize your first scope: rhema init

  2. Explore existing context: rhema scopes and rhema query

  3. Start recording knowledge: Use rhema insight record

  4. Set up team workflows: Share Rhema practices with your team

  5. 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.

Last updated on