Skip to main content

Module dream_prompt

Module dream_prompt 

Source
Expand description

What a Dreams pass asks the model (SPEC_DREAMS §2.3, §4, §6.1, §8).

The pass is one tool-less model call whose input is assembled here into one prompt. This module decides what goes in, under the input cap, and hands back the exact text the prompt carried, so dream_proposal can hold every quote the model cites against it. It runs no model, reads no file and writes nothing.

What it guarantees, so the model’s behaviour is never relied on:

  • only trusted text is carried: memory files and the person’s and the agent’s own session text. The caller is handed no way to pass tool output, a web page, mail or a jekt body, because a session’s label must be person or agent (the memory files are labelled memory by this module itself) and any other is refused;
  • every block is fenced by a marker that occurs nowhere in what it carries, so a memory file cannot close its own block and pose as an instruction;
  • the prompt never exceeds the input cap, its block lines included: the index is read first, then files newest first, then the most recent session text, and what did not fit is named in caps_hit (the entry shows it) instead of cut silently;
  • the size of the prompt is counted at the measured rate of memory text (BYTES_PER_TOKEN_TENTHS), so the cap is a count of real tokens, not a guess that a pass then overruns.

Structs§

Built
The prompt, and what it carried.
Caps
The input and output limits of one pass (§8). Tokens are estimated at four bytes each, an assumption the entry states.
Input
What a pass read, and what it was asked to do.

Enums§

Refused
Why no prompt was built.

Constants§

BYTES_PER_TOKEN_TENTHS
The bytes one token takes, in tenths. Measured on a real memory of 224,508 bytes of notes: the provider counted 100,747 tokens for the whole prompt, 2.2 bytes each. Prose runs nearer 4.4, so a session’s text is counted at up to twice its size, which keeps a cap safe.
INDEX_NAME
The index file: always read first, because every other file is reached through it.

Functions§

build
Assemble the prompt, within caps.
tokens
The estimate of a text’s tokens at the measured rate, rounded up.