Problem
Currently, when specify init --team-ai-directives <url> is run, it clones the team-ai-directives repository into .specify/memory/team-ai-directives/. This creates several issues:
- Nested Git Repository: The clone creates a
.git directory inside the project, which is problematic when .specify is committed to the project repo
- Worktree Conflicts: When using parallel execution with worktrees (Phase 2 feature), worktrees are created in
.specify/worktrees/ which should not be committed
- Version Tracking: Cannot track which version of team-ai-directives is being used
Solution
Use Git Submodule instead of Clone:
# Current (clone)
git clone <url> .specify/memory/team-ai-directives
# Proposed (submodule)
git submodule add <url> .specify/team-ai-directives
New Directory Structure
project/
├── .specify/
│ ├── team-ai-directives/ ← SUBMODULE (moved from .specify/memory/)
│ │ ├── context_modules/
│ │ ├── skills/
│ │ ├── drafts/ ← Levelup writes here
│ │ └── .git ← Submodule reference (not nested repo)
│ ├── memory/
│ │ ├── adr.md
│ │ └── constitution.md
│ └── worktrees/ ← Excluded via .git/info/exclude
│ ├── feature-login-task1/
│ └── feature-login-task2/
Worktree Exclusion
When creating worktrees for parallel task execution, add to .git/info/exclude:
# Agentic SDLC worktrees
.specify/worktrees/
.specify/worktrees/*
This follows Kilo's approach (.kilocode/worktrees/ in .git/info/exclude).
Changes Required
-
spec-kit CLI (src/specify_cli/__init__.py):
- Change
git clone → git submodule add
- Handle submodule update commands
-
Levelup Path Updates:
- Update
KNOWLEDGE_ROOT from .specify/memory/team-ai-directives → .specify/team-ai-directives
- Files:
scripts/bash/prepare-levelup.sh, scripts/powershell/prepare-levelup.ps1, templates/commands/levelup.md
-
Auto-exclude Worktrees:
- When creating worktree, append to
.git/info/exclude
-
Documentation:
- Update README with submodule setup instructions
- Document submodule update flow:
git submodule update --init --recursive
Related
- Phase 2: Worktree Support for Parallel Execution
- PRD: LLM Gateway Integration
Problem
Currently, when
specify init --team-ai-directives <url>is run, it clones the team-ai-directives repository into.specify/memory/team-ai-directives/. This creates several issues:.gitdirectory inside the project, which is problematic when.specifyis committed to the project repo.specify/worktrees/which should not be committedSolution
Use Git Submodule instead of Clone:
New Directory Structure
Worktree Exclusion
When creating worktrees for parallel task execution, add to
.git/info/exclude:This follows Kilo's approach (
.kilocode/worktrees/in.git/info/exclude).Changes Required
spec-kit CLI (
src/specify_cli/__init__.py):git clone→git submodule addLevelup Path Updates:
KNOWLEDGE_ROOTfrom.specify/memory/team-ai-directives→.specify/team-ai-directivesscripts/bash/prepare-levelup.sh,scripts/powershell/prepare-levelup.ps1,templates/commands/levelup.mdAuto-exclude Worktrees:
.git/info/excludeDocumentation:
git submodule update --init --recursiveRelated