Skip to content

TELOS template/parser mismatch breaks PRINCIPAL_TELOS.md rendering #1113

@wojteksbt

Description

@wojteksbt

Summary

The bootstrap TELOS templates and the GenerateTelosSummary.ts parsers are out of sync in two ways. After running the renderer on a fresh PAI v5.0.0 install, PRINCIPAL_TELOS.md contains:

  1. Stray ** characters in every Missions/Goals/Problems/Challenges/Narratives entry
  2. An empty ## Strategies section — the shipped STRATEGIES template never renders at all

Both symptoms come from a single root cause: the templates and parsers were written against different bullet/header conventions and never reconciled.

Reproduction

  1. Fresh PAI v5.0.0 install (templates as shipped under Releases/v5.0.0/.claude/PAI/USER/TELOS/).
  2. Run:
    bun ~/.claude/PAI/TOOLS/GenerateTelosSummary.ts
  3. Open the generated PAI/USER/TELOS/PRINCIPAL_TELOS.md.

Actual:

## Missions
- **M0**: ** (sample) Help one million people make better decisions...
- **M1**: ** (sample) Build infrastructure that lets individuals own...

## Strategies

## Active Narratives
...

Expected:

## Missions
- **M0**: (sample) Help one million people make better decisions...
- **M1**: (sample) Build infrastructure that lets individuals own...

## Strategies
- **S0**: (sample) Ship the crappy version, then iterate in public...
- **S1**: (sample) Write before building...
- **S2**: (sample) Default to open...

Same ** prefix artifact appears in Goals, Problems, Challenges, and Narratives sections. The Strategies section is silently empty.

Root cause #1**ID:** vs **ID**: (templates)

The templates use **ID:** (colon inside the bold span):

- **M0:** (sample) Help one million people make better decisions...

The parser at Releases/v5.0.0/.claude/PAI/TOOLS/GenerateTelosSummary.ts:53 expects **ID**: (colon outside the bold span):

const match = line.match(/^-\s+\*?\*?(\w+)\*?\*?:\s*(.+)/);

Walking the regex against - **M0:** text:

token matches
^-\s+ -
\*?\*? **
(\w+) M0
\*?\*? empty (next char is :)
: :
\s* empty
(.+) ** text ← garbage prefix

So the parser silently captures the trailing ** as part of the value. Affects MISSION, GOALS, PROBLEMS, STRATEGIES, CHALLENGES, NARRATIVES.

Root cause #2 — parsers read different formats per file

Even with Root cause #1 fixed, the Strategies section stays empty. parseStrategies reads only H2/H3 headers:

// GenerateTelosSummary.ts:131
const headers = [...content.matchAll(/^#{2,3}\s+(S\d+):\s*(.+?)(?:\s*\(.*\))?\s*$/gm)];

But the shipped STRATEGIES.md template uses bullets (- **S0:** text), not headers. So the parser ignores the template entirely. parseProblems has the inverse problem — it reads headers first and only falls back to bullets if headers find nothing, an unnecessary fork.

The other ID-bearing parsers (parseMissions, parseGoals, parseNarratives, parseChallenges) all read bullets via parseItems. The split between bullet-based and header-based parsing across files is the second half of the bug.

Affected files

Templates (Root cause #1):

  • Releases/v5.0.0/.claude/PAI/USER/TELOS/MISSION.md (M0–M2)
  • Releases/v5.0.0/.claude/PAI/USER/TELOS/GOALS.md (G0–G2)
  • Releases/v5.0.0/.claude/PAI/USER/TELOS/PROBLEMS.md (P0–P2)
  • Releases/v5.0.0/.claude/PAI/USER/TELOS/STRATEGIES.md (S0–S2)
  • Releases/v5.0.0/.claude/PAI/USER/TELOS/CHALLENGES.md (C0–C2)
  • Releases/v5.0.0/.claude/PAI/USER/TELOS/NARRATIVES.md (N0–N2)

Parser (Root cause #2):

  • Releases/v5.0.0/.claude/PAI/TOOLS/GenerateTelosSummary.tsparseStrategies, parseProblems

WISDOM.md, BELIEFS.md, and BOOKS.md use other formatting and are not affected.

Why this matters

PRINCIPAL_TELOS.md is force-loaded into every Claude Code session via CLAUDE.md's @-import block. Garbage prefixes propagate into the model's context on every startup, and the missing Strategies section means the DA never sees the user's playbook even after they've filled it in. Most users won't notice — broken output looks like a markdown rendering quirk or a "you haven't filled this in yet" state.

New users running /interview for the first time see broken output even when they did everything right.

Proposed fix (PR #1114 follows)

  1. Templates: **ID:****ID**: across 6 files (18 lines).
  2. Parsers: parseStrategies and parseProblems standardize on parseItems with an ID-prefix filter, mirroring parseMissions/parseGoals/parseNarratives/parseChallenges. Header-based parsing is dropped — single bullet convention across all ID-bearing TELOS files.

Breaking change note

Users whose existing STRATEGIES.md or PROBLEMS.md files use H2/H3 headers (## S0: title / ### P0: title) will stop rendering after the parser change. Migrate to bullet format - **S0**: title to match. The shipped v5.0.0 templates already use bullets, so users who never customized are unaffected.

Verification

After applying the PR, running the renderer against the as-shipped sample templates produces clean, complete output across all six sections (Missions, Goals, Problems, Strategies, Challenges, Narratives) — no ** artifact, no silent drops.

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