Overview
The Elastic Rules system consists of three main components:Project Guidelines (.elasticguides)
Project-specific instructions and guidelines that apply to all interactions
Learning Journal (.elasticrules)
User-documented project intelligence and patterns for enhanced effectiveness
Access Control (.elasticignore)
File and directory access restrictions for security and privacy
Project Guidelines (.elasticguides)
The.elasticguides file allows you to provide project-specific instructions that Elastic Copilot will follow throughout all interactions with your project.
What to Include
- Coding Standards: Style preferences, naming conventions, and formatting rules
- Architecture Guidelines: Preferred patterns, design principles, and structural requirements
- Technology Preferences: Specific libraries, frameworks, or tools to use or avoid
- Project Context: Business logic, domain knowledge, and project-specific requirements
- Development Practices: Testing approaches, documentation standards, and workflow preferences
Example .elasticguides File
Learning Journal (.elasticrules)
The.elasticrules file is where you document project-specific patterns, insights, and rules that you want Elastic Copilot to know about your project. This is your space to capture important project intelligence that isn’t obvious from the code alone.
What You Should Document
- Critical Implementation Paths: Key workflows and processes unique to your project
- Domain-Specific Patterns: Business logic patterns and domain knowledge
- Performance Considerations: Optimization strategies and performance-critical areas
- Integration Points: External service integrations and API patterns
- Common Pitfalls: Known issues and solutions specific to your project
- Team Decisions: Coding style and architectural decisions made by your team
How to Use It
Write down important insights about your project that you want Elastic Copilot to remember and apply:- Document recurring patterns in your codebase
- Record successful solutions to complex problems
- Note project-specific best practices
- Capture important architectural decisions
- Record domain knowledge and business rules
Example .elasticrules Content
Access Control (.elasticignore)
The.elasticignore file controls which files and directories Elastic Copilot can access, helping you maintain security and privacy while working with your codebase.
What to Exclude
- Sensitive Configuration: API keys, database credentials, and secrets
- Personal Information: User data, private communications, and confidential files
- Large Binary Files: Images, videos, and compiled assets that aren’t relevant for code assistance
- Temporary Files: Cache files, logs, and build artifacts
- Third-Party Code: Dependencies and vendor files you don’t want analyzed
Example .elasticignore File
Setup Instructions
Creating Configuration Files
-
Create files in your project root:
-
Add your project guidelines to
.elasticguides -
Configure access restrictions in
.elasticignore -
Document your project patterns in
.elasticrules
File Locations
All three files must be placed in your project’s root directory:Best Practices
- Start Simple: Begin with basic guidelines and expand over time
- Be Specific: Provide concrete examples rather than vague instructions
- Regular Updates: Review and update guidelines as your project evolves
- Team Alignment: Ensure all team members contribute to and follow the guidelines
- Security First: Always exclude sensitive files and credentials
Benefits
- Consistency: Maintain uniform coding standards across your project
- Efficiency: Reduce repetitive explanations and corrections
- Security: Control access to sensitive files and directories
- Intelligence: Build up project-specific knowledge that improves over time
- Team Collaboration: Share project knowledge and standards with team members