Skip to content

CONTEXT_ROUTING.md contains unresolved template variables #935

@virtualian

Description

@virtualian

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions