docs: describe midnight sleep and schedule automation

2026-05-15 14:37:35 +09:00
parent 5ce0fde821
commit 4bbfe500e1

@@ -49,27 +49,38 @@ The availability snapshot is stored in memory, not separately persisted. If the
- If `online`, reply normally.
- Periodically evaluate whether a proactive `startConversation` is appropriate.
### Before midnight
### Midnight automation
Generate tomorrow's 10-minute schedule:
Run the schedule and sleep pipeline from the host app on a real timer rather than exposing them as user-facing chat commands. A common policy is one local-midnight job:
1. Run sleep memory for the previous local day's messages.
2. Generate the next day's schedule.
3. On the first day of a month, generate a monthly schedule window.
4. Record debug/events to an admin dashboard or developer channel.
```ts
await persona.createDailySchedule(now, 'Keep tomorrow realistic and ordinary.');
```
const now = new Date('2026-05-01T00:00:00.000');
Because `createDailySchedule(datetime, message)` targets the day after `datetime`, running it on May 1 creates May 2 00:00 through May 3 00:00.
### At midnight
Run sleep memory on the previous day's messages:
```ts
await persona.sleepMemory({
datetime: '2026-05-02T00:00:00.000Z',
messageHistory: messagesFromMay1,
datetime: now,
messageHistory: messagesFromPreviousLocalDay,
});
await persona.createDailySchedule(
now,
"Generate tomorrow's ordinary realistic day schedule.",
);
if (now.getDate() === 1) {
await persona.createMonthlySchedule(
now,
'Generate the coming month of ordinary long-horizon anchors and special events.',
);
}
```
Because `createDailySchedule(datetime, message)` targets the day after `datetime`, running it at May 1 00:00 creates May 2 00:00 through May 3 00:00. This keeps the persona from "planning itself" in response to a slash command and makes the schedule feel like background life state.
Then drop local yesterday-only caches according to your application retention policy.
## Message delivery policy
@@ -208,7 +219,7 @@ Use this for:
## Sleep memory and objectivization
`sleepMemory` is the end-of-day memory pipeline.
`sleepMemory` is the end-of-day memory pipeline. Host apps should usually trigger it automatically from a midnight job over the previous local day's conversation log, then expose the result through observability surfaces rather than requiring a user to ask the persona to sleep.
The memory extraction instruction tells the model to objectivize subjective statements before storage: