Telesma

Telesma architecture and design rationale

This document explains why Telesma works the way it does. CLAUDE.md says what is where and which invariants must hold; this file keeps the reasoning and the lessons behind each mechanism, with the numbers that decided them. Before 1.0, Telesma was developed privately (internal versions 1–17); most of the lessons below come from that period and from a few long-running projects built with it. “The reference project” means the largest of them — a production application developed with Telesma for more than a year, with close to two thousand tasks in its plan. Where history mentions old names, the current English names are used.

The recurring theme: whatever the model does not do consistently, a script enforces. Several mechanisms started as instructions, were measured, found to be followed unevenly, and moved into the launcher, a hook or a check.


1. Continuous session instead of restart-per-task

Classic Claude automation restarts the CLI for each task and feeds it a fresh prompt. Telesma does the opposite: one session, in which the model runs the loop itself — pick a task, load what it needs, implement, test, commit, report, pick the next one — and calls /compact when context grows (per config: every N tasks or after a phase).

The price of a continuous session is that the context will be compacted, and anything held only in the conversation is lost. Hence the state files: telesma/state/PLAN.md (what to do), REPORT.md (what happened), PROJECT_CONTEXT.md (architecture, decisions, pitfalls), SPEC_INDEX.md (where things are in the spec), config.md. The model is told to update them before compacting. They are also what a new session starts from, so a session resume is detected from REPORT.md history, not from memory.

The launcher (telesma.sh) does everything deterministic before the model starts — migration, rotation, validation, prompt assembly — because work done by a script costs zero tokens and does not depend on the model remembering it.

Modes after clarification: autonomous (the loop), bugfix (chat: report → diagnosis → proposal → acceptance → fix → test → commit → BUGFIXES.md entry), review (chat: choose a scope, load telesma/spec/guidelines/context as criteria, findings with severity, low-severity fixes batched automatically, the rest gated, REVIEWS.md entry) and artifacts (autonomous, idempotent backfill of screenshots and recordings). Modes 2 and 3 force interactive mode because the chat is their point.

2. Clarification and plan generation

A spec is never complete, and a model that guesses silently builds the wrong thing confidently. Clarification (section -1) therefore runs before any code:

  1. The model reads telesma/spec/ and writes telesma/state/SPEC_INDEX.md: a two-level index with line ranges, per-section anchors, keywords — and a quality assessment (completeness, unambiguity, consistency, topic gaps, recommendation). The assessment drives the number of questions.
  2. telesma/state/QUESTIONS.md has three sections, in the order the user resolves them:
    • Contradictions (### S…) — two sources that disagree, with a proposed resolution. They must be settled first; answering questions on top of a contradiction wastes the answers.
    • Assumptions (### A…) — decisions taken without asking (industry standards, stack conventions), listed for a spot-check. This is what keeps the question count down.
    • Questions (### Q…) — only what cannot reasonably be assumed. The count is adaptive: 3–7 for a small project with a good spec, 15–30+ for a large one with a poor spec. Every question cites its Source in the spec.
  3. After the answers, the plan is generated from four sources: spec, contradiction resolutions, accepted assumptions, answers. The launcher first tries claude --continue on the indexing session, which already has the whole spec in context (cheaper and better informed), and falls back to a fresh run if no plan materialises.
  4. The plan starts with task 1.1 “architecture skeleton”, carries - AC: acceptance criteria on non-trivial tasks and a ## Spec coverage section mapping every index section to tasks or to a justified “out of scope”, and passes a self-review checklist.

Then Clarified: yes is set and telesma/spec/ is frozen.

The launcher validates the plan mechanically before every start: dependency graph (existence, cycles, duplicate ids), (tech:) tags against telesma/guidelines/, (spec:) / (ui-*:) / (flow:) tags against files. Errors gate the start. It also computes a next-task hint and collapses completed phases in the prompt copy.

3. Selective retrieval and anchors

Telesma never loads a whole spec document. A task carries (spec: file.md); the index gives the section and its line range; the model reads only that fragment with offset/limit. Grep over telesma/spec/ is the fallback.

Line ranges go stale when someone edits a file. So each index entry also carries an anchor — the exact heading text — and the model verifies that the fragment it read starts with it. On a mismatch it greps the heading, reads from the right offset and fixes the index entry itself. The launcher additionally stamps spec checksums into the index and warns on drift.

UX/UI material in telesma/spec/ux_ui/ (tokens, primitives, screens as CSS/JSX/HTML) is indexed per element. Tags (ui-tokens:), (ui-component: file#A,B) and (ui-screen: file#Screen) load one element at a time. Prototype components are rewritten into the production stack, never copied (prototypes are typically in-browser Babel with globals); a screen task reads the production component API, not the prototype again. Mockups that live outside the repo are entries in telesma/spec/ux_ui/LINKS.md, resolved through the index to a web fetch. That file is exempt from the spec freeze; the launcher detects unindexed entries deterministically and asks for a re-index.

4. Technology guidelines

Conventions per language/framework live in telesma/guidelines/ (copied from templates/guidelines/). The prompt carries only an index (tag + keywords). Per task the model reads general.md plus one file per (tech:) tag. A missing tag file is TELESMA BLOCKED — asking is cheaper than a project written in invented conventions.

Users edit these files freely. Updates go through .telesma-manifest, which stores the hash of the template version last delivered: an unedited file (equal to any historical template version) is replaced; an edited one gets a one-time warning with a diff command and is never overwritten. The same mechanism delivers the judge hook, the checks and the test-scenario skeleton.

5. The changes channel

After clarification telesma/spec/ is frozen; changes come through telesma/changes/, one Markdown file per change, optional frontmatter (date, priority, affects, kind). Before picking the next task the model processes pending changes (section 0.3): modifies pending tasks in place with (change: <file>), creates a rework phase (Phase N.Z1) for completed tasks that need rework — completed boxes are never unchecked — writes a ## Change history entry and moves the file to telesma/changes/processed/. A task carrying (change:) re-reads that file when executed.

Designed for spec corrections, telesma/changes/ turned out to be the main channel through which projects grow — hundreds of changes in a few months on the reference project, and many projects start from a deliberately thin spec. So neither the number of changes nor the share ending in rework says anything about quality. What carries signal is a change that exists because something already built does not work — hence the Kind field (bug | correction | feature), see §11.

6. Interactive decision log

After TELESMA COMPLETE or TELESMA BLOCKED the session stays open and the human takes over. Every exchange is appended to telesma/state/DECISIONS.md (question/context paraphrased, the outcome in 2–4 sentences, optional impact). The file is write-only — never loaded into a prompt — so decisions with architectural impact are dual-written to the ## Key decisions table in PROJECT_CONTEXT.md; otherwise the next autonomous session would never see them. Topics for later go to telesma/state/BACKLOG.md, which, unlike the logs, is read-write.

Write-only turned out to mean forgotten (format 19). “Never loaded into a prompt” was read by the model as “never read”, and the instructions said so outright. A review of every place where the model answers, proposes, plans or asks found no step that looked back: section 10 answered a design question from scratch and logged the result — a second decision next to the first when the topic came back months later; change processing (0.3) analysed impact against the plan alone, so a change could silently reverse a 📌 decision or a clarification answer; QUESTIONS.md — the answers the user gave in person — was a source for plan generation and never again; bugfix mode did not touch PROJECT_CONTEXT.md, so a production bug fixed there never became a pitfall; a reversed decision became two contradictory rows, and a 📌 row never rotates; and nothing pointed back into CONTEXT_ARCHIVE.md once a row had rotated out.

The fix keeps the prompt diet intact and adds a way back on demand, modelled on the spec index: a recall step (0.6) — one Grep of the topic’s words across the logs and archives before any answer, proposal, change plan or question, a hit opening the reply (“on 2026-04-23 we agreed X because Y — does that still hold?”); a pointer from a Key decisions / Known problems row to its full entry (→ DECISIONS.md 2026-04-23 16:42, → QUESTIONS.md A7, → BUGFIXES.md …), so the row stays a one-line conclusion and the rejected alternatives are one Read away; clarification answers written into Key decisions with that pointer; a conflict with a decision step in 0.3 that blocks instead of planning; bugfix mode feeding Known problems; and supersession — an overturned decision is edited in place (~~old~~ → new, superseded: …), never added beside the old row. No structural token changed, so no parser and no migration; the format number moved so that telemetry can tell before from after.

The first live test (two projects, one question each, 2026-11-03) showed where the step is fragile. The Grep and the Read happened both times; the failure was in the retelling. Asked “shall we switch to OpenAI for images?”, the model found the entry that said Google directly, OpenAI only through the proxy and opened with “we agreed the private build may use OpenAI directly” — a paraphrase written while already weighing the proposal, bent towards what the proposal needed, which the user who did not remember the entry could not catch. It then recommended the switch; one “yes” away from the contradictory second decision the step exists to prevent. Two rules followed: the hit is quoted verbatim (date and Outcome sentence in quotation marks) before it is interpreted, and a proposal that contradicts the hit gets change the decision, or the proposal? as the whole reply — the 0.3 rule for change files, now also for the chat. A launcher-side “related decisions” list would not have helped: the model reached the right entry and misread it.

The second run of the same question found a third failure, this one in the log itself. The first run had logged its unanswered recommendation (“new OpenAI generator… awaiting the owner’s confirmation and key”) as a Kind: question entry; the second run’s Grep hit that entry first, read the repeated question as the awaited confirmation and started writing code — a shared helper, a new generator, an edit to the existing one — before saying a word. Two more rules: an outcome that decides nothing starts with No decision — awaits: …, and recall treats such an entry, or any unanswered recommendation, as the question coming back, never as consent; and until the user answers change the decision, or the proposal? no tool that writes may run — the answer is the gate, not the model’s confidence that it knows what it will be.

7. Release versions and manual test scenarios

vX.Y.Z marks what shipped; it is deliberately separate from the internal telesma/phase-<ID> progress tags. Telesma proposes a release and waits — no answer, no tag. The proposal is a fixed, visibly separate block (📦 RELEASE PROPOSAL: previous version and date, commits since, what landed in product language, the suggested number with the reason, what “yes” will do), because a sentence folded into a phase report was easy to miss. Moments: green full suite at phase end, TELESMA COMPLETE, entering interactive mode with unreleased green commits, and a one-line patch proposal after a bugfix commit. The launcher computes the data (VERSIONS: directive) so the proposal does not depend on the model remembering git describe --tags --abbrev=0 --match 'v*' (the --match matters, or describe returns a phase tag). In user-facing text Telesma says “release version vX.Y.Z”, never bare “tag” — to an owner the bare word means nothing specific.

Before tagging, Telesma writes docs/test-scenarios/vX.Y.Z.md and commits it, so the file is part of the tagged state and the tree is clean. It contains only what automated tests could not check — look and feel, real data, external services, production-only paths — sourced from git log <prev>..HEAD and notes on tasks closed in that range. Every scenario has a failure signal; a release that adds a limit, validation or permission also gets a barriers section of things that must be rejected. telesma/spec/APP_FLOW.md contributes by exclusion: a step covered by a green e2e test is exactly what must not be copied here.

Blockers: red suite, dirty tree (a tag on a dirty tree points at a state nobody can reproduce), an existing tag of that name (-f is forbidden, unlike phase tags). Never: push (the user gets the command and the note that tags do not travel with a plain push), merge to main, deploy, or edits of version fields in manifests — the version is derived from git.

8. State-file rotation

PLAN.md, REPORT.md and PROJECT_CONTEXT.md go into every startup prompt in full and grow linearly. On the reference project, after a year, that was ~400k tokens before a single task started, 77% of it REPORT.md. The launcher rotates them at startup — deterministic, zero tokens — into *_ARCHIVE.md files that are never loaded.

Two kinds of sections. Current state (## Summary, the metrics table in ## Test status) is overwritten by the model; growth there means a session note was appended where it should not be, and only the three newest dated bullets survive. Chronicle sections (Test status run paragraphs, Task history, Problem log, Change history, ad-hoc sections) are append-only and keep the newest N (3 runs, 10 entries, 10 log entries, 10 change entries, 3 ad-hoc sections). Ad-hoc sections are recognised by a title not in the template’s set — a name pattern missed everything the model invented, and one such section sat in every prompt for three weeks.

An entry is a block, never a line. An early rotation archived single lines — a table row, a [date] opener — while the model writes multi-line entries (symptom + fix + lesson; a phase history subsection with its own table). Rotation cut entries in half: the archive held bare openers, the report kept headers with no rows and paragraphs starting mid-sentence. This was the one framework bug that destroyed content, which is why repair exists (§10).

Ordering is date-driven, not positional. The model appends to the bottom in some sessions and prepends in others; “keep the last N” silently archived the newest entries. The N newest by date survive wherever they sit. An undated block cannot be judged, so it stays but consumes a slot — an earlier rule required every block to carry a date, so one undated entry flipped the whole section back to positional mode.

## Test status was first classified as current state — a mistake: every run is compared with the previous one, so the model appends paragraphs. On the reference project the section reached 128 KB (~25k tokens per start, 90 runs back). Run blocks are now paragraphs opened by bold text with a date; a dateless paragraph continues the block above (wrapped lines also start with **, and treating them as blocks broke the date sort). 128 KB → 2.4 KB.

PROJECT_CONTEXT.md keeps the last 40 Key decisions rows and the last 30 Known problems and solutions rows, date-sorted; a row marked 📌 never rotates. The template once offered two sections for the same job (a problems table and a pitfalls list); the model filled the one the instructions did not describe, so the list was removed and folded into the table. Its size limit is in KB, not lines: “~150 lines” is no limit when a line runs to 2300 characters (162 lines, 82 KB on the reference project).

PLAN.md archives 100%-complete phases beyond the last N, only above 100 KB (small projects get no churn). A stub plus <!-- telesma-archived: 12.1 12.2 … --> stays, so the validator still resolves (requires: 12.3). Archiving is prompt-neutral (collapsing already protected the prompt); it buys file size, Edit/Grep cost and readable diffs — 1672 KB → 142 KB on the reference project. Ad-hoc ## Requests from <date> — … sections were not prompt-neutral: their prose intros (91 KB of commentary on long-shipped changes) escaped both collapsing and archiving, which only see ### Phase. Rotation archives only the intro, never the section — live phases hang under those headers, and a section with any open - [ ] is skipped entirely.

What counts as a task. The task regex once allowed only ✅ before the keyword, so a task marked ⛔ (waiting for a human) was invisible — and not counted toward phase completion, so a phase whose only remaining work was a ⛔ task read as complete and was archived with unfinished work inside. Any leading marker is now tolerated; ⛔ counts toward completeness, and the next-task hint skips it unless nothing else is left. Task lines are capped at 400 characters; long rationale belongs in the files that rotate.

Rotation dirties the tree at startup, which would block release tagging, so the instructions tell the model to include telesma/state/*_ARCHIVE.md in the session’s first commit.

9. Startup prompt diet

The first measurement across dimensions (§11) found the reference project’s startup prompt at 425k characters (~105k tokens) before Telesma did anything — carried again on every turn. 60% of it did not serve picking and doing the next task: 410 one-line stubs of archived phases, dozens of empty ad-hoc headers, PROJECT_CONTEXT.md table rows with a median of 967 characters (the instructions say “a couple of sentences”), ad-hoc change-history sections whose text already lives in telesma/changes/processed/, and 13 KB of template comments in config.md.

All of it is trimmed in the prompt copy only; files on disk are untouched. Finished phases become one line of ids (enough for dependencies — the title is one grep away), exhausted ad-hoc sections are dropped, config comments stripped, table rows cut at 400 characters with a pointer to the file. The diagnosis flags oversized rows so the model shortens them at the source. Result: 425k → 286k characters (−33%). The side effect to watch is retries — the model occasionally needs a grep for something the prompt no longer shows.

The guidelines index got the same treatment later: fifty tag — keywords lines are 8 KB in every session of a project that uses two or three tags. In the implementation modes the full line stays for the tags the project uses — every (tech:) in the plan, the plan’s Stack line, the detected manifests — and for general.md; the other tags are named in one line. The files themselves are all delivered to telesma/guidelines/ as before: copying only the “used” ones was tried earlier and abandoned, because a growing project keeps adding technologies and every new tag became a sync problem and a blocked task. Trimming the prompt instead of the directory has no state to keep in sync — the launcher recomputes the set from the plan at every start — and the clarification, which assigns the tags, still sees the whole index.

10. State-file diagnosis and repair

Nothing used to measure the state files themselves; the reference project grew to 550 KB of prompt before anyone looked. tools/telesma-repair.py does two jobs:

Git is the source of truth, with a rule per section: a log entry is restored from the commit that first introduced it (written once; later versions carry glued-on orphans of entries rotated away below it), a history subsection from its longest version ever (rows accumulate legitimately). Orphans are deleted only after their text is verified present in the archive. Two further repairs are mechanical: a phase archived with unfinished work goes back (the archive block and the stub are verbatim what rotation moved, so swapping them reverses a wrong move), and a checked item without a task keyword — a note wearing a checkbox — moves under its phase in Task history, dated by git log -S. An unchecked non-task item stays with the human: forgotten task or backlog entry, only a person can say.

Repair opens exactly four files (REPORT.md, REPORT_ARCHIVE.md, PLAN.md, PLAN_ARCHIVE.md), so decisions, backlog and conversation records are out of reach by construction. It never deletes what git does not know about — a first version rebuilt history subsections from git and therefore reverted, on a second run, the notes the first run had moved in. tools/test-repair.py pins the properties: every word of four or more characters occurs at least as often after repair (word level, because the tool reformats), files outside scope are byte-identical, and a second run changes nothing.

11. Quality telemetry (optional, self-hosted)

Every framework bug above was found the same way: a human opened a project and read its state files. tools/telesma-telemetry.py makes that systematic. It is optional and off by default; when enabled it sends events to the user’s own server (a separate, self-hosted project), in the background at startup — the start never waits for it. Payload schema version 2.

It reads what Telesma leaves behind anyway — problem log, tries per task, bugfix/review/decision logs, change history, pitfalls, scenario results, judge decision counters — plus git history and local Claude Code transcripts. Pure reads, zero tokens, never modifies the project. What never leaves the machine: telesma/spec/, source code, telesma/changes/ (written by a human about the product) and commands from the judge log (reduced to per-day counters). Text is scrubbed of secret patterns and the home path; tools/test-telemetry.py pins all of it with canaries. Sending uses plain HTTP, not MCP: a send that depends on the model remembering to call a tool would repeat the Test status lesson. What was sent is remembered in ~/.cache/telesma/, not in the project (a file there would dirty the tree and block release tagging); a failed send marks nothing and is retried next start. A server older than the client returns rejected ids, and those are resent until it catches up.

Design points that came from analysing real data:

A sender signature (hash of the git email, readable git name) gives attribution, not authentication. Event ids deliberately exclude the sender, so two people on one project produce one event per entry.

12. The first retro’s rules — lessons

The first analysis of the reference project’s events produced three rules, each now in the instructions and in general.md:

  1. A task that adds a mechanism names what triggers it, and one test goes through that entry. The costliest defect class was code built, tested and wired to nothing: a toolbar rendered only in its own test, screens with no navigation entry, a phase that “did not work end to end despite 37 green tests”. The plan had zero - AC: lines across ~1900 tasks, because projects grow through telesma/changes/ and acceptance criteria existed only in plan generation. Now every new mechanism gets - AC: entry — …, a test goes through that entry, and a 30-second check asks “disable the call — does anything go red?”.
  2. A pitfall that came back despite being written down gets a guard, not a pin. A pitfall about a typographic closing quote truncating a string literal was recorded, pinned and loaded into every prompt — and recurred nine times in five weeks. A note works on errors of ignorance, not on errors made by reflex. On the second occurrence a pitfall becomes a mechanical check (guard test, lint rule, grep in the smoke suite) and the row says → guard: <name>; 📌 is reserved for what cannot be checked mechanically.
  3. A rule’s test is verified by mutation — with a procedure that does not wreck the repo. Telesma arrived at manual mutation testing on its own and it kept exposing green tests that guarded nothing; it also wiped uncommitted work with git checkout and once left a MUTANT disabling production validation past the end of a session. general.md now states a four-step procedure, and the commit step greps for MUTANT.

TELESMA_FORMAT was bumped with no migration for this, deliberately: telemetry tells “before” from “after” by the version, and a change without a new number would be invisible to the measurement it was made for.

13. Integrations: repository and tracker

Telesma has no integration by default: it commits to the current branch, never pushes, knows no tracker. Integration instructions are separate files appended only when ## Integrations names them, so a non-integrated project behaves exactly as before and pays no tokens. User doc: docs/INTEGRATIONS.md.

The origin: a test project finished its whole plan and left 77 open PRs. The loop treated a task as done when its PR was opened, knew nothing about required checks or merge, chained every PR on the previous unmerged one — and the PR convention lived only in the session’s memory while the config said “no branches, no push”.

14. Permission judge

An opt-in hook (## Auto-approval) that answers permission prompts on the user’s behalf. Purely a harness feature; the instructions never mention it. Governing rule: the judge only removes prompts, never adds blocks. Anything dangerous still prompts, so the human remains the backstop exactly as before. Layers that recognise danger therefore ask rather than deny — rm -rf node_modules and git push are often legitimate, and denying would remove the user’s ability to approve them.

One exception, learned from the first live trial of the public version (2026-10-22): the whole project ran in Claude Code’s auto permission mode, where the built-in classifier answers prompts and the PermissionRequest hook is never called. 438 decisions by the classifier, 0 by the judge; a PR merged on a red required check, a release tag pushed. “Ask” is only a backstop when someone is asked. So two agent-side rules of the contract — merge only on green required checks, no push of a release tag — moved to the PreToolUse hook as a deny with a reason, because that hook runs in every mode. The layer is kept tiny on purpose (it mirrors what the instructions already forbid), a gh failure never denies, and the human can always do the operation by hand. The same hook leaves a note in the log when it sees auto, the launcher warns at the next start, and it starts Claude with an explicit --permission-mode so a session never begins in auto by accident.

Layers, model last and narrowest:

  1. Hard patterns (rm -rf, sudo, curl | sh, git push, SSH keys, cloud CLIs, package publish, writes to .claude/ or telesma/config.md) → ask. The model never sees them.
  2. Always ask user regexes, obfuscation at the conservative level, and writes disguised as reads → ask.
  3. Read layer — a command whose every member is provably a read inside the project or the working directories passes with no model.
  4. Model judge — only the gray zone. ALLOW skips the prompt; anything else is “no decision”.

Lessons that shaped it:

Variants: command (own script + any OpenAI-compatible endpoint), rules (same script, no model), none, and prompt / agent (Claude Code’s built-in judge hooks, where a guard cannot stop another hook’s allow, so there the guard denies instead of asking).

15. Quality checks

Every quality mechanism used to depend on the model remembering it: review mode had zero recorded uses across projects, and “watch for OWASP” works on errors of ignorance, not on reflexes. Meanwhile a medical project invented red-team tasks on its own — and a red team with mutation, not the implementation’s own tests, found a real authorization hole. It also showed the case nothing guarded: a debugging aid “to be removed before deployment”.

16. Frozen benchmark

Telemetry from real projects cannot isolate a framework change: projects keep growing and the models change. benchmark/bench.py holds everything still except the Telesma version: a small spec (a lending-library REST service on the Python standard library, with system time stored in the database — no dependencies, no clock), a ready plan and index (clarification depends on a human’s answers, so it is skipped), and four change requests built around the defect classes of §12: a mechanism triggered by the day change, a new item type that must work in seven places, a rework with a boundary, and a queue that shows its bugs only with two or more entries. Any edit to those files changes the benchmark fingerprint and makes results incomparable.

The judge is a hidden HTTP-only test suite Telesma never sees, so it measures what a user would see — including code that was built, tested and wired to nothing. The judge earns trust first: the reference implementation must pass everything, and each of five planted faults must be caught. Reported alongside: Telesma’s own test count (the gap between “green at my end” and the outside view is what is being measured), minutes, tokens, models and how many AC: entry lines appeared.

Lessons: one run is an anecdote (compare series of at least three, same model); a run is a real session on the user’s subscription, and the first full run exhausted the session limit halfway, so the harness recognises that and the default run starts from a frozen post-stage-A state. The first series scored 100% on every run for both versions — the benchmark is too easy to separate quality. It did show that the new rules are executed (entry criteria 0 vs 6–11 lines) and cost about four minutes per stage. A benchmark that measures quality needs requests that state the outcome rather than the trigger, and calibration to a 60–90% judge score.

17. Config validation

The launcher once validated the plan but never read config.md as data, so a test command left as the template placeholder ([e.g. pytest -v, npm test]) survived 100 days on the reference project — the model invents a command when the field is a placeholder, and “green suite” then means whatever it guessed. Now every - **Field**: value is parsed per section: missing or placeholder test commands are errors that gate an autonomous start; any other placeholder is a warning; no smoke suite on a large plan is a warning (regressions then surface only at phase end, with no task to attribute them to). Integration fields, the judge endpoint and key forms are validated the same way.

18. Working directories

## Working directories declares directories outside the repo that Claude may touch without prompting (scratchpad, build caches, asset directories). The launcher syncs them into permissions.additionalDirectories — settings entries grant file access only, whereas --add-dir would also load CLAUDE.md, hooks and skills from that directory. Roots that would disable protection rather than configure it (/, ~, /Users, /etc, /tmp, …) are rejected. The judge reads the same section, so rm -r passes only inside working directories, never inside the repo. It also trusts the session scratchpad without configuration: it is the agent’s own workspace, and the “outside the project” rule exists to protect the user’s documents, sibling repositories and system paths — without it the common backup → mutate → restore pattern prompted on every step.

19. One directory in the user’s project

The pre-release version spread itself over the project root: state and config, guidelines, checks, spec/, changes/, artifacts/ — six top-level entries, three of them with generic names that collide with the project’s own (spec/ is also where RSpec and many JS projects keep tests, changes/ and artifacts/ are common build outputs). A reader of the repository could not tell what belonged to the product and what to the tool, and removing the tool meant hunting for its pieces.

Since 1.0 everything Telesma reads or writes lives in telesma/: config.md and the human’s input (spec/, changes/) at the top, what the model writes in state/, what the clone delivers in guidelines/ and checks/, screenshots and recordings in artifacts/. The directory is visible, not hidden — the human edits the spec and the config in it. Two things stay outside on purpose: .claude/ (Claude Code reads its settings and hooks only from there) and docs/RUNBOOK.md + docs/test-scenarios/, which document the product — they stay useful if the project stops using Telesma.

Consequences that keep it cheap: the spec checksum stamp records paths from the project root (telesma/spec/…), so it does not change with the working directory; the check modules find the project root four levels up from their own file; the checks still skip only telesma/checks/ (the state files and the spec are scanned for secrets, as before). The launcher refuses to start on a project still in the pre-release layout, so no project ever ends up with a mixed one.

20. Setup wizard: defaults that work on the first run

The pre-release template shipped with everything optional turned off and, once turned on, turned on all at once. Both halves hurt. A newcomer who followed the README got the bare loop: every Bash command prompted, no checks — and the first thing they did about it, Auto-approve: yes, ran into a judge configured for a local model nobody had (Judge: command, Ollama on port 11434), so the start reported a broken judge instead of fewer prompts. Flipping Checks → Enabled: yes fired all eleven modules, including two that need an attack-surface map and three that need network or tools, and the first commit died under findings the user could not place. The config’s comments explained every key; nobody reads 490 lines of comments before the first run.

Since 1.0 the launcher asks instead of assuming, once, in the order a human can follow:

21. Adopting an existing project

Telesma starts from a specification and an empty directory. A project that already exists — built by hand, or with an assistant used the ordinary way — has neither telesma/spec/ nor a plan, and the obvious worry is that Telesma would plan the next feature without knowing the stages the code went through or the decisions taken along the way. The question was what to reconstruct, and from where: the commit and pull-request history, or the code.

What decided it is what the loop actually reads (§1, §8, §9). After a few phases a project built by Telesma looks to the model exactly like one built by someone else: the code, git, and a distillate — PROJECT_CONTEXT.md plus the spec behind its index. Completed phases collapse to their ids, the task history rotates to an archive nothing loads, DECISIONS.md is grepped, never read. A task history rebuilt from commits would therefore be read by nothing, verified by nothing (no acceptance criteria, no test that belongs to the task) and, in telemetry, would pass for Telesma’s own work. What an adopted project lacks is the distillate and a baseline. Code is the truth about what; git is the only source of why, and a cheap one.

telesma.sh --adopt builds exactly that, in two starts:

Deliberate limits of the first version: the survey samples (the confidence tag per line is what makes that honest); AS_BUILT.md is frozen with the rest of the spec and describes the system at Adopted at — later changes live in the plan and telesma/changes/, as in any project; a tag scheme other than v* is named in the digest, but the launcher still counts only v* tags as releases; the beginner path (--new) has no adoption variant. No structural token was added beyond the two Adopted fields in config.md and the new spec file, so no parser changed; the telemetry state event carries an adopted flag so that adopted and greenfield projects are never compared as one population.

22. The audit of 1.3.2: guarding by reading command text

The first outside-in audit (2026-11-10) read the three mechanisms that supervise the agent — the permission judge, the quality checks, the protection of their own configuration — as an attacker would, and as a careless model would. The evaluation gate was green the whole time: 0 false allows on 220 dangerous cases. Twenty-nine commands outside that set were allowed by the rules alone.

What was wrong was not a rule but the reading. Each mechanism parsed shell text on its own, with regular expressions, and each differently. A << inside quotes was taken for a heredoc and the following lines — rm -rf src, sudo … — dropped as data. A heredoc body with $(…) was dropped too, though the shell runs it. A blocklist of options missed their abbreviations (sort --outp=). The checks computed “what this commit contains” from the literal arguments of git add, so git add -u, a glob, or a message with one odd quote left the scan with nothing to scan — the last one by accident, in the commit form Claude Code uses every day. The rule that followed: what the parser cannot read is a question (judge) or a refusal of the shape (checks), never a pass — and allowlists of exact options replace blocklists wherever a command is called a read.

A gate measures its own set. Rules were tuned on the same 324 cases that gated them, so “zero false allows” was in-sample. There is now a held-out file that no rule is tuned against (it found 28 allows in the old judge on its first run and none in the new one), and a mutation test that respells every dangerous case — quotes inside the command word, git -C ., an assignment prefix, a wrapper, an abbreviated option — and requires that no respelling is allowed. It found one more miss on its first run.

The committed config was executable. telesma/config.md travels with the repository, and it held commands the launcher ran at start (cmd: keys, the adoption baseline), the permission mode and the endpoints. Cloning a project was enough to run its author’s command. The fix is the direnv allow idea: a per-machine record of the hashes of the executable sections; the launcher shows what is new and asks once, and it is the only writer. The hook, the telemetry tool and the lint-types check only read the record, each with its own copy of a ten-line hash — the hook is copied into projects and cannot import anything. The per-machine telemetry opt-in had covered the shared hub only; a custom endpoint now needs the same confirmation.

The supervised could edit the supervision. Exceptions, check modules and the config were protected by matching file paths in tool calls; an interpreter one-liner or a path in another letter case went around it, and approved commands were generalised into wildcards (Bash(python3:*), Bash(find:*)) that were then committed for the whole team. Path comparison is now by real path and case-folded, the generalised families no longer include anything that runs code or deletes, and the launcher compares the installed hook and checks with what it delivered and says so at every start when they differ.

Documentation is part of the contract. Four guarantees in SECURITY.md and CLAUDE.md did not hold as written (own-server telemetry without a per-machine step, checks printing the first characters of a password, exceptions writable without a question, repair deleting additions). Each was either made true or rewritten to say what the code does, and SECURITY.md gained a section on what Telesma does not protect against: there is no sandbox, and instructions to the model about untrusted text (section 0.7) are a mitigation, not a boundary.

Deliberately left for later, because each changes how the loop behaves or what it costs: a sandboxed run, a session budget, an independent verifier before a task is ticked, parallel tasks in worktrees, a git-native pre-commit hook (it collides with a project’s own hooks), and splitting the launcher’s Python heredocs into tested modules. (1.4.0 took up the sandbox and the session budget: §23 and §24.)

23. The task loop in a script: next and done

The audit of §22 had one root: the model ran git add / git commit itself, so the checks had to guess from the text of a command what would be committed, and every bypass found was a new shape of that text. The task history row, the number of tries and the test result were written by the one being measured. Since format 21 the model decides when a task is finished, and a script decides what happens then (tools/telesma-task.py):

Why an explicit command and not a hook: the Stop hook does not fire per task in a continuous session; a hook on the tick in PLAN.md would run minutes of tests inside a hook timeout, with the result poorly visible to the model; a claude process per task gives the cleanest trigger but gives up the continuous session (kept for later). The script runs from the Telesma clone, never copied into the project, and its allow rule is given per session with --allowedTools: written into settings.local.json it would sync into the committed config with a path of one machine.

What it does not do yet: the default allow rules for git add / git commit and the task-branch push rules of the GitHub integration are still written into new configs; the guard refuses those commands anyway, so they are dead weight to remove with a migration.

24. The sandbox: a layer that does not read the command

Everything before this section guards by reading: the judge reads a command’s text, the checks read a diff, the guard reads the shape of a git command. A wrong reading runs with every right the person has. Claude Code’s built-in sandbox (Seatbelt on macOS, bubblewrap on Linux and WSL2) does not read anything — Bash and what it starts write only inside the project, the extra directories and $TMPDIR, and reach the network only through a proxy with a host list. Format 22 writes it from ## Sandbox (templates/setup/sandbox.py) into settings.local.json on every start, after the mode is final.

The fixed values come from a live probe (2026-11-12, Claude Code 2.1.322) on a project the loop had just built:

Measured cost: 1.58 s against 1.44 s for the same 94 tests with a warm cache — the sandbox is not a reason to keep it off. Existing projects get Enabled: no through the merge and a one-line tip; a config the launcher creates starts with yes where the sandbox can run. Native Windows has no sandbox: yes warns, required stops the start. Enabled: no removes the key only while it is still exactly what Telesma wrote, and on every update the hosts and paths the person allowed in Claude Code stay (.git/telesma-task/sandbox.json remembers which values were Telesma’s own).

25. The independent review: a second model, called by the script

Telemetry from four projects (195 tasks, format 23): no session used a subagent, so the model that wrote a task also wrote its tests and judged both; on the reference project about half of the historical bugs were found by the owner or in production, all under green suites. ## Review (tools/telesma_review.py, off by default) puts a reader with no stake between “tests pass” and the commit. The idea of a reviewer without the conversation’s history, and three of its rules, come from Google’s elephant-goldfish model (which reviews design documents, not diffs):

What is Telesma’s own:

Not measured yet: how many real defects a reviewer finds on diffs alone, and how many blockers are false. The log (.git/telesma-review/reviews.jsonl) holds outcome, findings, time and tokens for that.