Roll out Shield to a team

This page covers the Claude Code plugin, the repository policy file, and the rollout steps.

Stops your coding agent from deleting, leaking or dropping things. Records everything else. Same guard for everyone on the team.

Two ways to spread the kya plugin (see hosts/claude-plugin.md for what the plugin does):

Requires the first kya release that includes kya team. To check yours, run kya help --all: versions that have it list team init; older ones answer Unknown command: team.

This is OSS advisory mode. The plugin records every tool call on the local record (trail), blocks only the small never-list, and fails open (if kya is missing or broken, the tool call proceeds unrecorded). Rolling it out does not change that. Hosted enforcement is a separate product and is not configured by these commands.

Per repository: kya team init

Run it at the repository root:

kya team init --dry-run   # show the change, write nothing
kya team init             # write .claude/settings.json
git add .claude/settings.json && git commit -m "chore: enable the kya Claude Code plugin"

It merges two keys into .claude/settings.json and keeps every other key and the file’s indentation:

{
  "extraKnownMarketplaces": {
    "shield-kya": {
      "source": { "source": "github", "repo": "The-Pixel-Boys/shield-kya", "ref": "vX.Y.Z" }
    }
  },
  "enabledPlugins": { "kya@shield-kya": true }
}

vX.Y.Z is the version of the kya you ran, read from its package.json at runtime (the command prints it), so the marketplace is pinned to that release tag, never to a branch. Run kya team init again after you upgrade kya to move the pin; it only rewrites the ref. If the file already pins a newer tag than your kya, the change list says downgrade so you notice before committing. A prerelease kya (for example 0.32.6-rc.1, npm dist-tag next) refuses team init and team managed-settings: prereleases get no public tag, so there is no ref to pin. Use a stable kya.

The command makes no network call, so it cannot check that the tag exists. Do it once before you commit:

git ls-remote https://github.com/The-Pixel-Boys/shield-kya refs/tags/vX.Y.Z

No output means the tag is missing. Public release tags are created per release; v0.24.0 and v0.24.2 exist, v0.24.1 was never published to the public repository and has no tag.

What it does and does not do:

What a teammate sees after pulling the commit:

Per organization: kya team managed-settings

kya team managed-settings > kya.json

It prints the same two keys with the same tag pin. Recommended for file-based policy: drop the output into the managed-settings.d/ directory next to managed-settings.json (macOS /Library/Application Support/ClaudeCode/, Linux and WSL /etc/claude-code/, Windows C:\Program Files\ClaudeCode\), for example as managed-settings.d/kya.json, instead of editing a shared managed-settings.json. A managed or drop-in file that is not valid JSON makes Claude Code refuse to start, so validate it. Server-managed settings and MDM work too; when server-managed settings deliver any policy key, file and MDM plugin keys are ignored unless managedSourcesBehavior is "merge" (see managed settings). Users cannot turn off a plugin that managed settings enable.

Not in the output, on purpose:

See the organization guide for both.

Supply chain: what the pin protects and what it does not

A committed settings file that enables a plugin decides what code runs on every teammate’s machine. Treat it like a dependency.

Repository policy: .kya/policy.json

The first kya team init also creates .kya/policy.json. It has no rules, so it changes no verdict. Commit it with .claude/settings.json. Add tool ids to make the local gate stricter for everyone who clones the repository:

{
  "version": 1,
  "deny": ["example.tool.id"],
  "requireApprove": ["example.other.tool"]
}

Rules:

.kya/config.json is not written

The OSS baseline is observe mode, which is what kya does when .kya/config.json has no gateMode. The only gate key that file supports is gateMode (hold or offline), and neither is an advisory baseline, so kya team init leaves it alone.

Undo

Remove the shield-kya entry and the kya@shield-kya line from .claude/settings.json, delete .kya/policy.json if you do not want its rules, and commit. Each teammate can then run /plugin uninstall kya@shield-kya.

For contributors: the manual end-to-end check

CI runs the unit and integration tests. The end-to-end check against a real Claude Code is opt-in, because it needs the claude CLI and reaches GitHub and npm for the plugin bootstrap. It makes no model call (the API base URL is a dead loopback port) and uses temporary HOME directories only:

pnpm build && KYA_CLAUDE_E2E=1 npx vitest run test/team.test.ts

A team lead runs kya team init and commits; a second user with a clean HOME and a fresh clone starts claude -p. It checks that the plugin loads from the pinned tag and that an untrusted folder adds no marketplace. It does not automate the folder trust prompt (trust is seeded through hasTrustDialogAccepted) and it serves the marketplace from a local git copy at the tag rather than from GitHub.