Reference

The corpus

A corpus is the library of vocabulary and tropes the engine recognizes against. This page describes the artifact — how a corpus is packaged, versioned, loaded, and published. For why it's layered, see the corpus guide; for the words inside it, the vocabulary glossary.

A bag of files

A corpus is a list of { path, source } records — the repo-relative path of each .trl file and its text. The engine loads the bag into one symbol table, and every name in it resolves. Publishing means serving that bag over HTTPS.

What's inside

On disk a corpus is a trl/ directory of four tiers, each building on the ones below (the guide covers the why):

trl/
  prelude.trl        # sigils, types, the universal vocabulary — always in scope
  ontology/          # verb classes and other cross-cutting relations
  concepts/          # abstract nodes a story is about (grief, power, betrayal)
  modules/           # reusable systems of imply + rules (the hero's journey, …)
  tropes/            # the named patterns, one file each
    corpus.toml      #   the manifest
    index.trl        #   the assembled registry (import list) of every entry

A file declares vocabulary and the implications between tags; a trope file adds a recognition rule:

concept ambition [+Abstract]
verb Strikes(target) [+Interpersonal]
imply Grifter -> [Deceptive, Cunning]

The manifest

trl/tropes/corpus.toml names the corpus and carries its distribution metadata — the only file you edit to make a fork your own:

# trl/tropes/corpus.toml
name         = "standard"
tropes       = "trl/tropes"          # the trope tree
index        = "trl/tropes/index.trl" # the assembled file list

id           = "standard"
display_name = "TropeLang Standard Corpus"
version      = "1.7.0"   # the corpus's own number (independent of the engine)
engine_min   = "0.4.0"   # the minimum engine that can parse it — the compatibility floor
license      = "CC0-1.0"

How an editor loads one

A corpus reference is a single URL. An editor accepts three forms, detected from the URL — all three reduce to the same bag of files:

FormYou point the editor atBest for
bundlea published corpus.json (or a channel resolve URL)a shared / production corpus — one cached fetch, sha256-checked
tarballa .tar.gz of the trl/ treefork-and-point with no publish step — fetched & unpacked client-side
nakeda corpus.toml URL (raw git, or a local folder)pointing straight at a fork's repo — no build; follows index.trl + imports

Before loading, the editor checks engine_min against its own engine and refuses a corpus it's too old to parse (rather than mis-reading it). The bundle form additionally carries a sha256 over its contents, verified on fetch. The standard corpus is served at corpus.tropelang.com; the editor defaults to its stable channel.

Versioning

version
The corpus's own number, independent of the engine. Bump it per change — a content edit is a point, a new domain pack a minor, a structural break a major.
engine_min
The minimum engine that can parse the corpus — raise it only when you adopt newer grammar. An editor refuses a corpus whose engine_min exceeds its bundled engine.
channel
A moving pointer (e.g. stable) to a published version. Consumers track a channel; promotion / rollback just repoints it. Each version is immutable once published.

Layering: compose & override

A consumer can stack several corpora: a later source overrides an earlier file of the same name (override), and named files can be removed (strike) — so a domain pack can extend the standard without forking it. A snippet's own declarations win over the corpus.

Override and strike work a whole file at a time. Accretive layering (engine ≥ 0.30.0) works a rule at a time: a layer file that opens with extends "stem" has its rules compiled into the trope with that stem — inheriting the base trope's header metadata, so the added route counts as the same trope rather than a separate lookalike with its own recognition entry and prior. redacts RuleName is the subtractive half — it withdraws a single named rule from the extended trope. Both are an accretion, not an override: they re-merge against whatever base is composed, so upstream edits to the base keep arriving. This replaces the old pattern of striking a trope and shipping a full fork just to add or drop one rule. See the grammar for the forms.

Publishing & contributing

The standard corpus is developed at github.com/kelnishi/tropelang-standard and published to corpus.tropelang.com. Open an issue there for a trope request or correction, or a pull request for a new trope or a founding fix.

To run your own, fork the repo: set your id and version in corpus.toml (add base = "trl/tropes/corpus.toml" to layer on the standard), then add, edit, or strike tropes under trl/. Push to GitHub Pages, or any HTTPS host with CORS, and point an editor at the result by URL — the naked form needs no build step.

See also

Corpus guide
The four tiers, founding, and why a shared vocabulary matters.
Vocabulary glossary
Every documented concept, prop, state, verb, relation, and attribute in the standard corpus.
Grammar
The syntax of the .trl files a corpus is made of.
Coverage & drams
How well a corpus keeps up with the stories people actually write.