Skip to content

fix(graph-query-skill): correct schema names to match live graph (stop misleading agents)#51

Merged
colombod merged 2 commits into
mainfrom
fix/graph-query-skill-schema-accuracy
Jul 9, 2026
Merged

fix(graph-query-skill): correct schema names to match live graph (stop misleading agents)#51
colombod merged 2 commits into
mainfrom
fix/graph-query-skill-schema-accuracy

Conversation

@colombod

@colombod colombod commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

The context-intelligence-graph-query SKILL is the schema contract agents load to write Cypher. Because the graph store persists property keys verbatim and Cypher returns null for absent properties without error, wrong names in the doc are silent nulls — agents get empty results, retry, and burn LLM roundtrips with no signal that the schema doc is wrong. A misleading schema doc is worse than a missing one.

This started from a real bug: Prompt.prompt_text is null on every node graph-wide. Investigation showed it was systematic, not isolated.

What was wrong (all confirmed against the LIVE graph: 3,071 sessions · 968,442 nodes)

Documented Reality Live check
Prompt.prompt_text real key is prompt prompt=4676, prompt_text=0
Prompt.started_at real key is occurred_at occurred_at=4676, started_at=0
SkillLoad.loaded_at real key is started_at started_at=1163, loaded_at=0
Orchestrator.name real key is orchestrator orchestrator=68, name=0
RecipeStep.status never written status=0
RecipeRun.current_step actually on RecipeStep placement fix
edge RecipeStep→RecipeRun TRIGGERED real type is SPAWNED TRIGGERED=0, SPAWNED=12
L1 edges HAS_FORK, HAS_TOOL_CALL, HAS_EVENT(ToolCall→Event) never written / not registered types removed

What this PR changes (doc-only; code keys are the contract)

  • Corrects the 4 property renames, removes phantom/misplaced properties, fixes the edge type, removes 3 phantom L1 edges.
  • Fixes 7 example queries that returned null; mixed :SST_EVENT temporal sweeps now use coalesce(started_at, occurred_at) (occurrence nodes use occurred_at, span nodes use started_at).
  • Scope guards to avoid over-correcting: TRIGGERED is retained — it is a real, heavily-used edge for RecipeStep→ToolCall (336) and →Delegation (82); only the →RecipeRun target was wrong. current_step was relocated, not deleted.
  • Bumps skill version 2.0.0 → 2.0.1.

Validation (proof, not assertion)

Every corrected name was re-queried against the live graph and returns populated data: prompt/occurred_at 100%, SkillLoad.started_at 100%, Orchestrator.orchestrator 100%, RecipeStep.current_step 99.5%, RecipeRun.status 100%, SPAWNED edges present, and coalesce(started_at, occurred_at) covers 99.91% of SST_EVENT nodes.

Recommended follow-up (not in this PR)

Add a CI guard that diffs handler upsert_node/upsert_edge dict keys against the SKILL schema tables — this class of doc↔code drift is mechanically detectable and would turn silent nulls into a failing check.

colombod and others added 2 commits July 9, 2026 11:53
…ive graph

Corrects property names and edge types in the documented schema to match what
the code actually writes to the graph, fixing silent nulls that mislead agents.

Fixes:
- Prompt: prompt_text → prompt, started_at → occurred_at
- SkillLoad: loaded_at → started_at
- Orchestrator: name → orchestrator
- RecipeStep/RecipeRun: relocates current_step to RecipeStep, removes phantom
  RecipeStep.status
- RecipeStep→RecipeRun edge: SPAWNED (TRIGGERED retained for real ToolCall and
  Delegation targets)
- Removes 3 phantom Layer-1 edges (HAS_FORK, Session→ToolCall HAS_TOOL_CALL,
  ToolCall→Event HAS_EVENT; retains Session→Event HAS_EVENT)
- Fixes 7 example queries that returned null; adds coalesce(started_at, occurred_at)
  for mixed temporal sweeps

All changes validated against the live production graph (3,071 sessions,
968,442 nodes): every corrected property name now returns populated data.

Bumps skill version 2.0.0 → 2.0.1.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
… reality

Corrected two brittle test assertions to match validated SKILL.md corrections:
- Version pin updated 2.0.0 → 2.0.1
- Removed assertions for phantom Layer-1 edges HAS_FORK and Session→ToolCall
  HAS_TOOL_CALL (confirmed absent across 1.5M live edges via graph validation)
- Retained HAS_EVENT assertion (Session→Event edge, real and validated)

Full unit suite verified locally before push:
  uv run pytest tests/ -m 'not neo4j and not integration' → 1800 passed, 2 skipped
  (Previously-failing tests now pass; no regression)

Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@colombod colombod merged commit 8cb647c into main Jul 9, 2026
3 checks passed
@colombod colombod deleted the fix/graph-query-skill-schema-accuracy branch July 9, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant