Stellarion
Tools

stellarion_find_similar [Pro]

Find functions most similar to a given function
This is a Pro tool. Requires a Stellarion Pro license. A 180-day free trial starts automatically.

Given a specific function, finds the most semantically similar functions in the codebase. Identify the target function by node ID or by file path and line number. Works across languages.

When to Use

  • To find related implementations when you need to understand a pattern used elsewhere
  • To locate functions that could share a common abstraction
  • When fixing a bug in one function and wanting to check if similar functions have the same bug
  • To find test examples — locate a tested function similar to yours and study its tests

Parameters

ParameterTypeRequiredDefaultDescription
uristringNoFile path of the target function (used with line)
linenumberNoLine number of the target function (used with uri)
nodeIdstringNoGraph node ID of the target function (alternative to uri + line)
limitnumberNo10Maximum number of similar functions to return

Provide either nodeId or both uri and line to identify the target function.

Examples

Find similar functions by file and line

Find functions similar to the one at src/services/auth.ts line 42.

Uses uri and line to locate the function, then returns the 10 most similar functions.

Find similar functions by node ID

Find functions similar to node abc123.

Uses nodeId for precise identification when you have a node ID from a previous query.

Limit results

Show me the 5 most similar functions to processOrder in src/handlers/order.rs.

Sets limit: 5 for a concise result set.

Bug-hunting across similar code

I found a bug in validate_input at src/validators.py line 88.
Find similar functions — they might have the same bug.

Returns semantically similar validation functions that may share the same flaw.

Output Format

Returns a ranked list of similar functions, each containing:

  • Function name — the matched function
  • File path and line number — where it lives
  • Language — which language the function is written in
  • Similarity score — 0.0 to 1.0

Results are sorted by similarity, highest first.

Tips

  • This is a targeted search starting from a specific function — use stellarion_find_duplicates for a broader codebase-wide scan
  • Similarity is based on semantic embeddings, not text matching — functions that do the same thing in different ways will still match
  • Use this to find "family" patterns: if you find a good implementation, search for similar ones that might be worse and could be replaced
  • When a function has no similar matches (all scores below 0.5), it is likely unique logic
  • Combine with stellarion_compare_symbols to do a detailed diff between the original and a similar function