moo.agent.lore

krustylu lore source for moo-agent world-builders.

LoreClient wraps a streamable-HTTP MCP session to the krustylu Simpsons archive and turns a location or character into a compact, build-ready text brief — a condensed wiki summary plus the precise detail that lives in the script lines (stage directions, signature dialogue, the characters who haunt a place). Builders consume the brief through the lore_room/lore_character tools; the model never sees krustylu’s raw query schema.

Every public method is defensive: a miss, a malformed query, or an unreachable server yields an empty-but-usable string, never an exception into the LLM cycle. The curation itself lives in module-level pure functions so it can be unit tested against captured query results without a live server.

Functions

build_character_brief(character, ...)

Assemble the bounded character brief from raw krustylu rows.

build_room_brief(location, description, ...)

Assemble the bounded room brief from raw krustylu rows.

condense_description(markdown, max_chars)

Reduce a krustylu wiki description to a short plain-text summary.

sanitize_query(q)

Strip quote characters that the krustylu FTS parser chokes on.

strip_md_links(text)

Replace [label](target) markdown links with their bare label.

top_speaker_ids(group_rows, limit)

Sort a $group count result by frequency and return the top character ids.

Classes

LoreClient(endpoint, *[, verify_tls, ...])

A persistent streamable-HTTP MCP client to the krustylu archive.