界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

knowledge-grounding

knowledge-grounding

【效率与协作】Use when checking what knowledge sources are available (wikis, docs, Confluence, Jira, vector stores, internet), determining grounding mode (internal-only vs full), routing queries to the best source, or flagging ungrounded answers. Covers source discovery, air-gap detection, grounding tiers (verified/grounded/inferred/training-only), and strict_airg…

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: knowledge-grounding description: Use when checking what knowledge sources are available (wikis, docs, Confluence, Jira, vector stores, internet), determining grounding mode (internal-only vs full), routing queries to the best source, or flagging ungrounded answers. Covers source discovery, air-gap detection, grounding tiers (verified/grounded/inferred/training-only), and strict_airgap enforcement.

Knowledge Grounding -- Source Discovery and Answer Provenance

Overview

Discovers available knowledge sources, produces a manifest, routes queries to the best source, and flags ungrounded answers. Companion to env-adoption (which handles tool availability). Two-tier state: persistent manifest (~/.claude/state/sources.json) and volatile session state ($XDG_RUNTIME_DIR/knowledge-grounding/session-<id>.json).

When to Use

  • Session start (after env-adoption) -- discover available knowledge sources
  • Before answering factual questions -- check what sources can ground the answer
  • On air-gapped / enterprise systems -- detect what is reachable
  • When a query returns training-only results -- flag explicitly with tier
  • When strict_airgap: true -- enforce user override for ungrounded answers

When NOT to Use

  • Do not replace wiki auto_consult -- this skill composes with .wiki-link behavior
  • Do not use for tool availability -- that is env-adoption
  • Do not use for search execution -- that is web-research, wiki, confluence-rest-api

Operations

OperationCommandPurpose
discoverbash ~/.claude/skills/knowledge-grounding/scripts/discover.sh discoverScan local sources, internet canary, write manifest
statusbash ~/.claude/skills/knowledge-grounding/scripts/discover.sh statusHuman-readable knowledge landscape
getbash ~/.claude/skills/knowledge-grounding/scripts/discover.sh get <path>Shell-friendly accessor (thin jq wrapper)

discover flags

FlagEffect
--forceRe-probe even if manifest is fresh (<24h)
--remoteAlso probe remote endpoints immediately (adds latency)
--silentNo stdout, just write state files
--jsonOutput combined manifest + session as JSON

get paths

discover.sh get internet_reachable           # true/false
discover.sh get grounding_mode               # internal-only / full
discover.sh get strict_airgap                # true/false
discover.sh get sources.wiki_trading.path    # /path/to/wiki
discover.sh get sources.internet.reachable   # true/false
discover.sh get session.active_sources       # JSON array

Routing Logic (per-query priority)

When answering a factual question, check sources in this order. Stop at the first tier that produces a match. Combine if multiple tiers contribute.

PrioritySource TypeCheckSkill/Tool
1Wiki (auto_consult first)grep for keywordswiki skill
2Project docs (local)grep docs/, PROJECT.md, COMPONENT.mdRead/Grep
3Git repo docs (local)grep configured doc_pathsRead/Grep
4Vector storesemantic search if configuredresearch-vectorization
5Confluence (remote, lazy)CQL searchconfluence-rest-api
6Jira (remote, context)JQL searchjira-rest-api
7Internetweb searchweb-research (only if internet_reachable: true)
8Training dataalways availableflag explicitly as tier 4

Manifest provides facts only. This routing logic decides per-query.

Grounding Tiers

TierLabelMeaningWhen to use
1verifiedDirect match in wiki, Confluence, or git docs with citationSource found, content matches query
2groundedPartial match or semantic similarity from vector/multi-sourceRelated content found, synthesized
3inferredCross-referenced from multiple weak signalsNo direct match, patterns align
4training-onlyNo internal source -- model training knowledge onlyNothing found; flag explicitly

Every answer should include grounding metadata:

  • [Grounding: verified | source: wiki_trading/page-name]
  • [Grounding: training-only | no internal sources matched]

In strict_airgap mode (opt-in), tier 4 answers require explicit user override: "No internal source found. This would use model training data (cutoff May 2025). Proceed? [y/n]"

Integration

TouchpointBehavior
CLAUDE.md session startAfter env-adoption, run discover.sh discover --silent
forge step 1Read sources.json, include active sources in shared_context
web-researchCheck internet_reachable before attempting search; suggest local sources if false
wiki auto_consultUnchanged -- grounding skill defers to existing .wiki-link behavior
All answersAppend grounding metadata (tier + source citation) when answering factual questions

See references/integration.md for detailed patterns.

Anti-Patterns

Don'tWhyDo Instead
Replace wiki auto_consultBreaks existing behavior, two routing pathsDefer to .wiki-link, augment with sources
Probe remote endpoints at session startHangs on air-gapped systems, violates <3sLazy probe on first query needing remote source
Bake routing logic into manifest JSONRouting rules change, manifest becomes stale policyManifest = facts, SKILL.md = routing logic
Score confidence by source type aloneStale wiki page is not better than training dataConsider match quality, freshness, provenance
Block on training-only answers by defaultMost systems are not strict air-gapstrict_airgap is opt-in, default=off
Auto-detect enterprise endpointsURLs are not discoverable, wrong guesses waste timeConfig file for enterprise, auto-detect for local

See also

  • rag-architecture — once a vector store is the chosen source, this covers how to build one that retrieves the right thing and how to prove it does.
  • llm-api-optimization — the cost of what you ground with, and when a cached corpus beats retrieval.
我的收藏