# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview This is a Tango Portal Chat Web application - an ASP.NET Core 8.0 MVC application that provides an AI-powered chat interface for querying data from Azure Data Explorer (ADX/Kusto). The application integrates with OpenAI/Azure OpenAI for natural language processing and allows users to interact with telemetry, job status, and machine data through conversational queries. ## Architecture The application follows standard ASP.NET Core MVC patterns with dependency injection: - **Controllers**: `ChatController` handles API endpoints for chat interactions, `HomeController` serves the main UI - **Services**: Core business logic including: - `LlmClient` - OpenAI/Azure OpenAI integration with assistants support - `KustoQueryService` - Azure Data Explorer connectivity and query execution - `SchemaRegistry` - Database schema management and validation - `KqlGuard` - Security layer for KQL query validation - **Models**: Data contracts, options configuration, and JSON converters - **Data**: Contains AI prompts, schema definitions, and sample data files - **Utils**: Utility classes for data processing ## Key Technologies - .NET 8.0 with C# nullable reference types enabled - ASP.NET Core MVC - Azure Data Explorer (Kusto) via `Microsoft.Azure.Kusto.Data` package - OpenAI integration via custom HTTP client - Azure Identity for authentication ## Development Commands ### Build and Run ```bash # Build the solution dotnet build # Run the application (development) dotnet run --project Tango.Portal.Chat.Web # Run with specific configuration dotnet run --project Tango.Portal.Chat.Web --configuration Release ``` ### Testing No test projects are currently configured in the solution. ### Database Operations The application connects to Azure Data Explorer clusters. Key tables accessed: - `JobRunsTable` - Job execution data - `JobStatusTable` - Job status tracking - `TelemetryTable` - System telemetry data - `MachinesTable` - Machine/device information ## Configuration Configuration is managed through `appsettings.json` and `appsettings.Development.json`: - **OpenAI Section**: API endpoints, keys, model settings, and assistant IDs - **ADX Section**: Kusto cluster URI, database name, and Azure AD authentication settings - **Logging**: Standard ASP.NET Core logging configuration ## Development Notes - The project uses Azure Identity for ADX authentication with service principal credentials - KQL queries are validated through the `KqlGuard` service before execution - The application supports both OpenAI and Azure OpenAI endpoints - AI prompts and schema definitions are stored as embedded content files in the Data directory - The `Utils` directory contains helper classes for data processing operations