-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
CONTEXT_ROUTING.md contains unresolved template variables #935
Description
Bug
CONTEXT_ROUTING.md contains {PRINCIPAL.NAME} template variables that are never resolved. The file is read raw by the DA via the Read tool, so users see literal {PRINCIPAL.NAME} instead of their configured name.
Root Cause
Only CLAUDE.md (via BuildCLAUDE.ts) and SKILL.md (via RebuildPAI.ts) go through template variable resolution. CONTEXT_ROUTING.md has no .template file, no builder, and no SessionStart hook — it's checked into git as a static file with unresolved variables.
Affected Lines
## {PRINCIPAL.NAME} — Personal ContextProposed Fix
Short-term
Add CONTEXT_ROUTING.md to BuildCLAUDE.ts's resolution pass. It already has the variable map ({PRINCIPAL.NAME} → settings.principal.name, etc.) — it just needs to also process this file after resolving CLAUDE.md.
Medium-term
Include CONTEXT_ROUTING.md in the formal build process with its own .template file, consistent with how CLAUDE.md.template works.
Long-term
Audit the build process to ensure all files containing template variables are covered by resolution. Currently only 2 of N files with {PRINCIPAL.NAME} references go through the template engine — any new file added with template variables will silently fail unless manually added to a builder.
Environment
- PAI v4.0.3
CONTEXT_ROUTING.mdreduced to 32 lines in v4.0.3 but still contains one unresolved variable