Quira Quira Docs
GitHub Star

Graph Query API

Prerequisites

Make sure you've read Context Graph and Plugin API before this section.

This is the detailed reference for every method on the quira.graph namespace. The Graph Query API provides programmatic access to the Context Graph. All methods return Promises.

Alpha API

These APIs are under active development. Method signatures may change before v1.0. Pin your extension to a specific Quira version if you depend on these APIs.

quira.graph.query(question, options?)

Submit a natural language query against the Context Graph. Returns an AI-generated answer with cited sources.

ParameterTypeDescription
questionstringNatural language question
options.maxNodesnumberMaximum context nodes to consider (default: 50)
options.dateRange{ from: string, to: string }ISO 8601 date range filter

Returns: Promise<QueryResult>

const result = await quira.graph.query(
  "What did I read about WebGPU this week?",
  { maxNodes: 20 }
);

// result.summary   -> AI-generated answer string
// result.sources   -> [{ url, title, visitedAt, dwellTime }]
// result.nodes     -> [ContextNode] matched nodes
// result.confidence -> number (0.0 - 1.0)

quira.graph.getRelated(url, options?)

Get nodes related to a given URL by traversing the Context Graph edges.

ParameterTypeDescription
urlstringURL of the source node
options.hopsnumberMax edge traversal depth (default: 2)
options.limitnumberMax nodes to return (default: 10)
options.minWeightnumberMinimum edge weight threshold (default: 0.0)

Returns: Promise<ContextNode[]>

const related = await quira.graph.getRelated(
  "https://docs.rs/wgpu/latest/wgpu/",
  { hops: 2, limit: 5, minWeight: 0.3 }
);

quira.graph.getNode(id)

Retrieve a single Context Graph node by its ID.

ParameterTypeDescription
idstringUUID v7 of the context node

Returns: Promise<ContextNode | null>

const node = await quira.graph.getNode("019503a1-b2c3-7def-8901-234567890abc");

if (node) {
  console.log(node.title);       // "WebGPU Best Practices"
  console.log(node.ai_summary);  // "This article covers..."
  console.log(node.ai_entities); // ["WebGPU", "WGSL", "compute shaders"]
  console.log(node.dwell_time);  // 342 (seconds)
}

Full-text search across Context Graph nodes using FTS5. Unlike query(), this performs keyword search without AI summarization.

ParameterTypeDescription
querystringFTS5 search query string
options.limitnumberMax results (default: 20)
options.domainstringFilter by domain
options.dateRange{ from: string, to: string }ISO 8601 date range filter

Returns: Promise<ContextNode[]>

const results = await quira.graph.search("authentication OAuth", {
  limit: 10,
  domain: "docs.rs"
});

quira.graph.export(options?)

Export the Context Graph or a subset of it in JSON or Markdown format.

ParameterTypeDescription
options.format"json" | "markdown"Export format (default: "json")
options.nodeIdsstring[]Specific node IDs to export (omit for all)
options.includeEdgesbooleanInclude edge data (default: true)

Returns: Promise<string>

// Export entire graph as JSON
const json = await quira.graph.export({ format: "json" });

// Export specific nodes as Markdown (for Obsidian import)
const md = await quira.graph.export({
  format: "markdown",
  nodeIds: ["019503a1-...", "019503a2-..."],
  includeEdges: false
});
Was this page helpful?
Ask AI
Q

Ask anything about the documentation

Ctrl+K to open anytime