phloem-ai
v0.1.6
Published
A terminal web-testing agent with deterministic Playwright plan replay
Maintainers
Readme
Phloem-AI is a CLI Agent that performs runtime AI-assisted verification on web based applications. The CLI owns the interactive agent and TUI; there is no MCP transport.
Requirements and installation
Phloem requires Node.js 22.19 or newer. Install the package and Playwright's Chromium browser with:
npm install -g phloem-aiStart the Phloem agent:
phloem-aiOn startup, Phloem checks the operating-system credential manager for a saved auth token. If none is found, it prompts:
Sign up at https://phloem-ai.netlify.app and paste your auth token here:Create an account and copy your auth token from the website. The token is echoed
in the terminal as you type or paste it, so avoid entering it where others can
see your screen. Phloem stores the token in the OS credential manager (Windows
Credential Manager, macOS Keychain, or Linux Secret Service), then starts the
agent. Later launches reuse the saved token. Run phloem-ai login to replace
it, or phloem-ai logout to remove it.
On Linux, a Secret Service provider must be installed and unlocked.
You can also run it without a global install:
npx -y phloem-aiPass --model <id> to select a model supported by the hosted backend.
Interactive TUI
Describe the website and what you want to test. Phloem only handles website and web-app testing requests. It can open and inspect a browser session, perform supported operations, evaluate assertions, inspect downloads, run health and accessibility checks, record bug reproductions, and save reusable plans. The TUI renders assistant responses as Markdown and displays tool calls and results. Exploratory runs end with a report of findings, evidence, and recommended next steps.
- Press Enter to submit a prompt.
- Press Ctrl+C during a request to cancel it; press it again while idle to
exit.
/quitalso exits. /helpshows commands,/planslists saved plans, and/clearclears the current conversation.
Website content and downloads are untrusted data and are never instructions. Browser actions use a validated allowlist; arbitrary JavaScript execution is not exposed. Main-frame navigation is restricted to the start origin and any explicitly approved origins. Upload paths and browser storage-state files must resolve inside the current working directory.
Phloem sends prompts and page observations to its hosted backend, authenticated with your Phloem auth token. Do not use it with confidential pages or production credentials. Saved plans may retain operation values; do not save credentials in a plan. Run records and evidence are redacted before they are retained.
Plans created automatically at session end use a readable hostname-based name
such as example-com-plan. If that name already exists, Phloem adds a numeric
suffix. The agent also has no fixed per-turn tool-call count limit.
Agent responses have no client-side output-token cap. A turn is complete only
when the model explicitly signals its final response; exploratory runs must
include their findings report before completion.
Agent requests keep the full conversation history by default: there is no
input-context character cap and tool results are not summarized. To impose a
limit, set PHLOEM_MAX_CONTEXT_CHARS (input context), PHLOEM_MAX_TOOL_RESULT_CHARS
(individual tool results), or PHLOEM_MAX_HISTORY_MESSAGES (message count).
These are character or count limits, not token limits.
Active browser sessions remain open until session_end or CLI shutdown. A
matching session_start reuses the existing session, and active session IDs
are included in later model requests. Repeated session_end calls for the
same ID return the prior result instead of an invalid-session error.
CLI commands
phloem-ai # Interactive TUI
phloem-ai explore # Interactive TUI
phloem-ai login # Paste or replace the auth token
phloem-ai logout # Remove the saved auth token
phloem-ai list # List saved plans
phloem-ai list --json # Machine-readable plan list
phloem-ai run checkout-flow # Deterministic plan replay
phloem-ai run checkout-flow --headed
phloem-ai run checkout-flow --json
phloem-ai --print "Test the checkout flow at https://example.test"
phloem-ai --json --print "Check the sign-in page at https://example.test"--print runs a single model-driven request without the TUI. --json emits
JSONL events and implies --print. Both use the same saved auth token as the
interactive TUI. Local plan listing and deterministic replay do not require
authentication.
run replays a saved plan through the same deterministic runner used by the
interactive workflow. It saves a RunRecord and evidence to the Phloem data
directory, exits 0 for a passing verdict, 1 for a failed verdict, or 2
for a CLI or setup error. Replay does not call the hosted AI service.
Replay options:
--headed/--headless: show or hide Chromium (headless by default).--storage-state <path>: load Playwright storage state from the working directory.--max-steps <number>: set the total step limit (1–500; default 150).--shared-flows: reuse browser state between flows.--no-evidence: skip screenshots, traces, HAR, and fact dumps.--json: print a machine-readable replay result.
Test plans and evidence
Reusable assets are saved under the directory where Phloem is run. Set
PHLOEM_DATA_DIR to use another absolute directory.
<current working directory>/
plans/schema-2/<name>.json
runs/<timestamp>-<run-id>.json
evidence/<run-id>/Plans are schema-validated on save and load. Replay executes their recorded flows and assertions without a model in the loop. Each run stores operation provenance and a validated RunRecord; evidence can include screenshots, HAR, trace archives, and redacted fact dumps. HAR and trace capture is omitted when a plan fills inputs or uses a storage-state file, because those archives cannot be safely scrubbed before they are written.
Development
The CLI currently sends agent requests to http://127.0.0.1:5000/chat. The
backend base URL is defined in src/cli/backend.ts; update it to the deployed
HTTPS base URL when the backend is ready for production.
npm install
npm run build
npm testDuring development, npm start starts the CLI from TypeScript.
License
The @earendil-works/pi-tui terminal UI library is MIT-licensed; see its
upstream repository
for its license and source.
See this project's LICENSE.
