ModelCtx

Open source · Apache-2.0 · Early development (M0)

See what your agent actually saw.

ModelCtx defines CCM, an open data model for agent context, converts sessions from agent clients into it, and shows the context window of every model call — including how subagents and the main agent hand work to each other.

Get startedView on GitHub

Call #37 · 128k window100%
  • System + tools 9%
  • AGENTS.md 4%
  • Summary (compacted) 11%
  • Messages 22%
  • Tool results 38%
  • Free 16%
Illustrative: the derived context window of one model call

Debug any agent. Share any run. Keep every secret.

Stop rebuilding debug views

Convert a session once and get the full trajectory: threads, turns, tool calls, compactions. No per-agent visualizer to maintain.

Share a run with a link

Upload with one command, then send a link. Other developers open the real session in ModelCtx Studio instead of a screenshot.

Only you can read your data

Local-first. Redacted on your machine. End-to-end encrypted in the cloud, so the server only ever stores ciphertext.

ModelCtx Studio, personal spaces and share links are planned for milestones M1–M3; today the project ships the data model and the converters.

Context is the product, trace is the input

Tracing tools show which calls happened. CCM shows what was inside the window at each call, where it came from, how many tokens it took, and why it was compacted or dropped. The primitives follow Codex app-server and Claude Code transcripts.

Thread

One context window: a main agent, a subagent, or a fork.

Turn

One unit of work started by an input.

Item

An atomic record with a lifecycle: user message, agent message, reasoning, tool call, compaction, injection.

Memory

A record in a store shared across threads, like AGENTS.md.

The context window is derived from the records, not stored: the model-visible items of a thread since its last compaction, plus the thread instructions.

Quick start

Convert a Claude Code or Codex session into a .mctx file and inspect it.

git clone https://github.com/modelctx-ai/modelctx
cd modelctx && bash scripts/setup.sh

# Claude Code → CCM
node apps/cli/dist/cli.js convert ~/.claude/projects/<project>/<session>.jsonl -o session.mctx
node apps/cli/dist/cli.js inspect session.mctx

# Codex CLI: all of ~/.codex/sessions
node apps/cli/dist/cli.js convert --from codex -o codex.mctx

Sources

Claude CodeConverter (synthetic fixtures)
Codex CLIConverter (synthetic fixtures)
Gemini CLI, Cursor, OpenCode, …Planned
OpenTelemetry GenAI, Langfuse, LangSmithPlanned

What it is not

ModelCtx is not an agent runtime and not a production observability backend. It interoperates with Langfuse, LangSmith and OpenTelemetry GenAI instead of replacing them.