guid.foo midden

An archive of agent session transcripts that serves them back as MCP tools.

0 74 pulls 7 Updated 9h
20261204181213-5f3baa1 MIT Source Docs
docker pull seamark.cr/guid.foo/midden:latest
Image Size Layers
8.9 MB 3
Pushed 9h
Vulnerabilities
Loading...
Pulls
74 total
Last pull 9h

midden

midden archives the transcript of every agent session you run, on
every machine, and lets your agents search the archive.

midden ship    # from a Claude Code hook: send new transcript entries
midden serve   # on your server: store them and serve them as MCP tools

midden stores the whole transcript: prompts, responses, tool calls,
tool results, and subagent turns. It’s for you if you run
Claude Code on several
machines, or run agents unattended, and want one history of all of it.

midden ship sends the entries as
OpenTelemetry logs. midden serve stores
them in PostgreSQL and serves seven
MCP tools at /mcp. The tools
list, read, and search sessions, and run read-only SQL.

A session is private when it works in a private repository or calls a
private tool, such as a mail connector. The users you name get the full
view, with every session. Everyone else gets the shared view, without
the private sessions.

simmer runs agents unattended,
and is optional. Its agents ship their sessions to midden, and can
search the archive in the shared view.

Install

midden needs:

  • PostgreSQL, and a superuser to create midden’s database and roles.
  • A login for atcr.io, the registry that
    hosts midden’s image.
  • A capture proxy, which checks HTTP Basic logins for MIDDEN_LISTEN.
  • An MCP proxy, which logs users in for MIDDEN_MCP_LISTEN.

midden trusts the user header that each proxy sets. Make sure that
nothing but the proxies can reach those two addresses.
Authentik can be both proxies, and the
install skill shows how to set it up.

As a superuser, create the database, an owner for midden’s tables, and
a login role for each view. Don’t grant the view roles anything. midden
grants their access itself, and won’t start if a role can read more
than its view.

CREATE ROLE midden LOGIN PASSWORD 'owner-secret';
CREATE DATABASE midden OWNER midden;
CREATE ROLE midden_full LOGIN PASSWORD 'full-secret';
CREATE ROLE midden_shared LOGIN PASSWORD 'shared-secret';
ALTER ROLE midden_full SET temp_file_limit = '1GB';

Write the settings to midden.env, and start the server with
Docker:

# midden.env
DATABASE_URL=postgres://midden:owner-secret@db.example.com/midden
MIDDEN_LISTEN=127.0.0.1:8080
MIDDEN_MCP_LISTEN=127.0.0.1:8081
MIDDEN_MCP_USER_HEADER=X-authentik-username
MIDDEN_MCP_FULL_USERS=alice
MIDDEN_MCP_FULL_DATABASE_URL=postgres://midden_full:full-secret@db.example.com/midden
MIDDEN_MCP_SHARED_DATABASE_URL=postgres://midden_shared:shared-secret@db.example.com/midden
docker run --env-file midden.env --network host atcr.io/guid.foo/midden:latest serve

curl http://localhost:8080/healthz returns 200 once the server is up.

Route https://midden.example.com/v1/logs to port 8080 through the
capture proxy. Route https://midden.example.com/mcp to port 8081
through the MCP proxy. Don’t route a proxy to port 9200, where midden
serves its Prometheus metrics.

The install skill also runs midden in
Kubernetes, and lists every setting.

First use

On each machine where you run Claude Code, build midden with
Go 1.27.4 or newer. go install puts it in
$(go env GOPATH)/bin. Claude Code’s hooks must find it there, so add
that directory to the PATH they run with.

These commands build midden, write its settings, and ship every
transcript that the machine still has. The password is this machine’s
app password for the capture proxy:

git clone https://tangled.org/guid.foo/midden.git
cd midden && go install .
mkdir -p ~/.config/midden
cat > ~/.config/midden/env <<'EOF'
MIDDEN_ENDPOINT=https://midden.example.com/v1/logs
MIDDEN_USERNAME=alice
MIDDEN_PASSWORD=<this machine's app password>
EOF
midden ship

The first run prints midden: shipped 1234 entries, and a second run
prints midden: shipped 0 entries.

To ship after every turn, add these hooks to ~/.claude/settings.json.
The SessionEnd hook ships what the session wrote after its last
Stop hook:

{
  "hooks": {
    "Stop": [{ "hooks": [{ "type": "command", "command": "midden ship || true", "timeout": 120 }] }],
    "SessionEnd": [{ "hooks": [{ "type": "command", "command": "midden ship || true", "timeout": 120 }] }]
  }
}

If your MCP proxy needs a token, add it with --header. Then add the
tools to Claude Code and ask about your history:

claude mcp add --transport http midden https://midden.example.com/mcp
claude "Which sessions this week worked in the notes repository, and what did each one change?"

The agent uses list_sessions, describe_session, and read_session
to answer. On a new database, the tools return “try again later” until
midden finishes building its tables.

Skills

skills/ has a guide for each task, as
Agent Skills:

  • install: run midden serve in
    Kubernetes or on its own, set up its roles and proxies, and upgrade
    it.
  • ship-transcripts: ship
    transcripts from a machine or a pod, and send Claude Code’s own
    OpenTelemetry events.
  • search-the-archive: connect
    an MCP client and use the seven tools, including query for SQL.
  • keep-sessions-private:
    choose the private repositories and tools, who gets the full view,
    and whether the shared view can run SQL.
  • troubleshoot: find out why entries
    don’t arrive, a build doesn’t finish, or a tool call fails.

The repository is also a plugin marketplace. In Claude Code:

claude plugin marketplace add https://tangled.org/guid.foo/midden.git
claude plugin install midden@midden

In Codex:

codex plugin marketplace add https://tangled.org/guid.foo/midden.git
codex plugin add midden@midden

Any other agent that reads Agent Skills can use skills/ directly.

More

The design is in plans/00-design.md.

MIT. See LICENSE.

Report a problem at https://tangled.org/guid.foo/midden/issues.