okf-consume
GitHub基于OKF包回答关于指标、策略等概念的问题,并报告每个概念的信任度、新鲜度和验证状态。适用于用户指向OKF目录或询问定义值及过时概念时。
触发场景
安装
npx skills add open-knowledge-format/open-knowledge-format --skill okf-consume -g -y
SKILL.md
Frontmatter
{
"name": "okf-consume",
"license": "Apache-2.0",
"metadata": {
"version": "0.1.0",
"publisher": "google"
},
"description": "Answer questions from an Open Knowledge Format (OKF) bundle, a directory of Markdown files with YAML frontmatter, and report the provenance, trust tier, freshness, and attestation status of every concept used. Use this skill when the user points at an OKF bundle or at a directory of Markdown files with index.md files and frontmatter type fields; asks what a metric, table, policy, or procedure means according to that bundle; asks for a number that the bundle defines with an Attested Computation; or asks which concepts are stale, deprecated, or unverified."
}
Answer from an OKF bundle
This skill only reads a bundle. If the task is to create, change, repair, migrate, or verify a bundle, stop and use the okf-generate skill instead.
This skill answers questions from an OKF v0.3 bundle and reports how far the reader can trust each concept that it used. The specification is SPEC.md in the OKF repository. references/trust.md gives the exact trust, freshness, conflict, path, and value rules.
Rules
- Answer from the bundle. If the bundle does not cover the question, say so. Label any statement from general knowledge as general knowledge.
- Report trust. For each concept that you use, report its trust tier, its status, and whether it is stale.
- Do not write your own computation or executor. If an Attested Computation defines a value, supply only its parameter values. Do not write or edit a query for that value, and run the executor exactly as the bundle gives it.
- Do not reject content. Use a concept even if it has unknown keys, an unknown
type, missing optional fields, or broken links (section 11.2). - Do not change the bundle.
Procedure
1. Find the bundle root
- Look for an
index.mdwith frontmatter. That file marks the bundle root, also when the bundle is a subdirectory of a larger repository. - Read its
okf_version,title, anddescription. The description states the scope of the bundle and when to use it. If you have more than one bundle, use the descriptions to choose. - If there is no root
index.md, use the top directory whose.mdfiles have frontmatter with atypefield. - If
okf_versionis not0.3, read the bundle on a best-effort basis. For version 0.2, an earlier version, or no version, apply the fallbacks in Read an older bundle.
2. Find the relevant concepts
Do not read the whole bundle at once. Use one of these methods:
- Scan script. Run
python3 scripts/scan.py <bundle-root>from this skill's directory. It prints one entry per concept with its ID, type, trust tier, status, freshness, title, and description. Filter with--type,--tag,--grep,--current,--stale,--deprecated, or--unverified. Use--jsonfor structured output. The script needs Python 3.9 or later and PyYAML. - Index files. Read the root
index.md. Then read only theindex.mdfiles of the directories that relate to the question. If a directory has noindex.md, list its files and read the frontmatter of each.
Then open only the concept documents that you need. Before you answer, look for other concepts on the same topic, for example with scan.py --grep, so that you find any conflict.
3. Read each concept
- A concept is a
.mdfile whose frontmatter has a non-emptytype. Skipindex.md,log.md, files without frontmatter ortype, and paths that start with.. - Read the frontmatter first:
type,title,description,resource,tags, and the trust and lifecycle fields. - Read the body: the definition,
# Schema,# Examples, and theComputationsection. - Follow the links that relate to the question, such as definitions, joins, policies, and computations.
- Resolve each link and path field with the rules in references/trust.md. Do not read a path that resolves outside the bundle root from the local file system.
- If a link target does not exist, treat it as missing knowledge, not as an error.
4. Judge trust and freshness
Do these checks for each concept that you use.
-
Trust tier. Use only current verification events. An event is current when its
atis equal to or later thangenerated.at, or whengeneratedis absent.- No current event means unverified.
- Current events from non-
human:actors only, such asteam:orprocess:, mean machine-confirmed. - A current event from a
human:actor means human-reviewed.
If every event is older than
generated.at, say that the concept was verified only before its last change. -
Status. A missing
statusmeansstable.- If the status is
draft, say that the concept is a draft. - If the status is
deprecated, do not present the concept as current. Followsuperseded_byto the replacement. Ifsuperseded_byis absent, look for the replacement in the links and the body. Say that you did this. - If the status is any other value, the concept is not current. Show the raw value.
- If the status is
-
Freshness. The concept is stale when the current time is at or after
stale_after. A date without a time means the start of that day in UTC. Say when the concept became stale. Ifstale_afterdoes not parse, treat the concept as stale and say that the value is malformed. Stale means "check again", not "false". -
Sources. Use the credibility signals of the sources to weigh claims that disagree. They are facts, not scores:
authorshows authority.usage_countoverusage_windowshows liveness. Compare counts only by order of magnitude.last_modifiedshows recency.
5. Resolve conflicts
If two concepts disagree, prefer them in this order. The first difference decides.
- A current concept: its status is
stableordraft. - A higher trust tier: human-reviewed, then machine-confirmed, then unverified.
- A concept that is not stale.
- The later
generated.at.
Tell the user about the conflict and the choice that you made.
6. Get a value from an attested computation
If the question asks for a value, and an Attested Computation produces it, do these steps:
- Load. Read
runtime,parameters,executor, andattester. Find the computation:- If
computationis present, the computation is the file that it names. - Otherwise, it is the first fenced code block in the section with the heading
Computation, at any heading level. - If neither exists, the concept is not attestable. Say so.
- If
- Parameterize. Supply values for the declared parameters only. If a required value is not clear, ask the user. Do not change the computation, add filters, or write a different query.
- Execute. Follow the instructions or code at
executor.resourceexactly. Do not modify it, replace it, or write a substitute, even to repair it. Bind the parameters the way that the runtime expects, for example as BigQuery named parameters, not as text in the query. Collect the receipt fields thatexecutor.receiptlists. - Attest. Run the code at
attester.resourceon the receipt and on the value that you plan to show. It returns a mapping withokand an optionalreason. Do not imitate the attester. Run it. - Gate. Use the table in references/trust.md:
- If the attestation fails, do not show the value in any form, even inside an explanation. Show the reason.
- If the concept has no
runtimeor noattester, never call the value attested. - If the computation is stale, warn the user before you show the value.
- If the attestation passes, show the value with the verdict and a receipt reference, such as the job ID.
- If you cannot execute, for example because you have no credentials or no executor, do not write your own query. Show the computation with the parameter values bound, and say that it did not run and is not attested.
verified and attestation answer different questions. verified shows that a person or a process confirmed the definition. Attestation shows that one run used the sanctioned computation. Report both.
7. Answer
Give the answer first. Then list the items below. Write each OKF term exactly as it appears here, not as a paraphrase.
- Concepts used: each concept ID with its trust tier (
unverified,machine-confirmed, orhuman-reviewed), its status, and its freshness. The trust tier describes the definition. When a value comes from an Attested Computation, also writeattestedornot attested. That result describes this run. - Citations: for each footnote label
[^id]that supports the answer, thetitleandresourceof thesourcesentry with thatid. - Gaps: the parts of the question that the bundle does not cover.
Read an older bundle
A bundle that declares okf_version 0.2 or earlier, or that declares no version, can use these fallbacks (section 12.1):
- If a path field has no leading
/and does not resolve from the directory of its file, resolve it from the bundle root. - If
generatedis absent, usetimestampas the time of the last change. - If
sourcesis absent, read the# Citationslist in the body.
A concept with no trust fields is unverified. It is still usable.
Bundles in other systems
A search index or a data catalog can also serve a bundle. Apply the same rules to the copy that you read. The connectors/ directory of the OKF repository has guides for specific systems, such as Google Cloud Knowledge Catalog.
版本历史
- 527e81a 当前 2026-11-24 11:34


