Skip to content

Architecture & Shortcuts

Justus Brugman edited this page Aug 22, 2026 · 7 revisions
# Architecture & Shortcuts

## Terminal Shortcuts & Commands

### Key Bindings
* `Ctrl-G`: Sends `(continue the story)`.
* `Ctrl-W`: Sends a transient reset instruction enforcing active story rules.
* `Ctrl-U`: Removes the last turn from history, sends a reset instruction, and restores the previous user prompt in the terminal buffer for editing.
* `Ctrl-L`: Read-only view of the last persisted prompt and response.

### Application Commands
* `/exit` or `/quit`: Exit the program.
* `/image <instruction>`: Reads an image from the OS clipboard and sends it with the instruction to a vision backend (not saved to `history.json`).
* `/export`: Exports the story to Markdown with user prompts in italics.
* `/export -intro`: Exports story with user prompts in italics between sections.
* `/export -clean`: Exports assistant story text only.
* `/export -all`: Chronological export with explicit headers.

---

## Code Architecture & Memory Layers

Storyteller operates as a modular monolith separating CLI adapters from reusable core services:

```text
nl.llm.storyteller
├── cli/                 # Terminal UI, JLine adapter, shortcuts, rendering
│   ├── AssistantApp.java
│   ├── TerminalStoryteller.java
│   └── TerminalRenderer.java
└── core/                # Application logic, persistence, prompting, HTTP clients
    ├── AppConfig.java
    ├── service/         # StorySession, PromptAssembly, DerivedMemoryManager
    └── model/           # Prompt inputs & validation outcomes

Prompt Assembly & Memory Structure

Rather than sending full conversation histories, Storyteller builds prompts using:

Single System Message: Combines the main prompt, fixed protagonists, canonical state (canonical-state.yaml), long-term summary (summary.md), and recent summary (recent-summary.md).

Recent Turns: Includes the last chat.maxRecentTurns raw messages.

Latest User Input: Appends the latest prompt.

Clone this wiki locally