Built Word Documents (.docx):
Spensara Overview (.docx)
Capability Assessment (.docx)
Brink POS Ingestion Analysis (.docx)
The Borg Ingestion Architecture (.docx)
Categories
Implementation Specs (157)
Detailed engineering and feature implementation specifications.
- specs/AnomalyDetection/TASK1.1.md
- specs/AnomalyDetection/TASK1.2.md
- specs/AnomalyDetection/TASK1.3.md
- specs/AnomalyDetection/TASK1.4.md
- specs/AnomalyDetection/TASK2.1.md
- specs/AnomalyDetection/TASK2.2.md
- specs/AnomalyDetection/TASK3.1.md
- specs/AnomalyDetection/TASK3.2.md
- specs/AnomalyDetection/TASK3.3.md
- specs/AnomalyDetection/TASK4.1.md
- specs/AnomalyDetection/TASK4.2.md
- specs/AnomalyDetection/TASK4.3.md
- specs/AnomalyDetection/TASK4.4.md
- specs/AnomalyDetection/TASK5.1.md
- specs/AnomalyDetection/TASK5.2.md
- specs/AnomalyDetection/TASK5.3.md
- specs/AnomalyDetection/TASK6.1.md
- specs/AnomalyDetection/TASK6.2.md
- specs/AnomalyDetection/TASK6.3.md
- specs/AnomalyDetection/TASKS.md
- specs/ApiServicePostgresTestStability/TASK.md
- specs/BackendDatabaseConsolidation/TASK.md
- specs/BackendDatabaseConsolidation/TASK1.1.md
- specs/BackendDatabaseConsolidation/TASK1.2.md
- specs/BackendDatabaseConsolidation/TASK1.3.md
- specs/BackendDatabaseConsolidation/TASK2.1.md
- specs/BackendDatabaseConsolidation/TASK2.2.md
- specs/BackendDatabaseConsolidation/TASK2.3.md
- specs/BackendDatabaseConsolidation/TASK3.1.md
- specs/BackendDatabaseConsolidation/TASK3.2.md
- specs/BackendDatabaseConsolidation/TASK4.1.md
- specs/BackendDatabaseConsolidation/TASK4.2.md
- specs/BackendDatabaseConsolidation/TASK4.3.md
- specs/BackendDatabaseConsolidation/TASK5.1.md
- specs/BackendDatabaseConsolidation/TASK5.2.md
- specs/BrinkLaborGetShiftsStaging/TASK.md
- specs/BrinkPosOrdersFirstEtlJob/TASK.md
- specs/BrinkPosOrdersFirstEtlJob/TASK0.md
- specs/BrinkPosOrdersFirstEtlJob/TASK1.md
- specs/BrinkPosOrdersFirstEtlJob/TASK2.1.md
- specs/BrinkPosOrdersFirstEtlJob/TASK2.2.md
- specs/BrinkPosOrdersFirstEtlJob/TASK2.3.md
- specs/BrinkPosOrdersFirstEtlJob/TASK2.4.md
- specs/BrinkPosOrdersFirstEtlJob/TASK2.md
- specs/BrinkPosOrdersFirstEtlJob/TASK3.1.md
- specs/BrinkPosOrdersFirstEtlJob/TASK3.2.md
- specs/BrinkPosOrdersFirstEtlJob/TASK3.3.md
- specs/BrinkPosOrdersFirstEtlJob/TASK3.4.md
- specs/BrinkPosOrdersFirstEtlJob/TASK3.md
- specs/BrinkPosOrdersFirstEtlJob/TASK4.1.md
- specs/BrinkPosOrdersFirstEtlJob/TASK4.2.md
- specs/BrinkPosOrdersFirstEtlJob/TASK4.3.md
- specs/BrinkPosOrdersFirstEtlJob/TASK4.4.md
- specs/BrinkPosOrdersFirstEtlJob/TASK4.md
- specs/BrinkPosOrdersFirstEtlJob/TASK5.1.md
- specs/BrinkPosOrdersFirstEtlJob/TASK5.2.md
- specs/BrinkPosOrdersFirstEtlJob/TASK5.3.md
- specs/BrinkPosOrdersFirstEtlJob/TASK5.4.md
- specs/BrinkPosOrdersFirstEtlJob/TASK5.md
- specs/BrinkPosOrdersFirstEtlJob/TASK6.1.md
- specs/BrinkPosOrdersFirstEtlJob/TASK6.2.md
- specs/BrinkPosOrdersFirstEtlJob/TASK6.3.md
- specs/BrinkPosOrdersFirstEtlJob/TASK6.4.md
- specs/BrinkPosOrdersFirstEtlJob/TASK6.md
- specs/BrinkPosOrdersFirstEtlJob/TASK7.md
- specs/BrinkPosOrdersFirstEtlJob/TASK8.md
- specs/BrinkPosOrdersFirstEtlJob/TASK9.md
- specs/BrinkSettings2ToStaging/TASK.MD
- specs/CuratedToS3Stage/TASK.md
- specs/CuratedToS3Stage/TASK0.md
- specs/CuratedToS3Stage/TASK1.md
- specs/CuratedToS3Stage/TASK2.md
- specs/CuratedToS3Stage/TASK3.md
- specs/CuratedToS3Stage/TASK4.md
- specs/CustomerCredentialCustomHeaders/TASK.md
- specs/CustomerCredentialCustomHeaders/TASK1.1.md
- specs/CustomerCredentialCustomHeaders/TASK1.2.md
- specs/CustomerCredentialCustomHeaders/TASK2.1.md
- specs/CustomerCredentialCustomHeaders/TASK2.2.md
- specs/CustomerCredentialCustomHeaders/TASK3.1.md
- specs/CustomerCredentialTriggeredProvisioning/TASK.md
- specs/CustomerCredentialTriggeredProvisioning/TASK1.1.md
- specs/CustomerCredentialTriggeredProvisioning/TASK1.2.md
- specs/CustomerCredentialTriggeredProvisioning/TASK2.1.md
- specs/CustomerCredentialTriggeredProvisioning/TASK2.2.md
- specs/CustomerCredentialTriggeredProvisioning/TASK3.1.md
- specs/CustomerCredentialTriggeredProvisioning/TASK3.2.md
- specs/CustomerCredentialTriggeredProvisioning/TASK4.1.md
- specs/EtlSourceAdapterFramework/TASK.md
- specs/EtlSourceAdapterFramework/TASK0.md
- specs/EtlSourceAdapterFramework/TASK1.md
- specs/EtlSourceAdapterFramework/TASK2.md
- specs/EtlSourceAdapterFramework/TASK3.md
- specs/EtlSourceAdapterFramework/TASK4.md
- specs/EtlSourceAdapterFramework/TASK5.md
- specs/EtlSourceAdapterFramework/TASK6.md
- specs/KdsCdcDebeziumIntegration/TASK.md
- specs/KdsCdcDebeziumIntegration/TASK1.md
- specs/KdsCdcDebeziumIntegration/TASK2.md
- specs/KdsCdcDebeziumIntegration/TASK3.md
- specs/KdsCdcDebeziumIntegration/TASK4.md
- specs/KdsCdcDebeziumIntegration/TASK5.md
- specs/KdsCdcDurableRelationRouting/TASK.md
- specs/KdsCdcDurableRelationRouting/TASK1.md
- specs/KdsCdcDurableRelationRouting/TASK2.md
- specs/KdsCdcDurableRelationRouting/TASK3.md
- specs/KdsCdcDurableRelationRouting/TASK4.md
- specs/KdsCdcDurableRelationRouting/TASK5.md
- specs/KdsCdcIngestion/TASK.md
- specs/KdsCdcIngestion/TASK1.md
- specs/KdsCdcIngestion/TASK2.md
- specs/KdsCdcIngestion/TASK3.md
- specs/KdsCdcIngestion/TASK4.md
- specs/KdsCdcIngestion/TASK5.md
- specs/KdsCdcIngestion/TASK6.md
- specs/KdsCdcIngestion/TASK7.md
- specs/KdsCdcIngestion/TASK8.md
- specs/KdsCdcIngestion/TASK9.md
- specs/KdsCdcReplayExecution/TASK.md
- specs/KdsCdcReplayExecution/TASK1.md
- specs/KdsCdcReplayExecution/TASK2.md
- specs/KdsCdcReplayExecution/TASK3.md
- specs/KdsCdcReplayExecution/TASK4.md
- specs/KdsMonitorServingContractMigration/TASK.md
- specs/KdsMonitorServingContractMigration/TASK1.1.md
- specs/KdsMonitorServingContractMigration/TASK1.2.md
- specs/KdsMonitorServingContractMigration/TASK2.1.md
- specs/KdsMonitorServingContractMigration/TASK2.2.md
- specs/KdsMonitorServingContractMigration/TASK3.1.md
- specs/KdsMonitorServingContractMigration/TASK3.2.md
- specs/RedshiftFoundation/TASK.md
- specs/RedshiftFoundation/TASK1.1.md
- specs/RedshiftFoundation/TASK1.2.md
- specs/RedshiftFoundation/TASK1.3.md
- specs/RedshiftFoundation/TASK1.4.md
- specs/RedshiftFoundation/TASK2.1.md
- specs/RedshiftFoundation/TASK2.2.md
- specs/RedshiftFoundation/TASK3.1.md
- specs/RedshiftFoundation/TASK3.2.md
- specs/RedshiftFoundation/TASK3.3.md
- specs/RedshiftSyntheticDataFeed/TASK.md
- specs/RedshiftSyntheticDataFeed/TASK1.1.md
- specs/RedshiftSyntheticDataFeed/TASK1.2.md
- specs/RedshiftSyntheticDataFeed/TASK1.3.md
- specs/RedshiftSyntheticDataFeed/TASK2.1.md
- specs/RedshiftSyntheticDataFeed/TASK2.2.md
- specs/RedshiftSyntheticDataFeed/TASK3.1.md
- specs/RedshiftSyntheticDataFeed/TASK3.2.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK1.1.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK1.2.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK2.1.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK2.2.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK2.3.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK3.1.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK3.2.md
- specs/SingleStoreRedshiftRuntimeReadPath/TASK4.1.md
TASK 5.2: Wire Up AnomalyDetector Module DI in CLI
Summary
Register all AnomalyDetector module services in the CLI application's dependency injection container, enabling the CLI commands to access the full anomaly detection stack. This builds on the base DI from TASK 1.4 and adds all remaining services.
Dependencies
- TASK 1.4 (McpToolProvider + base DI extensions)
- TASK 2.2 (AnomalyDetectorAgent)
- TASK 3.2 (EfMonitorSpecRepository)
- TASK 4.2 (MonitorRunOrchestrator)
- TASK 4.3 (AlertEmitter)
- TASK 4.4 (EfMonitorRunRepository)
- TASK 3.3 (MonitorSpecSeeder)
- TASK 5.1 (CLI commands that need the services)
Files to Modify
1. backend/Kds.Ai.AnomalyDetector/DependencyInjectionExtensions.cs
Ensure all services are registered (extends TASK 1.4's base registration):
csharp
using Kds.Ai.AnomalyDetector.Agents;
using Kds.Ai.AnomalyDetector.Alerts;
using Kds.Ai.AnomalyDetector.Mcp;
using Kds.Ai.AnomalyDetector.Orchestration;
using Kds.Ai.AnomalyDetector.Repositories;
using Kds.Ai.AnomalyDetector.Seeding;
using Kds.Ai.AnomalyDetector.Settings;
using Kds.Ai.Core;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
namespace Kds.Ai.AnomalyDetector;
public static class DependencyInjectionExtensions
{
/// <summary>
/// Add the AnomalyDetector module with all required services.
/// Note: IMonitorSpecRepository is registered by AddDataModule() - do not re-register here.
/// </summary>
public static IHostApplicationBuilder AddAnomalyDetectorModule(this IHostApplicationBuilder builder)
{
// === Settings ===
builder.AddOptions<McpMySqlSettings>();
// === MCP Tool Provider ===
builder.Services.AddSingleton(provider =>
{
var settings = provider.GetRequiredService<IOptions<McpMySqlSettings>>();
return new McpToolProvider(settings.Value);
});
// === Repositories ===
// IMonitorSpecRepository is registered by AddDataModule() (lives in Kds.Ai.Data.Repositories)
builder.Services.AddScoped<IMonitorRunRepository, EfMonitorRunRepository>();
// === Agent ===
builder.Services.AddScoped<IAnomalyDetectorAgent, AnomalyDetectorAgent>();
// === Orchestration ===
builder.Services.AddScoped<IMonitorRunOrchestrator, MonitorRunOrchestrator>();
builder.Services.AddScoped<IAlertEmitter, AlertEmitter>();
// === Seeding ===
builder.Services.AddScoped<MonitorSpecSeeder>();
return builder;
}
}2. backend/Kds.Ai.Cli/Program.cs
Add the AnomalyDetector module:
csharp
using ConsoleAppFramework;
using Kds.Ai.AgentsCommon;
using Kds.Ai.AnomalyDetector;
using Kds.Ai.Data;
using Microsoft.Extensions.Hosting;
var builder = Host.CreateApplicationBuilder(args);
// Add service defaults (Aspire integration)
builder.AddServiceDefaults();
// Add data layer (EF Core)
builder.AddDataModule();
// Add agents common (Bedrock IChatClient)
builder.AddAgentsCommonModule();
// Add anomaly detector module
builder.AddAnomalyDetectorModule();
var app = builder.ToConsoleAppBuilder();
await app.RunAsync(args);3. backend/Kds.Ai.Cli/Kds.Ai.Cli.csproj
Ensure project references are correct:
xml
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Kds.Ai.AgentsCommon\Kds.Ai.AgentsCommon.csproj" />
<ProjectReference Include="..\Kds.Ai.AnomalyDetector\Kds.Ai.AnomalyDetector.csproj" />
<ProjectReference Include="..\Kds.Ai.Data\Kds.Ai.Data.csproj" />
<ProjectReference Include="..\Kds.Ai.ServiceDefaults\Kds.Ai.ServiceDefaults.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ConsoleAppFramework" />
</ItemGroup>
</Project>Service Registration Summary
| Service | Lifetime | Implementation | Registered By |
|---|---|---|---|
McpMySqlSettings | Options | From configuration | AnomalyDetector |
McpToolProvider | Singleton | Self (manages MCP client lifecycle) | AnomalyDetector |
IMonitorSpecRepository | Scoped | EfMonitorSpecRepository | Data module (AddDataModule) |
IMonitorRunRepository | Scoped | EfMonitorRunRepository | AnomalyDetector |
IAnomalyDetectorAgent | Scoped | AnomalyDetectorAgent | AnomalyDetector |
IMonitorRunOrchestrator | Scoped | MonitorRunOrchestrator | AnomalyDetector |
IAlertEmitter | Scoped | AlertEmitter | AnomalyDetector |
MonitorSpecSeeder | Scoped | Self | AnomalyDetector |
Module Dependencies
Kds.Ai.Cli
├── Kds.Ai.ServiceDefaults (Aspire defaults)
├── Kds.Ai.Data (DbContext, Entities)
├── Kds.Ai.AgentsCommon (IChatClient from Bedrock)
└── Kds.Ai.AnomalyDetector (All anomaly detection services)Configuration Requirements
The CLI needs these configuration sections (via environment variables or appsettings.json):
json
{
"ConnectionStrings": {
"kdsaidb": "Server=localhost;Database=kdsaidb;User=root;Password=xxx;"
},
"AwsBedrockCredentials": {
"AccessKeyId": "xxx",
"SecretAccessKey": "xxx",
"ModelId": "anthropic.claude-3-sonnet-20240229-v1:0"
},
"McpMySqlSettings": {
"Command": "npx",
"Arguments": ["-y", "benborla-mcp-server-mysql"],
"EnvironmentVariables": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASS": "password",
"MYSQL_DB": "kdsdev"
}
}
}Changes from Old Design
- Removed
IMcpClient/McpClientregistration (replaced byMcpToolProviderusing official MCP SDK) - Removed
PrepTimeQueryBuilderregistration (deleted - agent formulates own SQL) - Removed
IKdsDataAccessService/McpKdsDataAccessServiceregistration (deleted - agent uses MCP tools directly) - Removed
IAnomalyDetectorAgentFactory/AnomalyDetectorAgentFactoryregistration (no factory pattern) - Changed
IAnomalyDetectorAgentimplementation fromPrepTimeAnomalyDetectorAgentto genericAnomalyDetectorAgent - Settings class renamed from
McpConnectionSettingstoMcpMySqlSettings
Acceptance Criteria
- [ ]
AddAnomalyDetectorModuleregisters all AnomalyDetector-owned services (NOTIMonitorSpecRepository-- that comes fromAddDataModule) - [ ] CLI Program.cs calls
AddAnomalyDetectorModule() - [ ] CLI project references AnomalyDetector project
- [ ] Service lifetimes are appropriate (scoped for DB access, singleton for MCP)
- [ ] No registration of deleted services (IMcpClient, PrepTimeQueryBuilder, IKdsDataAccessService, IAnomalyDetectorAgentFactory)
- [ ] Configuration sections documented
- [ ] Solution builds without errors
- [ ] CLI can execute
anomaly run --help
Testing the Wiring
bash
# Verify the CLI loads without errors
dotnet run --project backend/Kds.Ai.Cli -- --help
# Verify anomaly commands are registered
dotnet run --project backend/Kds.Ai.Cli -- anomaly --help
# Verify DI works (will fail if config missing, but shows wiring works)
dotnet run --project backend/Kds.Ai.Cli -- anomaly listNotes
- Order of
Add*Modulecalls matters if there are dependencies - The
AddServiceDefaultsprovides OpenTelemetry, health checks, etc. - Scoped services are created per CLI command execution
McpToolProvideris singleton because the MCP server process is long-lived- Consider adding validation that all required config is present at startup