Redesign
This commit is contained in:
412
docs/redesign/AGENT-MANIFEST.md
Normal file
412
docs/redesign/AGENT-MANIFEST.md
Normal file
@@ -0,0 +1,412 @@
|
||||
# Agent Manifest - Parallel Execution Coordination
|
||||
|
||||
## Agent Roster
|
||||
|
||||
### Agent 1: infra-agent (Infrastructure Agent)
|
||||
**Assigned Phases:** 1, 5, 7
|
||||
**Focus:** Docker, networks, databases
|
||||
**Estimated Duration:** 45-60 minutes
|
||||
**Complexity:** High
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 1: Rename containers and update docker-compose.yml
|
||||
- Phase 5: Simplify network architecture (5 → 3 networks)
|
||||
- Phase 7: Update database configurations
|
||||
|
||||
**Files Modified:**
|
||||
- docker-compose.yml
|
||||
- Network definitions
|
||||
- Volume configurations
|
||||
- Database connection strings
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- config-agent
|
||||
- docs-agent
|
||||
- backend-agent (different files)
|
||||
- storage-agent (different files)
|
||||
|
||||
**Must Wait For:**
|
||||
- config-agent (Phase 4) before starting Phase 1
|
||||
|
||||
---
|
||||
|
||||
### Agent 2: backend-agent (Backend Agent)
|
||||
**Assigned Phases:** 2, 6
|
||||
**Focus:** Backend code removal and updates
|
||||
**Estimated Duration:** 40-50 minutes
|
||||
**Complexity:** Medium-High
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 2: Remove multi-tenant architecture code
|
||||
- Phase 6: Update service references and API clients
|
||||
|
||||
**Files Modified:**
|
||||
- backend/src/core/middleware/tenant.ts (DELETE)
|
||||
- backend/src/core/config/tenant.ts (DELETE)
|
||||
- backend/src/features/tenant-management/ (DELETE entire directory)
|
||||
- backend/src/app.ts (MODIFY)
|
||||
- backend/src/features/vehicles/ (MODIFY)
|
||||
- backend/src/core/plugins/auth.plugin.ts (MODIFY)
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- infra-agent (different files)
|
||||
- storage-agent (different files)
|
||||
- platform-agent (different services)
|
||||
- docs-agent
|
||||
|
||||
**Must Wait For:**
|
||||
- config-agent (Phase 4)
|
||||
|
||||
---
|
||||
|
||||
### Agent 3: storage-agent (Storage Agent)
|
||||
**Assigned Phases:** 3
|
||||
**Focus:** MinIO to filesystem migration
|
||||
**Estimated Duration:** 30-40 minutes
|
||||
**Complexity:** Medium
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 3: Replace MinIO with filesystem storage
|
||||
|
||||
**Files Modified:**
|
||||
- backend/src/core/storage/adapters/filesystem.adapter.ts (CREATE)
|
||||
- backend/src/core/storage/storage.service.ts (MODIFY)
|
||||
- backend/src/features/documents/documents.controller.ts (MODIFY)
|
||||
- backend/src/features/documents/documents.service.ts (MODIFY)
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- backend-agent (different files)
|
||||
- infra-agent (different scope)
|
||||
- platform-agent
|
||||
- docs-agent
|
||||
|
||||
**Must Wait For:**
|
||||
- None (can start immediately)
|
||||
|
||||
---
|
||||
|
||||
### Agent 4: platform-agent (Platform Service Agent)
|
||||
**Assigned Phases:** 8
|
||||
**Focus:** mvp-platform service simplification
|
||||
**Estimated Duration:** 35-45 minutes
|
||||
**Complexity:** Medium-High
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 8: Simplify mvp-platform service
|
||||
|
||||
**Files Modified:**
|
||||
- mvp-platform-services/vehicles/ (all files)
|
||||
- Remove ETL and MSSQL dependencies
|
||||
- Update to use mvp-postgres and mvp-redis
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- backend-agent (different codebase)
|
||||
- storage-agent (different scope)
|
||||
- docs-agent
|
||||
|
||||
**Must Wait For:**
|
||||
- infra-agent Phase 1 (needs new container names)
|
||||
|
||||
---
|
||||
|
||||
### Agent 5: config-agent (Configuration Agent)
|
||||
**Assigned Phases:** 4
|
||||
**Focus:** Configuration and secrets cleanup
|
||||
**Estimated Duration:** 20-30 minutes
|
||||
**Complexity:** Low-Medium
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 4: Clean up configuration files and secrets
|
||||
|
||||
**Files Modified:**
|
||||
- config/app/production.yml (MODIFY)
|
||||
- .env (MODIFY)
|
||||
- secrets/app/ (DELETE MinIO and platform files)
|
||||
- secrets/platform/ (DELETE entire directory)
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- docs-agent
|
||||
- Initial startup of all other agents
|
||||
|
||||
**Must Wait For:**
|
||||
- None (FIRST WAVE - starts immediately)
|
||||
|
||||
**Blocks:**
|
||||
- backend-agent (needs config cleanup first)
|
||||
- infra-agent (needs config cleanup first)
|
||||
|
||||
---
|
||||
|
||||
### Agent 6: frontend-agent (Frontend Agent)
|
||||
**Assigned Phases:** 10
|
||||
**Focus:** Frontend updates
|
||||
**Estimated Duration:** 25-35 minutes
|
||||
**Complexity:** Low-Medium
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 10: Remove tenant UI and update API clients
|
||||
|
||||
**Files Modified:**
|
||||
- frontend/src/ (various files)
|
||||
- Remove tenant-related components
|
||||
- Update Auth0 integration
|
||||
- Update API clients
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- docs-agent
|
||||
|
||||
**Must Wait For:**
|
||||
- backend-agent (needs backend changes complete)
|
||||
|
||||
---
|
||||
|
||||
### Agent 7: docs-agent (Documentation Agent)
|
||||
**Assigned Phases:** 9
|
||||
**Focus:** Documentation and Makefile updates
|
||||
**Estimated Duration:** 30-40 minutes
|
||||
**Complexity:** Low
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 9: Update all documentation files
|
||||
|
||||
**Files Modified:**
|
||||
- README.md
|
||||
- CLAUDE.md
|
||||
- AI-INDEX.md
|
||||
- .ai/context.json
|
||||
- docs/PLATFORM-SERVICES.md
|
||||
- docs/TESTING.md
|
||||
- Makefile
|
||||
- All feature README files
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- ALL agents (no conflicts)
|
||||
|
||||
**Must Wait For:**
|
||||
- None (FIRST WAVE - starts immediately)
|
||||
|
||||
---
|
||||
|
||||
### Agent 8: test-agent (Testing Agent)
|
||||
**Assigned Phases:** 11
|
||||
**Focus:** Testing and validation
|
||||
**Estimated Duration:** 20-30 minutes
|
||||
**Complexity:** Low
|
||||
|
||||
**Responsibilities:**
|
||||
- Phase 11: Run all tests and validation
|
||||
|
||||
**Files Modified:**
|
||||
- Test files (update references)
|
||||
- Validation of all changes
|
||||
|
||||
**Can Run in Parallel With:**
|
||||
- None (runs last)
|
||||
|
||||
**Must Wait For:**
|
||||
- ALL other agents (LAST WAVE)
|
||||
|
||||
---
|
||||
|
||||
## Execution Dependency Graph
|
||||
|
||||
```
|
||||
Wave 1 (Parallel - Start Immediately):
|
||||
┌─────────────────┐ ┌─────────────────┐
|
||||
│ config-agent │ │ docs-agent │
|
||||
│ Phase 4 │ │ Phase 9 │
|
||||
└────────┬────────┘ └─────────────────┘
|
||||
│
|
||||
│ Blocks backend-agent and infra-agent
|
||||
▼
|
||||
Wave 2 (Parallel - After config-agent):
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ infra-agent │ │ backend-agent │ │ storage-agent │
|
||||
│ Phase 1 │ │ Phase 2 │ │ Phase 3 │
|
||||
└────────┬────────┘ └────────┬────────┘ └─────────────────┘
|
||||
│ │
|
||||
│ │
|
||||
▼ ▼
|
||||
Wave 3 (Parallel - Continue and Add):
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ infra-agent │ │ backend-agent │ │ platform-agent │
|
||||
│ Phase 5, 7 │ │ Phase 6 │ │ Phase 8 │
|
||||
└─────────────────┘ └────────┬────────┘ └─────────────────┘
|
||||
│
|
||||
│ Blocks frontend-agent
|
||||
▼
|
||||
Wave 4 (Sequential - After backend-agent):
|
||||
┌─────────────────┐
|
||||
│ frontend-agent │
|
||||
│ Phase 10 │
|
||||
└────────┬────────┘
|
||||
│
|
||||
│ All agents must complete
|
||||
▼
|
||||
Wave 5 (Sequential - After All):
|
||||
┌─────────────────┐
|
||||
│ test-agent │
|
||||
│ Phase 11 │
|
||||
└─────────────────┘
|
||||
```
|
||||
|
||||
## Detailed Execution Timeline
|
||||
|
||||
### Wave 1: Start (T+0)
|
||||
```
|
||||
T+0:00 → config-agent starts Phase 4
|
||||
T+0:00 → docs-agent starts Phase 9
|
||||
T+0:20 → config-agent completes Phase 4 ✓
|
||||
T+0:30 → docs-agent completes Phase 9 ✓
|
||||
```
|
||||
|
||||
### Wave 2: Main Execution (T+20-30)
|
||||
```
|
||||
T+0:20 → infra-agent starts Phase 1
|
||||
T+0:20 → backend-agent starts Phase 2
|
||||
T+0:20 → storage-agent starts Phase 3
|
||||
T+0:45 → infra-agent completes Phase 1 ✓
|
||||
T+0:50 → storage-agent completes Phase 3 ✓
|
||||
T+0:55 → backend-agent completes Phase 2 ✓
|
||||
```
|
||||
|
||||
### Wave 3: Continued + Platform (T+45-95)
|
||||
```
|
||||
T+0:45 → platform-agent starts Phase 8 (waits for infra Phase 1)
|
||||
T+0:50 → infra-agent starts Phase 5
|
||||
T+0:55 → backend-agent starts Phase 6
|
||||
T+1:05 → infra-agent completes Phase 5 ✓
|
||||
T+1:10 → infra-agent starts Phase 7
|
||||
T+1:20 → backend-agent completes Phase 6 ✓
|
||||
T+1:25 → platform-agent completes Phase 8 ✓
|
||||
T+1:30 → infra-agent completes Phase 7 ✓
|
||||
```
|
||||
|
||||
### Wave 4: Frontend (T+80-115)
|
||||
```
|
||||
T+1:20 → frontend-agent starts Phase 10 (waits for backend Phase 6)
|
||||
T+1:50 → frontend-agent completes Phase 10 ✓
|
||||
```
|
||||
|
||||
### Wave 5: Testing (T+110-140)
|
||||
```
|
||||
T+1:50 → test-agent starts Phase 11 (waits for all)
|
||||
T+2:15 → test-agent completes Phase 11 ✓
|
||||
```
|
||||
|
||||
**Total Parallel Execution Time:** ~2 hours 15 minutes
|
||||
**vs. Sequential Execution:** ~6-8 hours
|
||||
**Time Savings:** ~65-70%
|
||||
|
||||
## File Conflict Matrix
|
||||
|
||||
### Files Touched by Multiple Agents
|
||||
|
||||
| File | Agents | Coordination |
|
||||
|------|--------|--------------|
|
||||
| docker-compose.yml | infra-agent (Phase 1) | Sequential only - no conflict |
|
||||
| backend/src/app.ts | backend-agent (Phase 2, 6) | Same agent - sequential |
|
||||
| config/app/production.yml | config-agent (Phase 4) | Single agent - no conflict |
|
||||
| Makefile | docs-agent (Phase 9) | Single agent - no conflict |
|
||||
| .env | config-agent (Phase 4) | Single agent - no conflict |
|
||||
|
||||
**No file conflicts detected** - All agents work on different files or sequential phases.
|
||||
|
||||
## Communication Protocol
|
||||
|
||||
### State Updates
|
||||
Agents must update `EXECUTION-STATE.json` when:
|
||||
1. **Phase Start:** Set status to "in_progress", record timestamp
|
||||
2. **Phase Complete:** Set status to "completed", record timestamp
|
||||
3. **Phase Failed:** Set status to "failed", record error
|
||||
|
||||
### Coordination Points
|
||||
|
||||
**Critical Handoffs:**
|
||||
1. config-agent Phase 4 → infra-agent Phase 1
|
||||
2. config-agent Phase 4 → backend-agent Phase 2
|
||||
3. infra-agent Phase 1 → platform-agent Phase 8
|
||||
4. backend-agent Phase 6 → frontend-agent Phase 10
|
||||
5. All agents → test-agent Phase 11
|
||||
|
||||
### Conflict Resolution
|
||||
If unexpected conflict occurs:
|
||||
1. First agent creates `docs/redesign/locks/{filename}.lock`
|
||||
2. Second agent waits for lock release
|
||||
3. First agent deletes lock after completion
|
||||
4. Second agent proceeds
|
||||
|
||||
## Success Criteria Per Agent
|
||||
|
||||
### infra-agent
|
||||
- [ ] All 6 containers renamed correctly
|
||||
- [ ] docker-compose.yml validates (`docker compose config`)
|
||||
- [ ] Networks reduced to 3
|
||||
- [ ] Volumes configured correctly
|
||||
- [ ] Containers start successfully
|
||||
|
||||
### backend-agent
|
||||
- [ ] All tenant code removed
|
||||
- [ ] No import errors
|
||||
- [ ] API endpoints still functional
|
||||
- [ ] Tests pass for modified features
|
||||
|
||||
### storage-agent
|
||||
- [ ] Filesystem adapter created
|
||||
- [ ] Document upload/download works
|
||||
- [ ] No MinIO references remain
|
||||
- [ ] File permissions correct
|
||||
|
||||
### platform-agent
|
||||
- [ ] mvp-platform service simplified
|
||||
- [ ] Connects to mvp-postgres and mvp-redis
|
||||
- [ ] API endpoints functional
|
||||
- [ ] No MSSQL/ETL dependencies
|
||||
|
||||
### config-agent
|
||||
- [ ] All platform configs removed
|
||||
- [ ] MinIO configs removed
|
||||
- [ ] Secrets cleaned up
|
||||
- [ ] .env simplified
|
||||
|
||||
### frontend-agent
|
||||
- [ ] Tenant UI removed
|
||||
- [ ] Auth0 integration updated
|
||||
- [ ] API clients work
|
||||
- [ ] No console errors
|
||||
|
||||
### docs-agent
|
||||
- [ ] All documentation updated
|
||||
- [ ] Makefile commands updated
|
||||
- [ ] README reflects new architecture
|
||||
- [ ] Feature docs updated
|
||||
|
||||
### test-agent
|
||||
- [ ] `make rebuild` succeeds
|
||||
- [ ] All 6 containers healthy
|
||||
- [ ] `make test` passes
|
||||
- [ ] No regressions
|
||||
|
||||
## Emergency Procedures
|
||||
|
||||
### Agent Failure
|
||||
If an agent fails:
|
||||
1. Check EXECUTION-STATE.json for error details
|
||||
2. Review agent's phase documentation
|
||||
3. Option A: Retry agent with fix
|
||||
4. Option B: Manual intervention
|
||||
5. Option C: Rollback using ROLLBACK-STRATEGY.md
|
||||
|
||||
### Deadlock Detection
|
||||
If agents are waiting indefinitely:
|
||||
1. Check for circular dependencies (shouldn't exist)
|
||||
2. Check for orphaned lock files
|
||||
3. Review EXECUTION-STATE.json
|
||||
4. Manually release locks if needed
|
||||
|
||||
### Coordination Failure
|
||||
If agents lose sync:
|
||||
1. Pause all agents
|
||||
2. Review EXECUTION-STATE.json
|
||||
3. Identify completed vs. pending phases
|
||||
4. Resume from last known good state
|
||||
Reference in New Issue
Block a user