Journal

Status: Phase 1 shipped (2026-05-23). Phase 1.1 review fixes landed 2026-05-25 — multi-instance regen lock, single MaxEntries cap, REST status codes, GET /journal fan-out parallelized, fire-and-forget bound to host shutdown, /regenerate rate-limited, parser truncation salvage, configurable MaxEvalTokens, category persistence. See "Phase 1.1 — what landed" below. The Living Lorebook (Cast & places, save to a lorebook, continue with this cast, make a character) has shipped since, in October 2026: see its note under Living Lorebook. Phase 0 trust hardening landed 2026-08-08 (from docs-internal/archive/completed-audits/chat-engine/JOURNAL_FEATURE_REVIEW_2026-08-08.md): strict eval no-op contract, on-summary covered-window eval, human-edit authority, unique regen-lock tokens + lease renewal, staged/atomic regeneration, content-free logging — see "Phase 0 hardening — what landed". Run ledger + honest activity status (JRN-09) and index alignment (JRN-15) landed 2026-08-10 (63fe18e4); the Story State surface — header/phone-chip/Who-drawer entry points and the task-first editor (JRN-12/13, Slice A) — shipped 2026-08-12 (42fc37c4), spec and verification in docs-internal/archive/delivered/chat-engine/JOURNAL_SLICE_A_SURFACE.md. Phase 2+ planned — see "Out of Phase 1".

Overview

The Journal is an always-on persistent context system that maintains structured state about the ongoing story. Unlike memories (past events recalled by search) or lorebooks (static reference data matched by relevance), the journal tracks living state that is always injected into the prompt.

More importantly, the journal is a living lorebook -- it doesn't just track one-liner state, it extracts and evolves full character cards, location profiles, and world knowledge directly from the narrative. Characters you meet get auto-generated profiles that grow richer over time. Locations you visit accumulate detail. The journal essentially writes its own lorebook entries from what happens in the story, and these entries can be materialized into actual lorebook entries for reuse across conversations.

Three layers:

Layer What it tracks Scope Example
State Facts Basic ongoing truths Conversation-wide "The party is on a quest to find the Crystal of Dawn"
Character Progressions Full evolving character profiles Per-NPC / per-character Elara: appearance, personality, abilities, relationship to player, history of interactions
Location Progressions Full evolving location profiles Per-location Shadowkeep: description, layout, hazards, inhabitants, what the party has done there

All journal content is always included in the prompt (not search-gated), making it the system of record for "what is true right now."


Problem

Current gaps

Memories are episodic and search-based. They capture what happened, but:

Facts (Discord-only, not implemented for web) are user-level, not story-level:

Trackers (proposed) handle discrete named values but not narrative-level state:

Lorebooks are static reference data created upfront by the character creator:

What's needed

A system that automatically builds and evolves structured knowledge from the narrative -- character profiles that grow richer as you interact, location entries that accumulate detail as you explore, and the ability to graduate this living knowledge into reusable lorebook entries.


Proposed Design

Journal Structure

Journal (per conversation)
├── State Facts
│   ├── "The party is searching for the Crystal of Dawn"
│   ├── "Current party: Player, Elara (ranger), Grimjaw (dwarf)"
│   └── "The Shadow King's forces are gathering in the north"
│
├── Character Profiles (living character cards)
│   ├── Elara
│   │   ├── Profile: { appearance, personality, abilities, role, secrets... }
│   │   ├── Relationship: "Trusted companion after cave rescue"
│   │   └── History: ["Initially suspicious", "Bridge battle", "Cave rescue", ...]
│   ├── Grimjaw
│   │   ├── Profile: { gruff dwarf, twin axes, searching for brother... }
│   │   ├── Relationship: "Loyal, hired for gold but stays out of duty"
│   │   └── History: ["Met at tavern", ...]
│   └── The Shadow King
│       ├── Profile: { ancient lich, commands undead, rules Shadowkeep... }
│       ├── Relationship: "Unknown antagonist"
│       └── History: ["First mentioned by village elder", ...]
│
└── Location Profiles (living location cards)
    ├── Shadowkeep
    │   ├── Profile: { five-floor dungeon, dwarven-built, now undead-infested... }
    │   ├── State: "Floors 1-3 explored, bridge on 2 destroyed, boss on 5 undefeated"
    │   └── History: ["Entered through secret passage", "Cleared floor 1", ...]
    ├── Millhaven Village
    │   ├── Profile: { small farming village, friendly elder, near forest... }
    │   ├── State: "Safe, allied. Elder owes a favor."
    │   └── History: ["Arrived seeking info", "Defended from wolves", ...]
    └── The Northern Pass
        ├── Profile: { mountain pass, only route north, rumored dangerous... }
        ├── State: "Unexplored"
        └── History: ["Mentioned by Grimjaw", ...]

State Facts

Simple declarative statements about the current story state. Always injected.

JournalFact
├── ConversationId
├── Content              "The party is searching for the Crystal of Dawn"
├── Category             "quest" | "party" | "world" | custom
├── IsActive             true (false = historical, not injected but preserved)
├── CreatedAt
└── UpdatedAt

Key behavior:

Character Profiles (Living Character Cards)

Character profiles are auto-generated and continuously evolving character cards built from the narrative. When the AI introduces an NPC, the evaluation call extracts everything it can about that character and creates a profile. As the story progresses and reveals more, the profile grows richer.

JournalCharacterProfile
├── ConversationId
├── CharacterName         "Elara"
├── Aliases               ["the ranger", "Princess Elara", "the Lightbringer"]
├── ProfileJson           Structured character data (see below)
├── RelationshipState     "Trusted companion after cave rescue"
├── Entries[]             Progression history
│   ├── Content           "Grudging respect after bridge battle"
│   ├── CreatedAt
│   └── MessageId         (which message triggered this update)
├── IsActive              true
├── CreatedAt
└── UpdatedAt

ProfileJson structure (grows over time):

{
  "appearance": "Tall, lean build. Dark hair kept short. Wears green ranger's cloak, carries an oak longbow.",
  "personality": "Distrustful of outsiders but fiercely loyal once trust is earned. Dry sense of humor. Hates confined spaces.",
  "abilities": "Expert tracker and archer. Knows herb lore. Can speak with birds.",
  "role": "Ranger, party scout",
  "background": "From the Northern Reaches. Exiled princess (secret).",
  "goals": "Find the Crystal of Dawn to lift the curse on her homeland.",
  "secrets": "She is the exiled princess of the Northern Reaches.",
  "notable_items": "Oak longbow (named 'Whisper'), silver locket"
}

Not every field exists from the start. When Elara is first mentioned, the profile might only have:

{
  "appearance": "A ranger in a green cloak",
  "role": "Suspicious stranger at the tavern"
}

Over 20 messages of interaction, the evaluation call fills in personality, abilities, background, and secrets as the narrative reveals them. The profile is always the latest, most complete picture of who this character is.

Key behavior:

Location Profiles (Living Location Cards)

Same pattern for locations. When the party arrives somewhere, the evaluation call creates a location profile from what the narrative describes. As they explore, the profile grows.

JournalLocationProfile
├── ConversationId
├── LocationName          "Shadowkeep"
├── Aliases               ["the dungeon", "the ancient fortress"]
├── ProfileJson           Structured location data (see below)
├── CurrentState          "Floors 1-3 explored, bridge on 2 destroyed"
├── Entries[]             Progression history
│   ├── Content           "Cleared floor 1 goblins"
│   ├── CreatedAt
│   └── MessageId
├── IsActive              true
├── CreatedAt
└── UpdatedAt

ProfileJson structure:

{
  "description": "A crumbling five-floor dungeon carved into the mountainside. Built by ancient dwarves, now overrun by undead and goblins.",
  "layout": "Five descending levels. Level 1: entry hall and goblin warrens. Level 2: collapsed bridge over chasm. Level 3: fungal gardens.",
  "hazards": "Unstable stonework, goblin patrols, undead on lower floors",
  "inhabitants": "Goblins (floors 1-3), undead (floors 4-5), The Shadow King (floor 5 boss)",
  "notable_features": "Ancient dwarven murals on level 1, underground river on level 3",
  "resources": "Healing mushrooms in fungal gardens, dwarven weapon cache on level 2"
}

Key behavior:


Prompt Injection

New Provider Key: "journal"

Provider output example:

## Story Journal

### Current State
- The party is searching for the Crystal of Dawn
- Current party: Player, Elara (ranger), Grimjaw (dwarf fighter)
- The Shadow King's forces are gathering in the north

### Characters

**Elara** (the ranger)
Appearance: Tall, lean build. Dark hair kept short. Green ranger's cloak, oak longbow 'Whisper'.
Personality: Distrustful of outsiders, fiercely loyal once trust earned. Dry humor. Claustrophobic.
Abilities: Expert tracker/archer. Herb lore. Can speak with birds.
Background: Exiled princess of the Northern Reaches (revealed during cave rescue).
Relationship: Trusted companion after cave rescue.

**Grimjaw** (the dwarf)
Appearance: Stocky, heavily scarred. Braided beard. Twin hand-axes.
Personality: Gruff exterior, secretly sentimental. Protective of the party.
Abilities: Veteran fighter. Knows dwarven history and stonework.
Background: Searching for his brother who vanished in Shadowkeep.
Relationship: Loyal, hired for gold but stays out of duty now.

### Locations

**Shadowkeep**
Description: Five-floor dungeon carved into the mountainside. Dwarven-built, now overrun by undead and goblins.
Layout: L1 entry/goblins, L2 collapsed bridge, L3 fungal gardens, L4-5 undead/boss.
State: Floors 1-3 explored. Bridge on L2 destroyed. Boss on L5 undefeated.

**Millhaven Village**
Description: Small farming village near the forest edge. Friendly elder Brenn.
State: Safe, allied. Elder owes a favor.

Maintain consistency with these established facts and character profiles.

Token budget: Journal content is always injected, so it must stay concise. The system enforces:

Update Mechanism

Journal updates can happen through:

1. Evaluation LLM call (primary mechanism)

After each AI response, a separate LLM call (shared with tracker evaluation) identifies state changes:

The story LLM is never asked to produce structured journal output -- it writes pure narrative. The evaluation call runs async after the response streams to the user, using the same TrackerLlm config (cheap/fast model). Since tracker evaluation and journal evaluation both analyze the same AI response, they can share a single evaluation call that extracts both tracker updates and journal changes in one pass.

2. Summarization hook

When conversation summarization runs, the summary output includes journal updates. The summarization prompt asks the LLM to identify what changed during the summarized segment:

Based on the events summarized:
- Which state facts have changed?
- How have character relationships evolved?
- What location states were affected?

This is a natural fit since summarization already processes narrative content.

2a. Scene-Aware Summarization (future enhancement)

The current summarization system triggers based on message count (e.g., every 30 unsummarized messages). This is a poor fit for storytelling -- a fixed window may split a scene in half, creating a memory that covers the first half of a battle and another that covers the second half. Memories should ideally correspond to scenes: coherent narrative units with a beginning, middle, and end.

Scene transition detection via the evaluation call:

Since the tracker/journal evaluation call already analyzes every AI response, it can also detect scene transitions -- moments where the narrative context shifts significantly:

The evaluation call would output a scene_transition flag alongside its normal tracker/journal extractions:

{
  "tracker_updates": { ... },
  "journal_updates": { ... },
  "scene_transition": {
    "detected": true,
    "type": "location_change",
    "from": "The Rusty Anchor tavern",
    "to": "The northern forest road",
    "note": "Party departed after receiving the map"
  }
}

How this changes summarization:

Instead of summarizing every N messages, the summarization system would summarize per scene:

  1. Evaluation call detects a scene transition
  2. All messages from the previous scene boundary to now are grouped as one scene
  3. Summarization runs on that scene as a coherent unit
  4. The resulting memory is a complete scene summary ("At the Rusty Anchor, the party met Grimjaw, negotiated payment, and received the map to Shadowkeep")

Fallback: If no scene transition is detected for a long stretch (e.g., 40+ messages in one continuous scene), the system falls back to the current message-count-based summarization to prevent unbounded context growth.

Why this matters for memories: Scene-aligned memories are dramatically more useful for semantic recall. A memory of "the tavern scene" is a coherent, searchable unit. A memory of "messages 31-40" that happens to split across two locations produces fragmented, harder-to-recall context.

Status: This depends on the tracker evaluation call being implemented first. Scene detection would be an additional output from that same evaluation pass, requiring no extra LLM calls.

3. Manual user edits

Users can directly add, edit, or deactivate journal entries through the UI. This serves as a correction mechanism when the AI misinterprets events, and lets users seed the journal at conversation start.

Evaluation Prompt: Creator Control

The journal evaluation prompt is creator-configurable, not one-size-fits-all. Different creators have different expectations for how aggressively the journal extracts and evolves profiles:

Creator testing UI:

Since every journal update records its source_message_id, creators can test and iterate on their evaluation prompts:

  1. Regenerate from message: Select a message and re-run the journal evaluation against it. See what profiles/facts would be extracted with the current prompt.
  2. Batch test: Run evaluation across a range of messages to see how profiles evolve. Useful for verifying that the extraction prompt produces the right level of detail across a full conversation.
  3. A/B evaluation: Compare two extraction prompts against the same message to see which produces better profiles.
  4. Profile preview: Show a "before/after" of what the profile looked like before and after a given message's evaluation, so creators can see exactly what each response contributes.

This follows the same pattern as tracker evaluation testing and the existing memory regeneration system.


Relationship to Other Systems

Journal vs. Memories

Journal Memories
Content Current state Past events
Injection Always on Search-based recall
Structure Categorized (facts, characters, locations) Flat episodes
Mutability Updated as state changes Immutable once created
Source AI extraction + user edits Summarization pipeline

They complement each other. The journal says "Elara trusts the player." Memories say "In session 3, Elara and the player survived the cave collapse together." The journal is the conclusion; memories are the evidence. Fuzzy time search can surface the right memories when users ask temporal questions ("when did Elara start trusting us?"), connecting the journal's current state back to the memories that explain it.

Journal vs. Trackers

Journal Trackers
Values Narrative prose Discrete named values
Format Sentences/paragraphs Key: value
Examples "Elara has warmed up considerably" relationship_elara: 7/10
Best for Qualitative state Quantitative state

They can coexist. Trackers handle the mechanical (HP: 72, Time: Day 3), journal handles the narrative ("Party morale is low after the ambush").

Journal vs. Lorebooks

Journal Lorebooks
Content Mutable, narrative-extracted Static, creator-authored
Scope Per-conversation Per-character/shared
Injection Always on (active profiles) Relevance-searched
Source Auto-generated from story Manually created upfront
Growth Evolves every message Fixed until creator edits

Lorebooks define the world the creator built ("Shadowkeep is a five-floor dungeon built by the ancient dwarves"). Journal captures what the story creates ("The tavern keeper Marta is a retired adventurer who lost her left hand to a dragon" -- a character the AI invented on the fly, now permanently tracked).

The journal fills the gap lorebooks can't: Lorebooks only know what the creator wrote. The journal knows what happened. For characters the AI invents, locations the story discovers, and facts the narrative establishes, the journal is the only source of structured knowledge.


Living Lorebook

The journal's most powerful capability: it is a self-writing lorebook that extracts, structures, and evolves world knowledge directly from the narrative.

How It Works

  1. Auto-extraction: The evaluation LLM call analyzes each AI response and extracts structured data into character/location profiles. No creator input needed.

  2. Progressive enrichment: Profiles start sparse and grow rich. First mention of an NPC might yield just a name and role. After 10 interactions, the profile has appearance, personality, abilities, secrets, and a full relationship arc.

  3. Consistency enforcement: Because profiles are always injected, the AI stays consistent with established facts. If the journal says Elara has dark hair, the AI won't suddenly describe her as blonde. The journal is the AI's persistent memory of what it established.

  4. User editability: The LLM will make mistakes -- wrong details, missed changes, merged characters that shouldn't be merged. Every auto-generated field is directly editable by the user. User edits take precedence over future evaluation updates (see Design Principles: User Editability).

  5. Error transparency: When the evaluation call returns unparseable JSON, the raw response is preserved and the user is notified so they can manually apply the intended changes (see Design Principles: Error Handling).

  6. Full lorebook generation: Journal profiles can be materialized into actual lorebook entries -- creating a real, searchable lorebook from the story's emergent content.

Profile Evolution Example

Message 3: "A ranger in a green cloak watches you from across the tavern."

{
  "name": "Unknown Ranger",
  "appearance": "Wears a green cloak",
  "role": "Mysterious observer at tavern"
}

Message 8: "'I'm Elara,' she says, reluctantly extending her hand. 'I track things. People, mostly. You've been making noise since you arrived.'"

{
  "name": "Elara",
  "aliases": ["the ranger"],
  "appearance": "Wears a green cloak",
  "personality": "Reluctant, guarded, direct",
  "abilities": "Tracking",
  "role": "Ranger, potential ally"
}

Message 20: The cave rescue scene reveals more about her...

{
  "name": "Elara",
  "aliases": ["the ranger", "Princess Elara"],
  "appearance": "Tall, lean build. Dark hair kept short. Green ranger's cloak, oak longbow named 'Whisper'.",
  "personality": "Distrustful of outsiders but fiercely loyal once trust is earned. Dry humor. Claustrophobic.",
  "abilities": "Expert tracker and archer. Herb lore. Can speak with birds.",
  "background": "From the Northern Reaches. Exiled princess (revealed during cave rescue).",
  "role": "Trusted companion, party scout",
  "goals": "Lift the curse on her homeland",
  "secrets": "Her exile was voluntary -- she chose to leave rather than marry the Shadow King's emissary.",
  "notable_items": "Oak longbow 'Whisper', silver locket with portrait of her mother"
}

Each evaluation call updates only what changed or was newly revealed. The profile accumulates, never loses established facts.

Materialization: Journal → Lorebook

Users can materialize journal profiles into actual lorebook entries:

Per-entry materialization:

Bulk materialization:

Use cases:

Journal profiles work with the roster tracker:

Roster tracker: ["Elara", "Grimjaw"]
  ↓
Tracker-aware search pulls lorebook entries for Elara and Grimjaw
  ↓
Journal profiles for Elara and Grimjaw are ALSO always injected

Result: AI has BOTH:
  - Static lorebook data (creator-authored, via tracker search)
  - Living journal profile (narrative-extracted, always-on)

When both exist for the same character, they complement each other. The lorebook entry has the creator's canonical definition. The journal profile has what actually happened in this conversation. The AI sees both.

When NO lorebook entry exists (AI-invented NPC), the journal profile is the only source. This is the key value -- characters the story creates on the fly get the same structured knowledge treatment as characters the creator defined upfront.

Deduplication: Base Entry Informs Journal Evaluation

When a lorebook entry exists for a character that also has a journal profile, the evaluation call needs to be aware of the canonical lorebook entry. Without this, the journal might drift from or contradict the creator's established lore.

How it works:

The evaluation prompt includes the base lorebook entry (if one exists) alongside the current journal profile, with explicit instructions:

Existing lorebook entry for "Elara" (creator-authored, canonical):
"Elara is a ranger from the Northern Reaches. Distrustful of outsiders
but fiercely loyal once trust is earned. Expert tracker and archer."

Current journal profile for "Elara" (narrative-extracted, evolving):
{ "appearance": "Green cloak, oak longbow", "personality": "Guarded, direct" }

Instructions: Build on the base entry, do not contradict it. The lorebook
entry defines who this character IS. The journal profile tracks what has
been REVEALED and what has CHANGED through the narrative. Add new details
the narrative reveals. Update relationship state. Do NOT change established
traits unless the narrative explicitly shows a change (e.g., character
development, betrayal, transformation).

Matching lorebook entries to journal profiles:

The system matches by name and aliases:

  1. Journal profile has CharacterName: "Elara" and Aliases: ["the ranger", "Princess Elara"]
  2. Search bound lorebooks for entries whose keywords match any of these names
  3. If a match is found, include it as the "base entry" in the evaluation prompt

Conflict resolution:

Entity Salience Scoring

Every profile tracks a salience score that determines how much detail is injected into the prompt. Salience is computed from two signals:

salience = (recency_weight × recency_score) + (frequency_weight × frequency_score)

Both scores are normalized to [0,1]. The combined salience determines the entity's injection tier (see Tiered Injection Strategy).

When salience updates:

Why this matters: The journal is always-on, but context windows are finite. Without salience scoring, 15 tracked characters would all get full profiles injected, consuming thousands of tokens on NPCs the player hasn't interacted with in 50 messages. Salience ensures the token budget goes to entities that matter right now.

Incremental Extraction

The evaluation LLM call should produce diffs, not full rewrites. Each evaluation receives the current profile and outputs only what changed:

// ✓ GOOD - Evaluation output: only changed/new fields
{
  "character_updates": [
    {
      "name": "Elara",
      "changed_fields": {
        "personality": "Distrustful of outsiders but fiercely loyal once trust is earned. Dry humor. Claustrophobic.",
        "secrets": "Her exile was voluntary -- she chose to leave rather than marry the Shadow King's emissary."
      },
      "relationship_state": "Trusted companion after cave rescue",
      "progression_note": "Revealed her royal heritage and the reason for her exile"
    }
  ]
}
// ✗ BAD - Full profile rewrite every message
{
  "character_updates": [
    {
      "name": "Elara",
      "full_profile": {
        "appearance": "Tall, lean build...",
        "personality": "Distrustful...",
        "abilities": "Expert tracker...",
        // ... repeating everything unchanged
      }
    }
  ]
}

Benefits:

Evaluation prompt structure:

Current profile for "Elara":
{ "appearance": "...", "personality": "...", ... }

Base lorebook entry (canonical, do not contradict):
"Elara is a ranger from the Northern Reaches..."

Latest exchange:
[user message + AI response]

Output ONLY fields that changed or were newly revealed.
If nothing changed for this character, omit them entirely.

Inter-Entity Relationships

Character profiles should track relationships to other entities, not just the player. Inter-NPC dynamics are critical for narrative consistency -- "Grimjaw and Elara argue about the plan" only works if the AI knows their dynamic.

relationships_json field on character profiles:

{
  "Grimjaw": "Grudging respect. Elara finds him reckless but trusts his combat instincts.",
  "The Shadow King": "Deep hatred. He destroyed her homeland.",
  "Millhaven Village": "Feels protective. Reminds her of home."
}

Key design decisions:

Relationship to relationship_state: The existing relationship_state field tracks the entity's relationship specifically to the player character. relationships_json tracks relationships to everything else. Both are maintained independently.

Tiered Injection Strategy

The journal uses entity salience to determine how much detail to inject per profile, solving the token budget problem:

Tier Criteria Injected Fields Approx Tokens
Full In current scene (roster tracker) OR salience > 0.8 All profile fields + relationships + current state ~200-400
Summary Salience 0.4-0.8 (referenced recently or frequently) Name, role, appearance, personality, relationship to player ~80-150
Minimal Salience 0.1-0.4 (active but not recent) Name, role ~10-20
Omitted Salience < 0.1 or inactive Not injected (still in DB, recoverable) 0

Tier assignment flow:

1. Compute salience for all active profiles
2. Override: any entity in the roster tracker → Full tier (regardless of salience)
3. Apply tier thresholds to remaining entities
4. Calculate total token estimate
5. If over budget: demote lowest-salience entities one tier until within budget
6. Format and inject

Example prompt output with tiers:

## Story Journal

### Current State
- The party is searching for the Crystal of Dawn
- The Shadow King's forces are gathering in the north

### Characters

**Elara** (the ranger) [Full]
Appearance: Tall, lean build. Dark hair kept short. Green ranger's cloak, oak longbow 'Whisper'.
Personality: Distrustful of outsiders, fiercely loyal once trust earned. Dry humor. Claustrophobic.
Abilities: Expert tracker/archer. Herb lore. Can speak with birds.
Background: Exiled princess of the Northern Reaches (voluntary exile).
Relationship: Trusted companion after cave rescue.
Relationships: { Grimjaw: grudging respect, Shadow King: deep hatred }

**Grimjaw** (dwarf fighter) [Summary]
Appearance: Stocky, heavily scarred. Braided beard. Twin hand-axes.
Personality: Gruff exterior, secretly sentimental.
Relationship: Loyal, stays out of duty.

**The Shadow King** [Minimal]
Role: Ancient lich antagonist, commands undead from Shadowkeep.

### Locations
...

The [Full], [Summary], [Minimal] tier labels are NOT included in the actual prompt -- they're shown here for illustration only.

Settings for tier thresholds:

Key Default Description
Journal.FullTierThreshold 0.8 Minimum salience for full profile injection
Journal.SummaryTierThreshold 0.4 Minimum salience for summary injection
Journal.MinimalTierThreshold 0.1 Minimum salience for minimal injection
Journal.RecencyWeight 0.6 Weight of recency vs frequency in salience
Journal.FrequencyWeight 0.4 Weight of frequency vs recency in salience

Design Debates

Two architectural choices have outsized impact on cost, reliability, and UX. Neither has a free lunch — the tradeoffs are documented here so the eventual implementation is a deliberate pick, not a default.

Debate 1: Per-Message Evaluation vs. Per-Summarization Update

The question: when does the journal actually run its extraction pass?

Option A — Per-message evaluation. A separate eval LLM call fires after every assistant response (the model already proposed for tracker evaluation), and journal updates piggyback on the same call.

Option B — Per-summarization update. Journal extraction runs only when the summarization stage fires (every N unsummarized messages, or scene-aligned per §2a). The summarization prompt itself is extended to emit journal deltas alongside the summary + keywords.

Recommendation: Per-message evaluation, but only when the tracker evaluation call is already running (gated behind Trackers.EvaluationEnabled). The cost argument falls apart the moment tracker eval is in place — journal extraction is then a marginal output, not an extra call. Without trackers, journal updates piggyback on summarization. The hybrid is the right default; the polemic only matters if the platform decides to ship the journal before trackers.

Debate 2: Structured Tool-Use vs. Freeform JSON Output

The question: how does the eval LLM tell us what changed?

Option A — Freeform JSON in the response body. The eval prompt instructs "output JSON with this shape", the model produces a string, the service parses it. This is what every existing JSON-shaped LLM call in the codebase does today:

Option B — Native tool/function-calling. Define update_character_profile(name, changed_fields, relationship_state, ...) as a tool the eval model can call. The provider returns a structured object the platform deserializes directly.

Recommendation: Freeform JSON, with the forgiveness patterns the codebase already proves out. The journal eval payload is shallow (a list of character updates, a list of location updates, a few flat fact strings) — well within the band where careful prompting + a forgiving parser is reliable. Defer tool-use until either (a) the platform standardizes on tool-capable providers across the board, or (b) the existing JSON path produces a measurable malformed-response rate that justifies the cross-cutting refactor. When tool-use is eventually adopted, the natural first target is the whole eval call (trackers + journal + scene transitions), not journal alone — adopting it for one consumer doesn't pay for the abstraction.

Hedge: ship freeform with profile_diff_json always preserving the raw model output alongside the parsed result. If a future migration to tool-use happens, the corpus of "what models actually returned" is the evaluation set for "did the tool-call rewrite regress anything?"


Phase 1 — Entries-Only Slice

The full design above is the long-term target. Phase 1 ships only the "always-on lorebook summary" layer — a small set of user-curated journal entries about the current story state, always injected into the prompt, optionally maintained by an eval LLM call. No character profiles, no location profiles, no salience tiers, no materialization. Those land in later phases once Phase 1 is in users' hands.

Terminology note: the long-term design above uses the word "facts" for the simplest journal layer. Phase 1 renames the runtime concept to "journal entries" to avoid colliding with the existing Discord-only Facts feature (user-level, per-Discord-user, totally unrelated). Tables, columns, settings, API payloads, and UI copy all use "entry" / "entries" / "journal". The conceptual "State Facts" name survives in the long-term-design sections above as the category — but in code and in the UI the noun is "journal entry".

Mental model: the journal is a "game save"

The journal is conceptually closer to a save file than to a document. It captures what is true right now in this playthrough — facts that the AI needs to remember about the state of your specific story. Like a save file in a game, it's bound to the run it belongs to. That framing justifies several of the locked decisions:

Shipped in Phase 1.6 — Regenerate from conversation. The journal modal has a Regenerate button (footer, left of Save/Cancel) that wipes the auto-generated entries and replays the entire conversation in fixed-size windows of message-pairs, calling the journal-eval LLM once per window. A confirm modal surfaces the destructive opt-in for manual entries ("Also wipe my manual entries", off by default — manual entries are sacred). An in-modal progress overlay shows chunk-level progress (X of Y chunks · running added / updated / skipped / failed-chunk counts) with a Cancel button.

The walk is chunked, not summary-based, by design: summaries can drop or distort details, and a regen built on top of them would propagate those errors into the journal. Replaying raw transcripts trades latency for fidelity. Each chunk runs cumulatively — chunk N reads the entries chunk N-1 wrote, so the eval can choose update-existing over add-new across the walk.

Knob Default Range
Chunk size 20 message-pairs 5–60 (clamped)
Wipe manual entries off user opt-in via checkbox

Mutual exclusion: while a regen is in flight, the per-message eval stage (PerMessage cadence) skips silently for that conversation — the regen owns journal mutations for the window. A second concurrent regen on the same conversation is rejected with a clear error. The walk continues past individual chunk-level LLM failures (each failed chunk surfaces as a parseStatus: "failed" progress event); the user sees a tally of failed chunks and can re-run.

Wire: POST /api/conversations/{id}/journal/regenerate body {chunkSize?, wipeManual?}, streams SSE events plan → chunk × N → done (or error). Implementation: WebJournalRegenerateService (web/Services), IJournalRegenLock (Core; Postgres lease table journal_regen_locks with unique per-acquisition ownership tokens + renewal — see Phase 0 hardening).

Locked decisions

Decision Choice
UI surface Modal, opened from a card on the chat surface. Card is mounted in two places that open the same editor: the chat-v1 KnowledgeView (directly above the Lorebooks card) and the chat-v2 WhoDrawer World Knowledge section (above the lorebook list). Sums into the section's count badge in chat-v2.
Conversation scope web_conversations.id only. No Discord parity in v1.
Categories Column present in schema for forward-compat, no UI and no prompt grouping in v1
is_active lifecycle Out. Hard delete only.
Ordering updated_at ASC, id ASC (least- → most-recently-touched). No user-controlled reorder. A revised entry sinks to the bottom so the freshest state reads last — both in the modal and in the prompt injector's newest-N tail-slice. (Originally created_at ASC; changed because once the journal hits its entry cap the eval only rewrites existing rows, which left the oldest row holding the newest content pinned at the top.)
Cap behavior MaxEntries is editable inside the modal, not a hard block. Over-cap → eval is instructed to prefer updating an existing entry over adding a new one. User pays for the tokens; we don't gatekeep.
Injection position Default mode template: immediately after the Summary content provider. Modes can override the ordering.
Token accounting Journal size is returned from the same query that reads facts; rolled into the existing system-prompt budget calculation (not a separate budget).
Greeting / scenario seeding Out of v1.
Eval call cadence In v1, controlled by a per-conversation setting: per-message / on-summarization / off.
Echo cost Deferred. Free in v1. Charging hooks in once platform-model cost work lands.
Sharing / publishing Out. Journal is not included in published conversation snapshots.
Branching Branching a conversation does not copy the journal. The new branch starts with an empty journal. This must be surfaced inline in the branching UI.
Audience tier Owner only. No public/admin views in v1.
Feature toggle Features.EnableJournal (default: true). Lives in the HowDrawer's Active Features section alongside Summaries / Memories / Lorebook / Picture entries. When off: prompt provider returns empty AND the per-message stage + on-summarization trigger both short-circuit before the LLM call. No spend on a turned-off journal. Entries remain saved — flipping back on resumes injection. Per-conversation override, defaults from a user-level preference; the runtime resolves through ?? true so an unmigrated database doesn't silently disable the feature for everyone. The toggle also respects mode support: a custom mode that omits the "journal" sub-prompt renders the row as mode-locked (same shape as the summary / lorebook gates), since the underlying content provider wouldn't run regardless of toggle state.
Preset assignment New "Use for Journal" action on every LLM preset card, alongside "Use for Chat" / "Use for Summary". Resolved via JournalEvalLlm.PresetId → standard JournalEvalLlm.* keys by LlmPresetEnricher. Fallback chain: journal → summarization → chat → default built-in. Same shape as the existing summarization preset; no generation overrides (eval has hardcoded low-temperature settings). fn_clear_preset_references sweeps JournalEvalLlm.PresetId on preset DELETE so deleted presets don't dangle. (Since superseded: the per-card actions are gone — assignment is the Journal eval row of Settings → LLM → Pipeline stages, drag a preset or Assign. Chain unchanged.)

Sub-decisions (recommendations to ratify)

A. Eval model config. Dedicated JournalEvalLlm.{Provider,Model,ApiKey,Endpoint} settings family from day one, mirroring SummarizationLlm.* and the planned TrackerLlm.*. Defaults can point at the same model the platform admin already configured for summarization, but the journal eval gets its own knobs because the workflow will diverge (tool-use migration, multi-pass extraction, etc.). Coupled defaults via documentation, decoupled config in practice.

B. Eval input window.

C. Eval output shape. Schema:

{
  "entries": [
    { "action": "add",    "content": "...", "category": "LOCATION" },
    { "action": "update", "id": 42, "content": "..." },
    { "action": "append", "id": 17, "content": "..." }
  ]
}

D. Response format. Freeform JSON with provider JSON-mode constraint when supported (Phase 1.5 update). The JournalEvalLlmService sets LlmRequest.RequireJsonObject = true on every call; each ILlmClient translates that to its provider's native mechanism: OpenAI/OpenRouter/Custom/StrictOpenAI/Featherless pass response_format: { type: "json_object" }; Gemini sets responseMimeType: "application/json"; Anthropic uses the documented assistant-prefill trick (append { to the assistant turn, prepend { to the response). Providers that don't honour the flag silently ignore it. The same forgiveness patterns as SummarizationLlmService.ParseResponse — code-fence stripping, prose-preamble recovery — remain in place as belt-and-suspenders. Parse failure = log + skip the update + surface a single toast "Journal eval failed — entries unchanged". No retry, no partial application. Full tool-use is still deferred per Design Debate 2; JSON mode is the no-regret precursor.

E. Eval prompt. Mirror the summarization prompt resolution chain exactly: Mode-level JournalEvalPrompt override → settings default (Journal.DefaultEvalPrompt) → hardcoded fallback with WARNING log. No new abstraction.

F. Where the cadence setting lives. Conversation-level, defaulted from a user-level preference. Every other story-feel toggle (streaming, model, persona) is conversation-scoped — the cadence toggle joins them.

G. Token-size on journal_entries. Add char_length INTEGER GENERATED ALWAYS AS (length(content)) STORED so the system-prompt budget calc can read sizes in SQL without a per-row roundtrip. Char-count is used as a token proxy, matching whatever convention the existing budget math uses.

H. Eval-vs-manual-edit concurrency. Two layers of protection:

  1. Source attribution. Schema gains source SMALLINT NOT NULL (0 = manual, 1 = eval) and eval_run_id INTEGER NULL. The eval call only ever modifies entries where source = 1. Manual entries are sacred.
  2. Optimistic concurrency. When the eval applies its updates, it checks each target entry's updated_at against the snapshot it read at eval-start. If an entry was touched since (even by another eval), skip that update. Log the skip.

I. Modal anatomy.

J. Card preview (above Lorebooks). Shows:

K. Branching warning. Inline note directly beneath the branch button on the branch dialog: "Branching does not copy the journal — the new branch will start with an empty journal." No extra confirmation click; the inline copy is the warning.

Phase 1 schema delta

Trimmed from the full design, with the v1 additions called out:

CREATE TABLE IF NOT EXISTS journal_entries (
    id SERIAL PRIMARY KEY,
    conversation_id INTEGER NOT NULL REFERENCES web_conversations(id) ON DELETE CASCADE,
    content TEXT NOT NULL,
    category VARCHAR(50),                  -- present, unused in v1
    source SMALLINT NOT NULL DEFAULT 0,    -- 0 = manual, 1 = eval
    eval_run_id BIGINT NULL,               -- free-form run handle; no FK in v1
    source_message_id INTEGER REFERENCES web_messages(id) ON DELETE SET NULL,
    char_length INTEGER GENERATED ALWAYS AS (length(content)) STORED,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS ix_journal_entries_conversation ON journal_entries(conversation_id, created_at);

No is_active column. No journal_character_* or journal_location_* tables until Phase 2. eval_run_id is a free-form BIGINT in v1; promote to a proper journal_eval_runs table in Phase 2 when the eval lifecycle needs auditing.

No new columns on web_conversations or users. Per-conversation and per-user settings ride on the existing key/value tables (08_tables_settings.sql):

Phase 1 settings

Key Default Description
Journal.DefaultMaxEntries 10 Default cap for new conversations (system-wide default)
Journal.DefaultEvalCadence on_summarization Default cadence applied to new conversations
Journal.DefaultEvalPrompt (hardcoded fallback) System-wide default eval prompt; mode can override
Journal.EvalCadence (inherits Journal.DefaultEvalCadence) Per-conversation cadence override (off / per_message / on_summarization). Set from the Journal modal.
Journal.MaxEntries (inherits Journal.DefaultMaxEntries) Per-conversation cap override. Set from the Journal modal.
Features.EnableJournal true Per-conversation toggle (user-default). When off: no injection AND no eval LLM call. Surface: HowDrawer Active Features.
JournalEvalLlm.PresetId '' (empty) LLM preset assigned to the journal eval. Empty = fall through JournalEvalLlm.* → SummarizationLlm.* → Llm.* → default built-in. Set via the Journal eval row of Settings → LLM → Pipeline stages (the per-card "Use for Journal" action is gone).
JournalEvalLlm.Provider / .Model / .ApiKey / .Endpoint (inherit from SummarizationLlm.* when blank) Resolved by LlmPresetEnricher when JournalEvalLlm.PresetId is set; otherwise inherits from the summarization keys.

Pipeline integration

Concrete plumbing points so the implementation lines up cleanly with existing patterns:

Parallelism by convention. The JournalEvalStageBase must follow the existing fire-and-forget shape of SummarizationStageBase — the heavy LLM call belongs inside a detached Task.Run(...), not awaited inside ProcessAsync. This is the convention that keeps post-LLM stages from blocking each other: each stage's ProcessAsync returns in milliseconds, and the actual LLM work runs concurrently in the background. Once tracker eval is added as a third sibling stage, all three eval calls (summarization, journal, tracker) will race to completion in parallel by default — no scheduler, no orchestration, no shared state. The pattern is parallelism-friendly only as long as no implementer breaks it by awaiting the LLM call inline.

The cost of getting this right: nothing. The cost of getting it wrong: each eval stage adds its wall-clock time to every assistant turn. Worth a code-review checklist item.

Statistics

The journal eval is an LLM call and must be instrumented like every other LLM call on the platform. Mirror the exact pattern used by messaging (27_tables_message_stats.sql) and summarization (27a_tables_summary_stats.sql + IWebSummaryStatsRepository) — no new abstraction, just the same shape applied to a new call site.

Three layers, all required for parity:

  1. In-memory counters and timings via IStatisticsService. JournalEvalService records the same metrics SummarizationLlmService does — journal_eval.api.latency, journal_eval.completed, journal_eval.errors (tagged with type = timeout | network | provider | parse). Same pattern as SummarizationLlmService.CallLlmAsync — _statistics.RecordTiming(...) and _statistics.Increment(...) calls bracket the LLM invocation.

  2. Per-call DB row in journal_eval_stats. One row per eval LLM call. Survives fact edits and conversation deletes (stats are independent of the data they describe). Mirror of web_summary_stats:

    CREATE TABLE IF NOT EXISTS journal_eval_stats (
        id BIGSERIAL PRIMARY KEY,
        conversation_id INTEGER NOT NULL,
        user_id INTEGER,
    
        -- LLM details
        provider VARCHAR(50) NOT NULL,
        model VARCHAR(100) NOT NULL,
        cadence VARCHAR(20) NOT NULL,            -- 'per_message' | 'on_summarization'
    
        -- Token usage
        prompt_tokens BIGINT,
        completion_tokens BIGINT,
        total_tokens BIGINT,
        cache_creation_tokens BIGINT,
        cache_read_tokens BIGINT,
    
        -- Performance
        api_latency_ms INTEGER,
    
        -- Journal-specific outcome (denormalized; cheap to write, useful in analytics)
        entries_added INTEGER NOT NULL DEFAULT 0,
        entries_updated INTEGER NOT NULL DEFAULT 0,
        entries_skipped INTEGER NOT NULL DEFAULT 0, -- skipped due to manual-edit concurrency (decision H)
        parse_status VARCHAR(20) NOT NULL DEFAULT 'ok', -- 'ok' | 'fallback' | 'failed'
    
        -- Error tracking
        error_type VARCHAR(50),
        error_message TEXT,
    
        -- Timestamps
        created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
    );
    
    CREATE INDEX IF NOT EXISTS idx_journal_eval_stats_created_at
        ON journal_eval_stats (created_at);
    CREATE INDEX IF NOT EXISTS idx_journal_eval_stats_conversation_id
        ON journal_eval_stats (conversation_id);
    CREATE INDEX IF NOT EXISTS idx_journal_eval_stats_provider_model
        ON journal_eval_stats (provider, model, created_at);
    CREATE INDEX IF NOT EXISTS idx_journal_eval_stats_user_created
        ON journal_eval_stats (user_id, created_at)
        WHERE user_id IS NOT NULL;
    

    New repository: IJournalEvalStatsRepository / JournalEvalStatsRepository, mirroring WebSummaryStatsRepository. JournalEvalService.CallLlmAsync inserts the row in a try/finally so failed calls still produce a stats row with error_type and error_message populated.

    The cadence, entries_added/updated/skipped, and parse_status columns are the journal-specific additions over the summary-stats shape. They make "is the eval actually doing useful work or just burning tokens?" answerable in SQL without joining journal_entries history.

  3. Aggregation function + registered metric. New SQL function fn_stats_journal_evals(scope, scope_id, granularity, from_ts, to_ts, dimension) in database/v1/functions/70_stats_functions.sql, following the existing fn_stats_messages / fn_stats_summaries signature exactly. Allowed dimensions: provider, model, cadence, parse_status.

    New entry in DefaultStatsMetrics.Build:

    new StatsMetric(
        Key: "journal_evals",
        SqlFunction: "fn_stats_journal_evals",
        AllowedScopes: new HashSet<StatsScope> { StatsScope.Global, StatsScope.User, StatsScope.Creator },
        AllowedDimensions: new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "provider", "model", "cadence", "parse_status" },
        Anonymization: new StatsAnonymizationPolicy(),
        Description: "Per-call statistics for journal eval LLM invocations."),
    

    This makes journal eval volume / latency / token spend / parse-failure rate visible in the same analytics surfaces that already render messaging and summarization metrics — admin dashboards, creator analytics (Pro tier), per-user "my stats". No new analytics UI; the metric just appears wherever stats metrics are listed.

What this gives us:

Why a dedicated JournalEvalService (not AI Tasks)

The eval call is a structured stateful workflow we expect to grow in specific directions — tool-use migration (Debate 2), multi-pass extraction (Phase 2 character profiles), conflict resolution against base lorebook entries, salience-aware prompt truncation. AI Tasks is built for one-shot stateless evaluation (moderation passes, content checks, keyword matches) where the runner is fundamentally interchangeable. Journal eval is the opposite — the workflow itself is the product, not the prompt.

Concretely:

Journal.Enabled, Journal.AutoUpdate, Journal.UpdateOnSummarization, Journal.MaxCharacterProgressions, Journal.MaxLocationProgressions, and the entire salience/tier setting block from the long-term design are not in v1. They land with the entity profile work in Phase 2+.

Phase 1.1 — what landed

After Phase 1 shipped, a full feature review surfaced concerns that were addressed in a follow-up slice:

Phase 0 hardening — what landed (2026-08-08)

A deep technical review (docs-internal/archive/completed-audits/chat-engine/JOURNAL_FEATURE_REVIEW_2026-08-08.md) found six P0 defects that made saved story state silently lossy or destructible. All six — plus three adjacent fixes — landed as one hardening slice:

P1 trust tranche — what landed (2026-08-09)

The review's "one truthful journal form" slice (JRN-05/06/07/08/10/14-form/24):

Still open from the review: JRN-09 (run/chunk ledger), JRN-11's frontend-component coverage, JRN-12/13 (Story State IA + editor reframe), JRN-14 visual snapshots, JRN-15/16/17, JRN-18 (living-lorebook substrate); see the review doc's status header. (Update 2026-09-29: JRN-09 and JRN-15 have since landed (63fe18e4, 2026-08-10) and JRN-12/13 shipped as Slice A (42fc37c4, 2026-08-12) — see the status line at the top.)

Still on the WIP side of Phase 1.1

These bits are forward-designed in the schema but unwired in code — touching them needs more design than a follow-up review slice:

Out of Phase 1

For absolute clarity, these are the long-term-design features that are explicitly not part of the first slice:

Phase 2 picks up the next slice once Phase 1 has shipped, been used, and produced enough real eval-call output to design the profile schema against actual data.


Database Changes

-- Journal state facts
CREATE TABLE journal_facts (
    id SERIAL PRIMARY KEY,
    conversation_id INTEGER REFERENCES web_conversations(id),
    content TEXT NOT NULL,
    category VARCHAR(50),
    is_active BOOLEAN DEFAULT TRUE,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW(),
    source_message_id INTEGER REFERENCES web_messages(id)
);

-- Journal character profiles (living character cards)
CREATE TABLE journal_character_profiles (
    id SERIAL PRIMARY KEY,
    conversation_id INTEGER REFERENCES web_conversations(id),
    character_name VARCHAR(200) NOT NULL,
    aliases_json TEXT,              -- JSON array: ["the ranger", "Princess Elara"]
    profile_json TEXT NOT NULL,     -- JSON object: { appearance, personality, abilities, ... }
    relationship_state TEXT,        -- Current relationship to player
    relationships_json TEXT,        -- JSON object: { "Grimjaw": "grudging respect", "Millhaven": "feels protective" }
    mention_count INTEGER DEFAULT 0,         -- Total times referenced in conversation (frequency signal)
    last_referenced_at TIMESTAMPTZ,          -- When entity was last referenced (recency signal)
    is_active BOOLEAN DEFAULT TRUE,
    materialized_lorebook_entry_id INTEGER REFERENCES lorebook_entries(id),  -- if exported
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE journal_character_entries (
    id SERIAL PRIMARY KEY,
    profile_id INTEGER REFERENCES journal_character_profiles(id),
    content TEXT NOT NULL,          -- What changed ("Revealed her royal heritage")
    profile_diff_json TEXT,         -- JSON of fields that changed
    source_message_id INTEGER REFERENCES web_messages(id),
    created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Journal location profiles (living location cards)
CREATE TABLE journal_location_profiles (
    id SERIAL PRIMARY KEY,
    conversation_id INTEGER REFERENCES web_conversations(id),
    location_name VARCHAR(200) NOT NULL,
    aliases_json TEXT,              -- JSON array: ["the dungeon", "the fortress"]
    profile_json TEXT NOT NULL,     -- JSON object: { description, layout, hazards, ... }
    current_state TEXT,             -- What the party has done here
    mention_count INTEGER DEFAULT 0,         -- Total times referenced in conversation (frequency signal)
    last_referenced_at TIMESTAMPTZ,          -- When entity was last referenced (recency signal)
    is_active BOOLEAN DEFAULT TRUE,
    materialized_lorebook_entry_id INTEGER REFERENCES lorebook_entries(id),  -- if exported
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE journal_location_entries (
    id SERIAL PRIMARY KEY,
    profile_id INTEGER REFERENCES journal_location_profiles(id),
    content TEXT NOT NULL,
    profile_diff_json TEXT,         -- JSON of fields that changed
    source_message_id INTEGER REFERENCES web_messages(id),
    created_at TIMESTAMPTZ DEFAULT NOW()
);

UI Considerations

Chat Side

Conversation Start

History View

Materialization UI


Settings

New settings under Journal.*:

Key Default Description
Journal.Enabled true Enable/disable journal system
Journal.MaxActiveFacts 10 Maximum active state facts
Journal.MaxCharacterProgressions 10 Maximum tracked characters
Journal.MaxLocationProgressions 10 Maximum tracked locations
Journal.AutoUpdate true AI auto-updates journal after responses
Journal.UpdateOnSummarization true Update journal during summarization
Journal.IncludeHistory false Include progression history in prompt (expensive)
Journal.FullTierThreshold 0.8 Minimum salience for full profile injection
Journal.SummaryTierThreshold 0.4 Minimum salience for summary injection
Journal.MinimalTierThreshold 0.1 Minimum salience for minimal injection
Journal.RecencyWeight 0.6 Weight of recency in salience scoring
Journal.FrequencyWeight 0.4 Weight of frequency in salience scoring

Open Questions

  1. Evaluation frequency: Moved to Design Debate 1. Current recommendation: per-message when tracker eval is on, per-summarization otherwise.

  2. Extraction format: Moved to Design Debate 2. Current recommendation: freeform JSON with forgiving parsing, mirroring the existing SummarizationLlmService.ParseResponse pattern.

  3. Greeting integration: Should character greetings ship with starter journal entries? This would let scenario-based conversations begin with pre-populated state. Overlaps with the Package feature.

  4. Cross-conversation journal: Should journal state persist when starting a new conversation with the same character? Could be a "continue story" vs. "fresh start" option. Materialization into a lorebook is one path (explicit, user-controlled). Auto-carry is another (implicit, could be surprising).

  5. Profile identity / alias resolution: The evaluation call needs to recognize that "the ranger", "Elara", and "Princess Elara" are the same character. The aliases field helps, but the evaluation call must also detect new aliases and merge references. How aggressive should merging be? False merges (treating two different characters as one) are worse than false splits (creating duplicate profiles).

  6. Token budget enforcement: Resolved -- see Tiered Injection Strategy. Entity salience scoring (recency × frequency) determines injection tier (Full / Summary / Minimal / Omitted). Roster tracker overrides to Full tier. Soft token cap with automatic demotion when over budget.

  7. Profile schema evolution: As the evaluation call discovers new types of information, should the profile schema be fixed (predefined fields like appearance, personality, etc.) or open (any key-value the AI decides to extract)? Fixed is more structured and predictable. Open is more flexible but harder to display in UI.

  8. Materialization freshness: When a journal profile is materialized into a lorebook entry, should the lorebook entry auto-update when the journal profile evolves? Or is it a snapshot? Auto-sync blurs the line between journal and lorebook. Snapshot is simpler but drifts.

  9. Character card extraction: Could a compelling NPC profile be materialized not just as a lorebook entry but as a full character entity (with system prompt, greeting, etc.)? "I met this NPC in my story, now I want to chat with them independently." This is a powerful creator tool but significantly more complex than lorebook entry materialization.

  10. Scene transition sensitivity: The scene-aware summarization system needs to distinguish between meaningful scene transitions and minor location shifts. A character walking from the tavern bar to the tavern backroom is not a scene change. A character leaving the tavern to travel to the forest is. The evaluation prompt needs to be tuned for narrative granularity, not spatial granularity -- and this may need to be creator-configurable (some stories have rapid scene cuts, others have long continuous scenes). False positives (too many scene breaks) produce fragmented memories; false negatives (missed breaks) produce bloated multi-scene memories. False negatives are probably less harmful since the fallback message-count summarization catches them eventually.