← Back to blog

Resilient Autonomous Mode: Episodic Execution with Session Recovery

AgenticKode now supports episodic execution — bounded agent episodes with git checkpoints, automatic session recovery, stall detection, and budget controls for truly unattended autonomous coding.

By AgenticKode Team

Resilient Autonomous Mode

Autonomous mode has been available in AgenticKode since launch — give the agent a task, it writes code, runs tests, and opens a PR. But what happens when a session crashes at 2 AM? When the agent hits its context limit mid-task? When the server restarts?

Before today: the task times out and fails. You restart it manually.

Now: the task recovers automatically and continues where it left off.

What Changed

We rebuilt the autonomous execution engine around episodic execution — inspired by patterns from OpenClaw and NemoClaw.

Bounded Episodes

Instead of one long agent session, tasks execute in bounded episodes:

  1. Agent works for up to 30 turns (configurable)
  2. All work is committed as a git checkpoint
  3. Context is compacted into a summary
  4. Next episode picks up with the summary

This means a complex task that would exhaust Claude's context window in a single session can now run across multiple episodes — each with fresh context but full awareness of what was accomplished.

Automatic Session Recovery

If anything goes wrong — SSH disconnects, process crashes, server restarts — the worker engine:

  1. Detects the interrupted run on startup
  2. Finds the last git checkpoint
  3. Builds a context summary from the episode log
  4. Launches a new episode that continues the work

No manual intervention. The task just keeps going.

Stall Detection

If an agent gets stuck (no output for 10 minutes), the platform:

  1. Detects the stall via stream-json monitoring
  2. Kills the stuck process
  3. Starts a fresh episode with context from the stalled one

Budget Controls

Per-project policies prevent runaway costs:

  • Maximum budget in USD
  • Maximum episodes per task
  • Maximum turns per episode
  • Maximum total duration
  • Maximum files changed

When any limit is hit, the agent stops and the run is marked accordingly.

Real-Time Monitoring

The new Episode Timeline on the run detail page shows:

  • Each episode with its status (running, completed, stalled, recovered)
  • Turn count and token usage per episode
  • Context window usage meter (warns at 80%, critical at 90%)
  • Git checkpoint SHAs
  • Live SSE stream of agent activity

You can also send messages to redirect a running agent, pause it, or resume from the UI.

How to Enable

Add episode_config to your project's autonomy configuration:

{
  "execution_mode": "autonomous",
  "episode_config": {
    "max_episodes": 5,
    "max_turns_per_episode": 30,
    "stall_timeout_seconds": 600
  }
}

Without episode_config, the existing single-session behavior is unchanged — zero breaking changes.

What's Next: Conversational Agent

We're building a conversational AI manager — a built-in chat interface where you talk to an agent that controls the entire platform. Think OpenClaw, but for your coding automation:

  • "Fix the login bug in project X" — agent creates a task run, monitors it, reports back
  • "Run tests on all active projects" — agent orchestrates multiple runs in parallel
  • "Add my new server at 10.0.1.50" — agent configures the server and runs setup

The agent connects to the platform via an MCP server, so any external CLI tool (Claude Code, OpenCode, Gemini) can also control the platform remotely. More on this soon.

Try It

Upgrade to the latest version and read the autonomous mode guide to get started.