Engines
A rule has to be enforced by something. Taskless routes each rule to the engine that can decide it, and which engine that is follows from the evidence the rule depends on rather than from a preference.
Which engine, and why
Section titled “Which engine, and why”Start from what decides the rule. Everything else follows.
| The rule is decided by… | Engine | Rules live in | Needs an account |
|---|---|---|---|
| a tool your repo already runs, in that tool’s dialect | linter | that tool’s own config | no |
| one file’s syntax tree | sg |
.taskless/rules/sg/<id>/ |
no |
| a document’s words | vale |
.taskless/rules/vale/<id>/ |
no |
| more than one file, or evidence outside the files | runtime |
.taskless/rules/runtime/<name>/ |
yes |
You do not have to pick. ./.taskless/bin/cli.mjs agent route reads the repository and decides, and the authoring page covers how that decision gets made.
The order matters more than it looks. Naming a destination first and justifying it afterwards is how a rule about prose ends up in sg, and how a question that spans files ends up in vale. State what the rule is decided by, then let the engine follow.
The engines
Section titled “The engines”linter: a tool you already run
Section titled “linter: a tool you already run”If your repository already runs ESLint, Ruff, RuboCop, or Stylelint, a rule that tool can express belongs there. Taskless writes it in that tool’s own dialect, matching the conventions and severity choices your existing config already uses.
Your toolchain enforces it, not Taskless. taskless check does not invoke ESLint, Ruff, RuboCop, or Stylelint. The rule runs the next time your lint step runs, exactly like every other rule in that config. Taskless authors; your tools enforce.
This keeps a rule in the place your team already looks, and it means no new runner in CI for a rule your linter could always have caught.
sg: one file’s syntax tree
Section titled “sg: one file’s syntax tree”The ast-grep engine. It matches against the structure of a single source file, so it catches a pattern regardless of formatting, variable names, or whitespace.
Reach for it when the rule is decided by a call, an import, a JSX attribute, or a type annotation: anything you could point at in one file. Correlating two things within one file is still sg: a useEffect whose dependency array omits a value used in its body is a single-file question, even though it compares two places.
An sg rule carries its own files and ignores, so the rule file is the whole rule. It has its own page, and ast-grep covers the pattern syntax.
vale: a document’s words
Section titled “vale: a document’s words”The prose engine. Where sg makes your codebase’s structure checkable, Vale makes its contents checkable: documentation, README files, commit bodies, and the prose parts of source such as comments.
Vale sees one document at a time. It is the right engine for “no comment should promise future work” and the wrong one for “these twelve pages should agree on a term”. Consistency across documents is evidence outside the file, which makes it a runtime question.
Vale is the engine most likely to be new to you, and the only one with a failure mode that is silent by default. It has its own page, and Vale covers the tool itself.
runtime: evidence beyond one file
Section titled “runtime: evidence beyond one file”When a rule needs to hold two files at once, read git metadata, resolve an alias, follow a config chain, or look outside the repository, no single-file engine can express it. A runtime rule pairs ast-grep capture rules with a check.ts that receives the matches and returns findings.
The capture rules do the cheap work: if nothing matches, check.ts is never invoked. It has its own page, with Anatomy of a Rule covering the layout and the check.ts contract, runtime rules the gate, and Security the execution model.
One rule, one directory
Section titled “One rule, one directory”An sg, vale, or runtime rule occupies its own directory, named for the rule, under its engine:
.taskless/rules/sg/no-eval/ no-eval.yml the rule tests/fail/eval-of-payload/handler.ts a case it must fire on tests/pass/json-parse/handler.ts a case it must stay quiet on
.taskless/rules/vale/no-simply/ no-simply.yml the style: what the rule looks for .vale.ini the scope: which files it applies to tests/fail/simply-in-setup/README.md prose it must flag tests/pass/simple-noun/README.md prose it must leave alone
.taskless/rules/runtime/env-read/ captures/env-read.yml ast-grep rule narrowing which files the check sees check.ts receives those matches and returns findings tests/fail/undeclared/ a case: as many files as it needs tests/pass/declared/What each of those files holds, and the contract a runtime check.ts has to meet, is on Anatomy of a Rule.
Writing a rule means creating that directory. Deleting a rule means deleting it. Nothing outside it is touched either way, so two rules never collide, including two authored at the same time.
A linter rule is the exception. It has no directory here at all: it is written into ESLint’s, Ruff’s, RuboCop’s, or Stylelint’s own configuration, wherever your repository keeps that. This is also why taskless rule delete <id> resolves an id across sg, vale, and runtime only. A linter rule is removed the way any other rule in that tool’s config is removed.
Fixtures are cases, and every engine shares them
Section titled “Fixtures are cases, and every engine shares them”Every rule keeps its fixtures beside it in tests/, in two buckets: tests/fail/<case>/ holds code or prose the rule must fire on, and tests/pass/<case>/ holds what it must leave alone. A case is a directory named for what it shows, holding as many files as the case needs.
verify runs each case like a small repository: the case directory is the project root, and the rule’s own scope applies to it exactly as it applies to your code. A rule with files: [".github/workflows/*.yml"] reads tests/fail/<case>/.github/workflows/ci.yml; a bare tests/fail/<case>/ci.yml is outside its scope, and verify fails the case and says so. That is deliberate. A fixture that only passes because the runner ignored scope proves nothing about the rule check will run.
Anatomy of a Rule covers how a case is judged.
Before CLI 0.13.4, fixtures lived in a dot-directory, .tests/, and ast-grep’s took a different shape from the other two engines’. The first install after upgrading converts them and names anything it could not.
What needs an account
Section titled “What needs an account”Three of these engines need nothing from us. One does.
- In the Taskless Open Source CLI: linter,
sg, andvale. They run locally and offline, with no account and no network call. - Requires a Taskless Cloud account:
runtime.
The reason for that split is worth stating plainly, because the obvious guess is wrong.
Runtime rules are gated because they execute code, not because they are a paid feature. An sg or vale rule is inert data. Whatever is in it, the worst a bad one does is report something wrong. A check.ts is a program that runs on your machine with your permissions, and a rule file arriving in a pull request is code arriving in a pull request. So Taskless signs each check.ts, reconciles the signature with the service, and runs only what comes back verified.
That is a property of executing code. It says nothing about how capable an engine is. sg and vale rules are not less trusted, they are unexecuted.
In particular, checking prose costs nothing and needs no account. Vale is available in the Taskless Open Source CLI, like ast-grep.
Validating and verifying a rule
Section titled “Validating and verifying a rule”Whichever engine authored it, two commands close the loop:
./.taskless/bin/cli.mjs validate .taskless/rules/vale/no-simply/./.taskless/bin/cli.mjs verify .taskless/rules/vale/no-simply/validate checks that a rule has the components its engine requires, from its files alone. verify runs its fixture cases, after validating it first.
verify exits 0 only when every rule you named ran and passed. It exits 1 when a rule failed, and 2 when nothing failed but a rule did not run. A runtime rule’s fixtures execute its check.ts, so they run only with --dangerously-run-scripts; without the flag that rule is reported with "ran": false, and the exit is 2. Exit 2 is not a broken rule, but it is not a pass either: a rule that did not run has shown nothing. Before CLI 0.13.6 that case exited 0.
Before CLI 0.13 these were named verify and test. A hook or script that still calls test fails as an unknown command; one that calls verify for the quick check now runs the fixtures too.
validate matters most for Vale, where an incomplete rule does not error. It simply never fires. See Vale.