Skip to main content

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

FieldRequiredDescription
categoryYesCategory identifier
titleYesDisplay title
orderNoSort order (lower = earlier)
versionNoSemantic version
last_updatedNoLast 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:

CommandDescription
/era-directivesCreate or modify directives
/era-bootstrap-directivesGenerate comprehensive directives for existing projects
/era-sync-directivesSync directives from main branch

Best Practices

  1. Be specific - Vague directives are hard to follow
  2. Include rationale - Explain why the directive exists
  3. Keep it scannable - Use bullet points and short paragraphs
  4. Version your directives - Track changes over time
  5. Review regularly - Update as your project evolves