@jun133/kitty 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +208 -202
- package/dist/cli.js +3209 -2564
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,202 +1,208 @@
|
|
|
1
|
-
# 小猫智能体 Kitty
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<strong>🐾 一个本地 agent 编程工作台:搜得到,看得懂,改得准,跑得通,记得住,能继续。</strong>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<a href="https://www.npmjs.com/package/@jun133/kitty"><img alt="npm" src="https://img.shields.io/npm/v/%40jun133%2Fkitty?color=111827&label=npm"></a>
|
|
9
|
-
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D20-339933">
|
|
10
|
-
<img alt="typescript" src="https://img.shields.io/badge/TypeScript-5.9-3178C6">
|
|
11
|
-
<img alt="license" src="https://img.shields.io/badge/license-MIT-0f766e">
|
|
12
|
-
<img alt="agent" src="https://img.shields.io/badge/mode-agent-7c3aed">
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
小猫智能体是给本地代码仓库使用的 agent harness。
|
|
16
|
-
|
|
17
|
-
它把模型、工具、上下文、会话、变更记录和验证事实收进一个稳定的本地编程体验里,让长任务可以被推进、保存、恢复和继续。
|
|
18
|
-
|
|
19
|
-
## ✨ 为什么是小猫智能体
|
|
20
|
-
|
|
21
|
-
小猫智能体的核心体验很明确:
|
|
22
|
-
|
|
23
|
-
- 🧭 一个 agent 主循环负责推进任务。
|
|
24
|
-
- 🛠️ 四个 core 工具完成基础编程闭环。
|
|
25
|
-
- 🧩 扩展能力通过 extension 进入,保持核心清楚。
|
|
26
|
-
- 🧠 Context 和 Session 专门负责连续性。
|
|
27
|
-
- 📌 机器层执行、记录、恢复事实;模型基于目标和证据判断路线。
|
|
28
|
-
|
|
29
|
-
## 🚀 当前能力
|
|
30
|
-
|
|
31
|
-
| 能力 | 当前事实 |
|
|
32
|
-
| --- | --- |
|
|
33
|
-
| 🧭 Agent 循环 | 模型、工具、session、收尾都在同一个主循环里推进 |
|
|
34
|
-
| 🧠 Context |
|
|
35
|
-
| 💾 Session | 会话记录、checkpoint、todo
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
| `kitty
|
|
84
|
-
| `kitty
|
|
85
|
-
| `kitty
|
|
86
|
-
| `kitty
|
|
87
|
-
| `kitty
|
|
88
|
-
| `kitty
|
|
89
|
-
| `kitty
|
|
90
|
-
| `kitty
|
|
91
|
-
| `kitty
|
|
92
|
-
| `kitty
|
|
93
|
-
| `kitty
|
|
94
|
-
| `kitty
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
| `
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- `
|
|
147
|
-
- `
|
|
148
|
-
- `
|
|
149
|
-
- `
|
|
150
|
-
- `
|
|
151
|
-
- `
|
|
152
|
-
- `
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
npm.cmd run verify
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
1
|
+
# 小猫智能体 Kitty
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>🐾 一个本地 agent 编程工作台:搜得到,看得懂,改得准,跑得通,记得住,能继续。</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@jun133/kitty"><img alt="npm" src="https://img.shields.io/npm/v/%40jun133%2Fkitty?color=111827&label=npm"></a>
|
|
9
|
+
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D20-339933">
|
|
10
|
+
<img alt="typescript" src="https://img.shields.io/badge/TypeScript-5.9-3178C6">
|
|
11
|
+
<img alt="license" src="https://img.shields.io/badge/license-MIT-0f766e">
|
|
12
|
+
<img alt="agent" src="https://img.shields.io/badge/mode-agent-7c3aed">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
小猫智能体是给本地代码仓库使用的 agent harness。
|
|
16
|
+
|
|
17
|
+
它把模型、工具、上下文、会话、变更记录和验证事实收进一个稳定的本地编程体验里,让长任务可以被推进、保存、恢复和继续。
|
|
18
|
+
|
|
19
|
+
## ✨ 为什么是小猫智能体
|
|
20
|
+
|
|
21
|
+
小猫智能体的核心体验很明确:
|
|
22
|
+
|
|
23
|
+
- 🧭 一个 agent 主循环负责推进任务。
|
|
24
|
+
- 🛠️ 四个 core 工具完成基础编程闭环。
|
|
25
|
+
- 🧩 扩展能力通过 extension 进入,保持核心清楚。
|
|
26
|
+
- 🧠 Context 和 Session 专门负责连续性。
|
|
27
|
+
- 📌 机器层执行、记录、恢复事实;模型基于目标和证据判断路线。
|
|
28
|
+
|
|
29
|
+
## 🚀 当前能力
|
|
30
|
+
|
|
31
|
+
| 能力 | 当前事实 |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| 🧭 Agent 循环 | 模型、工具、session、收尾都在同一个主循环里推进 |
|
|
34
|
+
| 🧠 Context | 项目上下文、项目地图、运行时上下文、工作记忆、长上下文压缩 |
|
|
35
|
+
| 💾 Session | 会话记录、checkpoint、todo、恢复现场、结构化可审阅 memory assets |
|
|
36
|
+
| 🗺️ Project Map | 目录、入口、脚本、测试、spec 和 git 事实进入短项目地图 |
|
|
37
|
+
| 🔌 Provider | OpenAI-compatible provider、请求恢复、连接诊断 |
|
|
38
|
+
| 🛠️ Core tools | `read`、`edit`、`write`、`bash` |
|
|
39
|
+
| 🧩 Extensions | `todo`、`worktree`、`network`、`background`、`subagent`、`skills`、`spec` |
|
|
40
|
+
| 🧾 Control plane | SQLite 账本记录 task lifecycle、execution、deadline、输出健康、wait policy、pid、状态和 wake 事实;host 负责等待和恢复 lead |
|
|
41
|
+
| 📐 Spec 模式 | `requirements.md`、`design.md`、`tasks.md`、`notes.md` 和隔离 worktree |
|
|
42
|
+
| 💬 产品面 | CLI、交互终端、Telegram 私聊服务 |
|
|
43
|
+
| 📎 证据记录 | 事件、终端日志、崩溃记录、文件变更记录 |
|
|
44
|
+
| 🧪 Evaluation | `kitty eval` 暴露真实 agent 体验验收场景 |
|
|
45
|
+
|
|
46
|
+
## ⚡ 快速开始
|
|
47
|
+
|
|
48
|
+
安装依赖并构建:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm.cmd install
|
|
52
|
+
npm.cmd run build
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
初始化当前项目:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
kitty init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
启动交互式 agent:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
kitty
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
执行一次明确任务:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
kitty "检查这个仓库并修复失败测试"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
进入 spec 工作流:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
kitty spec
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## ⌨️ 常用命令
|
|
80
|
+
|
|
81
|
+
| 命令 | 用途 |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `kitty` | 进入默认 agent 交互,或直接接收一次性 prompt |
|
|
84
|
+
| `kitty agent` | 显式进入 agent 模式 |
|
|
85
|
+
| `kitty spec` | 进入 requirements -> design -> tasks -> implement -> validate 工作流 |
|
|
86
|
+
| `kitty resume [sessionId]` | 恢复最近会话或指定会话 |
|
|
87
|
+
| `kitty sessions` | 查看最近会话 |
|
|
88
|
+
| `kitty config show` | 查看从 `.kitty/.env` 解析出的当前运行配置 |
|
|
89
|
+
| `kitty config path` | 查看当前项目 `.kitty/.env` 路径 |
|
|
90
|
+
| `kitty status` | 查看当前项目 runtime 现场:session、task lifecycle、memory、project map、execution、deadline、wake、spec |
|
|
91
|
+
| `kitty memory` | 查看、读取、搜索、删除 runtime memory assets,或把 memory 沉淀到 spec notes / skill references |
|
|
92
|
+
| `kitty changes` | 查看记录的文件变更 |
|
|
93
|
+
| `kitty undo [changeId]` | 撤销最近一次或指定变更 |
|
|
94
|
+
| `kitty diff [path]` | 查看当前 git diff |
|
|
95
|
+
| `kitty doctor` | 检查运行环境 |
|
|
96
|
+
| `kitty eval` | 查看真实 agent 体验验收场景 |
|
|
97
|
+
| `kitty telegram serve` | 启动 Telegram 私聊服务 |
|
|
98
|
+
|
|
99
|
+
## 🛠️ 工具体系
|
|
100
|
+
|
|
101
|
+
Core 工具固定为四个:
|
|
102
|
+
|
|
103
|
+
| Tool | 作用 |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `read` | 读取文件和上下文事实 |
|
|
106
|
+
| `edit` | 精确修改已有文件 |
|
|
107
|
+
| `write` | 写入新文件或完整内容 |
|
|
108
|
+
| `bash` | 搜索、Git、构建、测试和本地命令 |
|
|
109
|
+
|
|
110
|
+
Extension 是可启用、可禁用、独立存在的工具集合:
|
|
111
|
+
|
|
112
|
+
| Extension | 作用 |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `todo` | 会话级 todo 写入和可见 checklist |
|
|
115
|
+
| `worktree` | Git worktree 事实、创建、保留和删除 |
|
|
116
|
+
| `network` | HTTP session、请求、探测、下载、trace、OpenAPI 检查 |
|
|
117
|
+
| `background` | 后台命令执行、运行输出摘要、deadline、last output、检查、终止和生命周期记录 |
|
|
118
|
+
| `subagent` | 聚焦子执行启动、派工边界、deadline、状态检查、worker 结论回传、wait policy、lead 挂起与 wake 恢复 |
|
|
119
|
+
| `skills` | 项目运行时 skill 包索引、正文加载、资源读取和脚本运行;使用事实进入 observability 和 task lifecycle |
|
|
120
|
+
| `spec` | durable spec 文档、状态、任务、checkpoint、隔离 worktree,并把 spec stage 接入 task lifecycle |
|
|
121
|
+
|
|
122
|
+
默认 agent 会启用 `todo`、`worktree`、`network`、`background`、`subagent`、`skills`。`spec` 不随默认 agent 自动启用;需要 spec 工作流时使用 `kitty spec`。
|
|
123
|
+
|
|
124
|
+
Runtime skills 放在项目 `SKILL.md`、`.skills/**/SKILL.md` 或 `skills/**/SKILL.md`。默认上下文只显示 skill 名称、说明和路径;完整正文必须由模型明确调用 `skill_load` 后进入当前轮。Skill 包内的 `references/`、`scripts/`、`examples/` 和 `assets/` 会作为资源索引出现,需要时用 `skill_read_resource` 读取资源,或用 `skill_run_script` 运行已声明的 `scripts/` 资源。Skill frontmatter 可用 `requires` 声明命令依赖,运行时用 `skill_check` 检查。`.codex/skills/**` 是 Codex 维护本仓库用的开发规范,不属于小猫运行时 skill。
|
|
125
|
+
|
|
126
|
+
Session memory 由模型在 turn 收口时按固定 Markdown 区块写出:`Current Focus`、`User Constraints`、`Decisions`、`Open Threads`、`Verification Facts`、`Reusable Lessons`。机器只维护格式和保存边界,不替模型判断事实重要性。
|
|
127
|
+
|
|
128
|
+
Memory assets 分为 `session`、`project`、`user` 和 `evidence`。每条 asset 暴露 kind、id、路径和 evidence references。Session memory 由模型写,project/user/evidence assets 是可审阅事实资产。`kitty memory <memoryId> --append-to-spec <specId>` 可以追加到 spec `notes.md`,`kitty memory <memoryId> --append-to-skill <skillName>` 可以写入该 skill 的 `references/`。这两条路径只沉淀已保存事实,不替模型判断哪些经验值得复用。
|
|
129
|
+
|
|
130
|
+
查看配置:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
kitty config show
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
扩展开关在 `.kitty/.env` 的 `KITTY_EXTENSION_*` 中维护。
|
|
137
|
+
|
|
138
|
+
## ⚙️ 配置
|
|
139
|
+
|
|
140
|
+
项目运行配置只从 `.kitty/.env` 读取。初始化后按 `.kitty/.env` 填写当前启用的 provider、模型、API key 和 profile。
|
|
141
|
+
|
|
142
|
+
`.kitty/.env` 放当前启用的 provider 和 API key,同时保留 YLS、TTAPI、DeepSeek 三组 provider preset 注释块,方便直接切换。Telegram、扩展开关和运行时配置也在 `.kitty/.env` 与 `.kitty/.env.example` 中保持同一结构。
|
|
143
|
+
|
|
144
|
+
当前支持的主要环境配置包括:
|
|
145
|
+
|
|
146
|
+
- `KITTY_PROVIDER`
|
|
147
|
+
- `KITTY_BASE_URL`
|
|
148
|
+
- `KITTY_MODEL`
|
|
149
|
+
- `KITTY_API_KEY`
|
|
150
|
+
- `KITTY_PROFILE`
|
|
151
|
+
- `KITTY_REASONING_EFFORT`
|
|
152
|
+
- `KITTY_MAX_OUTPUT_TOKENS`
|
|
153
|
+
- `KITTY_TELEGRAM_TOKEN`
|
|
154
|
+
- `KITTY_TELEGRAM_ALLOWED_USER_IDS`
|
|
155
|
+
- `KITTY_TELEGRAM_PROXY_URL`
|
|
156
|
+
- `KITTY_TELEGRAM_API_BASE_URL`
|
|
157
|
+
|
|
158
|
+
## 🗺️ 项目结构
|
|
159
|
+
|
|
160
|
+
| 模块 | 路径 |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| Agent 主循环 | `src/agent/` |
|
|
163
|
+
| Context | `src/context/` |
|
|
164
|
+
| Session | `src/session/` |
|
|
165
|
+
| Provider / Config | `src/provider/`, `src/config/` |
|
|
166
|
+
| Core tools | `src/tools/` |
|
|
167
|
+
| Extensions | `src/extensions/` |
|
|
168
|
+
| Runtime skills | `src/skills/`, `skills/` |
|
|
169
|
+
| Project map | `src/project/map.ts` |
|
|
170
|
+
| Memory assets | `.kitty/memory/sessions/`, `.kitty/memory/project/`, `.kitty/memory/user/`, `.kitty/memory/evidence/` |
|
|
171
|
+
| Control plane | `src/control/`, `src/execution/` |
|
|
172
|
+
| Spec runtime | `src/spec/` |
|
|
173
|
+
| Host 边界 | `src/host/` |
|
|
174
|
+
| CLI / Shell / Telegram | `src/cli/`, `src/shell/`, `src/telegram/` |
|
|
175
|
+
| Runtime UI | `src/runtime-ui/` |
|
|
176
|
+
| Observability | `src/observability/` |
|
|
177
|
+
| Evaluation | `src/evaluation/`, `tests/evaluation/` |
|
|
178
|
+
| Specs | `spec/` |
|
|
179
|
+
| Tests | `tests/` |
|
|
180
|
+
|
|
181
|
+
## 🧪 开发
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm.cmd run typecheck
|
|
185
|
+
npm.cmd run build
|
|
186
|
+
npm.cmd run test:core
|
|
187
|
+
npm.cmd run verify
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
交付前运行:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npm.cmd run verify
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 📜 规则与规范
|
|
197
|
+
|
|
198
|
+
当前架构事实和宪法原则在 `spec/`。运行时 agent 规则在 `AGENTS.md`。维护本仓库源码的 Codex 开发规范在 `.codex/skills/kitty-agent-development/SKILL.md`。
|
|
199
|
+
|
|
200
|
+
重要入口:
|
|
201
|
+
|
|
202
|
+
- `AGENTS.md`
|
|
203
|
+
- `.codex/skills/kitty-agent-development/SKILL.md`
|
|
204
|
+
- `spec/用户审阅/系统核心/核心地图.md`
|
|
205
|
+
- `spec/用户审阅/宪法原则/`
|
|
206
|
+
- `spec/技术实现/`
|
|
207
|
+
|
|
208
|
+
Spec、代码和测试共同描述同一个当前现实。项目入口、配置、文档和测试都跟随当前实现同步维护。
|