Linear Webhook Skill
Enables Linear issue comment @mentions to dispatch tasks to Clawdbot agents.
How It Works
- 1. Comment in Linear:
@mason implement user authentication or INLINECODE1 - Linear webhook fires on comment creation
- Clawdbot receives webhook via exposed endpoint
- Transform parses payload:
- Extracts @mason or @eureka mention
- Gets issue context (title, description, labels)
- Prepares task prompt
- 5. Routes to agent session:
- @mason →
mason agent (code/implementation)
- @eureka →
eureka agent (planning/strategy)
- 6. Agent processes task and returns result
- Result posted back as Linear comment
Setup
1. Configure Clawdbot Webhooks
Add to your config.json5:
CODEBLOCK0
2. Expose Webhook Endpoint
Use Cloudflare Tunnel or Tailscale Funnel to make webhook publicly accessible:
Option A: Cloudflare Tunnel (Recommended)
CODEBLOCK1
Option B: Tailscale Funnel
CODEBLOCK2
Note the public URL (e.g., https://your-tunnel.trycloudflare.com)
3. Configure Linear Webhook
- 1. Go to Linear Settings → API → Webhooks
- Click "Create new webhook"
- Set URL: INLINECODE6
- Add custom header: INLINECODE7
- Select events: Comment → Created
- Save webhook
4. Test
Comment in a Linear issue:
CODEBLOCK3
Expected flow:
- 1. Webhook fires to Clawdbot
- Mason agent receives task
- Mason implements or responds
- Result posted back to Linear issue as comment
Agent Routing
- - @mason → Code implementation, debugging, technical tasks
- @eureka → Planning, strategy, research, communication
- Other mentions → Ignored (not handled)
Issue Context Provided
The agent receives:
- - Issue title
- Issue description
- Issue labels
- Comment text (the @mention)
- Issue URL
- Commenter name
Customization
Add More Agents
Edit linear-transform.js:
CODEBLOCK4
Change Response Behavior
Modify deliver and channel in config:
CODEBLOCK5
This will also send agent responses to Telegram.
Security
- - Never commit hook token to version control
- Use environment variables: INLINECODE11
- Verify webhook source (Linear's IP ranges if needed)
- Use HTTPS only (Cloudflare Tunnel provides this)
Troubleshooting
Webhook not firing
- - Check Linear webhook logs (Settings → API → Webhooks → View logs)
- Verify tunnel is running: INLINECODE12
- Check Clawdbot logs: INLINECODE13
Agent not responding
- - Check transform is loading: Look for errors in gateway logs
- Verify agent session exists: INLINECODE14
- Test transform manually: INLINECODE15
Response not posting to Linear
- - Implement Linear API comment posting in transform
- Add Linear API token to config
- See
linear-transform.js for example
Linear API Access
To post comments back to Linear, you need a Linear API token:
- 1. Go to Linear Settings → API → Personal API keys
- Create new token with
write scope - Add to environment: INLINECODE18
- Transform will use this to post responses
Files
- -
SKILL.md - This documentation - INLINECODE20 - Webhook payload parser and agent router
- INLINECODE21 - Linear GraphQL API client (for posting comments)
- INLINECODE22 - Sample Linear webhook payload for testing
References
Linear Webhook 技能
支持通过 Linear 问题的评论 @提及 将任务分派给 Clawdbot 智能体。
工作原理
- 1. 在 Linear 中评论: @mason 实现用户认证 或 @eureka 规划 Q2 路线图
- Linear webhook 触发 在评论创建时
- Clawdbot 接收 webhook 通过暴露的端点
- 转换模块解析载荷:
- 提取 @mason 或 @eureka 提及
- 获取问题上下文(标题、描述、标签)
- 准备任务提示
- 5. 路由到智能体会话:
- @mason → mason 智能体(代码/实现)
- @eureka → eureka 智能体(规划/策略)
- 6. 智能体处理任务 并返回结果
- 结果回帖 作为 Linear 评论
设置
1. 配置 Clawdbot Webhook
添加到您的 config.json5:
json5
{
hooks: {
enabled: true,
token: your-secret-token-here, // 使用 openssl rand -base64 32 生成
path: /hooks,
transformsDir: /home/sven/clawd-mason/skills/linear-webhook,
mappings: [
{
name: linear,
match: {
path: /linear,
method: POST
},
action: agent,
transform: {
module: ./linear-transform.js,
export: transformLinearWebhook
},
deliver: false, // 不自动发送到聊天 - Linear 评论处理响应
}
]
}
}
2. 暴露 Webhook 端点
使用 Cloudflare Tunnel 或 Tailscale Funnel 使 webhook 可公开访问:
选项 A:Cloudflare Tunnel(推荐)
bash
如需安装
brew install cloudflared
启动隧道(替换为您的域名)
cloudflared tunnel --url http://localhost:18789
选项 B:Tailscale Funnel
bash
启用 funnel
tailscale funnel 18789
记下公共 URL(例如 https://your-tunnel.trycloudflare.com)
3. 配置 Linear Webhook
- 1. 进入 Linear 设置 → API → Webhooks
- 点击创建新 webhook
- 设置 URL:https://your-tunnel.trycloudflare.com/hooks/linear
- 添加自定义标头:x-clawdbot-token: your-secret-token-here
- 选择事件:评论 → 已创建
- 保存 webhook
4. 测试
在 Linear 问题中评论:
@mason 在登录页面添加用户认证
预期流程:
- 1. Webhook 触发到 Clawdbot
- Mason 智能体接收任务
- Mason 实现或响应
- 结果回帖到 Linear 问题作为评论
智能体路由
- - @mason → 代码实现、调试、技术任务
- @eureka → 规划、策略、研究、沟通
- 其他提及 → 忽略(不处理)
提供的问题上下文
智能体接收:
- - 问题标题
- 问题描述
- 问题标签
- 评论文本(@提及)
- 问题 URL
- 评论者姓名
自定义
添加更多智能体
编辑 linear-transform.js:
javascript
const AGENT_MENTIONS = {
@mason: mason,
@eureka: eureka,
@designer: designer, // 添加您自己的智能体
};
更改响应行为
修改配置中的 deliver 和 channel:
json5
{
deliver: true,
channel: telegram,
to: 1878354815, // 您的 Telegram 聊天 ID
}
这也会将智能体响应发送到 Telegram。
安全性
- - 切勿将 hook 令牌 提交到版本控制
- 使用环境变量:CLAWDBOTHOOKTOKEN
- 验证 webhook 来源(必要时使用 Linear 的 IP 范围)
- 仅使用 HTTPS(Cloudflare Tunnel 提供此功能)
故障排除
Webhook 未触发
- - 检查 Linear webhook 日志(设置 → API → Webhooks → 查看日志)
- 验证隧道正在运行:curl https://your-tunnel.trycloudflare.com/hooks/linear
- 检查 Clawdbot 日志:clawdbot gateway logs
智能体未响应
- - 检查转换模块是否加载:查看网关日志中的错误
- 验证智能体会话存在:clawdbot sessions list
- 手动测试转换模块:node linear-transform.js
响应未发布到 Linear
- - 在转换模块中实现 Linear API 评论发布
- 将 Linear API 令牌添加到配置
- 参见 linear-transform.js 示例
Linear API 访问
要将评论回帖到 Linear,您需要一个 Linear API 令牌:
- 1. 进入 Linear 设置 → API → 个人 API 密钥
- 创建具有 write 作用域的新令牌
- 添加到环境:CLAWDBOTLINEARAPIKEY=linapi_...
- 转换模块将使用此令牌发布响应
文件
- - SKILL.md - 本文档
- linear-transform.js - Webhook 载荷解析器和智能体路由器
- linear-api.js - Linear GraphQL API 客户端(用于发布评论)
- example-payload.json - 用于测试的示例 Linear webhook 载荷
参考