Skip to main content

AILED — Psyche & Personality System for Chess Engines

Architecture-agnostic middleware that gives any chess engine an emotional state.

A continuous psyche score (ψ ∈ [−100, +100]) tracks position quality move-by-move and drives a five-stage audio-inspired signal chain that reshapes the engine's move probability distribution — without any search, tree traversal, or model retraining.

Works as a drop-in layer on top of any move predictor that outputs logits or probabilities: Maia2, Stockfish NNUE policy heads, or your own transformer.

This module is a partial release accompanying the research paper: "Ailed: A Psyche-Driven Chess Engine with Dynamic Emotional Modulation"


What It Does

Psyche System

The PsycheCalculator evaluates the board position after every move across five factors:

Factor Default Weight Description
Material 10 Piece value difference (P=1, N/B=3, R=5, Q=9)
King safety 5 Pawn shield + nearby enemy attackers
Pieces attacked 3 Own pieces under attack
Center control 2 Attacks on d4/d5/e4/e5
Mobility 1 Legal moves minus opponent's legal moves

These are combined, tanh-compressed to [−100, +100], and blended into the running psyche state with configurable reactivity, phase-awareness (opening/middlegame/endgame), sacrifice dampening, and daily decay toward neutral.

Game Phase Detection

Phase is detected per move and controls reactivity scaling (opening = dampened, middlegame = baseline, endgame = strongly dampened / freeze-biased by default, all configurable via PsycheConfig):

Phase Condition
Opening fullmove ≤ 15 and non-pawn/non-king material loss < 6 pts
Endgame total non-pawn/non-king material on board ≤ 13 pts
Middlegame everything else

Endgame takes priority. The opening threshold prevents damped reactivity from masking rapid early collapses — gambits, sacrifices, or early trades that lose 6+ points of material (≈ two minor pieces) exit opening phase immediately, even before move 15. Both thresholds are configurable via PsycheConfig:

from ailed.psyche.config import PsycheConfig

config = PsycheConfig(
    opening_move_limit=15,               # fullmove limit for opening phase
    opening_material_loss_threshold=6,   # points lost to exit opening early (default: 6)
    endgame_material_threshold=13,       # total material to enter endgame
)
from ailed.psyche import PsycheCalculator
import chess

calc = PsycheCalculator()          # default config
board = chess.Board()
psyche = 0.0                       # neutral at game start

board.push_san("e4")
psyche = calc.update_psyche(psyche, board)
print(f"ψ = {psyche:.1f}")        # e.g. ψ = 3.2

EQ Signal Chain

MoveSelector applies a full audio-inspired signal chain to the move probability distribution:

Softmax → Noise gate → Dynamics → Sort + EQ bands → Saturation → Renormalize → Sample
  1. Noise gate — silences moves below probability threshold
  2. Dynamics — compressor/expander on probability spread
  3. EQ bands — moves sorted into 5 quality bands, each with gain multiplier
  4. Saturation — soft-clips dominant moves
  5. Renormalize — produces valid distribution

All five parameters interpolate across N psyche anchors. At ψ = −70 (stressed) behavior differs dramatically from ψ = +70 (overconfident).

from ailed.uci.move_selector import MoveSelector
from ailed.uci.eq_curve import PRESETS
import torch, chess

selector = MoveSelector(curve=PRESETS["human"])
board = chess.Board()
legal_moves = list(board.legal_moves)
logits = torch.randn(len(legal_moves))

move = selector.select_move(
    legal_moves=legal_moves,
    move_logits=logits,
    base_confidence=0.8,
    psyche=-40.0,
)

Six Built-in Personalities

Name Character
human (default) Stressed → noisy. Confident → autopilot.
human5_symmetric Fine-grained psyche response (5 anchors).
human5_asymmetric Wider stress, narrower confidence zone.
classical Tight, positional, disciplined.
jazz Avoids obvious moves, boosts alternatives.
rock Bold, loves extremes (V-shape EQ).
metal Chaotic, everything gets a shot.
flat Bypass — raw probabilities.

Installation

Requires Python 3.11+.

pip install chess pydantic torch
git clone https://github.com/chrnx-dev/ailed-chess
cd ailed-chess
pip install -e .

Reproduce Core Checks

Run the package tests exactly as used for release readiness:

pytest -q

Minimal sanity check of psyche + selector behavior:

python - <<'PY'
import chess
import torch
from ailed.psyche import PsycheCalculator
from ailed.uci.move_selector import MoveSelector

board = chess.Board()
board.push_san("e4")

calc = PsycheCalculator()
psi = calc.update_psyche(0.0, board)

selector = MoveSelector()
legal = list(board.legal_moves)
logits = torch.randn(len(legal))
move = selector.select_move(legal_moves=legal, move_logits=logits, base_confidence=0.8, psyche=psi)

print(f"psyche={psi:.2f}, selected={move.uci()}")
PY

Architecture Agnosticism

Works on top of any move predictor that outputs logits or probabilities:

  • Maia2 (convert probability dict to log-probs)
  • Stockfish NNUE policy head
  • Your custom transformer
  • Any neural network with move output

The paper demonstrates this across two engines of vastly different scale (60K-game model vs 169M-game Maia2), showing consistent behavioral signatures from psyche regardless of base model.


What Is NOT Included

This repository contains only the psyche and personality modules.

Full AILED system (released with paper) includes:

  • Move predictor (23.5M param transformer)
  • Training pipeline
  • Lichess bot deployment
  • Web dashboard
  • Nightly study loop
  • Terminal UI

Community

Contributing Bug fixes, new psyche factors, EQ personalities, docs
Code of Conduct Contributor Covenant v2.1
Security Private vulnerability reporting via GitHub advisories
Issue templates Bug report · Feature request · Docs improvement

AI-generated contributions are welcome. Contributors are responsible for understanding and testing their code. Changes to critical paths (psyche math, phase detection, EQ signal chain) may require human validation before merge — see CONTRIBUTING.md for details.


Citation

Please cite both:

  • the software release (preferred via GitHub citation tools / CITATION.cff)
  • the arXiv paper once public
@misc{ailed2026,
  title={Ailed: A Psyche-Driven Chess Engine with Dynamic Emotional Modulation},
  author={Resendez Prado, Diego Armando},
  year={2026},
  eprint={TBD},
  archivePrefix={arXiv},
  primaryClass={cs.AI}
}

License

Apache 2.0 — see LICENSE.

Metadata

Release files for ailed-chess 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ailed-chess 2.0.0
File Size Uploaded Provenance
ailed_chess-2.0.0.tar.gz 25.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ailed-chess 2.0.0
File Interpreter ABI Platform
ailed_chess-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / ailed_chess-2.0.0.tar.gz

Download URL ailed_chess-2.0.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
61f046fa21334a058f9e8192485d1061c4f95085948d707385a58da1cee3b2eb
BLAKE2b-256 checksum
How to use checksums
606c6c0e8e020d889d5ceb5180cac79ebdf6bba6ff613e634c8a74d9af370ec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / ailed_chess-2.0.0-py3-none-any.whl

Download URL ailed_chess-2.0.0-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d354f97f5bbbbd94ce4a99b8f64233fc98a684656a9409374a67442fe3030c
BLAKE2b-256 checksum
How to use checksums
6c6f4f3eab5d1adbb9a298a9a0d762a988e4426e4b08a10855885854050f98c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Security for ailed-chess 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ailed_chess-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page