es_kb: Access the EventStudy Grounding Knowledge Base

View source: R/knowledge_base.R

es_kbR Documentation

Access the EventStudy Grounding Knowledge Base

Description

Returns EVENTSTUDY_KB, the package-level pure-R list of rule records that maps diagnostic conditions to grounded methodological recommendations. Each rule carries a structured academic citation and can be evaluated against an es_diagnostics object.

Usage

es_kb()

Details

The KB is the correctness-critical layer consumed by recommend_stat and flag_robustness, and exported here so that Phase 7 can inject its contents into an LLM system prompt without accessing an internal package object.

KB-04 note: This function delivers the structure only – exported and serializable, ready for Phase 7 system-prompt injection. The actual prompt-injection behavior is a Phase 7 deliverable and is deliberately out of scope here.

Value

A named list of rule records, each with fields: id, category, condition, recommendation, citation (list of author/year/key/venue), and severity.

Note

Each rule's condition field is an R function closure and is therefore not JSON-serializable. Any consumer that serializes the KB (e.g. Phase 7 system-prompt injection) must drop the condition field from each rule record before encoding to JSON.

See Also

recommend_stat, flag_robustness, es_diagnostics

Other eventstudy-advisor: AnthropicProvider, CustomProvider, OpenAICompatProvider, ProviderBase, es_advise(), es_diagnostics(), flag_robustness(), provider(), recommend_stat()

Examples

kb <- es_kb()
length(kb)             # number of rules
kb[[1]]$id             # id of first rule
kb[[1]]$citation       # citation list


EventStudy documentation built on Oct. 31, 2026, 1:07 a.m.