Stop bad output early
TTSR (tool-text stream rules) watches the model’s output as it streams. If forbidden text appears inside a tool call (for example as any inside an edit payload), tsforge stops generation immediately, sends short correction text, and asks the model to retry.
The bad pattern never lands in your files.
Always on.
Built-in rules
Section titled “Built-in rules”| Rule | Blocks | Tells the model |
|---|---|---|
no-as-any | as any | use proper types |
no-ts-suppression | @ts-ignore | fix the real error |
no-empty-catch | empty catch {} | log or handle errors |
no-console-log | console.log | remove debug logging |
These apply to tool argument text under src/**/*.ts(x). Each rule has a cooldown so one mistake does not loop forever.
Custom rules
Section titled “Custom rules”Add your own stream rules in .tsforge/rules.json at the project root. They load on top of the built-ins; a custom rule whose name matches a built-in is ignored, so the built-in safety rules always win.
[ { "name": "no-todo-comment", "condition": ["//\\s*TODO", "//\\s*FIXME"], "guidance": "Do not leave TODO/FIXME markers; finish the work or open an issue.", "scope": "tool-args", "repeatMode": "cooldown", "repeatGap": 5, "fileGlobs": ["src/**/*.ts", "src/**/*.tsx"] }]| Field | Required | Notes |
|---|---|---|
name | yes | Unique; duplicates of a built-in are skipped |
condition | yes | Array of regex sources; matches if any one matches |
guidance | yes | Correction text sent to the model on a hit |
scope | no | tool-args, content, or both (default content) |
repeatMode | no | once (default) or cooldown |
repeatGap | no | Turns between refires when cooldown |
fileGlobs | no | Restrict to matching files; omit to apply everywhere |
Invalid JSON or invalid regex is skipped silently. On load, tsforge reports how many custom rules were registered.
Learned rules
Section titled “Learned rules”tsforge also writes its own TTSR rules: failures it made and then fixed in a repo are mined into .tsforge/learned-rules.json and loaded alongside the built-ins and your custom rules. So a mistake the model keeps making gets caught mid-stream next time. Automatically. See Learning from past runs.
Limits
Section titled “Limits”- 3 interrupts per task, then TTSR turns off for the rest of that task
→ Learning from past runs · Big picture · Environment variables