Documentation

Read the source code of your memory.

Docs / core-concepts / semantic-routing

Semantic Planet routing

How Orion automatically assigns knowledge to the right Planet using a 4-strategy routing engine.

When knowledge is written to Orion — via memory.write, brain.think, or the markdown importer — a routing layer automatically determines which Planet it belongs in. The planet parameter is optional in all write paths.

The routing engine

The Planet Assignment Engine runs four strategies in priority order, returning the first match above a confidence threshold:

Priority Strategy Threshold How it works
1 Graphify cluster ≥ 0.75 Runs Graphify to detect semantic clusters via Leiden community detection, then matches cluster labels to Planet descriptions using embedding similarity
2 Entity routing ≥ 0.70 Extracts entities from content, looks up which Planet's stardust mentions those entities most, routes accordingly
3 Keyword match ≥ 0.55 Word overlap between content and Planet descriptions — fast, no embeddings, lower confidence
4 Caller suggestion 0.50 Uses the Planet the caller explicitly specified (backward compatible)
5 Inbox fallback 0.0 Content goes to the Inbox Biome for human review

Each routing decision is logged to routing_log with the method, confidence, and reasoning — enabling transparency and accuracy tracking.

When Graphify runs

Graphify adds value for substantial content but is skipped for short notes:

  • Content has >500 words (long prose)
  • Content has >10 lines of code
  • Content has ≥2 code blocks (mixed markdown)
  • File has a source code extension (.py, .js, .ts, .go, etc.)

For short content, the engine falls through to entity routing or keyword matching.

The Inbox

Every Galaxy has a special Inbox Biome (is_inbox=True) that receives knowledge the engine couldn't confidently route. The Inbox is surfaced in the Galaxy view with an amber badge.

From the Inbox panel, you can:

  • Accept the engine's suggestion
  • Manually route to any Planet
  • See the reasoning behind each routing decision

Corrections are logged to routing_log and improve future routing accuracy.

Backward compatibility

Existing code that passes an explicit planet parameter continues to work — the engine uses it as Strategy 4 (caller suggestion) with confidence 0.50. The routing decision is logged either way.

Routing accuracy

Track routing performance via the API:

curl http://localhost:8000/api/v1/routing/stats

Returns method breakdown, average confidence per method, and correction rate — so you can see how often the engine gets it right and which strategy performs best for your Galaxy.