@jun133/kitty 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kitty contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,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 文件 |
36
+ | 🔌 Provider | OpenAI-compatible provider、请求恢复、连接诊断 |
37
+ | 🛠️ Core tools | `read`、`edit`、`write`、`bash` |
38
+ | 🧩 Extensions | `todo`、`worktree`、`network`、`background`、`subagent`、`team`、`skills`、`spec` |
39
+ | 🧾 Control plane | SQLite 账本记录执行、wait policy、pid、状态和 wake 事实;host 负责等待和恢复 lead |
40
+ | 📐 Spec 模式 | `requirements.md`、`design.md`、`tasks.md`、`notes.md` 和隔离 worktree |
41
+ | 💬 产品面 | CLI、交互终端、Telegram 私聊服务 |
42
+ | 📎 证据记录 | 事件、终端日志、崩溃记录、文件变更记录 |
43
+
44
+ ## ⚡ 快速开始
45
+
46
+ 安装依赖并构建:
47
+
48
+ ```bash
49
+ npm.cmd install
50
+ npm.cmd run build
51
+ ```
52
+
53
+ 初始化当前项目:
54
+
55
+ ```bash
56
+ kitty init
57
+ ```
58
+
59
+ 启动交互式 agent:
60
+
61
+ ```bash
62
+ kitty
63
+ ```
64
+
65
+ 执行一次明确任务:
66
+
67
+ ```bash
68
+ kitty "检查这个仓库并修复失败测试"
69
+ ```
70
+
71
+ 进入 spec 工作流:
72
+
73
+ ```bash
74
+ kitty spec
75
+ ```
76
+
77
+ ## ⌨️ 常用命令
78
+
79
+ | 命令 | 用途 |
80
+ | --- | --- |
81
+ | `kitty` | 进入默认 agent 交互,或直接接收一次性 prompt |
82
+ | `kitty agent` | 显式进入 agent 模式 |
83
+ | `kitty spec` | 进入 requirements -> design -> tasks -> implement -> validate 工作流 |
84
+ | `kitty resume [sessionId]` | 恢复最近会话或指定会话 |
85
+ | `kitty sessions` | 查看最近会话 |
86
+ | `kitty config show` | 查看从 `.kitty/.env` 解析出的当前运行配置 |
87
+ | `kitty config path` | 查看当前项目 `.kitty/.env` 路径 |
88
+ | `kitty status` | 查看当前项目 runtime 现场:session、memory、execution、team、wake、spec |
89
+ | `kitty memory` | 查看、读取、搜索、删除,或把 session memory 沉淀到 spec notes / skill references |
90
+ | `kitty changes` | 查看记录的文件变更 |
91
+ | `kitty undo [changeId]` | 撤销最近一次或指定变更 |
92
+ | `kitty diff [path]` | 查看当前 git diff |
93
+ | `kitty doctor` | 检查运行环境 |
94
+ | `kitty telegram serve` | 启动 Telegram 私聊服务 |
95
+
96
+ ## 🛠️ 工具体系
97
+
98
+ Core 工具固定为四个:
99
+
100
+ | Tool | 作用 |
101
+ | --- | --- |
102
+ | `read` | 读取文件和上下文事实 |
103
+ | `edit` | 精确修改已有文件 |
104
+ | `write` | 写入新文件或完整内容 |
105
+ | `bash` | 搜索、Git、构建、测试和本地命令 |
106
+
107
+ Extension 是可启用、可禁用、独立存在的工具集合:
108
+
109
+ | Extension | 作用 |
110
+ | --- | --- |
111
+ | `todo` | 会话级 todo 写入和可见 checklist |
112
+ | `worktree` | Git worktree 事实、创建、保留和删除 |
113
+ | `network` | HTTP session、请求、探测、下载、trace、OpenAPI 检查 |
114
+ | `background` | 后台命令执行、运行输出摘要、检查、终止和生命周期记录 |
115
+ | `subagent` | 聚焦子执行启动、派工边界记录、状态检查、worker 结论回传、wait policy、lead 挂起与 wake 恢复 |
116
+ | `team` | teammate 注册、派工边界记录、执行、消息、inbox、worker 结论回传、wait policy、lead 挂起与成员状态收束 |
117
+ | `skills` | 项目运行时 skill 包索引、正文加载和资源读取;模型自己判断是否加载,机器只负责列出和读取 |
118
+ | `spec` | durable spec 文档、状态、任务、checkpoint 和隔离 worktree |
119
+
120
+ 默认 agent 会启用 `todo`、`worktree`、`network`、`background`、`subagent`、`team`、`skills`。`spec` 不随默认 agent 自动启用;需要 spec 工作流时使用 `kitty spec`。
121
+
122
+ 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。
123
+
124
+ Memory 资产可以用 `kitty memory <sessionId> --append-to-spec <specId>` 追加到 spec `notes.md`,也可以用 `kitty memory <sessionId> --append-to-skill <skillName>` 写入该 skill 的 `references/`。这两条路径只沉淀已保存事实,不替模型判断哪些经验值得复用。
125
+
126
+ 查看配置:
127
+
128
+ ```bash
129
+ kitty config show
130
+ ```
131
+
132
+ 扩展开关在 `.kitty/.env` 的 `KITTY_EXTENSION_*` 中维护。
133
+
134
+ ## ⚙️ 配置
135
+
136
+ 项目运行配置只从 `.kitty/.env` 读取。初始化后按 `.kitty/.env` 填写当前启用的 provider、模型、API key 和 profile。
137
+
138
+ `.kitty/.env` 放当前启用的 provider 和 API key,同时保留 YLS、TTAPI、DeepSeek 三组 provider preset 注释块,方便直接切换。Telegram、扩展开关和运行时配置也在 `.kitty/.env` 与 `.kitty/.env.example` 中保持同一结构。
139
+
140
+ 当前支持的主要环境配置包括:
141
+
142
+ - `KITTY_PROVIDER`
143
+ - `KITTY_BASE_URL`
144
+ - `KITTY_MODEL`
145
+ - `KITTY_API_KEY`
146
+ - `KITTY_PROFILE`
147
+ - `KITTY_REASONING_EFFORT`
148
+ - `KITTY_MAX_OUTPUT_TOKENS`
149
+ - `KITTY_TELEGRAM_TOKEN`
150
+ - `KITTY_TELEGRAM_ALLOWED_USER_IDS`
151
+ - `KITTY_TELEGRAM_PROXY_URL`
152
+ - `KITTY_TELEGRAM_API_BASE_URL`
153
+
154
+ ## 🗺️ 项目结构
155
+
156
+ | 模块 | 路径 |
157
+ | --- | --- |
158
+ | Agent 主循环 | `src/agent/` |
159
+ | Context | `src/context/` |
160
+ | Session | `src/session/` |
161
+ | Provider / Config | `src/provider/`, `src/config/` |
162
+ | Core tools | `src/tools/` |
163
+ | Extensions | `src/extensions/` |
164
+ | Runtime skills | `src/skills/`, `skills/` |
165
+ | Memory assets | `.kitty/memory/sessions/` |
166
+ | Control plane | `src/control/`, `src/execution/` |
167
+ | Spec runtime | `src/spec/` |
168
+ | Host 边界 | `src/host/` |
169
+ | CLI / Shell / Telegram | `src/cli/`, `src/shell/`, `src/telegram/` |
170
+ | Runtime UI | `src/runtime-ui/` |
171
+ | Observability | `src/observability/` |
172
+ | Specs | `spec/` |
173
+ | Tests | `tests/` |
174
+
175
+ ## 🧪 开发
176
+
177
+ ```bash
178
+ npm.cmd run typecheck
179
+ npm.cmd run build
180
+ npm.cmd run test:core
181
+ npm.cmd run verify
182
+ ```
183
+
184
+ 交付前运行:
185
+
186
+ ```bash
187
+ npm.cmd run verify
188
+ ```
189
+
190
+ ## 📜 规则与规范
191
+
192
+ 当前架构事实和宪法原则在 `spec/`。运行时 agent 规则在 `AGENTS.md`。维护本仓库源码的 Codex 开发规范在 `.codex/skills/kitty-agent-development/SKILL.md`。
193
+
194
+ 重要入口:
195
+
196
+ - `AGENTS.md`
197
+ - `.codex/skills/kitty-agent-development/SKILL.md`
198
+ - `spec/用户审阅/系统核心/核心地图.md`
199
+ - `spec/用户审阅/宪法原则/`
200
+ - `spec/技术实现/`
201
+
202
+ Spec、代码和测试共同描述同一个当前现实。项目入口、配置、文档和测试都跟随当前实现同步维护。