Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(docker): persist session history across container revisions (#1118)
Serge ARADJ5912d65674c7
diff --git a/Dockerfile b/Dockerfileindex 4e4628db5..d03af8146 100644--- a/Dockerfile+++ b/Dockerfile@@ -75,6 +75,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \FROM python:${PYTHON_VERSION}-slim AS runtime-slim-baseARG RUNTIME_USER=nonroot+ARG RUNTIME_HOME=/home/nonrootARG PYTHON_SITE_PACKAGESRUN apt-get update && \@@ -97,12 +98,19 @@ RUN mkdir -p /home/nonroot /data && \fiUSER ${RUNTIME_USER}-WORKDIR /home/nonroot+WORKDIR ${RUNTIME_HOME}ENV HEADROOM_HOST=0.0.0.0 \PYTHONUNBUFFERED=1 \PYTHONDONTWRITEBYTECODE=1+# Declare ~/.headroom as a volume so Docker (and ACA) can attach persistent+# storage here. Bare `docker run` gets an anonymous volume as a fallback so+# state is never silently written to the ephemeral container layer.+# RUNTIME_HOME defaults to /home/nonroot (the published image default); pass+# --build-arg RUNTIME_HOME=/root when building with RUNTIME_USER=root.+VOLUME ${RUNTIME_HOME}/.headroom+EXPOSE 8787HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \@@ -137,4 +145,4 @@ ENTRYPOINT ["python3", "-m", "headroom.cli", "proxy"]CMD ["--host", "0.0.0.0", "--port", "8787"]# Default published image remains python-slim runtime-FROM runtime-slim-base AS runtime+FROM runtime-slim-base AS runtime\ No newline at end of filediff --git a/docker-compose.yml b/docker-compose.ymlindex a3a30316e..dbb8b0f9e 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -9,6 +9,8 @@ services:# - OPENAI_TARGET_API_URL=https://api.x.aiports:- "8787:8787"+ volumes:+ - headroom_workspace:/home/nonroot/.headroomhealthcheck:test: ["CMD", "curl", "--fail", "--silent", "http://127.0.0.1:8787/readyz"]interval: 30s@@ -46,5 +48,6 @@ services:- NEO4J_apoc_import_file_use__neo4j__config=truevolumes:+ headroom_workspace: # persists proxy_savings, memory.db, session_stats, toin across image updatesqdrant_data:- neo4j_data:+ neo4j_data:\ No newline at end of file