Human Approval Flows
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Human-in-the-Loop (HITL) workflows integrate human judgment into AI systems, ensuring that critical decisions receive human oversight while allowing automation for routine cases. HITL is essential for high-stakes applications and regulatory compliance.
Core Principle: "Automate the routine, escalate the exceptional. Humans and AI working together outperform either alone."
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
- Human reviewers have domain expertise
- Review capacity is sufficient for the workload
- Confidence scores are well-calibrated
- Reviewers have access to necessary context
Compatibility
- Works with any AI/ML model that provides confidence scores
- Language-agnostic workflow patterns
- Can be integrated with existing review systems
Test Scenario Matrix
| Scenario |
Confidence |
Expected Action |
Notes |
| Safe content |
>0.95 |
Auto-approve |
High confidence, low risk |
| Moderate confidence |
0.80-0.95 |
Async review |
Queue for later review |
| Low confidence |
0.60-0.80 |
Sync review |
Immediate review required |
| Very low confidence |
<0.60 |
Manual handling |
AI should not act |
| Critical domain |
Any |
Human review |
Regulatory requirement |
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
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: human-approval-flows3description: Human-in-the-Loop (HITL) workflows integrate human judgment into AI systems, Use when this capability is needed.4---56# Human Approval Flows78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Human-in-the-Loop (HITL) workflows integrate human judgment into AI systems, ensuring that critical decisions receive human oversight while allowing automation for routine cases. HITL is essential for high-stakes applications and regulatory compliance.1819**Core Principle**: "Automate the routine, escalate the exceptional. Humans and AI working together outperform either alone."2021---2223## Why This Matters24- **<Benefit>**: <short explanation>25- **<Benefit>**: <short explanation>26- **<Benefit>**: <short explanation>2728## Core Concepts & Rules2930### 1. Core Principles31- Follow established patterns and conventions32- Maintain consistency across codebase33- Document decisions and trade-offs3435### 2. Implementation Guidelines36- Start with the simplest viable solution37- Iterate based on feedback and requirements38- Test thoroughly before deployment394041## Inputs / Outputs / Contracts42* **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%>5455## Skill Composition56* **Depends on**: None57* **Compatible with**: None58* **Conflicts with**: None59* **Related Skills**: None6061## Quick Start62#6364## Assumptions65- Human reviewers have domain expertise66- Review capacity is sufficient for the workload67- Confidence scores are well-calibrated68- Reviewers have access to necessary context6970## Compatibility71- Works with any AI/ML model that provides confidence scores72- Language-agnostic workflow patterns73- Can be integrated with existing review systems7475---7677## Test Scenario Matrix78| Scenario | Confidence | Expected Action | Notes |79|----------|-----------|-----------------|-------|80| Safe content | >0.95 | Auto-approve | High confidence, low risk |81| Moderate confidence | 0.80-0.95 | Async review | Queue for later review |82| Low confidence | 0.60-0.80 | Sync review | Immediate review required |83| Very low confidence | <0.60 | Manual handling | AI should not act |84| Critical domain | Any | Human review | Regulatory requirement |8586---8788## Technical Guardrails & Security Threat Model8990### 1. Security & Privacy (Threat Model)91* **Top Threats**: Injection attacks, authentication bypass, data exposure92- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII93- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager94- [ ] **Authorization**: Validate user permissions before state changes9596### 2. Performance & Resources97- [ ] **Execution Efficiency**: Consider time complexity for algorithms98- [ ] **Memory Management**: Use streams/pagination for large data99- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks100101### 3. Architecture & Scalability102- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection103- [ ] **Modularity**: Decouple logic from UI/Frameworks104105### 4. Observability & Reliability106- [ ] **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 except109- [ ] **Observability Artifacts**:110 - **Log Fields**: timestamp, level, message, request_id111 - **Metrics**: request_count, error_count, response_time112 - **Dashboards/Alerts**: High Error Rate > 5%113114115## Agent Directives & Error Recovery116*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*117118- **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.122123124## Definition of Done125- [ ] Confidence thresholds defined and documented126- [ ] Review queue implemented with prioritization127- [ ] SLA tracking and alerting in place128- [ ] Reviewer interface provides sufficient context129- [ ] Feedback loop for model improvement130- [ ] Metrics dashboard configured131- [ ] Load balancing implemented132- [ ] Escalation procedures documented133- [ ] Integration tests passing134- [ ] Documentation complete135136---137138## Anti-patterns / Pitfalls139140* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries141* ⚠️ **Watch out for**: Common symptoms and quick fixes142* 💡 **Instead**: Use proper error handling, pagination, and logging143144145## Reference Links146- [EU AI Act - Human Oversight Requirements](https://artificialintelligenceact.eu/)147- [GDPR - Automated Decision Making](https://gdpr.eu/article-22-automated-decision-making/)148- [Google's People + AI Guidebook](https://pair.withgoogle.com/)149- [Microsoft's Human-AI Interaction Guidelines](https://www.microsoft.com/en-us/research/project/guidelines-for-human-ai-interaction/)150151---152153## Versioning & Changelog154155* **Version**: 1.0.0156* **Changelog**:157 - 2026-02-22: Initial version with complete template structure158159---160> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.161<!-- tomevault:4.0:skill_md:2026-04-13 -->