Skip to content

Commit e90271d

Browse files
committed
Ship PHANTOM platform and operator upgrades
1 parent b36282f commit e90271d

124 files changed

Lines changed: 18933 additions & 455 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 173 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
![Python](https://img.shields.io/badge/python-3.11%2B-blue)
55
![License](https://img.shields.io/badge/license-MIT-green)
66

7-
Local-first autonomous agent runtime with planning, memory, tool use, human approval, and workflow learning.
7+
Teachable AI agent for controlled delegation. PHANTOM plans first, learns your workflows, and executes with human approval when it matters.
88

9-
PHANTOM is built for people who want an agent they can actually inspect and control:
9+
PHANTOM is built for people who need to delegate real work without surrendering control:
1010

11-
- ask-first CLI mode instead of surprise execution
11+
- ask-first CLI and chat experience instead of surprise execution
1212
- plan approval before action
13+
- persistent workflow learning from human demonstrations
1314
- parallel task orchestration with replanning
14-
- persistent memory and reusable skills
15-
- teach mode for repeated workflows
16-
- Telegram and WhatsApp chat integrations
15+
- auditable traces, replay, and rollback-friendly execution
16+
- Telegram and WhatsApp entry points to the same runtime
17+
- persistent HTTP gateway with first-class sessions and diagnostics
1718
- Groq / OpenAI-compatible / Anthropic provider support
1819

1920
Engineering reference: [`docs/ENGINEERING_REFERENCE.md`](docs/ENGINEERING_REFERENCE.md)
@@ -23,18 +24,30 @@ Security policy: [`SECURITY.md`](SECURITY.md)
2324

2425
## Why PHANTOM
2526

26-
Most agent projects are either:
27+
Most agent projects optimize for one of two things:
2728

28-
- thin shells around one model call
29-
- opaque hosted products you cannot inspect
30-
- large frameworks that are hard to reason about
29+
- instant autonomy with little control
30+
- polished hosted UX with limited ownership
31+
- large coordination frameworks that are hard to reason about
3132

32-
PHANTOM tries to stay in the useful middle:
33+
PHANTOM is aimed at a different category:
3334

34-
- small enough to audit
35-
- structured enough to harden
36-
- autonomous enough to finish real work
37-
- safe enough to keep a human in control
35+
`controlled delegation for consequential work`
36+
37+
Use PHANTOM when the task matters enough that you want:
38+
39+
- a clear plan before action
40+
- approval points for risky steps
41+
- memory that improves from your workflows over time
42+
- traces you can inspect when something goes wrong
43+
- autonomy that compounds instead of surprising you
44+
45+
The core ideas behind PHANTOM are:
46+
47+
- `controlled delegation`: delegate real work without losing understanding
48+
- `workflow learning`: teach the system once and let future runs improve
49+
- `structured skepticism`: challenge weak reasoning before bad actions cascade
50+
- `auditable execution`: plan, checkpoint, trace, replay, and recover
3851

3952
## Quick Start
4053

@@ -79,18 +92,69 @@ Ask-first mode:
7992
.venv/bin/python phantom.py
8093
```
8194

95+
This opens PHANTOM chat. You can type a task directly or choose memory, briefing, demos, signals, skills, and evals from the interactive hub.
96+
97+
Guided setup:
98+
99+
```bash
100+
.venv/bin/python phantom.py --onboard
101+
```
102+
103+
Extension registry:
104+
105+
```bash
106+
.venv/bin/python phantom.py --extensions
107+
```
108+
109+
Bundled playbook catalog:
110+
111+
```bash
112+
.venv/bin/python phantom.py --skills
113+
```
114+
115+
PHANTOM now ships both:
116+
117+
- native PHANTOM playbooks for controlled delegation, workflow learning, messaging, and chief-of-staff work
118+
- an imported OpenClaw compatibility catalog so we can reuse a much broader skill surface while we keep building PHANTOM-native tooling
119+
120+
Compatibility runtimes now include first-class tools for:
121+
122+
- `github_cli` for structured `gh` operations
123+
- `tmux_session` for structured tmux session control
124+
- `slack_channel` for structured Slack channel operations
125+
- `discord_channel` for structured Discord channel operations
126+
- `browser_session` plus session-aware `browser_workflow` for persistent browser state and resume/attach-style operator flows
127+
82128
Direct task mode:
83129

84130
```bash
85131
.venv/bin/python phantom.py "analyze the current workspace and summarize the main modules"
86132
```
87133

134+
Doctor:
135+
136+
```bash
137+
.venv/bin/python phantom.py --doctor
138+
```
139+
140+
Persistent gateway:
141+
142+
```bash
143+
.venv/bin/python phantom.py --serve-gateway --gateway-port 8787
144+
```
145+
88146
Plan approval mode:
89147

90148
```bash
91149
.venv/bin/python phantom.py --approve-plan "analyze the current workspace and summarize the main modules"
92150
```
93151

152+
Live activity page:
153+
154+
```bash
155+
.venv/bin/python phantom.py --live-ui --approve-plan "analyze the current workspace and summarize the main modules"
156+
```
157+
94158
## First Commands
95159

96160
```bash
@@ -103,15 +167,24 @@ Plan approval mode:
103167
# Show the plan before PHANTOM acts
104168
.venv/bin/python phantom.py --approve-plan "audit this repository and summarize risks"
105169

170+
# Watch a live dashboard while PHANTOM runs
171+
.venv/bin/python phantom.py --live-ui --approve-plan "review this repository and explain the architecture"
172+
106173
# Require approval for the plan and risky tool actions
107174
.venv/bin/python phantom.py --confirm "refactor this repository"
108175

109176
# Run offline evals
110177
.venv/bin/python phantom.py --evals
111178

179+
# Check runtime setup and missing dependencies
180+
.venv/bin/python phantom.py --doctor
181+
112182
# Inspect memory
113183
.venv/bin/python phantom.py --memory
114184

185+
# Ingest a raw message, meeting note, or document summary into chief-of-staff memory
186+
.venv/bin/python phantom.py --ingest-signal "We will send the launch summary before Friday." --signal-kind message --signal-source telegram --signal-title "Nadia follow-up" --signal-metadata '{"people":[{"name":"Nadia","relationship":"manager"}],"project":{"name":"Launch","status":"active"},"counterparty":"Nadia","due_at":"Friday"}'
187+
115188
# Inspect generated skills
116189
.venv/bin/python phantom.py --skills
117190
```
@@ -123,10 +196,25 @@ Plan approval mode:
123196
- critique its own reasoning before bad steps cascade
124197
- replan when tasks fail or get blocked
125198
- persist memory across runs
126-
- learn from human demonstrations
199+
- learn from human demonstrations and surface matching procedures
200+
- use a structured bundled playbook catalog with frontmatter, references, and PHANTOM-native workflow guidance
201+
- ingest raw work signals into chief-of-staff memory and extract people, projects, and commitments
202+
- stream a live activity page showing the current agent, task graph, tool calls, and run timeline
203+
- expose a persistent HTTP gateway with session history, health, and doctor endpoints
127204
- replay bounded browser workflows through Playwright
128205
- expose the same runtime through Telegram and WhatsApp
129206

207+
PHANTOM also takes a fast lane for tiny local tasks. For example, a one-file workspace architecture review now avoids the full planner/executor/critic loop and can complete in about a second instead of burning dozens of model calls.
208+
209+
## When To Reach For PHANTOM
210+
211+
PHANTOM is strongest when:
212+
213+
- the task has real consequences if done wrong
214+
- the workflow repeats often enough to benefit from learning
215+
- you want the agent to ask, explain, and remember
216+
- you care about what happened during the run, not just the final answer
217+
130218
## Human Control
131219

132220
PHANTOM is designed to work with humans, not around them.
@@ -135,6 +223,7 @@ PHANTOM is designed to work with humans, not around them.
135223
- `--approve-plan` shows the plan and waits for approval
136224
- `--confirm` requires approval for the plan and risky tool actions
137225
- messaging users get a prompt instead of silent failure on greetings or empty/image-only messages
226+
- messaging DMs default to pairing, so unknown senders cannot trigger runs until you approve them
138227

139228
This gives you a cleaner progression:
140229

@@ -145,7 +234,7 @@ This gives you a cleaner progression:
145234

146235
## Teach Mode
147236

148-
PHANTOM can learn repeated workflows from humans.
237+
PHANTOM can learn repeated workflows from humans, match them back to future tasks, and reuse the executable parts.
149238

150239
```bash
151240
.venv/bin/python phantom.py --teach "check dashboard health" \
@@ -176,6 +265,73 @@ Messaging behavior:
176265
- concrete text task -> run it
177266
- `/start`, `/help`, `hi`, `hello` -> ask what the user wants
178267
- empty or image-only message -> ask for a concrete text task or image caption
268+
- unknown sender -> receive a pairing code instead of triggering a run
269+
270+
Pairing commands:
271+
272+
```bash
273+
.venv/bin/python phantom.py --pairings
274+
.venv/bin/python phantom.py --approve-pairing telegram ABC123
275+
.venv/bin/python phantom.py --allowlist
276+
```
277+
278+
If you want public inbound DMs instead, opt in explicitly:
279+
280+
```bash
281+
export PHANTOM_MESSAGING_DM_POLICY=open
282+
```
283+
284+
## Gateway
285+
286+
PHANTOM can also run as a lightweight control plane with first-class sessions.
287+
288+
```bash
289+
.venv/bin/python phantom.py --serve-gateway --gateway-host 127.0.0.1 --gateway-port 8787
290+
```
291+
292+
Gateway endpoints:
293+
294+
- `POST /sessions` to start a run with a goal and optional workspace/scope override
295+
- `GET /sessions` to list recent sessions
296+
- `GET /sessions/<id>` to inspect a session snapshot
297+
- `GET /sessions/<id>/events` to stream session events
298+
- `GET /doctor` to inspect runtime health
299+
- `GET /healthz` for a simple health check
300+
301+
## Extensions
302+
303+
PHANTOM now has a manifest-based extension registry under `extensions/`.
304+
305+
Current built-in manifests cover:
306+
307+
- browser operator capabilities
308+
- chief-of-staff memory capabilities
309+
- messaging ingress and pairing
310+
311+
Use:
312+
313+
```bash
314+
.venv/bin/python phantom.py --extensions
315+
```
316+
317+
This is the foundation for a stricter future extension SDK so new connectors and operator features do not have to be hardcoded into core.
318+
319+
## Chief-Of-Staff Signal Ingestion
320+
321+
PHANTOM can store raw work signals and turn them into structured memory.
322+
323+
```bash
324+
.venv/bin/python phantom.py --ingest-signal "We will send the launch summary before Friday." \
325+
--signal-kind message \
326+
--signal-source telegram \
327+
--signal-title "Nadia follow-up" \
328+
--signal-metadata '{"people":[{"name":"Nadia","relationship":"manager"}],"project":{"name":"Launch","status":"active"},"counterparty":"Nadia","due_at":"Friday"}'
329+
330+
.venv/bin/python phantom.py --signals
331+
.venv/bin/python phantom.py --brief "launch summary for Nadia"
332+
```
333+
334+
This is the ingestion foundation for future email, calendar, docs, and chat connectors.
179335

180336
## Safety and Engineering Posture
181337

0 commit comments

Comments
 (0)