{"slug": "a-local-copy-of-the-subgraph-for-your-agent-relate-pull-and-push-with-neo4j", "title": "A Local Copy of the Subgraph for Your Agent: Relate Pull and Push with Neo4j", "summary": "Neo4j released Relate 1.5.0, an open source embedded graph database that runs alongside an AI agent and uses the `relate pull` and `relate push` commands to move a task-specific subgraph between a local single-file store and an organization-wide Neo4j database over Neo4j's HTTP Query API. In a worked example, William Lyon pulled 0.7% of a 568,315-node, 2,530,106-relationship Neo4j demo graph into a local Relate file, analyzed Nvidia's supply chain, and pushed findings back as batched MERGE statements. Lyon noted the tool has no history, merge, conflict detection or revert and that a push never deletes nodes or relationships, making it behave more like `rsync` without `--delete` than `git push`.", "body_md": "# A Local Copy of the Subgraph for Your Agent: Relate Pull and Push with Neo4j\n\nWilliam Lyon\n\nDecember 1, 2026\n\n23 min read\n\n[Relate](https://relatedb.ai) by Neo4j is an open source embedded graph database that runs alongside your agent. It speaks Cypher, needs no server, and keeps a whole graph in a single file. That might make it sound like an alternative to Neo4j. In practice the two work together.\n\nNeo4j is the organization-wide graph, the one that many people and applications share. An agent working on a single task rarely needs all of it. With Relate, the agent can pull down just the subgraph that's relevant to its task or workflow, analyze it locally, and then write the new, enriched data back to Neo4j.\n\nWhy give the agent its own copy? It needs somewhere to write intermediate results, and anything written straight into the organization's graph is visible to everyone as soon as it commits. A local copy gives the agent room to try things, and it gives us one place, the push, to check what goes back.\n\n`relate pull` and `relate push` are the two commands that connect Relate to Neo4j, and in this post we'll use them end to end. We'll pull 0.7% of a 568,315-node Neo4j graph into a local Relate file, answer some supply-chain questions against it, and write the findings into the local copy. Then we'll push to Neo4j two ways. First we'll copy the whole subgraph into a Neo4j database of its own. Then we'll do the write-back: a second task that pushes only its new findings into a database that already holds the graph.\n\n**What you'll learn:** how `relate pull` selects a subgraph with a Cypher query and what that query may return, how `relate push` chooses the properties it merges on, and how to push findings back without overwriting other people's edits. **What you need:** Relate 1.5.0 and Docker. The demo database needs no account. Some Cypher helps.\n\nAll the files are in [relate-companies-pull-push-example](https://github.com/johnymontana/relate-companies-pull-push-example). The numbers and outputs below are from real runs on Relate 1.5.0, and the queries are trimmed from the repo files to fit the page. I built the example with Claude Code driving the Relate CLI, and there's more on how that went near the end.\n\n## What Pull and Push Do[#](#what-pull-and-push-do)\n\n[#](#what-pull-and-push-do)\n\n- `relate pull` runs a Cypher query on a Neo4j database and stores the nodes, relationships and paths it returns in a new local store (a single`.rl` file).\n- `relate push` writes a local store, or a scoped part of it, into a Neo4j database as batched`MERGE` statements.\n\nBoth go through Neo4j's [HTTP Query API](https://neo4j.com/docs/query-api/current/). That gives us a short checklist for whether this will work with a particular database:\n\n- The Query API port has to be reachable from where Relate runs. A Bolt URI is fine in the config: Relate maps `neo4j+s://host:7687` to`https://host:7473` .\n- Authentication is a username and password.\n- A pull runs your query and reads the schema, so a read-only user should be enough. I haven't confirmed that with a locked-down role. A push needs write access.\n\nIt's tempting to call this git for graphs. The checkout half of that holds up: we get a private copy that is cheap to snapshot, selected by a query we can review. The rest of git isn't here. There is no history, no merge, no conflict detection and no revert, and a push never deletes a node or a relationship. Each command makes a one-time copy, so a push behaves more like `rsync` without `--delete` than like `git push`.\n\n## The Example: Nvidia's Supply Chain[#](#the-example-nvidias-supply-chain)\n\n[#](#the-example-nvidias-supply-chain)\n\nStanding in for the organization-wide graph is `companies2`, a public demo database hosted by Neo4j. It's a knowledge graph of organizations, people, patents, filings and news articles: 568,315 nodes and 2,530,106 relationships across fifteen labels. The task for the agent is to map Nvidia's supply chain: who supplies Nvidia and its competitors, and which suppliers they share. That only needs the companies around Nvidia, so we can leave the 117,142 patents where they are.\n\nThe connection details go in an env file:\n\n```\n# demo.env\nNEO4J_URI=neo4j+s://demo.neo4jlabs.com:7687\nNEO4J_USERNAME=companies2\nNEO4J_PASSWORD=companies2\nNEO4J_DATABASE=companies2\n```\n\nThose are public demo credentials, which is the only reason the file is in the repo. Keep real ones out of git.\n\n## Step 1: Pull the Subgraph[#](#step-1-pull-the-subgraph)\n\n[#](#step-1-pull-the-subgraph)\n\nThe thing we write for a pull is a shape query: ordinary Cypher that runs on the Neo4j server and returns the part of the graph we want. This one has three statements.\n\nHere is the first statement. The `*0..1` hop keeps Nvidia itself in the set along with its 18 competitors, and I'll call those 19 companies the core.\n\n``` php\nMATCH (:Organization {name: $seed})\n      -[:HAS_COMPETITOR*0..1]->(o:Organization)\nWITH DISTINCT o\nMATCH p = (o)-[:HAS_SUPPLIER|HAS_CUSTOMER\n              |HAS_PARTNER|HAS_COMPETITOR]->(:Organization)\nRETURN p;\n```\n\nThe second statement returns every relationship between the companies the first one found, and the third returns the cities and countries where the core companies and their suppliers have primary offices. The whole file is [`cypher/01-pull.cypher`](https://github.com/johnymontana/relate-companies-pull-push-example/blob/main/cypher/01-pull.cypher).\n\nOne command runs all three and writes a new file:\n\n```\nrelate pull --from demo.env --query cypher/01-pull.cypher \\\n    --param seed=Nvidia --database ./nvidia.rl\npulled 3928 new / 3074 reused nodes, 58384 new / 5002 reused rels\n  (+ 0 constraints, 3 indexes; 17 schema skipped) to ./nvidia.rl\n```\n\nThat took about 8 seconds. The file holds 1,832 organizations, 2,017 cities and 79 countries, which is 0.7% of the nodes in the source and 2.3% of its relationships. Each node and relationship is stored once, however many times the three statements return it.\n\nThe query is a file in the repo, so it gets reviewed like any other code, and `seed=AMD` would pull a different neighborhood.\n\n### The Rules for a Shape Query[#](#the-rules-for-a-shape-query)\n\n[#](#the-rules-for-a-shape-query)\n\nThere are four, and each is checked against this version.\n\n1. Every item in the final `RETURN` has to be a node, a relationship or a path. We can aggregate and filter on the way there, but`RETURN o, o.name` is rejected with`rejected item: o.name` .\n2. A relationship is only stored if both of its end nodes are returned somewhere in the same pull. A bare `RETURN r` into an empty store pulls 0 nodes and 0 relationships and reports success. The second statement above returns bare relationships on purpose, to avoid sending the same large company nodes thousands of times, and it works because the first statement already pulled every company involved.\n3. Nodes arrive whole, with every label and every property. There is no way to leave a property behind.\n4. The destination has to be empty. A second pull into the same store fails with `pull writes into an empty database only` .\n\nThe second rule is the one to watch with an agent, because nothing fails. It's worth having the agent check node and relationship counts after every pull.\n\n## Step 2: Analyze Locally[#](#step-2-analyze-locally)\n\n[#](#step-2-analyze-locally)\n\nFrom here on everything runs against `nvidia.rl` and nothing touches the demo server.\n\n```\nrelate query -d ./nvidia.rl --param seed=Nvidia \\\n    < cypher/02-analyze.cypher\n```\n\nThat file has five read queries. Let's look at the first one, which asks which outside suppliers the most core companies depend on:\n\n``` php\nMATCH (:Organization {name: $seed})\n      -[:HAS_COMPETITOR*0..1]->(c:Organization)\nWITH collect(DISTINCT c) AS core\nUNWIND core AS c\nMATCH (c)-[:HAS_SUPPLIER]->(s:Organization)\nWHERE NOT s IN core\nWITH s, count(DISTINCT c) AS coreCustomers\nRETURN s.name AS chokepoint, coreCustomers\nORDER BY coreCustomers DESC, chokepoint LIMIT 7\nchokepoint              coreCustomers\nMicron Technology       11\nCorning                 9\nAccenture               8\nNokia                   8\nOracle                  8\nSK Hynix                8\nTaiwan Semiconductor    8\n```\n\nMicron Technology supplies 11 of the 19. A memory maker, a glass maker and a foundry are what I'd expect to see. Accenture and Oracle are there because `HAS_SUPPLIER` covers every kind of supplier.\n\nThe second query looks for companies that Nvidia doesn't buy from but its suppliers do. The top three are Applied Materials, Nokia and Sun Microsystems, each reached through seven of Nvidia's suppliers. Applied Materials is a believable answer: Taiwan Semiconductor, Micron Technology, Samsung Electronics and Intel all list it as a supplier. Sun Microsystems is not, since it hasn't existed as a company since 2010.\n\nThree caveats about these answers:\n\n- The source caps every company at 100 relationships of a type. 209 organizations have exactly 100 suppliers and none have more, so the numbers for the biggest companies are truncated.\n- A company can have several \"primary\" offices. The 583 companies we have locations for share 3,805 of them.\n- A local copy only answers for what was pulled. I ran the second query against the full graph and the top ten rows matched, but a query that walks further than the pull would return a wrong answer with no error.\n\nInside the engine each of the five queries took under 6 milliseconds. Sent to the demo server, the same queries took 350 to 500 milliseconds each, with a new HTTPS connection every time. That gap is small next to how long a model spends thinking, so I wouldn't pull a subgraph for read speed alone. The stronger reason comes next.\n\n## Step 3: Write the Findings into the Local Copy[#](#step-3-write-the-findings-into-the-local-copy)\n\n[#](#step-3-write-the-findings-into-the-local-copy)\n\nSo far the answers only exist in a terminal. Next we'll write them into the graph as properties and relationships, so later queries can use them. First, a copy of the untouched pull:\n\n```\nrelate clone ./nvidia.rl ./nvidia-raw.rl\nrelate query -d ./nvidia.rl --param seed=Nvidia \\\n    < cypher/03-enrich.cypher\n```\n\nThe enrichment script does four things:\n\n1. Tags the 19 core companies with `ecosystem` and`ecosystemRole` (`seed` or`competitor` ).\n2. Gives 681 outside suppliers a `coreCustomerCount` , and sets`isChokepoint` when that count is 6 or more. The threshold is arbitrary; 20 suppliers pass it.\n3. Adds 115 `SHARES_SUPPLIERS_WITH` relationships between core companies.\n4. Adds 43 `INDIRECTLY_DEPENDS_ON` relationships from Nvidia to companies that at least four of its suppliers buy from.\n\nThe last of those looks like this:\n\n``` php\nMATCH (n:Organization {name: $seed})\n      -[:HAS_SUPPLIER]->(t1:Organization)\n      -[:HAS_SUPPLIER]->(t2:Organization)\nWHERE t2 <> n AND NOT EXISTS { (n)-[:HAS_SUPPLIER]->(t2) }\nWITH n, t2, collect(DISTINCT t1.name) AS via\nWHERE size(via) >= 4\nMERGE (n)-[r:INDIRECTLY_DEPENDS_ON]->(t2)\nSET r.viaCount = size(via), r.via = via,\n    r.derivedBy = 'relate-example', r.derivedOn = date()\n```\n\nTwo things in that script are there because of what comes later.\n\nEvery relationship the script creates carries `derivedBy` and `derivedOn`. Once these land in a database other people use, somebody will want to know which facts came from the source and which ones an agent inferred, and there is no undo for a push. With the marker, removing them is one query.\n\nThe node properties are the weak part of this design. `ecosystemRole` isn't scoped to a seed, so pushing a second run for `seed=AMD` into the same database would overwrite the first. Findings modeled as new relationships are easier to mark, easier to remove and, as we'll see, safer to push.\n\nNone of this exists anywhere except `nvidia.rl` yet. If the agent had got it wrong, I'd go back to the clone.\n\n## Before You Push: Constraints on Both Sides[#](#before-you-push-constraints-on-both-sides)\n\n[#](#before-you-push-constraints-on-both-sides)\n\nConstraints matter twice, and both times caught us out.\n\n**In the local store, they are the merge keys.** Push reads the store's uniqueness constraints to decide which property to `MERGE` each label on. Look at the pull output above: `0 constraints`. The demo database has a uniqueness constraint on `Organization.uri`, but it defaults to Cypher 5, where `SHOW CONSTRAINTS` reports the type as `UNIQUENESS`, and Relate skips that with a warning. Under Cypher 25 the same constraint is reported as `NODE_PROPERTY_UNIQUENESS`, which Relate does copy. So for a database that defaults to Cypher 5, expect to recreate the constraints yourself. The enrichment script starts with them:\n\n```\nCREATE CONSTRAINT organization_uri IF NOT EXISTS\n  FOR (o:Organization) REQUIRE o.uri IS UNIQUE;\nCREATE CONSTRAINT city_id IF NOT EXISTS\n  FOR (c:City) REQUIRE c.id IS UNIQUE;\nCREATE CONSTRAINT country_uri IF NOT EXISTS\n  FOR (c:Country) REQUIRE c.uri IS UNIQUE;\n```\n\nA dry run of the untouched clone, which has no constraints, reports every label as `(unkeyed)` and skips all 62,312 rows.\n\n**On the target, they are the speed.** Push doesn't create constraints or indexes on the target, and without an index every `MERGE` scans the label. The same push took 108 seconds into an empty Neo4j with no constraints and under 6 seconds with them. That's with 1,832 organizations, and the gap grows with the size of the target.\n\n## Option A: Copy the Subgraph into a New Database[#](#option-a-copy-the-subgraph-into-a-new-database)\n\n[#](#option-a-copy-the-subgraph-into-a-new-database)\n\nThe simplest way to finish is to put the whole subgraph, findings included, into a Neo4j database of its own. It's also how you'd carve a piece of the organization's graph out for a team or an application that only needs that piece. The repo has a [compose file](https://github.com/johnymontana/relate-companies-pull-push-example/blob/main/docker-compose.yml) for a Neo4j container bound to localhost, and a script with the three constraints:\n\n```\ndocker compose up -d --wait\ndocker exec -i companies-local \\\n    cypher-shell -u neo4j -p relate-demo-pw \\\n    < cypher/00-target-schema.cypher\n```\n\nBefore sending anything, let's ask for the plan. I've left out the count columns, five relationship rows and all but one statement, and wrapped that one to fit:\n\n```\nrelate push --to local.env --database ./nvidia.rl --dry-run\nentity                                           total  merge key  policy\nCity                                              2017  id         add\nCountry                                             79  uri        add\nOrganization                                      1832  uri        add\n(Organization)-[:HAS_PARTNER]->(Organization)    20553             add\n(Organization)-[:HAS_SUPPLIER]->(Organization)    8932             add\n(Organization)-[:IN_CITY]->(City)                 3805             add\n...\nOrganization: UNWIND $rows AS row\n  MERGE (n:`Organization` {`uri`: row.key.` uri`})\n  SET n += row.props\n...\ndry run: 11 entities, 62470 rows planned; nothing was sent\n```\n\nThe dry run is a plan. It lists what will be written, how many rows, which property each label is merged on, and the shape of every statement. It doesn't contact the target, so it can't say what already exists there or which values would be overwritten. That's enough for an empty database, and a real limitation for Option B.\n\n```\nrelate push --to local.env --database ./nvidia.rl\npushed 62470 rows in 20 statements (27197270 bytes) in 5832 ms\n```\n\nA second run against the unchanged target reported 0 created and 62,470 updated, so repeating a push doesn't duplicate anything.\n\nI didn't plan to test a failure, but I got one. I first ran this on Relate 1.3.0, where a zoned `DATETIME` property made one batch fail with HTTP 400. The batches before it stayed written: 52,562 of the 58,542 relationships were in Neo4j and the rest were not. So a push is not one transaction. Relate 1.5.0 pushes that property correctly.\n\nProperty types come through. A quick check in Neo4j:\n\n```\nMATCH (n:Organization {name: 'Nvidia'})\nRETURN n.foundingDate AS founded,\n       valueType(n.foundingDate) AS type\nfounded       type\n1993-04-05    \"DATE NOT NULL\"\n```\n\nI also pushed one property each of `DATE`, `ZONED DATETIME`, `LOCAL DATETIME`, `ZONED TIME`, `DURATION` and `POINT` from a test store, and each arrived as the same type.\n\n## Option B: Write the Findings Back[#](#option-b-write-the-findings-back)\n\n[#](#option-b-write-the-findings-back)\n\nThis is the write-back from the introduction: the organization's graph stays where it is, and the agent sends back what it learned. I can't show that on the public demo server, which isn't mine to write to. So the database from Option A stands in for one that other people use. It's a single-user container on localhost holding only what the first push wrote, so this section shows the mechanics and is no test against a busy production graph.\n\nWe'll give it a second task: how exposed is each core company to each country? That needs less of the graph than before:\n\n``` php\nMATCH p = (c:Organization)-[:HAS_SUPPLIER]->(:Organization)\nWHERE c.ecosystemRole IS NOT NULL\nRETURN p;\n\nMATCH (c:Organization)-[:HAS_SUPPLIER]->(s:Organization)\nWHERE c.ecosystemRole IS NOT NULL\nWITH DISTINCT s\nMATCH p = (s)-[ic:IN_CITY]->(:City)-[:IN_COUNTRY]->(:Country)\nWHERE ic.isPrimary\nRETURN p\n```\n\n`ecosystemRole` is a property the first run wrote, so this pull only works because of the earlier enrichment.\n\n```\nrelate pull --from local.env --query cypher/04-pull-exposure.cypher \\\n    --database ./exposure.rl\npulled 2792 new / 2158 reused nodes, 7031 new / 1101 reused rels\n  (+ 3 constraints, 0 indexes; 0 schema skipped) to ./exposure.rl\n```\n\nThis time the three constraints came down with the data, because my Neo4j 2026.10 container reports them the Cypher 25 way.\n\nTo see what a push does to data that changed while we were away, we need a teammate, and a short script plays one. Between the pull and the push it edits Nvidia on the target, adding a `riskOwner` property that the local copy has never seen and changing `nbEmployees` from 36,000 to 42,000:\n\n```\ndocker exec -i companies-local \\\n    cypher-shell -u neo4j -p relate-demo-pw \\\n    < cypher/06-simulate-teammate-edit.cypher\n```\n\nThe enrichment adds a `SOURCES_FROM` relationship from each core company to each country where its suppliers have a primary office, and a `chokepointSuppliers` count on `Country` nodes:\n\n```\nrelate query -d ./exposure.rl < cypher/05-enrich-exposure.cypher\n```\n\nNow the part that needs care. A push scoped to `--types SOURCES_FROM` sends those relationships and both end nodes of each, and it sends the end nodes whole. With the default policy every property on those nodes is overwritten with the value we pulled. That would put Nvidia's `nbEmployees` back to 36,000 without any warning, and the dry run wouldn't show it.\n\nWe want the `Country` nodes updated, because they carry the new score, and the `Organization` nodes left alone, because we changed nothing on them. Update policies can be set per label:\n\n```\nrelate push --to local.env --database ./exposure.rl \\\n    --types SOURCES_FROM --nodes-update Organization=skip\nentity                                     total  created  updated  skipped\nCountry                                       79        0       79        0\nOrganization                                  18        0        0       18\n(Organization)-[:SOURCES_FROM]->(Country)    548      548        0        0\npushed 627 rows in 2 statements (298576 bytes) in 147 ms\n```\n\nThat created 548 relationships and updated 79 `Country` nodes, 17 of which gained a score. The 18 `Organization` nodes were skipped, and Nvidia still has `riskOwner` and 42,000 employees. (It's 18 and not 19 because VIA Technologies has no suppliers in this data.) The other 3,831 nodes in the database were never sent.\n\nThe result is there for the next person or the next agent:\n\n``` php\nMATCH (c:Organization)-[e:SOURCES_FROM]->(:Country {name: 'Taiwan'})\nRETURN c.name AS company, e.suppliers AS suppliers, e.share AS share\nORDER BY e.share DESC, company LIMIT 4\ncompany     suppliers  share\n\"MediaTek\"  5          0.313\n\"Nvidia\"    10         0.103\n\"Dell\"      8          0.08\n\"Intel\"     8          0.08\n```\n\n`share` is the fraction of a company's suppliers with a primary office in that country, and the fractions overlap because a supplier can count toward several countries. Dell and Intel both come out at exactly 8 of 100, which is the cap showing through.\n\n## How Push Decides What to Write[#](#how-push-decides-what-to-write)\n\n[#](#how-push-decides-what-to-write)\n\n### Merge Keys[#](#merge-keys)\n\n[#](#merge-keys)\n\nPush takes its merge keys from the uniqueness and key constraints in the local store, and a composite constraint gives a composite key. A node is merged on its key, and a relationship is merged between two nodes matched by theirs:\n\n```\nUNWIND $rows AS row\nMERGE (n:`Organization` {`uri`: row.key.` uri`})\nSET n += row.props\nUNWIND $rows AS row\nMATCH (a:`Organization` {`uri`: row.start.` uri`})\nMATCH (b:`Organization` {`uri`: row.end.` uri`})\nMERGE (a)-[r:`HAS_SUPPLIER`]->(b)\nSET r += row.props\n```\n\nRows travel as parameters, 5,000 to a batch. Some details:\n\n- A label with no constraint is reported as `(unkeyed)` and skipped. Supply a key with`--merge-key Label:prop` , or accept duplicates with`--unkeyed-labels create` .\n- If a node is missing its key property, the push stops while planning and sends nothing.\n- With no relationship key there is one relationship of a type in each direction between two nodes, so parallel relationships of the same type collapse into one. `--rel-key TYPE:prop` gives a type its own key.\n- A node with several labels is merged on one of them. In a test, a `Person:Employee` node merged on the`Employee` key, so check the dry run if you have multi-label nodes.\n- Pull doesn't keep Neo4j's element ids. A later push finds the same node again only for labels that have a unique property.\n\n### Scopes[#](#scopes)\n\n[#](#scopes)\n\nA push takes at most one scope flag, and no flag means the whole store.\n\n| Scope | What is in play | \n|---|---|\n| `--types SOURCES_FROM` | those relationships, plus both end nodes of each | \n| `--labels Organization,Country` | those nodes, plus the relationships between them | \n| `--query '...'` | whatever a Cypher query on the local store returns | \n| none | everything | \n\n`--query` follows the shape-query rules from Step 1. A relationship without both end nodes in scope is reported as `(dangling)` and skipped.\n\n### Update Policies[#](#update-policies)\n\n[#](#update-policies)\n\n`--nodes-update` decides what happens to a node that already exists on the target. Here is the Option B push under four settings, with the simulated teammate edit in place before each run:\n\n| `--nodes-update` | `riskOwner` | `nbEmployees` | new `Country` scores | \n|---|---|---|---|\n| `add` (the default) | kept | overwritten with 36,000 | sent | \n| `replace` | removed | overwritten with 36,000 | sent | \n| `skip` | kept | kept at 42,000 | not sent | \n| `Organization=skip` | kept | kept at 42,000 | sent | \n\n`add` runs `SET n += row.props` and `replace` runs `SET n = row.props`, which is why `replace` also removes properties that exist only on the target. `skip` writes only nodes that are missing.\n\nThere is a matching `--rels-update` for relationships, and an `--updated-at` flag that skips a row when the target's copy has a newer timestamp. That flag only protects rows with a timestamp on both sides. This dataset has none, and I haven't tested it.\n\n## Why Not Just...[#](#why-not-just)\n\n[#](#why-not-just)\n\n**...give the agent a read-only user?** For pure analysis, do that. It's simpler and the data is never stale. A local copy is worth having when the agent needs to write intermediate results, or when we don't want its queries running on the shared server.\n\n**...restore a dev or staging database?** That needs a server per agent and gives each one the whole graph. A pull gives each agent one small file. Getting findings back into the shared database is the same problem either way.\n\n**...use APOC to export the subgraph?** APOC can export a query's results as a Cypher script, which covers much of what push does. What it doesn't provide is somewhere to query and change the subgraph without running another Neo4j.\n\n## Limitations[#](#limitations)\n\n[#](#limitations)\n\n- Each command makes a copy. There is no history, no diff against the target, no conflict detection and no undo. Removing a pushed finding is hand-written Cypher, which is what `derivedBy` is for.\n- Whole nodes travel in both directions. A push can't send one property.\n- A push is not one transaction. If a batch fails, the batches before it stay.\n- The pulled file is an unprotected copy of whatever the pulling user could read. Pull with a user that can't read what shouldn't leave, and delete the file when the task is done.\n- Relate keeps the whole graph in memory and allows one writer per store. I tested 3,928 nodes and nothing bigger.\n- I didn't test two agents pushing at once. On nodes they both touch, the last push wins, property by property.\n\n## Letting an Agent Do This[#](#letting-an-agent-do-this)\n\n[#](#letting-an-agent-do-this)\n\nI built this example with Claude Code driving the Relate CLI through Relate's agent skill, which `relate skill install` sets up. A few things from that session are worth knowing before you hand this workflow to an agent:\n\n- It read the schema first (labels, relationship types and counts) through Neo4j's Query API, and chose Nvidia after comparing a handful of well-known companies.\n- Its first \"Nvidia and its competitors\" query matched `HAS_COMPETITOR` in both directions and came back with 155 companies, among them Boeing, Sweetgreen and Manchester United. Following the relationship outward only gives 18.\n- Its first pull was rejected by the server with a Cypher aggregation error, and it rewrote the query.\n- It had both env files and ran every command itself, pushes included. That was fine for a throwaway container on my machine.\n\nFor an organization's graph I'd split the work up:\n\n- The agent pulls with a read-only credential and never sees a write credential.\n- The agent's deliverable is the enriched store and the output of `relate push --dry-run` .\n- A person or a CI job runs the real push, with the scope and the per-label policy written down in the same pull request as the shape query.\n- Findings go in as new relationships marked with `derivedBy` , with`skip` on every label the agent had no reason to change.\n- The agent asserts counts after each pull and push, because several of the failures above report success: a bare `RETURN r` that pulls nothing, a label skipped for having no key.\n\n## What's Next?[#](#whats-next)\n\n[#](#whats-next)\n\nThere's a list of things I haven't tried: `--updated-at`, two agents pushing at the same time, a pull an order of magnitude bigger than this one, and Aura as either end. If you try any of them, or run this against your own graph, I'd like to hear how it goes. If I get to them first, the newsletter below is where you'll hear about it.\n\n## Watch the Demo[#](#watch-the-demo)\n\n[#](#watch-the-demo)\n\nI walked through this demo live on Neo4j's *Going Meta* livestream. The recording below starts where the Relate demo begins:\n\n## Resources[#](#resources)\n\n[#](#resources)\n\n- [relate-companies-pull-push-example on GitHub](https://github.com/johnymontana/relate-companies-pull-push-example) - the queries, env files and compose file from this post\n- [Relate](https://relatedb.ai) , the[Relate docs](https://relatedb.ai/docs/) and[relatedb/relate on GitHub](https://github.com/relatedb/relate)\n- [Where relate fits](https://relatedb.ai/docs/concepts/where-relate-fits/)\n- [A Graph Database in Your Pocket](https://lyonwj.com/blog/relate-embedded-graph-database-ios) - my earlier post on Relate, extensions and the Swift client\n- [Neo4j Query API](https://neo4j.com/docs/query-api/current/) - the HTTP interface that pull and push use\n- [The demo on the Going Meta livestream](https://www.youtube.com/watch?v=nNpLhyZfTAk&t=1664s) - the recording, starting at the Relate segment\n\n*The companies2 dataset is a public demo graph hosted by Neo4j. Company relationships in it come from an automated knowledge graph and are not a statement of fact about any company's suppliers, customers or competitors.*\n\n### Stay Updated\n\nGet notified about new posts and videos", "url": "https://wpnews.pro/news/a-local-copy-of-the-subgraph-for-your-agent-relate-pull-and-push-with-neo4j", "canonical_source": "https://lyonwj.com/blog/relate-pull-push-agents", "published_at": "2026-12-01 00:00:00+00:00", "updated_at": "2026-12-01 20:47:17.129541+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Neo4j", "Relate", "William Lyon", "Nvidia", "Claude Code", "Docker"], "also_reported_by": [], "takeaway": "Relate 1.5.0's `relate pull` copies a Cypher-selected subgraph into a single .rl file and `relate push` writes it back as batched MERGE statements over Neo4j's HTTP Query API, but pushes never delete nodes or relationships and there is no merge or conflict detection.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/a-local-copy-of-the-subgraph-for-your-agent-relate-pull-and-push-with-neo4j", "markdown": "https://wpnews.pro/news/a-local-copy-of-the-subgraph-for-your-agent-relate-pull-and-push-with-neo4j.md", "text": "https://wpnews.pro/news/a-local-copy-of-the-subgraph-for-your-agent-relate-pull-and-push-with-neo4j.txt", "jsonld": "https://wpnews.pro/news/a-local-copy-of-the-subgraph-for-your-agent-relate-pull-and-push-with-neo4j.jsonld"}}