[{"data":1,"prerenderedAt":324},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder":3},{"id":4,"title":5,"body":6,"description":316,"extension":317,"meta":318,"navigation":319,"path":320,"seo":321,"stem":322,"__hash__":323},"docs\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Findex.md","Cognet Folder",{"type":7,"value":8,"toc":311},"minimark",[9,13,17,121,132,137,140,153,168,171,175,181,194,231,238,246,250,268,278,281,296,307],[10,11,5],"h1",{"id":12},"cognet-folder",[14,15,16],"p",{},"A cognet is a folder. Everything Axon needs to compile, type-check, and load a brain\nlives here.",[18,19,24],"pre",{"className":20,"code":21,"language":22,"meta":23,"style":23},"language-bash shiki shiki-themes dark-plus","my-cognet\u002F\n├── .cognet\u002F           # generated globals.d.ts + tsconfig — commit, don't edit\n├── plugins\u002F           # lifecycle hooks: boot, wake, tick, shutdown\n├── src\u002F\n│   ├── main.ts        # the brain — declares loop()\n│   └── state.ts       # resident memory, shaped however you like\n├── cognet.config.ts   # identity and ABI version\n└── package.json       # name, version, npm deps\n","bash","",[25,26,27,36,50,61,69,84,98,109],"code",{"__ignoreMap":23},[28,29,32],"span",{"class":30,"line":31},"line",1,[28,33,35],{"class":34},"sCudf","my-cognet\u002F\n",[28,37,39,42,46],{"class":30,"line":38},2,[28,40,41],{"class":34},"├──",[28,43,45],{"class":44},"sKc5r"," .cognet\u002F",[28,47,49],{"class":48},"sOLPB","           # generated globals.d.ts + tsconfig — commit, don't edit\n",[28,51,53,55,58],{"class":30,"line":52},3,[28,54,41],{"class":34},[28,56,57],{"class":44}," plugins\u002F",[28,59,60],{"class":48},"           # lifecycle hooks: boot, wake, tick, shutdown\n",[28,62,64,66],{"class":30,"line":63},4,[28,65,41],{"class":34},[28,67,68],{"class":44}," src\u002F\n",[28,70,72,75,78,81],{"class":30,"line":71},5,[28,73,74],{"class":34},"│",[28,76,77],{"class":44},"   ├──",[28,79,80],{"class":44}," main.ts",[28,82,83],{"class":48},"        # the brain — declares loop()\n",[28,85,87,89,92,95],{"class":30,"line":86},6,[28,88,74],{"class":34},[28,90,91],{"class":44},"   └──",[28,93,94],{"class":44}," state.ts",[28,96,97],{"class":48},"       # resident memory, shaped however you like\n",[28,99,101,103,106],{"class":30,"line":100},7,[28,102,41],{"class":34},[28,104,105],{"class":44}," cognet.config.ts",[28,107,108],{"class":48},"   # identity and ABI version\n",[28,110,112,115,118],{"class":30,"line":111},8,[28,113,114],{"class":34},"└──",[28,116,117],{"class":44}," package.json",[28,119,120],{"class":48},"       # name, version, npm deps\n",[14,122,123,124,127,128,131],{},"Two files are required: ",[25,125,126],{},"cognet.config.ts"," and ",[25,129,130],{},"src\u002Fmain.ts",". Everything else is\noptional.",[133,134,136],"h2",{"id":135},"the-split","The split",[14,138,139],{},"Identity and behaviour never live in the same file.",[14,141,142,147,148,152],{},[143,144,145],"strong",{},[25,146,126],{}," declares what this cognet ",[149,150,151],"em",{},"is"," — name, version, the kernel ABI it\ntargets, how it wants to be woken. Pure data, no logic.",[14,154,155,159,160,163,164,167],{},[143,156,157],{},[25,158,130],{}," is what it ",[149,161,162],{},"does",". A raw script that runs once at load and declares\nexactly one ",[25,165,166],{},"loop()",".",[14,169,170],{},"The compile step composes the two into the artifact the kernel loads. That's why neither\nfile contains lifecycle boilerplate: the desugaring happens in the build, and there is no\nside channel around it.",[133,172,174],{"id":173},"what-the-compile-step-does","What the compile step does",[14,176,177,180],{},[25,178,179],{},"axon prepare"," on an agent that selects your cognet:",[18,182,184],{"className":20,"code":183,"language":22,"meta":23,"style":23},"axon prepare\n",[25,185,186],{"__ignoreMap":23},[28,187,188,191],{"class":30,"line":31},[28,189,190],{"class":34},"axon",[28,192,193],{"class":44}," prepare\n",[195,196,197,204,210,219,225],"ol",{},[198,199,200,203],"li",{},[143,201,202],{},"Installs"," the cognet from the registry, like any other dependency.",[198,205,206,209],{},[143,207,208],{},"Checks the ABI"," it declares against the kernel this Axon provides. A mismatch fails\nhere, naming both versions — never at agent boot.",[198,211,212,218],{},[143,213,214,215],{},"Wraps ",[25,216,217],{},"main.ts"," — hoists its imports out, defers its body into a callable.",[198,220,221,224],{},[143,222,223],{},"Generates an entry"," that imports the host first (so the ambient globals exist before\nyour code evaluates), then composes host + config + main.",[198,226,227,230],{},[143,228,229],{},"Bundles"," the result into one self-contained ESM file with a manifest.",[14,232,233,234,237],{},"The output lands in the agent's ",[25,235,236],{},".agent\u002Fcognet\u002F",", not in your cognet folder. Your source\ntree stays exactly as you wrote it.",[14,239,240,241,167],{},"Compilation happens on the machine that runs the agent, against the core runtime that\nmachine has. That's deliberate: a cognet is published as source, so it fuses to the\nkernel it will actually run against rather than one frozen at publish time. See\n",[242,243,245],"a",{"href":244},"\u002Fdocs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fpublishing","Publishing",[133,247,249],{"id":248},"scaffolding-one","Scaffolding one",[18,251,253],{"className":20,"code":252,"language":22,"meta":23,"style":23},"axon cognet init my-cognet\n",[25,254,255],{"__ignoreMap":23},[28,256,257,259,262,265],{"class":30,"line":31},[28,258,190],{"class":34},[28,260,261],{"class":44}," cognet",[28,263,264],{"class":44}," init",[28,266,267],{"class":44}," my-cognet\n",[14,269,270,271,274,275,277],{},"Writes the folder, generates the ",[25,272,273],{},".cognet"," frame, and leaves you with a ",[25,276,217],{}," that\ndeclares an empty loop with the three phases stubbed out.",[14,279,280],{},"To start from a working brain instead, clone the reference cognet:",[18,282,284],{"className":20,"code":283,"language":22,"meta":23,"style":23},"axon clone @axon\u002Fzero\n",[25,285,286],{"__ignoreMap":23},[28,287,288,290,293],{"class":30,"line":31},[28,289,190],{"class":34},[28,291,292],{"class":44}," clone",[28,294,295],{"class":44}," @axon\u002Fzero\n",[14,297,298,299,302,303,167],{},"That gives you ",[25,300,301],{},"zero"," — the default cognet every agent runs unless it selects another —\nas an editable project. See ",[242,304,306],{"href":305},"\u002Fdocs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fzero","Anatomy of zero",[308,309,310],"style",{},"html pre.shiki code .sCudf, html code.shiki .sCudf{--shiki-default:#DCDCAA}html pre.shiki code .sKc5r, html code.shiki .sKc5r{--shiki-default:#CE9178}html pre.shiki code .sOLPB, html code.shiki .sOLPB{--shiki-default:#6A9955}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":23,"searchDepth":38,"depth":38,"links":312},[313,314,315],{"id":135,"depth":38,"text":136},{"id":173,"depth":38,"text":174},{"id":248,"depth":38,"text":249},"The files that make up a cognet, and what each one owns.","md",{},true,"\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder",{"title":5,"description":316},"docs\u002Fv2\u002Fcognets\u002Ffolder\u002Findex","KyNyJI3Tm0Ay2u8suFTD0AmGdqbKJBFvert4HfGzIEk",1785156432127]