Status:
draft · Version 0.1 · Filed 2026-05-07version: 0.1 status: draft
SPEC-090 v0.1 — prism_adopt: explicit existing-repository project adoption
Origin
Frank is onboarding existing DFW/Keyz work on Windows mini1. The immediate case is an existing local repo forKeyz4me/Keyz, with related repos/components such as KaiBot and CFD.
Today the closest working verb is prism_clone. Its implementation already has a hidden register mode: if project_dir exists and contains .git, it skips git clone and calls backend bootstrap with strategy="register". That works mechanically, but the operator language is wrong. “Clone this repo” and “adopt this repo” are different intents:
- Clone means the repo is not local yet. Prism performs a checkout.
- Adopt means the repo already exists locally. Prism binds it into Prism state.
§1 — Goals
- Add an explicit
prism_adoptMCP verb for existing local git repositories. - Keep
prism_clonefocused on clone/check-out semantics. - Make adoption safe by construction: no
git clone, nogit init, no code movement, no application-code edits. - Support Windows editor-host onboarding from Cursor/Claude Code/Codex on mini1.
- Preserve the existing backend bootstrap behavior by using
strategy="register". - Make multi-repo onboarding clear: one Prism project/PID per repo. The GitHub owner/org is repository metadata; it is not the same thing as a Prism org/tenant.
§2 — Non-Goals
- No monorepo component model in v0.1. If
KaiBotandCFDare folders inside theKeyzrepo, they are tracked as components/spec areas inside theKeyzPrism project. If they are separate repos, each gets its own Prism project. - No automatic mutation during plain
prism_start.prism_startmay detect an untracked repo and recommend adoption, but adoption remains an explicit verb call. - No source-code scaffolding or framework migration. This verb only binds Prism metadata and BIOS/methodology files.
- No repo creation on GitHub. If the remote does not exist, fail with a clear preflight error.
§3 — Verb Contract
Required fields
name— Prism project display/name slug, e.g.Keyz.project_dir— absolute or workspace-resolved path to the existing local repo.
Optional fields
github_repo— canonical repo owner/name or URL, e.g.Keyz4me/Keyz.repo_owner— GitHub owner/org hint, e.g.Keyz4me. This is derived fromgithub_repowhen omitted.prism_org— future Prism org grouping hint. In v0.1 this is normally omitted; adoption lands under the current Prism tenant/personal install unless backend project→org binding has shipped.ptype— project type, defaultapplication.persona— initial/default persona, defaultBot.force— bypass only narrowly defined metadata mismatch guards; never bypasses destructive-code protections.
§4 — Required Preflight
prism_adopt MUST fail before backend mutation unless all required checks pass:
project_direxists.project_dir/.gitexists.project_diris not the Prism repo itself unlessnameresolves to Prism.git rev-parse --show-toplevelsucceeds and equals/resolves toproject_dir, or returns a clear nested-worktree warning. On Windows this comparison MUST canonicalize separators and drive-letter case before comparing.- If
github_repois provided,git remote get-url originmust match it after normalization, or adoption must stop unlessforce=true. - If
github_repois omitted, try to derive it fromorigin; if derivation fails, return a structured preflight error asking forgithub_repo. - If
repo_owneris omitted andgithub_repohas an owner, deriverepo_ownerfrom the repo owner. Do not treat the GitHub owner as a Prism org. - If
prism_orgis provided, preserve it as a future Prism grouping hint only. First-class Prism org enforcement waits for the project→org binding model. - Existing Prism project conflicts are handled explicitly:
- Same
project_diralready bound: return existing PID, idempotent success. - Same
github_repoalready bound to different path: fail with conflict unlessforce=trueand backend supports a safe rebind. - Same
namealready bound to a different repo in the current Prism tenant/personal install: fail with conflict.
- Same
§5 — Behavior
On successful preflight:- Call backend project bootstrap with:
- Load project context by returned PID.
- Sync Prism BIOS/methodology files with
syncBios({ files: "all", force: false }). - Write no application files except Prism-owned project metadata/docs:
PRISM.mdAGENTS.mdCLAUDE.md- no local
.prism/project.jsonbinding file in v0.1; backend remains the source of truth
- Return a structured result:
§6 — Relationship To prism_clone
Current prism_clone behavior:
SPEC-090 changes operator semantics:
Implementation may initially share helper code with
prism_clone, but the public verb contracts stay separate.
prism_clone keeps its current existing-repo register fallback for a deprecation window. When that fallback is used after prism_adopt ships, it SHOULD return a warning:
Existing local git repo detected.prism_adoptis the preferred verb for registering existing repos;prism_cloneregister fallback is retained for compatibility and may be removed in a later v0.2 change.
§7 — Windows / mini1 UX
For an existing repo:persona should refer to an existing persona when possible. For a new operator persona such as Cherry, run prism_persona_create first unless the active backend explicitly supports lazy persona creation during prism_start / controller registration.
For three separate repos under a common workspace root:
Keyz; track KaiBot and CFD as components/spec areas inside the Keyz project.
§8 — prism_start Integration
prism_start must not silently adopt. It MAY detect the untracked-repo case and return a reminder:
This git repository is not registered as a Prism project. To bind it without cloning or moving files, run prism_adopt(name=..., project_dir=...).
Detection should be advisory only in v0.1.
§9 — Implementation Notes
Likely first implementation is a small refactor inmcp-node/src/verbs/tier1c.ts:
- Extract shared helper from
prism_cloneregister path:- resolve project dir
- inspect git remote
- canonicalize paths cross-platform before comparing
project_dirandgit rev-parse --show-toplevel - call
client.bootstrapProjectApi({ strategy: "register" }) - load context and run
syncBios
- Add
registerVerb({ name: "prism_adopt", ... }). - Add tests for:
- existing git repo adopts successfully
- missing dir fails
- non-git dir fails
- remote mismatch fails
- existing binding is idempotent
- Windows path comparison handles
C:\Foo\Barvsc:/Foo/Bar - no
git clonecommand is invoked
(tenant_id, project_dir) and return the existing PID rather than creating a duplicate.
§10 — Acceptance Criteria
- On Windows mini1, Cherry can adopt an existing
Keyz4me/Keyzcheckout from Cursor without cloning. - The adopted project appears in
prism_status/prism_startwith a PID. - The project receives Prism BIOS files.
- Re-running
prism_adopton the same path returns the same PID and does not duplicate project records. - A mismatched
originvsgithub_reporeturns a structured conflict. - Existing
prism_clonebehavior is not broken.
§11 — Open Questions
- Should
repo_ownerbe stored explicitly or derived from normalizedgithub_repoeverywhere? - Should
prism_clonekeep its current register fallback for backward compatibility, or should it start warning that existing repos should useprism_adopt? - When project→Prism-org binding ships, should
prism_orgbecome required for hosted/customer-mode adoption?
§12 — Related
mcp-node/src/verbs/tier1c.ts— currentprism_create/prism_cloneimplementation.- SPEC-054 — Node MCP shim / install migration context.
- SPEC-055 — target registry and operator lifecycle verbs.
- SPEC-056 — multi-tenant routing / org identity model.
- SPEC-087 / SPEC-089 — cloud org/auth context for customer onboarding.

