diff --git a/src/agent/process-manager.ts b/src/agent/process-manager.ts index b3c6d83..f55a6c8 100644 --- a/src/agent/process-manager.ts +++ b/src/agent/process-manager.ts @@ -68,6 +68,13 @@ export class ProcessManager { baseBranch }, 'creating project worktrees'); + // No linked projects — fall back to standalone worktree so the agent + // always has a git-backed working directory. + if (projects.length === 0) { + log.info({ alias, initiativeId }, 'initiative has no linked projects, falling back to standalone worktree'); + return this.createStandaloneWorktree(alias); + } + for (const project of projects) { const clonePath = await ensureProjectClone(project, this.workspaceRoot); const worktreeManager = new SimpleGitWorktreeManager(clonePath, undefined, agentWorkdir);