HarnessLink is the controller for your coding agents: it routes their model
calls, gives them shared memory, banks what they do, and syncs and restores
your setup. You code in omp, Claude Code, Codex or pi. The command is hnl.
Each of those programs is a harness: it runs a model in a loop with
tools. The installer adds omp (upstream oh-my-pi); Claude Code, Codex, pi
and Antigravity work too. hnl itself runs no model and no coding
session: it signs you in, runs a local service beside your harnesses, syncs
what they produce and serves it back as search, recall and briefs.
Plain hnl shows the home screen: the service (running, version),
sign-in, sync health, autobank per harness, what each harness is wired to
(gateway, transcripts, autobank, context, memory tools) and the one next
thing to do. On a machine that is not set up yet it runs hnl cloud
setup instead. Without a terminal it prints the same as plain text.
Setup is in INSTALL.md.
First task: bank a turn, then find it
#- Run plain
hnl: the home screen shows the service running and yourharness wired for transcripts and autobank. Fix whatever it flags first.
- In your harness, do one small turn (ask it to explain one function).
When the turn ends, autobank writes a memory entry for it — nothing to run.
- Dashboard → Query: search for a word from that turn. Your prompt and
the banked entry come back together.
- Start a new session and ask the harness what you just did: its context
brief carries the banked entry in, so it answers from memory, not from re-reading your files.
That loop — do, bank, recall — is the whole product. Everything below is that loop with more control.
Query: search your own work
#Dashboard → Query (g q; /search links land here) searches your
prompt history, memories, runs and session transcripts (titles, workspace
and harness, not their bodies) with one query. Results from every source are
listed together, newest first or by relevance, with a filter per source,
workspace, harness and device and a chart of matches over time.
Plain words work (auth refactor finds both words). For more, the query
language combines phrases, fields, wildcards, regular expressions, numeric
and date ranges, and AND / OR / NOT:
"rate limit" harness:codex after:-7d
in:runs tokens:>100000 cost:>=1.5
(harness:codex OR harness:omp) /timeout|deadline/i -has:sessionThe same syntax works in the search box of History, Archive, Memory and Runs, restricted to that page's fields. A mistake is underlined where it is, with a message saying what is wrong. Regex searches test at most the newest 20,000 candidate rows; past that the page says how many rows were scanned. No model is involved: results are exact matches, never generated answers. The full reference is QUERY_SYNTAX.md.
History: every prompt, from every harness
#Dashboard → History. Your prompts, newest first, as Conversations
(the default) or Prompts. A conversation is the prompts you typed in one
sitting: one session in one harness (or, for prompts recorded without a
session, one folder on one device), split wherever more than two hours pass
between prompts, so a session resumed for weeks shows as the separate stretches
of work it was. Its title is the first prompt that says what you asked (slash
commands, pasted-image placeholders, redacted pastes and nudges like
"carry on" are skipped), with the latest prompt under it, the time range and
duration; click it to read just that conversation's prompts, and **Open full
session for the whole transcript. Prompts** lists every prompt on its own
row. Each row names the harness it was typed into (omp, claude-code,
codex, pi, antigravity, and Old HarnessLink agent for prompts from
HarnessLink's old built-in agent) and its workspace (Scratch (/tmp) for
throwaway temp folders, No folder when none was recorded); filter by harness
from the search bar or the Filters panel.
The HarnessLink service reads new prompts from each harness with capture on
about every 30 seconds and uploads queued rows every 5 to 10 seconds, so a
prompt usually appears within a minute. hnl cloud sync does both now.
Cursor prompts are not captured.
Policies: rules for your organisation
#Dashboard → Policies. Write the rules your organisation wants its harnesses to follow. Tool and command rules are enforced before every tool call in Claude Code, Codex and omp (see Org policy: enforced before every tool call); pi, Cursor and Antigravity have no HarnessLink tool hook.
A saved change applies without anyone doing anything: every online machine in the organisation fetches the new signed policy within seconds, the next tool call is decided by it, and every session already open is told what changed on its next prompt, once. Instructions come to the model as your organisation's, through HarnessLink, taking precedence over project and user instructions.
Each rule is effect + target + optional conditions.
| Effect | Meaning |
|---|---|
| Explicit deny | Blocked, always |
| Explicit prompt | Always ask first |
| Explicit allow | Outranks a lower-precedence deny or prompt; never auto-approves |
| Conditional deny / prompt / allow | The same, only when conditions match |
Explicit beats conditional; within each, deny > prompt > allow.
Targets are a tool (bash, write, edit, computer), a shell
pattern (rm -rf *), or a model (claude-opus-*, anthropic/*).
Conditions are cwd_prefix and model for tools and commands, and
harness (claude-code, codex, omp, pi, antigravity, other) for
models. A model rule only allows or denies: once any allow applies to you,
models no allow matches are refused.
Usage limits (Policies → Usage limits) cap spend in USD or tokens (input, output, cache reads and cache writes) per UTC day or UTC month, either per machine or per person across all their machines, optionally for matching models only. USD is HarnessLink's estimate from list prices, not your provider's bill. A per-person limit counts a person's other machines once they sync, usually within about a minute.
Model rules and limits are enforced by HarnessLink 17.5.50 and later, in the
local gateway, before a model call leaves the machine: every call from Claude
Code and Codex, and calls through the Anthropic and OpenAI Codex providers in
omp and pi, once hnl gateway connect has routed them. Cursor,
Antigravity and other providers go direct and are not covered.
A refused call gets a 403 from the gateway naming the rule or limit, your
organisation and the Policies page; for a limit it also says how much is
used, of how much, and when the window resets (UTC midnight, or the first of
the month). Limits are checked before each call: a response that starts
under a limit finishes even if it goes over, and the next call is refused.
If the policy file on a machine cannot be read, model calls are refused
until the HarnessLink service rewrites it; on a machine that has never fetched a
policy, nothing is enforced. hnl and hnl cloud status show each
limit with its current usage.
Explicit deny command rm -rf *
Explicit deny command terraform apply *
Conditional prompt tool bash when cwd_prefix=/Users/you/Workspace
Conditional allow tool read when cwd_prefix=/Users/you/WorkspaceMemory
#Dashboard → Memory. What your harnesses' sessions left behind, with
full-text search and dropdown filters for project (by folder name), harness,
type, machine and time; the filters live in the page address, so links and
Back work. Each row shows the entry's title. Temporary folders (/tmp, the
OS temp dir) and generated files (each project's MAIN.md index and daily
summaries) are hidden unless you ask for them. Click an entry to read it; its
file and folder paths are under Details. Turns run in a temporary folder
are not banked at all.
What syncs, once setup has run (all through the memories sync category):
- HarnessLink's memory tree (
~/.hnl/agent/memories): bank entries,MAIN.md, daily summaries andstate/snapshots (see MEMORY_BANKING.md). - Each captured harness's own memory files, in place, about every 5
minutes and on
hnl cloud sync: Claude CodeCLAUDE.md(global and per project) and auto memory; CodexAGENTS.md,AGENTS.override.mdand~/.codex/memories/; omp and piAGENTS.mdandmemories/; AntigravityGEMINI.md, rules, knowledge and brain artifacts; Cursor~/.cursorrules. A file whose project is known is filed under that project (harness/<id>/…); the rest go to a project named after the harness. Only.mdfiles up to 1 MiB.
Every file is redacted client-side before upload, and an unredactable file is skipped rather than sent.
Importing older memory
#hnl cloud import-memories # preview
hnl cloud import-memories --apply # write (setup runs this once for you)Reconstructs documents from a MemPalace store and ~/.hermes
(MEMORY.md, SOUL.md, USER.md) into the normal memory tree, with a
provenance header recording where each came from. They then sync like any
other memory. Each machine files its imports under its own
machine-<id>/ folder, so two machines with the same home path (two servers
as ubuntu) keep separate copies instead of replacing each other's. Imports
from earlier releases are moved into that folder when their content matches;
anything else is left where it is. Idempotent: re-running rewrites nothing
unchanged. Live harness memory such as CLAUDE.md is not imported: it
already syncs in place.
Recall: ask before you re-derive
#hnl cloud recall "rate limit" # this folder's project + linked projects
hnl cloud recall "rate limit" --all # every project you own
hnl cloud recall "rate limit" --project=<slug>Search over your banked memory in the cloud, by keyword and by meaning
(MEMORY_BANKING.md). Every finished turn in each
harness with autobank on (omp, pi, Claude Code, Codex; Antigravity per
conversation) becomes a bank entry automatically (memory.autoBank, default
on; subagent turns are not banked), so the outcome of past investigations is
one query away, far cheaper than an agent re-deriving it. Entries banked by
HarnessLink's old built-in agent stay searchable.
hnl cloud bank --title=… [--tags=…] records something
by hand; hnl cloud link-memory --project=<slug> makes another project's
memory part of this folder's default recall scope.
Context brief: seed a session instead of replaying one
#hnl cloud brief # print to stdout
hnl cloud brief --budget=6000 --out=brief.md
hnl cloud brief --recall="deploy freeze" # add a recall section (local index, no network)A deterministic, budgeted summary of the current folder built from memory,
not transcripts: the human-written part of MAIN.md, the newest ten bank
entries, the harness's own memory files (omp's raw_memories.md and newest
rollout summary; folders worked in upstream omp carry context there and may
have no bank at all), and an optional recall section. Sections are kept
whole or dropped, with a note naming what was dropped, so the brief never
exceeds --budget characters (default 8 000).
Paste it into a fresh session in any harness. Re-establishing context is the largest token cost in agent work; a brief costs a few hundred tokens where replaying the transcript it stands in for can cost millions.
The local index: memory search without the network
#The HarnessLink service keeps a SQLite full-text index of this machine's memory
tree at ~/.hnl/agent/memory-index.db. memory_search, memory_get,
context_brief's recall and the context hooks read it first, so they answer
offline, in milliseconds, at no cost.
- What is indexed: every
.mdfile under~/.hnl/agent/memories.A bank entry is split into its parts (title, tags,
## Prompt, the## Actionsstep log (one line per tool call) and## Result) and ranked so a match in the Result counts most, then the step log, then the prompt. Words match across inflections ("permissions" finds "permission"). Each project's generatedMAIN.mdindex and daily summaries are kept out of results, as on the dashboard. - How it stays current: one pass when the service starts (files whose
size and modification time are unchanged are not read again), then the service's file watcher applies each add, edit, rename and delete as it happens, and a full check every 5 minutes catches anything it missed. Without the service, the MCP relay (
hnl mcp), the hooks andhnl cloud briefbring the index up to date for the projects they are about to search before searching. - Cost: on 2,533 memory files (15 MB) the first build took about 0.5 s
and the index is 12 MB; a later service start checks every file in about 30 ms. A search takes 1 to 6 ms.
- Other machines:
memory_searchalso asks the cloud, for entries fromyour other machines and linked projects, and waits for it at most 1.5 s. The cloud also matches by meaning (ADR-102). When the cloud doesn't answer in time, you're offline or not signed in, you get this machine's results and one line saying so.
The file is a cache. Deleting it is safe: it is rebuilt from the memory files, and an unreadable one is rebuilt automatically.
Resuming sessions across harnesses
#hnl resumeOne picker over every session on the machine that a harness can resume
natively (Claude Code, Codex, pi and omp; Antigravity and Cursor transcripts
are not offered, since no harness can open them), plus sessions left by
HarnessLink's old built-in agent, newest first, each row ending
with its replay cost. Resuming does not re-send the file: the harness rebuilds
the model context, which compaction keeps bounded, so the cost shown is the
context the provider actually saw on the session's last request, read from
the transcript's own last usage record (~69k tok). A transcript with no
usage record shows a bytes-based ceiling instead (≤425k tok). Measured
live, the byte heuristic alone overstated a 17 MB session by 63×. Pick a
session, then pick where to open it: omp is preselected for omp-format
sessions (including the old HarnessLink agent's), claude/codex for their own.
Handoff copies the session file into the target harness's store (it never moves or overwrites it), then launches the harness's native resume. Cross- family conversion is refused rather than approximated: a claude-code transcript is not an omp session file.
At 50 000 tokens and above the harness picker gains a fifth
option: *brief: seed a fresh session from project memory instead of
replaying ~N tokens*. It runs hnl cloud brief in the session's folder
and works for any family, because it is built from the folder's memory
rather than the transcript. The native resume stays the default; the cheaper
path is simply visible at the moment the cost is being paid.
Continue on another machine (Pro)
#hnl resume <session-id> --harness omp # or claude-code, codex, pi
hnl resume <session-id> --cwd ~/src/acme-api # say where the repository is (remembered)
hnl resume <session-id> --print # print the context, start nothingPicks up one of your sessions from any of your machines: start in Claude Code on the laptop, carry on in omp on the desktop. The dashboard's Continue on… (History's conversation panel and the Session page) shows the command with a harness picker; nothing runs from the dashboard.
What happens on the machine you run it on:
- Fetch.
GET /v1/continue/<id>returns the session's checkpoint (thework-state file HarnessLink keeps per session: goal, next step, todos, done, decisions, files touched), the newest handoff note banked for it, and its eight newest prompts. Only your own sessions: an id from anyone else, teammates included, answers "no session under this account".
- Find the workspace. Sessions carry a workspace id, not a path. A
folder you chose before for that workspace wins (
~/.hnl/workspace-folders.json); then the session's own folder if it exists here and is the same repository; then, for a git repository, a clone with the same remote under~/Workspace,~/code,~/src,~/Projects,~/Developer,~/dev,~/repos,~/git,~/GitHub,~/work,~/Documents/GitHub,~/Sitesor the home folder (a few levels deep; ssh and https spellings of a remote are the same repository). Not found: on a terminal it asks once for the folder, otherwise it says to pass--cwd. Either answer is remembered. - Start the harness there with the context.
- omp and Claude Code with HarnessLink's context hook installed
(
hnl harness context omp|claude-code): the checkpoint is written as an open work-state file of that folder's project, so the hook's resume block opens the new session with it (Claude Code at start, omp with your first message) and marks it picked up. An explicit resume carries a checkpoint older than the usual three-day window. - Codex and pi, or a harness without the hook: the same block is the
harness's first prompt.
- omp and Claude Code with HarnessLink's context hook installed
The default harness is the session's own when it is one of the four, else omp. Your files are not copied: pull the branch first; the context tells the model the folder differs from the original machine's.
On Free (after the 14-day Pro trial) the command and the dialog answer with
the upgrade prompt (403 feature_gated, feature resume_anywhere).
Profile sync: moving machines
#hnl cloud push-profile # snapshot this machine now (the HarnessLink service also does it every 5 minutes when something changed)
hnl cloud push-profile --dry-run # print exactly what would be uploaded; uploads nothing
hnl cloud restore # show what this machine would get
hnl cloud restore --apply # write it (config.yml is backed up first)
hnl cloud restore --approve-mcp # approve restored MCP servers left pendingThe device profile holds HarnessLink's own config.yml, the MCP servers its
hub runs and the skills and agents the old built-in agent left in its own
folder, and the setup of every harness installed here (including skills
hnl add put there), Markdown files only:
| Harness | What travels |
|---|---|
Claude Code (~/.claude) | agents/, commands/, rules/, output-styles/, skills/, CLAUDE.md |
Codex (~/.codex) | prompts/, skills/, AGENTS.md |
omp (~/.omp/agent), pi (~/.pi/agent) | agents/, commands/, rules/, prompts/, skills/, AGENTS.md, SYSTEM.md |
Skill scripts, extensions and anything else that could run are never
captured. Each file is redacted and capped at 32 KiB, and the whole profile
stays under 1 MiB (instruction files first, skills last; anything left out is
counted). Harness config files (settings.json, config.toml, config.yml,
models.yml …) are listed by key name only and never restored;
hnl cloud setup redoes the wiring instead.
restore reads the newest profile pushed by another device unless you
name one with --device <id>. Harness files are restored additively: a
missing file is created, an existing one is never overwritten, and a harness
not installed on this machine is skipped with a note to install it and
re-run.
Secret values are never uploaded. MCP env/headers entries are reduced
to their key names, so restore tells you which secrets to re-supply and
cannot supply them itself. Syncing credentials would put a fleet-wide secret
store behind one web session.
Restored MCP servers stay off until you approve them. Nothing from the
cloud runs on this machine without your consent: every MCP server a restore
adds is written with "enabled": false and recorded in
~/.hnl/agent/mcp-pending.json. restore --apply then shows each one with
the command or URL it would run and asks Approve? [y/N]; without a terminal
nothing is approved. --approve-mcp approves them all without asking: with
--apply for this restore, alone for what an earlier restore left pending.
An organisation can pre-approve servers in its policy bundle with
"mcp": { "allow": ["uvx", "https://mcp.example.com/sse"] }: entries match
the exact command or URL, never the server name (the name is chosen by
whoever pushed the profile). hnl cloud setup restores the harness files
(additively) but never config.yml or MCP servers; run hnl cloud
restore --apply for those.
Machine-bound servers stay disabled even when approved. A restored stdio
server whose command is an absolute path that does not exist on this machine
(typically /Users/<other-user>/…/some-mcp) keeps "enabled": false, and the
apply report lists it with the re-enable instruction. A config that fails on
every session start is worse than one that says why it is off. Servers that
need a per-machine credential (an http MCP answering 401) still surface at
connect time; the report names the secrets they need.
Devices: linked, unlinked and deleted
#Dashboard → Devices (and Settings → Devices) lists every machine you
signed in with hnl cloud login. A device is linked while it holds a live
token. Unlink revokes its tokens: the machine stops syncing at once and
must sign in again, which links it as a new device. An unlinked device stays
listed (filter Status → Not linked; Settings shows them under *Unlinked
devices*) with its last pushed profile until you delete it.
Delete permanently removes an unlinked device for good: its device
record, last pushed profile, revoked tokens and sync cursors. **Delete all
unlinked (N) does that for every unlinked device at once, and Unlink and
delete** does both steps for a linked one. What the device synced stays in
your account: history, transcripts, memories and usage keep the device id,
and every view that names devices shows them as from a Deleted device.
The palette (⌘K) has Delete unlinked devices. Each deletion is written to
the organisation's audit log (device.delete).
Owners and admins do the same for members' devices under Team → Devices
(an admin cannot unlink an owner's device), and the platform owner from the
owner console with a written reason (audited as delete_device).
| Route | Who | Does |
|---|---|---|
DELETE /v1/devices/:id | you | unlink: revoke the device's tokens |
POST /v1/devices/:id/delete | you | delete an unlinked device; { "unlink": true } unlinks a linked one first (otherwise 409 device_linked) |
POST /v1/devices/delete-unlinked | you | delete every unlinked device in the active organisation |
POST /v1/org/devices/:id/delete | org owner/admin | the same for a member's device |
POST /v1/org/devices/delete-unlinked | org owner/admin | every member's unlinked device |
POST /v1/admin/devices/:id/delete | platform owner | any device, with { "reason": "…" } (and "unlink": true for a linked one) |
A CLI on a deleted device gets 401 like any revoked token; hnl cloud login
links it again.
Every device shows the hnl version it runs (from the User-Agent of its
last call, recorded at most hourly unless it changes) and where it stands
against the latest release: Up to date, Updating soon (every release
it lacks came out today or yesterday: it installs within a day), or **Behind
by N releases**. A machine on a CLI from before versions were recorded shows
Version unknown until it updates. See Updates.
Templates: the registry
#hnl registry search intent
hnl add intent-discovery # shows where it will write, then asks; --yes skips
hnl add intent-discovery --harness claude-code # one harness only
hnl add --list # what HarnessLink installed, and which harness reads it
hnl remove intent-discovery # removes only what HarnessLink wroteDashboard → Templates lists reusable skills and agents. hnl add
<name> copies each skill into the user-level skill folder of every harness
enabled in cloud.harnesses or detected on this machine (its folder exists
or its CLI is on PATH), so the harness loads it in its next session:
| Harness | Skill folder | Source |
|---|---|---|
| Codex | ~/.agents/skills/<name>/ | Codex: Build skills |
| Claude Code | ~/.claude/skills/<name>/ | Claude Code: Skills |
| omp | ~/.omp/agent/skills/<name>/ | omp config-usage |
| pi | ~/.pi/agent/skills/<name>/, also reads ~/.agents/skills/ | pi: Skills |
| Antigravity CLI | ~/.gemini/antigravity-cli/skills/<name>/ | Antigravity: Agent skills |
| Cursor | ~/.cursor/skills/<name>/, also reads ~/.agents/skills/, ~/.claude/skills/, ~/.codex/skills/ | Cursor: Agent Skills |
A harness that also reads a folder another harness's copy goes to (pi and
Cursor read ~/.agents/skills/; Cursor reads ~/.claude/skills/) uses that
copy instead of getting a duplicate it would load twice. Agent definitions
(agents/*.md) go to omp only (~/.omp/agent/agents/); when omp is not
enabled or detected they are listed as skipped, never dropped silently.
HarnessLink records every path it writes in ~/.hnl/agent/addons.json. A
skill folder of the same name that HarnessLink did not write is yours: add
skips that harness and says so (exit code 1), even with --force. Running
add again is a no-op when nothing changed and updates HarnessLink's own copy
when the registry has a newer one; a copy you edited is left alone unless you
pass --force. hnl remove <name> deletes only the files HarnessLink wrote,
unedited (or with --force), keeps anything you added to the folder, and
keeps a folder another installed item still uses. The AI-native SDLC pack
brings the intent → spec → plan artifact chain to every project:
| Skill | Stage | Produces |
|---|---|---|
intent-discovery | Plan | intent/<date>-<slug>.intent.md: interview the originator to completion; intent/ is the backlog |
spec-from-intent | Design | spec/<slug>.spec.md: requirements traced to the intent, org instructions honoured by construction |
plan-from-spec | Build | plan/<slug>.plan.md: files, ordered/parallel steps, blast-radius interrogation, proof per step; implementable with no other context |
maintenance-intent | Maintain | a diagnosed intent from an alert, log or ticket: evidence quoted, suggestions never actions |
Slugs match across the three folders so a chain is greppable end to end, and the committed/done stages bank to memory: the chain plus recall is the project's institutional record.
hnl (hnl add hnl) is the cross-harness playbook. It teaches
the agent in any harness (Claude Code, codex, omp, or a plain shell) to
reach cloud recall and briefs, find and resume where a session stopped
(sessions list --json), and sync on demand (cloud sync --json).
Extensions: code that runs inside omp
#hnl add context-compress # asks for consent; --yes skipsRegistry items of kind extension install into omp's own extension
directory (~/.omp/agent/extensions/), because they are code the harness
executes, not prose; no other harness runs omp extensions, so without omp
they are reported as skipped. Only the official registry and your org's
shared artifacts can supply them; third-party @alias sources are refused.
context-compress keeps large tool outputs out of the model's context.
On omp's tool_result hook, any bash/eval/grep/glob/MCP output over
8 KB is replaced by its first 40 lines, last 20 lines, every line that looks
like an error or warning, and a marker:
…3943 lines omitted (18.3 KB) — call retrieve_output({"id":"<toolCallId>"}) for the full outputThe original is written to ~/.hnl/agent/outputs/<toolCallId>.txt
(0600, pruned after 14 days) and a retrieve_output tool returns it, or a
line range of it, on demand. read, edit and write results are never
touched: hashline anchors and diffs are what the agent edits against. The
compression is a pure function of the output, applied once when the result
arrives, so the provider's prompt cache stays valid. Measured on real
sessions, tool results are about half of billable context and the largest
6% of them carry half of those bytes; expect a 10 to 20% reduction in
input-side spend. Live: a 4 000-line seq entered context as 335
characters and the model retrieved lines 2000 to 2002 exactly.
qmd: local search over your memories
#hnl add qmd # shows the plan, then asks once; --yes skips (required without a terminal)
hnl add --list # qmd's binary, collection, models and MCP entries
hnl remove qmd # removes only the MCP entries and the collection HarnessLink set upqmd is a local search engine for Markdown:
BM25 keywords, vector search and LLM reranking, all on this machine with
GGUF models. hnl add qmd:
- installs qmd with
bun install -g @tobilu/qmdwhenqmdis not onPATH(qmd needs Node.js 22 or newer); - creates the qmd collection
harnesslink-memoriesover~/.hnl/agent/memories(**/*.md) with a context that tells search what the entries are; re-running updates it, never adds a second one; - registers qmd's stdio MCP server (
qmd mcp, server nameqmd) in everyenabled or detected harness HarnessLink writes MCP config for: omp (
~/.omp/agent/mcp.json), Cursor (~/.cursor/mcp.json), Codex ([mcp_servers.qmd]in~/.codex/config.toml) and Claude Code (claude mcp add --scope user qmd -- qmd mcp; skipped when theclaudeCLI is not onPATH); - downloads qmd's three models with
qmd pulland runs the firstqmd embed: about 2.3 GB (embedding 334 MB, reranker 639 MB, query expansion 1.3 GB) into~/.cache/qmd/models. The confirmation states the size before anything is downloaded.
A qmd MCP entry you added yourself is never overwritten or removed (the
harness is listed as skipped, exit code 1); the same rule as skills, recorded
in ~/.hnl/agent/addons.json. hnl remove qmd leaves qmd itself, its
models and your own collections in place (bun remove -g @tobilu/qmd
uninstalls qmd).
Freshness. While the add-on is installed, the HarnessLink service runs
qmd update 30 seconds after memories stop changing (and once at service
start), so new entries are found by keyword search within a minute. It does
not embed in the background: run qmd embed now and then to add vectors for
new entries. qmd update re-indexes every collection and runs each
collection's update command, so when one of your collections has one
(qmd collection update-cmd, e.g. git pull) the service does not run it and
says so in its log; run qmd update yourself.
Delegation: one harness hands a task to another
#hnl run --harness codex "why does the build fail?" # headless, in this directory
hnl run --harness claude-code --cwd ~/src/api --timeout 5m "…" # another directory, stopped after 5 min
cat task.md | hnl run --harness omp --json # task on stdin, result as JSON
hnl run --harness codex --detach "review the open diff" # hand it to the service's queue, print its run id
hnl run --list # every run on this machine: queued, running (with progress), finishedhnl run runs the harness headless in your terminal, streams what it does,
and ends with its status, exit code and a summary; the command exits with the
harness's exit code. --detach hands the run to the HarnessLink service
instead and prints its run id at once.
Inside any harness, the delegate MCP tool hands a task to the service:
{harness, task, cwd?, timeout_s?, model?, wait?, notify?} → {harness,
status, exit_code, summary, transcript_ref, run_id}. The calling session
never has to wait for it:
- Runs outlive the caller. The caller's
hnl mcprelay sends the run, withthe caller's environment (what the child would have inherited from the relay: PATH, HOME, provider auth, depth and run-link env), to the service's supervisor over a private socket beside the MCP hub's (
~/.hnl/agent/run/delegate.sock). The run keeps going when the calling session ends. - A queue, not a refusal. Past the machine's capacity a run comes back as
status: "queued"with itsposition, and starts on its own, oldest first, when a slot frees. The queue survives a service restart. wait.true(the default) waits about 25 s, under the 30 s MCP timeoutof omp and others, and returns the result when the run is that quick, else
status: "running"with its progress;falsereturns therun_idat once.- Results come to the caller, mid-turn. When a run ends, its result is
addressed to the calling session and shown to it once: run id, harness, status, a one-paragraph summary and the
transcript_refformemory_get. It arrives with the session's next tool call, so an agent that is still working sees it without waiting for you to type: Claude Code and Codex get it from thePostToolUsehook (Codex runs it once you trust it in/hooks, like the others), omp from its extension'stool_result(omp 18.3.2 or later), pi as a steering message queued after the current tool calls. Whatever no tool call took comes at the start of the next turn (UserPromptSubmit, the extensions'before_agent_start), as before, and a result nobody picked up expires after 7 days. The hook after a tool call costs one directory listing when nothing waits for that session: each notice's file name says whom it is for (~/.hnl/agent/delegations/notifications/<run_id>[.progress].<address>.json), so other sessions' notices are never opened. - Live progress. While a run goes, the service keeps a short rolling
summary from the harness's output stream:
progress={seq, elapsed_s, tool_calls, last_action, last_text, tokens}(last_actionis the latest tool call with what it acted on,last_textthe last line the harness wrote,tokensinput/output so far when the harness reports them — Claude Code, Codex, omp and pi do).delegateanddelegate_statusreturn it for a running run, andhnl run --listshows it under the run. It is written to the run's record at most once a second and kept there when the run ends. notify: "progress". By default a caller hears only of the result.With
notify: "progress"it also gets a short progress update (elapsed, tool calls, last action, last line) at its next tool call or turn, at most one per run per minute, the first no sooner than a minute in, only when something changed; an update not yet delivered is replaced by the next one and dropped once the result is in.delegate_status.{run_id}waits again for one run, up to ~25 s, andreturns its result or its progress (
cancel: truestops it; only the session that asked may cancel).since: theprogress.seqof the last answer — the call returns as soon as the run moves past it (or ends), so an agent can follow a run step by step instead of waiting 25 s at a time;wait: falseanswers at once. Withoutrun_idit lists the session's runs that are running, queued, or finished and not yet delivered. A resultdelegateordelegate_statusreturned counts as delivered and is not shown again (nor is a pending progress update of a run it returned); a harness without hooks gets its results this way.
When no service accepts the connection, the relay runs the delegation
itself, as before, and the result says so (supervisor: "relay" and a
note): that run stops when the calling session ends, and a run past capacity
is refused instead of queued. A service that accepted the request but gave no
answer may have queued the run, so the relay never runs it a second time:
delegate returns an error pointing at delegate_status (no run_id) and
hnl run --list, and hnl run --detach says the same.
Windows. The service takes no delegations on Windows: a named pipe can be
created first by another local user, who would then receive your environment
(API keys included), and HarnessLink cannot check who owns the pipe. Every
delegate runs in the calling session's relay there (the result's note says
why), and hnl run --detach is not available.
How each harness is run. No permission-bypass flag is ever passed
(--dangerously-skip-permissions, --yolo, --full-auto,
--auto-approve, --dangerously-bypass-hook-trust, …), and terminal wrapper
shims on PATH (cmux's) are skipped because they add such flags. Each harness
keeps its own default non-interactive permissions:
| Harness | Invocation | What a delegated run may do | HarnessLink hooks in the headless run |
|---|---|---|---|
| Claude Code | claude -p --output-format stream-json --verbose [--model=<id>], task on stdin | Starts in Claude Code's built-in mode for -p (default, or auto where feature flags aren't fetched, as behind the gateway) unless your settings set defaultMode. Anything that would prompt is denied, and the summary lists the refused tools. | Yes: -p loads ~/.claude/settings.json hooks (no --bare); org policy "prompt" rules become asks nobody answers, so they're denied. |
| Codex | codex exec --json [--model=<id>] -, task on stdin | Read-only sandbox, no approvals: it reads and answers, edits are refused. Refuses to start outside a git repository (no --skip-git-repo-check). | Only if you trusted HarnessLink's hooks in Codex's /hooks; untrusted hooks are skipped and no bypass is passed. |
| omp | omp -p --mode json [--model=<id>], task on stdin | Your tools.approvalMode (omp's default lets tools run). | Yes: the hnl-context.ts extension loads in print mode; "prompt" rules block (no UI). |
| pi | pi -p --mode json [--model=<id>] <task> | pi asks before nothing; untrusted project files (extensions, settings) are skipped headless. | None: HarnessLink installs no pi hook. |
| Antigravity | agy --output-format stream-json [--model=<id>] -p=<task> | request-review: anything that needs permission (shell commands, for example) is auto-denied; allow it with a permissions.allow rule in Antigravity's settings. | None: Antigravity has no documented hook. |
The gateway is wired in each harness's own config (hnl gateway connect),
so a delegated Claude Code, Codex, omp or pi run goes through it and its model
rules and usage limits like any session. A harness that isn't installed is
refused with <harness> is not installed (no <binary> on PATH); skipped.
Limits.
- Depth: the child gets
HNL_DELEGATION_DEPTH= caller's + 1; a sessionat depth 2 may not delegate. A harness that strips the env from its tools (Codex gives MCP servers a minimal one) doesn't escape it: a caller whose ancestor process is a running delegated harness counts from that run.
- Capacity:
delegate.maxConcurrentinconfig.ymlwhen set; otherwise itadapts to the machine: min(CPU count, (available memory − 1 GiB) / 1 GiB), 1 to 8, evaluated again whenever a run could start. Available memory is what the OS can reclaim (macOS: free + inactive + speculative + purgeable pages; Linux:
MemAvailable). It counts every delegation on the machine,hnl runin a terminal included; a foregroundhnl runpast it is refused (--detachqueues). - Every run has a timeout (15 min by default, at most 4 h). On timeout or
cancel (Ctrl-C,
cancel: true, a relay-run's calling session ending), the harness's whole process tree gets SIGTERM, then SIGKILL after 5 s. - Delegated harnesses run under the service but outside its process watchdog
(200 processes / 2048 MB for the service's own tree): their own timeout and the capacity bound them instead. Stopping the service stops its running delegations and records them as failed with that reason; queued ones start after it comes back. A run whose supervisor died is closed as failed with the reason, and a harness it left running is stopped.
cwdmust exist.hnl runstays in the current directory unless youpass
--cwd, which may name any existing directory. Thedelegatetool only accepts acwdinside the caller's project root (its git top level).
Runs and memory. The child runs with HNL_RUN_ID, HNL_PHASE
= delegate-<harness> and HNL_ROSTER, so it shows on the Runs page:
in the caller's run when the caller has an HNL_RUN_ID, else in the
calling Claude Code or Codex session's own run (<harness>-<session id>,
the id subagent runs use, with the caller linked as phase main), else in a
run named after the delegation. A finished run is banked at once as one
memory entry tagged delegated, with the delegated prompt and its result,
through the autobank's parsers and claim store (the service never banks it a
second time); transcript_ref is its {project, rel_path} for
memory_get. It follows memory.autoBank and hnl cloud autobank like
any session. A failed, timed-out or cancelled run banks nothing; so does a
run that exits 0 without an answer (Antigravity does when its permissions
refused every step), which is reported as failed. Each run's record and raw
output stay in ~/.hnl/agent/delegations/ for 7 days; a queued run's task and
environment wait beside it in an owner-only .request file until it starts.
Runs: watch a software factory from outside
#export HNL_RUN_ID=feature-42 HNL_PHASE=build HNL_ROSTER=cheap
claude # or codex, omp: this session joins run feature-42
hnl cloud runs # runs, phases, tokens, costDashboard → Runs. Sessions that carry a run id are grouped into runs:
one row per run with its roster, harnesses, session count, tokens and cost,
and a phase strip in start order (plan → build → test → review). Expand a
run to see each phase's session. Every phase, tool call and response is
already in the synced transcript, so the run view is the trace the factory
pattern asks you to read instead of reaching into the box.
A session joins a run in one of two ways. Neither needs a command.
1. A run in the environment. Set HNL_RUN_ID (letters, digits,
., _, -; up to 64), and optionally HNL_PHASE and
HNL_ROSTER (lowercase letters, digits, -; up to 32), before you start
the harness. Invalid values are ignored.
- Claude Code, Codex, omp: HarnessLink's context hook sees the variables when
the session starts or you send a prompt, and records them for that session in
~/.hnl/agent/run-links.db. The HarnessLink service stamps the run on the session's next upload (within about 5 minutes) and on its subagents'. A session uploaded before the link existed is sent again so it joins the run. This needs the context hooks (hnl harness context; Codex runs a new hook only after you trust it once in/hooks), transcript sync for that harness, and thesessionssync category. A session started before the hooks were installed is not linked. - pi, Antigravity and Cursor have no context hook, so environment runs
do not apply to them.
2. Subagents. A session that started subagents forms a run with them
automatically: run id <harness>-<parent session id>, phase main for the
parent and the subagent's name for each child (omp and pi: the subagent
file name; Codex: the agent role; Claude Code: subagent). This works for
omp, pi, Claude Code and Codex. Subagent transcripts upload as sessions of
their own but stay out of hnl resume and session lists. An environment
run wins over subagent grouping and also covers the subagents, even when the
session already reached the cloud inside its subagent run.
Tokens and cost per session are computed server-side from the transcript's own usage records, for omp and Claude Code transcripts alike.
Run tokens: the credential boundary
#export HNL_CLOUD_TOKEN=$(hnl cloud run-token --run=feature-42 --ttl=2h)
hnl cloud run-token --run=feature-42 --revoke # at teardownA run token is a short-lived child of your device token: sync:write only
by default, never broader than its parent, at most 24 hours, invalid the
moment its parent is revoked, and unable to mint children of its own. Hand
it to a sandbox and the box can stream traces up but cannot read your
memory, sessions or profile.
The token is also the run's identity: every session uploaded with it is stamped with that run id server-side, whatever the client says. A sandboxed Claude Code or Codex needs no environment plumbing to be attributed: the credential does it. One level of nesting, enforced by credentials rather than by trust.
Cost
#Dashboard → Overview shows month-to-date spend by model. Usage is the analytical view: time series, per-model breakdown, gateway savings. Both read your harnesses' model calls through the HarnessLink gateway, plus any usage the old built-in agent recorded.
$/Mtok is blended across input, output and cache tokens. A headline
input price is misleading when cache writes dominate, which they often do.
The Cache savings card shows how much of your context is served from
the provider's prompt cache: hit rate (cache reads ÷ (cache reads + fresh
input)), the cached-token count, and a tokens-weighted *≈N× cheaper than
uncached* estimate. Cache reads bill at roughly a tenth of fresh input, so
N = (input + cache) ÷ (input + 0.1 × cache). It is labelled an estimate and
uses no per-model price table; it is hidden until cache data exists.
Costs reported from your machine (the gateway's catalog estimates, and the old built-in agent's own figures) are cross-checked against a server-side rate card. Where they disagree, both are shown: the divergence is the signal. A model with no list price on file is marked unverified rather than being given a fabricated rate.
A weekly email flags specific, actionable findings: cache writes that never get read, spend concentrated on one model, prompt caching left unexploited, run-rate spikes. Each cites the numbers that triggered it. Findings are throttled per issue, so a standing one stays quiet for 28 days.
Updates: HarnessLink keeps itself current
#A release install (the one install.sh / install.ps1 makes in
~/.hnl/bin) updates itself. Every hour the HarnessLink service reads the
latest version from https://harnesslink.sh/version.txt. When a newer release
is out it:
- Stages it beside the installed binary, as
~/.hnl/bin/hnl.next:downloads the release manifest, checks its signature, downloads the binary for this machine, checks it against the manifest, and runs the staged
hnl --versionandhnl --smoke-test, the same checks the installer runs. Nothing the service runs from changes during this step. - Waits for idle. The new version is swapped in only when no harness
session is connected to the MCP hub and no HarnessLink hook has run for 15 minutes. While the machine is busy it checks again every 10 minutes. A release that has waited 24 hours installs anyway.
- Swaps and restarts.
hnl.nextbecomeshnl, and the previousbinary is kept as
hnl.previousuntil the next update. The service then restarts through the same service managerhnl updateuses: launchd,systemd --useror the logon task. A service started withhnl daemon startis started again the same way.
Each release gets one attempt. If staging, the smoke test, the swap or
the restart fails, the machine keeps the version it has, the error goes to
the daemon log and to hnl, hnl status and hnl daemon status, and nothing
is tried for 6 hours. The failed release is not retried; the next release
gets its own attempt, and hnl update installs the failed one by hand.
hnl status # "updates: automatic; up to date, checked 12m ago" (or what it waits for, or the failure)
hnl update # update now, by hand (the picker also updates your harnesses)
hnl update --check # is a newer version out?Turn automatic updates off for one machine with update.auto: false in
~/.hnl/agent/config.yml. hnl update keeps working either way. A git
checkout, or HarnessLink run from source, never updates itself; update it
with git pull && bun install. The service and hnl update hold one lock,
~/.hnl/update.lockdir, so they never update the same machine at once.
The dashboard's Devices page shows each machine's version and whether it is up to date (Devices).
Doctor: when something is off
#hnl doctor checks everything HarnessLink needs on this machine and fixes
what is safe to fix, listing each fix. When a problem remains it prints the
exact command that fixes it. It exits 0 when everything is healthy and 1 when
something is still wrong.
hnl doctor # diagnose and fix
hnl doctor --check # diagnose only; changes nothing
hnl doctor --only history --only outboxes # some areas
hnl doctor --json # the report, machine-readableIt checks, in this order:
- Service: installed, running, on this CLI's build, whether the last
automatic update failed, and whether the binary matches its signed release. Fix: install, start or restart the service.
- Sign-in: the cloud accepts this machine's token; the account, org and
linked device; cloud sync not switched off. Points to
hnl cloud login. - Capture lists: prompt history, transcripts and memories sync, and
every harness HarnessLink banks memories from is also captured. Fix: add a harness to
cloud.harnesses(never removes one). - History ingest: each captured harness's prompt store holds nothing the
ingest hasn't read. Fix: read it into the sync queue now.
- Outboxes: failed items, stuck or failing uploads, missing capture
triggers. Fix: requeue, reinstall the triggers, sync now.
- Sessions: transcripts changed after their last upload. Fix: upload now.
- Cloud parity: what HarnessLink Cloud stored from this machine against
what is here, including "memories arrive but prompt history doesn't".
- Policy: the org policy cache is present, verified and not expired.
Fix: fetch it again.
- Hooks and MCP: the context and policy hooks and the
hnlMCP entryof every harness you use. Fix: reinstall.
- MCP hub and gateway: both answer. Fix: restart the service.
- Legacy names: leftovers from before the rename (
~/.superpi, oldservice, old MCP entries). Fix: the same migration as
hnl migrate. - Databases: an integrity check of HarnessLink's own SQLite files. A
damaged one gets a backup-and-recover command; nothing is deleted.
On by default, off by choice
#Every sync category is on unless you turned it off, and the doctor never
undoes an opt-out you made. From this release every off switch is dated in
cloud.offByChoice in ~/.hnl/agent/config.yml: hnl cloud sync --disable,
setup's Customize screen, hnl cloud harnesses disable and
hnl harness context --remove. The doctor shows those as "off by your choice
(since <date>)" and leaves them alone.
A category that is off without a date was switched off before HarnessLink
recorded who changed it, or by editing config.yml. Because categories are on
by default, that means it was switched off on this machine, maybe not on
purpose. The doctor says so and prints the command (hnl cloud sync --enable
history). Run interactively, hnl doctor asks whether to turn it back on; a
"no" is recorded as your choice and it stops asking. The service never turns a
category on by itself.
Notices
#The HarnessLink service runs hnl doctor --check every 30 minutes and again
after a sync pass fails. When something is off:
hnlandhnl cloud statusshow one "needs attention" line and the commandto run.
- The next harness session starts with one line, for example `HarnessLink:
Prompt history sync is turned off on this machine while memories still sync; run
hnl cloud sync --enable history.` Each problem is mentioned at most once a day. - The dashboard's Devices page marks the machine "Needs attention: run
hnl doctoron this machine" and lists the problems; Overview shows a banner. The report sent there carries finding codes, one-line summaries and commands, never file paths or prompts.
HarnessLink Cloud also checks on its own: a machine whose memories still arrive while none of its prompts have for two days is flagged even if the machine never reports, unless prompt history is off on purpose there.
Harnesses: installing and updating
#HarnessLink accompanies any of the supported coding-agent harnesses. Use
hnl harness to see what is installed on the current machine and to
install additional ones.
hnl harness list # table: id, binary state, real path, capture, install hint
hnl harness install <id> # install a harness via bun install -g <pkg>
hnl harness install <id> --yes # skip the confirmation promptValid harness ids and their packages:
| id | binary | npm package |
|---|---|---|
omp | omp | @oh-my-pi/pi-coding-agent |
claude-code | claude | @anthropic-ai/claude-code |
codex | codex | @openai/codex |
gemini | gemini | @google/gemini-cli |
pi | pi | @mariozechner/pi-coding-agent |
dsh | dsh | @deepseek-ai/dsh |
Binary state column
#- installed vX.Y.Z: binary found, realpath is a genuine install.
- shim (cmux):
which <binary>resolves to a PATH shim managed bycmux-cli (usually under the OS temp directory). The harness is not actually installed here; select
installto install it properly. - missing: binary not found in PATH.
The update picker (hnl update) also shows shim and missing harnesses
and lets you install them in one step.
Capture state is separate
#The capture column shows whether HarnessLink's cloud sync is reading this harness's sessions, memory and prompt history. That is managed independently:
hnl cloud harnesses # list capture state
hnl cloud harnesses enable <id> # turn on cloud sync for a harness
hnl cloud harnesses disable <id> # turn it offAutobank (the memory bank of finished turns) is a separate switch per harness, because it works locally and does not depend on cloud sync:
hnl cloud autobank # status: per harness on/off, turns banked, today, last banked
hnl cloud autobank enable <id> # turn it on; banks that harness's last 30 days right away
hnl cloud autobank disable <id> # stop banking (existing entries stay)
hnl cloud autobank backfill [--days=N] [id…] # re-scan the last N days (default 30); never banks a turn twiceInstalling a harness with hnl harness install turns on neither. Run
hnl cloud setup again, or the commands above. The HarnessLink service picks
up a harness turned on after it started, without a restart.
Installing at setup time
#Pass --with=<id,id,...> to the installer to install harnesses alongside omp:
curl -fsSL https://harnesslink.sh/install.sh | bash -s -- --with=claude-code,codexThe installer verifies the registry's bin field before running
bun install -g <pkg>, and --yes is implied by --with (consent is given
by including the flag).
Command reference
## Home and housekeeping
hnl # home screen: service, sign-in, sync, each harness's wiring, next step (first run: cloud setup; plain text when not a terminal)
hnl cleanup # remove what the old built-in agent left (git worktrees in ~/.hnl/wt, background-job logs in ~/.hnl/run/daemons), with consent; never silently drops uncommitted work
hnl prune # native files built for another OS or CPU, in the packages HarnessLink installs: listed by package with sizes, deleted after you confirm (reinstalling a package restores them)
hnl prune --dry-run # list them only; --yes deletes without asking; --root <dir> also scans a directory you name (listed, never deleted)
hnl prune off | on # the automatic pass after every harness install, update and service start (on by default)
hnl doctor # find and fix what keeps HarnessLink from working; lists every fix; exit 1 while problems remain
hnl doctor --check # diagnose only, change nothing; --only <area> (repeatable), --json, --verbose
# Setup and the HarnessLink service
hnl cloud setup # the onboarding: plan → sign-in (required) → sync, service, every harness, restore, verify
hnl gateway start # install the HarnessLink service (launchd / systemd --user / logon task) and start it; restarts an older build
hnl gateway service install|uninstall|restart|status # manage that supervised service directly
hnl gateway status # gateway health, harness wiring, today's requests and savings, cloud sync health
hnl gateway connect [id] # route a harness's model calls through the gateway (all detected when omitted; starts the service)
hnl gateway disconnect [id] # put back the harness's own provider settings
hnl gateway run [--port=<n>] # the gateway alone, in this terminal (debugging)
hnl daemon install|uninstall # same as gateway service install|uninstall
hnl daemon status # is the service process running, and which harnesses it captures
hnl daemon start [-f] # unsupervised background copy (no auto-restart, no OS limits); -f runs it in this terminal
hnl daemon stop # stop the running service process
# Harnesses
hnl harness list # binary state, path, capture, install hint
hnl harness install <id> [--yes]
hnl harness select [id] [--enable|--disable] [--hook] [--all] # capture on/off and MCP registration, interactive without flags
hnl harness hook [id] # register HarnessLink's MCP memory tools (every installed harness when omitted)
hnl harness context [id] [--remove] # context hooks for Claude Code, Codex and omp
hnl cloud harnesses [enable|disable <id>] # transcript and prompt-history capture per harness
# Cloud account and sync
hnl cloud login [--url=<api>] [--token] # link this machine (turns cloud sync on); --token reads a dashboard-minted spk_ token from stdin
hnl cloud status # sync on/off, every sync category on/off, token, API base, per-store pending / failed / last success
hnl cloud sync [--json] [--retry-dead] # ingest harness prompt history, then upload everything pending now; --retry-dead requeues failed rows first
hnl cloud sync --disable <category> # stop one category (history|sessions|memories|usage|gatewayUsage|profile); its queued rows are discarded
hnl cloud sync --enable <category> # turn it back on (from now; nothing typed meanwhile is backfilled)
hnl cloud logout # unlink and stop capturing
hnl cloud backfill [--force]
# Moving machines
hnl cloud push-profile [--dry-run] # snapshot machine setup (HarnessLink's and every harness's); --dry-run prints it
hnl cloud restore [--device=<id>] [--apply] [--approve-mcp] [--install-tools] [--yes]
hnl cloud pull-sessions [--machine] [--days=<n>] [--all [--yes]]
# default: this folder; --machine: every folder on this machine (+ adopted ones);
# both take sessions updated in the last cloud.restore.days (30) within
# cloud.restore.maxBytes (500 MB), newest first. --all: every session of the
# account — states the total size and asks first (--yes skips the question);
# --all copies stay until you delete them (outside the budget below)
# The service keeps restored transcripts within cloud.restore.maxBytes, least
# recently used out first (logged); files a harness wrote are never removed.
hnl cloud pull-history
hnl cloud pull-memories [--all]
hnl cloud adopt [--from=<slug>] # map another machine's folder to this one
# Memory
hnl cloud autobank [status|enable <id…>|disable <id…>|backfill [--days=N] [id…]] [--json] # memory bank of every harness's finished turns
hnl cloud import-memories [--apply] [--gateway=<path>] # MemPalace and ~/.hermes (setup runs it once)
hnl cloud recall <query> [--project=<slug>|--all]
hnl cloud forget <rel_path> [--project=<slug>]
hnl cloud brief [--budget=<chars>] [--recall=<query>] [--out=<file>]
hnl cloud bank --title=<t> [--tags=a,b] [--body=<text>]
hnl cloud link-memory --project=<slug>
# Sharing, runs, sessions
hnl cloud share | shared | pull-shared [--yes] # org-shared artifacts (Team and Enterprise plans)
hnl policy managed [status|install|remove] # your org's policy in each harness's admin settings (Team and Enterprise; one administrator prompt)
hnl cloud runs [--limit=<n>] # runs: phases, tokens, cost
hnl cloud run-token --run=<id> [--ttl=2h] [--scopes=sync:write] [--revoke]
hnl sessions list [--project=<dir>] [--limit=<n>] [--json] # sessions from every harness on this machine (read-only)
hnl sessions search <query> [--project=<dir>] [--limit=<n>] [--json]
hnl resume # cross-harness session picker
hnl resume <session-id> [--harness omp|claude-code|codex|pi] [--cwd <dir>] [--print] # continue one of your sessions from another machine (Pro)
hnl run --harness <claude-code|codex|omp|pi|antigravity> [--cwd <dir>] [--timeout <dur>] [--model <id>] [--json] [--detach] "<task>" # hand a task to another harness, headless; --detach queues it in the service (see Delegation)
hnl run --list [--json] # this machine's delegations: queued (with position), running, finished
# Updates, templates, MCP
hnl update [--check] [--force] # harness picker: omp, HarnessLink itself, claude, codex, …; offers to clean up ~/.hnl/wt (HarnessLink also updates itself: see Updates)
hnl add <name> [--harness <id>] [--yes] [--force] # install a registry skill into every enabled or detected harness's skill folder (agents, extensions: omp only)
hnl add --list # what HarnessLink installed, per harness
hnl add qmd [--harness <id>] [--yes] [--force] # qmd: local BM25 + vector search over your memories, as an MCP server in each harness (downloads ~2.3 GB of models)
hnl remove <name> [--yes] [--force] # remove only what `hnl add` wrote
hnl registry search|list|sources|add-source # browse registries, add a third-party source (`add` is an alias of `registry`)
hnl mcp [--cwd=<dir>] [--harness=<id>] # what a harness runs: relay into the per-machine MCP hub
hnl mcp register [--harness=omp,claude-code,codex] [--yes] # wire into harnesses
hnl mcp register --status # show registration status
hnl mcp print [--harness=<id>] [--format=json|toml] # print the MCP entry for any client
hnl context-hook # what a harness's context hook runs (reads hook JSON on stdin); installed by `hnl harness context`
# Other
hnl kb search|ingest|status … # alias `knowledge`: a separate semantic knowledge base in your own Cloudflare account (Workers AI + Vectorize)
hnl completions bash|zsh|fish # print a shell completion script
# Root flags
hnl --help | --version
hnl --smoke-test # load every command and exercise the gateway and the MCP relay end to end
hnl --profile <name> <command> # run against a named profile instead of the defaultCommands that belonged to HarnessLink's old built-in agent are gone: launching a
coding session, any first argument starting with - other than the root
flags above (-p, --model …), and acp, agents, auth-broker,
auth-gateway, bench, browser-relay, cleanse, commit, compress,
config, dry-balance, eval, factory, gallery, gc, grep,
grievances, install, integrate, join, marketplace, models,
plugin, provider, q, read, say, search, setup, share,
shell, ssh, stats, ste, tiny-models, token, ttsr, usage,
worktree and wt. Running one prints a single line saying it was part of
the old built-in agent and to use omp or your harness instead, and exits 2.
Memory inside every harness: the MCP server
#Every harness registers the same command, hnl mcp, under the MCP server
name hnl, so its tools reach the model as mcp__hnl_*. Wire it into a
harness once and your memory is a tool the
model can call directly, with no manual hnl cloud recall round trips.
The hub. hnl mcp is a small relay. It forwards the harness's
JSON-RPC 2.0 stdio traffic to the MCP hub, one per machine, inside the
HarnessLink service. The hub:
- serves HarnessLink's own tools (below) plus the MCP servers in HarnessLink's own
~/.hnl/agent/mcp.json, starting each of those servers once and sharing it across every session; - hides from a session the servers its harness already runs itself
(
--harness=<id>tells the hub which harness is asking;registerwrites it for you); - serves at most 64 sessions at a time; the 65th gets HarnessLink's own tools
in-process, without the shared servers;
- starts nothing while the containment watchdog is tripped (see
When the service is not running, hnl mcp serves HarnessLink's own tools
in-process, so memory tools keep working.
Tools
#| Tool | Description |
|---|---|
memory_search | Search over memory: this machine's from the local index (always, offline included), plus your other machines' from the cloud, by keyword and meaning, when it answers within 1.5 s; an entry held by both appears once. Each hit shows its abstract, the top three a summary too. Default scope is this project plus its linked projects. Use scope: "all" only when the user asks to search globally or names something that may belong to another project. |
memory_get | Pull one entry's full content (project + rel_path from a memory_search hit): this machine's file first, else the cloud. |
memory_bank | Record a durable memory for this project (a decision, outcome or fact); syncs and becomes searchable everywhere. |
memory_forget | Forget one entry everywhere, also on your other machines; only when asked. |
context_brief | A budgeted brief of this project from memory (human notes, recent work, harness memory, optional recall from the local index). Use at session start instead of replaying transcripts. Never waits on the network. |
session_list | Sessions from every harness on this machine, newest first, with whether each can be resumed here. |
session_get | One session by id: owning harness, transcript path, and the exact resume command. |
prompt_library_list, prompt_library_get | Your prompt library: the prompts you starred on the dashboard's History (title, tags), then one prompt's full text by id, so the model can use a saved prompt as your instruction. Free keeps 5 starred prompts, Pro any number. Also hnl prompts. |
cloud_sync | Upload everything pending now (queued rows, finished sessions, memory files) and report what was pushed. |
kb_search, kb_ingest | A separate semantic knowledge base for documents and code, in your own Cloudflare account (CF_API_TOKEN / CLOUDFLARE_API_TOKEN and CF_ACCOUNT_ID). Without credentials it falls back to local embeddings. It is not your HarnessLink Cloud memory. |
code_map | Locate code without reading whole files: Code map. |
mcp_list_servers | The downstream MCP servers the hub proxies, their status and tools. |
delegate | Hand a task to another harness on this machine (claude-code, codex, omp, pi, antigravity), supervised by the HarnessLink service: {harness, task, cwd?, timeout_s?, model?, wait?, notify?} → {harness, status, exit_code, summary, transcript_ref, run_id}, or status: "running" (with progress) / "queued" (with position) and the run_id. It outlives your session and its result is delivered to you at your next tool call or turn; wait: false returns at once; notify: "progress" adds a progress update at most once a minute. Runs with that harness's default permissions, in a cwd under your project root. See Delegation. |
delegate_status | {run_id}: waits up to ~25 s for that run and returns its result, or its progress while it runs; since (a progress.seq) returns as soon as the run moves on; wait: false answers at once; cancel: true stops it. Without run_id: your session's runs that are running, queued, or finished and not yet delivered. |
recall_memory, record_learning, search_knowledge | Aliases of memory_search, memory_bank and kb_search. |
The hub also lists the tools of the MCP servers it proxies, except unused ones (MULTI_HARNESS.md).
Scope semantics for memory_search (the same for the local index and the
cloud):
"linked"(default): current project + projects listed in<memoriesRoot>/<project>/linked.txt. Stay here unless the user asks otherwise."project": current project only."all": no project filter; searches everything in the account. Use whenthe user says "all my memory", "across projects", or names something that clearly belongs elsewhere.
Signed out, memory_search still answers from this machine and says that
other machines' memories need hnl cloud login.
Register in your harnesses
#hnl mcp register # default: omp + any other detected harness binaries
hnl mcp register --yes # non-interactive (skip confirmation prompts)
hnl mcp register --harness=omp,claude-code,codex
hnl mcp register --status # show what is already registeredConfig written per harness:
| Harness | File | Entry |
|---|---|---|
omp | ~/.omp/agent/mcp.json | mcpServers.hnl = { type: "stdio", command: "hnl", args: ["mcp", "--harness", "omp"] } |
claude-code | user scope | claude mcp add --scope user hnl -- hnl mcp --harness claude-code |
codex | ~/.codex/config.toml | [mcp_servers.hnl] block running hnl mcp --harness codex |
cursor | ~/.cursor/mcp.json | same shape as omp, with --harness cursor |
A preset is only shipped for a client whose config path and format we verified
against that client's own documentation; today that is Cursor. Every other
client still gets the canonical block: print it and paste it into that client's
config under the key it documents (VS Code: servers, Zed: context_servers,
OpenCode: mcp with command as one array).
hnl mcp print # canonical `mcpServers` block (JSON)
hnl mcp print --format toml # TOML form
hnl mcp print --harness=omp # exactly what register writes for a known harnessThe block is the only thing on stdout; the note naming where it goes is written
to stderr, so hnl mcp print | jq and hnl mcp print > mcp.json stay
clean. An unknown --harness id exits non-zero with the valid ids listed rather
than falling back to the generic block.
In the onboarding
#hnl cloud setup registers the memory tools for every detected omp,
Claude Code and Codex as part of its automatic checklist
("Memory tools (MCP)" per harness; turn it off per harness under c
customize). A failure shows the exact hnl mcp register --harness=<id> --yes
command to retry it.
Context hooks: memory before the model thinks
#MCP tools only run when the model decides to call them. Context hooks run first, on every session and prompt, so the model starts with your memory instead of having to go looking for it.
hnl harness context # install into every detected harness
hnl harness context codex # one harness
hnl harness context --remove # undo (only HarnessLink's entries are touched)Suggested past fixes (Pro). When a session starts, and again on its first
prompt, the hook asks the cloud (GET /v1/recall) for up to three of your
past memory entries that match it — the workspace's newest prompts at start,
the prompt itself after — and hands them to the harness as "You fixed this
in <workspace> on <date>: <title>" with the entry attached. Matching only;
nothing is generated. Your own entries only, plus (Team) projects your owner
shared. The request gets 250 ms; if the cloud is slower, the workspace's last
answer is used. Turn it off for one machine with memory.recall: false in
config.yml, or for every machine in Settings → Profile → Suggested past fixes.
| Harness | Where | Mechanism |
|---|---|---|
| Claude Code | ~/.claude/settings.json | SessionStart + UserPromptSubmit + PreToolUse + PostToolUse + Stop + PreCompact command hooks |
| Codex | ~/.codex/hooks.json | the same minus Stop; Codex runs a new hook only after you trust it once in /hooks |
| omp | ~/.omp/agent/extensions/hnl-context.ts | a managed extension on before_agent_start, tool_call, tool_result, agent_end and session_before_compact |
Each hook calls hnl context-hook, which injects:
- On session start: your organisation's policy instructions (the
global text plus every scoped instruction whose conditions match), stated to come from your organisation through HarnessLink and to take precedence over project and user instructions, then the project's context brief (the same one
hnl cloud briefprints), opened by the handoff of an unfinished task when there is one (see Session handoff). The whole injection stays under 9,500 characters for Claude Code and omp (Claude Code's cap is 10,000) and 7,000 for Codex (under its 2,500-token preview limit). - On the first prompt after an org policy change: a "HarnessLink policy
updated (vN)" block, once per change, in every session that is already open: changed instructions in full, withdrawn ones by name, and one line per added, changed or removed rule or limit, with the same precedence sentence. A change that doesn't reach this session (say, an instruction scoped to another folder) adds nothing. What each session was last shown is kept in
~/.hnl/agent/policy-seen/<session id>.json(removed after 30 days). - On each prompt: up to three bank entries whose title or tags share at
least two distinctive words with the prompt, ranked by how well their full text matches it, each with the
projectandrel_paththatmemory_gettakes. Words that appear in most of the project's entries (usually the project's own name) don't count. Nothing is injected when nothing matches. - After each tool call: what your
delegateruns have to tell thissession (see Delegation), and nothing else. With nothing waiting it answers after one directory listing.
It reads the local memory index
and memory files only (about 75 ms per prompt including process start). It
never calls the cloud, gives up after 1.5 seconds (10 seconds at a turn's end
or before a compaction, where it reads the transcript), and exits 0 on any
error, so a broken or missing HarnessLink can't block the harness. Existing hooks and
settings are kept, running it again
changes nothing, and a settings file that isn't valid JSON is left alone and
reported instead of overwritten. hnl cloud setup installs them for every
detected harness as its "Context hooks" step.
Org policy: enforced before every tool call
#The same hooks enforce the rules your org sets on the dashboard's
Policies page. Before each tool call the
harness asks hnl context-hook, which reads the policy the HarnessLink
service keeps in ~/.hnl/agent/cloud-policy.json. It never calls the cloud
on this path.
Changes apply in seconds. While you're signed in (whatever your sync settings), the service holds a connection to HarnessLink that announces each policy change: saving a rule or instruction, a platform owner's override, or an organisation suspended or restored. The announcement carries only your organisation's id and the new version number, never the policy; on hearing it the service fetches the signed bundle at once, so the next tool call is decided by the new rules, usually within a second of the save. The service still checks every minute, and fetches again whenever the connection comes back, so a machine whose connection can't be held open (a strict proxy, say) gets the change within a minute instead. An announcement can't change anything by itself: only a bundle that verifies is used.
| Rule | Claude Code | Codex | omp | pi | Cursor |
|---|---|---|---|---|---|
| deny (tool or command) | blocked | blocked | blocked | blocked | blocked |
| prompt | you're asked | blocked (Codex hooks cannot ask) | you're asked; blocked with no UI | you're asked; blocked with no UI | asked for shell and MCP calls; other tools blocked |
| allow | outranks a lower-precedence restriction; never auto-approves | same | same | same | same |
Tool names on the dashboard use omp's vocabulary (bash, write, edit,
read, web_search, task, …); Claude Code's Bash, Write, Edit,
WebSearch, Task, Codex's Bash and apply_patch (counts as edit
and write), pi's bash/powershell, and Cursor's Shell, Read,
Write (also edit), Delete (also write) map onto them. MCP tools match
by their full name (mcp__<server>__<tool>, Cursor's included). Command
rules use * wildcards and match any part of a compound command
(cd x && rm -rf y meets rm -rf *). A rule conditioned on a model applies
when the harness's model is unknown, unless it is an allow.
The policy is signed, and enforcement fails closed. The control plane
signs every bundle (Ed25519) and binds it to your device and a validity
window: the org's stale tolerance, 24 hours unless an admin sets another
(1–720 h). Every tool and model call verifies the signature, the device and
the expiry, so on a signed-in machine a policy that is missing, edited,
copied from another device, expired, or from a suspended organization blocks
every tool call (and, at the gateway, every model call) with a message saying
how to recover. The service fetches a fresh copy as soon as one is issued
(within a minute at most) while
online; hnl cloud status shows the state and hnl gateway service restart
restarts the service. Your own hnl cloud …, hnl gateway … and
hnl daemon … commands still run through an agent while it is blocked. A
machine that is not signed in has no org policy. The cache file is
read-only, but only the signature is trusted.
Hooks repair themselves. While your org's policy has something to
enforce, the service checks every installed harness at start, every five
minutes and when their config files change, and puts back a removed or
altered policy hook (Claude Code and Codex PreToolUse, the omp and pi
extensions, the Cursor hooks) and HarnessLink's MCP entry where it was
registered. Each repair, refusal and failed verification is reported to
your org's policy audit log. Codex still runs a reinstalled hook only after
you trust it in /hooks.
Install the hooks with hnl harness context [claude-code|codex|omp|pi|cursor].
pi gets ~/.pi/agent/extensions/hnl-policy.ts; Cursor gets
preToolUse, beforeShellExecution, beforeMCPExecution and
beforeReadFile entries in ~/.cursor/hooks.json with failClosed: true.
Cursor's carries policy only, not memory context; pi's also adds your
organisation's instructions at session start and the "policy updated" block
on the next prompt after a change. Antigravity has no tool hook, so org
tool and command rules cannot be enforced there; plain hnl and
hnl cloud status say so. Its model calls follow model rules and limits only
on a Gemini API key, once hnl gateway connect antigravity routes them
through the gateway (below).
Codex's hosted web search bypasses hooks. A refusal names the rule and links
the Policies page.
Installed system-wide on Team and Enterprise. On a machine signed in to a Team or Enterprise organisation whose policy is on, HarnessLink also writes the policy into each harness's admin-owned settings, which sit above anything in your own settings files:
| Harness | File | What it carries |
|---|---|---|
| Claude Code | managed-settings.d/50-harnesslink.json in /Library/Application Support/ClaudeCode/ (macOS), /etc/claude-code/ (Linux, WSL), C:\Program Files\ClaudeCode\ (Windows) | SessionStart, UserPromptSubmit, PreToolUse and PostToolUse hooks on the absolute hnl launcher; permissions.deny/ask for unconditional explicit tool and command rules. A drop-in, so an admin's own managed-settings.json is untouched. |
| Codex | /etc/codex/requirements.toml (macOS, Linux), %ProgramData%\OpenAI\Codex\requirements.toml (Windows), plus a wrapper in HarnessLink's hooks folder (hooks.managed_dir) | The same four hooks, [features] hooks = true so they cannot be switched off, and [rules] prefix_rules for command rules written as word word *. Managed hooks need no /hooks trust. |
| Cursor | hooks.json in /Library/Application Support/Cursor/, /etc/cursor/ or C:\ProgramData\Cursor\ | The four policy hooks, each failClosed. |
| HarnessLink | enrollment.json in /Library/Application Support/HarnessLink/, /etc/harnesslink/ or C:\ProgramData\HarnessLink\ | The org and device ids, so a deleted sign-in does not lift the policy. |
The files hold hook commands, rule patterns and rule names only: never a
token, a signature or your organisation's instructions. They are owned by
root (mode 0644). Writing them takes one administrator step: hnl cloud setup
does it after sign-in, and hnl policy managed install does it any time (a
password prompt on macOS, sudo on Linux, an elevated PowerShell on
Windows — written but not yet exercised on Windows). After that the service
keeps them current: it compares the files with what the policy asks for and
asks for a password only when something changed, at most once a day (a
password dialog on macOS; on Linux and Windows the change waits for you).
A waiting change shows in hnl cloud status, hnl doctor and
hnl policy managed status with the command to run, and Policies ›
Coverage shows each device's state to owners and admins (while the owner's
Devices switch is on). If you leave the organisation or it moves to another
plan, the service removes them the same way; hnl policy managed remove
does it at once and refuses while the policy still requires them. Signing
out leaves them in place. A file at one of these paths that HarnessLink did
not write (for example an admin's requirements.toml) is left alone and
reported as blocked. omp and pi have no system-level settings, so they keep
the user-level extension and the service's repairs.
What each harness guarantees: Claude Code applies managed settings above
user, project and command-line settings, and disableAllHooks outside
managed settings cannot turn managed hooks off; but when the machine also
gets Claude Code policy from claude.ai server-managed settings or MDM,
Claude Code reads only that source by default and skips the file. Codex
enforces requirements.toml above user config, but its own MDM and cloud
requirements rank above the system file, and a running Codex reads it at
start. Cursor runs enterprise hooks alongside user and project hooks, and
the strictest answer wins. An administrator on the machine can still edit
or delete any of these files.
Locked rules. Every rule, instruction and limit is locked when created. An owner or admin unlocks one on the dashboard before changing or deleting it and can lock it again; both are recorded in the policy audit log alongside every change. Policy can only be changed from a signed-in dashboard session, never with an API or device token.
You don't need to reinstall after an update. When the HarnessLink service starts,
it adds the hooks added since (policy, session handoff) wherever HarnessLink's
context hooks are already installed, and refreshes its omp and pi extensions.
Codex runs a new hook only after you trust it: until you open /hooks in Codex
and trust HarnessLink's entries, Codex skips them, and plain hnl shows
"run /hooks in Codex" as the next step.
Session handoff and compaction
#By default a session keeps its full context and the harness compacts it on its own when the context needs it. HarnessLink saves a handoff before every compaction, and in omp it writes the compaction summary itself. You can also set an earlier handoff point, where HarnessLink moves the task to a new session (Claude Code) or compacts it (omp) before the window fills.
Checkpoint. For every session the autobank keeps a task checkpoint in
state/<harness>--<session>.md under the project's memory, updated as the
transcript grows: the goal (the session's first prompt, plus the latest
request), the next step (the todo in progress, else the last assistant
message), the latest tool calls, decisions (assistant and, where the
transcript keeps it, reasoning sentences that state a choice), the files
edited, and the todo list or plan. It is capped at 4,000 characters. Its
status is open, done (every todo finished) or picked_up (a new session
resumed it).
When to hand off. The hooks read the context size from the transcript's
last usage record (Claude Code, omp, pi) or Codex's token_count, never from
a character estimate; omp reports its own. The handoff point is
context.handoffAt in ~/.hnl/agent/config.yml:
context:
handoffAt: auto # default: no handoff point; the harness compacts when its context needs it
# handoffAt: 80000 # a token count
# handoffAt: "40%" # a share of the window
# handoffAt: off # HarnessLink stays out of compaction entirely (no handoff, no summary)The window is the one the harness states (Codex, omp), else the model's
family default (Claude 200k, or 1M once a session is past 200k). With auto
the first row and the "skipped" cells below do not apply: no turn end asks for
a handoff, no compaction is skipped, and HarnessLink never starts one.
| Moment | Claude Code | Codex | omp |
|---|---|---|---|
| A turn ends past a set handoff point, task open | the model is asked to save a handoff with memory_bank (tag handoff) and tell you to start a new session (/clear); asked again only after the context grows by another half of the handoff point, never while a Stop hook is already continuing the turn | nothing (no Stop hook) | HarnessLink compacts the session with its own summary (below): the main session once the turn is over, a subagent between its tool turns |
| Automatic compaction, context under 90% of the window, with a set handoff point | a handoff is saved and the compaction is skipped; the reason is shown | the same (continue: false) | a handoff is saved, then it compacts with HarnessLink's summary; never skipped |
Any other compaction (under handoffAt: auto, at 90% or more, or /compact) | a handoff is saved, then it compacts | the same | the same as above |
Each safe point also banks the checkpoint as a bank entry tagged handoff
(one per session, rewritten in place), so the handoff syncs to your other
machines.
omp: compaction with HarnessLink's summary. omp's extension API cannot
open a new session from a hook, so in omp HarnessLink compacts the session in
place instead, and no model call writes the summary. Every omp compaction
(HarnessLink's, omp's own automatic or overflow one, and /compact) first
saves the handoff as above, then replaces the compacted conversation with a
summary HarnessLink builds from what it already has: the session's
checkpoint, the previous compaction's summary (carried forward, up to 3,000
characters), your own requests verbatim (the newest 12, each up to 2,000
characters), the files modified and read (the newest 40 of each), and a line
telling the model to recall earlier details with HarnessLink's
memory_search, memory_get and session_get tools. The summary is capped
at 9,000 characters; the oldest material goes first. Without a checkpoint,
or if anything fails (HarnessLink missing or slow), omp's own summariser runs.
HarnessLink never cancels an omp compaction.
With a set handoff point HarnessLink also starts the compaction itself: in
the main session when a turn is over (not before a retry or continuation), in
a subagent after a turn that ran tools (not after its last turn or yield),
so subagents, whose whole assignment is one run, get cheaper too. It
compacts once per crossing: again only after the context has been under the
handoff point, so a kept tail still past it is not compacted in a loop. The
main session then shows one line, "HarnessLink compacted this session with
its saved checkpoint", with the size before and after. handoffAt: off
turns all of it off and leaves compaction and its summary to omp.
Resuming. When a session starts fresh (startup), after /clear, or
after a Claude Code or Codex compaction, the newest open checkpoint of the
project (this session's own first, at most three days old) and the newest
handoff note go first in the brief, under "Resume: unfinished task from an
earlier session", capped at 5,000 characters and never dropped for budget.
After an omp compaction they are not added again: HarnessLink's summary
already carries them. Both are then marked picked up, so the next session
starts clean; a checkpoint reopens if its session does more work. Resuming a
transcript (--resume) injects no handoff.
The gateway: every model call goes through HarnessLink
#HarnessLink runs a local gateway on 127.0.0.1:4747. Once a harness is
connected, its model calls go through HarnessLink first, then to the provider.
Your harness keeps its own login: HarnessLink passes the credential through and
never stores provider keys. A HarnessLink Cloud account is required: without a
sign-in the gateway answers every call with "HarnessLink Cloud sign-in required".
hnl gateway connect # start the HarnessLink service if needed, then point every detected harness at it
hnl gateway connect omp # or just one harness
hnl gateway start # start the service on its own (now and at every login)
hnl gateway status # service, sign-in, per-harness wiring, today's savings
hnl gateway disconnect # restore direct provider access| Harness | What connect changes |
|---|---|
| Claude Code | env.ANTHROPIC_BASE_URL in ~/.claude/settings.json (your claude.ai login keeps working) |
| Codex | top-level openai_base_url in ~/.codex/config.toml (ChatGPT login or API key, detected from auth.json) |
| omp | providers.{anthropic,openai-codex,muse-code}.baseUrl in ~/.omp/agent/models.yml, plus a providers.anthropic.compat block (below) |
| pi | providers.anthropic.baseUrl and providers.openai-codex.baseUrl in ~/.pi/agent/models.json |
| Antigravity | Gemini API-key mode only (below): export GOOGLE_GEMINI_BASE_URL=…/antigravity/gemini in a marked block in your shell's startup file |
Restart a harness after connecting it. disconnect puts back exactly what
was there before, including a base URL you had set yourself.
Antigravity. Signed in with a Google account, Antigravity (agy) sends its
model calls straight to Google over a connection no base URL can redirect,
so they are not counted and connect changes nothing. Its CLI can instead
call the Gemini API with your own key
(Using a Gemini API key):
set "modelProvider": "gemini" in ~/.gemini/antigravity-cli/settings.json
and export GEMINI_API_KEY. In that mode it reads GOOGLE_GEMINI_BASE_URL
from its environment (only there: no .env, no setting), so
hnl gateway connect antigravity exports it for new terminals:
| Shell | Where |
|---|---|
| zsh | ~/.zshrc ($ZDOTDIR/.zshrc when set) |
| bash | ~/.bashrc, and on macOS also ~/.bash_profile if you have one |
| fish | ~/.config/fish/conf.d/hnl-gateway.fish (set -gx) |
| Windows | your user environment variable |
The block sits between # >>> HarnessLink gateway: Antigravity >>> and
# <<< HarnessLink gateway: Antigravity <<<; disconnect removes exactly
that block. connect refuses, changing nothing, when GOOGLE_GEMINI_BASE_URL
is already set to another endpoint in your environment or startup file. Open
a new terminal afterwards (or run the export line it prints) before
starting agy. Calls are counted as harness antigravity, provider gemini,
with the model from the request path, so model rules match gemini/<model>.
hnl gateway connect with no harness named includes Antigravity only in
API-key mode, and hnl gateway status shows which mode it is in.
omp decides some Anthropic request features from the base URL, so on the
gateway URL it would treat api.anthropic.com as an unknown proxy. connect
therefore also writes, under providers.anthropic.compat, the official-endpoint
values that hold behind HarnessLink's transparent proxy:
signingEndpoint: true, replayUnsignedThinking: false (unsigned thinking is
never replayed into a 400) and supportsEagerToolInputStreaming: true.
It leaves officialEndpoint and supportsLongCacheRetention (1-hour cache
writes cost twice the input price) unset. A flag you already set yourself is
kept, and disconnect removes only the flags connect added.
The service. hnl gateway connect and hnl gateway start register
the service (daemon run) with the platform's supervisor: a LaunchAgent on macOS, a
systemd --user unit on Linux, a logon task on Windows. Where there is no
supervisor (a container, WSL without systemd) it starts the daemon in the
background and says it will not survive a reboot. connect needs a HarnessLink
Cloud sign-in and waits until the gateway answers before it changes any
harness; if the service cannot start, nothing is connected. The service
(daemon run) hosts the gateway, the MCP hub, the containment
watchdog, gateway-usage sync, prompt-history ingest from every harness with
capture on, cloud sync and the harness transcript watcher. When it is down,
connected harnesses get "connection refused": there is no silent bypass
around HarnessLink. hnl daemon start runs the same loop without a
supervisor: no restart after a crash or reboot and no OS resource limits.
Use it only where gateway start cannot install a service.
Limits. The daemon cannot run away, however many sessions use it. A
watchdog inside it checks the daemon's child-process tree every 5 seconds;
above 200 processes or 2048 MB of combined resident memory it kills that tree
(never the daemon), refuses to start MCP servers for 5 minutes, and records the
trip in ~/.hnl/agent/run/watchdog.json. hnl gateway status shows a
red line for a trip in the last 24 hours, and /_hnl/health reports the
watchdog. The OS adds a backstop: the systemd unit sets TasksMax=512,
MemoryHigh=2G and MemoryMax=3G (TasksMax counts threads: the daemon
alone runs about 40 and each node-based MCP server about 12, twice that under
npx, so 256 would cap you at about nine MCP servers). The LaunchAgent sets
NumberOfProcesses to 4096: macOS applies that limit to every process the
user owns, not just the daemon's tree, and a desktop session already runs
about 500, so a tree-sized value would make every process start in the daemon
fail. Windows has no OS limit (Bun cannot place the daemon in a job object);
the watchdog is the bound there.
Disk. The service writes its output to ~/.hnl/logs/daemon.log.
Past 5 MB (checked at start and hourly) it is copied to daemon.log.1,
replacing the previous copy, and emptied in place, so the log never holds more
than about 10 MB. gateway.db gives back the space of cache entries it drops:
once more than 8 MB is free it shrinks the file. A gateway.db created before
this was in place is rewritten once by the service when it holds more than
32 MB of free space; the service log records the size before and after, and
gateway requests wait for it (about 0.7 s for a 550 MB file).
Token savings. Three mechanisms, all reported per harness on the dashboard's Usage page under Gateway savings:
- Exact-match cache. An identical model request replays the stored
response without calling the provider (response header
x-hnl-gateway: hit). Per-request identifiers that harnesses stamp on every call (Codex item ids and turn metadata, the Claude-Code billing hash,metadata,prompt_cache_key) are ignored when matching. Streams over WebSocket (Codex's default transport) and requests chained withprevious_response_idare never cached, because they depend on server-side state. Entries live 24 hours ingateway.db, capped at 128 MB (gateway.cache.ttlHours,gateway.cache.maxMB,gateway.cache.enabled); the gateway expires and caps it every 15 minutes too and hands freed space back to the filesystem in small steps between requests. An Anthropic request is answered from it only when the stored response is less than a minute old (a retry or a duplicate). A later identical request is usually a harness keeping Anthropic's prompt cache alive (omp repeats its last request about 4.5 minutes later), so it goes to Anthropic and its response replaces the stored one. Sendx-hnl-cache: bypassto skip it for one call, orx-hnl-cache: offto also keep that call's conversation out of keep-warm (below). - Provider prompt caching. Most tokens in an agent loop are the same
conversation prefix re-sent every turn; providers bill those at a large discount when they are cache reads. The gateway records every cache read and, for Anthropic, every cache write split by TTL (5-minute and 1-hour).
Cache assist. An Anthropic request that sets no
cache_controlanywhere gets two breakpoints: top-level automatic caching (Anthropic caches up to the last block and moves the breakpoint forward as the conversation grows) and one on the stable prefix: the last system block, or the last tool when there is no system prompt. A request that sets any breakpoint of its own is forwarded untouched. The Usage page counts assisted requests and the cache reads they earned.TTL.
gateway.cache.anthropicTtl(5m, the default, or1h) sets the TTL of the breakpoints the assist adds; it never changes a harness's own breakpoints. Anthropic's cache entry lives 5 minutes from the start of the last request that wrote or read it. A 5-minute write costs 1.25x input, a 1-hour write 2x input, a read 0.1x or less. So1hpays off when you come back to a conversation 5 to 60 minutes after its last turn (a long review, a meeting, a slow tool run): without it the whole prefix is written again at 1.25x instead of read at 0.1x. With turns less than 5 minutes apart it only adds the 0.75x-input premium on every write.Rewrites. The gateway notices when a conversation writes again a prefix that was already cached, and sorts those tokens by the gap since the conversation's previous request: under 5 minutes (the prefix changed or a breakpoint fell outside Anthropic's 20-block lookback), 5 to 60 minutes (the 5-minute entry expired; 1h would have kept it) and over an hour. The Usage page shows what the rewrites cost and what
1hwould have saved against what it would have cost extra. It is an estimate: a harness that edits earlier turns in place also shows up as rewrites.Keep-warm. When an Anthropic conversation goes quiet (a subagent waiting for its parent, you reading a diff), the gateway keeps its 5-minute cache alive: 4 minutes 45 seconds after the start of the conversation's latest request it sends that request again, byte for byte, reads the response only up to its first event (which reports the usage) and closes the connection. That costs one cache read of the prefix (0.1x input or less) plus the small uncached tail, instead of writing the whole prefix again at 1.25x when you come back. It repeats every 4 minutes 45 seconds until the conversation has had no request of its own for
gateway.cache.keepWarmMinutes(35 by default;0turns keep-warm off). Any request of the conversation, including a harness's own cache-warming request (omp warms its main session at 4 minutes 30 seconds), resets the timer, so nothing is warmed twice. Only conversations with at least 20,000 cached tokens in the 5-minute tier are warmed: never a conversation whose last cache write was 1-hour, one that sets nocache_control, a request body over 16 MB, or a request sent withx-hnl-cache: off. A conversation whose latest response called theyieldtool (an omp subagent finishing its run) is not warmed until its next turn: most finished subagents never resume, so refreshing them cost about twice what it saved. A request sent without streaming is replayed as a stream:streamis not part of the cached prompt, so it reads the same entry. Warming stops for a conversation when a refresh misses (it reads less than 90% of what it was keeping, so it wrote the prefix again) until the conversation's next real turn, and for good on any provider error or rate limit; it is never retried. The requests it replays, credentials included, are held in memory only (at most 64 MB, the conversations with the fewest cached tokens dropped first) and never written to disk or logs. The Usage page counts the refreshes and what they cost (also included in the gateway's spend, but not in its request count), and the cached tokens they rescued: a real turn that came back 5 minutes or more after the previous one and read what a refresh had kept, with the write it avoided less the read as the saving. - Context compression. Oversized text the model is sent (tool results, pasted logs, JSON
dumps) shrinks before it reaches the provider: identical log lines collapse with counts, JSON minifies, and anything over
gateway.compress.maxBlockChars(12,000) keeps head and tail with a marker and an id. The original stays here 7 days for thecontext_expandMCP tool, withingateway.compress.maxMB(128 MB) (gateway.compress.enabled: falseturns it off;x-hnl-cache: bypassskips one call). Deterministic, so the cache above stays correct. System prompts, tool definitions and harness-added context are never touched. Usage counts the tokens and dollars held back.Web pages. A raw HTML page in a tool result (
curl, an MCP fetch) is first distilled to text (headings, paragraphs, lists, tables, code verbatim,[text](url)links, alt text; no scripts, styles or navigation), then capped;context_expandreturns the distilled text in pages (offset), or the HTML withformat: "html". File reads, commands that fetch no URL, source and pages that would not shrink by a fifth pass untouched.gateway.compress.html: falseturns it off.Code and stack traces. Where the cap cuts a tool result anyway, a source file is outlined instead (imports and signatures kept, bodies folded to
… N lines (L1–L2) …) and a stack trace keeps its error and first app frames.gateway.compress.codeOutline: falseturns this off.Stale tool results. In long conversations, old tool results (read or run again, edited since, or over 4 KB) and superseded screenshots become
context_expandstubs. The lastgateway.compress.staleKeepTurns(12) turns stay whole; the boundary moves in 32-turn steps, only when worth a prompt-cache rewrite.gateway.compress.staleResults: falseturns it off.
Costs are estimates from the bundled model catalog; a model the catalog does not price shows tokens saved without a dollar figure.