Cached at:
10/14/26, 06:31 PM
# OpenCode 2.0
Source: [https://anoma.ly/notes/opencode-2-0/](https://anoma.ly/notes/opencode-2-0/)
OpenCode2\.0isamajoroverhaul\.Itdrawsonmillionsofdailyusers'experiencetodeliverasystemthatcanflextoeverythinganagentneedstobe\.Therearequitealotofnewfeatures,performanceimprovements,andbugfixesbutherearesomeofthemoreimpactfuluser\-facingchanges\.
## The Service
FromthebeginningOpenCodeadoptedaclient/servermodel\.However,thiswasnotsomethingittookadvantageofbydefaultandwasmostlyusedbypowerusers\.
In2\.0thisservernowautomaticallyrunsasasinglebackgroundprocessonyourmachine\.WhenyouopenupaTUI,thewebinterfaceorthedesktopappthey'realltalkingtothesamecentralprocess\.
opencodepid48213Running
Sessions
Ifyou'reusingtheprogrammaticclient`@opencode/client`tomakeyourownscripts,theywillautodiscoverthelocalserviceandjustwork\.Thisisparticularlyusefulforscheduledtasks\.YoucanalsocallitviaCLIbyusing`opencode``api`commands\.
Youcanexposeittootherhostsandrun`/pair`or`opencode``pair`toconnectittootherapplications\.Wehavenativeappsintheworksthattakeadvantageofthisflow\.
## The API
TheoldAPIgrewhaphazardlyasweandtheworldcollectivelylearnedwhatagentsareandshouldbe\.Itwasbad\.
WestartedfromscratchandexaminedalltheweirdusecasesacrossthemillionsofuserswhouseOpenCodeeveryday\.Itnowsupportsnearlyanythingyouneedtobeabletodo\.
OpenCodeisalsoawareofitsownAPIandwillcallittodousefulthingslikemovingthecurrentsessionintoagitworktreewhenstartingnewwork\.
SessionNew session
OpenCode
Fix flaky upload testinterrupted
Migrate config loadertab closed
We'vealsoshippedanewclientpackage`@opencode/client`thatcontainsclientsforvanillaJavaScriptaswellasEffect\.
review\.ts```
import { OpenCode } from "@opencode/client"
import { Service } from "@opencode/client/service"
const endpoint = await Service.ensure()
const client = OpenCode.make({
baseUrl: endpoint.url,
headers: Service.headers(endpoint),
})
const session = await client.session.create({
location: { directory: process.cwd() },
})
await client.session.prompt({
sessionID: session.id,
text: "Review the current changes",
})
```
## Code Mode
ThemodelslovetowritecodeandOpenCode2\.0takesadvantageofthatmorethananyothercodingagent\.We'vebuiltaminimalJavaScriptinterpreterinthe`@opencode/codemode`package\.
Session
Code Mode
MCP servers
ThispackageingestsMCPserversorOpenAPIendpoints,convertingthemintofunctionsthattheagentcancallinascript\.ItcanrunthesescriptsnativelywithoutthecomplexityofNode\.jsVMsorembeddingcomplicatedsolutionslikeQuickJS\.
Thisletsyouragentwritescriptsthatcandothingslikecallatool,mapovertheresultsandcallanothertool\.Singleroundtripinsteadofcallingthemoneatatime\.
AllMCPserversin2\.0areoptedintocodemodebydefault\.Thismeansyoucanaddathousandofthemwithminimalcontextbloatandyouragentwilldiscoverandcomposethemtogetthingsdone\.
## Background Tasks
Thelatestbatchofmodelsareincrediblygoodatorchestrationanditisimportantforharnessestoletthemexpressthefullextentofthatcapability\.
First,we'veaddedbackgroundsubagents\.Thisallowstheprimaryagenttokickoffsomeworktoanotheronewhileitcontinues\.
Thishappensautomaticallybutyoucanalsotriggeritmanually\-evenwithadifferentmodel\.Itletsyoudothingslike“spawnabackgroundfablesubagenttoreviewthiscode”whileyoukeepprompting\.
Second,we'veaddedbackgroundshellcommands\.Theshelltoolcanbeinvokedasynchronouslysolong\-runningworkdoesnothavetoblocktheprimaryagent\.It'llbenotifiedwhenthingsarecomplete\.
Ifanyforegroundshellcommandorsubagenttakeslongerthanyouexpect,youcanhitahotkeytomovethemtothebackgroundsoyoucankeepprompting\.
## Plugins
AlthoughOpenCode1\.0hadapluginsystem,itnevergottheattentionitneeded\.Tocorrectthat,weforcedourselvestoimplementnearlyeveryOpenCode2\.0featureasaninternalpluginandtherearenow80\+ofthem\.ThisguaranteesthatthePluginAPIstayswellmaintained\.
We'vealsopromotedTUIpluginsfromexperimentaltostable\.SinceitisallpoweredbyOpenTUI,youcanbuildnearlyanything\.Hereisanexampleofsomethinguseless\.
WealsospentquitealotoftimeensuringeverythinginOpenCode2\.0canbehot\-reloaded\.Soitcanwriteapluginforitselfmid\-sessionanduseitrightaway\-wecoveredthedesignofthisina[previous blogpost](https://anoma.ly/notes/opencode-reloaded)\.
YoucanaskOpenCodetobuildwhateverpluginyouwantanditknowshowto\.Butifyoudowanttoreadthedocs,theyareavailable[here](https://opencode.ai/v2/docs/build/plugins)\.
## The SDK
OpenCodecanalsonowbeusedasalibrarywiththe`@opencode/sdk`package\.ThisistheexactsamecodethatpowersourCLI\.
ThismeansyoucanstripitdownandmakeyourownflavorofOpenCodethatrunsonaserverorinspecializedenvironmentslikeDurableObjects\.AndthenyoucanconnecttoitfromanyOpenCodeclientsinceitspeaksthestandardOpenCodeserverprotocol\.
ItalsohasanoptionalEffect\-basedAPI\.
Thisoneisstillindevelopmentasthingsareshiftingbutyoucan[already use it](https://opencode.ai/v2/docs/build/sdk)\.
## Upgrading
ToupgradetheCLI,makesureyou'reonthelatest1\.xrelease,thenrun`opencode``upgrade``\-\-major`\.
Toupgradeyourdesktopapp,downloadthelatest[here](https://opencode.ai/download)\.
Therearesomebreakingchanges\.
1\.0pluginswillnotworkin2\.0
ServerAPIiscompletelydifferent
tui\.jsonconfigismovedtojson
Therearealotofotherchangesbuttheyarebackwardscompatible\.ItisworthpointingOpenCodeat[this doc](https://opencode.ai/v2/docs/migrate-v1/)soitcanmigratethingsforyou\.