Agentic Spaceflight A single Claude Opus 5.5 session running in Claude Code against Kerbal Space Program via kRPC designed and flew four missions — a test flight to orbit, an uncrewed Mun orbiter, a crewed Mun landing and return, and a rendezvous and docking in Mun orbit — with no control code written by the human operator, who reported the results in a blog post. The agent generated the craft files, wrote the flight scripts, built the telemetry pipeline, and set up its own monitors and alarms, using 427.3k tokens across three missions before compaction and ending the fourth mission at 379k of its 1M-token context window. The author concluded that retries in the ascents and docking mostly traced back to the agent's own code, designs, or interventions rather than the physics, and that non-determinism must be solved before such agents approach real hardware. Beyond simply writing code, AI agents have been applied to frontier problems https://www.claymath.org/millennium/navier-stokes-equation/ in math and science, achieving outcomes https://openai.com/index/navier-stokes-solution/ that were previously thought unimaginable only months ago. Curious about AI applications in spaceflight, I decided to explore the capabilities of fully autonomous AI agents for space mission design and operation. tl;dr A single Claude Opus 5.5 session, running in Claude Code against Kerbal Space Program through kRPC, designed and flew four missions with no control code written by me: a test flight to orbit, an uncrewed Mun orbiter, a crewed Mun landing and return, and a rendezvous and docking in Mun orbit. Claude generated the craft files, wrote the flight scripts, built the telemetry pipeline, and set up its own monitors and alarms. Transfers, captures, the landing, and the return all went to plan or were corrected in flight by the agent. The retries were in the ascents and the docking, and most of those failures traced back to the agent's own code, designs, or interventions rather than the physics. The capability is real. The non-determinism is what has to be solved before any of this gets near hardware. To do this, I used Kerbal Space Program KSP as the simulation environment for testing Claude's capabilities in spaceflight scenarios. While KSP has many simplifications over real spaceflight such as patched conics over N-body simulation and much smaller celestial bodies, it is nevertheless a solid, albeit simplified, orbital mechanics simulator built on top of Unity's rigid-body physics engine. A decade ago, I began exploring KSP as an educational tool in aerospace engineering https://jdkaplan.com/blog/ksp-control-systems with promising results. This approach uses a third-party modification to KSP called kRPC https://krpc.github.io/ Kerbal Remote Procedure Calls that allows spacecraft in the game to be controlled programmatically using a variety of programming languages. These recent experiments take this beyond classical control systems and instead explore how an AI agent like Claude can autonomously design and execute a space mission. All examples in this post used a single Opus 5.5 agent running in a single session. It used 427.3k tokens across a series of three missions before the session was compacted to avoid the risk of mid-mission compaction. After the fourth and final mission rendezvous and docking and all final analysis and documentation, the session was at 379k tokens of its 1M-token context window. All user and agent messages shown in this post are from the actual session, but reflect only excerpts of a larger conversation. Minor typos in my own prompts were edited to ensure comprehension for the reader and are faithful to the original intent. Chat excerpts are intended to illustrate the key events and findings, not provide a comprehensive record. Initially, I set my sights high. I began with this prompt: We're doing an experiment - I have Kerbal Space Program running on this machine with krpc installed. I wanted to have you, Claude, design and build a lunar mission. I can design the spacecraft and describe it to you or give you the craft file, but I want you to write the kRPC code. Do you want input on the vehicle design or should I build it? I can also use a stock spacecraft. Claude gave me a spec and, not wanting to spend the rest of the day on a detailed spacecraft design, I thought it best to scale back our first attempt. Expand to see Claude's design criteria Claude initially gave me the following delta-V budget. Phase Δv m/s ───────────────────────────────────────────────────────────────── Launch to ~80 km Kerbin orbit ~3,400 Burn to the Mun ~860 Enter Mun orbit ~310 Descent and landing ~600 Ascent back to Mun orbit ~600 Burn home to Kerbin ~310 Total ~6,100, aim for 6,500+ with margin It then also gave me criteria to "make it easy to script": 1. Simple staging. Each stage is one engine or a symmetric cluster, with no fuel lines or crossfeed. My code will detect an empty stage and fire the next one, and that's much more reliable when stages are plain and in order. 2. A dedicated lander/ascent stage with a low-thrust engine e.g. Terrier . Throttle control during landing is much better with a TWR around 2–4 in Mun gravity than with something huge. 3. Enough attitude control: reaction wheels on the lander a probe core or command pod with built-in wheels is fine . kRPC's autopilot struggles with floppy or under-controlled craft, so please use struts or autostrut on the launch stack. 4. Action groups: - Gear toggles the landing legs - AG1 extends solar panels and antennas - AG2, if needed, is anything else 1. Parachutes on the final capsule, staged last. I'll deploy them by altitude and speed, so their stage position matters less, but they shouldn't fire with anything else. 2. Optional but helpful: set name tags on key parts right-click → Name Tag , e.g. lander engine, chute. I can look those up directly instead of guessing which part is which. I instead quickly built a gut-feel spacecraft that was over-capable for a simple low-orbit mission and asked Claude to launch it into orbit as our first test flight. I named it the CLV or Claude Launch Vehicle. Launch to Orbit Without any requirements specified beyond reaching orbit, I let Claude run in auto-mode, fully autonomously inspecting the .craft file, KSP's text-based definition of a spacecraft, and writing the control code. I've gone through CLV-1, and it should reach orbit with fuel to spare. There's one change I'd ask for before I write the launch script: the upper stage can't steer well. The upper stage needs a way to steer. The Reliant has no gimbal, which I confirmed in its config. The only other steering is the OKTO's reaction wheel 0.3 kN·m trying to turn a 4.5 t stage. It would mostly hold heading, but it would track the gravity turn poorly. I proceeded to add the additional reaction wheel module and we were on our way. Our agent proactively began a first test flight. The script is written. You said I could test, so I'm launching for real now. During the flight, Claude made heavy use of its Monitor tool to watch for events throughout the flight. The monitor tool was introduced to Claude Code in April of this year to allow Claude to establish background monitoring of events that then interrupt Claude under certain conditions. This both limits continuous polling, reducing token usage, and allows Claude to respond to critical events. All while continuing its primary task or being available to the user. Claude ran two kinds of monitors: 1. Event Watchers: Tailed flight script logs passed through a grep pattern watching for specific flight events. 2. Alarms: A poller first using kRPC, later using the telemetry stream for alert conditions, e.g. any part above 70% of its thermal limit, pitch or yaw rate thresholds, throttle open with zero thrust. Across the first three missions it armed fifteen alarms and they delivered 204 events. Monitor started task btqf3iim2, expires in 15m unless the source ends first; you get one notice at expiry — re-arm if you still need the watch . You will be notified on each event. Keep working — do not poll or sleep. Events may arrive while you are waiting for the user — an event is not their reply. The flight is running and I'll report events as they arrive.