Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

CONTEXT_ROUTING.md contains unresolved template variables

Open virtualian opened this issue 8 months ago • 1 comments

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 Context

Proposed 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.md reduced to 32 lines in v4.0.3 but still contains one unresolved variable

virtualian avatar Mar 09 '26 13:03 virtualian

This is a duplicate of Issue #879.

virtualian avatar Mar 09 '26 21:03 virtualian