Installation

Get AI4BayesCode running.

Two ways to use AI4BayesCode:

New here? Install both. Generate your sampler with a coding agent, then run it with the R or Python package.

AI4BayesCode runs through a coding agent, for example Claude Code, Cursor, or Codex. A chat-only LLM like ChatGPT can’t be used, because the agent needs to work with files on your computer and run code to validate the sampler it builds.

The repository root is the skill package. Install it once, reload, then launch it and describe your model.

Claude Code
# clone, copy in, then delete the clone (re-run to update)
git clone https://github.com/zjg540066169/AI4BayesCode.git
cd AI4BayesCode
mkdir -p ~/.claude/skills
rsync -a --delete --exclude '.git/' ./ ~/.claude/skills/AI4BayesCode/
cd .. && rm -rf AI4BayesCode

Reload Claude Code, then type /AI4BayesCode.

Codex
# clone, copy in, then delete the clone (re-run to update)
git clone https://github.com/zjg540066169/AI4BayesCode.git
cd AI4BayesCode
mkdir -p ~/.codex/skills
rsync -a --delete --exclude '.git/' ./ ~/.codex/skills/AI4BayesCode/
cd .. && rm -rf AI4BayesCode

Restart Codex, then type /Ai4bayescode (Codex lowercases the skill name, so only the first letter is capitalized).

Other coding agent
# clone the repo (no skills dir needed)
git clone https://github.com/zjg540066169/AI4BayesCode.git

# then tell your coding agent:
Read AI4BayesCode/start.md first,
then: <your model description>

No slash command needed. Cursor, Windsurf, Cline, aider, or any coding agent (one with local-file & code access) launches by reading start.md, which routes you to generate-vs-design and loads the rest on demand.

With the R or Python package installed, the sampler the agent writes finds the AI4BayesCode library on its own, so you never have to point it at a folder by hand.

After install, launch it. Use the slash command in Claude Code / Codex, or tell any other coding agent to "Read AI4BayesCode/start.md first". It first asks what you want to do: generate a sampler (compose existing blocks for your model) or design a new block (build a new sampling primitive). Choose generate a sampler, then describe your model in plain typeable text (spell Greek out: beta, sigma):

# Claude Code: /AI4BayesCode    ·    Codex: /Ai4bayescode
# Cursor / other coding agent: "Read AI4BayesCode/start.md first"
# then choose "generate a sampler", and describe the model:
y ~ N(Xbeta, sigma^2) with Jeffreys prior p(sigma^2) propto 1/sigma^2

The block-design flow is the other path, for building a new sampling primitive when no existing block fits. It runs only in a coding agent, not in the R or Python package. Pure-C++ users need only a C++17 compiler. The bundled include/ headers are the install.