[{"data":1,"prerenderedAt":535,"buildId":536},["ShallowReactive",2],{"docs:\u002Fguide\u002Fagents":3},{"page":4,"section":16,"document":17,"credits":10,"prev":531,"next":10},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":12,"layout":13,"sidebar":14,"toc":14,"kind":10,"group":10,"navigation":14,"order":15},"agents","\u002Fguide\u002Fagents","guide\u002Fagents.md","Coding agents","Tell coding agents how your program syncs, and let them test a sync without touching the machine's agents.",null,[],"i-lucide-bot","article",true,7,"guide",{"nodes":18,"toc":527},[19,28,161,169,176,473,492,507,513],[20,21,22,23,27],"p",{},"A coding agent that works on a program built on skillrc needs three facts: where the state is, which files a sync may write, and how to test without the user's agents. Put them in ",[24,25,26],"code",{},"AGENTS.md",":",[29,30,33],"pre",{"language":31,"filename":26,"class":32,"wrap":14},"md","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,34,36,45,46,45,48,45,77,45,88,45,113,45,130,45,149,45,154],{"class":35},"language-md",[37,38,41],"span",{"class":39,"style":40},"line","display: inline",[37,42,44],{"style":43},"color:#0550AE;--shiki-light-font-weight:bold;--shiki-dark:#79C0FF;--shiki-dark-font-weight:bold","## Sync","\n",[37,47],{"class":39,"style":40},[37,49,50,54,58,62,65,68,71,74],{"class":39,"style":40},[37,51,53],{"style":52},"color:#953800;--shiki-dark:#FFA657","-",[37,55,57],{"style":56},"color:#1F2328;--shiki-dark:#E6EDF3"," skillrc runs the sync (",[37,59,61],{"style":60},"color:#0550AE;--shiki-dark:#79C0FF","`sync`",[37,63,64],{"style":56}," from skillrc\u002Fsync). Our ",[37,66,67],{"style":60},"`SyncHost`",[37,69,70],{"style":56}," is in ",[37,72,73],{"style":60},"`src\u002Fhost.ts`",[37,75,76],{"style":56},"; it reads",[37,78,79,82,85],{"class":39,"style":40},[37,80,81],{"style":56},"  the plan from ",[37,83,84],{"style":60},"`~\u002F.config\u002Fmytool\u002Fmytool.json`",[37,86,87],{"style":56},".",[37,89,90,92,95,98,101,104,107,110],{"class":39,"style":40},[37,91,53],{"style":52},[37,93,94],{"style":56}," State is in ",[37,96,97],{"style":60},"`~\u002F.local\u002Fstate\u002Fmytool`",[37,99,100],{"style":56},": ",[37,102,103],{"style":60},"`state.json`",[37,105,106],{"style":56},", ",[37,108,109],{"style":60},"`last-run.json`",[37,111,112],{"style":56}," and the store. Never edit them",[37,114,115,118,121,124,127],{"class":39,"style":40},[37,116,117],{"style":56},"  by hand; ",[37,119,120],{"style":60},"`loadState`",[37,122,123],{"style":56}," and ",[37,125,126],{"style":60},"`saveState`",[37,128,129],{"style":56}," do.",[37,131,132,134,137,140,143,146],{"class":39,"style":40},[37,133,53],{"style":52},[37,135,136],{"style":56}," Config edits go through ",[37,138,139],{"style":60},"`editConfigFile`",[37,141,142],{"style":56}," or ",[37,144,145],{"style":60},"`setTomlTable`",[37,147,148],{"style":56},", never a whole-file write: the user and",[37,150,151],{"class":39,"style":40},[37,152,153],{"style":56},"  the agents edit the same files.",[37,155,156,158],{"class":39,"style":40},[37,157,53],{"style":52},[37,159,160],{"style":56}," Tests never touch the machine's agents. Every folder, HOME and git's config included, is a temp one.",[162,163,168],"h2",{"id":164,"anchor":165},"testing-without-the-users-agents",{"label":166,"icon":167},"Section titled \"Testing without the user's agents\"","#","Testing without the user's agents",[20,170,171,172,175],{},"Build the ",[24,173,174],{},"Places"," in a temporary folder, and point every variable an agent or git reads there too. skillrc's own engine tests do this:",[29,177,179],{"language":178,"class":32,"wrap":14},"ts",[24,180,182,45,201,45,215,45,229,45,243,45,245,45,285,45,306,45,322,45,346,45,368,45,390,45,408,45,410,45,428,45,439,45,454,45,468],{"class":181},"language-ts",[37,183,184,188,191,194,198],{"class":39,"style":40},[37,185,187],{"style":186},"color:#CF222E;--shiki-dark:#FF7B72","import",[37,189,190],{"style":56}," { mkdtempSync, realpathSync } ",[37,192,193],{"style":186},"from",[37,195,197],{"style":196},"color:#0A3069;--shiki-dark:#A5D6FF"," \"node:fs\"",[37,199,200],{"style":56},";",[37,202,203,205,208,210,213],{"class":39,"style":40},[37,204,187],{"style":186},[37,206,207],{"style":56}," { tmpdir } ",[37,209,193],{"style":186},[37,211,212],{"style":196}," \"node:os\"",[37,214,200],{"style":56},[37,216,217,219,222,224,227],{"class":39,"style":40},[37,218,187],{"style":186},[37,220,221],{"style":56}," { join } ",[37,223,193],{"style":186},[37,225,226],{"style":196}," \"node:path\"",[37,228,200],{"style":56},[37,230,231,233,236,238,241],{"class":39,"style":40},[37,232,187],{"style":186},[37,234,235],{"style":56}," { vi } ",[37,237,193],{"style":186},[37,239,240],{"style":196}," \"vitest\"",[37,242,200],{"style":56},[37,244],{"class":39,"style":40},[37,246,247,250,253,256,260,263,266,268,271,273,276,279,282],{"class":39,"style":40},[37,248,249],{"style":186},"const",[37,251,252],{"style":60}," root",[37,254,255],{"style":186}," =",[37,257,259],{"style":258},"color:#8250DF;--shiki-dark:#D2A8FF"," realpathSync",[37,261,262],{"style":56},"(",[37,264,265],{"style":258},"mkdtempSync",[37,267,262],{"style":56},[37,269,270],{"style":258},"join",[37,272,262],{"style":56},[37,274,275],{"style":258},"tmpdir",[37,277,278],{"style":56},"(), ",[37,280,281],{"style":196},"\"mytool-\"",[37,283,284],{"style":56},")));",[37,286,287,289,292,294,297,300,303],{"class":39,"style":40},[37,288,249],{"style":186},[37,290,291],{"style":60}," home",[37,293,255],{"style":186},[37,295,296],{"style":258}," join",[37,298,299],{"style":56},"(root, ",[37,301,302],{"style":196},"\"home\"",[37,304,305],{"style":56},");",[37,307,308,311,314,316,319],{"class":39,"style":40},[37,309,310],{"style":56},"vi.",[37,312,313],{"style":258},"stubEnv",[37,315,262],{"style":56},[37,317,318],{"style":196},"\"HOME\"",[37,320,321],{"style":56},", home);",[37,323,324,326,328,330,333,335,337,340,343],{"class":39,"style":40},[37,325,310],{"style":56},[37,327,313],{"style":258},[37,329,262],{"style":56},[37,331,332],{"style":196},"\"XDG_CONFIG_HOME\"",[37,334,106],{"style":56},[37,336,270],{"style":258},[37,338,339],{"style":56},"(home, ",[37,341,342],{"style":196},"\".config\"",[37,344,345],{"style":56},"));",[37,347,348,350,352,354,357,359,361,363,366],{"class":39,"style":40},[37,349,310],{"style":56},[37,351,313],{"style":258},[37,353,262],{"style":56},[37,355,356],{"style":196},"\"CLAUDE_CONFIG_DIR\"",[37,358,106],{"style":56},[37,360,270],{"style":258},[37,362,339],{"style":56},[37,364,365],{"style":196},"\".claude\"",[37,367,345],{"style":56},[37,369,370,372,374,376,379,381,383,385,388],{"class":39,"style":40},[37,371,310],{"style":56},[37,373,313],{"style":258},[37,375,262],{"style":56},[37,377,378],{"style":196},"\"CODEX_HOME\"",[37,380,106],{"style":56},[37,382,270],{"style":258},[37,384,339],{"style":56},[37,386,387],{"style":196},"\".codex\"",[37,389,345],{"style":56},[37,391,392,394,396,398,401,403,406],{"class":39,"style":40},[37,393,310],{"style":56},[37,395,313],{"style":258},[37,397,262],{"style":56},[37,399,400],{"style":196},"\"GIT_CONFIG_NOSYSTEM\"",[37,402,106],{"style":56},[37,404,405],{"style":196},"\"1\"",[37,407,305],{"style":56},[37,409],{"class":39,"style":40},[37,411,412,414,417,419,422,425],{"class":39,"style":40},[37,413,249],{"style":186},[37,415,416],{"style":60}," places",[37,418,255],{"style":186},[37,420,421],{"style":56}," Object.",[37,423,424],{"style":258},"freeze",[37,426,427],{"style":56},"({",[37,429,430,433,436],{"class":39,"style":40},[37,431,432],{"style":56},"  program: ",[37,434,435],{"style":196},"\"mytool\"",[37,437,438],{"style":56},",",[37,440,441,444,446,448,451],{"class":39,"style":40},[37,442,443],{"style":56},"  state: ",[37,445,270],{"style":258},[37,447,299],{"style":56},[37,449,450],{"style":196},"\"state\"",[37,452,453],{"style":56},"),",[37,455,456,459,461,463,466],{"class":39,"style":40},[37,457,458],{"style":56},"  config: ",[37,460,270],{"style":258},[37,462,299],{"style":56},[37,464,465],{"style":196},"\"config\"",[37,467,453],{"style":56},[37,469,470],{"class":39,"style":40},[37,471,472],{"style":56},"});",[20,474,475,476,479,480,483,484,487,488,491],{},"A ",[24,477,478],{},"SyncHost"," whose ",[24,481,482],{},"targets"," returns one folder under ",[24,485,486],{},"home"," stands in for an agent. A local source or a bare git repository in ",[24,489,490],{},"root"," stands in for a remote.",[20,493,494,495,498,499,502,503,506],{},"Two variables shorten waits in tests: ",[24,496,497],{},"\u003CPROGRAM>_LOCK_WAIT_MS"," sets how long ",[24,500,501],{},"withSyncLock"," waits for a running sync, and ",[24,504,505],{},"\u003CPROGRAM>_SYNC_TIMEOUT_MS"," sets the limit on a whole sync.",[162,508,512],{"id":509,"anchor":510},"markdown-copies",{"label":511,"icon":167},"Section titled \"Markdown copies\"","Markdown copies",[20,514,515,516,519,520,523,524,87],{},"Every page on this site has a raw Markdown copy at ",[24,517,518],{},"\u002Fraw\u002F\u003Cpage>.md",", such as ",[24,521,522],{},"\u002Fraw\u002Fguide\u002Fsync.md",", and a full index at ",[24,525,526],{},"\u002Fllms.txt",[528,530],{"id":164,"depth":529,"text":168},2,{"id":509,"depth":529,"text":512},{"path":532,"title":533,"description":534},"\u002Fguide\u002Fsync","Sync","Run the sync engine with a plan and a SyncHost, preview it with a dry run, and read the report and the state it keeps.",1796390516757,"74c0e290-bf28-4a8a-b311-db0be1c3af18"]