T ThinkEdge Learn

Open Code and OpenCode: A Coding Agent You Can Read

A coding agent is the same loop as the robot loop, with the body swapped for a computer: read, decide, act, check the result. The version you can inspect and host yourself is opencode.

open code opencode ai coding agent open code ai
AI and Electronics · The coding agent loop, and the open source tool that runs it

What a coding agent is

It is the same loop as the robot loop, with the body swapped for a computer. Read the files, decide on a change, make the change, run the build or the tests, read the error output, change something else, and repeat. The difference from a chat assistant is that the agent can act on your project and verify its own work by running it.

That verification step is the whole value. A text assistant can tell you what a fix looks like, but it cannot tell you whether the fix compiled. An agent that runs the code gets a fact instead of an opinion, and the loop closes the same way a control loop closes. In a classroom this is the difference between a student reading generated code and a student testing it.

What opencode is, and why open source matters here

opencode is an open-source AI coding agent that runs in the terminal as a keyboard-driven interface, and it now also ships as a desktop app and an IDE extension. It is MIT licensed, developed by Anomaly, and deliberately model-agnostic: it connects to more than 75 model providers through Models.dev, including locally hosted models, so a school is not tied to one vendor's subscription or to one company's data policy.

For a school, the open-source part is the point. The tool itself can be read, audited and hosted by you, and the same agent works with a free model, a paid one, or a model running on a Raspberry Pi in the lab. It also has a plan mode, where the agent breaks a task into steps and waits for you to approve the plan before it touches a file, which is the difference between an agent you supervise and one you merely observe.

Step by step

  1. Install it in an empty folder

    Run the installer, start it in a directory with nothing in it, and ask it to list the files. Do not point it at your project on the first day.

  2. Give it one small task and read every diff

    Ask for one change to one file, then read the diff line by line. If you cannot explain every line, you are not reviewing the work, you are accepting it.

  3. Let it run the build

    Point it at the compile or upload command and watch it read the error output and try again. This is the step that makes an agent different from a chat window.

  4. Use the plan mode for anything bigger

    For work that spans several files, make it produce a plan first and approve or reject the plan before it writes any code.

  5. Point it at a local model

    Configure it to use a model running on a Raspberry Pi in your classroom and nothing leaves the building. You give up some quality and you gain privacy.

  6. Set the rules before you need them

    Work inside a git repository, review each diff before accepting it, and never let it push. The failure mode of coding agents is an overconfident edit, and a commit history is the cheapest insurance there is.

What you'll need

ItemQtyWhy
Laptop or desktop with 16 GB of RAM1Runs the agent, and the model too if you point it at a local one on the same machine.
Arduino Uno R31The target of the generated code, which is what stops the exercise being about text.
USB cable and breadboard1 setSo the code the agent writes is actually flashed and run, not just read on a screen.
HC-SR04 ultrasonic sensor1Gives the generated program something physical to do, with numbers you can check against reality.
Pushbutton and LED assortment1 kitThe simplest possible target for a first generated sketch that you can verify by eye.
Raspberry Pi 5 with 8 GB1Optional, for hosting a local model so that no student code or data leaves the lab.

Practise it before you build it

Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the LED on screen and the readings change when you change the wiring — no hardware, no burnt components.

Common questions

Is opencode free?

The tool is MIT licensed and costs nothing to install or run. The cost depends on the model you connect: opencode includes free models, a paid provider bills per token, and a local model on your own hardware costs only electricity. Open source also means you can read the code, which matters more in a school than the licence fee does.

Can an AI coding agent do my homework?

It can, and that is exactly why the interesting use is different. Ask it to explain the error you got, to write the test that catches a bug, or to review your code and tell you which line is wrong. That turns it into a tutor that never gets bored. Handing over the whole project turns it into a way of avoiding the practice, and your examiner can tell the difference from the code alone.

Is it safe to let a coding agent run commands on my computer?

Not without rules, because an agent that can run commands can delete files or rewrite your project. Keep the work in a git repository so every change is a diff you can read and undo, run it in a copy of the folder, and never give it credentials. The setup takes five minutes and removes almost all of the risk.

Related guides

What an AI Agent Actually IsAn AI agent is a loop of model calls, tools and memory. Learn how that loop maps onto the sense, decide, act cycle of a robot you can build this term. AI in the Classroom: What to Allow and What to StopAI in the classroom works when the policy is specific. Here is what AI genuinely helps with, the rules that keep it honest, and what a school should not upload. Artificial Intelligence for StudentsArtificial intelligence for students: what a model really is, the three ways to learn it that are not hype, and the projects that prove each one landed. Edge AI: Decisions Made on the DeviceEdge AI runs the decision on the device instead of in the cloud. Here is what that buys you in latency and privacy, and what a 32 KB microcontroller can really do. Local LLM: Your Own Model, Your Own MachineRun a language model on your own hardware: the RAM maths for a Raspberry Pi, the real token speeds, and how an Arduino can act on what the model says.

Try the full simulator with your class

103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.