Skip to content

Scope plugins out of agent sessions per project (and let a plugin supply the policy per directory) #3843

Closed as not planned

Description

@VKirill

The workflow

I run one bb with ~20 enabled plugins and use it for very different kinds of work: bb development, agency/orchestration, SEO, and client work. Plugins are installed and enabled app-wide, which is right for their UI, services and CLI. But every enabled plugin also enters every agent session on every project: its instructions, its dynamic tools, its skills.

For some work I want a plugin to be enabled globally but absent from the agent sessions of one project, or of one sub-directory inside a project. Example: in a Clients/ folder the agent should not see the Agency plugin's delegation instructions, workflow tools or the bb Connect hint. The session there should not know those plugins exist. The plugin keeps running for every other project.

I also maintain a plugin (bb-plugin-project-folders) that organizes projects into nested section folders with inherited per-section rules. It is the natural place for a user to say "in this section, these plugins are off". Today it cannot do that.

What happens today

Observed on bb 0.43.1 (commit 267938526), provider claude-code, macOS.

A fresh thread in a plain project folder receives separate blocks from agency, bb-guide, connect, env-catalog, memory, md-editor, project-folders and workflows, plus their tools and skills. None of these can be removed for that project without disabling the plugin for the whole app.

Session context is assembled in resolveThreadRuntimeCommandConfig, and every contribution is already attributed to a pluginId:

What a plugin can do today:

  • bb.agents.configure(ctx) returns only that plugin's tools, skills and instructions. A plugin can withhold itself, but it cannot scope another plugin out.
  • Static instruction providers receive only { threadId, projectId } (plugin-agent-contributions.ts#L65-L70). Scoping has to be reimplemented in every plugin, and third-party plugins won't do it.
  • bb plugin disable <id> is app-wide and unloads the plugin's code.

What you would expect

1. Core concept: a plugin can be enabled but out of agent scope for a project

Add a per-project setting: plugins excluded from agent sessions. The plugin stays enabled (UI, services, CLI, schedules keep working), but for threads in that project the runtime config resolver drops everything attributed to the plugin:

  • static instructions, configure() dynamic instructions and tool-scoped instructions;
  • dynamic tools, including a rejection at invoke time, so a tool name the model remembers or guesses cannot be called;
  • plugin skill roots and selections.

The check runs when session config is resolved, not when the thread is created, so changing the setting applies from the next session start for every thread in the project, however it was created.

Possible surface: a "Plugins in agent sessions" list in project settings, and bb plugin scope <id> --project <projectId> --exclude|--include.

This overlaps with the "bonus" in #1255 ("globally installed extensions … individually enabled/disabled per project"), limited to the agent-context layer and without needing repo-scoped extensions first.

2. Extension point: let a plugin supply the scope for a session

Projects are too coarse for directory-based organization: one project folder can contain sections with different needs. Proposed hook, shaped like message.dispatch, a decision rather than a mutation:

bb.experimental_hooks.on("agent.context", (ctx) => {
  // ctx: PluginAgentConfigurationContext (thread, project, environment.path, host, provider, origin)
  return { excludePluginIds: ["agency", "workflows"] };
});

Guardrails I'd expect core to own:

  • Decisions only narrow the session. A hook can exclude plugins, never add or rewrite another plugin's contributions.
  • The result is visible: thread details (or bb thread show) lists which plugins were scoped out and by which plugin, so a missing tool is never a mystery.
  • Core decides which plugins can't be excluded (for example builtin safety plugins such as tool approval). Results from several hooks are combined as a union.
  • A throwing or slow hook falls back to the project setting from (1) and logs a warning, like instruction providers do today.

With (1) alone, users get project-level control. With (2), directory/section plugins like project-folders can provide per-section switches with inheritance, and core's filtering stays the only enforcement point.

Context and alternatives

AGENT GENERATED

Activity

  1. added
    plugins
    on Sep 17, 2026
  2. bb-slop-cop commented on Sep 17, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied and verified: Type Feature, Priority Medium, Effort High, label plugins. All classifications were missing; no existing values were replaced.

    This adds plugin scoping behavior and a public policy extension point. Medium priority reflects a meaningful workflow limitation with workarounds; High effort reflects the new policy design, settings, and enforcement surfaces.

    No reproduction report or pull request: this is a feature requiring product and architecture decisions, outside the simple bug-fix path.

  3. VKirill commented on Sep 24, 2026

    @VKirill
    Author

    Superseded by #4233, which covers this request together with #4043 as one session-policy extension point, with a working prototype on a fork and an integration guide.

    AGENT GENERATED

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

    plugins

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions