Spensara Spensara Knowledge Base & Documentation Repository

Repository Docs & Knowledge Base

Consolidated Spensara documentation repository (722 Markdown & architecture documents in ../repository)
Built Word Documents (.docx): Spensara Overview (.docx) Capability Assessment (.docx) Brink POS Ingestion Analysis (.docx) The Borg Ingestion Architecture (.docx)

Implementation Specs (157)

Detailed engineering and feature implementation specifications.
implementation-specs/specs/SingleStoreRedshiftRuntimeReadPath/TASK2.3.md 2,659 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

TASK 2.3: Update Data Access Prompt and Tool Descriptions

Summary

Update data access prompt and tool descriptions so the agent understands the new runtime query surface.

The prompt should describe tenant-scoped Redshift curated, not PostgreSQL or source-shaped kdsdev.

This task does not edit individual monitor specs.

Dependencies

  • TASK 2.2 (curated-only discovery and SQL guardrails)

Files to Modify

1. backend/Kds.Ai.AnomalyDetector/Agents/DataAccessPromptComposer.cs

Update instructions for:

  • Redshift query engine,
  • tenant-scoped database routing,
  • curated-only schema,
  • phase-1 source-mirror tables,
  • source-shaped fields,
  • unavailable source schemas.

2. backend/Kds.Ai.AnomalyDetector/Tools/WarehouseQueryToolProvider.cs

Update AI tool descriptions so they mention:

  • Redshift,
  • tenant-scoped curated tables,
  • curated-only discovery,
  • aggregation guidance.

Required Behavior

The data access prompt must tell the agent:

  • it is querying tenant-scoped Redshift,
  • only approved source-mirror curated tables are available,
  • phase-1 tables are approved curated.<system>_<table> objects such as curated.kds_orders, curated.kds_items, and curated.kds_item_bumps,
  • KDS source-mirror time fields may remain source-shaped values such as create_time and update_time,
  • source-shaped fields such as store_guid and is_deleted may still be present in the branch-aligned runtime surface,
  • use Redshift-compatible SQL,
  • prefer aggregation and bounded result sets.

The prompt must not:

  • tell the agent to discover broad schemas,
  • tell the agent to query PostgreSQL,
  • tell the agent to use source schemas or kdsdev.*,
  • edit or embed individual monitor business logic.

Status

Completed.

Implemented in:

  • backend/Kds.Ai.AnomalyDetector/Agents/DataAccessPromptComposer.cs
  • backend/Kds.Ai.AnomalyDetector/Agents/DataAccessAgentFactory.cs
  • backend/Kds.Ai.AnomalyDetector/Tools/WarehouseQueryToolProvider.cs

Acceptance Criteria

  • [x] Data access prompt describes tenant-scoped Redshift
  • [x] Data access prompt describes curated as the only query surface
  • [x] Data access prompt names approved source-mirror curated objects
  • [x] Data access prompt no longer refers to PostgreSQL as the runtime warehouse
  • [x] Data access prompt no longer instructs broad schema discovery
  • [x] Tool descriptions mention Redshift curated tables
  • [x] Individual monitor spec files are not changed in this task
  • [x] Solution builds without errors

Notes

  • This is allowed in slice 03 because it describes the runtime surface.
  • Business prompt migration remains in slice 04.