Overview#
This page lists every okb command, grouped by what you are trying to do. Each entry shows what the command does, an example, and a table of its arguments. For the commands you will use most, see the cheat sheet. In your terminal, okb help prints a short summary.
Angle brackets like <name> mark a required argument, and square brackets like [name] mark an optional one. Two options work with most commands:
| Argument | Type | Description |
|---|---|---|
-C |
path | The ontology folder. Defaults to the current folder. |
--json |
flag | Print machine-readable output, for commands that support it. |
Tip: When a class and a slot share a name, say which one you mean with
class:Genreorslot:genre.
Getting started#
okb init#
Creates a new ontology folder with the starting files and shows the guide for step 1.
$ okb init wine --name "Wine and Food"
Arguments#
| Argument | Type | Description |
|---|---|---|
<folder> |
path | Where to create the ontology. |
--name |
text | The ontology’s name. Defaults to the folder name. |
okb status#
Shows which step you are on, what is done, and what to do next.
$ okb status
okb step#
Moves between the eight steps and shows the guide for a step.
$ okb step
$ okb step next
$ okb step 4
Arguments#
| Argument | Type | Description |
|---|---|---|
[n|next|prev] |
number or word | The step to move to: 1 to 8, next, or prev. Moving on with a step unfinished is allowed. |
okb explain#
Explains a concept, rule, step or decision guide in plain language.
$ okb explain class
$ okb explain 5
$ okb explain --search inverse
Arguments#
| Argument | Type | Description |
|---|---|---|
[topic] |
text | A concept, rule key, step number or decision guide. |
--search |
text | Find entries that mention these words instead. |
okb validate#
Checks your ontology against the rules. Errors make the command exit with code 1.
$ okb validate
$ okb validate --all --why
Arguments#
| Argument | Type | Description |
|---|---|---|
--all |
flag | Include warnings and hints from steps you haven’t reached. |
--why |
flag | Show why each rule exists. |
--rule |
rule key | Run only this rule. Repeat it for more. |
--strict |
flag | Also exit with code 1 on warnings. |
--json |
flag | Print the findings as JSON. |
Planning#
okb scope#
Records the domain, purpose, users and boundaries of the ontology. With no flags it shows what you have.
$ okb scope --domain "Wine and food pairing" --purpose "Recommend wines for a meal" --users sommeliers,cooks
Arguments#
| Argument | Type | Description |
|---|---|---|
--domain |
text | What the ontology covers. |
--purpose |
text | What it is for. |
--users |
list | Who will use it. |
--maintainers |
list | Who keeps it up to date. |
--out-of-scope |
list | What it deliberately leaves out. |
--kind |
text | The kind of ontology, such as a domain ontology. |
--name |
text | Rename the ontology. |
okb cq#
Manages competency questions: the questions your ontology must be able to answer.
okb cq add#
Adds one or more questions.
$ okb cq add "Which wines go with fish?"
Arguments#
| Argument | Type | Description |
|---|---|---|
<question> |
text | The question. Quote it. |
okb cq list#
Lists the questions and what each one needs. Bare okb cq does the same.
$ okb cq list
okb cq link#
Says which classes, slots or instances a question needs. Use unlink to undo it.
$ okb cq link 1 Wine Food goesWellWith
Arguments#
| Argument | Type | Description |
|---|---|---|
<number> |
number | The question’s number. |
<name>... |
names | The classes, slots or instances it needs. |
okb cq set#
Changes a question’s text or marks it answerable.
$ okb cq set 1 --status answerable
Arguments#
| Argument | Type | Description |
|---|---|---|
<number> |
number | The question’s number. |
--text |
text | New wording. |
--status |
draft or answerable | Whether the ontology can answer it yet. |
okb cq remove#
Deletes a question.
$ okb cq remove 3
Arguments#
| Argument | Type | Description |
|---|---|---|
<number> |
number | The question’s number. |
okb reuse#
Records which existing ontologies you looked at and what you decided about each.
okb reuse add#
Records one ontology you considered.
$ okb reuse add --name FOAF --url http://xmlns.com/foaf/spec/ --decision reference
Arguments#
| Argument | Type | Description |
|---|---|---|
--name |
text | The ontology’s name. |
--decision |
reuse, adapt, reference or rejected | What you decided. |
--url |
url | Where it lives. |
--notes |
text | Why. |
okb reuse none#
Records that you looked and found nothing that fits.
$ okb reuse none --why "Checked schema.org and FOAF; neither covers wine."
Arguments#
| Argument | Type | Description |
|---|---|---|
--why |
text | What you looked at and why nothing fit. |
okb reuse list#
Lists what you recorded. Bare okb reuse does the same.
$ okb reuse list
okb term#
Collects the important words of your domain, then decides what each one becomes.
okb term add#
Adds terms to the list.
$ okb term add wine grape winery color
Arguments#
| Argument | Type | Description |
|---|---|---|
<term>... |
text | One or more terms. Quote multi-word terms. |
--note |
text | A note to keep with them. |
okb term list#
Lists terms grouped by what you decided. Bare okb term does the same.
$ okb term list
okb term set#
Decides what a term becomes.
$ okb term set wine --as class
$ okb term set vintage --as synonym --node Year
Arguments#
| Argument | Type | Description |
|---|---|---|
<term> |
text | The term. |
--as |
class, slot, instance, value, synonym or out-of-scope | What it becomes. |
--node |
name | The class, slot or instance it became or points to. |
--note |
text | A note about the decision. |
Modeling#
okb convention#
Sets how names are written, so the validator can check them. With no flags it shows the current choices.
$ okb convention --class-case PascalCase --slot-case camelCase --number singular
Arguments#
| Argument | Type | Description |
|---|---|---|
--class-case |
text | Case for class names, such as PascalCase. |
--slot-case |
text | Case for slot names, such as camelCase. |
--instance-case |
text | Case for instance names. |
--number |
singular or plural | Whether class names are singular or plural. |
--slot-affix |
text | A prefix or suffix every slot name carries, if any. |
okb class#
Creates and changes classes, the kinds of things in your domain.
okb class add#
Adds a class.
$ okb class add RedWine --parent Wine --desc "Wine made with dark grapes"
Arguments#
| Argument | Type | Description |
|---|---|---|
<Name> |
text | The name, in the case your naming convention asks for. |
--parent |
class | A parent class. Repeat it for more. |
--desc |
text | A one-line description. |
--synonym |
text | Another name for it. Repeat it for more. |
--abstract |
flag | Mark it as a grouping with no members of its own. |
--terminological |
flag | Mark it as terminological. |
--force |
flag | Add it even if the name breaks your convention. |
okb class set#
Changes a class.
$ okb class set RedWine --add-parent Beverage
Arguments#
| Argument | Type | Description |
|---|---|---|
<Class> |
class | The class to change. |
--desc |
text | New description. |
--add-parent |
class | Add a parent. |
--remove-parent |
class | Remove a parent. |
--synonym |
text | Add a synonym. |
--abstract |
true or false | Whether it is abstract. |
--terminological |
true or false | Whether it is terminological. |
okb class disjoint#
Says that no one thing can belong to more than one of these classes.
$ okb class disjoint RedWine WhiteWine RoseWine
Arguments#
| Argument | Type | Description |
|---|---|---|
<Class>... |
classes | Two or more classes. |
okb class fix#
Gives every member of a class the same value for a slot.
$ okb class fix DessertWine sugar=sweet
Arguments#
| Argument | Type | Description |
|---|---|---|
<Class> |
class | The class. |
<slot=value>... |
slot=value | The values every member has. |
okb class default#
Gives a class a starting value for a slot that individual members can override.
$ okb class default Wine body=full
Arguments#
| Argument | Type | Description |
|---|---|---|
<Class> |
class | The class. |
<slot=value>... |
slot=value | The starting values. |
okb class restrict#
Narrows a slot for one class: fewer values, a limit on how many, or a narrower range.
$ okb class restrict SingleVarietal grape --max 1
Arguments#
| Argument | Type | Description |
|---|---|---|
<Class> |
class | The class. |
<slot> |
slot | The slot to narrow. |
--values |
list | Allowed values. |
--min |
number | The fewest values allowed. |
--max |
number | The most values allowed. |
--range |
class | Allowed classes, for a relationship. |
--clear |
flag | Remove the restriction. |
okb tree#
Prints the class hierarchy as an indented tree.
$ okb tree
$ okb tree --instances
Arguments#
| Argument | Type | Description |
|---|---|---|
--instances |
flag | Show instances under their classes. |
okb property#
A slot that holds a plain value, such as a number, text or one of a fixed list. It takes the same subcommands as okb slot.
okb property add#
Adds a property to a class.
$ okb property add body --on Wine --type Enumerated --values light,medium,full --card single
Arguments#
| Argument | Type | Description |
|---|---|---|
<name> |
text | The name, in the case your naming convention asks for. |
--on |
class | The class it belongs to. |
--type |
String, Integer, Float, Boolean or Enumerated | What kind of value it holds. |
--values |
list | The allowed values, for Enumerated. |
--card |
single or multiple | Whether it holds one value or several. |
--desc |
text | A one-line description. |
okb relationship#
A slot that links one thing to another, such as a wine to its winery. Okb stores it as edges, so maker becomes :MAKER.
okb relationship add#
Adds a relationship between two classes.
$ okb relationship add maker --from Wine --to Winery --card single
Arguments#
| Argument | Type | Description |
|---|---|---|
<name> |
text | The name, in the case your naming convention asks for. |
--from |
class | The class the relationship starts at. |
--to |
class | The class it points to. |
--card |
single or multiple | Whether it holds one target or several. |
okb relationship inverse#
Declares that two relationships are the same link read from opposite ends.
$ okb relationship inverse maker produces
Arguments#
| Argument | Type | Description |
|---|---|---|
<slotA> |
slot | The relationship that is stored. |
<slotB> |
slot | Its inverse. |
okb relationship property#
Adds a property to a relationship itself, such as the condition under which one thing is preferred over another.
$ okb relationship property preferredOver condition --type String
Arguments#
| Argument | Type | Description |
|---|---|---|
<relationship> |
slot | The relationship. |
<name> |
text | The property’s name. |
--type |
String, Integer, Float, Boolean or Enumerated | What kind of value it holds. |
--values |
list | The allowed values, for Enumerated. |
--required |
flag | Every link must give it a value. |
--desc |
text | A one-line description. |
--remove |
flag | Remove the property. |
okb slot#
Creates and changes slots, the properties and relationships of a class. okb property and okb relationship are friendlier names for the same command.
okb slot add#
Adds a slot to a class.
$ okb slot add body --on Wine --type Enumerated --values light,medium,full
Arguments#
| Argument | Type | Description |
|---|---|---|
<name> |
text | The name, in the case your naming convention asks for. |
--on |
class | A class it belongs to. Repeat it for more. |
--type |
String, Integer, Float, Boolean, Enumerated or Instance | What it holds. Instance makes it a relationship. |
--values |
list | The allowed values, for Enumerated. |
--range |
class | The class a relationship points to. |
--card |
single or multiple | Whether it holds one value or several. |
--min |
number | The fewest values allowed. |
--max |
number | The most values allowed. |
--default |
text | A starting value. |
--desc |
text | A one-line description. |
--force |
flag | Add it even if the name breaks your convention. |
okb slot set#
Changes a slot. It takes every flag add takes, plus the ones below.
$ okb slot set maker --card single --min 1
$ okb slot set body --off Beverage
Arguments#
| Argument | Type | Description |
|---|---|---|
<slot> |
slot | The slot to change. |
--off |
class | Take the slot off a class. |
--add-range |
class | Add a class a relationship can point to. |
--remove-range |
class | Remove one. |
--on-rules |
flag | Let rules set this slot. |
--off-rules |
flag | Stop rules setting this slot. |
okb slot inverse#
Declares that two relationships are the same link read from opposite ends.
$ okb slot inverse maker produces
Arguments#
| Argument | Type | Description |
|---|---|---|
<slotA> |
slot | The relationship that is stored. |
<slotB> |
slot | Its inverse. |
okb show#
Shows everything about one class, slot or instance: its parents, slots, values and links.
$ okb show Wine
$ okb show class:Genre
Arguments#
| Argument | Type | Description |
|---|---|---|
[name] |
text | The thing to show. When a class and a slot share a name, write class:Genre or slot:genre. |
okb link#
Connects two instances (or an instance and a class) with a relationship.
$ okb link Radio preferredOver SegmentedControl condition="2 to 7 options"
Arguments#
| Argument | Type | Description |
|---|---|---|
<from> |
name | Where the link starts. |
<relationship> |
slot | The relationship. |
<to> |
name | Where it ends. |
<name=value>... |
name=value | Values for the relationship’s own properties. |
--rule |
rule id | The extracted rule this link comes from. |
--clear |
text | Remove a property value from the link. |
okb unlink#
Removes a link.
$ okb unlink Radio preferredOver SegmentedControl
Arguments#
| Argument | Type | Description |
|---|---|---|
<from> |
name | Where the link starts. |
<relationship> |
slot | The relationship. |
<to> |
name | Where it ends. |
okb instance#
Adds and changes instances, the individual things your classes describe.
okb instance add#
Adds an instance and sets its values.
$ okb instance add "Chateau Morgon Beaujolais" --of Beaujolais body=light maker="Chateau Morgon"
Arguments#
| Argument | Type | Description |
|---|---|---|
<Name> |
text | The instance’s name. Quote it if it has spaces. |
--of |
class | A class it belongs to. Repeat it for more. |
--desc |
text | A one-line description. |
<slot=value>... |
slot=value | Values for its slots. |
okb instance set#
Changes an instance’s values. Use += to add a value, -= to remove one, and slot= to clear it.
$ okb instance set "Chateau Morgon Beaujolais" grape+=Gamay
$ okb instance set "Chateau Morgon Beaujolais" --of Beaujolais
Arguments#
| Argument | Type | Description |
|---|---|---|
<Name> |
text | The instance. |
<slot=value>... |
slot=value | The changes. |
--of |
class | Move it to another class. |
--desc |
text | New description. |
Reviewing and sharing#
okb review#
Turns the rules only a person can judge into questions about your ontology. The ontology-review skill uses it.
$ okb review
$ okb review --all --json
Arguments#
| Argument | Type | Description |
|---|---|---|
--all |
flag | Include every rule, not only the visible ones. |
--json |
flag | Print everything as JSON. |
okb decision#
Records a design decision, with the reason, so you and others can see why the ontology is the way it is.
okb decision add#
Records a decision. A decision can waive a rule, which turns that rule’s warning into a note.
$ okb decision add --title "Wines are not foods" --decision "Keep them separate" --why "Pairing needs both"
Arguments#
| Argument | Type | Description |
|---|---|---|
--title |
text | A short title. |
--decision |
text | What you decided. |
--why |
text | The reason. |
--question |
text | The question it answers. |
--alt |
text | An option you rejected. Repeat it for more. |
--about |
name | A class, slot or instance it concerns. Repeat it for more. |
--waives |
rule key | A rule it explains away. Repeat it for more. |
okb decision list#
Lists the decisions. Bare okb decision does the same.
$ okb decision list
okb diagram#
Draws the ontology as a Mermaid diagram you can open in GitHub or VS Code.
$ okb diagram --out diagram.md
Arguments#
| Argument | Type | Description |
|---|---|---|
--out |
path | Write the diagram here instead of printing it. |
okb export#
Writes the ontology as JSON or as openCypher, ready for Neo4j, Neptune or Memgraph. Instances become nodes labeled with their classes.
$ okb export --format cypher --out wine.cypher
Arguments#
| Argument | Type | Description |
|---|---|---|
--format |
json or cypher | The output format. Defaults to json. |
--out |
path | Write to this file instead of printing. |
--with-schema |
flag | Include classes and slots, not only instances. |
--no-inherited |
flag | Leave out values an instance inherits from its class. |
--no-rules |
flag | Leave out extracted rules. |
--include-unverified |
flag | Include rules and quotes that haven’t been verified. |
Working from documents#
okb source#
Registers documents you are extracting from, so quotes and rules can point back to them.
okb source add#
Registers a Markdown or PDF file.
$ okb source add docs/button.md --repo-url https://github.com/acme/ds/blob/main/button.md
Arguments#
| Argument | Type | Description |
|---|---|---|
<file> |
path | A Markdown or PDF file. |
--title |
text | A title. |
--repo-url |
url | The file’s address on GitHub. |
--url |
url | The address of the rendered page. |
--id |
text | Your own id for it. |
okb source outline#
Lists every block of a Markdown source with its heading path and line numbers, and shows which are already quoted.
$ okb source outline button --quotable
Arguments#
| Argument | Type | Description |
|---|---|---|
<source> |
name | The source. |
--quotable |
flag | Show only blocks you can quote. |
--problems |
flag | Show only problems in the document. |
okb source refresh#
Checks quotes again after the document changes.
$ okb source refresh button
Arguments#
| Argument | Type | Description |
|---|---|---|
<source> |
name | The source. |
okb source list#
Lists the sources. Bare okb source does the same.
$ okb source list
okb quote#
Records a verbatim passage from a source. Okb finds it in the document for you.
okb quote add#
Records one quote.
$ okb quote add button "Use a primary button for the main action." --cites Button
Arguments#
| Argument | Type | Description |
|---|---|---|
<source> |
name | The source it comes from. |
<text> |
text | The passage, word for word. |
--cites |
node | A node the quote supports. Repeat it for more. |
--line |
number | A line to look near, if the text appears more than once. |
--allow-code |
flag | Allow a quote from a code block. |
okb quote list#
Lists the quotes. Bare okb quote does the same.
$ okb quote list
okb rule#
Records a rule a document states, tied to the quote that supports it.
okb rule add#
Records one rule.
$ okb rule add --statement "Buttons SHOULD have one primary per page." --modality SHOULD --governs Button --cites quote.1
Arguments#
| Argument | Type | Description |
|---|---|---|
--statement |
text | The rule, in one sentence. |
--modality |
MUST, SHOULD, MAY, MUST_NOT or SHOULD_NOT | How strong the document makes it. |
--cites |
quote id | The quote that supports it. Repeat it for more. |
--governs |
class or slot | What it applies to. Repeat it for more. |
--name |
text | A short name. |
--authored |
flag | You wrote it; the document doesn’t state it. |
--value |
slot=value | A value it sets. Repeat it for more. |
--refines |
rule id | A broader rule this one narrows. |
--adds |
text | What this rule adds to the one it refines. |
okb rule refines#
Says that one rule narrows another.
$ okb rule refines rule.2 rule.1 --adds "Only inside dialogs"
Arguments#
| Argument | Type | Description |
|---|---|---|
<rule> |
rule id | The narrower rule. |
<broader rule> |
rule id | The rule it narrows. |
--adds |
text | What it adds. |
--remove |
flag | Remove the link. |
okb rule list#
Lists the rules. Bare okb rule does the same.
$ okb rule list
okb fulfills#
Says that an instance follows a rule.
$ okb fulfills SaveButton rule.1
Arguments#
| Argument | Type | Description |
|---|---|---|
<instance> |
name | The instance. |
<rule> |
rule id | The rule. |
--remove |
flag | Remove the link. |
okb cite#
Attaches a quote you already recorded to another node.
$ okb cite Button quote.4
Arguments#
| Argument | Type | Description |
|---|---|---|
<node> |
name | The class, slot, instance or rule. |
<quote id> |
quote id | The quote. okb quote list shows them. |
okb verify#
Records the result of an independent check that a node matches what its quote says, or approves it.
$ okb verify rule.1 --status SUPPORTED
$ okb verify rule.1 --approve
Arguments#
| Argument | Type | Description |
|---|---|---|
<node> |
name | The node to verify. |
--status |
SUPPORTED, OVERREACH or UNSUPPORTED | What the check found. |
--corrected |
text | A corrected wording, for OVERREACH. |
--confidence |
verbatim or paraphrased | How closely the node follows the quote. |
--note |
text | A note about the check. |
--approve |
flag | Approve it after review. |
Skills#
okb skills#
Puts the skills that come with okb where Claude Code and Cursor load them from, and checks that they match this okb.
okb skills install#
Links the three skills into ~/.claude/skills/ (a link keeps them current when the package updates), or copies them. It replaces a link to an older okb, a broken link or an older copy. It refuses to touch a folder that is not one of okb’s, and changes nothing if it refuses.
$ okb skills install
$ okb skills install --copy
$ okb skills install --dir ~/.cursor/skills
Arguments#
| Argument | Type | Description |
|---|---|---|
--copy |
flag | Copy the skill folders instead of linking to them. Run it again after you update okb. |
--dir |
path | The skills folder to use instead of ~/.claude/skills/. The OKB_SKILLS_DIR environment variable sets it too. |
--force |
flag | Delete a folder or file that is not one of okb’s skills (or a copy you edited) and put the skill in its place. |
okb skills status#
Lists each skill with where it is installed and whether its version matches this okb. It exits with code 1 when any skill is missing or out of date.
$ okb skills status
$ okb skills status --dir ~/.cursor/skills
Arguments#
| Argument | Type | Description |
|---|---|---|
--dir |
path | The skills folder to check instead of ~/.claude/skills/. |
Housekeeping#
okb rename#
Renames a class, slot or instance and updates everything that points to it.
$ okb rename Vino Wine
Arguments#
| Argument | Type | Description |
|---|---|---|
<old name> |
name | The current name. |
<new name> |
text | The new name. |
--force |
flag | Rename it even if the name breaks your convention. |
okb remove#
Deletes a class, slot, instance, term or other node, with the edges that touch it.
$ okb remove Vino
$ okb remove genre --type Slot
Arguments#
| Argument | Type | Description |
|---|---|---|
<name> |
name | What to delete. |
--type |
text | Which kind, when a name is ambiguous: Class, Slot, Instance, Term and so on. |
okb drift#
Compares quotes with the documents they came from and reports quotes that no longer match.
$ okb drift .
$ okb drift ../wine ../food
Arguments#
| Argument | Type | Description |
|---|---|---|
[folder]... |
paths | The ontology folders to check. |
okb help#
Prints a one-screen summary of the commands. okb --help and okb -h do the same.
$ okb help
okb version#
Prints the okb version and the version of the rules it carries. okb --version does the same.
$ okb version