This file provides guidance to Claude Code when working with code in this repository.
This is an OpenClaw plugin that bridges Linear's native Agent Session webhooks to OpenClaw agent runs. The live architecture is runtime-centered: Linear is a conversational surface, not a plugin-hosted tool API.
npm run build # runs tsc
npm test # builds, then runs node tests from dist/src/**/*.test.jsTypeScript sources in index.ts + src/ compile to dist/.
Registers three HTTP routes via api.registerHttpRoute:
POST /plugins/linear/linear— native Linear Agent Session webhook receiverPOST /plugins/linear/oauth/callback— OAuth callback helperPOST /plugins/linear/oauth/exchange— OAuth code exchange helper
No /plugins/linear/api route is registered.
src/
types.ts — shared runtime interfaces
config.ts — normalizeCfg() for active plugin config
util.ts — HTTP/body/header/json helpers
linear-client.ts — callLinear() for all Linear GraphQL communication
graphql/
queries.ts — GraphQL query strings
mutations.ts — GraphQL mutation strings
runtime/
handler.ts — createLinearWebhook() and session turn execution
payload.ts — webhook normalization and trigger extraction
prompt.ts — chat-first/task-mode prompt shaping
gateway.ts — OpenClaw gateway invocation
session-resolver.ts — comment webhook session lookup + fallback cache
issue-policy.ts — issue start/delegate policy on session create
skip-filter.ts — self-authored comment detection
validation.ts — HMAC-SHA256 signature verification
oauth/
route.ts — OAuth callback/exchange route
refresh.ts — token refresh helper
token-store.ts — persisted OAuth token storage
- Linear sends POST to
/plugins/linear/linear. - The runtime validates the signature, rejects stale payloads, and responds
202immediately. - It normalizes the native Agent Session payload and resolves the session ID for comment follow-ups when needed.
- It posts an immediate visible
thoughtactivity so the user sees a fast acknowledgement. - It runs one OpenClaw turn against a stable session key.
- It publishes exactly one final Linear
responseorerror.
- callLinear() in
linear-client.ts— single gateway for all Linear GraphQL calls - Persistent session identity — one Linear session maps to one OpenClaw session key
- Immediate visible ack —
runtime/handler.tsposts a visiblethoughtbefore the agent turn completes - Session ID resolution — direct field first, then fallback lookup for comment webhooks
- No plugin-side API proxy — do not reintroduce
/plugins/linear/apiunless the product direction changes
Defined in openclaw.plugin.json. Active runtime options:
agentId/devAgentIdlinearWebhookSecretlinearApiKeyor OAuth credentials +linearTokenStorePathopenclawProvider/openclawModel/openclawThinkinglinearDebugToolTracerepoByTeam/repoByProject/defaultDirdelegateOnCreate/startOnCreateexternalUrlBase/externalUrlLabel
openclaw.plugin.json may still expose a few [legacy] compatibility fields for older installs, but the runtime ignores them. In particular, /plugins/linear/api is not part of the live runtime.