Add neo4j-memory skill for persistent health knowledge graph#1
Open
pswider wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
neo4j-memoryskill 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 queriesmed-pdftemplate exactly: SKILL.md under 500 tokens, details inreferences/, scripts as Node ESM.mjsopenclaw.json→NEO4J_MEMORY_CONFIGenv var →~/.openclaw/workspace/memory/neo4j.yaml— same precedence pattern asmyhealth-pulseprofiles, so Aria can inject per-patient config without any skill code changesmemory-diff/references/memory-paths.md— optional, falls back gracefully to sources 1–5 when not configuredWhat'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 tablereferences/graph-schema.md— node labels (Observation, Condition, Medication, DiagnosticReport, DocumentReference), relationships, common Cypher patternsreferences/scripts.md— per-script flags and output schemasreferences/examples.md— end-to-end setup, ingest-after-health-records, ingest-after-med-pdf, trend queriesScripts (
skills/neo4j-memory/scripts/):config.mjs— shared config loader, no external depsschema-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 silentlyquery.mjs— execute Cypher, return clean JSONEvals (
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.configinopenclaw.jsonper patient agent, pointing to aneo4j.yamlwith per-patient credentials anddatabase: 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-driveron the VM~/.openclaw/workspace/memory/neo4j.yamlwith AuraDB Free URI and setNEO4J_MEMORY_PASSWORDnode skills/neo4j-memory/scripts/schema-init.mjs— expect{"ok":true,"constraints":5,"indexes":3}med-pdfparsequery.mjsand confirm results match workspace cache{"skipped":true}responsewaza check skills/neo4j-memoryand confirm spec compliancehttps://claude.ai/code/session_01UFbAo7LwCgCJzc6TNS3CRW
Generated by Claude Code