Index links, code snippets, and text into your persistent knowledge base.
The knowledge namespace indexes external sources into your vault’s structured knowledge layer. Once indexed, sources are automatically included in memory.surface() and memory.synthesize() results — no separate query required.
from xysq import Xysqwith Xysq() as client: client.knowledge.add(type="link", url="https://...") client.knowledge.list()
Knowledge sources and memories are linked layers. Sources you index here become part of the same vault your memories live in — everything surfaces together.
sources = client.knowledge.list(limit=20, status="indexed")for s in sources: print(f"[{s.source_id}] {s.type}: {s.title or '(no title)'} — {s.status}")
Block until a source finishes indexing (or fails) or the timeout elapses.
final = client.knowledge.wait( source.source_id, timeout=60.0, interval=1.0,)if final.status == "indexed": # Source is now searchable via memory.surface() and memory.synthesize() memories = client.memory.surface("health check standards")
Use wait() in tests or pipelines where you need the source to be searchable before continuing.Parameters
import timefrom xysq import Xysqwith Xysq() as client: # Add sources link = client.knowledge.add( type="link", url="https://docs.python.org/3/library/typing.html", title="Python typing module", ) snippet = client.knowledge.add( type="code", content="from typing import TypeVar\nT = TypeVar('T')", title="TypeVar usage", confidence="high", ) # Wait for indexing client.knowledge.wait(link.source_id, timeout=60.0) client.knowledge.wait(snippet.source_id, timeout=60.0) # Surface from memory — knowledge sources are included automatically memories = client.memory.surface("Python type annotations") for m in memories: print(m.text[:80]) # Synthesize from knowledge result = client.memory.synthesize("How should I use TypeVar?") print(result.answer)