Guide
When the toolchain repairs
Since M62–M65 a teaching error that names exactly one canonical form is also a repair: ptc fix applies it, and so does every editor, the playground, the MCP server, the generation loops and the POLY-OS Terminal — the same rules everywhere, no model involved.
record Stat:
name: Text
count: Int
fn label(s: Stat) -> Text:
return s.name + ": " + "{s.count}"
fn tally(words: List[Text]) -> List[Stat]:
mut out = []
for w in words:
out.push(Stat(count: w.length, name: w))
return out
fn main() -> Void:
for s in tally(["ab", "cde"]):
print(label(s))Four habits from other languages in one file: + on Text, an empty list with no type, a constructor's fields in the wrong order, .length. ptc fix --check only describes the first error and its fix; ptc fix rewrites the file in place, up to three fixes per run, and says what is left.
ptc fix report.ptptc fix report.ptptc run report.ptThe file after the two runs — every edit is the canonical form its message named, nothing else changed:
record Stat:
name: Text
count: Int
fn label(s: Stat) -> Text:
return "{s.name}: {s.count}"
fn tally(words: List[Text]) -> List[Stat]:
mut out: List[Stat] = []
for w in words:
out.push(Stat(name: w, count: w.len()))
return out
fn main() -> Void:
for s in tally(["ab", "cde"]):
print(label(s))The same rules run everywhere a POLYTONE error appears: as code actions in VS Code and every LSP editor, as the fix button in the playground, as the fix tool of polytone-mcp for Claude Code, Codex and the other agents, as the free first step of the Pro CLI and POLYTONEide loops ("fixed locally" before a paid repair round), and as fix <file.pt> in the POLY-OS Terminal, which writes the repaired file back to its disk. Of the 24 first attempts recorded in the generation baselines, 20 fail in a class these rules repair.