Monolith Technical Briefing

The Problem

AI coding agents need recursive reasoning over large contexts without losing session state. Existing RLM frameworks operate interactively but lack deployed infrastructure, persistent memory across sessions, and MCP tooling integration — forcing agents to restart context from scratch on every new task.

What This Does

Monolith packages RLM as deployable infrastructure (23 files in rlm/, 21 in mcp-modal/). It adds three layers: an MCP server (claude_tool_mcp/server.py / mcp-modal/server.py) exposing RLM as tools, Modal serverless backend (mcp-modal/modal_runtime.py / rlm/modal_runtime.py) with zero-manage compute, and a Modal Volume persistent memory layer (modal_runtime.py) storing {thread_id}/context.txt across sessions. The reasoning loop (rlm/rlm/repl.py, mcp-modal/rlm/repl.py) uses a root LLM (gpt-5) for orchestration and sub-LLMs (gpt-5-nano) for focused analysis, keeping costs low on arbitrarily large contexts.

How It Is Wired

Execution starts at main.py:52 (run, reaches 35 functions, called by nothing else) or main.py:77 (main, reaches 57 functions, called from 1 place). The primary agent-facing entry is chat_rlm_query in claude_tool_mcp/server.py:91 (reaches 39 functions, called by nothing else), which invokes answer (claude_tool_mcp/server.py:82, reaches 34 functions, called from 2 places). The traced path: run -> answer -> completion [model via self.llm.completion]. Key hubs are _colorize (called from 6 places, 8 edges from log_query_start/log_model_response), completion (5 places), and code_execution (4 places, 5 edges from load_context). The module graph shows mcp-modal/rlm/repl.py and rlm/rlm/repl.py as the most connected (19 functions each, called from 6 and 2 files respectively), with mcp-modal/rlm/logger/root_logger.py central to logging (_colorize called from 5 files). Four distinct projects compose the repo — rlm, mcp-modal, deeprecurse, scripts, claude_tool_mcp — sharing RLM reasoning patterns but no common architecture.

How To Use It

Setup: Clone https://github.com/moses-y/Monolith. Install OpenAI key into a Modal volume: modal volume create rlm-shared-volume then echo "OPENAI_API_KEY=sk-..." > .env. No lockfile exists; rlm/requirements.txt, mcp-modal/requirements.txt, and requirements.txt declare dependencies via pip.

Configuration: OpenAI API key stored in Modal Volume. No other env vars are required for basic operation.

Running: python -m monolith.query or python -m monolith.store (CLI entry points from main.py). To serve via MCP: start the Cloudflare Worker (mcp-modal/cloudflare/worker-gateway/src/index.ts) or the Python stdio server (mcp-modal/server.py). CORS is currently wildcard (access-control-allow-origin": "* in mcp-modal/cloudflare/worker-gateway/src/index.ts) — restrict for production.

Real-World Use

A Claude Code user invokes chat_rlm_query with a complex codebase question and thread_id. The MCP server routes to Modal, which reads the thread's context from Volume, enters the REPL reasoning loop: root LLM reads context, writes Python to split along chunk boundaries, delegates semantic analysis to sub-LLM via llm_query(), aggregates results, appends the Q&A turn to Volume, and returns the answer. On subsequent sessions, the agent resumes from the accumulated context rather than starting fresh.

Code Health & Issues

  • [HIGH] Add a test suite — 40 source files, no test files. Any change ships with no signal existing behaviour holds; regressions reach production undetected. Fix: add one test per public entry point, then a CI step that runs them.
  • [HIGH] Add a workflow that builds and tests — 40 source files, no CI configuration. Every change merges with nobody having run the build, which across this estate means zero verification gates.
  • [HIGH] Replace wildcard CORS origin — mcp-modal/cloudflare/worker-gateway/src/index.ts has access-control-allow-origin": "*. Paired with credentials, any page on the internet can call the API with the browser's cookies attached, enabling authenticated requests without the user's knowledge.
  • [MEDIUM] Enable Dependabot or Renovate — 5 manifest(s), no update bot configured. Without a bot, a published advisory sits unpatched until someone audits by hand.

The Bottom Line

The repo successfully turns RLM into deployed, persistent infrastructure that AI agents can call as a tool — the MCP + Modal + Volume stack works as described. However, the codebase shows poor test coverage, no CI, and a dangerous wildcard CORS configuration. It is suitable for early prototyping or internal agent workflows where these gaps are acceptable, but not for production deployment without addressing the health findings.