Imported from leostera/riot (
packages/typ/AGENTS.md). Install upstream withnpx skills add leostera/riot --skill typ. Copyright stays with the author.
typ AGENTS
typ is Riot's type-checker engine package.
Specs
The docs under packages/typ/docs are the current normative spec stack for
typ.
Start with:
packages/typ/docs/index.mdpackages/typ/docs/checker/index.mdpackages/typ/docs/checker/checker.mdpackages/typ/docs/checker/solver.mdpackages/typ/docs/checker/engine.md
Then use the feature slices that match the work you are doing.
The active implementation direction is deliberately small while the checker is
being rebuilt: parse with Syn, build a single Typ.Ast, run
Typ.Infer.check over that tree, and return an inferred module interface plus
diagnostics through the same path.
The package currently keeps only the minimum runtime surface needed for that path:
Typ.AstTyp.InferTyp.DiagnosticsTyp.Modelsource/path/id helpers
Rules
- Keep semantic work centered on
Typ.Ast; rawSyn.Ast.Node.tand parser events are source-stage details. - Treat source spans and origins as explicit data in long-lived semantic state.
- Keep prototype diagnostics structured and span-backed, even when the checker falls back to holes or recovery nodes.
- Prefer snapshot-heavy examples that dump semantic structure, environments, and diagnostics together.
- Keep prototype scope narrow and explicit; unsupported syntax should surface as recovery plus diagnostics, not silent drops.
- Keep cross-query state explicit. Query-local mutation should stay inside the query boundary.
- Keep structured diagnostic-shape regressions covered by focused snapshots, not only human-readable reports.
- Add checker subsystems back only when a slice needs them, and make their ownership clear from the module name and public interface.
Current Caveat
riot test -p typmay fail snapshots while the expected checker output is being rebuilt aroundTyp.Ast; distinguish compile failures from intentional expected-output drift.
