Name generation system

libname: human-readable identifier generation for agents, remotes, and hives

A flexible name generation toolkit creates human-readable identifiers for agents, remotes, hives, and passphrases.

Overview

The name generation system is implemented in libid/name/ using the libname namespace. It provides:

  • WordSource interface - Abstraction for word providers
  • NamePattern class - Combines words using different joining styles
  • NameGenerator toolkit - Main API for building name generators
  • Domain-specific generators - Pre-built generators for agents and remotes

Architecture

libid/name/
├── WordSource.hpp          # Interface for word providers
├── ResourceWordSource.hpp  # Loads words from Qt resources
├── CustomWordSource.hpp    # User-provided word lists
├── NamePattern.hpp         # Pattern building and generation
├── NameGenerator.hpp       # Main toolkit API
├── SyllableNameGenerator.hpp  # Base syllabic name generator
├── AgentNameGenerator.hpp  # Agent-specific names (e.g., "Lunara")
└── RemoteNameGenerator.hpp # Remote-specific names (e.g., "Azure Fox")

Design Principles

Toolkit, Not Repository

libname is a toolkit that provides building blocks. Domain-specific naming logic belongs to the consuming code, not to libname. This ensures:

  1. Naming stability - Agent names won't change if wordlists are updated
  2. Consumer ownership - Each domain controls its naming patterns
  3. Flexibility - Consumers can use built-in or custom word sources

Ownership Rules

Domain Owns Naming For Uses libname For
libid (delivery) Agent names, Remote names Syllable sources, pattern utils
libhive Hive names Adjective + habitat sources
Any consumer Their domain names Toolkit components

Pattern Types

The NamePattern::Type enum defines how words are joined:

Type Example Description
Concatenate "SunnyMeadow" Words joined directly
Spaced "Sunny Meadow" Words joined with space
Hyphenated "sunny-meadow" Words joined with hyphen
CamelCase "sunnyMeadow" First word lower, rest capitalized
Syllabic "Lunara" Syllables combined into single word

Built-in Wordlists

The following wordlists are available as Qt resources:

Source Name Description Example Words
adjectives Nature-themed positive words cozy, sunny, hidden, misty
habitats Animal homes/shelters burrow, den, nest, hollow
colors Color names azure, crimson, golden, silver
animals Animal names fox, owl, wolf, deer
passphrase Common words for passphrases correct, horse, battery, staple
syllable_prefix Starting syllables lu, zen, ax, tri
syllable_stem Middle syllables na, ri, on, ex
syllable_suffix Ending syllables ra, ix, us, a
agent_prefix Agent-specific prefixes lu, zen, ka, vo
agent_stem Agent-specific stems na, ri, do, ex
agent_suffix Agent-specific suffixes ra, ix, us, a
remote_adjectives Remote-specific adjectives azure, swift, bright
remote_nouns Remote-specific nouns fox, hawk, wolf

Usage Examples

Using Built-in Generators

#include "name/AgentNameGenerator.hpp"
#include "name/RemoteNameGenerator.hpp"

// Generate agent name (syllabic pattern)
libname::AgentNameGenerator agentGen;
QString agentName = agentGen.generate();  // e.g., "Lunara"

// Generate remote name (adjective + noun pattern)
libname::RemoteNameGenerator remoteGen;
QString remoteName = remoteGen.generate();  // e.g., "Azure Fox"

Using the Toolkit Directly

#include "name/NameGenerator.hpp"

libname::NameGenerator gen;

// Create custom pattern for hive names
auto pattern = gen.pattern(libname::NamePattern::Type::Spaced)
    .addSource(gen.wordSource("adjectives"))
    .addSource(gen.wordSource("habitats"))
    .capitalize(true, false);

QString hiveName = pattern.generate();  // e.g., "Cozy Burrow"

Custom Word Sources

libname::NameGenerator gen;

// Use custom words instead of built-in lists
QStringList techWords = {"quantum", "neural", "cyber"};
auto techSource = libname::NameGenerator::fromList(techWords, "tech");

auto pattern = gen.pattern(libname::NamePattern::Type::Hyphenated)
    .addSource(techSource)
    .addSource(gen.wordSource("animals"))
    .capitalize(false);

QString name = pattern.generate();  // e.g., "quantum-fox"

Passphrase Generation

libname::NameGenerator gen;

// Generate 4-word passphrase with spaces
QString pass = gen.passphrase(4);  // e.g., "correct horse battery staple"

// Generate 3-word passphrase with hyphens
QString pass2 = gen.passphrase(3, "-");  // e.g., "apple-banana-cherry"

Syllabic Word Generation

libname::NameGenerator gen;

// Generate syllabic word with custom syllable sources
QString word = gen.syllabicWord(
    gen.wordSource("syllable_prefix"),
    gen.wordSource("syllable_stem"),
    gen.wordSource("syllable_suffix"),
    true  // capitalize
);  // e.g., "Lunara"

Test Coverage

Category Tests Status
WordSource interface 4 Pass
ResourceWordSource 6 Pass
CustomWordSource 4 Pass
NamePattern all types 12 Pass
NameGenerator toolkit 8 Pass
AgentNameGenerator 6 Pass
RemoteNameGenerator 6 Pass
Integration tests 6 Pass
Total 52 Pass
  • Hive System: See hive-encryption documentation
  • Identity Management: See libid documentation
  • Delivery System: See libpair/delivery documentation
In this section
Topics
reference libname name-generation