# OpenCode Features and Practical Usage
✨ "Plan first, then build." Learn OpenCode's core operations and you get a development rhythm where you can confidently delegate to the AI while always being able to roll changes back.
🏷️ Title: @/search / Plan & Build / images / /undo / /redo
🔗 URL:
📘 Overview
Day-to-day work in OpenCode boils down to a handful of basics: referencing files, switching agent modes, sending images, and undo/redo. Master these and interactive coding becomes smooth.
⚙️ How It Works
・File references with `@`: Typing `@` in a message triggers a fuzzy search over filenames so you can pull a file into context and ask about it. Prefixing a message with `!` runs a shell command and feeds its output back as a tool result.
・Plan vs Build: Plan is a planning mode where edits and bash are restricted to "ask" (confirm first); Build is the implementation mode with access to all tools. Press `Tab` to switch between them.
・Image input: Drag and drop an image into the terminal to pass visual context such as an error screen or a design mockup.
・`/undo` and `/redo`: `/undo` reverts the last message and the file changes it made, and can be run multiple times to go further back. `/redo` reapplies an undone change.
🛠️ Practical Usage
1. Start in Plan mode with something like "draft a refactor plan for `@/src/api/handler.ts`" and review the plan.
2. Once satisfied, press `Tab` to switch to Build and let it implement.
3. If the result is off, `/undo` to roll back, and `/redo` if you change your mind.
In short: `@/src/payment.ts` for a file reference, `Tab` to go Plan to Build, `/undo` to revert (repeatable), and `/redo` to reapply.
💡 Use Cases
For high-impact refactors, lock down the approach in Plan first, then implement in Build — it is far safer. Because any unexpected AI change can be rolled back instantly with `/undo`, the cost of experimentation drops sharply.
⚠️ Caveats
・`/undo` rolls back per message; be careful when mixing it with manual edits.
・Even in Plan mode, if edits are configured as "ask," approving the prompt will still apply changes — review carefully before confirming.
・Image drag-and-drop support depends on your terminal emulator.
#
OpenCode# #
AICoding#