tscircuit-autorouter
AGENTS.md101 starsChanged 3 months agoMITView on GitHub
Don't format or lint the code. Do not edit README.md unless the user explicitly requests README changes. - Run tests, builds, and focused checks locally by default. - Use Blacksmith only for benchmark runs unless the user explicitly asks to use Blacksmith for another validation task. When changing or reviewing solver visualize() / preview() output, use the tscircuit-visualization skill. Prefer existing graphics artifact tooling instead of ad hoc screenshots: - Use PipelineStageDebugRunner for per-stage artifacts. - Use scripts/run-sample.ts --ai-visuals to…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- blacksmith-testboxSkill
- tscircuit-create-solverSkill
- tscircuit-performance-improvement-workflowSkill
- tscircuit-visualizationSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
22 rules. About 0 are common, 12 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 6
Start development server: bun run start
- Very specific: line 8
Run specific test: bun test tests/svg.test.ts
- Distinctive: line 16
Run tests, builds, and focused checks locally by default.
- Distinctive: line 17
Use Blacksmith only for benchmark runs unless the user explicitly asks to use Blacksmith for another validation task.
- Very specific: line 22
When changing or reviewing solver visualize() / preview() output, use the tscircuit-visualization skill.
- Distinctive: line 25
Prefer existing graphics artifact tooling instead of ad hoc screenshots:
- Very specific: line 27
Use PipelineStageDebugRunner for per-stage artifacts.
- Very specific: line 28
Use scripts/run-sample.ts --ai-visuals to export PNG, SVG, GraphicsObject JSON, and per-step PNGs.
- Very specific: line 30
If you need Pipeline 7 visuals colored by net instead of layer, use --net-colors.
- Distinctive: line 59
Use TypeScript with strict typing enabled
- Very specific: line 60
Naming: Use camelCase for variables/functions and PascalCase for classes/interfaces.
- Distinctive: line 65
Components: Create React components with proper type definitions
- Distinctive: line 66
Error handling: Use try/catch for recoverable I/O at the edges.
- Distinctive: line 67
Formatting: Use Biome for consistent formatting (2-space indentation, double quotes for JSX)
- Distinctive: line 68
Comments: Add meaningful comments for complex logic, avoid unnecessary comments
- Distinctive: line 70
Avoid over-abstraction. Prefer direct code until a helper removes real duplication or clarifies a genuinely complex operation.
- Distinctive: line 72
Do not create functions smaller than 6 lines.
- Distinctive: line 75
Always define function return types in new code.
- Distinctive: line 82
Keep diffs to the requested fix.
- Very specific: line 92
When writing visualization snapshot tests, read the tscircuit-visualization skill first.
- Very specific: line 94
When running tests locally, pass a large timeout, such as --timeout 9999999.
- Very specific: line 96
When asked to update snapshots, run BUN_UPDATE_SNAPSHOTS=1 bun test --timeout 9999999.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Capacity Node Autorouter Development Guide
Commands
- Build:
bun run build - Start development server:
bun run start - Run tests:
bun test - Run specific test:
bun test tests/svg.test.ts
Don't format or lint the code.
Do not edit README.md unless the user explicitly requests README changes.
Validation Policy
- Run tests, builds, and focused checks locally by default.
- Use Blacksmith only for benchmark runs unless the user explicitly asks to use Blacksmith for another validation task.
Visualization Debugging
When changing or reviewing solver visualize() / preview() output, use the
tscircuit-visualization skill.
Prefer existing graphics artifact tooling instead of ad hoc screenshots:
- Use
PipelineStageDebugRunnerfor per-stage artifacts. - Use
scripts/run-sample.ts --ai-visualsto export PNG, SVG, GraphicsObject JSON, and per-step PNGs. - If you need Pipeline 7 visuals colored by net instead of layer, use
--net-colors. - Inspect the generated PNGs before making visual changes.
For pipeline 7 first-stage visual debugging, use:
bun scripts/run-sample.ts \
--pipeline 7 \
--dataset srj18 \
--sample 1 \
--effort 0.1 \
--stop-after-stage componentDetectionSolver \
--ai-visuals \
--net-colors \
--out-dir /tmp/pipeline7-visualsFallback Logic
When a solver hits a state it can't explain, fix the root cause or throw. Do not add a fallback.
Fallback logic is an anti-pattern here and a common mistake when extending the solvers. A fallback is any code that lets the pipeline keep running after something went wrong instead of surfacing it: catching a thrown error and continuing as if it succeeded, ?? [] / || default on data that should always exist, "if strategy X fails, silently try Y", or marking a solve solved when it actually failed. Because the pipeline keeps going, the result isn't a crash you can debug — it's a silently wrong board.
- Don't:
TinyHypergraphPortPointPathingSolver._stepcatches the thrown error and callsfinishWithExistingSolverState, which setssolved = true; failed = false; error = null. Astart regions not found/regions not founderror means region computation is broken upstream — fix why the region list is empty; do not add another branch that guesses around it. - Do:
assertDefined(startRegion, 'Could not find start region for connection "..."')inbuildHyperGraph.ts— fail loud, named, specific. - The "avoid throwing" note under Code Style applies to recoverable I/O at the edges, not to solver-internal invariants. A loud failure on bad input beats a plausible-looking wrong route.
Code Style Guidelines
- Use TypeScript with strict typing enabled
- Naming: Use camelCase for variables/functions and PascalCase for
classes/interfaces. A focused source file should match its primary export
exactly (for example,
getNodeEdgeMap.tsorCapacityMeshEdgeSolver.ts). Multi-export utility and type modules may use a descriptive camelCase name. - Imports: Organize imports according to Biome rules (auto-organized when formatting)
- Components: Create React components with proper type definitions
- Error handling: Use try/catch for recoverable I/O at the edges; do not swallow solver-internal errors. See Fallback Logic above — throw on unexpected/invalid solver state rather than adding a fallback.
- Formatting: Use Biome for consistent formatting (2-space indentation, double quotes for JSX)
- Comments: Add meaningful comments for complex logic, avoid unnecessary comments
- Export patterns: Export classes/functions directly from their definition files
- Avoid over-abstraction. Prefer direct code until a helper removes real duplication or clarifies a genuinely complex operation.
- Do not create functions smaller than 6 lines.
- Define types near the start of new code so variables, function parameters, and return values have explicit types.
- Always define function return types in new code.
- Structure types so invalid states are not representable where practical.
- Make solver invariants required in the type system; use
OrThrowhelpers at boundaries where invalid external data must be rejected. - Name shared metadata for its domain role, not its current producer (for
example,
connectedTo, notobstacleConnectedTo). Avoid prefixes; if one defines a category, apply it consistently to every member of that category. - Keep diffs to the requested fix. Do not add precautionary or adjacent refactors without asking first.
- ONE TEST PER FILE
Architecture
The codebase follows a modular architecture with solvers handling different aspects of autorouting. The main export is the AutoroutingPipelineSolver which orchestrates the routing process and contains all the stages.
Writing tests
When writing visualization snapshot tests, read the tscircuit-visualization
skill first. Do not set timeouts in test code; CI controls test timeouts.
When running tests locally, pass a large timeout, such as --timeout 9999999.
When asked to update snapshots, run
BUN_UPDATE_SNAPSHOTS=1 bun test --timeout 9999999. If only specific tests are
failing because of a change, update only those failing tests. Do not spend time
updating every test.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

