Search from current directory upward to find indexed codebase
Semantic search from current directory upward to find the nearest code index. Use when working in subdirectories to locate and search the closest indexed codebase.
/plugin marketplace add cadrianmae/claude-marketplace/plugin install semantic-search@cadrianmae-claude-marketplace<query>Search from current directory upward to find and search the nearest semantic index. Shows where the index was found for transparency.
/semq:here <query>
Arguments:
query - Natural language description of what to find (required).odino/Difference from /semq:search:
/semq:search - Assumes you know where the index is/semq:here - Explicitly shows index location (useful from subdirectories)Search from subdirectory:
cd src/utils/
/semq:here validation functions
Find authentication from deep directory:
cd src/routes/api/v1/
/semq:here authentication logic
# Helper function to find .odino directory with verbose output
find_odino_root_verbose() {
local dir="$PWD"
local depth=0
while [[ "$dir" != "/" ]]; do
if [[ -d "$dir/.odino" ]]; then
echo "FOUND:$dir"
return 0
fi
# Stop at git root as a boundary
if [[ -d "$dir/.git" ]] && [[ ! -d "$dir/.odino" ]]; then
echo "NOTFOUND:git-boundary:$dir"
return 1
fi
dir="$(dirname "$dir")"
depth=$((depth + 1))
# Safety limit
if [[ $depth -gt 20 ]]; then
echo "NOTFOUND:max-depth"
return 1
fi
done
echo "NOTFOUND:filesystem-root"
return 1
}
# Get query from arguments
QUERY="$*"
if [[ -z "$QUERY" ]]; then
echo "Error: Query required"
echo "Usage: /semq:here <query>"
exit 1
fi
# Show current location
echo "Searching from: $PWD"
echo ""
# Find index with verbose output
RESULT=$(find_odino_root_verbose)
EXIT_CODE=$?
if [[ $EXIT_CODE -eq 0 ]]; then
ODINO_ROOT="${RESULT#FOUND:}"
# Show where index was found
if [[ "$ODINO_ROOT" == "$PWD" ]]; then
echo "ā Index found in current directory"
else
# Calculate relative path for clarity
REL_PATH=$(realpath --relative-to="$PWD" "$ODINO_ROOT")
echo "ā Index found at: $REL_PATH"
fi
echo " Location: $ODINO_ROOT"
echo ""
# Run search
RESULTS=$(cd "$ODINO_ROOT" && odino query -q "$QUERY" 2>&1)
if [[ $? -eq 0 ]]; then
echo "$RESULTS"
echo ""
echo "š” Tip: File paths are relative to: $ODINO_ROOT"
else
echo "Search failed:"
echo "$RESULTS"
fi
else
# Parse failure reason
REASON="${RESULT#NOTFOUND:}"
echo "ā No semantic search index found"
echo ""
case "$REASON" in
git-boundary:*)
GIT_ROOT="${REASON#git-boundary:}"
echo "Searched up to git repository root: $GIT_ROOT"
echo "The repository is not indexed."
;;
filesystem-root)
echo "Searched all the way to filesystem root"
echo "No index found in any parent directory."
;;
max-depth)
echo "Reached maximum search depth (20 levels)"
echo "Index might be higher up or doesn't exist."
;;
esac
echo ""
echo "To create an index, navigate to your project root and run:"
echo " cd <project-root>"
echo " /semq:index"
fi
From subdirectory:
Searching from: /home/user/project/src/utils
ā Index found at: ../..
Location: /home/user/project
Score: 0.87 | Path: src/utils/validation.js
Score: 0.81 | Path: src/middleware/validate.js
Score: 0.74 | Path: src/schemas/user.js
š” Tip: File paths are relative to: /home/user/project
No index found:
Searching from: /home/user/project/src/utils
ā No semantic search index found
Searched up to git repository root: /home/user/project
The repository is not indexed.
To create an index, navigate to your project root and run:
cd <project-root>
/semq:index
Use /semq:here when:
Use /semq:search when:
Traversal stops at:
.odino/ directory found (success).git/ directory without .odino/ (git repository boundary)/ (no more parents)Why stop at git root?
/semq:search <query> - Search without traversal info/semq:status - Check index status/semq:index - Create index"Searched up to git repository root"
/semq:index from the git root"Searched all the way to filesystem root"
/semq:index"Reached maximum search depth"