feat(記憶): 新增 habit 型別,慣例每輪注入而不是等人問

其餘九個型別都是宣告性記憶(發生過什麼、他偏好什麼),慣例是程序性的——
不是「記得的事」,是「每次都這樣做的事」。

所以慣例不只接上 recall(型別不影響檢索,本來就通),還每輪注入:
只在關鍵詞對上時才回想得到的慣例等於沒有,沒有人為了照慣例做事先去回想它。

上限 HABIT_INJECT_MAX = 2。糊掉的(fuzzy)不注入——想不起來的慣例就不是慣例,
那是「以前好像有這種習慣」。faded 的標「只記得大概」,不假裝清楚。

注入文字講明慣例是背景不是話題:照著做就好,講出來(「我們不是都這樣嗎」)
就變成在討論它。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-03 08:49:04 +00:00
co-authored by Claude Opus 5
parent f45db7a9cb
commit 10299e18ef
2 changed files with 46 additions and 1 deletions
+4 -1
View File
@@ -1026,8 +1026,11 @@ commands.consolidate = ({ flags }) => {
if (!body.trim()) die("需要 `--body` 或 `--body-file`。");
const type = str(flags.type) || "fact";
// diary:睡眠時寫的第一人稱回顧(persona-sleeppersona-sleeper 都用這個型別)
// habit:**我們之間的慣例**(「他習慣先講結論」「我們之間不說再見」)。
// 其餘型別都是宣告性記憶(發生過什麼、他偏好什麼),慣例是程序性的——
// 它不是「記得的事」,是「每次都這樣做的事」,所以另立一格並且每輪注入。
const VALID_TYPES = [
"fact", "preference", "event", "promise", "relationship", "insight", "boundary", "canon", "diary",
"fact", "preference", "event", "promise", "relationship", "insight", "boundary", "canon", "diary", "habit",
];
if (!VALID_TYPES.includes(type)) die(`--type 只能是 ${VALID_TYPES.join("/")}`);
const about = csv(flags.about).length ? csv(flags.about) : ["user"];