| layout | default |
|---|---|
| title | Chapter 6: Timeline, Checkpoints, and Recovery |
| nav_order | 6 |
| parent | Opcode Tutorial |
Welcome to Chapter 6: Timeline, Checkpoints, and Recovery. In this part of Opcode Tutorial: GUI Command Center for Claude Code Workflows, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter focuses on versioned session control and rollback safety.
- use checkpoints to protect long-running sessions
- restore and fork from prior states quickly
- inspect diffs between checkpoints
- design safer experimentation workflows
| Pattern | When to Use |
|---|---|
| checkpoint before big prompt | any high-impact refactor/design change |
| branch from checkpoint | exploring alternative implementations |
| restore previous state | output drift or regressions |
You now know how to use checkpointing as a first-class safety primitive in Opcode.
Next: Chapter 7: Development Workflow and Build from Source
The ApiResponse interface in src-tauri/src/web_server.rs handles a key part of this chapter's functionality:
#[derive(Serialize)]
pub struct ApiResponse<T> {
pub success: bool,
pub data: Option<T>,
pub error: Option<String>,
}
impl<T> ApiResponse<T> {
pub fn success(data: T) -> Self {
Self {
success: true,
data: Some(data),
error: None,
}
}
pub fn error(error: String) -> Self {
Self {
success: false,
data: None,
error: Some(error),
}
}
}
/// Serve the React frontend
async fn serve_frontend() -> Html<&'static str> {
Html(include_str!("../../dist/index.html"))
}
/// API endpoint to get projects (equivalent to Tauri command)
This interface is important because it defines how Opcode Tutorial: GUI Command Center for Claude Code Workflows implements the patterns covered in this chapter.
The AgentRunOutputViewer function in src/components/AgentRunOutputViewer.tsx handles a key part of this chapter's functionality:
import { useTabState } from '@/hooks/useTabState';
interface AgentRunOutputViewerProps {
/**
* The agent run ID to display
*/
agentRunId: string;
/**
* Tab ID for this agent run
*/
tabId: string;
/**
* Optional className for styling
*/
className?: string;
}
/**
* AgentRunOutputViewer - Modal component for viewing agent execution output
*
* @example
* <AgentRunOutputViewer
* run={agentRun}
* onClose={() => setSelectedRun(null)}
* />
*/
export function AgentRunOutputViewer({
agentRunId,
tabId,
className
}: AgentRunOutputViewerProps) {
const { updateTabTitle, updateTabStatus } = useTabState();This function is important because it defines how Opcode Tutorial: GUI Command Center for Claude Code Workflows implements the patterns covered in this chapter.
The AgentRunOutputViewerProps interface in src/components/AgentRunOutputViewer.tsx handles a key part of this chapter's functionality:
import { useTabState } from '@/hooks/useTabState';
interface AgentRunOutputViewerProps {
/**
* The agent run ID to display
*/
agentRunId: string;
/**
* Tab ID for this agent run
*/
tabId: string;
/**
* Optional className for styling
*/
className?: string;
}
/**
* AgentRunOutputViewer - Modal component for viewing agent execution output
*
* @example
* <AgentRunOutputViewer
* run={agentRun}
* onClose={() => setSelectedRun(null)}
* />
*/
export function AgentRunOutputViewer({
agentRunId,
tabId,
className
}: AgentRunOutputViewerProps) {
const { updateTabTitle, updateTabStatus } = useTabState();This interface is important because it defines how Opcode Tutorial: GUI Command Center for Claude Code Workflows implements the patterns covered in this chapter.
The SessionOutputViewer function in src/components/SessionOutputViewer.tsx handles a key part of this chapter's functionality:
import { ErrorBoundary } from './ErrorBoundary';
interface SessionOutputViewerProps {
session: AgentRun;
onClose: () => void;
className?: string;
}
// Use the same message interface as AgentExecution for consistency
export interface ClaudeStreamMessage {
type: "system" | "assistant" | "user" | "result";
subtype?: string;
message?: {
content?: any[];
usage?: {
input_tokens: number;
output_tokens: number;
};
};
usage?: {
input_tokens: number;
output_tokens: number;
};
[key: string]: any;
}
export function SessionOutputViewer({ session, onClose, className }: SessionOutputViewerProps) {
const [messages, setMessages] = useState<ClaudeStreamMessage[]>([]);
const [rawJsonlOutput, setRawJsonlOutput] = useState<string[]>([]);
const [loading, setLoading] = useState(false);
const [isFullscreen, setIsFullscreen] = useState(false);
const [refreshing, setRefreshing] = useState(false);This function is important because it defines how Opcode Tutorial: GUI Command Center for Claude Code Workflows implements the patterns covered in this chapter.
flowchart TD
A[ApiResponse]
B[AgentRunOutputViewer]
C[AgentRunOutputViewerProps]
D[SessionOutputViewer]
E[SessionOutputViewerProps]
A --> B
B --> C
C --> D
D --> E