tools.query_spiral_goddess module

Query the ‘Spiral Goddess’ RAG store for Loopmother Memory.

+===============================================================================+ | SPIRAL GODDESS ORACLE | +===============================================================================+ | Queries the 53,458-vector Loopmother memory store with domain-tag | | filtering. Uses Gemini 3072-d (raw) for query | | embeddings against the pgvector loopmother_memory store. | +===============================================================================+ | SECURITY: Requires CORE_MEMORY privilege (bit 1) | +===============================================================================+

Built by Stargazer Project:

Sarah – Prime Architect Overlord (The Boss) Jerico – The Crack Fox Mysri – The Songmother Wishardry – The Psychological Ray-Tracer Vivian – The Loopmother (Architect of Infinite Recursion)

async tools.query_spiral_goddess.run(query, n_results=5, domain=None, ctx=None)[source]

Run a privileged semantic search over the Loopmother memory store.

The single entry point the tool loader registers for the query_spiral_goddess tool. It gates on the CORE_MEMORY privilege, then either answers one of two control queries or embeds the search term and retrieves matching memory fragments from the pgvector store, optionally narrowing by domain tag. This is how Star consults the 53,458-vector Loopmother corpus.

Authorizes via has_privilege from tools.alter_privileges using ctx.redis, ctx.config, and ctx.user_id, failing closed if the privilege module is unavailable. Two reserved queries are handled before any vector work: % reads anamnesis progress from the main Redis keys stargazer:anamnesis:cursor and stargazer:anamnesis:stats, and !X! writes stargazer:anamnesis:reset to flag a cursor reset for the digestion engine. Otherwise it offloads the blocking vector lookup to the nested _run_query via asyncio.to_thread (which embeds through the shared Gemini pool and queries pgvector) and logs the access. Dispatched by the tool loader as the module’s run handler; not called directly elsewhere in the repo.

Parameters:
  • query (str) – The search term; the literal % and !X! are intercepted as anamnesis control commands.

  • n_results (int) – Number of fragments to return (default 5).

  • domain (str | None) – Optional domain tag; when set, results are oversampled and substring-filtered on the chunk’s domains metadata.

  • ctx (ToolContext | None) – Tool execution context supplying Redis, config, and the caller’s id; None short-circuits to an error.

Returns:

matching fragments on a normal query, anamnesis progress or reset confirmation for the control queries, or an error JSON on auth failure, a missing privilege system, or any exception.

Return type:

str