diff --git a/AGENT.md b/AGENT.md index 8f75f95..47afe76 100644 --- a/AGENT.md +++ b/AGENT.md @@ -40,12 +40,16 @@ jobs will run unattended at night. | part | role | state | |---|---|---| | `labbrain.okf` | OKF mechanics: frontmatter, git hashes, summaries, links, `index.md`, drift, check | works; moved from `okf_vault.sh` unchanged, held by parity tests | -| `labbrain.cli` | `labbrain `, 8 commands; reads the settings | works | -| `env/` | `.env.example`; a person's `.env` (`LABBRAIN_CONTRIBUTOR`, `LABBRAIN_VAULT`, `LABBRAIN_ANNOTATE`) | works | +| `labbrain.okf.search` | code-only search over the graph: headers, then full text, then links | experimental: being tried out | +| `labbrain.okf.graph`, `.page` | the wiki's graph in `_maps/graph.json`: a cache, rebuilt from changed files only, never committed; and the page to explore it, from `graph_page.html` | experimental: being tried out | +| `labbrain.okf.canvas`, `.hierarchy` | pictures of JSON and YAML data in `_maps/` (an Obsidian canvas or a web page), and the summaries as one tree to draw | experimental: being tried out | +| `labbrain.cli` | `labbrain `, 12 commands; reads the settings | works | +| `labbrain.okf.config` | the wiki's own config: `labbrain.yaml` and `topics.yaml` at its root | works | +| `env/` | `.env.example`; a person's `.env` (`LABBRAIN_CONTRIBUTOR`, `LABBRAIN_VAULT`, `LABBRAIN_ANNOTATE`, `LABBRAIN_VIEW`) | works | | `docs/` | how-to guides, usage, configuration; no per-function reference yet | first versions | -| `skills/` | `search`, `okf-conventions`, `summary-writing`, `index`, `drift` | first versions | +| `skills/` | `search`, `okf-conventions`, `summary-writing`, `index`, `drift`; `canvas` | first versions; `canvas` experimental | | `patterns/` | trace and pattern formats, dummy examples | draft; no code writes them yet | -| *(planned)* | `llm()` with the model and preferences settings, the jobs, the night-run dispatcher, search code, an MCP server | not started | +| *(planned)* | `llm()` with the model and preferences settings, the jobs, the night-run dispatcher, an MCP server | not started | | *(separate feature)* | task boards (Kanban): an Obsidian plugin's format, maybe a front-end feature later | not started; no board handling in the core | **One entry point:** `labbrain`, the same as `python -m labbrain`. @@ -71,9 +75,10 @@ skills and patterns come back here by pull request; raw traces never do. - **Provenance is git blob hashes** (`git hash-object`), so `git cat-file -p` recovers the exact version a summary was built from. - **The frontmatter parser is hand-written,** so key order, flow mappings and quoting survive a - rewrite. No YAML library. -- **The runtime is the standard library plus `python-dotenv`,** which reads `env/.env`. `git` is - the one system dependency. + rewrite. PyYAML never touches frontmatter: it reads and writes whole data files only. +- **PyYAML reads with `safe_load`, never `load`:** a file's content is untrusted input. +- **The runtime is the standard library plus `python-dotenv`,** which reads `env/.env`, **and + PyYAML.** `git` is the one system dependency. - **`labbrain.okf` returns data and `cli.py` prints it.** No `print` below the CLI. - **No state outlives a call.** A cache is made by the function that needs it and passed down (`history(vault, rel, cache)`). The night run is one process running many jobs, and a module-level @@ -94,6 +99,9 @@ skills and patterns come back here by pull request; raw traces never do. - a file argument outside the vault is refused, before anything is written; - `links` removes `drift_verification` when it drops the last record, instead of leaving the key empty; + - nothing looks inside `_maps/` at the root of the wiki or of a repo in it, where labbrain + draws its pictures, nor at `labbrain.yaml` and `topics.yaml` at the wiki root; + - a bad wiki config stops every command; - argparse handles usage and help. --- @@ -114,8 +122,10 @@ from arguments and the environment: never hardcode URLs, keys, paths or people. **A function is a capsule: everything it needs is in its arguments.** - Configuration is read once, at the edge (`cli.py`), and passed down. Nothing below it reads `os.environ` or `env/.env`. -- **Settings are about the person, never the wiki.** A wiki-wide rule (thresholds, note types) is - not a setting: it would mean different things depending on who ran the job. +- **Two levels of configuration.** A person's settings (`env/.env`) are about the person. A rule for + the whole wiki goes in `labbrain.yaml` or `topics.yaml` at the wiki root, committed and the same + for everyone; no setting overrides it, or it would mean different things depending on who ran the + job. Both are read once, in `cli.py`, and passed down field by field. - **A long signature beats a config object.** Nine named arguments are honest; a bag hides which fields are used. - **The tell is untestability.** A function that reads its own module can only be tested by patching. diff --git a/README.md b/README.md index 110a64f..7c3f3c7 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ the wiki, run `pixi run --manifest-path /pixi.toml labbrain ` | `labbrain links [FILE...]` | turns `[[wikilinks]]` into relative markdown links | | `labbrain hot` | often-changed files, the files that cite them, and which are due a drift check | | `labbrain drift-stamp --by ACTOR FILE [SUMMARY...]` | records a drift check | +| `labbrain canvas FILE...` | draws a JSON or YAML file as a tree of boxes, as an Obsidian canvas or a web page, in `_maps/` | +| `labbrain graph` | brings the wiki's graph up to date in `_maps/graph.json`, and draws a page to explore it in any browser | +| `labbrain search WORD...` | finds files by their headers, then their text, then the links around them, with code only | +| `labbrain hierarchy [FOLDER...]` | writes the folder summaries, of the whole wiki or of each FOLDER, as one tree with the links between them, to `_maps/`, and draws it | ## Skills Instructions for an agent working on a wiki, in the `SKILL.md` format. Load the ones a job needs. @@ -76,6 +80,7 @@ Instructions for an agent working on a wiki, in the `SKILL.md` format. Load the | [summary-writing](skills/summary-writing/SKILL.md) | writing and rebuilding a folder summary faithfully | | [index](skills/index/SKILL.md) | bringing headers, summaries, listings and the map up to date | | [drift](skills/drift/SKILL.md) | checking that summaries still say what their notes say | +| [canvas](skills/canvas/SKILL.md) | drawing the summaries as one tree, or any JSON or YAML file; experimental | The skills here are seeds. Each wiki keeps and evolves its own copies, and what it learns from its runs goes in its `patterns/` (see [patterns/README.md](patterns/README.md)). A skill or pattern that diff --git a/dev-skills/update-docs/SKILL.md b/dev-skills/update-docs/SKILL.md index f0af961..96e1674 100644 --- a/dev-skills/update-docs/SKILL.md +++ b/dev-skills/update-docs/SKILL.md @@ -39,6 +39,7 @@ The code is the source, and the docs follow it. When one of these changes, updat | options, defaults, output, exit status | `parser()` and `main()` in `cli.py` | `docs/usage.md` | | how to run labbrain from a wiki | `pixi.toml` | `README.md`, `docs/usage.md`, the *Running labbrain* section of each skill in `skills/`, word for word the same in each | | the settings | `SETTINGS` and `settings()` in `cli.py` | `env/.env.example`, `docs/configuration.md` | +| the wiki's config | `wiki_config()` in `okf/config.py` | `docs/configuration.md`, `skills/okf-conventions/SKILL.md` | | how the package differs from `okf_vault.sh` | `tests/test_parity.py`, `tests/test_cli.py` | `AGENT.md` (known differences) | | the repo's layout | the folders | `README.md` (Layout), `docs/how-it-works.md`, `AGENT.md` (What LabBrain is) | | the skills | `skills/` | `README.md` (Skills), `docs/how-it-works.md` | diff --git a/docs/configuration.md b/docs/configuration.md index c5bc322..17eca92 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,7 +1,10 @@ # Configuration -Settings about you, not about the wiki, go in `env/.env`. labbrain works without any of them; they -save you typing the same thing on every run. +There are two levels: +- **your settings,** about you, in `env/.env`. labbrain works without any of them; they save you + typing the same thing on every run; +- **the wiki's config,** rules for everyone who works on the wiki, in `labbrain.yaml` and + `topics.yaml` at its root (see [The wiki's own config](#the-wikis-own-config)). ## Setting up ```sh @@ -16,6 +19,7 @@ template: it lists every setting, each one empty, so a copy you forget to edit c | `LABBRAIN_CONTRIBUTOR` | you, as an actor: the default for `labbrain frontmatter --by` | `human:ada` | | `LABBRAIN_VAULT` | the wiki to use when you run labbrain outside any wiki | `~/wiki` | | `LABBRAIN_ANNOTATE` | whether agents may add metadata to the header of your notes: `true` or `false` (the default) | `true` | +| `LABBRAIN_VIEW` | how you like `labbrain canvas` pictures: `canvas` (the default) for Obsidian, or `html` for a web page | `html` | | `LABBRAIN_ENV` | where your settings file is, if not `env/.env`. Set it in your shell, not in the file | `~/.config/labbrain.env` | **`LABBRAIN_CONTRIBUTOR`** is written as `human:`, with no spaces and no email address. It is @@ -44,9 +48,12 @@ changes to the wrong wiki. [okf-conventions](../skills/okf-conventions/SKILL.md) skill). No labbrain command adds agent metadata yet. +**`LABBRAIN_VIEW`** is only how you like to look at pictures, so it changes nothing in the wiki. +`--view` overrides it for one run (see [labbrain canvas](usage.md#labbrain-canvas)). + ## Where labbrain looks For each setting, the first of these that has a value wins: -1. the option on the command line (`--by`, `--vault`); +1. the option on the command line (`--by`, `--vault`, `--view`); 2. the variable in your shell's environment, if it's set and not empty; 3. the settings file: the file `LABBRAIN_ENV` names, or else `env/.env` in the LabBrain checkout that labbrain runs from. @@ -68,7 +75,8 @@ labbrain stops before doing anything, prints `bad setting …` and exits with 2, - `LABBRAIN_CONTRIBUTOR` isn't `human:`, or contains an email address; - `LABBRAIN_VAULT` isn't the root of a wiki; - `LABBRAIN_ANNOTATE` isn't `true` or `false`, or is `true` without a `LABBRAIN_CONTRIBUTOR` to say - whose notes it is about. + whose notes it is about; +- `LABBRAIN_VIEW` isn't `canvas` or `html`. Names that don't start with `LABBRAIN_` are ignored, so the file can hold other tools' settings too. @@ -77,7 +85,43 @@ Names that don't start with `LABBRAIN_` are ignored, so the file can hold other work, and a default would be wrong the first time you switched tools. - **`hot`'s thresholds** (`--days`, `--min`, `--recheck`) **and the note types.** These are rules for the whole wiki. If each person set their own, "checked for drift" would mean something different - depending on who ran the check. Change them for one run with the options. + depending on who ran the check. Change them for one run with the options. *(They may move to the + wiki's config.)* + +## The wiki's own config +Rules for everyone who works on the wiki go in two files at its root, committed with the wiki and +changed by review, like code. Both are optional. labbrain reads them once per run; no summary covers +them, and no `index.md` lists them. + +**`labbrain.yaml`:** +```yaml +graph: + hidden: [Session Summary, Daily Recap] # note types the graph page starts with hidden + file_url: https://git.example.org/lab/wiki/-/blob/main/{path} +``` +- **`graph.hidden`:** note types the [graph page](usage.md#labbrain-graph) starts with switched off. + Anyone can switch them back on. +- **`graph.file_url`:** where the graph page's links lead, with `{path}` standing for the file's path + in the wiki, so the page works for people who open it from a server without a copy of the wiki. + Without it, the links are relative to the page. + +**`topics.yaml`:** the wiki's vocabulary, one key per topic. +```yaml +cancer: + synonyms: [tumour, tumor, oncology] + narrower: [neoantigen] +neoantigen: +``` +- **`synonyms`:** other words for the topic. A search for any of them finds the topic. +- **`narrower`:** more specific topics, each a key of the file. A search for `cancer` also finds + `neoantigen`, but not the other way round. + +Summaries carry the topics they cover as `topics: [cancer]` in their frontmatter (see the +[okf-conventions](../skills/okf-conventions/SKILL.md) skill). + +**Mistakes it refuses:** a key labbrain doesn't know, a value of the wrong kind, a `file_url` without +`{path}`, a narrower topic that isn't in the file, or a file that isn't valid YAML. Every command +then prints `bad wiki config in : …` and exits with 2. ## Coming later With the code that calls a model (`llm()`), the settings file will also hold: diff --git a/docs/how-it-works.md b/docs/how-it-works.md index 1d9d6af..e734e7b 100644 --- a/docs/how-it-works.md +++ b/docs/how-it-works.md @@ -122,7 +122,9 @@ A skill or pattern that works beyond one lab comes back here by pull request, wi taken out. Raw traces never leave the wiki. ## What exists today -- **Works:** the eight commands, the five wiki skills, and the settings in `env/`. +- **Works:** the twelve commands, the six wiki skills, the settings in `env/`, and the wiki's own + config. +- **Experimental:** the `canvas`, `hierarchy`, `graph` and `search` commands, and the `canvas` skill. - **Draft:** the trace and pattern formats. -- **Planned:** the code that calls a model (`llm()`), the nightly run, search code, an MCP server, +- **Planned:** the code that calls a model (`llm()`), the nightly run, an MCP server, and task boards as a separate feature. diff --git a/docs/usage.md b/docs/usage.md index c068652..33c06cf 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -48,7 +48,7 @@ that doesn't exist, it prints `no such folder: DIR` and exits with 2. the wiki without `--vault`. ## File arguments -`stamp`, `links` and `drift-stamp` take file paths. +`stamp`, `links`, `drift-stamp` and `canvas` take file paths, and `hierarchy` takes folders. - **They are relative to where you run the command,** like any shell command, not to the wiki's root. From the root you write `Garden/Garden_summary.md`; from inside `Garden/`, `Garden_summary.md`. Absolute paths work too. @@ -69,8 +69,8 @@ actor must name the model that actually did the work. `frontmatter` falls back t | status | means | |---|---| | 0 | done; or nothing to do, or nothing wrong | -| 1 | `check` found problems, `stale` found stale summaries, or `drift-stamp` was named a file that isn't a summary | -| 2 | the command couldn't run: a missing argument, no wiki found, a path outside the wiki, a missing file, a file `stamp` won't take, or a bad setting. Nothing was written | +| 1 | `check` found problems, `stale` found stale summaries, `drift-stamp` was named a file that isn't a summary, or `search` found nothing | +| 2 | the command couldn't run: a missing argument, no wiki found, a path outside the wiki, a missing file, a file `stamp` won't take, a file `canvas` can't draw, a `hierarchy` folder that isn't one, a bad setting, or a bad wiki config. Nothing was written | So `labbrain check || echo "the wiki needs attention"` works in a script or a scheduled job. @@ -85,6 +85,10 @@ So `labbrain check || echo "the wiki needs attention"` works in a script or a sc | [`links`](#labbrain-links) | the notes' link syntax, and the hashes recorded in summaries | | [`hot`](#labbrain-hot) | nothing | | [`drift-stamp`](#labbrain-drift-stamp) | the summaries' `drift_verification` | +| [`canvas`](#labbrain-canvas) | pictures in `_maps/`, which git ignores | +| [`hierarchy`](#labbrain-hierarchy) | `_maps/hierarchy.yaml` and its picture | +| [`graph`](#labbrain-graph) | `_maps/graph.json`, the wiki's graph | +| [`search`](#labbrain-search) | the graph, and what it found in `_maps/search/` | The examples below are real output from the dummy wiki in `tests/fixtures/vault/`. @@ -142,8 +146,9 @@ It ends with `N stale summary(ies).` and exits with 1 if N isn't 0. **What a summary covers:** every text file in its folder (`.md`, `.canvas`, `.sh`, `.nix`, `.lock`, `.txt`, `.py`, `.json`, `.yaml`, `.yml`, `.toml`), and those in subfolders without a summary of their -own. It leaves out other summaries, `index.md`, `log.md`, hidden files and folders, and anything in -another git repo. Images and data files are attachments, not sources. +own. It leaves out other summaries, `index.md`, `log.md`, hidden files and folders, anything in +another git repo, `_maps/` at the root of the wiki or of any git repo in it, where labbrain draws +its pictures, and the wiki's own config, `labbrain.yaml` and `topics.yaml` at its root. Images and data files are attachments, not sources. The hash is taken of the file on disk, so uncommitted edits count. @@ -409,6 +414,241 @@ $ labbrain drift-stamp --by claude-code/claude-opus-5-5 Garden/Tomatoes.md nothing due for Garden/Tomatoes.md ``` +### labbrain canvas +``` +labbrain canvas FILE... [--view canvas|html] [--vault DIR] +``` +Draws each `.json`, `.yaml` or `.yml` FILE as a tree of boxes, so you can see how the data nests. +- **The view** is `--view`, else `LABBRAIN_VIEW` (see [Configuration](configuration.md)), else + `canvas`: + - `canvas`: an Obsidian canvas ([JSON Canvas](https://jsoncanvas.org)), which Obsidian opens; + - `html`: one web page, with nothing loaded from the internet. +- **The picture goes in `_maps/` at the wiki root,** at the file's own path with the view's + extension: `Garden/plan.yaml` becomes `_maps/Garden/plan.canvas`. With `--vault` naming an inner + bundle, the root is that bundle's. A file already in `_maps/` gets + its picture beside it. Drawing a file again replaces its picture. +- **`_maps/` is never part of the wiki.** labbrain writes `_maps/.gitignore`, so git ignores the + folder, and no other command looks inside it: no summary covers it, and no listing shows it. That + holds for a `_maps/` at the root of any git repo in the wiki too, such as one drawn with `--vault`. + +**What goes in a box:** +- A mapping or a list is a box, titled by its key. A list item has no title. +- A value that is neither, such as a number or a short text, is a line in its parent's box: + `budget: 120`, or `- basil` for a list item. Each nested mapping or list is a box of its own, with + an arrow from its parent. +- **Some keys shape the picture** instead of showing as `key: value`: + + | key | does | + |---|---| + | `title` | titles the box | + | `description` | a line in the box, without its key | + | `path` | when it names a file in the wiki, the title links to that file | + | `children` | a list whose items are boxes under this one, without a `children` box between | + | `links` | wiki files this box links to: one line at the end of the box, `→ Garden — Summary · Beans`, each name a link to its file. A name is the file's `title`, else its file name. There are no arrows for links: on a real wiki they tangled | + +A `path` or a link that isn't a file in the wiki is shown as text. In a canvas, click a title or a +link's name to open its file. In a page, they are links to the files. + +YAML is read with PyYAML's `safe_load`, so a file can't make labbrain run anything. A file that +isn't JSON or YAML, doesn't exist, or doesn't parse is refused with `can't draw : `. Every +FILE is read before any picture is written, so one bad file means nothing is written, and the exit +status is 2. + +``` +$ labbrain canvas Garden/plan.yaml +drew _maps/Garden/plan.canvas +$ labbrain canvas --view html Garden/plan.yaml Garden/Tomatoes.md +can't draw Garden/Tomatoes.md: not a .json, .yaml or .yml file +``` + +### labbrain hierarchy +``` +labbrain hierarchy [FOLDER...] [--view canvas|html] [--vault DIR] +``` +Writes the folder summaries in each FOLDER as one tree, then draws it beside, as +[`canvas`](#labbrain-canvas) does. With no FOLDER, it draws the whole wiki. + +| FOLDER | writes | +|---|---| +| none | `_maps/hierarchy.yaml`, and `_maps/hierarchy.canvas` or `.html` | +| `Garden` | `_maps/Garden/hierarchy.yaml`, and `_maps/Garden/hierarchy.canvas` or `.html` | + +Each is rewritten on every run. A FOLDER is relative to where you run the command, like a file +argument: from inside `Garden/`, `labbrain hierarchy .` draws `Garden`. A FOLDER that doesn't exist +is refused with `not a folder: `, and nothing is written. It reads only the summaries' +frontmatter and links: no model, and no note is read. +- **Each summary sits under the summary of the folder above it,** as `stamp` would record its + `parent`. +- **The top of the tree** is FOLDER's own summary, when every other summary in FOLDER sits under + it. Otherwise it is the folder itself, titled with its name, with its `index.md` as its `path`. + For the whole wiki that is usually the wiki, because the top summary of each git repo in it has + no parent. +- **Each summary has** its `title`, its `path`, its `description` if it has one, its `links` and + its `children`. +- **`links` are what its text links to outside its own part of the tree:** + - a link to a note becomes a link to the summary that covers the note, inside FOLDER or not, + so a part of the wiki shows how it connects to the rest; + - a link to a file no summary covers stays a link to the file; + - links to its own notes, its parent and its children are left out, since the tree shows them; + - broken links, links inside code and web links are left out. + +``` +$ labbrain hierarchy +wrote _maps/hierarchy.yaml +drew _maps/hierarchy.canvas +$ cat _maps/hierarchy.yaml +# Written by `labbrain hierarchy` from the folder summaries, and rewritten on every run. +title: vault +path: index.md +children: +- title: Garden — Summary + path: Garden/Garden_summary.md + description: Trials of tomatoes and beans in the test garden, with soil notes. + links: + - Kitchen/Recipes.md + children: + - title: Soil — Summary + path: Garden/Soil/Soil_summary.md + description: Compost notes for the garden beds. +- title: Shelf — Summary + path: Shelf/Shelf_summary.md + description: Jars kept on the shelf. +``` +The picture is only as current as the summaries: run `labbrain stale` first. + +### labbrain graph +``` +labbrain graph [--vault DIR] +``` +Brings the wiki's graph up to date in `_maps/graph.json`, and draws it as a page to explore in a +browser, `_maps/graph.html` (see [The graph page](#the-graph-page)). The graph is a cache: code builds it from +the wiki, nobody edits it, and git ignores it, like everything in `_maps/`. Throw it away and the +next run builds the same one. + +- **Each markdown file is a node,** except `index.md` and `log.md`, which link to everything around + them. A node has the file's path as its `id`, and its `type`, `title`, `description`, `tags` and + `topics` from its header, where it has them. A `title` comes from the header, else the first + `# heading`, else the file name. `hash` is the file's git blob hash. +- **Edges have a `kind`:** + + | kind | from | to | + |---|---|---| + | `link` | a file | a file its text links to, by `[[wikilink]]` or relative link, resolved the way Obsidian resolves it | + | `covers` | a summary | a note it is built from (one of its `sources`) | + | `child` | a summary | the summary of a subfolder under it | + + Links inside code, to files that don't exist, to files that aren't markdown, and to the file + itself make no edge. +- **The same wiki always gives the same file:** nodes and edges are sorted, and nothing in it + depends on the time or on who ran it. Anyone who builds it from the same commits gets the same + bytes. +- **Only changed files are read.** `_maps/graph-cache.json` keeps what was read from each file, + under the file's git blob hash, and a file whose hash hasn't changed isn't read again. Links are + resolved again on every run, since a new file can change where `[[Beans]]` leads. + +```json +{ + "title": "vault", + "nodes": [ + {"id": "Garden/Garden_summary.md", "type": "Folder Summary", "title": "Garden — Summary", + "description": "Trials of tomatoes and beans in the test garden, with soil notes.", "hash": "…"}, + {"id": "Garden/Tomatoes.md", "type": "Note", "title": "Tomatoes", "hash": "…"} + ], + "edges": [ + {"from": "Garden/Garden_summary.md", "to": "Garden/Soil/Soil_summary.md", "kind": "child"}, + {"from": "Garden/Garden_summary.md", "to": "Garden/Tomatoes.md", "kind": "covers"}, + {"from": "Garden/Tomatoes.md", "to": "Kitchen/Recipes.md", "kind": "link"} + ] +} +``` + +``` +$ labbrain graph +wrote _maps/graph.json: 13 files; 16 link, 5 covers and 1 child edges; 13 file(s) read, the rest unchanged +drew _maps/graph.html +$ labbrain graph +wrote _maps/graph.json: 13 files; 16 link, 5 covers and 1 child edges; 0 file(s) read, the rest unchanged +drew _maps/graph.html +``` + +#### The graph page +One HTML file with the whole graph inside it. It loads nothing from anywhere else, so it works +opened from disk or from a server, in any browser, without Obsidian. +- **It opens at the wiki's root,** with the top summaries around it, and the files 1 step further + out (`Depth`, 0 to 3). A page drawn by `labbrain search` opens on what the search found instead. +- **Click a file to put it in the middle,** with the files around it in rings: 1 away, 2 away, and + so on. The browser's back button goes back to the view before. +- **Search** by title, description, path, tags and topics, with the wiki's vocabulary, as step 1 of + [`labbrain search`](#labbrain-search). The full text isn't in the page: for that, run + `labbrain search --text`. +- **Show and hide:** which edges to follow (links, the summary tree, a summary's notes); the + summaries over the notes in view; each note type; and only the paths that contain some text. The + types in `graph.hidden` (see [the wiki's own config](configuration.md#the-wikis-own-config)) start + hidden. +- **The side panel** lists everything in view, by distance, with a link to open each file. Links + lead to `graph.file_url` if the wiki's config sets one, else to the files beside `_maps/`. +- **Colours:** summaries blue (and drawn larger), notes orange, the concepts drafted from papers + (`Paper`, `Method`, `Finding`, …) aqua, and every other type grey. Light or dark follows your + system. +- **More than 350 files in view** and the outer rings are cut: lower the depth or hide some types. + +### labbrain search +``` +labbrain search WORD... [--depth N] [--text] [--vault DIR] +``` +Finds the files about WORD..., taken together as one phrase, with code only: no model reads +anything. It brings [the graph](#labbrain-graph) up to date first, then climbs from the cheapest +step and stops when one finds something: + +| step | looks at | reads files | +|---|---|---| +| 1. the headers | each file's title, description, path, `tags` and `topics` | no: they are in the graph | +| 2. the full text | each file's text; only if step 1 found nothing, or with `--text` | yes | +| 3. the links | the files linked to or from what was found, up to `--depth` away (default 1), and the summaries that cover them | no | + +- **The wiki's vocabulary widens the words** (see [the wiki's own config](configuration.md#the-wikis-own-config)). + A word that names a topic, or one of its synonyms, also finds the topic's other synonyms and its + narrower topics: with `cancer: {synonyms: [tumour], narrower: [neoantigen]}`, `tumour` finds files + about cancer and neoantigens. +- **A word matches from the start of a word,** in any case: `tomato` finds *Tomatoes*, but `omato` + finds nothing. `tags` and `topics` must match whole. +- **Step 3 follows `link` edges only,** in both directions. A summary that covers a file found is + added for context, but its other notes aren't. + +It prints the files by step, with why each is there, then writes what it found to +`_maps/search/.json`, and a [graph page](#the-graph-page) that opens on it, +`_maps/search/.html`. The JSON is in the graph's own format plus a `filter` that records the query, the +words searched, the topics they named, the depth and the last step that found something. A hit has +`hit` (where it matched, or `text` with `matches`), a linked file has `distance`, and a summary +added for context has `context`. It exits with 1 if nothing was found. + +``` +$ labbrain search tomato +looked for: tomato +step 1, the headers: 2 file(s) + Garden/Garden_summary.md — Garden — Summary (description) + Garden/Tomatoes.md — Tomatoes (title) +step 3, linked up to 1 away: 6 file(s) + Garden/Beans.md — Beans (1 away) + Garden/Seeds/Pumpkin.md — Pumpkin (1 away) + Garden/Soil/Soil_summary.md — Soil — Summary (1 away) + Kitchen/Recipes.md — Recipes (1 away) + Kitchen/Session_2026-01-05.md — Planning session (1 away) + Kitchen/Spice rack.md — Spice rack (1 away) +wrote _maps/search/tomato.json +drew _maps/search/tomato.html +$ labbrain search brine +looked for: brine +step 2, the full text: 1 file(s) + Kitchen/Pickling.md — Pickling (3 matches) +step 3, linked up to 1 away: 1 file(s) + Shelf/Jars.md — Jars (1 away) +and the summaries over them: 1 file(s) + Shelf/Shelf_summary.md — Shelf — Summary +wrote _maps/search/brine.json +drew _maps/search/brine.html +``` + ## Common sequences **After notes changed** (the code steps of the `index` skill): ```sh diff --git a/docs/writing-a-function.md b/docs/writing-a-function.md index 03cccb6..c2451f0 100644 --- a/docs/writing-a-function.md +++ b/docs/writing-a-function.md @@ -19,6 +19,7 @@ There is one module per subject, in `src/labbrain/okf/`: | module | holds | |---|---| +| `config.py` | the wiki's own config: `labbrain.yaml` and `topics.yaml` | | `files.py` | reading, writing and walking the wiki's files; which files count as text | | `frontmatter.py` | the hand-written frontmatter parser and writer | | `git.py` | every call to git: blob hashes, history, the repos inside the wiki | @@ -27,6 +28,11 @@ There is one module per subject, in `src/labbrain/okf/`: | `links.py` | wikilinks, broken links, and carrying hashes past link-only edits | | `index.py` | the generated `index.md` listings | | `drift.py` | hot files and drift checks | +| `canvas.py` | pictures of JSON and YAML data, in `_maps/` | +| `hierarchy.py` | the folder summaries as one tree, with the links between them | +| `graph.py` | the wiki's graph: nodes, edges, and the cache of what each file holds | +| `search.py` | code-only search over the graph: headers, full text, links | +| `page.py` | the graph page; its HTML and JavaScript are in `graph_page.html` beside it | | `check.py` | `check`: every conformance test at once | `src/labbrain/cli.py` is the command line. It reads the settings, finds the wiki, calls functions @@ -47,8 +53,9 @@ and prints their results. Nothing else prints. `add_frontmatter` adds its header. Any other metadata goes into a note's header only when the header says `annotate: true`, with an entry in `annotated`, and never replaces `generated`. Other output goes to summaries, `index.md` blocks or logs. -- **Frontmatter goes through `frontmatter.py`.** There is no YAML library on purpose: one would - reorder keys and change quoting. +- **Frontmatter goes through `frontmatter.py`.** PyYAML is never used on frontmatter, on purpose: + it would reorder keys and change quoting. It reads and writes whole YAML data files only, and + reads with `yaml.safe_load`, because a file's content is untrusted. - **Git goes through `git.py`.** - **An error is an exception that takes data.** Arguments in, attributes stored, and the message formatted in `__init__`: @@ -62,7 +69,7 @@ and prints their results. Nothing else prints. ``` - **A one-line docstring,** and comments only where the code isn't obvious. - **No new dependency without a reason,** given in the pull request, or by an agent through - `dev-skills/logging`. The runtime today is the standard library plus `python-dotenv`. + `dev-skills/logging`. The runtime today is the standard library, `python-dotenv` and PyYAML. ## An example Say `check` should flag a folder summary that has no `description`, since `index.md` shows the diff --git a/env/.env.example b/env/.env.example index 84175fe..0273fed 100644 --- a/env/.env.example +++ b/env/.env.example @@ -17,3 +17,7 @@ LABBRAIN_VAULT= # header of each new note signed as LABBRAIN_CONTRIBUTOR, never into anyone else's. Your notes' # text is never touched either way. LABBRAIN_ANNOTATE= + +# How you like `labbrain canvas` to draw: canvas (an Obsidian canvas) or html (a web page). +# Empty means canvas. +LABBRAIN_VIEW= diff --git a/logs/decisions/2026-11-24-links-as-text-and-folder-trees.md b/logs/decisions/2026-11-24-links-as-text-and-folder-trees.md new file mode 100644 index 0000000..6cf6d9e --- /dev/null +++ b/logs/decisions/2026-11-24-links-as-text-and-folder-trees.md @@ -0,0 +1,29 @@ +--- +date: 2026-11-24 +title: Links as text, a folder's own tree, _maps/ at every repo root +decided_by: [human:patrickCNMartin, claude-code/claude-opus-5-5] +--- + +**Work:** committed before this record, in ef72b7d, 8c50ebd and 0d70251, on `feat/yaml-canvas`. + +**Decided:** +- **A box's links are one line of text,** `→ Vision — Summary · Nix — Summary`, each name a link to + its file, not arrows (ef72b7d). A name is the file's `title`, else its file name. The extra boxes + for files no summary covers went with the arrows. +- **`labbrain hierarchy FOLDER...` draws one part of the wiki** into `_maps//`. The tree's + top is the folder's own summary when everything else in it sits under that summary, else the + folder itself. Links that leave the folder stay, to show how it connects to the rest. +- **`_maps/` is skipped at the root of every git repo in the wiki** (8c50ebd), not only at the + wiki's root. + +**Why:** +- On the user's wiki, 246 link arrows crossed whole columns of boxes. Leaving out links along a + branch would have removed only 14 of them. The user chose links as text over hiding them until + hover, or keeping only the links between bundles. +- The user expects people to ask for a picture of one directory, not only of the whole wiki. +- `--vault` can name an inner bundle, which puts `_maps/` in that bundle's root. A later run on the + whole wiki would then have taken the pictures for the bundle summary's sources. + +**Cost:** +- Links no longer show where their target sits in the picture; the name says which summary it is. +- Links to images and PDFs show like any other file a summary links to. diff --git a/logs/decisions/2026-11-24-maps-folder-is-labbrains-own.md b/logs/decisions/2026-11-24-maps-folder-is-labbrains-own.md new file mode 100644 index 0000000..7768d37 --- /dev/null +++ b/logs/decisions/2026-11-24-maps-folder-is-labbrains-own.md @@ -0,0 +1,26 @@ +--- +date: 2026-11-24 +title: _maps/ at the wiki root is labbrain's own +decided_by: [human:patrickCNMartin, claude-code/claude-opus-5-5] +--- + +**Work:** committed before this record, in d9c41ef, on `feat/yaml-canvas`. + +**Discovered:** a git-ignored folder isn't invisible to labbrain. `listdir` skips only dot-names, +so pictures in an ignored `maps/` would still become summary sources, need headers and show up in +listings. + +**Decided:** `listdir` skips `_maps/` at the wiki root, so no command sees it. The picture commands +write `_maps/.gitignore` with `*`, so the folder ignores itself, and a wiki's own `.gitignore` is +never touched. `test_the_maps_folder_is_invisible` holds this against the reference script. + +**Why:** the user wanted the pictures inside the wiki and ignored by git, to try them out. + +**Rejected:** +- **`maps/`:** a lab's own `maps/` folder (genetic maps, site maps) would silently drop out of its + summaries. +- **A dot-folder:** Obsidian hides it, so the canvas couldn't be opened. +- **Making `walk` honour `.gitignore`:** the wiki's root ignores `Shelf/`-style sub-repos that must + still be walked, and it would change every command. + +**Cost:** a wiki that has its own `_maps/` at the root loses it from summaries and listings. diff --git a/logs/decisions/2026-11-24-picture-commands.md b/logs/decisions/2026-11-24-picture-commands.md new file mode 100644 index 0000000..44dfd95 --- /dev/null +++ b/logs/decisions/2026-11-24-picture-commands.md @@ -0,0 +1,29 @@ +--- +date: 2026-11-24 +title: "Pictures: one tree layout, two views, summaries as the tree" +decided_by: [human:patrickCNMartin, claude-code/claude-opus-5-5] +--- + +**Work:** committed before this record, in ea57af9, 05aacac and 7f269fc, on `feat/yaml-canvas`. + +**Decided:** +- `labbrain canvas` draws any JSON or YAML file and `labbrain hierarchy` draws the folder + summaries, both into `_maps/`. Both are experimental. +- **One layout, two views:** an Obsidian canvas or a self-contained web page, chosen by `--view` + or the person's `LABBRAIN_VIEW`. +- **Boxes are text, with the title linking to the file,** not canvas file nodes. Run on a test + file, a file node showed the file but dropped the box's title and description. +- **The tree is worked out from the folders on disk,** with `expected()`, not from the `parent` and + `children` recorded in frontmatter, which can be out of date. +- **A link to a note becomes a link to the summary that covers it** (`covers()`). Links to the + summary's own notes, its parent and its children are left out, since the tree shows them. +- **The web page draws arrows above the boxes,** so an arrow crossing a box can't pass for a link + from it. + +**Why:** the user wanted to see the subjects and their relationships before paying a model to read +the summaries. Everything here can be worked out from paths, frontmatter and links, so it is code. + +**Cost:** +- On the user's wiki (85 summaries, 246 links between them), the tree reads well, but the link + arrows tangle: they cross whole columns of boxes. How to show links is open. +- Subjects inside the summaries, which need a model, are not started. diff --git a/logs/decisions/2026-11-24-pyyaml-runtime-dependency.md b/logs/decisions/2026-11-24-pyyaml-runtime-dependency.md new file mode 100644 index 0000000..145172c --- /dev/null +++ b/logs/decisions/2026-11-24-pyyaml-runtime-dependency.md @@ -0,0 +1,20 @@ +--- +date: 2026-11-24 +title: PyYAML is a runtime dependency +decided_by: [human:patrickCNMartin, claude-code/claude-opus-5-5] +--- + +**Work:** committed before this record, in 67de892, on `feat/yaml-canvas`. + +**Decided:** PyYAML joins the runtime, beside `python-dotenv`. It reads and writes whole YAML data +files, and reads with `safe_load` only. Frontmatter stays with the hand-written parser. + +**Why:** the user asked for pictures of any JSON or YAML file, and expects YAML to be needed for +other jobs later. The rule against a YAML library was about rewriting frontmatter, where key order +and quoting must survive; a whole data file read once has no such need. PyYAML was already in both +locks, through pre-commit. + +**Rejected:** +- **JSON only, or YAML only in the subset the frontmatter parser reads:** neither reads any YAML file. + +**Cost:** a compiled dependency, with wheels for every platform pixi lists. diff --git a/logs/decisions/2026-11-24-wiki-config-graph-search-page.md b/logs/decisions/2026-11-24-wiki-config-graph-search-page.md new file mode 100644 index 0000000..7669012 --- /dev/null +++ b/logs/decisions/2026-11-24-wiki-config-graph-search-page.md @@ -0,0 +1,47 @@ +--- +date: 2026-11-24 +title: The wiki's own config, the graph as a cache, code-first search, the graph page +decided_by: [human:patrickCNMartin, claude-code/claude-opus-5-5] +--- + +**Work:** committed before this record, in fe38bd3, 542234b, d8698ab, 67647eb and 937fcab, on `feat/yaml-canvas`. + +**Decided:** +- **Two levels of configuration** (fe38bd3). A person's settings stay in `env/.env`. Rules for + everyone go in `labbrain.yaml` and `topics.yaml` at the wiki root, committed and changed by + review; no setting overrides them. The vocabulary (topics, synonyms, narrower topics) is its own + file, because it grows and changes often. Both are read once in `cli.py` and passed down field by + field; a bad file stops every command. +- **The graph is a cache** (542234b): built by code from the wiki, never edited, never committed. + Each markdown file is a node; `link`, `covers` and `child` are the edges. Sorted, with no times, + so the same commits give the same bytes. A per-file cache keyed by git blob hash means a rebuild + reads only changed files; links are resolved again on every run. +- **Search climbs a ladder with code only** (d8698ab): headers with the vocabulary, then the full + text only if nothing was found (or `--text`), then links up to `--depth`, plus the summaries over + what was found. The `search` skill runs it before a model reads anything. +- **The graph page** (67647eb, 937fcab): one HTML file with the graph inside and nothing loaded + from elsewhere, so it works from disk or a server, without Obsidian. It opens at the wiki's root; + a click re-centres it; a search puts its hits around the query. The layout is radial and + deterministic. Three colours (summaries, notes, paper concepts) and grey for every other type, + checked for colour-blind readers in light and dark, with summaries drawn larger so colour is never + the only cue. + +**Why:** the user wants to explore the wiki visually and filter what to see, to find the right +files without a model reading the whole wiki, and to run this for a lab on one shared repo, with a +graph agent curating it nightly. On the user's wiki (271 files, 818 links), a full build reads 261 +files in under a second, and a rebuild with nothing changed reads none. + +**Rejected:** +- **A second `.env` for the wiki:** flat lines can't hold a vocabulary, and `.env` is per person, + ignored by git and the place for secrets. +- **Committing the graph:** one large file rewritten every night by several agents and people + would conflict every day. Anyone rebuilds the same graph in seconds; the nightly run can publish a + copy on the lab's server for people without LabBrain. +- **SQLite now:** the graph fits in memory, and the full-text step reads every file only when the + headers find nothing. FTS5 is in both environments' SQLite for when that gets slow. + +**Cost:** +- Search matches words, not meaning: the vocabulary has to carry the synonyms. +- Renaming a file changes its node's id; the graph agent will have to carry curated relations over. +- More than 350 files in view and the page cuts the outer rings. +- The graph agent, which curates topics and relations, is not started: it is on `feat/graph-agent`. diff --git a/pixi.lock b/pixi.lock index 1bc8624..f373af8 100644 --- a/pixi.lock +++ b/pixi.lock @@ -71,6 +71,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2026e-h5d301ff_0.conda - pypi: ./ - pypi: https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/74/27/e5b8f34d02d9995b80abcef563ea1f8b56d20134d8f4e5e81733b1feceb2/pyyaml-6.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl linux-aarch64: - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_10.conda @@ -112,6 +113,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.13-9_cp313.conda - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2026e-h5d301ff_0.conda - pypi: ./ + - pypi: https://files.pythonhosted.org/packages/50/31/b20f376d3f810b9b2371e72ef5adb33879b25edb7a6d072cb7ca0c486398/pyyaml-6.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl - pypi: https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl osx-64: - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.10.23-hbd8a1cb_0.conda @@ -149,6 +151,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-64/zstd-1.5.7-hbc1a06c_7.conda - pypi: ./ - pypi: https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/d1/11/0fd08f8192109f7169db964b5707a2f1e8b745d4e239b784a5a1dd80d1db/pyyaml-6.0.3-cp313-cp313-macosx_10_13_x86_64.whl osx-arm64: - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.10.23-hbd8a1cb_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.13-9_cp313.conda @@ -185,6 +188,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zstd-1.5.7-hf451053_7.conda - pypi: ./ - pypi: https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/b1/16/95309993f1d3748cd644e02e38b75d50cbc0d9561d21f390a76242ce073f/pyyaml-6.0.3-cp313-cp313-macosx_11_0_arm64.whl dev: channels: - url: https://conda.anaconda.org/conda-forge/ @@ -2904,6 +2908,7 @@ packages: name: labbrain requires_dist: - python-dotenv>=1.0 + - pyyaml>=6.0 - ruff ; extra == 'dev' - pytest ; extra == 'dev' - pytest-cov ; extra == 'dev' diff --git a/pyproject.toml b/pyproject.toml index 56b30d7..0d750d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "Tools and skills for agents that read and maintain an OKF lab wiki" readme = "README.md" requires-python = ">=3.11" -dependencies = ["python-dotenv>=1.0"] +dependencies = ["python-dotenv>=1.0", "pyyaml>=6.0"] [project.optional-dependencies] dev = [ diff --git a/skills/canvas/SKILL.md b/skills/canvas/SKILL.md new file mode 100644 index 0000000..21d2793 --- /dev/null +++ b/skills/canvas/SKILL.md @@ -0,0 +1,76 @@ +--- +name: canvas +description: Draw the wiki's folder summaries as one tree, with the links between them, or draw any JSON or YAML file as a tree of boxes, as an Obsidian canvas or a web page; or draw the wiki's graph as a page to explore how files link to each other. Use when asked for a map, picture, canvas, graph, diagram, overview or hierarchy of the wiki or of its subjects, to see what relates to a file or a subject, or to see how a JSON or YAML file nests. Code does all the drawing; the model runs the commands, checks the result and reports what it shows. Experimental. +--- + +# canvas: draw the wiki's summaries, or any JSON or YAML file + +## Why +A wiki with many folders is hard to see whole. Its summaries already know which folder sits under +which and what they link to, so code can draw that without reading a note. The same drawing works +for any JSON or YAML file, to see how its data nests. + +This is experimental: the point is to find out whether the picture is useful. Report what looks +wrong or cluttered, and change nothing to make the picture look better. + +## When +- **When someone asks** for a map, picture, canvas, overview or hierarchy of the wiki, or of a JSON + or YAML file in it. +- **The picture is only as current as the summaries.** Run `labbrain stale` first. If it lists + anything, say so before drawing; offer the `index` skill to bring the summaries up to date. + +## Code versus model +| step | done by | +|---|---| +| which summaries are stale | code: `labbrain stale` | +| the tree of summaries and their links | code: `labbrain hierarchy` | +| the picture of any JSON or YAML file | code: `labbrain canvas` | +| where the files go | code: always `_maps/` at the wiki root, at the path of what was drawn | +| reading the result, and the report | **the model** | + +No step needs a note read. Never write the tree, a link or a picture by hand. + +## Steps +1. **Check the summaries** with `labbrain stale`. If any are stale, say which, and ask whether to + go on or to run the `index` skill first. +2. **Draw.** + - The wiki's summaries: `labbrain hierarchy`. It writes `_maps/hierarchy.yaml` and its picture. + - One part of the wiki: `labbrain hierarchy `, with the folder the person named. It + writes `_maps//hierarchy.yaml` and its picture. Links that leave the folder stay, so + the picture shows how that part connects to the rest. + - A JSON or YAML file: `labbrain canvas `. + - How files link to each other, to explore: `labbrain graph`, then open `_maps/graph.html` in a + browser. For the files about a subject, `labbrain search `, which also draws a page + that opens on them. + - The picture is an Obsidian canvas unless the person's `LABBRAIN_VIEW` says `html`. Add + `--view html` or `--view canvas` only if they ask for that view. +3. **Read the result.** For the summaries, read the `hierarchy.yaml` that step 2 wrote. Look for: + - summaries with no `description`: their boxes show a title only; + - links to notes rather than summaries, because no summary covers them: a folder that may + need a summary; + - a summary that links to many others, or that nothing links to. +4. **Report** in chat: the path of the picture to open, the number of summaries and links, and what + you saw in step 3. Say what you saw, not what it means for the notes: that is for their authors. + +## Rules +- **Write nothing but through `labbrain hierarchy` and `labbrain canvas`.** They write only in + `_maps/`, which git ignores and no other command reads. +- **Never edit a file in `_maps/` by hand.** Every run rewrites it. +- **Don't fix the wiki to improve the picture.** A missing description or a stray link is a finding + to report. Fixing it is a job for the `index` or `drift` skill, and only if asked. + +## Stop and ask +Stop, and wait for an answer, when: +- `labbrain stale` lists summaries (step 1); +- the file to draw isn't in the wiki, or isn't JSON or YAML: `labbrain canvas` refuses it; +- the request is to draw the subjects inside the summaries rather than the summaries themselves. + That needs a model to read the summaries, and isn't built yet. + +Say what you found, the options and the one you recommend. + +## Running labbrain +Run `labbrain ` from the wiki root, or from anywhere with `--vault `. File +arguments are relative to where you run it, and must be inside the wiki. If `labbrain` isn't on your +PATH, stay in the wiki and run it through a LabBrain checkout: +`pixi run --manifest-path /pixi.toml labbrain `, or +`uv run --project labbrain `. diff --git a/skills/okf-conventions/SKILL.md b/skills/okf-conventions/SKILL.md index 9a3b955..f6c8f12 100644 --- a/skills/okf-conventions/SKILL.md +++ b/skills/okf-conventions/SKILL.md @@ -76,6 +76,9 @@ sources: # every file it was built from, with its git bl - **You write `title`, `description` and the body. Code writes the rest.** Run `labbrain stamp --by `: it lists the sources, hashes them, and sets `generated`, `parent` and `children`. Never fill these in by hand. +- **`topics`,** optional, lists what the summary is about, from the wiki's vocabulary in + `topics.yaml`: `topics: [proteomics, normalization]`. A topic that isn't in the vocabulary is a + proposal for a person, not a value to write. The graph and search read it. - **`sources`** are every text file in the folder, plus the files in subfolders that have no summary of their own. They never include the summary itself, `index.md` or `log.md`. - **Why a hash:** it is the git blob id. `git cat-file -p `, run in the owning repo, prints the @@ -86,7 +89,7 @@ sources: # every file it was built from, with its git bl - **Human review** is OKF's `verified: { by: human:, at: