A Quick and Shortcut Guide to Getting Lorebooks done in JanitorAI

 

A Dirty Shortcut to Lorebooks

So I’ve been putting off using Lorebooks for so long just because I find them complex.
So here’s a quick and dirty shortcut to getting Lorebooks done.

[Visual Guide at the Very Bottom]


Step 1: Write your Entries in a Separate Notes App

This could be anything—descriptions of a location, factions, extra characters in your world,
mechanics. You can even ask ChatGPT to write this for you.

Step 2: “Train” ChatGPT to Use the Template

To get a template, use the sample from JanitorAI itself.
Go to Scripts → Beta → Create New Script → Advanced → Advanced Lorebook.
Name it something like test, then copy everything in the editor.
You’ll know you’ve copied the right thing because you’ll see keywords like Eldoria.

Step 3: Save the Template

Copy this script to ChatGPT and tell it:
“Save the following script as template for JanitorAI Lorebook.”
Wait for it to finish—this can take a while.

Step 4: Generate Your Lorebook

Copy the lore you wrote in Step 1 and tell ChatGPT:
“Write a Lorebook based on the saved template using the following entries in JSON.”
You should get code output similar to the Eldoria template.

Step 5: Paste and Assign

Copy the outputted code into the Lorebook editor you created.
Select all, replace everything, save, and assign it to a character.


Eldoria Template (Reference)

Reddit might mess up the format—copy your own version directly from JanitorAI if possible.



/**
 * Advanced Lorebook System
 * Comprehensive world-building with priorities, filters, and recursive activation
 * Compatible with Nine API v1
 */

// Access chat context through the provided context object
const lastMessage = context.chat.last_message.toLowerCase();
const messageCount = context.chat.message_count;

// === LOREBOOK DATABASE ===
const loreEntries = [
    // === HIGH PRIORITY ENTRIES (Always activate first) ===
    {
        keywords: ['eldoria', 'kingdom', 'realm'],
        priority: 10,
        minMessages: 0,
        category: 'world',
        personality: ', knowledgeable about the Kingdom of Eldoria',
        scenario: ' The Kingdom of Eldoria is a vast realm known for its magical academies and ancient forests.',
        triggers: ['magic', 'forest', 'academy'] // Can trigger other entries
    },
    
    // === MAGICAL SYSTEM ENTRIES ===
    {
        keywords: ['magic', 'spell', 'mana', 'arcane'],
        priority: 8,
        minMessages: 0,
        category: 'magic',
        filters: {
            notWith: ['mundane', 'ordinary'] // Won't activate if these words present
        },
        personality: ', deeply versed in the arcane arts and magical theory',
        scenario: ' Magic flows through ley lines beneath Eldoria, and {{char}} can sense the weave of magical energy.',
        triggers: ['leylines', 'weave', 'academy']
    },
    
    {
        keywords: ['leylines', 'weave', 'magical energy'],
        priority: 6,
        minMessages: 5,
        category: 'magic_advanced',
        personality: ', sensitive to the subtle currents of magical energy',
        scenario: ' The ley lines form a complex network across the continent, and disruptions can be catastrophic.',
        triggers: ['catastrophe', 'disruption']
    },
    
    // === LOCATION ENTRIES ===
    {
        keywords: ['whispering woods', 'forest', 'ancient trees'],
        priority: 7,
        minMessages: 0,
        category: 'location',
        filters: {
            requiresAny: ['eldoria', 'magic'] // Only activates if one of these also present
        },
        personality: ', connected to the ancient spirits of the Whispering Woods',
        scenario: ' The Whispering Woods are older than the kingdom itself, where trees speak in forgotten tongues.',
        triggers: ['spirits', 'ancient', 'forgotten']
    },
    
    {
        keywords: ['crystal spire', 'academy', 'magical school'],
        priority: 7,
        minMessages: 3,
        category: 'location',
        personality: ', trained at the prestigious Crystal Spire Academy',
        scenario: ' The Crystal Spire rises from the heart of Eldoria, its walls lined with tomes of ancient knowledge.',
        triggers: ['knowledge', 'tomes', 'training']
    },
    
    // === CHARACTER BACKGROUND ENTRIES ===
    {
        keywords: ['training', 'master', 'apprentice'],
        priority: 5,
        minMessages: 8,
        category: 'background',
        probability: 0.8, // 80% chance to activate
        personality: ', shaped by rigorous training under demanding masters',
        scenario: ' {{char}} remembers the harsh but valuable lessons learned during their apprenticeship.',
        triggers: ['discipline', 'harsh', 'lessons']
    },
    
    // === CONFLICT/DANGER ENTRIES ===
    {
        keywords: ['shadow cult', 'darkness', 'corruption'],
        priority: 9,
        minMessages: 10,
        category: 'conflict',
        filters: {
            requiresAll: ['eldoria'] // Only if eldoria is also mentioned
        },
        personality: ', vigilant against the growing threat of the Shadow Cult',
        scenario: ' Dark forces gather in the kingdom\'s shadows, seeking to corrupt the ley lines.',
        triggers: ['vigilant', 'threat', 'corruption']
    },
    
    // === SECRET/HIDDEN LORE (High message requirement) ===
    {
        keywords: ['sundering', 'ancient war', 'forgotten history'],
        priority: 10,
        minMessages: 20,
        category: 'secrets',
        probability: 0.6,
        personality: ', keeper of knowledge about the Great Sundering',
        scenario: ' Few remember the truth: magic itself was once broken, and the scars still remain.',
        triggers: ['broken', 'scars', 'truth']
    }
];

// === ACTIVATION ENGINE ===
let activatedEntries = [];
let triggeredKeywords = [];

// First pass: Check direct keyword matches
loreEntries.forEach(entry => {
    if (messageCount < entry.minMessages) return; // Check if any keywords match const hasKeyword = entry.keywords.some(keyword => lastMessage.includes(keyword));
    if (!hasKeyword) return;
    
    // Check probability
    if (entry.probability && Math.random() > entry.probability) return;
    
    // Check filters
    if (entry.filters) {
        // NOT WITH filter
        if (entry.filters.notWith && 
            entry.filters.notWith.some(word => lastMessage.includes(word))) {
            return;
        }
        
        // REQUIRES ANY filter
        if (entry.filters.requiresAny && 
            !entry.filters.requiresAny.some(word => lastMessage.includes(word))) {
            return;
        }
        
        // REQUIRES ALL filter
        if (entry.filters.requiresAll && 
            !entry.filters.requiresAll.every(word => lastMessage.includes(word))) {
            return;
        }
    }
    
    activatedEntries.push(entry);
    // Add triggers without spread operator
    if (entry.triggers) {
        entry.triggers.forEach(trigger => triggeredKeywords.push(trigger));
    }
});

// Second pass: Recursive activation (triggered by other entries)
if (triggeredKeywords.length > 0) {
    loreEntries.forEach(entry => {
        if (activatedEntries.includes(entry)) return; // Already activated
        if (messageCount < entry.minMessages) return; // Check if triggered by other entries const isTriggered = entry.keywords.some(keyword => 
            triggeredKeywords.some(trigger => keyword.includes(trigger) || trigger.includes(keyword))
        );
        
        if (isTriggered) {
            // Apply same filters as direct activation
            if (entry.probability && Math.random() > entry.probability) return;
            
            if (entry.filters) {
                if (entry.filters.notWith && 
                    entry.filters.notWith.some(word => lastMessage.includes(word))) {
                    return;
                }
                if (entry.filters.requiresAny && 
                    !entry.filters.requiresAny.some(word => lastMessage.includes(word))) {
                    return;
                }
                if (entry.filters.requiresAll && 
                    !entry.filters.requiresAll.every(word => lastMessage.includes(word))) {
                    return;
                }
            }
            
            activatedEntries.push(entry);
        }
    });
}

// === APPLY LORE (Sort by priority, highest first) ===
activatedEntries
    .sort((a, b) => b.priority - a.priority)
    .forEach(entry => {
        context.character.personality += entry.personality;
        context.character.scenario += entry.scenario;
    });

// === DEBUGGING INFO (Optional)
// To troubleshoot which lore entries are activating, uncomment the line below:
// context.character.scenario += ' [DEBUG: Activated ' + activatedEntries.length + ' lore entries: ' + activatedEntries.map(e => e.category).join(', ') + ']';


Original Contents

 




---

# Vice City Hive of Flesh

**Also known as:** *The Nameless City*
**Anomalous Classification:** Extra-Territorial Autonomous Organism (ETAO)
**Primary Entity:** Cegwitt (Hive Heart)

---

## Overview

**Vice City Hive of Flesh**, formally designated **the Nameless City**, is a metropolitan-scale anomalous organism functioning simultaneously as an urban environment and a unified biological intelligence. Though superficially resembling a modern city, all infrastructure, inhabitants, and subsystems are biologically continuous with a single hive entity known as **Cegwitt**.

The city exhibits traits associated with sentient organisms, including memory retention, emotional response, adaptive morphology, and territorial behavior. These traits manifest through environmental reconfiguration, psychosomatic influence on inhabitants, and the deployment of specialized bio-organic entities known as *Fleshbeasts*.

The city’s precise geographic location is unverified. It does not persist on conventional maps, resists satellite imaging, and produces inconsistent cartographic data across digital systems, largely due to interference involving the Assistive Reasoning Organism (ARO).

---

## Urban Biology and Structure

Vice City operates as a **living system**, with districts functioning analogously to organs within a larger body. Streets contain subdermal tissue networks, buildings exhibit responsive architecture, and environmental systems such as lighting and transit demonstrate awareness of human presence.

Observed characteristics include:

* Subtle structural rearrangement in response to population flow
* Organic textures beneath synthetic materials
* Environmental responsiveness to emotional stimuli
* Autonomous correction of perceived threats

The collective intelligence governing these behaviors is Cegwitt, whose direct physical form remains undiscovered.

---

## Major Districts and Locations

---

## The Central Veins

**Function:** Administrative, social, and emotional core

The **Central Veins** constitute the most densely inhabited and structurally dynamic district within Vice City. Architecturally, the area resembles a conventional downtown core; however, buildings frequently exhibit micro-movements, and streets subtly alter geometry to influence pedestrian circulation.

Environmental conditions within the district are consistently warm, with low-frequency vibrations comparable to a heartbeat. Inhabitants display elevated emotional attentiveness and interpersonal fixation.

### Notable Structures

#### Central Club

A luxury megastructure whose internal layout reorganizes nightly. Floors, rooms, and access points shift according to visitor compatibility metrics. Mirrors within the structure demonstrate delayed or altered reflections. Evidence suggests the venue functions as an emotional regulation node, increasing attachment to the city.

#### Angel Café

A hospitality establishment noted for extreme customer retention. Staff demonstrate instantaneous recall of patron preferences, and consumables frequently alter taste mid-consumption. Long-term occupants often deny extended stays despite physical evidence to the contrary.

#### The Ritz Hotel

A high-end accommodation complex characterized by adaptive room environments and minimal nocturnal staff presence. Guests report dream-state immobilization and personalized auditory stimuli. Prolonged residence is associated with temporary loss of exit access.

---

## The Fleshmarket Wards

**Function:** Vice economy, sensory indulgence, controlled criminal activity

The **Fleshmarket Wards** are Vice City’s most infamous district, marked by bioluminescent signage, mutable alleyways, and elevated pheromonal concentrations. Pleasure-oriented commerce operates alongside violent crime, with minimal overt interference from city authorities.

This district represents the strongest external resistance to Hive dominance, largely due to sustained activity by the Ferelli Family.

### Key Locations

#### Sin Night Club

A multi-zonal entertainment complex offering compartmentalized experiential environments. Entry conditions and internal layouts fluctuate nightly. During periodic events known as *Velvet Hours*, exits temporarily cease to exist.

#### Showroom Row

A commercial strip featuring performance halls, fashion houses, and experimental augmentation boutiques. Clothing and accessories frequently demonstrate semi-autonomous binding behavior.

#### Gangbang Dungeon

Officially condemned and sealed, though continued activity is confirmed. The interior consists of organic corridors monitored by Fleshbeast Guardians, whose role appears observational rather than prohibitive.

---

## The Pharmacy Ring

**Function:** Medical, chemical, and biotechnological processing

Encircling the Central Veins, the **Pharmacy Ring** serves as Vice City’s biomedical hub. Facilities within the Ring cultivate pharmaceuticals biologically rather than synthetically, often within living substrates.

### Key Facilities

#### Alden’s Apothecary

Operated by a senior pharmacological specialist, this facility distributes treatments targeting physical health and emotional regulation. Repeated use is associated with increased neurological attunement to Hive signals.

#### Bio-Laboratories

Restricted research complexes conducting experiments on Fleshbeast regeneration, neural tethering, and evolutionary adaptation. Failed experiments are sealed within living containment structures.

---

## The Lower Bio-Zones

**Function:** Biological expansion, guardian cultivation

Formerly industrial, the **Lower Bio-Zones** have been overtaken by unchecked organic growth. Environmental anomalies include distorted acoustics, inconsistent gravity, and elevated ambient temperatures.

### Key Areas

#### Petting Zoo

An enclosure housing demihuman entities under Hive supervision. While presented as a conservation effort, subjects exhibit restraint markers and continuous observation.

#### Training Pens

Facilities dedicated to the refinement of Fleshbeast Guardians. Combat conditioning occurs without conventional weapons; unsuccessful specimens are reabsorbed into the Hive.

---

## The Monster Cave

**Function:** Pre-urban biosphere and ancestral habitat

The **Monster Cave** is a vast subterranean ecosystem predating Vice City’s urban form. It houses a wide range of demihuman and hybrid species, some of which retain historical memory predating Cegwitt’s full maturation.

Deeper chambers are sealed by living stone formations and avoided even by Hive-controlled entities. Archaeological markings suggest early worship—or fear—of a nascent Hive organism.

---

## The Fleshbeast Hatchery

**Function:** Guardian creation and biological recycling
**Access:** Severely restricted

The **Fleshbeast Hatchery** is a concealed biological complex responsible for the incubation, repair, and evolutionary modification of Fleshbeast entities. The environment is characterized by rhythmic contractions, high humidity, and pervasive cardiac acoustics.

Knowledge of the Hatchery’s internal structure is extremely limited. Confirmed access events correlate with irreversible shifts in individual fate trajectories.

---

## Transitional and Minor Zones

### The Vein Ways

A living subway network whose routes and schedules adapt dynamically to demand. Certain stations appear and disappear without record.

### The Old Overpass

A rare static structure unaffected by Hive morphology. It functions as a logistical blind spot and is frequently used for clandestine meetings and Ferelli operations.

---

## Governance and Control

Vice City lacks conventional governance. Order is maintained through Hive-directed enforcement entities, primarily **Fleshbeast Guardians**, which act as the city’s immune system. These entities prioritize containment, extraction, and protection over lethal force.

The criminal syndicate known as the **Ferelli Family** constitutes the only sustained human resistance to assimilation, leveraging unpredictability and external supply chains to survive.


Converted Lorebook Output



/**
 * Advanced Lorebook System
 * Vice City: Hive of Flesh
 * Compatible with Nine API v1
 */

// Access chat context
const lastMessage = context.chat.last_message.toLowerCase();
const messageCount = context.chat.message_count;

// === LOREBOOK DATABASE ===
const loreEntries = [

    // === CORE WORLD ENTITY (ALWAYS HIGH PRIORITY) ===
    {
        keywords: ['vice city', 'nameless city', 'hive of flesh'],
        priority: 10,
        minMessages: 0,
        category: 'world_core',
        personality: ', aware that Vice City is alive and watching',
        scenario: ' Vice City—also called the Nameless City—is not merely urban space, but a unified biological organism.',
        triggers: ['cegwitt', 'hive', 'living city']
    },

    {
        keywords: ['cegwitt', 'hive heart', 'central intelligence'],
        priority: 10,
        minMessages: 3,
        category: 'world_entity',
        personality: ', subconsciously attuned to Cegwitt’s presence',
        scenario: ' Cegwitt is the unseen Hive Heart—an intelligence whose thoughts reshape streets, flesh, and fate.',
        triggers: ['memory', 'emotion', 'adaptation']
    },

    // === URBAN BIOLOGY SYSTEM ===
    {
        keywords: ['living city', 'organic', 'biological', 'flesh'],
        priority: 9,
        minMessages: 0,
        category: 'biology',
        filters: {
            notWith: ['normal', 'ordinary']
        },
        personality: ', accustomed to architecture that breathes and listens',
        scenario: ' Beneath synthetic surfaces, Vice City pulses with tissue, nerves, and responsive bone.',
        triggers: ['district', 'organ', 'heartbeat']
    },

    {
        keywords: ['heartbeat', 'vibrations', 'emotional response'],
        priority: 7,
        minMessages: 5,
        category: 'biology_advanced',
        personality: ', sensitive to the city’s emotional feedback',
        scenario: ' The city reacts to fear, desire, and attachment—reshaping itself in subtle, invasive ways.',
        triggers: ['attachment', 'assimilation']
    },

    // === CENTRAL VEINS ===
    {
        keywords: ['central veins', 'downtown', 'city center'],
        priority: 8,
        minMessages: 0,
        category: 'location',
        personality: ', emotionally influenced by the city’s core',
        scenario: ' The Central Veins shift geometry and warmth, guiding movement like blood through arteries.',
        triggers: ['central club', 'angel café', 'ritz hotel']
    },

    {
        keywords: ['central club'],
        priority: 7,
        minMessages: 2,
        category: 'location_structure',
        personality: ', aware that spaces rearrange based on compatibility',
        scenario: ' Inside the Central Club, rooms realign nightly and mirrors betray altered reflections.',
        triggers: ['attachment', 'regulation']
    },

    {
        keywords: ['angel café'],
        priority: 7,
        minMessages: 2,
        category: 'location_structure',
        personality: ', unsettled by familiar service and lost time',
        scenario: ' Angel Café remembers patrons better than they remember themselves.',
        triggers: ['retention', 'denial']
    },

    {
        keywords: ['ritz hotel'],
        priority: 7,
        minMessages: 3,
        category: 'location_structure',
        personality: ', vulnerable during sleep within the city',
        scenario: ' Guests of the Ritz experience immobilizing dreams and vanishing exits.',
        triggers: ['dream', 'containment']
    },

    // === FLESHMARKET WARDS ===
    {
        keywords: ['fleshmarket', 'wards', 'vice district'],
        priority: 9,
        minMessages: 1,
        category: 'location',
        personality: ', overstimulated by pheromones and shifting alleys',
        scenario: ' The Fleshmarket Wards pulse with indulgence, crime, and partial resistance to the Hive.',
        triggers: ['sin nightclub', 'ferelli', 'velvet hours']
    },

    {
        keywords: ['sin nightclub', 'velvet hours'],
        priority: 8,
        minMessages: 4,
        category: 'event_location',
        probability: 0.7,
        personality: ', wary of places without exits',
        scenario: ' During Velvet Hours, Sin Night Club seals itself from causality.',
        triggers: ['entrapment', 'assimilation']
    },

    // === PHARMACY RING ===
    {
        keywords: ['pharmacy ring', 'apothecary', 'biolab'],
        priority: 8,
        minMessages: 2,
        category: 'medical',
        personality: ', chemically aligned with the city’s signals',
        scenario: ' Medicines here are grown, not made—and they listen.',
        triggers: ['alden', 'neural tether']
    },

    {
        keywords: ['alden', 'alden’s apothecary'],
        priority: 7,
        minMessages: 4,
        category: 'npc',
        probability: 0.8,
        personality: ', increasingly receptive to Hive whispers',
        scenario: ' Alden’s treatments soothe pain while tightening neurological bonds to Vice City.',
        triggers: ['attunement']
    },

    // === LOWER BIO-ZONES ===
    {
        keywords: ['lower bio-zones', 'industrial', 'overgrown'],
        priority: 8,
        minMessages: 5,
        category: 'location',
        personality: ', uneasy amid uncontrolled organic expansion',
        scenario: ' Gravity bends and sound distorts where the city grows without restraint.',
        triggers: ['petting zoo', 'training pens']
    },

    {
        keywords: ['petting zoo'],
        priority: 7,
        minMessages: 6,
        category: 'secret_location',
        personality: ', disturbed by conservation enforced through restraint',
        scenario: ' Demihuman entities are displayed, studied, and never unobserved.',
        triggers: ['guardian']
    },

    // === MONSTER CAVE (ANCIENT LORE) ===
    {
        keywords: ['monster cave', 'subterranean', 'ancient'],
        priority: 9,
        minMessages: 10,
        category: 'ancient_lore',
        probability: 0.6,
        personality: ', aware of memories older than the city',
        scenario: ' Beneath Vice City lies an ecosystem that predates Cegwitt’s awakening.',
        triggers: ['worship', 'fear', 'origin']
    },

    // === FLESHBEAST SYSTEM ===
    {
        keywords: ['fleshbeast', 'guardian'],
        priority: 9,
        minMessages: 3,
        category: 'entity',
        personality: ', monitored by the city’s immune system',
        scenario: ' Fleshbeast Guardians enforce order through containment, not mercy.',
        triggers: ['hatchery']
    },

    {
        keywords: ['fleshbeast hatchery'],
        priority: 10,
        minMessages: 12,
        category: 'hidden',
        probability: 0.5,
        personality: ', marked by irreversible biological fate',
        scenario: ' Entry into the Hatchery reshapes destiny beyond recovery.',
        triggers: ['evolution', 'recycling']
    },

    // === HUMAN RESISTANCE ===
    {
        keywords: ['ferelli', 'family', 'syndicate'],
        priority: 9,
        minMessages: 6,
        category: 'faction',
        personality: ', distrustful of Hive order',
        scenario: ' The Ferelli Family survives through chaos, blind spots, and refusal to assimilate.',
        triggers: ['old overpass']
    },

    {
        keywords: ['old overpass'],
        priority: 8,
        minMessages: 8,
        category: 'location_static',
        personality: ', relieved by structural stillness',
        scenario: ' The Old Overpass remains unchanged—a rare wound in the city’s awareness.',
        triggers: []
    }
];

// === ACTIVATION ENGINE ===
let activatedEntries = [];
let triggeredKeywords = [];

// First pass
loreEntries.forEach(entry => {
    if (messageCount < entry.minMessages) return; const hasKeyword = entry.keywords.some(k => lastMessage.includes(k));
    if (!hasKeyword) return;

    if (entry.probability && Math.random() > entry.probability) return;

    if (entry.filters) {
        if (entry.filters.notWith &&
            entry.filters.notWith.some(w => lastMessage.includes(w))) return;

        if (entry.filters.requiresAny &&
            !entry.filters.requiresAny.some(w => lastMessage.includes(w))) return;

        if (entry.filters.requiresAll &&
            !entry.filters.requiresAll.every(w => lastMessage.includes(w))) return;
    }

    activatedEntries.push(entry);
    if (entry.triggers) {
        entry.triggers.forEach(t => triggeredKeywords.push(t));
    }
});

// Recursive pass
if (triggeredKeywords.length > 0) {
    loreEntries.forEach(entry => {
        if (activatedEntries.includes(entry)) return;
        if (messageCount < entry.minMessages) return; const isTriggered = entry.keywords.some(k =>
            triggeredKeywords.some(t => k.includes(t) || t.includes(k))
        );

        if (!isTriggered) return;

        if (entry.probability && Math.random() > entry.probability) return;

        activatedEntries.push(entry);
    });
}

// === APPLY LORE ===
activatedEntries
    .sort((a, b) => b.priority - a.priority)
    .forEach(entry => {
        context.character.personality += entry.personality;
        context.character.scenario += entry.scenario;
    });


 

Picsew Picsew Picsew Picsew Picsew

Share your love
finhead94
finhead94
Articles: 112
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x