# ckb-init — edge cases Reference material for the `ckb-init` skill. Read when a run hits an unusual situation the main steps don't cover. - **Target is the current repo itself, or a parent/ancestor of it** - refuse and explain why: this would either overwrite the live KB you're running from, or nest a KB inside itself. Ask for a genuinely separate path. - **Target is on a different filesystem/drive or requires elevated permissions** - if directory creation fails, report the exact error rather than retrying with escalated permissions. - **User wants only *some* of the wiki template files** (e.g. just the directory structure, no `AGENTS.md`) - honor that; the steps above are the default full scaffold, not an all-or-nothing bundle. - **Clone fails and there's no local KB to fall back on** - stop and report the raw git error. Don't hand-write an approximation of the scaffold from memory; a KB whose `AGENTS.md` is a paraphrase is worse than no KB. - **User asks to clone the template repo straight into the target** - point out that this gives them the template's git history and files rather than a fresh KB, and offer both: a plain `git clone` (if that's really what they want) or the scratch-clone-then-init flow, which is the default. - **Target already contains a `.git/`** - proceed with the scaffold, but skip Step 11's `git init`/commit and say so; committing into someone else's repo is theirs to decide. - **Scratch clone path already exists** (a previous run died mid-way) - remove it before cloning (`rm -rf`), and remove it again when done. Never reuse a half-cloned scratch dir. - **This repo's own `AGENTS.md` or template `wiki/` files have since drifted from each other** (e.g. one mentions a directory the other doesn't) - fix the drift in *this* repo first if noticed, then copy the corrected version. Don't propagate a known inconsistency into a new KB. --- *Licensed under the Apache License, Version 2.0 — see [LICENSE](../../../LICENSE) at the repository root, or .*