AGENT SKILL

retrieval-hybrid

Run the §7.4 hybrid pipeline (structural filter → BM25/FTS5 → local semantic → citation graph → RRF fusion → local rerank → MMR) for one query, returning ranked candidates with full source provenance. Invoke whenever a skill needs to fetch passages from any matter (private or public) before drafting.

License 许可
CC-BY-4.0
所属仓库
KairosPan/kairos
最近更新
2026-07-08
Stars
★ 0
Forks
0

01 前言 Front Matter

a2a
{ "expose": false, "endpoint_path": null }
name
retrieval-hybrid
inputs
{ "$ref": "./schemas/inputs.json" }
limits
{ "max_tokens": 4000, "max_latency_seconds": 30 }
models
{ "fallback": "claude-opus-4-7", "forbidden": [], "preferred": "deepseek-v4-flash" }
safety
{ "upl_check": "not-applicable", "disclaimer": "legal-research-only", "matter_scope": "enforced", "citation_verification": "not-applicable", "jurisdiction_consistency": "advisory" }
license
CC-BY-4.0
outputs
{ "$ref": "./schemas/outputs.json" }
version
0.1.0
eval_set
./evals/retrieval-hybrid-v1.jsonl
triggers
{ "keywords": [ "hybrid retrieval", "retrieve passages", "ranked candidates", "bm25 semantic" ] }
languages
[ "en", "zh" ]
optimizer
{ "L2_rag": "enabled", "L4_model": "shadow", "L1_prompt": "enabled", "L3_routing": "enabled", "L6_self_mod": "disabled", "L5_synthesis": "disabled" }
retrieval
{ "fusion": "rrf", "layers": [ "structural", "lexical", "semantic", "citation_graph", "rerank", "mmr" ], "rerank": { "cloud": null, "local": "bge-reranker-v2-m3" }, "embedding": { "cloud": null, "local": "bge-large-v1.5", "cloud_allowed_corpus": [ "public" ] }, "mmr_lambda": 0.5, "matter_isolation": "required", "citation_required": true }
risk_tier
low
maintainer
kairos-core
risk_class
low
visibility
public
description
Run the §7.4 hybrid pipeline (structural filter → BM25/FTS5 → local semantic → citation graph → RRF fusion → local rerank → MMR) for one query, returning ranked candidates with full source provenance. Invoke whenever a skill needs to fetch passages from any matter (private or public) before drafting.
display_name
Hybrid Retrieval Pipeline
golden_cases
[]
strict_model
false
target_users
[ "lawyer", "researcher", "student" ]
default_model
claude-opus-4-7
jurisdictions
[ "agnostic" ]
allowed_models
[ "claude-opus-4-7", "deepseek-v4-pro", "deepseek-v4-flash" ]
practice_areas
[]
required_skills
[]
requires_skills
[]
requires_sandbox
false
side_effect_class
pure_read
required_connectors
[ "kairos/free-law-project", "kairos/cn-statutes", "kairos/eu-legislation" ]
requires_connectors
null

02 资源文件 7

03 SKILL.md 正文

Hybrid Retrieval

When to use

Anytime a downstream skill (statute-compare, case-retrieve, contract-review) needs ranked passages with provenance. Never call this skill from a user-facing chat; it is composed.

Workflow (matches §7.4.1 layered chain)

  1. Structural filter — apply jurisdictions, doc_types, practice_areas, matter_id against SQLite/LanceDB.
  2. Lexical recall — BM25 over FTS5 (parallel exact-citation match + free-text).
  3. Semantic recall — local BGE-large-v1.5 embedding × LanceDB cosine top-50.
  4. Citation graph expansion — KuzuDB 1-hop neighbours of the structural-filter candidates.
  5. Fusion — Reciprocal Rank Fusion across BM25 + semantic + graph.
  6. Local rerank — bge-reranker-v2-m3 cross-encoder, top-20.
  7. MMR diversification — λ=0.5, top-10.

Output contract

List of { doc_id, passage, score, source_uri, source_locator, jurisdiction, doc_type, matter_id } rows. The harness will pass these to citation-verify before any user-visible text is generated.

Hard rules

  • matter_id is required (database-design §3.4.5). The harness rejects this skill if matter_id is missing.
  • Privileged docs (confidentiality: privileged) never appear in semantic results — only exact doc_id lookup; per database-design §3.2.
  • Cloud embedding/rerank only fire when corpus.confidentiality == public AND node policy permits (defaults to OFF).

04 同仓库更多 Skills

KairosPan
KairosPan/kairos

statute-compare

Compare statutory provisions on the same topic across two or more jurisdictions. Invoke when the user asks "regulation / comparison / difference / similarities and differences of X in A/B/C jurisdictions". Covers five dimensions: scope of application, elements, exceptions, penalties, effective date.

★ 0
KairosPan
KairosPan/kairos

setup-interview

On first install/subscription of a skill, run a guided interview to learn the lawyer's playbook (jurisdiction / citation style / risk tolerance / output preferences) and write the answers to user/firm preferences. Mirrors the Anthropic plugin setup-interview UX. Feeds the §5 self-improving feedback source.

★ 0
KairosPan
KairosPan/kairos

query-parser

Extract structured legal-research facets (jurisdiction, doc_type, citation_id, date_range, practice_area, matter_id) from a natural-language query. Invoked first by every retrieval-bearing skill (statute-compare, case-retrieve, ...).

★ 0
KairosPan
KairosPan/kairos

document-intake

Advisory guidance on getting a document into a matter's private index: which file formats are supported, how confidentiality levels behave (privileged documents are stored but never FTS-indexed, per database-design §3.2), and where to upload. The actual ingestion + extraction + indexing is performed by the conversation file-upload route, NOT by this skill — this skill only explains the path.

★ 0
KairosPan
KairosPan/kairos

disclaimer-injector

Inject the appropriate legal disclaimer (legal-research-only, in-house-counsel-only, or academic-use) into the trailing `disclaimer` field of a draft response. Mandatorily run by the Safety Gate; skill authors should not invoke directly.

★ 0
KairosPan
KairosPan/kairos

contract-risk-annotate

Take an extracted clause list and annotate each clause with jurisdiction-aware risks (governing law mismatch, unenforceable non-compete under target jurisdiction, missing carve-outs, one-sided indemnification, etc.). Invoked after contract-clause-extract; uses statute-compare under the hood when the user asks for cross-jurisdiction risk.

★ 0