Skip to main content

Knowledge Graph queries

Pulse exposes 14 read-only KG tools:
  • 9 primary query tools — typed, opinionated answers to the questions agents ask most often.
  • 5 power tools — escape hatches for arbitrary Cypher, natural-language search, schema introspection, grounding verification, and a reflective retrieve-critic stub.
Permissions are dotted-string flags in the granular registry (okto-pulse-core/src/okto_pulse/core/infra/permissions.py:PERMISSION_REGISTRY):
  • The 9 primary tools sit under kg.query.* — granted as a wildcard or per-tool (kg.query.decision_history, kg.query.global, …).
  • The 5 power tools split across kg.power.natural, kg.power.schema_info, kg.power.cypher. kg.power.cypher is the most restricted and is typically excluded from default presets.
  • kg.power.cypher and the natural-language tool also write to the per-node hit counter that feeds relevance_score over time — every read result you take from these tools is logged.
None of these tools write graph data. None of them call an LLM at runtime — every primary tool is a deterministic combination of HNSW vector search and graph traversal. (kg_query_reflective is the sole exception and is a V1 stub.) For the schema (11 node types, 10 rel types + belongs_to, 5 HNSW indexes) and tool inventory, see overview.

Primary query tools (9)

Source: okto-pulse-core/src/okto_pulse/core/mcp/kg_query_tools.py:register_kg_query_tools. Citations below reference 80-pulse-feature-inventory.md:519–531.

okto_pulse_kg_get_decision_history

Trace decisions about a topic over time. Hybrid HNSW + title-CONTAINS search, results ordered chronologically with supersedence chain summaries.
2-hop neighborhood traversal around a single node. Supports edge type filter, direction filter, max depth (default 2, cap 4).

okto_pulse_kg_get_supersedence_chain

Walk the supersedes chain for a decision (max depth 10). Returns nodes in newest-to-oldest order.

okto_pulse_kg_find_contradictions

Find contradicts edges. With no node_id, returns all contradiction pairs on the board. With node_id, returns the pairs anchored at that node.

okto_pulse_kg_find_similar_decisions

Hybrid ranked similarity. The reranking formula is fixed in kg_service.py:244:
This is the search reranking score, not the persisted relevance_score on each node — do not conflate the two (80-pulse-feature-inventory.md:957).

okto_pulse_kg_explain_constraint

Returns the origin spec/decision for a Constraint node, related constraints, and any Bug nodes that record violations of it.

okto_pulse_kg_list_alternatives

For a Decision, return the Alternative nodes that were considered and discarded, with the recorded reason_discarded.

okto_pulse_kg_get_learning_from_bugs

Trace Learning nodes derived from bugs in an area, via Learning → Bug validates edges.

okto_pulse_kg_query_global

Cross-board semantic search via the global discovery layer (~/.okto-pulse/global/discovery.lbug). ACL-filtered: only returns nodes from boards the calling agent’s API key can read.

Power tools (5)

Source: okto-pulse-core/src/okto_pulse/core/mcp/kg_power_tools.py:register_kg_power_tools. Citations: 80-pulse-feature-inventory.md:535–543. These are escape hatches. Reach for them when the typed primary tools don’t cover the question, when you need full schema introspection, or when you need to verify an answer is grounded in actual graph data.

okto_pulse_kg_query_cypher

Read-only Cypher against the board graph. Safety rails:
  • Write keywords (CREATE, DELETE, MERGE, SET, REMOVE) are rejected by whitelist.
  • LIMIT is auto-injected if the query lacks one.
  • Variable-length paths bounded to *..20.
  • 30-second timeout.
  • 30 requests / minute / agent rate limit.
kg_query_cypher is the broadest read tool — but the typed primary tools above are faster and safer for the common patterns. Reach for Cypher only when the typed tools genuinely don’t fit.

okto_pulse_kg_query_natural

Plain-English question against the graph. Hybrid embedding + HNSW + 1-hop traversal expansion. No LLM — deterministic.

okto_pulse_kg_schema_info

Schema introspection. Use this to assert the live schema version before issuing version-specific Cypher, or to discover new node/edge types after an upgrade.

okto_pulse_kg_verify_grounding

Verify that an agent-generated answer is actually backed by retrieved KG nodes. V1: deterministic entity check + Jaccard fallback at 0.7 threshold.

okto_pulse_kg_query_reflective

V1 stub of the reflective retrieve-critic loop. Returns a single retrieve+critic pass. The full multi-step loop requires an LLM callable wired through the Python API — this MCP variant is intentionally a thin stub.

Choosing a tool


Determinism note

Every primary query and every power tool except kg_query_reflective is deterministic over a fixed graph state. Same board_id + same input + same graph.lbug snapshot = same output. This is what makes the KG safe to depend on for long-horizon agent decisions.

Next steps

Consolidation

Write nodes and edges into the graph through transactional sessions.

Health & migration

Operate the consolidation pipeline: queue depth, dead-letter, decay tick, schema migration.
Last modified on May 8, 2026