1# Chapter 6½: inside rules/src 2 3Two files. `lib.rs` is the whole engine and every rule, in about 500 lines, 4and it reads well from top to bottom: 5 61. **The vocabulary.** `Kind` (yes-or-no, pick, how-much, how-likely), 7 `Fact` (everything that can be known about a question), `Value`, and 8 `Source` (who teaches a fact: Jev, the LLM, or Jev again). 92. **What a rule can say.** `Test` (a fact is a value, or is known), and 10 `Then`: an `End` (stop with this), an `Effect` (go and make a call), or a 11 `Note` (show this; list it). 123. **`RULES`.** The rules themselves, as data. This is the list in 13 chapter 6, and the one place to change what the site does. 144. **`Known`.** What has been learned so far about one question. 155. **`Network`.** `compile` builds the Rete network from the rules; 16 `next` and `decide` say what to do; `alpha`, `join` and `used` are what 17 the diagram draws. 18 19`tests.rs` holds the engine to its promises, including the one that matters 20most: every way the Jev facts can fall ends with something to show or 21something to do (`every_way_the_jev_facts_can_fall_ends_or_does_something`). 22 23> **Try it.** `cargo test -p rules` runs them, offline, in well under a 24> second. 25 26| File | What | 27| --- | --- | 28| [lib.rs](lib.rs) | Facts, tests, rules, `RULES`, `Known`, and the `Network` that compiles and runs them. | 29| [tests.rs](tests.rs) | The engine's tests: each kind of question takes its path, rules share the tests they have in common, a failed test fails what follows it, and every answerable outcome is covered. | 30 31← Previous: [Chapter 6, rules/](../) · Up: [rules](../) · Next: [Chapter 7, ask/](../../ask/) →