360 Secure SkillHub
360 安全技能中心

Memory Semantic Search

核心功能:对工作区Markdown文件进行语义搜索,支持增量索引,可按含义而非关键词查找相关内容、过往决策或笔记;典型场景:跨文件检索相关MD内容、语义式回忆工作区笔记;输入输出:通过CLI命令执行目录索引、提交查询,可返回相关片段或JSON结果,需配置OpenAI兼容嵌入API环境变量,仅支持Markdown文件,不适用非MD、网页或代码搜索。

toller892
toller892
热度 37.00
最近更新 2026-05-11 17:45:14
分类:搜索依赖:代码执行 / 读写文件 / 第三方 API应用场景:笔记整理 / 研究

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add memory-semantic-search
Metadata
name
memory-semantic-search
description
Semantic search over workspace markdown files using embedding API + SQLite vector store. Use when: (1) searching workspace notes/memory by meaning rather than exact keywords, (2) finding related markdown content across files, (3) recalling past decisions, context, or notes semantically. Requires an OpenAI-compatible embedding API. NOT for: searching non-markdown files, web search, or code search.

Memory Semantic Search

Standalone semantic search over workspace .md files. Uses an OpenAI-compatible embedding API and SQLite for vector storage. No external dependencies beyond Python 3 stdlib + the embedding API.

Setup

Set these environment variables (or pass as CLI args):

export EMBEDDING_API_KEY="sk-xxx"
export EMBEDDING_API_BASE="https://api.openai.com/v1"   # any OpenAI-compatible endpoint
export EMBEDDING_MODEL="text-embedding-3-small"          # optional, this is the default

Usage

Index workspace

python3 scripts/index.py /path/to/workspace

Options:

  • --force — full reindex (clear existing data)
  • --db PATH — custom SQLite path (default: memory_search.sqlite in skill dir)
  • --api-base, --api-key, --model — override env vars

Incremental: only new/changed chunks are embedded. Deleted files are cleaned up automatically.

Search

python3 scripts/search.py "your query here"

Options:

  • --top-k N — number of results (default: 5)
  • --min-score F — minimum cosine similarity threshold (default: 0.3)
  • --json — output as JSON
  • --db, --api-base, --api-key, --model — same as index

Typical agent workflow

  1. Run index.py on the workspace (once, or after file changes)
  2. Run search.py "query" to find relevant snippets
  3. Use read tool to load full context from the returned file paths and line numbers