docs(notion-search): add /notion-search slash command + CLAUDE.md section
Slash command at custom-skills/31-notion-organizer/commands/notion-search.md documents the CLI surface and JSON output schema. CLAUDE.md gains a Semantic Search section explaining the 4-stage pipeline and env var requirements. requirements.txt notes the optional anthropic SDK dependency (the skill falls back to the claude CLI if missing). Final task of Phase 3b-i. 30 tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,42 @@ python scripts/schema_migrator.py --source [DB_ID] --target [DB_ID] --dry-run
|
||||
python scripts/async_organizer.py --database [DB_ID] --action cleanup
|
||||
```
|
||||
|
||||
## Semantic Search
|
||||
|
||||
```bash
|
||||
# Default browse mode (terminal table)
|
||||
python scripts/notion_search.py "AI agents in 2026"
|
||||
|
||||
# JSON output for piping
|
||||
python scripts/notion_search.py "AI agents" --json | jq '.[].id'
|
||||
|
||||
# Constrain to specific databases
|
||||
python scripts/notion_search.py "MCP" --databases f8f19ede-32bd-43ac-9f60-0651f6f40afe
|
||||
|
||||
# Property filter
|
||||
python scripts/notion_search.py "MCP" --databases ID \
|
||||
--filter '{"Status": "Done", "Topic": "AI"}'
|
||||
|
||||
# Fast mode (skip LLM stages)
|
||||
python scripts/notion_search.py "exact term" --no-rerank --no-expand
|
||||
```
|
||||
|
||||
The search runs four stages:
|
||||
|
||||
1. **Expand** — Claude Haiku generates up to 5 query variants (synonyms + cross-language KR↔EN)
|
||||
2. **Search** — Notion API searched per variant; results unioned + deduped at 30 candidates
|
||||
3. **Enrich** — title, properties, and 200-char excerpt fetched per candidate
|
||||
4. **Rerank** — Claude Haiku scores candidates against the *original* query; top N returned
|
||||
|
||||
Results are cached for 24h (SHA256 of query + candidate IDs). Bypass with `--no-cache`.
|
||||
|
||||
### Requirements
|
||||
|
||||
| Env var | Purpose |
|
||||
|---------|---------|
|
||||
| `NOTION_API_KEY` (or legacy `NOTION_TOKEN`) | Notion integration token |
|
||||
| `ANTHROPIC_API_KEY` (optional) | Use Claude SDK directly. If missing, the skill falls back to `claude -p` CLI. |
|
||||
|
||||
## Scripts
|
||||
|
||||
| Script | Purpose |
|
||||
|
||||
Reference in New Issue
Block a user