Skip to content

investigation(run): load phase skills from the installed package via the SDK plugins option, so adopters stop committing ~20k lines of skills #1388

Closed

Description

@admarble

Epic: graph-2026-10-freeze Tier: judgment Execution: runner session (launches a nested Claude via launchctl; not inside a phase, #856)

Why

sequant init adds 66 files and about 23,000 lines for a newcomer to commit, 20,686 of them in .claude/skills (measured in the 2026-10-09 stranger smoke test, #1387). The cause is one upstream decision, not init:

  1. The Claude Code driver starts phase agents with settingSources: ["project"] (src/lib/workflow/drivers/claude-code.ts). Fix sequant run to use Claude Agent SDK #19 AC-3 chose it as the way to load skills ("Loads .claude/skills/"), not as an isolation boundary.
  2. So phase agents see only the project's .claude/skills/, never user or plugin skills. An installed plugin does not help.
  3. Phase worktrees are checked out from git, so the skills must be committed (the doctor warning, fix(run): skills preflight validates the main checkout, not the worktrees agents run in (#813 follow-up) #933, fix(run): spec runs in the main checkout, which the skills pre-flight never checks — a stale checkout silently degrades spec (#933 regression) #1193, fix(adopt): missing-skills remedies contradict each other, and the README plugin path omits the skills that runs need #1201).
  4. Every adopter carries a copy that drifts. Skills changed 79 times since 2026-06-01, and each change needs sequant sync in every project. Cleaning up untracked files silently deletes uncommitted skills.

#1209 made a minimal install cheaper but kept the commit requirement. Customization no longer needs committed skills: .claude/.local/skills/<name>/overrides.md already survives updates.

The candidate change

The Agent SDK's query() accepts plugins: [{ type: "local", path }] (docs: code.claude.com/docs/en/agent-sdk/plugins.md). The npm package already ships plugin/ (package.json files), so every install has a plugin directory at node_modules/sequant/plugin with skills/, hooks/ and the MCP launcher. Phase agents could load skills from there, the installed version, with nothing committed but the manifest.

Documented caveats: plugin skills are namespaced (/sequant:spec, not /spec), and the docs don't say whether settingSources: ["project"] filters a programmatically loaded plugin.

Spike (no merge needed)

In a scratch repo with no .claude/skills/, run one phase through a local driver change that passes plugins: [{ type: "local", path: <package>/plugin }]. Launch it outside any Claude session (launchctl submit, per #856). Answer each question below with evidence, and record the decision it implies.

Acceptance Criteria

  • AC-1: Whether a plugin passed through plugins loads under settingSources: ["project"], and whether a phase agent can invoke its namespaced skill (/sequant:spec <N>) to completion, including the SEQUANT_PHASE marker. Evidence: the phase transcript excerpt and the SDK version, pasted in a comment.
  • AC-2: What else the loaded plugin brings into the phase agent: whether its hooks fire, and fire twice in a repo that also has .claude/hooks/; and whether its MCP server starts, which would bypass the fix(mcp): phase agents receive the user's entire Claude Desktop config — capability over-grant + literal secrets in argv #936 phase-MCP allowlist. Evidence: hook log lines and the agent's MCP server list from the same run.
  • AC-3: Every place that invokes a skill by bare name and would need the sequant: prefix, split into src/ (phase prompts, phase-registry.ts) and skill text (which is frozen while the plugin directory review is open). Evidence: a grep and the list, in a comment.
  • AC-4: A recorded decision with its migration: (a) load skills from the package by default and make committed .claude/skills/ an opt-in override; (b) keep the commit model; or (c) a hybrid. Cover how existing projects with committed skills behave. Evidence: an ADR marked Proposed, plus follow-up issues for the chosen path.

Constraints

  • Plugin freeze (since 2026-10-08): no merge may touch plugin/, .claude/skills/ or templates/skills/. The spike needs no merge. A rollout that edits skill text waits for the freeze to lift.
  • The Codex and opencode drivers read skills differently; the spike covers the Claude Code driver only and notes the others.

Related: #19, #933, #1201, #1209, #1387.

May touch

docs/adr/ (one new Proposed ADR), docs/adr/README.md, a local, unmerged driver change for the spike. The merge is docs-only.

Non-Goals

  • Rolling out the change (it edits skill text; queued for after the freeze).
  • Any edit under plugin/, .claude/skills/ or templates/skills/ (plugin freeze, I-1 of the graph doc).

Activity

  1. admarble commented on Oct 9, 2026

    @admarble
    ContributorAuthor

    Prior art: this root was found in July and patched site by site since. #813 (2026-07-26) named this exact cause: the user-scope plugin "bundles all skills" yet did not resolve /spec for the phase agent, because of settingSources: ["project"] (#19 AC-3). It chose a fail-fast preflight. Every issue since has patched a symptom of the same decision:

    Issue Symptom patched
    #813 missing skills: the phase flails for 30 min, so fail fast
    #933 the preflight checked the main checkout, not the worktrees
    #1193 spec runs in the main checkout, which the preflight never checked
    #1201 the missing-skills remedies contradicted each other
    #1209 made the minimal install cheaper, kept the commit requirement
    #1257 doctor reported success with skills untracked
    #1354 an uncommitted sync silently runs old committed skills
    #1387 adoption cost: about 20.7k lines of skills to commit

    If the spike lands on option (a), add to AC-4: list which of those guards (preflight, freshness check, doctor's skills-committed and untracked warnings) become dead code, and remove or narrow them in the follow-ups, so the fix doesn't leave seven layers of patches behind it.

  2. added
    graph-2026-10-freeze
    on Oct 9, 2026
  3. added a commit that references this issue on Oct 10, 2026
  4. admarble commented on Oct 10, 2026

    @admarble
    ContributorAuthor

    Spike evidence: AC-1, AC-2, AC-3 (runner session, 2026-10-10)

    Setup. A local, unmerged driver change in a scratch worktree of origin/main @ c8762a2c:

    • When SEQUANT_SPIKE_PLUGIN is set, query() gets plugins: [{ type: "local", path }] and the phase prompt's /spec is rewritten to /sequant:spec .
    • The same env var short-circuits runSkillsPreflight. Without that, the run stops before spawning.
    • The SDK system/init message is dumped to a file.

    The fixture is clones of a private fixture repo with .claude/skills/ removed (git rm, committed locally). The run was node <worktree>/dist/bin/cli.js run <N> --phases spec, launched by launchctl submit outside any Claude session (#856).

    The plugin path is a copy of the repo's plugin/ (the tree package.json files ships). The only change is two probe hooks that append to a log, one on SessionStart and one prepended to PreToolUse.

    Versions: @anthropic-ai/claude-agent-sdk 0.3.289, Claude Code claude_code_version 2.1.289 (from the init message), sequant 2.19.0 + spike diff.

    AC-1: yes, the plugin loads under settingSources: ["project"] and /sequant:spec runs to completion

    Run A2 used fixture issue 23, freshly filed so spec couldn't reuse an earlier plan:

    • init.plugins lists {"name":"sequant","source":"sequant@inline","version":"2.19.0"}.
    • init.skills lists all 19 sequant:* skills, and no bare spec/exec/qa.
    • The prompt was … Run the /sequant:spec 23 workflow. The agent's first tool call was Skill {"skill":"sequant:spec","args":"23"}, loaded from …/plugin/skills/spec.
    • It posted the spec comment on fixture issue 23 with <!-- SEQUANT_PHASE: {"phase":"spec","status":"completed","timestamp":"2026-10-10T03:55:46Z"} --> and <!-- SEQUANT_SPEC: {"phases":["exec","qa"],"qualityLoop":false} -->.
    • The orchestrator's fix(run): spec runs in the main checkout, which the skills pre-flight never checks — a stale checkout silently degrades spec (#933 regression) #1193 spec-marker check accepted it: ✔ #23 spec 3m 21s, 1 passed.

    So settingSources: ["project"] does not filter a programmatically loaded plugin.

    AC-2: plugin hooks fire and stack with repo hooks; the plugin's MCP server starts and bypasses the #936 allowlist

    • Hooks fire. Plugin SessionStart fired once per session. Plugin PreToolUse fired once per tool call (A2: 6 tool calls, 6 firings).
    • Hooks stack with the repo's (run B). The fixture also had .claude/settings.json registering a PreToolUse probe in .claude/hooks/. Both fired on every tool call:
      1791603044 PLUGIN PreToolUse …/plugin
      1791603044 REPO PreToolUse
      1791603049 REPO PreToolUse
      1791603049 PLUGIN PreToolUse …/plugin
      
      In a project that already has sequant's hooks committed (any sequant init today), pre-tool.sh and post-tool.sh would run twice per tool call. The guard rules would block twice, and the timing and token logs would double-count.
    • The plugin's MCP server starts. With the plugin, init.mcp_servers includes {"name":"plugin:sequant:sequant","status":"connected","source":"plugin"}, launched from plugin/.mcp.json (node mcp-launch.mjs [email protected]). It sits next to the driver-passed sequant (source: "dynamic"). It does not come through getPhaseMcpServersConfig, so the fix(mcp): phase agents receive the user's entire Claude Desktop config — capability over-grant + literal secrets in argv #936 allowlist doesn't see it.
    • Pre-existing, not caused by the plugin: baseline run C used stock sequant 2.19.0, no plugin, and committed skills. Its init.mcp_servers already had the user's claude.ai connectors: claude.ai Gmail and claude.ai Claude Docs connected, and Drive, Calendar and Figma at needs-auth. The fix(mcp): phase agents receive the user's entire Claude Desktop config — capability over-grant + literal secrets in argv #936 allowlist governs only options.mcpServers, so phase agents running bypassPermissions on issue text currently hold the user's connected claude.ai tools. This is out of scope here, so it's raised separately.

    AC-3: bare-name invocations that would need sequant:

    src/ (not frozen):

    • src/lib/workflow/phase-registry.ts:178,202,222,240,257,274,289,309,326: every phase prompt (Run the /spec {issue} workflow. and so on). This is the load-bearing one.
    • src/lib/assess-comment-parser.ts:376-379: detects workflow lines with line.includes("/spec"), "/exec", "/test", "/qa". /sequant:spec does not contain /spec, so a namespaced recommendation would be missed. This is a consumer as well as a producer.
    • src/commands/init.ts:1314-1316: the "Next steps" text (/spec 123, /exec 123, /qa 123), which fix(onboarding): first-run papercuts from a stranger smoke test — doctor contradicts the README install, init omits the commit step, warning count and phase timer are off #1387 is also editing.
    • src/lib/system.ts:107,114,120: skill name lists ("/test", "/exec", "/fullsolve", …).
    • Messages only: phase-executor.ts:1317, qa-stagnation.ts:122,282, run-reflect.ts:175, upstream/report.ts, bin/cli.ts:684,869.

    Skill text (frozen):

    • 7 bare Skill(skill: "<name>") calls, all in fullsolve/SKILL.md (:352 spec, :465/:499 exec, :571/:602 test, :640/:690 qa). Only 2 calls repo-wide are already sequant:-qualified.
    • 514 bare /<skill> mentions across 19 SKILL.md files. Most are prose; the agent acts on them when it chains skills. Top files: fullsolve 93, qa 71, loop 45, exec 34, test 34.

    Name collision, measured: the plugin-only phase agent's init.skills also lists Claude Code built-ins named verify and loop. Any bare /verify or /loop left in the prompts or skill text would go to the built-in, not sequant's (the #562 class). With committed skills (baseline run C), init.skills shows one loop and one verify entry. The project defines both, so the names collide today too; which source wins was not measured.

    AC-4 (the ADR) follows in a docs-only PR.

  5. added a commit that references this issue on Oct 10, 2026
  6. admarble commented on Oct 10, 2026

    @admarble
    ContributorAuthor

    AC-4 follow-ups filed for ADR-0012 option (a), which the owner accepted on 2026-10-10. The ADR stays Proposed until #1397 verifies the skills-only view.

    Raised separately from the spike baseline: #1396 (phase agents receive claude.ai connectors outside #936).

  7. added a commit that references this issue on Oct 10, 2026
  8. admarble commented on Oct 10, 2026

    @admarble
    ContributorAuthor

    All ACs met. AC-1–3: spike evidence in the comment above. AC-4: ADR-0012 (Proposed) merged in #1392, with option (a) accepted by the owner on 2026-10-10. Follow-ups #1397–#1400 are filed, and #1397 gates the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    graph-2026-10-freeze

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions