create-context-graph 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- create_context_graph-0.1.0/.claude/settings.local.json +33 -0
- create_context_graph-0.1.0/.github/workflows/ci.yml +50 -0
- create_context_graph-0.1.0/.github/workflows/publish-npm.yml +25 -0
- create_context_graph-0.1.0/.github/workflows/publish-pypi.yml +39 -0
- create_context_graph-0.1.0/.gitignore +39 -0
- create_context_graph-0.1.0/CLAUDE.md +164 -0
- create_context_graph-0.1.0/LICENSE +190 -0
- create_context_graph-0.1.0/PKG-INFO +323 -0
- create_context_graph-0.1.0/README.md +282 -0
- create_context_graph-0.1.0/ROADMAP.md +238 -0
- create_context_graph-0.1.0/npm-wrapper/README.md +35 -0
- create_context_graph-0.1.0/npm-wrapper/bin/create-context-graph.mjs +71 -0
- create_context_graph-0.1.0/npm-wrapper/package.json +33 -0
- create_context_graph-0.1.0/pyproject.toml +68 -0
- create_context_graph-0.1.0/src/create_context_graph/__init__.py +3 -0
- create_context_graph-0.1.0/src/create_context_graph/__main__.py +5 -0
- create_context_graph-0.1.0/src/create_context_graph/cli.py +157 -0
- create_context_graph-0.1.0/src/create_context_graph/config.py +76 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/_base.yaml +82 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/agent-memory.yaml +390 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/conservation.yaml +407 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/data-journalism.yaml +408 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/digital-twin.yaml +402 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/financial-services.yaml +357 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/gaming.yaml +429 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/genai-llm-ops.yaml +384 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/gis-cartography.yaml +421 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/golf-sports.yaml +409 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/healthcare.yaml +411 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/hospitality.yaml +433 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/manufacturing.yaml +420 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/oil-gas.yaml +445 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/personal-knowledge.yaml +387 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/product-management.yaml +434 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/real-estate.yaml +441 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/retail-ecommerce.yaml +415 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/scientific-research.yaml +421 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/software-engineering.yaml +406 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/trip-planning.yaml +419 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/vacation-industry.yaml +427 -0
- create_context_graph-0.1.0/src/create_context_graph/domains/wildlife-management.yaml +413 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/agent-memory.json +1133 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/conservation.json +1115 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/data-journalism.json +1188 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/digital-twin.json +1143 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/financial-services.json +1154 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/gaming.json +1227 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/genai-llm-ops.json +1128 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/gis-cartography.json +1225 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/golf-sports.json +1222 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/healthcare.json +1441 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/hospitality.json +1250 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/manufacturing.json +1175 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/oil-gas.json +1223 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/personal-knowledge.json +1139 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/product-management.json +1209 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/real-estate.json +1224 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/retail-ecommerce.json +1172 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/scientific-research.json +1180 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/software-engineering.json +1518 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/trip-planning.json +1243 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/vacation-industry.json +1159 -0
- create_context_graph-0.1.0/src/create_context_graph/fixtures/wildlife-management.json +1189 -0
- create_context_graph-0.1.0/src/create_context_graph/generator.py +378 -0
- create_context_graph-0.1.0/src/create_context_graph/ingest.py +288 -0
- create_context_graph-0.1.0/src/create_context_graph/neo4j_validator.py +25 -0
- create_context_graph-0.1.0/src/create_context_graph/ontology.py +365 -0
- create_context_graph-0.1.0/src/create_context_graph/renderer.py +222 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/claude_agent_sdk/agent.py.j2 +143 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/crewai/agent.py.j2 +94 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/google_adk/agent.py.j2 +103 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/langgraph/agent.py.j2 +94 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/maf/agent.py.j2 +115 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/openai_agents/agent.py.j2 +81 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/pydanticai/agent.py.j2 +97 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/agents/strands/agent.py.j2 +84 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/agent_stub.py.j2 +36 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/config.py.j2 +20 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/context_graph_client.py.j2 +88 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/gds_client.py.j2 +82 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/generate_data.py.j2 +85 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/main.py.j2 +41 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/models.py.j2 +3 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/pyproject.toml.j2 +23 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/routes.py.j2 +104 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/backend/shared/vector_client.py.j2 +84 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/base/Makefile.j2 +60 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/base/README.md.j2 +79 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/base/docker-compose.yml.j2 +17 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/base/dot_env.j2 +15 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/base/gitignore.j2 +30 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/cypher/gds_projections.cypher.j2 +29 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/cypher/schema.cypher.j2 +4 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/app/globals.css.j2 +12 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/app/layout.tsx.j2 +23 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/app/page.tsx.j2 +46 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/components/ChatInterface.tsx.j2 +147 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/components/ContextGraphView.tsx.j2 +154 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/components/DecisionTracePanel.tsx.j2 +158 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/components/Provider.tsx.j2 +9 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/lib/config.ts.j2 +26 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/next.config.ts.j2 +9 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/package.json.j2 +27 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/theme/index.ts.j2 +28 -0
- create_context_graph-0.1.0/src/create_context_graph/templates/frontend/tsconfig.json.j2 +23 -0
- create_context_graph-0.1.0/src/create_context_graph/wizard.py +165 -0
- create_context_graph-0.1.0/tests/__init__.py +0 -0
- create_context_graph-0.1.0/tests/conftest.py +71 -0
- create_context_graph-0.1.0/tests/test_cli.py +137 -0
- create_context_graph-0.1.0/tests/test_config.py +95 -0
- create_context_graph-0.1.0/tests/test_generated_project.py +267 -0
- create_context_graph-0.1.0/tests/test_generator.py +124 -0
- create_context_graph-0.1.0/tests/test_matrix.py +68 -0
- create_context_graph-0.1.0/tests/test_neo4j_validator.py +71 -0
- create_context_graph-0.1.0/tests/test_ontology.py +197 -0
- create_context_graph-0.1.0/tests/test_renderer.py +308 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Read(//Users/lyonwj/github/johnymontana/back-of-my-balls/src/app/**)",
|
|
5
|
+
"Bash(pip install:*)",
|
|
6
|
+
"Bash(uv pip:*)",
|
|
7
|
+
"Bash(uv venv:*)",
|
|
8
|
+
"Read(//private/tmp/**)",
|
|
9
|
+
"Bash(rm -rf test-financial)",
|
|
10
|
+
"Bash(source /Users/lyonwj/github/johnymontana/create-context-graph/.venv/bin/activate)",
|
|
11
|
+
"Bash(create-context-graph test-financial:*)",
|
|
12
|
+
"Bash(grep -r {{[^{] src/create_context_graph/templates/ --include=*.j2 -l)",
|
|
13
|
+
"Bash(rm -rf test-sw)",
|
|
14
|
+
"Bash(create-context-graph test-sw:*)",
|
|
15
|
+
"Bash(create-context-graph --list-domains)",
|
|
16
|
+
"Bash(ls -la /Users/lyonwj/github/johnymontana/create-context-graph/src/create_context_graph/domains/*.yaml)",
|
|
17
|
+
"Bash(for f:*)",
|
|
18
|
+
"Bash(do echo:*)",
|
|
19
|
+
"Read(//Users/lyonwj/github/johnymontana/create-context-graph/src/create_context_graph/domains/**)",
|
|
20
|
+
"Bash(done)",
|
|
21
|
+
"Bash(ls -1 /Users/lyonwj/github/johnymontana/create-context-graph/src/create_context_graph/domains/*.yaml)",
|
|
22
|
+
"Bash(xargs -I{} basename {} .yaml)",
|
|
23
|
+
"Bash(python3 -c \":*)",
|
|
24
|
+
"Bash(rm -rf test-gen)",
|
|
25
|
+
"Bash(create-context-graph test-gen:*)",
|
|
26
|
+
"Bash(source .venv/bin/activate)",
|
|
27
|
+
"Bash(pytest tests/ -v --tb=short)",
|
|
28
|
+
"Bash(pytest tests/test_matrix.py -v --tb=short --slow)",
|
|
29
|
+
"Bash(pytest tests/ --tb=short --slow)",
|
|
30
|
+
"Bash(chmod +x /Users/lyonwj/github/johnymontana/create-context-graph/npm-wrapper/bin/create-context-graph.mjs)"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
run: uv python install ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: uv venv && uv pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: uv run pytest tests/ -v --tb=short
|
|
31
|
+
|
|
32
|
+
matrix:
|
|
33
|
+
name: Domain x Framework Matrix
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- name: Install uv
|
|
41
|
+
uses: astral-sh/setup-uv@v4
|
|
42
|
+
|
|
43
|
+
- name: Set up Python
|
|
44
|
+
run: uv python install 3.12
|
|
45
|
+
|
|
46
|
+
- name: Install dependencies
|
|
47
|
+
run: uv venv && uv pip install -e ".[dev]"
|
|
48
|
+
|
|
49
|
+
- name: Run matrix tests (all 176 domain x framework combos)
|
|
50
|
+
run: uv run pytest tests/test_matrix.py -v --tb=short --slow
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: Publish npm wrapper to npm
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: "20"
|
|
19
|
+
registry-url: "https://registry.npmjs.org"
|
|
20
|
+
|
|
21
|
+
- name: Publish to npm
|
|
22
|
+
working-directory: npm-wrapper
|
|
23
|
+
run: npm publish --access public
|
|
24
|
+
env:
|
|
25
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: Build and publish to PyPI
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write # Required for trusted publishing (OIDC)
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
run: uv python install 3.12
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv venv && uv pip install -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Run tests
|
|
28
|
+
run: uv run pytest tests/ -v --tb=short
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: uv build
|
|
32
|
+
|
|
33
|
+
- name: Publish to PyPI
|
|
34
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
35
|
+
# Uses trusted publishing (OIDC) — no API token needed.
|
|
36
|
+
# Configure at: https://pypi.org/manage/project/create-context-graph/settings/publishing/
|
|
37
|
+
# If not using trusted publishing, set PYPI_API_TOKEN secret and use:
|
|
38
|
+
# with:
|
|
39
|
+
# password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.venv/
|
|
9
|
+
venv/
|
|
10
|
+
|
|
11
|
+
# Testing
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
|
|
16
|
+
# IDE
|
|
17
|
+
.vscode/
|
|
18
|
+
.idea/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
|
|
22
|
+
# OS
|
|
23
|
+
.DS_Store
|
|
24
|
+
Thumbs.db
|
|
25
|
+
|
|
26
|
+
# Environment
|
|
27
|
+
.env
|
|
28
|
+
.env.local
|
|
29
|
+
|
|
30
|
+
# Build artifacts
|
|
31
|
+
*.whl
|
|
32
|
+
*.tar.gz
|
|
33
|
+
|
|
34
|
+
# npm
|
|
35
|
+
npm-wrapper/node_modules/
|
|
36
|
+
npm-wrapper/*.tgz
|
|
37
|
+
|
|
38
|
+
# Generated test output
|
|
39
|
+
/foobar/
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# CLAUDE.md — Create Context Graph
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
Interactive CLI scaffolding tool that generates domain-specific context graph applications. Like `create-next-app` but for AI agents with graph memory. Invoked via `uvx create-context-graph` or `npx create-context-graph`.
|
|
6
|
+
|
|
7
|
+
Given a domain (e.g., "healthcare", "wildlife-management") and an agent framework (e.g., PydanticAI, Claude Agent SDK), it generates a complete full-stack application: FastAPI backend, Next.js + Chakra UI v3 + NVL frontend, Neo4j schema, synthetic data, and a configured AI agent with domain-specific tools.
|
|
8
|
+
|
|
9
|
+
**Status:** Phase 3 complete. 22 domains, 8 agent frameworks, NVL graph visualization, data generation pipeline, 103 passing tests.
|
|
10
|
+
|
|
11
|
+
## Quick Reference
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Setup
|
|
15
|
+
uv venv && uv pip install -e ".[dev]"
|
|
16
|
+
|
|
17
|
+
# Run tests
|
|
18
|
+
source .venv/bin/activate && pytest tests/ -v
|
|
19
|
+
|
|
20
|
+
# Test scaffold generation
|
|
21
|
+
create-context-graph my-app --domain financial-services --framework pydanticai --demo-data
|
|
22
|
+
|
|
23
|
+
# List available domains
|
|
24
|
+
create-context-graph --list-domains
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Architecture
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
src/create_context_graph/
|
|
31
|
+
├── cli.py # Click CLI entry point (interactive + flag modes)
|
|
32
|
+
├── wizard.py # 7-step Questionary interactive wizard
|
|
33
|
+
├── config.py # ProjectConfig Pydantic model
|
|
34
|
+
├── ontology.py # YAML domain ontology loader, validation, code generation
|
|
35
|
+
├── renderer.py # Jinja2 template engine (renders project scaffold)
|
|
36
|
+
├── generator.py # LLM-powered synthetic data pipeline (4 stages)
|
|
37
|
+
├── ingest.py # Neo4j ingestion via neo4j-agent-memory or direct driver
|
|
38
|
+
├── neo4j_validator.py # Neo4j connection testing
|
|
39
|
+
├── domains/ # 22 YAML ontology definitions + _base.yaml
|
|
40
|
+
├── fixtures/ # 22 pre-generated JSON fixture files
|
|
41
|
+
└── templates/ # Jinja2 templates for generated projects
|
|
42
|
+
├── base/ # .env, Makefile, docker-compose, README, .gitignore
|
|
43
|
+
├── backend/
|
|
44
|
+
│ ├── shared/ # FastAPI main, config, neo4j client, GDS, vector, models, routes
|
|
45
|
+
│ └── agents/ # Per-framework agent.py (8 frameworks)
|
|
46
|
+
├── frontend/ # Next.js + Chakra UI v3 + NVL components
|
|
47
|
+
└── cypher/ # Schema constraints + GDS projections
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Key Design Decisions
|
|
51
|
+
|
|
52
|
+
### Templates are domain-agnostic, data-driven
|
|
53
|
+
No per-domain template directories. The ontology YAML drives all domain customization via Jinja2 context variables. Only `backend/agents/{framework}/agent.py.j2` varies by framework — everything else is shared.
|
|
54
|
+
|
|
55
|
+
### Jinja2 + JSX/Python escaping
|
|
56
|
+
Templates that contain JSX curly braces or Python dict literals must use `{% raw %}...{% endraw %}` blocks to avoid conflicts with Jinja2's `{{ }}` syntax. Break out of raw mode only for actual Jinja2 substitutions:
|
|
57
|
+
```
|
|
58
|
+
{% raw %}JSX code with {curly} braces{% endraw %}{{ jinja_var }}{% raw %}more JSX{% endraw %}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Two-layer ontology inheritance
|
|
62
|
+
`_base.yaml` defines shared POLE+O entity types (Person, Organization, Location, Event, Object). Domain YAMLs declare `inherits: _base` and add domain-specific entity types. The `ontology.py` loader merges base entities/relationships into each domain.
|
|
63
|
+
|
|
64
|
+
### Dual data generation modes
|
|
65
|
+
- **Static fallback** (no LLM key): Generates placeholder entities with `{Label} {N}` naming. Ships pre-generated fixtures in `fixtures/` directory.
|
|
66
|
+
- **LLM-powered** (with `--anthropic-api-key`): Generates realistic entities, documents, and decision traces via Anthropic or OpenAI APIs.
|
|
67
|
+
|
|
68
|
+
### Dual ingestion backends
|
|
69
|
+
`ingest.py` tries `neo4j-agent-memory` MemoryClient first (demonstrating all three memory types), falls back to direct `neo4j` driver if the package isn't installed.
|
|
70
|
+
|
|
71
|
+
## Domain Ontology YAML Schema
|
|
72
|
+
|
|
73
|
+
Each domain YAML file must contain:
|
|
74
|
+
- `inherits: _base` — merge base POLE+O types
|
|
75
|
+
- `domain:` — id, name, description, tagline, emoji
|
|
76
|
+
- `entity_types:` — label, pole_type (PERSON/ORGANIZATION/LOCATION/EVENT/OBJECT), subtype, color (hex), icon, properties (name, type, required, unique, enum)
|
|
77
|
+
- `relationships:` — type, source, target
|
|
78
|
+
- `document_templates:` — id, name, description, count, prompt_template, required_entities
|
|
79
|
+
- `decision_traces:` — id, task, steps (thought/action), outcome_template
|
|
80
|
+
- `demo_scenarios:` — name, prompts list
|
|
81
|
+
- `agent_tools:` — name, description, cypher query, parameters
|
|
82
|
+
- `system_prompt:` — multi-line agent system prompt
|
|
83
|
+
- `visualization:` — node_colors, node_sizes, default_cypher
|
|
84
|
+
|
|
85
|
+
Property types: `string`, `integer`, `float`, `boolean`, `date`, `datetime`, `point`
|
|
86
|
+
YAML booleans in enum values must be quoted: `enum: ["true", "false"]` not `enum: [true, false]`
|
|
87
|
+
|
|
88
|
+
## Generated Project Structure
|
|
89
|
+
|
|
90
|
+
When a user runs the CLI, the output is:
|
|
91
|
+
```
|
|
92
|
+
my-app/
|
|
93
|
+
├── backend/app/ # FastAPI + chosen agent framework
|
|
94
|
+
│ ├── main.py, config.py, routes.py, models.py
|
|
95
|
+
│ ├── agent.py # Framework-specific (8 frameworks available)
|
|
96
|
+
│ ├── context_graph_client.py, gds_client.py, vector_client.py
|
|
97
|
+
│ └── __init__.py
|
|
98
|
+
├── backend/scripts/generate_data.py
|
|
99
|
+
├── backend/pyproject.toml
|
|
100
|
+
├── frontend/ # Next.js + Chakra UI v3 + NVL
|
|
101
|
+
│ ├── app/ (layout.tsx, page.tsx, globals.css)
|
|
102
|
+
│ ├── components/ (ChatInterface, ContextGraphView, DecisionTracePanel, Provider)
|
|
103
|
+
│ ├── lib/config.ts, theme/index.ts
|
|
104
|
+
│ └── package.json, next.config.ts, tsconfig.json
|
|
105
|
+
├── cypher/ (schema.cypher, gds_projections.cypher)
|
|
106
|
+
├── data/ (ontology.yaml, _base.yaml, fixtures.json, documents/)
|
|
107
|
+
├── .env, Makefile, docker-compose.yml, README.md, .gitignore
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Testing
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pytest tests/ -v # All 103 tests
|
|
114
|
+
pytest tests/test_config.py # Config model tests (10)
|
|
115
|
+
pytest tests/test_ontology.py # Ontology loading + all 22 domains validate (20)
|
|
116
|
+
pytest tests/test_renderer.py # Template rendering + all 8 frameworks compile check (34)
|
|
117
|
+
pytest tests/test_generator.py # Data generation pipeline (14)
|
|
118
|
+
pytest tests/test_cli.py # CLI integration + 8 domain/framework combos (15)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Tests do NOT require Neo4j or any API keys. All tests use `tmp_path` fixtures for output.
|
|
122
|
+
|
|
123
|
+
## Adding a New Domain
|
|
124
|
+
|
|
125
|
+
1. Create `src/create_context_graph/domains/{domain-id}.yaml` following the schema above
|
|
126
|
+
2. Generate fixture data: run the CLI with `--demo-data` or use `generator.py` directly
|
|
127
|
+
3. Copy the fixture to `src/create_context_graph/fixtures/{domain-id}.json`
|
|
128
|
+
4. Verify: `pytest tests/test_ontology.py::TestLoadAllDomains -v`
|
|
129
|
+
|
|
130
|
+
## Adding a New Agent Framework
|
|
131
|
+
|
|
132
|
+
1. Create `src/create_context_graph/templates/backend/agents/{framework_key}/agent.py.j2` (use underscores for directory name; hyphens in config key are auto-converted via `fw_key = framework.replace("-", "_")`)
|
|
133
|
+
2. Add the framework key to `SUPPORTED_FRAMEWORKS`, `FRAMEWORK_DISPLAY_NAMES`, and `FRAMEWORK_DEPENDENCIES` in `config.py`
|
|
134
|
+
3. Template must export `async def handle_message(message: str, session_id: str | None = None) -> dict` returning `{"response": str, "session_id": str, "graph_data": dict | None}`
|
|
135
|
+
4. Use `{% raw %}...{% endraw %}` blocks for Python dict literals in the template
|
|
136
|
+
5. Use `{% for tool in agent_tools %}` to generate domain-specific tools from ontology
|
|
137
|
+
6. The template receives full ontology context: `domain`, `agent_tools`, `system_prompt`, `framework_display_name`, etc.
|
|
138
|
+
7. Add tests to `TestAllFrameworksRender` in `test_renderer.py` and `TestMultipleDomainScaffolds` in `test_cli.py`
|
|
139
|
+
|
|
140
|
+
### Current frameworks and their patterns
|
|
141
|
+
| Framework | Directory | Pattern |
|
|
142
|
+
|-----------|-----------|---------|
|
|
143
|
+
| PydanticAI | `pydanticai/` | `@agent.tool` decorator + `RunContext[AgentDeps]` |
|
|
144
|
+
| Claude Agent SDK | `claude_agent_sdk/` | Dict-based TOOLS list + agentic while loop |
|
|
145
|
+
| OpenAI Agents SDK | `openai_agents/` | `@function_tool` decorator + `Runner.run()` |
|
|
146
|
+
| LangGraph | `langgraph/` | `@tool` + `create_react_agent()` |
|
|
147
|
+
| CrewAI | `crewai/` | `Agent` + `Task` + `Crew` with `@tool` |
|
|
148
|
+
| Strands | `strands/` | `Agent` with `@tool`, Bedrock model |
|
|
149
|
+
| Google ADK | `google_adk/` | `Agent` + `FunctionTool`, Gemini model |
|
|
150
|
+
| MAF | `maf/` | Modular tool registry with decorator pattern |
|
|
151
|
+
|
|
152
|
+
## Dependencies
|
|
153
|
+
|
|
154
|
+
**Core:** click, questionary, rich, jinja2, pyyaml, pydantic, neo4j
|
|
155
|
+
**Optional:** anthropic, openai (for LLM data generation), neo4j-agent-memory (for memory-aware ingestion)
|
|
156
|
+
**Dev:** pytest, pytest-cov, pytest-asyncio
|
|
157
|
+
**Build:** hatchling (src layout, bundles YAML/JSON/Jinja2 files automatically)
|
|
158
|
+
|
|
159
|
+
## What's Not Yet Implemented
|
|
160
|
+
|
|
161
|
+
- SaaS data connectors (Gmail, Slack, Jira, GitHub, Notion, Salesforce)
|
|
162
|
+
- Custom domain LLM generation ("describe your domain" flow)
|
|
163
|
+
- npm wrapper package for `npx create-context-graph`
|
|
164
|
+
- CI/CD and PyPI/npm publishing workflows
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Neo4j Labs
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|