CLI Internals API
Status: Generated from current Python docstrings and type hints.
Typer application wiring and command implementation entrypoints. User-facing CLI behavior is documented in CLI Commands; per-group structure is summarized in the CLI overview.
Alpha 0 moved the 9 historical flat verbs under grouped paths; the current
v0.5 surface also includes the agent-facing author, bayes,
pkg add-import, pkg add-module, and pkg scaffold commands. See
Migration to alpha 0 for the old-to-new verb mapping
and the package-loading helpers that moved into gaia.engine.packaging.
gaia.cli.main
Gaia CLI — knowledge package authoring toolkit.
The CLI organizes verbs into explicit top-level groups:
sdk generate the SDK reference + cheat sheet (start here, then
author the DSL directly — the primary path)
build init / compile / check
run infer / render
inspect starmap
review (empty skeleton — held for downstream reviewer tooling)
inquiry (sub-app: focus / review / obligation / hypothesis / tactics / reject)
pkg add / add-import / add-module / register / scaffold
author OPTIONAL authoring convenience (primary path: gaia sdk + write
the DSL directly). claim / artifact / figure / equal / derive /
note / question / contradict / exclusive / decompose / observe /
compute / infer / associate / parameter / register-prior /
variable / depends-on / candidate-relation / materialize /
compose / composition
bayes model / compare / distribution literals
example galileo / mendel (print or save the cli walkthrough for a
shipping v0.5 example package)
trace (independent sub-app: verify / review / show)
See docs/migration.md for guidance on moving off pre-alpha-0 invocations.
Command implementations
gaia.cli.commands.init
gaia init -- scaffold a new Gaia knowledge package.
init_command
init_command(name: str = typer.Argument(help="Package name (must end with '-gaia')."), docstring: str | None = typer.Option(None, '--docstring', help='Module docstring for the generated src/<import_name>/__init__.py. Wrapped in triple quotes at line 1. Default: no docstring.')) -> None
Create a new Gaia knowledge package.
Example: gaia build init mypkg-gaia --docstring "My package."
Source code in gaia/cli/commands/init.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
gaia.cli.commands.compile
gaia build compile -- compile Python DSL package to Gaia IR v2 JSON.
compile_command
compile_command(path: str = typer.Argument('.', help='Path to knowledge package directory')) -> None
Compile a knowledge package to .gaia/ir.json.
Loads the package's Python DSL, applies any sidecar priors (priors.py),
lowers it into the canonical IR v2 JSON, runs the IR validator, and
writes .gaia/ir.json + .gaia/ir_hash + .gaia/compile_metadata.json.
Downstream verbs (gaia run infer, gaia run render, gaia inspect
starmap, gaia pkg register) all require fresh compile artifacts.
Example:
.. code-block:: bash
gaia build compile .
Source code in gaia/cli/commands/compile.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
gaia.cli.commands.check
gaia build check -- validate a Gaia knowledge package.
check_command
check_command(path: str = typer.Argument('.', help='Path to knowledge package directory'), brief: bool = typer.Option(False, '--brief', '-b', help='Show per-module warrant brief after check'), show: str | None = typer.Option(None, '--show', '-s', help='Expand detail for a module name or claim/strategy label (implies --brief)'), hole: bool = typer.Option(False, '--hole', help='Show detailed prior review report for all independent claims'), warrants: bool = typer.Option(False, '--warrants', help='Show v6 ReviewManifest warrants with audit questions'), blind: bool = typer.Option(False, '--blind', help='With --warrants, omit status values and prior diagnostics'), inquiry: bool = typer.Option(False, '--inquiry', help='Show goal-oriented reasoning progress and review status'), gate: bool = typer.Option(False, '--gate', help='Run quality gate checks and exit non-zero on failure'), refs: bool = typer.Option(False, '--refs', help='Show reference/citation/artifact diagnostics for this package.')) -> None
Validate structure and artifact consistency for a Gaia knowledge package.
Compiles the package in-memory, validates the resulting IR (including
Bayes coherence: dangling predictions, unobserved targets, prior
coherence), checks that any stored .gaia/ir.json is fresh, and
classifies every claim into a role bucket (independent / derived /
structural / background / scaffolded / orphaned). Exits non-zero on
any error diagnostic. After gaia author <verb> cycles, this is
the natural quality probe before gaia build compile.
Common option combinations:
--brief/--show <label>— per-module warrant brief or expand a single claim/strategy--hole— list independent claims with no external prior--warrants/--blind— show v6 ReviewManifest warrants (use--blindto hide statuses for self-review)--inquiry— render goal-oriented inquiry trees--gate— applytool.gaia.qualitythresholds, exit non-zero on failure (CI-friendly)--refs— show citation/local-reference/artifact diagnostics
Example:
.. code-block:: bash
gaia build check .
gaia build check . --hole
gaia build check . --refs
gaia build check . --gate
Source code in gaia/cli/commands/check.py
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 | |
gaia.cli.commands.infer
gaia run infer -- run BP from compiled IR with metadata priors.
infer_command
infer_command(path: str = typer.Argument('.', help='Path to knowledge package directory'), depth: int = typer.Option(0, '--depth', help='Dependency depth for joint inference. 0=flat priors (default), 1=direct deps, -1=all transitive deps.')) -> None
Run BP inference on a compiled knowledge package.
Reads fresh .gaia/ir.json (run gaia build compile first),
lowers the IR into a factor graph, runs belief propagation, and
writes .gaia/beliefs.json. Priors come from claim metadata (set
by priors.py and reason+prior DSL pairing during
compilation). Review status is qualitative and never supplies
numeric priors; gaia run infer previews the compiled graph
without gating unreviewed warrants. Use gaia build check --gate
or gaia inquiry review for publish-quality review gating.
With --depth N (N>0), dependency packages' factor graphs are
merged for joint cross-package inference instead of using flat
prior injection from dep_beliefs/. --depth -1 merges all
transitive deps.
Example:
.. code-block:: bash
gaia build compile .
gaia run infer .
gaia run infer . --depth 1
Source code in gaia/cli/commands/infer.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
gaia.cli.commands.render
gaia run render command for package presentation outputs.
RenderTarget
Bases: StrEnum
Supported presentation targets for gaia run render.
render_command
render_command(path: str = typer.Argument('.', help='Path to knowledge package directory'), target: RenderTarget = _TARGET_OPTION) -> None
Render presentation outputs from a compiled package.
--target docs renders docs/detailed-reasoning.md from the compiled IR
alone; when gaia run infer has also been run, the output is enriched with
belief and prior values. --target github strictly requires inference
results and emits the .github-output/ README/wiki/data bundle.
--target obsidian writes gaia-wiki/ and enriches pages with beliefs
when fresh inference results are available.
--target all (default) always renders docs and adds github when
inference results are available, emitting a warning when they are not.
Compile freshness is required; beliefs freshness is required when
present. Typical pipeline: gaia build compile → gaia run infer
→ gaia run render.
Example:
.. code-block:: bash
gaia build compile .
gaia run infer .
gaia run render . --target all
gaia run render . --target obsidian
Source code in gaia/cli/commands/render.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
gaia.cli.commands.starmap
gaia inspect starmap — emit a starmap of a compiled package (HTML, DOT, or SVG).
starmap_command
starmap_command(path: str = typer.Argument('.', help='Path to knowledge package directory'), out: str = typer.Option(None, '--out', help="Output file. Defaults to '.gaia/starmap.html' (html) or '.gaia/starmap.dot' (dot), relative to the package directory; absolute paths are honored as-is."), fmt: str = typer.Option('html', '--format', help="Output format: 'html' (interactive Sigma.js), 'dot' (paper-ready Graphviz source), or 'svg' (rendered figure, stellaris glow filters baked in)."), theme: str = typer.Option('light', '--theme', help="Visual theme for 'dot' / 'svg' output. 'light' (default) is the flat paper-friendly palette. 'stellaris' (alias: 'dark') is a deep-space dark variant. For 'svg' the stellaris variant gets an injected <defs> block with radial-gradient background and glow filters bound to contradiction / support / root nodes.")) -> None
Emit a starmap of the compiled package.
Three formats are supported:
html(default) — single-file interactive Sigma.js visualization. Double-click to open in a browser; no server required.dot— a Graphvizdigraphsource. Pipe throughdot(Graphviz) to get a paper-ready figure.graphvizmust be installed separately (brew install graphviz/apt install graphviz).svg— rendered figure, end-to-end. Internally callsdot(light theme) orsfdp(stellaris/dark) on the dot source, then for the stellaris theme injects an SVG<defs>block with a radial gradient background and three glow filters keyed offclass="..."markers (contradiction / support / root). RequiresgraphvizonPATH.
Compile freshness, beliefs freshness, and graph validation gates apply to all formats.
Examples:
Interactive HTML (default):
gaia inspect starmap path/to/pkg
DOT source (manually pipe through dot/sfdp for full control):
gaia inspect starmap path/to/pkg --format dot --out figures/starmap.dot dot -Tsvg figures/starmap.dot -o figures/starmap.svg
End-to-end paper figure (light, no glow):
gaia inspect starmap path/to/pkg --format svg --out figures/starmap.svg
End-to-end paper figure with stellaris glow defs baked in:
gaia inspect starmap path/to/pkg --format svg --theme stellaris \ --out figures/starmap_stellaris.svg
PNG preview at higher DPI from the dot source:
dot -Tpng -Gdpi=200 figures/starmap.dot -o figures/starmap.png
PDF for direct LaTeX \includegraphics inclusion:
dot -Tpdf figures/starmap.dot -o figures/starmap.pdf
Source code in gaia/cli/commands/starmap.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
gaia.cli.commands.add
gaia pkg add — install registered or LKM-backed Gaia packages.
LKMSourceRef
dataclass
LKMSourceRef(index_id: str, kind: str, provider_id: str)
Stable source identity for an LKM-backed package candidate.
ref
property
ref: str
Return the canonical LKM source ref.
add_command
add_command(package: str | None = typer.Argument(None, help='Package name (e.g., galileo-falling-bodies-gaia) or LKM ref (lkm:<index>:paper:<id> / lkm:<index>:claim:<id>).'), version: str | None = typer.Option(None, '--version', '-v', help='Specific version'), registry: str = typer.Option(DEFAULT_REGISTRY, '--registry', help='Registry GitHub repo'), lkm_index: str = typer.Option(DEFAULT_LKM_INDEX_ID, '--lkm-index', '--lkm-server', help='Configured LKM index id for --lkm-paper / --lkm-claim.'), lkm_paper: str | None = typer.Option(None, '--lkm-paper', help='Materialize this LKM paper id as a local Gaia package and add it.'), lkm_claim: str | None = typer.Option(None, '--lkm-claim', help='Resolve this LKM claim id to its backing paper package.'), target: str = typer.Option('.', '--target', help='Path to the Gaia knowledge package to add the dependency to (default: cwd). Matches the --target convention used by `gaia author` verbs so the whole package lifecycle runs from one place.')) -> None
Install a registered or LKM-backed Gaia knowledge package.
Resolves <package> against the gaia registry (default:
SiliconEinstein/gaia-registry on GitHub), runs uv add on the
resolved git+<repo>@<sha> spec, and best-effort downloads the
upstream beliefs.json into .gaia/dep_beliefs/<import_name>.json
so foreign-node priors flow into local inference. Must be run from
within a Gaia knowledge package (pyproject.toml carrying a
tool.gaia table).
LKM paper refs/flags fetch the paper graph, generate a local Gaia package
under .gaia/lkm_packages/, compile it, and add it as an editable
dependency with uv add --editable.
--version pins a specific release; omit to take the latest
registered version.
Example:
.. code-block:: bash
gaia pkg add galileo-falling-bodies-gaia
gaia pkg add mendel-v0-5-gaia --version 0.1.0
gaia pkg add --lkm-index bohrium --lkm-paper 811827932371615744
gaia pkg add --lkm-index bohrium --lkm-claim gcn_579430355a0e4bbd
gaia pkg add lkm:bohrium:paper:811827932371615744
Source code in gaia/cli/commands/add.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
gaia.cli.commands.register
gaia pkg register -- prepare or submit a registry registration for a Gaia package.
register_command
register_command(path: str = typer.Argument('.', help='Path to knowledge package directory'), tag: str | None = typer.Option(None, help='Git tag to register. Defaults to v<version>.'), repo: str | None = typer.Option(None, help='GitHub repository URL. Defaults to the git origin remote.'), registry_dir: str | None = typer.Option(None, help='Path to a local checkout of the official registry repository.'), registry_repo: str = typer.Option('SiliconEinstein/gaia-registry', help='Registry GitHub repo slug for PR creation.'), create_pr: bool = typer.Option(False, help='Push the registry branch and open a GitHub PR.')) -> None
Prepare or submit a registration for a tagged GitHub-backed Gaia package.
Reads the freshly-compiled package, validates git state (clean
worktree, tag pointing at HEAD, tag pushed to origin), builds the
registry-side Package.toml / Versions.toml / Deps.toml +
per-release manifests + beliefs.json, and either prints the
registration plan as JSON (default) or writes it into a local
checkout of the registry repo and opens a PR.
Preconditions checked: [project].name ends with -gaia,
[tool.gaia].uuid set to a valid UUID, .gaia/ir_hash matches
the freshly-compiled IR (run gaia build compile first), git
worktree clean, tag v<version> (or --tag) on HEAD and
pushed.
Example:
.. code-block:: bash
# Dry run — print the registration plan as JSON:
gaia pkg register .
# Write a registry branch into a local checkout and open a PR:
gaia pkg register . --registry-dir ~/dev/gaia-registry --create-pr
Source code in gaia/cli/commands/register.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
gaia.cli.commands.author
gaia author subcommand group — optional authoring convenience.
This module exposes the gaia author <verb> namespace, where <verb>
matches one of the DSL surface verbs (claim / artifact /
figure / equal / derive / note / question /
contradict / exclusive / decompose / observe /
compute / infer / associate / parameter /
register_prior / depends_on / candidate_relation /
materialize / variable / compose / composition). Direct
SDK authoring (gaia sdk + writing the DSL in Python) is the primary
path; this CLI is an OPTIONAL convenience for humans and agents alike.
When used, it owns identifier collision checks, reference resolution,
pre-write defensive validation, file appending into the package's
composed authored/ submodule (never the package-root
__init__.py), and (by default) a post-write gaia build check to
make sure the package still compiles. Output is JSON-by-default through a
uniform envelope (see :mod:._envelope); --human opts into a
human-readable rendering of the same payload.
The author surface ships 22 verbs end-to-end against a uniform pre-write
envelope skeleton: 20 statement-emitting verbs (claim /
artifact / figure / equal / derive / note /
question / contradict / exclusive / decompose /
observe / compute / infer / associate / parameter /
register_prior / depends_on / candidate_relation /
materialize / variable) plus the two file-based compose /
composition
validate-and-register verbs (see :mod:.compose). Prose-mode
--<arg>-content flags, two pre-write warning kinds, and a
restricted-globals formula sandbox round out the authoring surface; the
engine's deprecation catalog is discovered via an AST scan over the DSL
source (see :mod:._deprecation_scan).
See docs/reference/cli/author.md for the per-verb contract.
artifact_command
artifact_command(dsl_binding_name: str = typer.Option(..., '--dsl-binding-name', help='Python module-scope identifier to bind.'), kind: str = typer.Option(..., '--kind', help=f'Artifact kind: {', '.join(sorted(ARTIFACT_KINDS))}.'), source: str | None = typer.Option(None, '--source', help='Citation key in references.json.'), locator: str | None = typer.Option(None, '--locator', help='Source-local locator.'), path: str | None = typer.Option(None, '--path', help='Package-relative artifact path.'), caption: str | None = typer.Option(None, '--caption', help='Caption for visual artifacts.'), description: str | None = typer.Option(None, '--description', help='Description for attachments.'), media_type: str | None = typer.Option(None, '--media-type', help='Optional MIME type.'), content: str | None = typer.Option(None, '--content', help='Override note content.'), title: str | None = typer.Option(None, '--title', help='Optional note title.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package.'), file: str | None = typer.Option(None, '--file', help='Relative module file under src/<import_name>.'), export: bool = typer.Option(False, '--export/--no-export', help='Export the artifact binding.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write build check.'), human: bool = typer.Option(False, '--human', help='Render human-readable output.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output.')) -> None
Append an artifact(...) note anchor statement.
Source code in gaia/cli/commands/author/artifact.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
figure_command
figure_command(dsl_binding_name: str = typer.Option(..., '--dsl-binding-name', help='Python module-scope identifier to bind.'), source: str | None = typer.Option(None, '--source', help='Citation key in references.json.'), locator: str | None = typer.Option(None, '--locator', help='Source-local figure locator.'), path: str | None = typer.Option(None, '--path', help='Package-relative image path.'), caption: str | None = typer.Option(None, '--caption', help='Figure caption.'), description: str | None = typer.Option(None, '--description', help='Optional description.'), media_type: str | None = typer.Option(None, '--media-type', help='Optional MIME type.'), content: str | None = typer.Option(None, '--content', help='Override note content.'), title: str | None = typer.Option(None, '--title', help='Optional note title.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package.'), file: str | None = typer.Option(None, '--file', help='Relative module file under src/<import_name>.'), export: bool = typer.Option(False, '--export/--no-export', help='Export the figure binding.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write build check.'), human: bool = typer.Option(False, '--human', help='Render human-readable output.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output.')) -> None
Append a figure(...) artifact note anchor statement.
Source code in gaia/cli/commands/author/artifact.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
associate_command
associate_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered associate(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = associate(...)``). Omit to emit a bare expression.'), a: str = typer.Option(..., '--a', help='Identifier of the first Claim.'), b: str = typer.Option(..., '--b', help='Identifier of the second Claim.'), p_a_given_b: float = typer.Option(..., '--p-a-given-b', help='P(a | b) — required.'), p_b_given_a: float = typer.Option(..., '--p-b-given-a', help='P(b | a) — required.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), pattern: str | None = typer.Option(None, '--pattern', help='Optional structural pattern (equal / contradict / exclusive).'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add the returned association helper to __all__ as a public probabilistic relation export. Default off: exports are curated explicitly.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append an associate(...) probabilistic-association statement.
Example
gaia author associate --a my_claim_a --b my_claim_b \ --p-a-given-b 0.9 --p-b-given-a 0.6 \ --dsl-binding-name my_association
Source code in gaia/cli/commands/author/associate.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
candidate_relation_command
candidate_relation_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered candidate_relation(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = candidate_relation(...)``). Omit to emit a bare expression.'), claims: str = typer.Option(..., '--claims', help='Comma-separated references to at least two Claim(s): local Claim identifiers and/or pulled-claim QIDs (lkm:<package>::<label>).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), pattern: str | None = typer.Option(None, '--pattern', help='Optional structural pattern (equal / contradict / exclusive).'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), background: str | None = typer.Option(None, '--background', help='Comma-separated background Knowledge identifiers.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add --dsl-binding-name to __all__ on a successful write (default off for candidate_relation: scaffold-tier output is structural, not part of the public Knowledge surface).'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a candidate_relation(...) scaffold-tier hypothesised relation.
Example
gaia author candidate-relation \ --claims my_claim_a,my_claim_b,my_claim_c \ --pattern equal --dsl-binding-name my_maybe_equal
Source code in gaia/cli/commands/author/candidate_relation.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
claim_command
claim_command(content: str = typer.Argument(..., help='Claim content (natural-language statement).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python module-scope identifier the rendered statement binds to (``<name> = claim(...)``). Omit to emit a bare expression statement. ``claim()`` does not take an engine ``label=`` kwarg, so this is the only label-like flag the verb exposes.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into (e.g. `priors.py`). Default: `__init__.py`. The file must already exist; use `gaia pkg add-module` to scaffold a fresh sibling.'), title: str | None = typer.Option(None, '--title', help='Optional short title for the claim.'), prior: float | None = typer.Option(None, '--prior', help='Optional direct prior in (0, 1), rendered as a prior= kwarg on the claim() call. Usually omit it: leaf-claim priors are normally recorded separately via `gaia author register-prior`, which keeps the belief value out of the claim definition and carries a source tag. Pass --prior only when a prior belongs inline on the claim itself.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), references: str | None = typer.Option(None, '--references', help="Comma-separated identifiers to whitelist inside the formula sandbox (no effect when --formula / --predicate is absent). References are NOT rendered into the claim's `background=` kwarg — use --background for that. Typical shape: `--references f2_total_count,f2_dominant_count --formula 'equals(f2_total_count, Constant(395, Nat))'`."), background: str | None = typer.Option(None, '--background', help="Comma-separated Knowledge identifiers passed to the rendered claim's `background=[...]` kwarg. Pre-write resolves each identifier in module scope. Independent of --references (--references is sandbox-only and not rendered into the claim call)."), predicate: str | None = typer.Option(None, '--predicate', help='Alias for --formula (predicate-mode shape). Backwards-compatible spelling; prefer --formula for new authoring.'), formula: str | None = typer.Option(None, '--formula', help="Predicate-logic expression rendered as the ``formula=`` kwarg. Validated by the formula sandbox (whitelist: land/lor/lnot/implies/iff/equals/forall/exists + ClaimAtom + Distribution factories + Variable/Constant + Nat/Real/Bool/Probability + references). Example: `--formula 'land(equals(my_var, Constant(395, Nat)), ClaimAtom(p))'`. Mutually exclusive with --predicate."), label: str | None = typer.Option(None, '--label', help="Optional Claim label. ``claim()`` does not take an engine ``label=`` kwarg, so the cli emits a follow-up ``<binding>.label = '<label>'`` assignment line after the rendered ``claim(...)`` call — matching the hand-authored pattern in the example packages. Requires --dsl-binding-name (no LHS means nothing to mutate)."), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to the target module's __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (currently a no-op; reserved for future use).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a claim(...) Knowledge declaration.
Example
gaia author claim "The reaction is fast." \ --dsl-binding-name fast_reaction --prior 0.7
Source code in gaia/cli/commands/author/claim.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
compose_command
compose_command(from_file: str = typer.Option(..., '--from-file', help='Path to a Python file containing exactly one @compose-decorated function.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), check: bool = typer.Option(True, '--check/--no-check', help="Run postwrite_check against the target package after registration (default on). Registration is preserved on disk even when post-check fails — the envelope reports source='postwrite' so the caller can detect a register-but-validation-broken state."), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Reserved for symmetry; compose does not currently surface warnings.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Validate + register a @compose-decorated function into pkg metadata.
Source code in gaia/cli/commands/author/compose.py
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | |
composition_command
composition_command(from_file: str = typer.Option(..., '--from-file', help='Path to a Python file containing exactly one @composition-decorated function.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), check: bool = typer.Option(True, '--check/--no-check', help="Run postwrite_check against the target package after registration (default on). Registration is preserved on disk even when post-check fails — the envelope reports source='postwrite' so the caller can detect a register-but-validation-broken state."), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Reserved for symmetry; composition does not currently surface warnings.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Alias of compose; validate + register a @composition-decorated function.
Source code in gaia/cli/commands/author/compose.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |
compute_command
compute_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered compute(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = compute(...)``). Omit to emit a bare expression.'), conclusion_type: str = typer.Option(..., '--conclusion-type', help='Identifier of the Claim subclass the computation produces (e.g. `Probability`).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), fn: str | None = typer.Option(None, '--fn', help='Identifier of a callable producing the result (e.g. `compute_probability`).'), given: str | None = typer.Option(None, '--given', help='Comma-separated identifiers of premise Claim(s).'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a compute(...) deterministic-computation statement.
Example
gaia author compute --conclusion-type Probability \ --fn my_compute_prob --given my_hypothesis_x \ --dsl-binding-name my_result --label my_result
Source code in gaia/cli/commands/author/compute.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
contradict_command
contradict_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered contradict(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = contradict(...)``). Omit to emit a bare expression.'), a: str = typer.Option(..., '--a', help='First Claim reference: a local Claim identifier or a pulled-claim QID (lkm:<package>::<label>).'), b: str = typer.Option(..., '--b', help='Second Claim reference: a local Claim identifier or a pulled-claim QID (lkm:<package>::<label>).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the contradict() background kwarg.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add the returned contradiction helper to __all__ as a public relation export. Default off: exports are curated explicitly.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a contradict(a, b, ...) structural relation.
Example
gaia author contradict --a my_claim_a --b my_claim_b \ --dsl-binding-name my_contradiction --label my_contradiction
Source code in gaia/cli/commands/author/contradict.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
decompose_command
decompose_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered decompose(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = decompose(...)``). Omit to emit a bare expression.'), whole: str = typer.Option(..., '--whole', help='Identifier of the composite Claim being decomposed.'), parts: str = typer.Option(..., '--parts', help='Comma-separated identifiers of atomic Claim parts.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), formula_template: str | None = typer.Option(None, '--formula-template', help='Pre-baked formula shape over --parts: atom (single-part), and (conjunction), or (disjunction).'), formula_expr: str | None = typer.Option(None, '--formula-expr', help='Raw Python expression for the formula, evaluated at author time with land/lor/lnot/iff/implies/ClaimAtom plus part names in scope.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add --dsl-binding-name to __all__ on a successful write when the decomposed Knowledge is part of the curated public surface. Default off.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a decompose(whole, parts=..., formula=...) decomposition.
Example
gaia author decompose --whole my_composite \ --parts my_atom_a,my_atom_b \ --formula-template and \ --dsl-binding-name my_decomposition
Source code in gaia/cli/commands/author/decompose.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
depends_on_command
depends_on_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered depends_on(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = depends_on(...)``). Omit to emit a bare expression.'), conclusion: str = typer.Option(..., '--conclusion', help='Identifier of the dependent Claim.'), given: str = typer.Option(..., '--given', help='Comma-separated dependency references: local Claim identifiers and/or pulled-claim QIDs (lkm:<package>::<label>).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), background: str | None = typer.Option(None, '--background', help='Comma-separated background Knowledge identifiers.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to __all__ on a successful write (default off for depends_on: scaffold actions are structural, not part of the package's public Knowledge surface)."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a depends_on(...) scaffold dependency.
Example
gaia author depends-on --conclusion my_big_claim \ --given my_small_claim_a,my_small_claim_b \ --dsl-binding-name my_dependency
Source code in gaia/cli/commands/author/depends_on.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
derive_command
derive_command(conclusion: str | None = typer.Option(None, '--conclusion', help='Identifier of the conclusion Claim (must already be declared).'), conclusion_content: str | None = typer.Option(None, '--conclusion-content', help='Prose for an auto-generated conclusion Claim. Mutually exclusive with --conclusion and --conclusion-prose. Cli derives a snake-case slug for the label (override via --conclusion-label).'), conclusion_label: str | None = typer.Option(None, '--conclusion-label', help='Optional explicit label for the auto-generated conclusion Claim (only meaningful with --conclusion-content).'), conclusion_prose: str | None = typer.Option(None, '--conclusion-prose', help="Inline prose passed to the engine's ``derive(conclusion: Claim | str, ...)`` polymorphism. Emits ``derive('<prose>', ...)`` directly with no named binding. Mutually exclusive with --conclusion and --conclusion-content."), given: str = typer.Option(..., '--given', help='Comma-separated premise references the conclusion is derived from: local Claim identifiers and/or pulled-claim QIDs (lkm:<package>::<label>).'), label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg passed through to the rendered derive(...) call. Distinct from --dsl-binding-name (the Python LHS). Omit both to render derive(...) without a label= kwarg and no LHS.'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python module-scope identifier the rendered statement binds to (``<name> = derive(...)``). Omit to emit a bare expression statement (no LHS); the derive() result is then only reachable via transitive Claim references in the IR.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification of the derivation.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the derive() background kwarg.'), export: bool = typer.Option(False, '--export/--no-export', help="Append --dsl-binding-name to the target module's __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a derive(conclusion, given=[...]) support relation.
Example
gaia author derive --conclusion-content "B follows from A." \ --given my_claim_a \ --dsl-binding-name my_derivation \ --label my_derivation_path
Source code in gaia/cli/commands/author/derive.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |
equal_command
equal_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered equal(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = equal(...)``). Omit to emit a bare expression statement.'), a: str = typer.Option(..., '--a', help='Identifier of the first Claim.'), b: str = typer.Option(..., '--b', help='Identifier of the second Claim.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the equal() background kwarg.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add the returned equivalence helper to __all__ as a public relation export. Default off: exports are curated explicitly.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (currently a no-op; reserved for future use).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append an equal(a, b, ...) structural relation.
Example
gaia author equal --a my_claim_a --b my_claim_b \ --dsl-binding-name my_equivalence --label my_equivalence
Source code in gaia/cli/commands/author/equal.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
exclusive_command
exclusive_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered exclusive(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = exclusive(...)``). Omit to emit a bare expression.'), a: str = typer.Option(..., '--a', help='Identifier of the first Claim.'), b: str = typer.Option(..., '--b', help='Identifier of the second Claim.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the exclusive() background kwarg.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add the returned exclusive/complement helper to __all__ as a public relation export. Default off: exports are curated explicitly.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append an exclusive(a, b, ...) closed-partition statement.
Example
gaia author exclusive --a my_outcome_a --b my_outcome_b \ --dsl-binding-name my_partition
Source code in gaia/cli/commands/author/exclusive.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
infer_command
infer_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered infer(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = infer(...)``). Omit to emit a bare expression.'), evidence: str = typer.Option(..., '--evidence', help='Identifier of the evidence Claim.'), hypothesis: str | None = typer.Option(None, '--hypothesis', help='Identifier of the hypothesis Claim (must already be declared). Mutually exclusive with --hypothesis-content.'), hypothesis_content: str | None = typer.Option(None, '--hypothesis-content', help='Prose for an auto-generated hypothesis Claim. Mutually exclusive with --hypothesis. Cli derives a snake-case slug for the label (override via --hypothesis-label).'), hypothesis_prose: str | None = typer.Option(None, '--hypothesis-prose', help="Inline prose wrapped into an anonymous claim() at the call site. Emits ``infer(evidence, hypothesis=claim('<prose>'), ...)`` with no named binding. Mutually exclusive with --hypothesis and --hypothesis-content. (The engine's ``infer()`` hypothesis kwarg is strictly Claim-typed, so the cli wraps the prose at the call site rather than passing a bare string.)"), hypothesis_label: str | None = typer.Option(None, '--hypothesis-label', help='Optional explicit label for the auto-generated hypothesis Claim (only meaningful with --hypothesis-content).'), p_e_given_h: float = typer.Option(..., '--p-e-given-h', help='P(evidence | hypothesis) — required likelihood under the hypothesis.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), p_e_given_not_h: float | None = typer.Option(None, '--p-e-given-not-h', help='P(evidence | NOT hypothesis) — defaults to 0.5 in the DSL when omitted.'), given: str | None = typer.Option(None, '--given', help='Comma-separated identifiers of conditioning Claim(s).'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the infer() background kwarg.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append an infer(...) Bayesian-inference statement.
Example
gaia author infer --evidence my_evidence \ --hypothesis my_hypothesis --p-e-given-h 0.7 \ --dsl-binding-name my_inference --label my_inference
Source code in gaia/cli/commands/author/infer.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
list_command
list_command(target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under ``src/<import_name>/`` to scope the scan to a single source file (e.g. ``__init__.py`` or ``observations.py``). Default: every non-auxiliary ``.py`` file under the source root.'), kind: str | None = typer.Option(None, '--kind', help='Filter to one binding kind (e.g. ``claim`` / ``derive`` / ``variable``). The value matches the ``kind`` column / JSON field — use the underscored callable form.'), unbound: bool = typer.Option(False, '--unbound', help='Include bare-expression statements (calls without an LHS binding) in the output. Default off — bare calls are frequently scaffolding noise.'), human: bool = typer.Option(False, '--human', help='Render output as a human-readable table instead of the JSON envelope.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
List author-verb bindings in a Gaia DSL package.
Walks every .py file under the package source root as Python AST
(no engine import, no compile pipeline) and reports every top-level
author-verb statement: kind, binding name, content preview, file,
line, and whether the binding is exported via __all__. Reads
[[tool.gaia.compositions]] entries from pyproject.toml for
the trailing compositions section.
The verb is read-only; it never writes to disk and does not share the write/postwrite pipeline used by the other 19 author verbs.
Example
gaia author list --target ./my-pkg-gaia --human gaia author list --target ./my-pkg --kind claim --json
Source code in gaia/cli/commands/author/list.py
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | |
materialize_command
materialize_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered materialize(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = materialize(...)``). Omit to emit a bare expression.'), scaffold: str = typer.Option(..., '--scaffold', help='Identifier of the registered Scaffold (DependsOn / CandidateRelation).'), by: str = typer.Option(..., '--by', help='Comma-separated identifiers of formal graph records that materialise the scaffold.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help='Add --dsl-binding-name to __all__ on a successful write (default off for materialize: the link is structural metadata, not part of the public Knowledge surface).'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a materialize(scaffold, by=...) scaffold-to-formal-record link.
Example
gaia author materialize --scaffold my_maybe_equal \ --by my_formal_equal --dsl-binding-name my_materialization
Source code in gaia/cli/commands/author/materialize.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
note_command
note_command(content: str = typer.Argument(..., help='Note content (natural-language background).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python module-scope identifier the rendered statement binds to (``<name> = note(...)``). Omit to emit a bare expression. ``note()`` does not take an engine ``label=`` kwarg, so this is the only label-like flag the verb exposes.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), title: str | None = typer.Option(None, '--title', help='Optional short title for the note.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to the target module's __all__ on a successful write (default off for note: notes are contextual background, not part of the package's public Knowledge surface)."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a note(...) background statement.
Example
gaia author note "Earlier work established the setup." \ --dsl-binding-name background_setup --title "Setup background"
Source code in gaia/cli/commands/author/note.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
observe_command
observe_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered observe(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = observe(...)``). Omit to emit a bare expression.'), conclusion: str | None = typer.Option(None, '--conclusion', help='Identifier of the observed Claim, Variable, or Distribution (must already be declared). Mutually exclusive with --observation-content.'), observation_content: str | None = typer.Option(None, '--observation-content', help='Prose for an auto-generated observation Claim. Mutually exclusive with --conclusion. Cli derives a snake-case slug for the label (override via --observation-label). Only valid for discrete observations; the quantity form (--value / --error) targets a Variable or Distribution and so must use --conclusion.'), observation_prose: str | None = typer.Option(None, '--observation-prose', help="Inline prose passed through the engine's ``observe(conclusion: Claim | str, ...)`` polymorphism. Emits ``observe('<prose>', ...)`` directly with no named binding. Mutually exclusive with --conclusion and --observation-content."), observation_label: str | None = typer.Option(None, '--observation-label', help='Optional explicit label for the auto-generated observation Claim (only meaningful with --observation-content).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), value: str | None = typer.Option(None, '--value', help="Numeric value (quantity form). Forwarded verbatim — pass a literal (`--value 203`) or a Quantity expression (`--value '203 * ureg.K'`)."), error: str | None = typer.Option(None, '--error', help='Observation error (quantity form): scalar sigma or Distribution.'), given: str | None = typer.Option(None, '--given', help='Comma-separated premise identifiers for a conditional discrete observation.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the observe() background kwarg.'), source_refs: str | None = typer.Option(None, '--source-refs', help='Comma-separated source reference strings attached to the observation.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append an observe(...) measurement event.
Example
gaia author observe --conclusion my_distribution \ --value 203 --error 5 \ --dsl-binding-name temperature_obs --label temperature_obs
Source code in gaia/cli/commands/author/observe.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |
parameter_command
parameter_command(label: str | None = typer.Option(None, '--label', help='Engine `label=` kwarg on the rendered parameter(...) call. Distinct from --dsl-binding-name (the Python LHS).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = parameter(...)``). Omit to emit a bare expression.'), variable: str = typer.Option(..., '--variable', help='Identifier of the bound Variable.'), value: str = typer.Option(..., '--value', help="Variable value (literal). Forwarded verbatim — pass `0.5` or `'fast'` etc."), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), content: str | None = typer.Option(None, '--content', help='Optional Claim content text (defaults to auto-generated).'), title: str | None = typer.Option(None, '--title', help='Optional short title for the parameter Claim.'), prior: float | None = typer.Option(None, '--prior', help='Optional inline prior in (0, 1).'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification (routed through metadata).'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a parameter(...) Variable-to-value binding.
Example
gaia author parameter --variable my_theta --value 0.5 \ --dsl-binding-name my_theta_default --prior 0.5
Source code in gaia/cli/commands/author/parameter.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
question_command
question_command(content: str = typer.Argument(..., help='Question content (natural-language research question).'), dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered statement (``<name> = question(...)``). Omit to emit a bare expression. ``question()`` does not take an engine ``label=`` kwarg, so this is the only label-like flag the verb exposes.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), title: str | None = typer.Option(None, '--title', help='Optional short title for the question.'), targets: str | None = typer.Option(None, '--targets', help='Comma-separated identifiers of claims the question targets (must resolve in package).'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add --dsl-binding-name to __all__ on a successful write. Default off: exports are the package's curated public Knowledge surface."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a question(...) research-question statement.
Example
gaia author question "Does X cause Y?" \ --dsl-binding-name rq_x_causes_y \ --targets my_hypothesis_x,my_hypothesis_y
Source code in gaia/cli/commands/author/question.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
register_prior_command
register_prior_command(claim: str = typer.Option(..., '--claim', help='Identifier of the Claim to attach the prior to.'), value: str = typer.Option(..., '--value', help='Prior probability in (CROMWELL_EPS, 1 - CROMWELL_EPS). Accepts either a numeric literal (`--value 0.5`) or a bare Python identifier (`--value PRIOR_MENDELIAN_MODEL`) resolved against the module scope so callers can reference imported constants (e.g. from a sibling `probabilities.py`). Arbitrary Python expressions are refused at the flag boundary.'), justification: str = typer.Option(..., '--justification', help='Required non-empty rationale string (engines reject empty values).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into (e.g. `priors.py` to match the hand-authored pattern). Default: `__init__.py`. When writing to a sibling file, the cli will auto-insert `from <import_name> import <claim>` if missing.'), source_id: str | None = typer.Option(None, '--source-id', help="Source identifier. Defaults to the engine's `user_priors`; when omitted on the cli, the rendered call omits the `source_id=` kwarg so the engine default applies (matches the hand-authored omit-when-default pattern). Engines use namespaced ids (e.g. `continuous_inference`, `reviewer_alice`)."), statement_label: str | None = typer.Option(None, '--statement-label', help='Optional trailing-comment label so tooling can scan the source line.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), export: bool = typer.Option(False, '--export/--no-export', help="Add the statement's binding to __all__ on a successful write (default off for register_prior: the call has no LHS binding, so this flag is reserved for surface uniformity)."), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a register_prior(...) prior-registration statement.
Example
gaia author register-prior --claim my_hypothesis --value 0.7 \ --justification "Prior elicited from domain expert."
Source code in gaia/cli/commands/author/register_prior.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
variable_command
variable_command(dsl_binding_name: str | None = typer.Option(None, '--dsl-binding-name', help='Python LHS for the rendered Variable/Constant declaration (``<name> = Variable(...)``). Omit to emit a bare expression. Variable / Constant do not take an engine ``label=`` kwarg, so this is the only label-like flag the verb exposes.'), symbol: str | None = typer.Option(None, '--symbol', help='Symbol used in formulas (e.g. `k_dominant`). Required unless --const is passed (Constant has no symbol).'), domain: str = typer.Option(..., '--domain', help='Primitive type or user-declared Domain identifier. Built-in primitives: Nat / Real / Bool / Probability. A non-primitive name is treated as a user-declared Domain reference (pre-write verifies it resolves in module scope).'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), value: str | None = typer.Option(None, '--value', help="Bound value: numeric literal (`--value 395`), boolean / None (`--value True`), or a bare Python identifier (`--value DOMINANT_COUNT`) resolved against the package's module scope so authors can reference imported constants (e.g. from a sibling `probabilities.py`). Required for Constant; arbitrary Python expressions are refused at the flag boundary."), content: str | None = typer.Option(None, '--content', help="Optional Variable.content override (defaults to auto-generated `'Variable <symbol>: <domain> = <value>'`)."), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), const: bool = typer.Option(False, '--const', help='Emit Constant(value, primitive) instead of Variable(...). Constant is a frozen literal term used inside formulas; it does not carry a symbol or bind a runtime value.'), export: bool = typer.Option(False, '--export/--no-export', help='Add --dsl-binding-name to __all__ on a successful write (default off for variable: typed-term declarations are internal scaffolding, not part of the public Knowledge surface).'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Append a Variable(...) or Constant(...) typed-term declaration.
Example
gaia author variable --symbol my_n --domain Nat --value 395 \ --dsl-binding-name my_count
Source code in gaia/cli/commands/author/variable.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
gaia.cli.commands.bayes
gaia bayes subcommand group — Bayesian-modelling cli surface.
Exposes :mod:gaia.engine.bayes through structured cli verbs. Mirrors
the engine's authoring surface:
bayes model— declare a predictive model linking a hypothesis Claim to a Variable observable and a Distribution.bayes compare— compare observed data against one or more predictive models.bayes <dist>— declare a Distribution literal as a standalone binding so subsequentbayes model/observeinvocations can reference it by name.<dist>is one of the 11 v0.5 shipping distributions (Binomial / BetaBinomial / Normal / LogNormal / Beta / Exponential / Gamma / StudentT / Cauchy / ChiSquared / Poisson).
Namespace choice: top-level gaia bayes <verb>. The engine's
bayes surface is a coherent sub-domain (its own gaia.engine.bayes
package), so giving it a top-level cli group mirrors the engine
organisation. bayes model / bayes compare reads naturally;
flat-under-author would have produced author bayes-model which
felt forced.
All bayes verbs share the same JSON envelope + pre-write + post-write
pipeline as the gaia author family via the runner in
:mod:gaia.cli.commands.author._runner. The distribution-literal verbs
build a Distribution(...) binding; the structural verbs model
and compare produce helper Claim bindings the same way the
engine's bayes.model / bayes.compare do.
compare_command
compare_command(label: str = typer.Option(..., '--label', help='Identifier the comparison helper Claim binds to.'), data: str = typer.Option(..., '--data', help='Comma-separated identifier(s) of observation Claim(s).'), model: str = typer.Option(..., '--model', help='Identifier of the primary bayes.model helper Claim.'), against: str | None = typer.Option(None, '--against', help='Comma-separated identifier(s) of alternative model Claim(s); at least one required.'), exclusivity: str = typer.Option('exhaustive_pairwise_complement', '--exclusivity', help="Structural constraint between the compared hypotheses. exhaustive_pairwise_complement (default): the hypotheses partition the outcome space — exactly one must be true; posterior mass flows pairwise as in standard Bayesian model selection (suitable when the listed models are collectively exhaustive). pairwise_contradiction: the hypotheses are mutually exclusive but not exhaustive — at most one is true; an 'all hypotheses false' joint state is permitted (use when you believe all listed models may be wrong)."), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the background kwarg.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Author a bayes.compare(data, models=[model, ...]) statement.
bayes compare is the quantitative culmination of a qualitative
authoring graph (claims, observations, derivations, exclusive
operators). For a self-contained two-prior posterior comparison
without a qualitative argument, libraries like PyMC or
scipy.stats may be a lighter fit.
Example:
.. code-block:: bash
gaia bayes compare \
--data f2_count_observation \
--model mendel_count_model \
--against diffuse_count_model \
--rationale "Compare Mendel vs diffuse on F2 counts." \
--label mendel_count_likelihood
Source code in gaia/cli/commands/bayes/compare.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
beta_command
beta_command(label: str = typer.Option(..., '--label', help='Identifier the Beta binding takes.'), alpha: str = typer.Option(..., '--alpha', help='Shape alpha (>0): literal or identifier.'), beta: str = typer.Option(..., '--beta', help='Shape beta (>0): literal or identifier.'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Beta(content, alpha=..., beta=...) literal binding.
Renders Beta(alpha, beta) on (0, 1) — the canonical conjugate prior
for Bernoulli / Binomial success rates. alpha=1, beta=1 is
uniform. Each parameter accepts a numeric literal or a bare
module-scope identifier.
Example:
.. code-block:: bash
gaia bayes beta --label success_rate_prior --alpha 2.0 --beta 5.0
Source code in gaia/cli/commands/bayes/distributions.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
betabinomial_command
betabinomial_command(label: str = typer.Option(..., '--label', help='Identifier the BetaBinomial binding takes.'), n: str = typer.Option(..., '--n', help='Trial count: numeric literal or bare identifier.'), alpha: str = typer.Option(..., '--alpha', help='Beta prior alpha (>0): literal or identifier.'), beta: str = typer.Option(..., '--beta', help='Beta prior beta (>0): literal or identifier.'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a BetaBinomial(content, n=..., alpha=..., beta=...) literal.
Renders the BetaBinomial(n, alpha, beta) predictive distribution as
a standalone binding; common as the diffuse / uniform-mean reference
model in a likelihood comparison (alpha=1, beta=1 collapses to
the uniform 1/(n+1) over counts). Each parameter accepts a numeric
literal or a bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes beta-binomial --label diffuse_binomial \\
--n 395 --alpha 1.0 --beta 1.0
Source code in gaia/cli/commands/bayes/distributions.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
binomial_command
binomial_command(label: str = typer.Option(..., '--label', help='Identifier the Binomial binding takes.'), n: str = typer.Option(..., '--n', help='Trial count: numeric literal or bare identifier.'), p: str = typer.Option(..., '--p', help='Success probability: numeric literal or bare identifier.'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Binomial(content, n=..., p=...) literal binding.
Renders <label> = Binomial('<label>', n=..., p=...) into the target
module. --n and --p accept a numeric literal (--n 395,
--p 0.75) or a bare module-scope identifier (--n TOTAL_COUNT,
--p MENDELIAN_DOMINANT_PROBABILITY); each identifier must already
be importable in the target file.
Example:
.. code-block:: bash
gaia bayes binomial --label mendel_binomial --n 395 --p 0.75
Source code in gaia/cli/commands/bayes/distributions.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
cauchy_command
cauchy_command(label: str = typer.Option(..., '--label', help='Identifier the Cauchy binding takes.'), mu: str = typer.Option(..., '--mu', help='Location parameter.'), gamma: str = typer.Option(..., '--gamma', help='Scale parameter (>0).'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Cauchy(content, mu=..., gamma=...) literal binding.
Renders Cauchy(mu, gamma) — undefined mean / variance; useful as a heavy-tailed robust alternative to Normal. Each parameter accepts a numeric literal or a bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes cauchy --label heavy_tail_noise --mu 0.0 --gamma 1.0
Source code in gaia/cli/commands/bayes/distributions.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | |
chisquared_command
chisquared_command(label: str = typer.Option(..., '--label', help='Identifier the ChiSquared binding takes.'), df: str = typer.Option(..., '--df', help='Degrees of freedom (>0).'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a ChiSquared(content, df=...) literal binding.
Renders ChiSquared(df) on positive reals — sum of squared standard
Normals with df degrees of freedom. --df accepts a numeric
literal or a bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes chi-squared --label variance_test_stat --df 5
Source code in gaia/cli/commands/bayes/distributions.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
exponential_command
exponential_command(label: str = typer.Option(..., '--label', help='Identifier the Exponential binding takes.'), rate: str = typer.Option(..., '--rate', help='Rate (>0): literal or identifier.'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Exponential(content, rate=...) literal binding.
Renders the single-parameter Exponential(rate) distribution on
positive reals — mean 1/rate. --rate accepts a numeric
literal or a bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes exponential --label decay_time --rate 0.5
Source code in gaia/cli/commands/bayes/distributions.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
gamma_command
gamma_command(label: str = typer.Option(..., '--label', help='Identifier the Gamma binding takes.'), alpha: str = typer.Option(..., '--alpha', help='Shape parameter (>0).'), rate: str = typer.Option(..., '--rate', help='Rate parameter (>0).'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Gamma(content, alpha=..., rate=...) literal binding.
Renders Gamma(alpha, rate) on positive reals — mean alpha/rate.
Common as a conjugate prior for Poisson rates. Each parameter accepts
a numeric literal or a bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes gamma --label rate_prior --alpha 2.0 --rate 0.5
Source code in gaia/cli/commands/bayes/distributions.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
lognormal_command
lognormal_command(label: str = typer.Option(..., '--label', help='Identifier the LogNormal binding takes.'), mu: str = typer.Option(..., '--mu', help='Location parameter of the underlying Normal.'), sigma: str = typer.Option(..., '--sigma', help='Scale of the underlying Normal (>0).'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a LogNormal(content, mu=..., sigma=...) literal binding.
Renders LogNormal(mu, sigma) — the distribution of exp(X) for
X ~ Normal(mu, sigma). Common for positively-supported
multiplicative noise. Each parameter accepts a numeric literal or a
bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes log-normal --label price_noise --mu 0.0 --sigma 0.3
Source code in gaia/cli/commands/bayes/distributions.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
normal_command
normal_command(label: str = typer.Option(..., '--label', help='Identifier the Normal binding takes.'), mu: str = typer.Option(..., '--mu', help='Location parameter: literal or identifier.'), sigma: str = typer.Option(..., '--sigma', help='Scale parameter (>0): literal or identifier.'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Normal(content, mu=..., sigma=...) literal binding.
Renders the Normal(mu, sigma) distribution as a standalone binding. Each parameter accepts a numeric literal or a bare module-scope identifier.
Example:
.. code-block:: bash
gaia bayes normal --label measurement_noise --mu 0.0 --sigma 1.5
Source code in gaia/cli/commands/bayes/distributions.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
poisson_command
poisson_command(label: str = typer.Option(..., '--label', help='Identifier the Poisson binding takes.'), rate: str = typer.Option(..., '--rate', help='Poisson rate (>0): literal or identifier.'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a Poisson(content, rate=...) literal binding.
Renders the single-parameter Poisson(rate) distribution as a
standalone binding. --rate accepts a numeric literal or a bare
module-scope identifier (e.g. an expected-count constant).
Example:
.. code-block:: bash
gaia bayes poisson --label arrival_rate_model --rate 4.2
Source code in gaia/cli/commands/bayes/distributions.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
studentt_command
studentt_command(label: str = typer.Option(..., '--label', help='Identifier the StudentT binding takes.'), df: str = typer.Option(..., '--df', help='Degrees of freedom (>0).'), mu: str = typer.Option('0.0', '--mu', help='Location parameter (default 0.0).'), sigma: str = typer.Option('1.0', '--sigma', help='Scale parameter (default 1.0, >0).'), target: str = typer.Option('.', '--target', help='Target package path.'), file: str | None = typer.Option(None, '--file', help='Relative file under src/<pkg>/.'), metadata: str | None = typer.Option(None, '--metadata', help='JSON metadata.'), check: bool = typer.Option(True, '--check/--no-check'), human: bool = typer.Option(False, '--human'), interactive: bool = typer.Option(False, '--interactive')) -> None
Declare a StudentT(content, df=..., mu=..., sigma=...) literal binding.
Renders Student's t-distribution. --mu and --sigma are
optional location/scale (defaults 0.0 / 1.0); --df (degrees of
freedom) is required. Heavier-tailed than Normal; useful for
robust-likelihood comparisons.
Example:
.. code-block:: bash
gaia bayes student-t --label robust_noise --df 4.0 --mu 0.0 --sigma 1.0
Source code in gaia/cli/commands/bayes/distributions.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
model_command
model_command(label: str = typer.Option(..., '--label', help='Identifier the predictive-model helper Claim binds to.'), hypothesis: str = typer.Option(..., '--hypothesis', help='Identifier of the hypothesis Claim being modelled.'), observable: str = typer.Option(..., '--observable', help='Identifier of the Variable the model predicts.'), distribution: str = typer.Option(..., '--distribution', help="Distribution binding. Accepts either (a) a bare identifier of a Distribution binding (created via `bayes binomial` / `bayes normal` / ...) — resolved in module scope, or (b) an inline Distribution expression like `Binomial('k under H', n=395, p=3/4)` — validated via the formula sandbox and emitted verbatim into the `distribution=` slot."), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str | None = typer.Option(None, '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`.'), background: str | None = typer.Option(None, '--background', help='Comma-separated identifiers passed as the background kwarg.'), rationale: str | None = typer.Option(None, '--rationale', help='Optional natural-language justification.'), metadata: str | None = typer.Option(None, '--metadata', help='Optional JSON-encoded metadata dict.'), references: str | None = typer.Option(None, '--references', help='Comma-separated identifiers to whitelist inside the formula sandbox when --distribution carries an inline expression referencing module-scope constants (e.g. `--distribution "Binomial(\'k under H\', n=TOTAL_COUNT, p=MENDELIAN_DOMINANT_PROBABILITY)" --references TOTAL_COUNT,MENDELIAN_DOMINANT_PROBABILITY`). Each name is also pushed into pre-write reference resolution so module-scope binding is verified. No effect when --distribution is a bare identifier.'), check: bool = typer.Option(True, '--check/--no-check', help='Run post-write `gaia build check` after a successful write (default on).'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (human mode only).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Author a bayes.model(hypothesis, observable=..., distribution=...) statement.
Example:
.. code-block:: bash
gaia bayes model \
--hypothesis mendelian_segregation_model \
--observable f2_dominant_count \
--distribution mendel_binomial \
--background monohybrid_cross_setup,dominance_background \
--rationale "Mendel predicts Binomial(N, 3/4) for F2 dominant counts." \
--label mendel_count_model
Source code in gaia/cli/commands/bayes/model.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
gaia.cli.commands.pkg.add_import
gaia pkg add-import — inject from <module> import <names> into a target file.
Plain-Python imports between sibling modules of a Gaia knowledge package
are a precondition the author verbs can't handle on their own. When
gaia author variable --value DOMINANT_COUNT is invoked against
__init__.py, the cli has no way to know DOMINANT_COUNT lives in
./probabilities.py — the per-verb sibling_imports machinery
short-circuits whenever the target file is __init__.py since a
package can't re-import from itself.
This verb closes that gap with a small, explicit utility: it inserts
from .<module> import <names> (or from <dotted.module> import
<names>) into the target file, idempotently. Each name that already
appears in any matching from line is silently skipped; everything
new is folded into a single import line, alphabetically sorted, placed
after the docstring + from __future__ block.
The verb covers the "plain Python data plumbing" gap surfaced when
reproducing example packages whose sibling modules carry plain numeric
constants (probabilities.py) or NamedTuple helpers — content that
isn't DSL and so isn't author-verb material, yet still needs to be
referenced from __init__.py.
add_import_command
add_import_command(from_: str = typer.Option(..., '--from', help="Module to import from. A bare identifier (`probabilities`) or leading-dot form (`.probabilities`) resolves against the target package's import name as `<import_name>.probabilities`. A dotted absolute form (`other_pkg.helpers`) is used verbatim."), names: str = typer.Option(..., '--names', help='Comma-separated Python identifiers to import. Each must be a valid identifier; duplicates and entries already imported are silently skipped.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), file: str = typer.Option('__init__.py', '--file', help='Relative path under src/<import_name>/ to write into. Default: `__init__.py`. The file must already exist; use `gaia pkg add-module` first if you need to seed a fresh sibling.'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Inject from <module> import <names> into a Gaia package file.
Example:
.. code-block:: bash
gaia pkg add-import --from probabilities \
--names DOMINANT_COUNT,RECESSIVE_COUNT,TOTAL_COUNT
Source code in gaia/cli/commands/pkg/add_import.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
gaia.cli.commands.pkg.add_module
gaia pkg add-module — scaffold a fresh sibling Python module.
Sibling files in a Gaia knowledge package (e.g. priors.py,
probabilities.py) need a precondition step before
gaia author <verb> --file <relative> can write into them. This verb
fills the gap by:
- Validating the target package is a Gaia knowledge package (via the existing pre-write invariant (a) machinery).
- Creating
src/<import_name>/<module>.pywith a minimal header and an empty__all__list. - Optionally seeding
from gaia.engine.lang import <verbs>based on the--importsflag (CSV).
The verb emits the same uniform JSON envelope as the rest of the
gaia author / gaia pkg scaffold family so an agent consumer can
chain it into authoring pipelines.
Why a separate sub-verb instead of letting the author verbs auto-create their target file? Two reasons:
-
Pre-write hygiene. Author verbs assume the target file already exists so the (c) collision-and-reference scan has stable inputs; letting them silently mint a fresh file would diverge their pre-write invariants.
-
Explicit intent. Adding a sibling module is a structural choice about package organisation. Splitting it from the per-statement verb keeps the agent's actions auditable.
add_module_command
add_module_command(name: str = typer.Option(..., '--name', help='Module name relative to the package source root. Accepts a bare identifier (`priors`) or a filename (`priors.py`). Required.'), target: str = typer.Option('.', '--target', help='Path to the target Gaia package (default: cwd).'), imports: str | None = typer.Option(None, '--imports', help="Comma-separated DSL verbs to seed the module's imports (e.g. `register_prior,note`). Default: no imports beyond `from __future__ import annotations`."), docstring: str | None = typer.Option(None, '--docstring', help='Module docstring for the generated sibling file. Wrapped in triple quotes at line 1. Default: no docstring.'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Scaffold a sibling Python module under src/<import_name>/authored/.
The module is created inside the composed authored/ submodule so
a later gaia author <verb> --file <name>.py (which routes into
authored/) can write into it.
Example:
.. code-block:: bash
gaia pkg add-module --name priors --imports register_prior \
--target ./mypkg-gaia --docstring "Priors module."
Source code in gaia/cli/commands/pkg/add_module.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
gaia.cli.commands.pkg.scaffold
gaia pkg scaffold — initialise a fresh Gaia knowledge package.
Maps the agent-first authoring story to package initialisation: given a
target directory and a package name, lay down the minimal layout that
the rest of the gaia author cycle needs (pyproject.toml with
[tool.gaia] block, src/<import_name>/__init__.py template,
.gaia/ artifact directory).
Why a new verb instead of reusing the legacy gaia init /
gaia build init? Two reasons:
- Agent-first envelope.
gaia initwrites human-oriented text to stdout and shells out touv;gaia pkg scaffoldemits the same uniform{status, code, verb, payload, warnings, diagnostics}shape thegaia author <verb>family does, so an LLM agent can parse one envelope schema across the whole package lifecycle. - Independent pre-validation surface.
scaffoldknows about-gaianaming, namespace defaults, and--checkintegration that runsgaia build checkagainst the freshly created package.
The scaffold verb writes its own pre-validation pipeline (target
directory absence + name ending + import-name validity) rather than
reusing :mod:gaia.cli.commands.author._prewrite — its 4 invariants
assume a pre-existing Gaia package, while scaffold creates one
from scratch. The JSON envelope is shared verbatim.
scaffold_command
scaffold_command(target: str = typer.Option(..., '--target', help='Path to the directory to initialise (must be empty or non-existent). Author verbs are run from outside the package, with --target <path>.'), name: str | None = typer.Option(None, '--name', help="Package name (must end with '-gaia'); defaults to target dir name."), namespace: str | None = typer.Option(None, '--namespace', help='Package namespace; defaults to the import name.'), description: str | None = typer.Option(None, '--description', help='Short description for pyproject.toml.'), with_uuid: bool = typer.Option(False, '--with-uuid', help='Generate a [tool.gaia].uuid for the package. Default is to omit the field (matches the shipping example packages).'), docstring: str | None = typer.Option(None, '--docstring', help='Module docstring for the generated src/<import_name>/__init__.py. Wrapped in triple quotes at line 1. Default: no docstring.'), check: bool = typer.Option(False, '--check/--no-check', help='Run post-write `gaia build check` on the freshly created package. Default off — a fresh scaffold has no declarations yet, which the engine treats as an error. Re-run with `gaia build check` once author commands have added statements.'), human: bool = typer.Option(False, '--human', help='Render the envelope in human-readable form instead of JSON.'), interactive: bool = typer.Option(False, '--interactive', help='Prompt on pre-write warnings (no-op for scaffold — it emits no warnings).'), json_: bool = typer.Option(True, '--json/--no-json', help='JSON-first output (default; redundant for clarity).')) -> None
Scaffold a fresh Gaia knowledge package.
Example:
.. code-block:: bash
gaia pkg scaffold --target ./mypkg-gaia --name mypkg-gaia \
--docstring "My package."
Source code in gaia/cli/commands/pkg/scaffold.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |
gaia.cli.commands.inquiry
gaia inquiry — public CLI sub-app.
Public commands per spec §G3: focus, review. Additional ProofState-extension subcommands (Round A1) exposed under inquiry obligation / hypothesis / reject / tactics to support Lean-like reasoning process tracking, all implemented via state.json only — no mutation of .py source / IR / priors / beliefs.
focus_command
focus_command(target: str | None = typer.Argument(None, help='Focus target.'), clear: bool = typer.Option(False, '--clear', help='Clear current focus.'), push: bool = typer.Option(False, '--push', help='Push current focus and set new.'), pop: bool = typer.Option(False, '--pop', help='Pop saved focus off the stack.'), show_stack: bool = typer.Option(False, '--stack', help='Print focus stack.'), path: str = typer.Option('.', '--path', help='Package path.')) -> None
Inspect or update the current inquiry focus.
The inquiry focus is a state.json-only pointer to the claim, strategy,
or freeform topic the agent is currently working on. focus is
inspect-or-set: no args reads the current focus; a bare TARGET
sets it. The focus stack supports push/pop semantics so the agent
can dive into a sub-claim and resume.
Example:
.. code-block:: bash
# Read current focus:
gaia inquiry focus
# Set focus to a claim label:
gaia inquiry focus my_claim_label
# Push current focus and switch to a new one:
gaia inquiry focus other_claim --push
# Pop back to the prior focus:
gaia inquiry focus --pop
# Inspect the focus stack:
gaia inquiry focus --stack
# Clear the focus entirely:
gaia inquiry focus --clear
Source code in gaia/cli/commands/inquiry.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
obligation_add
obligation_add(target_qid: str = typer.Argument(..., help='QID the obligation is about.'), content: str = typer.Option(..., '-c', '--content', help='What must be shown.'), kind: str = typer.Option('other', '--kind', help='Diagnostic kind.'), path: str = typer.Option('.', '--path', '--target', help='Package path (--target accepted as an alias).')) -> None
Add a synthetic obligation for an inquiry target.
Records a "what must be shown" note against a target QID — a ProofState-style obligation visible in the inquiry review report. Pure state.json mutation; no IR / priors / beliefs change.
--kind selects the diagnostic kind; allowed values are
focus_weakness / other (default) / prior_hole /
structural_hole / support_weak (see VALID_OBLIGATION_KINDS
in :mod:gaia.engine.inquiry.state).
Example:
.. code-block:: bash
gaia inquiry obligation add my_claim \
-c "Show the prior is justified by the cited evidence." \
--kind prior_hole
Source code in gaia/cli/commands/inquiry.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
obligation_list
obligation_list(json_out: bool = typer.Option(False, '--json'), path: str = typer.Option('.', '--path', '--target')) -> None
List open synthetic obligations.
Prints every open obligation (kind, qid, target_qid, content) in
state.json. --json emits the same rows as a JSON array for
machine consumption.
Example:
.. code-block:: bash
gaia inquiry obligation list
gaia inquiry obligation list --json
Source code in gaia/cli/commands/inquiry.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
obligation_close
obligation_close(qid: str = typer.Argument(...), path: str = typer.Option('.', '--path', '--target')) -> None
Close a synthetic obligation by QID.
Removes the obligation with the given QID from state.json; logs a
obligation_close tactic event. Exits non-zero when no obligation
matches the QID. QIDs are printed by gaia inquiry obligation
list.
Example:
.. code-block:: bash
gaia inquiry obligation close oblig_a1b2c3d4
Source code in gaia/cli/commands/inquiry.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
hypothesis_add
hypothesis_add(content: str = typer.Argument(..., help='Hypothesis content.'), scope: str | None = typer.Option(None, '--scope', help='Scope QID.'), path: str = typer.Option('.', '--path', '--target')) -> None
Add a working hypothesis to inquiry state.
Records a tentative hypothesis the agent wants to track during
inquiry without committing it to the DSL / IR. Pure state.json
mutation. --scope optionally pins the hypothesis to a specific
target QID so the inquiry review report can group it with related
claims.
Example:
.. code-block:: bash
gaia inquiry hypothesis add "The prior is robust to ±10% perturbation."
gaia inquiry hypothesis add "Bayes factor > 10 under diffuse alt." \
--scope my_claim_id
Source code in gaia/cli/commands/inquiry.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
hypothesis_list
hypothesis_list(json_out: bool = typer.Option(False, '--json'), path: str = typer.Option('.', '--path', '--target')) -> None
List working hypotheses from inquiry state.
Prints every recorded hypothesis (qid, scope_qid, content) from
state.json. --json emits a JSON array for machine consumption.
Example:
.. code-block:: bash
gaia inquiry hypothesis list
gaia inquiry hypothesis list --json
Source code in gaia/cli/commands/inquiry.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
hypothesis_remove
hypothesis_remove(qid: str = typer.Argument(...), path: str = typer.Option('.', '--path', '--target')) -> None
Remove a working hypothesis by QID.
Drops the hypothesis with the given QID from state.json. QIDs are
printed by gaia inquiry hypothesis list.
Example:
.. code-block:: bash
gaia inquiry hypothesis remove hyp_a1b2c3d4
Source code in gaia/cli/commands/inquiry.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
reject_command
reject_command(strategy: str = typer.Argument(..., help='Target strategy label/id.'), content: str = typer.Option(..., '-c', '--content', help='Reason.'), path: str = typer.Option('.', '--path', '--target')) -> None
Record a synthetic rejection for a strategy.
Annotates a strategy with a free-text rejection note (e.g. "the cited evidence does not actually support this", "argument is circular"). Pure state.json mutation; the strategy stays in the IR. Useful as a self-review affordance: a rejected strategy can later be revisited or removed from the DSL source.
Example:
.. code-block:: bash
gaia inquiry reject my_strategy_label \
-c "Premise A is not yet established."
Source code in gaia/cli/commands/inquiry.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
tactics_log
tactics_log(json_out: bool = typer.Option(False, '--json'), path: str = typer.Option('.', '--path', '--target')) -> None
Print the inquiry tactic event log.
Renders the append-only audit log of every inquiry state mutation
(focus / obligation / hypothesis / reject / review events) in
chronological order. --json emits one JSON record per entry for
machine consumption.
Example:
.. code-block:: bash
gaia inquiry tactics log
gaia inquiry tactics log --json
Source code in gaia/cli/commands/inquiry.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
context_command
context_command(path: str = typer.Argument('.', help='Package path.'), focus_: str | None = typer.Option(None, '--focus'), trajectory: str = typer.Option('most_uncertain', '--trajectory'), order: str = typer.Option('backward', '--order'), json_out: bool = typer.Option(False, '--json')) -> None
Render a focus-centered context packet for the current inquiry claim.
Source code in gaia/cli/commands/inquiry.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |
review_command
review_command(path: str = typer.Argument('.', help='Package path.'), focus_: str | None = typer.Option(None, '--focus'), mode: str = typer.Option('auto', '--mode'), no_infer: bool = typer.Option(False, '--no-infer'), depth: int = typer.Option(0, '--depth'), since: str | None = typer.Option(None, '--since'), json_out: bool = typer.Option(False, '--json'), markdown_out: bool = typer.Option(False, '--markdown'), strict: bool = typer.Option(False, '--strict')) -> None
Run the local semantic inquiry review.
Executes the semantic inquiry loop on the package: graph-health
diagnostics, focus-relevance analysis, optional inference, and
publish-readiness blockers. Writes a timestamped review artifact
under .gaia/inquiry/reviews/.
--mode selects the review profile:
auto(default) — pick a profile based on the package stateformalize— emphasise scaffolded / unformalised claimsexplore— bias towards weak / orphaned claimsverify— emphasise prior coherence + Bayes diagnosticspublish— full publish-readiness gates (combine with--strict)
--no-infer skips the BP inference step (faster but misses
belief-derived diagnostics); --depth N controls dependency
inference depth as in gaia run infer.
Example:
.. code-block:: bash
gaia inquiry review .
gaia inquiry review . --mode publish --strict
gaia inquiry review . --no-infer --json
gaia inquiry review . --focus my_claim_label --markdown > review.md
Source code in gaia/cli/commands/inquiry.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
gaia.cli.commands.trace
Public gaia trace CLI sub-app.
Commands per ARM Trace v1: verify — 仅 schema + hash chain 校验,秒级 fail-fast review — 完整八段 review,stdout/json/markdown show — 列事件流(tactic_log 风格)
Exit codes: 0 clean / no errors 1 tampered / errors found 2 schema-broken / bad CLI args
verify_command
verify_command(trace_path: str = typer.Argument(..., help='Path to trace file (.json/.jsonl).'), quiet: bool = typer.Option(False, '--quiet', help='Suppress non-error output.')) -> None
Verify trace schema and hash chain.
Fast schema + hash-chain check (seconds, fail-fast). Loads the trace,
validates each event's prev_hash forms an unbroken chain from
GENESIS, then checks the manifest's events_root and
manifest_hash against recomputed values.
Exit codes
- 0 — clean
- 1 — hash chain / manifest mismatch (tampering)
- 2 — schema error / unreadable file
Example:
.. code-block:: bash
gaia trace verify path/to/trace.json
gaia trace verify path/to/trace.jsonl --quiet
Source code in gaia/cli/commands/trace.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
review_command
review_command(trace_path: str = typer.Argument(..., help='Path to trace file (.json/.jsonl).'), mode: str = typer.Option('trace', '--mode', help='Ranking mode: trace|publish.'), package: str | None = typer.Option(None, '--package', help='Gaia package path used to resolve claim_ref review_ids.'), json_out: bool = typer.Option(False, '--json', help='Emit JSON report (deterministic).'), markdown_out: bool = typer.Option(False, '--markdown', help='Emit Markdown report.'), snapshot_dir: str | None = typer.Option(None, '--snapshot-dir', help='Override snapshot output directory.'), strict: bool = typer.Option(False, '--strict', help='Exit non-zero whenever any error/warning diagnostic is present.')) -> None
Run the full ARM trace review (eight-section review).
Performs the complete ARM trace review: schema + chain + decision
soundness + tool-call validity + retry hygiene + claim_ref resolution
+ manifest coherence + ranking. --mode trace (default) emits the
generic review; --mode publish adds publish-readiness gates.
--package lets the reviewer resolve claim_ref review_ids against
a Gaia package's review manifest.
Exit codes
- 0 — clean (no error diagnostics; no warning blockers under --strict)
- 1 — error-level diagnostic, or any warning under
--strict - 2 — invalid CLI argument combination
Example:
.. code-block:: bash
gaia trace review path/to/trace.json
gaia trace review path/to/trace.json --mode publish --strict
gaia trace review path/to/trace.json --json > review.json
gaia trace review path/to/trace.json --markdown > review.md
Source code in gaia/cli/commands/trace.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
show_command
show_command(trace_path: str = typer.Argument(..., help='Path to trace file (.json/.jsonl).'), limit: int = typer.Option(50, '--limit', help='Max events to print (0 = all).'), kind: str | None = typer.Option(None, '--kind', help='Filter by event kind (decision/tool_call/...).'), json_out: bool = typer.Option(False, '--json', help='Emit JSONL of selected events.')) -> None
Print the trace event stream (tactic_log style).
Walks the events list in seq order and prints a compact one-line summary per event (kind, actor, ts, plus kind-specific detail). On schema violations the loadable events are still printed; schema issues go to stderr.
--kind filters by event kind (decision / tool_call /
retry / etc.); --limit 0 shows every event; --json
emits one JSON line per event for machine consumption.
Example:
.. code-block:: bash
gaia trace show path/to/trace.json
gaia trace show path/to/trace.json --kind tool_call --limit 0
gaia trace show path/to/trace.json --json > events.jsonl
Source code in gaia/cli/commands/trace.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |