Databaseprompt onlyIntermediate

Data Integrity Guardian

This loop identifies and removes invalid records from your database through iterative integrity checks. The agent will systematically scan for data quality issues, remove problematic entries while preserving valid data, and continue until achieving a clean state with zero integrity problems.

← all loops
databasedata cleaningintegrityvalidationetldata quality

Goal

Remove invalid records

How to Run

The Data Integrity Guardian loop automatically scans your database, identifies invalid records, and removes them while maintaining data integrity. It runs iteratively until all issues are resolved or the maximum iteration limit is reached.

  1. 01

    Initialize Database Connection

    Provide the agent with your database connection details (type, credentials, table names) to begin the integrity check process.

  2. 02

    Execute Integrity Check

    The agent will run 'integrity check' to scan for invalid records across specified tables and identify specific issues.

  3. 03

    Review and Confirm Changes

    After each iteration, review the identified invalid records and confirm removal before the agent proceeds with deletion.

  4. 04

    Monitor Loop Progress

    The loop will continue automatically until either all integrity issues are resolved or the maximum iterations (10) are reached.

Workflow Steps

  1. 01

    Run integrity check on specified database tables

    Execute database validation queries to identify records with null constraints, foreign key violations, data type mismatches, or custom business rule violations

  2. 02

    Report findings to user

    Display list of invalid records with specific error types, row identifiers, and sample data for review and approval

  3. 03

    Remove confirmed invalid records

    Delete records only after user confirmation, using secure transaction handling to maintain database consistency

  4. 04

    Validate improvements

    Re-run integrity check to verify that removed records reduced overall data quality issues before next iteration

Kickoff Prompt

Start the "Data Integrity Guardian" loop.

Goal: Remove invalid records
Max iterations: 10
Between iterations run: integrity check
Exit when: Zero integrity issues


You are the Data Integrity Guardian. Your task is to clean a database by removing invalid records through iterative integrity checks. First, ask the user for database connection details and which tables to target. Then begin the loop: run 'integrity check' to scan for invalid records, report findings, wait for user confirmation on deletions, remove the invalid records, and re-check. Continue this cycle until 'integrity check' returns zero issues or you've reached 10 iterations. Always preserve valid data and maintain a log of all changes made.

Self-pace this loop. After each iteration, run `integrity check` and evaluate the output, and only continue if the exit condition is not met (Zero integrity issues). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.

Guardrails

hardcoded
  • ·Never delete valid records that pass integrity validation
  • ·Log all removed records with timestamps and reasons for audit trail
  • ·Stop immediately if maximum iterations (10) are reached without full resolution
  • ·Preserve database schema and structure during record removal operations
  • ·Require explicit confirmation before deleting records in production environments
  • ·Handle large datasets by prompting for batch size limits to prevent performance issues

Flow Diagram

rendering…

Related loops — Database