-
Notifications
You must be signed in to change notification settings - Fork 7
feat(context/runtime): 落地 manual compact(拆分自 #127)并补齐配置、TUI、事件与测试 #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d25bd39
feat: 拆分 default_workdir 与 session workdir 并接入会话级切换
Cai-Tang-www 2178e26
feat: 移除 legacy workdir 兼容并强制 default_workdir
Cai-Tang-www fb93f7e
feat(context,runtime): 落地 manual compact 与 transcript 持久化
wynxing ba7e26b
feat(config,tui): 接入 manual compact 配置、事件与 /compact
wynxing 9229313
fix(context): 修复 compact rune 计数与规则发现错误处理
wynxing c374624
test(docs): 补齐 manual compact 覆盖并同步文档
wynxing 13d9d85
test: 补齐 P0-3 工作目录分支覆盖率
Cai-Tang-www 6955c22
fix(tui): 拦截空会话的 compact 请求
wynxing d8da168
feat: 移除 workdir 配置持久化并改为会话内存态
Cai-Tang-www 4408951
feat: slash命令仅保留cwd并移除workspace
Cai-Tang-www 25f28b5
test: 补齐runtime与cwd命令分支覆盖
Cai-Tang-www 572c8c6
test: 修复runtime测试环境变量并行竞态
Cai-Tang-www 5d9706f
Merge branch 'main' into P0-3
Cai-Tang-www 59f5134
test: 修复合并后runtime测试配置入口引用
Cai-Tang-www 4bc5ddc
Refine compact prompt ownership and session model binding
wynxing 1c26c0f
docs: 更新 AGENTS.md 规则并移除重复的 agents.md
wynxing b486d8d
refactor: centralize context compact constants
wynxing fc78692
Merge pull request #131 from Cai-Tang-www/P0-3
minorcell 42f089e
fix:修复了实现的不规范问题,并更新了文档说明
wynxing b86206e
feat(context,runtime): 落地 manual compact 与 transcript 持久化
wynxing 85c0d55
feat(config,tui): 接入 manual compact 配置、事件与 /compact
wynxing add5caa
fix(context): 修复 compact rune 计数与规则发现错误处理
wynxing 5be2e7d
test(docs): 补齐 manual compact 覆盖并同步文档
wynxing 4000a6b
fix(tui): 拦截空会话的 compact 请求
wynxing a8c305d
Refine compact prompt ownership and session model binding
wynxing 331d513
docs: 更新 AGENTS.md 规则并移除重复的 agents.md
wynxing e552ca0
refactor: centralize context compact constants
wynxing 733529a
fix:修复了实现的不规范问题,并更新了文档说明
wynxing 3d37bbb
Merge branch 'rebasetest' of https://github.com/Yumiue/neo-code into …
wynxing 75d616a
test:添加测试
wynxing a180d94
docs(README):修正下载链接
wynxing 1e24012
refactor: 收敛 compact 结构与文档说明
wynxing afeaeee
docs:加入过时的声明
wynxing f6d1479
docs:把过时文档的更改给撤销了
wynxing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ config.local.yaml | |
| # Local data | ||
| data/ | ||
| .cache/ | ||
| .neocode/projects/**/.transcripts/ | ||
|
|
||
| # Editor/IDE | ||
| .idea/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # Context Compact | ||
|
|
||
| 本文档说明 NeoCode 中 manual compact 的配置、执行链路和摘要约定。 | ||
|
|
||
| ## 概览 | ||
|
|
||
| - 当前仅支持手动触发的 compact,不包含自动 compact。 | ||
| - 用户通过 `/compact` 对当前会话执行一次上下文压缩。 | ||
| - compact 前会先写入完整 transcript,随后生成并校验 compact summary,再回写会话消息。 | ||
|
|
||
| ## 配置 | ||
|
|
||
| compact 相关配置位于: | ||
|
|
||
| ```yaml | ||
| context: | ||
| compact: | ||
| manual_strategy: keep_recent | ||
| manual_keep_recent_messages: 10 | ||
| max_summary_chars: 1200 | ||
| ``` | ||
|
|
||
| - `manual_strategy` | ||
| 控制手动 compact 的策略,支持 `keep_recent` 和 `full_replace`。 | ||
| - `manual_keep_recent_messages` | ||
| 在 `keep_recent` 模式下保留最近消息数量,并按 tool call 与 tool result 的原子块整体保留。 | ||
| - `max_summary_chars` | ||
| 控制 compact summary 的最大字符数。 | ||
|
|
||
| ## 执行链路 | ||
|
|
||
| 1. TUI 识别 `/compact` 并调用 `runtime.Compact(...)`。 | ||
| 2. runtime 发出 `compact_start` 事件。 | ||
| 3. compact runner 将原始消息写入 transcript(JSONL)。 | ||
| 4. compact runner 根据策略构造归档消息与保留消息。 | ||
| 5. runtime 选择用于生成 summary 的 provider 和 model: | ||
| 优先复用会话记录的 `provider` / `model`,缺失时回退到当前配置。 | ||
| 6. summary generator 调用模型生成语义摘要。 | ||
| 7. runner 校验摘要结构与长度,必要时截断。 | ||
| 8. compact 成功时回写会话消息并发出 `compact_done`;失败时发出 `compact_error`。 | ||
|
|
||
| ## 摘要协议 | ||
|
|
||
| compact summary 必须以如下结构返回: | ||
|
|
||
| ```text | ||
| [compact_summary] | ||
|
|
||
| done: | ||
| - ... | ||
|
|
||
| in_progress: | ||
| - ... | ||
|
|
||
| decisions: | ||
| - ... | ||
|
|
||
| code_changes: | ||
| - ... | ||
|
|
||
| constraints: | ||
| - ... | ||
| ``` | ||
|
|
||
| - 必须包含固定起始标记 `[compact_summary]`。 | ||
| - 必须包含 `done`、`in_progress`、`decisions`、`code_changes`、`constraints` 五个 section。 | ||
| - 每个 section 至少包含一条非空 bullet。 | ||
|
|
||
| ## 保留原则 | ||
|
|
||
| - 优先保留已完成事项及结果。 | ||
| - 保留仍在进行中的状态、关键决策及原因、关键代码改动、用户约束。 | ||
| - 默认忽略工具详细输出、重复背景、已解决错误的排查细节。 | ||
|
|
||
| ## 事件 | ||
|
|
||
| manual compact 相关 runtime 事件包括: | ||
|
|
||
| - `compact_start` | ||
| - `compact_done` | ||
| - `compact_error` | ||
|
|
||
| `compact_done` payload 包含: | ||
|
|
||
| - `applied` | ||
| - `before_chars` | ||
| - `after_chars` | ||
| - `saved_ratio` | ||
| - `trigger_mode` | ||
| - `transcript_id` | ||
| - `transcript_path` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
wynxing marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| # ⚠️ 已过时:旧版 API 文档(DEPRECATED) | ||
|
|
||
|
|
||
| # NeoCode Coding Agent MVP 架构设计 | ||
|
|
||
| ## 1. 目标 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.