Lifecycle init
Use this skill to set up a project's governance layer after installing the Lifecycle Framework plugin. Runs a fixed interview (project identity for CLAUDE.md, optional knowledge-base seeding, then Connections — Git, tracker, Databricks), detecting what is already connected before asking, then writes every Tier-B file from the bundled templates, bootstraps the toolchain (git, npm, husky, the Agent Teams flag), and wires/verifies the MCP servers. Designed primarily to run INSIDE an already-cloned repo (a working branch in a CI/CD repo), and re-runnable to update config; never clobbers protected, append-only, or .local files. Trigger when the user says "set up the framework", "lifecycle-init", "scaffold this project", "initialize the team framework", or wants the governance corpus created in a repo.From its SKILL.md
npx -y skills add Zuus89/lifecycle-framework --skill lifecycle-initAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
37.7 KB, as published. Nobody here has run it
/lifecycle-init — Set up a project from the Lifecycle Framework
You turn a repository into a fully governed Lifecycle-Framework project: run a short, fixed-order interview, then write every Tier-B file from the bundled templates, bootstrap the toolchain, and wire the connections. You do NOT copy agents/skills/hooks — those are Tier-A (plugin-resident) and read this project's config at runtime.
Primary scenario: this usually runs inside an already-cloned repo — often a working branch of a repo that already has CI/CD. So the Connections phase detects and confirms what already exists before offering to create anything. Creating a fresh repo is the fallback, not the default.
Two-tier rule (never violate it): Tier-A files (
agents/*.md,skills/**,hooks/*) are installed once with the plugin and read config (tracker, stack, models) at runtime — they contain no{{TEMPLATE_VARS}}. Tier-B files (everything you write here, sourced from${CLAUDE_PLUGIN_ROOT}/data/templates/) ARE templated: substitute every{{VAR}}and strip the.templatesuffix. Never write a{{VAR}}into a scaffolded file; never leave a.templatesuffix on an output file.
The template root is ${CLAUDE_PLUGIN_ROOT}/data/templates/. All output paths are relative to the target
project root (the current working directory). All user-facing prose follows the project's communication language
(default: Spanish to the user); file contents, code, comments, and docs are English.
0. Pre-flight — detect the environment (don't act yet, just record)
Run these read-only probes and record the results; you will use them in the interview so you can confirm rather than ask blindly.
- Target directory. State the absolute CWD and confirm it is the project root to set up.
- Prior run (idempotency). Check for
.claude/CLAUDE.md(or the legacy rootCLAUDE.md— earlier scaffolds wrote it there),corpus.config.mjs,.claude/settings.json. If any exist → update mode (re-run pre-filled, prompt before overwriting; §7 governs protection). Else → fresh scaffold. Legacy-location migration: if a rootCLAUDE.mdexists and.claude/CLAUDE.mddoes not, offergit mv CLAUDE.md .claude/CLAUDE.md— the canonical home is INSIDE.claude/(both locations are auto-loaded by Claude Code, but the framework standardizes on.claude/CLAUDE.md; never leave two copies). - Templates. Verify
${CLAUDE_PLUGIN_ROOT}/data/templates/exists; list its tree once. If missing, stop — the plugin install is broken. - Toolchain.
git --version,node --version(need 24+),npm --version, andpython --version(only needed if the destructive hook's stack patterns are enabled). Record gaps. - Git context (for C.1):
git rev-parse --is-inside-work-tree,git remote -v,git branch --show-current,git config user.name,git config user.email,git status --porcelain(clean/dirty), and whether.github/workflows/already exists (pre-existing CI). Also enumerate the connected git accounts — the user may have several (work + personal):gh auth statuslists every authenticated GitHub account and which is active; also notegit config --get credential.helper. Record all accounts + the active one. - Connected tracker MCP (for C.2): run
claude mcp listfrom the repo root and record which tracker servers exist and at which scope (linear/atlassianat local, project, or user). Session-visible tools prefixedmcp__claude_ai_*are account-level claude.ai connectors — they do NOT count as a wired tracker (they are global to the account, exactly what this framework avoids depending on). Record the server name + scope, or "none". Also note (informationally) which tracker the connectors suggest the user works with. In update mode, additionally read the existing.claude/settings.json → mcpblock (scope + servers) — C.5 seeds from it. - Databricks config (for C.3): check for
~/.databrickscfgand list the profile names it defines (e.g.dev,qa,prod,global_data_and_analytics). Record them; do not read secrets. - Cloud-synced folder (for C.4): note whether the CWD path lies inside a sync client's folder (path contains
OneDrive,Dropbox, orGoogle Drive). Record the finding — it drives the/handshaketransport default.
Then run the interview in exactly this order: A → B → C. Echo each captured value before moving on.
A. Information for CLAUDE.md (project identity)
-
Project name →
{{PROJECT_NAME}}; derive{{PROJECT_SLUG}}(lowercase, non-alphanumeric →_, collapsed). The slug must be unique across the user's projects (it identifies the project — and, ifbasic-memoryis enabled, its notes folder). Confirm it. -
One-line goal →
{{PROJECT_GOAL}}. -
Stack →
{{STACK}}(web | data | generic). Selects the CLAUDE.md / architecture / CI variant and stack MCP guidance. Ifdata, default Databricks ON in C.3. If unsure,generic. -
Communication language (default: Spanish to the user, English for code/docs) →
{{COMM_LANGUAGE}}. -
Model policy — confirm all-Opus defaults, ask only for overrides:
Role Default Var pm session model (no pin — Opus via /model){{MODEL_PM}}=session (Opus via /model)de claude-opus-4-8{{MODEL_DE}}da claude-opus-4-8{{MODEL_DA}}code-reviewer claude-opus-4-8{{MODEL_CODE_REVIEWER}}devils-advocate claude-opus-4-8{{MODEL_DEVILS_ADVOCATE}}(Optional agents are fixed by policy:
corpus-steward/scout/dead-code-cleanup=sonnet,data-reviewer=claude-opus-4-8,kb-curator=claude-opus-5. Their pins live in the Tier-A agent frontmatter; here you only document the policy.) -
Agent roster. Core five always on. Toggles:
corpus-stewardON by default;kb-curatorON by default (at-close KB curation on every/close-taskvariant — writes onlydocs/knowledge_base/);data-reviewerOFF (ON setsseparation_of_duties_mode = strict);scoutOFF;dead-code-cleanupOFF. Record the enabled set + SoD mode — they are written to theagentsblock of.claude/settings.json, the machine-readable roster that/close-taskand the PM read at runtime. (Re-running init on a project scaffolded before this block existed simply ADDS it.) -
Memory backend →
{{MEMORY_BACKEND}}(corpus | basic-memory). Defaultcorpus— there is no memory MCP: the project's markdown corpus is the knowledge graph (chronicle + snapshot + knowledge base + INDEX +affects-lookup). Recall = readproject_chronicle.md+context_snapshot.md+docs/knowledge_base/(topic articles) + the INDEX, then grep /affects-lookupfor a topic; record = write to the corpus (task report, reviews, and the chronicle via/close-task). Opt-inbasic-memoryadds an MCP over the repo's own Markdown (notes indocs/memory/); the corpus stays the source of truth either way. If the user picksbasic-memory, honor the §6.4 enablement steps at scaffold time.
B. Initial documentation → knowledge base
Ask: "Do you have initial documentation you want to seed the project with?"
- Yes: the user gives file/folder paths. Copy them into
docs/knowledge_base/(preserve filenames). Record asknowledge_base_seed. After the scaffold + toolchain are up (§5–§6), run/audit-corpusso the seeded docs get valid frontmatter and are indexed. - No: create
docs/knowledge_base/with a.gitkeep.
Never invent knowledge-base content; only copy what the user supplies.
C. Connections — MCP scope → Git → Tracker → Databricks
This is where the project is wired to the outside world. For each connection: report what you detected in pre-flight, ask the user to confirm or change it, and only then guide creation if nothing exists.
C.0 — MCP scope (set ONCE — default local; applies to every MCP server this init wires)
Claude Code stores MCP servers at three usable scopes (plus IT-managed managed-mcp.json), with documented
precedence local > project > user — the winning entry replaces the whole definition, fields are never merged
(https://code.claude.com/docs/en/mcp — Installation scopes / Scope hierarchy):
| Scope | Lives in | Official guidance |
|---|---|---|
local (CLI default) | ~/.claude.json → this project's entry | personal servers, experimental configs, credentials you don't want in version control |
project | .mcp.json at repo root (committed) | team collaboration — same servers for everyone; no secrets, use ${VAR} / ${VAR:-default} env expansion (officially supported in command/args/env/url/headers) |
user | ~/.claude.json root level | personal utilities you use across all projects on this machine |
- Detect multi-identity signals from pre-flight: ≥2 accounts in
gh auth status, and/or multiple tracker/Atlassian identities already configured across~/.claude.jsonprojects. - Default:
local— do not ask, announce it. The framework wires every project MCP atlocalscope: the server lives in THIS project's entry in~/.claude.json, confined to this repo — nothing bleeds into other projects, other clients' sessions, or the machine's global config, and nothing depends on account-level claude.ai connectors. Override only if the user explicitly requests it:project— team repo where every teammate should inherit the same servers: committed.mcp.json, no secrets,${VAR}indirection; approval flow viaenabledMcpjsonServers/ trust dialog.user— single-identity machine, personal tooling used everywhere. Never assume it.
- Record →
{{MCP_SCOPE}}and write it into committed config —.claude/settings.json→"mcp": { "scope": … }— so/handshake incan re-verify the servers at the right scope on the user's other machine. Apply it to every server this init wires (tracker in C.2, the C.5 stack catalog,basic-memorystays project-scoped by design — §6.4). Note the choice inmcp-usage/CLAUDE.mdso future sessions know where servers live. - Never assume
user/global. If the user later needs the same server elsewhere, re-running init there (orclaude mcp addin that project) is the supported path.
C.1 — Git (the repo this framework runs in)
Goal: end up on a working branch of a repo with a remote (the CI/CD target), with a configured git identity. Use the pre-flight git context.
- Already a repo with a remote (the common case): report
originURL, current branch, and git identity. Ask: "Run the framework here, on this repo + branch?"- Derive
{{GITHUB_REPO}}(origin URL),{{GIT_HOST}}(github/gitlab/bitbucket from the URL),{{GIT_BRANCH}}(current),{{GIT_DEFAULT_BRANCH}}(git symbolic-ref refs/remotes/origin/HEADor ask). - If the current branch is the default (
main/master): warn — the framework works on a feature branch (1 ticket = 1 branch = 1 PR). Offer to create/checkout a working branch (named from the start ticket once C.2 is done, e.g.feat/<key>-<slug>). Don't force it; record the choice. - Pre-existing CI: if
.github/workflows/already exists, do not clobber it — in §2 addlint-frontmatter.ymlalongside the existing workflows and tell the user. - Dirty tree: if
git statusis dirty, note it; the scaffold adds files — make sure that's expected.
- Derive
- A repo with NO remote: ask whether to add one (
git remote add origin <url>) — needed for CI/CD and PRs — or proceed local-only (note husky works, but CI/PR review won't). - Not a repo: offer, in order of preference for the CI/CD goal:
- Point at / clone an existing remote — if the user wants the framework in an existing project, they should
run init inside that clone; offer the exact
git clone <url>+cdto run first, then re-invoke init. git inita new repo here + optionallygit remote add origin <url>(andgh repo createifghis authenticated).- Proceed without git — discouraged: husky hooks, the INDEX-freshness gate, post-commit logging, and the
lint-frontmatterCI all need a git repo. Warn explicitly.
- Point at / clone an existing remote — if the user wants the framework in an existing project, they should
run init inside that clone; offer the exact
- Git identity: if
user.name/user.emailare unset, set them (ask) — commits and the activity log need them. - Pick the right git account — the user may have several connected. Parse the remote owner from the origin
URL (
github.com/<owner>/…orgit@host:<owner>/…) and compare against the accounts from pre-flight (gh auth status):- One match: an account whose login equals the remote owner (or is a member/admin of the owner org) is the one
to use. If
{{GIT_HOST}} = githuband it is not the active account, switch to it for this repo:gh auth switch --user <account>thengh auth setup-git. Record the previously-active account and restore it in §8 — never leave the user's globalghstate changed after init. - Record the selected login as
{{GIT_ACCOUNT}}→ committedsettings.jsongit.account(an identity, never a credential — the token stays in the credential helper)./handshake incomparesgh auth statuson the user's other machine against this value. If{{GIT_HOST}}is not github or no account applies, record"". - Several candidates / ambiguous: show the accounts and ask which to use for this remote (default: the one matching the owner).
- No account can reach the remote: the user is authenticated but none can push here — say so and offer
gh auth login(or add) the right account before continuing.
- One match: an account whose login equals the remote owner (or is a member/admin of the owner org) is the one
to use. If
- Use the token from where it already lives — never hardcode it. Local pushes use the selected account's
credential via gh's credential helper / the system credential store — you do NOT copy the git token into
settings.jsonor any committed file. Only if the project itself needs the GitHub API (thegithubMCP, or a script) fetch it from the correct account —gh auth token --user <account>— and write it asGITHUB_TOKENinto the gitignored.claude/.local/secrets.env. For non-GitHub hosts (gitlab/bitbucket), rely on the configured git credential helper for the matching account; same rule — read from the credential store, never inline it. ghavailability: if{{GIT_HOST}} = githuband no authenticated account can reach the remote, flag it — Step-8 PR review and thegithubMCP depend on it.
C.2 — Tracker (where tickets live)
Use the pre-flight detection of the connected tracker MCP.
- Confirm or choose the tracker:
- If exactly one is wired (pre-flight found
linearoratlassianviaclaude mcp list): "I detected <X>. Use <X> for this project?" Confirm or switch. →{{TRACKER}}. - If both are wired: ask which to use. If none is wired: ask
linear | jira | none. - Wire-at-scope is mandatory whenever
{{TRACKER}} ≠ none: ifclaude mcp list(from the repo root) does NOT show the tracker server at{{MCP_SCOPE}}, run the C.5 catalog command now — even if tracker tools are visible in-session (those may be account-level claude.ai connectors or another scope, and §6's verification would fail against them). OAuth completes via/mcp, no token in any file; forprojectscope write the server into.mcp.jsoninstead (no secrets). The tracker's server name is always included in{{MCP_SERVERS_JSON}}when{{TRACKER}} ≠ none.none→ localTODO.mdonly; skip the rest of C.2.
- If exactly one is wired (pre-flight found
- Find what this repo connects to (scope). Ask: "Is this repo tied to a single ticket, or to a larger
project/epic?" Then resolve it concretely using the tracker MCP so you store real ids, not guesses:
- Linear:
{{TRACKER_ORG}}(workspace) +{{TRACKER_TEAM}}(team) + the project or initiative →{{TRACKER_PROJECT}}(uselist_projects/list_initiativesto find and confirm the id/name) + ticket prefix →{{TRACKER_KEY}}.{{TRACKER_CLOUD_ID}}stays empty. - Jira: Atlassian site/cloud id →
{{TRACKER_CLOUD_ID}}(usegetAccessibleAtlassianResources) + the project key →{{TRACKER_KEY}}(also mirror into{{TRACKER_PROJECT}}; confirm viagetVisibleJiraProjects) + the epic the repo lives under, if any → record asstart_epic.{{TRACKER_TEAM}}empty unless team-managed. - Either tracker, optionally a specific start ticket →
start_ticket(used to name the working branch in C.1 and seedTODO.md/context_snapshot.md; not a template var). Validate it exists via the MCP.
- Linear:
- Token — only if a script needs the REST API. The tracker MCP itself needs no token (OAuth via
/mcp, per machine). Ask for a tracker API token ONLY if the project will call the tracker's REST API directly from scripts (outside the MCP); then write it into the gitignored.claude/.local/secrets.env(LINEAR_API_KEY, orJIRA_API_TOKEN+JIRA_EMAIL) — never into a committed file. The connection identity goes into committedsettings.json+corpus.config.mjs; tokens never do.
C.3 — Databricks (data stack)
Ask: "Connect this project to Databricks?" (default yes if {{STACK}} = data, else no). If no →
{{DATABRICKS}} = off, skip the rest. If yes → {{DATABRICKS}} = on:
- Profiles / environments. From the pre-flight
~/.databrickscfgprofile list, report what's available and ask which environments this project uses — typically dev / qa / prod (and a default). Record:{{DATABRICKS_ENVS}}= comma list of the envs in use (e.g.dev,qa,prod).{{DATABRICKS_PROFILE}}= the default profile/env for everyday work (e.g.dev).- the host per env (read each profile's
hostfrom~/.databrickscfg) → store as a per-env map. - If
~/.databrickscfgis absent, guide the user to create profiles (databricks configure/ OAuth) before data work.
- Warehouses. Ask for (or, if a profile authenticates, list via the SQL connector) the SQL warehouse id per env. Record them in a per-env map. (Warehouse ids are not secrets but per the user's rules must not be hardcoded in code — they live in config.)
- Where it goes:
.claude/settings.json+corpus.config.mjs(committed): adatabricksblock, filled via the template vars —{{DATABRICKS}}(on/off),{{DATABRICKS_ENVS}},{{DATABRICKS_PROFILE}},{{DATABRICKS_DEFAULT_HOST}}, and the per-env maps{{DATABRICKS_HOSTS_JSON}}/{{DATABRICKS_WAREHOUSES_JSON}}. No tokens; no catalog names hardcoded in code..claude/.local/secrets.env(gitignored):PYTHONIOENCODING=utf-8(Windows Unicode), and any token only if the user is not using~/.databrickscfgprofiles. Prefer profile-based auth (databricks-sql-connector+w.config.authenticate()for OAuth) over raw tokens — note this inmcp-usage/CLAUDE.md.- Note in
CLAUDE.md(data stack): usedatabricks-sql-connectorfor local SQL; never hardcode catalogs/ warehouse ids/workspace URLs; pick the env profile per task.
C.4 — Handshake transport (two-machine work transfer)
From pre-flight item 8, report whether the repo lies inside a cloud-synced folder, then confirm
{{HANDSHAKE_TRANSPORT}} (auto | synced-folder | git-remote, default auto):
auto(default) —/handshakedecides at runtime: repo path inside a sync client's folder →synced-folder; elsegit-remote.synced-folder— the sync client (e.g. OneDrive) carries the working tree, the gitignored snapshot, and.git/itself between the user's machines;/handshakeverifies sync completion, scans for conflict copies, and checks git integrity. Warn once here:.git/inside a synced folder on two machines carries a real corruption risk (objects synced mid-write, placeholder hydration, conflict copies on simultaneous use) — the handshake ritual mitigates it, it cannot eliminate it.git-remote— per-machine clones;/handshake outpacks (WIP transport commit + handoff doc) and pushes.
C.5 — Project MCPs (the stack catalog, wired at {{MCP_SCOPE}})
Beyond the tracker (C.2), wire the MCPs this project actually needs — detect before asking, install only what
is needed, everything at the C.0 scope (default local), with every claude mcp add run from the repo
root (local scope binds to the CWD's project entry). All catalog servers are the providers' official remote
endpoints with OAuth — no token lands in any file; the user completes each auth via /mcp in-session, per
machine (local scope does not travel — /handshake in re-offers these exact commands on the other machine).
| Server | When | Command (official remote endpoint, OAuth) |
|---|---|---|
| Tracker — Linear | {{TRACKER}} = linear (C.2) | claude mcp add --transport http --scope local linear https://mcp.linear.app/mcp |
| Tracker — Atlassian (Jira) | {{TRACKER}} = jira (C.2) | claude mcp add --transport http --scope local atlassian https://mcp.atlassian.com/v1/mcp/authv2 |
| Slack | ask: "Does this project read/notify Slack?" — default no | claude mcp add --transport http --scope local slack https://mcp.slack.com/mcp (a workspace admin must have approved MCP access) |
| Vercel | only {{STACK}} = web AND the repo deploys on Vercel — detect vercel.json / .vercel/; if neither, don't even ask | claude mcp add --transport http --scope local vercel https://mcp.vercel.com |
| Supabase | the project's database is Supabase — detect supabase/ dir, else confirm | claude mcp add --transport http --scope local supabase https://mcp.supabase.com/mcp |
| Neon | the project's database is Neon (mutually exclusive with Supabase — one DB backend per project) | claude mcp add --transport http --scope local neon https://mcp.neon.tech/mcp |
(For {{MCP_SCOPE}} = project, the same servers go into the committed .mcp.json instead; for user, swap the
--scope flag. The commands above are the default-local form.)
Databricks is NOT an MCP. Its connection is CLI/SDK-based via the profiles in ~/.databrickscfg (C.3:
databricks-sql-connector, OAuth via w.config.authenticate()). Do not wire a Databricks MCP server.
Record the enabled set as a JSON array of the configured server names (e.g. ["linear", "slack", "supabase"]) →
{{MCP_SERVERS_JSON}}, written to committed .claude/settings.json → "mcp": { "servers": … } — this is the
list §6 verifies here and /handshake in verifies on the user's other machine ([] when tracker = none and
no stack MCP applies). If an add command fails or an endpoint has moved, check the provider's MCP docs rather
than guessing — and record the correction in mcp-usage.md §0 so the repo carries the working command.
Update mode (re-run on an already-scaffolded project): merge, never silently overwrite. Seed the interview
from the existing settings.json → mcp block + the pre-flight claude mcp list: present explicit adds/drops
instead of re-asking from defaults (Slack's "default no" becomes "default: the previous answer"). On a confirmed
drop, offer the matching claude mcp remove --scope {{MCP_SCOPE}} <name> so the record and ~/.claude.json
move together — never drop a server from mcp.servers while leaving it configured (orphan drift), and never
remove a configured server without the user confirming the drop.
After C, echo a full summary (all vars + roster + SoD mode + memory backend + the three connections + handshake transport + the project MCP set) and get a single confirmation before writing anything.
1. Canonical template variables
Resolve all before substitution; use exactly these names:
| Var | Source |
|---|---|
{{PROJECT_NAME}} / {{PROJECT_SLUG}} / {{PROJECT_GOAL}} | A.1 / A.1 derived / A.2 |
{{STACK}} / {{COMM_LANGUAGE}} | A.3 / A.4 |
{{MODEL_PM}} (=session (Opus via /model)) / {{MODEL_DE}} / {{MODEL_DA}} / {{MODEL_CODE_REVIEWER}} / {{MODEL_DEVILS_ADVOCATE}} | A.5 |
{{TRACKER}} / {{TRACKER_ORG}} / {{TRACKER_TEAM}} / {{TRACKER_PROJECT}} / {{TRACKER_KEY}} / {{TRACKER_CLOUD_ID}} | C.2 |
{{GITHUB_REPO}} / {{GIT_HOST}} / {{GIT_BRANCH}} / {{GIT_DEFAULT_BRANCH}} | C.1 |
{{GIT_ACCOUNT}} | C.1 — the gh login selected for this remote ("" when not github / not applicable) |
{{MCP_SCOPE}} (local|project|user) | C.0 |
{{HANDSHAKE_TRANSPORT}} (auto|synced-folder|git-remote, default auto) | C.4 |
{{MCP_SERVERS_JSON}} | C.2 + C.5 — bare JSON array of configured server names (unquoted; [] when none) |
{{DATABRICKS}} (on|off) / {{DATABRICKS_ENVS}} (comma list) / {{DATABRICKS_PROFILE}} / {{DATABRICKS_DEFAULT_HOST}} | C.3 |
{{DATABRICKS_HOSTS_JSON}} / {{DATABRICKS_WAREHOUSES_JSON}} | C.3 — JSON objects keyed by env (e.g. {"dev":"...","prod":"..."}); resolve to {} when {{DATABRICKS}}=off |
{{MEMORY_BACKEND}} (corpus|basic-memory, default corpus) | A.7 |
{{AGENT_CORPUS_STEWARD}} / {{AGENT_KB_CURATOR}} / {{AGENT_SCOUT}} / {{AGENT_DEAD_CODE_CLEANUP}} / {{AGENT_DATA_REVIEWER}} | A.6 — bare JSON booleans (true/false, unquoted); defaults true, true, false, false, false |
{{SOD_MODE}} (collapsed|strict) | A.6 — strict iff data-reviewer is ON, else collapsed |
{{TODAY}} | date +%F |
(.mcp.json expected contents by configuration: {{MCP_SCOPE}} = local|user + corpus backend → empty
({"mcpServers":{}}) — the corpus is the knowledge graph, no memory MCP, and the wired servers live in
~/.claude.json, not here. {{MCP_SCOPE}} = project → it declares the tracker + C.5 catalog servers (official
remote endpoints, no secrets). {{MEMORY_BACKEND}} = basic-memory → additionally the basic-memory entry
(§6.4), whose BASIC_MEMORY_HOME is set literally via ${CLAUDE_PROJECT_DIR}, per-project without a slug.)
Empty vars (e.g. tracker fields when none, Databricks fields when off) substitute to the empty string; ensure the
surrounding template line still reads correctly.
2. Write the Tier-B files (template substitution)
For every *.template under ${CLAUDE_PLUGIN_ROOT}/data/templates/: read it, substitute every {{VAR}}, compute
the output path (same relative path under project root, .template stripped), create parent dirs, apply the §7
overwrite policy, write. Expected map: .claude/CLAUDE.md (stack-variant — inside .claude/, never the repo
root), TODO.md (protected), .gitignore, .mcp.json (expected contents per the §1 note — empty by default; project scope → the wired servers, merge with, never overwrite, servers already written by claude mcp add --scope project; basic-memory per §6.4);
docs/{strategy.md,architecture.md} (protected), project_chronicle.md (append-only, init entry {{TODAY}}),
context_snapshot.md, empty activity_log.jsonl, _templates/*, claude_tasks/{alpha_tests,reviews,reports,council,archive,handoffs},
audits/, knowledge_base/, INDEX (autogen in §6); .claude/{settings.json (committed, has Agent Teams env + connections), .local/secrets.env (gitignored), rules/*, log_session}; .husky/{pre-commit,post-commit,pre-push};
.github/workflows/lint-frontmatter.yml (+ stack optionals, alongside any pre-existing CI); scripts/*.mjs +
corpus.config.mjs (scaffolded into the repo — husky/CI call them by relative path; ${CLAUDE_PLUGIN_ROOT} does not
resolve there). If a template is absent, report it — don't fabricate.
3–4. Where connection config + secrets go
.claude/.local/secrets.env(gitignored):PYTHONIOENCODING=utf-8(if Databricks), tracker REST token(s) only if C.2.3's script-needs-the-API condition fired (the tracker MCP is OAuth — no token), andGITHUB_TOKENonly if a script/MCP needs the GitHub API (fetched from the selected account viagh auth token --user <account>) — git push itself uses the account's credential helper, not this.- Memory backend: the default (
{{MEMORY_BACKEND}} = corpus) has no memory MCP — the markdown corpus (project_chronicle.md+context_snapshot.md+docs/knowledge_base/+ INDEX +affects-lookup) is the knowledge graph; the scaffolded.mcp.jsonis empty ({"mcpServers":{}}). There is nomemory.jsonlto create. Only when the user opted intobasic-memory(A.7) do you run the §6.4 enablement (verify uv/uvx + Python 3.12+; write.mcp.json+docs/memory/+.bmignore; gitignore the SQLite index; extend the allowlist). .claude/settings.json+corpus.config.mjs(committed): tracker type + identity, git remote/branch, thedatabricksblock (envs/profile/host+warehouse map). No secrets.{{TRACKER}} = none→ empty tracker identity, no token.{{DATABRICKS}} = off→ no databricks block.
5. Bootstrap the toolchain
From the project root (print the exact command for the user if a step is blocked — never fail silently):
- Git. Honor the C.1 decision: if not a repo and the user chose to create one,
git init(+git remote add origin {{GITHUB_REPO}}/gh repo createif chosen); if the user chose a new working branch, create/checkout it. Do nothing to an existing repo/remote beyond what C.1 confirmed. - npm. If
package.jsonis absent → renderpackage.json.template. If it already exists (the common already-cloned-repo case) → merge, do not overwrite: add the governancedevDependencies(js-yaml,husky) andscripts(lint:frontmatter,build:index, andprepare: "husky"if absent) into the project's existingpackage.json, leaving its own fields untouched. Thennpm install(installs husky + js-yaml) and commit the resultingpackage-lock.json(CI usesnpm ci, which requires the lockfile). - husky.
npx husky install(ornpm run prepare); confirm.husky/hooks present + executable (chmod +x). - Agent Teams flag. Verify
.claude/settings.jsonenvhas"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"— the hard prerequisite (a plugin can't set it). If missing, add it. Without it, orchestration collapses to one agent.
6. Build the index + verify connections/MCP
- Stage, then build INDEX.
build-index.mjsreads git-tracked files, so an unstaged scaffold indexes 0 files. Firstgit add -A(stage the scaffolded corpus), thennode scripts/build-index.mjs→docs/INDEX.md+docs/index.json. Commit order matters — thepre-pushhook rebuilds the INDEX and blocks on drift — so the first commit should be:git add -A && npm run build:index && git add docs/INDEX.md docs/index.json && git commit. (Init does not commit for the user unless asked; tell them this is the first commit to make.) - Seed KB (if §B had docs): run
/audit-corpus. - Verify connections:
- Git: remote reachable (
git ls-remoteif a remote is set), on the intended branch, identity set;gh auth statusif GitHub. - MCP: confirm
.mcp.jsonmatches the expected contents for the recorded scope/backend (§1 note: local/user + corpus → empty; project → the wired servers; basic-memory → its entry, verified per §6.4) and that the corpus (chronicle + snapshot + knowledge base + INDEX) is in place; that is the knowledge graph. Then verify every server insettings.json → mcp.servers(the tracker + the C.5 catalog) at{{MCP_SCOPE}}(C.0): runclaude mcp listfrom the repo root — each must appear at the recorded scope with its OAuth completed (/mcpshows it connected). If one is absent, give the user the exact C.5 command; flag, don't block. Reverse check: any server configured at the recorded scope but absent frommcp.serversis an orphan — offer to add it to the record orclaude mcp removeit. Two extra checks:- Shadowing (doc-backed): if the same server name exists at more than one scope, warn which definition wins
(precedence
local > project > user, whole-entry override — a stale local entry silently masks the team's.mcp.json). Offerclaude mcp remove --scope <loser>to clean up. - Windows dual-casing (empirical, not in official docs): with
{{MCP_SCOPE}} = local,~/.claude.jsonmay hold TWO entries for the same project differing only in drive-letter case (c:/…vsC:/…), andclaude mcp addwrites only the cwd's casing. Verify the server exists under both casings when both entries exist; mirror it into the missing one.
- Shadowing (doc-backed): if the same server name exists at more than one scope, warn which definition wins
(precedence
- Databricks (if on): confirm the chosen profile authenticates (
databricks current-user me --profile {{DATABRICKS_PROFILE}}or an SQL-connector ping); flag per-env gaps.
- Git: remote reachable (
6.4 — Enable basic-memory (only if {{MEMORY_BACKEND}} = basic-memory)
Skip entirely for the default corpus backend. basic-memory is deliberately project-scoped (.mcp.json)
regardless of {{MCP_SCOPE}} — its storage lives inside the repo (docs/memory/), so the definition belongs with
the repo; the C.0 choice governs the external connections (tracker, github, stack MCPs). Being project-scoped it
goes through the approval flow — that is why step 4 below allowlists it in enabledMcpjsonServers. When opted in,
at scaffold time:
- Prereqs. Verify
uv/uvxand Python 3.12+ are available (uvx --version,python --version). If missing, tell the user to installuv(https://docs.astral.sh/uv/) and flag it — do not block the rest of init. - Declare the server in the project
.mcp.json(instead of the empty default):
Manual alternative for the user:{ "mcpServers": { "basic-memory": { "command": "uvx", "args": ["basic-memory", "mcp"], "env": { "BASIC_MEMORY_HOME": "${CLAUDE_PROJECT_DIR}/docs/memory" } } } }claude mcp add basic-memory -- uvx basic-memory mcp. - Storage. Create
docs/memory/(with a.gitkeep) and adocs/memory/.bmignoreguarding PII. Gitignore the derived SQLite index and any*.db(add*.dband the basic-memory index path to.gitignore). - Allowlist. In
.claude/settings.json, add"basic-memory"toenabledMcpjsonServers, and add themcp__basic-memory__*tools to the permission allowlist:write_note,read_note,edit_note,search_notes,build_context,recent_activity,list_directory. The corpus remains the default source of truth; agents must still work without this MCP.
7. Idempotency & overwrite policy (critical)
- Protected (
strategy.md,architecture.md,TODO.md): if they exist with content, don't overwrite — show intent, preserve by default. PM edits these via proposal mode. - Append-only (
project_chronicle.md,activity_log.jsonl): never truncate/rewrite; create only on fresh scaffold. .claude/.local/: never blind-overwrite; merge new keys, preserve existing tokens.- Autogenerated (
INDEX.md,index.json): always safe to regenerate. - Pre-existing CI (
.github/workflows/): add framework workflows alongside; never delete the user's. - Everything else (config, rules, scripts, hooks,
CLAUDE.md): update mode → prompt before overwriting a differing file; fresh scaffold → write freely. - Sealed alpha tests (
docs/claude_tasks/alpha_tests/): never touch — the FREEZE RULE.
8. Final summary (in the user's language)
Report: project identity; model policy + enabled roster + separation_of_duties_mode; the three connections —
Git (repo/branch/remote, identity, the git account selected for this remote — recorded in git.account), tracker
(type + connection identity + MCP OAuth status; a REST token in secrets.env only if C.2.3's condition fired,
never shown), Databricks (envs/profile/warehouses, or "not connected"); the MCP scope + the project MCP set
(recorded in mcp.scope / mcp.servers — default scope local: confined to this repo, never global) and the
handshake transport (recorded in handshake.transport); every
file written, every file preserved, any missing template; toolchain status (git, npm, husky, Agent Teams flag,
INDEX); memory backend (corpus = no MCP, the corpus is the knowledge graph; or basic-memory enabled per §6.4);
MCP verification (every server in mcp.servers at {{MCP_SCOPE}} per §6, + basic-memory if enabled;
Databricks is verified separately via its CLI profile — it is not an MCP). If you switched the active gh account in C.1,
restore the previously-active one now (gh auth switch --user <prev>) and confirm it. Next step: start a session —
the PM reads CLAUDE.md + TODO.md + the chronicle and begins the
lifecycle at Step 1 (Brief).
Do not declare success if the Agent Teams flag is missing, the corpus scripts failed, or any {{VAR}} was left
unresolved — surface these as blocking issues.