Adopt existing repositories
Keep your repositories where they are. A SpecWeave workspace has one planning root containing .specweave/config.json; its workspace.repos inventory can point to nested, sibling or external checkouts. The familiar repositories/<owner>/<repo> layout remains the default for new clones, not a requirement for existing work.
Repository layouts
SpecWeave never asks you to move a repository. This is how each layout joins a workspace:
| Layout | Example | How it joins |
|---|---|---|
| One repository | my-app/ holding .git | Nothing to add. The folder is the project. |
| A plain folder of repositories | my-product/api, my-product/services/web | specweave init adds every checkout up to three levels down, whatever the folders are called, when the folder is not inside a Git repository. |
Under repositories/ | repositories/acme/api, repositories/api | init adds them even when the workspace folder is a Git repository itself, including symlinks to checkouts elsewhere. specweave get owner/repo clones here. |
| Elsewhere in a folder that is, or sits inside, a Git repository | planning/services/api | init does not add these, since they may be fixtures or vendored copies. It prints specweave get ./services/api for each. |
| Siblings or anywhere on disk | ~/code/api beside ~/code/planning | specweave get ../api. Never guessed. |
| Git submodules | libs/ui holding a .git file | Part of the parent repository. |
specweave handoff --all walks the same three levels and reports local-only work in every nested checkout and submodule, registered or not. SpecWithCode lists nested checkouts on its own too; add a sibling repository on the project's Environment page.
Starting a new multi-repo product? Let specweave get clone into repositories/<owner>/<repo>. Everything then sits under one folder: one folder to approve in SpecWithCode, one copy to move to another machine, and task Files paths that name their repository. That is the whole case for it; repositories you already have can stay where they are.
Preview and register
Run this from any directory. A relative source path is resolved from the directory where you invoked the command, even when --workspace selects another planning root.
specweave --workspace ./planning get ../existing-api --dry-run --json
specweave --workspace ./planning get ../existing-api --json
The preview reports the canonical source path, proposed workspace entry, existing child planning root, action and fingerprint. To apply exactly the preview you inspected, supply its fingerprint:
specweave --workspace ./planning get ../existing-api --expected-fingerprint <fingerprint> --json
A changed config, path or origin rejects that apply. Preview again after reviewing the change. Repeating a completed registration without a stale fingerprint is a no-op.
Local adoption changes only the planning workspace config. It does not clone, move, initialize or commit the checkout; history, dirty files, untracked files, existing child config and native tool sessions remain where they are. No source checkout credentials are copied into the inventory. Remote sources such as owner/repo still use the existing clone flow; preview flags apply only to local adoption.
Select the planning root
specweave --workspace /projects/planning task list
SPECWEAVE_WORKSPACE=/projects/planning specweave task list
The command-line option explicitly selects and enters the planning root. The environment variable also carries context to hooks and child tools; when inherited from a checkout, its real path must belong to that workspace. Invalid explicit context fails rather than falling back to another project. Symlinks are resolved before membership is checked.
Without explicit selection, SpecWeave discovers ancestor workspaces through registered membership or the conventional repository layout. A sibling or external checkout needs explicit context because its planning root is not an ancestor. If a registered nested checkout already owns increments, SpecWeave asks for an explicit root instead of silently changing authority. Adopting a repository does not merge its existing plans into the selected workspace.
The CLI and hook root resolver use the same planning context. Handoff inventory includes registered paths and the Git worktrees belonging to them; missing checkouts remain registered and are omitted from checkout scans. It does not recursively search your home directory.
Identity and compatibility
The inventory remains in .specweave/config.json:
{
"workspace": {
"name": "Product",
"repos": [
{
"id": "acme-api",
"path": "../existing-api",
"prefix": "API",
"identity": "github.com/acme/api",
"sync": { "github": { "owner": "acme", "repo": "api" } }
}
]
}
}
Existing IDs, prefixes, sync bindings and paths are preserved. New IDs include the remote owner when available; collisions receive a deterministic suffix. Canonical remote identity strips credentials and transport details. Idempotency requires the same physical checkout: two clones of one remote remain separate, while two spellings or symlinks of the same checkout do not create duplicates. A changed recorded origin fails for explicit review.
Concurrent adoption calls serialize through .specweave/config.json.adoption.lock and replace the config atomically. If a process is interrupted, a leftover lock fails closed after a bounded wait. Check the PID recorded in that lock before removing it; never remove a live writer's lock. Other tools should not edit the config concurrently. There is no automatic mass relocation or historical increment renumbering.
SpecWithCode can read this same inventory to preview and attach existing repositories. Its approved-folder permissions, local project identity and native plans remain separate; registration in SpecWeave alone does not grant the app filesystem access or change its planning root.
Configuration schema
The npm package includes src/core/schemas/specweave-config.schema.json and its adjacent workspace and sync schemas. Point an editor's $schema reference at that installed file. Location-based schema references let editors resolve the adjacent files locally without fetching a schema service. The old absolute https://verified-skill.com/schemas/specweave-config.json identifier is no longer declared by the packaged schema; existing configurations that explicitly reference that remote URL must update their $schema reference to the installed file. Configuration loading itself does not fetch $schema URLs.