require trust before installing project python skills - #2176
require trust before installing project python skills#2176kevinjosethomas wants to merge 2 commits into
Conversation
Project-scoped Python skills are downgraded to markdown skills until the project is trusted (persisted per canonical project path, prompted once in UI sessions, denied by default headless). Trusted project skills install into a per-project kernel venv instead of the shared kernel-venv. Linear: ENG-5338
… attaches Daemon sessions bind extensions before any client is attached, so the bind-time selector resolves with no answer. Keep the project undecided in that case and prompt again once a client that renders extension UI attaches. Linear: ENG-5338
Prime Agent performance — completedPR
Python runtime
Sandbox cost: ~$0.1056 — no inference calls. Methodology and samplesMain resolved at 2026-09-09T23:54:04.647965+00:00. Harness
|
| path | ||
| .basename(canonical) | ||
| .replace(/[^A-Za-z0-9._-]+/g, "-") | ||
| .replace(/^-+|-+$/g, "") |
| .replace(/^-+|-+$/g, "") | ||
| .slice(0, 32) || "project"; | ||
| const digest = createHash("sha256").update(canonical).digest("hex").slice(0, 12); | ||
| return path.join(path.dirname(baseVenv), `${path.basename(baseVenv)}-projects`, `${slug}-${digest}`); |
Context
Linear: ENG-5338 — https://linear.app/primeintellect/issue/ENG-5338
Opening a repository was enough to run code from it.
loadSkillsdiscovers project skills under<cwd>/.prime/agent/skills, and apyproject.tomlmarks a Python skill. On session startup (prewarmIpythonKernel)ensureKernelPythonranuv pip install --editable <skill dir>for every project Python skill into the shared user venv~/.prime/agent/kernel-venv(executing the skill's build backend), and the kernel bootstrap cell imported the package. There was no trust decision, and the package stayed installed and importable from the shared venv after opening an unrelated project.Changes
core/project-skill-trust.ts(new): persisted per-project trust store (~/.prime/agent/project-skill-trust.json, 0600, keyed by canonical project path; corrupt/unreadable fails closed),applyProjectSkillTrust(downgrades project-scoped Python skills to markdown skills unless trusted), status/prompt helpers.AgentSession:_modelVisibleSkills()applies the trust decision, so untrusted project Python skills reach neither the kernel bootstrap nor thepython_importprompt entry (theSKILL.mdstays readable as a markdown skill). NewgetProjectSkillTrust(),setProjectSkillTrust(),promptProjectSkillTrust(). When a UI is bound, the session asks once via the extension UI bridge (trust / not now / never); headless sessions (print, JSON, ACP, subagents) never prompt and stay denied.attach/worker_subscribere-ask once a client that renders extension UI is attached (no protocol change)./trust-project-skills [status|on|off|reset]extension command (always loaded, also under--no-extensions) to change the decision later; it reloads so the kernel picks up or drops the packages.PythonSkillRuntimeInfo.scopeis carried toensureKernelPython; when any project-scoped skill is installed the kernel uses a per-project venv~/.prime/agent/kernel-venv-projects/<name>-<hash>(getProjectKernelVenvDir). The shared venv only ever receives user-level and bundled skills, so project packages and their dependencies never persist into other projects' sessions.skills.md,rlm.md) and changelog fragment.Model-facing surface unchanged: tool names, system prompt structure, and the kernel recursion API are untouched; an untrusted project skill is simply listed as
<type>markdown</type>without apython_import, exactly as a markdown skill is today.Validation
Local:
npm run checkclean.test/project-skill-trust.test.ts(8),test/kernel-bootstrap.test.ts(25),test/skills.test.ts(32),test/suite/regressions/5338-project-skill-trust.test.ts(8), plussdk-skills,agent-session-services,system-prompt,ipython-provisioner,ipython-bootstrap,herdr-agent-state,agent-session-recursion,repl-kernel-startup, suiteagent-session-model-extension,agent-session-runtime,2781-skill-collision-precedence,daemon-extension-binding,daemon-mode,agent-connection-daemon: all pass.test/resource-loader.test.tshas 4 failures that reproduce identically on unpatchedorigin/main(extension files under tmp not loaded) and are unrelated.Prime sandbox (
node:24-bookworm, usertester, real uv/Python kernel, fixture skill whosesetup.pybuild hook and__init__.pywrite markers; headlesscreateAgentSession({ prewarmIpythonKernel: true })withbindExtensions({}), i.e. no UI):editable_wheel, import marker written insiderlm.repl,marker_skillbound in kernel namespace,<python_import>marker_skill</python_import>in prompt, importable from shared venvmarker_skillabsent from kernel namespace, prompt entry<type>markdown</type>,import marker_skillfrom shared venv fails, no project venv created, trust statusundecidedkernel-venv-projects/proj-fixture-<hash>/bin/python,marker_skillimportable from the project venv only; shared venv.bootstrap-versionhas nomarker_skillandimport marker_skillfrom it still failsmarker_skillstill importable from the shared venv (persistence)marker_skill, kernel namespace has nomarker_skill, no project venv for the clean projectThe same test files were run in the sandbox on this branch: all pass except the 4 pre-existing
resource-loaderfailures (identical on main in the sandbox) and oneagent-session-servicestelemetry test that fails only because the sandbox env exportsPI_OFFLINE=1(passes there without it, and fails identically on main with it). Sandbox deleted afterwards.Not validated end to end: the interactive TUI selector itself (covered by the suite tests through the extension UI bridge with a mocked
select), and the daemon attach re-prompt in a live daemon (covered bypromptProjectSkillTrusttests; daemon test files pass).Note
Require trust before installing project Python skills
/trust-project-skillscommand to report and change trust decisions (status,on,off,reset), and prompts interactively when a session starts with undecided project skills.applyProjectSkillTrustin project-skill-trust.ts removespython_importand other Python runtime metadata from untrusted skills; existing setups relying on automatic project skill execution will need to grant explicit trust.Macroscope summarized 49d6db8.