Skip to content

Feat(yaml canvas): converting yaml into canvas and searchable graphs. - #3

Open
patrickCNMartin wants to merge 23 commits into
mainfrom
feat/yaml-canvas
Open

patrickCNMartin wants to merge 23 commits into
mainfrom
feat/yaml-canvas

Conversation

@patrickCNMartin

Copy link
Copy Markdown
Collaborator

Pictures, a graph and code-only search for the wiki (experimental)

Ways to see and search a wiki without a model reading all of it. Everything here is code; no LLM calls.

Commands

  • labbrain canvas FILE...: draws any JSON or YAML file as a tree of boxes, as an Obsidian canvas or a web page.
  • labbrain hierarchy [FOLDER...]: the folder summaries as one tree, with the links between them, for the whole wiki or one folder.
  • labbrain graph: the wiki as a graph in _maps/graph.json. Each markdown file is a node, with link, covers and child edges. A rebuild reads only files whose git hash changed. Also draws graph.html, a self-contained page to explore it in any browser.
  • labbrain search WORD...: headers first (title, description, path, tags, topics), then full text only if needed, then the links around the hits. It writes the results and a page that opens on them.

Config and conventions

  • Wiki-level config, committed with the wiki: labbrain.yaml (graph page options) and topics.yaml (topic vocabulary with synonyms). Person-level settings stay in env/.env, which gains LABBRAIN_VIEW.
  • _maps/ is labbrain's output folder: git-ignored, and no other command looks inside it. The config files are likewise left out of summaries and listings.
  • PyYAML is now a runtime dependency (safe_load only). Frontmatter keeps its hand-written parser.
  • New canvas skill. The search skill now runs labbrain search before reading files.

Checks

  • 141 tests pass and lint is clean.
  • Parity with okf_vault.sh holds, apart from the documented differences.
  • Tried on a real 271-file wiki: no tracked file changed, and stale output was identical before and after.

Not in this PR: the nightly graph agent that curates topics and relations, which will go on feat/graph-agent.

17 commits; decisions are recorded in logs/audit_log.md.

🤖 Generated with Claude Code

patrickCNMartin and others added 23 commits November 24, 2026 14:27
Frontmatter stays with the hand-written parser; PyYAML reads with
safe_load only. Needed now for the canvas views, and later for other jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
listdir skips it, so the pictures the canvas commands will draw there can't
make a summary stale, need a header, or show up in a listing. Named with an
underscore so a lab's own maps/ folder is never hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An Obsidian canvas or a self-contained web page, chosen by --view or the new
LABBRAIN_VIEW setting. Pictures go in _maps/, which ignores itself in git.
title, description, path, children and links shape the picture; every other
key is drawn as it nests. YAML is read with safe_load only. Experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Writes _maps/hierarchy.yaml from the summaries' frontmatter and links, then
draws it as canvas does. Code only: no model, no note read. A link to a note
becomes a link to the summary that covers it; links the tree already shows
are left out. The web page now draws arrows above the boxes, so a crossing
can't pass for a link from the box it crosses. Experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The model runs labbrain stale, hierarchy or canvas, reads the tree, and
reports what it shows; code does all the drawing. Experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a real wiki, 45 such files made one row 23,000 px wide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a real wiki, 246 link arrows crossed whole columns of boxes. Each box now
ends with one line, "→ Garden — Summary · Beans", each name a link to its
file. The extra boxes for unlinked files and the arrow routing go with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --vault naming an inner bundle, pictures land in <bundle>/_maps/, and a
later run on the whole wiki would have taken them for the bundle summary's
sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each FOLDER gets its own tree, in _maps/<FOLDER>/. Its 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two levels of configuration: a person's settings in env/.env, and rules for
everyone in two committed files at the wiki root. labbrain.yaml holds the
graph page's hidden note types and file URL; topics.yaml is the vocabulary,
with synonyms and narrower topics. Read once in cli.py; a bad file stops
every command. No summary covers them and no listing shows them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each markdown file a node; link, covers and child edges. Deterministic:
sorted, no times, the same bytes for the same commits. A per-file cache keyed
by git blob hash means a rebuild reads only the files that changed; links
are resolved again on every run. Git ignores it all. Experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step 1, the headers (title, description, path, tags, topics), widened by the
wiki's vocabulary; step 2, the full text, only when step 1 finds nothing or
with --text; step 3, the files linked to what was found, up to --depth, and
the summaries over them. Writes what it found to _maps/search/ in the graph's
format. The search skill now runs it before reading anything. Experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One HTML file with the graph inside, nothing loaded from elsewhere. Opens at
the wiki's root; a click puts a file in the middle, with rings 1, 2, 3 away;
a search (headers, with the vocabulary) puts its hits around the query. Show
and hide edges, types and paths; the side panel lists all in view. labbrain
graph draws _maps/graph.html; labbrain search draws a page that opens on
what it found. Colours validated for colour-blind readers, in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a real wiki, side-by-side labels on a ring overlapped and labels on the
edge were cut off. Labels now point outward (turned over on the left half),
are cut at 28 characters, and the view fits them in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… graph page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… decision records

logs/audit_log.md is main's, frozen: the five entries this branch appended
there move to logs/decisions/, one file each, in the commits that follow.
The dependency rule keeps main's wording and names PyYAML in the runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decision record for work already committed on this branch; it was an entry
in logs/audit_log.md before main froze that file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decision record for work already committed on this branch; it was an entry
in logs/audit_log.md before main froze that file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decision record for work already committed on this branch; it was an entry
in logs/audit_log.md before main froze that file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decision record for work already committed on this branch; it was an entry
in logs/audit_log.md before main froze that file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…raph page

Decision record for work already committed on this branch; it was an entry
in logs/audit_log.md before main froze that file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patrickCNMartin patrickCNMartin changed the title Feat/yaml canvas Feat(yaml canvas): converting yaml into canvas and searchable graphs. Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant