# sync-worktrees - Doramagic AI Context Pack

> Positioning: a pre-install experience and judgment asset. It helps the host AI get off to a good start, but it does not mean the project has already been installed, run, or validated.

## Sufficiency Principle

- **Sufficiency over compression**: The AI Context Pack should be sufficient for the host AI to understand the project's value, capability boundaries, entrypoints, risks, and evidence sources before starting work; it may be layered, but it does not aim for the shortest possible summary.
- **Compression policy**: Compress only noise and duplication, never context that affects judgment or the quality of the work.

## How the Host AI Should Use This

You are reading the AI Context Pack that Doramagic compiled for sync-worktrees. Treat it as pre-work context: help the user understand who it fits, what it can do, how to start, what must be verified after install, and where the risks are. Do not claim that you have already installed, run, or executed the target project.

## Claim Consumption Rules

- **Fact source**: Repo Evidence + Claim/Evidence Graph; the Human Wiki only supplies salience, terminology, and narrative structure.
- **Minimum status for a fact**: `supported`
- `supported`: May be used as a project fact, but the answer must cite the claim_id and evidence path.
- `weak`: Usable only as a low-confidence lead; the user must be asked to keep verifying.
- `inferred`: Usable only for risk notes or open questions; must not be packaged as a project fact.
- `unverified`: Must not be used as fact; state clearly that evidence is insufficient.
- `contradicted`: Must show the conflicting sources and must not force a single version on the user's behalf.

## Who It Fits Best

- **Developers already using host AIs such as Claude/Codex/Cursor/Gemini**: The README or plugin config mentions multiple host AIs. Evidence: `README.md` Claim: `clm_0002` supported 0.86

## What It Can Do

- **Command-Line Startup or Install Flow** (Verify after install): The project documentation contains runnable commands; real use requires running them in a local or host environment. Evidence: `README.md` Claim: `clm_0001` supported 0.86

## How to Start

- `npm install -g sync-worktrees` Evidence: `README.md` Claim: `clm_0003` supported 0.86
- `claude mcp add sync-worktrees -- npx -y -p sync-worktrees sync-worktrees-mcp` Evidence: `README.md` Claim: `clm_0004` supported 0.86

## Continue-or-Stop Decision Card

- **Current recommendation**: Sandbox-trial permissions first
- **Why**: The project has signals of install commands, host configuration, or local writes; do not go straight into your primary environment—trial it in isolation first.

### 30-Second Read

- **What to do now**: Sandbox-trial permissions first
- **Minimum safe next step**: Run Prompt Preview first; if you still want to install, trial only in an isolated environment
- **Do not trust yet**: Tool permission boundaries cannot be trusted before install.
- **Continuing will touch**: Command execution, Local environment or project files, Host AI context

### What You Can Trust Now

- **Target-audience signal: Developers already using host AIs such as Claude/Codex/Cursor/Gemini** (supported): Backed by a supported claim or project evidence, but that still is not the same as real install results. Evidence: `README.md` Claim: `clm_0002` supported 0.86
- **Capability exists: Command-Line Startup or Install Flow** (supported): You can trust that the project contains signals of this capability; whether it fits your specific task still needs trial or after-install verification. Evidence: `README.md` Claim: `clm_0001` supported 0.86
- **There are Quick Start / install-command signals** (supported): You can trust that the docs mention a startup or install entrypoint; do not run it directly in your primary environment because of that. Evidence: `README.md` Claim: `clm_0003` supported 0.86

### What You Cannot Trust Yet

- **Tool permission boundaries cannot be trusted before install.** (unverified): MCP/tool projects usually touch files, the network, the browser, or external APIs, so permissions and logs must be checked for real.
- **Real output quality cannot be trusted before install.** (unverified): Prompt Preview can only show how it guides you; it cannot prove result quality in the real project.
- **Host AI version compatibility cannot be trusted before install.** (unverified): Host loading rules and version differences across Claude, Cursor, Codex, Gemini, and others must be verified in a real environment.
- **That it will not pollute your existing host AI's behavior cannot be trusted directly.** (inferred): Skill, plugin, and AGENTS/CLAUDE/GEMINI instructions may change the host AI's default behavior.
- **Safe rollback cannot be assumed by default.** (unverified): Unless the project clearly provides uninstall and recovery instructions, verify in an isolated environment first.
- **After a real install, is it compatible with the user's current host AI version?** (unverified): Compatibility can only be verified in the actual host environment.
- **Does the project's output quality meet the user's specific task?** (unverified): The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **Do the install commands require network access, permissions, or global writes?** (unverified): This affects install risk in both enterprise and personal environments. Evidence: `README.md`

### What Continuing Will Touch

- **Command execution**: Package managers, network downloads, the local plugin directory, project config, or the user's home directory. Why: Running the very first command can already change your environment; decide whether it is worth running first. Evidence: `README.md`
- **Local environment or project files**: Install results, plugin caches, project config, or local dependency directories. Why: The write scope and rollback path cannot be proven before install and need isolated verification. Evidence: `README.md`
- **Host AI context**: The AI Context Pack, Prompt Preview, Skill routing, risk rules, and project facts. Why: Importing context affects the host AI's later judgment, so avoid packaging unverified items as facts.

### Minimum Safe Next Steps

- **Run Prompt Preview first**: Use a pre-install interactive trial to judge whether the way of working fits; it needs no authorization or environment change. (applies when: Applies to any project, especially when output quality is unknown.)
- **Trial-install only in an isolated directory or a test account**: Avoid letting install commands pollute your primary host AI, real projects, or home directory. (applies when: When there are signals of command execution, plugin config, or local writes.)
- **After install, verify just one minimal task**: Verify loading, compatibility, output quality, and rollback first, then decide whether to use it deeply. (applies when: When moving from a trial into a real workflow.)

### Exit Plan

- **Preserve the pre-install state**: Record the original host config and project state so you can later judge whether it is recoverable.
- **Record the install commands and written paths**: Without clear uninstall instructions, you at least need to know which directories or configs to clean up manually.
- **If there is no rollback path, do not enter your primary environment**: No rollback is a blocker before continuing; do not proceed on trust or luck.

## What Can Only Be Previewed

- Explain who the project fits and what it can do
- Demonstrate a typical conversation flow based on project docs
- Help the user decide whether it is worth installing or researching further

## What Must Be Verified After Install

- Actually installing the Skill, plugin, or CLI
- Running scripts, modifying local files, or accessing external services
- Verifying real output quality, performance, and compatibility

## Boundary & Risk Decision Card

- **Mistaking the pre-install preview for a real run**: The user may overestimate how much configuration, permission, and compatibility verification the project has already done. Mitigation: Clearly separate prompt_preview_can_do from runtime_required. Claim: `clm_0005` inferred 0.45
- **Command execution will modify the local environment**: Install commands may write to the user's home directory, the host plugin directory, or project configuration. Mitigation: Run in an isolated environment or a test account first. Evidence: `README.md` Claim: `clm_0006` supported 0.86
- **To confirm**: After a real install, is it compatible with the user's current host AI version?. Why: Compatibility can only be verified in the actual host environment.
- **To confirm**: Does the project's output quality meet the user's specific task?. Why: The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **To confirm**: Do the install commands require network access, permissions, or global writes?. Why: This affects install risk in both enterprise and personal environments.

## Pre-Work Working Context

### Loading Order

- First read how_to_use.host_ai_instruction to establish the boundaries of this pre-install judgment asset.
- Read claim_graph_summary to confirm facts come from the Claim/Evidence Graph, not the Human Wiki narrative.
- Then read intended_users, capabilities, and quick_start_candidates to judge whether the user is a match.
- When you need to carry out a concrete task, check role_skill_index first, then evidence_index.
- For real install, file modification, network access, performance, or compatibility questions, turn to risk_card and boundaries.runtime_required.

### Task Routes

- **Command-Line Startup or Install Flow**: State that this is an after-install capability first, then give a pre-install checklist. Boundary: Must be verified after a real install or run. Evidence: `README.md` Claim: `clm_0001` supported 0.86

### Context Scale

- Total files: 210
- Important-file coverage: 40/210
- Evidence index entries: 56
- Role / Skill entries: 12

### Handling Insufficient Evidence

- **missing_evidence**: State that evidence is insufficient and ask the user for the target file, a README section, or after-install verification records; do not fill in facts.
- **out_of_scope_request**: State that the task is beyond the current AI Context Pack's evidence scope and suggest the user check the Human Manual or verify after a real install.
- **runtime_request**: Provide a pre-install checklist and command sources, but do not run commands for the user or claim they have been run.
- **source_conflict**: Show the conflicting sources side by side, mark them as unverified, and do not force a single version.

## Prompt Recipes

### Fit assessment

- Goal: Judge whether this project fits the user's current task.
- Expected output: A fit conclusion, key reasons, evidence citations, what can be previewed before install, what must be verified after install, and a next-step recommendation.

```text
Based on the AI Context Pack for sync-worktrees, ask me 3 necessary questions first, then judge whether it fits my task. The answer must cover: who it fits, what it can do, what it cannot do, whether it is worth installing, and where the evidence comes from. Every project fact must cite evidence_refs, source_paths, or a claim_id.
```

### Pre-install experience

- Goal: Let the user feel the core workflow before installing, while avoiding packaging the preview as real capability or a marketing promise.
- Expected output: An experience script with boundary labels, an after-install verification checklist, and a cautious recommendation; with no real-run promises or strong marketing language.

```text
Treat sync-worktrees as a pre-install experience asset, not an already-installed tool or a real runtime environment.

Output exactly four parts:
1. Ask me 3 necessary questions first.
2. Give an "experience script": use the three labels [Previewable before install], [Must verify after install], and [Insufficient evidence] to show how it might guide the workflow.
3. Give an after-install verification checklist: list which capabilities can only be confirmed after a real install, real host loading, and a real project run.
4. Give a cautious recommendation: only "worth researching/trialing further", "add information before deciding", or "not recommended to continue"; do not endorse the project.

Hard boundaries:
- Do not claim you have installed, run, executed tests, modified files, or produced real results.
- Do not write promise-like phrasing such as "auto-adapts", "guarantees passing", "perfect fit", or "strongly recommend installing".
- If you describe how it works after install, you must use a conditional such as "if installed successfully and the host loads the Skill correctly, it might...".
- The experience script may only be written as "example lines / hypothetical flow": use "might ask / might suggest / might show", not "has written, has generated, has passed, is running, is generating".
- Prompt Preview does not hand out install commands; if the user is ready to trial, only prompt them to read Quick Start and the Risk Card first and to verify in an isolated environment.
- Every project fact must come from a supported claim, evidence_refs, or source_paths; inferred/unverified items can only be risks or open questions.

```

### Role / Skill selection

- Goal: Pick the best-matching asset from the project's roles or Skills.
- Expected output: A list of candidate roles or Skills, each with an applicable scenario, evidence paths, risk boundary, and whether after-install verification is needed.

```text
Read role_skill_index and recommend 3-5 of the most relevant roles or Skills for my target task. For each recommendation, state the applicable scenario, likely output, risk boundary, and evidence_refs.
```

### Risk pre-check

- Goal: Identify environment, permission, rule-conflict, and quality risks before installing or adopting.
- Expected output: A checklist of environment, permission, dependency, license, host-conflict, quality risk, and unknown items.

```text
Based on risk_card, boundaries, and quick_start_candidates, give me a pre-install risk pre-check list. Do not run commands for me; only explain what I should check, why, and what impact a failure would have.
```

### Host AI kickoff instruction

- Goal: Turn the project context into a host AI instruction for the start of a conversation.
- Expected output: A pre-work instruction with clear boundaries and clear evidence citations, suitable to copy to a host AI.

```text
Based on the AI Context Pack for sync-worktrees, generate a pre-work instruction I can paste to my host AI. This instruction must obey not_runtime=true and must not claim the project has been installed, run, or produced real results.
```

## Role / Skill Index

- Indexed 12 role / Skill / project-doc entries.

- **Changesets** (project_doc): Hello and welcome! This folder has been automatically generated by @changesets/cli , a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it in our repository https://github.com/changesets/changesets Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `.changeset/README.md`
- **sync-worktrees** (project_doc): Keep every branch and every repo you work on checked out as predictable directories — no stashing, no re-cloning, no re-orienting your AI assistant. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `README.md`
- **Demo recording** (project_doc): Scripts to re record the README's demo GIF. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `demo-recording/README.md`
- **sync-worktrees** (project_doc): - 387b05e: Fix 20 code-review findings across safety, CLI, MCP, and config subsystems F1–F20 in REVIEW FINDINGS.md : orphan cleanup can no longer delete a bare repo nested in worktreeDir; filesToCopyOnBranchCreate works again patterns stay relative, absolute/escaping patterns rejected ; default branches containing / are detected correctly; MCP create worktree / update worktree fetch before acting; runOnce exit codes… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CHANGELOG.md`
- **Code Review Findings — 2026-07-07** (project_doc): Full-codebase review bugs + design issues . Each finding is written as a self-contained task spec: an agent should be able to implement it from this document alone, without the original review conversation. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `REVIEW_FINDINGS.md`
- **01 Worktree Vs Sync** (project_doc): git worktree is the underlying Git primitive: a single command that adds one extra working directory backed by a shared .git database it works with any repo, bare or not . sync-worktrees is a workspace orchestrator built on top of it — in worktree mode it sets up a bare repo, creates a directory for every selected remote branch automatically, prunes them when branches are deleted upstream, and keeps the whole thing… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/01-worktree-vs-sync.md`
- **02 Vs Cloning** (project_doc): Cloning duplicates the entire Git object database for every branch — wasteful on disk and slow to refresh. Worktrees share one .git directory among many checkouts, so disk usage scales with working-tree size, not with branch count. sync-worktrees automates the bookkeeping you'd otherwise have to do manually creating worktrees for new remote branches, removing stale ones, handling force-pushes safely . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/02-vs-cloning.md`
- **03 Mcp Agents** (project_doc): The bundled sync-worktrees-mcp binary exposes its tools over MCP stdio . detect context , list worktrees , create worktree , and sync let an agent discover every configured sibling repo and worktree in one detect context call, so "go look in the other repo" works without manual re-orientation. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/03-mcp-agents.md`
- **04 Monorepos** (project_doc): Yes. Per-repo branch include/exclude globs and sparse-checkout support let you scope each worktree to the slice of the monorepo you actually care about. Combined with branchMaxAge to ignore stale branches, this keeps multi-million-line monorepos manageable on disk. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/04-monorepos.md`
- **05 Force Push Delete** (project_doc): Force-pushes are detected and the divergent working copy is moved aside into a .diverged/ directory rather than overwritten — uncommitted work is never silently lost. Deleted branches have their worktrees removed only if they are clean, with no unpushed commits, no stashes, and no operation in progress; anything else is preserved and surfaced in the TUI's status view. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/05-force-push-delete.md`
- **06 Cron** (project_doc): Yes. The default invocation launches the interactive TUI and syncs continuously based on the cronSchedule field in your config per-repo overrides are supported . For one-shot or scripted use, pass --runOnce . For CI pipelines, point --config at your workspace config and the same one-shot path applies. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/06-cron.md`
- **07 Uncommitted Safety** (project_doc): Yes. Sync operations never merge or rebase your working copies. They fetch, create missing worktrees, fast-forward eligible existing worktrees, and prune only when the safety checks pass. Worktree removal refuses on dirty trees, unpushed commits, stashes, or in-progress operations merge/rebase/cherry-pick/revert/bisect . Newly created branches are pushed with explicit --no-track so they don't inherit origin/main as… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `site/src/content/faq/07-uncommitted-safety.md`

## Evidence Index

- Indexed 56 evidence entries.

- **Changesets** (documentation): Hello and welcome! This folder has been automatically generated by @changesets/cli , a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it in our repository https://github.com/changesets/changesets Evidence: `.changeset/README.md`
- **sync-worktrees** (documentation): Keep every branch and every repo you work on checked out as predictable directories — no stashing, no re-cloning, no re-orienting your AI assistant. Evidence: `README.md`
- **Demo recording** (documentation): Scripts to re record the README's demo GIF. Evidence: `demo-recording/README.md`
- **Package** (package_manifest): { "name": "sync-worktrees", "version": "5.1.1", "type": "module", "description": "Automatically synchronize Git worktrees with remote branches - perfect for multi-branch development workflows", "main": "dist/index.js", "types": "dist/index.d.ts", "bin": { "sync-worktrees": "dist/index.js", "sync-worktrees-mcp": "dist/mcp-server.js" }, "scripts": { "build": "node esbuild.config.js && tsc --emitDeclarationOnly", "start": "node dist/index.js", "watch": "tsc --watch", "lint": "eslint .", "lint:fix": "eslint . --fix", "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.spec.json", "test": "vitest run", "test:e2e:local": "npm run build && vitest run src/ tests /e2e", "test:e2e:network": "npm r… Evidence: `package.json`
- **Package** (package_manifest): { "name": "sync-worktrees-site", "version": "0.1.0", "private": true, "type": "module", "description": "Marketing landing page for sync-worktrees", "scripts": { "prebuild": "node scripts/copy-assets.mjs && node scripts/generate-og-image.mjs", "dev": "astro dev", "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { "@astrojs/mdx": "^5.0.6", "@astrojs/sitemap": "^3.7.2", "@fontsource/inter": "^5.2.8", "@fontsource/jetbrains-mono": "^5.2.8", "@tailwindcss/typography": "^0.5.19", "@tailwindcss/vite": "^4.3.0", "astro": "^6.3.7", "tailwindcss": "^4.3.0", "vite": "^7.3.3" }, "devDependencies": { "@astrojs/check": "^0.9.9", "@playwright/te… Evidence: `site/package.json`
- **License** (source_file): Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Evidence: `LICENSE`
- **Index** (source_file): import { realpathSync } from "fs"; ⋮---- import { fileURLToPath } from "url"; ⋮---- import pLimit from "p-limit"; ⋮---- import { DEFAULT CONFIG } from "./constants"; import { ConfigFileExistsError, ConfigFileNotFoundError } from "./errors"; import { ConfigLoaderService } from "./services/config-loader.service"; import { InteractiveUIService } from "./services/InteractiveUIService"; import { Logger } from "./services/logger.service"; import { WorktreeSyncService } from "./services/worktree-sync.service"; import { CLI COMMANDS, parseArguments } from "./utils/cli"; import { formatCloneSkipReason } from "./utils/clone-skip-format"; import { findConfigInCwd, generateConfigFile, getDefaultConfigP… Evidence: `src/index.ts`
- **App** (source_file): import React, { useState, useEffect, useCallback, useRef } from "react"; import { Box, useInput, useWindowSize } from "ink"; import StatusBar from "./StatusBar"; import HelpModal from "./HelpModal"; import BranchCreationWizard from "./BranchCreationWizard"; import OpenEditorWizard from "./OpenEditorWizard"; import WorktreeStatusView from "./WorktreeStatusView"; import LogPanel from "./LogPanel"; import type { AppEventEmitter } from "../utils/app-events"; import type { AppSyncProgress } from "../utils/app-events"; import type { HookContext, WorktreeStatusEntry, DivergedDirectoryInfo, RepositoryListEntry, RepositoryDiskUsage, } from "../types"; ⋮---- export interface AppProps { events: AppEve… Evidence: `src/components/App.tsx`
- **Branchcreationwizard** (source_file): import React, { useState, useEffect, useCallback, useMemo, useRef } from "react"; import { Box, Text, useInput, usePaste } from "ink"; ⋮---- import { isValidGitBranchName } from "../utils/git-validation"; ⋮---- type WizardStep = "SELECT PROJECT" "SELECT BRANCH" "ENTER NAME" "CREATING" "RESULT"; ⋮---- export interface BranchCreationWizardProps { repositories: Array ; getBranchesForRepo: index: number = Promise ; getDefaultBranchForRepo: index: number = string; fetchForRepo?: index: number = Promise ; createAndPushBranch: repoIndex: number, baseBranch: string, branchName: string, = Promise ; onClose: = void; onComplete: success: boolean = void; onBranchCreated?: context: { repoIndex: number;… Evidence: `src/components/BranchCreationWizard.tsx`
- **Openeditorwizard** (source_file): import React, { useState, useEffect, useMemo, useCallback, useRef } from "react"; import { Box, Text, useInput, usePaste } from "ink"; ⋮---- type WizardStep = "SELECT PROJECT" "SELECT WORKTREE" "OPENING" "ERROR"; ⋮---- export type OpenAction = "terminal" "editor"; ⋮---- export interface OpenEditorWizardProps { repositories: Array ; getWorktreesForRepo: index: number = Promise ; openEditorInWorktree: worktreePath: string = { success: boolean; error?: string }; openTerminalInWorktree: repoIndex: number, worktreePath: string, branchName: string, = { success: boolean; error?: string }; onClose: = void; } ⋮---- const handleOpen = = ⋮---- const getStepNumber = = ⋮---- const getTotalSteps = ⋮----… Evidence: `src/components/OpenEditorWizard.tsx`
- **Statusbar** (source_file): import React, { useState, useEffect } from "react"; import { Box, Text } from "ink"; import { CronExpressionParser } from "cron-parser"; ⋮---- import type { AppSyncProgress } from "../utils/app-events"; ⋮---- export interface StatusBarProps { status: "idle" "syncing"; syncProgressEntries?: AppSyncProgress ; activeOps?: string ; maxProgressLines?: number; repositoryCount: number; lastSyncTime: Date null; cronSchedule?: string; diskSpaceUsed?: string; } ⋮---- const formatTime = date: Date null : string = ⋮---- const getStatusColor = : "green" "yellow" = ⋮---- const getStatusIcon = : string = ⋮---- const formatProgress = syncProgress: AppSyncProgress : string = $ ⋮---- Evidence: `src/components/StatusBar.tsx`
- **Worktreestatusview** (source_file): import React, { useState, useEffect, useMemo, useCallback, useRef } from "react"; import { Box, Text, useInput, usePaste } from "ink"; ⋮---- import type { WorktreeStatusResult } from "../services/worktree-status.service"; import type { WorktreeStatusEntry, DivergedDirectoryInfo, RepositoryListEntry, RepositoryDiskUsage, } from "../types"; import { getErrorMessage } from "../utils/lfs-error"; ⋮---- type ViewStep = "SELECT PROJECT" "VIEW STATUS" "ERROR"; ⋮---- export interface WorktreeStatusViewProps { repositories: RepositoryListEntry ; getWorktreeStatusForRepo: index: number = Promise ; getRepositoryDiskUsage?: index: number = Promise ; getDivergedDirectoriesForRepo?: index: number = Promis… Evidence: `src/components/WorktreeStatusView.tsx`
- **Index** (source_file): import { ERROR MESSAGES } from "../constants"; ⋮---- export class SyncWorktreesError extends Error ⋮---- constructor message: string, public readonly code: string, public readonly cause?: Error, ⋮---- export class GitError extends SyncWorktreesError ⋮---- constructor message: string, code: string, cause?: Error ⋮---- export class GitNotInitializedError extends GitError ⋮---- constructor ⋮---- export class GitOperationError extends GitError ⋮---- constructor operation: string, details: string, cause?: Error ⋮---- export class FastForwardError extends GitError ⋮---- constructor public readonly branchName: string, cause?: Error, ⋮---- export class WorktreeError extends SyncWorktreesError ⋮----… Evidence: `src/errors/index.ts`
- **Index** (source_file): import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; ⋮---- import { RepositoryContext } from "./context"; import { createServer } from "./server"; ⋮---- import type { DiscoveredRepoContext } from "./context"; ⋮---- async function main : Promise Evidence: `src/mcp/index.ts`
- **Server** (source_file): import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; ⋮---- import { buildUnsupportedContext } from "./context"; import { handleCreateWorktree, handleDetectContext, handleGetWorktreeStatus, handleInitialize, handleListWorktrees, handleLoadConfig, handleSetCurrentRepository, handleSync, handleUpdateWorktree, } from "./handlers"; import { wrapHandler } from "./utils"; ⋮---- import type { DiscoveredRepoContext, RepositoryContext } from "./context"; ⋮---- export interface ServerSnapshot { discovered: DiscoveredRepoContext null; configuredRepoCount?: number; } ⋮---- export function buildInstructions snapshot?: ServerSnapshot : string ⋮---- export function… Evidence: `src/mcp/server.ts`
- **Interactiveuiservice** (source_file): import React from "react"; ⋮---- import { render, Instance } from "ink"; ⋮---- import pLimit from "p-limit"; import { spawn, spawnSync } from "child process"; import { existsSync } from "fs"; import App from "../components/App"; import { DEFAULT CONFIG } from "../constants"; import { WorktreeSyncService } from "./worktree-sync.service"; import { ConfigLoaderService } from "./config-loader.service"; import { BranchCreatedActionsService } from "./branch-created-actions.service"; import { HookExecutionService } from "./hook-execution.service"; import { PathResolutionService } from "./path-resolution.service"; import { Logger, LogOutputFn, LogLevel } from "./logger.service"; import { formatClon… Evidence: `src/services/InteractiveUIService.tsx`
- **Clone Sync.Service** (source_file): import simpleGit from "simple-git"; ⋮---- import { DEFAULT CONFIG, ENV CONSTANTS, PATH CONSTANTS } from "../constants"; import { ConfigError, FastForwardError, GitOperationError, WorktreeNotCleanError } from "../errors"; import { fileExists } from "../utils/file-exists"; import { makeGitProgressHandler } from "../utils/git-progress"; import { normalizeRepoUrlForComparison } from "../utils/git-url"; import { getErrorMessage, isLfsError, isMissingRemoteRefError } from "../utils/lfs-error"; ⋮---- import { BranchCreatedActionsService } from "./branch-created-actions.service"; import { cloneSkipToOutcomeAction } from "./sync-outcome"; ⋮---- import type { GitService } from "./git.service"; import… Evidence: `src/services/clone-sync.service.ts`
- **Config Loader.Service** (source_file): import { createRequire } from "module"; ⋮---- import { pathToFileURL } from "url"; ⋮---- import { CONFIG FILE NAMES, DEFAULT CONFIG } from "../constants"; import { ConfigFileNotFoundError, ConfigValidationError, SyncWorktreesError } from "../errors"; import { matchesPattern } from "../utils/branch-filter"; import { parseDuration } from "../utils/date-filter"; import { fileExists } from "../utils/file-exists"; import { getDefaultBareRepoDir } from "../utils/git-url"; import { normalizePathForCompare } from "../utils/path-compare"; import { REPOSITORY MODES, isRepositoryMode } from "../utils/repo-mode"; import { sanitizeNameForPath } from "../utils/sanitize-name"; ⋮---- import type { Config,… Evidence: `src/services/config-loader.service.ts`
- **Git Maintenance.Service** (source_file): import simpleGit from "simple-git"; ⋮---- import { DEFAULT CONFIG, MAINTENANCE CONSTANTS, PATH CONSTANTS } from "../constants"; import { atomicWriteFile } from "../utils/atomic-write"; import { parseDuration } from "../utils/date-filter"; import { getErrorMessage } from "../utils/lfs-error"; import { REPOSITORY MODES, resolveMode } from "../utils/repo-mode"; ⋮---- import { Logger } from "./logger.service"; ⋮---- import type { Config } from "../types"; import type { GitService } from "./git.service"; import type { SimpleGit } from "simple-git"; ⋮---- export interface MaintenanceState { lastAttemptAt?: string; lastSuccessAt?: string; lastFailureAt?: string; lastError?: string; } ⋮---- interfa… Evidence: `src/services/git-maintenance.service.ts`
- **Git.Service** (source_file): import simpleGit from "simple-git"; ⋮---- import { DEFAULT CONFIG, ENV CONSTANTS, GIT CONSTANTS, PATH CONSTANTS } from "../constants"; import { GitOperationError, WorktreeError, WorktreeNotCleanError } from "../errors"; import { probePathExists } from "../utils/file-exists"; import { makeGitProgressHandler } from "../utils/git-progress"; import { getDefaultBareRepoDir } from "../utils/git-url"; import { getErrorMessage } from "../utils/lfs-error"; import { quarantineDirectory } from "../utils/quarantine"; import { parseWorktreeListPorcelain } from "../utils/worktree-list-parser"; ⋮---- import { Logger } from "./logger.service"; import { SparseCheckoutService } from "./sparse-checkout.servic… Evidence: `src/services/git.service.ts`
- **Removal Audit.Service** (source_file): import type { WorktreeStatusResult } from "./worktree-status.service"; ⋮---- export type RemovalAuditAction = "prune remove" "orphan delete" "orphan quarantine" "diverged replace" "manual remove" "trash create" "trash adopt" "trash restore" "trash reap"; ⋮---- export interface RemovalAuditEntry { action: RemovalAuditAction; result: "attempt" "success" "failure"; path: string; branch?: string; status?: WorktreeStatusResult; quarantinePath?: string; trashId?: string; trashPath?: string; error?: string; } ⋮---- export class RemovalAuditService ⋮---- constructor private readonly logFilePath: string ⋮---- async record entry: RemovalAuditEntry : Promise Evidence: `src/services/removal-audit.service.ts`
- **Repo Operation Lock** (source_file): import { DEFAULT CONFIG, ENV CONSTANTS } from "../constants"; import { getErrorMessage } from "../utils/lfs-error"; import { getCloneModeLockTarget } from "../utils/lock-path"; import { REPOSITORY MODES, resolveMode } from "../utils/repo-mode"; ⋮---- import { Logger } from "./logger.service"; ⋮---- import type { Config } from "../types"; import type { GitService } from "./git.service"; ⋮---- export type RepoLockRelease = = Promise ; ⋮---- export class RepoOperationLock ⋮---- constructor ⋮---- updateLogger logger: Logger : void ⋮---- async acquire : Promise ⋮---- private async acquireCloneModeLock : Promise ⋮---- private async acquireWorktreeModeLock : Promise ⋮---- private async lockPath lo… Evidence: `src/services/repo-operation-lock.ts`
- **Trash Migration.Service** (source_file): import { DEFAULT CONFIG, GIT CONSTANTS, METADATA CONSTANTS } from "../constants"; import { getErrorMessage } from "../utils/lfs-error"; ⋮---- import type { Logger } from "./logger.service"; import type { TrashService } from "./trash.service"; import type { Config } from "../types"; ⋮---- interface DivergedInfo { originalBranch?: string; divergedAt?: string; originalPath?: string; localCommit?: string; } ⋮---- export class TrashMigrationService ⋮---- constructor ⋮---- updateLogger logger: Logger : void ⋮---- isEnabled : boolean ⋮---- async migrateLegacyUnlocked : Promise ⋮---- private async migrateRemovedDir : Promise ⋮---- private async migrateDivergedDir : Promise ⋮---- private async listD… Evidence: `src/services/trash-migration.service.ts`
- **Trash Reaper.Service** (source_file): import { GIT CONSTANTS } from "../constants"; import { formatBytes } from "../utils/disk-space"; import { getErrorMessage } from "../utils/lfs-error"; import { computeTrashRootHash } from "../utils/trash-root-hash"; ⋮---- import { summarizeTrashEntries } from "./trash.service"; ⋮---- import type { GitService } from "./git.service"; import type { Logger } from "./logger.service"; import type { RemovalAuditService } from "./removal-audit.service"; import type { TrashEntry, TrashService } from "./trash.service"; import type { Config } from "../types"; ⋮---- export class TrashReaperService ⋮---- constructor ⋮---- updateLogger logger: Logger : void ⋮---- async reapExpiredUnlocked now: Date = new… Evidence: `src/services/trash-reaper.service.ts`
- **Trash.Service** (source_file): import { randomBytes } from "crypto"; ⋮---- import { DEFAULT CONFIG, GIT CONSTANTS, PATH CONSTANTS, TRASH CONSTANTS } from "../constants"; import { TrashOperationError } from "../errors"; import { atomicWriteFile } from "../utils/atomic-write"; import { calculateDirectorySize } from "../utils/disk-space"; import { probePathExists } from "../utils/file-exists"; import { filenameTimestamp } from "../utils/filename-timestamp"; import { getErrorMessage } from "../utils/lfs-error"; import { computeTrashRootHash } from "../utils/trash-root-hash"; ⋮---- import type { GitService } from "./git.service"; import type { Logger } from "./logger.service"; import type { RemovalAuditService } from "./remov… Evidence: `src/services/trash.service.ts`
- **Worktree Mode Sync Runner** (source_file): import pLimit from "p-limit"; ⋮---- import { DEFAULT CONFIG, ERROR MESSAGES, GIT CONSTANTS, METADATA CONSTANTS, PATH CONSTANTS } from "../constants"; import { TrashOperationError, WorktreeNotCleanError } from "../errors"; import { filterBranchesByName } from "../utils/branch-filter"; import { filterBranchesByAge, formatDuration } from "../utils/date-filter"; import { probePathExists } from "../utils/file-exists"; import { getErrorMessage, isLfsError } from "../utils/lfs-error"; import { getRemovalAuditLogPath } from "../utils/lock-path"; import { normalizePathForCompare } from "../utils/path-compare"; import { quarantineDirectory } from "../utils/quarantine"; ⋮---- import { PathResolutionSe… Evidence: `src/services/worktree-mode-sync-runner.ts`
- **Worktree Sync Planner** (source_file): import { PathResolutionService } from "./path-resolution.service"; ⋮---- import type { SparseCheckoutConfig } from "../types"; ⋮---- export interface WorktreeInventory { remoteBranches: string ; defaultBranch: string; existingWorktrees: WorktreeEntry ; worktreeDir: string; } ⋮---- export interface WorktreeEntry { path: string; branch: string; } ⋮---- export type CreateAction = { kind: "create"; branch: string; path: string } { kind: "skip-create"; branch: string; path: string; reason: "path-collision"; conflictingBranch: string }; ⋮---- export type PruneAction = { kind: "check-prune"; branch: string; path: string }; ⋮---- export type UpdateAction = { kind: "update-candidate"; branch: string… Evidence: `src/services/worktree-sync-planner.ts`
- **Worktree Sync.Service** (source_file): import pLimit from "p-limit"; ⋮---- import { ENV CONSTANTS } from "../constants"; import { ConfigError, TrashOperationError } from "../errors"; import { getErrorMessage } from "../utils/lfs-error"; import { getRemovalAuditLogPath } from "../utils/lock-path"; import { REPOSITORY MODES, resolveMode } from "../utils/repo-mode"; import { retry } from "../utils/retry"; import { PhaseTimer, Timer, formatTimingTable } from "../utils/timing"; ⋮---- import { type CloneSkipReason, CloneSyncService } from "./clone-sync.service"; import { GitMaintenanceService } from "./git-maintenance.service"; import { GitService } from "./git.service"; import { Logger } from "./logger.service"; import { ProgressEmit… Evidence: `src/services/worktree-sync.service.ts`
- **Index** (source_file): import type { Logger } from "../services/logger.service"; import type { WorktreeStatusResult } from "../services/worktree-status.service"; ⋮---- export interface RetryConfig { maxAttempts?: number "unlimited"; maxLfsRetries?: number; initialDelayMs?: number; maxDelayMs?: number; backoffMultiplier?: number; jitterMs?: number; } ⋮---- export interface HookContext { branchName: string; worktreePath: string; repoName: string; baseBranch: string; repoUrl: string; } ⋮---- export interface HooksConfig { onBranchCreated?: string ; } ⋮---- export type SparseCheckoutMode = "cone" "no-cone"; ⋮---- export interface SparseCheckoutConfig { include: string ; exclude?: string ; mode?: SparseCheckoutMode; s… Evidence: `src/types/index.ts`
- **Cli** (source_file): import yargs from "yargs"; import { hideBin } from "yargs/helpers"; ⋮---- export type CliCommand = typeof CLI COMMANDS keyof typeof CLI COMMANDS ; ⋮---- export type CliOptions = { command: typeof CLI COMMANDS.RUN; config?: string; runOnce: boolean } { command: typeof CLI COMMANDS.INIT; config?: string; force: boolean } { command: typeof CLI COMMANDS.LIST; config?: string; filter?: string }; ⋮---- export function parseArguments argv: string = hideBin process.argv : CliOptions Evidence: `src/utils/cli.ts`
- **Config Generator** (source_file): import { CONFIG FILE NAMES } from "../constants"; import { ConfigFileExistsError } from "../errors"; ⋮---- import { fileExists } from "./file-exists"; import { extractRepoNameFromUrl } from "./git-url"; ⋮---- import type { InitConfigInput, InitRepositoryInput } from "../types"; ⋮---- type SerializableValue = string number boolean null undefined SerializableObject SerializableValue ; interface SerializableObject { key: string : SerializableValue; } ⋮---- function serializeToESM obj: SerializableValue, indent: number = 0 : string ⋮---- export interface GenerateConfigFileOptions { overwrite?: boolean; } ⋮---- function toConfigRelativePath configDir: string, target: string : string ⋮---- functi… Evidence: `src/utils/config-generator.ts`
- **sync-worktrees** (documentation): - 387b05e: Fix 20 code-review findings across safety, CLI, MCP, and config subsystems F1–F20 in REVIEW FINDINGS.md : orphan cleanup can no longer delete a bare repo nested in worktreeDir; filesToCopyOnBranchCreate works again patterns stay relative, absolute/escaping patterns rejected ; default branches containing / are detected correctly; MCP create worktree / update worktree fetch before acting; runOnce exit codes no longer mask failures SIGINT exits 130, per-repo runOnce rejected in favor of defaults.runOnce ; diverged-replace preserves stashes; trash pin refs are namespaced per trash root; config validation rejects malformed branchInclude / branchExclude / branchMaxAge /parallelism valu… Evidence: `CHANGELOG.md`
- **Code Review Findings — 2026-07-07** (documentation): Full-codebase review bugs + design issues . Each finding is written as a self-contained task spec: an agent should be able to implement it from this document alone, without the original review conversation. Evidence: `REVIEW_FINDINGS.md`
- **01 Worktree Vs Sync** (documentation): git worktree is the underlying Git primitive: a single command that adds one extra working directory backed by a shared .git database it works with any repo, bare or not . sync-worktrees is a workspace orchestrator built on top of it — in worktree mode it sets up a bare repo, creates a directory for every selected remote branch automatically, prunes them when branches are deleted upstream, and keeps the whole thing fresh on a cron schedule. It also ships an interactive TUI and an MCP server so AI agents can navigate and operate the workspace. Evidence: `site/src/content/faq/01-worktree-vs-sync.md`
- **02 Vs Cloning** (documentation): Cloning duplicates the entire Git object database for every branch — wasteful on disk and slow to refresh. Worktrees share one .git directory among many checkouts, so disk usage scales with working-tree size, not with branch count. sync-worktrees automates the bookkeeping you'd otherwise have to do manually creating worktrees for new remote branches, removing stale ones, handling force-pushes safely . Evidence: `site/src/content/faq/02-vs-cloning.md`
- **03 Mcp Agents** (documentation): The bundled sync-worktrees-mcp binary exposes its tools over MCP stdio . detect context , list worktrees , create worktree , and sync let an agent discover every configured sibling repo and worktree in one detect context call, so "go look in the other repo" works without manual re-orientation. Evidence: `site/src/content/faq/03-mcp-agents.md`
- **04 Monorepos** (documentation): Yes. Per-repo branch include/exclude globs and sparse-checkout support let you scope each worktree to the slice of the monorepo you actually care about. Combined with branchMaxAge to ignore stale branches, this keeps multi-million-line monorepos manageable on disk. Evidence: `site/src/content/faq/04-monorepos.md`
- **05 Force Push Delete** (documentation): Force-pushes are detected and the divergent working copy is moved aside into a .diverged/ directory rather than overwritten — uncommitted work is never silently lost. Deleted branches have their worktrees removed only if they are clean, with no unpushed commits, no stashes, and no operation in progress; anything else is preserved and surfaced in the TUI's status view. Evidence: `site/src/content/faq/05-force-push-delete.md`
- **06 Cron** (documentation): Yes. The default invocation launches the interactive TUI and syncs continuously based on the cronSchedule field in your config per-repo overrides are supported . For one-shot or scripted use, pass --runOnce . For CI pipelines, point --config at your workspace config and the same one-shot path applies. Evidence: `site/src/content/faq/06-cron.md`
- **07 Uncommitted Safety** (documentation): Yes. Sync operations never merge or rebase your working copies. They fetch, create missing worktrees, fast-forward eligible existing worktrees, and prune only when the safety checks pass. Worktree removal refuses on dirty trees, unpushed commits, stashes, or in-progress operations merge/rebase/cherry-pick/revert/bisect . Newly created branches are pushed with explicit --no-track so they don't inherit origin/main as upstream by accident. Evidence: `site/src/content/faq/07-uncommitted-safety.md`
- **Config** (structured_config): { "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", "changelog": "@changesets/cli/changelog", "commit": false, "fixed": , "linked": , "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": } Evidence: `.changeset/config.json`
- **Tsconfig** (structured_config): { "extends": "astro/tsconfigs/strict", "include": "src/ / ", ".astro/types.d.ts" , "exclude": "dist", "node modules" } Evidence: `site/tsconfig.json`
- **Tsconfig.Eslint** (structured_config): { "extends": "./tsconfig.json", "compilerOptions": { "noEmit": true }, "include": "src/ / ", "src/ / tests / / ", "src/ / .test.ts", "src/ / .spec.ts", "vitest.config.ts" , "exclude": "node modules", "dist" } Evidence: `tsconfig.eslint.json`
- **Tsconfig** (structured_config): { "compilerOptions": { "target": "ES2022", "module": "ESNext", "lib": "ES2022" , "types": "node", "react" , "jsx": "react", "moduleResolution": "bundler", "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "resolvePackageJsonExports": true, "declaration": true, "declarationMap": true, "sourceMap": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true }, "include": "src/ / " , "exclude": "node modules", "dist", "src/ / tests / / ", "src/ / .test.ts", "src/ / .spec.ts" } Evidence: `tsconfig.json`
- **Local Codex CLI config** (source_file): node modules/ dist/ .log .DS Store .env .env.local coverage/ .nyc output/ .tsbuildinfo Evidence: `.gitignore`
- **.prettierrc** (source_file): { "printWidth": 120 } Evidence: `.prettierrc`
- **Cname** (source_file): sync-worktrees.com Evidence: `CNAME`
- **Convert To Gif** (source_file): set -euo pipefail SCRIPT DIR="$ cd "$ dirname "${BASH SOURCE 0 }" " && pwd " REPO ROOT="$ cd "$SCRIPT DIR/.." && pwd " CAST IN="$SCRIPT DIR/demo-sync-worktrees.cast" GIF RAW="$SCRIPT DIR/demo-sync-worktrees.raw.gif" GIF OUT="$REPO ROOT/assets/sync-worktrees-demo-optimized.gif" if ! -f "$CAST IN" ; then echo "Missing $CAST IN — run ./demo-recording/record-demo.sh first." &2 exit 1 fi for tool in agg gifsicle; do if ! command -v "$tool" /dev/null 2 &1; then echo "$tool not installed. Run: brew install $tool" &2 exit 1 fi done echo "→ agg: cast → raw gif" agg "$CAST IN" "$GIF RAW" \ --theme monokai \ --font-size 14 echo "→ gifsicle: optimize" gifsicle -O3 --colors 256 --lossy=30 -o "$GIF OUT"… Evidence: `demo-recording/convert-to-gif.sh`
- **Prefer the built binary; fall back to ts-node dev runner if not built.** (source_file): set -euo pipefail GREEN='\033 0;32m' NC='\033 0m' SCRIPT DIR="$ cd "$ dirname "${BASH SOURCE 0 }" " && pwd " REPO ROOT="$ cd "$SCRIPT DIR/.." && pwd " CONFIG="$SCRIPT DIR/sync-worktrees.config.js" clear echo -e "${GREEN}🌳 sync-worktrees demo — launching TUI${NC}" echo "" sleep 1 Prefer the built binary; fall back to ts-node dev runner if not built. if -f "$REPO ROOT/dist/index.js" ; then node "$REPO ROOT/dist/index.js" --config "$CONFIG" else echo "dist/ not found — run 'pnpm build' first." &2 exit 1 fi Evidence: `demo-recording/demo.sh`
- **Drive Record** (source_file): set -euo pipefail SCRIPT DIR="$ cd "$ dirname "${BASH SOURCE 0 }" " && pwd " REPO ROOT="$ cd "$SCRIPT DIR/.." && pwd " SESSION="swt-demo" CAST="$SCRIPT DIR/demo-sync-worktrees.cast" COLS=100 ROWS=28 cd "$REPO ROOT" if tmux has-session -t "$SESSION" 2 /dev/null; then echo "Refusing to overwrite existing tmux session '$SESSION'." &2 exit 1 fi rm -f "$CAST" tmux new-session -d -s "$SESSION" -x "$COLS" -y "$ROWS" \ "cd '$REPO ROOT' && asciinema rec --quiet --overwrite --command '$SCRIPT DIR/demo.sh' '$CAST'" cleanup { tmux kill-session -t "$SESSION" 2 /dev/null true } trap cleanup EXIT echo "→ waiting for TUI to render..." for i = 0; i /dev/null; then echo "Session died before TUI rendered." &2… Evidence: `demo-recording/drive-record.sh`
- **Record Demo** (source_file): set -euo pipefail SCRIPT DIR="$ cd "$ dirname "${BASH SOURCE 0 }" " && pwd " REPO ROOT="$ cd "$SCRIPT DIR/.." && pwd " CAST OUT="$SCRIPT DIR/demo-sync-worktrees.cast" FIXTURE DIR="$SCRIPT DIR/fixture" cd "$REPO ROOT" if ! -f "dist/index.js" ; then echo "→ dist/ missing, building..." npx pnpm build fi echo "→ cleaning fixture state at $FIXTURE DIR" rm -rf "$FIXTURE DIR" "$CAST OUT" if ! command -v asciinema /dev/null 2 &1; then echo "asciinema not installed. Run: brew install asciinema" &2 exit 1 fi cat <<'BANNER' ──────────────────────────────────────────────────────────────────── Recording starts in 3 seconds. Once the TUI is up and the initial sync log shows two repos synced, press: w → E… Evidence: `demo-recording/record-demo.sh`
- **Eslint.Config** (source_file): // Prettier integration ⋮---- // Import organization ⋮---- // TypeScript specific rules ⋮---- // Base ESLint recommended configuration ⋮---- // TypeScript files - base configuration ⋮---- // Override some base rules for TypeScript "no-unused-vars": "off", // Use @typescript-eslint/no-unused-vars instead "no-undef": "off", // TypeScript handles this ⋮---- // Test files - relaxed rules ⋮---- // JavaScript config files and site build tooling ⋮---- // Files to ignore ⋮---- // The site/ workspace has its own toolchain astro check ; don't lint it from the root. Evidence: `eslint.config.cjs`
- **Optional PostHog analytics for the marketing site.** (source_file): Optional PostHog analytics for the marketing site. PUBLIC POSTHOG KEY= PUBLIC POSTHOG HOST=https://eu.i.posthog.com Evidence: `site/.env.example`
- **site/.gitignore** (source_file): .env Evidence: `site/.gitignore`
- **Tailwind.Config** (source_file): / @type {import 'tailwindcss' .Config} / Evidence: `site/tailwind.config.mjs`
- **Vitest.Config** (source_file): import path from "path"; ⋮---- import { defineConfig } from "vitest/config"; Evidence: `vitest.config.ts`

## Rules the Host AI Must Follow

- **Treat this asset as pre-work context, not a runtime environment.**: The AI Context Pack contains only an evidence-backed understanding of the project, not the project's executable state. Evidence: `.changeset/README.md`, `README.md`, `demo-recording/README.md`
- **When answering the user, distinguish what can be previewed from what can only be verified after install.**: The consumer value of the pre-install experience comes from reducing bad installs and misjudgments, not from pretending to be a real run. Evidence: `.changeset/README.md`, `README.md`, `demo-recording/README.md`

## Questions the User Should Answer First

- Which host AI or local environment do you plan to use it in?
- Do you just want to experience the workflow first, or are you ready to actually install?
- What matters most to you: install cost, output quality, or conflicts with your existing rules?

## Acceptance Checks

- Every capability claim can be traced back to a file path in evidence_refs.
- AI_CONTEXT_PACK.md does not package previews as a real run.
- The user can understand who it fits, what it can do, how to start, and the risk boundaries within 3 minutes.

---

## Doramagic Context Augmentation

The following sections strengthen the repository context for a host AI. Human Manual data is a reading route, and pitfall notes become operating constraints.

## Human Manual Outline

Usage rule: this is only a reading route and salience signal, not factual authority. Concrete claims must still return to repo evidence or Claim Graph.

Host AI hard rules:
- Do not treat page titles, section order, summaries, or importance values as factual project evidence.
- When explaining the Human Manual outline, state that it is only a reading route or salience signal.
- Capability, installation, compatibility, runtime state, and risk claims must cite repo evidence, source paths, or Claim Graph.

- **Overview, Modes, and Configuration**: importance `high`
  - source_paths: README.md, sync-worktrees.config.example.js, src/index.ts, src/types/index.ts, src/utils/config-generator.ts
- **System Architecture and Sync Engine**: importance `high`
  - source_paths: src/services/worktree-mode-sync-runner.ts, src/services/clone-sync.service.ts, src/services/worktree-sync.service.ts, src/services/worktree-sync-planner.ts, src/services/git.service.ts
- **Interactive TUI and MCP Server**: importance `high`
  - source_paths: src/services/InteractiveUIService.tsx, src/components/App.tsx, src/components/BranchCreationWizard.tsx, src/components/OpenEditorWizard.tsx, src/components/WorktreeStatusView.tsx
- **Safety, Trash, Maintenance, and Failure Modes**: importance `high`
  - source_paths: src/services/trash.service.ts, src/services/trash-reaper.service.ts, src/services/trash-migration.service.ts, src/services/removal-audit.service.ts, src/services/git-maintenance.service.ts

## Repo Inspection Evidence

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `bc6038cb8bf185f293378f1624cba3326c621e55`
- inspected_files: `README.md`, `package.json`, `pnpm-lock.yaml`, `src/__tests__/e2e/clone-mode.e2e.test.ts`, `src/__tests__/e2e/config-file.e2e.test.ts`, `src/__tests__/e2e/double-run.test.ts`, `src/__tests__/e2e/git-maintenance.e2e.test.ts`, `src/__tests__/e2e/head-branch-filter.test.ts`, `src/__tests__/fixtures/git-responses.ts`, `src/__tests__/helpers/mock-helpers.ts`, `src/__tests__/index.run-once.test.ts`, `src/__tests__/integration.test.ts`, `src/__tests__/local-ahead-of-remote.test.ts`, `src/__tests__/rebased-branch-handling.test.ts`, `src/__tests__/setup.ts`, `src/__tests__/test-utils.ts`, `src/__tests__/utils/retry.test.ts`, `src/constants.ts`, `src/errors/__tests__/index.test.ts`, `src/errors/index.ts`

Host AI hard rules:
- Without repo_clone_verified=true, do not claim that the source code has been read.
- Without repo_inspection_verified=true, do not write README, docs, or package-file conclusions as facts.
- Without quick_start_verified=true, do not claim that the Quick Start path has run successfully.

## Doramagic Pitfall Constraints

These rules come from Doramagic discovery, validation, or compilation findings. The host AI must treat them as operating constraints, not background notes.

### Constraint 1: Capability evidence risk requires verification

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: capability.assumptions | https://github.com/yordan-kanchelov/sync-worktrees
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 2: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: downstream_validation.risk_items | https://github.com/yordan-kanchelov/sync-worktrees
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 3: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: risks.scoring_risks | https://github.com/yordan-kanchelov/sync-worktrees
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 4: Maintenance risk requires verification

- Trigger: issue_or_pr_quality=unknown。
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: evidence.maintainer_signals | https://github.com/yordan-kanchelov/sync-worktrees
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 5: Maintenance risk requires verification

- Trigger: release_recency=unknown。
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: evidence.maintainer_signals | https://github.com/yordan-kanchelov/sync-worktrees
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.
