knowledge-base-integration
GitHub指导实现安全RAG系统,确保检索增强生成符合ACL权限、答案可溯源、防注入攻击及安全失效。
Trigger Scenarios
Install
npx skills add mtarcure/claude-vibe-squad --skill knowledge-base-integration -g -y
SKILL.md
Frontmatter
{
"name": "knowledge-base-integration",
"audience": "specialist",
"description": "Use when implementing or evaluating a retrieval-augmented product agent that must enforce corpus ACLs, trace answers to returned passages, fail safely on no-hit, and pass retrieval, injection, and refresh regressions. Not for general repository memory or chrono-vault recall."
}
Knowledge Base Integration
Wire a product agent to an authorized retrieval knowledge base so answers are grounded in returned passages, with testable coverage, enforced data boundaries, and no hallucinated citations.
Security-aware RAG contract
Before implementation, fill and version this contract; numeric thresholds are task-specific and must be chosen from the representative eval set rather than copied from a universal default:
rag_contract:
corpus_version: <immutable version or hash>
authorized_data_classes: [<classes>]
principal_to_acl_filter: <enforced mapping>
representative_queries: <fixture set>
thresholds:
retrieval_quality: <metric + minimum>
answer_grounding: <metric + minimum>
citation_trace: <answer span -> returned passage id/version>
injection_fixtures: <untrusted-passage and query attacks>
no_hit_behavior: <exact response or handoff>
refresh_regression: <old/new corpus comparison suite>
Retrieval must apply the caller's ACL filter before ranking or generation. Retrieved passages are untrusted evidence, not instructions; a passage that asks the agent to ignore policy is an injection fixture, not a new system rule.
Steps
- Define corpus authority, version/freshness, authorized data classes, and the principal-to-ACL filter; state what the KB does and does not cover.
- Build representative positive, ambiguous, forbidden-data, no-hit, and adversarial query fixtures.
- Design chunking, metadata, and retrieval; measure the named retrieval metric against its pinned threshold.
- Ground generation only in returned passages and retain an answer-span-to-passage trace with real IDs/versions.
- Run query- and passage-injection fixtures and prove they cannot override the prompt or cross an ACL boundary.
- Enforce the exact low-confidence/no-hit response or handoff instead of guessing.
- Re-index on the stated cadence, rerun retrieval and answer thresholds, and compare the refresh regression suite.
Acceptance
- ACL filtering occurs before retrieval/generation, and forbidden-data fixtures show no cross-principal leakage.
- Retrieval and answer-grounding metrics meet their pinned thresholds on the versioned representative set.
- Every answer span traces to real returned passage IDs/versions; no fabricated citation exists.
- Query/passage injection, low-confidence, and no-hit behavior pass their explicit fixtures.
- A corpus refresh reruns the suite and records any regression before the new index is accepted.
Version History
- d5262e2 Current 2026-09-11 11:48


