[{"data":1,"prerenderedAt":305},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Fsrc":3},{"id":4,"title":5,"body":6,"description":297,"extension":298,"meta":299,"navigation":300,"path":301,"seo":302,"stem":303,"__hash__":304},"docs\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Fsrc.md","src",{"type":7,"value":8,"toc":292},"minimark",[9,12,57,67,72,82,153,156,160,167,193,200,204,207,266,272,288],[10,11,5],"h1",{"id":5},[13,14,19],"pre",{"className":15,"code":16,"language":17,"meta":18,"style":18},"language-bash shiki shiki-themes dark-plus","src\u002F\n├── main.ts      # required — declares loop()\n└── state.ts     # convention — resident memory\n","bash","",[20,21,22,31,45],"code",{"__ignoreMap":18},[23,24,27],"span",{"class":25,"line":26},"line",1,[23,28,30],{"class":29},"sCudf","src\u002F\n",[23,32,34,37,41],{"class":25,"line":33},2,[23,35,36],{"class":29},"├──",[23,38,40],{"class":39},"sKc5r"," main.ts",[23,42,44],{"class":43},"sOLPB","      # required — declares loop()\n",[23,46,48,51,54],{"class":25,"line":47},3,[23,49,50],{"class":29},"└──",[23,52,53],{"class":39}," state.ts",[23,55,56],{"class":43},"     # convention — resident memory\n",[58,59,60,63,64,66],"p",{},[20,61,62],{},"main.ts"," is the only file the compile step looks for. Everything else is ordinary\nTypeScript that ",[20,65,62],{}," imports, bundled into the artifact along with it.",[68,69,71],"h2",{"id":70},"what-gets-bundled","What gets bundled",[58,73,74,75,77,78,81],{},"The compile step follows the import graph from ",[20,76,62],{}," (and from ",[20,79,80],{},"plugins\u002F",") and inlines\neverything into one self-contained ESM file. So splitting the brain across files costs\nnothing at runtime:",[13,83,85],{"className":15,"code":84,"language":17,"meta":18,"style":18},"src\u002F\n├── main.ts\n├── state.ts\n├── render.ts        # context assembly\n├── parse.ts         # interpreting engine output\n└── strategy\u002F\n    ├── plan.ts\n    └── critique.ts\n",[20,86,87,91,98,105,116,127,135,144],{"__ignoreMap":18},[23,88,89],{"class":25,"line":26},[23,90,30],{"class":29},[23,92,93,95],{"class":25,"line":33},[23,94,36],{"class":29},[23,96,97],{"class":39}," main.ts\n",[23,99,100,102],{"class":25,"line":47},[23,101,36],{"class":29},[23,103,104],{"class":39}," state.ts\n",[23,106,108,110,113],{"class":25,"line":107},4,[23,109,36],{"class":29},[23,111,112],{"class":39}," render.ts",[23,114,115],{"class":43},"        # context assembly\n",[23,117,119,121,124],{"class":25,"line":118},5,[23,120,36],{"class":29},[23,122,123],{"class":39}," parse.ts",[23,125,126],{"class":43},"         # interpreting engine output\n",[23,128,130,132],{"class":25,"line":129},6,[23,131,50],{"class":29},[23,133,134],{"class":39}," strategy\u002F\n",[23,136,138,141],{"class":25,"line":137},7,[23,139,140],{"class":29},"    ├──",[23,142,143],{"class":39}," plan.ts\n",[23,145,147,150],{"class":25,"line":146},8,[23,148,149],{"class":29},"    └──",[23,151,152],{"class":39}," critique.ts\n",[58,154,155],{},"Normal imports, normal module scope, one copy of each module per brain.",[68,157,159],{"id":158},"a-note-on-dependencies","A note on dependencies",[58,161,162,163,166],{},"npm packages work — declare them in ",[20,164,165],{},"package.json"," and import them normally. They're\nbundled in with your source.",[58,168,169,170,174,175,178,179,182,183,186,187,192],{},"What does ",[171,172,173],"em",{},"not"," work is reaching for the environment. There is no ",[20,176,177],{},"node:fs",", no\n",[20,180,181],{},"node:net",", no ",[20,184,185],{},"process.env"," that means anything. A cognet that imports a package which\nopens a socket at import time will fail, and it should: the\n",[188,189,191],"a",{"href":190},"\u002Fdocs\u002Fv2\u002Fcognets\u002Fengine\u002Fkernel-contract","kernel contract"," is the only door to the\noutside, and it is a narrow one.",[58,194,195,196,199],{},"Pure computation is fine. A tokenizer, a math library, a parser, a data structure — all\nordinary dependencies. Anything that wants I\u002FO belongs on the other side of\n",[20,197,198],{},"kernel.run()",".",[68,201,203],{"id":202},"suggested-shape","Suggested shape",[58,205,206],{},"For anything beyond a trivial loop, the split that tends to hold:",[208,209,210,223],"table",{},[211,212,213],"thead",{},[214,215,216,220],"tr",{},[217,218,219],"th",{},"File",[217,221,222],{},"Owns",[224,225,226,236,246,256],"tbody",{},[214,227,228,233],{},[229,230,231],"td",{},[20,232,62],{},[229,234,235],{},"the pipeline — which phases run, in what order, under what conditions",[214,237,238,243],{},[229,239,240],{},[20,241,242],{},"state.ts",[229,244,245],{},"the resident model",[214,247,248,253],{},[229,249,250],{},[20,251,252],{},"render.ts",[229,254,255],{},"turning the model into whatever the engine consumes",[214,257,258,263],{},[229,259,260],{},[20,261,262],{},"parse.ts",[229,264,265],{},"turning engine output back into decisions",[58,267,268,269,271],{},"That keeps ",[20,270,62],{}," readable as a description of how the brain thinks, which is the file\nsomeone reads first when they clone your cognet.",[58,273,274,277,278,280,281,283,284,199],{},[20,275,276],{},"zero"," uses ",[20,279,62],{}," + ",[20,282,242],{}," and puts its grammar in a shared library, because its\nrender step is a call into the AIR format rather than bespoke logic. See\n",[188,285,287],{"href":286},"\u002Fdocs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fzero","Anatomy of zero",[289,290,291],"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":18,"searchDepth":33,"depth":33,"links":293},[294,295,296],{"id":70,"depth":33,"text":71},{"id":158,"depth":33,"text":159},{"id":202,"depth":33,"text":203},"The brain's source tree — one required file, the rest is yours.","md",{},true,"\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Fsrc",{"title":5,"description":297},"docs\u002Fv2\u002Fcognets\u002Ffolder\u002Fsrc","fPYDWZQ7BTpMkhmV5iwDFacir0hK5g5AHmz-i2gWBGU",1785156432102]