← All writing

The night sky as a graph, with Relate by Neo4j

What I'd tell a customer about Relate, learned by mapping 16,846 stars.

I work with some of our largest customers on their most complex challenges: deciding whether a graph fits, modeling the domain, and designing architectures that scale and stay highly available. The case for a graph is rarely the hurdle. Getting to the first query is: a server to provision, an account to create, a security review before a single row of real data goes in.

On November 11, at NODES 2026, Neo4j launched Relate, an open-source embedded graph database that removes that hurdle. It runs inside whatever you’re building: a library in Python, JavaScript, Rust, Java, Go or Swift, a command-line tool, or WebAssembly in a browser. There’s no server and no signup, and it speaks Cypher, the same query language as Neo4j.

I wanted to feel that from the user’s side, so I picked a dataset I love: the night sky. One file, sky.rl, holds every naked-eye star, every confirmed exoplanet, the 88 constellations and the missions that found those worlds. An agent built it, any agent can query it, and it powers the map below with no server behind this page.

Disclosure: I’m a Solutions Engineer at Neo4j. This is a personal project, and the opinions (and any bugs) are mine.

The sky, live in your browser

The map loads when you scroll here.

Cypher
Every naked-eye star and every known exoplanet host, with the queries running live in your browser on Relate compiled to WebAssembly (about 3 MB to download).

Everything above runs on your machine. Browsers can’t open a .rl file directly, so the page loads a 2 MB export of sky.rl, with just the fields the map needs, into an in-memory Relate database, compiled to WebAssembly and running in a Web Worker. It’s usually ready in a few seconds, depending on your connection and device, and your queries never leave your computer.

One file, two audiences Open data (the HYG star catalog, the NASA Exoplanet Archive and d3-celestial constellation lines) goes to Claude Code with the Relate skill, which builds sky.rl: one file, no server. sky.rl feeds the map in your browser, running Relate as WebAssembly in a Web Worker, for people; and your agent, through relate serve over MCP, read-only, with SKY.md, for agents. for people for agents Open data HYG star catalog NASA Exoplanet Archive d3-celestial constellation lines Claude Code with the Relate skill sky.rl one file, no server Map in your browser Relate (WebAssembly) in a Web Worker Your agent relate serve over MCP read-only, with SKY.md
One file, two audiences: built once from open data by an agent, then read by people in the browser and by agents over MCP.

One file, built once by an agent, serves both audiences: the map for people, and an MCP server for agents. Neither needs a server of mine.

The graph

The night-sky graph model Five node types. A Planet ORBITS a Star, was FOUND_BY a Mission and DETECTED_VIA a Method. A Star is IN a Constellation. Stars connect to other stars with LINE_TO (constellation stick figures) and NEAR, which carries the distance in light-years. FOUND_BY DETECTED_VIA ORBITS IN LINE_TO NEAR {ly} Mission73 Method11 Planet6,473 Star16,846 Constellation88
Star
name, ra_deg, dec_deg, mag, dist_ly, x_ly/y_ly/z_ly, spect, naked_eye, is_host
Planet
name, radius_earth, mass_earth, period_days, eq_temp_k, insolation, disc_year, features (a 5-number vector for similarity search)
Constellation · Mission · Method
abbr and name · name and locale (space or ground) · name
NEAR {ly}
11,688 links between stars within 100 ly of the Sun that are at most 10 ly apart
LINE_TO
743 stick-figure segments between naked-eye stars
The graph model: five kinds of nodes and six kinds of relationships. Numbers are node counts.

The whole model fits on a whiteboard, which is how I start most customer conversations: five kinds of things and the connections between them.

  • 16,846 stars: every star you can see with the naked eye (magnitude 6.5 or brighter), every star known to host a planet, and every catalogued star within 100 light-years of the Sun.
  • 6,473 planets: each one ORBITS its star, was FOUND_BY one of 73 missions or observatories, and was DETECTED_VIA one of 11 methods.
  • 88 constellations: every star sits IN one, and 743 LINE_TO links draw the stick figures on the map.
  • 11,688 NEAR links: each joins two stars within 100 ly of the Sun that are at most 10 ly apart, with the distance stored on the link.

Each planet also carries a five-number fingerprint: radius, mass, orbital period, temperature and the starlight it receives, each scaled from 0 to 1. Comparing fingerprints tells you how alike two planets are. It’s a likeness score, not a habitability index.

Notice where the interesting data lives: on the connections. The distance sits on NEAR, just as the amount sits on a payment or the lead time on a supplier link in the models I build with customers. That’s the part a table of rows struggles to express, and the part a graph makes easy to ask about.

An agent built this graph

I didn’t write the pipeline. I gave Claude Code one prompt, and with Relate’s agent skill installed, it built, loaded and verified sky.rl in a single 26-minute session, about 22 minutes of it working on its own.

That works because Relate is designed for an agent to pick up, not just a developer:

  • It installs itself. One command adds the CLI and a skill that teaches the agent Relate’s commands, and relate agent-context gives the reference for the exact version installed.
  • There’s nothing to provision. No server and no signup means nothing for an agent to get stuck on. The database is a single file it creates and queries, and you can commit it to git.
  • It speaks Cypher. Agents already know the language, so most of what this one fixed was in the data (a missing version tag, a split constellation, a duplicate star), not in learning the database.
  • Its output is built for agents. In agent mode, Relate returns compact results and errors that explain what to do next.
  • It fits the agent you already use. The skill installs into Claude Code, Cursor, Codex, Gemini CLI and others, and relate serve exposes any database to any MCP client.

I stepped in exactly once. The 6-light-year route I’d asked for doesn’t exist, so the agent stopped, explained why, and offered three options. I took its recommendation of adding every catalogued star within 100 ly and report both the strict and the relaxed answers.

Two pieces of the Cypher it wrote. The NEAR links, loaded in batches from Python (build.py):

UNWIND $rows AS r
MATCH (a:Star {id: r.from}), (b:Star {id: r.to})
CREATE (a)-[:NEAR {ly: r.ly}]->(b)

And the check that explains why the strict route fails, listing every star you can reach from the Sun in jumps of 6 ly or less (verify.py):

MATCH (sun:Star {name: $from})
MATCH (sun)(()-[r:NEAR]-() WHERE r.ly <= $max){1,8}(x:Star)
WHERE x <> sun
RETURN count(DISTINCT x) AS reachable, max(x.dist_ly) AS farthest_from_sun_ly,
       collect(DISTINCT x.name) AS stars

My take:

  • I reviewed results more than lines. I checked the counts and the three answers against what I know of the sky, and skimmed the scripts. I also tried running some more interesting Cypher queries on my own.
  • By hand, I’d have hit the same snags, just slower. The missing version tag, the split Serpens and the duplicate star are data problems, and I’d have spent an evening on them instead of 22 minutes.
  • The skill did the quiet work. The agent read it before writing code, so most of what it fixed was about the data, not about Relate. Same lesson as SKY.md below: agents do far better when the tool ships its own instructions.

Three questions only a graph answers well

Each of these is a question I hear in some form from customers, dressed up in starlight. The Cypher for each is in the tabs on the map above, so you can run it yourself.

Query 1: Can you hop from the Sun to TRAPPIST-1?

TRAPPIST-1 is a small red star 40.5 light-years away with seven Earth-sized planets. Suppose your ship can only jump 6 light-years at a time. Is there a route?

No. A 6-light-year ship can reach just five stars: Proxima Centauri, Rigil Kentaurus and Toliman (the Alpha Centauri pair), Barnard’s Star and Ross 154. Then it’s stuck. The smallest jump that works is 8.21 ly. Allow 8.5 ly and the trip takes 19 jumps and 124.4 ly: Sun → Barnard’s Star → Ross 154 → Lacaille 8760 → GJ 876 → and onward, detouring out to about 56 ly before swinging back in. One caveat: star catalogs miss many faint red dwarfs, so the real neighborhood probably has more stepping stones.

Relate’s SHORTEST path with a rule on every hop got exponentially slower as routes grew, so the agent computed routes in Python and confirmed each hop with Cypher. At real scale, this is where I’d reach for Neo4j’s Graph Data Science library, which ships weighted shortest-path algorithms built for exactly this.

MATCH (sun:Star {name: 'Sun'}), (t:Star {name: 'TRAPPIST-1'})
MATCH p = SHORTEST 1 (sun)-[r:NEAR WHERE r.ly <= 6]-+(t)
RETURN [n IN nodes(p) | n.name] AS route

Where this shows up at work: any question of the form “can we get from A to B under a constraint?” Think of shipments routed only through lanes under a capacity limit, network paths that avoid a failing link, or money moving through accounts under a reporting threshold. A path with a rule on every step is a graph question.

Query 2: Earth-like planets you can point at

Which planets most resemble Earth and orbit a star you can see without a telescope? The query ranks every planet by how close its fingerprint is to Earth’s, then follows ORBITS to its star and IN to its constellation, keeping only naked-eye stars.

τ Ceti h and τ Ceti f lead, around Tau Ceti in Cetus, 11.9 ly away. Next come HD 20794 e, d and f, orbiting 82 Eridani in Eridanus, 19.7 ly away. Then HD 219134 f and d in Cassiopeia, τ Ceti g, and HD 136352 d in Lupus. From a dark site, you can find Tau Ceti and 82 Eridani yourself.

MATCH (p:Planet)-[:ORBITS]->(s:Star {naked_eye: true})-[:IN]->(c:Constellation)
WHERE p.features IS NOT NULL
WITH p, s, c, vector.similarity.euclidean(p.features, $earth) AS similarity
RETURN p.name, s.name, c.name, similarity
ORDER BY similarity DESC LIMIT 10

Where this shows up at work: any question of the form “find things like this one that are also connected to that.” Think of products like the one a customer viewed that are in stock near them, customer records that look alike and share an address, or transactions that resemble a known fraud pattern and touch a flagged account. Similarity alone returns lookalikes; the connections make them relevant. Relate lets one Cypher statement combine similarity search with following connections, so there’s no second store to glue on.

Query 3: Where the worlds are, and how we found them

Count planets by their star’s constellation and two names dominate: Cygnus with 1,683 and Lyra with 1,062. That’s not where planets cluster; it’s where the Kepler space telescope stared for four years. Draco follows with 319, and Sagittarius has 239, mostly found by microlensing toward the crowded center of our galaxy.

The detection methods tell the same story over time:

Decade Radial velocity Transit
1990s 27 0
2000s 285 60
2010s 462 3,078
2020s (so far) 430 1,662

Transit took over in the 2010s, when Kepler, and later TESS, started catching planets as they crossed in front of their stars.

MATCH (p:Planet)-[:ORBITS]->(:Star)-[:IN]->(c:Constellation)
RETURN c.name AS constellation, count(p) AS planets
ORDER BY planets DESC
MATCH (p:Planet)-[:DETECTED_VIA]->(m:Method)
RETURN p.disc_decade AS decade, m.name AS method, count(p) AS planets
ORDER BY decade, planets DESC

Where this shows up at work: the map of planets is really a map of where we’ve looked. Customer data works the same way. Counting along connections, such as exposure by counterparty or incidents by owning team, often reveals the bias in how the data was collected before it reveals anything about the world.

Bring your own agent

The map is for people. The same file works for agents too. relate serve turns sky.rl into a read-only MCP server with two tools, one to read the schema and one to run Cypher, so Claude, or any agent that speaks MCP, can answer questions about the sky in plain English. Writes are rejected, so nothing an agent does can change the data.

I tested this with a fresh Claude Code session that had nothing but this server, asking the three questions above. With SKY.md, a one-page guide to the schema, it got all three right in four turns. Without it, it got two of three: it never found the planet fingerprints and invented its own Earth-likeness score.

That’s the lesson I’d pass on to any team putting agents on their data: ship the meaning with the data. A schema tells an agent what exists; a short guide tells it what things mean and which pitfalls to avoid. One short Markdown file fixed the one wrong answer.

1. Install Relate.

curl -sSfL https://relatedb.ai/install.sh | bash

The binary lands in ~/.local/bin/relate. Check it with relate --version. I tested with Relate 1.3.0.

2. Build the graph yourself. The pipeline fetches the three public datasets, builds sky.rl and checks it with the three queries above. It needs Python 3.9 or newer and takes a minute or two, most of it installing Python packages the first time.

git clone https://github.com/dhodapkarsoham/sky-graph.git
cd sky-graph
./run.sh

You end up with sky-graph/sky.rl, about 49 MB. That’s much bigger than the 2 MB the map loads because the file also holds every catalog column, the indexes and the database’s own storage overhead. The star catalog and constellation lines are pinned to fixed versions, but the planet list comes live from the NASA Exoplanet Archive, so a later build will have a few more planets than the 6,473 in mine.

3. Give your agent the guide. SKY.md describes every label, relationship and property with units, the things that trip queries up, and five example questions with their Cypher. Save it next to sky.rl and hand it to your agent.

4. Serve it read-only over MCP.

relate serve --database /absolute/path/to/sky.rl --mcp stdio --read-only

--mcp stdio speaks MCP on stdin and stdout, which is what desktop agents expect, and --read-only opens the file without a write lock so every write is refused. You don’t run this yourself; your MCP client starts it. The server offers two tools: get_schema and read_cypher.

Claude Code, one line:

claude mcp add sky -- relate serve --database /absolute/path/to/sky.rl --mcp stdio --read-only

Claude Desktop: open Settings → Developer → Edit Config and add a sky server to claude_desktop_config.json. Use the full path to relate, because the desktop app doesn’t see your shell’s PATH.

{
  "mcpServers": {
    "sky": {
      "command": "/Users/you/.local/bin/relate",
      "args": ["serve", "--database", "/Users/you/sky-graph/sky.rl", "--mcp", "stdio", "--read-only"]
    }
  }
}

Restart Claude Desktop, then attach SKY.md to your first message.

5. Ask it something. Start with these three:

  • Which planets are most Earth-like, and in which constellations are their host stars?
  • What’s the shortest route from the Sun to TRAPPIST-1 with jumps of 6 ly or less?
  • Which detection method found the most planets each decade?

One caveat from testing. The route question has a trap: no route exists at 6 ly, and a relaxed route needs 19 jumps. Relate 1.3.0 evaluates a per-hop filter in SHORTEST by enumerating paths, and relate serve has no statement timeout. Asking for that long a route (say, jumps up to 8.5 ly) runs until you restart the server. SKY.md warns agents about this and suggests pulling the edges and running Dijkstra instead, which is what the map does.

Relate’s agent quickstart covers setting it up for other agents, including Cursor, Codex and Gemini CLI.

Relate or Neo4j database (Aura/Enterprise Edition)?

The question I’ll get most after this post is “why not just use Neo4j?” My answer: they aren’t rivals. Neo4j is where your graph lives; Relate is where your graph travels. The same Cypher runs on both, and the deployment shape decides which one you reach for.

If you need… Reach for
A graph inside an app, notebook, browser page or agent sandbox, with nothing to host Relate
A throwaway graph per task, per session or per agent Relate
Data that stays on the device, or works offline Relate
One graph that many users and services read and write at once Neo4j: AuraDB or self-managed
Large graphs, high availability and enterprise security Neo4j: AuraDB or self-managed
Graph algorithms at scale, such as weighted paths, centrality and communities Neo4j Graph Data Science or Aura Graph Analytics

This post sits firmly in the top half. It’s a few thousand read-only records, one reader at a time, on a static site that can’t run a server. Every reader gets a private copy, so there’s nothing to scale, secure or keep running, and the page will still work years from now.

The two also work together. You can pull a slice of a larger graph from Aura into Relate for a task and push results back, and existing Neo4j drivers and tools can connect to Relate over Bolt or HTTP. If this sky ever grows into a full survey catalog of more than a billion stars, it moves to Neo4j, and the queries come with it. Where Relate’s Cypher differs from Neo4j’s, the docs list it.

What’s next

This post is about a graph an agent built. The next one is about a graph an agent keeps: an observing companion that plans my stargazing sessions and remembers what I’ve seen, when, with what gear and under what sky. It will link that memory to this sky graph, so it can answer “what’s up tonight that I haven’t seen, near something I loved last month?” That’s Relate’s other big promise, memory with structure, and I want to see how far it goes.

Try it yourself

  • Start with Relate: relatedb.ai has one-line install, the docs, an in-browser playground and a cookbook of recipes. It’s open source under Apache 2.0 on GitHub.
  • Read the launch post: Meet Relate by Neo4j, including a demo of an agent auditing a project’s dependencies with a fleet of throwaway graphs.
  • Build on this project: the pipeline is at sky-graph. Clone it, run ./run.sh and you’ll have your own sky.rl in a minute or two.
  • Join the hackathon: the Relate by Neo4j Hackathon runs until December 11, with a Mac Studio for the winner.
  • When your graph outgrows one process: Neo4j AuraDB has a free tier, and the same Cypher carries over.

Data and credits

  • Stars: HYG Database v4.4 by David Nash (astronexus), licensed CC BY-SA 4.0. The graph data served with this post (sky-graph.json) and any sky.rl you build from the pipeline adapt HYG, so they fall under the same license.
  • Planets: NASA Exoplanet Archive, Planetary Systems Composite Parameters table (doi:10.26133/NEA13), accessed November 25, 2026. This research has made use of the NASA Exoplanet Archive, which is operated by the California Institute of Technology, under contract with the National Aeronautics and Space Administration under the Exoplanet Exploration Program.
  • Constellation lines: d3-celestial by Olaf Frohn, BSD 3-Clause License.
  • Database: Relate by Neo4j, compiled to WebAssembly, Apache 2.0. Full license notes are in LICENSES.txt.