Skip to content

Quest archetypes & exports

Reference for what @kiberon-labs/quests ships: the archetype cores, the module stage layers, and the package’s public exports.

Each archetype is a seeded core: an abstract spine that reifies against world state and is filled out by the stage and structure layers. Compose one with composeQuest / composeGrammar, or load its pre-built grammar at @kiberon-labs/quests/grammars/<pattern>.grammar.json.

PatternWhat it is
competeEnter a contest for a prize: bouts and preparation against a field of rivals.
defendHold a place against an assault, driving back successive waves.
escapeBreak out of captivity and get clear, often with fellow prisoners in tow.
escortGet a charge safely to a destination against threats on the road.
exploreChart an unknown or sealed place and reveal what it hides.
fetchRecover a specific item and return it to the one who wants it.
heistInfiltrate a guarded vault and take the prize without raising the alarm.
huntTrack and bring down a mobile quarry: a fleeing beast, a runaway, or cunning prey.
investigateUncover the culprit behind a wrong by weighing suspects and evidence.
negotiateBroker terms between two parties, sometimes with leverage or a hidden position.
provisionGather → refine → craft → deliver goods (a fetch with a production chain).
rescueFree a captive and bring them home, often against a clock or a cruel choice.
slayKill a foe that threatens the giver or something the giver cares about.
surviveOutlast a killing environment and reach a haven.

QUEST_ARCHETYPES exports these 14 pattern tags as a readonly tuple; coreFor(pattern) returns a core by tag.

Modules live under src/modules/, grouped by the quest stage they act on (the number prefix is load order). A core lays down the spine; the stage and structure layers compete (weighted-random) to fill it in.

FolderProvides
0-coreThe 14 seeded quest archetypes.
1-expositionOpening beats that ground the situation and stakes.
2-incitingThe hook that sets the quest in motion.
3-rising-actionThe body: travel legs, obstacles, and grounded complications.
4-climaxThe decisive beat that resolves the goal.
5-complicationRe-spawnable setbacks that deepen the rising action.
6-falling-actionConsequences and twists after the climax (e.g. a double-cross).
7-denouementThe return, the reward, and concrete aftermaths.
8-structureCross-cutting structure: branches, prerequisites, parallel objectives, rare gated scenarios.

Every registered module carries a capability requirement (requires): the mechanics a game must be able to present for the beat to be coherent, such as Combat or Dialogue. manifest.json lists these; filter REGISTRY on them to include only beats your game supports.

Import specifierContents
@kiberon-labs/questsThe TypeScript API (composition, registry, authoring DSL).
@kiberon-labs/quests/grammars/<pattern>.grammar.jsonA pre-built, runnable grammar for one archetype.
@kiberon-labs/quests/data/*The raw generated data: per-module JSON, index.json, manifest.json.
ExportSignature / typeDescription
composeQuest(core: CoreDescriptor, seed?: number) => { nodes, edges }Compose an archetype and run it into a finished, scaffolding-stripped quest graph.
composeGrammar(core: CoreDescriptor, seed?: number) => GrammarCompose an archetype into a runnable graph-grammar grammar (run it yourself).
coreFor(archetype: QuestArchetype) => CoreDescriptorLook up a shipped archetype core by its pattern tag.
coresCoreDescriptor[]All 14 archetype cores.
QUEST_ARCHETYPESreadonly QuestArchetype[]The 14 pattern tags.
stripTransitions(nodes, edges) => { nodes, edges }Remove empty-stage transition no-ops and bridge their neighbours.
ExportSignature / typeDescription
REGISTRYRegisteredModule[]Every core and beat, with key, folder, requires.
modulesForCore(pattern: string) => RegisteredModule[]The layers affine to an archetype.
modulesFor(caps: string[]) => RegisteredModule[]Modules whose capability requirements the caps satisfy.
affinityOf(key: string) => string[] | nullWhich archetypes a module is scoped to (null = universal).
ExportDescription
matchModule, branchMatchModule, beatModule, complicationModule, bondRevealModuleBuilders that return a BeatDescriptor from a spec.
matchBeat, branchMatchBeatLower-level rule builders the module builders wrap.
BeatDescriptor, MatchSpec, BeatStep, MotivationSpec, StageKey, CoreDescriptor, QuestArchetypeThe DSL types.

The package also re-exports the augmented-quest schema and validity helpers, and graph utilities (reidGraph, largestComponent, splitByComponents, wlSignature) for validating and normalizing quest graphs.

Built by Kiberon Labs