Skip to main content
Glama

harness-connector

A small work harness you add to claude.ai as a custom connector. Any chat that has it knows who you are, remembers the last chat, logs what it decides, wraps up when you say so, and can't send anything outward until you approve the exact text in a form.

It is a plain Python server on your own box, with your data in files you can read. Nothing here calls a model.

What a chat gets

Tool

What it does

orient

Returns your profile, the rolling memory from earlier chats, and the work log since the last wrap. The server instructions tell the chat to call it first.

log_work

Appends one short entry: a decision, a result, an open question, a note.

wrap_begin, wrap_commit

A wrap. The server hands over a packet; the chat rewrites the rolling memory from it; the server checks the result and installs it.

outward_send

The one tool that leaves the chat. It shows you the exact text in a form. It runs only if you check the box and submit.

It also serves the wrap procedure as an MCP skill (and as a resource, for clients that don't list skills) and your profile as a resource.

Every call to one of the five tools is written to receipts.jsonl with its arguments, before the tool runs. If that write fails, the tool doesn't run.

Related MCP server: Claude Soul

What we measured

On 2026-11-29 I put a throwaway server in front of claude.ai and asked it three things. These are the results, and the only claims this README makes about claude.ai.

  • Skills load. The client listed an MCP skill from the server, read it and ran it.

  • Sampling is out. The client that ran the tools declared elicitation, extensions and roots, and no sampling. A request sent anyway (sampling/createMessage) was refused and not retried. So the server can't ask the chat's model for a completion, and the wrap below is built around that. The 2026-07-28 spec also marks sampling deprecated.

  • Elicitation forms work. The form appeared. Approving it ran the pending action once; declining ran nothing.

One detail worth knowing: the client that made the tool calls identified itself as claude-code/2.1.333, reached through the claude.ai connector. The claude.ai web client, in the same minute, declared only extensions on server/discover. If you run this from a surface that doesn't declare elicitation, outward_send refuses and nothing is sent.

The wrap, and its limit

A wrap normally wants a fresh context: a second model call that sees only the old memory and the new log. Without sampling the server can't make that call, so the chat does the rewrite itself.

wrap_begin returns a packet: the current rolling memory, the log entries since the last wrap, a character cap, a base hash and a through number. The base (an HMAC-SHA256 under a key derived from the server's signing key) covers both the whole rolling.md file (including any part past what the packet shows) and through. The wrap skill tells the chat to write the new memory from that packet only. wrap_commit then refuses a stale base or a through other than the packet's (so entries the packet never showed can't be marked folded), an over-cap text, or a through outside the log. The cap is measured on the text as stored: trailing newlines are stripped and exactly one is put back, and that one counts. It keeps the previous version as rolling.prev.md. Entries logged while the wrap was running stay unwrapped for the next one.

A commit writes three files in order: rolling.prev.md, then rolling.md, then the marker in state.json. A crash between the rolling write and the marker write leaves the new memory in place with the marker not advanced, so the next packet holds the same entries in both places, folded into the rolling memory and again in the log; the chat should treat a log line the rolling memory already says as folded. rolling.prev.md holds what the most recent commit replaced. A crash after it was written and before rolling.md was replaced leaves it a copy of rolling.md, and the version before that is gone.

The cost is real: the rewrite is the same chat, held to the packet by instructions. It isn't a fresh context. The .prev copy and the receipts are what make a bad rewrite recoverable. If you want a true fresh-context rewrite, call a model from the server with your own API key; that's not built here, on purpose, so the server holds no secret and spends nothing.

The approval gate

MCP 2026-07-28 has no server-to-client requests. When outward_send needs your answer, it replies with an interim result (input_required, the form, and a requestState string). The client shows the form, then retries the same call with your answer.

The server keeps nothing between the two round trips, so requestState carries what the second one needs, and the spec says to treat that string as attacker-controlled. Here that means:

  • it's HMAC-signed, and holds the connector name, the tool, a short expiry (STATE_TTL_S in gate.py), a random nonce and the exact text the form showed;

  • the send runs from the text in the verified state, never from the retry's arguments;

  • the nonce is spent and fsynced before anything runs, on any answer (a missing or unrecognised one too) from a client that can show the form, so one form gets one answer and a replayed approve sends nothing;

  • only action: accept with approve equal to the JSON boolean true runs it ("true" and 1 don't);

  • a client that didn't declare form elicitation (elicitation empty or with form; a url-only declaration doesn't count), and the older protocol era (this server has no form flow for it), never send: the tool refuses, on the first call and on a retry alike;

  • the text and the destination are checked against an allowlist before anything is asked. Allowed: letters, numbers, punctuation, symbols and the plain space (U+0020); in the text only, line breaks and tabs; and combining marks (accents and the like) only directly after a letter, number or symbol, a few in a row at most (MAX_MARKS in gate.py). Never allowed, though their Unicode categories would pass: variation selectors (U+FE00 to U+FE0F, U+E0100 to U+E01EF), the combining grapheme joiner (U+034F), the Hangul fillers (U+115F, U+1160, U+3164, U+FFA0), the Khmer inherent vowels (U+17B4, U+17B5), the Mongolian free variation selectors (U+180B to U+180D, U+180F) and the braille blank (U+2800). No variation selector is let through, so a text containing U+FE0F (the colour form of a heart or a check mark) is refused whole; the chat has to send the plain symbol without it. Everything else is refused, including every space other than U+0020 (the no-break space U+00A0, U+2000 to U+200A, U+3000 and the rest), because they look like a plain space and the form cannot show which one it is; control, format, private-use and unassigned characters are refused too. A run of invisible characters (text followed by hundreds of variation selectors carrying a hidden instruction) shows as just the text, which is why the check is an allowlist;

  • the form shows the destination JSON-quoted on one labelled line, every line of the text behind a | quote bar, and then the text's length, how many of its characters are not ASCII, and the first characters of its sha256, so nothing the chat passes can pose as part of the form.

What the gate assumes: it proves the client sent an accept for a form this server issued. It can't prove a human was the one who clicked. It relies on the client showing the form to the user and keeping the interim result (requestState) out of the model's reach. The model's tool call only controls arguments (the tool's input schema has no requestState or inputResponses, and additionalProperties is false), which is why the model can't craft a retry itself. Look-alike characters (homoglyphs) and how a client renders the message aren't things a server can fully control; the form shows the text as quoted lines plus a length and a hash.

"Send" means one of two things. With --webhook-url https://... the approved text is POSTed to that URL as {"text", "to"}, and the chat is told which of three things happened: SENT (the webhook answered 2xx), NOT SENT (it answered 4xx other than 408, rejecting the message, or the request never left: the name didn't resolve or the connection was refused), or UNCONFIRMED (anything else: a 408, 3xx or 5xx answer, a timeout, a dropped connection, a broken response; the message may have arrived, and the chat is told not to resend without asking you). Without a webhook, the reply starts APPROVED: the text is only recorded in outbox.jsonl and nothing leaves the server. Either way an approved line goes into outbox.jsonl before any delivery (if that write fails, nothing is sent), and with a webhook a second line with the same id records the result. Delivery runs outside the session lock, so a slow webhook doesn't hold up the other tools.

Sends are at most once. A crash after the nonce is spent and before delivery means nothing is sent, and the chat has to ask again.

Install

You need Python 3.10 or newer, a machine with a public hostname, and something in front that does TLS (Caddy, nginx). Linux or macOS.

pip install git+https://github.com/phillipclapham/harness-connector   # brings in anneal-memory, whose HTTP front this uses
harness-connector init --data ~/harness-data

Edit ~/harness-data/profile.md, which init seeded with an example of the shape: who you are and how you want to be answered. Keep it to things you're happy for every chat to read.

Make a token (the connector's sign-in uses it) and start the server:

python -m anneal_memory.remote token-add --token-file ~/harness-data/tokens claude-ai
harness-connector serve --data ~/harness-data --token-file ~/harness-data/tokens \
    --port 8770 --oauth-issuer https://harness.example.com

The token prints once. Keep it; only a hash is stored. deploy/harness-connector.service is a systemd user unit and deploy/Caddyfile.example is the proxy block.

Before claude.ai can sign in, open the sign-in window on the box:

python -m anneal_memory.remote oauth-window --token-file ~/harness-data/tokens --minutes 10

Then in claude.ai: Settings, Connectors, Add custom connector, your https://harness.example.com/mcp, Connect, paste the token at the sign-in page. The window allows one sign-in and closes. Remove the connector from the same settings page when you're done with it.

Run one server per data directory; a second one refuses to start.

What's in the data directory

profile.md        you, written by you
rolling.md        the rolling memory (rolling.prev.md is what the last wrap replaced; see the wrap section)
worklog.jsonl     what chats logged
state.json        where the last wrap ended: it decides which log entries count as folded into rolling.md
receipts.jsonl    every call to one of the five tools with its arguments, plus its outcome
outbox.jsonl      every approved send and its delivery result
consumed.jsonl    spent form nonces (it only grows)
.state_key        the signing key; forms and wraps each sign with their own key derived from it
.lock             held by the running server, so a second one refuses to start

Receipts hold whatever text the chats passed in. They're yours and 0600; protect the directory like you would your shell history.

Limits

  • The HTTP front is anneal-memory's remote module: this subclasses the package's HTTP handler to record each request's MCP-Protocol-Version, Mcp-Method and Mcp-Name headers and to send a header-mismatch reply as HTTP 400 (it overrides the handler's private _send) (the session refuses a modern request whose header is missing or differs from its _meta version, as the 2026-07-28 spec requires) and patches one list at runtime, its supported protocol versions. That module isn't in its frozen public surface, so the dependency is pinned to >=4.0.2,<4.1. A new minor of anneal-memory needs a re-check before you move the pin.

  • A missing or mismatched MCP-Protocol-Version header on a modern request is answered as a JSON-RPC error (-32022) inside HTTP 200, because the package's handler sends the reply. The 2026-07-28 spec says HTTP 400; claude.ai accepted 200 for JSON-RPC errors in our measurements.

  • One user, one box. Bearer tokens and one-user OAuth; no accounts, no multi-tenant anything. Hosting other people's data is a separate question this doesn't answer.

  • The older protocol era is served (initialize handshake, tools, resources) so existing clients connect, but this server has no form flow for it, so outward_send refuses there.

  • The wrap isn't a fresh-context rewrite. See above.

  • consumed.jsonl and worklog.jsonl are re-read in full (every answer to a form reads the first; every log_work, orient and wrap call reads the second), so they slow down as they grow. That's fine for one person. Prune consumed.jsonl by hand after the forms in it have expired (STATE_TTL_S in gate.py).

  • Only the first MAX_PROFILE_BYTES of profile.md are read, and rolling.md is read up to ROLLING_READ_FACTOR bytes per character of the cap (both in store.py). Past its bound the profile is cut without a note, and orient shows the start of the rolling memory with a note that it was cut. A wrap refuses a rolling.md past its bound (and one it can't read) with the reason and changes nothing: it shows and signs the file from one read, so it takes the whole file or none of it. Shorten the file by hand and wrap again.

  • The 2026-07-28 spec's routing headers are required: a modern request without Mcp-Method, or a tools/call, resources/read or prompts/get without Mcp-Name, or with either differing from the body (Mcp-Name may be =?base64?...?= encoded), is answered HTTP 400 with JSON-RPC error -32020 and nothing runs. A request in the older era is held to the same rule only for a header it sends. This is the spec's text, read on 2026-11-30; claude.ai's own requests have not been measured against it, so the first claude.ai run after this change is the check.

  • A wrap writes rolling.prev.md, then reads rolling.md once more and is refused if it changed since the wrap's first read, then writes and renames the new file. An editor can't be locked out, so an edit landing during that last write and rename (milliseconds) is still lost; rolling.prev.md then holds the version before the edit. --rolling-cap takes 200 or more.

  • Tests: pip install -e '.[test]' && pytest. They cover the gate, the wrap, the receipts and the HTTP front, not claude.ai itself.

MIT licensed.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A local-first cognitive substrate for neurodivergent professionals. Gives Claude memory, a sense of time, a translator for corporate ambiguity, and a guardrail that refuses to amplify rumination, hyperfocus, or sycophancy. MCP-native. No telemetry. AGPL-3.0-or-later. Self-ID sufficient — no diagnosis gating.
      17
      22
      AGPL 3.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives Claude Code persistent cross-session memory with semantic search, automatic detection and classification of user corrections into behavioral patterns, and self-evolving frameworks that refine judgment over time. Everything runs locally through hooks and MCP tools, with no cloud, API keys, or telemetry.
      6 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables Claude Code, Cursor, Codex, and Claude Desktop to carry project decisions, rules, bugs, to-dos, and failed approaches across sessions by saving them as lines in a repo file and bringing the relevant ones back on each prompt. It also checks commands and file edits against those saved rules before they run, flagging anything that might break one.
      158 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives Claude Code a persistent identity and cross-session memory with semantic search over saved facts, decisions, and journals. It also detects and classifies user corrections into behavioral patterns with lifecycle trends, reflecting periodically to promote or retire working frameworks.
      6 npm
      MIT