[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79XFMPQR2WQY508H0WHS68M":3,"skill-same:01M79XFMPQR2WQY508H0WHS68M":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":51},"01M79XFMPQR2WQY508H0WHS68M","setup",null,"First-run experience for the harness. Three modes: Recommended (guided, ~3 min), Full Tour (guided + skill walkthrough, ~8 min), and Express (zero questions, ~30 sec). Installs hooks first, detects stack, configures harness.json, runs a live demo on real code, and prints a reference card.","mayankjain1815-commits\u002FCITADEL","mayankjain1815-commits","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234472344?v=4","01M79X9599EWEQTD62DMNTEG7X","Mayank jain","01M79X95AA0KDFTN1Z1A6DQTX1",4,"MIT","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fsetup\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: setup\nlicense: MIT\ndescription: >-\n  First-run experience for the harness. Three modes: Recommended (guided,\n  ~3 min), Full Tour (guided + skill walkthrough, ~8 min), and Express\n  (zero questions, ~30 sec). Installs hooks first, detects stack, configures\n  harness.json, runs a live demo on real code, and prints a reference card.\nuser-invocable: true\nauto-trigger: false\ntrigger_keywords:\n  - setup\n  - first run\n  - configure harness\n  - install citadel\n  - getting started\nlast-updated: 2026-04-06\n---\n\n# \u002Fdo setup — First-Run Experience\n\nConfigures the harness for a specific project: installs hooks, detects stack, writes harness.json, and optionally demos the system on real code. Flag: `\u002Fdo setup --express` skips mode selection and runs Express directly. Reference tables and layouts: docs\u002FSETUP_REFERENCE.md.\n\n## Orientation\n\n**Use when:** first-run configuration of Citadel on a new project -- installs hooks, generates harness.json, scaffolds .planning\u002F.\n**Don't use when:** harness is already configured and you want to verify it (use \u002Fverify); adding a single skill to an existing project (copy SKILL.md manually).\n\n## Protocol\n\n### Step -1: ARCHIVE DETECTION (all modes, before anything else)\n\nRun `ls docs\u002Fcitadel\u002F 2>\u002Fdev\u002Fnull`. If `docs\u002Fcitadel\u002F` exists and contains `.md` files with `citadel-archive: true` in frontmatter, extract the `exported-at` date and prompt once:\n\n```\nFound a Citadel archive from {exported-at date}.\n  Campaigns: {N}  Postmortems: {N}  Backlog items: {N}  Research: {N}\n\nRestore history into .planning\u002F during setup? [Y\u002Fn]\n```\n\nY or Enter → set `restoreArchive = true`, restore after Step 1 (below). n → skip silently. No archive found → skip entirely, no output.\n\n**ARCHIVE RESTORE** (runs after Step 1 if `restoreArchive = true`). Splitting: each `## Section Title` becomes one restored file; strip frontmatter before writing.\n\n| File | Restore to |\n|---|---|\n| `campaigns.md` | Split sections → `.planning\u002Fcampaigns\u002Fcompleted\u002F{name}.md` |\n| `postmortems.md` | Split sections → `.planning\u002Fpostmortems\u002F{name}.md` |\n| `research.md` | Split sections → `.planning\u002Fresearch\u002F{name}.md` |\n| `backlog.md` | Split sections → `.planning\u002Fintake\u002F{name}.md` |\n| `discoveries.md` | Split sections → `.planning\u002Fdiscoveries\u002F{name}.md` |\n| `project.md` | Strip frontmatter → `.citadel\u002Fproject.md` |\n| `harness.json.md` | Strip frontmatter → `.claude\u002Fharness.json` |\n\nAfter restore: `  ✓ Archive restored — {N} campaigns, {N} postmortems, {N} backlog items`\n\n### Step 0: MODE SELECTION\n\n```\nWelcome to Citadel.\n\nHow would you like to get started?\n\n  [1] Recommended  — auto-detect your stack, install hooks, live demo  (~3 min)\n  [2] Full Tour    — everything in Recommended + guided skill walkthrough (~8 min)\n  [3] Express      — zero questions, auto-detect, hooks installed, done  (~30 sec)\n\nPress Enter for Recommended, or type 1, 2, or 3.\n```\n\nIf harness.json already exists with full config, add: `  [4] Update — reconfigure existing setup (current: {language}, {skillCount} skills)`. Default: Recommended. If `--express` flag passed: skip mode selection, run Express.\n\n### Step 1: INSTALL HOOKS (all modes, always first)\n\nHooks must be live before anything else. Run `node {citadel-root}\u002Fscripts\u002Finstall-hooks.js`. Find `{citadel-root}`: read `.citadel\u002Fplugin-root.txt`; fallback: directory containing this SKILL.md. The installer reads `hooks\u002Fhooks-template.json`, resolves absolute paths, writes into `.claude\u002Fsettings.json`, preserves non-Citadel settings, is idempotent.\n\n**On success:** `  ✓ {N} hooks installed (protect-files, external-gate, circuit-breaker, quality-gate + more)`\n**On failure:** output the error, explain manual install path (`node \u002Fpath\u002Fto\u002FCitadel\u002Fscripts\u002Finstall-hooks.js`), continue — setup must not abort.\n\n### Step 2: STACK DETECTION (all modes)\n\nAuto-detect by scanning the project root. Never ask what can be read. (Readable tables: docs\u002FSETUP_REFERENCE.md#stack-detection-tables.)\n\n- **Language** (check in order): `tsconfig.json` → TypeScript; `package.json` without tsconfig → JavaScript; `requirements.txt` or `pyproject.toml` → Python; `go.mod` → Go; `Cargo.toml` → Rust; `pom.xml` or `build.gradle` → Java\n- **Framework** (package.json dependencies): `next` → Next.js; `react` (no next) → React; `vue` → Vue; `svelte` → Svelte; `@angular\u002Fcore` → Angular; `express` → Express; `fastify` → Fastify\n- **Package manager**: `pnpm-lock.yaml` → pnpm; `yarn.lock` → yarn; `bun.lockb` → bun; `package-lock.json` → npm; `requirements.txt` → pip; `Pipfile` → pipenv\n- **Test framework**: package.json devDependencies for `jest`, `vitest`, `mocha`, `jasmine`; Python: `pytest` in requirements.txt or pyproject.toml\n- **Typecheck by language**: TypeScript `npx tsc --noEmit` (per-file: no, project-scope incremental); Python `mypy {file}` or `pyright {file}` (per-file: yes); Go `go vet .\u002F...`, Rust `cargo check`, JavaScript none (per-file: no)\n\n**Confirmation (Recommended + Full Tour only):** output `Detected: {language}{+ framework if any} · {packageManager} · {testFramework if any}`, then `Correct? [y\u002Fn\u002Fedit]`. y\u002FEnter → proceed; n\u002Fedit → ask for corrections inline. Express: skip confirmation, use detected values.\n\n### Step 3: GENERATE CONFIG (all modes)\n\nWrite `.claude\u002Fharness.json` using Node (not Write tool — harness.json is protected after first install):\n\n```javascript\nnode -e \"\nconst fs = require('fs');\nconst existing = fs.existsSync('.claude\u002Fharness.json') ? JSON.parse(fs.readFileSync('.claude\u002Fharness.json', 'utf8')) : {};\nconst skillDirs = fs.readdirSync('{citadelRoot}\u002Fskills', { withFileTypes: true }).filter(d => d.isDirectory()).map(d => d.name);\nconst config = {\n  language: '{detected}', framework: '{detected or null}', packageManager: '{detected}',\n  typecheck: { command: '{command}', perFile: {bool}, timeoutMs: 25000 },\n  test: { command: '{testCommand}', framework: '{testFramework}' },\n  qualityRules: { builtIn: ['no-confirm-alert', 'no-transition-all'], custom: [] },\n  protectedFiles: ['.claude\u002Fharness.json', '.claude\u002Fsettings.json'],\n  features: { intakeScanner: true, telemetry: true },\n  registeredSkills: skillDirs, registeredSkillCount: skillDirs.length,\n  agentTimeouts: { skill: 600000, research: 900000, build: 1800000 },\n  trust: { sessionCount: existing.trust?.sessionCount || 0, campaignCount: existing.trust?.campaignCount || 0, level: existing.trust?.level || 'novice' },\n  ...existing  \u002F\u002F preserve consent, storage, policy\n};\nfs.writeFileSync('.claude\u002Fharness.json', JSON.stringify(config, null, 2));\n\"\n```\n\nNote: `perFile` applies to Python checkers only; TypeScript always runs a project-scope incremental check and ignores `perFile` with an advisory.\n\n**Skill registry rebuild:** populate `registeredSkills` from every directory under `{citadelRoot}\u002Fskills\u002F` plus `.claude\u002Fskills\u002F`. Set `registeredSkillCount` to match.\n\n**Routing table regeneration:** run `node {citadelRoot}\u002Fscripts\u002Fgenerate-routing.js`, then verify with `node {citadelRoot}\u002Fscripts\u002Fgenerate-routing.js --check` — exit 0 means all routing surfaces are in sync (what it regenerates: docs\u002FSETUP_REFERENCE.md#routing-surfaces). If the script is missing (older Citadel install), skip this step silently.\n\n**Dependency pattern suggestions (Recommended + Full Tour only):** read package.json for `@tanstack\u002Freact-query`, `zustand`, `date-fns`, `zod`. For each match ask: `\"I see {package} installed. Warn agents when they use {anti-pattern}? [y\u002Fn]\"` and add accepted patterns to `dependencyPatterns` in harness.json (anti-pattern and message table: docs\u002FSETUP_REFERENCE.md#dependency-pattern-suggestions).\n\n### Step 4: CLAUDE.md + AGENTS.md (all modes)\n\nRun `node {citadelRoot}\u002Fscripts\u002Fbootstrap-project-guidance.js --project-root {projectRoot}` — creates `.citadel\u002Fproject.md` and generates `CLAUDE.md` and `AGENTS.md`. Safe to run — only creates files that don't exist.\n\n**Project description (Recommended + Full Tour only):** ask `\"What's this project? One line is fine — or press Enter to use the package name.\"` Skip if CLAUDE.md already exists with content.\n\n**CLAUDE.md merge rules:**\n- Does not exist → generate the starter from docs\u002FSETUP_REFERENCE.md#claudemd-starter-template: project name, description, Stack section (detected values), placeholder Conventions and Architecture sections, and a `## Citadel Harness` section noting the harness and `.claude\u002Fharness.json`\n- Exists, no `## Citadel Harness` section → append that section at bottom only\n- Exists with `## Citadel Harness` → skip, don't duplicate\n- NEVER overwrite or delete existing content\n\n### Step 5: OPTIONAL INTEGRATIONS (Recommended + Full Tour only)\n\nPresent as one prompt:\n\n```\nOptional integrations — choose any, or press Enter to skip all:\n  [g] GitHub    — scaffold Claude triage workflow for issues + PRs\n  [m] MCP       — create .mcp.json with common servers pre-configured\n  [b] Both\n  [s] Skip\n```\n\n**GitHub:** create `.github\u002Fworkflows\u002F` if missing; copy `.planning\u002F_templates\u002Fclaude-triage.yml` → `.github\u002Fworkflows\u002Fclaude-triage.yml` and `.planning\u002F_templates\u002FREVIEW.md` → `REVIEW.md` (skip any that already exist). Output: `\"Add ANTHROPIC_API_KEY to Settings > Secrets > Actions to activate.\"`\n**MCP:** copy `.planning\u002F_templates\u002F.mcp.json` → `.mcp.json` (skip if exists). Output: `\"Edit .mcp.json to uncomment the servers you want.\"`\n\n### Step 6: LIVE DEMO (Recommended + Full Tour only)\n\n**Find target file:** `git diff --name-only HEAD~1 HEAD 2>\u002Fdev\u002Fnull | head -5`, filter for source files, use the most recently changed. If no git history, use `find` for recently modified files.\n\n**Pain point question:**\n\n```\nWhat's your biggest frustration with AI coding tools right now?\n\n  [a] Repetitive context — I keep re-explaining my codebase\n  [b] Quality — the agent breaks things or misses issues\n  [c] Context loss — every new session starts from zero\n  [d] Scale — fine for small tasks, falls apart on big ones\n  [e] Something else \u002F skip demo\n```\n\n**Demo by pain point** — execute on real code, show output:\n- **(a)** run `\u002Freview` on target file — \"This review uses the harness.json config you just set up — it already knows your stack, conventions, and quality rules.\"\n- **(b)** run `\u002Freview` on target file — \"The quality-gate hook just ran on every edit made during setup. Here's what that looks like on your code:\"\n- **(c)** show `.planning\u002F` structure, explain campaigns — \"Sessions now persist. Start a campaign today, close your laptop, resume tomorrow.\"\n- **(d)** run `\u002Freview` on largest source file — \"For bigger work: `\u002Fmarshal` for multi-step sessions, `\u002Farchon` for multi-day campaigns, `\u002Ffleet` for parallel agents.\"\n- **(e)** skip demo, continue to reference card\n\n### Step 7: FULL TOUR WALKTHROUGH (Full Tour only)\n\nPresent the five skill families in order, using the per-skill one-liners and timings from docs\u002FSETUP_REFERENCE.md#full-tour-walkthrough:\n\n1. **Code Quality** (2 min): `\u002Freview`, `\u002Ftest-gen`, `\u002Fsystematic-debugging` — show by running `\u002Freview` on the Step 6 file if not already done\n2. **Building** (2 min): `\u002Fscaffold`, `\u002Frefactor`, `\u002Fcreate-skill`\n3. **Research** (1 min): `\u002Fresearch` (add `--parallel` for multi-scout), `\u002Finfra-audit`\n4. **Orchestration** (1 min): `\u002Fmarshal`, `\u002Farchon`, `\u002Ffleet`\n5. **Observability** (1 min): `\u002Fdo next`, `\u002Fdashboard`, `\u002Fcost`, `\u002Flearn`\n\nAfter walkthrough: `That's the system. Everything routes through \u002Fdo — you never have to choose the right tool.`\n\n### Step 8: REFERENCE CARD (all modes)\n\nPrint the reference card using the canonical boxed layout at docs\u002FSETUP_REFERENCE.md#reference-card, filled with actual counts from the detected config. It must contain, in order:\n\n- Header: `CITADEL READY` — {N} skills · {N} hooks live · {language}{+ framework}\n- THE ONE COMMAND: `\u002Fdo [anything]` — describe what you want in plain English, the router handles the rest\n- COMMON STARTING POINTS: `\u002Fdo review [file]`, `\u002Fdo fix [description]`, `\u002Fdo why is [thing] broken`, `\u002Fdo build [feature]`, `\u002Fdo test [file]`, `\u002Fdo next`, `\u002Fdo status`, `\u002Fdo continue`\n- WHEN TASKS GET BIGGER: `\u002Fmarshal` (multi-step, one session), `\u002Farchon` (multi-session campaign), `\u002Ffleet` (parallel agents)\n- WHAT'S NOW PROTECTING YOUR SESSION: protect-files, external-gate, circuit-breaker, quality-gate, telemetry\n- NEXT STEPS: add conventions to CLAUDE.md, `\u002Fdo --list`, `\u002Fcreate-skill`, `\u002Fimprove [target]`\n- Footer: `docs\u002FSKILLS.md · INSTALL.md · \u002Fdo --list`\n\n**Express mode**: print abbreviated card (THE ONE COMMAND + WHAT'S NOW PROTECTING only).\n\n### Step 9: CLOSING LINE (all modes)\n\nBefore printing the closing line, record successful setup as local activation evidence:\n\n```bash\nnode .citadel\u002Fscripts\u002Factivation-telemetry.js record --stage setup_completed --status succeeded --runtime {claude-code|codex}\n```\n\nUse the current runtime. This is fire-and-forget. If the delegate is missing or recording fails,\nskip it silently and never fail setup. The next successful session start also records this milestone\nonce when it finds a valid `.claude\u002Fharness.json`.\n\n```\nExpress:      Done. {N} hooks live, {N} skills registered.\n              Type \u002Fdo [anything] to start.\n\nRecommended:  Setup complete. Citadel is configured for {language}{+ framework}.\n              {N} hooks are protecting this session. {N} skills are registered.\n              Type \u002Fdo [anything] to get started — or \u002Fdo --list to browse all skills.\n\nFull Tour:    Tour complete. You've seen the full system.\n              {N} hooks live · {N} skills registered · trust level: {level}\n              The best next thing: \u002Fdo \"review the most important file in this codebase\"\n\nUpdate:       Configuration updated. {N} hooks reinstalled, {N} skills re-registered.\n              Changes: {list what changed vs previous config}\n```\n\n## Fringe Cases\n\n**Plugin not found (`.citadel\u002Fplugin-root.txt` missing):** Prompt for Citadel install path. Write answer to `.citadel\u002Fplugin-root.txt`.\n\n**Project has no source files:** Skip demo. Output: `\"Once you have code, try \u002Freview [file] to see the harness in action.\"`\n\n**harness.json is protected and Write tool is blocked:** Use `node -e \"...\"` via Bash — Node script bypasses the Write hook, which is correct since setup is the authorized path.\n\n**Existing CLAUDE.md with no blank line at end:** Append newline before `## Citadel Harness` section.\n\n**Stack detection fails entirely:** Fall back to: `\"What's your primary language? (typescript \u002F javascript \u002F python \u002F go \u002F rust \u002F other)\"`\n\n**Re-running setup on configured project (Update mode):** Show diff of what would change. Don't silently overwrite. Confirm each change.\n\n**`bootstrap-project-guidance.js` not found:** Skip silently — fall back to manual CLAUDE.md template.\n\n## Contextual Gates\n\n**Disclosure:** \"Configuring Citadel for this project. Will modify `.claude\u002Fsettings.json` and install hooks.\"\n**Reversibility:** amber — writes `.claude\u002Fsettings.json`, installs hooks, creates `.planning\u002F`; undo by running `\u002Funharness`\n**Trust gates:**\n- Any: first-run configuration; expected to modify settings and install hooks\n\n## Quality Gates\n\n- Hooks must be installed before any other step completes\n- harness.json must contain `registeredSkillCount` matching actual skill count\n- CLAUDE.md must not lose existing content\n- Demo must run on real user code, not a canned example\n- Reference card must show accurate skill and hook counts\n- Closing line must confirm hooks are live\n\n## Exit Protocol\n\nDo not output a HANDOFF block. Setup is the beginning.\nAfter the closing line, wait for the user's next command.\n","# \u002Fdo setup — First-Run Experience\n\nConfigures the harness for a specific project: installs hooks, detects stack, writes harness.json, and optionally demos the system on real code. Flag: `\u002Fdo setup --express` skips mode selection and runs Express directly. Reference tables and layouts: docs\u002FSETUP_REFERENCE.md.\n\n## Orientation\n\n**Use when:** first-run configuration of Citadel on a new project -- installs hooks, generates harness.json, scaffolds .planning\u002F.\n**Don't use when:** harness is already configured and you want to verify it (use \u002Fverify); adding a single skill to an existing project (copy SKILL.md manually).\n\n## Protocol\n\n### Step -1: ARCHIVE DETECTION (all modes, before anything else)\n\nRun `ls docs\u002Fcitadel\u002F 2>\u002Fdev\u002Fnull`. If `docs\u002Fcitadel\u002F` exists and contains `.md` files with `citadel-archive: true` in frontmatter, extract the `exported-at` date and prompt once:\n\n```\nFound a Citadel archive from {exported-at date}.\n  Campaigns: {N}  Postmortems: {N}  Backlog items: {N}  Research: {N}\n\nRestore history into .planning\u002F during setup? [Y\u002Fn]\n```\n\nY or Enter → set `restoreArchive = true`, restore after Step 1 (below). n → skip silently. No archive found → skip entirely, no output.\n\n**ARCHIVE RESTORE** (runs after Step 1 if `restoreArchive = true`). Splitting: each `## Section Title` becomes one restored file; strip frontmatter before writing.\n\n| File | Restore to |\n|---|---|\n| `campaigns.md` | Split sections → `.planning\u002Fcampaigns\u002Fcompleted\u002F{name}.md` |\n| `postmortems.md` | Split sections → `.planning\u002Fpostmortems\u002F{name}.md` |\n| `research.md` | Split sections → `.planning\u002Fresearch\u002F{name}.md` |\n| `backlog.md` | Split sections → `.planning\u002Fintake\u002F{name}.md` |\n| `discoveries.md` | Split sections → `.planning\u002Fdiscoveries\u002F{name}.md` |\n| `project.md` | Strip frontmatter → `.citadel\u002Fproject.md` |\n| `harness.json.md` | Strip frontmatter → `.claude\u002Fharness.json` |\n\nAfter restore: `  ✓ Archive restored — {N} campaigns, {N} postmortems, {N} backlog items`\n\n### Step 0: MODE SELECTION\n\n```\nWelcome to Citadel.\n\nHow would you like to get started?\n\n  [1] Recommended  — auto-detect your stack, install hooks, live demo  (~3 min)\n  [2] Full Tour    — everything in Recommended + guided skill walkthrough (~8 min)\n  [3] Express      — zero questions, auto-detect, hooks installed, done  (~30 sec)\n\nPress Enter for Recommended, or type 1, 2, or 3.\n```\n\nIf harness.json already exists with full config, add: `  [4] Update — reconfigure existing setup (current: {language}, {skillCount} skills)`. Default: Recommended. If `--express` flag passed: skip mode selection, run Express.\n\n### Step 1: INSTALL HOOKS (all modes, always first)\n\nHooks must be live before anything else. Run `node {citadel-root}\u002Fscripts\u002Finstall-hooks.js`. Find `{citadel-root}`: read `.citadel\u002Fplugin-root.txt`; fallback: directory containing this SKILL.md. The installer reads `hooks\u002Fhooks-template.json`, resolves absolute paths, writes into `.claude\u002Fsettings.json`, preserves non-Citadel settings, is idempotent.\n\n**On success:** `  ✓ {N} hooks installed (protect-files, external-gate, circuit-breaker, quality-gate + more)`\n**On failure:** output the error, explain manual install path (`node \u002Fpath\u002Fto\u002FCitadel\u002Fscripts\u002Finstall-hooks.js`), continue — setup must not abort.\n\n### Step 2: STACK DETECTION (all modes)\n\nAuto-detect by scanning the project root. Never ask what can be read. (Readable tables: docs\u002FSETUP_REFERENCE.md#stack-detection-tables.)\n\n- **Language** (check in order): `tsconfig.json` → TypeScript; `package.json` without tsconfig → JavaScript; `requirements.txt` or `pyproject.toml` → Python; `go.mod` → Go; `Cargo.toml` → Rust; `pom.xml` or `build.gradle` → Java\n- **Framework** (package.json dependencies): `next` → Next.js; `react` (no next) → React; `vue` → Vue; `svelte` → Svelte; `@angular\u002Fcore` → Angular; `express` → Express; `fastify` → Fastify\n- **Package manager**: `pnpm-lock.yaml` → pnpm; `yarn.lock` → yarn; `bun.lockb` → bun; `package-lock.json` → npm; `requirements.txt` → pip; `Pipfile` → pipenv\n- **Test framework**: package.json devDependencies for `jest`, `vitest`, `mocha`, `jasmine`; Python: `pytest` in requirements.txt or pyproject.toml\n- **Typecheck by language**: TypeScript `npx tsc --noEmit` (per-file: no, project-scope incremental); Python `mypy {file}` or `pyright {file}` (per-file: yes); Go `go vet .\u002F...`, Rust `cargo check`, JavaScript none (per-file: no)\n\n**Confirmation (Recommended + Full Tour only):** output `Detected: {language}{+ framework if any} · {packageManager} · {testFramework if any}`, then `Correct? [y\u002Fn\u002Fedit]`. y\u002FEnter → proceed; n\u002Fedit → ask for corrections inline. Express: skip confirmation, use detected values.\n\n### Step 3: GENERATE CONFIG (all modes)\n\nWrite `.claude\u002Fharness.json` using Node (not Write tool — harness.json is protected after first install):\n\n```javascript\nnode -e \"\nconst fs = require('fs');\nconst existing = fs.existsSync('.claude\u002Fharness.json') ? JSON.parse(fs.readFileSync('.claude\u002Fharness.json', 'utf8')) : {};\nconst skillDirs = fs.readdirSync('{citadelRoot}\u002Fskills', { withFileTypes: true }).filter(d => d.isDirectory()).map(d => d.name);\nconst config = {\n  language: '{detected}', framework: '{detected or null}', packageManager: '{detected}',\n  typecheck: { command: '{command}', perFile: {bool}, timeoutMs: 25000 },\n  test: { command: '{testCommand}', framework: '{testFramework}' },\n  qualityRules: { builtIn: ['no-confirm-alert', 'no-transition-all'], custom: [] },\n  protectedFiles: ['.claude\u002Fharness.json', '.claude\u002Fsettings.json'],\n  features: { intakeScanner: true, telemetry: true },\n  registeredSkills: skillDirs, registeredSkillCount: skillDirs.length,\n  agentTimeouts: { skill: 600000, research: 900000, build: 1800000 },\n  trust: { sessionCount: existing.trust?.sessionCount || 0, campaignCount: existing.trust?.campaignCount || 0, level: existing.trust?.level || 'novice' },\n  ...existing  \u002F\u002F preserve consent, storage, policy\n};\nfs.writeFileSync('.claude\u002Fharness.json', JSON.stringify(config, null, 2));\n\"\n```\n\nNote: `perFile` applies to Python checkers only; TypeScript always runs a project-scope incremental check and ignores `perFile` with an advisory.\n\n**Skill registry rebuild:** populate `registeredSkills` from every directory under `{citadelRoot}\u002Fskills\u002F` plus `.claude\u002Fskills\u002F`. Set `registeredSkillCount` to match.\n\n**Routing table regeneration:** run `node {citadelRoot}\u002Fscripts\u002Fgenerate-routing.js`, then verify with `node {citadelRoot}\u002Fscripts\u002Fgenerate-routing.js --check` — exit 0 means all routing surfaces are in sync (what it regenerates: docs\u002FSETUP_REFERENCE.md#routing-surfaces). If the script is missing (older Citadel install), skip this step silently.\n\n**Dependency pattern suggestions (Recommended + Full Tour only):** read package.json for `@tanstack\u002Freact-query`, `zustand`, `date-fns`, `zod`. For each match ask: `\"I see {package} installed. Warn agents when they use {anti-pattern}? [y\u002Fn]\"` and add accepted patterns to `dependencyPatterns` in harness.json (anti-pattern and message table: docs\u002FSETUP_REFERENCE.md#dependency-pattern-suggestions).\n\n### Step 4: CLAUDE.md + AGENTS.md (all modes)\n\nRun `node {citadelRoot}\u002Fscripts\u002Fbootstrap-project-guidance.js --project-root {projectRoot}` — creates `.citadel\u002Fproject.md` and generates `CLAUDE.md` and `AGENTS.md`. Safe to run — only creates files that don't exist.\n\n**Project description (Recommended + Full Tour only):** ask `\"What's this project? One line is fine — or press Enter to use the package name.\"` Skip if CLAUDE.md already exists with content.\n\n**CLAUDE.md merge rules:**\n- Does not exist → generate the starter from docs\u002FSETUP_REFERENCE.md#claudemd-starter-template: project name, description, Stack section (detected values), placeholder Conventions and Architecture sections, and a `## Citadel Harness` section noting the harness and `.claude\u002Fharness.json`\n- Exists, no `## Citadel Harness` section → append that section at bottom only\n- Exists with `## Citadel Harness` → skip, don't duplicate\n- NEVER overwrite or delete existing content\n\n### Step 5: OPTIONAL INTEGRATIONS (Recommended + Full Tour only)\n\nPresent as one prompt:\n\n```\nOptional integrations — choose any, or press Enter to skip all:\n  [g] GitHub    — scaffold Claude triage workflow for issues + PRs\n  [m] MCP       — create .mcp.json with common servers pre-configured\n  [b] Both\n  [s] Skip\n```\n\n**GitHub:** create `.github\u002Fworkflows\u002F` if missing; copy `.planning\u002F_templates\u002Fclaude-triage.yml` → `.github\u002Fworkflows\u002Fclaude-triage.yml` and `.planning\u002F_templates\u002FREVIEW.md` → `REVIEW.md` (skip any that already exist). Output: `\"Add ANTHROPIC_API_KEY to Settings > Secrets > Actions to activate.\"`\n**MCP:** copy `.planning\u002F_templates\u002F.mcp.json` → `.mcp.json` (skip if exists). Output: `\"Edit .mcp.json to uncomment the servers you want.\"`\n\n### Step 6: LIVE DEMO (Recommended + Full Tour only)\n\n**Find target file:** `git diff --name-only HEAD~1 HEAD 2>\u002Fdev\u002Fnull | head -5`, filter for source files, use the most recently changed. If no git history, use `find` for recently modified files.\n\n**Pain point question:**\n\n```\nWhat's your biggest frustration with AI coding tools right now?\n\n  [a] Repetitive context — I keep re-explaining my codebase\n  [b] Quality — the agent breaks things or misses issues\n  [c] Context loss — every new session starts from zero\n  [d] Scale — fine for small tasks, falls apart on big ones\n  [e] Something else \u002F skip demo\n```\n\n**Demo by pain point** — execute on real code, show output:\n- **(a)** run `\u002Freview` on target file — \"This review uses the harness.json config you just set up — it already knows your stack, conventions, and quality rules.\"\n- **(b)** run `\u002Freview` on target file — \"The quality-gate hook just ran on every edit made during setup. Here's what that looks like on your code:\"\n- **(c)** show `.planning\u002F` structure, explain campaigns — \"Sessions now persist. Start a campaign today, close your laptop, resume tomorrow.\"\n- **(d)** run `\u002Freview` on largest source file — \"For bigger work: `\u002Fmarshal` for multi-step sessions, `\u002Farchon` for multi-day campaigns, `\u002Ffleet` for parallel agents.\"\n- **(e)** skip demo, continue to reference card\n\n### Step 7: FULL TOUR WALKTHROUGH (Full Tour only)\n\nPresent the five skill families in order, using the per-skill one-liners and timings from docs\u002FSETUP_REFERENCE.md#full-tour-walkthrough:\n\n1. **Code Quality** (2 min): `\u002Freview`, `\u002Ftest-gen`, `\u002Fsystematic-debugging` — show by running `\u002Freview` on the Step 6 file if not already done\n2. **Building** (2 min): `\u002Fscaffold`, `\u002Frefactor`, `\u002Fcreate-skill`\n3. **Research** (1 min): `\u002Fresearch` (add `--parallel` for multi-scout), `\u002Finfra-audit`\n4. **Orchestration** (1 min): `\u002Fmarshal`, `\u002Farchon`, `\u002Ffleet`\n5. **Observability** (1 min): `\u002Fdo next`, `\u002Fdashboard`, `\u002Fcost`, `\u002Flearn`\n\nAfter walkthrough: `That's the system. Everything routes through \u002Fdo — you never have to choose the right tool.`\n\n### Step 8: REFERENCE CARD (all modes)\n\nPrint the reference card using the canonical boxed layout at docs\u002FSETUP_REFERENCE.md#reference-card, filled with actual counts from the detected config. It must contain, in order:\n\n- Header: `CITADEL READY` — {N} skills · {N} hooks live · {language}{+ framework}\n- THE ONE COMMAND: `\u002Fdo [anything]` — describe what you want in plain English, the router handles the rest\n- COMMON STARTING POINTS: `\u002Fdo review [file]`, `\u002Fdo fix [description]`, `\u002Fdo why is [thing] broken`, `\u002Fdo build [feature]`, `\u002Fdo test [file]`, `\u002Fdo next`, `\u002Fdo status`, `\u002Fdo continue`\n- WHEN TASKS GET BIGGER: `\u002Fmarshal` (multi-step, one session), `\u002Farchon` (multi-session campaign), `\u002Ffleet` (parallel agents)\n- WHAT'S NOW PROTECTING YOUR SESSION: protect-files, external-gate, circuit-breaker, quality-gate, telemetry\n- NEXT STEPS: add conventions to CLAUDE.md, `\u002Fdo --list`, `\u002Fcreate-skill`, `\u002Fimprove [target]`\n- Footer: `docs\u002FSKILLS.md · INSTALL.md · \u002Fdo --list`\n\n**Express mode**: print abbreviated card (THE ONE COMMAND + WHAT'S NOW PROTECTING only).\n\n### Step 9: CLOSING LINE (all modes)\n\nBefore printing the closing line, record successful setup as local activation evidence:\n\n```bash\nnode .citadel\u002Fscripts\u002Factivation-telemetry.js record --stage setup_completed --status succeeded --runtime {claude-code|codex}\n```\n\nUse the current runtime. This is fire-and-forget. If the delegate is missing or recording fails,\nskip it silently and never fail setup. The next successful session start also records this milestone\nonce when it finds a valid `.claude\u002Fharness.json`.\n\n```\nExpress:      Done. {N} hooks live, {N} skills registered.\n              Type \u002Fdo [anything] to start.\n\nRecommended:  Setup complete. Citadel is configured for {language}{+ framework}.\n              {N} hooks are protecting this session. {N} skills are registered.\n              Type \u002Fdo [anything] to get started — or \u002Fdo --list to browse all skills.\n\nFull Tour:    Tour complete. You've seen the full system.\n              {N} hooks live · {N} skills registered · trust level: {level}\n              The best next thing: \u002Fdo \"review the most important file in this codebase\"\n\nUpdate:       Configuration updated. {N} hooks reinstalled, {N} skills re-registered.\n              Changes: {list what changed vs previous config}\n```\n\n## Fringe Cases\n\n**Plugin not found (`.citadel\u002Fplugin-root.txt` missing):** Prompt for Citadel install path. Write answer to `.citadel\u002Fplugin-root.txt`.\n\n**Project has no source files:** Skip demo. Output: `\"Once you have code, try \u002Freview [file] to see the harness in action.\"`\n\n**harness.json is protected and Write tool is blocked:** Use `node -e \"...\"` via Bash — Node script bypasses the Write hook, which is correct since setup is the authorized path.\n\n**Existing CLAUDE.md with no blank line at end:** Append newline before `## Citadel Harness` section.\n\n**Stack detection fails entirely:** Fall back to: `\"What's your primary language? (typescript \u002F javascript \u002F python \u002F go \u002F rust \u002F other)\"`\n\n**Re-running setup on configured project (Update mode):** Show diff of what would change. Don't silently overwrite. Confirm each change.\n\n**`bootstrap-project-guidance.js` not found:** Skip silently — fall back to manual CLAUDE.md template.\n\n## Contextual Gates\n\n**Disclosure:** \"Configuring Citadel for this project. Will modify `.claude\u002Fsettings.json` and install hooks.\"\n**Reversibility:** amber — writes `.claude\u002Fsettings.json`, installs hooks, creates `.planning\u002F`; undo by running `\u002Funharness`\n**Trust gates:**\n- Any: first-run configuration; expected to modify settings and install hooks\n\n## Quality Gates\n\n- Hooks must be installed before any other step completes\n- harness.json must contain `registeredSkillCount` matching actual skill count\n- CLAUDE.md must not lose existing content\n- Demo must run on real user code, not a canned example\n- Reference card must show accurate skill and hook counts\n- Closing line must confirm hooks are live\n\n## Exit Protocol\n\nDo not output a HANDOFF block. Setup is the beginning.\nAfter the closing line, wait for the user's next command.\n",{"name":5,"license":15,"description":7,"auto-trigger":20,"last-updated":24,"user-invocable":25,"trigger_keywords":26},1775433600000,true,[5,27,28,29,30],"first run","configure harness","install citadel","getting started","main","49119fa06efc769f502bede04ad99746ac20f021","skills\u002Fsetup",0,"https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits","2nd-yr EEE 📍 Bangalore | Python, C, Java, C# | ML, NLP & Flask backends | Building AI tools that ship 🚀 | Open to hackathons & collabs","2026-11-14 14:46:28",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":25},[41,44,47],{"tool":42,"command":43},"npx","npx skills add mayankjain1815-commits\u002FCITADEL --skill setup",{"tool":45,"command":46},"bunx","bunx skills add mayankjain1815-commits\u002FCITADEL --skill setup",{"tool":48,"command":49},"pnpm","pnpm dlx skills add mayankjain1815-commits\u002FCITADEL --skill setup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fsetup\u002FSKILL.md",[52,58],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"__benchmarks__\u002Falready-configured.md","REFERENCE","参考文档",851,"https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fsetup\u002F__benchmarks__\u002Falready-configured.md",{"path":59,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":60,"sourceHtmlUrl":61},"__benchmarks__\u002Ffresh-project.md",847,"https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fsetup\u002F__benchmarks__\u002Ffresh-project.md",[63,70,77,84,91,98],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M79XH1DBMXQEF9N0Q6NW7Q5P","workspace","Multi-repo campaign coordinator. Same lifecycle as fleet -- scope claims, discovery relay, wave-based execution -- but the unit of work is a repo, not a file. Coordinates campaigns across repositories with shared context.","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fworkspace\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M79XGWJJHSKNTH78TNVX09VK","wiki","Markdown-first knowledge base where the LLM acts as librarian. Ingests raw sources, compiles and interlinks topic files, self-maintains an index. No vector DB or embeddings required -- uses LLM-native navigation over structured markdown up to ~400K words.","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fwiki\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M79XGNW2YTFHVMEZGZDEDN43","watch","File sentinel that monitors the working directory for changes and marker comments, then auto-triggers appropriate skills. Poll-based via git diff against the last scan commit. Writes intake items for batch processing and routes marker actions through \u002Fdo. Use for automatic reactions to file changes; do NOT use for one-off inspection or tasks needing human judgment per file.","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fwatch\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M79XGHZ0028HDW7SDT186D6Q","verify","Self-test the Citadel hook pipeline from within a live session. Exercises real tool calls (Write, Edit, Bash, Read) and checks that hooks fired, telemetry accumulated, and no errors occurred. Reports HOOK HEALTH: PASS or HOOK HEALTH: FAIL with a per-hook breakdown.","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Fverify\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M79XGDKHMADJXC27T0FMQAN3","unharness","Remove Citadel from a project. Exports valuable state (campaigns, postmortems, research, backlog, discoveries) to docs\u002Fcitadel\u002F as human-readable markdown, then removes all harness files and hooks. The archive is detected by \u002Fdo setup on re-install and offered for restore.","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Funharness\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M79XG81A3RHP2TKKBT5WYEY2","triage","GitHub issue and PR investigator. Pulls open issues\u002FPRs, classifies them, searches the codebase for root cause or reviews contributed code, proposes fixes with file:line references, and optionally implements fixes. Use for investigating GitHub issues and reviewing PRs; do NOT use for general code review unrelated to GitHub issues.","https:\u002F\u002Fgithub.com\u002Fmayankjain1815-commits\u002FCITADEL\u002Fblob\u002Fmain\u002Fskills\u002Ftriage\u002FSKILL.md",[],[]]