flavor-code 1.2.4 → 1.2.5

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 CHANGED
@@ -1,367 +1,369 @@
1
- <div align="center">
2
- <img src="./assets/icon-transparent-512.png" alt="Flavor Code Logo" width="168" />
3
- <h1>Flavor Code</h1>
4
- <p><strong>本地优先、可审计、可恢复的 AI 编程助手</strong></p>
5
- <p>在终端、Electron 桌面端和 VS Code 中读代码、改文件、运行命令并完成复杂任务。</p>
6
-
7
- <p>
8
- <a href="https://www.npmjs.com/package/flavor-code"><img alt="npm version" src="https://img.shields.io/npm/v/flavor-code?color=cb3837&logo=npm" /></a>
9
- <a href="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
10
- <img alt="Node.js 20+" src="https://img.shields.io/badge/Node.js-20%2B-339933?logo=nodedotjs&logoColor=white" />
11
- <a href="./LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
12
- </p>
13
-
14
- <p>
15
- <a href="#快速开始">快速开始</a> ·
16
- <a href="#核心能力">核心能力</a> ·
17
- <a href="#使用入口">使用入口</a> ·
18
- <a href="#权限与沙箱">安全</a> ·
19
- <a href="#开发">参与开发</a>
20
- </p>
21
- </div>
22
-
23
- ---
24
-
25
- Flavor Code 接入 OpenAI、Anthropic 或兼容服务,在受控工作区内使用文件、搜索、Shell、MCP 和自定义工具。复杂任务可以拆成计划和并行子任务;会话、Diff、工具调用、checkpoint 与审计记录全部保存在本地,便于恢复、复查和继续工作。
26
-
27
- ## 核心能力
28
-
29
- | | 能力 | 你得到什么 |
30
- | --- | --- | --- |
31
- | 🖥️ | **一个运行时,三个入口** | CLI、Electron 与 VS Code 共享模型配置、会话和工具能力 |
32
- | 🧭 | **复杂任务可控推进** | 任务计划、子 Agent、steering、follow-up、`/loop` 和 `/goal` |
33
- | ⏪ | **结果可追溯、可恢复** | 完整时间线、checkpoint、rewind、trace、Diff 和失败审计 |
34
- | 🧠 | **本地长期上下文** | 记忆、Skill、插件和项目指南均保存在本机 |
35
- | 🛡️ | **明确的权限边界** | 分别控制读、写、Shell、网络和破坏性操作,也可使用 Docker |
36
-
37
- ## 快速开始
38
-
39
- > [!IMPORTANT]
40
- > CLI 需要 Node.js 20 或更高版本。Windows 桌面端也可以直接从 [Releases](https://github.com/YachuanWzh/flavor-code/releases) 下载。
41
-
42
- **1. 安装**
43
-
44
- ```bash
45
- npm install -g flavor-code
46
- ```
47
-
48
- **2. 在项目中启动**
49
-
50
- ```bash
51
- cd your-project
52
- flavor
53
- ```
54
-
55
- **3. 初始化项目上下文**
56
-
57
- 首次进入项目后运行 `/init`。Flavor 会分析语言、包管理器、源码目录和验证命令,并生成 `FLAVOR.md` 项目指南。
58
-
59
- 也可以直接执行一次性任务:
60
-
61
- ```bash
62
- flavor --print "分析这个项目并列出最值得修复的三个问题"
63
- flavor --resume
64
- flavor --resume -p "继续完成剩余工作"
65
- ```
66
-
67
- 非交互模式会拒绝需要人工审批的操作,不会悬挂等待输入。
68
-
69
- ## 配置模型
70
-
71
- 最快的方式是设置环境变量:
72
-
73
- ```bash
74
- # macOS / Linux
75
- export OPENAI_API_KEY="sk-..."
76
-
77
- # Windows PowerShell
78
- $env:OPENAI_API_KEY = "sk-..."
79
- ```
80
-
81
- 也可以把密钥放在项目根目录的 `.env`。
82
-
83
- <details>
84
- <summary><strong>使用 <code>.flavor/flavor.json</code> 配置多个 Provider</strong></summary>
85
-
86
- 项目配置示例:
87
-
88
- ```json
89
- {
90
- "providers": {
91
- "openai": {
92
- "type": "openai",
93
- "apiKey": "${OPENAI_API_KEY}",
94
- "defaultModel": "gpt-5",
95
- "cheapModel": "gpt-5-mini"
96
- }
97
- },
98
- "agents": {
99
- "main": { "model": "openai:gpt-5" },
100
- "subagent": { "model": "openai:gpt-5-mini" }
101
- },
102
- "permissionMode": "default",
103
- "maxSubagents": 3,
104
- "language": "zh-CN"
105
- }
106
- ```
107
-
108
- 配置按以下顺序合并,后者优先:
109
-
110
- 1. 全局 `~/.flavor-code/flavor.json`
111
- 2. 项目 `.flavor/flavor.json`
112
- 3. `.env`
113
- 4. 进程环境变量
114
-
115
- 支持的常用 Provider 类型:
116
-
117
- - `openai`:OpenAI 官方接口
118
- - `anthropic`:Anthropic 官方接口
119
- - `openai-compatible`:兼容 OpenAI 协议的服务
120
-
121
- </details>
122
-
123
- OAuth PKCE 的运行时行为与配置约定见 [PKCE 规范](./docs/specs/pkce-runtime-config.md)。完整配置字段以 [配置 Schema](./src/config/schema.ts) 为准。
124
-
125
- ## 使用入口
126
-
127
- | 入口 | 适合场景 | 启动方式 |
128
- | --- | --- | --- |
129
- | **CLI** | 日常开发、远程环境、脚本与 CI | `flavor` |
130
- | **Electron** | 可视化会话、Diff、权限和资源管理 | `npm run desktop:start` |
131
- | **VS Code / Qoder** | 编辑器上下文、诊断修复和任务控制面 | `npm run ide:install` |
132
-
133
- ### CLI
134
-
135
- 直接运行 `flavor` 后输入自然语言即可。输入 `/` 会显示内置命令、插件命令和 Skill。
136
-
137
- 常用命令:
138
-
139
- | 命令 | 作用 |
140
- | --- | --- |
141
- | `/init` | 生成或更新 `FLAVOR.md` |
142
- | `/model` | 查看或切换主/子 Agent 模型 |
143
- | `/permissions` | 切换权限模式 |
144
- | `/tasks` | 查看任务计划和子 Agent 状态 |
145
- | `/compact` | 手动压缩长会话上下文 |
146
- | `/checkpoint`、`/tree` | 保存现场、查看会话树 |
147
- | `/rewind`、`/unrevert`、`/fork` | 恢复或分叉会话 |
148
- | `/memory`、`/remember`、`/forget` | 管理长期记忆 |
149
- | `/mcp` | 查看和管理 MCP 服务 |
150
- | `/loop <goal>` | 运行带验证的自治循环 |
151
- | `/goal <objective>` | 运行规划、执行、对抗审查流程 |
152
- | `/audit` | 查看工具失败审计 |
153
-
154
- 运行中可以提交 steering 或排队 follow-up;当前模型响应结束后,任务会在安全边界处接收新指令。
155
-
156
- ### Electron 桌面端
157
-
158
- ```bash
159
- npm run desktop:dev # 开发模式
160
- npm run desktop:start # 构建并启动
161
- npm run desktop:pack # Windows 免安装目录
162
- npm run desktop:dist # Windows NSIS 安装包
163
- ```
164
-
165
- 桌面端提供项目和会话切换、流式 Markdown、工具与 Diff 展示、权限确认、任务状态,以及 Skill、MCP、记忆和模型管理。
166
-
167
- ### VS Code / Qoder
168
-
169
- ```bash
170
- npm run vscode:install # 安装到 VS Code
171
- npm run qoder:install # 安装到 Qoder
172
- npm run ide:install # 自动选择已安装的 IDE
173
- ```
174
-
175
- 扩展包含 `@flavor` Chat Participant、Mission Control、Changes & Health、Time Machine、诊断修复、CodeLens、checkpoint 和 rewind。若 `flavor` 不在 `PATH`,请设置 `flavorCode.executable`。
176
-
177
- ## MCP、Skill 与插件
178
-
179
- Flavor 可以连接 stdio 或 Streamable HTTP MCP 服务。项目配置示例:
180
-
181
- <details>
182
- <summary><strong>MCP 配置与 CLI 示例</strong></summary>
183
-
184
- ```json
185
- {
186
- "mcpServers": {
187
- "docs": {
188
- "url": "https://example.com/mcp",
189
- "headers": {
190
- "Authorization": "Bearer ${MCP_TOKEN}"
191
- }
192
- }
193
- }
194
- }
195
- ```
196
-
197
- MCP 配置也可以通过 CLI 管理:
198
-
199
- ```bash
200
- flavor mcp list
201
- flavor mcp add docs --url https://example.com/mcp
202
- flavor mcp disable docs
203
- ```
204
-
205
- </details>
206
-
207
- Skill 是带有 YAML 头信息的 `SKILL.md`,放在 `.flavor/skills/<name>/` 或 `~/.flavor-code/skills/<name>/`。Flavor 会按任务渐进加载,也支持通过 `/<skill-name>` 显式调用。
208
-
209
- 插件放在 `.flavor/plugins/`,可以注册命令、工具、Hook、Skill 根目录和模型适配器。
210
-
211
- > [!WARNING]
212
- > 插件和 Agent 自注册工具是进程内执行的 JavaScript,不是安全沙箱。只安装、启用和批准你信任的代码。
213
-
214
- ## 会话、记忆与执行记录
215
-
216
- 项目运行数据集中在 `.flavor/`:
217
-
218
- ```text
219
- .flavor/
220
- ├── flavor.json # 项目配置
221
- ├── sessions/ # 会话时间线
222
- ├── session-assets/ # 图片附件
223
- ├── session-trees/ # 会话分支
224
- ├── checkpoints/ # 工作区快照
225
- ├── memory/ # 长期记忆
226
- ├── traces/ # 可选执行 trace
227
- ├── audit.jsonl # 工具失败审计
228
- ├── skills/ # 项目 Skill
229
- └── plugins/ # 项目插件
230
- ```
231
-
232
- 长期记忆会区分用户偏好、行为反馈、项目约定和外部引用。自动提取只保存高置信候选,并提供确认、忽略和删除入口;密钥、Token、原始工具输出和模型猜测会被拒绝。
233
-
234
- 图片提示支持 PNG、JPEG 和 WebP,单图最大 5 MiB、每次最多 5 张。桌面端支持选择或拖放;CLI 剪贴板图片目前支持 Windows 和 macOS。
235
-
236
- ## 权限与沙箱
237
-
238
- | 模式 | 行为 |
239
- | --- | --- |
240
- | `default` | 读操作自动放行,写、Shell、网络和破坏性操作按需确认 |
241
- | `acceptEdits` | 工作区写入和例行验证自动放行 |
242
- | `plan` | 只读规划,不允许修改和执行 |
243
- | `bypassPermissions` | 主 Agent 在硬安全检查后尽量自动执行 |
244
- | `auto` | 使用分类器判断,无法确定时回到人工确认 |
245
- | `bubble` | 将不确定操作冒泡给主会话审批 |
246
-
247
- > [!CAUTION]
248
- > 本地 Shell 仍然以当前用户身份运行。处理不可信项目时建议启用 Docker。
249
-
250
- <details>
251
- <summary><strong>Docker 执行环境示例</strong></summary>
252
-
253
- ```json
254
- {
255
- "execution": {
256
- "mode": "docker",
257
- "image": "node:24-bookworm-slim",
258
- "network": false,
259
- "memory": "2g",
260
- "cpus": 2
261
- }
262
- }
263
- ```
264
-
265
- Docker 不可用时任务会失败,不会静默回退到本机。配置文件中的敏感字段与 OAuth Token 使用本机配置密钥进行 AES-256-GCM 认证加密。
266
-
267
- </details>
268
-
269
- ## SDK、RPC 与评测
270
-
271
- <details>
272
- <summary><strong>Node.js SDK 示例</strong></summary>
273
-
274
- ```ts
275
- import { createFlavorRuntime } from "flavor-code/sdk";
276
-
277
- const runtime = await createFlavorRuntime({
278
- workspace: process.cwd(),
279
- approvalPolicy: "deny",
280
- output: console.log,
281
- });
282
-
283
- await runtime.session.start();
284
- await runtime.session.submit("修复失败的测试");
285
- await runtime.dispose();
286
- ```
287
-
288
- </details>
289
-
290
- 其他 IDE 或语言可以通过 JSONL RPC 接入:
291
-
292
- ```bash
293
- flavor --mode rpc --workspace . --trace .flavor/traces/run.jsonl
294
- ```
295
-
296
- 评测运行:
297
-
298
- ```bash
299
- flavor eval eval.json --output report.json
300
- ```
301
-
302
- RPC、trace、replay、eval、会话树与 Docker 的设计约束见 [控制面规范](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md)。
303
-
304
- ## 开发
305
-
306
- ```bash
307
- npm ci
308
- npm test
309
- npm run typecheck
310
- npm run vscode:typecheck
311
- npm run build
312
- npm run smoke:install
313
- ```
314
-
315
- - TypeScript strict,目标 ES2022,Node.js 20+
316
- - Vitest 单元与集成测试
317
- - tsup 构建 CLI、SDK、Electron 主进程和 VS Code 扩展
318
- - Vite 构建 Electron renderer
319
- - CI 覆盖 Windows/macOS 与 Node 20/24
320
-
321
- 发布构建默认不生成或打包 source map。需要本地调试构建时显式开启:
322
-
323
- ```bash
324
- # macOS / Linux
325
- FLAVOR_SOURCEMAP=1 npm run build
326
-
327
- # Windows PowerShell
328
- $env:FLAVOR_SOURCEMAP = "1"
329
- npm run build
330
- ```
331
-
332
- ## 文档
333
-
334
- - [技术方案报告](./技术方案报告.md):整体架构、Agent 循环、上下文、权限、插件和安全模型
335
- - [运行时可靠性规范](./docs/specs/2026-07-26-runtime-reliability.md)
336
- - [控制面、沙箱与 VS Code 规范](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md)
337
- - [多模态图片规范](./docs/specs/2026-07-30-multimodal-image-attachments.md)
338
- - [VS Code 后续规划](./docs/specs/2026-08-01-flavor-code-vscode-next.md)
339
-
340
- ## 安全提示
341
-
342
- - 审查模型生成的代码和命令,尤其是依赖安装、脚本和删除操作。
343
- - 不要把 `.flavor/sessions/`、trace 或长期记忆当作秘密仓库。
344
- - 使用最小权限 API Key,不要提交 `.env`。
345
- - Skill 内容可能影响模型行为;插件和自注册工具还拥有进程内 Node.js 权限。
346
- - 建议在版本控制下工作,并在高风险任务前创建 checkpoint。
347
-
348
- ## 参与贡献
349
-
350
- 欢迎提交 Issue 和 Pull Request。提交前请至少运行:
351
-
352
- ```bash
353
- npm test
354
- npm run typecheck
355
- npm run vscode:typecheck
356
- npm run build
357
- ```
358
-
359
- 架构改动建议先阅读 [技术方案报告](./技术方案报告.md) 和相关 [设计规范](./docs/specs/)。
360
-
361
- ## License
362
-
363
- [MIT](./LICENSE)
364
-
365
- <p align="center">
366
- Made with 🌶️ by Flavor Code contributors.
367
- </p>
1
+ <p align="center"><b><a href="./README.md">English</a></b> | <a href="./README.zh-CN.md">简体中文</a></p>
2
+
3
+ <div align="center">
4
+ <img src="./assets/icon-transparent-512.png" alt="Flavor Code Logo" width="168" />
5
+ <h1>Flavor Code</h1>
6
+ <p><strong>Local-first, auditable, resumable AI coding assistant</strong></p>
7
+ <p>Read code, edit files, run commands, and complete complex tasks in the terminal, Electron desktop, and VS Code.</p>
8
+
9
+ <p>
10
+ <a href="https://www.npmjs.com/package/flavor-code"><img alt="npm version" src="https://img.shields.io/npm/v/flavor-code?color=cb3837&logo=npm" /></a>
11
+ <a href="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
12
+ <img alt="Node.js 20+" src="https://img.shields.io/badge/Node.js-20%2B-339933?logo=nodedotjs&logoColor=white" />
13
+ <a href="./LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
14
+ </p>
15
+
16
+ <p>
17
+ <a href="#quick-start">Quick Start</a> ·
18
+ <a href="#features">Features</a> ·
19
+ <a href="#entry-points">Entry Points</a> ·
20
+ <a href="#permissions--sandbox">Security</a> ·
21
+ <a href="#development">Development</a>
22
+ </p>
23
+ </div>
24
+
25
+ ---
26
+
27
+ Flavor Code connects to OpenAI, Anthropic, or compatible services and works with file, search, Shell, MCP, and custom tools inside a controlled workspace. Complex tasks can be broken into plans and parallel sub-tasks; sessions, diffs, tool calls, checkpoints, and audit records are all stored locally so you can resume, review, and continue at any time.
28
+
29
+ ## Features
30
+
31
+ | | Capability | What you get |
32
+ | --- | --- | --- |
33
+ | 🖥️ | **One runtime, three entry points** | CLI, Electron, and VS Code share model configuration, sessions, and tooling |
34
+ | 🧭 | **Controlled progress on complex tasks** | Task plans, sub-agents, steering, follow-ups, `/loop`, and `/goal` |
35
+ | ⏪ | **Traceable, resumable results** | Full timeline, checkpoints, rewind, traces, diffs, and failure audits |
36
+ | 🧠 | **Local long-term context** | Memory, Skills, plugins, and project guides stored on your machine |
37
+ | 🛡️ | **Clear permission boundaries** | Independent control over read, write, Shell, network, and destructive actions; Docker supported |
38
+
39
+ ## Quick Start
40
+
41
+ > [!IMPORTANT]
42
+ > The CLI requires Node.js 20 or later. Windows desktop builds can also be downloaded directly from [Releases](https://github.com/YachuanWzh/flavor-code/releases).
43
+
44
+ **1. Install**
45
+
46
+ ```bash
47
+ npm install -g flavor-code
48
+ ```
49
+
50
+ **2. Start in your project**
51
+
52
+ ```bash
53
+ cd your-project
54
+ flavor
55
+ ```
56
+
57
+ **3. Initialize project context**
58
+
59
+ Run `/init` the first time you enter a project. Flavor analyzes the language, package manager, source directories, and verification commands, then generates a `FLAVOR.md` project guide.
60
+
61
+ You can also run one-off tasks directly:
62
+
63
+ ```bash
64
+ flavor --print "Analyze this project and list the top three issues worth fixing"
65
+ flavor --resume
66
+ flavor --resume -p "Continue the remaining work"
67
+ ```
68
+
69
+ Non-interactive mode refuses actions that require human approval and never hangs waiting for input.
70
+
71
+ ## Configuring Models
72
+
73
+ The fastest way is to set environment variables:
74
+
75
+ ```bash
76
+ # macOS / Linux
77
+ export OPENAI_API_KEY="sk-..."
78
+
79
+ # Windows PowerShell
80
+ $env:OPENAI_API_KEY = "sk-..."
81
+ ```
82
+
83
+ You can also put the key in a `.env` file at the project root.
84
+
85
+ <details>
86
+ <summary><strong>Configure multiple providers with <code>.flavor/flavor.json</code></strong></summary>
87
+
88
+ Example project configuration:
89
+
90
+ ```json
91
+ {
92
+ "providers": {
93
+ "openai": {
94
+ "type": "openai",
95
+ "apiKey": "${OPENAI_API_KEY}",
96
+ "defaultModel": "gpt-5",
97
+ "cheapModel": "gpt-5-mini"
98
+ }
99
+ },
100
+ "agents": {
101
+ "main": { "model": "openai:gpt-5" },
102
+ "subagent": { "model": "openai:gpt-5-mini" }
103
+ },
104
+ "permissionMode": "default",
105
+ "maxSubagents": 3,
106
+ "language": "zh-CN"
107
+ }
108
+ ```
109
+
110
+ Configuration is merged in the following order, with later sources taking precedence:
111
+
112
+ 1. Global `~/.flavor-code/flavor.json`
113
+ 2. Project `.flavor/flavor.json`
114
+ 3. `.env`
115
+ 4. Process environment variables
116
+
117
+ Commonly supported provider types:
118
+
119
+ - `openai`: OpenAI's official API
120
+ - `anthropic`: Anthropic's official API
121
+ - `openai-compatible`: Services compatible with the OpenAI protocol
122
+
123
+ </details>
124
+
125
+ Runtime behavior and configuration conventions for OAuth PKCE are described in the [PKCE spec](./docs/specs/pkce-runtime-config.md). The [config schema](./src/config/schema.ts) is the source of truth for all fields.
126
+
127
+ ## Entry Points
128
+
129
+ | Entry point | Best for | How to start |
130
+ | --- | --- | --- |
131
+ | **CLI** | Daily development, remote environments, scripting, and CI | `flavor` |
132
+ | **Electron** | Visual sessions, diffs, permissions, and resource management | `npm run desktop:start` |
133
+ | **VS Code / Qoder** | Editor context, diagnostic fixes, and a task control plane | `npm run ide:install` |
134
+
135
+ ### CLI
136
+
137
+ Run `flavor` and type natural language. Typing `/` shows built-in commands, plugin commands, and Skills.
138
+
139
+ Common commands:
140
+
141
+ | Command | Purpose |
142
+ | --- | --- |
143
+ | `/init` | Generate or update `FLAVOR.md` |
144
+ | `/model` | View or switch main/sub-agent models |
145
+ | `/permissions` | Switch permission modes |
146
+ | `/tasks` | View task plans and sub-agent status |
147
+ | `/compact` | Manually compact long session context |
148
+ | `/checkpoint`, `/tree` | Save state, view the session tree |
149
+ | `/rewind`, `/unrevert`, `/fork` | Resume or fork sessions |
150
+ | `/memory`, `/remember`, `/forget` | Manage long-term memory |
151
+ | `/mcp` | View and manage MCP servers |
152
+ | `/loop <goal>` | Run an autonomous loop with verification |
153
+ | `/goal <objective>` | Run the plan, execute, adversarial-review workflow |
154
+ | `/audit` | View tool failure audits |
155
+
156
+ You can submit steering or queue follow-ups while a run is in progress; once the current model response finishes, the task picks up new instructions at safe boundaries.
157
+
158
+ ### Electron Desktop
159
+
160
+ ```bash
161
+ npm run desktop:dev # dev mode
162
+ npm run desktop:start # build and start
163
+ npm run desktop:pack # Windows portable directory
164
+ npm run desktop:dist # Windows NSIS installer
165
+ ```
166
+
167
+ The desktop app provides project and session switching, streaming Markdown, tool and diff views, permission confirmations, task status, and management of Skills, MCP, memory, and models.
168
+
169
+ ### VS Code / Qoder
170
+
171
+ ```bash
172
+ npm run vscode:install # install into VS Code
173
+ npm run qoder:install # install into Qoder
174
+ npm run ide:install # auto-select the installed IDE
175
+ ```
176
+
177
+ The extension includes the `@flavor` Chat Participant, Mission Control, Changes & Health, Time Machine, diagnostic fixes, CodeLens, checkpoints, and rewind. If `flavor` is not on your `PATH`, set `flavorCode.executable`.
178
+
179
+ ## MCP, Skills & Plugins
180
+
181
+ Flavor can connect to stdio or Streamable HTTP MCP servers. Example project configuration:
182
+
183
+ <details>
184
+ <summary><strong>MCP configuration and CLI examples</strong></summary>
185
+
186
+ ```json
187
+ {
188
+ "mcpServers": {
189
+ "docs": {
190
+ "url": "https://example.com/mcp",
191
+ "headers": {
192
+ "Authorization": "Bearer ${MCP_TOKEN}"
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ MCP configuration can also be managed from the CLI:
200
+
201
+ ```bash
202
+ flavor mcp list
203
+ flavor mcp add docs --url https://example.com/mcp
204
+ flavor mcp disable docs
205
+ ```
206
+
207
+ </details>
208
+
209
+ A Skill is a `SKILL.md` with YAML frontmatter, placed in `.flavor/skills/<name>/` or `~/.flavor-code/skills/<name>/`. Flavor loads skills progressively based on the task, and you can invoke one explicitly with `/<skill-name>`.
210
+
211
+ Plugins live in `.flavor/plugins/` and can register commands, tools, hooks, Skill roots, and model adapters.
212
+
213
+ > [!WARNING]
214
+ > Plugins and agent self-registered tools are in-process JavaScript, not a security sandbox. Only install, enable, and approve code you trust.
215
+
216
+ ## Sessions, Memory & Execution Records
217
+
218
+ Project runtime data lives under `.flavor/`:
219
+
220
+ ```text
221
+ .flavor/
222
+ ├── flavor.json # Project config
223
+ ├── sessions/ # Session timelines
224
+ ├── session-assets/ # Image attachments
225
+ ├── session-trees/ # Session branches
226
+ ├── checkpoints/ # Workspace snapshots
227
+ ├── memory/ # Long-term memory
228
+ ├── traces/ # Optional execution traces
229
+ ├── audit.jsonl # Tool failure audits
230
+ ├── skills/ # Project skills
231
+ └── plugins/ # Project plugins
232
+ ```
233
+
234
+ Long-term memory distinguishes user preferences, behavioral feedback, project conventions, and external references. Automatic extraction only keeps high-confidence candidates and provides confirm, ignore, and delete actions; secrets, tokens, raw tool output, and model guesses are rejected.
235
+
236
+ Image prompts support PNG, JPEG, and WebP, with a 5 MiB per-image maximum and up to 5 images per prompt. The desktop app supports picking or drag-and-drop; CLI clipboard images currently work on Windows and macOS.
237
+
238
+ ## Permissions & Sandbox
239
+
240
+ | Mode | Behavior |
241
+ | --- | --- |
242
+ | `default` | Reads are auto-approved; writes, Shell, network, and destructive actions are confirmed on demand |
243
+ | `acceptEdits` | Workspace writes and routine verification are auto-approved |
244
+ | `plan` | Read-only planning; no modifications or execution |
245
+ | `bypassPermissions` | The main agent executes as much as possible after hard safety checks |
246
+ | `auto` | A classifier decides, falling back to human approval when uncertain |
247
+ | `bubble` | Uncertain operations bubble up to the main session for approval |
248
+
249
+ > [!CAUTION]
250
+ > Local Shell still runs as your current user. Consider enabling Docker when working with untrusted projects.
251
+
252
+ <details>
253
+ <summary><strong>Docker execution environment example</strong></summary>
254
+
255
+ ```json
256
+ {
257
+ "execution": {
258
+ "mode": "docker",
259
+ "image": "node:24-bookworm-slim",
260
+ "network": false,
261
+ "memory": "2g",
262
+ "cpus": 2
263
+ }
264
+ }
265
+ ```
266
+
267
+ If Docker is unavailable, tasks fail rather than silently falling back to the host. Sensitive fields in config files and OAuth tokens are encrypted at rest with AES-256-GCM using a local configuration key.
268
+
269
+ </details>
270
+
271
+ ## SDK, RPC & Evaluation
272
+
273
+ <details>
274
+ <summary><strong>Node.js SDK example</strong></summary>
275
+
276
+ ```ts
277
+ import { createFlavorRuntime } from "flavor-code/sdk";
278
+
279
+ const runtime = await createFlavorRuntime({
280
+ workspace: process.cwd(),
281
+ approvalPolicy: "deny",
282
+ output: console.log,
283
+ });
284
+
285
+ await runtime.session.start();
286
+ await runtime.session.submit("fix the failing tests");
287
+ await runtime.dispose();
288
+ ```
289
+
290
+ </details>
291
+
292
+ Other IDEs or languages can integrate over JSONL RPC:
293
+
294
+ ```bash
295
+ flavor --mode rpc --workspace . --trace .flavor/traces/run.jsonl
296
+ ```
297
+
298
+ Run evaluations:
299
+
300
+ ```bash
301
+ flavor eval eval.json --output report.json
302
+ ```
303
+
304
+ Design constraints for RPC, traces, replay, eval, session trees, and Docker are in the [control-plane spec](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md).
305
+
306
+ ## Development
307
+
308
+ ```bash
309
+ npm ci
310
+ npm test
311
+ npm run typecheck
312
+ npm run vscode:typecheck
313
+ npm run build
314
+ npm run smoke:install
315
+ ```
316
+
317
+ - TypeScript strict, targeting ES2022, Node.js 20+
318
+ - Vitest for unit and integration tests
319
+ - tsup builds the CLI, SDK, Electron main process, and VS Code extension
320
+ - Vite builds the Electron renderer
321
+ - CI covers Windows/macOS with Node 20/24
322
+
323
+ Release builds do not generate or package source maps by default. For a local debugging build, enable them explicitly:
324
+
325
+ ```bash
326
+ # macOS / Linux
327
+ FLAVOR_SOURCEMAP=1 npm run build
328
+
329
+ # Windows PowerShell
330
+ $env:FLAVOR_SOURCEMAP = "1"
331
+ npm run build
332
+ ```
333
+
334
+ ## Documentation
335
+
336
+ - [Technical Design Report](./技术方案报告.md): overall architecture, agent loop, context, permissions, plugins, and security model
337
+ - [Runtime reliability spec](./docs/specs/2026-07-26-runtime-reliability.md)
338
+ - [Control plane, sandbox & VS Code spec](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md)
339
+ - [Multimodal image attachments spec](./docs/specs/2026-07-30-multimodal-image-attachments.md)
340
+ - [VS Code next steps](./docs/specs/2026-08-01-flavor-code-vscode-next.md)
341
+
342
+ ## Security Notes
343
+
344
+ - Review model-generated code and commands, especially dependency installs, scripts, and deletions.
345
+ - Do not treat `.flavor/sessions/`, traces, or long-term memory as secret stores.
346
+ - Use least-privilege API keys and never commit `.env`.
347
+ - Skill content can influence model behavior; plugins and self-registered tools also have in-process Node.js permissions.
348
+ - Work under version control and create checkpoints before high-risk tasks.
349
+
350
+ ## Contributing
351
+
352
+ Issues and Pull Requests are welcome. Please at least run the following before submitting:
353
+
354
+ ```bash
355
+ npm test
356
+ npm run typecheck
357
+ npm run vscode:typecheck
358
+ npm run build
359
+ ```
360
+
361
+ For architecture changes, read the [Technical Design Report](./技术方案报告.md) and the relevant [design specs](./docs/specs/) first.
362
+
363
+ ## License
364
+
365
+ [MIT](./LICENSE)
366
+
367
+ <p align="center">
368
+ Made with 🌶️ by Flavor Code contributors.
369
+ </p>