[{"data":1,"prerenderedAt":861},["ShallowReactive",2],{"docs.index":3,"docs.page.\u002Fdocs\u002Fagents\u002Fhandbook\u002Fversions-and-conflicts":358},[4,20,26,33,43,52,59,65,71,76,82,89,95,100,104,111,115,119,123,132,137,141,147,152,157,163,170,177,183,189,193,199,205,211,217,222,226,230,236,242,247,252,256,260,265,271,277,283,287,294,299,305,310,314,318,322,328,333,338,343,347,353],{"path":5,"title":6,"navTitle":7,"seoTitle":8,"description":9,"type":10,"position":11,"updated":12,"release":13,"related":14,"plans":17},"\u002Fdocs\u002Faccount\u002Fbilling","Upgrade and manage billing","Billing",null,"Move a workspace onto Grove or Forest, understand how seats are charged, and what happens if a payment fails or you cancel.","how-to",2,"2026-09-29","public",[15,16],"\u002Fdocs\u002Faccount\u002Fplans-and-limits","\u002Fdocs\u002Fsharing\u002Finvite-people",[18,19],"grove","forest",{"path":21,"title":22,"navTitle":8,"seoTitle":8,"description":23,"type":24,"position":25,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Faccount","Account and billing","What each plan includes, how billing and seats work, managing your account, and how Treehouse keeps your files safe.","hub",7,{"path":15,"title":27,"navTitle":8,"seoTitle":8,"description":28,"type":29,"position":30,"updated":12,"release":13,"related":31,"plans":8},"Plans and limits","What Seedling, Grove and Forest include, how usage is counted, and what happens when a workspace reaches a limit.","reference",1,[5,16,32],"\u002Fdocs\u002Fsharing\u002Fshare-links",{"path":34,"title":35,"navTitle":8,"seoTitle":8,"description":36,"type":37,"position":38,"updated":12,"release":13,"related":39,"plans":8},"\u002Fdocs\u002Faccount\u002Fsecurity-and-privacy","Security and privacy","How Treehouse encrypts your files, who can see what in a workspace, and how keys, share links and HTML pages are kept in check.","concept",4,[40,32,41,42],"\u002Fdocs\u002Fagents\u002Fconnect\u002Fapi-keys","\u002Fdocs\u002Ffiles\u002Fprivate-files","\u002Fdocs\u002Ffiles\u002Fhtml-pages",{"path":44,"title":45,"navTitle":46,"seoTitle":8,"description":47,"type":10,"position":48,"updated":12,"release":13,"related":49,"plans":8},"\u002Fdocs\u002Faccount\u002Fyour-account","Manage your account","Your account","Create an account, sign in and out, reset a forgotten password, and move between the workspaces you belong to.",3,[50,51,34],"\u002Fdocs\u002Fget-started\u002Fquickstart","\u002Fdocs\u002Fsharing\u002Fcustomise-your-workspace",{"path":40,"title":53,"navTitle":54,"seoTitle":8,"description":55,"type":10,"position":38,"updated":12,"release":13,"related":56,"plans":8},"Manage API keys","API keys","Create a key for each agent, see which keys can reach your workspaces, and revoke the ones you no longer need.",[57,58,34],"\u002Fdocs\u002Fagents\u002Fconnect\u002Fclaude-code","\u002Fdocs\u002Fagents\u002Freference\u002Fauthentication",{"path":57,"title":60,"navTitle":8,"seoTitle":8,"description":61,"type":10,"position":11,"updated":12,"release":13,"related":62,"plans":8},"Connect Claude Code","Give Claude Code access to a workspace through your synced folder, the Treehouse MCP server, or both.",[63,40,64],"\u002Fdocs\u002Fagents\u002Fconnect\u002Fhow-agents-work","\u002Fdocs\u002Fplaybooks\u002Fwrite-your-agents-md",{"path":63,"title":66,"navTitle":67,"seoTitle":8,"description":68,"type":37,"position":30,"updated":12,"release":13,"related":69,"plans":8},"How agents work with Treehouse","How agents work","The two ways an agent can reach a workspace, what it can do there, and how its work shows up for everyone else.",[57,40,70],"\u002Fdocs\u002Fagents\u002Fhandbook",{"path":72,"title":73,"navTitle":74,"seoTitle":8,"description":75,"type":24,"position":30,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fagents\u002Fconnect","Connect an agent","Connect","Give Claude Code, Codex, Cursor or any other agent access to a workspace, with its own key when you want its work labelled.",{"path":77,"title":78,"navTitle":8,"seoTitle":8,"description":79,"type":10,"position":48,"updated":12,"release":13,"related":80,"plans":8},"\u002Fdocs\u002Fagents\u002Fconnect\u002Fother-agents","Connect other agents","Connection settings for Cursor, VS Code, Codex, Gemini CLI, Claude Desktop and any other MCP client.",[57,40,81],"\u002Fdocs\u002Fagents\u002Freference\u002Fmcp-server",{"path":70,"title":83,"navTitle":83,"seoTitle":84,"description":85,"type":24,"position":11,"updated":12,"release":13,"related":86,"plans":8},"Agent handbook","Agent handbook: how agents work in Treehouse","Written for agents. How to reach a Treehouse workspace, the rules that keep everyone's work safe, and the conventions the web app understands.",[81,87,88],"\u002Fdocs\u002Fagents\u002Fhandbook\u002Fversions-and-conflicts","\u002Fdocs\u002Fplaybooks\u002Freview-loop",{"path":87,"title":90,"navTitle":8,"seoTitle":8,"description":91,"type":37,"position":30,"updated":12,"release":13,"related":92,"plans":8},"Versions and conflicts","The concurrency contract every Treehouse client shares - version numbers, compare-and-swap writes, conflicted copies, deletes, moves and restores.",[93,94,81],"\u002Fdocs\u002Ffiles\u002Fconflicted-copies","\u002Fdocs\u002Fagents\u002Freference\u002Frest-api",{"path":96,"title":97,"navTitle":8,"seoTitle":98,"description":99,"type":24,"position":30,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fagents","Agents","Treehouse for agents","Everything an agent needs to work in a Treehouse workspace, and everything you need to connect one.",{"path":58,"title":101,"navTitle":8,"seoTitle":8,"description":102,"type":29,"position":30,"updated":12,"release":13,"related":103,"plans":8},"Authentication","How API keys work, what each kind of key can reach, the device authorisation flow the CLI and desktop app use, and how keys are revoked.",[40,81,94],{"path":105,"title":106,"navTitle":8,"seoTitle":8,"description":107,"type":29,"position":38,"updated":12,"release":13,"related":108,"plans":8},"\u002Fdocs\u002Fagents\u002Freference\u002Fchange-feed","Change feed","Read every change to a workspace in order with a cursor, so a script or agent can react to new and edited files.",[109,110,87],"\u002Fdocs\u002Fsharing\u002Factivity","\u002Fdocs\u002Fplaybooks\u002Froutines",{"path":112,"title":113,"navTitle":8,"seoTitle":8,"description":114,"type":24,"position":48,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fagents\u002Freference","API reference","The protocol reference - authentication, every MCP tool, the REST API and the change feed.",{"path":81,"title":116,"navTitle":8,"seoTitle":8,"description":117,"type":29,"position":11,"updated":12,"release":13,"related":118,"plans":8},"MCP server","Every tool the Treehouse MCP server exposes, with parameters, outputs, limits and the instructions it gives connected agents.",[57,77,87],{"path":94,"title":120,"navTitle":8,"seoTitle":8,"description":121,"type":29,"position":48,"updated":12,"release":13,"related":122,"plans":8},"REST API","Endpoints for reading, writing, moving, searching, sharing and commenting on workspace files over HTTP, with headers, status codes and examples.",[58,87,105],{"path":124,"title":125,"navTitle":126,"seoTitle":8,"description":127,"type":29,"position":128,"updated":12,"release":13,"related":129,"plans":8},"\u002Fdocs\u002Fdesktop\u002Fcli-reference","Sync CLI reference","Sync CLI","Every treehouse command and flag, the files and environment variables the CLI reads, and the safety rules it follows while syncing.",5,[130,131,105],"\u002Fdocs\u002Fdesktop\u002Fsync-with-the-cli","\u002Fdocs\u002Fdesktop\u002Fhow-sync-works",{"path":131,"title":133,"navTitle":8,"seoTitle":8,"description":134,"type":37,"position":11,"updated":12,"release":13,"related":135,"plans":8},"How sync works","What the sync engine does in the background, which files it skips, and how it protects your work when things go wrong.",[93,41,109,136],"\u002Fdocs\u002Fget-started\u002Fhow-treehouse-works",{"path":138,"title":139,"navTitle":8,"seoTitle":8,"description":140,"type":24,"position":128,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fdesktop","Desktop app and sync","Keep a folder on your computer in step with a workspace, using the Mac app or the sync CLI.",{"path":142,"title":143,"navTitle":8,"seoTitle":8,"description":144,"type":10,"position":30,"updated":12,"release":13,"related":145,"plans":8},"\u002Fdocs\u002Fdesktop\u002Finstall-the-desktop-app","Install the desktop app","Download Treehouse for Mac, sign in and pick a folder, and your workspace's files appear on your computer and stay in sync.",[131,146,130],"\u002Fdocs\u002Fdesktop\u002Fmanage-synced-folders",{"path":146,"title":148,"navTitle":8,"seoTitle":8,"description":149,"type":10,"position":48,"updated":12,"release":13,"related":150,"plans":8},"Manage synced folders","Check sync status, pause, move or stop syncing a folder, add another workspace, and sign out, all from the Treehouse icon in your menu bar.",[131,130,151],"\u002Fdocs\u002Fhelp\u002Ftroubleshooting",{"path":130,"title":153,"navTitle":154,"seoTitle":8,"description":155,"type":10,"position":38,"updated":12,"release":13,"related":156,"plans":8},"Sync a folder with the CLI","Sync with the CLI","Install the treehouse command-line tool to sync a folder on Windows, Linux, a server or any machine where the desktop app doesn't run.",[124,131,146],{"path":93,"title":158,"navTitle":8,"seoTitle":8,"description":159,"type":37,"position":160,"updated":12,"release":13,"related":161,"plans":8},"Conflicted copies","When two edits to the same file collide, Treehouse keeps both. Here's what a conflicted copy is, how to spot one and how to resolve it.",9,[162,131,87],"\u002Fdocs\u002Ffiles\u002Fversion-history",{"path":164,"title":165,"navTitle":166,"seoTitle":8,"description":167,"type":10,"position":11,"updated":12,"release":13,"related":168,"plans":8},"\u002Fdocs\u002Ffiles\u002Fcreate-and-edit","Create and edit files","Create and edit","Make new files and folders in the web app, edit markdown, code and HTML, and save your changes.",[169,93,162],"\u002Fdocs\u002Ffiles\u002Ffront-matter",{"path":171,"title":172,"navTitle":173,"seoTitle":8,"description":174,"type":10,"position":128,"updated":12,"release":13,"related":175,"plans":8},"\u002Fdocs\u002Ffiles\u002Ffolder-pages","Turn a folder into a page or calendar","Folder pages and calendars","Give a folder a front page with a README, or show a folder of dated notes as a calendar you can reschedule by dragging.",[169,42,176],"\u002Fdocs\u002Fplaybooks\u002Fshape-your-workspace",{"path":169,"title":178,"navTitle":179,"seoTitle":8,"description":180,"type":29,"position":181,"updated":12,"release":13,"related":182,"plans":8},"Front matter reference","Front matter","The YAML block at the top of a markdown file, and the keys Treehouse reads from it to label, title and schedule your files.",6,[171,164,110],{"path":42,"title":184,"navTitle":185,"seoTitle":8,"description":186,"type":10,"position":25,"updated":12,"release":13,"related":187,"plans":8},"Publish an HTML page","HTML pages","Show HTML files as full pages, decide when their scripts may run, and share them publicly as reports, dashboards or decks.",[32,171,188],"\u002Fdocs\u002Ffiles\u002Fview-files",{"path":190,"title":191,"navTitle":8,"seoTitle":8,"description":192,"type":24,"position":48,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Ffiles","Files and folders","Find, read, write, upload and organise the files in a workspace, and get back anything that changed.",{"path":194,"title":195,"navTitle":196,"seoTitle":8,"description":197,"type":10,"position":38,"updated":12,"release":13,"related":198,"plans":8},"\u002Fdocs\u002Ffiles\u002Forganise-files","Rename, move and organise files","Organise files","Rename, move, reorder and delete files and folders, and give them icons, from the sidebar tree.",[162,41,176],{"path":41,"title":200,"navTitle":201,"seoTitle":8,"description":202,"type":10,"position":203,"updated":12,"release":13,"related":204,"plans":8},"Keep files private","Private files","Make a file or folder visible only to you and your own agents, even in a workspace you share with others.",10,[194,32,63],{"path":206,"title":207,"navTitle":208,"seoTitle":8,"description":209,"type":10,"position":48,"updated":12,"release":13,"related":210,"plans":8},"\u002Fdocs\u002Ffiles\u002Fupload-and-download","Upload and download files","Upload and download","Add files from your computer to a workspace, decide what happens when names clash, and download a copy of any file.",[164,131,15],{"path":162,"title":212,"navTitle":213,"seoTitle":8,"description":214,"type":10,"position":215,"updated":12,"release":13,"related":216,"plans":8},"See and restore earlier versions","Version history","Look through every change to a file, see who made it, view or restore an older version, and catch up on what changed while you were away.",8,[93,109,87],{"path":188,"title":218,"navTitle":219,"seoTitle":8,"description":220,"type":10,"position":30,"updated":12,"release":13,"related":221,"plans":8},"Find and view files","Find and view","Browse the file tree, search by name, and see how Treehouse shows markdown, HTML, code, images and everything else.",[164,171,162],{"path":136,"title":223,"navTitle":8,"seoTitle":8,"description":224,"type":37,"position":48,"updated":12,"release":13,"related":225,"plans":8},"How Treehouse works","Workspaces, versions, conflicted copies and attribution - the handful of ideas the rest of Treehouse is built on.",[162,93,63,87],{"path":227,"title":228,"navTitle":8,"seoTitle":8,"description":229,"type":24,"position":11,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fget-started","Get started","What Treehouse is, how to set up your first workspace, and how it works underneath.",{"path":50,"title":231,"navTitle":8,"seoTitle":8,"description":232,"type":233,"position":11,"updated":12,"release":13,"related":234,"plans":8},"Quickstart","Create a workspace, sync it to your computer, connect an agent and let it set things up. About ten minutes.","guide",[235,57,64],"\u002Fdocs\u002Fget-started\u002Fset-up-with-an-agent",{"path":235,"title":237,"navTitle":238,"seoTitle":8,"description":239,"type":10,"position":38,"updated":12,"release":13,"related":240,"plans":8},"Set up a workspace with an agent","Set up with an agent","Hand a new, empty workspace to an agent. It interviews you, proposes a structure and builds it once you agree.",[176,64,241],"\u002Fdocs\u002Fplaybooks\u002Finbox-and-filing",{"path":243,"title":244,"navTitle":244,"seoTitle":8,"description":245,"type":37,"position":30,"updated":12,"release":13,"related":246,"plans":8},"\u002Fdocs\u002Fget-started\u002Fwhat-is-treehouse","What is Treehouse?","A shared workspace of plain files that people and agents both work in, with the sharing, history and review that plain folders lack.",[50,136,63],{"path":248,"title":249,"navTitle":250,"seoTitle":8,"description":251,"type":29,"position":11,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fhelp\u002Ffaq","Frequently asked questions","FAQ","Short answers to the questions people ask most about Treehouse, agents, sharing and data.",{"path":253,"title":254,"navTitle":8,"seoTitle":8,"description":255,"type":29,"position":48,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fhelp\u002Fglossary","Glossary","The words Treehouse uses, and what each one means in the app and in these docs.",{"path":257,"title":258,"navTitle":8,"seoTitle":8,"description":259,"type":24,"position":215,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fhelp","Help","Fixes for common problems, answers to common questions, and the words Treehouse uses.",{"path":151,"title":261,"navTitle":8,"seoTitle":262,"description":263,"type":10,"position":30,"updated":12,"release":13,"related":264,"plans":8},"Troubleshooting","Troubleshooting Treehouse sync, agents and sharing","The problems people hit most often with sync, agent connections, sharing and limits, and how to fix each one.",[146,57,93],{"path":266,"title":267,"navTitle":8,"seoTitle":268,"description":269,"type":24,"position":270,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs","Treehouse docs","Treehouse documentation","How to set up a shared workspace for your team and your agents, and how to get the most out of it once you have.",0,{"path":272,"title":273,"navTitle":274,"seoTitle":8,"description":275,"type":233,"position":215,"updated":12,"release":13,"related":276,"plans":8},"\u002Fdocs\u002Fplaybooks\u002Fclient-work","Run client work","Client work","A folder per client, agents that prepare the deliverables, and share links that give clients exactly what they should see.",[32,42,88],{"path":241,"title":278,"navTitle":279,"seoTitle":8,"description":280,"type":233,"position":48,"updated":12,"release":13,"related":281,"plans":8},"Run an inbox your agent files","Inbox and filing","Drop anything into Inbox\u002F without deciding where it goes, and have an agent file it by rules you write once.",[110,282,176],"\u002Fdocs\u002Fplaybooks\u002Fsecond-brain",{"path":284,"title":285,"navTitle":8,"seoTitle":8,"description":286,"type":24,"position":181,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fplaybooks","Playbooks","Opinionated patterns for running a workspace with your agents, from the rulebook they follow to the routines that keep it alive.",{"path":288,"title":289,"navTitle":290,"seoTitle":8,"description":291,"type":233,"position":128,"updated":12,"release":13,"related":292,"plans":8},"\u002Fdocs\u002Fplaybooks\u002Fmemory-and-decisions","Give your agents a memory","Memory and decisions","Status pages, decision records and handoff notes that let any agent pick up where the last session left off.",[64,293,171],"\u002Fdocs\u002Fplaybooks\u002Fmultiple-agents",{"path":293,"title":295,"navTitle":296,"seoTitle":8,"description":297,"type":233,"position":25,"updated":12,"release":13,"related":298,"plans":8},"Work with several agents","Several agents","Give each agent its own key and its own lane, hand work over through files, and let versioning catch the collisions.",[40,288,93],{"path":88,"title":300,"navTitle":301,"seoTitle":8,"description":302,"type":233,"position":38,"updated":12,"release":13,"related":303,"plans":8},"Review your agent's work","Review loop","Let an agent draft, review it with comments in the web app, and have the agent work through your feedback thread by thread.",[304,162,57],"\u002Fdocs\u002Fsharing\u002Fcomments",{"path":110,"title":306,"navTitle":307,"seoTitle":8,"description":308,"type":233,"position":181,"updated":12,"release":13,"related":309,"plans":8},"Set up routines","Routines","Recurring agent work, like a morning inbox run or a weekly review, and where the schedule lives when Treehouse doesn't run agents itself.",[241,130,105],{"path":282,"title":311,"navTitle":8,"seoTitle":8,"description":312,"type":233,"position":160,"updated":12,"release":13,"related":313,"plans":8},"Build a second brain","A personal workspace where you capture everything quickly and an agent keeps it filed, linked and useful.",[241,110,171],{"path":176,"title":315,"navTitle":8,"seoTitle":8,"description":316,"type":233,"position":11,"updated":12,"release":13,"related":317,"plans":8},"Shape your workspace","Folder structures that work for people and agents alike, and the handful of habits that keep a workspace easy to navigate as it grows.",[64,171,194],{"path":64,"title":319,"navTitle":8,"seoTitle":8,"description":320,"type":233,"position":30,"updated":12,"release":13,"related":321,"plans":8},"Write your AGENTS.md","The one file every agent reads first. What to put in it so any agent, in any session, works the way your team does.",[176,63,235],{"path":323,"title":324,"navTitle":325,"seoTitle":8,"description":326,"type":24,"position":160,"updated":12,"release":13,"related":327,"plans":8},"\u002Fdocs\u002Fself-hosting","Self-host Treehouse","Self-hosting","Run your own Treehouse server - the architecture, required and optional environment variables, storage and encryption, and connecting clients.",[58,81,124],{"path":109,"title":329,"navTitle":330,"seoTitle":8,"description":331,"type":10,"position":38,"updated":12,"release":13,"related":332,"plans":8},"See what changed in a workspace","Activity","The activity feed shows every change and comment in a workspace, who made it, and whether it came from a person or an agent.",[63,40,162,93],{"path":304,"title":334,"navTitle":335,"seoTitle":8,"description":336,"type":10,"position":48,"updated":12,"release":13,"related":337,"plans":8},"Comment on a document","Comments","Leave comments on passages of a markdown file, reply and resolve threads, and let agents read and act on your feedback.",[88,162,109],{"path":51,"title":339,"navTitle":340,"seoTitle":8,"description":341,"type":10,"position":128,"updated":12,"release":13,"related":342,"plans":8},"Customise your workspace","Customise a workspace","Rename a workspace, give it an icon and colour, create new workspaces, and choose a theme for everyone or just for you.",[15,32],{"path":344,"title":345,"navTitle":8,"seoTitle":8,"description":346,"type":24,"position":38,"updated":12,"release":13,"related":8,"plans":8},"\u002Fdocs\u002Fsharing","Share and collaborate","Invite people into a workspace, share files with anyone by link, comment on documents and see who changed what.",{"path":16,"title":348,"navTitle":349,"seoTitle":8,"description":350,"type":10,"position":30,"updated":12,"release":13,"related":351,"plans":352},"Invite people to a workspace","Invite people","Bring teammates into a workspace with an invite link, see who's a member, and remove people when they no longer need access.",[32,5,40],[18,19],{"path":32,"title":354,"navTitle":355,"seoTitle":8,"description":356,"type":10,"position":11,"updated":12,"release":13,"related":357,"plans":8},"Share a file or folder with a link","Share links","Send members straight to a file, or give anyone read-only access to a file or folder, with an optional password and a pinned version.",[16,42,162,15],{"id":359,"title":90,"body":360,"description":91,"extension":854,"meta":855,"navTitle":8,"navigation":856,"path":87,"plans":8,"position":30,"related":857,"release":13,"seo":858,"seoTitle":8,"stem":859,"type":37,"updated":12,"__hash__":860},"docs\u002Fdocs\u002Fagents\u002Fhandbook\u002Fversions-and-conflicts.md",{"type":361,"value":362,"toc":843},"minimark",[363,367,372,474,478,493,500,504,507,536,539,553,556,559,569,603,624,628,638,656,660,663,667,670,736,742,746,753,797,803,807,836],[364,365,366],"p",{},"Treehouse never loses a write. Every surface (the web app, synced folders, MCP and REST) goes through one file service that applies the rules on this page, so they hold whoever or whatever is writing.",[368,369,371],"h2",{"id":370},"the-rules","The rules",[373,374,375,388],"table",{},[376,377,378],"thead",{},[379,380,381,385],"tr",{},[382,383,384],"th",{},"Situation",[382,386,387],{},"Result",[389,390,391,400,408,421,429,437,445,458,466],"tbody",{},[379,392,393,397],{},[394,395,396],"td",{},"New file",[394,398,399],{},"Created at version 1",[379,401,402,405],{},[394,403,404],{},"Write with the current version as the base",[394,406,407],{},"Saved; the version goes up by exactly one",[379,409,410,413],{},[394,411,412],{},"Write with a stale base, different content",[394,414,415,416,420],{},"The file is untouched. Your bytes are saved as a ",[417,418,419],"strong",{},"conflicted copy"," and the response names it.",[379,422,423,426],{},[394,424,425],{},"Write with a stale base, identical content",[394,427,428],{},"Succeeds, returning the current version. No copy, no new version.",[379,430,431,434],{},[394,432,433],{},"Write to a file deleted since you read it",[394,435,436],{},"The edit wins: the file is recreated at version 1 with your content",[379,438,439,442],{},[394,440,441],{},"Delete with the current version as the base",[394,443,444],{},"Deleted",[379,446,447,450],{},[394,448,449],{},"Delete with a stale base",[394,451,452,453,457],{},"Nothing is deleted (",[454,455,456],"code",{},"412",", or an MCP error naming the current version)",[379,459,460,463],{},[394,461,462],{},"Move",[394,464,465],{},"The file restarts at version 1 at its new path",[379,467,468,471],{},[394,469,470],{},"Restore",[394,472,473],{},"The old bytes become a new version on top of the history",[368,475,477],{"id":476},"versions","Versions",[364,479,480,481,484,485,488,489,492],{},"A file's version is an integer that starts at 1 and goes up by one with each successful write. You get it back from every read (",[454,482,483],{},"X-Treehouse-Version"," over REST, ",[454,486,487],{},"version"," from ",[454,490,491],{},"read_file",") and every write.",[364,494,495,496,499],{},"Version numbers are per path, and a path that is deleted and later recreated starts again at 1. When you need to name exact bytes, use the content hash (",[454,497,498],{},"X-Treehouse-Content-Hash",") instead: it is a SHA-256 of the content and is never reused.",[368,501,503],{"id":502},"compare-and-swap-writes","Compare-and-swap writes",[364,505,506],{},"To update a file, tell Treehouse which version you based your edit on:",[508,509,510,525],"ul",{},[511,512,513,516,517,520,521,524],"li",{},[417,514,515],{},"MCP:"," ",[454,518,519],{},"write_file"," with ",[454,522,523],{},"baseVersion",".",[511,526,527,516,530,520,533,524],{},[417,528,529],{},"REST:",[454,531,532],{},"PUT",[454,534,535],{},"If-Match: \"\u003Cversion>\"",[364,537,538],{},"If the file is still at that version, your write lands. If someone else wrote first, the file is left as they wrote it and your content is saved next to it as a conflicted copy.",[364,540,541,542,544,545,548,549,552],{},"Creating is the same idea with no base. Over MCP, omit ",[454,543,523],{},"; over REST, send ",[454,546,547],{},"If-None-Match: *"," (or no precondition, which REST rejects with ",[454,550,551],{},"428"," if the path already exists). If the path turns out to exist with different content, you get a conflicted copy rather than an overwrite.",[368,554,158],{"id":555},"conflicted-copies",[364,557,558],{},"A conflicted copy sits next to the original, with who and when in its name:",[560,561,567],"pre",{"className":562,"code":564,"language":565,"meta":566},[563],"language-text","Projects\u002Fplan (conflicted copy — agent — 2026-09-29T14:03:12.481Z).md\n","text","",[454,568,564],{"__ignoreMap":566},[508,570,571,582,585,591,597,600],{},[511,572,573,574,577,578,581],{},"The middle part is the writer's actor type, ",[454,575,576],{},"agent"," or ",[454,579,580],{},"human",", from their API key.",[511,583,584],{},"The timestamp is the server's time of the conflict, in ISO 8601 UTC.",[511,586,587,588,524],{},"If that name is already taken (two different conflicts on the same file, from the same kind of writer, in the same millisecond), the later one gets a counter: ",[454,589,590],{},"plan (conflicted copy — agent — 2026-09-29T14:03:12.481Z) (2).md",[511,592,593,594,524],{},"A file without an extension gets the suffix at the end: ",[454,595,596],{},"Makefile (conflicted copy — human — 2026-09-29T14:03:12.481Z)",[511,598,599],{},"If a conflicted copy of that file already holds exactly the same bytes, Treehouse returns that copy's path instead of making another.",[511,601,602],{},"A conflicted copy of a private file is private to the same owner.",[364,604,605,606,488,609,611,612,615,616,618,619,623],{},"The response tells you where your bytes went: ",[454,607,608],{},"conflictCopyPath",[454,610,519],{},", or ",[454,613,614],{},"conflict_copy_path"," in a REST ",[454,617,456],{}," body. Resolving it is up to you or the person who owns the file; see ",[620,621,622],"a",{"href":93},"conflicted copies"," for the human side.",[368,625,627],{"id":626},"deletes-and-moves","Deletes and moves",[364,629,630,631,633,634,637],{},"A delete also takes a base version (",[454,632,523],{}," over MCP, ",[454,635,636],{},"If-Match"," over REST, both required). A stale delete loses: nothing is removed, and you learn the current version. Combined with \"a write to a deleted file recreates it\", this means an edit always beats a delete that didn't see it.",[364,639,640,641,644,645,648,649,652,653,655],{},"A move creates the file at its new path and removes the old one in one step. The moved file starts at ",[417,642,643],{},"version 1",", and the change feed records two events: a ",[454,646,647],{},"delete"," at the old path and a ",[454,650,651],{},"move"," at the new one. Comment threads move with the file. Over MCP a move applies to whatever the current version is; over REST you can pass ",[454,654,523],{}," to make it conditional.",[368,657,659],{"id":658},"restores","Restores",[364,661,662],{},"Restoring an old version never rewrites history. The old bytes are written as a new version at the top, attempted up to five times against the latest version if other writes are landing. If other writes keep winning after that, the restored content is saved as a conflicted copy instead. A restore of a file that has since been deleted recreates it at version 1.",[368,664,666],{"id":665},"plan-limits","Plan limits",[364,668,669],{},"Limits only block a clean write: a new file, or an update whose base is current. They never block the safety paths.",[373,671,672,688],{},[376,673,674],{},[379,675,676,679,682,685],{},[382,677,678],{},"Check",[382,680,681],{},"Clean write",[382,683,684],{},"Conflicted copy",[382,686,687],{},"Move, delete, restore",[389,689,690,703,714,725],{},[379,691,692,695,698,700],{},[394,693,694],{},"Per-file size limit",[394,696,697],{},"Enforced",[394,699,697],{},[394,701,702],{},"Not checked",[379,704,705,708,710,712],{},[394,706,707],{},"Storage limit",[394,709,697],{},[394,711,702],{},[394,713,702],{},[379,715,716,719,721,723],{},[394,717,718],{},"File-count limit (new files only)",[394,720,697],{},[394,722,702],{},[394,724,702],{},[379,726,727,730,732,734],{},[394,728,729],{},"Read-only workspace (lapsed plan)",[394,731,697],{},[394,733,702],{},[394,735,702],{},[364,737,738,739,524],{},"So a stale write is always preserved as a copy, even in a workspace that is full or read-only. See ",[620,740,741],{"href":15},"plans and limits",[368,743,745],{"id":744},"worked-example","Worked example",[364,747,748,749,752],{},"An agent and a person both edit ",[454,750,751],{},"notes.md",", currently at version 4.",[754,755,756,762,768,785,794],"ol",{},[511,757,758,759,761],{},"The agent reads ",[454,760,751],{}," and gets version 4.",[511,763,764,765,767],{},"The person saves an edit in the web app. ",[454,766,751],{}," is now version 5.",[511,769,770,771,774,775,777,778,781,782,524],{},"The agent writes its edit with ",[454,772,773],{},"baseVersion: 4",". The base is stale, so ",[454,776,751],{}," stays at version 5 and the agent's content is saved as ",[454,779,780],{},"notes (conflicted copy — agent — 2026-09-29T14:03:12.481Z).md",". The result is ",[454,783,784],{},"{ ok: false, currentVersion: 5, conflictCopyPath: \"notes (conflicted copy — agent — …).md\" }",[511,786,758,787,789,790,793],{},[454,788,751],{}," again (version 5), merges its change into the person's version, and writes with ",[454,791,792],{},"baseVersion: 5",". It lands as version 6.",[511,795,796],{},"The agent deletes its conflicted copy, since its content is now merged.",[364,798,799,800,802],{},"Had the person's edit in step 2 been a delete instead, step 3 would have recreated ",[454,801,751],{}," at version 1 with the agent's content.",[368,804,806],{"id":805},"the-recommended-loop-for-agents","The recommended loop for agents",[754,808,809,815,821,827,833],{},[511,810,811,814],{},[417,812,813],{},"Read"," the file and keep its version.",[511,816,817,820],{},[417,818,819],{},"Edit"," your copy.",[511,822,823,826],{},[417,824,825],{},"Write"," with that version as the base.",[511,828,829,832],{},[417,830,831],{},"On a conflict",", re-read the file, merge your change into what's there now, and write again with the new version. Then delete your conflicted copy (reading it first to get its version, which is 1), so the folder stays tidy.",[511,834,835],{},"Never retry a conflicted write with the same stale base: it will conflict again.",[364,837,838,839,842],{},"The ",[620,840,841],{"href":70},"agent handbook"," gives agents the same guidance in their own terms.",{"title":566,"searchDepth":11,"depth":48,"links":844},[845,846,847,848,849,850,851,852,853],{"id":370,"depth":11,"text":371},{"id":476,"depth":11,"text":477},{"id":502,"depth":11,"text":503},{"id":555,"depth":11,"text":158},{"id":626,"depth":11,"text":627},{"id":658,"depth":11,"text":659},{"id":665,"depth":11,"text":666},{"id":744,"depth":11,"text":745},{"id":805,"depth":11,"text":806},"md",{},true,[93,94,81],{"title":90,"description":91},"docs\u002Fagents\u002Fhandbook\u002Fversions-and-conflicts","DFZc7ADVZe4JXFKDjqHPJAJl_op_XCVCZVoVXASCWng",1790706077340]