{"id":89,"date":"2026-03-21T22:47:16","date_gmt":"2026-03-21T14:47:16","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/concepts-compaction\/"},"modified":"2026-03-21T23:08:53","modified_gmt":"2026-03-21T15:08:53","slug":"concepts-compaction","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/concepts-compaction\/","title":{"rendered":"\u538b\u7f29"},"content":{"rendered":"<h1>\u538b\u7f29<\/h1>\n<h1>\u4e0a\u4e0b\u6587\u7a97\u53e3\u4e0e\u538b\u7f29<\/h1>\n<p>\u6bcf\u4e2a\u6a21\u578b\u90fd\u6709\u4e00\u4e2a<strong>\u4e0a\u4e0b\u6587\u7a97\u53e3<\/strong>\uff08\u53ef\u89c1\u7684\u6700\u5927 token \u6570\uff09\u3002\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u5bf9\u8bdd\u4f1a\u7d2f\u79ef\u6d88\u606f\u548c\u5de5\u5177\u7ed3\u679c\uff1b\u4e00\u65e6\u7a97\u53e3\u7a7a\u95f4\u7d27\u5f20\uff0cOpenClaw \u4f1a<strong>\u538b\u7f29<\/strong>\u8f83\u65e9\u7684\u5386\u53f2\u8bb0\u5f55\u4ee5\u4fdd\u6301\u5728\u9650\u5236\u8303\u56f4\u5185\u3002<\/p>\n<h2>\u4ec0\u4e48\u662f\u538b\u7f29<\/h2>\n<p>\u538b\u7f29\u4f1a\u5c06<strong>\u8f83\u65e9\u7684\u5bf9\u8bdd\u603b\u7ed3<\/strong>\u4e3a\u4e00\u6761\u7d27\u51d1\u7684\u6458\u8981\u6761\u76ee\uff0c\u5e76\u4fdd\u6301\u8fd1\u671f\u6d88\u606f\u4e0d\u53d8\u3002\u6458\u8981\u5b58\u50a8\u5728\u4f1a\u8bdd\u5386\u53f2\u4e2d\uff0c\u56e0\u6b64\u540e\u7eed\u8bf7\u6c42\u4f7f\u7528\u7684\u662f\uff1a<\/p>\n<ul>\n<li>\u538b\u7f29\u6458\u8981<\/li>\n<li>\u538b\u7f29\u70b9\u4e4b\u540e\u7684\u8fd1\u671f\u6d88\u606f<\/li>\n<\/ul>\n<p>\u538b\u7f29\u4f1a<strong>\u6301\u4e45\u5316<\/strong>\u5230\u4f1a\u8bdd\u7684 JSONL \u5386\u53f2\u8bb0\u5f55\u4e2d\u3002<\/p>\n<h2>\u914d\u7f6e<\/h2>\n<p>\u6709\u5173 <code>agents.defaults.compaction<\/code> \u8bbe\u7f6e\uff0c\u8bf7\u53c2\u9605<a href=\"\/concepts\/compaction\">\u538b\u7f29\u914d\u7f6e\u4e0e\u6a21\u5f0f<\/a>\u3002<\/p>\n<h2>\u81ea\u52a8\u538b\u7f29\uff08\u9ed8\u8ba4\u5f00\u542f\uff09<\/h2>\n<p>\u5f53\u4f1a\u8bdd\u63a5\u8fd1\u6216\u8d85\u8fc7\u6a21\u578b\u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u65f6\uff0cOpenClaw \u4f1a\u89e6\u53d1\u81ea\u52a8\u538b\u7f29\uff0c\u5e76\u53ef\u80fd\u4f7f\u7528\u538b\u7f29\u540e\u7684\u4e0a\u4e0b\u6587\u91cd\u8bd5\u539f\u59cb\u8bf7\u6c42\u3002<\/p>\n<p>\u4f60\u4f1a\u770b\u5230\uff1a<\/p>\n<ul>\n<li>\u8be6\u7ec6\u6a21\u5f0f\u4e0b\u663e\u793a <code>\ud83e\uddf9 Auto-compaction complete<\/code><\/li>\n<li><code>\/status<\/code> \u663e\u793a <code>\ud83e\uddf9 Compactions: &lt;count&gt;<\/code><\/li>\n<\/ul>\n<p>\u5728\u538b\u7f29\u4e4b\u524d\uff0cOpenClaw \u53ef\u4ee5\u8fd0\u884c\u4e00\u6b21<strong>\u9759\u9ed8\u8bb0\u5fc6\u5237\u5199<\/strong>\u8f6e\u6b21\uff0c\u5c06\u6301\u4e45\u5316\u7b14\u8bb0\u5199\u5165\u78c1\u76d8\u3002\u8be6\u60c5\u53ca\u914d\u7f6e\u8bf7\u53c2\u9605<a href=\"\/concepts\/memory\">\u8bb0\u5fc6<\/a>\u3002<\/p>\n<h2>\u624b\u52a8\u538b\u7f29<\/h2>\n<p>\u4f7f\u7528 <code>\/compact<\/code>\uff08\u53ef\u9009\u9644\u5e26\u6307\u4ee4\uff09\u5f3a\u5236\u6267\u884c\u4e00\u6b21\u538b\u7f29\uff1a<\/p>\n<pre><code>\/compact Focus on decisions and open questions\n<\/code><\/pre>\n<h2>\u4e0a\u4e0b\u6587\u7a97\u53e3\u6765\u6e90<\/h2>\n<p>\u4e0a\u4e0b\u6587\u7a97\u53e3\u56e0\u6a21\u578b\u800c\u5f02\u3002OpenClaw \u4f7f\u7528\u5df2\u914d\u7f6e\u63d0\u4f9b\u5546\u76ee\u5f55\u4e2d\u7684\u6a21\u578b\u5b9a\u4e49\u6765\u786e\u5b9a\u9650\u5236\u3002<\/p>\n<h2>\u538b\u7f29\u4e0e\u4fee\u526a<\/h2>\n<ul>\n<li><strong>\u538b\u7f29<\/strong>\uff1a\u603b\u7ed3\u5e76<strong>\u6301\u4e45\u5316<\/strong>\u5230 JSONL \u4e2d\u3002<\/li>\n<li><strong>\u4f1a\u8bdd\u4fee\u526a<\/strong>\uff1a\u4ec5\u88c1\u526a\u65e7\u7684<strong>\u5de5\u5177\u7ed3\u679c<\/strong>\uff0c<strong>\u5728\u5185\u5b58\u4e2d<\/strong>\u6309\u8bf7\u6c42\u8fdb\u884c\u3002<\/li>\n<\/ul>\n<p>\u6709\u5173\u4fee\u526a\u7684\u8be6\u60c5\uff0c\u8bf7\u53c2\u9605 <a href=\"\/concepts\/session-pruning\">\/concepts\/session-pruning<\/a>\u3002<\/p>\n<h2>\u63d0\u793a<\/h2>\n<ul>\n<li>\u5f53\u4f1a\u8bdd\u611f\u89c9\u8fc7\u65f6\u6216\u4e0a\u4e0b\u6587\u81c3\u80bf\u65f6\uff0c\u4f7f\u7528 <code>\/compact<\/code>\u3002<\/li>\n<li>\u5927\u578b\u5de5\u5177\u8f93\u51fa\u5df2\u88ab\u622a\u65ad\uff1b\u4fee\u526a\u53ef\u4ee5\u8fdb\u4e00\u6b65\u51cf\u5c11\u5de5\u5177\u7ed3\u679c\u7684\u5806\u79ef\u3002<\/li>\n<li>\u5982\u679c\u4f60\u9700\u8981\u5168\u65b0\u5f00\u59cb\uff0c<code>\/new<\/code> \u6216 <code>\/reset<\/code> \u4f1a\u542f\u52a8\u4e00\u4e2a\u65b0\u7684\u4f1a\u8bdd ID\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u538b\u7f29 \u4e0a\u4e0b\u6587\u7a97\u53e3\u4e0e\u538b\u7f29 \u6bcf\u4e2a\u6a21\u578b\u90fd\u6709\u4e00\u4e2a\u4e0a\u4e0b\u6587\u7a97\u53e3\uff08\u53ef\u89c1\u7684\u6700\u5927 token \u6570\uff09\u3002\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u5bf9\u8bdd\u4f1a\u7d2f\u79ef\u6d88\u606f\u548c [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":1,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/89\/revisions"}],"predecessor-version":[{"id":384,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/89\/revisions\/384"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}