What HxGraph Is

Every time a case type is saved in Studio, every time a connector is configured, every time an access group is defined — that information is indexed into HxGraph. The graph has two classes of edges: structural edges that capture containment and dependency relationships (a case type contains stages; a stage contains steps; a step uses a connector), and semantic edges that capture similarity relationships discovered via pgvector cosine distance on concept_embeddings. A "Fraud Review" step and a "Compliance Check" step may not be structurally connected — but HxGraph will identify them as semantically similar because their descriptions and context are close in embedding space.

HxGraph is stored in three PostgreSQL tables — graph_nodes, graph_edges, and concept_embeddings — and served by the case-service on port 8200. The Studio UI at /hxgraph provides an interactive visualizer, a node browser, and a natural-language query interface backed by HxNexus. No external graph database is required.

Why HxGraph matters: Without HxGraph, HxNexus would only know about case data — individual records in a database. With HxGraph, it knows the architecture of your process: which case types share forms, which connectors are critical paths, which stages appear across multiple workflows, and how a change to one component ripples through the system. This is what enables impact analysis, cross-module relationship discovery, and architecture-level Q&A.

Node Types

HxGraph indexes eleven distinct node types. Each node carries a label, a description, and an embedding vector computed at sync time. Nodes are uniquely identified by a composite of type + external_id.

Node Type Source Description Example
case_type case_types table A top-level process definition. Root node of every process subgraph. Contains stages, carries SLA policy and access group assignments. Loan Application, Claims Processing, Employee Onboarding
stage stages table A lifecycle phase within a case type. Has entry/exit conditions, SLA duration, and one or more steps. Stages are the Kanban columns in HxWork. Document Collection, Underwriting Review, Final Approval
step steps table An atomic action within a stage. Has a step type (form, connector call, AI, assignment, notification, decision, etc.) and optional guard conditions. Collect Income Proof (form), Run Credit Check (connector), Send Approval Email (notification)
form forms table A named set of fields attached to a step or stage. Forms are reusable — the same form can appear in multiple steps across case types. Personal Details Form, KYC Declaration, Property Valuation
field fields table An individual data field within a form. Carries type, validation rules, visibility conditions, and default values. 12 field types supported. date_of_birth (date), annual_income (number), id_document (file)
module Velaris service registry A major platform module (case-service, flow-engine, HxWork, HxStream, HxGraph, HxAnalytics, etc.). Used for cross-module dependency mapping. case-service, flow-engine, HxWork
endpoint API route registry A REST or SSE API endpoint exposed by any Velaris service. Indexed with its HTTP method, path, and owning module for dependency tracing. POST /api/v1/cases, GET /api/v1/stream/events, POST /api/v1/nexus/query
access_group access_groups table A named permission boundary grouping users, case types, and data visibility rules. Structural edges connect access groups to the case types they govern. Claims Team, Underwriting, Compliance, Customer-facing
connector connectors table A configured external integration (Stripe, Onfido, DocuSign, Salesforce, Twilio, etc.) used by one or more steps. HxGraph tracks which case types depend on each connector. Stripe Payments, Onfido KYC, DocuSign eSign
concept HxGraph sync (AI-extracted) An abstract domain concept extracted from process descriptions and field labels during sync. Concepts are purely semantic nodes — they have no structural source row, only embeddings and similarity edges to other nodes. creditworthiness, identity verification, regulatory compliance
pattern HxGraph community detection A recurring structural pattern detected across multiple case types (e.g., "3-stage sequential approval", "parallel document + identity check"). Patterns are auto-labelled by the sync algorithm after community detection. sequential-approval-pattern, dual-check-pattern

Studio UI — HxGraph

Access the HxGraph Studio at Studio > HxGraph (route: /hxgraph). The interface has four tabs:

Tab What It Does
Visualize Interactive D3.js force-directed graph. Nodes are color-coded by type. Drag to rearrange, scroll to zoom, click a node to see its label, description, edges, and linked records. Filter by node type using the legend checkboxes. Click an edge to see its type (structural or semantic) and similarity score.
Browse Nodes A searchable, filterable table of all graph nodes. Filter by node type, search by label or description. Click any node to open its detail panel showing all inbound and outbound edges, the raw embedding, and a link to the source record (e.g., the case type editor for a case_type node).
Ask HxNexus A full HxNexus chat interface scoped to graph context. Natural language queries are routed to the graph endpoints (/graph/query, /graph/path, /graph/explain) rather than case data. Ideal for architecture exploration: "What stages are shared across more than two case types?", "Which connectors are single points of failure?"
Graph Report Auto-generated markdown report summarizing the graph's community structure, most-connected nodes (hub analysis), dangling nodes (no edges), and semantic clusters. Regenerated on demand or after each sync. Equivalent to a GRAPH_REPORT.md but live and interactive.

Graph API Reference

All graph endpoints are served by the case-service on port 8200. Admin-level JWT required for sync; other endpoints require a standard authenticated token.

Method Endpoint Description
POST /api/v1/graph/query Natural language query over the graph. Body: {"question": "..."}. HxNexus traverses structural and semantic edges to construct an answer about process architecture.
GET /api/v1/graph/path?from=A&to=B Find the shortest structural path between two node labels or IDs. Returns an ordered array of nodes and edge types. Useful for understanding how two components are connected.
GET /api/v1/graph/explain?concept=term Return a HxNexus-generated explanation of a concept, step type, or module — drawing on both the graph node's context and semantically similar nodes.
GET /api/v1/graph/similar?concept=term Find graph nodes semantically similar to the given term, ranked by pgvector cosine distance. Returns node type, label, description, and similarity score. Supports &limit=N and &type=step filters.
GET /api/v1/graph/report Retrieve the current Graph Report as structured JSON (communities, hubs, isolates, semantic clusters). The same data rendered in the Studio "Graph Report" tab.
GET /api/v1/graph/export Export the full graph as a JSON document (nodes array + edges array). Useful for external visualization tools, backups, or feeding into custom analysis pipelines.
POST /api/v1/graph/sync Re-index the graph from the current database state. Triggers: node extraction from all tables, embedding generation via the configured AI backend, community detection (Louvain algorithm), and similarity edge computation. Takes 5–30 seconds depending on graph size. Admin only.
GET /api/v1/graph/visualize Serves the interactive D3.js graph HTML page directly. Open in any browser — no authentication required for the static visualizer shell (data is loaded client-side with the user's token).

Re-syncing the Graph

The graph is not automatically updated on every Studio save — instead, it is synced on demand. Run a sync after any of the following changes to ensure HxGraph reflects the current state of the platform:

After sync completes, the algorithm automatically:

  1. Extracts nodes from all indexed tables (case_types, stages, steps, forms, fields, connectors, access_groups, modules, endpoints).

  2. Generates embeddings for new or changed nodes by calling the configured embedding backend with each node's label + description as input text. Embeddings are stored in the concept_embeddings table as 1536-dimensional vectors.

  3. Computes structural edges from foreign-key and config relationships (case_type > stage > step > form > field, step > connector, case_type > access_group).

  4. Computes semantic edges using pgvector cosine similarity. Node pairs with distance below the configured threshold (default 0.25) receive a SIMILAR_TO edge.

  5. Detects communities using the Louvain modularity algorithm over the structural edge graph. Detected communities are labelled and stored as pattern nodes.

# Trigger a full graph re-sync (Admin JWT required)
curl -s -X POST http://localhost:8200/api/v1/graph/sync \
  -H "Authorization: Bearer <ADMIN_JWT>"

# Response
{
  "status": "ok",
  "nodes_indexed": 284,
  "edges_structural": 631,
  "edges_semantic": 148,
  "communities": 7,
  "duration_ms": 8420
}

cURL Examples

Natural Language Architecture Query

curl -s -X POST http://localhost:8200/api/v1/graph/query \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -d '{"question": "Which case types share the same KYC connector?"}'

Path Between Two Concepts

curl -s \
  "http://localhost:8200/api/v1/graph/path?from=Loan+Application&to=Onfido+KYC" \
  -H "Authorization: Bearer <JWT_TOKEN>"

# Sample response
{
  "path": [
    { "type": "case_type",  "label": "Loan Application" },
    { "type": "stage",      "label": "Identity Verification", "edge": "CONTAINS" },
    { "type": "step",       "label": "Run KYC Check",            "edge": "CONTAINS" },
    { "type": "connector",  "label": "Onfido KYC",               "edge": "USES"     }
  ],
  "length": 3
}

Find Similar Concepts

curl -s \
  "http://localhost:8200/api/v1/graph/similar?concept=fraud+detection&limit=5" \
  -H "Authorization: Bearer <JWT_TOKEN>"

Use Cases

🔍
Architecture Queries
Ask "what stages are common across all our financial case types?" or "which steps invoke external APIs?" HxGraph traverses structural edges to answer in seconds.
📈
Impact Analysis
Before deprecating a connector or changing a shared form, query HxGraph to see exactly which case types, stages, and steps depend on it. Avoid surprise breakages.
🔗
Cross-Module Discovery
Semantic edges reveal non-obvious relationships — a step in one case type is semantically similar to a step in another, suggesting opportunities for form reuse or connector consolidation.
📄
Documentation Automation
Generate up-to-date architecture documentation on demand via the Graph Report endpoint — no manual diagramming. The report reflects the actual current state of the database, not a stale wiki.
Sync before querying: HxGraph answers are only as current as the last sync. If you've published a new case type or configured a new connector and the graph has not been re-synced, queries about that component will return "not found" or incomplete paths. Always sync after significant structural changes.