Federation map
The federation map draws an instance’s external world: the instances it federates with, the peers those peers list, and the sources and ecosystems its knowledge comes from. It is two pieces with one file between them. org-os-kms reads the instance’s files and writes map.json (the data plane); @org-os/federation-map is a <federation-map> web component that reads map.json and draws it (the view). The package README calls it “the torch”; it is the counterpart of the internal note graph. The design is in the federation map spec.
Status. Both packages are version 0.1.0. Their tests pass (org-os-federation-map 19, the map-related org-os-kms suites 26 in this pass), and the map runs on the project site. Modules lists the package under the federation module, which is live there. No operator other than the maintainer has run it on an instance of their own.
The commands, from the instance directory (all but the frontier fetch read and write local files only):
node packages/org-os-kms/src/cli.mjs render map # data/kb/map.json
node packages/org-os-kms/src/cli.mjs federate frontier # ring 2: fetch peers' manifests, one hop out
node packages/org-os-kms/src/cli.mjs render map html # renders/federation-map.html + renders/federation-links.md
render map takes --dir <instance> (default .), --out <path> (default data/kb/map.json, relative to --dir) and --surface web|vault (default web). render map html takes --dir and --out (default renders/federation-map.html). Neither needs kms.yaml; the map degrades to what it finds. The only hard requirement is a federation.yaml with identity.name; without it the command stops with no federation.yaml with identity in: <dir>.
For how federation itself works (the manifest, trust levels, peers), see Federation. The knowledge system overview is docs/KMS.md, and publishing its output is docs/KMS-PUBLISHING.md (both written in the same pass).
The three rings
| Ring | Nodes | Comes from |
|---|---|---|
| 1 | instance | federation.yaml: every entry of peers, upstream and downstream; and each key of peers: in kms.yaml (knowledge peers) |
| 2 | frontier | the cache written by federate frontier: the peers listed in each ring-1 peer’s own federation.yaml |
| 3 | source, ecosystem | data/source-systems.yaml (sources) and data/ecosystems.yaml (curated ecosystems) |
The instance itself is self, in the centre (ring 0 in the drawing). A node is added once: if a frontier peer is already in ring 1, no new node is created and only an edge is added. An entry whose id equals the instance’s own is skipped.
Edges carry a kind:
| Kind | From to | Meaning |
|---|---|---|
federation, upstream, downstream | self to ring-1 instance | the section of federation.yaml the peer was listed in |
knowledge | self to ring-1 instance | a peer named in kms.yaml |
frontier | ring-1 instance to frontier node | listed in that peer’s manifest |
provenance | source to self; ecosystem to source | where knowledge came from; an ecosystem groups the sources it lists in sources: |
Building map.json
buildMap (src/map.mjs in the knowledge-system package) does only filesystem reads: no network. What it takes, in order:
federation.yaml:identity.name,type,emoji;hubbecomes the selfurl. For each peer, upstream or downstream entry:id(orname),name,type,trust,url,repo, andlocal_path. Iflocal_path(relative to--dir) exists, the node islive: true,last_seenis the generation time, andcountstakes the length ofmembersin that peer’s.well-known/members.jsonand ofprojectsin its.well-known/projects.jsonwhen those files exist. Otherwiselive: false.kms.yaml: only the keys ofpeers; each becomes a bare ring-1 node.data/source-systems.yaml: each entry becomes asourcenode (idortitle,ecosystem,url). Ifdata/kb/index.jsonexists, itstotalis copied tocounts.objects.portal_webor, with--surface vault,portal_vault, becomes the node’sportallink. This file is not in the framework repository itself, so a framework checkout has no source nodes.data/ecosystems.yaml:ecosystems:withid,name,url, andsources:(ids of source nodes that are present).data/federation/frontier/<id>.json: the frontier cache. A snapshot for an id that is no longer a node is ignored.
Every file except federation.yaml is optional, and an unreadable or malformed file is treated as absent.
The shape of the result:
{
"version": "1",
"generated_at": "2026-10-10T05:52:26.209Z",
"self": { "id": "org-os", "name": "org-os", "type": "Project", "emoji": "🧬", "url": null },
"nodes": [
{ "id": "peer-os", "kind": "instance", "name": "Peer", "type": "LocalNode", "ring": 1,
"trust": "full", "live": true, "url": "https://...", "repo": "owner/peer-os",
"counts": { "members": 3, "projects": 26 }, "last_seen": "2026-10-10T05:52:26.209Z" },
{ "id": "child", "kind": "frontier", "name": "Child", "type": null, "ring": 2,
"live": false, "url": null, "repo": null, "counts": {} },
{ "id": "src", "kind": "source", "ring": 3, "ecosystem": "eco", "portal": null, "counts": { "objects": 14 } },
{ "id": "eco", "kind": "ecosystem", "ring": 3, "url": "https://...", "counts": {} }
],
"edges": [
{ "from": "org-os", "to": "peer-os", "kind": "downstream" },
{ "from": "peer-os", "to": "child", "kind": "frontier" },
{ "from": "src", "to": "org-os", "kind": "provenance" }
]
}
Node fields the view uses: id and kind are required; name, type, ring, trust, live, url, repo, portal, ecosystem, counts (any numeric map) and last_seen are optional. A render map run in this pass over a copy of this repository’s federation.yaml and data/ecosystems.yaml gave 12 nodes (9 instances, 3 ecosystems) and 9 edges, all of kinds federation and downstream: ring 2 was empty because no frontier cache was copied, and the instances were all live: false because their local_path directories were not there.
The frontier fetch
federate frontier (src/frontier.mjs) is the only step that can touch the network. For each entry of peers, upstream and downstream:
- If its
local_pathholds afederation.yaml, that is read (sourcelocal); no network. - Otherwise, if the entry has a
repo(owner/name), it fetcheshttps://raw.githubusercontent.com/<repo>/HEAD/federation.yaml, with an 8-second timeout per peer. - Otherwise the peer is reported
skipped: no local_path or repo.
The peers named in that manifest (peers, upstream, downstream, reduced to id, name, repo, url, type) are written to data/federation/frontier/<id>.json with fetched_at and source. A peer that cannot be reached is reported unreached and its existing cache file is left alone, so a failed fetch never blanks the map. render map reads only this cache, never the network. Per peer, failures never fail the command: it returns ok: true and a per-peer report, so read the report, not the exit code. A missing or unreadable federation.yaml does throw, and the exit code is 1. It is one hop only: peers of peers, not peers of those.
The cache files are tracked content in this repository, so commit them if you want the frontier in a build made elsewhere.
The HTML artifact
render map html writes one self-contained file, renders/federation-map.html (or --out): the map data and the built component (packages/org-os-federation-map/dist/federation-map.iife.js) are both inlined, so it opens offline. It builds the map with --surface vault, so portal links use the vault surface (obsidian:// links). It also writes renders/federation-links.md (always at that path under --dir), a note listing every node grouped as Instances, One hop beyond, Sources and Ecosystems, each linking to federation-map.html#node=<id>, so a note can link into the map and the map’s panel can link back out. Both files carry one shared timestamp.
The bundle is a committed build output. If you change the component, run npm run build inside packages/org-os-federation-map (it uses esbuild, a dev dependency) before rendering, or the artifact inlines the old one; test/dist.test.mjs checks that the committed bundle exists and is self-contained.
The <federation-map> element
@org-os/federation-map 0.2.0 (on main since org-os 0.7.0) draws the map as the “house map”: layered by the direction knowledge travels, static first, keyboard-complete, with a list twin. It has no dependencies; the d3-force rings of earlier versions are gone.
<script src="packages/org-os-federation-map/dist/federation-map.iife.js"></script>
<federation-map src="/map.json"></federation-map> <!-- fetch -->
<federation-map data-surface="vault"><script type="application/json">{…}</script></federation-map>
<federation-map mode="mini" href="/federation"><script type="application/json">{…}</script></federation-map>
Without a bundler, load the committed bundle with a plain <script src>. Importing src/index.mjs directly needs a bundler; the project site does that through Vite. The package README writes the bare specifier @org-os/federation-map, which works only if the package is installed under that name; nothing in this repository shows it published to a registry.
| Attribute | Values | Effect |
|---|---|---|
src | URL of a map.json | fetched when the element connects |
inline <script type="application/json"> child | the map data | wins over src |
mode | full (default), mini | mini draws the small map: this instance and up to six neighbours, 188px tall, the whole element one link |
href | a URL, default # | where the mini map links |
data-surface | vault, or absent | vault is the steward’s copy (attention marks, vault links); without it you get the public copy, where peers not reached read “not mapped” |
The layout (src/layout.mjs) is pure and has no imports. From top to bottom: one hop beyond, over the upstream instance that reported it; what feeds this instance (upstream instances and sources, an ecosystem’s sources grouped); the centre row (this instance, its federation peers on one side, its knowledge peers on the other, and their one-hop-beyond nodes further out); downstream instances; and one hop beyond below them. Inputs are sorted first, so the same map.json always gives the same picture, and positions are computed, never stored. Names and facts wrap; they are never cut.
Behaviour. The element draws the static map (src/static.mjs, the same HTML kms pre-draws so its pages work without JavaScript) into its shadow root at its own width, then adds selection, keys, the List · Map toggle, Fit, zoom and the #node=<id> deep link. Tab enters at this instance or the deep-link target; arrow keys move along edges; Enter opens the node’s first safe link (safeUrl allow-lists link schemes); Space fills the caption; Esc leaves the map; v toggles List · Map; ⌘0 fits, and ⌘+ / ⌘− (or ctrl-wheel) zoom between 50 and 200 %. A button outside the element with data-fm-view="list" or "map", or data-fm-fit, drives the map its aria-controls names (with none, the page’s first map), and the element keeps its aria-pressed in step. Data that cannot be read (not JSON, a failed fetch, no nodes) shows “No federation data yet. Run org-os-kms render map.” and never throws; a page kms pre-drew keeps its drawing instead.
Theme. The element reads the house tokens from the page (--paper, --edge, …); when the page has none it uses the house values in src/house-tokens.mjs, generated from kms’s house-tokens.css by scripts/sync-tokens.mjs. Light and dark follow the reader’s setting. For one release the old --fedmap-bg, --fedmap-text and --fedmap-font are still read, as aliases of --sunken, --ink and --sans.
Exports (src/index.mjs; importing it registers the element): FederationMap, MapController, define, nodePanelHTML, safeUrl, normalizeMap, layoutMap, nearestInDirection, LAYOUT, EDGE_WORDS, nodeView, statusLine, captionSentence, renderStaticMap, renderListTwin, renderSmallMap, renderCaption, esc, ICONS_USED, MAP_ICONS, mapSprite and HOUSE_TOKENS_CSS.
Building. npm run build inside the package (esbuild, its only dev dependency) writes dist/federation-map.iife.js with map.css bundled as text. The bundle is committed; test/dist.test.mjs checks it exists, is self-contained and carries no d3.
How the project site uses it
site/scripts/aggregate-federation.mjs runs as npm run aggregate in site/. npm run dev runs it first; npm run build runs npm run clean first, then it (site/package.json). It does two things. Before any of them it checks that the two installs exist (the repository root and site) and, if one is missing, stops with a sentence that names it.
- It reads
data/instances.yaml, leaves out every entry markedlisted: false, and writessite/src/data/federation.json. That file holds six things:root(the framework’s ownname,typeandrepo);nodes(for each instance that is left, onlyname,typeandrepo);registered, the number of those instances;operational, the number of them whose maturity isproductionin the registry;operationalDefinition, one sentence that says how that count is set; andgeneratedAt, the time of the run. If an entry has alistedthat is nottrueorfalse(for example"false",noor0), the run stops with a sentence that names the entry and writes nothing, because the entry would otherwise be published. The registry’s other fields, including its notes, are not published;site/scripts/federation-aggregate.mjsholds the three-field list (PUBLIC_FIELDS) and thelistedrule (isListed), andsite/scripts/verify-build.mjsfails the build if more reachesdist/or if an unlisted entry is infederation.jsonor in the page’s list. - It calls
buildMapon the repository root with the surface set toweb, passes the result throughquietMapand thenpublicMap, and writes it twice:site/src/data/map.jsonandsite/public/map.json.quietMapremoveslive: falseand alast_seenofnullfrom each node. A node whose checkout was not beside the repository at build time (always the case in CI) therefore carries no status, and the map prints none. A node that was read keepslive: trueand itslast_seen.publicMap(site/scripts/map-addresses.mjs) applies the list’s rule to the map: it leaves out each node whose registry entry is markedlisted: false, its edges, and each node that was reached from the centre only through one. A node no edge reaches, such as an ecosystem on ring 3, stays. It then drops eachurlorrepothat is not anhttpsaddress, that is a folder inside another GitHub repository (a/tree/or/blob/path), that is a repository on itsPRIVATE_REPOSlist, or that is under a GitHub name on itsUNREGISTERED_OWNERSlist; the node stays without it. Both lists are kept by hand in that file.verify-build.mjsruns the same checks ondist/map.jsonand fails the build on anything that got through.
The site does not publish the repository’s .well-known/ files. They are the hand-written 0.5 files, and the generator cannot rewrite them for this site: it builds every address from the origin of identity.daoURI, and the site is served under a sub-path. The aggregator removes any site/public/.well-known/ an earlier build left, and the verifier fails the build if dist/.well-known/ exists.
site/src/components/FederationMapIsland.astro renders <federation-map src=".../map.json">, imports the component from packages/org-os-federation-map/src/index.mjs, and offers a mini variant that links to the /federation page. The home page uses the mini variant; the /federation page uses the full map and, below it, a list of the registered instances that are not marked listed: false (name, type and a link to the repository), read from federation.json. The site build does not run federate frontier, so the site’s ring 2 is whatever is in the committed data/federation/frontier/ cache.
The files
| File | Role |
|---|---|
federation.yaml, kms.yaml (peers), data/source-systems.yaml, data/ecosystems.yaml, data/kb/index.json, <peer>/.well-known/{members,projects}.json | read by render map |
data/federation/frontier/<id>.json | written by federate frontier, read by render map |
data/kb/map.json | written by render map (ignored by git in this repository) |
renders/federation-map.html, renders/federation-links.md | written by render map html |
packages/org-os-federation-map/dist/federation-map.iife.js | the committed bundle inlined in the HTML |