Add Neo4j schema initialization and validation scripts
- Introduced `neo4j-schema-init.py` for creating the foundational schema for the personal knowledge graph used by multiple AI assistants. - Implemented functionality for creating constraints, indexes, and sample nodes, along with comprehensive testing of the schema. - Added `neo4j-validate.py` to perform validation checks on the Neo4j knowledge graph, including constraints, indexes, sample nodes, relationships, and junk data detection. - Enhanced logging for better traceability and debugging during schema initialization and validation processes.
This commit is contained in:
52
tools/neo4j-personal.md
Normal file
52
tools/neo4j-personal.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Neo4j Knowledge Graph — Personal Team
|
||||
|
||||
You have access to a unified Neo4j knowledge graph shared across fifteen AI assistants (9 personal, 4 work, 2 engineering).
|
||||
|
||||
## Principles
|
||||
|
||||
1. **Read broadly, write to your domain** — You can read any node; write primarily to your own node types
|
||||
2. **Always MERGE on `id`** — Check before creating to avoid duplicates
|
||||
3. **Use consistent IDs** — Format: `{type}_{identifier}_{qualifier}` (e.g., `trip_costarica_2025`, `recipe_carbonara_classic`)
|
||||
4. **Always set timestamps** — `created_at` on CREATE, `updated_at` on every SET
|
||||
5. **Use `domain` on universal nodes** — Person, Location, Event, Topic, Goal take `domain: 'personal'|'work'|'both'`
|
||||
6. **Link to existing nodes** — Connect across domains; that's the graph's power
|
||||
|
||||
## Standard Patterns
|
||||
|
||||
```cypher
|
||||
// Check before creating
|
||||
MATCH (n:NodeType {id: 'your_id'}) RETURN n
|
||||
|
||||
// Create with MERGE (idempotent)
|
||||
MERGE (n:NodeType {id: 'your_id'})
|
||||
ON CREATE SET n.created_at = datetime()
|
||||
SET n.name = 'Name', n.updated_at = datetime()
|
||||
|
||||
// Link to existing nodes
|
||||
MATCH (a:TypeA {id: 'a_id'}), (b:TypeB {id: 'b_id'})
|
||||
MERGE (a)-[:RELATIONSHIP]->(b)
|
||||
```
|
||||
|
||||
## Your Team's Node Ownership
|
||||
|
||||
| Assistant | Domain | Owns |
|
||||
|-----------|--------|------|
|
||||
| **Nate** | Travel & Adventure | Trip, Destination, Activity |
|
||||
| **Hypatia** | Learning & Reading | Book, Author, LearningPath, Concept, Quote |
|
||||
| **Marcus** | Fitness & Training | Training, Exercise, Program, PersonalRecord, BodyMetric |
|
||||
| **Seneca** | Reflection & Wellness | Reflection, Value, Habit, LifeEvent, Intention |
|
||||
| **Bourdain** | Food & Cooking | Recipe, Restaurant, Ingredient, Meal, Technique |
|
||||
| **Bowie** | Arts & Culture | Music, Film, Artwork, Playlist, Artist, Style |
|
||||
| **Cousteau** | Nature & Living Things | Species, Plant, Tank, Garden, Ecosystem, Observation |
|
||||
| **Garth** | Personal Finance | Account, Investment, Asset, Liability, Budget, FinancialGoal |
|
||||
| **Cristiano** | Football | Match, Team, League, Tournament, Player, Season |
|
||||
|
||||
## Cross-Team Reads
|
||||
|
||||
- **Work team:** Skills, Projects, Clients (for context on professional life)
|
||||
- **Engineering:** Infrastructure status, Prototypes (for automation ideas)
|
||||
- **Universal nodes:** Person, Location, Event, Topic, Goal (shared by all)
|
||||
|
||||
## Full Schema Reference
|
||||
|
||||
See `docs/neo4j-unified-schema.md` for complete node definitions, all fields, and relationship types.
|
||||
Reference in New Issue
Block a user