# REVIEW_WORKFLOW.md - Hybrid Protocol Review & Approval Process

## Overview
This document defines the complete review and approval workflow for the Hybrid Protocol system. All work must go through this process before being considered complete.

## Key Principle
**Rivet approves, not Michael.** Rivet is the designated quality gate and approver for all work in the system.

## Workflow Stages

### Stage 1: INBOX (New)
- Task created in INBOX.md with all required fields
- Priority and size estimated
- Acceptance criteria defined
- Tags added for categorization

### Stage 2: IN PROGRESS
- Task status updated to "In-Progress"
- Work begins according to acceptance criteria
- Regular updates in notes section if needed

### Stage 3: COMPLETED
- All acceptance criteria met
- Implementation details documented
- Testing completed and documented
- Task moved to OUTBOX.md
- Status changed to "Ready-For-Review"

### Stage 4: REVIEW
- Rivet notified of pending review
- Rivet reviews within SLA:
  - P0/P1: Within 24 hours
  - P2/P3: Within 48 hours
- Rivet evaluates against acceptance criteria
- Rivet checks quality, standards, documentation

### Stage 5: DECISION
**Approval:**
- All acceptance criteria met
- Quality standards satisfied
- Documentation complete
- No regressions
- → Task moved to STATUS.md archive
- → Status changed to "Approved"

**Rejection:**
- Acceptance criteria not met
- Quality issues found
- Missing documentation
- Security concerns
- → Task returned to INBOX.md
- → Status changed to "Rejected"
- → Feedback provided for correction

## Reviewer Responsibilities (Rivet)

### Must Check:
1. **Acceptance Criteria:** All items completed as specified
2. **Code Quality:** Follows established patterns and standards
3. **Testing:** Adequate testing performed and documented
4. **Documentation:** All relevant documentation updated
5. **Security:** No security issues introduced
6. **Performance:** No performance regressions
7. **User Experience:** If applicable, UX considerations addressed

### Review Checklist
- [ ] All acceptance criteria met
- [ ] Code follows style guide
- [ ] Tests pass
- [ ] Documentation updated
- [ ] No breaking changes
- [ ] Security review complete
- [ ] Performance impact assessed
- [ ] Backward compatibility maintained

## SLA (Service Level Agreement)

| Priority | Max Review Time | Escalation Time |
|----------|----------------|-----------------|
| P0       | 4 hours        | 2 hours         |
| P1       | 24 hours       | 12 hours        |
| P2       | 48 hours       | 24 hours        |
| P3       | 72 hours       | 48 hours        |

## Escalation Path
1. Primary: Rivet
2. Secondary: System alert if SLA breached
3. Tertiary: Automated notification to maintainers

## Quality Gates

### Must-Have (Blocking)
- All acceptance criteria met
- Basic functionality works
- No security vulnerabilities
- No data loss risk

### Should-Have (Warning)
- Code follows standards
- Tests exist and pass
- Documentation complete
- Performance acceptable

### Nice-to-Have (Optional)
- Performance optimized
- UX polished
- Edge cases handled
- Monitoring added

## Feedback Format
When rejecting or requesting changes, feedback must include:

```
### Review Feedback
**Reviewer:** Rivet
**Date:** [YYYY-MM-DD HH:MM]
**Decision:** Rejected/Changes Requested

#### Issues Found:
1. [Specific issue with details]
2. [Specific issue with details]

#### Required Changes:
- [ ] Change 1
- [ ] Change 2

#### Suggestions:
- Suggestion 1
- Suggestion 2

#### Re-review Required:
- [ ] All changes completed
- [ ] Re-test performed
```

## Metrics Tracked
1. **Review Cycle Time:** Time from "Ready-For-Review" to decision
2. **First-Time Approval Rate:** % of tasks approved without rework
3. **Rejection Rate:** % of tasks rejected
4. **Re-review Rate:** % of tasks needing multiple reviews
5. **Feedback Quality:** Measured by clarity and specificity

## Continuous Improvement
- Monthly review of metrics
- Process adjustments based on data
- Reviewer training/calibration
- Template improvements

## Emergency Override
In case of system emergency (P0 critical issue):
1. Rivet can fast-track approval
2. Post-approval documentation required
3. Retrospective review within 24 hours

---

## Quick Reference

### For Task Owners:
1. Complete all acceptance criteria
2. Document implementation
3. Test thoroughly
4. Move to OUTBOX.md
5. Notify Rivet
6. Address feedback if rejected

### For Rivet (Reviewer):
1. Check acceptance criteria
2. Review quality standards
3. Provide clear feedback
4. Approve or reject within SLA
5. Track metrics

### For Everyone:
- Rivet's decision is final
- Quality over speed
- Documentation is mandatory
- Learn from rejections