Customization technical reference
This page provides technical implementation details for working with plugs, overlays, and scopes. Author rules in .aligntrue/rules/*.md; exports (for example, AGENTS.md, .cursor/rules/*.mdc) are generated outputs and should be treated as read-only. For user-facing guides, see Plugs, Overlays, and Scopes.
Where to declare features
| Feature | Align Files | Config File | Primary Use |
|---|---|---|---|
| Plugs slots | ✓ | - | Define template variables |
| Plugs fills | - | ✓ | Fill template variables (config only) |
| Overlays | - | ✓ | Override rule properties (config only) |
| Scopes | - | ✓ | Filter rules by path |
Plugs slots:
- Declared in Align files (natural markdown sections or
.aligntrue/rulesIR) - Example:
examples/aligns/testing.mdwith natural markdown sections
Plugs fills:
- Declared in
.aligntrue/config.yamlonly (project-level fills) - Formats supported:
command,text(fileandurlare deprecated and treated astext) - Sync fails if required plugs are missing
Overlays:
- Declared in
.aligntrue/config.yamlonly (underoverlays.overrides:) - Supported selectors:
rule[id=...],sections[index](others are deprecated) - Remove via
set: { key: null }(removeis deprecated) - Conflicts fail by default;
--allow-overlay-conflictsopts into last-writer-wins
Scopes:
- Declared in
.aligntrue/config.yamlonly (underscopes:) - Applied at load time before plugs/overlays
Authoring formats
AlignTrue supports two authoring formats (source of truth is .aligntrue/rules/*.md):
Natural markdown sections (recommended for Aligns)
---
id: testing-align
version: 1.0.0
plugs:
slots:
test.cmd:
description: "Command to run tests"
format: command
required: true
example: "pytest -q"
---
# Testing Align
Use consistent test commands across your project.
## Testing guidelines
Run tests before committing: [[plug:test.cmd]]Direct YAML (internal IR format)
AlignTrue keeps an internal IR in memory while syncing; this YAML shows the equivalent shape for reference. Your authored files stay in .aligntrue/rules/*.md.
id: testing-align
version: 1.0.0
plugs:
slots:
test.cmd:
description: "Command to run tests"
format: command
rules:
- id: testing.run-tests
severity: error
guidance: "Run tests: [[plug:test.cmd]]"Data flow
.aligntrue/rules/*.md → Parser → In-memory IR → Exporters → Agent exports (AGENTS.md, .cursor/rules/*.mdc, etc.)Note: Agent exports (including AGENTS.md and .cursor/rules/*.mdc) are generated outputs. Edit .aligntrue/rules/*.md or .aligntrue/config.yaml instead.
Plugs resolution algorithm
- Normalize CRLF/CR to LF in rule text
- Protect escapes: sentinel-replace
[[\plug:temporarily - For each
[[plug:<key>]]:- If fill exists → replace with fill value
- If required and no fill → insert TODO block
- If optional and no fill → replace with empty string
- Unescape sentinel back to
[[plug:for[[\plug:...] - Ensure single trailing LF
TODO Block Format (Exact Bytes, LF Only)
With example:
TODO(plug:<key>): Provide a value for this plug.
Examples: <example-from-slot>Without example:
TODO(plug:<key>): Provide a value for this plug.Merge order
Base < stack Align(s) < repo. Last writer wins.
Plugs format types
command- Single-line command, no env vars exceptCI=truetext- Any single-line UTF-8 stringfile- Repo-relative POSIX path, no..segments, no absolute pathsurl- Must start withhttp://orhttps://
Plugs key naming rules
- Pattern:
^[a-z0-9._-]+$ - Cannot start with
stack.orsys.(reserved) - Use dots for namespacing:
test.cmd,docs.url,author.name
Overlays selector syntax
- By rule ID:
rule[id=no-console-log] - By property path:
profile.version - By array index:
rules[0](less common, prefer ID)
Overlays operations
Set operation (supports dot notation)
overlays:
overrides:
- selector: "rule[id=no-console-log]"
set:
severity: "error" # Simple property
"check.inputs.maxLength": 120 # Nested property
autofix: false # Disable autofixRemove operation
overlays:
overrides:
- selector: "rule[id=max-complexity]"
remove:
- "autofix"
- "tags"Combined
overlays:
overrides:
- selector: "rule[id=line-length]"
set:
severity: "warning"
"check.inputs.threshold": 120
remove:
- "autofix"Severity values
"off", "info", "warning", "error"
Application order
Overlays apply in definition order. Last matching overlay wins if multiple target same rule.
Scopes path rules
- Must be relative (no leading
/) - No parent directory traversal (
..not allowed) - Use forward slashes (POSIX-style)
- Use
.for workspace root
Scopes include/exclude
- Standard glob syntax (micromatch)
- Relative to scope path
- Multiple patterns allowed
- Exclude applied after include
Scopes merge order (default)
merge:
strategy: "deep"
order: ["root", "path", "local"]- root - Rules from workspace root config
- path - Rules from scope-specific configs
- local - Rules from nested/local configs
Last writer wins for conflicts.
Integration and order
When using multiple customization features together, they apply in this order:
- Scopes - Filter rules by path
- Plugs - Resolve template slots
- Overlays - Apply property overrides
Determinism and hashing
Plugs
- Lock hash - Computed over canonicalized YAML pre-resolution
- Export hash - Computed over fully resolved text post-resolution
- Fills are not volatile - they affect export hash
Overlays
- base_hash - Upstream content
- overlay_hash - Local modifications
- result_hash - Combined result
- Tracked in lockfile for drift detection
Scopes
- Applied at load time before plugs and overlays
- Merge order is deterministic
- Path validation prevents security issues
Validation rules
Plugs
- Every
[[plug:...]]must have declared slot - Fills must be non-empty, single-line scalars
- Keys cannot start with
stack.orsys. - Format validation (command, text, file, url)
- Required slots must have fills or render TODO blocks
Overlays
- Selectors must match existing rules
- Severity values must be valid (
off,info,warning,error) - Property paths use dot notation for nested properties
- Remove operations list property names to delete
- Stale selectors (no match) flagged in
override status
Scopes
- Paths must be relative (no leading
/) - No parent directory traversal (
..) - Glob patterns must be syntactically valid
- Merge order values must be
root,path, orlocal - No duplicate values in merge order
- Rulesets must reference existing rule Align IDs
Best practices
For plugs
- Provide examples for required slots
- Use most restrictive format (command > file > text)
- Mark as optional unless truly required
- Namespace keys with dots:
test.cmd,docs.url - Never put secrets in fills (use env vars at runtime)
For overlays
- Keep overlays minimal (fewer = easier updates)
- Document reasons with YAML comments
- Track expiration dates for temporary overrides
- Review regularly with
override status - Consolidate duplicate overlays
For scopes
- Start simple, add complexity only when needed
- Use shared base rules across all scopes
- Map scopes to team ownership boundaries
- Exclude test files if rules differ
- Document scope ownership with comments
Vendor bags (passive)
Vendor bags are an implementation detail that preserves agent-specific metadata during sync. You don’t need to configure or manage them - they work automatically.
What they do:
- Preserve Cursor-specific fields when importing from
.mdcfiles - Store agent metadata in
vendor.<agent>.*namespace - Exclude volatile fields (like session IDs) from hashing
- Enable lossless round-trips between IR and agent formats
When they matter:
- Preserving agent-specific fields when importing from agent formats
- Importing from agent-specific formats
- Preserving agent hints and metadata
You don’t need to understand vendor bags to use AlignTrue effectively - they’re implementation details for the system.
CLI Workflows
Plugs workflow
# 1. Audit slots and fills
aligntrue plugs list
# 2. Set required fills
aligntrue plugs set test.cmd "pnpm test"
# 3. Preview resolution
aligntrue plugs resolve
# 4. Sync to agents
aligntrue syncOverlays workflow
# 1. Add overlay
aligntrue override add \
--selector 'rule[id=no-console-log]' \
--set severity=error
# 2. View all overlays
aligntrue override status
# 3. Show effects
aligntrue override diff
# 4. Sync to agents
aligntrue syncScopes workflow
# 1. Configure scopes in .aligntrue/config.yaml
aligntrue scopes
# 2. Validate
aligntrue check
# 3. Sync to agents
aligntrue syncRelated documentation
Handling gitignore merge conflicts
AlignTrue manages .gitignore entries between # START AlignTrue Generated Files and # END markers. If a merge conflict appears in that managed block:
- Keep either side of the conflict (do not try to hand-merge individual lines).
- Save and rerun
aligntrue sync— the managed section will be rewritten cleanly.
Conflicts outside the managed block should be resolved normally.