Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
events {}
http {
access_log /dev/stdout;
error_log /dev/stderr info;
upstream memory {
server ai-memory:49374;
}
# Each port stands for one authenticated human. A real deployment resolves
# the identity from an SSO session; here the port IS the session, which
# keeps the harness honest about the only thing that matters downstream:
# what the proxy asserts.
#
# `proxy_set_header` REPLACES, it does not append. That is exactly the
# requirement docs/users.md places on the operator — with an appending
# ingress the client's own value arrives first and would be the one read.
# Asserting it here means this harness also demonstrates the safe config.
server {
listen 8081;
location / {
proxy_pass http://memory;
proxy_set_header Authorization "Bearer proxy-token-for-the-proxy-only";
proxy_set_header X-Memory-Actor-User "alice";
proxy_set_header X-Memory-Actor-Agent $http_x_memory_actor_agent;
proxy_set_header X-Memory-Actor-Session-Id $http_x_memory_actor_session_id;
# Anything else the client tried to assert is dropped on the floor.
proxy_set_header X-Memory-Actor-Sub "";
proxy_set_header X-Memory-Actor-Issuer "";
proxy_set_header X-Memory-Actor-Client "";
proxy_set_header Host $host;
}
}
server {
listen 8082;
location / {
proxy_pass http://memory;
proxy_set_header Authorization "Bearer proxy-token-for-the-proxy-only";
proxy_set_header X-Memory-Actor-User "bob";
proxy_set_header X-Memory-Actor-Agent $http_x_memory_actor_agent;
proxy_set_header X-Memory-Actor-Session-Id $http_x_memory_actor_session_id;
proxy_set_header X-Memory-Actor-Sub "";
proxy_set_header X-Memory-Actor-Issuer "";
proxy_set_header X-Memory-Actor-Client "";
proxy_set_header Host $host;
}
}
# The OIDC ingress: names a human via the issuer/subject pair with no
# `preferred_username`, so no X-Memory-Actor-User. The engine treats this
# as a named operator (identity_key resolves the subject, and it OUTRANKS
# a username); a regression here files the operator as unattributed and is
# invisible without a test.
server {
listen 8083;
location / {
proxy_pass http://memory;
proxy_set_header Authorization "Bearer proxy-token-for-the-proxy-only";
proxy_set_header X-Memory-Actor-User "";
proxy_set_header X-Memory-Actor-Issuer "https://idp.example";
proxy_set_header X-Memory-Actor-Sub "oidc-subject-carol";
proxy_set_header X-Memory-Actor-Agent $http_x_memory_actor_agent;
proxy_set_header X-Memory-Actor-Session-Id $http_x_memory_actor_session_id;
proxy_set_header Host $host;
}
}
}