npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sinm/kai

v1.9.0

Published

KAi — Multi-Agent Collaborative Chat

Readme

KAi

开启思考。不是帮你做事,是帮你想得更深、更远。

KAi 是一款多 AI Agent 协作桌面应用。你可以创建多个拥有独立人格、记忆和技能的 Agent,让它们在你的桌面上像一个真正的团队一样协作——讨论、交接、互审、分工。

为什么

用 ChatGPT 聊天,你得到的是一个无所不能但什么都记不住的通用助手。

KAi 不一样。你可以让一个"乔布斯"负责产品思考,一个"Anders Hejlsberg"把控架构,一个"TJ Holowaychuk"写代码,一个"Robert C. Martin"写审查。它们各有各的记忆、工具权限和个性。它们会 @mention 彼此,会交接任务,会监督结果。

一个人,一支团队。

特性

🧠 Agent 系统

  • 独立身份 — 每个 Agent 有自己的名字、头像、个性描述,甚至可以自定义 SOUL(行为准则)
  • 持久记忆 — Agent 自主维护 MEMORY.md(长期记忆)和每日笔记,跨会话记住上下文
  • 工作空间 — 每个 Agent 拥有独立的文件工作空间(~/.kai/agents/{id}/workspace/
  • Skill 技能系统 — 可扩展的技能包,Agent 按需加载,提升专业领域表现

👥 多 Agent 协作

  • 群聊模式 — 多个 Agent 在同一个对话中协作,支持 sequential / parallel / broadcast 策略
  • Handoff 交接 — Agent 之间可以主动交接任务,附带原因和上下文摘要
  • @mention — 在回复中 @AgentName 触发自动交接
  • Supervisor 监督 — 指定一个 Agent 作为监督者,评估执行结果是否达成目标
  • 子任务分派 — Agent 可以创建前台/后台子任务,委托给其他 Agent 执行

🛠 内置工具

Agent 开箱即用的能力:

| 工具 | 功能 | |------|------| | Shell | 执行终端命令 | | Read/Write/Edit File | 读写和精确编辑本地文件 | | Web Search | 网络搜索 | | Web Fetch | 抓取和解析网页内容 | | Database | 查询应用数据库(只读) | | Scheduler | 创建和管理定时任务 | | Skill | 加载和执行技能包 | | MCP | 通过 Model Context Protocol 连接外部工具服务器 |

💬 聊天体验

  • 流式输出,实时渲染 Markdown / 代码高亮 / 推理过程
  • 支持图片附件
  • 明暗主题自适应
  • 中英文国际化(i18n)

技术栈

Electron 40 + React 19 + TypeScript 5
Vercel AI SDK + SQLite3 + Zustand + CSS Modules
electron-vite + Vitest
  • 主进程:Agent 执行引擎、IPC、数据库、文件系统、MCP 客户端
  • 渲染进程:React UI,沙箱化运行(contextIsolation: true
  • 预加载层contextBridge 安全桥接

快速开始

环境要求

  • Node.js >= 22
  • Yarn

安装

git clone https://github.com/your-org/kai.git
cd kai
yarn install

开发

yarn dev          # 启动开发服务器(支持 HMR)

构建

yarn build        # 构建生产版本
yarn package      # 打包为平台安装包(输出到 release/)

测试

yarn test              # 运行测试
yarn test:ui           # 测试 UI
yarn test:coverage     # 覆盖率报告

架构

Agent 执行层

SoloExecutor          ← 单 Agent 对话
SwarmExecutor         ← 多 Agent 群聊(管理 handoff 循环)
  ├── AgentExecutor   ← 单次 LLM 调用(流式 + 工具执行循环)
  ├── SupervisorLoop  ← 监督评估循环
  ├── TaskOrchestrator ← 子任务创建和管理
  └── SwarmContext    ← 共享状态(handoff chain、task map)

消息压缩管线

长对话自动压缩,4 级策略管道:

ToolResultSpill(合并冗长工具结果)
  → ReasoningRemoval(移除推理过程)
    → Summarization(摘要旧消息)
      → Pruning(裁剪最旧消息)

数据存储

~/.kai/
├── kai.db                    # SQLite 主数据库
├── config/                   # 应用配置(加密存储 API Key)
├── agents/
│   └── {agentId}/
│       └── workspace/        # Agent 工作空间
│           ├── IDENTITY.md   # 身份定义
│           ├── SOUL.md       # 行为准则
│           ├── MEMORY.md     # 长期记忆
│           ├── USER.md       # 用户信息
│           ├── AGENTS.md     # 工作指南
│           ├── TOOLS.md      # 环境配置
│           └── memory/       # 每日笔记
├── attachments/              # 对话附件
└── sessions/                 # 会话消息存储

支持的 LLM

KAi 通过 Vercel AI SDK 连接大语言模型,支持:

  • OpenAI Compatible(OpenAI、DeepSeek、Moonshot、MiniMax 等)
  • Anthropic Claude
  • Google Gemini
  • 任何兼容 OpenAI API 的模型

在设置的 LLM 通道中配置 API Key 即可使用。

MCP(Model Context Protocol)

KAi 内置 MCP 客户端支持。在设置中配置 MCP 服务器,即可让 Agent 使用外部工具:

{
  "mcp": {
    "servers": {
      "my-server": {
        "command": "npx",
        "args": ["-y", "@my/mcp-server"]
      }
    }
  }
}

项目结构

src/
├── main/                  # Electron 主进程
│   ├── agent/             # Agent 执行引擎
│   │   ├── SoloExecutor   # 单 Agent 执行器
│   │   ├── SwarmExecutor  # 群聊执行器
│   │   ├── AgentExecutor  # LLM 调用执行器
│   │   ├── SupervisorLoop # 监督循环
│   │   ├── TaskOrchestrator # 任务编排
│   │   ├── SwarmContext   # 共享上下文
│   │   ├── HandoffResolver # Handoff 解析
│   │   └── factory/       # Prompt/Tools 构建
│   ├── compression/       # 消息压缩管线
│   ├── config/            # 配置管理(加密)
│   ├── db/                # SQLite 数据层
│   ├── handlers/          # IPC 处理器
│   ├── mcp/               # MCP 客户端
│   ├── scheduler/         # 定时任务系统
│   ├── skill/             # Skill 技能系统
│   ├── storage/           # 会话/附件存储
│   ├── tools/             # 内置工具
│   └── workspace/         # Agent 工作空间管理
├── renderer/              # React 渲染进程
│   └── src/
│       ├── components/    # UI 组件
│       ├── stores/        # Zustand 状态管理
│       ├── locales/       # i18n 翻译文件
│       └── styles/        # 设计令牌 + CSS Modules
├── preload/               # 安全桥接层
└── shared/                # 主进程/渲染进程共享类型

安全模型

KAi 采用 Electron 三进程安全架构:

  • 渲染进程:完全沙箱化,无 Node.js 访问
  • 预加载层contextIsolation: true + nodeIntegration: false
  • 主进程:所有文件系统、网络操作通过 IPC 暴露给渲染进程
  • API Key:AES-256 加密存储,使用机器唯一标识派生密钥

License

MIT