Directives Guide
Directives are project-specific guidelines that define how your team works. They complement the immutable Constitution with customizable rules.
Directory Structure
.era/memory/directives/
├── _config.yaml # Auto-generated (DO NOT EDIT)
├── 000-upstream-header.md # Header (managed by Era)
├── development.md # Your development standards
├── testing.md # Your testing requirements
├── security.md # Your security policies
└── 999-upstream-footer.md # Footer (managed by Era)
Creating a Directive File
Create a new .md file in .era/memory/directives/:
---
category: development
title: Development Standards
order: 10
version: 1.0.0
last_updated: 2025-01-09
---
## Code Style
<!-- directive:code-style -->
All code MUST follow the project's established coding style.
### Requirements
- Use consistent indentation (2 spaces for JS/TS)
- Follow naming conventions
- Add JSDoc comments to public APIs
### Rationale
Consistent code style improves readability and reduces cognitive load.
<!-- /directive -->
Frontmatter Fields
| Field | Required | Description |
|---|---|---|
category | Yes | Category identifier |
title | Yes | Display title |
order | No | Sort order (lower = earlier) |
version | No | Semantic version |
last_updated | No | Last update date |
Directive Markers
Use markers to identify individual directives:
<!-- directive:unique-id -->
Directive content...
<!-- /directive -->
IDs must be unique across all directive files.
Language
Use RFC 2119 language for requirements:
- MUST / MUST NOT - Absolute requirements
- SHOULD / SHOULD NOT - Recommended
- MAY - Optional
Building Directives
Directives are compiled into .era/memory/DIRECTIVES.md automatically when you run:
era-code start
Or manually:
era-code build-directives
OpenCode Commands
From within OpenCode, use these commands:
| Command | Description |
|---|---|
/era-directives | Create or modify directives |
/era-bootstrap-directives | Generate comprehensive directives for existing projects |
/era-sync-directives | Sync directives from main branch |
Best Practices
- Be specific - Vague directives are hard to follow
- Include rationale - Explain why the directive exists
- Keep it scannable - Use bullet points and short paragraphs
- Version your directives - Track changes over time
- Review regularly - Update as your project evolves