Skip to content

Add neo4j-memory skill for persistent health knowledge graph#1

Open
pswider wants to merge 1 commit into
mainfrom
claude/add-neo4j-memory-8HUML
Open

Add neo4j-memory skill for persistent health knowledge graph#1
pswider wants to merge 1 commit into
mainfrom
claude/add-neo4j-memory-8HUML

Conversation

@pswider
Copy link
Copy Markdown
Collaborator

@pswider pswider commented May 18, 2026

Summary

  • Adds neo4j-memory skill that ingests workspace cache files (health-records FHIR JSON, med-pdf labs/imaging JSON) into a Neo4j graph and answers longitudinal trend questions via Cypher queries
  • Follows the med-pdf template exactly: SKILL.md under 500 tokens, details in references/, scripts as Node ESM .mjs
  • Connection config resolved at runtime via openclaw.jsonNEO4J_MEMORY_CONFIG env var → ~/.openclaw/workspace/memory/neo4j.yaml — same precedence pattern as myhealth-pulse profiles, so Aria can inject per-patient config without any skill code changes
  • Registers Neo4j as Source 0 in memory-diff/references/memory-paths.md — optional, falls back gracefully to sources 1–5 when not configured

What's included

Skill (skills/neo4j-memory/):

  • SKILL.md — two workflow modes: ingest (workspace caches → graph) and query (natural language → Cypher → results)
  • references/connection-schema.md — config YAML schema, precedence chain, personal Tula vs. Aria table
  • references/graph-schema.md — node labels (Observation, Condition, Medication, DiagnosticReport, DocumentReference), relationships, common Cypher patterns
  • references/scripts.md — per-script flags and output schemas
  • references/examples.md — end-to-end setup, ingest-after-health-records, ingest-after-med-pdf, trend queries

Scripts (skills/neo4j-memory/scripts/):

  • config.mjs — shared config loader, no external deps
  • schema-init.mjs — idempotent constraints + indexes (IF NOT EXISTS)
  • ingest.mjs — FHIR R4, med-pdf labs.json, med-pdf imaging.json → MERGE into graph; ingest log keyed on path + mtime so re-runs skip silently
  • query.mjs — execute Cypher, return clean JSON

Evals (evals/neo4j-memory/): ingest trigger, query trigger, anti-trigger (PDF → route to med-pdf first), PHI boundary (refuse email export)

Aria isolation path

No skill code changes needed for multi-tenant. Aria injects skills.entries.neo4j-memory.config in openclaw.json per patient agent, pointing to a neo4j.yaml with per-patient credentials and database: patient_<id>. Hard isolation via Neo4j 4.0+ multi-database. The skill is unaware of which deployment it's running in — that's the point.

Test plan

  • sudo npm install --prefix /usr/lib/node_modules/openclaw neo4j-driver on the VM
  • Create ~/.openclaw/workspace/memory/neo4j.yaml with AuraDB Free URI and set NEO4J_MEMORY_PASSWORD
  • Run node skills/neo4j-memory/scripts/schema-init.mjs — expect {"ok":true,"constraints":5,"indexes":3}
  • Run a health-records ingest and confirm nodes appear in AuraDB console
  • Run a med-pdf-labs ingest after a med-pdf parse
  • Query glucose trend via query.mjs and confirm results match workspace cache
  • Re-run ingest on the same file — confirm {"skipped":true} response
  • Run waza check skills/neo4j-memory and confirm spec compliance

https://claude.ai/code/session_01UFbAo7LwCgCJzc6TNS3CRW


Generated by Claude Code

Adds a new skill that ingests workspace cache files (health-records FHIR
JSON, med-pdf labs.json, med-pdf imaging.json) into a Neo4j graph and
answers longitudinal trend questions via Cypher queries.

Skill design follows the med-pdf template exactly: SKILL.md under ~100
lines, details pushed to references/, scripts in Node ESM (.mjs). Connection
config resolved at runtime via openclaw.json → NEO4J_MEMORY_CONFIG env var →
~/.openclaw/workspace/memory/neo4j.yaml — same precedence pattern as
myhealth-pulse profiles, so Aria can inject per-patient config without any
code changes.

Ingest is idempotent (MERGE + ingest log keyed on path + mtime). Single-agent
today; Aria isolates per patient via per-agent credentials pointing to a
separate Neo4j database (neo4j 4.0+ multi-database).

Also registers Neo4j as Source 0 in memory-diff/references/memory-paths.md
— optional, falls back gracefully to sources 1–5 when not configured.

https://claude.ai/code/session_01UFbAo7LwCgCJzc6TNS3CRW
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.

2 participants