Setting Up IntelliJ IDEA for Rhema Development
This guide will help you configure IntelliJ IDEA to work effectively with Rhema (Git-Based Agent Context Protocol) projects. IntelliJ’s powerful Git integration, YAML support, and extensibility make it an excellent choice for Rhema development, especially for Java/Kotlin projects.
Prerequisites
-
IntelliJ IDEA 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 --versionIntelliJ Configuration
1. Install Recommended Plugins
IntelliJ works best with Rhema when you have these plugins installed:
Essential Plugins
-
YAML/TOML Support - YAML language support with schema validation
-
Git Integration - Enhanced Git capabilities (usually pre-installed)
-
Rust - Rust language support (for CLI development)
-
GitHub Copilot - AI code assistance (optional)
Recommended Plugins
-
Rainbow Brackets - Visual bracket matching
-
String Manipulation - String and text utilities
-
Key Promoter X - Learn keyboard shortcuts
-
GitToolBox - Enhanced Git features
2. Configure IntelliJ Settings
File Associations
-
Go to File → Settings → Editor → File Types
-
Find YAML in the list
-
Add these patterns to Registered Patterns:
-
*.rhema.yaml -
rhema.yaml -
knowledge.yaml -
todos.yaml -
decisions.yaml -
patterns.yaml -
conventions.yaml
-
YAML Schema Configuration
-
Go to File → Settings → Languages & Frameworks → Schema and DTDs → JSON Schema Mappings
-
Add a new mapping:
-
Schema file or URL:
schemas/rhema.json -
Schema version:
1.0 -
File path pattern:
**/rhema.yaml -
File path pattern:
**/knowledge.yaml -
File path pattern:
**/todos.yaml -
File path pattern:
**/decisions.yaml -
File path pattern:
**/patterns.yaml -
File path pattern:
**/conventions.yaml
-
Editor Settings
-
Go to File → Settings → Editor → Code Style → YAML
-
Set Indent to 2 spaces
-
Enable Use tab character if preferred
-
Go to File → Settings → Editor → General → Auto Import
-
Enable Optimize imports on the fly
-
Enable Add unambiguous imports on the fly
3. Configure External Tools
Set up external tools for Rhema CLI commands:
Rhema Initialize
-
Go to File → Settings → Tools → External Tools
-
Click + to add a new tool:
-
Name:
Rhema: Initialize Scope -
Program:
rhema -
Arguments:
init -
Working directory:
$ProjectFileDir$
-
Rhema Validate
-
Add another external tool:
-
Name:
Rhema: Validate All -
Program:
rhema -
Arguments:
validate --recursive -
Working directory:
$ProjectFileDir$
-
Rhema Health
-
Add another external tool:
-
Name:
Rhema: Show Health -
Program:
rhema -
Arguments:
health -
Working directory:
$ProjectFileDir$
-
Rhema List Scopes
-
Add another external tool:
-
Name:
Rhema: List Scopes -
Program:
rhema -
Arguments:
scopes -
Working directory:
$ProjectFileDir$
-
4. Configure Run Configurations
Create run configurations for common Rhema operations:
Rhema CLI Help
-
Go to Run → Edit Configurations
-
Click + → Shell Script
-
Configure:
-
Name:
Rhema Help -
Script path:
rhema -
Script options:
--help -
Working directory:
$ProjectFileDir$
-
Rhema Query
-
Create another Shell Script configuration:
-
Name:
Rhema Query -
Script path:
rhema -
Script options:
query "$Prompt$" -
Working directory:
$ProjectFileDir$
-
Workflow Integration
1. Initialize a Rhema Scope
-
Open your project in IntelliJ
-
Go to Tools → External Tools → Rhema: Initialize Scope
-
Or use the terminal:
rhema init
This creates the initial .rhema/ directory with template files.
2. Configure AI Context
If using GitHub Copilot, 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 Live Templates
Set up live templates for Rhema file creation:
Rhema Todo Template
-
Go to File → Settings → Editor → Live Templates
-
Create a new template group called Rhema
-
Add a new template:
-
Abbreviation:
rhema-todo -
Description:
Create a new Rhema todo item -
Template text:
-
- id: "todo-$ID$"
title: "$TITLE$"
description: "$DESCRIPTION$"
status: $STATUS$
priority: $PRIORITY$
assigned_to: "$ASSIGNEE$"
created_at: "$DATE$"
tags: [$TAGS$]
related_components: [$COMPONENTS$]-
Variables:
-
$ID$:completeSmart() -
$TITLE$:completeSmart() -
$DESCRIPTION$:completeSmart() -
$STATUS$:enum("pending", "in_progress", "completed", "blocked") -
$PRIORITY$:enum("low", "medium", "high", "critical") -
$ASSIGNEE$:completeSmart() -
$DATE$:date("yyyy-MM-dd'T'HH:mm:ss'Z'") -
$TAGS$:completeSmart() -
$COMPONENTS$:completeSmart()
-
Rhema Insight Template
-
Add another template:
-
Abbreviation:
rhema-insight -
Description:
Record a new Rhema insight -
Template text:
-
- finding: "$FINDING$"
impact: "$IMPACT$"
solution: "$SOLUTION$"
confidence: $CONFIDENCE$
evidence: [$EVIDENCE$]
related_files: [$FILES$]
category: $CATEGORY$
recorded_at: "$DATE$"-
Variables:
-
$FINDING$:completeSmart() -
$IMPACT$:completeSmart() -
$SOLUTION$:completeSmart() -
$CONFIDENCE$:enum("low", "medium", "high") -
$EVIDENCE$:completeSmart() -
$FILES$:completeSmart() -
$CATEGORY$:enum("performance", "security", "architecture", "user_experience") -
$DATE$:date("yyyy-MM-dd'T'HH:mm:ss'Z'")
-
Git Integration
1. Git Configuration
IntelliJ has excellent built-in Git support:
Git Settings
-
Go to File → Settings → Version Control → Git
-
Ensure Git executable is properly configured
-
Configure Git user information if not already set
Git Toolbar
-
Enable the Git toolbar: View → Appearance → Toolbar
-
Customize Git toolbar buttons as needed
Git Branches
-
Use Git → Branches for branch management
-
Use Git → Log for commit history
-
Use Git → Show History for file history
2. 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-commitAI-Powered Workflows
1. Context-Aware Code Generation
When using GitHub Copilot or other AI assistants:
-
Reference existing context: “Based on the patterns in
.rhema/patterns.yaml, generate…” -
Follow established decisions: “Following the decision in
.rhema/decisions.yamlabout database choice…” -
Consider existing insights: “Given the performance insights in
.rhema/knowledge.yaml…“
2. Automated Context Updates
Use AI to help maintain Rhema files:
-
“Update
.rhema/knowledge.yamlwith insights from this code change” -
“Record this architectural decision in
.rhema/decisions.yaml” -
“Add a todo item for this technical debt in
.rhema/todos.yaml”
3. Cross-Scope Analysis
For multi-scope projects:
-
“Analyze the impact of this change across all Rhema scopes”
-
“Find todos related to this feature across the entire project”
-
“Identify knowledge gaps in the current Rhema context”
Keyboard Shortcuts
Configure keyboard shortcuts for Rhema operations:
-
Go to File → Settings → Keymap
-
Search for External Tools
-
Assign shortcuts:
-
Ctrl+Shift+G Ifor Rhema: Initialize Scope -
Ctrl+Shift+G Vfor Rhema: Validate All -
Ctrl+Shift+G Hfor Rhema: Show Health -
Ctrl+Shift+G Sfor Rhema: List Scopes
-
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. AI Collaboration
-
Use GitHub Copilot to help maintain Rhema files
-
Ask AI to suggest context updates based on code changes
-
Leverage AI to find relevant existing context
-
Use AI to help identify knowledge gaps
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
4. IntelliJ Specific
-
Use the integrated terminal for Rhema commands
-
Leverage IntelliJ’s powerful Git integration
-
Use live templates for consistent Rhema file creation
-
Take advantage of IntelliJ’s refactoring tools
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 -
AI not using context: Verify
.copilotfile is properly configured -
Schema not loading: Check that
schemas/rhema.jsonpath is correct in settings -
External tools not working: Ensure Rhema CLI is in your PATH
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 IntelliJ’s built-in help and documentation
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.