Step 1: Load Source of Truth
Read the following files:
brain.yaml-- master configurationMachine/Rules/active-rules.md-- current behavioral rulescore/brain-rules.md-- universal base rules
Step 2: Scan Vault Conventions
Analyze actual vault usage patterns to detect conventions:
- Frontmatter patterns: Sample 10-20 recent files. What fields are consistently used? Any new fields not in the standard schema?
- Tag patterns: What tags are actively used? Any new tag namespaces (e.g.,
#project/name)? - File naming patterns: Are files using kebab-case, camelCase, spaces? Is it consistent?
- Wikilink patterns: How are wikilinks used? Short names vs full paths?
- Directory usage: Are files landing in the expected directories per brain.yaml?
Step 3: Detect Drift
Compare active-rules.md against actual vault conventions:
Rules without matching reality
Rules in active-rules.md that do not match actual vault behavior:
- A rule says "use kebab-case" but recent files use spaces
- A rule references a directory that does not exist
- A rule describes a process that session logs show is not followed
Reality without matching rules
Conventions observed in the vault that are not captured in active-rules.md:
- Consistent patterns in recent files not documented as rules
- New directories or structures that emerged organically
- Behavioral corrections in
Machine/Memory/corrections.mdnot yet promoted to rules
Configuration drift
Differences between brain.yaml settings and actual practice:
preferences.wikilinks: truebut files do not use wikilinksmemory.session_logs: truebut no session logs exist- Agents marked
enabled: truebut config files are missing or outdated
Step 4: Propose Rule Updates
Present a summary of drift findings and propose specific changes:
## Drift Report
### Rules to Update
1. Rule "{name}" -- actual practice differs: {description}
Proposed: {updated rule text}
### Rules to Add
1. New rule: "{name}" -- observed pattern: {description}
Proposed: {rule text}
### Rules to Remove
1. Rule "{name}" -- no longer applicable: {reason}
### No Changes Needed
{list rules that are aligned}
Ask for user approval before making any changes to active-rules.md.
Step 5: Update Active Rules (with approval)
If the user approves changes:
- Update
Machine/Rules/active-rules.mdwith approved changes. - Append entries to
Machine/Rules/rule-changelog.md:### {YYYY-MM-DD} -- Vault Alignment - Updated: {rule name} -- {reason} - Added: {rule name} -- {reason} - Removed: {rule name} -- {reason}
Step 6: Regenerate Agent Configs
For each agent marked enabled: true in brain.yaml:
Read the corresponding template from
generators/templates/:- Claude Code:
CLAUDE.md.tmpl - Cursor:
cursorrules.tmpl - Gemini CLI:
gemini.md.tmpl - Codex:
codex.md.tmpl
- Claude Code:
Regenerate the config file by combining:
- Base rules from
core/brain-rules.md - Active rules from
Machine/Rules/active-rules.md - Owner profile from brain.yaml
- Vault structure from brain.yaml
- Agent-specific adaptations from the template
- Base rules from
Write the regenerated config to the location specified in brain.yaml (
agents.{name}.config_file).If skills are enabled for an agent (
agents.{name}.skills: true), ensure skill references are included in the config.
Step 7: Report Results
## Vault Alignment Complete
### Rules Updated
- {N} rules modified, {N} added, {N} removed
- Changelog updated: Machine/Rules/rule-changelog.md
### Configs Regenerated
- CLAUDE.md -- regenerated (Claude Code)
- .cursorrules -- regenerated (Cursor)
- {or "skipped -- agent not enabled"}
### Remaining Drift
- {any drift the user chose not to address}
- {or "Vault is fully aligned."}