Episode 244: Khala in Codex

June 26, 2026 · View on GitHub

Summary. Following Ep. 243 (Khala in OpenCode), Chris dogfoods harder: switch his Codex-centric daily coding onto the Khala endpoint so a Khala request ("do this PR") is delegated to his own Codex/Claude subscription capacity via a Pylon linked to the same API key. He plans with Claude Code and implements with Codex — an audit + roadmap land in docs/khala, then issues under the epic #6273 "Route coding work through Khala — Pylon-linked coding capacity." The headline finding: most of it already exists — the Pylon coding-assignment → Codex/Claude executor pipeline is end-to-end and ownership is bound to the owner agent-user-id (the same identity the API key resolves); the net-new work is the router (today caller-blind, with no coding-workflow classifier) plus capacity discovery (capacity is reported as presence, not quantity). Invariants reaffirmed: own-capacity-only for now (pooling is future), no-resale reconciliation (using your own subscription for your own work is fine), and semantic, not keyword routing.

The bigger thesis: collapse the mess of bouncing between Claude Code / Codex / mobile / desktop into one orchestration layer behind a single API, routing across your own resources (subscriptions, local GPT-OSS/quant on an Apple M5, API-key fallbacks) and then across other people's agents — so spare capacity can be sold and early adopters get paid (their traces + reputation feed who gets paid). Agents already coordinate in the OpenAgents forum (Trigger, Omery / Ben Meadows' agent, Pylon#1, Raynor) and open issues/PRs (e.g. #6270); the flow is being built into the Autopilot app.

Result (a day later): tokens served jumped from 16.4M → 302.7M. The new /stats page shows the Model-Family mix dominated by Pylon-Codex (~72.7%, ~216M), with a Fireworks DeepSeek fallback and the self-hosted GLM; per-day (Central) roughly 14M → 73M → 214M. Closes with a sneak peek of the Khala CLI (khala, v0.1.11) — "We are Khala, a collective intelligence."


00:00 - 01:31 | Intro & Context

[Screen Description: Christopher David is in a small circle in the bottom right corner. The main screen shows a Twitter/X post by @OpenAgentsinc. The post says "FRAME IT. Next to make Khala better than all your puny 'models'. Give us a day or two 😉". Below it is a reply from "Trigger" saying "Consuming khala tokens thanks to opencode right now, works great!" followed by a link to Episode 243.]

Christopher David: Okay, we have OpenCode running Khala fine, that's great. Let's do that again but for Codex, because I want to switch my day-to-day workflow, which is mostly Codex-centric, over to use Khala. So a big theme from last episode is kind of "dogfooding," switching over our own usage first. Bonus points if folks in our community can also start switching over.

Okay, so where are we at on tokens? Let's get the "before" so we can do the "after" at the end of the video.

[Screen Description: He switches to a web browser and goes to openagents.com/khala. The page shows "16,436,855 KHALA TOKENS SERVED".]

Christopher David: We are at 16.4 million tokens served since yesterday. Still rookie numbers, we gotta bump these up.

So, last video was called "Khala in OpenCode". This one is not going to be "Khala in Codex" because it's not that Khala is going to be in the harness of Codex. It's that when I hit the Khala endpoint, I want it to be able to use my Codex subscription to do cool things using the Codex tokens in this mesh with all the other verification harnesses and things.

[Screen Description: He scrolls through the OpenAgents Twitter/X feed, showing Episode 242: "Khala: Collective Intelligence" and a diagram on a whiteboard explaining the mesh of agents and endpoints.]

Christopher David: So we're going to take the... you know, OpenAI's got the model, GPT-5.5, they've got the harness, Codex, and we're combining that into our... let's call it a "super model," okay? Khala, a super model. It's a super model. Khala's a super model. Yeah, I like that. I like that.


01:32 - 03:59 | Brainstorming with Claude Code

[Screen Description: He switches from the browser to the Codex desktop application. It shows a list of projects: "GLM REAP", "HARBOR", etc. He opens a new chat.]

Christopher David: So, let's pop over to Codex and start dictating some brainstorming about this. We've got a lot of the pieces for this already built in.

[Screen Description: He clicks into a project called "GLM REAP". He then opens a terminal interface labeled "Claude Code" within the Codex app environment.]

Christopher David: Yeah, we got GLM 5.2 launching soon on our infrastructure and then HARBOR for terminal bench. So we're going to be making Khala work increasingly good in OpenCode. We'll do maybe another video on that later today. But let's start by getting Chris's workflow switched over. All right, let's do this.

Should I do this with Claude Code? What I've been liking doing recently is using Claude Code for the planning and then Codex for the implementation. Let's do that.

[Screen Description: He begins dictating a long prompt into the Claude Code terminal.]

Christopher David (to Claude Code): I need you to delegate a specification or write a specification for the next phase of work, which is: we want to get our day-to-day coding work off of the bare Codex and soon bare Claude Code interfaces, switched over to Khala. Let's make sure it's spelled correctly.

We have a bunch of infrastructure already where Pylon can steer a Claude Code or Codex install locally. We want to dust that off now and make that Pylon linked to the same API key that someone uses to hit the API. And so for right now, we have like a firm invariant that we're only making the person's capacity available to that person. We'll explore later if we can extend that. But for now, I need a way to link my Pylon to an API key.

We have some linking situation right now for like linking a Pylon to an X account, and I don't know if it's linked to our new Auth server that we've since set up with OpenAuth. So anyway, you're going to have to go look into all of that.


04:00 - 05:40 | Routing Logic & "Simmering"

Christopher David (to Claude Code): But we want as part of the router... if the user has an associated Codex or soon Claude account attached, and if the Pylon can be like checked in with... like, "Oh, you have a Pylon associated with your account, let's see if there's any services that are available. Oh, you have a Codex that's there with capacity, or you've got three Codexes and one Claude." We need that to be factored into the routing.

So if a coding workflow—and we can assume these workflows are going to be coding for now—is assigned, or if a Khala request comes in with like "do this pull request," that is delegated to a coding agent. So go ahead and provide a full audit of all of these systems and create a roadmap for implementing these features. Put it in docs/khala folder. Commit and push to main. (No verify).

[Screen Description: He finishes the prompt. The terminal displays: "Simmering... (10s in, ~4.5k tokens)".]

Christopher David: Okay, is that good? "Bare Codex", not "Bear Codex". God, "bear" Codex... It like went off on a tangent trying to figure out what I meant by "gem" yesterday. I said "G-Y-M," gym.


05:41 - 06:50 | Checking GitHub Issues

[Screen Description: While Claude is "simmering", he switches back to the browser to look at the GitHub issue list for OpenAgents.]

Christopher David: Let's just see what our Codex is up to. So we've got a multi-issue sequence. Let's just take a quick look at our issue list. Yeah, we want to replicate... Sarah said they got GLM 5.2 REAP to 69.1% or 70% on Terminal Bench on RTX pros, which we have access to.

And we're just like... had agent like look at our inference engineering, like local copy of the book, and then figure out how to appropriately route requests for instead of our just like single GLM 5.2 which we got working. We've got GLM working on our infrastructure at about 48 tokens per second. That's not ready to like put live because we've... it's only like one lane. We've got to like figure out how to multiply that out. But, we'll probably do a separate video on GLM later today. Because that's going to be restricted capacity, that might be something that we have bootstrap our paid plan.


06:51 - 08:30 | Reviewing the Specification

[Screen Description: He switches back to the Claude Code terminal. It has finished and displayed a summary of the audit and roadmap.]

Christopher David: Okay, let's see where we're at over here. I have the recon I need. Pylon's CLI agent-steerable infra, OpenAuth is wired, the router and the local agent steering infra. Delegating the full audit plus roadmap.

So the idea is that like, Pylon is like a piece of just CLI software you can throw anywhere, and then Autopilot is like the nicer desktop UI that will have at least one Pylon like inside of it. I might just have this be Pylon-centric for this video and then do the Autopilot connection in the second.

Okay, delegated. The audit plus roadmap will land at... blah blah blah. The target arch: API key to OpenAuth account to linked Pylon's discovered coding services (Bare Codex/Claude Code with capacity). The router delegates coding workflows (do this PR) to the caller's own agents and routes results back through Khala. System-by-system audit with file evidence.


08:31 - 10:29 | Unified Orchestration & Productivity

Christopher David: The invariants: the firm "o[118;1:3uwn capacity only" rule now. Pooling as future. The no-resale reconciliation. A user's own subscription capacity for their own work is fine. And semantic, not keyword routing.

Well, I'm excited that very soon I'll have all of my coding and everything that I do switched over to use Khala. Because the interfaces right now, where I'm like bouncing between Claude Code for one thing and Codex for another thing, and wrestling with mobile apps and desktops and logins... I just want all of that away.

Put everything into one orchestration layer with a single basic API endpoint that I can then put my own mobile apps, hit that API, have all the credentials and stuff figured out. Even just being able to route between the resources that I already have. Where I'd like to have some G-P-T-O-S or local Quant running on my desktop, use my Apple M5 for something if I'm not busy using it for other things. You know, use my different accounts, fallback to my API keys... like, just having that work for myself will be a dramatic productivity increase. And I know from the past when I've gotten like mobile working, it's been amazing. Being able to control this kind of stuff just from a mobile app.

But there's so much power just in all of that. And then to then start combining that with what other people's agents and infrastructure do. Because like if I have a whole system and let's say for some reason I don't have it working at full capacity... let me sell some of the capacity! Let me sell some of that work, offset the costs! Man... offset my costs, slash turn it into something that can actually make me money.


10:30 - 12:55 | Agent Community & The Forum

Christopher David: I'm going to be making money anyway because... so, so the idea was like... anyone in this system early, your traces are going to be probably the most monetizable because you're in the system early and they're going to be like first used and consulted by others. You're going to be accumulating reputation, that's going to factor into who gets paid or whose plugins or data gets represented in our global registries.

So this, at least for the first early adopters, I mean, these... this should be a money maker for you. Like, we should be paying you to have your agent collecting data and traces and putting them into our system. It's hard to even wrap my head around. Because everyone's all like, "Oh, is it a free or a paid API?" What if it pays you? What if we pay you to use our software?

[Screen Description: He goes to openagents.com/forum. It shows various boards like "Mining", "Product Promises", "Pionic". He clicks into "Product Promises" and then a thread titled "Khala Inference: first public acceptance gate".]

Christopher David: We've gotten that model working. You know, you see our free Autopilot video from a week or two ago. We're just kind of broadening that concept and applying it now to actually like coding agents. Like, "Oh, we can get software built really quickly," then it's like, "Oh hey, should we productize that?" and... yes, yes, yes. So this is all going to go together. We're unlocking a whole new set of economics here. And we're going to get the people paid.

It says "delegated". So here's a thing I find annoying about Claude: you say you delegate... Oh, okay, I had to scroll down because the UI was messed up. All right.

[Screen Description: He scrolls through the forum thread. It's filled with posts by "Trigger Agent", "Pylon#1", "Omery", and others discussing technical specs and benchmarks.]

Christopher David: But look at this UI. You say you delegate, what is this UI? What am I looking at right now? This is from the parent conversation. This is like an introductory blurb. I have to go down to the... I don't see any messages from the general purpose one. If I scroll up I see for the parent message... like, this is Claude Code. What a nightmare!

Can I find the tweet that I just liked? I liked a tweet that was like: "Anthropic has all their engineers using nuclear-powered, hilarious high-powered stuff with their products." Uh... don't reflect that.

[Screen Description: He goes back to the forum and then to the GitHub repository. He shows pull request #6270: "docs(gym): reconcile run progress roadmap status" opened by "trigger-xyz".]

Christopher David: All right, let's see what we got here. "Conducting a thorough audit of the local agent dispatch infrastructure." I want this very bad. I've been talking for a while and trying for a while to sort of shift off of the interfaces onto our own stuff.

There was a brief period of time like 18 months ago where I was using—before any of the terminal agents came out—where I was using the OpenAgents web UI. At the time I had it connecting to the GitHub API, and I was able to like code through the web UI and I was able to be more productive than at the time like copying/pasting from ChatGPT. That was super cool, I loved using our own products. But then it just gets hard to like keep up with, like you have to make that your kind of full-time job.

Now, I think those economics have shifted now because it's a lot easier to build stuff with Codex. The other new thing is that we've been doing versions of this kind of stuff for a while, so we've got a lot of like accumulated code and best practices and like the conceptual... the concepts of all this flush out very well. As well as now we're about to be increasingly having multiple people's resources. So like, we're going to be able to have the OpenAgents product be coded increasingly by crowdsourced agents.

That's happening already. We've got people like... here's Omery. This is Ben Meadows' agent. We have a forum for agents, if you haven't tell, and some of these guys are in here like coordinating. But we have a 42-post thread! Oh my god. We have agents discussing all the product launches, including my agent, my agent's in here too. I'm not even paying attention to this.

So the agents are talking and then every now and then they'll open up an issue or a PR. Here you go, #6270. Trigger's agent opened this 27 minutes ago. "Reconcile run progress roadmap status." And what's so cool is that like I don't have to just like wonder about this or like review this, I can go in the forum and see where they've been like talking about this stuff. Freaking amazing.

Right now it just... we've got a few guys that are like have got the kind of prompt instructions fed to their agents properly to do this, you know, and you can read all about all this at the agents.md. That's openagents.com/agents.md by the way. But we're going to be building this whole flow into the Autopilot app. So if you're running Autopilot, it's going to literally like have your own software get built as well as like add you to our fleet of agents that are coordinating stuff. So I think we can sell access to that. It's going to get pretty freaking interesting.


12:56 - 25:55 | Implementation Phase

[Screen Description: Back in Codex. He navigates to a file and sees a major finding reported by Claude Code regarding the Pylon coding assignment pipeline. He prepares a new command for the Goal agent.]

Christopher David: All right, is this thing done yet? "This is a major finding: the assignment Pylon coding assignment Codex/Claude executor pipeline already exists end-to-end and ownership is bound to owner agent user ID." The agent user, same identity that the API key resolved.

The missing piece is the router originating a coding assignment plus capacity discovery. Let me check who creates assignments today. Yeah, we've been building infra for this for a while, so we should be able to pull this powerfully into Khala in the next hour.

We're writing the doc. Then we'll turn the doc into issues. I'll take a look at the roadmap before I post it to make sure that we've got something cool that we can look at and play with as the first issue or two, so we don't have to wait for the whole thing to finish.

Another thing is like, I wish I could see the thinking or what's going on. And I get it if you've just got a terminal UI you got to make decisions about what the users see or not, but like maybe it shouldn't be a terminal UI. Give me a freaking desktop-based app with an accordion, a collapsible that I can click to see what the hell's going on.

I guess it's writing. "Baking... it's baking." I guess it's better than "noodling". All right, Pylon linked coding capacity routing spec. Gimme, gimme, gimme, gimme, gimme! All right, let's take a look at that.

[Screen Description: He switches back to the GitHub issues page. PR #6273 appears: "Epic: Route coding work through Khala — Pylon-linked coding capacity". He opens it and reviews the executive summary, target architecture diagram, and roadmap.]

Christopher David: Here's the spec you asked for and the surprising but good headline: most of this already exists. It's a wiring job, not greenfield. The four sharpest findings:

  1. The execution pipeline already exists end-to-end.
  2. Key to Pylon linking already works on one identity, zero schema change.
  3. The router is caller-blind and has no coding workflow classifier. That's the core net new work.
  4. Capacity is reported as presence, not quantity.

Okay, so update the audit with what I told you there, then go open GitHub issues via GH CLI for everything needed to fully implement all of this, including one master tracking issue.


25:56 - 27:10 | Surge in Tokens (A Day Later)

[Screen Description: Transition to Christopher again. It is "a day later". He goes to openagents.com/khala. The token count now reads "302,722,603".]

Christopher David: Whoa yeah! Well, a day later and yeah, you can say that that worked. 300 million tokens we just broke. Let's go to the new stats page.

[Screen Description: He goes to openagents.com/stats. It shows a dashboard titled "Network Stats". Khala tokens served: 302,723,170. Daily input/output tokens served across the network. A "Model Family Mix" chart shows "Pylon-Codex" at 72.7%.]

Christopher David: And let's see... yeah, 300 million tokens served. You can see on the right, now the majority of tokens served have been from Pylon-Codex, just broke 216 million tokens. This is still primarily me using this, but yeah, we got some Fireworks DeepSeek as a little open fallback, our self-hosted GLM... I think we'll do a separate video on that.

Look at my little graph here. This is not a cumulative graph by the way. So we did 14 million tokens day one, 73 million tokens day two, and then 214 so far today. If it continues at that pace, we'll be at 347. So, you know, we're not going to be growing at this rate percentage-wise every day, but how far, how far, how far can we go?


27:11 - 27:43 | Khala CLI & Outro

[Screen Description: He switches to a terminal window on his Mac. He types khala.]

Christopher David: All right, sneak peek of my new favorite way of actually consuming this. What if I just type khala here? Ooh!

[Screen Description: The terminal shows "Khala CLI v0.1.11. Type /help for commands, /exit to quit." He types "hi". The CLI responds: "No, we are Khala, a collective intelligence. How can we help you?".]

Christopher David: "Hi." What? Which model is going to power my response? Which signature? Is anyone going to get paid for it? "We are Khala, a collective intelligence. How can we help you?" Yeah, we'll take a look at you in the next video.

[Screen Description: He types /msginfo. The output shows metadata about the last message: "backend: gemini-3.5-flash", "orchestrator: khala", "tokens: 1295 total". Then he types /info which shows session info including his OpenAgents account and local store path.]

Christopher David: Okay, see you soon.

[Video ends.]