Skip to content

Telos UpdateTelos.ts: Backups crash, Updates.md case drift, footer-append placement, allowlist drift — all reproduce at HEAD (incl. regressions of closed #1085/#1086) #1452

Description

@jbmml

Summary

skills/Telos/Tools/UpdateTelos.ts is the sole sanctioned write path for TELOS files, and on a fresh install it fails several different ways before a single update can complete cleanly. Two of the four defects below were reported before (#1085, #1086) and closed, but the corresponding code change never landed — git log on this file shows exactly one commit (the bulk repo add), and both defects reproduce byte-for-byte at HEAD today. Filing the full cluster together with a sandboxed repro so it can be fixed in one pass.

Defect 1 — Backups/ never created (regression of #1086)

BACKUPS_DIR (line 42) is never mkdirSync'd — there is no mkdirSync anywhere in the file — before the copyFileSync at line 118. Fresh installs have no Backups/ dir, so the very first update crashes:

❌ Failed to create backup: Error: ENOENT: no such file or directory, copyfile
   '.../TELOS/PROBLEMS.md' -> '.../TELOS/Backups/PROBLEMS-<ts>.md'

#1086 was closed (2026-07-07) with "landing in source so it rides out in the next release," but the file hasn't been touched since the bulk add — the one-liner appears to have slipped through the cracks between the comment and a commit.

Defect 2 — Updates.md case drift + crash when missing (new)

Line 43 hardcodes UPDATES_FILE = join(TELOS_DIR, 'Updates.md') (capital U), while every console message in the same file (lines 166/171/174) and all of Workflows/Update.md (lines 43, 104, 273) call it lowercase updates.md. The scaffold ships neither variant, and readFileSync(UPDATES_FILE, ...) at line 149 throws instead of creating it, so every fresh install ends its first successful file update with:

❌ Failed to update updates.md: Error: ENOENT: no such file or directory, open '.../TELOS/Updates.md'

On case-sensitive filesystems the changelog can also fork into two different files depending on which name gets created first.

Defect 3 — new entries land below the closing footer (new)

Line 128 appends blindly to EOF (currentContent.trimEnd() + '\n' + content + '\n'). Every shipped TELOS template (BELIEFS, BOOKS, CHALLENGES, GOALS, MISSION, NARRATIVES, PROBLEMS, STRATEGIES, TELOS, WISDOM) ends with a --- + italic attribution footer, so new entries land after the closing commentary instead of in the content list:

Problems differ from CHALLENGES.md — problems are out there in the world, challenges are about you.

---
*The DA uses this list to recognize when your current work is (or isn't) serving your stated problem set...*
- **P3:** New problem entry added via UpdateTelos

Defect 4 — VALID_FILES drifted from the shipped scaffold (regression of #1085)

VALID_FILES (lines 46–51) advertises 18 names, but the shipped scaffold (USER/TELOS/) creates only 10 of them: BELIEFS, BOOKS, CHALLENGES, GOALS, MISSION, NARRATIVES, PROBLEMS, STRATEGIES, TELOS, WISDOM. The other 8 — FRAMES, LESSONS, MODELS, MOVIES, PREDICTIONS, PROJECTS, TRAUMAS, WRONG — hard-fail existsSync ("File does not exist") on any fresh install despite being documented as valid. #1085 covered the LESSONS naming case specifically and was closed noting the stale entries were "flagged for cleanup" (and PR #1024, which contained that rename, was closed without merging) — LESSONS.md is still in the array at HEAD.

Repro (minimal, sandboxed — does not touch a real install)

mkdir -p /tmp/repro/.claude/LIFEOS/USER/TELOS
cp LifeOS/install/USER/TELOS/{BELIEFS,BOOKS,CHALLENGES,GOALS,MISSION,NARRATIVES,PROBLEMS,STRATEGIES,TELOS,WISDOM}.md \
   /tmp/repro/.claude/LIFEOS/USER/TELOS/
cd LifeOS/install
HOME=/tmp/repro bun skills/Telos/Tools/UpdateTelos.ts PROBLEMS.md "- test entry" "test"
# -> Defect 1: ENOENT on Backups/
mkdir -p /tmp/repro/.claude/LIFEOS/USER/TELOS/Backups
HOME=/tmp/repro bun skills/Telos/Tools/UpdateTelos.ts PROBLEMS.md "- test entry" "test"
# -> Defect 2: ENOENT on Updates.md; Defect 3: entry lands below the footer (inspect PROBLEMS.md)
HOME=/tmp/repro bun skills/Telos/Tools/UpdateTelos.ts LESSONS.md "- test" "test"
# -> Defect 4: "File does not exist" despite LESSONS.md being in VALID_FILES

Also confirmed on a live v6.0.5-lineage install (macOS) — defects 1–3 were all hit in real use before the sandbox repro was built.

Suggested fixes (with migration notes)

  1. Backups: mkdirSync(BACKUPS_DIR, { recursive: true }) before the copy — purely additive, matches what Telos UpdateTelos.ts: crashes on first run — backups/ directory is not auto-created #1086 already agreed to.
  2. Updates file: resolve the name at runtime — prefer whichever of Updates.md/updates.md already exists (protects installs with history in the capitalized variant, especially on case-sensitive filesystems), create lowercase updates.md (matching the docs) when neither exists, and create-instead-of-throw at line 149.
  3. Placement: insert new entries above the template's closing ---/italic footer when that shape is present, falling back to today's EOF append when it isn't — strictly better in the common case, identical behavior in the worst case.
  4. Allowlist: either shrink VALID_FILES to what the scaffold ships, or (better, since this is the sole sanctioned write path) auto-scaffold a minimal starter file when a listed file doesn't exist yet. The second option avoids regressing long-time users whose older-lineage installs still carry FRAMES/MODELS/etc. Also sync the JSDoc file list (lines 16–34) with whichever list ships.

Happy to send a PR covering all four — wanted the write-up and repro in front of you first, given the tracking history on #1085/#1086.

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