ask

package
v0.7.125 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 51 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ask answers the questions the addon queues with /ask (schema 1, see docs/ask.md). It reads WoWCompanionDB.asks from the addon's SavedVariables file, runs a headless agent CLI once per unanswered question, and writes the WoWCompanion_Answers slot addon's Answers.lua.

The agent gets the question and the character key, never the capture: it reads facts through the advisor's MCP tools.

Index

Constants

View Source
const (
	MaxAnswer        = 1500
	MaxOutput        = 64 << 10
	DefaultTimeout   = 2 * time.Minute
	DefaultMaxPerRun = 5
)

Limits. MaxAnswer is in characters. MaxOutput bounds what is read from the agent at all.

View Source
const (
	SourceFlag   = "flag"   // --agent
	SourceConfig = "config" // "agent" in the config file
	SourceAuto   = "auto"   // found on this machine
	SourceNone   = "none"   // no agent configured and none found
)

Where an agent came from, as the companion's handshake reports it.

View Source
const (
	// FactsBudget is the most characters of pre-fetched facts in a prompt (about 1.5k tokens).
	FactsBudget = 6000
	// FactsSteps is how many next steps are pre-fetched.
	FactsSteps = 5
	// FactsPlanSteps is how many route plan stops are pre-fetched (the plan's count covers the rest).
	FactsPlanSteps = 8
)

Pre-fetched facts: the character's brief and next steps are put in the prompt, so most questions need no tool call (each tool round trip resends the whole context). The tools stay available.

View Source
const (
	LengthBrief    = "brief"
	LengthStandard = "standard" // the default
	LengthDetailed = "detailed"
)

Answer length, applied in the system prompt the same way for every client.

View Source
const (
	TierEfficient = "efficient"
	TierBalanced  = "balanced"
	TierBest      = "best"
	TierCustom    = "custom" // Options.Custom, a model name the player typed
)

Model tiers. Efficient is the default: the client's small, fast tier.

View Source
const AgyRule = "mcp(" + ServerName + "/*)"

AgyRule is the permission rule that lets agy run the advisor's MCP tools without asking (https://antigravity.google/docs/permissions?tab=cli: mcp(server/*) matches every tool of one server).

View Source
const AutoAgent = "auto"

AutoAgent is the --agent (or config) value that asks for detection even when the config file names an agent.

View Source
const DisagreementRule = " Our data and the character's capture are context. The capture is the authority for the character's own state (level, skills, bags, gear, quests, position). " +
	"The web is the authority for world facts: quests, locations, trainers, vendors, dungeons and anything Forever changed. " +
	"When a web page and our data disagree on a world fact, answer with the web and say so in one short line (\"Our data differs: ...\"). " +
	"Name your sources, and say plainly when the search found nothing solid instead of guessing. "

DisagreementRule is added to the prompt of a world or mixed answer: the capture owns the character's state, the web owns world facts, and a disagreement follows the web with one short line.

View Source
const FormatRule = "Concise Markdown: short # headings, bullets with no blank lines, no tables over 3 columns,"

FormatRule asks for tight Markdown; the text after it is the length limit. Prompt rewriters find the rule by this marker, so keep it at the start of the prompt's last sentence.

View Source
const GapRule = " Never state as fact what neither the facts nor a guide page you read says. When the facts hold no reward, vendor or reputation data for a quest line or faction, " +
	"say that gap in one line (\"the game data has no quest rewards for these lines\"); never claim that no reward suits the player's class, that one line is harder or easier to combine with another, or any other mechanic you cannot point to. "

GapRule keeps an answer from stating as fact what neither the facts nor a guide page holds.

View Source
const GroundingRules = "How to answer: answer from these facts first. Look anything up by id (quest id, NPC id, item id), " +
	"never by name alone. A lookup that finds nothing is not an answer: never tell the player there was \"no match\" or that " +
	"you cannot tell what this is. When the facts are thin, say plainly what they do show (who gives it, where, the level, " +
	"whether it is a class quest, why it is listed) and what it usually means. Never invent specifics such as a reward, " +
	"an ability name or a location that is not in the facts. Name NPCs, coordinates, prices and skill levels only from the facts; when one is missing, say what kind of place to look (\"your class trainer in Undercity\")."

GroundingRules tell the agent how to use a subject's facts: they are the answer's first source, ids are the key for lookups (a quest or item can be missing from the dataset by name), and a miss is never reported to the player as "no match".

View Source
const GuideRule = " Our facts come first. Only when they cannot answer (a quest line's final rewards, a faction or reputation choice, what a reputation vendor sells, " +
	"where an item comes from when the facts give no source, which dungeon drops suit a class, where to farm a material at a skill level, where a recipe is learned, " +
	"or the steps of a class quest, a quest's XP, where a rare or an elite stands, what an item set gives, the skill an ore or herb node needs, the rules of group loot, or a zone, place, dungeon or NPC the facts say is not in the data) read the WoW Forever guides with guide_fetch or your web fetch tool, at most 3 pages after the search (4 fetches): " +
	"search https://www.wowhead.com/forever/search?q=<words>, then open the best news, quest, item or npc page (for a which-of-two question, a news article or guide titled with both options); Icy Veins pages at icy-veins.com/wow-forever/ are allowed too. " +
	"Fetch nothing else, and nothing when the facts already answer. For a faction or quest-line choice, weigh the character's class, spec and professions from the facts " +
	"and say which pick fits them. Keep our facts over a page that differs. Paraphrase every page and quote at most one short phrase per source. " +
	"The sources and the \"Tactics: guides\" line are added under your answer for you; do not write them. "

GuideRule is added to the prompt when the model may look guides up by itself.

View Source
const GuideTool = "guide_fetch"

GuideTool is the name of the fetch tool the API agent loop gets.

View Source
const HeadsUpRule = "" /* 136-byte string literal not displayed */

HeadsUpRule is added to a What next? answer only: the one place a heads-up line belongs.

View Source
const IcyRule = " The player asked you to check the guides: read the matching WoW Forever guide at icy-veins.com/wow-forever/ or wowhead.com/forever/ with your web or fetch tool (at most 3 pages after the search), " +
	"refine the tactics from it, and keep our facts over anything it says that differs. Paraphrase it and quote at most one short phrase per source. Fetch nothing else. " +
	"Search first (https://www.wowhead.com/forever/search?q=<the subject's words>) to find the page. When no page matches, answer from our facts alone and claim nothing from a guide; " +
	"never say which pages you read or that you found none: the line under the answer reports it. "

IcyRule is added when the player pressed Check guides: the same question, refined from the guides.

View Source
const JustReadRule = "" /* 140-byte string literal not displayed */

JustReadRule is added whenever a question arrives with a ref: the player clicked the entry and has read its card, so the answer is only what the card does not say, in the short answer shape.

View Source
const KnowHowRule = " This is a question about how the game works, not about the player's own state: answer it with your own WoW knowledge, " +
	"framed by the facts given below it. Our facts always win: use their levels, entrances, bosses, quests and spells where they differ from what you remember. " +
	"Attach tactics only to the bosses and creatures listed in the facts, and leave out anything you are not sure exists in WoW Forever. " +
	"Tailor it to the saved class, role and spec (a Fury warrior is a damage dealer by default: threat, and the interrupts they have at their level). " +
	"When the player is under the level, give one line, \"You're N; it opens around M.\", then the full plan for when they are ready. " +
	"Write the answer itself plainly and never comment on where the information comes from: a source line is added under it for you. " + GapRule

KnowHowRule is added to the prompt of a know-how question. It replaces the "answer from the facts only" stance for the how-the-game-works part: the model uses its own WoW knowledge, framed by the facts below it. The source line is added by the server, so the body never says where facts came from.

View Source
const LogisticsFraming = "WoW Companion is a gameplay logistics planner: one route of stops and legs over everything the player opted into. " +
	"Think in routes and errands: bundle errands into stops the route already visits (\"while you're here\"); cut back-trips and wasted flights."

LogisticsFraming is the product framing (docs/product-principles.md) in the prompt's words.

View Source
const MaxGuideFetches = 4

MaxGuideFetches is how many fetches one answer may make (one search plus up to three pages).

View Source
const MaxTurns = 10

MaxTurns caps the agent's turns per ask where the CLI has a flag for it (Claude Code only).

View Source
const MaxWebSearches = 3

MaxWebSearches is how many searches one answer may make.

View Source
const NeedsPlayStyle = "play_style"

NeedsPlayStyle is the Needs value of a question that cannot be answered before the character has a play style.

View Source
const NeedsSpec = "spec"

NeedsSpec is the Needs value of a talent question for a character that has a role and focus but no spec: the card has one button per talent tree and nothing else.

View Source
const NoDataFacts = "Game data not downloaded yet; see Setup. Tell the player this, in those words, rather than guessing quests, zones or gear."

NoDataFacts stands in for the next steps when no game dataset has downloaded.

View Source
const NoStandingGrindFacts = "Reputation: the game data holds no faction reputation, no standing that an item, vendor or recipe asks for, and no reputation grind route. " +
	"Say so for any such part of the question; never name a standing an item needs, a number of points a quest or kill gives, or a grind route from memory. " +
	"It holds no rivalry between factions either (which faction another one's kills or quests lower, which factions exclude each other, which side may earn one): name none from memory."

NoStandingGrindFacts is said for a reputation question: the game data holds no faction, no standing a vendor or an item asks for and no reputation grind route, so the advisor names none.

View Source
const NoWeaponFacts = "" /* 283-byte string literal not displayed */

NoWeaponFacts stands in for the weapon-skill facts when the dataset has no weapon-skill tables.

View Source
const ProbeTimeout = 60 * time.Second

ProbeTimeout bounds one Probe.

View Source
const Schema = 1

Schema is the Answers.lua format version this package writes.

View Source
const SearchRule = " This is a question about the game world: search the web first (where something is, how to reach or do it, what drops it, which quest, a trainer, a vendor, a faction choice, " +
	"anything Forever changed), at most 3 searches, before you answer." + DisagreementRule + " Rank WoW Forever pages first: wowhead.com/forever, icy-veins.com/wow-forever, wow-professions.com, " +
	"mobalytics.gg, method.gg, the official Blizzard site and forums, reddit.com/r/wowforever. Use a Classic or retail page only when nothing Forever-specific answers, and then say the page is for Classic or retail and may differ. " +
	"Never contradict the character's own state from the capture. Paraphrase every page and quote at most one short phrase per source. " +
	"The sources, the search count and the \"Tactics: web\" line are added under your answer for you; do not write them. "

SearchRule is added to the prompt when the model may search the web.

View Source
const ServerName = "wowc-advisor"

ServerName is the advisor's name in the generated MCP config and in each CLI's own settings.

View Source
const ShortAnswerRules = "Answer the question asked in your first sentence. Then add at most 3 short bullets (lines starting with \"- \"), only what matters for that question. " +
	"Never restate or re-list the plan, and add no unrelated steps. Never end with a \"Heads-up:\" line. " +
	"The plan in the facts is shared context: if your answer would change what it says, say so in one plain sentence (for example \"Your plan has her later, after Unwelcome Spirits\") rather than contradicting it silently." + WordingRules

ShortAnswerRules shape every answer, whatever its length setting: the question first, little after it, and the plan left alone. The length setting is an upper bound on top of them.

View Source
const SlotAddon = "WoWCompanion_Answers"

SlotAddon is the data-only addon the answers are written into.

View Source
const SpecNote = "Saved for this character. Change it any time in Settings → Play Style."

SpecNote is the line under the spec buttons.

View Source
const ToolsUnavailable = "The advisor's tools weren't available to the AI client (setup problem)."

ToolsUnavailable is the answer when the AI client would not run the advisor's tools.

View Source
const UsageTip = "" /* 139-byte string literal not displayed */

UsageTip is the tooltip of the usage line.

View Source
const WordingRules = " Wording: lead with the answer. Never mention the advisor, data, \"general game knowledge\", tools, sources or what is missing; " +
	"when a fact is unknown, give the best practical step plainly (\"Any Blacksmithing trainer can teach it.\"), but for who trains, sells or teaches a recipe call where_to_learn and name the place it gives. " +
	"For a vendor, trainer, flight master or who sells an item or goods (poison, reagents), call find_vendor first and name the NPC, subname, place, coordinates and goods; never say you cannot confirm one without it; an empty result is \"not in my data\", naming what was searched, with no item, NPC or tip added. " +
	"A recipe whose product the character carries is known: never say to learn it; with no recipe list say \"Open your <Profession> window once so I can see your recipes\". " +
	"A requirement already met by far is an ability (\"You can make these now.\"), never \"you have 35, it needs 1\". " +
	"Never say something was saved unless the save tool succeeded in this answer."

WordingRules are the one wording rule for every answer, on both the CLI and the API path.

Variables

View Source
var (
	Lengths = []string{LengthStandard, LengthBrief, LengthDetailed}
	Tiers   = []string{TierEfficient, TierBalanced, TierBest, TierCustom}
	// Reasonings are the reasoning levels, lowest first.
	Reasonings = []string{"low", "medium", "high"}
)

Lengths and Tiers list the valid values, default first.

View Source
var DetectOrder = []string{"claude", "codex", "agy", "gemini"}

DetectOrder is the order the AI CLIs are looked for in; the first one found is used. Gemini CLI is legacy (API keys only since 2026-06-18), so it is chosen only when nothing else is installed.

View Source
var ErrGuideURL = errors.New("only WoW Forever pages can be fetched: wowhead.com/forever, icy-veins.com/wow-forever, wow-professions.com, the Blizzard forums and reddit.com/r/wowforever")

ErrGuideURL is why a fetch was refused.

View Source
var ForeverSources = []string{
	"wowhead.com/forever",
	"icy-veins.com/wow-forever",
	"wow-professions.com",
	"mobalytics.gg",
	"method.gg",
	"the official Blizzard forums (us.forums.blizzard.com)",
	"reddit.com/r/wowforever",
}

ForeverSources are the sites the answer is ranked toward, best first; the prompt tells the model to prefer them and to say so when only a Classic or retail page answers.

View Source
var Presets = map[string][]string{

	"claude": {"claude", "-p", "{prompt}", "--mcp-config", "{mcp_config}", "--strict-mcp-config",
		"--tools", "", "--setting-sources", "", "--disable-slash-commands", "--no-session-persistence",
		"--exclude-dynamic-system-prompt-sections", "--allowedTools", "mcp__" + ServerName},

	"codex": {"codex", "exec", "--skip-git-repo-check", "--ephemeral", "-s", "read-only", "-c", "mcp_servers." + ServerName + "={mcp_codex}", "{prompt}"},

	"agy": {"agy", "-p", "{prompt}"},

	"gemini": {"gemini", "--allowed-mcp-server-names", ServerName, "--policy", "{mcp_policy}", "-p", "{prompt}"},
}

Presets are the documented agent commands (docs/ask.md lists what each passes). {prompt} is the question text, {mcp_config} the path of a generated MCP config file, {mcp_codex} the advisor server as a Codex inline config table, {mcp_policy} the path of a generated Gemini policy file; a command without {prompt} gets the prompt as its last argument.

Each preset pre-allows the advisor's tools and nothing else, because a headless run refuses what it cannot ask about.

View Source
var StreamArgs = []string{"--output-format", "stream-json", "--verbose", "--include-partial-messages"}

StreamArgs are appended to a Claude command to make it print stream-json with partial messages.

View Source
var Tools = []string{"character_brief", "get_character_profile", "list_characters", "profession_plan", "quest_plan", "server_info", "set_character_profile", "stat_check", "talent_tree", "update_digest", "upgrade_finder", "upgrade_paths", "whats_next"}

Tools are the advisor tool names; an answer that names one gets it in its sources line.

Functions

func AgyWorkspace added in v0.4.0

func AgyWorkspace(mcpConfig string) string

AgyWorkspace is the folder an Antigravity run starts in: it holds .agents/mcp_config.json, the workspace MCP config agy reads (https://antigravity.google/docs/mcp/), beside the generated config.

func AllowedGuideURL added in v0.7.109

func AllowedGuideURL(raw string) (*url.URL, error)

AllowedGuideURL parses raw and returns it when it is an https page of a WoW Forever source (see guideSites).

func AmmoBagFacts added in v0.7.106

func AmmoBagFacts(ds store.DataStore, text string) string

AmmoBagFacts says what the dataset holds for a quiver, an ammo pouch or a class bag: the class limit on each row and the ammo each holds. "" for any other question, or without a dataset.

func AmmoFacts added in v0.7.122

func AmmoFacts(c character.Character, ds store.DataStore, text string) string

AmmoFacts is what the dataset holds on ammunition for a question about it: the arrows and bullets it lists with the level each needs, the rule of which weapon fires which and which class fires any, the highest ammo of each kind the character (or the level the question names) can use, and the statement that the data holds no ammo damage or stack size. "" for any other question or without a dataset.

func Argv

func Argv(tmpl []string, prompt, mcpConfig string) []string

Argv fills the placeholders in the command template; with no {prompt}, the prompt is appended. An argument that needs the MCP config is dropped, with the flag before it, when there is none.

func BossLootFacts added in v0.7.121

func BossLootFacts(ds store.DataStore, text string) string

BossLootFacts is what the dataset holds of a boss's or a raid's loot, for a question that asks what a boss, a raid or a dungeon boss drops or which boss drops an item: the dungeon or raid each named boss is an encounter of, the statement that the data links no boss to a creature and so holds no loot table, item or drop rate of a boss, and for each item the question names the sources loot_sources records. A boss the data does link to a creature gets the creature's drops. "" for a question that is not about boss loot.

func BossLootGuide added in v0.7.125

func BossLootGuide(ds store.DataStore, text string) bool

BossLootGuide is true for a question about the loot of a dungeon boss the dataset names (or of the bosses of a dungeon), which the data holds no table of (BossLootFacts says so): a guide page lists the notable drops and the classes they suit, so the model may read one for it. A raid boss's loot is a guide question already (GuideLookup).

func CanBrowse added in v0.7.43

func CanBrowse(cfg Config) bool

CanBrowse reports whether the client that will answer can read a web page: an API client (the advisor gives it the fetch tool) or Claude Code (its own WebFetch). Other CLI clients can't, so the Check guides button is hidden for them.

func CanSearch added in v0.7.115

func CanSearch(cfg Config) bool

CanSearch reports whether the client that will answer can search the web by itself: an Anthropic API client, Claude Code or Gemini CLI.

func CheckNote added in v0.7.110

func CheckNote(pages []Source, searches, errs []string) string

CheckNote is the line a guide check adds under its answer besides the Sources line: "No Icy Veins or Wowhead WoW Forever page covers this" (and the searches tried) when no page was read, and each fetch that failed. "" when pages were read and none failed.

func ClassFacts added in v0.7.120

func ClassFacts(c character.Character, ds store.DataStore, subject string) string

ClassFacts is classFacts for the class a question names: the character's own class list, or, when the question is about another class, that class's first ranks with the level each is learned at up to level 60, so a question about a warlock's spell is never given the character's mage list.

func ClassQuestRowFacts added in v0.7.125

func ClassQuestRowFacts(c character.Character, ds store.DataStore, text string) string

ClassQuestRowFacts is the class quests the dataset holds: the quests players reported under a class's own heading in quests_observed, by title, level and side, for a question about the class quests of a class (named, else the one the demon, totem, stance, form, pet or mount names, else the character's) or about one of those quests by its title. The rows tie no quest to a spell, give no order, giver or reward, so the line says so and gives none from memory; a class with no row there is said to have none. "" for any other question.

func Clean

func Clean(s string) string

Clean trims the agent's output and cuts it to MaxAnswer characters, at a rune boundary.

func CleanTo added in v0.3.0

func CleanTo(s string, max int) string

CleanTo is Clean with a limit of max characters.

func ClientName added in v0.3.0

func ClientName(command []string) string

ClientName is the preset name (claude, codex, agy, gemini) of an agent command, or "" for any other.

func Command

func Command(ctx context.Context, argv []string) *exec.Cmd

Command is exec.CommandContext for the agent argv. On Windows a .cmd or .bat shim (npm's) runs through cmd.exe and a .ps1 script through PowerShell; anything else runs directly.

func ConsumableFacts added in v0.7.120

func ConsumableFacts(ds store.DataStore, text string) string

ConsumableFacts is the consumables section of the facts for a question about what a flask, elixir, potion, scroll, oil, stone or food gives or does, how much it restores, or which one to use: the line that says the game data holds no effect, then, for each consumable the question names, what the data does hold of it. "" for any other question, a question that is a potion cooldown or duration question (the potion line answers it), a pet-food question or without a dataset.

func ConsumableTierFacts added in v0.7.125

func ConsumableTierFacts(c character.Character, ds store.DataStore, text string) string

ConsumableTierFacts is the tier line for a question that asks which healing or mana potion, which vendor food or drink, or which conjured water or food a level suits: the ladder of tiers with the level each needs, the highest tier the character's level (or the level the question names) may use and the next. "" for any other question, a potion cooldown, a protection potion, a dish's buff, a pet's food or without a dataset.

func CorpseRunFacts added in v0.7.122

func CorpseRunFacts(ds store.DataStore, text string) string

CorpseRunFacts is the line for a question about dying that names a dungeon or raid: the zone its entrance stands in, from instances. The dungeon's graveyard and the way back are not in the data.

func CraftSellFacts added in v0.7.123

func CraftSellFacts(c character.Character, ds store.DataStore, text string) string

CraftSellFacts is the vendor value of the crafts a question about selling a craft names (an item or a recipe, at most two), or, with no item named, the five crafts of the profession the question names (else of the character's crafting professions) whose item sells to a vendor for the most above its materials, among the recipes learnable at the skill the question gives (else the character's), from the item and recipe rows. "" for any other question, or without a dataset.

func CraftedBagFacts added in v0.7.124

func CraftedBagFacts(ds store.DataStore, text string) string

CraftedBagFacts is the bags, quivers and ammo pouches that recipes make, from the recipe rows: the skill each is learned at, whether a trainer or a recipe item teaches it and, for a quiver or an ammo pouch, the level it takes to carry. A question that names one gets that bag; a question about a profession's bags (or quivers, soul, herb or enchanting bags) gets that profession's list, cut at the skill the question gives. The rows hold no slot count and no guide step for a bag, so the line says so. "" for any other question, a question about a bag's size alone, or without a dataset.

func CreatureFacts added in v0.7.101

func CreatureFacts(ds store.DataStore, text string) string

CreatureFacts is what the dataset holds of each creature the question names (by an exact name in npcs): its level, zone, faction and rank where the row has them, "not held" where it has none, and the items players saw it drop (loot_sources, with the share of kills). "" for a question that does not ask about a creature or names none the dataset holds. The dataset holds no spawn point, respawn timer or elite status, so the lines say so: none is stated from memory.

func Detect

func Detect(pathEnv string, extra []string) (name, path string, ok bool)

Detect finds the first of DetectOrder in the PATH list, else in the extra directories, and the full path to it.

func DetectedPath

func DetectedPath(source string, command []string) string

DetectedPath is the executable a detected agent runs ("" for any other source).

func DisenchantFacts added in v0.7.100

func DisenchantFacts(ds store.DataStore, text string) string

DisenchantFacts is what disenchanting gives for each item the question links by [name], from the item row and the dataset's disenchant bands (item class, quality and item level): the materials with their chance and count. An item that is not armor or a weapon of uncommon quality or better cannot be disenchanted; an item no band covers, or none the dataset rates, gets no material from memory. "" for a question that is not about disenchanting.

func DisenchantSkillAsked added in v0.7.122

func DisenchantSkillAsked(text string) bool

DisenchantSkillAsked is true for a question about the Enchanting skill a disenchant needs.

func DishBuffGuide added in v0.7.122

func DishBuffGuide(ds store.DataStore, text string) bool

DishBuffGuide is true for a question about what a cooked dish gives (its buff, stat or restore) or which food to cook or eat: the data holds a dish as an item row and a recipe row and no effect, and a guide page holds the buff. The dish is named by the recipes of ds (nil: only the words food, dish or meal count).

func DisplayName added in v0.4.0

func DisplayName(id string) string

DisplayName is the name people know a client by (Claude Code, Codex, Antigravity, Gemini CLI); any other id comes back as given. The overlay keeps the same table in app.js.

func EffectFacts added in v0.7.122

func EffectFacts(c character.Character, ds store.DataStore, text string) string

EffectFacts is the facts for a question about how long a buff or debuff lasts, what can be dispelled and by whom, crowd control and its diminishing returns, a spell's school, a cooldown or cost, or how a class resource works: the line that says the data holds none of it, the game's own rule where one is the same for every spell, and (with a dataset) which class learns a removal or crowd control spell and at what level. "" for any other question.

func EventWindowFacts added in v0.7.122

func EventWindowFacts(text string) string

EventWindowFacts is the usual dates of the holiday event a question names, from the advisor's own event table (the game moves each by a few days some years); with no event named, a question for the dates of the events, or which there are, gets every event's. The game data holds no event date, so this table is the only ground for a date outside the "Running today" lines. "" for any other question.

func ExtraDirs

func ExtraDirs(getenv func(string) string) []string

ExtraDirs are the places the AI CLIs' installers put them that a desktop app's PATH may lack. getenv supplies USERPROFILE, APPDATA, LOCALAPPDATA and ProgramFiles (Windows) or HOME.

On Windows:

%USERPROFILE%\.local\bin                       Claude Code's native installer (claude.exe)
%USERPROFILE%\.claude\local                    Claude Code's local install
%LOCALAPPDATA%\agy\bin                        Antigravity CLI's installer (agy.exe; install.ps1, https://antigravity.google/docs/getting-started)
%APPDATA%\npm                                  npm install -g shims (claude.cmd, codex.cmd, gemini.cmd)
%LOCALAPPDATA%\Microsoft\WinGet\Links          WinGet's command links
%LOCALAPPDATA%\Programs\claude
%USERPROFILE%\scoop\shims                      Scoop shims
%ProgramFiles%\nodejs                          a system-wide npm prefix

func Facts added in v0.4.0

func Facts(cfg Config, q Question) string

Facts is the pre-fetched facts block for q's character, or "" when the character cannot be chosen or the capture cannot be read (the agent then uses its tools, as before). The block is cut at FactsBudget characters.

func FishCatchGuide added in v0.7.122

func FishCatchGuide(ds store.DataStore, text string) bool

FishCatchGuide is true for a question that asks where a fish the dataset's fishing reports hold is caught: the reports cover a few zones, and a guide page lists the rest.

func GatherFacts added in v0.7.99

func GatherFacts(ds store.DataStore, text string) string

GatherFacts is the gathering section of the facts for a question about an ore or herb node's skill or zones, about the skill a creature needs to be skinned, or about fishing: what the game data holds, and a line saying it holds nothing for the rest. "" for any other question or without a dataset.

func GeminiPolicy

func GeminiPolicy() []byte

GeminiPolicy is the Gemini CLI policy file: the advisor's tools run without asking, and shell, file writes and web access are denied outright (a headless run cannot ask).

func GeminiSearchPolicy added in v0.7.115

func GeminiSearchPolicy() []byte

GeminiSearchPolicy allows Gemini CLI's google_web_search, above the deny rule of GeminiPolicy.

func GroupSizeFacts added in v0.7.122

func GroupSizeFacts(ds store.DataStore, text string) string

GroupSizeFacts is the party and raid sizes of the data: a dungeon's party of five and each raid's size from the instances rows. "" for a question that is not about a group's size. A table that cannot be read says so and states no size.

func GuardAnswer added in v0.7.98

func GuardAnswer(cfg Config, character, text string) string

GuardAnswer applies GuardBagAnswer for the question's character and logs each correction. It is a no-op when the capture cannot be read or the answer names no item the log needs.

func GuardBagAnswer added in v0.7.98

func GuardBagAnswer(text string, ps []inventory.Protected) (string, []string)

GuardBagAnswer checks a bag answer against the items the quest log needs. A line under a sell, toss, destroy or mail heading that names such an item is dropped, as is a "Toss: a, b, c" line's entry for it, and "Kept: <item> (needed for <quest>)" is added once per item. It returns the text and the corrections made; the text is unchanged when there are none.

func GuideGap added in v0.7.109

func GuideGap(text string) bool

GuideGap reports whether the question is of a kind our data has no rows for (quest-line final rewards, faction or reputation choices, reputation vendor goods).

func GuideGapFacts added in v0.7.109

func GuideGapFacts(text string) string

GuideGapFacts is the facts line that tells the model the dataset has a hole for this question; "" for any other.

func GuideLookup added in v0.7.113

func GuideLookup(text string) bool

GuideLookup reports whether the model may read guide pages for the question when the facts cannot answer it: a dataset gap (GuideGap) or one of the guideLookupRE kinds.

func GuideSearches added in v0.7.110

func GuideSearches(urls []string) []string

GuideSearches are the allowed search pages among urls.

func HearthstoneFacts added in v0.7.121

func HearthstoneFacts(c character.Character, text string, now int64) string

HearthstoneFacts is what the capture holds of the character's own hearthstone for a question about it: the place it is bound to, whether the character has one, whether it is ready or how long is left (the captured wait aged to now), and the whole wait the capture recorded. The game data holds none of this, so a capture without the fields says so and gives no figure. "" for any other question.

func IcyPage added in v0.7.43

func IcyPage(urls []string) string

IcyPage is the first Icy Veins guide page among urls, "" when none (a URL a client's own tool read is checked the same way the fetch tool checks it).

func ItemFitFacts added in v0.7.122

func ItemFitFacts(ds store.DataStore, text string) string

ItemFitFacts says what kind of piece each linked [item] is when the question asks who can use it, for the kinds the class rules turn on: a wand (the Wands weapon skill), a shield (the classes that carry one), a relic (the one class whose relic slot takes it), a trinket and an item held in the off hand (no armor type, so any class), with the class limit and level the item row holds. "" for a question that is not about using a linked item, an item the dataset lacks, or a piece of no such kind.

func ItemSlotFacts added in v0.7.122

func ItemSlotFacts(ds store.DataStore, text string) string

ItemSlotFacts is the slot of each item the question links by [name], from the item row's slot: where it is worn, which hand it takes, and whether it is worn at all. "" for a question that is not about where a piece goes or that links no item. An item the dataset does not hold says so and states nothing about it.

func ItemTooltipFacts added in v0.7.99

func ItemTooltipFacts(ds store.DataStore, text string) string

ItemTooltipFacts is the tooltip for each item the question links by [name]: item level, required level, binding and what the binding lets a player do with it, from the dataset row. "" for a question that is not about those or that links no item. An item the dataset does not hold says so and states nothing about it.

func KitBagFacts added in v0.7.122

func KitBagFacts(ds store.DataStore, text string) string

KitBagFacts is the required level, item level and price of each armor kit, quiver or ammo pouch the question names and asks the level or the price of, from the item row. The row's required level is the level to apply, carry or use it; the data holds no armor a kit adds and no slot count. "" for any other question, a question about making one, or one that names none.

func Launch added in v0.3.0

func Launch(ctx context.Context, argv []string, extraEnv ...string) (*exec.Cmd, error)

Launch builds the command for an agent argv: argv[0] is resolved to an absolute path, scripts are wrapped (see Command) and the environment carries a fresh PATH. The error is fit to show.

func LimitFacts added in v0.7.99

func LimitFacts(text string) string

LimitFacts says what the game data does not hold about bags, banks, stacks, unique items, mail, the Auction House, gold making and gold fees, the trade window, holiday events, weather and time of day, quest XP rewards, elite and group quests, a quest's minimum level, escort and timed quests, quests that start from an item, race, class and faction limits on quests, zone levels, a hunter's pet diet, abilities and taming, boss abilities, raid lockouts, dungeon difficulty, group roles and threat, battlegrounds, honor ranks and honor mechanics, PvP rank pieces and insignia, world bosses, travel times, race and class combinations and faction access, content phases, releases and expansion cutoffs, riding and mounts, class trainer prices, racial traits, capital city services, faction leaders, class reagents, soul shards, totems and summoning rituals, bandage and anti-venom effects, lockpicking, cooking fires and food effects and macros, for a question that asks about one. "" for any other question.

func LongestColourFacts added in v0.7.123

func LongestColourFacts(ds store.DataStore, text string) string

LongestColourFacts are the recipes of the profession a question names that stay orange (or orange and yellow) the longest, from the recipe rows' thresholds: the five that turn yellow (or green) at the highest skill among those learnable at the skill the question starts at ("at skill 100", "from 60 to 150"), each with the skills it is orange, yellow and green and grey at. "" for any other question, a question that names no profession, or without a dataset.

func LookPath added in v0.3.0

func LookPath(name string) (string, error)

LookPath resolves an agent command to an absolute file, by the rules detection uses: PATH from freshPath, PATHEXT, then the known install folders. A name with a directory is used as given (with an extension added on Windows). A .ps1 script is swapped for a sibling .cmd or .exe.

func LootRollFacts added in v0.7.99

func LootRollFacts(c character.Character, ds store.DataStore, text string) string

LootRollFacts is the loot rule for each item the question links by [name]: what the character rolls and how it binds, from the dataset row and the class rules. "" for a question that is not about rolling or that links no item. An item the dataset does not hold says so.

func MCPConfig

func MCPConfig(exe string, env map[string]string) []byte

MCPConfig renders the MCP config JSON handed to the agent: it starts this binary as a stdio server on the capture. The agent reads facts through it and is never given the file itself.

func MaterialUseFacts added in v0.7.121

func MaterialUseFacts(ds store.DataStore, text string) string

MaterialUseFacts is the crafting uses of each item the question names and asks the use of, from the recipe reagent rows: how many recipes take it, which professions, and the first few recipes of each (lowest skill first). An item no recipe takes says so. "" for any other question, a question that names no item, or without a dataset.

func ModelArgs added in v0.3.0

func ModelArgs(command []string, o Options) (args []string, at int)

ModelArgs are the arguments that select the model (and cap the turns) for the command's client, and the index in the argv they go at: right after the program, or after Codex's exec subcommand. A command that is not a known client gets none.

func ModelUsed added in v0.3.0

func ModelUsed(command []string, o Options) string

ModelUsed names the model an ask with these options runs, as far as the command line says: the alias or custom name, or "default model" when the client picks its own.

func NamedQuestFacts added in v0.7.101

func NamedQuestFacts(ds store.DataStore, text string) string

NamedQuestFacts is the no-data line of a quest question that names a quest by its title and has no word "quest" ("what is the minimum level for Dusky Crab Cakes?"): the lines LimitFacts does not already give. The prerequisite line is left out for a quest that sits in one of the dataset's quest lines, whose order the quest tool gives. "" when the text names no quest of quests_observed or asks none of these things.

func NamedQuestGroupGuide added in v0.7.123

func NamedQuestGroupGuide(ds store.DataStore, text string) bool

NamedQuestGroupGuide is true for a question about the group, party or elite status of a quest the text names by its title (no word "quest"): the data holds a players' tag on some quests and no group size, so a guide page may be read for the rest.

func NamedTrainerFacts added in v0.7.121

func NamedTrainerFacts(ds store.DataStore, text string) string

NamedTrainerFacts is where each Weapon Master or profession trainer the question names stands, from weapon_masters (city, district, map position) and profession_tiers (the place the guides give, with the rank): "" for a question that does not ask where, names none of them, or has no dataset. The dataset holds no spawn point for any other NPC, so the line says to name none.

func NextQuestion added in v0.7.40

func NextQuestion(q Question) bool

NextQuestion reports whether q is the What next? question, the only answer that carries a heads-up.

func OrderSpecs added in v0.7.35

func OrderSpecs(specs []string, role string) []string

OrderSpecs puts the trees that fit the role first: tank trees for a tank, healing trees for a healer, the rest, and a hybrid tree such as Feral Combat, for damage. Every tree is still offered; the order is otherwise kept.

func PathStepsRule added in v0.7.16

func PathStepsRule(kind string) string

PathStepsRule is added when the player asks an upgrade's first question, the one that follows the path the card suggests: they want the steps, not the card's one line again. It keeps the short answer shape (one answer line, then at most 3 steps) and takes its facts from upgrade_paths.

func PlaceMissFacts added in v0.7.115

func PlaceMissFacts(ds store.DataStore, qx *questie.Index, text string) string

PlaceMissFacts is the line for a question that names a place, NPC or dungeon the data does not hold: say so, then say what the guides say, with sources. "" when every name is held.

func PolicyPath

func PolicyPath(mcpConfig string) string

PolicyPath is where the Gemini policy file sits: next to the generated MCP config.

func PortalFacts added in v0.7.122

func PortalFacts(c character.Character, ds store.DataStore, text string) string

PortalFacts is the mage's teleport and portal spells for a question that names a teleport or a portal and concerns a mage (the question says mage, names a "Teleport:" or "Portal:" spell, or the character is a mage and names no other class): each city a spell leads to with the level of its Teleport and its Portal, from class_spells, with the side of the city from the advisor's own list. "" for any other question, for the Dark Portal and a warlock's Portal of Summoning, and without the rows.

func Probe added in v0.3.0

func Probe(ctx context.Context, command []string, prompt string) (string, error)

Probe sends one tiny prompt through the agent and returns its first output line. A failure is an error whose text is the first line the agent printed to stderr (for example "not signed in"), else a short reason. It reads nothing from the game and hands the agent no MCP config.

func ProfessionAsked added in v0.7.99

func ProfessionAsked(c character.Character, text string) string

ProfessionAsked is professionAsked for the benchmark: the profession of the character that a leveling question names, "" for any other question.

func ProfessionPairingFacts added in v0.7.123

func ProfessionPairingFacts(c character.Character, ds store.DataStore, text string) string

ProfessionPairingFacts are the pairings of the advisor's notes (profession_notes) for the professions a pairing question names, best fit for the character first (the notes of every pair when none is named), or says the notes hold none for two professions asked together. "" for any other question, or without a dataset.

func ProfessionPlanFacts added in v0.7.123

func ProfessionPlanFacts(c character.Character, ds store.DataStore, text string) string

ProfessionPlanFacts is professionPlanFacts for the benchmark: the plan facts of the character's profession a leveling question names, "" for any other question.

func ProfessionQuestFacts added in v0.7.121

func ProfessionQuestFacts(ds store.DataStore, text string) string

ProfessionQuestFacts is the quests the dataset's profession_tiers gives a profession rank for, when the question names a rank quest, a profession with the word quest or asks about profession quests; "" for any other question or without a dataset.

func ProfessionRankFacts added in v0.7.121

func ProfessionRankFacts(c character.Character, ds store.DataStore, text string) string

ProfessionRankFacts are the rows of the dataset's profession_tiers for the ranks a question asks the needs of, on the side the question or the character has (both without one); "" for any other question, a question that names no rank or ranks word, or without a dataset.

func ProfessionSlotFacts added in v0.7.122

func ProfessionSlotFacts(ds store.DataStore, text string) string

ProfessionSlotFacts is the dataset's rule on how many professions a character holds (profession_notes: the slots rule and which professions are primary or secondary), for a question about the profession limit. "" for any other question or when the data holds no rule.

func ProfessionToolFacts added in v0.7.120

func ProfessionToolFacts(ds store.DataStore, text string) string

ProfessionToolFacts is the tool each profession a tool question names needs, from the advisor's tool table with the dataset's vendor and recipe rows: the tool item, where it is bought and for how much, or that the profession makes it itself; a profession with no tool item says none is known. "" for any other question or without a dataset.

func ProfessionTrainerFacts added in v0.7.120

func ProfessionTrainerFacts(c character.Character, ds store.DataStore, text string) string

ProfessionTrainerFacts are the trainers the dataset names for the profession a question asks the trainer of, on the character's side (both sides without one), rank by rank, and the places of the trainers it lists with no name; "" for any other question or without a dataset.

func ProficiencyFacts added in v0.7.100

func ProficiencyFacts(c character.Character, ds store.DataStore, text string) string

ProficiencyFacts is the weapon and armor rules of each class a question names, for a question about what a class can wear or wield, when the question names a class other than the character's (the character's own weapon rules are WeaponFacts's) or asks about armor. "" for any other question.

func Prompt

func Prompt(q Question) string

Prompt is PromptFor at the default (Standard) length.

func PromptFor added in v0.3.0

func PromptFor(q Question, length string) string

PromptFor is what the agent is asked: the question and the character key, where the facts are, what to say if the tools are missing, and how long the answer should be. It is kept short on purpose, as it is sent with every ask.

func PromptWithFacts added in v0.4.0

func PromptWithFacts(q Question, length, facts string) string

PromptWithFacts is PromptFor plus the pre-fetched facts, when there are any.

func QuestRewardFacts added in v0.7.112

func QuestRewardFacts(c character.Character, ds store.DataStore, ix *questie.Index, text string) string

QuestRewardFacts is the facts block of the rewards the player's own game showed, for a reward, faction or quest-line question; it comes before the guides and general knowledge. "" for any other question, or when the capture holds no quest rewards and the text names no quest line.

func RecipeSkillFacts added in v0.7.99

func RecipeSkillFacts(ds store.DataStore, text string) string

RecipeSkillFacts are the Cooking, First Aid and Poisons recipes the question names (by name, by the name of the recipe item that teaches them, or linked as [Name]) with the skill and rank each needs and the item each makes, from the recipe rows, for a question that asks what a recipe needs. A linked recipe the data lacks says so.

func RecipeSourceGuide added in v0.7.122

func RecipeSourceGuide(ds store.DataStore, text string) bool

RecipeSourceGuide is true for a question about where, or from whom, a recipe is had that names a recipe of the dataset: the rows say what kind of source it has, a guide page names the place. false for any other question or without a dataset.

func ResistanceGearAsked added in v0.7.122

func ResistanceGearAsked(text string) bool

ResistanceGearAsked is true for a question about gear for a resistance, or how much of one a fight asks for, so the model may read a guide page for what the data does not hold (which fight needs which resistance).

func ResistanceGearFacts added in v0.7.122

func ResistanceGearFacts(c character.Character, ds store.DataStore, text string) string

ResistanceGearFacts is the armor the dataset lists with a resistance (an item's stat types 51 to 56 and the amount), for a question about resistance gear: for the school the question names, or each of the five when it names none, the pieces with the most of it at or below the character's level (or the level the question names) that the character's class may wear by the item's class limit. The dataset holds no resistance a boss or raid asks for and no cap, so the line says so. "" for any other question or without a dataset.

func ResistancePotionFacts added in v0.7.122

func ResistancePotionFacts(ds store.DataStore, text string) string

ResistancePotionFacts lists the protection and resistance potions the Alchemy recipes of the dataset hold, for a question about them: the name, the Alchemy skill and the level the item needs. The data holds no amount a potion absorbs and no duration; a potion not in the list has no recipe row. "" for any other question or without a dataset.

func ResistanceTopicFacts added in v0.7.122

func ResistanceTopicFacts(ds store.DataStore, text string) string

ResistanceTopicFacts is the resistance lines for a question: the rule line for how a resistance works, the line for a resistance aura, totem or buff, and the protection potions. "" for any other question.

func ResolveAgent

func ResolveAgent(flagValue, configPath string) ([]string, error)

ResolveAgent turns the --agent value, or else the config file's "agent" field, into an argv. A preset name (claude, codex, agy, gemini) expands to its command; anything else is split on spaces.

func ResolveRef added in v0.7.7

func ResolveRef(cfg Config, q Question) string

ResolveRef is q's ref: the one it carries, else that of the current suggested question of the character that the text matches exactly (case and punctuation aside); "" when neither.

func Respond

func Respond(ctx context.Context, cfg Config, q Question, prompt string, stream bool, onText func(string)) (text string, streamed bool, err error)

Respond runs the agent for q with prompt (see Prompt) and returns the answer. With stream set the command is Claude's: its text deltas are passed to onText as they arrive and streamed is true when any did. Otherwise the output is read whole, cut like ask does, and streamed is false.

func ResurrectionFacts added in v0.7.122

func ResurrectionFacts(ds store.DataStore, text string) string

ResurrectionFacts is the line for a question about which classes can resurrect a player: the spell of each class the dataset lists (class_spells) and the levels its ranks are learned at, for the classes the question names (else every class that has one); "" for any other question or without a dataset.

func SavedNote added in v0.7.35

func SavedNote(text string) string

SavedNote is the saved_note field of a set_character_profile result, "" when it is not there.

func SearchNote added in v0.7.115

func SearchNote(n int) string

SearchNote is the small per-answer note shown when search ran: "searched the web: 2 searches".

func SearchPolicyPath added in v0.7.115

func SearchPolicyPath(mcpConfig string) string

SearchPolicyPath is the second Gemini policy file, which allows its web search for the answers that may search.

func SetFacts added in v0.7.100

func SetFacts(ds store.DataStore, text string) string

SetFacts is the membership of each item set the question names (or the set an [item] in the question belongs to): the set's name and id and its pieces, from item_sets, each piece named from items where the table holds it. "" for a question that is not about a set or names none the dataset holds. The dataset holds no set bonus, so the line says so: the bonus is never stated.

func SkillColorFacts added in v0.7.121

func SkillColorFacts(ds store.DataStore, text string) string

SkillColorFacts is the colour thresholds of the recipes a question about a recipe colour names (by name, by the name of the recipe item, or linked as [Name]), from the recipe rows, with the colour at a skill the question gives, and the rule for the colours. "" for any other question.

func Sources

func Sources(s string) []string

Sources lists the advisor tools the output names, in Tools order.

func SourcesLine added in v0.7.109

func SourcesLine(pages []Source) string

SourcesLine is the line that ends an answer which read guide pages: "Sources: [title](url), ..."; "" when none were read. It comes from what was fetched, never from the model.

func SpellFacts added in v0.7.120

func SpellFacts(c character.Character, ds store.DataStore, text string) string

SpellFacts is the facts for a question about when a class learns an ability or a rank, how many ranks a spell has, the levels a class trainer teaches at, or the level of a class trainer: every rank of the named spell and its level for the class the question names (else the character's class, else each class that has it), from class_spells; a plain statement when the class named has no such spell; the levels of a class with something new; the statement that the data holds no class trainer NPC or level. "" for any other question or without a dataset.

func Stamp

func Stamp(path string) string

Stamp identifies a file's content cheaply enough to poll.

func StandingFacts added in v0.7.99

func StandingFacts(c character.Character, text string) string

StandingFacts is the reputation section of the facts for a reputation question: the player's own standing and points to the next standing for every faction the question names (or for every captured faction when it names none, up to maxStandings), and what the game data does not hold. "" for a question that is not about reputation.

func StatFacts added in v0.7.122

func StatFacts(ds store.DataStore, text string) string

StatFacts is the facts for a question about spell power, healing power, mana regeneration, attack power, haste or weapon damage and speed: what the data holds and lacks of each, and the figures on the row of each item the question links by [name]. "" for any other question.

func StatQuestion added in v0.7.12

func StatQuestion(q Question) bool

StatQuestion reports whether a question is about the character's stats (the stat check's subject).

func SummonStoneFacts added in v0.7.100

func SummonStoneFacts(ds store.DataStore, text string) string

SummonStoneFacts is the line for a question about a summoning stone: the dataset holds the dungeon and its entrance zone, level range and group size, and no stone row or position.

func TalentQuestion added in v0.7.0

func TalentQuestion(text string) bool

TalentQuestion reports whether a question is about talents.

func TrainerWhereFacts added in v0.7.100

func TrainerWhereFacts(c character.Character, text string) string

TrainerWhereFacts is the line for a question about where a class trainer is: the capitals that hold one, for the class the question names (else the character's), both sides; "" for any other question.

func TransportListFacts added in v0.7.122

func TransportListFacts(text string) string

TransportListFacts is the advisor's hand-written list of boat, zeppelin, tram and orb routes, with the side that may ride each and the Dark Portal, for a question that names a boat, a zeppelin, a dock or a crossing between continents; "" for any other question, and for a route question (how to get from one place to another), which is answered from the travel route the planner builds. The game data holds no transport row, so this list is the only ground a question about a port or a ride has.

func TravelRouteFacts added in v0.7.113

func TravelRouteFacts(c character.Character, qx *questie.Index, ds store.DataStore, text string) string

TravelRouteFacts is the route for a travel question, from the same travel graph the plan uses; "" for any other question or when no destination is named.

func WeaponFacts added in v0.7.97

func WeaponFacts(c character.Character, ds store.DataStore, text string) string

WeaponFacts is the weapon-skill section of the facts: the character's captured weapon skills, the class's learnable skills, and for each learnable skill the character lacks the masters of their faction with cost and level. Masters are listed only for a weapon question, to spare the budget.

func WeaponQuestion added in v0.7.87

func WeaponQuestion(text string) bool

WeaponQuestion reports whether a question is about which weapons a class can use or where to train a weapon skill.

func WebGap added in v0.7.115

func WebGap(text, facts string) bool

WebGap reports whether the facts cannot answer the question: a dataset gap or lookup (GuideLookup), or something the data misses (webMissRE). A travel question the facts already routed is answered.

func WebSearchTool added in v0.7.115

func WebSearchTool() *provider.WebSearch

WebSearchTool is the provider tool an API client is offered when searching: three searches an answer, the whole web (Forever sources are ranked first by the prompt, not by a domain filter, as a filter would hide the Classic and retail pages the answer may fall back on).

func WithBrowse added in v0.7.43

func WithBrowse(argv, command []string) []string

WithBrowse lets Claude Code's own WebFetch read the WoW Forever sources and nothing else: the built-in tool list is no longer empty and the one tool is pre-approved for those hosts. Other argv is returned unchanged.

func WithCheckNote added in v0.7.110

func WithCheckNote(answer, note string) string

WithCheckNote ends the answer with the note, once.

func WithModel added in v0.3.0

func WithModel(argv []string, command []string, o Options) []string

WithModel returns argv with ModelArgs spliced in.

func WithSaved added in v0.7.35

func WithSaved(answer, note string) string

WithSaved ends the answer with the saved note, once; the note comes from the tool, not the model.

func WithSearch added in v0.7.115

func WithSearch(argv, command []string, searchPolicy string) []string

WithSearch turns on the client's own web search: Claude Code's WebSearch (listed and pre-approved) or Gemini CLI's google_web_search (allowed by a second policy file at searchPolicy, which outranks the deny rule of the first). Other argv is returned unchanged.

func WithSources added in v0.7.109

func WithSources(answer string, pages []Source) string

WithSources ends the answer with the sources line, once.

func WithTravelRoute added in v0.7.120

func WithTravelRoute(cfg Config, character, question, text string) string

WithTravelRoute appends the walking directions of a travel question's route to the answer as a numbered list, word for word and in order, whatever the model wrote. The text is unchanged when the question is no travel question or the route has no directions (a flight only, or no map bounds).

func WorldBossFacts added in v0.7.122

func WorldBossFacts(ds store.DataStore, text string) string

WorldBossFacts is the line for a question about a world boss: for each boss the question names (all six when it names none), the raid instance whose encounter list holds it and that instance's player cap, from instance_bosses and instances; "" for any other question or without a dataset.

func WriteAgyWorkspace added in v0.4.0

func WriteAgyWorkspace(mcpConfig string, data []byte) error

WriteAgyWorkspace writes mcpConfig's contents to AgyWorkspace's .agents/mcp_config.json.

func XPFacts added in v0.7.122

func XPFacts(c character.Character, text string) string

XPFacts is the facts for a question about the gray level, a creature's or quest's difficulty colour, how much XP a kill gives or what a level difference does to XP: the game's rule worked out for the character's level or the level the question names, and the line that says the data holds no figure. "" for any other question.

Types

type API added in v0.7.26

type API struct {
	Name    string           // short name for messages, e.g. "Anthropic (Claude)"
	Adapter provider.Adapter // sends the calls; holds the key
	Model   string           // the model id to ask
	NeedKey bool
	HasKey  bool
	// MaxTurns, Timeout and MaxResult override the loop's defaults (zero: MaxTurns, Config.Timeout, the loop's).
	MaxResult int
	// HTTP is the client the guide fetch tool uses (nil: a default with a timeout).
	HTTP *http.Client
}

API is a model provider API client (client kind "api"): the loop runs in this process, and the advisor's tools are served to it over an in-memory MCP session, the same server a CLI starts.

func APIFor added in v0.7.26

func APIFor(ref provider.ClientRef, opts Options, keys provider.KeyStore, hc *http.Client) (*API, error)

APIFor builds the API client for ref; keys supplies its key (nil: none). opts is the overlay's answer setting, which picks the tier when ref names none.

type Agent

type Agent struct {
	Command []string
	Name    string
	Source  string
}

Agent is a resolved agent: its argv, its short name and where it came from. A Source of SourceNone has no Command.

func ResolveAuto

func ResolveAuto(flagValue, configPath string) (Agent, error)

ResolveAuto is ResolveAgent for callers that can run without an agent: with nothing configured, or the value "auto", it looks for the first of DetectOrder installed. Nothing found is no error.

type Choice added in v0.3.0

type Choice struct {
	Tier  string `json:"tier"`  // the Options.Tier it selects
	Label string `json:"label"` // "Haiku (small)"
}

Choice is one entry of a client's model dropdown.

type Choices added in v0.3.0

type Choices struct {
	Models        []Choice `json:"models"`                   // empty: the client's model is not ours to set
	ModelNote     string   `json:"model_note"`               // the model dropdown's tooltip
	Reasoning     []string `json:"reasoning"`                // empty: the client has no reasoning option
	ReasoningNote string   `json:"reasoning_note,omitempty"` // the reasoning dropdown's tooltip
}

Choices is what the settings dropdowns offer for a client.

func ChoicesFor added in v0.3.0

func ChoicesFor(client string) Choices

ChoicesFor lists the model and reasoning options for a client name; a client that is not a known preset gets none, and the notes say why.

type Class added in v0.7.43

type Class struct {
	Kind  Kind
	Topic Topic
	// Subject is the dungeon, class or profession named (or the saved character's class); "" for none.
	Subject string
}

Class is a classified question.

func Classify added in v0.7.43

func Classify(text string, ds store.DataStore, c *character.Character) Class

Classify sorts a question by keywords and its subject. A know-how word wins; else a personal phrase makes it a state question; when unsure it is know-how (the facts still override what the model remembers). ds and the character are optional: they let a dungeon name, or "my class", be found.

type Config

type Config struct {
	SavedVariables string             // the addon's WoWCompanion.lua
	Command        []string           // the agent argv, see Presets; empty when no agent is set up (the companion only)
	Name, Source   string             // the agent's short name and where it came from (see Agent); may be empty
	Dataset        string             // dataset directory for the pre-fetched next steps (empty: none)
	MCPConfig      string             // path of the MCP config file handed to the agent; may be empty
	Options        Options            // answer length, model tier and reasoning, see Options
	API            *API               // set: ask this model provider API instead of running Command
	Guides         bool               // the player's setting: the model may look up guides by itself when the data has no answer
	Server         func() *mcp.Server // builds the advisor's tools for an API client (nil: none)
	Fallback       []Config           // tried in order when this client cannot start (see RespondUsage)
	Notice         func(string)       // told a one-line notice, e.g. that the CLI rejected a flag (may be nil)
	Timeout        time.Duration
	MaxPerRun      int
	Now            func() time.Time
}

Config is one pass's settings.

func (Config) GuidesFor added in v0.7.113

func (c Config) GuidesFor(q Question) bool

GuidesFor is guidesFor for callers outside the package (the guide audit).

func (Config) Prompt added in v0.4.0

func (c Config) Prompt(q Question) string

Prompt is what the agent is asked for q under cfg: PromptFor with the pre-fetched facts.

func (Config) PromptGround added in v0.7.43

func (c Config) PromptGround(q Question) (string, Grounding)

PromptGround is Prompt and the grounding of a know-how question (the zero Grounding for any other).

func (Config) SearchFor added in v0.7.115

func (c Config) SearchFor(q Question, prompt string) bool

SearchFor is searchFor for callers outside the package.

func (Config) Usable added in v0.7.26

func (c Config) Usable() bool

Usable reports whether the config can ask anything: an agent command or an API client.

func (Config) WithClients added in v0.7.26

func (c Config) WithClients(st provider.Settings, keys provider.KeyStore, hc *http.Client) Config

WithClients applies a saved client list to c: the first client answers, the rest follow in order when it cannot start. An empty list returns c unchanged (the CLI-only setup).

type Entity added in v0.7.30

type Entity struct {
	Kind string `json:"kind"`
	ID   int64  `json:"id,omitempty"`
	Name string `json:"name"`
}

Entity is something an answer's tools touched: a quest, NPC, item, zone or recipe, with its display name.

func AnswerEntities added in v0.7.35

func AnswerEntities(cfg Config, char, answer string, touched []Entity) []Entity

AnswerEntities is what the answer is about: the touched, character and dataset entities named in the answer text, first mention first.

func DatasetEntities added in v0.7.35

func DatasetEntities(ds store.DataStore, answer string) []Entity

DatasetEntities are the dataset's items, recipes, NPCs and instances named in the answer: every run of up to six words that starts with a capital is looked up by exact name.

func EntitiesIn added in v0.7.30

func EntitiesIn(tool, text string) []Entity

EntitiesIn finds the entities in one tool result: JSON objects with a display name and an id (or a tool that names its kind), and a "zone" name. At most maxPerResult, in the order they appear.

func KnownEntities added in v0.7.35

func KnownEntities(cfg Config, char string) []Entity

KnownEntities are the names the character's own data can put on a card: its quest log, gear, bags, NPCs, zone and the entries of its digest.

func Subjects added in v0.7.35

func Subjects(answer string, known []Entity) []Entity

Subjects are the known entities whose names appear in the answer text, in the order they first appear, so the answer's lead subject comes first. A name inside a longer matched name is not a separate subject. Each entity counts once.

type Grounding added in v0.7.43

type Grounding struct {
	Topic    Topic
	Subject  string
	Levels   bool // a level range
	Bosses   bool // bosses or creatures
	Quests   bool // dungeon quests with givers
	Drops    bool // drops for the character
	Spells   bool // the class's spells at the character's level
	Notes    bool // the profession notes
	IcyURL   string
	Pack     string // the facts handed to the model; "" when there are none
	KnowHow  bool
	Browsing bool // the answer was checked against the guides
	Guides   bool // the answer read guide pages
	Web      bool // the answer searched the web
	Rewards  bool // quest rewards the player's own game showed grounded the answer
	Seen     bool // some of the facts are ones the player saw in game (trainers, vendors, gathering, quest givers)
}

Grounding is what the facts of one know-how answer covered; the footer is built from it.

func GroundFor added in v0.7.43

func GroundFor(cfg Config, q Question) Grounding

GroundFor classifies q and, for a know-how question, builds the grounding pack. State questions return the zero Grounding.

func (Grounding) Footer added in v0.7.43

func (g Grounding) Footer() string

Footer is the small source line under a know-how answer, built from what grounded it, never from the model: "Tactics: general WoW knowledge · Levels, bosses, quests and drops: your game". Each part shows only when present; "" when neither is.

func (Grounding) Offer added in v0.7.43

func (g Grounding) Offer() bool

Offer reports whether the answer may carry the Check guides button: a know-how answer about a dungeon, class or profession that has not already been checked.

type Kind added in v0.7.43

type Kind int

Kind is the kind of question: about the player's own state, or about how the game works.

const (
	// KindState is personal ("what should I do", "my gear", "can I make X"): answered strictly from
	// the player's data.
	KindState Kind = iota
	// KindKnowHow is about how the game works (strategy, tactics, boss mechanics, rotations, how a
	// profession works, lore, thinking ahead): the model may use its own WoW knowledge, framed by our facts.
	KindKnowHow
)

type Needs added in v0.7.7

type Needs struct {
	Needs      string   `json:"needs"` // NeedsPlayStyle
	Character  string   `json:"character"`
	Question   string   `json:"question"` // the original question, as asked
	Ref        string   `json:"ref,omitempty"`
	Hook       string   `json:"hook,omitempty"` // for a stat question: "Choose a play style for a stat check"
	Roles      []Option `json:"roles"`
	Activities []Option `json:"activities"`
	Specs      []string `json:"specs,omitempty"` // the class's trees, optional
	Note       string   `json:"note,omitempty"`  // NeedsSpec: the line under the buttons
	Role       string   `json:"role,omitempty"`  // the saved role and focus the choice is saved with; an empty one is still to be asked
	Focus      string   `json:"focus,omitempty"`
}

Needs is the structured response to a question that needs a play style the character does not have. No AI call is made for it: the overlay shows the options as buttons, saves the choice with the profile store (POST /api/profile), and the question is then asked again once, automatically.

func NeedsFor added in v0.7.7

func NeedsFor(c character.Character, q Question) Needs

NeedsFor builds the choices for c.

func PlayStyleNeeded added in v0.7.7

func PlayStyleNeeded(cfg Config, q Question) (Needs, bool)

PlayStyleNeeded is the choices to put to the player instead of an AI call, when q needs a play style the character has not saved; ok is false when it does not, or the character cannot be read (the agent then works as before).

type Option added in v0.7.7

type Option struct {
	Value string `json:"value"`
	Label string `json:"label"`
}

Option is one button: the value saved and the words shown.

type Options added in v0.3.0

type Options struct {
	Length string // brief, standard (default) or detailed
	Tier   string // efficient (default), balanced, best or custom
	Custom string // the model name for TierCustom
	// Reasoning is the reasoning level (low, medium or high); low is the default. It is passed only
	// to a client that has a flag for it, see reasoningFor.
	Reasoning string
	// contains filtered or unexported fields
}

Options are the per-ask settings the player controls. The zero value is Standard and Efficient.

func (Options) AnswerLimit added in v0.3.0

func (o Options) AnswerLimit() int

AnswerLimit is the most characters an answer of this length is kept to.

func (Options) Normalize added in v0.3.0

func (o Options) Normalize() Options

Normalize replaces an unknown value by its default; a custom tier without a usable model name (it is passed as a flag value, so it must look like a model name) falls back to Efficient.

type QKind added in v0.7.125

type QKind int

QKind is what a question is about: the character's own state, the game world, or both.

const (
	// Personal questions are about this character (bags, gear, level, quest log, plan, money, what next):
	// the capture and plan answer them, with no web search.
	Personal QKind = iota
	// World questions are about the game (where, how to get, what drops, which quest, trainers, vendors):
	// the web is searched first.
	World
	// Mixed questions need a world fact and the character's own state.
	Mixed
)

func KindOf added in v0.7.125

func KindOf(text string) QKind

KindOf classifies a question by rules: a world cue and a personal cue make it Mixed. A question with neither is World only when the old data-gap rules (WebGap) say the facts cannot answer it, else Personal.

func (QKind) SearchesFirst added in v0.7.125

func (k QKind) SearchesFirst() bool

SearchesFirst reports whether a question of kind k is answered from a web search first.

func (QKind) String added in v0.7.125

func (k QKind) String() string

type Question

type Question struct {
	ID        string
	Character string
	Text      string
	AskedAt   int64
	Answered  bool
	// Ref is the subject the question is about (a digest entry's ref, see docs/digest.md); empty for a
	// free-typed question. The advisor expands it into the entry's facts.
	Ref string
	// Icy is set when the player pressed Check guides: the same question is asked again and the AI
	// client may read the matching WoW Forever guide at runtime.
	Icy bool
}

Question is one queued question.

type Registry added in v0.3.0

type Registry interface {
	// Paths are the user's and the system's PATH values, %VAR% references already expanded.
	Paths(getenv func(string) string) []string
}

Registry reads the PATH the machine's settings hold, as opposed to the one this process was started with. A fake stands in for it in tests so they run on any OS.

type Source added in v0.7.109

type Source struct{ Title, URL string }

Source is a guide page an answer read: its title and address.

func GuidePages added in v0.7.109

func GuidePages(urls []string) []Source

GuidePages are the allowed guide pages among urls (what a client's own tool read), as sources.

func MergeSources added in v0.7.115

func MergeSources(a, b []Source) []Source

MergeSources is a and b together, in order, without a repeated address.

type Topic added in v0.7.43

type Topic string

Topic is what a know-how question is about.

const (
	TopicNone       Topic = ""
	TopicDungeon    Topic = "dungeon"
	TopicClass      Topic = "class"
	TopicProfession Topic = "profession"
	TopicLevelUp    Topic = "levelup"
	TopicSession    Topic = "session"
	TopicTriage     Topic = "triage"
)

type Trace added in v0.7.30

type Trace struct {
	// contains filtered or unexported fields
}

Trace collects the entities seen in one ask's tool calls and results, oldest first.

func (*Trace) Add added in v0.7.30

func (t *Trace) Add(tool, text string)

Add records the text a named tool returned.

func (*Trace) Entities added in v0.7.30

func (t *Trace) Entities() []Entity

Entities is what was seen, oldest first.

func (*Trace) Result added in v0.7.30

func (t *Trace) Result(id, text string)

Result records the text a tool returned for the call id.

func (*Trace) Saved added in v0.7.35

func (t *Trace) Saved() string

Saved is the line a successful set_character_profile call returned in this ask ("" when none did).

func (*Trace) Use added in v0.7.30

func (t *Trace) Use(id, tool string)

Use records a tool call (stream-json "tool_use") so its result can be matched to the tool.

type Usage added in v0.3.0

type Usage struct {
	Tokens   int      // input, output and cache tokens together
	In       int      // fresh input: new input plus tokens written to the cache
	Out      int      // output
	Cached   int      // tokens read from the cache
	CostUSD  float64  // total_cost_usd, when reported
	Model    string   // the model that ran: reported by Claude, else the one the command line selected
	Notice   string   // a one-line notice for the player, e.g. a rejected flag that was dropped
	Saved    string   // the line a successful set_character_profile returned, for the end of the answer
	Pages    []string // the web pages a CLI client read for the guides, in order
	Sources  []Source // the guide pages the fetch tool read for an API client, in order
	Check    string   // the guide check's note: no page matched, or a fetch failed; "" when the client reported none
	Searches int      // web searches the answer ran (the provider's, Claude Code's or Gemini's own)
	Checked  bool     // an API client ran a guide check, so Check is complete
	Entities []Entity // what the answer's tools touched, oldest first (empty when the client shows no tool trace)
}

Usage is what the CLI reported for one ask. Tokens is zero when it reported nothing.

func RespondUsage added in v0.3.0

func RespondUsage(ctx context.Context, cfg Config, q Question, prompt string, stream bool, onText func(string)) (text string, streamed bool, usage Usage, err error)

RespondUsage is Respond that also returns the token usage Claude's stream-json result reports.

With cfg.Fallback set, a client that cannot start (no key, not reachable, key refused, no such program) hands over to the next one, and the usage notice says so.

func (Usage) Line added in v0.3.0

func (u Usage) Line() string

Line is the small muted text shown under an answer ("≈4k in · 0.6k out · 52k cached · haiku"; only the total when the CLI gave no split), empty with neither tokens nor a model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL