Skip to content

feat: squirrel channel, push cloud audit events into a running Claude Code session #569

Closed

Description

@nc9

Problem or use case

When a scheduled squirrelscan cloud audit finishes or fails, or opens new issues, the coding agent working on that site doesn't find out until someone asks it to check. We want squirrelscan to ping the running agent session ("last night's audit of example.com found 11 new issues") so the agent can triage and fix without being prompted.

Claude Code supports this through channels (research preview): a local stdio MCP server declares capabilities.experimental['claude/channel'] and sends notifications/claude/channel with { content, meta }. Claude sees a <channel source="..."> event and starts a turn, even if the session is idle. Docs: https://code.claude.com/docs/en/channels and https://code.claude.com/docs/en/channels-reference

Channels have to be local stdio servers. A hosted MCP server can't be one, so the bridge has to be the squirrel binary, which already holds the user's cloud login.

Proposed behavior

A new squirrel channel command that runs a stdio MCP channel server. It polls the logged-in org's cloud notification feed and emits a channel event for each new audit_complete, audit_failed and issues_detected notification.

  • Declare capabilities.experimental['claude/channel'] = {}. Do not declare claude/channel/permission (permission relay): nobody but Claude Code should be able to approve tool use in the session.
  • instructions (8,192-character cap) explains what the events mean and which squirrelscan tools to call next (get_report, list_issues, compare_audits).
  • meta keys must match [A-Za-z0-9_], because Claude Code silently drops keys with hyphens: use website_id, run_id, category, domain.
  • Event content is built from ids, counts and fixed strings only, never from text taken from crawled pages (titles, issue text). That text is attacker-influenced, and an ungated channel is a prompt-injection vector. The agent pulls details through tools.
  • Negotiate the legacy MCP handshake. Claude Code does not register a channel server that negotiates MCP revision 2026-07-28.
  • Persist the last-seen cursor per org under ~/.squirrel/ so a restart catches up exactly once. Channels only deliver while a session is open, and Claude Code doesn't replay events.
  • No cloud login: emit a single event telling the agent the user needs to run squirrel login, and keep running.

Needs a cursor (after=) on the cloud notification feed. That's tracked on the cloud side.

Alternatives considered

  • Making the hosted MCP server the channel: not possible, because channels are stdio only.
  • Cloud webhooks into the developer machine: needs a public URL or tunnel.
  • MCP Triggers & Events (a standard server-to-client push mechanism): still at the ideating stage in the MCP working group. Revisit once it lands, so agents other than Claude Code get the same push.

Who it helps

Claude Code users with scheduled cloud audits who want their agent to follow up on results automatically.

Rollout caveat: only plugins on Anthropic's channel allowlist register with --channels. Until squirrelscan is listed, users need --dangerously-load-development-channels server:squirrelscan, or an org admin who adds us to allowedChannelPlugins. Team and Enterprise orgs must also set channelsEnabled.

Acceptance Criteria

  • squirrel channel starts a stdio MCP server that Claude Code registers as a channel when launched with --dangerously-load-development-channels server:squirrelscan.
  • When a cloud audit for the logged-in org completes, the open session receives a channel event within 60 seconds, carrying category, website_id, run_id and domain meta and a one-line summary.
  • audit_failed and issues_detected notifications are also delivered, and the delivered categories are configurable.
  • Events that happened while Claude Code was closed are delivered exactly once on the next start.
  • Event content never includes text taken from crawled pages.
  • With no cloud login, the server emits one event explaining how to log in, and does not crash.
  • The poll interval is configurable and backs off on 429 or 5xx responses.
  • Shell completions in apps/cli/src/self/completion.ts include the new command.
  • The new behavior is documented in docs/, including the allowlist and development-flag caveats.

Generated by Claude Code

Activity

  1. added
    enhancement
    P2
    size: M
    on Oct 8, 2026
  2. added
    size: XS
    and removed
    size: M
    on Oct 10, 2026
  3. nc9 commented on Oct 10, 2026

    @nc9
    ContributorAuthor

    Ticked criteria 3 to 9: #571 (shipped in v0.0.106) adds squirrel channel with tests for categories, restart catch-up (poller.test.ts), no crawled text (events.test.ts), the no-login event, interval and 429/5xx backoff (server.test.ts), completions and docs/developers/channel.mdx. The cloud feed's after= cursor has also landed.

    Left: criteria 1 and 2 are covered by a stdio e2e test against a mock feed, but not yet checked live: start Claude Code with --dangerously-load-development-channels server:squirrelscan, run a cloud audit, and see the event arrive within 60 seconds with its meta. Resized to XS, since only that check remains.

  4. nc9 commented on Oct 11, 2026

    @nc9
    ContributorAuthor

    Checked against 0.0.108 and current main (ad95fb2): CANNOT TEST HERE for criteria 1 and 2. They need a live Claude Code session started with --dangerously-load-development-channels server:squirrelscan, a cloud login and a real cloud audit.

    One thing for whoever runs the live check: squirrel channel moved to the v2 MCP SDK after 0.0.108 (#654). On main, apps/cli/src/channel/server.ts builds its own Server with supportedProtocolVersions: CHANNEL_PROTOCOL_VERSIONS, which keeps only the versions before 2026-07-28 (lines 50 to 62). It also avoids serveStdio, so the legacy-handshake requirement looks preserved. Since #654 is not in 0.0.108, the live check should run on a build that includes it, so it tests the code that will ship.

  5. nc9 commented on Oct 13, 2026

    @nc9
    ContributorAuthor

    Direction change (maintainer): the channel moves into squirrel mcp, which becomes a stdio front end for the hosted MCP. See #737. The rules here still apply (ids and counts only, no permission relay, catch up exactly once); the event source becomes the hosted MCP's events instead of a separate poller.

  6. added theissue type on Oct 28, 2026
  7. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Checked against main (23a34c1, v0.0.144). Ticked what holds. Open: criteria 1 and 2 (registering in a live Claude Code session and delivery within 60 seconds) are only covered by a stdio e2e test against a mock feed, and the direction moved into squirrel mcp (#737) while apps/cli/src/channel still exists on main. Needs a live check or a restated criterion.

    nik

  8. nc9 commented on Nov 13, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.106: 4892263 "add squirrel channel to push cloud audit events into Claude Code (#571)" (an ancestor of the v0.0.106 tag); docs/cli/channel.mdx documents it, and the v0.0.106 CHANGELOG entry describes it.

    nik

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

    P2enhancementsize: XS

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions