[{"data":1,"prerenderedAt":541},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fpublishing":3},{"id":4,"title":5,"body":6,"description":533,"extension":534,"meta":535,"navigation":536,"path":537,"seo":538,"stem":539,"__hash__":540},"docs\u002Fdocs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fpublishing.md","Publishing",{"type":7,"value":8,"toc":524},"minimark",[9,13,17,40,47,52,59,62,69,72,82,88,92,95,141,144,159,163,170,173,210,213,217,220,242,254,261,265,268,298,305,310,395,398,404,408,415,442,455,460,464,467,477,502,508,514,520],[10,11,5],"h1",{"id":12},"publishing",[14,15,16],"p",{},"Cognets are first-class registry artifacts. Same namespace as agents and modules, same\nversioning, same install path.",[18,19,24],"pre",{"className":20,"code":21,"language":22,"meta":23,"style":23},"language-bash shiki shiki-themes dark-plus","axon publish\n","bash","",[25,26,27],"code",{"__ignoreMap":23},[28,29,32,36],"span",{"class":30,"line":31},"line",1,[28,33,35],{"class":34},"sCudf","axon",[28,37,39],{"class":38},"sKc5r"," publish\n",[14,41,42,43,46],{},"Run it from the cognet root. It bundles the source, registers the name, uploads the\nversion, and syncs visibility from ",[25,44,45],{},"package.json",".",[48,49,51],"h2",{"id":50},"what-ships","What ships",[14,53,54,58],{},[55,56,57],"strong",{},"Source."," Not a compiled artifact.",[14,60,61],{},"That's a deliberate decision with a real consequence. A compiled cognet inlines the core\nruntime it was built against — the bundle contains a copy of the kernel-side machinery it\ntalks to. Publishing that would pin every consumer to whatever core version your machine\nhappened to have at publish time.",[14,63,64,65,68],{},"Instead, the consumer compiles. ",[25,66,67],{},"axon prepare"," on their agent installs your source and\nfuses it to the kernel it will actually run against. A cognet is always compiled for the\nruntime it executes on.",[14,70,71],{},"Two more things follow from that:",[14,73,74,77,78,81],{},[55,75,76],{},"Your cognet is readable."," People clone it, read it, and fork it. For a layer this low,\nthat's the point — ",[25,79,80],{},"@axon\u002Fzero"," exists to be cloned.",[14,83,84,87],{},[55,85,86],{},"Core changes invalidate every bundle."," The compile step's cache key includes the core\nsource tree, so a kernel change rebuilds every agent's cognet automatically. No stale\nfusion.",[48,89,91],{"id":90},"identity","Identity",[14,93,94],{},"Scoped names only:",[18,96,100],{"className":97,"code":98,"language":99,"meta":23,"style":23},"language-json shiki shiki-themes dark-plus","{\n  \"name\": \"@you\u002Fmy-cognet\",\n  \"version\": \"0.1.0\"\n}\n","json",[25,101,102,108,124,135],{"__ignoreMap":23},[28,103,104],{"class":30,"line":31},[28,105,107],{"class":106},"sTNBD","{\n",[28,109,111,115,118,121],{"class":30,"line":110},2,[28,112,114],{"class":113},"s3F5K","  \"name\"",[28,116,117],{"class":106},": ",[28,119,120],{"class":38},"\"@you\u002Fmy-cognet\"",[28,122,123],{"class":106},",\n",[28,125,127,130,132],{"class":30,"line":126},3,[28,128,129],{"class":113},"  \"version\"",[28,131,117],{"class":106},[28,133,134],{"class":38},"\"0.1.0\"\n",[28,136,138],{"class":30,"line":137},4,[28,139,140],{"class":106},"}\n",[14,142,143],{},"The registry refuses the flat global namespace. The scope must be one you own — your\nusername, or an org you belong to.",[14,145,146,147,150,151,154,155,158],{},"Names are unique ",[55,148,149],{},"across every kind",". If ",[25,152,153],{},"@you\u002Fthing"," is a module, it cannot also be a\ncognet. One name, one artifact — which is why ",[25,156,157],{},"axon clone @you\u002Fthing"," needs no flag to\nsay what it's fetching.",[48,160,162],{"id":161},"versions-are-immutable","Versions are immutable",[14,164,165,166,169],{},"A published version can never be replaced. Bump before republishing — or let the CLI do\nit: on a collision ",[25,167,168],{},"axon publish"," patches the version, rebuilds so the tarball and\nregistry metadata agree, and retries.",[14,171,172],{},"Consumers pin with ordinary semver:",[18,174,178],{"className":175,"code":176,"language":177,"meta":23,"style":23},"language-ts shiki shiki-themes dark-plus","export default defineAgent({\n    cognet: \"@you\u002Fmy-cognet@^0.2.0\",\n})\n","ts",[25,179,180,195,205],{"__ignoreMap":23},[28,181,182,186,189,192],{"class":30,"line":31},[28,183,185],{"class":184},"sYbnZ","export",[28,187,188],{"class":184}," default",[28,190,191],{"class":34}," defineAgent",[28,193,194],{"class":106},"({\n",[28,196,197,200,203],{"class":30,"line":110},[28,198,199],{"class":113},"    cognet:",[28,201,202],{"class":38}," \"@you\u002Fmy-cognet@^0.2.0\"",[28,204,123],{"class":106},[28,206,207],{"class":30,"line":126},[28,208,209],{"class":106},"})\n",[14,211,212],{},"Bun resolves and locks it like any other dependency. An unconstrained install leaves an\nexisting pin alone — only an explicit constraint moves it.",[48,214,216],{"id":215},"visibility","Visibility",[14,218,219],{},"npm convention, and the only visibility contract:",[18,221,223],{"className":97,"code":222,"language":99,"meta":23,"style":23},"{ \"private\": true }\n",[25,224,225],{"__ignoreMap":23},[28,226,227,230,233,235,239],{"class":30,"line":31},[28,228,229],{"class":106},"{ ",[28,231,232],{"class":113},"\"private\"",[28,234,117],{"class":106},[28,236,238],{"class":237},"scz_3","true",[28,240,241],{"class":106}," }\n",[14,243,244,246,247,250,251,253],{},[25,245,238],{}," keeps it private. Absent or ",[25,248,249],{},"false"," publishes publicly. Every ",[25,252,168],{}," syncs\nthis, so the file stays the source of truth.",[14,255,256,257,260],{},"There is no unpublish. ",[25,258,259],{},"private: true"," is the kill switch: existing installs keep\nresolving, nothing new can find it.",[48,262,264],{"id":263},"abi-compatibility","ABI compatibility",[14,266,267],{},"The one thing that makes cognet publishing different from module publishing.",[18,269,271],{"className":175,"code":270,"language":177,"meta":23,"style":23},"export default defineCognet({\n    abi: \"9\",\n})\n",[25,272,273,284,294],{"__ignoreMap":23},[28,274,275,277,279,282],{"class":30,"line":31},[28,276,185],{"class":184},[28,278,188],{"class":184},[28,280,281],{"class":34}," defineCognet",[28,283,194],{"class":106},[28,285,286,289,292],{"class":30,"line":110},[28,287,288],{"class":113},"    abi:",[28,290,291],{"class":38}," \"9\"",[28,293,123],{"class":106},[28,295,296],{"class":30,"line":126},[28,297,209],{"class":106},[14,299,300,301,304],{},"Cognets version independently of the CLI now, so an agent can pin ",[25,302,303],{},"@you\u002Fmy-cognet@0.1.0","\nwhile its Axon moves forward. When the kernel ABI changes, an old cognet is genuinely\nincompatible — not degraded, incompatible.",[14,306,307,309],{},[25,308,67],{}," checks the declared ABI against the kernel the installed Axon provides and\nfails there, naming both versions:",[18,311,313],{"className":20,"code":312,"language":22,"meta":23,"style":23},"COGNET_ABI_MISMATCH: cognet \"@you\u002Fmy-cognet\" targets kernel ABI 8,\nbut this Axon provides ABI 9 — install a cognet version built for\nABI 9, or update Axon\n",[25,314,315,338,378],{"__ignoreMap":23},[28,316,317,320,323,326,329,332,335],{"class":30,"line":31},[28,318,319],{"class":34},"COGNET_ABI_MISMATCH:",[28,321,322],{"class":38}," cognet",[28,324,325],{"class":38}," \"@you\u002Fmy-cognet\"",[28,327,328],{"class":38}," targets",[28,330,331],{"class":38}," kernel",[28,333,334],{"class":38}," ABI",[28,336,337],{"class":38}," 8,\n",[28,339,340,343,346,349,352,354,358,361,364,367,369,372,375],{"class":30,"line":110},[28,341,342],{"class":34},"but",[28,344,345],{"class":38}," this",[28,347,348],{"class":38}," Axon",[28,350,351],{"class":38}," provides",[28,353,334],{"class":38},[28,355,357],{"class":356},"sDGX8"," 9",[28,359,360],{"class":38}," —",[28,362,363],{"class":38}," install",[28,365,366],{"class":38}," a",[28,368,322],{"class":38},[28,370,371],{"class":38}," version",[28,373,374],{"class":38}," built",[28,376,377],{"class":38}," for\n",[28,379,380,383,386,389,392],{"class":30,"line":126},[28,381,382],{"class":34},"ABI",[28,384,385],{"class":38}," 9,",[28,387,388],{"class":38}," or",[28,390,391],{"class":38}," update",[28,393,394],{"class":38}," Axon\n",[14,396,397],{},"At prepare time, with both numbers and the file to edit. Never at agent boot, from inside\na compiled bundle.",[14,399,400,403],{},[55,401,402],{},"When the ABI changes, publish a new major."," Consumers on the old ABI keep resolving the\nold version; consumers on the new runtime pin the new one. Same discipline as any breaking\nchange, with the difference that the mismatch is mechanically detected rather than\ndiscovered in production.",[48,405,407],{"id":406},"being-selected","Being selected",[14,409,410,411,414],{},"An agent picks its cognet in ",[25,412,413],{},"axon.config.ts",":",[18,416,418],{"className":175,"code":417,"language":177,"meta":23,"style":23},"export default defineAgent({\n    cognet: \"@you\u002Fmy-cognet\",\n})\n",[25,419,420,430,438],{"__ignoreMap":23},[28,421,422,424,426,428],{"class":30,"line":31},[28,423,185],{"class":184},[28,425,188],{"class":184},[28,427,191],{"class":34},[28,429,194],{"class":106},[28,431,432,434,436],{"class":30,"line":110},[28,433,199],{"class":113},[28,435,325],{"class":38},[28,437,123],{"class":106},[28,439,440],{"class":30,"line":126},[28,441,209],{"class":106},[14,443,444,445,447,448,451,452,46],{},"At ",[25,446,67],{}," that becomes a package.json dependency, resolves through the registry,\ninstalls into ",[25,449,450],{},"node_modules",", gets ABI-checked, and compiles into the agent's\n",[25,453,454],{},".agent\u002Fcognet\u002F",[14,456,457,458,46],{},"Exactly one per agent — an agent has one brain. Omitting the field selects ",[25,459,80],{},[48,461,463],{"id":462},"before-you-publish","Before you publish",[14,465,466],{},"A short list worth running through:",[14,468,469,476],{},[55,470,471,472,475],{},"Does ",[25,473,474],{},"axon cognet prepare"," pass?"," It regenerates the frame and type-checks the source.",[14,478,479,489,490,493,494,497,498,501],{},[55,480,481,482,485,486,488],{},"Is ",[25,483,484],{},"files"," right in ",[25,487,45],{},"?"," Ship ",[25,491,492],{},"cognet.config.ts",", ",[25,495,496],{},"src",", and ",[25,499,500],{},"plugins",".\nLeave out tests and scratch.",[14,503,504,507],{},[55,505,506],{},"Does it survive a cold start?"," Kill the agent mid-wake and restart it. If your cognet\nneeds a graceful shutdown to be correct, the state that mattered was in RAM when it should\nhave been in the log.",[14,509,510,513],{},[55,511,512],{},"Do the phase names read well?"," They're your trace. Someone debugging your cognet reads\nthose names before they read your code.",[14,515,516,519],{},[55,517,518],{},"Is the README worth reading?"," It renders on the registry page. A cognet is a strategy,\nand the useful thing to document is what strategy it implements and when someone would\nwant it.",[521,522,523],"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 .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);}html pre.shiki code .sTNBD, html code.shiki .sTNBD{--shiki-default:#D4D4D4}html pre.shiki code .s3F5K, html code.shiki .s3F5K{--shiki-default:#9CDCFE}html pre.shiki code .sYbnZ, html code.shiki .sYbnZ{--shiki-default:#C586C0}html pre.shiki code .scz_3, html code.shiki .scz_3{--shiki-default:#569CD6}html pre.shiki code .sDGX8, html code.shiki .sDGX8{--shiki-default:#B5CEA8}",{"title":23,"searchDepth":110,"depth":110,"links":525},[526,527,528,529,530,531,532],{"id":50,"depth":110,"text":51},{"id":90,"depth":110,"text":91},{"id":161,"depth":110,"text":162},{"id":215,"depth":110,"text":216},{"id":263,"depth":110,"text":264},{"id":406,"depth":110,"text":407},{"id":462,"depth":110,"text":463},"Ship a cognet to the registry — source, versions, and ABI compatibility.","md",{},true,"\u002Fdocs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fpublishing",{"title":5,"description":533},"docs\u002Fv2\u002Fcognets\u002Fbuilding\u002Fpublishing","Fqft6UdHa8ADf6IDTdcIQuc3_tNRvYGI7eR7laf-0kc",1785156432034]