Requirements Document
Introduction
This specification defines the target architecture for a multi-repository platform that cleanly separates workspace-level operations, repository-level utilities, and platform foundation infrastructure. The architecture consists of workspace-root (workspace management and AI Gateway), workspace-shared (lightweight repo utilities), and k8s-lab (platform foundation), creating a cohesive ecosystem that supports both traditional development and AI-enabled workflows.
Glossary
- Workspace_Root: Repository containing workspace-level tooling, AI Gateway configuration, BMAD methodology, and cross-workspace operations
- Workspace_Shared: Lightweight repository containing repo-level shared utilities accessible via git submodule
- Platform_Foundation: The k8s-lab repository providing base infrastructure (ArgoCD, supporting applications) for all platform capabilities
- Foundation_Seed: Base infrastructure components in k8s-lab that provide GitOps foundation for business capabilities
- Business_Capabilities: Application-specific components (Backstage, Image Factory, EDA) that build on the platform foundation
- AI_Gateway: Mobile AI development system enabling AI-assisted workflows with centralized configuration
- BMAD_Methodology: Business Method and Design methodology with centralized templates and cross-workspace learning
- ArgoCD_Bootstrap: Self-managing GitOps engine that provides the foundation for all platform deployments
- Supporting_Applications: Infrastructure services (cert-manager, external-secrets, Kargo, Headlamp) that support platform operations
- Central_Secret_Store: Automated secret distribution system that eliminates manual secret management
- Task_Organization: Clear, non-overlapping task structure that eliminates confusion between deployment scenarios
- Workspace_Discovery: System for automatically identifying and configuring AI-enabled development environments
- Environment_Overlays: Configuration system supporting different deployment environments with appropriate capability sets
Requirements
Requirement 1: Separate Workspace-Level and Repo-Level Concerns
User Story: As a developer, I want workspace-level tooling separated from repo-level utilities, so that I can use each at the appropriate level without duplication or confusion.
Acceptance Criteria
- WHEN workspace-level operations are needed, THE System SHALL provide tooling from workspace-root without requiring submodule inclusion
- WHEN repo-level utilities are needed, THE System SHALL provide lightweight tooling from workspace-shared via submodule
- WHEN a repository needs shared utilities, THE System SHALL not require inclusion of heavy workspace tooling
- WHEN workspace management is performed, THE System SHALL not duplicate tooling across multiple repository submodules
- THE System SHALL maintain clear separation between workspace-level and repo-level operations
Requirement 2: Workspace-Root Repository Structure
User Story: As a developer, I want workspace-root to provide comprehensive workspace-level tooling, so that I can manage multi-repository development environments effectively.
Acceptance Criteria
- WHEN workspace-root is accessed, THE System SHALL provide workspace management functionality for multi-repository operations
- WHEN workspace tooling is needed, THE System SHALL provide workspace management, BMAD methodology, AI Gateway configuration, and development environment setup
- WHEN workspace-root is referenced, THE System SHALL operate at the workspace level managing multiple repositories
- WHEN workspace configurations are processed, THE System SHALL handle them consistently across all supported environments
- THE System SHALL provide all workspace-level operations without requiring submodule inclusion
Requirement 3: Workspace-shared Repository
User Story: As a developer, I want a lightweight workspace-shared repository for repo-level utilities, so that I can include shared tasks in individual repositories without heavy dependencies.
Acceptance Criteria
- WHEN workspace-shared is created, THE System SHALL contain only lightweight repo-level utilities
- WHEN repositories include workspace-shared as submodule, THE System SHALL provide access to docs:taskfile and other CI tasks
- WHEN workspace-shared is updated, THE System SHALL not include heavy tooling like workspace management or bmad
- WHEN GitLab CI runs, THE System SHALL have local access to required tasks from workspace-shared submodule
- THE System SHALL keep workspace-shared minimal and focused on per-repository needs
Requirement 4: Extract and Migrate Repo-Level Tasks
User Story: As a developer, I want repo-level tasks extracted from the current dev-common into workspace-shared, so that repositories can access shared utilities without workspace-level dependencies.
Acceptance Criteria
- WHEN docs:taskfile task is migrated, THE System SHALL provide identical functionality in workspace-shared
- WHEN other repo-level utilities are identified, THE System SHALL migrate them to workspace-shared
- WHEN tasks are extracted, THE System SHALL maintain the same task interface and behavior
- WHEN repositories reference workspace-shared tasks, THE System SHALL provide the same functionality as current dev-common submodule usage
- THE System SHALL not migrate workspace-level tasks to workspace-shared
Requirement 5: Update Repository References and Usage Patterns
User Story: As a developer, I want existing repositories updated to use the new structure, so that I can benefit from the improved architecture without breaking existing workflows.
Acceptance Criteria
- WHEN repositories currently using dev-common submodule are updated, THE System SHALL reference workspace-shared instead
- WHEN workspace-level operations are needed, THE System SHALL reference workspace-root directly
- WHEN Taskfile includes are updated, THE System SHALL reference the appropriate repository for each task type
- WHEN GitLab CI configurations are updated, THE System SHALL continue to work with workspace-shared submodule
- THE System SHALL provide migration documentation for updating existing repositories
Requirement 6: Maintain Functional Compatibility
User Story: As a developer, I want all existing functionality preserved during the restructure, so that my current workflows continue to work without interruption.
Acceptance Criteria
- WHEN workspace management tasks are executed, THE System SHALL provide identical functionality from workspace-root
- WHEN repo-level tasks are executed, THE System SHALL provide identical functionality from workspace-shared
- WHEN workspace configurations are processed, THE System SHALL handle them with the same behavior as before
- WHEN development tools are installed, THE System SHALL provide the same installation and management capabilities
- THE System SHALL not break any existing workspace or repository functionality during migration
Requirement 7: Integrate with AI Gateway Workspace Structure
User Story: As a developer, I want the repository restructure to support the AI Gateway workspace architecture, so that workspace-root can serve as the foundation for AI-enabled development workflows.
Acceptance Criteria
- WHEN workspace-root is established, THE System SHALL support the global AI Gateway configuration pattern from ai-dev design
- WHEN workspace-root contains BMAD methodology, THE System SHALL provide centralized BMAD templates and configuration for all workspaces
- WHEN workspace discovery is implemented, THE System SHALL integrate with the existing workspaces.yaml structure
- WHEN AI-enabled workspaces are created, THE System SHALL support the
.ai/directory pattern for workspace-specific AI state - THE System SHALL enable workspace-root to serve as the central location for cross-workspace BMAD artifacts and methodology
Requirement 8: Support BMAD Methodology Structure
User Story: As a developer, I want workspace-root to contain the centralized BMAD methodology structure, so that all AI-enabled workspaces can access consistent business method and design templates.
Acceptance Criteria
- WHEN BMAD methodology is centralized, THE System SHALL provide the
_bmad/directory structure in workspace-root - WHEN BMAD configuration is accessed, THE System SHALL provide methodology definitions, templates, and role configurations
- WHEN cross-workspace learning occurs, THE System SHALL store patterns and lessons learned in the centralized
_bmad/_memory/location - WHEN workspace-specific BMAD artifacts are created, THE System SHALL reference the centralized methodology while maintaining workspace isolation
- THE System SHALL support the BMAD phase structure (bmb, bmm, cis, core, planning-artifacts, implementation-artifacts)
Requirement 9: Enable Workspace Discovery Integration
User Story: As a developer, I want workspace-root to integrate with the existing workspace discovery system, so that AI Gateway can automatically discover and configure AI-enabled workspaces.
Acceptance Criteria
- WHEN workspace discovery is performed, THE System SHALL read workspace definitions from the existing workspaces.yaml structure
- WHEN AI Gateway configuration is loaded, THE System SHALL provide global AI settings from workspace-root
- WHEN workspace-specific AI state is needed, THE System SHALL support the
.ai/directory pattern in individual workspace repositories - WHEN workspace scope is determined, THE System SHALL derive AI scope from existing workspace project definitions
- THE System SHALL support both local development and code-server environments through unified configuration
Requirement 10: Shared Component Distribution and Management
User Story: As a platform engineer, I want to reuse common infrastructure components across multiple workspaces via workspace-shared, so that all projects can benefit from standardized configurations without duplicating code.
Acceptance Criteria
- WHEN consuming common components from workspace-shared repository, THE System SHALL support git submodule references at
libs/workspace-shared - WHEN common components are updated in workspace-shared, THE System SHALL allow consuming workspaces to pin to specific versions for stability
- WHEN multiple workspaces use shared components, THE System SHALL maintain consistent behavior across all consuming workspaces
- WHEN component versions are released, THE System SHALL follow semantic versioning with git tags to communicate breaking changes and compatibility
- WHEN consuming workspaces import shared components, THE System SHALL provide clear documentation for submodule integration patterns and configuration options
- WHEN shared components include Helm charts, kustomize components, and steering documentation, THE System SHALL organize them in the established workspace-shared directory structure
Requirement 11: Automated Taskfile Management for Shared Components
User Story: As a platform engineer, I want automated tasks for managing workspace-shared components, so that I can easily set up, update, and maintain shared components across multiple workspaces.
Acceptance Criteria
- WHEN setting up a new workspace, THE System SHALL provide tasks to automatically add workspace-shared as a submodule at libs/workspace-shared
- WHEN workspace-shared components are updated, THE System SHALL provide tasks to update submodules in consuming workspaces
- WHEN pinning to specific component versions, THE System SHALL provide tasks to pin submodules to specific git tags
- WHEN checking component status, THE System SHALL provide tasks to show current versions and available updates
- WHEN developing workspace-shared components from consuming workspaces, THE System SHALL provide tasks for committing, pushing, testing, and releasing changes
- WHEN consuming workspaces need to validate their workspace-shared integration, THE System SHALL provide tasks to verify submodule integrity and component functionality
Requirement 12: Clear Documentation and Usage Patterns
User Story: As a developer, I want clear documentation on when to use workspace-root vs workspace-shared, so that I can choose the appropriate tooling for my needs.
Acceptance Criteria
- WHEN documentation is provided, THE System SHALL clearly explain workspace-root usage for workspace-level operations including AI Gateway and BMAD
- WHEN documentation is provided, THE System SHALL clearly explain workspace-shared usage for repo-level operations
- WHEN migration guides are created, THE System SHALL provide step-by-step instructions for updating existing repositories
- WHEN examples are provided, THE System SHALL show proper usage patterns for both repositories including AI Gateway integration
- THE System SHALL document the architectural reasoning behind the separation and its role in the AI Gateway ecosystem
Requirement 10: Clear Documentation and Usage Patterns
User Story: As a developer, I want clear documentation on when to use workspace-root vs workspace-shared, so that I can choose the appropriate tooling for my needs.
Acceptance Criteria
- WHEN documentation is provided, THE System SHALL clearly explain workspace-root usage for workspace-level operations including AI Gateway and BMAD
- WHEN documentation is provided, THE System SHALL clearly explain workspace-shared usage for repo-level operations
- WHEN migration guides are created, THE System SHALL provide step-by-step instructions for updating existing repositories
- WHEN examples are provided, THE System SHALL show proper usage patterns for both repositories including AI Gateway integration
- THE System SHALL document the architectural reasoning behind the separation and its role in the AI Gateway ecosystem
Requirement 11: Platform Foundation Infrastructure Separation
User Story: As a platform engineer, I want k8s-lab to provide foundational infrastructure components separate from business capabilities, so that I can reuse the foundation across multiple platform deployments and maintain clear separation of concerns.
Acceptance Criteria
- WHEN deploying the foundation seed in k8s-lab, THE Foundation_Seed SHALL install ArgoCD and all supporting applications without any business capabilities
- WHEN the foundation is deployed, THE Foundation_Seed SHALL provide a stable base that other repositories can assume exists
- WHEN business capabilities are deployed, THE Business_Capabilities SHALL assume ArgoCD and supporting applications are already available
- THE Foundation_Seed SHALL include ArgoCD, cert-manager, external-secrets, Kargo, Headlamp, and other supporting applications
- THE Foundation_Seed SHALL NOT include Backstage, Image Factory, or EDA Mesh components
Requirement 12: ArgoCD Bootstrap and Self-Management
User Story: As a platform operator, I want ArgoCD to bootstrap itself and then manage all subsequent deployments, so that I have a GitOps-native platform from the start.
Acceptance Criteria
- WHEN applying the foundation seed, THE ArgoCD_Bootstrap SHALL install ArgoCD using a single kubectl apply command
- WHEN ArgoCD is running, THE Self_Managing_Seed SHALL create ArgoCD applications that manage the seed directory itself
- WHEN changes are made to the seed configuration, THE Self_Managing_Seed SHALL automatically detect and apply those changes
- THE ArgoCD_Bootstrap SHALL include initial ArgoCD configuration, projects, and RBAC settings
- THE Self_Managing_Seed SHALL prevent infinite sync loops through proper ignoreDifferences configuration
Requirement 13: Environment Overlay Support
User Story: As a platform engineer, I want to support different deployment environments with varying capabilities, so that I can use the same foundation across development, staging, and production environments.
Acceptance Criteria
- WHEN deploying to different environments, THE Foundation_Seed SHALL support environment-specific overlays
- WHEN using local development overlays, THE Foundation_Seed SHALL include all supporting applications for full development capabilities
- WHEN using production overlays, THE Foundation_Seed SHALL include only essential supporting applications for production stability
- THE Foundation_Seed SHALL support branch targeting for isolated development workflows
- THE Foundation_Seed SHALL maintain consistent core functionality across all environment overlays
Requirement 14: Central Secret Management
User Story: As a security engineer, I want all secrets to be managed centrally and distributed automatically, so that I maintain security best practices and avoid manual secret management.
Acceptance Criteria
- WHEN the foundation is deployed, THE Foundation_Seed SHALL create a central secret store namespace
- WHEN secrets are needed by applications, THE Foundation_Seed SHALL automatically distribute secrets from the central store
- WHEN new namespaces are created, THE Foundation_Seed SHALL automatically provision required secrets based on namespace labels
- THE Foundation_Seed SHALL include External Secrets Operator for automated secret distribution
- THE Foundation_Seed SHALL never create secrets manually in individual namespaces
Requirement 15: Lightweight Business Capability Integration
User Story: As a business capability developer, I want to deploy my capabilities assuming the foundation exists, so that I can focus on business logic without managing infrastructure concerns.
Acceptance Criteria
- WHEN business capabilities are deployed, THE Business_Capabilities SHALL assume ArgoCD is already running and configured
- WHEN creating ArgoCD applications for business capabilities, THE Business_Capabilities SHALL use the existing ArgoCD instance
- WHEN business capabilities need supporting services, THE Business_Capabilities SHALL reference services provided by the foundation
- THE Business_Capabilities SHALL not duplicate any infrastructure components provided by the foundation
- THE Business_Capabilities SHALL be deployable as lightweight seeds that extend the foundation
Requirement 16: Foundation Testing and Validation
User Story: As a platform engineer, I want comprehensive testing of the foundation seed, so that I can ensure reliability and catch regressions early.
Acceptance Criteria
- WHEN the foundation seed is deployed, THE Foundation_Seed SHALL pass all validation tests
- WHEN ArgoCD applications are created, THE Foundation_Seed SHALL verify that all applications sync successfully
- WHEN supporting applications are deployed, THE Foundation_Seed SHALL validate that all services are healthy
- THE Foundation_Seed SHALL include automated tests for the bootstrap process
- THE Foundation_Seed SHALL include tests for self-management functionality
Requirement 17: Clear Task Organization and Workflow
User Story: As a platform operator, I want clearly organized and non-overlapping Taskfile commands with obvious purposes, so that I can efficiently manage the foundation without confusion about which task to use in different scenarios.
Acceptance Criteria
- WHEN managing the foundation, THE Foundation_Seed SHALL provide distinct tasks for each deployment scenario without functional overlap
- WHEN bootstrapping a clean cluster, THE Foundation_Seed SHALL provide a single clear bootstrap task that handles the complete initial setup
- WHEN applying routine updates, THE Foundation_Seed SHALL provide a separate apply task that assumes the foundation already exists
- WHEN initializing secrets and prerequisites, THE Foundation_Seed SHALL provide a dedicated initialization task that can be run independently
- THE Foundation_Seed SHALL eliminate redundant tasks that perform similar functions with different names
- WHEN viewing available tasks, THE Foundation_Seed SHALL provide clear descriptions that explain when each task should be used
- THE Foundation_Seed SHALL organize tasks into logical groups (bootstrap, management, troubleshooting) for better discoverability
Requirement 18: Single Large Workspace for AI Agents
User Story: As an AI agent, I want a single large workspace option that includes all projects in a unified structure, so that the AI can have as much context as possible to help it understand work & can work across multiple repositories.
Acceptance Criteria
- WHEN a workspace is configured with an internal folder setting, THE System SHALL instantiate all configured projects as subdirectories under that internal folder
- WHEN an AI agent workspace is created, THE System SHALL support a “repos” subfolder containing all project repositories
- WHEN projects are cloned into an internal folder workspace, THE System SHALL maintain the same project structure and functionality as individual workspaces
- WHEN workspace discovery occurs, THE System SHALL support both traditional multi-workspace and single large workspace patterns
- THE System SHALL allow workspaces to specify an
internalFolderproperty that determines where projects are instantiated - WHEN an internal folder is specified, THE System SHALL create the folder structure automatically during workspace setup
- THE System SHALL maintain backward compatibility with existing workspace configurations that don’t use internal folders
Requirement 19: Modular ArgoCD Application Organization
User Story: As a platform engineer, I want the k8s-lab foundation seed organized into logical ArgoCD application groupings (core-infrastructure, platform-services, remote-development, observability), so that I can manage, deploy, and troubleshoot related components together while keeping the main seed focused and maintainable.
Acceptance Criteria
- WHEN organizing components in k8s-lab, THE System SHALL group them into logical directories: core-infrastructure/, platform-services/, remote-development/, and observability/
- WHEN deploying the foundation seed, THE System SHALL deploy core-infrastructure and platform-services components as part of the main seed
- WHEN deploying modular components, THE System SHALL create separate ArgoCD applications for remote-development and observability component groups
- WHEN a component group is deployed as an ArgoCD application, THE System SHALL reference the component group directory path in the application source
- THE System SHALL maintain independent sync policies and health checks for each modular ArgoCD application
- WHEN troubleshooting components, THE System SHALL provide isolated status and logs per component group
- THE System SHALL support enabling/disabling entire component groups based on environment needs (e.g., disable remote-development in production)
Requirement 20: Unified Project Structure for Multi-Tool Development
User Story: As a developer using multiple AI coding tools (Kiro and Codev), I want a single unified projects folder where all project artifacts live, so that I can work on projects with any tool without duplicating specifications or managing multiple tool-specific folders.
Acceptance Criteria
- WHEN creating a new project, THE System SHALL store all project artifacts in a unified
.ai/projects/{project-name}/directory - WHEN a project uses Kiro format, THE System SHALL store requirements.md, design.md, and tasks.md in the project directory
- WHEN a project uses Codev format, THE System SHALL store spec.md, plan.md, and review.md in the project directory
- WHEN a project is created, THE System SHALL use exactly one format (Kiro or Codev), not both simultaneously
- WHEN Kiro needs to access a project, THE System SHALL provide a symlink from
.kiro/specs/{project-name}to.ai/projects/{project-name}/ - WHEN Codev needs to access a project, THE System SHALL provide pointer files in
codev/specs/,codev/plans/, andcodev/reviews/that reference the unified project location - WHEN a project is created, THE System SHALL generate a metadata.json file tracking which tool format the project uses and which artifacts are present
- WHEN listing projects, THE System SHALL show all projects regardless of which tool format they use
- WHEN migrating existing projects, THE System SHALL preserve all existing artifacts and maintain the original tool format
- THE System SHALL support converting a project from one format to another through explicit migration
- THE System SHALL ensure
.ai/projects/is included in.gitignoreto keep AI-specific project state local to each developer