makecindy / makecindy/cindy

单次代码修复任务消耗 8.4M token,疑似上下文/工具调用被异常放大

Open
#1,628 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: FourJ
**客户端版本**: 0.1.28

---

## 现象
一次普通的本地代码修复任务,Cindy 全程累计消耗约 8.4M token,远超同类任务的正常水平。任务最终交付的 diff 只有约 100 行。

## 复现步骤
1. 让 Cindy 在本地一个约 1000 行的 Python 项目(profit-monitor)里定位一个 bug
2. Cindy 依次执行 `ls` / `rg` / `cat` 探索目录,找到目标文件
3. 修复过程中需要多次查看同一文件的不同位置
4. 观察 token 消耗

## 实际行为
- 全程约 30 分钟,exec_command 调用 30+ 次
- 多个文件被完整 `cat` 进上下文,包括内容不相关的大型源文件
- 同一路径在短时间内被重复读取,没有复用已有结果
- apply_patch 失败后重新读整个文件再重写
- 累计消耗约 8.4M token

## 期望行为
- 类似规模的本地修复任务,token 应控制在 200K 以内
- 读取文件应优先按行/按片段返回,而非整文件
- 已读过的文件在会话内应被识别为已知,避免重复拉取
- 建议在 UI 实时显示「本会话已消耗 X token」,让用户能中途介入
---
**OS**: darwin arm64 (27.0.0)
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by tracing the exec_command and apply_patch handling, then locate where session context and token usage are recorded. Done means reproducing the excessive reads, reducing repeated or unnecessarily complete file retrieval, and exposing live session token usage in the UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.