> ## Documentation Index
> Fetch the complete documentation index at: https://ai-novel-writing-assistant.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Base and RAG

> Save materials that affect creation over the long term, letting AI automatically recall references during planning, sequel writing, and body text generation.

The Knowledge Base is used to save materials that affect creation over the long term, such as setting documents, reference works, breakdown conclusions, character materials, world rules, and style samples. Its purpose is to let materials continue being used in subsequent planning, sequel writing, and body text generation, rather than relying on you to copy and paste them every time.

RAG (Retrieval-Augmented Generation) is the Knowledge Base's core mechanism: during chapter execution, the system constructs queries based on the current chapter task, recalls the most relevant material fragments from the Knowledge Base, and assembles them into a context package together with book facts and planning assets, for AI to reference during body text generation.

## What the Knowledge Base Can Do for You

* Upload and manage creative materials.
* Save breakdown publication results, letting breakdown experience enter subsequent writing.
* View material indexing progress, confirming whether documents can be retrieved for use.
* Test whether a specific material can be recalled.
* Archive infrequently used materials, and restore them when needed.
* Provide long-term references for novel, world, style, and chapter generation.

## When to Use It

* You have settings, materials, reference texts, or breakdown conclusions that you want subsequent writing to continue using.
* When writing long-form works, you often worry that AI will forget earlier world rules or material backgrounds.
* You want to unify and organize multiple reference sources, rather than having them scattered across local files and chat logs.
* You want to check whether a specific material can really be used by subsequent generation.
* You want breakdown results, style samples, and world materials to become reusable assets.

## Preparation Before Starting

The Knowledge Base is an enhancement capability, not a prerequisite for starting to write a novel. You can create a novel and generate chapters first without configuring the Knowledge Base; enable it when you begin needing long-term materials, reference works, or complex settings.

To fully use material retrieval capabilities, you usually need to configure an available Embedding model and vector database connection. Regular users can first complete the basic configuration according to the settings page prompts, then return to the Knowledge Base to upload materials.

Before uploading, it is recommended to organize text first:

* One document should contain only one type of material as much as possible.
* Write clear titles indicating material purpose.
* Reference works, world settings, and style samples are best saved separately.
* Materials no longer in use can be archived to avoid interfering with subsequent retrieval.

## Recommended Usage Path

**1. Open Knowledge Base**

Enter the "Knowledge Base" page.

**2. Upload Materials**

Upload settings, reference texts, or organized materials.

**3. Confirm Indexing Complete**

View indexing status and wait for material processing to complete.

**4. Retrieval Test**

Use the retrieval test to confirm materials can be found.

**5. Bind for Use**

Select or bind this material in the novel, world, breakdown, or style workflow.

**6. Archive and Restore**

Archive when no longer in use; restore and rebuild index when needed again.

If you publish results from the breakdown module, the Knowledge Base saves them as breakdown publication materials, making it easy to return to the source breakdown for continued viewing.

## Material Ingestion and Usage Flow

```mermaid theme={null}
flowchart LR
  U[Upload materials] --> V[Indexing progress<br/>vector/text processing]
  V --> W[Retrieval test<br/>confirm hit]
  W --> X[Bind to novel/world/style]
  X --> Y[During chapter execution<br/>construct query and recall]
  Y --> Z[Enter context package<br/>participate in body text generation]
```

## How Materials Enter Chapter Context

Reset

Chapter Context Package

This is the most critical step in Biz Novel Studio chapter generation. The system does not simply search the Knowledge Base using chapter titles. Instead, it assembles queries based on the complete chapter task, then recalls materials most relevant to the current goal.

### Query Construction Content

Chapter RAG queries contain the following information, all from the chapter brief and context package:

* Novel title
* Chapter title
* Chapter goal
* Chapter expectations
* Content that must be advanced this chapter
* Target conflict
* Appearing characters
* Structured outline

The closer the query is to this chapter's goal, the easier it is to hit truly useful materials.

### Material Source Layers

RAG is not a single material pool. Different materials have different credibility and purposes:

| Layer | Examples | Usage Principles |
| - | - | - |
| Book Facts | Written chapters, fact ledger, character states, world states | Highest priority; cannot be overwritten by external materials |
| Book Planning | Book contract, macro story, volume strategy, chapter tasks | Guide the next writing goal |
| User Materials | Uploaded Knowledge Base, world samples, dedicated setting documents | Used to supplement facts and settings |
| Breakdown Conclusions | Reference work structure, appeal, character, and style analysis | Migrate methods, do not copy plots |
| Style Assets | Style rules, Anti-AI Rules, sample text features | Control expression methods |
| Temporary Dialogue | Creative Hub current round input | Can only affect the current task; to take effect long-term, commit to the library |

> [!NOTE]
>
> Book facts take priority: if external Knowledge Base materials conflict with facts already established in the book, chapter execution should prioritize following book facts. Reference materials are for supplementation, not for overturning content already written into novel state.

### Retrieval Methods

The system uses vector retrieval, text retrieval, or hybrid recall to hit materials:

| Retrieval Method | Suitable Content | Common Issues |
| - | - | - |
| Vector Retrieval | Semantically similar but differently worded materials, long documents, breakdown conclusions | Cannot hit when documents are not indexed or vector database is unavailable |
| Text Retrieval | Person names, place names, proper nouns, fixed terms | May miss when users do not write clear keywords |
| Hybrid Recall | Needs both semantics and keywords simultaneously | Needs reasonable document titles, chunking, and metadata |

### Why Chunking and Metadata Matter

The Knowledge Base does not guarantee retrieval just because a file is uploaded. Chunking, titles, summaries, and metadata affect hits:

| Information | Impact |
| - | - |
| Document Title | Helps identify material theme and source |
| Chunk Text | Determines vector semantics and text retrieval hits |
| Facets | Makes filtering by genre, appeal, character name, chapter anchor, etc. more precise |
| Source Type | Distinguishes uploaded documents, breakdown publications, world samples, etc. |
| Document Version | Avoids mixing materials with the same name |

The longer the material, the more it needs clear titles and stable chunking. A million-word original text without reliable indexing will only show limited fragments during chapter execution.

## Where RAG Is Used

| Stage | Uses RAG? | Explanation |
| - | - | - |
| Direction Candidates | May use breakdown/material summaries | For understanding genre, reader expectations, and reference directions |
| Book Contract | Mainly uses candidates and macro story | Key goals come from user selection; should not be overwritten by external materials |
| World Building | May reference world samples and Knowledge Base | Helps generate rules, factions, and locations |
| Character Generation | May reference world, genre, and character assets | Characters must obey the book's direction |
| Volume Strategy | Uses book contract, macro story, character roster | RAG serves only as auxiliary, not replacing main plot planning |
| Beat Board / Chapter List | Uses volume strategy and chapter task materials | Focus is structural consistency |
| Chapter Execution | Explicitly uses task-driven RAG | GenerationContextAssembler constructs queries and recalls materials based on chapter goals |
| Review / Repair | Uses chapter runtime package | The repairer reads writing context, review issues, and RAG fragments |

## How to Enter Subsequent Creative Chains

Knowledge Base materials play a role in multiple places:

* **During book creation and planning**, providing genre, setting, and reference work information.
* **During world and character generation**, providing background rules and character materials.
* **During chapter writing**, providing material references relevant to the current task.
* **After breakdown publication**, letting work analysis conclusions continue to be recalled by subsequent creation.
* **In the Style Engine**, style assets can be extracted from Knowledge Base original text.

The Knowledge Base is not a body text editor. It is more like a long-term material warehouse: put important materials in, and let the creative chain use them when needed.

## Asset Loop

After chapter execution completes, the system feeds back new facts, character changes, foreshadowing states, and quality issues. When subsequent chapters assemble context, they read these states.

```mermaid theme={null}
flowchart LR
  P1[Auto Director preparation] --> P2[Chapter execution]
  P2 --> P3[Body text generation]
  P3 --> P4[State feedback<br/>facts/characters/foreshadowing]
  P4 --> P5[Next chapter reads new state]
  P5 --> P2
```

The loop path is:

**1. Auto Director Preparation**

Prepare book-level, world, character, and chapter tasks.

**2. Chapter Execution**

Read these assets and RAG materials.

**3. Body Text Generation**

Extract facts, character resources, and foreshadowing changes.

**4. State Feedback**

State submission and ledger synchronization write back to the project.

**5. Continue Generation**

The next chapter reads the new state and continues generating.

This is the core difference between long-form production chains and one-shot text generation.

## Frequently Asked Questions

> [accordion] Can I start writing a novel without configuring the Knowledge Base?
>
> Yes. The Knowledge Base is an enhancement capability, not a prerequisite for book creation. First get the creative workflow running, then gradually add materials; this is usually more suitable for beginners.

> [accordion] Why can't I use materials after uploading?
>
> Uploading only saves materials. Materials also need to complete indexing before they can be stably used in retrieval tests and creative chains. First check indexing status and recent tasks.

> [accordion] What materials are suitable for the Knowledge Base?
>
> Suitable for content that will be reused long-term, such as world rules, faction materials, reference work analysis, breakdown conclusions, character backgrounds, style samples. Temporary ideas can be placed in the novel project first.

> [accordion] Will too many documents interfere with generation?
>
> It is possible. It is recommended to use clear titles, archive materials no longer in use, and select truly relevant materials within specific novels or tasks.

> [accordion] Does archiving delete materials?
>
> Archiving is not deletion. Archived materials exit the default usage scope and can be restored when needed. After restoration, indexing usually needs to be reprocessed before stable recall is possible again.

> [accordion] Do I need to understand Qdrant and RAG?
>
> No. You only need to know: after configuration is complete, the Knowledge Base can better find materials according to the current task. Technical details are handled by the system and settings page.

> [accordion] How do I check if the Knowledge Base is not working?
>
> Check in order: 1) Does the document exist 2) Is indexing complete 3) Can single-document retrieval test hit 4) Does the current chapter task really need this material 5) Is there an RAG fragment in the context package 6) Did the review report suppress materials due to conflict.

> [accordion] What if too much is recalled?
>
> If the chapter deviates toward a reference work, strengthen the chapter task and book facts, and reduce reference recall. If the model paraphrases material summaries, narrow the query and retain fragments related to this chapter's conflict. If proper nouns leak into body text, review and Anti-AI Rules should intercept proper noun leakage.

> [card] [Book Breakdown Workbench](https://ai-novel-writing-assistant.mintlify.site/en/features/book-analysis.md)
>
> Publish work analysis to the Knowledge Base, turning conclusions into reusable assets.

> [card] [Style Engine](https://ai-novel-writing-assistant.mintlify.site/en/features/style-engine.md)
>
> Extract style assets from Knowledge Base original text to control expression methods.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.