The Deska blog

Runbooks by Agent: Capture the 3am Knowledge

Learn how to use AI agents to automate runbook writing and maintenance during production incidents to preserve critical operational knowledge.

· 10 min read

Writing runbooks is often the last priority for a software engineer until a critical system failure occurs in the middle of the night. Effective runbook writing requires capturing the exact steps, context, and environment state needed to resolve an issue, yet these details are frequently lost in the heat of an incident. By leveraging AI agents to document processes as they happen, teams can transform chaotic troubleshooting sessions into structured, repeatable operational procedures.

Why Runbooks Fail in Production

Traditional runbooks often suffer from documentation rot. If a manual is written once and never updated, it becomes a liability rather than an asset. The hardware changes, dependencies are updated, and security protocols evolve, leaving the old instructions obsolete.

When a developer is paged at 3 a. m., they are rarely thinking about documentation. They are thinking about restoration of service. The commands they run, the logs they tail, and the temporary fixes they apply are often left in the terminal history. This creates a knowledge silo where only the person who fixed the bug knows how to fix it again.

The Cost of Missing Documentation

  1. Increased Mean Time to Recovery: Without clear steps, every engineer must rediscover the solution from scratch.
  2. Mental Fatigue: The stress of "flying blind" during an outage leads to burnout and human error.
  3. Onboarding Friction: New team members cannot help with on-call rotations because they lack the institutional context stored in senior engineers' heads.

The Role of AI Agents in Captured Knowledge

Modern AI agents like Claude Code or Codex CLI provide a new way to bridge the gap between action and documentation. Instead of writing a runbook after the fact, an agent can observe the session or even execute the commands under human supervision. Because these agents can read the current state of a repository and the output of a terminal, they are uniquely positioned to summarize what actually worked.

When using agents for this task, the goal is not to have the AI replace the engineer, but to act as a digital scribe. The agent can track which environment variables were checked, which database queries were executed, and which services were restarted. This creates a high-fidelity audit trail that can be converted into a markdown file with minimal effort.

Architecting an Agent Managed Workspace

To effectively capture this 3 a. m. knowledge, the workspace environment must be unified. If logs are in one window, code in another, and the terminal in a third, the context is fragmented.

Deska provides an infinite canvas where you can place terminals and code editors side by side. This visual layout is not just for organization; it allows the user to see the entire incident surface area at once. When running AI agents as panels within this space, the agent has more context about what the developer is trying to achieve.

Tool Comparison for Incident Management

ApproachDocumentation QualitySpeed of RecoveryContext Retention
Manual WikisHigh but often outdatedSlowLow
Console HistoryLow and messyFastMedium
Agent SessionsHigh and structuredFastHigh
Automated ScriptsHigh but rigidVery fastVariable

While manual wikis are great for high-level architecture, they differ in approach from agent-captured notes. The agent focuses on the "how" of a specific instance, which is often what is missing from general documentation.

Running Agents Side by Side

One powerful technique is running multiple agents simultaneously to verify a fix. Within the Deska workspace, you can open panels for different agents and compare their suggestions. This is particularly useful when troubleshooting complex distributed systems where one agent might focus on the infrastructure (Terraform or Kubernetes manifests) while another analyzes the application logs.

If you are away from your desk, the mobile app allows you to monitor these active sessions. This ensures that even if you have to step away, the agent can continue running long-running diagnostic tasks or health checks, reporting the results back to your phone through a secure relay.

Structured Recipes for Runbook Writing

To get the most out of an agent during an incident, follow a structured workflow. This ensures the output is useful for future use cases.

  • Define the scope: Use Ask Deska to open the relevant panels and set up the environment.
  • Execute with observation: Run your debugging commands. If you are using an agent panel, let it suggest the commands first.
  • Tag the success: Once the system is stable, ask the agent to summarize the last ten minutes of terminal output.
  • Export to a note: Move this summary into the notes notebook panel.
  • Refine: Add a title and search keywords to the note so it can be found in the future.

This process turns a frantic fix into a permanent asset. The local-first nature of the application ensures that these logs and notes stay on your machine, which is critical for security and compliance when handling sensitive production data.

Refining Agent Output

AI agents are excellent at generating text, but they require human oversight for technical accuracy. Always check the generated runbook for hardcoded values like specific pod names or timestamps that should be replaced with variables. A good runbook should be generalized enough to work during the next incident without major edits.

FAQ for Automated Runbooks

how to automate runbook updates with ai?

You can automate updates by feeding the agent your existing runbook and the recent logs from a successful recovery session. The agent identifies where the manual steps differ from the actual commands used and suggests a diff for the documentation.

can ai agents run terminal commands?

Yes, agents like Claude Code or Codex CLI can execute shell commands within a controlled environment. In a workspace like Deska, you can monitor these commands in real-time as they appear in the terminal panels, allowing you to stop or modify them if necessary.

where to store operational playbooks safely?

Playbooks should be stored in a version-controlled repository or a local-first application to ensure availability during network partitions. Storing them in the same workspace where you perform the work, such as within the data and storage of your local tool, provides the fastest access during a crisis.

Getting Started with Agent Workspaces

The transition from manual documentation to agent-assisted runbook writing does not happen overnight. It starts with having the right tools in place before the incident occurs. By setting up a unified workspace, you provide the context needed for AI to be effective.

You can begin organizing your operational knowledge today by trying the environment yourself. Download the app for your platform and start building your first persistent workspace for incident response.

💡 Ideas+🐛 BugsSuggest a feature or report a bug