phantom CLAUDE.md

A project instruction file for Phantom, an autonomous AI co-worker that runs as a long-lived Bun and TypeScript process. It documents Phantom’s technology, configuration, commands, testing, and communication channels.

In plain words
What is it for?
Use it when building, testing, configuring, or changing Phantom, including its memory system, chat channels, provider settings, and MCP server.
Why use it?
It gives coding agents the project context they need to work consistently in a large codebase and follow its required conventions.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/ghostwright/phantom/claude-md
Clone the repo
git clone --depth 1 https://github.com/ghostwright/phantom
Per session 9,391 This file is loaded in full into every session.
When invoked 9,391 The same file — it is already loaded in full.
Security scan D 3 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.09391 $0.09391
Opus 5 $0.04695 $0.04695
Sonnet 5 $0.01878 $0.01878
Haiku 4.5 $0.00939 $0.00939

Measured yesterday against content hash a3489a52dc14, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade D, and why

phantom CLAUDE.md scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- **Don't run as root in Docker.** Claude Code CLI rejects --dangerously-skip-permissions as root. The non-root phantom user with group_add for Docker socket is the correct pattern.

Cloud metadata endpointhighServer-side request forgery

One request to 169.254.169.254 can return temporary IAM credentials.

**Key fetch.** `src/email/key-fetcher.ts` exposes `ResendKeyFetcher` (gateway-backed, 15-minute cache; `GET http://169.254.169.254/v1/secrets/resend_api_key`) and `EnvKeyFetcher` (env-backed for local dev / OSS Docker wi

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl https://<slug>.phantom.ghostwright.dev/health/build-info
CLAUDE.md · 434 lines

How it starts

The opening of the file, as written. The whole thing — 434 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Phantom

Phantom is an autonomous AI co-worker that runs as a persistent Bun process on a VM. It wraps the Claude Agent SDK as a subprocess (Anthropic by default, swappable via a provider: config block to Z.AI/GLM-5.1, OpenRouter, Ollama, vLLM, LiteLLM, or any Anthropic Messages API compatible endpoint). It maintains vector-backed memory across sessions, rewrites its own configuration through a validated self-evolution engine, communicates via Slack/Web Chat/Telegram/Email/Webhook, and exposes all capabilities as an MCP server. 30,000+ lines of TypeScript, 1,819 tests, v0.20.2. Apache 2.0, repo at ghostwright/phantom.

Tech Stack

Layer Technology
Runtime Bun (TypeScript-native, built-in SQLite, no bundler)
Agent Claude Agent SDK (@anthropic-ai/claude-agent-sdk) subprocess. Provider is configurable via src/config/providers.ts: Anthropic (default), Z.AI, OpenRouter, Ollama, vLLM, LiteLLM, custom.
Memory Qdrant (vector DB, Docker) + Ollama (nomic-embed-text, local embeddings)
State SQLite via Bun (sessions, tasks, metrics, evolution versions, scheduled jobs)
Channels Slack (Socket Mode), Web Chat (SSE streaming), Telegram (long polling), Email (IMAP/SMTP), Webhook (HMAC-SHA256), CLI
Chat Client React 19 + Vite + shadcn/ui + Tailwind v4 SPA at /chat
Web UI Tailwind v4 Browser CDN + DaisyUI v5, static files from public/
MCP Streamable HTTP on /mcp, bearer token auth, 17+ tools
Infrastructure Docker (compose), Specter VMs (Hetzner), systemd (bare metal)
Lint/Format Biome
Test bun:test

The Cardinal Rule

TypeScript is plumbing. The Agent SDK is the brain.

The Agent SDK (Opus 4.7) has full computer access: Read, Write, Edit, Bash, Glob, Grep, WebSearch, Agent tools. It can understand natural language, read code, explore repos, detect tech stacks, clone repos, install packages, write configs, and reason about anything.

TypeScript handles: starting processes, routing messages, managing sessions, storing data, serving HTTP endpoints, tracking state. Mechanical, deterministic work.

Read the full file on GitHub · 434 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 434 lines · 9,391 tokens per session scan D a3489a52dc14

Subscribe to this mod's changes

phantom CLAUDE.md is an instructions file published in the GitHub repository ghostwright/phantom (1,463 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 9,391 tokens to every session, about $0.0470 per session on Opus 5. A static security scan graded it D with 3 findings (asks for root, cloud metadata endpoint, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.