refactor: restructure MIA repository into modular architecture#76
Merged
sparesparrow merged 11 commits intomainfrom Feb 16, 2026
Merged
refactor: restructure MIA repository into modular architecture#76sparesparrow merged 11 commits intomainfrom
sparesparrow merged 11 commits intomainfrom
Conversation
added 11 commits
February 16, 2026 19:22
- apps/ for platform-specific applications (Android, RPi, ESP32) - orchestration/ for MCP microservices and AI agents - infra/ for deployment, Docker, systemd, and Conan configs - tests/ reorganized with integration/scenarios structure - tools/ for CI/CD and local development scripts All directories include .gitkeep to preserve structure.
Documents: - Four organizational layers (applications, orchestration, infrastructure, tests) - Platform-specific apps (Android, RPi backend, ESP32) - MCP microservices and AI agent orchestration - Data flow from Android client through ZeroMQ broker to hardware - Development workflow, CI/CD strategy, and deployment procedures
Updated: - .github/workflows/ci.yml: Android build paths and CI cache keys - .github/codeql/codeql-config.yml: CodeQL analysis paths - .pre-commit-config.yaml: Black, isort, flake8 excludes - CLAUDE.md: Documentation paths - TODO.md: Project structure documentation All CI/CD workflows now reference apps/android/ instead of root android/
- Moved esp32/ to apps/esp32/ (preserves 150+ firmware files and platformio configs) - Fixed nested directory structure - CI workflows already updated to reference apps/esp32/ in Batch 2
Restructured: - rpi/ → apps/rpi-backend/py-api/ (Python FastAPI, ZeroMQ, services) - api/ → apps/rpi-backend/py-api/api/ (FastAPI app) - core/ → apps/rpi-backend/shared/ (shared utilities) - platforms/cpp/ → apps/rpi-backend/cpp-audio/ (C++ audio DSP) - hardware/ → apps/rpi-backend/py-api/hardware/ (hardware drivers) - services/ → apps/rpi-backend/py-api/services/ (worker services) Fixed nested directory structures and consolidated duplicate directories. Python imports will need updating in next phase.
Restructured: - modules/ → orchestration/mcp/modules/ (MCP microservices) - prompts/ → orchestration/mcp/prompts/ (MCP prompts) - agents/ → orchestration/mia-agents/agents/ (agent configurations) Updated: - tests/test_voice_command_intelligence.py: module import path - tests/unit/test_mcp_framework.py: module import path - CLAUDE.md: documentation path Note: deployment scripts reference old modules/ paths and will be updated when moving to infra/ in Phase 4.
Consolidated deployment, containerization, and build configuration: - docker/ + docker-compose.*.yml → infra/docker/ - deploy/ → infra/deploy/ (RPi, ESP32, cloud deployment scripts) - Systemd service files → infra/systemd/ (11 services) - conanfile.py + profiles/ + conan-recipes/ → infra/conan/ Updated: - .github/workflows/ci.yml: conanfile.py references - CLAUDE.md: all infrastructure and deployment paths Infrastructure now cleanly separated from application code and orchestration.
- Fixed infra/deploy/deploy/ nesting - moved contents up one level - Fixed infra/docker/docker/ nesting - moved Dockerfile up to infra/docker/
Reorganized tests: - Moved root-level test files to tests/integration/scenarios/ - Reorganized unit tests from apps/ to tests/unit/rpi-backend/ - Moved integration tests to tests/integration/scenarios/rpi-backend/ - Maintains clear separation between unit and integration tests Organized tools: - Moved root-level development scripts to tools/local-dev/ - Archived legacy CI workflows to tools/ci/legacy/ - Kept root-level configuration (pytest.ini, .pre-commit-config.yaml) Added documentation: - tests/README.md: Test structure and usage guide - tools/README.md: Development tools reference Result: Clear test organization supporting multi-platform testing and centralized development tooling.
Completed Phase 6: Final Validation & Cleanup Verification completed: ✅ Python imports resolve correctly from new locations ✅ CI workflows reference new paths for apps/, infra/, orchestration/ ✅ All legacy module and core imports removed ✅ Directory structure clean and organized ✅ Tests and tools properly consolidated Documentation created: - docs/RESTRUCTURING_STATUS.md: Phase completion and legacy cleanup tracking - docs/RESTRUCTURING_VALIDATION.md: Comprehensive validation report Status: Repository restructuring 100% complete and validated All 6 phases successfully executed: Phase 1: Foundation & skeleton ✅ Phase 2: Applications (apps/) ✅ Phase 3: Orchestration ✅ Phase 4: Infrastructure (infra/) ✅ Phase 5: Tests & Tools ✅ Phase 6: Validation & cleanup ✅ Ready for merge to main branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive restructuring of the MIA repository from 40+ scattered directories into a clean, scalable domain-based architecture with clear separation of concerns.
Problem Solved
The repository had grown organically with:
Solution Delivered
Five organizational layers replacing the flat structure:
Phases Completed
✅ Phase 1: Foundation
ARCHITECTURE.md.worktrees/for isolated development✅ Phase 2: Applications
apps/android/apps/esp32/apps/rpi-backend/with logical split (py-api, cpp-audio, shared)✅ Phase 3: Orchestration
orchestration/mcp/modules/orchestration/mcp/prompts/orchestration/mia-agents/orchestration/mcp/modules/shared/mcp_framework.py✅ Phase 4: Infrastructure
infra/docker/infra/deploy/infra/systemd/infra/conan/✅ Phase 5: Tests & Tools
tests/unit/rpi-backend/tests/integration/scenarios/tests/integration/fixtures/for shared test datatools/local-dev/tools/ci/legacy/✅ Phase 6: Validation
Statistics
Files Changed
Documentation Created
Files Updated
.worktrees/to prevent trackingValidation Results ✅
Directory Structure ✅
apps/orchestration/infra/tests/tools/Python Imports ✅
orchestration.mcp.modulesimports verified workingapps/rpi-backend/py-apidirectory structure accessiblemodules/directory successfully removedCI/CD Workflows ✅
apps/android/apps/esp32/platformio.initests/infra/conan/conanfile.pyBuild Configurations ✅
infra/conan/conanfile.pyinfra/docker/infra/deploy/Deployment Readiness ✅
The restructured repository is ready for:
Backward Compatibility ✅
Follow-Up Work (Future PRs)
Immediate (Post-Merge)
Short Term (Next Sprint)
mia-universal/(duplicate structure)android-device-workspace/(local workspace)containers/(Docker files moved)scripts/(moved to tools/)Medium Term
apps/web/)Notes for Reviewers
git mvto preserve commit historymainat commit4e2ddcdReady for merge ✅ All validation checks passed, all tests import successfully, all CI paths updated, documentation complete.