Skip to content

source-control/babysit: make identity-domain userConfig (watched_owners, self_logins) sourceable per-directory via env fallback — pluginConfigs is machine-global on 2.1.207+ #1204

Closed as not planned

Description

@kyle-sexton

Summary

Make plugin userConfig values that are identity-domain / directory dependent sourceable
per-directory, instead of only from machine-global pluginConfigs. Concretely for this
marketplace: let /source-control:babysit-prs (and the babysit-loop lane) resolve
babysit_watched_owners (and peer identity scalars — babysit_self_logins,
babysit_intended_write_identity) from an env-var fallback and/or a documented consumer file,
not solely from the substituted ${user_config.*} block.

Why this can't be done today (verified against upstream docs)

Claude Code v2.1.207+ reads pluginConfigs only from user settings, the --settings flag,
and managed settings
— a repo's .claude/settings.json / settings.local.json are ignored
for pluginConfigs (plugins-reference, "User configuration", min-version: 2.1.207). Claude Code
also does not cascade settings.json from ancestor directories (project settings resolve to the
git repo root only; parent-folder traversal is open FR anthropics/claude-code#12962). Net: a plugin
userConfig scalar is effectively machine-global — there is no first-class way to give it a
different value per repo or per directory tree via settings files.

That collides with any plugin option whose correct value depends on where you're working.

Concrete scenario (our example — a good general case)

One work machine hosts two GitHub identity domains side by side:

  • C:/Dev/GitHub/SETWorks/… → org SETWorks (account ksexton-sw)
  • C:/Projects/melodic/… → org melodic-software (account kyle-sexton)

Desired: babysit's owner allowlist is ["SETWorks"] under the SETWorks tree and
["melodic-software"] under the melodic tree — never crossing. But babysit_watched_owners is a
single global pluginConfigs value: set it to one org and the lane is dead in the other domain; set
it to the union and the app-layer allowlist no longer expresses the domain boundary at all.

What DOES already scope per-directory on 2.1.207+ is the env block (Claude still reads env
from .claude/settings.local.json). We rely on that today for the real write-boundary
(GH_CONFIG_DIR selects the gh account per repo; GitHub account authz then blocks cross-org writes).
The gap is only that the plugin's app-layer allowlist can't ride that same per-repo channel.

Generalized problem

Any plugin whose userConfig encodes a value that varies by the working directory's identity
domain
is affected, e.g.:

  • an owner/org allowlist (this case),
  • a per-domain API base URL / tenant / account id (a plugin that talks to a company vs. personal
    backend),
  • a profile/credential-dir selector (like GH_CONFIG_DIR, AWS_PROFILE, KUBECONFIG),
  • self-identity / author logins used for self-suppression.

For all of these, "one global value" is wrong on a multi-domain machine, and the safe direction is
fail-closed on domain mismatch, not silently inheriting the other domain's value.

Proposal (plugin-side — no Claude Code change required)

  1. Env-var fallback for identity scalars. Have babysit resolve babysit_watched_owners (and the
    listed peers) as: explicit invocation flag → CLAUDE_PLUGIN_OPTION_<KEY> / a documented
    BABYSIT_* env var
    → substituted ${user_config.*} → default. Because env is read from
    per-repo settings.local.json, this makes the value per-directory-settable today using the
    same channel that already scopes GH_CONFIG_DIR. (plugins-reference already exposes
    CLAUDE_PLUGIN_OPTION_<KEY> to hooks; extend the skill/scripts to honor it for these scalars.)
  2. Optional: a fail-closed domain assert. Before mutating, assert the resolved allowlist contains
    the target repo's own owner; refuse + report on mismatch (turns a silent wrong-domain scope into
    a loud early stop). Ties into source-control/babysit: owner allowlist (babysit_watched_owners) has no per-identity-domain scoping — multi-org machines fail open to wrong-org scope #1203.
  3. Document the multi-domain-machine recipe in /source-control:setup (env-per-repo +
    git includeIf + GH_CONFIG_DIR), so consumers aren't reverse-engineering the platform's
    pluginConfigs scoping limits.

Non-goals

Not asking Claude Code to add per-directory pluginConfigs (that's upstream FR #12962). This is a
plugin-side resolution-order enhancement that works within the current platform behavior.

Related

Activity

  1. added
    area: security
    on Jul 24, 2026
  2. kyle-sexton commented on Jul 24, 2026

    @kyle-sexton
    MemberAuthor

    Validation update — this reuses an EXISTING in-plugin pattern, it's not a new mechanism:

    • skills/pull-request/scripts/parse-branch-issue.sh already reads ${CLAUDE_PLUGIN_OPTION_BRANCH_ISSUE_PATTERN:-} from env as a userConfig fallback.
    • scripts/fetch-all-pr-comments.sh and scripts/babysit-readiness-gate.sh already read FETCH_COMMENTS_OWNER/FETCH_COMMENTS_REPO env overrides.

    So the ask is: extend the same env-override pattern to the identity scalars (babysit_watched_owners, babysit_self_logins, babysit_intended_write_identity). Because Claude Code reads env from per-repo .claude/settings.local.json (verified — that's how GH_CONFIG_DIR is scoped today), this makes the values per-directory-settable via the channel already in use, with no wrapper.

    Caveat for implementation: the snapshot script's --owners is REQUIRED (trust boundary) and the merge/resolve wrappers fail closed without --allowed-owners, so the resolution must happen where those flags are built (skill instruction to prefer the env value, and/or the scripts honoring the env fallback when building/validating the flag) — not a silent script default that could weaken the fail-closed posture.

    Confirmed platform constraints (Claude Code 2.1.218) motivating this: pluginConfigs is read only from user/managed/--settings (project & local .claude/settings*.json ignored) since v2.1.207; no ancestor-directory settings cascade (upstream FR anthropics/claude-code#12962, open); no settings-path env var. So env-fallback is the cleanest per-directory path that doesn't require a launch wrapper.

  3. kyle-sexton commented on Jul 24, 2026

    @kyle-sexton
    MemberAuthor

    Correction — retracting the env-channel approach; it violates this repo's own documented standard.

    docs/PLUGIN-PHILOSOPHY.md is explicit:

    • L214: "...graduates to the tracked consumer-project file on demonstrated need — never a custom env channel."
    • L222–223: "Do not add an environment variable merely to create a second configuration channel."
    • The customization-home table (L170–177) sanctions four homes only: invocation argument, userConfig (user-global), a tracked consumer-project file, and a gitignored overlay. No env channel.

    So the CLAUDE_PLUGIN_OPTION_BABYSIT_WATCHED_OWNERS env-fallback proposed above is off-standard and should NOT be built. My cited precedents don't sanction it either: FETCH_COMMENTS_OWNER is a narrow operational override (run from a non-checkout dir), not a personal-config channel; CLAUDE_PLUGIN_OPTION_* is the platform's native hook-only mirror (skills/Bash don't receive it) — neither is a general per-config env channel.

    Standard-aligned resolution instead:

    1. Default (zero-config, already shipping): unset babysit_watched_owners → the plugin infers the current repo's owner (SKILL.md 'unset behavior', lines ~82/290). On a multi-identity-domain machine this yields correct per-folder scoping with no config and no new mechanism. This is the cleanest and needs no plugin change.
    2. If an explicit per-repo pin is genuinely needed (watching an owner other than the repo's own), route it through the tracked .claude/source-control.md consumer file — the sanctioned 'tracked repository convention' mechanism the plugin ALREADY reads (loop-lane babysit_loop_* keys, commit/PR keys) — NOT env. That reframes the value as repository policy, which is what a per-repo owner scope actually is.

    Revised ask for this issue: decide whether babysit_watched_owners (for the per-repo case) should be readable from tracked .claude/source-control.md as repository policy, with the existing userConfig/infer path as the default when the tracked key is absent. Drop the env-fallback framing entirely.

    Cross-ref #1203 (the fail-closed domain-assert guard remains valid and is independent of the config channel).

  4. added
    needs-human
    on Jul 24, 2026
  5. kyle-sexton commented on Jul 24, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during the /work-items:work-loop autonomous drain cycle.

    Surfaced in the --autonomous frontier (unassigned, unblocked, not human-gated) but carries no role label — already triaged (priority set) yet never routed to agent-ready or needs-human. Content reads as structural/cross-cutting (convention, contract, or design-space work) rather than a scoped bug fix, so this cycle's admission gate classifies it C4-shaped or unclassified and routes it human-gated per the fail-closed default rather than admitting it to autonomous dispatch.

    Routing: added needs-human. No other state changed — priority and existing labels are left as-is. If this is actually scoped/delegable, re-label to agent-ready (+ status: ready) and it will be picked up by a later drain cycle.

  6. added theissue type on Aug 13, 2026
  7. kyle-sexton commented on Aug 13, 2026

    @kyle-sexton
    MemberAuthor

    Frontier disposition (drain session)

    Ruling: Close as not planned for this drain wave (frontier consensus).

    Dual-panel drain ruling: advisory, superseded, folded into a program umbrella, or blocked on a host/design carrier without an actionable in-repo slice this session. Re-open with a concrete acceptance brief if a consumer needs the work.

    KEEP set for this wave: standing telemetry; host-physical Class C (#631 family); program umbrellas #530/#531/#532/#535; live design carriers #1500/#1553/#1668/#1695/#1716/#1681/#1718; #1360.

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

    area: securityneeds-human

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions