Use this file to discover all available pages before exploring further.
Every domain in Create Context Graph is defined by a single YAML file. This file is the source of truth for everything the tool generates: Neo4j schema and constraints, Pydantic models, agent tools, NVL visualization config, and demo scenarios.Domain YAMLs live in src/create_context_graph/domains/ in the source tree and are copied into generated projects at data/ontology.yaml.
All domain ontologies must declare inherits: _base. This instructs the ontology loader to merge the base POLE+O entity types (Person, Organization, Location, Event, Object) and their standard relationships into the domain. Base types are prepended to the entity list unless the domain explicitly redefines an entity with the same label.The three base relationships added automatically are:
The POLE+O model classifies every entity in the knowledge graph into one of five semantic categories. This drives how the agent tools are generated, how the graph is visualized, and how embeddings are indexed.
Templates that guide synthetic document generation. Each template produces a batch of documents when --demo-data is used with an LLM API key. Documents are stored as :Document nodes in Neo4j with :MENTIONS edges to the entities they reference.
Field
Type
Required
Description
id
string
yes
Template identifier.
name
string
yes
Human-readable template name.
description
string
no
What this document type represents.
count
integer
no
Number of documents to generate. Default: 5.
prompt_template
string
no
LLM prompt template for generation. May reference entity field values via {{entity.field}} placeholders.
required_entities
list
no
Entity labels that must exist before documents of this type can be generated.
document_templates: - id: discharge_summary name: Discharge Summary description: Patient discharge summaries after hospital stays count: 8 prompt_template: | Write a discharge summary for patient {{patient.name}} (ID: {{patient.patient_id}}) discharged from {{facility.name}} on {{date}}. Attending physician: Dr. {{provider.name}} ({{provider.specialty}}). Diagnoses: {{diagnosis_list}}. Treatments received: {{treatment_list}}. Include discharge instructions and follow-up plans. required_entities: [Patient, Provider, Facility, Diagnosis, Treatment] - id: referral_letter name: Referral Letter description: Provider-to-provider referral communications count: 6 prompt_template: | Write a referral letter from Dr. {{referring.name}} ({{referring.specialty}}) to Dr. {{specialist.name}} ({{specialist.specialty}}) at {{facility.name}} for patient {{patient.name}}. Reason for referral: {{diagnosis.name}}. Include relevant history and findings. required_entities: [Provider, Patient, Diagnosis, Facility]
Decision trace scenarios define multi-step reasoning patterns for agent memory. Each trace records the thought process an agent follows for a given task, stored as :DecisionTrace → :HAS_STEP → :TraceStep chains in Neo4j.
Field
Type
Required
Description
id
string
yes
Trace identifier.
task
string
yes
The task or question being reasoned about. May reference entities via {{entity.field}} placeholders.
steps
list
no
Ordered list of reasoning steps.
outcome_template
string
no
Template for the final outcome string.
Each step contains:
Field
Type
Required
Description
thought
string
yes
The agent’s internal reasoning at this step.
action
string
yes
The action taken (tool call, Cypher query, external lookup, etc.).
observation
string
no
The result of the action. Populated at generation time.
decision_traces: - id: readmission_risk task: "Assess readmission risk for {{patient.name}} being discharged after {{diagnosis.name}} treatment" steps: - thought: Review patient's hospitalization and readmission history action: Query past encounters and discharge outcomes - thought: Evaluate completeness of discharge plan action: Check for scheduled follow-ups, medication reconciliation, and support services - thought: Identify risk factors from similar patients action: Find patients with similar diagnoses and demographics, check their readmission rates outcome_template: "Risk level: {{risk_level}}. Mitigation: {{actions}}"
Pre-built chat scenarios displayed in the generated frontend. Each scenario provides a sequence of prompts the user can click to demo the agent without typing.
Field
Type
Required
Description
name
string
yes
Scenario display name.
prompts
list
yes
Ordered list of chat messages to send.
demo_scenarios: - name: Patient Lookup prompts: - "Show me all patients with a chronic diagnosis" - "What medications are currently prescribed to patients in the cardiology department?" - "Find all recent patient encounters in the last 6 months" - name: Clinical Decision Support prompts: - "Are there any potential drug interactions in current prescriptions?" - "What treatments have been most effective for patients with heart failure?" - "Show me the most recent decision traces for treatment plans"
Domain-specific tools the AI agent can call. Each tool maps to a parameterized Cypher query executed against Neo4j. The description field is passed directly to the LLM as the tool’s description, so write it as you would a docstring.All agent tools must return their results as a JSON-serialized string (json.dumps(result, default=str)). The default=str handler ensures Neo4j-specific types like datetime and spatial values serialize correctly.
Field
Type
Required
Description
name
string
yes
Tool function name (snake_case).
description
string
yes
What the tool does. Passed to the LLM as the tool description.
cypher
string
no
Cypher query to execute. Use $param_name for parameters.
parameters
list
no
List of parameter definitions (same schema as entity properties).
agent_tools: - name: search_patient description: Search for patients by name or ID cypher: | MATCH (p:Patient) WHERE toLower(p.name) CONTAINS toLower($query) OR p.patient_id = $query OPTIONAL MATCH (p)-[r]-(related) RETURN p, type(r) AS rel_type, related LIMIT 20 parameters: - name: query type: string description: Patient name or ID - name: get_patient_history description: Get comprehensive history for a patient cypher: | MATCH (p:Patient {patient_id: $patient_id}) OPTIONAL MATCH (p)-[:HAD_ENCOUNTER]->(e:Encounter)-[:OCCURRED_AT]->(f:Facility) OPTIONAL MATCH (p)-[:DIAGNOSED_WITH]->(d:Diagnosis) OPTIONAL MATCH (e)-[:INCLUDES]->(t:Treatment) RETURN p, collect(DISTINCT e) AS encounters, collect(DISTINCT d) AS diagnoses, collect(DISTINCT t) AS treatments, collect(DISTINCT f) AS facilities parameters: - name: patient_id type: string description: Patient ID - name: list_patients description: "List Patient records with optional limit" cypher: | MATCH (n:Patient) RETURN n ORDER BY n.name LIMIT toInteger($limit) parameters: - name: limit type: string description: "Maximum number of results to return (default: 10)"
Every domain should include at least one list_* tool and one get_*_by_id tool so the agent can enumerate and drill into records. The built-in domains each provide 7–8 tools following this pattern.
A multi-line string that becomes the agent’s system prompt. It should describe the agent’s role, capabilities, and behavioral guidelines for the domain. Keep it grounded in what the agent tools can actually do.
The generated agent templates automatically append a tool-use emphasis suffix: "IMPORTANT: You MUST use the available tools to query the knowledge graph before answering any question about the data." You do not need to add this yourself.
system_prompt: | You are an AI clinical intelligence assistant with access to a comprehensive knowledge graph of healthcare data. You help clinicians, care coordinators, and medical staff analyze patient records, diagnoses, treatments, and provider networks. Your capabilities include: - Searching patient records and clinical history - Checking medication contraindications and interactions - Finding similar past cases for clinical decision support - Analyzing provider referral networks - Tracing treatment decisions and outcomes Always prioritize patient safety. Flag potential contraindications immediately. Provide evidence-based insights grounded in the clinical data available.
Configuration for the NVL (Neo4j Visualization Library) graph view in the frontend. All fields are optional — sensible defaults are derived from entity_types colors automatically.
Field
Type
Required
Description
node_colors
map
no
Label → hex color mapping. Overrides the color field from entity_types.
node_sizes
map
no
Label → pixel size mapping. Default: 20.
default_cypher
string
no
Initial Cypher query for the graph view. Default: MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 100.
If node_colors is not specified for a label, the color field from the corresponding entity_types entry is used automatically.
The following is a valid minimal domain YAML — enough to scaffold a working project with a single entity type and one agent tool:
inherits: _basedomain: id: bookstore name: Bookstore description: Book inventory, customers, and sales tagline: "AI-powered Book Recommendations" emoji: "\U0001F4DA"entity_types: - label: Book pole_type: OBJECT color: "#8b5cf6" icon: book properties: - name: title type: string required: true - name: isbn type: string unique: true - name: genre type: string - name: price type: floatrelationships: - type: PURCHASED source: Person target: Book - type: AUTHORED source: Person target: Bookagent_tools: - name: search_books description: Search for books by title or genre cypher: | MATCH (b:Book) WHERE b.title CONTAINS $query OR b.genre = $query RETURN b parameters: - name: query type: string required: truesystem_prompt: | You are a bookstore assistant with access to the inventory and customer purchase history.demo_scenarios: - name: Book Recommendation prompts: - "What science fiction books do we have in stock?" - "Who has purchased the most books this month?"
You can generate a complete domain YAML from a plain English description using the --custom-domain flag. The LLM uses _base.yaml and two reference domain YAMLs as few-shot examples, then validates the output against the DomainOntology Pydantic model (up to 3 retry attempts).
To save a custom domain for reuse, generated YAMLs are stored at ~/.create-context-graph/custom-domains/.For the full domain list and CLI flag values, see the Domain Catalog. For framework selection, see Framework Comparison.