Skip to content

dpaschal/phantasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Thanks!

β˜• Buy me Claude Code credits or support a project! β˜•

Every donation keeps the code flowing β€” these tools are built with your support.

Buy Me A Coffee


Phantasm

License: MIT Rust Tests

AI-powered game trainer for Linux/Steam. Describe what you want in plain English β€” the AI finds it.

Classic Amiga trainer philosophy meets modern AI. Phantasm uses Claude to automate memory discovery, cheat generation, and post-update adaptation for Steam games running under Proton/Wine on Linux.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        PHANTASM                              β”‚
β”‚                                                              β”‚
β”‚  "I want infinite health"                                    β”‚
β”‚                                                              β”‚
β”‚  AI: Scanning for float values...                            β”‚
β”‚  AI: Take some damage, then tell me.                         β”‚
β”‚  AI: Found 3 candidates. Writing test value...               β”‚
β”‚  AI: Health locked at 100.0 β€” bound to F1.                   β”‚
β”‚                                                              β”‚
β”‚  [F1] Infinite Health  βœ“  [F2] Max Gold  βœ“  [F3] No Fall  βœ“ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Features

  • AI-Driven Cheat Discovery β€” Tell Claude what you want. It figures out the memory addresses, value types, and scan strategy automatically.
  • Memory Scanner β€” Exact value, unknown initial, fuzzy float, and changed/unchanged scans across 2-4GB game processes in seconds.
  • AOB Pattern Scanner β€” Array of bytes scanning with wildcard (??) support for finding code signatures that survive game updates.
  • Code Patching β€” NOP sleds, forced branches, conditional jump removal. The AI understands x86/x64 assembly.
  • Pointer Chain Resolution β€” Multi-level pointer chains with ASLR-aware module-relative base addresses.
  • Freeze Loop β€” Background 60Hz write loop to lock values (health, ammo, gold) at their cheat values.
  • Cheat Engine Import β€” Import .CT files from Cheat Engine and forum posts directly into Phantasm's format.
  • Auto-Adaptation β€” When a game updates and addresses shift, the AI re-discovers them using AOB signatures.
  • TUI (Terminal) β€” ratatui-based keyboard-driven interface with dashboard, scanner, AI chat, and cheat table views.
  • Web Dashboard β€” Dark-themed browser UI at localhost:13337 with process manager, AI workspace, memory viewer, and cheat editor.
  • Hotkey System β€” Global hotkeys via /dev/input that work even when the game has focus (Wayland compatible).
  • Proton/Wine Aware β€” Auto-detects Steam games running under Proton, resolves Windows-style module names.

Quick Start

Prerequisites

  • Rust 1.93+ (Arch: pacman -S rust, or rustup.rs)
  • Linux with /proc filesystem (any modern distro)
  • Root or CAP_SYS_PTRACE for memory access
  • Anthropic API key for AI features (optional β€” scanner works without it)

Build

git clone https://github.com/dpaschal/phantasm.git
cd phantasm
cargo build --release

The binary is at target/release/phantasm.

Usage

# List running Steam/Proton game processes
sudo phantasm ps

# Attach to a game by name or PID
sudo phantasm attach "Grim Dawn"
sudo phantasm attach 12345

# Launch the TUI (terminal interface)
sudo phantasm tui

# Launch the web dashboard
sudo phantasm web              # default port 13337
sudo phantasm web -p 8080      # custom port

# Load a saved cheat table
sudo phantasm load ~/.config/phantasm/tables/grimdawn.toml

# Import a Cheat Engine table
sudo phantasm import trainer.ct
sudo phantasm import trainer.ct -o grimdawn.toml

Note: sudo is required for /proc/pid/mem access. Alternatively, grant CAP_SYS_PTRACE:

sudo setcap cap_sys_ptrace=eip target/release/phantasm

AI Setup

Set your Anthropic API key to enable AI features:

export ANTHROPIC_API_KEY="sk-ant-..."

Then use the AI chat in the TUI (Tab 3) or web dashboard to describe what cheats you want.

Architecture

phantasm (single binary)
β”œβ”€β”€ mem/           Memory engine
β”‚   β”œβ”€β”€ process    Process attach, /proc/pid/mem, region enumeration
β”‚   β”œβ”€β”€ scanner    Value scanning (exact, changed, fuzzy)
β”‚   β”œβ”€β”€ writer     Write operations (single, freeze, toggle, patch)
β”‚   β”œβ”€β”€ pattern    AOB signature scanning with wildcards
β”‚   β”œβ”€β”€ pointer    Multi-level pointer chain resolution
β”‚   └── freeze     Background 60Hz write loop
β”œβ”€β”€ ai/            AI orchestrator
β”‚   β”œβ”€β”€ client     Claude Messages API with tool use
β”‚   β”œβ”€β”€ strategy   Tool dispatch (scan, read, write, disassemble)
β”‚   └── adapter    Post-update cheat table recovery
β”œβ”€β”€ cheat/         Cheat management
β”‚   β”œβ”€β”€ table      CheatTable TOML serialization
β”‚   β”œβ”€β”€ entry      Cheat definitions (value, patch, pointer chain)
β”‚   β”œβ”€β”€ hotkey     Global hotkeys via evdev /dev/input
β”‚   └── import     Cheat Engine .CT file parser
β”œβ”€β”€ tui/           Terminal interface (ratatui)
β”‚   └── views      Dashboard, Scanner, AI Chat, Cheats
└── web/           Web dashboard
    β”œβ”€β”€ server     axum REST API (localhost:13337)
    β”œβ”€β”€ api        8 REST endpoints + WebSocket
    └── frontend   Embedded dark-theme single-page app

Cheat Table Format

Phantasm stores cheat tables as human-readable TOML files in ~/.config/phantasm/tables/:

[meta]
game = "Grim Dawn"
steam_app_id = 219990
executable = "Grim Dawn.exe"
version = "1.2.1.0"
created = "2026-02-18"
last_verified = "2026-02-18"
ai_adaptable = true

[[cheats]]
name = "Infinite Health"
description = "Locks player health at max"
hotkey = "F1"
enabled = false

[cheats.target]
type = "f32"
value = 100.0
mode = "freeze"

[cheats.target.pointer_chain]
base_module = "Game.dll"
base_offset = 0x01A3F4C0
offsets = [0x28, 0x10, 0xB8, 0x60]

[cheats.target.aob_signature]
pattern = "F3 0F 11 86 ?? ?? ?? ?? 48 8B 5C 24"
offset = 0

[[cheats]]
name = "No Fall Damage"
hotkey = "F3"

[cheats.target]
type = "bytes"
mode = "patch"
original = "0F 85 A3 00 00 00"
patched  = "90 90 90 90 90 90"

[cheats.target.aob_signature]
pattern = "0F 85 ?? ?? ?? ?? F3 0F 10 45"
offset = 0

Cheat Engine Import

Import .CT files from Cheat Engine or cheat forums:

# Import a .CT file β€” outputs a .toml cheat table
phantasm import my_trainer.ct

# Specify output path
phantasm import my_trainer.ct -o ~/.config/phantasm/tables/game.toml

Phantasm parses the CT XML format and converts:

  • Variable types (Float, 4 Bytes, Double, etc.)
  • Pointer chains (with CE's reversed offset order)
  • AOB signatures
  • Hotkeys (Windows virtual key codes to Linux key names)

Web Dashboard

The web dashboard runs at http://localhost:13337 and provides:

Tab Function
Processes Detect and attach to running Steam/Proton games
AI Chat Natural language cheat discovery with Claude
Scanner Manual memory scanning with type selection
Cheats View and toggle active cheat table entries
Tables Browse and load saved cheat tables

Dark theme with green/cyan accents β€” classic trainer aesthetic.

TUI Controls

Key Action
1-4 Jump to view (Dashboard/Scanner/Chat/Cheats)
Tab Next view
Shift+Tab Previous view
q Quit
F1-F12 Toggle cheats (configurable)
Home Master toggle (all cheats on/off)
Insert Show/hide TUI

Configuration

~/.config/phantasm/config.toml:

[general]
web_port = 13337
tui_toggle_key = "Insert"
master_toggle_key = "Home"
tables_dir = "~/.config/phantasm/tables"

[ai]
api_key_env = "ANTHROPIC_API_KEY"
model = "claude-sonnet-4-5-20250929"
max_tokens = 4096

[steam]
library_path = "~/.local/share/Steam/steamapps"
proton_aware = true

How the AI Works

When you tell Phantasm "I want infinite health", the AI:

  1. Classifies the request β€” health is likely a float (f32), range 1-10000, decreases when taking damage
  2. Generates a scan plan β€” "take damage" β†’ decreased scan β†’ "heal" β†’ increased scan β†’ narrow candidates
  3. Executes using memory engine tools β€” scan, read, write, disassemble
  4. Creates a cheat entry β€” address, type, freeze value, hotkey, AOB signature for persistence
  5. Adapts after game updates β€” re-scans using saved AOB signatures to find new addresses

The AI has 8 tools at its disposal:

Tool Purpose
scan_exact Find all addresses holding a specific value
scan_changed Narrow by increased/decreased/unchanged
read_address Read memory at an address
write_address Write a value to memory
list_regions Enumerate process memory regions
aob_scan Signature scan with ?? wildcards
resolve_pointer Follow a pointer chain
disassemble Disassemble x86/x64 instructions

Testing

# Run all 96 tests
cargo test

# Run specific test suites
cargo test --test mem_process     # 19 tests β€” process attachment, maps parsing
cargo test --test mem_scanner     # 22 tests β€” exact/changed value scanning
cargo test --test mem_pattern     # 5 tests  β€” AOB pattern scanning
cargo test --test mem_writer      # 4 tests  β€” write operations
cargo test --test mem_pointer     # 2 tests  β€” pointer chains
cargo test --test cheat_table     # 3 tests  β€” TOML serialization
cargo test --test cheat_hotkey    # 11 tests β€” hotkey key name parsing
cargo test --test cheat_import    # 7 tests  β€” CT file import
cargo test --test ai_client       # 13 tests β€” Claude API client
cargo test --test ai_strategy     # 5 tests  β€” tool dispatch routing

Security Considerations

  • Requires elevated privileges (root or CAP_SYS_PTRACE) to read/write game memory
  • API key is read from environment variable, never stored in config files
  • Web dashboard binds to 127.0.0.1 only β€” no remote access
  • No telemetry, no phoning home, no data collection
  • Cheat tables are local files β€” nothing is shared without explicit user action

Disclaimer

Phantasm is designed for single-player and offline games. Using memory modification tools in online/multiplayer games may violate terms of service and result in bans. Use responsibly.

License

MIT License β€” see LICENSE for details.

Contributing

Contributions welcome! Please open an issue or PR on GitHub.


Built with Rust, powered by Claude AI.

Buy Me A Coffee

About

AI-powered game trainer for Linux/Steam

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages