# Project Cleanup and Optimization Plan

**Date**: 2025-11-18  
**Status**: In Progress

## Overview

This document tracks the cleanup and optimization of the smom-dbis-138 project, focusing on:
- Deduplication of documentation and scripts
- Removal of outdated/conflicting files
- Consolidation of configurations
- Project structure optimization

## Findings

### Documentation
- **89 markdown files** in `terraform/phases/phase1/` - mostly status/completion reports
- **645+ total markdown files** across the project
- Multiple duplicate status reports and completion summaries

### Configuration Files
- **Old structure**: `config/validators/`, `config/sentries/`, `config/rpc/` (IBFT2-based)
- **New structure**: `config/config-*.toml` (QBFT-based, standardized)
- **4 genesis.json backup files** in config/
- **README.md** still references IBFT 2.0 (should be QBFT)

### Docker Compose Files
- **Old**: `docker/besu-*/docker-compose.yml` (per-node-type structure)
- **New**: `docker-compose/docker-compose.template.yml` (Option A template-based)
- **Phase2 files**: `docker/phase2/docker-compose.*.yml` (regional deployments)

### Scripts
- **260 shell scripts** total
- Multiple genesis generation scripts (duplicates)
- Old deployment scripts vs new standardized approach

## Cleanup Actions

### Phase 1: Archive Old Status Reports ✅
- [x] Create archive directory structure
- [ ] Move terraform/phases/phase1/*COMPLETE*.md files
- [ ] Move terraform/phases/phase1/*STATUS*.md files
- [ ] Move terraform/phases/phase1/*FIX*.md files
- [ ] Create summary document of archived reports

### Phase 2: Remove Backup Files ✅
- [ ] Remove config/genesis.json.backup.* files
- [ ] Verify current genesis.json is correct

### Phase 3: Update Documentation ✅
- [ ] Update README.md: IBFT 2.0 → QBFT
- [ ] Update all references to consensus protocol
- [ ] Consolidate duplicate documentation

### Phase 4: Consolidate Config Files ✅
- [ ] Archive old config/validators/, config/sentries/, config/rpc/ directories
- [ ] Document migration to config-*.toml structure
- [ ] Update references in scripts

### Phase 5: Docker Compose Consolidation ✅
- [ ] Document which docker-compose files are current
- [ ] Archive old docker/ structure if not needed
- [ ] Create migration guide

### Phase 6: Script Deduplication ✅
- [ ] Identify duplicate scripts
- [ ] Consolidate genesis generation scripts
- [ ] Remove obsolete deployment scripts

## Archive Structure

```
docs/archive/
├── status-reports/
│   └── phase1/          # terraform/phases/phase1 status reports
├── old-configs/
│   └── ibft2/           # Old IBFT2 config structure
└── old-scripts/
    └── deprecated/      # Obsolete scripts
```

## Progress Tracking

- **Started**: 2025-11-18
- **Current Phase**: Phase 1 - Archive Old Status Reports
- **Next Steps**: Complete archiving, then proceed to documentation updates

