How ashgz8025/selfmend works
SelfMend is a data-quality monitoring and self-remediation system. Its main workflow accepts a batch, detects quality failures and drift, retrieves similar incidents, diagnoses the problem, checks diagnosis faithfulness and policy, then remediates or escalates. The API persists run traces and the dashboard presents them and can trigger runs. The graph preserves documented evaluation, fault injection, and ETL capabilities. Some links come from the SOURCE INDEX or README (the README is empty); unsampled modules are represented only where their role is clear, and uncertain wiring is omitted.
Main entry points: graph.py Workflow Graph · detector.py Unified Detector · main.py Run API · run_evaluation.py Evaluation Runner
Components 21
Data Ingestion
- Batch ETL
selfmend/pipeline/etl.py - Fault Injection
selfmend/faults/injector.py - Evaluation Runner
selfmend/evaluation/run_evaluation.py
Diagnosis Workflow
- Workflow Graph
selfmend/agents/graph.py - Pipeline State
selfmend/agents/state.py - Detection Stage
selfmend/agents/nodes.py - Unified Detector
selfmend/detection/detector.py - GX Checks
selfmend/detection/gx_checks.py - Drift Checks
selfmend/detection/drift_check.py - Incident Retrieval
selfmend/agents/nodes.py - Diagnosis Stage
selfmend/agents/nodes.py - Faithfulness Scoring
selfmend/trust/faithfulness.py - Decision Gate
selfmend/policy/gate.py
Remediation
- Repair Executor
selfmend/remediation/executor.py - Repair Actions
selfmend/remediation/actions.py
Persistence
- Incident Memory
selfmend/memory/incident_store.py - DB Sessions
selfmend/db/session.py - Audit Models
selfmend/db/models.py
Other components
- Operator
Connections 23
- Operator → Dashboard: operates
selfmend/dashboard/app.py - Dashboard → Run API: fetches runs
selfmend/dashboard/app.py - Dashboard → Fault Injection: injects faults
selfmend/dashboard/app.py - Run API → Workflow Graph: runs workflow
selfmend/api/main.py - Run API → Fault Injection: injects faults
selfmend/api/main.py - Workflow Graph → Detection Stage: dispatches stages
selfmend/agents/graph.py - Workflow Graph → Incident Retrieval: dispatches stages
selfmend/agents/graph.py - Workflow Graph → Diagnosis Stage: dispatches stages
selfmend/agents/graph.py - Workflow Graph → Decision Gate: dispatches stages
selfmend/agents/graph.py - Workflow Graph → Repair Executor: dispatches repair
selfmend/agents/graph.py - Detection Stage → Unified Detector: calls detection
selfmend/agents/nodes.py - Unified Detector → GX Checks: runs checks
selfmend/detection/detector.py - Unified Detector → Drift Checks: runs checks
selfmend/detection/detector.py - Incident Retrieval → Incident Memory: retrieves incidents
selfmend/agents/nodes.py - Diagnosis Stage → Incident Memory: uses retrieved evidence
selfmend/agents/nodes.py - Diagnosis Stage → Faithfulness Scoring: scores diagnosis
selfmend/agents/nodes.py - Repair Executor → Repair Actions: applies action
selfmend/remediation/executor.py - Repair Executor → Unified Detector: revalidates batch
selfmend/remediation/executor.py - Run API → DB Sessions: persists run
selfmend/api/main.py - DB Sessions → Audit Models: creates schema
selfmend/db/session.py - Evaluation Runner → Fault Injection: injects faults
selfmend/evaluation/run_evaluation.py - Evaluation Runner → Unified Detector: evaluates detection
selfmend/evaluation/run_evaluation.py - Evaluation Runner → Workflow Graph: evaluates workflow
selfmend/evaluation/run_evaluation.py