本地优先AI代理工具

Sniff是一个基于YAML配置的本地优先AI代理工具,支持与Linear平台集成,适用于自动化代码执行和任务管理。

  • by caiopizzol
  • TypeScript
  • 本地部署
  • 7 星标
  • 更新于
在 GitHub 查看 sniff-dev/sniff

使用说明

Sniff-用于线性的本地优先AI代理

在您的机器上运行的声明性AI代理。比如Docker Compose for AI代理。

使用简单的YAML配置部署AI代理。代码执行保持在本地,只有webhook路由通过云。

建筑

flowchart LR
    Linear -->|webhook| Proxy[Proxy]
    CLI[Local CLI] -->|WebSocket| Proxy
    Proxy -->|forward| CLI
    CLI --> Claude[Claude Code]
    CLI --> Worktree[Git Worktree]
  • 本地优先:代理在您的计算机上运行,具有完全的代码库访问权限
  • 孤立执行:每个问题都有自己的git工作树
  • 线性制剂API:与Linear代理平台的原生集成
  • 无数据库:配置来自YAML,令牌存储在本地 ~/.sniff/

快速开始

# Install Bun if you haven't
curl -fsSL https://bun.sh/install | bash

# Clone and install
git clone https://github.com/caiopizzol/sniff
cd sniff
bun install

# Initialize config
bun run apps/cli/src/index.ts init

# Authenticate with Linear
bun run apps/cli/src/index.ts auth linear

# Start the agent
bun run apps/cli/src/index.ts start

配置

sniff.yml -代理定义(提交到git):

version: "2.0"

agents:
  - id: triage-agent
    name: Triage Agent
    label: triage # Triggered when this label is applied
    systemPrompt: |
      You are a triage agent. When assigned an issue:
      1. Analyze the issue description
      2. Explore the codebase for context
      3. Suggest next steps or solutions
    runner:
      claude:
        allowedTools:
          - Read
          - Glob
          - Grep

CLI命令

sniff init              # Create sniff.yml
sniff validate          # Validate configuration
sniff auth linear       # Authenticate with Linear (OAuth)
sniff start             # Start local agent server
sniff stop              # Stop running agent
sniff status            # Show agent status
sniff logs              # View execution logs

运作原理

  1. CLI连接 → WebSocket连接到云代理
  2. 线性webhook火灾 → 分配给代理人或贴上标签
  3. 代理转发 → 通过WebSocket将webhook路由到CLI
  4. 已创建工作树 → 用于隔离执行的Git工作树
  5. 克劳德执行 → 在系统提示和工具限制下运行
  6. 结果公布 → 代理响应出现在Linear中

项目结构

sniff/
├── apps/
│   ├── cli/              # CLI application
│   ├── proxy/            # Cloudflare Worker
│   ├── web/              # Web application
│   └── docs/             # Documentation site
├── packages/
│   ├── core/             # Shared types, env config, logger
│   ├── config/           # Zod schemas, YAML loading
│   ├── connection/       # WebSocket CLI-proxy communication
│   ├── linear/           # Webhook parsing, API client
│   ├── orchestrator/     # Server, worktree manager
│   ├── runner-claude/    # Claude Code SDK wrapper
│   └── storage/          # Filesystem storage (~/.sniff/)
└── sniff.yml             # Your agent configuration

环境变量

所有环境变量都是可选的,具有合理的默认值:

变量 默认值 描述
SNIFF_PROXY_URL https://proxy.sniff.to webhooks的代理URL
SNIFF_PORT 3847 本地服务器端口
LINEAR_WEBHOOK_SECRET - Webhook签名验证

令牌存储在本地 ~/.sniff/tokens/ 运行后 sniff auth.

发展

# Install dependencies
bun install

# Run CLI in development
bun run apps/cli/src/index.ts [command]

# Type check
bun run typecheck

# Lint
bun run lint

# Run tests
bun test

自托管代理(可选)

默认情况下,Sniff使用 https://proxy.sniff.to。要运行自己的代理:

cd apps/proxy
bunx wrangler deploy

然后设置 SNIFF_PROXY_URL=https://your-proxy.workers.dev 并配置Linear webhooks以指向 https://your-proxy.workers.dev/webhook/linear.

许可证

麻省理工学院

支持