refactor(recall): 回执去教学化——尾部操作指引清除,空态一句话,注入头行瘦身

与 schedule 回执同病同治(规范 §六:怎么做写在 schema description,运行时只给事实):

- search 空态:'换个更宽泛的关键词再试,或 op=days…' → '日记中无「q」相关记录。';
  命中数尾巴 '要更多加大 count 或关键词收窄' 删;
- days:'用 op=day 看某天;记得关键词就 op=search' 教学尾行删,头行简化
  '【日记索引】共 N 天(新在前)';空态一句 '日记库为空(尚无收口碎片)。';
- day 空态 '没有日记(当天无交互或条目已裁剪;op=days 可看有哪些天)' → 'date 无日记。';
- files:'(按磁盘实况列出;取内容用 op=link)' 教学尾行删;措辞收紧为
  '「标题」现存文件(顶层 N 个)' / 目录不存在、无文件各一句;
- journalFor 注入头行:五连 op 枚举(search/days/day/files/link 用法)收为
  '(最近N条,非全部——更早的可用 recall 检索)' 一句事实+指针,op 细节归 schema;
- throw 类纠错错误保留(§五:错误是引导修正的合法位置)。

探针 6 项全过(search/days/day/files 零教学、空态一句话、注入头行瘦身)。
This commit is contained in:
2026-09-29 17:31:28 +08:00
parent 4de159c896
commit c5ca2e0bf6
2 changed files with 10 additions and 15 deletions
+2 -5
View File
@@ -76,9 +76,7 @@ function journalFor(db, cfg, user) {
'SELECT session_id, day, text FROM memory_fragments WHERE user = ?' + INJECT_ORDER + ' LIMIT ?'
).all(String(user || ''), cap);
if (!rows.length) return '';
const head = '【长期记忆·日记(最近' + rows.length + '条)】收工时的当日事件摘要,新在前、天内按发生顺序;'
+ '每条【编号】是来源会话 id:更早的日记用 recall 工具 op=search 关键词检索、op=days 按日期翻页再 op=day 取整天;'
+ '那次工作的成果文件用 op=files 查、op=link 取。';
const head = '【长期记忆·日记(最近' + rows.length + '条,非全部——更早的可用 recall 检索)】新在前、天内按发生顺序;每条【编号】是来源会话 id。';
const groups = [];
for (const r of rows) {
const g = groups[groups.length - 1];
@@ -118,8 +116,7 @@ function searchFragments(db, user, query, count) {
if (!hits.length) return '';
hits.sort((a, b) => b.score - a.score || a.i - b.i);
const shown = hits.slice(0, lim);
const parts = ['【日记检索】「' + String(query).trim() + '」命中 ' + hits.length + ' 条,按相关度列前 ' + shown.length + ' 条'
+ (hits.length > shown.length ? ';要更多加大 count 或关键词收窄' : '') + ':'];
const parts = ['【日记检索】「' + String(query).trim() + '」命中 ' + hits.length + ' 条,按相关度列前 ' + shown.length + ' 条:'];
for (const h of shown) parts.push('--- ' + h.r.day + '(' + Math.round(h.score * 100) + '% 匹配)---\n' + renderFrag(h.r));
return parts.join('\n\n');
}