MIT-licensed Go coding agent for the terminal: targeted hashline edits, isolated sub-agents, a permission gate, and low-token MCP. Pairs with DeepSeek models; ~12 MB, no Node/Python runtime.
DSH integration
Ecosystem-related
Author-claimed
Safety audit
Unaudited
Last verified
2026-08-24
License
MIT
01What can it help you accomplish?
Run a coding agent in the terminal that edits files via hashline anchors and spawns isolated sub-agents
A TUI-driven agent loop with targeted edits, persisted sessions under ~/.phi/session, and isolated sub-agent jobs summarized back to the parent
Developers who want a minimal, cheap, local-first terminal coding agent that works with any OpenAI-compatible or Anthropic model
Drive coding tasks headlessly in CI or benchmarks
One agent loop without a TUI, emitting JSONL events to stdout (--jsonl) with defined exit codes (0/1/2/3)
Teams automating coding tasks in pipelines, needing machine-readable output and a strict permission gate
02How to install into DeepSeek Harness
Prerequisites
- A model API key for an OpenAI-compatible or Anthropic endpoint (set PHI_API_KEY / PHI_MODEL / PHI_BASE_URL, or use `phi config`)
- To build from source: Go 1.26.3+ (see go.mod)
Installation steps
- 01
macOS / Linux — install the latest release: `curl -fsSL https://raw.githubusercontent.com/pulseaiclub/phi/main/scripts/install.sh | bash`
$ curl -fsSL https://raw.githubusercontent.com/pulseaiclub/phi/main/scripts/install.sh | bash
- 02
Windows (PowerShell 5.1+) — `irm https://raw.githubusercontent.com/pulseaiclub/phi/main/scripts/install.ps1 | iex`
- 03
Or build from source: `make build` (produces ./phi) then `make install` (into $GOBIN)
Verify the integration
- Query the latest release without installing: `phi update --check`
- Check configured MCP servers: `phi mcp doctor`
03DSH integration and capability boundaries
Terminal coding-agent harness that pairs well with DeepSeek models (PHI_MODEL / PHI_API_KEY / PHI_BASE_URL env vars + DeepSeek Flash recommended); no native dsh runtime binding
Hashline edits
whole-file `@file path#TAG` plus line `LINE#HASH` anchors→targeted edits; stale tags/hashes are rejected to stop over-edits and silent corruption
writes files on disk, gated by the permission policy (workspace_only_writes default true)Sub-agents
agent_spawn with a role (explore | review | worker)→isolated jobs; only a short wait/task summary is returned to the parent context
sub-agent transcripts live under ~/.phi/jobs/<id>/ and are not injected into the parent contextPermission gate
modes interactive | readonly | autopilot | headless-strict; per-tool bash.allow / bash.deny rules→Gate / Ask before destructive tools fire; headless `phi run` folds ask → deny
can deny or allow shell commands; dangerously_allow_all defaults to falseMCP without context death
configure any number of MCP servers; meta-tools mcp_list / mcp_inspect / mcp_call→server tool schemas never enter the model prompt — only server names; lazy subprocess start on first use
spawns MCP subprocesses; calls still pass through PreHooks → Gate / Ask → Run → PostHooks
04Who is it for? When not to use it?
Good for
- Developers who want a minimal, cheap, local-first terminal coding agent that works with any OpenAI-compatible or Anthropic model
- Teams automating coding tasks in pipelines, needing machine-readable output and a strict permission gate
Not for
- phi reads/writes your working tree: `write`/`edit` are gated by the permission policy, and workspace_only_writes defaults to true. Use readonly / headless-strict modes to deny writes.
05Compatibility, maintenance and safety notes
- Building from source requires Go 1.26.3 or newer (see go.mod); the install script pulls a prebuilt release so it is not required for binary installs.
- phi needs network access to reach the model provider (OpenAI-compatible or Anthropic) via base_url; searches also download `fd`/`rg` into ~/.phi/bin on first use when missing.
- phi reads/writes your working tree: `write`/`edit` are gated by the permission policy, and workspace_only_writes defaults to true. Use readonly / headless-strict modes to deny writes.
MIT · actively maintained (latest release v0.16.0, 2026-08-22)
06Frequently asked questions
How do I install phi and connect a DeepSeek model?
On macOS/Linux run `curl -fsSL https://raw.githubusercontent.com/pulseaiclub/phi/main/scripts/install.sh | bash`; on Windows run the PowerShell install script. Then set `PHI_MODEL`/`PHI_API_KEY` (e.g. a DeepSeek endpoint) or run `phi config` to write ~/.phi/config.yaml. DeepSeek Flash is the recommended model per the README.
What makes phi's edits safer than a normal agent rewrite?
phi uses hashline edits: the model points at whole-file `@file path#TAG` anchors plus `LINE#HASH` line anchors instead of rewriting whole files. Stale tags/hashes are rejected, which stops over-edits and silent file corruption before they land.
How do sub-agents avoid bloating the parent context?
Sub-agent tools (`agent_spawn`, `agent_wait`, …) are on by default. Their full transcripts live under `~/.phi/jobs/<id>/` and are never injected into the parent context — only a short wait/task summary is returned to the parent.
How does phi keep MCP from eating my context window?
phi lists only configured MCP server names in the system prompt and gives the agent three meta-tools (`mcp_list` / `mcp_inspect` / `mcp_call`). Tool schemas never enter the prompt, and server subprocesses start lazily on first use, so you pay ~0 schema tokens until you actually call a tool.
Can I run phi unattended in CI, and how do permissions behave?
Yes — `phi run -p "…"` runs one agent loop headlessly and emits JSONL to stdout with exit codes 0/1/2/3. In headless mode `ask` decisions are denied (headless-strict safety), so readonly-style behavior applies; pass `--yolo` only for benchmarks/CI that need arbitrary shell.
07Related DSH workflows
deepseek-reasonix
by esengine
DeepSeek-native AI coding agent for your terminal. Engineered around prefix-cache stability — leave it running.
mnemon
by mnemon-dev
LLM-supervised persistent memory for AI agents — graph-based recall, cross-session knowledge, single binary. Works with DeepSeek Harness, Claude Code, OpenClaw, and any agent runtime.
sivtr
by ariestar
A unified memory workspace for agents and people, making terminal output and AI session context searchable and reusable across local workspaces.
caliper
by edonadei
Run your real agent with and without your skills, MCPs, and rules. See which ones actually help, and what they cost in tokens. Supports Claude Code, Codex, Pi, and Hermes.
08Data and sources
phi + DeepSeek Flash — the best pairing: grounded, low hallucination, cache hit rates near 100%.
export PHI_MODEL=gpt-4o export PHI_API_KEY=sk-...
This page is generated from the project’s public documentation, repository metadata and a structured parse of DSH Plugins; last verified on 2026-08-24. Found an error? Submit a correction.
Best DeepSeek Harness Plugins
Twelve plugins worth installing first — picked from the whole catalog, across every category.
