{"id":1835,"date":"2026-07-30T18:12:46","date_gmt":"2026-07-30T10:12:46","guid":{"rendered":"https:\/\/www.imaseo.com\/blog\/?p=1835"},"modified":"2026-06-02T17:31:15","modified_gmt":"2026-06-02T09:31:15","slug":"learn-forgetting-context-compression","status":"publish","type":"post","link":"https:\/\/www.imaseo.com\/blog\/ai-tools\/learn-forgetting-context-compression","title":{"rendered":"\u5b66\u4f1a\u9057\u5fd8\uff1aCodex\u3001Claude Code \u4e0e OpenCode \u7684\u4e0a\u4e0b\u6587\u538b\u7f29\u672f\u600e\u4e48\u7528\uff1f"},"content":{"rendered":"<p>\u5b66\u4f1a\u9057\u5fd8\uff1aCodex\u3001Claude Code \u4e0e OpenCode \u7684\u4e0a\u4e0b\u6587\u538b\u7f29\u672f\u600e\u4e48\u7528\uff1f<\/p>\n<p>\u5728\u4f7f\u7528 AI Agent \u6df1\u5ea6\u53c2\u4e0e\u7f16\u7a0b\u4efb\u52a1\u65f6\uff0c\u4f60\u4e00\u5b9a\u9047\u5230\u8fc7\u8fd9\u79cd\u7a98\u5883\uff1a\u8d77\u521d AI \u53cd\u5e94\u654f\u6377\uff0c\u6307\u54ea\u6253\u54ea\uff1b\u4f46\u968f\u7740\u5bf9\u8bdd\u8f6e\u6b21\u589e\u52a0\uff0c\u5b83\u4f3c\u4e4e\u5f00\u59cb\u53d8\u5f97\u8d8a\u6765\u8d8a\u7b28\u3002\u4e0a\u4e0b\u6587\u5feb\u7528\u5b8c\u7684\u65f6\u5019\uff0cAI \u4f1a\u7740\u6025\u5b8c\u6210\u5bfc\u81f4\u6548\u679c\u4e0d\u4f73\uff0c\u793e\u533a\u4e2d\u79f0\u4f5c Context Anxiety\uff08\u4e0a\u4e0b\u6587\u7126\u8651\uff09\u3002\u548c\u6211\u4eec\u4eba\u4e00\u6837\uff0c\u7740\u6025\u5c31\u5bb9\u6613\u51fa\u9519\u3002<\/p>\n<p>\u4e3a\u4e86\u7ef4\u6301\u5bf9\u8bdd\uff0cAgent \u5fc5\u987b\u4e22\u6389\u4e00\u90e8\u5206\u8bb0\u5fc6\uff08\u538b\u7f29 &#8211; Compact\uff09\u3002\u4f46\u600e\u4e48\u4e22\u3001\u4e22\u6389\u8c01\u3001\u4e22\u6389\u540e\u600e\u4e48\u8865\u6551\uff0c\u6210\u4e86\u8861\u91cf\u4e00\u4e2a Agent \u8fd0\u884c\u65f6\u662f\u5426\u6210\u719f\u7684\u5206\u6c34\u5cad\u3002<\/p>\n<p><strong>\u4e3a\u4ec0\u4e48 Agent \u9700\u8981\u5b66\u4f1a\u9057\u5fd8<\/strong><\/p>\n<p>Codex \u50cf\u4e00\u4e2a\u4fdd\u7559\u5e95\u7a3f\u7684\u5f52\u6863\u5458\uff1a\u5148\u628a\u65e7\u6d88\u606f\u9690\u85cf\u8d77\u6765\uff0c\u7a7a\u95f4\u8fd8\u4e0d\u591f\u65f6\u518d\u603b\u7ed3\uff0c\u800c\u4e14\u4f1a\u628a\u7528\u6237\u6700\u540e\u4e00\u53e5\u8bdd\u91cd\u65b0\u653e\u56de\u73b0\u573a\u3002\u8bf4\u5230\u5e95\uff0c2026 \u5e74\u7684\u4e0a\u4e0b\u6587\u7ba1\u7406\uff0c\u91cd\u70b9\u5df2\u7ecf\u4e0d\u662f\u628a\u7a97\u53e3\u65e0\u9650\u505a\u5927\uff0c\u800c\u662f\u8ba9 Agent \u5b66\u4f1a\u6709\u9009\u62e9\u5730\u9057\u5fd8\u3002\u8be5\u4e22\u6389\u7684\u662f\u566a\u97f3\u548c\u91cd\u590d\u7ed3\u679c\uff0c\u8be5\u7559\u4e0b\u7684\u662f\u4efb\u52a1\u72b6\u6001\u3001\u7528\u6237\u610f\u56fe\u548c\u4e0b\u4e00\u6b65\u5224\u65ad\u4f9d\u636e\u3002\u4e00\u4e2a\u4ec0\u4e48\u90fd\u5e26\u7740\u8d70\u7684 Agent\uff0c\u53cd\u800c\u6700\u5bb9\u6613\u88ab\u81ea\u5df1\u7684\u8bb0\u5fc6\u62d6\u6162\u3002<\/p>\n<p><strong>Codex \u7684\u538b\u7f29\u673a\u5236<\/strong><\/p>\n<p>OpenAI \u7684 Codex \u5728 <code>compact.rs<\/code> \u4e2d\u5b9e\u73b0\u4e86\u5206\u5c42\u5904\u7406\u3002\u5b83\u5148\u901a\u8fc7\u5165\u53e3\u5c42\u63a7\u5236\u5de5\u5177\u8f93\u51fa\u548c\u5386\u53f2\u81a8\u80c0\uff0c\u907f\u514d\u7a97\u53e3\u592a\u5feb\u88ab\u566a\u58f0\u5403\u6389\u3002\u5f53\u89e6\u53d1 CompactionTrigger \u65f6\uff0c\u670d\u52a1\u7aef\u4f1a\u628a\u4efb\u52a1\u72b6\u6001\u4ea4\u7ed9\u8fdc\u7a0b\u5904\u7406\uff0c\u7528 encrypted_content \u627f\u8f7d\u6bd4\u660e\u6587 summary \u66f4\u5f3a\u7684\u6062\u590d\u80fd\u529b\u3002\u538b\u7f29\u540e\uff0cPrompt scaffold \u4f1a\u91cd\u5efa\u7cfb\u7edf\u89c4\u5219\uff0c\u8ba9 summary \u4e0d\u5fc5\u80cc\u8d1f\u6240\u6709\u73af\u5883\u7ea6\u675f\u3002\u591a\u6b21 compact \u540e\uff0cCodex \u4f9d\u7136\u80fd\u63a5\u7740\u5e72\u6d3b\uff0c\u6b63\u662f\u56e0\u4e3a\u5b83\u628a\u201c\u73b0\u573a\u201d\u4fdd\u5b58\u5f97\u8db3\u591f\u5b8c\u6574\u3002<\/p>\n<p><strong>Claude Code \u7684\u7f13\u5b58\u4e0e\u7ba1\u7406\u7b56\u7565<\/strong><\/p>\n<p>Claude Code \u5219\u4f9d\u9760 cache_edits \u548c context_management \u80fd\u529b\u3002\u5b83\u4f1a\u4f18\u5148\u4fdd\u7559\u7528\u6237\u610f\u56fe\u548c\u5f53\u524d\u4efb\u52a1\u72b6\u6001\uff0c\u5bf9\u91cd\u590d\u7684\u641c\u7d22\u7ed3\u679c\u6216\u5df2\u9a8c\u8bc1\u7684\u4ee3\u7801\u7247\u6bb5\u8fdb\u884c\u5feb\u901f\u88c1\u526a\u3002\u793e\u533a\u9006\u5411\u7814\u7a76\u663e\u793a\uff0c\u5176 compaction engine \u5728\u5904\u7406\u957f\u7a0b\u5bf9\u8bdd\u65f6\uff0c\u4f1a\u628a\u975e\u5173\u952e\u7684\u5de5\u5177\u8fd4\u56de\u7ed3\u679c\u8f6c\u4e3a opaque state\uff0c\u51cf\u5c11\u660e\u6587\u5360\u7528\u3002\u9047\u5230\u767b\u5f55 Bug \u8fd9\u7c7b\u573a\u666f\uff0c\u5b83\u80fd\u5feb\u901f\u4e22\u5f03\u65e9\u671f\u65e0\u6548\u7684 grep \u7ed3\u679c\uff0c\u53ea\u4fdd\u7559 auth.ts \u7684\u5173\u952e\u903b\u8f91\u548c\u7528\u6237\u6700\u540e\u4e00\u6b21\u786e\u8ba4\u7684\u4fee\u590d\u65b9\u5411\u3002<\/p>\n<p><strong>OpenCode \u7684\u5b9e\u9645\u843d\u5730\u65b9\u5f0f<\/strong><\/p>\n<p>OpenCode \u5728\u5f00\u6e90\u5b9e\u73b0\u4e2d\u66f4\u6ce8\u91cd\u5916\u90e8\u5b58\u50a8\u3002\u5b83\u9f13\u52b1\u7528\u6237\u628a\u51b3\u7b56\u8fc7\u7a0b\u8bb0\u5f55\u5230\u5916\u90e8\u6587\u4ef6\u6216\u4ed3\u5e93\uff0c\u907f\u514d\u6bcf\u6b21\u65b0\u5f00\u5bf9\u8bdd\u90fd\u91cd\u65b0\u89e3\u91ca\u80cc\u666f\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4e0a\u4e0b\u6587\u65ad\u88c2\u95ee\u9898\u88ab\u5927\u5e45\u7f13\u89e3\u3002Agent \u4e0d\u7528\u5728\u6bcf\u8f6e\u90fd\u91cd\u65b0\u8ba4\u8bc6\u9879\u76ee\u7ed3\u6784\uff0c\u800c\u662f\u76f4\u63a5\u8bfb\u53d6\u5df2\u4fdd\u5b58\u7684\u72b6\u6001\u7ee7\u7eed\u63a8\u8fdb\u3002<\/p>\n<p><strong>\u600e\u4e48\u5728\u65e5\u5e38\u4e2d\u5e94\u7528\u8fd9\u4e9b\u538b\u7f29\u672f<\/strong><\/p>\n<p>\u5f53\u4f60\u4fee\u590d\u4e00\u4e2a 401 Unauthorized \u7684\u767b\u5f55\u63a5\u53e3\u65f6\uff0c\u5148\u8ba9 Agent \u505a\u4e00\u6b21\u6709\u9488\u5bf9\u6027\u7684 grep \u548c read_file\uff0c\u800c\u4e0d\u662f\u65e0\u8111\u5168\u91cf\u626b\u63cf\u3002\u9047\u5230\u4e0a\u4e0b\u6587\u538b\u529b\u65f6\uff0c\u4e3b\u52a8\u89e6\u53d1 compact\uff0c\u5e76\u628a\u5173\u952e\u610f\u56fe\u7528\u4e00\u53e5\u8bdd\u91cd\u65b0\u786e\u8ba4\u3002Codex\u3001Claude Code \u548c OpenCode \u90fd\u652f\u6301\u8fd9\u79cd\u201c\u5148\u9690\u85cf\u3001\u518d\u603b\u7ed3\u201d\u7684\u6d41\u7a0b\uff0c\u533a\u522b\u53ea\u5728\u4e8e\u670d\u52a1\u7aef\u5904\u7406\u7ec6\u8282\u548c\u6062\u590d\u80fd\u529b\u5f3a\u5f31\u3002<\/p>\n<p>\u638c\u63e1\u8fd9\u4e9b\u9057\u5fd8\u6280\u5de7\u540e\uff0c\u4f60\u4f1a\u53d1\u73b0 Agent \u7684\u8868\u73b0\u4e0d\u518d\u968f\u5bf9\u8bdd\u957f\u5ea6\u7ebf\u6027\u4e0b\u964d\uff0c\u800c\u662f\u59cb\u7ec8\u4fdd\u6301\u5728\u9ad8\u6548\u533a\u95f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4f1a\u9057\u5fd8\uff1aCodex\u3001Claude Code \u4e0e OpenCode \u7684\u4e0a\u4e0b\u6587\u538b\u7f29\u672f\u600e\u4e48\u7528\uff1f \u5728\u4f7f\u7528 AI Agent \u6df1\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1835","post","type-post","status-publish","format-standard","hentry","category-ai-tools"],"_links":{"self":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts\/1835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/comments?post=1835"}],"version-history":[{"count":1,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts\/1835\/revisions"}],"predecessor-version":[{"id":1836,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/posts\/1835\/revisions\/1836"}],"wp:attachment":[{"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/media?parent=1835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/categories?post=1835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.imaseo.com\/blog\/wp-json\/wp\/v2\/tags?post=1835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}