per-turn reminder: turn-composition protocol as its own system chunk after every GM turn, one live copy elided like the papers; handbook cut follows (short turns)

This commit is contained in:
2026-11-14 22:00:04 +00:00
parent 5956e44f7a
commit 89a2c161b3
13 changed files with 156 additions and 31 deletions
+5 -1
View File
@@ -10,7 +10,7 @@
import fs from 'node:fs';
import path from 'node:path';
import { clerkJson } from './clerk.mjs';
import { toolList, runTool, readSettings, runDir, expandVars } from './bundle.mjs';
import { toolList, runTool, readSettings, runDir, expandVars, assembleReminder } from './bundle.mjs';
import { renderView } from './session.mjs';
export class HttpError extends Error {
@@ -36,6 +36,10 @@ export async function gmTurn(ctx, runId, line, user) {
const agendaWire = agenda.map((d, i) => `${i}. ${d}`).join('; ');
const content = `${line.trim()}\n\n<status>${paper.join(', ')}</status>\n<agenda>${agendaWire}</agenda>`;
s.append({ t: 'msg', m: { role: 'user', content } });
// the reminder follows the GM's prose as its own system chunk —
// every turn, one live copy (older ones elide in the view)
const reminder = assembleReminder(runId);
if (reminder) s.append({ t: 'msg', m: { role: 'system', content: reminder }, reminder: true });
return runLoop(ctx, runId, user);
}