shareAI-lab / shareAI-lab/learn-claude-code

这里s06Context Compact 的第一层micro_compact还是有些简单粗暴的,后面会压缩重要信息导致模型出现幻觉问题

Open
#274 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
77.2k
Forks
12.4k
Avg merge
2d 5h
Merged PRs (30d)
6

Description

使用的问题示例是:Read every Python file in the agents/ directory one by one。
第一层压缩会把前面的非read_file类型的tool result 替换为占位符,而有个bash result是find到的待read文件列表,这个result被压缩之前还能按顺序走loop依次读取文件,但是压缩后下一个模型读取的文件就是/agents/s03_errors.py,这个文件完全不存在,无疑是模型幻觉了
不过这里应该只是考虑到教学,简化了压缩的逻辑,感觉实际使用的时候还要用到更有效的压缩策略。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the s06Context Compact implementation, focusing on the first-layer micro_compact behavior described in the issue. Reproduce the example of reading every Python file in agents/ and verify that compaction preserves the discovered file list and ordering, so the model does not select a nonexistent file afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.