This guide helps you migrate from project-specific processes to Foundation.
Migration involves:
- Installing Foundation - Add as submodule or symlink
- Creating Configuration - Define repo-specific settings
- Migrating Content - Move generic processes to foundation
- Updating References - Point to foundation instead of local docs
- Testing - Verify everything works
# Method A: As git submodule (recommended)
git submodule add <foundation-repo-url> foundation
# Method B: As local symlink (for testing)
ln -s ../foundation foundation# Copy template
cp foundation/config/foundation-config.yaml ./foundation-config.yaml
# Customize for your repository
vim foundation-config.yamlConfigure:
- Repository name and type
- Branch naming patterns
- Code conventions (file naming, string quotes, etc.)
- Security rules (protected paths)
- Enable/disable optional features
Identify Generic Documentation:
Look for documentation that could apply to any project:
- Development workflow
- Code conventions
- Testing standards
- Security practices
Keep Project-Specific Documentation:
Keep documentation that is unique to your project:
- Product specifications
- Architecture decisions
- Business logic
- Domain models
Update References:
<!-- Before -->
See [Code Conventions](docs/conventions/code-conventions.md)
<!-- After -->
See [Code Conventions](foundation/conventions/code-conventions.md)Generic Scripts → Foundation:
Move scripts that could work in any project:
- Worktree setup scripts
- Security audit scripts
- Environment setup scripts
Keep Project-Specific Scripts:
Keep scripts that are specific to your project:
- Deployment scripts
- Database migration scripts
- Project-specific build scripts
Add to .gitignore:
# Foundation local overrides
foundation-config.local.yaml
# Keep existing patterns
.env*
.secrets/
Add git hooks (optional):
# Copy pre-commit hook
cp foundation/security/pre-commit-audit.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit# Validate setup
./foundation/scripts/validate-setup.sh
# Test key workflows
./foundation/development/worktree-setup.sh test-branch
./foundation/security/pre-commit-audit.sh
# Run your tests
npm test # or your test commandUpdate onboarding docs and README to reference foundation:
## Development
This project uses [Foundation](foundation/README.md) for development processes.
Key documents:
- [Development Workflow](foundation/development/workflow.md)
- [Code Conventions](foundation/conventions/code-conventions.md)
- [Security Rules](foundation/security/security-rules.md)Before: Traditional feature branches
git checkout -b feature/my-feature
# ... develop ...
git push origin feature/my-featureAfter: Foundation workflow with worktrees
./foundation/development/worktree-setup.sh my-feature
cd ../repo-my-feature
# ... develop ...
git pushConfiguration:
development:
workflow:
use_worktrees: trueBefore: Project-specific conventions doc
docs/
└── conventions.md # All conventions in one file
After: Foundation conventions + repo adapter
foundation/conventions/code-conventions.md # Generic conventions
foundation-config.yaml # Repo-specific overrides
# In foundation-config.yaml:
conventions:
typescript:
files: "kebab-case" # Override if different
Before: Manual security checks
# Developer manually checks for secrets before commit
grep -r "api_key" .After: Automated security audit
# Automatic via git hook
./foundation/security/pre-commit-audit.shFor simple differences, use configuration:
# foundation-config.yaml
conventions:
typescript:
files: "kebab-case" # Override foundation defaultFor complex overrides, create a repo adapter:
# foundation/config/repo-adapters/my-repo.yaml
repo_name: "my-repo"
# Override multiple settings
conventions:
typescript:
files: "kebab-case"
sql:
tables: "PascalCase" # Different from foundation
security:
pre_commit_audit:
protected_paths:
- "sensitive/" # Custom protected pathFor project-specific processes, keep separate:
docs/
├── project-specific/
│ ├── domain-model.md
│ ├── api-spec.md
│ └── deployment.md
foundation/ (submodule)
└── ...
If migration causes issues:
- Remove foundation submodule:
git submodule deinit foundation
git rm foundation
rm foundation-config.yaml- Restore original documentation:
git revert <migration-commit>- Fix issues and try again later
You can migrate gradually:
Phase 1: Install foundation, configure, but keep using existing docs
# foundation-config.yaml
documentation:
enforce_agent_instructions: false # Don't enforce yetPhase 2: Migrate development workflow
- Start using foundation workflow
- Update references in README
Phase 3: Migrate conventions
- Start using foundation conventions
- Update linter configs
Phase 4: Migrate security
- Enable security checks
- Add git hooks
Phase 5: Full migration
- Remove duplicate documentation
- Enable all foundation features
After migration, verify:
-
./foundation/scripts/validate-setup.shpasses - All team members can follow new workflow
- CI/CD still works
- Documentation is accessible
- Scripts are executable
- Configuration is correct
git submodule update --init --recursive
git submodule update --remote foundationchmod +x foundation/scripts/*.sh
chmod +x foundation/security/*.sh
chmod +x foundation/development/*.shCheck configuration file location and syntax:
# Should be in repository root
ls foundation-config.yaml
# Validate YAML syntax
python -c "import yaml; yaml.safe_load(open('foundation-config.yaml'))"# Reinstall hooks
cp foundation/security/pre-commit-audit.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
# Test hook
.git/hooks/pre-commitIf you encounter issues during migration:
- Check
foundation/README.mdfor documentation - Review
foundation-config.yamlfor configuration options - Test in a separate branch first
- Ask for help in foundation repository
After successful migration:
- Document your configuration - Add comments to
foundation-config.yaml - Train team - Ensure everyone understands new processes
- Monitor adoption - Check that team is following foundation
- Contribute back - Share improvements with foundation
- Stay updated - Regularly sync foundation updates
# Regular updates
git submodule update --remote foundation