Rules and instructions
Write standing instructions every Code thread reads first — conventions, preferences, what you'd tell a new engineer — with triggers, versions, and how to check a rule was used.
On this page
Rules and instructions are the standing instructions every Code thread loads before it touches code: the conventions you would tell an engineer on their first day that aren’t written down in the repository. Use them for anything you’d otherwise repeat in every brief. This page covers what makes a good rule, account and repository rules, triggers, versions, and managing rules; for facts carried across Ask conversations, use Memory.
The rule#
Every Code thread loads the rules that are on before it touches code, at most 16 per thread, the most relevant first. A rule with a trigger loads only when the work matches it. A thread records the exact version of each rule it used, so a later edit never changes what past work was told.
What makes a good rule#
- Use
pnpm, nevernpm. - All money is stored in minor units as integers.
- New endpoints need an OpenAPI entry and an integration test.
- Don’t edit generated files under
src/gen/; change the schema instead. - UI copy is British English.
Keep each rule to one idea: short, specific rules are applied more reliably than a long style guide.
Kinds of rule#
| Kind | Applies to |
|---|---|
| Account rule (For: Every repository) | All your work |
| Repository rule | One repository: its conventions and gotchas |
| Standing rule (no trigger) | Always eligible |
| Triggered rule | Only work whose goal and criteria match the trigger, such as migration or schema |
| Built-in rule (“built in”) | Can only be switched on or off |
| Platform guidance | Ysra’s own guidance, read-only, listed under Show |
Managing rules#
Rules live under Library → Rules & instructions, in the web app or the desktop app; both show the same rules, and threads in the desktop app and the CLI load them.
| Action | What happens |
|---|---|
| New rule | Asks for a Title, The rule, When it applies (optional) (empty applies it to all work) and For (Every repository or one repository). Add rule saves it: “Rule added. New threads load it.” |
| Edit → Save rule | Saves a new version: “Rule saved. New threads load this version.” Old versions stay visible. |
| The On switch | Turns the rule on or off. |
| Delete | Asks “Delete this rule?”, then Delete or Keep. |
| History | The rule’s Versions, and Loaded by: the work that loaded it. |
Each rule shows its repository (or “built in”), its trigger, its version and how many times it was loaded.
Limits#
| Limit | Value |
|---|---|
| Rules loaded into one thread | 16 |
If a rule isn’t followed#
| Symptom | Why | What to do |
|---|---|---|
| The thread didn’t load the rule (Loaded by doesn’t list it) | It is off, its trigger didn’t match, it is for another repository, or more relevant rules filled the 16 places. | Check the switch and For; make the trigger broader, or remove rules you don’t need. |
| It loaded an old version | The thread started before your edit. | New threads load the new version. |
| The rule was loaded but not followed | It is long or mixes ideas. | Split it into one idea per rule. |
Related#
- Memory — facts and preferences for Ask.
- Plans and acceptance criteria — what a single brief can require.
- Ysra Code — where rules fit in a thread.
