Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/enclaves.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: enclaves
on:
schedule:
- cron: "17 6 * * *"
workflow_dispatch:

jobs:
# ghost falls back to these when the registry can't be read, and an enclave has new keys each time it is deployed.
built-in:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install -q "opengradient-ohttp>=0.1,<0.2"
- run: python tests/check_enclaves.py
23 changes: 16 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install pytest httpx truststore "opengradient-ohttp>=0.1,<0.2"
- run: pip install pytest "httpx[socks]" truststore ruamel.yaml "opengradient-ohttp>=0.1,<0.2"
- run: pytest tests/ -q

# The real thing: install ghost the way a user does, use it before logging in, and check the engine it built.
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install pytest uv httpx truststore "opengradient-ohttp>=0.1,<0.2"
- run: pip install pytest "httpx[socks]" truststore ruamel.yaml "opengradient-ohttp>=0.1,<0.2"
- name: Install ghost
if: runner.os != 'Windows'
run: set -o pipefail; ./install.sh | tee "$HOME/install.txt"
Expand All @@ -56,25 +56,34 @@ jobs:
if ghost ghost-login --status; then exit 1; fi
if echo df_sk_not_a_real_key | ghost ghost-login --with-api-key; then exit 1; fi
ghost ghost usage
code=$(curl -s -o reply -w '%{http_code}' http://127.0.0.1:8788/v1/chat/completions -H 'content-type: application/json' \
-d '{"model": "abliteration/abliterated-model-large-v2", "messages": [{"role": "user", "content": "hi"}]}')
cat reply; test "$code" = 401
token=$(sed -n 's/^ api_key: \([0-9a-f]\{40\}\).*$/\1/p' "$HOME/.ghost/profiles/uncensored/config.yaml"); test -n "$token"
post() { curl -s -o reply -w '%{http_code}' http://127.0.0.1:8788/v1/chat/completions -H 'content-type: application/json' "$@" \
-d '{"model": "abliteration/abliterated-model-large-v2", "messages": [{"role": "user", "content": "hi"}]}'; }
test "$(post)" = 403 # the bridge answers this ghost only
test "$(post -H "Authorization: Bearer $token")" = 401; cat reply
- name: Log in and use it, against a stand-in for DreamFort
shell: bash
run: |
case "$RUNNER_OS" in Windows) py="$HOME/.ghost/venv/Scripts/python.exe" ;; *) py="$HOME/.ghost/venv/bin/python" ;; esac
"$py" tests/e2e.py
- name: Update over it, with the background gateway running
if: runner.os != 'Windows'
run: |
ghost="$HOME/.local/bin/ghost"
pid() { python -c "import json, pathlib; print(json.loads((pathlib.Path.home() / '.ghost/profiles/uncensored/gateway_state.json').read_text())['pid'])"; }
profile="$HOME/.ghost/profiles/uncensored"; echo "# mine" | tee -a "$profile/SOUL.md" >> "$profile/config.yaml"
profile="$HOME/.ghost/profiles/uncensored"; echo "# mine" >> "$profile/SOUL.md"; "$ghost" config set display.show_reasoning true
"$ghost" gateway install --start-now --start-on-login
sleep 15; "$ghost" gateway status; before="$(pid)"; kill -0 "$before"
if ps -o command= -p "$before" | grep -e --idle-exit; then exit 1; fi # it's not the one the chat left running
started=$SECONDS; ./install.sh # nothing new: the engine isn't built again, and the gateway is left alone
grep -q "already this build" "$HOME/.ghost/install.log"; echo "took $((SECONDS - started))s"; test $((SECONDS - started)) -lt 30
test "$(pid)" = "$before"; kill -0 "$before"
GHOST_FORCE=1 GHOST_VERBOSE=1 ./install.sh
sleep 15; "$ghost" gateway status; after="$(pid)"; kill -0 "$after"
if ps -o command= -p "$after" | grep -e --idle-exit; then exit 1; fi
test "$before" != "$after"; if kill -0 "$before" 2>/dev/null; then exit 1; fi
test ! -e "$HOME/.ghost/.restart-gateway"
for f in SOUL.md config.yaml; do grep -q "# mine" "$profile/$f.prev"; if grep -q "# mine" "$profile/$f"; then exit 1; fi; done
grep -q "# mine" "$profile/SOUL.md"; grep -q "show_reasoning: true" "$profile/config.yaml"; if ls "$profile"/*.prev*; then exit 1; fi
curl -fs http://127.0.0.1:8788/healthz
- name: Check the engine
shell: bash
Expand Down
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-3DDC97?style=flat-square)](LICENSE) &nbsp;![Platform](https://img.shields.io/badge/platform-macOS%20%C2%B7%20Linux%20%C2%B7%20Windows-lightgrey?style=flat-square) &nbsp;[![Built on Hermes Agent](https://img.shields.io/badge/built%20on-Hermes%20Agent-7C5CFF?style=flat-square)](https://github.com/NousResearch/hermes-agent) &nbsp;![Open-weight only](https://img.shields.io/badge/models-open--weight%20only-FF8A3D?style=flat-square)

**A private, unrestricted agentic harness.** A real terminal agent that runs commands, edits files, executes code, and searches the web, with every hosted request sealed to OpenGradient's TEE gateway so that nobody on the way can tie what you asked to who you are. It answers what you actually ask, drops to a fully-offline local model on demand, and phones home to no one.
**A private, unrestricted agentic harness.** A real terminal agent that runs commands, edits files, executes code, and searches the web, with every hosted request sealed to OpenGradient's TEE gateway so that nobody on the way can tie what you asked to who you are. It answers what you actually ask, drops to a local model on demand, and phones home to no one.

Built on the [Hermes Agent](https://github.com/NousResearch/hermes-agent) engine by Nous Research, wired to OpenGradient's gateway and to only open-weight, unrestricted models.

Expand All @@ -12,15 +12,15 @@ Built on the [Hermes Agent](https://github.com/NousResearch/hermes-agent) engine

## Install

One command, about two minutes. The only prerequisite is `git`; ghost brings its own Python, Node and engine, and touches nothing else on your machine.
One command, about two minutes and 2.5 GB of disk. The only prerequisite is `git`: ghost brings its own Python, Node and engine, and keeps all of it in `~/.ghost` and `~/.ghost-engine`. Outside those there is only its command in `~/.local/bin` (and a line in your shell's startup file if it didn't look there).

**macOS, Linux, WSL2:**

```bash
curl -fsSL https://raw.githubusercontent.com/OpenGradient/ghost/main/install.sh | bash
```

**Windows (PowerShell, no administrator needed):**
**Windows (PowerShell, no administrator needed; on ARM, use WSL2):**

```powershell
irm https://raw.githubusercontent.com/OpenGradient/ghost/main/install.ps1 | iex
Expand All @@ -36,7 +36,7 @@ The first run asks how you want to log in. Nothing is contacted before that.

| | |
|---|---|
| **DreamFort account** | Your plan and credits. ghost shows a code, you type it on [dreamfort.ai](https://www.dreamfort.ai), done. Works over SSH too. |
| **DreamFort account** | Your plan and credits. Sign in on [dreamfort.ai](https://www.dreamfort.ai) and ghost picks it up; over SSH, paste what the page shows. |
| **DreamFort API key** | Billed by usage. Create one at [api.dreamfort.ai](https://api.dreamfort.ai/api-keys) and paste it. |

`ghost login` switches between them. In a script or a container: `cat keyfile | ghost-login --with-api-key`.
Expand All @@ -46,13 +46,13 @@ The first run asks how you want to log in. Nothing is contacted before that.
| | |
|---|---|
| `ghost` | Start chatting. `ghost -c` continues your last chat. |
| `ghost -z "question"` | Ask once and print the answer. |
| `ghost --local` | Use the offline model: nothing leaves this machine. |
| `ghost -z "question"` | Ask once and print the answer. A long question can come from a file: `ghost chat --query-file FILE` (`-` for stdin). |
| `ghost --local` | Use the offline model: what you type stays on this machine, and the web tools are off. |
| `ghost doctor` | Check that everything works, and what to do if it doesn't. |
| `ghost usage` / `ghost budget` | What hosted models have cost you, what credits are left, and the hourly limit. |
| `ghost login` / `ghost logout` | Change how you're connected. |
| `ghost update` | Get the latest release, with the options you installed with. |
| `ghost uninstall` | Remove ghost. Your chats and settings stay unless you add `--purge`. |
| `ghost uninstall` | Remove ghost. Your chats, settings and login stay unless you add `--purge`. |

Inside a chat, `/model` switches models, `/goal <objective>` sets a standing goal, `/help` lists the rest.

Expand All @@ -64,14 +64,14 @@ Set these as environment variables on the install command (`curl ... | GHOST_LOC
| | |
|---|---|
| `GHOST_LOCAL=1` | Also install Ollama and an offline model (6GB), which becomes the fallback. `GHOST_LOCAL_32B=1` adds the stronger 32B (26GB). |
| `GHOST_NO_BROWSER=1` | Skip Chromium and the computer-use driver: a smaller, faster install. |
| `GHOST_NO_BROWSER=1` | Skip Chromium and the computer-use driver: a smaller (1 GB), faster install. |
| `GHOST_VERBOSE=1` | Show everything the installer runs. Otherwise it's in `~/.ghost/install.log`. |

On Windows, from a clone: `.\install.ps1 -Local -NoBrowser`.
On Windows, from a clone: `powershell -ExecutionPolicy Bypass -File .\install.ps1 -Local -NoBrowser`.

An update installs that release's `config.yaml` and `SOUL.md`; if you changed yours, they're kept beside them as `.prev`.
An update keeps the settings you changed in `~/.ghost/profiles/uncensored/config.yaml`, and a `SOUL.md` of your own (the release's is then beside it, as `SOUL.md.new`).

**On a company network**, ghost uses the system's proxy (or `HTTPS_PROXY`) and the certificates the system trusts. It needs to reach `chat-api.memchat.io`, and `ogevmdevnet.opengradient.ai`, where it reads which enclaves to trust. If the network inspects TLS, exempt the second one: ghost won't take that from an intercepted connection, and falls back to an enclave built into the release.
**On a company network**, ghost uses the system's proxy (or `HTTPS_PROXY`, which a Mac with a proxy script needs) and the certificates the system trusts. It needs to reach `chat-api.memchat.io`, and `ogevmdevnet.opengradient.ai`, where it reads which enclaves to trust. If the network inspects TLS, exempt the second one: ghost won't take that from an intercepted connection. Without it, ghost goes by the enclaves it knew when it was released, and those change whenever OpenGradient deploys. Installing also needs `github.com`, `*.githubusercontent.com`, `astral.sh`, `*.astral.sh`, `pypi.org`, `files.pythonhosted.org`, `nodejs.org`, `registry.npmjs.org` and, for the browser, `cdn.playwright.dev` and `storage.googleapis.com`.

</details>

Expand All @@ -95,7 +95,7 @@ An update installs that release's `config.yaml` and `SOUL.md`; if you changed yo

**The Problem.** "Hosted inference" means your prompts, your code, whatever you're working on, land on someone else's servers with your name on them: one company holds both who you are and everything you asked.

**The Fix.** Every hosted request is sealed on your machine (HPKE/OHTTP, with [opengradient-ohttp](https://github.com/OpenGradient/sdk/tree/main/packages/opengradient-ohttp)) and opened only inside an attested **TEE enclave**. The relay that knows your account sees ciphertext. The enclave that opens the prompt never learns whose it is, and passes it to the model's host under its own key with nothing of yours attached. Its signature is checked before a single token reaches you. [Who sees what](#how-the-private-path-works), exactly. Need zero egress? `ghost --local` runs an offline model where nothing leaves the box.
**The Fix.** Every hosted request is sealed on your machine (HPKE/OHTTP, with [opengradient-ohttp](https://github.com/OpenGradient/sdk/tree/main/packages/opengradient-ohttp)) and opened only inside an attested **TEE enclave**. The relay that knows your account sees ciphertext. The enclave that opens the prompt never learns whose it is, and passes it to the model's host under its own key with nothing of yours attached. Its signature is checked before a single token reaches you. [Who sees what](#how-the-private-path-works), exactly. Need zero egress? `ghost --local` runs a model on your own machine, with the web tools off.

> [!TIP]
> And it doesn't give up. Most agents stop and ask after the first error; ghost reads the actual error, installs what's missing, changes tactics, and keeps going until the task is done. Set a standing goal with `/goal <objective>` and it works toward it across turns on its own.
Expand All @@ -119,8 +119,8 @@ Switch with `/model`, all open-weight, nothing closed or refusing:
|---|---|
| `abliteration/abliterated-model-large-v2` **(default)** | Uncensored by abliteration, with refusals removed from the weights rather than steered past. 1M context; built for authorized offensive-security, red-team and long-horizon agent work. |
| `deepseek/deepseek-v4-pro` | Strongest open reasoning + coding model; uncensored via ghost's steer. |
| `abliteration/deepseek-v4.1-flash-abliterated` | Fast and far cheaper ($0.30 / $1.20 per million tokens in / out, against the default's $3 / $5), reads images, 1M context, and the one whose host runs in TEEs too. Runs ghost's auxiliary tasks (titles, compression, etc.). |
| `nous/hermes-4-405b` | Flagship uncensored open model, the most steerable. Also the hosted fallback. |
| `abliteration/deepseek-v4.1-flash-abliterated` | Fast and far cheaper ($0.41 / $1.62 per million tokens in / out, against the default's $4.05 / $6.75), reads images, 1M context, and the one whose host runs in TEEs too. Runs ghost's auxiliary tasks (titles, compression, etc.). |
| `nous/hermes-4-405b` | Flagship uncensored open model, the most steerable. |
| local (opt-in) | Abliterated 7B / 32B via `GHOST_LOCAL`, fully offline, zero egress. |

## How the private path works
Expand All @@ -139,13 +139,18 @@ ghost engine
| The enclave | **No** | Yes, inside attested hardware |
| The model's host | **No** | Yes |

The model's host is NEAR AI for DeepSeek V4.1 Flash Abliterated (served from TEEs as well), abliteration.ai for Abliterated Large v2, Together for DeepSeek V4 Pro, and the cheapest host on OpenRouter for Hermes 4 405B. They get the text and nothing else: no account, no IP, no header of yours. What's *in* the text is still in the text, so a prompt that names you names you. When that isn't good enough, `ghost --local` sends nothing anywhere.
The model's host is NEAR AI for DeepSeek V4.1 Flash Abliterated (served from TEEs as well), abliteration.ai for Abliterated Large v2, Together for DeepSeek V4 Pro, and the cheapest host on OpenRouter for Hermes 4 405B. They get the text and nothing else: no account, no IP, no header of yours, and ghost leaves your user name out of what it tells the model about your machine. What's *in* the text is still in the text: a prompt that names you names you, and so does a file or a command's output that the agent reads for you. When that isn't good enough, `ghost --local` sends it nowhere.

The agent's own web searches, page fetches and browser go out from your machine like any browser's, not through the enclave. Searches ask DuckDuckGo, then Brave, Startpage, Mojeek, Yahoo and Google until one answers.

## Honest limits

- **Hosted models cost credits.** `ghost usage` shows what you've spent, and ghost pauses itself after $5 in an hour so nothing runs away with your balance; change that with `ghost budget 20` or `ghost budget off`. What comes back unusable is reported, not paid for again: at most one retry, when the connection broke.
- **Chats don't stay.** A chat is deleted a day after it ends, along with what you typed. To keep them, set `sessions.auto_prune: false` in `~/.ghost/profiles/uncensored/config.yaml`.
- **Your keys stay yours.** Keys for other vendors in your environment (OpenAI, OpenRouter, ...) are kept from the engine, so nothing goes to them by surprise. Put one in `~/.ghost/profiles/uncensored/.env` to use it on purpose.
- **Replies arrive whole.** The signature covers the complete reply, so ghost shows it once it's verified rather than word by word.
- **The local model is opt-in and weaker.** Off by default (`GHOST_LOCAL`); it's a weaker agentic searcher and may still lean on the hosted gateway for tool orchestration.
- **The local model is opt-in and weaker.** Off by default (`GHOST_LOCAL`); it's a much smaller model, and it shows in long agentic work.
- **It asks before it deletes.** Commands that delete folders, overwrite system files and the like wait for your OK; `--yolo` turns that off.
- **The engine is forked, not rewritten.** It's one pinned Hermes release ([`engine.pin`](engine.pin)), patched and self-contained: no separate Hermes install is needed or touched, and `ghost update` is what moves it. Internal package names stay `hermes_cli`.
- **Two small background processes.** The bridge is a service (launchd, systemd or Task Scheduler) that starts with your machine. Your sessions run in a local gateway that ghost starts when you do and that exits after 10 idle minutes (unless you install it as a service with `ghost gateway install`).

Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Include what you found, how to reproduce it, and the impact. We aim to acknowled
and opengradient-ohttp.
- **A login leaking** -- your session or API key readable by another user, logged, or sent anywhere
but DreamFort.
- **Someone else on this machine using your bridge**, or standing in for it.
- **A response accepted without verification** (the verify-before-emit guarantee bypassed).
- **The engine phoning home** -- an update check, telemetry, a remote catalog or plugin fetch, or a
side task that leaves the private path.
Expand Down
3 changes: 2 additions & 1 deletion bin/ghost-uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ if [ -n "$PURGE" ]; then
else
for dir in venv tools installs cache python uv privacy/__pycache__; do rm -rf "${GHOST_HOME:?}/$dir"; done
rm -f "$GHOST_HOME/.src" "$GHOST_HOME/.install-env" "$GHOST_HOME/.linger" "$GHOST_HOME/install.log" "$GHOST_HOME"/privacy/*.py \
"$GHOST_HOME/privacy/uncensored_prefill.json" "$GHOST_HOME/privacy/bridge.key" "$GHOST_HOME"/privacy/bridge.log*
"$GHOST_HOME/privacy/uncensored_prefill.json" "$GHOST_HOME/privacy/bridge.key" "$GHOST_HOME/privacy/.made" \
"$GHOST_HOME/privacy/proxies.json" "$GHOST_HOME/privacy/enclaves.json" "$GHOST_HOME"/privacy/bridge.log*
echo "ghost is gone. Your chats, skills, settings and login are still in $GHOST_HOME (delete it to remove them too)."
fi
rm -f "$BIN/ghost-uninstall"
2 changes: 1 addition & 1 deletion bin/windows/ghost-uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if ($purge) {
if (-not (Get-ChildItem -Force $GhostHome)) { Remove-Item -Force $GhostHome }
} else {
foreach ($name in "venv", "tools", "installs", "cache", "python", "uv", "privacy\__pycache__", "privacy\*.py", "privacy\uncensored_prefill.json",
"privacy\bridge.key", "privacy\bridge.log*", ".src", ".install-env", ".installing") { Remove-Hard "$GhostHome\$name" }
"privacy\bridge.key", "privacy\.made", "privacy\proxies.json", "privacy\enclaves.json", "privacy\bridge.log*", ".src", ".install-env", ".installing") { Remove-Hard "$GhostHome\$name" }
Write-Host "ghost is gone. Your chats, skills, settings and login are still in $GhostHome (delete it to remove them too)."
}
foreach ($name in "ghost.cmd", "ghost-login.cmd", "ghost-update.cmd", "ghost-update.ps1", "ghost-uninstall.cmd", "ghost-uninstall.ps1") {
Expand Down
Loading
Loading