# Active Inference in PHP

> PHP implementation of Active Inference with belief updating, free energy minimization, and policy selection

- Skill: `activeinferenceinstitute/active-inference-in-php` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add activeinferenceinstitute/active-inference-in-php`
- Raw SKILL.md: https://api.skillmd.com/api/skills/activeinferenceinstitute/active-inference-in-php/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: activeinferenceinstitute (https://skillmd.com/u/activeinferenceinstitute)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/activeinferenceinstitute/active-inference-in-php

---


# Active Inference in PHP

## Overview

This skill provides a complete Active Inference implementation in PHP,
demonstrating Bayesian belief updating, variational free energy calculation,
and expected free energy-based policy selection.

## Core Algorithms

1. **Belief Updating**: Bayesian inference using observation likelihoods to update posterior beliefs
2. **Free Energy Calculation**: KL divergence between posterior beliefs and prior distribution
3. **Policy Selection**: Softmax action selection over expected free energy per action
4. **Perception-Action Loop**: Iterative sense → infer → act cycle with generative model

## Key Files

- `ActiveInferenceAgent.php` — Source implementation
- `run.sh` — Execution script (handles compilation if needed)
- `README.md` — Usage documentation and requirements

## Usage

```bash
cd 0_CONTEXT/Computer_Languages/PHP/
./run.sh
```

## Language-Specific Features

- Rapid prototyping and iteration
- Dynamic typing flexibility
- Rich standard library

## Integration

- Tested via `master_controller.py test php`
- Benchmarked via `benchmark_suite.py`
- Listed in `languages.json` under category "Scripting"

## Prerequisites

See `README.md` for PHP-specific installation requirements.

