Skip to content

Use Git Submodule for team-ai-directives instead of Clone #53

@kanfil

Description

@kanfil

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:

  1. Nested Git Repository: The clone creates a .git directory inside the project, which is problematic when .specify is committed to the project repo
  2. Worktree Conflicts: When using parallel execution with worktrees (Phase 2 feature), worktrees are created in .specify/worktrees/ which should not be committed
  3. 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

  1. spec-kit CLI (src/specify_cli/__init__.py):

    • Change git clonegit submodule add
    • Handle submodule update commands
  2. 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
  3. Auto-exclude Worktrees:

    • When creating worktree, append to .git/info/exclude
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions