> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autosage.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt assembly

> How AutoSage layers answering behavior, operator prompts, tools, memory, and conversation context.

AutoSage assembles each request from stable instructions and message-time context. Understanding these layers helps you shape behavior without duplicating retrieval content or accidentally replacing useful defaults.

## The layers

```
System prompt
  1. Built-in answering behavior
  2. Operator Persona and Instructions
  3. Tool guidance
  4. Attached skills
  5. Preview of available documents and data

Message-time context
  6. Recalled durable memory, when enabled
  7. Summary of older conversation, when needed
  8. Recent conversation history
  9. New user message

During the run
  10. Retrieved passages and other tool results
```

### Persona and Instructions

**Persona** controls identity, voice, tone, and formatting. **Instructions** define task-specific rules and operating behavior. AutoSage adds both as authoritative operator layers, so they take precedence over conflicting built-in guidance.

### Tools, skills, and data preview

The system prompt describes available retrieval and tool behavior, then adds any attached skills. A short preview of document summaries and connected data helps the model choose the right tool without loading the entire corpus into context.

### Memory and conversation history

At message time, relevant durable memories and a compact summary of older turns can be added before the recent history and new message. These are independent systems: compaction preserves continuity within one chat, while durable memory can carry selected facts across chats.

Retrieved document passages are not preloaded as memory. They arrive as tool results during the run and become the sources cited in the final answer.

## Full Custom Prompt precedence

A full Custom Prompt is a complete replacement for the built-in answering behavior in its mode. When it is set, it also supersedes Persona and Instructions for that mode.

| Field                   | Applies to              | Behavior                                      |
| ----------------------- | ----------------------- | --------------------------------------------- |
| Persona                 | Quick and Deep defaults | Authoritative identity and presentation layer |
| Instructions            | Quick and Deep defaults | Authoritative operating rules                 |
| Custom Prompt           | Quick                   | Replaces the Quick answering prompt           |
| Main/Deep Custom Prompt | Deep                    | Replaces the Deep answering prompt            |

<Warning>
  A full Custom Prompt takes ownership of the complete answering contract. Include the identity, tone, safety boundaries, citation behavior, and task rules you need; Persona and Instructions are not added on top of it for that mode.
</Warning>

Per-request prompt fields take precedence when supplied. When a request omits one, the runtime falls back to the corresponding prompt stored on the knowledge base.

<Tip>
  Prefer Persona plus Instructions for most integrations. They preserve AutoSage's grounded-answer and tool guidance while giving you authoritative control. Use a full Custom Prompt when you need complete white-label behavior.
</Tip>

See [Knowledge-base prompts](/knowledge-bases/prompts) for configuration examples and [Memory system](/developers/lifecycles/memory-system) for memory scope and lifecycle.

## Next steps

<CardGroup cols={2}>
  <Card title="Knowledge-base prompts" icon="pen" href="/knowledge-bases/prompts">
    Configure Persona, Instructions, and mode-specific Custom Prompts.
  </Card>

  <Card title="Agent runtime" icon="robot" href="/developers/concepts/runtime">
    See how prompt layers guide planning, tools, and final answers.
  </Card>
</CardGroup>
