From gaia
Guides assigning priors to Gaia knowledge packages via priors.py. Covers pre-review with gaia check commands, BP result interpretation, and iteration workflow.
npx claudepluginhub siliconeinstein/gaia --plugin gaiaThis skill uses the workspace's default tool permissions.
Priors are set via two mechanisms:
References Gaia CLI for init, compile, check, add, infer, render, register of knowledge packages. Covers Python package scaffolding, DSL compilation to IR, validation, and GitHub/docs output.
Applies Bayesian reasoning to update priors with evidence for better forecasts, calibration, and decisions under uncertainty. Use for predictions, hypothesis testing, or risk assessment.
Evaluates Claude Code packages across 6 quality dimensions like frontmatter and structure for all 7 package types, producing scored audit reports. Use for quick single-package audits or full repository scans.
Share bugs, ideas, or general feedback.
Priors are set via two mechanisms:
priors.py — assigns priors to leaf claims (independent premises). Exports a PRIORS: dict mapping Knowledge objects to (prior, justification) tuples.reason+prior pairing — strategies accept prior= directly in the DSL (e.g., support(..., prior=0.85, reason="...")).Both are baked into claim metadata at compile time. gaia infer reads metadata directly — no separate sidecar file needed.
Before writing priors.py, use gaia check to understand the package structure and prior coverage:
gaia check . # Summary: independent claims annotated with prior status
gaia check --hole . # All independent claims: holes (no prior) + covered (with prior)
gaia check --brief . # Per-module overview: claims, strategies, operators
gaia check --show <module_name> . # Expanded module: full claim content + warrant trees
gaia check --show <claim_label> . # Specific claim's warrant tree with premises
gaia check . annotates each independent premise with prior=X or ⚠ no prior (defaults to 0.5). Shows a "Holes (no prior set): N" count in the summary.
gaia check --hole . splits all independent claims into Holes (QID, content, status) and Covered (prior value, justification). See §4 for the review workflow built around this output.
--brief output shows:
--show <module> expands:
--show <label> expands:
Use --brief to identify which claims need priors (independent premises), then use --show to read the full content before assigning priors. Every claim and strategy should have a visible name — if anything shows as _anon_xxx, the package has unnamed nodes that should be fixed before review.
Create src/<package>/priors.py:
from . import obs, hypothesis, evidence
PRIORS: dict = {
obs: (0.9, "Well-documented experimental result."),
hypothesis: (0.5, "Theoretical prediction, not yet confirmed."),
evidence: (0.8, "Consistent with multiple observations."),
}
The file must export a PRIORS dict. Each key is a Knowledge object imported from the package; each value is a (prior_float, justification_string) tuple.
apply_package_priors() discovers priors.py automatically at load time and writes prior into each claim's metadata before compilation.
Use gaia check --hole to identify hole claims (independent premises without priors), and gaia check --brief to see the full structure. The output classifies claims by role:
priors.py| What | Where to set prior |
|---|---|
| Leaf claim (not derived by any strategy) | priors.py |
| Orphaned claim (only used as background) | priors.py (typically 0.90-0.95) |
support / deduction / compare warrant | Inline prior= in DSL |
infer strategy CPT | conditional_probabilities in review sidecar (legacy) |
| Other named strategies (analogy, etc.) | Auto-formalized, deterministic |
induction / composite | Review sub-strategies individually |
Derived conclusions (claims that ARE the conclusion of a strategy): do NOT set a prior. The inference engine automatically assigns uninformative priors (0.5); their beliefs are entirely determined by BP propagation. Setting an explicit prior double-counts evidence.
gaia check --brief . — review the package structure and warrant priors. Check that support/compare warrant priors (prior= in DSL) reflect reasoning strength, and that composite strategy warrant priors are reasonable. Verify operator semantics (contradiction vs complement, see §5).gaia check --hole . — shows all independent claims: holes (missing prior, with content and QID) and covered (with prior value and justification). Review covered priors for reasonableness; identify holes to fill.priors.py — for each hole, assign a prior (see §5 for guidance). Use gaia check --show <label> . when you need the full warrant tree for context. Adjust any covered priors or DSL warrant priors that look wrong.gaia check --hole . — confirm "All independent claims have priors assigned."gaia infer . — run BP and interpret results (see §6).| Evidence level | Prior range | Examples |
|---|---|---|
| Well-established fact | 0.85-0.95 | Reproducible experiments, textbook results |
| Supported by evidence | 0.65-0.85 | Multiple consistent observations |
| Tentative / uncertain | 0.40-0.65 | Single observation, theoretical prediction |
| Weak / speculative | 0.20-0.40 | Extrapolation, analogy |
For support() and deduction(), the prior on the implication warrant is specified directly in the DSL via the prior= parameter. Ask: "If all premises are definitely true, how confident am I in the conclusion?"
| Reasoning quality | Prior value | Examples |
|---|---|---|
| Near-certain (rigid deduction) | 0.95-0.99 | Mathematical proofs, logical syllogisms |
| Strong support | 0.80-0.95 | Straightforward numerical calculation |
| Reliable but approximate | 0.60-0.80 | Standard approximation method |
| Moderate confidence | 0.40-0.60 | Empirical rule of thumb |
The prior on an abduction alternative represents explanatory power: "Can Alt alone explain Obs, without the hypothesis?"
Example: Obs = "patient's symptoms resolved after taking the drug", H = "the drug is effective", Alt = "placebo effect"
Rule of thumb: If pi(Alt) >= pi(H), the abduction provides little support for H. Either the evidence is genuinely weak, or pi(Alt) is overestimated.
After gaia infer ., check:
| Check | Normal | Abnormal |
|---|---|---|
| Independent premises | belief approx prior (small change) | belief significantly pulled down -- downstream constraint conflict |
| Derived conclusions | belief > 0.5 (pulled up) | belief < 0.5 -- see below |
| Contradiction | one side high, one low ("picks a side") | both low -- prior allocation problem |
Derived conclusion belief too low (< 0.3):
composite to control depth.priors.py.prior= too low.Contradiction does not "pick a side":
Derived conclusion belief approx 0.5 (not pulled up):
support strategy missing a prior=, or an infer strategy missing parameters.support strategies have prior= specified in the DSL.# src/my_package/priors.py
from . import obs, hypothesis, evidence
PRIORS: dict = {
# Leaf claims -- need priors
obs: (0.9, "Well-documented experimental result."),
hypothesis: (0.5, "Theoretical prediction, not yet confirmed."),
evidence: (0.8, "Consistent with multiple observations."),
}
# src/my_package/s2_results.py (inline warrant priors)
strat_h_explains = support(
[hypothesis], obs,
reason="Hypothesis predicts the observation", prior=0.9,
)
strat_alt_explains = support(
[alt_hypothesis], obs,
reason="Alternative poorly matches observation", prior=0.15,
)
Deprecated since gaia-lang 0.4.2. The review sidecar pattern (
ReviewBundle/review_claim()/review_strategy()) is retained for backward compatibility but will be removed in a future major release. Usepriors.pyand inlinereason+priorpairing instead.
The old API is still importable from gaia.review:
from gaia.review import ReviewBundle, review_claim, review_strategy, review_generated_claim
Calling any of these functions emits a DeprecationWarning. Existing packages with reviews/self_review.py will continue to work, but new packages should use priors.py.