153 lines
6.8 KiB
Markdown
153 lines
6.8 KiB
Markdown
---
|
|
name: ckb-join
|
|
description: Join an existing shared Cascade Knowledge Base by its git origin URL — clone it into a folder (given, or a sensible default), check that it really is a Cascade KB, verify git identity, symlinks and upstream mounts, and leave it ready to open in the agent. Installed in a user's profile, so it works from any folder. Use for "join the knowledge base at this URL", "join our wiki", "get me set up on the team KB", "clone our wiki into this folder", "I've been invited to a KB". Not for creating a new KB (ckb-create) or for syncing a KB you already have (ckb-sync-changes inside it).
|
|
---
|
|
|
|
# Join a shared Cascade KB
|
|
|
|
## Purpose
|
|
|
|
Turn an origin URL into a working local copy of a team KB, and tell the
|
|
person what (if anything) is still missing on their machine. This skill
|
|
lives in a person's profile (`~/.claude/skills/`), not in any KB; once the
|
|
clone exists, the KB's own skills take over.
|
|
|
|
Read-only towards the shared history: it clones, inspects and reports. It
|
|
never commits, pushes, or edits files in the KB. Anything it can't fix
|
|
without writing to the KB is reported, not done.
|
|
|
|
## How to run this skill
|
|
|
|
### Step 1 — Inputs
|
|
|
|
- **Origin URL** — required. Ask if missing.
|
|
- **Folder** — optional. Default: `<current working directory>/<repo-name>`,
|
|
where `<repo-name>` is the last path segment of the URL without `.git`.
|
|
If the current directory is itself inside a git work tree or a KB, don't
|
|
default into it — ask where to put the clone instead.
|
|
|
|
Resolve the folder to an absolute path and say it back before cloning.
|
|
|
|
### Step 2 — Pre-flight
|
|
|
|
```bash
|
|
git --version
|
|
git config user.name; git config user.email
|
|
git ls-remote --symref <origin-url> HEAD
|
|
```
|
|
|
|
- **No git identity** — the KB stamps every log entry, workload note and
|
|
commit with it, so colleagues see who changed what. Ask for name and
|
|
email and set them with `git config --global` on a yes. If they decline,
|
|
continue but say the agent will fall back to the OS user name.
|
|
- **`ls-remote` fails** — report git's raw error. The usual causes: the
|
|
person hasn't been granted access yet (ask the KB owner), or no
|
|
credentials for that host (SSH key, credential helper, token). Stop.
|
|
- **`ls-remote` returns nothing** — the remote is empty: nobody has
|
|
published a KB there. Say so and suggest the owner runs `ckb-create`.
|
|
Stop.
|
|
- **Folder exists**:
|
|
- empty → clone into it;
|
|
- already a clone of the same remote (`git -C <folder> remote get-url
|
|
origin` matches) → nothing to clone; say "you've already joined — open
|
|
the folder and say *sync changes* to update", then go to Step 4 to
|
|
check it;
|
|
- anything else → stop and ask for another folder. Never clone over
|
|
existing files.
|
|
|
|
### Step 3 — Clone
|
|
|
|
```bash
|
|
git clone <origin-url> <folder>
|
|
```
|
|
|
|
Clone the remote's default branch (shown by `ls-remote --symref`). If it is
|
|
not `main`, say so: the KB's `ckb-sync-changes` assumes `main`, so the owner
|
|
should either rename the branch or know that sync will need adjusting.
|
|
|
|
On Windows, clone with `git clone -c core.symlinks=true …` so `CLAUDE.md`
|
|
and `.claude/skills` arrive as symlinks (needs Developer Mode or an
|
|
elevated shell).
|
|
|
|
### Step 4 — Check it is a working Cascade KB
|
|
|
|
From the folder:
|
|
|
|
```bash
|
|
test -f AGENTS.md && test -f wiki/index.md && test -f ckb.yaml
|
|
test -L CLAUDE.md && test -L .claude/skills
|
|
cat VERSION
|
|
grep kb_schema_version wiki/index.md
|
|
```
|
|
|
|
- **`AGENTS.md` or `wiki/index.md` missing** — this is not a Cascade KB (or
|
|
not a finished one). Say what was found, leave the clone in place, and
|
|
ask whether to delete it. Never delete without a yes.
|
|
- **Symlinks are plain files** — symlinks were not checked out (typically
|
|
Windows without `core.symlinks`). The agent would read a stale or empty
|
|
system prompt and see no skills. Tell the user how to fix it on their
|
|
machine: enable Developer Mode, `git config core.symlinks true`, then
|
|
`git checkout -- CLAUDE.md .claude/skills`. Don't commit anything.
|
|
|
|
Then report what the KB brings with it, from the files alone:
|
|
|
|
- **Purpose** — the `tldr` or first lines of `ABOUT.md`.
|
|
- **Template** — `VERSION`, and `ckb.yaml`'s `template:` branch if it is not
|
|
`main`.
|
|
- **Modules** — `ckb.yaml`'s `kb_modules:`; for `software`, note that
|
|
`src/` clones are not shared through this repo and must be cloned
|
|
separately if the person needs them.
|
|
- **Upstream mounts** —
|
|
- `linked/<name>` symlinks: check each target exists on this machine
|
|
(`test -e linked/<name>`). A dangling one points at a path on the
|
|
owner's machine; the person needs that upstream KB locally at the same
|
|
relative location, or their own symlink (not committed) to it.
|
|
- `libs/<name>/` with `source.yaml`: connector-backed, its generated index
|
|
came with the clone; nothing to do unless they are asked to be its admin.
|
|
- `libs/` folders mentioned in `wiki/` or the docs but absent: git-copy
|
|
libs are gitignored, so they never arrive with a clone. List them and
|
|
say who to ask for the source.
|
|
- **Python** — the first of `python3`, `python`, `py -3` that reports 3.x.
|
|
If none, say once that the KB still works on its fallback paths and point
|
|
to "Prerequisites" in its `docs/MANUAL.md`.
|
|
|
|
### Step 5 — Session brief (optional, when Python is available)
|
|
|
|
```bash
|
|
cd <folder> && <python> .agents/skills/ckb-lint/scripts/session_start.py --title "Joined the knowledge base"
|
|
```
|
|
|
|
Show the `ckb check:` and `routines:` lines only if they need action. Don't
|
|
act on them here — that happens in a session inside the KB.
|
|
|
|
### Step 6 — Report
|
|
|
|
Keep it short:
|
|
|
|
- the folder, the origin, the branch, and the KB's purpose line;
|
|
- anything from Step 4 the person has to fix on their machine, each with
|
|
its one-line fix — or "nothing to fix";
|
|
- **next step:** open the folder in the agent (`cd <folder> && claude`) so
|
|
the KB's own skills and rules load. Good first things to say there:
|
|
*set up my profile*, *onboard me on <topic>*, or a question. *Sync
|
|
changes* pulls colleagues' work and shares theirs.
|
|
|
|
## Edge cases
|
|
|
|
- **The person already has a ZIP copy of the KB** — a ZIP has no `origin`.
|
|
Clone fresh into a new folder rather than wiring git into the unpacked
|
|
copy; if they made local changes there, they can copy those files over
|
|
after the clone and sync.
|
|
- **They were given a URL to the upstream template (`…/ckb.git`)** rather
|
|
than a team KB — that repo is the template itself. Joining it is almost
|
|
never what they want; ask whether they meant to *create* a new KB
|
|
(`ckb-create`) or have a team KB URL.
|
|
- **Large repository** — fine to clone in full; don't use `--depth`, since
|
|
`ckb-sync-changes` merges and needs history.
|
|
- **Several KBs** — each is its own folder and its own clone; nothing is
|
|
shared between them unless one mounts the other under `linked/`.
|
|
|
|
---
|
|
|
|
*Licensed under the Apache License, Version 2.0 —
|
|
<http://www.apache.org/licenses/LICENSE-2.0>.*
|