Curiosity

Code Index Execution Scope

A Custom Code Index lets you write C# code to control how nodes are indexed — for example, to compute custom embeddings or generate derived text for indexing. When this code runs, it has access to the CodeIndexExecutionScope.

Available Properties and Methods

Property / Method Type Description
Graph / G Graph Access to the full graph API.
Query() / Q() IQuery Creates a new graph query.
ToIndex IReadOnlyList<UID128> The list of node UIDs currently being processed by the indexer.
IndexUID IndexUID The UID of the custom code index currently executing.
ChatAI ChatAI Helper for interacting with configured AI providers.
Tracker QueryTracker Shared performance tracker for all queries created in this scope.
CreateHttpClient() HttpClient Creates a pre-configured HTTP client for external requests.
Logger ILogger Logger instance.
CancellationToken CancellationToken Token for cancellation.
RunEndpointAsync<T>(endpointName, ...) Task<T> Executes a custom endpoint by name.
RunToolAsync(toolUID, functionName, ...) Task<ToolCallResult> Executes a registered AI tool by UID and function name.

Example

// Iterate over nodes being indexed and generate a derived text for embedding
foreach (var uid in ToIndex)
{
    var node = Graph.Get(uid);
    var summary = node.GetString(N.SupportCase.Summary);
    var content = node.GetString(N.SupportCase.Content);
    // Return derived text for each node to be used as the indexing input
    yield return (uid, $"{summary}\n{content}");
}

Next Steps

Referenced by

© 2026 Curiosity. All rights reserved.