Skip to content

Commit f179ad3

Browse files
authored
Merge pull request #130 from ethosengine/staging
kuzu seed database and qahal, REA shefa, and imagodei modeling.
2 parents 1c6ef50 + 4e11189 commit f179ad3

File tree

302 files changed

+31960
-17751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+31960
-17751
lines changed

.claude/commands/import-content.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Content Import Command
2+
3+
Import content from source files into lamad ContentNodes.
4+
5+
## Usage
6+
7+
```
8+
/import-content [action] [options]
9+
```
10+
11+
## Actions
12+
13+
- `import` - Run incremental import (default)
14+
- `full` - Run full reimport
15+
- `preview` - Preview what would change
16+
- `stats` - Show import statistics
17+
- `validate` - Validate manifest integrity
18+
19+
## What This Does
20+
21+
This command triggers the elohim-service content import pipeline:
22+
23+
1. **Scans** `/data/content/` for markdown (.md) and Gherkin (.feature) files
24+
2. **Parses** each file extracting:
25+
- Path metadata (domain, epic, user type)
26+
- YAML frontmatter
27+
- Content sections
28+
- Gherkin scenarios
29+
3. **Transforms** content into ContentNodes:
30+
- Source nodes (raw content for provenance)
31+
- Epic nodes
32+
- Role/Archetype nodes
33+
- Scenario nodes
34+
- Resource nodes
35+
4. **Extracts relationships** between nodes:
36+
- Explicit references
37+
- Path-based (same epic/user type)
38+
- Tag-based similarity
39+
- Content references
40+
5. **Writes output** to `/output/lamad/`:
41+
- `nodes.json` - All ContentNodes
42+
- `relationships.json` - Node relationships
43+
- `content-manifest.json` - For incremental updates
44+
- `import-summary.json` - Statistics
45+
46+
## Example Prompts
47+
48+
- "Import all content to lamad format"
49+
- "Run a full content reimport"
50+
- "Preview what files have changed since last import"
51+
- "Show me the import statistics"
52+
- "Validate the import manifest"
53+
54+
## Implementation
55+
56+
Located at: `elohim-library/projects/elohim-service/`
57+
58+
To run manually:
59+
```bash
60+
cd elohim-library/projects/elohim-service
61+
npx ts-node src/cli/import.ts import --source ../../data/content --output ../../output/lamad
62+
```

.claude/file-relationships.json

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"description": "Defines relationships between files that should stay in sync for the Elohim project",
3+
"version": "1.0.0",
4+
"relationships": {
5+
"elohim-import": {
6+
"description": "Elohim import pipeline - skill, CLI, and all related models/services",
7+
"skill": ".claude/skills/elohim-import/SKILL.md",
8+
"cli": "elohim-library/projects/elohim-service/src/cli/import.ts",
9+
"models": {
10+
"service": [
11+
"elohim-library/projects/elohim-service/src/models/content-node.model.ts",
12+
"elohim-library/projects/elohim-service/src/models/path-metadata.model.ts",
13+
"elohim-library/projects/elohim-service/src/models/manifest.model.ts",
14+
"elohim-library/projects/elohim-service/src/models/import-context.model.ts"
15+
],
16+
"app": [
17+
"elohim-app/src/app/lamad/models/content-node.model.ts",
18+
"elohim-app/src/app/lamad/models/learning-path.model.ts",
19+
"elohim-app/src/app/lamad/models/exploration.model.ts",
20+
"elohim-app/src/app/lamad/models/human-node.model.ts",
21+
"elohim-app/src/app/lamad/models/content-attestation.model.ts",
22+
"elohim-app/src/app/lamad/models/trust-badge.model.ts",
23+
"elohim-app/src/app/lamad/models/content-mastery.model.ts",
24+
"elohim-app/src/app/lamad/models/content-lifecycle.model.ts",
25+
"elohim-app/src/app/lamad/models/content-access.model.ts",
26+
"elohim-app/src/app/lamad/models/knowledge-map.model.ts"
27+
]
28+
},
29+
"services": [
30+
"elohim-library/projects/elohim-service/src/services/import-pipeline.service.ts",
31+
"elohim-library/projects/elohim-service/src/services/human.service.ts",
32+
"elohim-library/projects/elohim-service/src/services/standards.service.ts",
33+
"elohim-library/projects/elohim-service/src/services/trust.service.ts",
34+
"elohim-library/projects/elohim-service/src/services/scaffold.service.ts",
35+
"elohim-library/projects/elohim-service/src/services/manifest.service.ts",
36+
"elohim-library/projects/elohim-service/src/services/relationship-extractor.service.ts"
37+
],
38+
"sync_rules": [
39+
{
40+
"trigger_pattern": "elohim-service/src/cli/import.ts",
41+
"notify": ["skill"],
42+
"message": "CLI commands changed - update SKILL.md documentation"
43+
},
44+
{
45+
"trigger_pattern": "elohim-service/src/models/*.model.ts",
46+
"notify": ["skill", "cli"],
47+
"message": "Service model changed - may affect CLI options and skill documentation"
48+
},
49+
{
50+
"trigger_pattern": "elohim-service/src/services/*.service.ts",
51+
"notify": ["cli", "skill"],
52+
"message": "Service API changed - may require CLI command updates"
53+
},
54+
{
55+
"trigger_pattern": "elohim-app/src/app/lamad/models/*.model.ts",
56+
"notify": ["skill"],
57+
"message": "App model changed - update skill schema documentation"
58+
},
59+
{
60+
"trigger_pattern": ".claude/skills/elohim-import/SKILL.md",
61+
"notify": [],
62+
"message": "Skill updated - no action needed"
63+
}
64+
]
65+
},
66+
"model-sync": {
67+
"description": "ContentNode models must stay in sync between service and app",
68+
"pairs": [
69+
{
70+
"source": "elohim-library/projects/elohim-service/src/models/content-node.model.ts",
71+
"target": "elohim-app/src/app/lamad/models/content-node.model.ts",
72+
"sync_direction": "service-to-app",
73+
"message": "ContentNode model in elohim-service changed - ensure elohim-app model is compatible"
74+
}
75+
]
76+
}
77+
},
78+
"schemas": {
79+
"ContentNode": {
80+
"description": "Core content unit in lamad system",
81+
"definedIn": "elohim-library/projects/elohim-service/src/models/content-node.model.ts",
82+
"usedBy": ["import-pipeline", "human.service", "standards.service"],
83+
"fields": ["id", "contentType", "title", "description", "content", "contentFormat", "tags", "relatedNodeIds", "metadata"]
84+
},
85+
"PathMetadata": {
86+
"description": "Metadata extracted from file system paths",
87+
"definedIn": "elohim-library/projects/elohim-service/src/models/path-metadata.model.ts",
88+
"usedBy": ["import-pipeline"],
89+
"fields": ["fullPath", "relativePath", "domain", "epic", "userType", "contentCategory"]
90+
},
91+
"ContentManifest": {
92+
"description": "Tracks imported content for incremental updates",
93+
"definedIn": "elohim-library/projects/elohim-service/src/models/manifest.model.ts",
94+
"usedBy": ["manifest.service", "import-pipeline"],
95+
"fields": ["manifestVersion", "schemaVersion", "sourceHashes", "nodeHashes", "migrations"]
96+
},
97+
"ImportOptions": {
98+
"description": "Configuration for import pipeline execution",
99+
"definedIn": "elohim-library/projects/elohim-service/src/models/import-context.model.ts",
100+
"usedBy": ["cli", "import-pipeline"],
101+
"fields": ["mode", "sourceDir", "outputDir", "domains", "epics", "dryRun", "verbose", "skipRelationships"]
102+
},
103+
"Human": {
104+
"description": "Human persona in the network",
105+
"definedIn": "elohim-library/projects/elohim-service/src/services/human.service.ts",
106+
"usedBy": ["cli"],
107+
"fields": ["id", "displayName", "bio", "category", "profileReach", "location", "affinities"]
108+
}
109+
}
110+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Load Project Context Hook
4+
5+
Runs at session start to provide Claude with project schema knowledge.
6+
Loads schemas from file-relationships.json so Claude knows about
7+
ContentNode, PathMetadata, etc. without needing to read the model files.
8+
9+
Hook Type: SessionStart
10+
"""
11+
import json
12+
import sys
13+
import os
14+
15+
def load_relationships(project_dir: str) -> dict:
16+
"""Load the file relationships configuration."""
17+
rel_path = os.path.join(project_dir, '.claude', 'file-relationships.json')
18+
if not os.path.exists(rel_path):
19+
return {}
20+
21+
with open(rel_path, 'r') as f:
22+
return json.load(f)
23+
24+
def format_schema_summary(schemas: dict) -> str:
25+
"""Format schemas for context injection."""
26+
if not schemas:
27+
return ""
28+
29+
lines = ["ELOHIM PROJECT SCHEMAS:"]
30+
lines.append("")
31+
32+
for name, info in schemas.items():
33+
lines.append(f"• {name}: {info.get('description', 'No description')}")
34+
lines.append(f" Defined in: {info.get('definedIn', 'Unknown')}")
35+
fields = info.get('fields', [])
36+
if fields:
37+
lines.append(f" Fields: {', '.join(fields[:8])}")
38+
if len(fields) > 8:
39+
lines.append(f" ...and {len(fields) - 8} more")
40+
lines.append("")
41+
42+
return "\n".join(lines)
43+
44+
def get_sync_relationships_summary(relationships: dict) -> str:
45+
"""Summarize file relationships for context."""
46+
lines = ["FILE SYNC RELATIONSHIPS:"]
47+
lines.append("")
48+
49+
for group_name, group in relationships.get('relationships', {}).items():
50+
desc = group.get('description', group_name)
51+
lines.append(f"• {group_name}: {desc}")
52+
53+
if 'skill' in group:
54+
lines.append(f" Skill: {group['skill']}")
55+
if 'cli' in group:
56+
lines.append(f" CLI: {group['cli']}")
57+
58+
sync_rules = group.get('sync_rules', [])
59+
if sync_rules:
60+
lines.append(f" Sync rules: {len(sync_rules)} patterns tracked")
61+
62+
lines.append("")
63+
64+
return "\n".join(lines)
65+
66+
def main():
67+
try:
68+
# Read hook input from stdin
69+
data = json.load(sys.stdin)
70+
71+
# Get project directory
72+
project_dir = os.environ.get('CLAUDE_PROJECT_DIR', '/projects/elohim')
73+
74+
# Load relationships
75+
relationships = load_relationships(project_dir)
76+
if not relationships:
77+
sys.exit(0)
78+
79+
context_parts = []
80+
81+
# Add schema summary
82+
schemas = relationships.get('schemas', {})
83+
if schemas:
84+
context_parts.append(format_schema_summary(schemas))
85+
86+
# Add relationship summary
87+
rels = relationships.get('relationships', {})
88+
if rels:
89+
context_parts.append(get_sync_relationships_summary(relationships))
90+
91+
if not context_parts:
92+
sys.exit(0)
93+
94+
# Add reminder about hooks
95+
context_parts.append("SYNC HOOKS ACTIVE:")
96+
context_parts.append("When you modify files in elohim-service or elohim-app,")
97+
context_parts.append("hooks will remind you about related files that may need updates.")
98+
context_parts.append("")
99+
100+
# Output context for Claude
101+
output = {
102+
"hookSpecificOutput": {
103+
"hookEventName": "SessionStart",
104+
"additionalContext": "\n".join(context_parts)
105+
}
106+
}
107+
108+
print(json.dumps(output))
109+
110+
except json.JSONDecodeError:
111+
sys.exit(0)
112+
except Exception as e:
113+
print(f"load-project-context hook error: {e}", file=sys.stderr)
114+
sys.exit(1)
115+
116+
if __name__ == "__main__":
117+
main()

0 commit comments

Comments
 (0)