Override Mechanisms
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Override Mechanisms allow humans to correct or reverse AI decisions, providing a critical safety net for automated systems. Proper override implementation includes tracking, justification, learning, and prevention of abuse.
Core Principle: "AI should be overridable, but overrides should be logged, justified, and learned from."
Why This Matters
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- <e.g., env vars, request payload, file paths, schema>
- Entry Conditions:
- <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>
- Outputs:
- <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>
- Artifacts Required (Deliverables):
- <e.g., Code Diff, Unit Tests, Migration Script, API Docs>
- Acceptance Evidence:
- <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>
- Success Criteria:
- <e.g., p95 < 300ms, coverage ≥ 80%>
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start
Assumptions
- Users have appropriate permissions for their role
- Override reasons are provided in good faith
- Override correctness can be verified
- Model can be improved from override data
Compatibility
- Works with any AI/ML system
- Language-agnostic override patterns
- Can integrate with existing permission systems
Test Scenario Matrix
| Scenario |
Override Type |
Expected Behavior |
Notes |
| Low-impact decision |
Manual |
Immediate override |
No approval needed |
| High-impact decision |
Manual |
Requires approval |
Manager must approve |
| VIP customer |
Business rule |
Auto-approve |
Rule-based override |
| Emergency |
Emergency |
Kill switch |
Immediate, alerts team |
| Suspicious pattern |
Abuse detection |
Alert manager |
Prevent bulk overrides |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done
Anti-patterns / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
Reference Links
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
1---2name: override-mechanisms-23description: Override Mechanisms allow humans to correct or reverse AI decisions, providing a critical safety net for automated systems. Proper override implementation includes tracking, justification, learning, a4---5
6# Override Mechanisms
7
8## Skill Profile
9*(Select at least one profile to enable specific modules)*
10- [ ] **DevOps**
11- [x] **Backend**
12- [ ] **Frontend**
13- [ ] **AI-RAG**
14- [ ] **Security Critical**
15
16## Overview
17Override Mechanisms allow humans to correct or reverse AI decisions, providing a critical safety net for automated systems. Proper override implementation includes tracking, justification, learning, and prevention of abuse.
18
19**Core Principle**: "AI should be overridable, but overrides should be logged, justified, and learned from."
20
21---
22
23## Why This Matters
24- **<Benefit>**: <short explanation>
25- **<Benefit>**: <short explanation>
26- **<Benefit>**: <short explanation>
27
28## Core Concepts & Rules
29
30### 1. Core Principles
31- Follow established patterns and conventions
32- Maintain consistency across codebase
33- Document decisions and trade-offs
34
35### 2. Implementation Guidelines
36- Start with the simplest viable solution
37- Iterate based on feedback and requirements
38- Test thoroughly before deployment
39
40
41## Inputs / Outputs / Contracts
42* **Inputs**:
43 - <e.g., env vars, request payload, file paths, schema>
44* **Entry Conditions**:
45 - <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>
46* **Outputs**:
47 - <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>
48* **Artifacts Required (Deliverables)**:
49 - <e.g., Code Diff, Unit Tests, Migration Script, API Docs>
50* **Acceptance Evidence**:
51 - <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>
52* **Success Criteria**:
53 - <e.g., p95 < 300ms, coverage ≥ 80%>
54
55## Skill Composition
56* **Depends on**: None
57* **Compatible with**: None
58* **Conflicts with**: None
59* **Related Skills**: None
60
61## Quick Start
62#
63
64## Assumptions
65- Users have appropriate permissions for their role
66- Override reasons are provided in good faith
67- Override correctness can be verified
68- Model can be improved from override data
69
70## Compatibility
71- Works with any AI/ML system
72- Language-agnostic override patterns
73- Can integrate with existing permission systems
74
75---
76
77## Test Scenario Matrix
78| Scenario | Override Type | Expected Behavior | Notes |
79|----------|--------------|-------------------|-------|
80| Low-impact decision | Manual | Immediate override | No approval needed |
81| High-impact decision | Manual | Requires approval | Manager must approve |
82| VIP customer | Business rule | Auto-approve | Rule-based override |
83| Emergency | Emergency | Kill switch | Immediate, alerts team |
84| Suspicious pattern | Abuse detection | Alert manager | Prevent bulk overrides |
85
86---
87
88## Technical Guardrails & Security Threat Model
89
90### 1. Security & Privacy (Threat Model)
91* **Top Threats**: Injection attacks, authentication bypass, data exposure
92- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII
93- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager
94- [ ] **Authorization**: Validate user permissions before state changes
95
96### 2. Performance & Resources
97- [ ] **Execution Efficiency**: Consider time complexity for algorithms
98- [ ] **Memory Management**: Use streams/pagination for large data
99- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks
100
101### 3. Architecture & Scalability
102- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection
103- [ ] **Modularity**: Decouple logic from UI/Frameworks
104
105### 4. Observability & Reliability
106- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`
107- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`
108- [ ] **Error Handling**: Standardized error codes, no bare except
109- [ ] **Observability Artifacts**:
110 - **Log Fields**: timestamp, level, message, request_id
111 - **Metrics**: request_count, error_count, response_time
112 - **Dashboards/Alerts**: High Error Rate > 5%
113
114
115## Agent Directives & Error Recovery
116*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*
117
118- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.
119- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
120- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.
121- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.
122
123
124## Definition of Done
125- [ ] Override permissions defined and implemented
126- [ ] Justification requirements enforced
127- [ ] Approval workflows for high-impact decisions
128- [ ] Comprehensive logging of all overrides
129- [ ] Feedback loop to model training
130- [ ] Abuse detection and alerting
131- [ ] Emergency override mechanism
132- [ ] Override analytics dashboard
133- [ ] Integration tests passing
134- [ ] Documentation complete
135
136---
137
138## Anti-patterns / Pitfalls
139
140* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries
141* ⚠️ **Watch out for**: Common symptoms and quick fixes
142* 💡 **Instead**: Use proper error handling, pagination, and logging
143
144
145## Reference Links
146- [NIST AI Risk Management Framework](https://www.nist.gov/itl/ai-risk-management-framework)
147- [EU AI Act - Human Oversight](https://artificialintelligenceact.eu/)
148- [Google's AI Principles](https://ai.google/responsibility/principles/)
149
150---
151
152## Versioning & Changelog
153
154* **Version**: 1.0.0
155* **Changelog**:
156 - 2026-02-22: Initial version with complete template structure
157