Run the Template
- Go to Assets/InworldRuntime/Scenes/Primitivesand play theKnowledgeTemplatescene. 
- After pressing Play, click Connect.
- Click Add Knowledgeto add more records.
Add.
In this demo, all added records go to the knowledge/test collection.
- Click Query Knowledgeto search the knowledge records.
Query.
Matching records will be displayed on the screen.
- Clicking the trash icon next to a knowledge record deletes all records in that knowledge collection for this game session.
Click the GIF to expand.

Understanding the Template
Structure
- 
This demo has two prefabs under InworldController:TextEmbedder(containsTextEmbedderModule) andKnowledge(containsKnowledgeModule).
- 
These modules create TextEmbedderFactoryandKnowledgeFactory, and each factory creates aTextEmbedderInterfaceorKnowledgeInterfacebased on the currentTextEmbedder/KnowledgeConfig.

KnowledgeData
KnowledgeData is the asset this demo interacts with. After the text embedder initializes, whenever you submit a query, the AI module batches this KnowledgeData and tries to retrieve the most relevant pieces of knowledge. By default, it’s stored underAssets/InworldRuntime/Data/General.

knowledge/.
See the example data in our Unity project.

Workflow
- Initialization is sequenced because Knowledgedepends onInworldController.
- When InworldControllerinitializes, it callsInitializeAsync()onTextEmbedderModule.
InworldController invokes OnProcessInitialized, which triggers KnowledgeModule initialization (see Primitives Overview).
- Once KnowledgePanelis initialized,InworldControllerinvokesOnFrameworkInitialized.
KnowledgeConfigPanel on KnowledgeCanvas > ConfigPanel is registered to this event.
- Then KnowledgeConfigPanelcompiles knowledge using the existing TextEmbedder module.
KnowledgeConfigPanel.cs
Add Knowledge
- When you press Add Knowledgeand submit the input text, the data is added to the currentKnowledgeData.
- In this demo, this invokes KnowledgeInteractionPanel._AddKnowledge().
- It tries to add a new knowledge group knowledge/test, then adds your entry to it.
- It then automatically calls CompileKnowledges()to activate the new piece of knowledge.
KnowledgeInteractionPanel.cs
KnowledgeData.cs
Query Knowledge
- 
As long as InworldControlleris connected and each module is initialized, you can clickQuery Knowledge.
- Enter any question; if it matches the knowledge database above, related entries are listed.
- More relevant entries appear higher in the list.
- 
When you press Enter or click Query, it first triggersKnowledgeInteractionPanel._QueryKnowledge().
- 
This calls InworldController.Knowledge.GetKnowledges(), which in turn callsKnowledgeInterface.GetKnowledge().
InworldController.cs