Skip to main content
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.

Top-level structure


inherits

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:
  • WORKS_FOR: Person → Organization
  • LOCATED_AT: Organization → Location
  • PARTICIPATED_IN: Person → Event

domain

Domain metadata used in the generated project’s README, UI header, and configuration.

entity_types

A list of entity type definitions. Each entry maps to a Neo4j node label and a generated Pydantic model.

POLE+O types

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.

PERSON

Individuals — patients, employees, customers, researchers, players.

ORGANIZATION

Companies, teams, departments, agencies, institutions.

LOCATION

Physical places, addresses, regions, facilities, habitats.

EVENT

Time-bound occurrences — transactions, encounters, appointments, sightings.

OBJECT

Everything else — accounts, documents, products, equipment, medications.

Property definitions

Each property within an entity_types or relationships entry accepts:

Supported property types

When using boolean-like values in enum lists, you must quote them. Unquoted true and false are parsed by YAML as actual booleans, not strings.

Example — healthcare entity types

The following is taken directly from the healthcare.yaml domain:

relationships

A list of relationship type definitions. Each entry maps to a Neo4j relationship type.

document_templates

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.

decision_traces

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. Each step contains:

demo_scenarios

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.

agent_tools

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.
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.

system_prompt

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.

visualization

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. If node_colors is not specified for a label, the color field from the corresponding entity_types entry is used automatically.

Complete minimal example

The following is a valid minimal domain YAML — enough to scaffold a working project with a single entity type and one agent tool:

Adding a custom domain

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.