Agent Mode is one of PorkiCoder's most powerful features — built on the official
@anthropic-ai/claude-agent-sdk. It gives Claude autonomous access to your
project filesystem, shell, and the web, while keeping you in control of every file write
through human-in-the-loop diff review. Agent Mode also runs on Gemini and
Kimi, not just Claude.
New in v1.14.0: Agent sessions now
persist across restarts; Gemini and Kimi agents accept image attachments;
you can set an optional per-run spend ceiling; Claude agents gain task
tracking and can ask you a clarifying question mid-run; long-running
commands stream their output live, and parallel tool calls group under one collapsible card.
How It Works
Agent Mode uses the Claude Agent SDK to run multi-step tool-use loops:
1. You describe the task — "Refactor the auth module", "Add dark mode", "Fix the failing test". Plain English.
2. The agent plans and acts — Claude autonomously calls tools: Read to understand files, Glob and Grep to search your codebase, Bash to run commands, WebSearch and WebFetch for documentation, and sub-Agent to delegate subtasks.
3. Diff review on every write — When the agent wants to edit or create a file, the change routes through a DiffReviewBridge into a Monaco Diff Editor modal. You see side-by-side diffs and accept or reject each change. Only approved writes are applied.
4. Adaptive thinking — Extended thinking is enabled with thinking deltas streamed live, so you can follow the agent's reasoning as it works through complex tasks.
5. Progress tracking — Toast-style progress cards show planning, tool calls, thinking, and completion events in real time.
Agent Tools
Read — Read any file in your project for context.
Glob — Find files by pattern (e.g., src/**/*.ts).
Grep — Search file contents with regex across your codebase.
Bash — Run shell commands: install packages, run tests, git operations, build steps.
WebSearch — Search the web for documentation, APIs, or error solutions.
WebFetch — Fetch content from URLs for context.
Sub-Agent — Spawn child agents to handle subtasks in parallel.
Edit / Write — File modifications routed through human-in-the-loop diff review.
Human-in-the-Loop Guarantees
Every file write from Agent Mode goes through a blocking async bridge. Only one diff review is shown at a time (serialized queue), with a 5-minute timeout to prevent stalls. The agent pauses until you approve — your codebase is never modified without your explicit consent.
Autopilot Mode NEW in v1.5.6
Trust the agent on routine work? Toggle the shield-check button in the chat header to enable Autopilot Mode. File writes and edits apply automatically without the diff preview modal — but every change still surfaces in the activity toast (with a ⚡ icon to distinguish autopilot writes from reviewed ones), so you stay informed without being interrupted. Your toggle persists across restarts. Works for both Claude Agent SDK and Gemini Agent.
Resumable Sessions
Agent sessions are persisted per thread ID. You can close PorkiCoder, reopen it, and resume a multi-step agent task exactly where you left off — no lost context, no repeated work.
Project Instructions (porki.md)
Drop a porki.md file in your project root and the agent will load it as persistent project-level instructions. Use it to describe your codebase conventions, architecture, key files, and preferences — the agent reads it before every task so it always has the right context.
Preview Error Auto-Send
When your Live Preview hits a runtime error, PorkiCoder automatically sends the error to the AI so it can diagnose and fix the issue — no more copy-pasting stack traces.
Pro Tip
Agent Mode works best when you give it clear, scoped tasks. For broad refactors, the agent will use sub-agents to parallelize work. You can also attach elements (images, files) directly into the chat for richer context alongside whatever the agent discovers on its own.