chore(knowledge/setup): retrofit library_dir precedence + portability hardening#138
Conversation
… hardening Mirror the resolved planning/setup hardening onto knowledge/setup's library_dir seam: - Precedence: resolve the full documented order (Managed > --settings > Local > Project > User), warn when higher layers are unreadable, and surface layer shadowing rather than reporting a lower-precedence value as effective. - Portability: guard the tracked project write against propagating a machine-specific personal value; route personal-only overrides to the local overlay (portability required only for the shared project write). - Declared-convention alignment: inspect the repo's declared working-notes/artifacts convention even when a value is set, and surface divergence so library_dir tracks it. Deviation from the issue's fix #3 premise: verified via work-root.js and the youtube pipeline that knowledge resolves library_dir directly at write time — no skill honors a repo convention OVER library_dir at runtime (that is planning's design, not knowledge's). Softened the imported write-time override claim to knowledge's reality (library_dir is runtime-authoritative; setup keeps it aligned with the declared convention). Apply the precedence/shadowing subset to codebase-audit/setup (partial match — writes a tracked .md, not settings): step 1 now reports the effective additively-merged config across user-global/team/local layers instead of the team file alone. Patch-bump codebase-audit for the behavior change. Bump knowledge plugin.json minor; both plugins validate clean.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_af8bc7af-67ea-415f-a081-e846878a3e34) |
There was a problem hiding this comment.
Stale comment
Risk: low. Did not approve: Cursor Bugbot completed as skipped (usage limit reached), so automated review did not finish successfully. Human review is required; no reviewers were assigned because no eligible reviewers were identifiable outside the author.
Sent by Cursor Approval Agent: Pull Request Router and Approver
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00a6ae916b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rstated library_dir runtime claim - codebase-audit/setup step 1: honor the empty-source-list opt-out when summarizing the effective merged config, so a dimension a higher layer deliberately zeroed is reported removed, not present. - knowledge/setup Output: library_dir's youtube wiring is not currently exported (resolveWorkRoot falls back to CLAUDE_PROJECT_DIR), so describe library_dir as the persisted/configured seam setup keeps aligned with the repo convention, not as a guaranteed runtime redirect. Youtube wiring gap tracked separately.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_f145211b-3b7b-4606-b092-bd5bb72e2757) |
There was a problem hiding this comment.
Stale comment
Risk: low. Did not approve: Cursor Bugbot completed as skipped (usage limit reached), so automated review did not finish successfully. Human review is required; no reviewers were assigned because no eligible reviewers were identifiable outside the author.
Sent by Cursor Approval Agent: Pull Request Router and Approver
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85ce7ce1f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Claude finished @kyle-sexton's task in 3m 48s —— View job PR Review — chore(knowledge/setup): retrofit library_dir precedence + portability hardening
OverviewThe PR correctly ports the Issues1 — P2 (still-open): Step 2 of
|
… the youtube pipeline Address repeat Codex finding: a non-default library_dir does not currently redirect youtube artifacts (resolveWorkRoot falls back to the project root; the skill never exports YOUTUBE_WORK_ROOT). Output now reports a persisted non-default value as recorded-for-future-consumption rather than as currently relocating artifacts, so setup does not mislead. Runtime wiring is tracked as a separate issue.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_45a31ff7-7932-4653-a5c1-afcaaee40a99) |
|
Claude finished @kyle-sexton's task in 2m 32s —— View job PR Review — chore(knowledge/setup): retrofit library_dir precedence + portability hardening
Re-review after
|
There was a problem hiding this comment.
Stale comment
Risk: low. Did not approve: Cursor Bugbot completed as skipped (usage limit reached), so automated review did not finish successfully. Human review is required; no reviewers were assigned because no eligible reviewers were identifiable outside the author.
Sent by Cursor Approval Agent: Pull Request Router and Approver
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d573de799
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- knowledge 'does NOT do': the personal .claude/settings.local.json write in step 5 is legitimate machine-local config; reframe the exclusion as 'never writes into the plugin install/data directory' (mirrors planning/setup) and correct the local overlay from 'tracked' to the personal gitignored overlay, so an agent does not skip the personal-override write. - codebase-audit step 1: extend the overlay-shadowing warning to the subtractive direction — when a local/user opt-out zeroes a dimension, a team-scope re-enable will not restore it on that machine; prompt to also remove/update the overlay opt-out.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d29f3c08-df9e-44e7-be97-4db8f9d8af8f) |
|
Claude finished @kyle-sexton's task in 2m 1s —— View job PR Review — chore(knowledge/setup): retrofit library_dir precedence + portability hardening
|
| # | Severity | File | Status |
|---|---|---|---|
| Step 2 runtime-authority claim | P2 | knowledge/setup/SKILL.md:40–42 |
Still open |
Dangling (step 6) reference |
Minor | codebase-audit/setup/SKILL.md:21 |
Still open |
Everything else — the five-layer precedence expansion, the narrow-jq security guard, the portability guards, the correct Output disclosure, the Codex opt-out fix, the personal-override path fix — is solid. The PR is one targeted step-2 rewrite (and an optional one-word drop) away from being clean.
There was a problem hiding this comment.
Risk: low. Did not approve: Cursor Bugbot completed as skipped (usage limit reached), so automated review did not finish successfully. Human review is required; no reviewers were assigned because no eligible reviewers were identifiable outside the author.
Sent by Cursor Approval Agent: Pull Request Router and Approver
…ne (#146) Retrofit the `course-digest` skill (Dometrain/Teachable course extraction and repo-applicability synthesis) into the `knowledge` plugin, replicating the shipped `youtube` vendoring precedent. Pre-baked decisions from the source issue were honored, not re-litigated. ## What changed - **Vendored shared libs** — `@melodic/repo-analysis` + `@melodic/video-digestion` copied (runtime source only) into `extraction/vendor/`, each with its own trimmed `package.json` (real `name`/`version`/`exports`; `video-digestion` keeps its `imghash` runtime dep). `package.json` deps rewritten to `file:./vendor/*`. Byte-identical to the youtube skill's vendored copies (dedup of the two is tracked separately). - **Launcher trio** — `run.mjs` / `register-hook.mjs` / `resolve-hook.mjs` resolve bundled deps from `${CLAUDE_PLUGIN_DATA}` via an ESM resolve hook. `setup-deps.mjs` installs node deps into `${CLAUDE_PLUGIN_DATA}` (sha256 fingerprint over `package.json` + `vendor/`, stamped `.course-extraction.stamp`) **and provisions Playwright's Chromium** into `${CLAUDE_PLUGIN_DATA}/ms-playwright`. `run.mjs` pins `PLAYWRIGHT_BROWSERS_PATH` to that path so install-path and runtime-lookup-path stay in lockstep. - **Credentials (adapter-native, no sensitive userConfig)** — login via the user's own `COURSE_*`/`TEACHABLE_*` shell env vars (prefix driven by `platformConfig.authEnvPrefix`), interactive manual-login fallback. Session cookies re-homed out of the consumer repo to `${CLAUDE_PLUGIN_DATA}/auth/<platform>.auth-state.json` via `lib/auth-store.js`. - **Decoupling** — inlined `tsconfig.json` (no cross-repo `extends`); genericized `SKILL.md` + `context/`/`reference/` paths to `${CLAUDE_PLUGIN_ROOT}`; routed script invocations through `run.mjs`; namespaced self-referencing slashes to `/knowledge:course-digest` (and cross-refs to `/knowledge:youtube`); rewrote `!`-precompute probes to cross-platform `node -e`; fixed the `build-course-json.js` JSDoc example path. - **Version + catalog** — `knowledge` plugin `0.4.0` → `0.5.0` (rebased on #145, which took `0.4.0`), CHANGELOG `0.4.0` entry added (plus a backfilled `0.3.0` entry that PR #138 had omitted). Extended plugin `keywords` and marketplace `tags` with course/video terms. - Excluded the ~2 GB `data/` tree (consumer machine state, per the issue). ## Verification - `claude plugin validate --strict` — clean (plugin + marketplace). - `npx vitest run` — **10 files, 91 tests pass**; `tsc --noEmit` clean; markdownlint clean. - **Clean-repo smoke** (scratchpad, `CLAUDE_PLUGIN_DATA`=temp, **local `node_modules` absent**): - `setup-deps.mjs` installed deps + Chromium into the data dir; re-run early-exits (idempotent). - Vendored `@melodic/*` + `playwright` bare imports resolved **from `${CLAUDE_PLUGIN_DATA}`** (proved by running a pipeline script with no local `node_modules`). - Dry run reached the **auth branch**: Chromium launched from the data-dir path and control entered `adapter.authenticate` → `clerkLogin`, failing exactly as expected on a fake login page (no real credentials). ## Implementation decisions (reviewer visibility) - **Auth is keyed per-platform**, not per-course. The source issue framed the re-home as "location, not behavior"; per-platform is a slight behavior change but the correct shape (a login session is a platform session, reused across courses). - **Dev/test fallback** when `CLAUDE_PLUGIN_DATA` is unset: `${home}/.claude/course-digest/auth/…` — machine-local, persistent, out of the consumer repo. - `--course-dir` stays caller-provided; full `library_dir` → course-dir auto-resolution (the youtube work-root analog) is **not** wired here — possible follow-up. - **Manual-login-under-headless** may not function (documented as a known limitation, not a blocker); env-var + cookie-reuse carry the skill. Refs melodic-software/medley#1409 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Adds Playwright automation, course-platform credentials, and large new surface area (browser auth, vendored deps, long-running extraction), but credentials stay in env/plugin data and behavior is documented/tested rather than changing existing skills. > > **Overview** > **Knowledge plugin 0.5.0** adds **`/knowledge:course-digest`**: a multi-phase workflow to discover, extract, and synthesize **Dometrain** and **Teachable** courses into repo-applicable artifacts (`repo-candidates.md`, `action-items.md`), with single YouTube videos still routed to `/knowledge:youtube`. > > The PR ships a **bundled Node extraction stack** (Playwright orchestration, ffmpeg/ImageMagick frame tooling, companion-repo analysis) following the **youtube** pattern: `@melodic/repo-analysis` and `@melodic/video-digestion` vendored under `extraction/vendor/`, **`setup-deps.mjs`** installing into `${CLAUDE_PLUGIN_DATA}` plus Chromium under `ms-playwright`, and **`run.mjs`** resolving deps and pinning `PLAYWRIGHT_BROWSERS_PATH`. **Platform adapters** (`dometrain`, `teachable`) implement a shared contract (transcript, HLS, resources, URLs); shared **Clerk** / **Teachable SSO** auth and **Mux** / **Hotmart** player modules live under `lib/`. > > **Auth** uses shell `COURSE_*` / `TEACHABLE_*` (from `platformConfig.authEnvPrefix`) with manual-login fallback; session state is stored per platform at **`${CLAUDE_PLUGIN_DATA}/auth/<platform>.auth-state.json`**, not in the consumer repo. Skill docs cover the 8-phase pipeline, storage schema, evals, and prerequisites; marketplace/plugin metadata and CHANGELOG are updated (including a backfilled **0.3.0** entry). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 477e254. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->



Applies the resolved
planning/setuphardening toknowledge/setup'slibrary_dirseam (same single-directoryuserConfigshape, same latent issues).Changes
plugins/knowledge/skills/setup/SKILL.md--settings> Local > Project > User), warns when higher layers are unreadable instead of declaring a lower value authoritative, and surfaces layer shadowing before the project write..claude/settings.local.json(portability required only for the shared project write).plugins/codebase-audit/skills/setup/SKILL.md(partial match — writes a tracked.md, not settings)Deviations (own-flagged)
skills/youtube/extraction/lib/work-root.jsand the youtube pipeline that knowledge resolveslibrary_dirdirectly at write time — no skill overrides it with a repo convention at runtime. Documenting that behavior would be false, so I softened the imported write-time-override claim:library_diris runtime-authoritative, and setup's job is to keep it aligned with any declared convention. Fixes chore: initialize marketplace scaffold #1 and fix: correct plugin-system inaccuracies and harden references #2 are unaffected.codebase-auditversion bump not in issue scope. Patch-bumped0.1.0 → 0.1.1because its SKILL behavior changed; the issue only specified theknowledgeminor bump.Verification
knowledgeplugin.jsonminor bump0.2.0 → 0.3.0;codebase-audit0.1.0 → 0.1.1.claude plugin validateclean on both plugins.Refs melodic-software/medley#1463
Note
Low Risk
Changes are limited to plugin skill documentation and version metadata; no application runtime or security-sensitive code paths are modified.
Overview
Hardens setup skills for the
knowledgeandcodebase-auditplugins so interactive setup reflects layered config reality instead of treating a single team file as authoritative.For
knowledge/setup, step 1 now follows the full Claude Code precedence chain (Managed →--settings→ Local → Project → User), warns when higher layers are unreadable, and calls out when a project write would stay shadowed. A new step reconcileslibrary_dirwith repo-declared working-notes conventions even when a value is already set. Persistence (step 5) blocks copying machine-specific personal paths into tracked project settings, routes personal-only overrides to.claude/settings.local.json, and the output section documents honest pipeline behavior (book-distillignoreslibrary_dir; YouTube does not yet honor it).knowledgebumps 0.2.0 → 0.3.0.For
codebase-audit/setup, step 1 is expanded to summarize the effective merged config across user-global → team → local layers (including dimension opt-outs via empty source lists), explain that only the team file is written, and warn when overlays block re-enabling dimensions.codebase-auditpatch-bumps 0.1.0 → 0.1.1.Reviewed by Cursor Bugbot for commit f13139a. Bugbot is set up for automated code reviews on this repo. Configure here.