Skip to content

Write your first file

You have a table of quarterly rents by market and sector. Two columns come from two vendors: asking rent from vendor_a and effective rent from vendor_b. You load each vendor's file when it arrives. By the end of this page your agent will have written files that declare the table, checked with a checker, and you will have seen what an agent reads from them.

Your agent writes these files; you decide and review. Each step below shows what the agent writes, and what you check. Ask it in plain words: "Describe the Rents table for the oryxkb/ folder: what one row is, a unit and a description for every column, the release each vendor's data comes from, and what an agent must know. Leave out anything you cannot find in the code or the data." Every key used here is defined in the spec.

It takes six steps and a review. The complete files are in Examples.

1. The project file

The agent creates oryxkb/project.yaml in the folder that holds the data or the code that builds it. It describes what the data is; the facts go in a second file in step 5:

version: 1
project:
  name: rents-research
  owner: data-team
  sources:
    vendor_a: Quarterly asking-rent file from vendor A
    vendor_b: Quarterly effective-rent file from vendor B

You check: the project name is the one other projects will use, and each vendor feed is named once, with one line saying what it is. The same names come back in step 4.

2. What one row is

datasets:
  Rents:
    purpose: Quarterly rent per market and sector, from vendors A and B.
    grain: [market_id, sector, period_yq]

purpose is the first line an agent reads. grain lists the columns that identify one row: here, one row per market, sector and quarter. Grain is the most useful line in the file: it tells an agent what a sum means and which joins are safe.

You check: the grain is true. If two rows can share a market, sector and quarter, it is wrong.

3. Every column: type and unit

    columns:
      market_id:
        type: string
        description: market code
      sector:
        type: string
        description: property sector
      period_yq:
        type: string
        description: calendar quarter, written 2026Q3
      asof_a:
        type: date
        description: as-of date of the vendor A file this row came from
      rent_a:
        type: number
        description: vendor A asking rent
        currency: USD
        per: year
        per_unit: "[sft_i]"
      rent_b:
        type: number
        description: vendor B effective rent
        currency: USD
        per: year
        per_unit: "[sft_i]"
  • type is how the value is stored (string, number, date, ...). A tool fills it from the data when it publishes. Codes such as market_id stay string, so leading zeros survive. With the units, the types make up the dataset's schema.
  • Money takes currency (an ISO code), per (the period, for a flow such as rent) and, for money per something, per_unit: here US dollars per year, per square foot ([sft_i]).
  • Other numbers take unit, for example unit: decimal for a fraction where 0.012 means 1.2%. See Common units.

You check: the units. The agent never guesses a unit; where the code and the data do not show one, it asks you. A wrong unit here is the commonest cause of a wrong answer.

4. Which release each vendor's data is

dates_asof gives the as-of date of each source: which release of the vendor's data the table reflects.

    dates_asof:
      vendor_a:
        column: asof_a
        cadence: quarterly
      vendor_b:
        constant: "2026-09-30"
        cadence: quarterly

Two forms, for two common cases:

  • column: the load step writes the release date of the vendor A file into the column asof_a. This stays right when the next file arrives, and is preferred when possible.
  • constant: a fixed date. Simple, but it must be updated when a new vendor B file is loaded; nothing notices a stale constant.

Then each value column is linked to its source, so a citation of rent_a names only vendor A: as_of_sources: [vendor_a] on rent_a, [vendor_b] on rent_b. Other forms (param, from_input) are for pipelines: see Which form to use.

You check: each date is the release date, not the day the file was downloaded.

5. What an agent must know

The two rent columns look alike but measure different things. That goes in a second file, oryxkb/facts.yaml, which holds every fact of the project:

facts:
- kind: quirk
  id: asking-vs-effective
  statement: "rent_a is asking rent and rent_b is effective rent (after incentives): compare each with itself over time, never average or subtract them"
  about: [Rents#rent_a, Rents#rent_b]
  impact: important
  as_of: 2026-11-13
- kind: quirk
  id: market-id-text
  statement: market_id codes have leading zeros, such as 04567; read it as text or they are lost
  about: [Rents#market_id]
  impact: important
  as_of: 2026-11-13
  • kind says what sort of statement it is. Both are a quirk: something odd in the data, with its consequence in the same line. A rule is an instruction with nothing odd behind it ("do not fill missing rent with zero"); rather than write the same sentence as a rule and as a quirk, the agent writes one quirk. A house choice with nothing odd in the data behind it ("quote asking rent in memos") is a rule. The decision test is on Facts.
  • about says what the fact is about: here columns, written Dataset#column. A fact about the whole project has no about.
  • impact says how much it matters. Both are important: ignore them and some answers are wrong. critical means the answer is wrong whenever it is ignored; write it sparingly (check hints when more than a quarter of the facts are critical).
  • as_of is the day the fact was written. Where nobody knows the date, the agent leaves it out: a tool shows when the line entered git.
  • A new fact is proposed and shows as [unreviewed] until you review it (the review step below).
  • Write about as a one-line list for plain ids like these; an id with ?, a space or : goes in a block list or in quotes, which oryxkb's writers do for you (Facts).

Optionally, the agent adds a profile block that shapes the coverage the agent will see (see Profile fields):

    profile:
      period: period_yq
      entities: [market_id]
      coverage_by: [sector]

You check: every statement is true and says what to do differently. If a statement is only a count ("12,000 rows"), it does not belong: counts are generated from the data.

6. Check the files

Install oryxkb, the first implementation; its install steps are in the oryxkb docs. From the project folder, the agent (or you) runs:

oryxkb check

With no path it checks the whole oryxkb/ folder: the project file and the facts.

Suppose the agent had made two slips: unit: USD on rent_a instead of currency: USD, and a fact about Rents#rent_c, a column that does not exist. The check reports both, with file and line:

ERROR oryxkb/project.yaml:39: datasets.Rents.columns.rent_a.unit: 'USD' is a currency code: currency is not a UCUM unit: use currency: USD
ERROR oryxkb/facts.yaml:6: about 'Rents#rent_c': no column rent_c in Rents
1 dataset; 2 warnings (2 ERROR)
2 things to fix: oryxkb/project.yaml:39: datasets.Rents.columns.rent_a.unit: 'USD' is a currency code: currency is not a UCUM unit: use currency: USD; oryxkb/facts.yaml:6: about 'Rents#rent_c': no column rent_c in Rents

After the fix, it reports:

1 dataset; 0 warnings (0 ERROR)
ready to publish/hand off
  • The summary counts every reported line as a warning, and says how many of them are errors.
  • The plain check always lets you carry on. oryxkb check --strict exits with status 1 when there are errors, for CI.
  • Checks that need the data itself, such as "every declared column is in the data", run when the tool can read the data. With the files alone, it checks the files.

The review

The checker confirms the files are well formed and the ids resolve. It cannot tell you a statement is true. You review the facts; the agent sets status: reviewed and reviewed_by: <your name> on each one you confirmed, and on nothing else. A fact left proposed still reaches the agent, labelled [unreviewed]: nothing is blocked. How review fits with the agents' work: How agents and people work together.

What the agent gets

A tool renders these files, plus counts from the data, into a card. For these files, with a small synthetic pipeline behind them, oryxkb writes (all counts synthetic):

## Rents
Quarterly rent per market and sector, from vendors A and B. (D)

```python
src = oryxflow.FlowImport('rents-research')   # or FlowImport(path='<path to rents-research>')
@oryxflow.requires(src.Rents)
```

Build (G): prod, built 2026-11-19T08:25:47Z, git d85add6, params `{}`.
Change (G): rents-research/Rents changed vs build 2026-11-19T08:25:38Z: 756 rows in [asof_a]; retyped asof_a timestamp -> date.
Location (G): data/Rents/Rents__99914b932b-data.parquet.

**Sources** (D; as-of values G)
- vendor_a: Quarterly asking-rent file from vendor A; as-of: 2026-09-30 (quarterly)
- vendor_b: Quarterly effective-rent file from vendor B; as-of: 2026-09-30 (quarterly)

**Schema**
Grain (D): one row per market_id x sector x period_yq.

(type, nulls, distinct: G; unit, description, facts: D)

| column | type | nulls | distinct | unit | description | facts |
|---|---|---|---|---|---|---|
| `market_id` | string | 0 | 6 |  | market code | important quirk: market_id codes have leading zeros, such as 04567; read it as text or they are... |
| `sector` | string | 0 | 2 |  | property sector |  |
| `period_yq` | string | 0 | 67 |  | calendar quarter, written 2026Q3 |  |
| `asof_a` | date | 0 | 1 |  | as-of date of the vendor A file this row came from |  |
| `rent_a` | number | 0 |  | USD, per year, per [sft_i], sources: vendor_a | vendor A asking rent | important quirk: rent_a is asking rent and rent_b is effective rent (after incentives): compare... |
| `rent_b` | number | 0 |  | USD, per year, per [sft_i], sources: vendor_b | vendor B effective rent | important quirk: rent_a is asking rent and rent_b is effective rent (after incentives): compare... |

**Coverage**
Rows (G): 756.
Entities (G): 6 market_id.
Coverage (G): period_yq 2010Q1..2026Q3; 12 series by market_id x sector; 12 reach the latest period; 0 have gaps.
By sector (G): industrial 2012Q1..2026Q3, 354 rows, 6 market_id; office 2010Q1..2026Q3, 402 rows, 6 market_id.

**Quirks**
- **important** market_id codes have leading zeros, such as 04567; read it as text or they are lost (Rents#market_id; as of 2026-11-13; id market-id-text) [unreviewed]
- **important** rent_a is asking rent and rent_b is effective rent (after incentives): compare each with itself over time, never average or subtract them (Rents#rent_a, Rents#rent_b; as of 2026-11-13; id asking-vs-effective) [unreviewed]

Other builds: `oryxkb card rents-research/Rents --builds`.

(+detail): oryxkb facts <id> --full shows the full text.

How each line maps to the files: What an agent sees. Before any build, with the files alone, the card shows only what is declared: types show as -, and nulls, distinct counts and coverage come from a build.

The next session

A week later a new session asks for rent by market. The agent reads the card first (oryxkb card rents-research/Rents) and keeps asking and effective rent apart, as the quirk says. While it works it learns that the team quotes asking rent in memos, a house choice nobody wrote down, and adds one fact to facts.yaml:

facts:
- kind: rule
  statement: quote asking rent (rent_a) in memos; effective rent only when the memo says so
  about: [Rents#rent_a, Rents#rent_b]
  status: proposed

It runs oryxkb check and commits. From now on the card lists the rule under Rules, marked [unreviewed], and every later session applies it until you confirm it. The full routine for a session: How an agent uses it.

Next

  • Which fields matter most and what to add next: What to write first. This page covered the Critical tier and part of the Important tier.
  • More facts: definition and recipe facts, and relationships for joins (Facts, Relationships). Complete files with every kind: Examples.
  • When a vendor's file changes shape or a column is renamed: Schema changes.
  • When other projects read this table: Producers and consumers and Communication.
  • One metric from two vendors can also be one column plus a vendor column; then grain includes vendor. Both shapes work; this page used two columns.