@codrihub/memora 2.1.10 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/app.js +11 -2
- package/assets/index.html +2 -2
- package/assets/mnemo-docs.json +1 -1
- package/assets/sw.js +2 -2
- package/package.json +4 -4
package/assets/app.js
CHANGED
|
@@ -4899,7 +4899,7 @@ ${t} .cn-prog .done .n{background:var(--tile);border-color:transparent;color:var
|
|
|
4899
4899
|
<div class="vx-main">
|
|
4900
4900
|
<div class="vx-pane vx-pane-list" aria-label="Folder"></div>
|
|
4901
4901
|
<div class="vx-pane vx-pane-note" aria-label="Note"></div>
|
|
4902
|
-
</div>`,t.appendChild(nn),hE=new sE(nn.querySelector(".vx-pane-tree"),{showNotes:Ve.showNotesInTree,showPins:!0}),Da(nn.querySelector(".vx-pane-tree")),a$(nn),nn.addEventListener("keydown",e=>{if(e.key==="F6"){e.preventDefault();const n=nn?.querySelector(".vx-pane-tree"),i=!!n?.contains(document.activeElement)||nn?.classList.contains("no-tree")?N.note?Mc():Em():n;(i?.querySelector('[tabindex="0"],button,input,textarea')||i)?.focus()}})}function a$(t){t.querySelectorAll(".vx-resizer").forEach(e=>{const n=a=>{Ve.treeW=Math.round(Math.max(190,Math.min(460,a))),t.style.setProperty("--tree-w",Ve.treeW+"px")};e.onpointerdown=a=>{a.preventDefault(),e.setPointerCapture(a.pointerId);const i=a.clientX,o=Ve.treeW;t.classList.add("resizing"),e.onpointermove=s=>n(o+s.clientX-i),e.onpointerup=()=>{e.onpointermove=null,t.classList.remove("resizing"),ja()}},e.onkeydown=a=>{(a.key==="ArrowLeft"||a.key==="ArrowRight")&&(a.preventDefault(),n(Ve.treeW+(a.key==="ArrowLeft"?-16:16)),ja())}})}function Yr(){const t=Em();t&&In(t,py())}async function Ac(t=!1){const e=Mc();if(e){if(!N.note&&kc){Sc("note"),e.innerHTML=_s(me.note,"Note not found",`“${x(lt(kc))}” may have been moved, renamed or deleted. Deleted notes wait in the Trash.`,'<span><button class="btn sm primary" data-home>Show all notes</button> <button class="btn sm ghost" data-trash>Open Trash</button></span>').replace("vx-empty","vx-empty vx-missing"),e.querySelector("[data-trash]").onclick=()=>nt.openTrash(),e.querySelector("[data-home]").onclick=()=>{kc=null,Jp("")};return}if(!N.note){Sc("list");return}Sc("note"),await Us(e,N.note,py(),t)}}function Kp(){const t=H(".crumb");t.textContent=N.note?lt(N.note):Ve.folder?"Notes / "+Ve.folder:"Notes"}function hy(){if(!nn)return;const t=nn.querySelector(".vx-pane-tree"),e=Array.from(document.querySelectorAll(".vx-treehost")).some(n=>n!==t&&n.isConnected&&!nn.contains(n));nn.classList.toggle("no-tree",e||py())}async function uy(){qx();const t=H("#view-vault");if(t.classList){if(!nn||!t.contains(nn)){n$(t),Ve.folder&&!$l(Ve.folder)&&(Ve.folder=""),hy(),Sc(N.note?"note":"list"),hE?.render(),Yr(),await Ac(),Kp();return}Ve.folder&&!$l(Ve.folder)&&(Ve.folder=""),hy(),Qa(),Yr(),(N.note!==sO()||!N.note)&&await Ac(!0),Kp()}}function fE(t){return en().some(e=>e.path===t)}async function Zp(t){if(!fE(t)&&!Object.keys(N.tree).length)try{await te.loadCore()}catch{}await gE(t)}function mE(t,e){if(location.pathname+location.search===t)return;const a=e?.vxDepth||0;try{history.replaceState({...history.state||{},vxDepth:a+1},"")}catch{}}function i$(){if((history.state?.vxDepth||0)>0){history.back();return}Jp(N.note?Be(N.note):Ve.folder||"")}async function gE(t,e=!1){await xc();const n=location.pathname+location.search,a=history.state;if(!fE(t)){if(Hr())return;kc=t,N.note=null,N.editing=!1,N.page!=="vault"?te.go("vault"):(Ac(),Kp());return}kc=null,N.note=t,N.editing=!1,Je.clear(),Fi(Be(t),Ve.folder||"")||(Ve.folder=Be(t),G0(),ja());let i=Be(t);for(;i;)hn.add(i),i=Be(i);if(Po(),N.page!=="vault"){te.go("vault"),mE(n,a),te.refreshTree(),e&&setTimeout(()=>Mc()?.querySelector("[data-mode=edit]")?.click(),400);return}mE(n,a),Sc("note"),Qa(),Yr(),await Ac(),e&&Mc()?.querySelector("[data-mode=edit]")?.click(),Kp(),te.refreshTree(),Mc()?.querySelector(".vx-note-scroll")?.scrollTo(0,0)}function Jp(t){kc=null,xc().then(()=>{const e=(Ve.folder||"")!==t;if(Ve.folder=t,ja(),G0(),Je.clear(),N.note=null,N.editing=!1,Sc("list"),N.page!=="vault"){te.go("vault");return}Qa(),Yr(),e&&Em()?.querySelector(".vx-bscroll")?.scrollTo(0,0),Ac(),Kp()})}function o$(){Ve.filter="all",RD(),Jp("")}nt.selectFolder=Jp,nt.allNotes=o$,nt.openNote=t=>{Zp(t)},nt.newNote=t=>{const e=As(),n=t&&t!=="Root"&&e.includes(t)?t:"";let a=null;const i=async o=>{const s=o.querySelector("#vxName"),r=s?.value.trim()||"";if(!r){s?.focus();return}const l=a?.value??"";de.close();const c=await iT(l,r);c&&await gE(c,!0)};de.open({title:"New note",body:de.field("Title","vxName",{value:""})+'<div class="field"><label id="vxWhereL">Location</label><div id="vxWhere"></div></div>',actions:[{label:"Cancel",cls:"ghost",run:()=>de.close()},{label:"Create",cls:"primary",run:i}],onOpen:o=>{a=Uf({folders:e,value:n,label:"Location",onPick:()=>{i(o)}}),o.querySelector("#vxWhere")?.appendChild(a.el);const s=o.querySelector("#vxName");s?.focus(),s&&(s.onkeydown=r=>{r.key==="Enter"&&(r.preventDefault(),i(o))})}})},nt.newFolder=t=>{eb(t?`New folder in ${t}`:"New folder","Folder name","",async e=>{const n=await N8(t,e);n&&Jp(n)})},tT(()=>{N.page==="vault"&&nn?uy():Qa()}),IS(()=>{N.page==="vault"&&nn&&Yr()});let vE=0;nP(()=>{clearTimeout(vE),vE=window.setTimeout(()=>{Qa(),N.page==="vault"&&nn&&!N.editing&&Yr()},250)}),document.addEventListener("vx-back",()=>i$()),window.matchMedia(uE).addEventListener?.("change",()=>{N.page==="vault"&&nn&&(hy(),Yr(),Ac(!0))});function s$(){nt.newNote("")}function r$(){nt.newFolder("")}function l$(t){Wr([t])}function c$(t){$0(t)}function d$(t){Lp(t)}function p$(t){U0(t)}const xE="Memora by Codrihub Tech",fy="Second brain for your AI",bE="A self-hosted memory vault: your notes as plain Markdown, wired into a living brain that your AI agents read and write over MCP. What they learn stays.",h$="Set up once, use everywhere: connect each agent once and they all share the same memory, on your local network or over the internet.",yE="Memora is memory, advanced: built to remember what you and your AI learn, and to remember more the more you use it.",u$={bg:"#0b0f17",bgTop:"#17202e",accent:"#5eead4",cyan:"#22d3ee",coreLight:"#a5f3fc"},f$="M7.2 16.8V7.4l4.8 5.1 4.8-5.1v9.4",m$=[[7.2,16.8],[7.2,7.4],[16.8,7.4],[16.8,16.8]],_m=[12,12.5];let g$=0;const my=typeof document>"u"?"s":"r";function v$(t){const{bg:e,bgTop:n,accent:a,cyan:i,coreLight:o}=u$,s=++g$,r=`mmg${my}${s}`,l=`mmt${my}${s}`,c=`mmc${my}${s}`,d=m$.map(([p,h])=>`<circle cx="${p}" cy="${h}" r="1.7" fill="${p<12?a:i}"/>`).join("");return`<defs><linearGradient id="${r}" x1="3" y1="3" x2="21" y2="21" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="${a}"/><stop offset="1" stop-color="${i}"/></linearGradient><linearGradient id="${l}" x1="0" y1="0" x2="0" y2="24" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="${n}"/><stop offset="1" stop-color="${e}"/></linearGradient><radialGradient id="${c}" cx="50%" cy="50%" r="50%"><stop offset="0" stop-color="#ffffff"/><stop offset=".55" stop-color="${o}"/><stop offset="1" stop-color="${i}"/></radialGradient></defs><g fill="none" stroke="none"><rect x="1.5" y="1.5" width="21" height="21" rx="6.2" fill="url(#${l})"/><rect x="1.5" y="1.5" width="21" height="21" rx="6.2" fill="none" stroke="url(#${r})" stroke-opacity=".55" stroke-width=".8"/><path d="${f$}" fill="none" stroke="url(#${r})" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/>`+d+`<circle cx="${_m[0]}" cy="${_m[1]}" r="3" fill="${i}" opacity=".22"/><circle cx="${_m[0]}" cy="${_m[1]}" r="2" fill="url(#${c})"/></g>`}function to(t="brand-mark"){return`<svg class="${t}" viewBox="0 0 24 24" aria-hidden="true">${v$()}</svg>`}const Qp="'Memora Script', 'Segoe Script', cursive",wE="@font-face{font-family:'Memora Script';font-style:normal;font-weight:700;font-display:block;src:url(data:font/woff2;base64,d09GMgABAAAAAA/sABAAAAAAHHwAAA+QAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjYbhwYcgk4GYD9TVEFUKgCBJBEICqMAnUsBNgIkA3ALOgAEIAWEVgcgDAcbcRijopyyciP4iwQOrxo/YUJJ0KGxLYMtMChiyWS84W/ql0UgbBZ6Di4wnBshySzP83/v5z73TelUewLYrDUcDki+zwpojAYT8WhpwME5w9Op/y7xBWpyiS9GoS1CmaYptJoj1Indp4sPuxPXFFgU4UiGMoyq87T9ziPxIzsBL2e31mxqv+oBPZDTdX5t1h5CCSG96Pf/2y+1czMbJldkoYKqKkLXmN35CwOfdif08ouMQjZClVgBudbVqBrfUynqfY1QtTVkJ/C41laa+xiZm7oMAOl1MkS2QwUalm4sgDWd5YHBXskEmXTfVZ5vWqHigHkezEsA+qx+qAfQ4QAaA2/xsXmgB5CwhIOhQzHgnDJ8zOsXKeRI6vMy+BLyAowuInzYAlIR1N7RezDB9hAABPzxx7/w3z7/sh2YmrBV4CrBpxWBEbHM5LokcjkwJ0qpJevSaGXRI8XILWNWxIqXsYvgZGQKc4jV7pwS5JWQK4K+TEeshFQCtQZ2L8AP24apBVsRbgURKhYYj+ORK4PronDyKNnQwUEGDwxkPpvvGl4CAHzBsE8RdjENeviggTYGeKONGZqYoclOxd3hg8H7N2FiATggr6EBQEED6tTuvWeBsTPfDEBm9aRx4NKQIv4ene7+YwsecXCESTtPeXxQYGDhEJDtti0DC0cKKFRsDwiPadkArDjm1LxiihaRrj4JQBmPCBb+LApq7S1goyXkAGbh4R5j1xXermbTvPAc/kllAAWmZ/EECjLeXS5Dgf/aY01F1/GYqX6ueRin4tijMUFLbEtcS/wAAfFN+jXANGtvrQeOWW9jF8gY8Rncz6O6CLnvOwwncLyjUUbqlkRMeWb1DM4XFtvRAIuKB4Wv4MNgz0DAaZ5wjbBg91iSDSkB/loIO+TE9Rlw+XTc16p5fB4l99140PkAHJ45/L074j9pvxMcgZo77bljAJh7DTmqp+Y95lXAKSxIcgRsjnY8hLlpbRuCQJBEzZnD3L8wZkJ4WGSEs4UuQuHGv5eHT0C+QnEJzdp16zVg2NzGwC712v5c/d1bgV576bnHHrrvtqsuO++0I5DONAE1xlByqOihefeBBSla/H+2jU8YAAQoOeNiU9HLrBkMtYBo7NznPqDYMipzUqk6TxaVrg3KaQG6iJp0Uh2ZbliU2qZLc2jUUk77VYDFLYjRlC8+h29mGwqvqYmmZg7CvKUXMOkHzMsqKvv+AhgCiPmyeqBBbPVpyprE8URsVgpBnJiWU1a1A95wH4a4UJ88cQ1iaRiostfXkJ1yIhjHZUPtUaBxTdjcNK9Dztr6mLiZ+MKXsgn5XVUm6660NVS5uzzkuckbCuiJOAdWp1+kZx5L3xVEHRHbl+4VQPsYBqgsq9NKsSDAoMh8iGnQ0j5M7q3pJUl5Bx4GlyLWJX49XYRc25uI1xofr4fzZLOWBTEBa83pCG7pVFl1eRsL4vugxD7TGBpXldiKYqXZsiCPL9BpSoR9qWlZqpx3rct+dYyn1LMrJSnh+osJA48AYj7srZ1ragzCNLlFAvHo9YepKaMcFmMngeSFC4DqPD0arzcWMgZ12YrI8W1OoBhlCMWnKi3R1iORF8OI+FwM5j0heh39y9rAy2KZbm8yz1R25unJzGRq6hrCGCQMx6lFsmMPKMLwJhfclN2Ow825UI9u721f2gWLLRBSpHjmjuobhzg++cRmUvZyfMHMWt953KcMMRvJCjUtOLkEAeHeszVGK5OJzStP6HHNo0e5+46BnOFYtB9U8SGvUHjrYLY4+sWRyV9Z3/rHr6/s8jmjF6pYc+BjM8ZGF/UVSoRlj7pBFaQhdljPdbvJrH1Yoa0woRT5ED9VWcWFLrAdty0wPxLJnd2vZfAzk1de8KUlQNnD1MDcnI5MXX2Zkn0fUEI/Ea3kCtnRI7bqN6aD0FbGjqEfTeI4vzEmej++qjivawt0VZYPAbdUOV25mw/UFFH3tp+cUogVlKmrlBSxdUcuEzfbvPKE6PtCXDp12TmaRFkxeGLqmuiy6exrjrtKnY+59KHrtlZyeL8C2pCTeJlWJ1kWvfVLdBkGopxvlHXkwYYiV9Yet3Wo7P3IGGZgExZwRlG8f/9gDb83rxAR/T+7J6pkZ2xQBLR4EBvb9y60BVoYmxy+yPWF+KBjvDtnx5A+zEhc+9LNaWGNc+2aSGYprF5KP08IX+isecfO8tnLxh/tdc7rGxIHtlxVn9i8Mvbk0ubCCxFXls+WzY7azB6uWefSCue5oIJ+0aMXwzpvX8/BO2Oi9ImejyS7jw7PpE476yD1nzjNkQ9UakFT6Rk+/N//x3xjq7/12e2hWYuTLcxpHv0d3e04pR5Fk2K2aD6zz6j7nYP4AvoCtrS4oT3Dpo2HkYqOmz7iJ9ZExQ2F7nnFHE2PcSpSUTRXH5p4ANxk3qyQqT+30Hoosbmzd54713TbIU2JKPz3ELhmyYdFvEQK2yUwVXtKe/xrtFs8NnHyd1daR3Z5/ektCm99zzwveDXprnO4Ei6TutQfrLa1zlTm61NT6+qzPbmerAytKNjJoa/ZnO/wqaSLUPPT0oTZKEseDsHteZnNDinfs8GW3p5T3nj6iMrf2DPXDXDJAltH/Gr/b4G96R4ifI9l8PIjKjIi5X/7NweNjYZFKnWGqKPJQ1pBHtRnZa3wLfMMupLjE6Uc+tvLkPjkN5JNyFb6Mocwf1Wx8bkvrb2OX+VLb2V3Z851jmibji6rxyvZiagWKsdWQ1UGBo0eG237O3IgNwx+SmbV5aT3FuRbD5Rs6u1b5PbBrcqiD0mudnddd3SdcWfIJaqYdKbXefJ70tdItnglRK+VzZqn9ojD1byXuCK150WvViKNcnzEPHmL/UxiaVtFjxn8OYf/hrfE3ZTZnCGssl3lxiRWIeVgrjhpXqMbMPQ558vzW8/6iPicj4l3o4IKts1cl1JstkdcVr0/YC2RlDLD+L6fc+uCtTW1PzpXoy8MdonK7a6o05VVLHgk9868Dphk+j5Iwiu6jgSda12LbYNuH2jAF5NuRfymQVZM68d89vpnUSzznUp+I95sHS78Tz7/FaZ3RIangkVyikkpK04vDLmLtXrjPZWobAdfDqdMC8U78/RhJCBGEWRBhs8Z1KnwtpZcCkxvwrFok0x+MmhKKIa98YhFox+UYDDQYm86aAtnZgVn2OUr07f5N4QGZvqQlFyCGCk0VmSW+UP+rkJmsV7XJhGOyX3qkM4e06BbnBK6+wf8LIKSy9nx6bpwbjae4r4fn1FyYPkavgqi0pQCLpL4ZNW3Oq/U7ZJhsNCy5Y64tQn0pbu8bp9dXTMzWmDUGyJi8QmEc3VXqZQ0hyLosgTFBXLxywZNsTFUkLQvSNS2pAG/hNNwWiaXFacVh33FegNyiIXPGUp1UeTXBSrfDITzO1MUnVEwIouXW0es3ZbSY2wKoLHQqKM1a45jETovjb+EwitO9/ZYk76SfItG/4uS6bZ+6w96tGDQ6Pb7XSZTQyxZlWoRfq3TGD0RZzn6JJYE43Xv/CI2JCzR/M0zzycqWux117f9dzEipswmI8xf68AEj+0zW6RLXZvda/19M3x8bo1AxC8wVmQl/aHAY1+XCPAwPpUl9Zrdb+sUtf8iaMjNY/9H4Z3PCsd+rM8tidiNmtlS7sdvcPkehmDkP5H/weeR3l3TOr/UzaFBEESY5Yg7WkGhxHRNjTAC4jy17y6PKmHQPtH5pGE52sRTFPoMiR8UZZ316Y9zPk7h28XszVzuJICl2hoUee9dNutFGMkJmLx/XHfJT1WSyU6Bn+NF6Icp3KPuoowGFuXPBXhoklPMLV1sKKLT7Qx4uCz2uVEvUO+Q0TLaiowvZ0u074uFJAwb3sIQsQzhD3F/OhK+DOCRmWElyvHqj/GIKtfD9e4r3JSvOJzo/H9Ffjs38IXOaJWrNVVnbjAZB/vuieNhi5K24zhSlt23d0BeqEDG6ZxhPfcbcFugnpSLx17iI+9nJtNaqN++Za6L7mUJ/2NQz+Hxa7kwbv9fqGT/dg79S5ifI4nv6DeE4mUuEJMoLunFrJg49AON+PK5y1IPEpPhzHcYrKZ1Gt8PO5c8U03FGtZb+PQTTO7O3FD/N6WB0kKbRvL8PjyegoMHHgNWRHBJgcbv+hX/X3gr3/l1wGNkLzohE7Ij4uD/VEJbrW59ddoTHMYNFu+TZ8S83EL3eoT02lZGSlLeH95SWSAK0z7KicScs4TuGd0BdwrHV6gonHYbxgTwUn+6UroFT1uh+vIh5AdwPemLnLUY9gWrJqlu+GAvS2hiUeqJtBNEGHcAlkvmDdniseb/vCuYBk9JPBW0P+A8Bwvw/mKBqKC8qUirW1qyx1Jly9F+l1TRix+geKzuqjlfVnLEFSVLJExaO550mkDGXaDIJQtXptCEffP3vp2ibHeyONOi/lwhFnou8QXfGJ9VVDgKwjYH4dGsRz/GwB6B7HP6vwoh35n8ZORtred7F4ohM5cO2ksszeA5W67HnX+0Oz3D4/c7Tab6WLIqzSZ8Tqc2uiP2ctmTWCqJfZ0sT23yl6wxF3o9BVq96Dm93R/rsjyNg0nsk3+jxqQ9WrRIcj5R3Zx6486dD9fZhKQ2Cpf+SW1MtuecUyyizqGIH9qjoEBmualzqSoywh7neQ6eky6vx4kZHJZRpWB76Vr2X1z/1nV0HrOByCwj4s/iYdx+GJXOH+QwvoQR03/xFblZnpJ4uln9hUxyeD9fyNRfE8cO/W6jEY+fSHr7ae0dp2MZ1NbnNzk2Oa5up6QLOKD7xNmRQN5BuEomrw9g7gEuYJHILnJgmHaKRQL9DgIM3tv987fWMXJ+I2GxXwJ8Y0FUAPieXN2bLt59iWNg94AQYAAE+PkfTv9SRc2LlX07X3KYC0DmABg3AIzHAB3c6WDSTPtjM/uZbUA2xCAv90tlb83kT3v5pkpKp+V8D+/XOmNHwQxNG+kEIF8bp17Bb3X6H5T+6c+EnbbGucrj65pAg78ZBrcMXiucXmbMv23ZACxojgxAtgGYGwkRhzcSgxTHSKysZI3E0WRoJJ4w+0YQqHJ9IgiAtbxpcHRf6tOrz1wD2rVqMwTlYGOXBpUI0LyuX70ejVnVUwlVwgTS9CWqSKhXx4RpnCeP4VG1RTRgUIyOnob0HZTF2kWt2oHLhjWwaNSre5V69Q7LujRrOVRP9t5BVlrsm5Ce6fRmkxIqvkAN9jRgpK5qggrSEarATTerk1ekN69ggT3eq1eXJg4WNosty1agsL/ZgGydAzPBwVs1AzZJPtGgdiZHoXIPXdacMs0Ha7E6M+qYw/pfEpdvcRU=) format('woff2')}",ei=[{version:"2.1.10",title:"Every chat keeps its model",lead:"The default model is for new chats only, a fallback that takes over stays, and a divider shows each change of model.",groups:[{kind:"better",items:[{icon:"pin",title:"A chat keeps its model",text:"The model a chat began with, or the one you switched it to, stays with that chat. Changing the default only changes new chats."},{icon:"refresh",title:"Fallbacks you can see",text:"When a model fails and a fallback takes over, the chat switches to it and a divider says so. Every change of model is marked, even inside one reply."},{icon:"bolt",title:"Straight to the fallback",text:"A model out of quota, with its key refused or not found is skipped at once; a busy one gets one quick retry before the next model."},{icon:"brain",title:"Thinking level for more models",text:"A model that has shown its thinking gets the Think chip, whatever its name."},{icon:"send",title:"A calmer prompt",text:"The model and its memory ring sit under the prompt; inside it, just the thinking level and Send. The fleeting eye shows on new chats only."}]}]},{version:"2.1.9",title:"Chats in step everywhere, a queue that never sticks",lead:"Every device shows the same chat live, queued messages always go out, and Mnemo can fall back to another model or think harder when you ask.",groups:[{kind:"new",items:[{icon:"monitor",title:"Live on every device",text:"A message sent on your phone shows up on your laptop at once, with Mnemo's reply streaming on both. The queue is the same everywhere too."},{icon:"enter",title:"Send now, as a new message",text:"Send a queued message now (or press Ctrl+Enter): Mnemo's reply is cut where it is and your message is answered as a new one, not mixed into the old reply."},{icon:"refresh",title:"Fallback models",text:"Line up to five models in Settings, Mnemo. When the chat's model fails, the next one carries on by itself; with none left, the error shows with Try again."},{icon:"brain",title:"Thinking level",text:"For models that can think, pick Auto, Off, Low, Medium or High next to the model."}]},{kind:"better",items:[{icon:"chat",title:"A queue that keeps moving",text:"Queued messages wait on the server and go out one by one when each reply ends: finished, stopped or cut. After an error the queue pauses until you resume or send one. Send now, Clear and Resume are always there."},{icon:"menu",title:"Long queues stay small",text:"Three rows show, the rest scroll with a soft fade; Show all opens the whole list."},{icon:"stop",title:"Stop keeps what was written",text:"Stopping a reply keeps the text so far in the chat, and the next queued message goes out."},{icon:"refresh",title:"Compaction you can read",text:"The summary appears under the divider as it is written, and opening the divider always shows it."},{icon:"check",title:"Switching models asks first",text:"Changing the model of a chat that has begun asks before it switches, since answers may read a little differently."}]}]},{version:"2.1.8",title:"@mnemo requests are never dropped",lead:"A request in a note that Mnemo could not answer stays open and is tried again until it goes through.",groups:[{kind:"better",items:[{icon:"refresh",title:"Tried again, not dropped",text:"When the AI provider or the network is down, an @mnemo request is no longer struck through with an error: it stays in the note and Mnemo tries again after 1, 3, 10 and 30 minutes, then every hour, in the same chat."},{icon:"chat",title:"The right chat at its address",text:"Opening a chat by its address shows its title at once, never New chat while it loads."},{icon:"sparkle",title:"Fresh ideas, smoother",text:"While Mnemo writes new suggestions the button shimmers and the cards wait as soft placeholders."},{icon:"bolt",title:"What's new, neater",text:"The release row starts flush left and only fades on a side with more to see; the arrows show only where you can go."}]}]},{version:"2.1.7",title:"Skills, fleeting chats and chats that follow their note",lead:"Teach Mnemo a skill once and run it with a slash, chat without keeping anything, and find a note's chats wherever the note goes.",groups:[{kind:"new",items:[{icon:"bolt",title:"Skills",text:'Skills are notes in the Skills folder. Ask Mnemo to make one ("a skill that tidies meeting notes"), then type / in the chat to pick it. Mnemo can change or remove them too.'},{icon:"eye",title:"Fleeting chats",text:"The eye in Mnemo's header starts a chat that is not kept: it and the pictures sent in it are gone when you leave it, and it stays out of search. Changes to notes stay."},{icon:"sparkle",title:"Suggestions that change",text:"A new chat shows different suggestions each time: some of yours (Your suggestions), some Mnemo wrote from your recent notes (Fresh ideas writes new ones) and some built in. Your skills are one tap away."},{icon:"image",title:"Mnemo sees your pictures",text:"Mnemo can open a picture shown in a note to describe it or read it. A picture that is only a web address it cannot open, and it tells you to send or add it instead."}]},{kind:"better",items:[{icon:"note",title:"One chat per note",text:"Every @mnemo request in a note goes to that note's one chat, which follows the note when it is renamed, moved or sent to the Trash. Asking about a note offers its earlier chats."},{icon:"enter",title:"@mnemo from Mnemo works",text:"When Mnemo writes an @mnemo request into a note for you, it is answered like one you wrote."},{icon:"refresh",title:"Steadier chats",text:"Leaving a chat while Mnemo answers no longer shows a network error: it picks the reply up again. Chats get a proper title even when the first try fails, and deleting a chat also deletes the pictures sent in it."},{icon:"expand",title:"Room for the chat",text:"A page open beside the chat folds the chat list away (it comes back when you drag the divider to give the chat more room). If both cannot fit, the page opens full screen."},{icon:"image",title:"Pictures fit the note",text:"Pictures in notes are at most about 60% of the screen tall; tap one for the full size."}]}]},{version:"2.1.6",title:"Pages that grow, chats you can tidy",lead:"Mnemo reworks the page it made instead of starting over, chats can be cleaned up in bulk, and compacting waits until the chat is really full.",groups:[{kind:"new",items:[{icon:"code",title:"Pages are versions of one file",text:"Ask Mnemo to tidy or change a page and it rewrites that same file: the card shows v2, v3 and latest, the panel steps between versions, and on a wide screen the new one opens by itself. Pages stay with their chat (listed under In this chat) and Mnemo can reuse one from another chat."},{icon:"expand",title:"Drag the divider",text:"The line between the chat and an open page can be dragged. Each side keeps a sensible minimum, the width is remembered, and a double-click resets it."},{icon:"trash",title:"Select, clean up or delete all",text:"The ⋯ beside New chat picks several chats to delete, cleans up chats older than 7, 30 or 90 days, or deletes them all (pinned ones kept unless you say so)."},{icon:"chat",title:"Chats know each other",text:'Mnemo can list your other chats, search them by title or words and read one, so "the chat from yesterday" just works.'}]},{kind:"better",items:[{icon:"refresh",title:"Compacting only when full",text:"A chat is compacted only once it fills the model's memory, and while it happens you see it working, with a clock, before the reply goes on."},{icon:"sun",title:"Tidier Mnemo foot and pages",text:"Appearance is one wide button with Activity, Settings and Memora under it. Page cards stand out and fill the reply's width. Scrollbars are thin and show only while you scroll."},{icon:"bolt",title:"What's new, as a carousel",text:"Releases slide in one row with arrows, newest first, and the buttons at the bottom no longer bump into each other on a phone."}]}]},{version:"2.1.5",title:"Unread that agrees everywhere, and a tidier Mnemo",lead:"What you have read is remembered on the server, the chat list ends in one neat row, and phones stop sending half a message.",groups:[{kind:"better",items:[{icon:"bell",title:"Unread on every device",text:"A chat you read on your phone is read on your laptop too. Your own messages and the chat you are looking at never count as news."},{icon:"sun",title:"Appearance in one place",text:"Theme, chat background and text size moved into an Appearance panel (a sheet on phones). The chat list ends in one row: Appearance, Activity, Settings and Memora."},{icon:"enter",title:"Enter on phones",text:"On a touch keyboard Enter starts a new line; the send button sends. With a real keyboard Enter still sends and Shift+Enter is a new line."},{icon:"chev-down",title:"Scroll to the bottom",text:"The button above the message box is a plain way down, with no New messages label."}]}]},{version:"2.1.4",title:"Pages open like files, and news is marked",lead:"A page Mnemo writes is a card in the chat; open it and it sits beside the chat. Chats with news stand out.",groups:[{kind:"new",items:[{icon:"chev-down",title:"Back to the latest",text:"Scrolled up? A button above the message box takes you down again, and says New messages when a reply came in meanwhile."},{icon:"bell",title:"Unread chats",text:"The Mnemo item in the sidebar shows how many chats have news; in Mnemo each one is in bold with its number of new messages."}]},{kind:"better",items:[{icon:"code",title:"File cards and a side panel",text:"Charts and pages show as a card with Open and Download. On a wide screen the page opens beside the chat; on a tablet or phone it fills the screen until you close it. Preview, Code, Copy, Download and Close sit in one clear bar."},{icon:"refresh",title:"Compacted, centred",text:"The divider where a chat was compacted sits in the middle of the chat again."}]}]},{version:"2.1.3",title:"Mnemo answers with pictures",lead:"Ask for a chart, a diagram or a small page and see it live in the chat.",groups:[{kind:"new",items:[{icon:"eye",title:"Live previews",text:"When a chart, graph or diagram says it better, Mnemo writes a small HTML or SVG page. Once the reply is done it shows as a preview; switch to Code, copy it, download it or open it full screen. It runs sandboxed, away from your notes."}]},{kind:"better",items:[{icon:"refresh",title:"Calmer compact divider",text:"Where a chat was compacted the divider just says Compacted, centred; open it to read the summary."}]}]},{version:"2.1.2",title:"Mnemo fits your screen, and errors read plainly",lead:"On a phone Mnemo uses the full width, and you choose how big its text is.",groups:[{kind:"new",items:[{icon:"eye",title:"Text size",text:"Auto, Small, Medium or Large, from Appearance in the chat list or Settings, Mnemo. Auto is small on phones so more fits, and medium elsewhere."}]},{kind:"better",items:[{icon:"chat",title:"Full width on phones",text:"Replies drop the avatar beside them and use the whole width, with the same margin on both sides."},{icon:"refresh",title:"Clear errors",text:"A provider that is down for a moment is asked again by itself for about half a minute. If it still fails, Mnemo says so in plain words with Try again; the full error is there only if you open it."}]}]},{version:"2.1.1",title:"Mnemo asks first, or just gets on with it",lead:"Pick how much Mnemo may do on its own, answer its questions with a tap, and keep typing while it works.",groups:[{kind:"new",items:[{icon:"help",title:"It asks instead of guessing",text:"When a choice is yours, Mnemo shows the options as buttons, plus Other for your own answer."},{icon:"shield",title:"Ask first, or Auto",text:"Ask first: Mnemo looks freely but waits for your OK before changing notes. Auto: it goes ahead and keeps working until the job is done. Switch from the chip next to the model."},{icon:"chat",title:"Type while it works",text:"Messages you send mid-reply wait in a queue you can reorder; they go out one by one. Ctrl+Enter steers the reply that is running instead."}]},{kind:"better",items:[{icon:"eye",title:"Easier to read",text:"Replies sit on a frosted card, details start closed and keep their header in view, and the chat scrolls without a bar."}]}]},{version:"2.1.0",title:"Meet Mnemo, your notes have a helper now",lead:"Ask in plain words and Mnemo finds, writes, tidies and links your notes for you, with the AI key you already have. And your notes can finally hold pictures.",groups:[{kind:"new",items:[{icon:"mnemo",title:"Ask Mnemo anything about your notes",text:"“What did I decide about the launch?” “Tag everything from last week.” “Turn this into a checklist.” Mnemo does it and shows each step. It only works inside your notes and never deletes for good."},{icon:"note",title:"Write @mnemo: right in a note",text:"Leave a request on any line, save, and come back to the answer underneath with the request crossed out. Handy for to-dos you would rather hand off."},{icon:"image",title:"Show it a picture",text:"Paste a screenshot or a photo and Mnemo actually sees it: ask what it says, or have it filed beside the right note."},{icon:"chat",title:"It remembers the whole chat",text:"Long conversations get folded into a summary instead of forgotten, replies keep going if you switch chats, and the search box finds anything either of you said."},{icon:"image",title:"Images live in your notes",text:"Drop a PNG, JPEG, WebP or GIF into a note. It sits in the note’s folder and moves, goes to the Trash and comes back with it. Each folder gets a gallery too."}]},{kind:"better",items:[{icon:"eye",title:"Read your way",text:"Nine reading themes from paper and sepia to night, plus fonts like Literata, Atkinson Hyperlegible and OpenDyslexic, in the size you like."},{icon:"sparkle",title:"A chat that feels like yours",text:"Light or dark right from Mnemo’s sidebar, a dozen quiet backgrounds, and a timeline on the right edge to jump through long chats with your thumb."},{icon:"check",title:"No more surprise sign-outs",text:"Memora keeps you signed in while you are using it; it only times out when you really step away."}]},{kind:"admin",items:[{icon:"settings",title:"Bring your own AI",text:"Settings, Mnemo: add OpenAI, Anthropic or any OpenAI-compatible server, test it, pick a default model and write instructions in your own words. Mnemo is in the terminal app too."}]}]},{version:"2.0.1",title:"A calmer reader",lead:"Notes now read like a clean page, whatever reading settings you pick.",groups:[{kind:"better",items:[{icon:"note",title:"Cleaner note text",text:"Clearer headings, even lists, quieter code and tables, and real check boxes for tasks."},{icon:"menu",title:"Contents and Details",text:"The panel beside a note has two tabs. Contents holds the outline, links and mentions."},{icon:"settings",title:"Simpler reading settings",text:"The fonts and colours that look right everywhere stay. A choice that was removed moves to the nearest one."}]}]},{version:"2.0.0",title:"A calmer, clearer Memora",lead:"Every page was redesigned around one quiet look, and the places you use most got new tools: version history, tag patterns, a summary of what your AIs do, and a cleaner way to read.",groups:[{kind:"new",items:[{icon:"refresh",title:"Version history for every note",text:"See each version and who made it, compare it with now, and restore it. Restoring adds a new version, so nothing is lost."},{icon:"tags",title:"Find notes by a pattern of tags",text:"Build “session or (memora and plan) not docker” from chips on the Tags page, and see how many notes match before you apply it."},{icon:"activity",title:"Activity, summarised",text:"Numbers, a chart, what your AIs do most and what went wrong, with every action on its own Timeline tab."},{icon:"note",title:"A cleaner way to read",text:"Fold the toolbar away with F. Contents sits beside the note, with its details as a tab."},{icon:"brain",title:"Clean view on the maps",text:"Hide every control on 3D, Graph and Canvas with C, and bring them back the same way."}]},{kind:"better",items:[{icon:"trash",title:"A safer Trash",text:"Choose where a note goes back. Deleting forever asks you to type DELETE, and also erases the note from its history."},{icon:"bolt",title:"Faster",text:"Data travels compressed, Activity remembers each time range, and the start screen leaves the moment the app is ready."},{icon:"settings",title:"Settings you can change",text:"The server name and how long browsers stay signed in. Switching the notes folder now says what moves with it."},{icon:"agents",title:"Your AIs at a glance",text:"The Live panel leads with what your AIs did last, then who is working."}]},{kind:"admin",items:[{icon:"shield",title:"For whoever runs the server",text:"Deleting a note for good over the API now needs an admin key. The database needs no migration: a 1.3 install updates in place."},{icon:"book",title:"A new licence",text:"From 2.0.0 Memora is under the GNU AGPL v3.0 or later. Forks and hosted copies keep the source open and credit Memora."}]}]}],x$={new:"New",better:"Better",admin:"Good to know"},kE="/api/ui/layout/whats-new",b$=`
|
|
4902
|
+
</div>`,t.appendChild(nn),hE=new sE(nn.querySelector(".vx-pane-tree"),{showNotes:Ve.showNotesInTree,showPins:!0}),Da(nn.querySelector(".vx-pane-tree")),a$(nn),nn.addEventListener("keydown",e=>{if(e.key==="F6"){e.preventDefault();const n=nn?.querySelector(".vx-pane-tree"),i=!!n?.contains(document.activeElement)||nn?.classList.contains("no-tree")?N.note?Mc():Em():n;(i?.querySelector('[tabindex="0"],button,input,textarea')||i)?.focus()}})}function a$(t){t.querySelectorAll(".vx-resizer").forEach(e=>{const n=a=>{Ve.treeW=Math.round(Math.max(190,Math.min(460,a))),t.style.setProperty("--tree-w",Ve.treeW+"px")};e.onpointerdown=a=>{a.preventDefault(),e.setPointerCapture(a.pointerId);const i=a.clientX,o=Ve.treeW;t.classList.add("resizing"),e.onpointermove=s=>n(o+s.clientX-i),e.onpointerup=()=>{e.onpointermove=null,t.classList.remove("resizing"),ja()}},e.onkeydown=a=>{(a.key==="ArrowLeft"||a.key==="ArrowRight")&&(a.preventDefault(),n(Ve.treeW+(a.key==="ArrowLeft"?-16:16)),ja())}})}function Yr(){const t=Em();t&&In(t,py())}async function Ac(t=!1){const e=Mc();if(e){if(!N.note&&kc){Sc("note"),e.innerHTML=_s(me.note,"Note not found",`“${x(lt(kc))}” may have been moved, renamed or deleted. Deleted notes wait in the Trash.`,'<span><button class="btn sm primary" data-home>Show all notes</button> <button class="btn sm ghost" data-trash>Open Trash</button></span>').replace("vx-empty","vx-empty vx-missing"),e.querySelector("[data-trash]").onclick=()=>nt.openTrash(),e.querySelector("[data-home]").onclick=()=>{kc=null,Jp("")};return}if(!N.note){Sc("list");return}Sc("note"),await Us(e,N.note,py(),t)}}function Kp(){const t=H(".crumb");t.textContent=N.note?lt(N.note):Ve.folder?"Notes / "+Ve.folder:"Notes"}function hy(){if(!nn)return;const t=nn.querySelector(".vx-pane-tree"),e=Array.from(document.querySelectorAll(".vx-treehost")).some(n=>n!==t&&n.isConnected&&!nn.contains(n));nn.classList.toggle("no-tree",e||py())}async function uy(){qx();const t=H("#view-vault");if(t.classList){if(!nn||!t.contains(nn)){n$(t),Ve.folder&&!$l(Ve.folder)&&(Ve.folder=""),hy(),Sc(N.note?"note":"list"),hE?.render(),Yr(),await Ac(),Kp();return}Ve.folder&&!$l(Ve.folder)&&(Ve.folder=""),hy(),Qa(),Yr(),(N.note!==sO()||!N.note)&&await Ac(!0),Kp()}}function fE(t){return en().some(e=>e.path===t)}async function Zp(t){if(!fE(t)&&!Object.keys(N.tree).length)try{await te.loadCore()}catch{}await gE(t)}function mE(t,e){if(location.pathname+location.search===t)return;const a=e?.vxDepth||0;try{history.replaceState({...history.state||{},vxDepth:a+1},"")}catch{}}function i$(){if((history.state?.vxDepth||0)>0){history.back();return}Jp(N.note?Be(N.note):Ve.folder||"")}async function gE(t,e=!1){await xc();const n=location.pathname+location.search,a=history.state;if(!fE(t)){if(Hr())return;kc=t,N.note=null,N.editing=!1,N.page!=="vault"?te.go("vault"):(Ac(),Kp());return}kc=null,N.note=t,N.editing=!1,Je.clear(),Fi(Be(t),Ve.folder||"")||(Ve.folder=Be(t),G0(),ja());let i=Be(t);for(;i;)hn.add(i),i=Be(i);if(Po(),N.page!=="vault"){te.go("vault"),mE(n,a),te.refreshTree(),e&&setTimeout(()=>Mc()?.querySelector("[data-mode=edit]")?.click(),400);return}mE(n,a),Sc("note"),Qa(),Yr(),await Ac(),e&&Mc()?.querySelector("[data-mode=edit]")?.click(),Kp(),te.refreshTree(),Mc()?.querySelector(".vx-note-scroll")?.scrollTo(0,0)}function Jp(t){kc=null,xc().then(()=>{const e=(Ve.folder||"")!==t;if(Ve.folder=t,ja(),G0(),Je.clear(),N.note=null,N.editing=!1,Sc("list"),N.page!=="vault"){te.go("vault");return}Qa(),Yr(),e&&Em()?.querySelector(".vx-bscroll")?.scrollTo(0,0),Ac(),Kp()})}function o$(){Ve.filter="all",RD(),Jp("")}nt.selectFolder=Jp,nt.allNotes=o$,nt.openNote=t=>{Zp(t)},nt.newNote=t=>{const e=As(),n=t&&t!=="Root"&&e.includes(t)?t:"";let a=null;const i=async o=>{const s=o.querySelector("#vxName"),r=s?.value.trim()||"";if(!r){s?.focus();return}const l=a?.value??"";de.close();const c=await iT(l,r);c&&await gE(c,!0)};de.open({title:"New note",body:de.field("Title","vxName",{value:""})+'<div class="field"><label id="vxWhereL">Location</label><div id="vxWhere"></div></div>',actions:[{label:"Cancel",cls:"ghost",run:()=>de.close()},{label:"Create",cls:"primary",run:i}],onOpen:o=>{a=Uf({folders:e,value:n,label:"Location",onPick:()=>{i(o)}}),o.querySelector("#vxWhere")?.appendChild(a.el);const s=o.querySelector("#vxName");s?.focus(),s&&(s.onkeydown=r=>{r.key==="Enter"&&(r.preventDefault(),i(o))})}})},nt.newFolder=t=>{eb(t?`New folder in ${t}`:"New folder","Folder name","",async e=>{const n=await N8(t,e);n&&Jp(n)})},tT(()=>{N.page==="vault"&&nn?uy():Qa()}),IS(()=>{N.page==="vault"&&nn&&Yr()});let vE=0;nP(()=>{clearTimeout(vE),vE=window.setTimeout(()=>{Qa(),N.page==="vault"&&nn&&!N.editing&&Yr()},250)}),document.addEventListener("vx-back",()=>i$()),window.matchMedia(uE).addEventListener?.("change",()=>{N.page==="vault"&&nn&&(hy(),Yr(),Ac(!0))});function s$(){nt.newNote("")}function r$(){nt.newFolder("")}function l$(t){Wr([t])}function c$(t){$0(t)}function d$(t){Lp(t)}function p$(t){U0(t)}const xE="Memora by Codrihub Tech",fy="Second brain for your AI",bE="A self-hosted memory vault: your notes as plain Markdown, wired into a living brain that your AI agents read and write over MCP. What they learn stays.",h$="Set up once, use everywhere: connect each agent once and they all share the same memory, on your local network or over the internet.",yE="Memora is memory, advanced: built to remember what you and your AI learn, and to remember more the more you use it.",u$={bg:"#0b0f17",bgTop:"#17202e",accent:"#5eead4",cyan:"#22d3ee",coreLight:"#a5f3fc"},f$="M7.2 16.8V7.4l4.8 5.1 4.8-5.1v9.4",m$=[[7.2,16.8],[7.2,7.4],[16.8,7.4],[16.8,16.8]],_m=[12,12.5];let g$=0;const my=typeof document>"u"?"s":"r";function v$(t){const{bg:e,bgTop:n,accent:a,cyan:i,coreLight:o}=u$,s=++g$,r=`mmg${my}${s}`,l=`mmt${my}${s}`,c=`mmc${my}${s}`,d=m$.map(([p,h])=>`<circle cx="${p}" cy="${h}" r="1.7" fill="${p<12?a:i}"/>`).join("");return`<defs><linearGradient id="${r}" x1="3" y1="3" x2="21" y2="21" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="${a}"/><stop offset="1" stop-color="${i}"/></linearGradient><linearGradient id="${l}" x1="0" y1="0" x2="0" y2="24" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="${n}"/><stop offset="1" stop-color="${e}"/></linearGradient><radialGradient id="${c}" cx="50%" cy="50%" r="50%"><stop offset="0" stop-color="#ffffff"/><stop offset=".55" stop-color="${o}"/><stop offset="1" stop-color="${i}"/></radialGradient></defs><g fill="none" stroke="none"><rect x="1.5" y="1.5" width="21" height="21" rx="6.2" fill="url(#${l})"/><rect x="1.5" y="1.5" width="21" height="21" rx="6.2" fill="none" stroke="url(#${r})" stroke-opacity=".55" stroke-width=".8"/><path d="${f$}" fill="none" stroke="url(#${r})" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/>`+d+`<circle cx="${_m[0]}" cy="${_m[1]}" r="3" fill="${i}" opacity=".22"/><circle cx="${_m[0]}" cy="${_m[1]}" r="2" fill="url(#${c})"/></g>`}function to(t="brand-mark"){return`<svg class="${t}" viewBox="0 0 24 24" aria-hidden="true">${v$()}</svg>`}const Qp="'Memora Script', 'Segoe Script', cursive",wE="@font-face{font-family:'Memora Script';font-style:normal;font-weight:700;font-display:block;src:url(data:font/woff2;base64,d09GMgABAAAAAA/sABAAAAAAHHwAAA+QAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjYbhwYcgk4GYD9TVEFUKgCBJBEICqMAnUsBNgIkA3ALOgAEIAWEVgcgDAcbcRijopyyciP4iwQOrxo/YUJJ0KGxLYMtMChiyWS84W/ql0UgbBZ6Di4wnBshySzP83/v5z73TelUewLYrDUcDki+zwpojAYT8WhpwME5w9Op/y7xBWpyiS9GoS1CmaYptJoj1Indp4sPuxPXFFgU4UiGMoyq87T9ziPxIzsBL2e31mxqv+oBPZDTdX5t1h5CCSG96Pf/2y+1czMbJldkoYKqKkLXmN35CwOfdif08ouMQjZClVgBudbVqBrfUynqfY1QtTVkJ/C41laa+xiZm7oMAOl1MkS2QwUalm4sgDWd5YHBXskEmXTfVZ5vWqHigHkezEsA+qx+qAfQ4QAaA2/xsXmgB5CwhIOhQzHgnDJ8zOsXKeRI6vMy+BLyAowuInzYAlIR1N7RezDB9hAABPzxx7/w3z7/sh2YmrBV4CrBpxWBEbHM5LokcjkwJ0qpJevSaGXRI8XILWNWxIqXsYvgZGQKc4jV7pwS5JWQK4K+TEeshFQCtQZ2L8AP24apBVsRbgURKhYYj+ORK4PronDyKNnQwUEGDwxkPpvvGl4CAHzBsE8RdjENeviggTYGeKONGZqYoclOxd3hg8H7N2FiATggr6EBQEED6tTuvWeBsTPfDEBm9aRx4NKQIv4ene7+YwsecXCESTtPeXxQYGDhEJDtti0DC0cKKFRsDwiPadkArDjm1LxiihaRrj4JQBmPCBb+LApq7S1goyXkAGbh4R5j1xXermbTvPAc/kllAAWmZ/EECjLeXS5Dgf/aY01F1/GYqX6ueRin4tijMUFLbEtcS/wAAfFN+jXANGtvrQeOWW9jF8gY8Rncz6O6CLnvOwwncLyjUUbqlkRMeWb1DM4XFtvRAIuKB4Wv4MNgz0DAaZ5wjbBg91iSDSkB/loIO+TE9Rlw+XTc16p5fB4l99140PkAHJ45/L074j9pvxMcgZo77bljAJh7DTmqp+Y95lXAKSxIcgRsjnY8hLlpbRuCQJBEzZnD3L8wZkJ4WGSEs4UuQuHGv5eHT0C+QnEJzdp16zVg2NzGwC712v5c/d1bgV576bnHHrrvtqsuO++0I5DONAE1xlByqOihefeBBSla/H+2jU8YAAQoOeNiU9HLrBkMtYBo7NznPqDYMipzUqk6TxaVrg3KaQG6iJp0Uh2ZbliU2qZLc2jUUk77VYDFLYjRlC8+h29mGwqvqYmmZg7CvKUXMOkHzMsqKvv+AhgCiPmyeqBBbPVpyprE8URsVgpBnJiWU1a1A95wH4a4UJ88cQ1iaRiostfXkJ1yIhjHZUPtUaBxTdjcNK9Dztr6mLiZ+MKXsgn5XVUm6660NVS5uzzkuckbCuiJOAdWp1+kZx5L3xVEHRHbl+4VQPsYBqgsq9NKsSDAoMh8iGnQ0j5M7q3pJUl5Bx4GlyLWJX49XYRc25uI1xofr4fzZLOWBTEBa83pCG7pVFl1eRsL4vugxD7TGBpXldiKYqXZsiCPL9BpSoR9qWlZqpx3rct+dYyn1LMrJSnh+osJA48AYj7srZ1ragzCNLlFAvHo9YepKaMcFmMngeSFC4DqPD0arzcWMgZ12YrI8W1OoBhlCMWnKi3R1iORF8OI+FwM5j0heh39y9rAy2KZbm8yz1R25unJzGRq6hrCGCQMx6lFsmMPKMLwJhfclN2Ow825UI9u721f2gWLLRBSpHjmjuobhzg++cRmUvZyfMHMWt953KcMMRvJCjUtOLkEAeHeszVGK5OJzStP6HHNo0e5+46BnOFYtB9U8SGvUHjrYLY4+sWRyV9Z3/rHr6/s8jmjF6pYc+BjM8ZGF/UVSoRlj7pBFaQhdljPdbvJrH1Yoa0woRT5ED9VWcWFLrAdty0wPxLJnd2vZfAzk1de8KUlQNnD1MDcnI5MXX2Zkn0fUEI/Ea3kCtnRI7bqN6aD0FbGjqEfTeI4vzEmej++qjivawt0VZYPAbdUOV25mw/UFFH3tp+cUogVlKmrlBSxdUcuEzfbvPKE6PtCXDp12TmaRFkxeGLqmuiy6exrjrtKnY+59KHrtlZyeL8C2pCTeJlWJ1kWvfVLdBkGopxvlHXkwYYiV9Yet3Wo7P3IGGZgExZwRlG8f/9gDb83rxAR/T+7J6pkZ2xQBLR4EBvb9y60BVoYmxy+yPWF+KBjvDtnx5A+zEhc+9LNaWGNc+2aSGYprF5KP08IX+isecfO8tnLxh/tdc7rGxIHtlxVn9i8Mvbk0ubCCxFXls+WzY7azB6uWefSCue5oIJ+0aMXwzpvX8/BO2Oi9ImejyS7jw7PpE476yD1nzjNkQ9UakFT6Rk+/N//x3xjq7/12e2hWYuTLcxpHv0d3e04pR5Fk2K2aD6zz6j7nYP4AvoCtrS4oT3Dpo2HkYqOmz7iJ9ZExQ2F7nnFHE2PcSpSUTRXH5p4ANxk3qyQqT+30Hoosbmzd54713TbIU2JKPz3ELhmyYdFvEQK2yUwVXtKe/xrtFs8NnHyd1daR3Z5/ektCm99zzwveDXprnO4Ei6TutQfrLa1zlTm61NT6+qzPbmerAytKNjJoa/ZnO/wqaSLUPPT0oTZKEseDsHteZnNDinfs8GW3p5T3nj6iMrf2DPXDXDJAltH/Gr/b4G96R4ifI9l8PIjKjIi5X/7NweNjYZFKnWGqKPJQ1pBHtRnZa3wLfMMupLjE6Uc+tvLkPjkN5JNyFb6Mocwf1Wx8bkvrb2OX+VLb2V3Z851jmibji6rxyvZiagWKsdWQ1UGBo0eG237O3IgNwx+SmbV5aT3FuRbD5Rs6u1b5PbBrcqiD0mudnddd3SdcWfIJaqYdKbXefJ70tdItnglRK+VzZqn9ojD1byXuCK150WvViKNcnzEPHmL/UxiaVtFjxn8OYf/hrfE3ZTZnCGssl3lxiRWIeVgrjhpXqMbMPQ558vzW8/6iPicj4l3o4IKts1cl1JstkdcVr0/YC2RlDLD+L6fc+uCtTW1PzpXoy8MdonK7a6o05VVLHgk9868Dphk+j5Iwiu6jgSda12LbYNuH2jAF5NuRfymQVZM68d89vpnUSzznUp+I95sHS78Tz7/FaZ3RIangkVyikkpK04vDLmLtXrjPZWobAdfDqdMC8U78/RhJCBGEWRBhs8Z1KnwtpZcCkxvwrFok0x+MmhKKIa98YhFox+UYDDQYm86aAtnZgVn2OUr07f5N4QGZvqQlFyCGCk0VmSW+UP+rkJmsV7XJhGOyX3qkM4e06BbnBK6+wf8LIKSy9nx6bpwbjae4r4fn1FyYPkavgqi0pQCLpL4ZNW3Oq/U7ZJhsNCy5Y64tQn0pbu8bp9dXTMzWmDUGyJi8QmEc3VXqZQ0hyLosgTFBXLxywZNsTFUkLQvSNS2pAG/hNNwWiaXFacVh33FegNyiIXPGUp1UeTXBSrfDITzO1MUnVEwIouXW0es3ZbSY2wKoLHQqKM1a45jETovjb+EwitO9/ZYk76SfItG/4uS6bZ+6w96tGDQ6Pb7XSZTQyxZlWoRfq3TGD0RZzn6JJYE43Xv/CI2JCzR/M0zzycqWux117f9dzEipswmI8xf68AEj+0zW6RLXZvda/19M3x8bo1AxC8wVmQl/aHAY1+XCPAwPpUl9Zrdb+sUtf8iaMjNY/9H4Z3PCsd+rM8tidiNmtlS7sdvcPkehmDkP5H/weeR3l3TOr/UzaFBEESY5Yg7WkGhxHRNjTAC4jy17y6PKmHQPtH5pGE52sRTFPoMiR8UZZ316Y9zPk7h28XszVzuJICl2hoUee9dNutFGMkJmLx/XHfJT1WSyU6Bn+NF6Icp3KPuoowGFuXPBXhoklPMLV1sKKLT7Qx4uCz2uVEvUO+Q0TLaiowvZ0u074uFJAwb3sIQsQzhD3F/OhK+DOCRmWElyvHqj/GIKtfD9e4r3JSvOJzo/H9Ffjs38IXOaJWrNVVnbjAZB/vuieNhi5K24zhSlt23d0BeqEDG6ZxhPfcbcFugnpSLx17iI+9nJtNaqN++Za6L7mUJ/2NQz+Hxa7kwbv9fqGT/dg79S5ifI4nv6DeE4mUuEJMoLunFrJg49AON+PK5y1IPEpPhzHcYrKZ1Gt8PO5c8U03FGtZb+PQTTO7O3FD/N6WB0kKbRvL8PjyegoMHHgNWRHBJgcbv+hX/X3gr3/l1wGNkLzohE7Ij4uD/VEJbrW59ddoTHMYNFu+TZ8S83EL3eoT02lZGSlLeH95SWSAK0z7KicScs4TuGd0BdwrHV6gonHYbxgTwUn+6UroFT1uh+vIh5AdwPemLnLUY9gWrJqlu+GAvS2hiUeqJtBNEGHcAlkvmDdniseb/vCuYBk9JPBW0P+A8Bwvw/mKBqKC8qUirW1qyx1Jly9F+l1TRix+geKzuqjlfVnLEFSVLJExaO550mkDGXaDIJQtXptCEffP3vp2ibHeyONOi/lwhFnou8QXfGJ9VVDgKwjYH4dGsRz/GwB6B7HP6vwoh35n8ZORtred7F4ohM5cO2ksszeA5W67HnX+0Oz3D4/c7Tab6WLIqzSZ8Tqc2uiP2ctmTWCqJfZ0sT23yl6wxF3o9BVq96Dm93R/rsjyNg0nsk3+jxqQ9WrRIcj5R3Zx6486dD9fZhKQ2Cpf+SW1MtuecUyyizqGIH9qjoEBmualzqSoywh7neQ6eky6vx4kZHJZRpWB76Vr2X1z/1nV0HrOByCwj4s/iYdx+GJXOH+QwvoQR03/xFblZnpJ4uln9hUxyeD9fyNRfE8cO/W6jEY+fSHr7ae0dp2MZ1NbnNzk2Oa5up6QLOKD7xNmRQN5BuEomrw9g7gEuYJHILnJgmHaKRQL9DgIM3tv987fWMXJ+I2GxXwJ8Y0FUAPieXN2bLt59iWNg94AQYAAE+PkfTv9SRc2LlX07X3KYC0DmABg3AIzHAB3c6WDSTPtjM/uZbUA2xCAv90tlb83kT3v5pkpKp+V8D+/XOmNHwQxNG+kEIF8bp17Bb3X6H5T+6c+EnbbGucrj65pAg78ZBrcMXiucXmbMv23ZACxojgxAtgGYGwkRhzcSgxTHSKysZI3E0WRoJJ4w+0YQqHJ9IgiAtbxpcHRf6tOrz1wD2rVqMwTlYGOXBpUI0LyuX70ejVnVUwlVwgTS9CWqSKhXx4RpnCeP4VG1RTRgUIyOnob0HZTF2kWt2oHLhjWwaNSre5V69Q7LujRrOVRP9t5BVlrsm5Ce6fRmkxIqvkAN9jRgpK5qggrSEarATTerk1ekN69ggT3eq1eXJg4WNosty1agsL/ZgGydAzPBwVs1AzZJPtGgdiZHoXIPXdacMs0Ha7E6M+qYw/pfEpdvcRU=) format('woff2')}",ei=[{version:"2.1.11",title:"Thinking level for every model",lead:"The Think chip no longer waits for a model to show its thinking first.",groups:[{kind:"better",items:[{icon:"brain",title:"Think chip on router models",text:"Models behind a router alias get the thinking level right away. It hides only when the provider refuses it."}]}]},{version:"2.1.10",title:"Every chat keeps its model",lead:"The default model is for new chats only, a fallback that takes over stays, and a divider shows each change of model.",groups:[{kind:"better",items:[{icon:"pin",title:"A chat keeps its model",text:"The model a chat began with, or the one you switched it to, stays with that chat. Changing the default only changes new chats."},{icon:"refresh",title:"Fallbacks you can see",text:"When a model fails and a fallback takes over, the chat switches to it and a divider says so. Every change of model is marked, even inside one reply."},{icon:"bolt",title:"Straight to the fallback",text:"A model out of quota, with its key refused or not found is skipped at once; a busy one gets one quick retry before the next model."},{icon:"brain",title:"Thinking level for more models",text:"A model that has shown its thinking gets the Think chip, whatever its name."},{icon:"send",title:"A calmer prompt",text:"The model and its memory ring sit under the prompt; inside it, just the thinking level and Send. The fleeting eye shows on new chats only."}]}]},{version:"2.1.9",title:"Chats in step everywhere, a queue that never sticks",lead:"Every device shows the same chat live, queued messages always go out, and Mnemo can fall back to another model or think harder when you ask.",groups:[{kind:"new",items:[{icon:"monitor",title:"Live on every device",text:"A message sent on your phone shows up on your laptop at once, with Mnemo's reply streaming on both. The queue is the same everywhere too."},{icon:"enter",title:"Send now, as a new message",text:"Send a queued message now (or press Ctrl+Enter): Mnemo's reply is cut where it is and your message is answered as a new one, not mixed into the old reply."},{icon:"refresh",title:"Fallback models",text:"Line up to five models in Settings, Mnemo. When the chat's model fails, the next one carries on by itself; with none left, the error shows with Try again."},{icon:"brain",title:"Thinking level",text:"For models that can think, pick Auto, Off, Low, Medium or High next to the model."}]},{kind:"better",items:[{icon:"chat",title:"A queue that keeps moving",text:"Queued messages wait on the server and go out one by one when each reply ends: finished, stopped or cut. After an error the queue pauses until you resume or send one. Send now, Clear and Resume are always there."},{icon:"menu",title:"Long queues stay small",text:"Three rows show, the rest scroll with a soft fade; Show all opens the whole list."},{icon:"stop",title:"Stop keeps what was written",text:"Stopping a reply keeps the text so far in the chat, and the next queued message goes out."},{icon:"refresh",title:"Compaction you can read",text:"The summary appears under the divider as it is written, and opening the divider always shows it."},{icon:"check",title:"Switching models asks first",text:"Changing the model of a chat that has begun asks before it switches, since answers may read a little differently."}]}]},{version:"2.1.8",title:"@mnemo requests are never dropped",lead:"A request in a note that Mnemo could not answer stays open and is tried again until it goes through.",groups:[{kind:"better",items:[{icon:"refresh",title:"Tried again, not dropped",text:"When the AI provider or the network is down, an @mnemo request is no longer struck through with an error: it stays in the note and Mnemo tries again after 1, 3, 10 and 30 minutes, then every hour, in the same chat."},{icon:"chat",title:"The right chat at its address",text:"Opening a chat by its address shows its title at once, never New chat while it loads."},{icon:"sparkle",title:"Fresh ideas, smoother",text:"While Mnemo writes new suggestions the button shimmers and the cards wait as soft placeholders."},{icon:"bolt",title:"What's new, neater",text:"The release row starts flush left and only fades on a side with more to see; the arrows show only where you can go."}]}]},{version:"2.1.7",title:"Skills, fleeting chats and chats that follow their note",lead:"Teach Mnemo a skill once and run it with a slash, chat without keeping anything, and find a note's chats wherever the note goes.",groups:[{kind:"new",items:[{icon:"bolt",title:"Skills",text:'Skills are notes in the Skills folder. Ask Mnemo to make one ("a skill that tidies meeting notes"), then type / in the chat to pick it. Mnemo can change or remove them too.'},{icon:"eye",title:"Fleeting chats",text:"The eye in Mnemo's header starts a chat that is not kept: it and the pictures sent in it are gone when you leave it, and it stays out of search. Changes to notes stay."},{icon:"sparkle",title:"Suggestions that change",text:"A new chat shows different suggestions each time: some of yours (Your suggestions), some Mnemo wrote from your recent notes (Fresh ideas writes new ones) and some built in. Your skills are one tap away."},{icon:"image",title:"Mnemo sees your pictures",text:"Mnemo can open a picture shown in a note to describe it or read it. A picture that is only a web address it cannot open, and it tells you to send or add it instead."}]},{kind:"better",items:[{icon:"note",title:"One chat per note",text:"Every @mnemo request in a note goes to that note's one chat, which follows the note when it is renamed, moved or sent to the Trash. Asking about a note offers its earlier chats."},{icon:"enter",title:"@mnemo from Mnemo works",text:"When Mnemo writes an @mnemo request into a note for you, it is answered like one you wrote."},{icon:"refresh",title:"Steadier chats",text:"Leaving a chat while Mnemo answers no longer shows a network error: it picks the reply up again. Chats get a proper title even when the first try fails, and deleting a chat also deletes the pictures sent in it."},{icon:"expand",title:"Room for the chat",text:"A page open beside the chat folds the chat list away (it comes back when you drag the divider to give the chat more room). If both cannot fit, the page opens full screen."},{icon:"image",title:"Pictures fit the note",text:"Pictures in notes are at most about 60% of the screen tall; tap one for the full size."}]}]},{version:"2.1.6",title:"Pages that grow, chats you can tidy",lead:"Mnemo reworks the page it made instead of starting over, chats can be cleaned up in bulk, and compacting waits until the chat is really full.",groups:[{kind:"new",items:[{icon:"code",title:"Pages are versions of one file",text:"Ask Mnemo to tidy or change a page and it rewrites that same file: the card shows v2, v3 and latest, the panel steps between versions, and on a wide screen the new one opens by itself. Pages stay with their chat (listed under In this chat) and Mnemo can reuse one from another chat."},{icon:"expand",title:"Drag the divider",text:"The line between the chat and an open page can be dragged. Each side keeps a sensible minimum, the width is remembered, and a double-click resets it."},{icon:"trash",title:"Select, clean up or delete all",text:"The ⋯ beside New chat picks several chats to delete, cleans up chats older than 7, 30 or 90 days, or deletes them all (pinned ones kept unless you say so)."},{icon:"chat",title:"Chats know each other",text:'Mnemo can list your other chats, search them by title or words and read one, so "the chat from yesterday" just works.'}]},{kind:"better",items:[{icon:"refresh",title:"Compacting only when full",text:"A chat is compacted only once it fills the model's memory, and while it happens you see it working, with a clock, before the reply goes on."},{icon:"sun",title:"Tidier Mnemo foot and pages",text:"Appearance is one wide button with Activity, Settings and Memora under it. Page cards stand out and fill the reply's width. Scrollbars are thin and show only while you scroll."},{icon:"bolt",title:"What's new, as a carousel",text:"Releases slide in one row with arrows, newest first, and the buttons at the bottom no longer bump into each other on a phone."}]}]},{version:"2.1.5",title:"Unread that agrees everywhere, and a tidier Mnemo",lead:"What you have read is remembered on the server, the chat list ends in one neat row, and phones stop sending half a message.",groups:[{kind:"better",items:[{icon:"bell",title:"Unread on every device",text:"A chat you read on your phone is read on your laptop too. Your own messages and the chat you are looking at never count as news."},{icon:"sun",title:"Appearance in one place",text:"Theme, chat background and text size moved into an Appearance panel (a sheet on phones). The chat list ends in one row: Appearance, Activity, Settings and Memora."},{icon:"enter",title:"Enter on phones",text:"On a touch keyboard Enter starts a new line; the send button sends. With a real keyboard Enter still sends and Shift+Enter is a new line."},{icon:"chev-down",title:"Scroll to the bottom",text:"The button above the message box is a plain way down, with no New messages label."}]}]},{version:"2.1.4",title:"Pages open like files, and news is marked",lead:"A page Mnemo writes is a card in the chat; open it and it sits beside the chat. Chats with news stand out.",groups:[{kind:"new",items:[{icon:"chev-down",title:"Back to the latest",text:"Scrolled up? A button above the message box takes you down again, and says New messages when a reply came in meanwhile."},{icon:"bell",title:"Unread chats",text:"The Mnemo item in the sidebar shows how many chats have news; in Mnemo each one is in bold with its number of new messages."}]},{kind:"better",items:[{icon:"code",title:"File cards and a side panel",text:"Charts and pages show as a card with Open and Download. On a wide screen the page opens beside the chat; on a tablet or phone it fills the screen until you close it. Preview, Code, Copy, Download and Close sit in one clear bar."},{icon:"refresh",title:"Compacted, centred",text:"The divider where a chat was compacted sits in the middle of the chat again."}]}]},{version:"2.1.3",title:"Mnemo answers with pictures",lead:"Ask for a chart, a diagram or a small page and see it live in the chat.",groups:[{kind:"new",items:[{icon:"eye",title:"Live previews",text:"When a chart, graph or diagram says it better, Mnemo writes a small HTML or SVG page. Once the reply is done it shows as a preview; switch to Code, copy it, download it or open it full screen. It runs sandboxed, away from your notes."}]},{kind:"better",items:[{icon:"refresh",title:"Calmer compact divider",text:"Where a chat was compacted the divider just says Compacted, centred; open it to read the summary."}]}]},{version:"2.1.2",title:"Mnemo fits your screen, and errors read plainly",lead:"On a phone Mnemo uses the full width, and you choose how big its text is.",groups:[{kind:"new",items:[{icon:"eye",title:"Text size",text:"Auto, Small, Medium or Large, from Appearance in the chat list or Settings, Mnemo. Auto is small on phones so more fits, and medium elsewhere."}]},{kind:"better",items:[{icon:"chat",title:"Full width on phones",text:"Replies drop the avatar beside them and use the whole width, with the same margin on both sides."},{icon:"refresh",title:"Clear errors",text:"A provider that is down for a moment is asked again by itself for about half a minute. If it still fails, Mnemo says so in plain words with Try again; the full error is there only if you open it."}]}]},{version:"2.1.1",title:"Mnemo asks first, or just gets on with it",lead:"Pick how much Mnemo may do on its own, answer its questions with a tap, and keep typing while it works.",groups:[{kind:"new",items:[{icon:"help",title:"It asks instead of guessing",text:"When a choice is yours, Mnemo shows the options as buttons, plus Other for your own answer."},{icon:"shield",title:"Ask first, or Auto",text:"Ask first: Mnemo looks freely but waits for your OK before changing notes. Auto: it goes ahead and keeps working until the job is done. Switch from the chip next to the model."},{icon:"chat",title:"Type while it works",text:"Messages you send mid-reply wait in a queue you can reorder; they go out one by one. Ctrl+Enter steers the reply that is running instead."}]},{kind:"better",items:[{icon:"eye",title:"Easier to read",text:"Replies sit on a frosted card, details start closed and keep their header in view, and the chat scrolls without a bar."}]}]},{version:"2.1.0",title:"Meet Mnemo, your notes have a helper now",lead:"Ask in plain words and Mnemo finds, writes, tidies and links your notes for you, with the AI key you already have. And your notes can finally hold pictures.",groups:[{kind:"new",items:[{icon:"mnemo",title:"Ask Mnemo anything about your notes",text:"“What did I decide about the launch?” “Tag everything from last week.” “Turn this into a checklist.” Mnemo does it and shows each step. It only works inside your notes and never deletes for good."},{icon:"note",title:"Write @mnemo: right in a note",text:"Leave a request on any line, save, and come back to the answer underneath with the request crossed out. Handy for to-dos you would rather hand off."},{icon:"image",title:"Show it a picture",text:"Paste a screenshot or a photo and Mnemo actually sees it: ask what it says, or have it filed beside the right note."},{icon:"chat",title:"It remembers the whole chat",text:"Long conversations get folded into a summary instead of forgotten, replies keep going if you switch chats, and the search box finds anything either of you said."},{icon:"image",title:"Images live in your notes",text:"Drop a PNG, JPEG, WebP or GIF into a note. It sits in the note’s folder and moves, goes to the Trash and comes back with it. Each folder gets a gallery too."}]},{kind:"better",items:[{icon:"eye",title:"Read your way",text:"Nine reading themes from paper and sepia to night, plus fonts like Literata, Atkinson Hyperlegible and OpenDyslexic, in the size you like."},{icon:"sparkle",title:"A chat that feels like yours",text:"Light or dark right from Mnemo’s sidebar, a dozen quiet backgrounds, and a timeline on the right edge to jump through long chats with your thumb."},{icon:"check",title:"No more surprise sign-outs",text:"Memora keeps you signed in while you are using it; it only times out when you really step away."}]},{kind:"admin",items:[{icon:"settings",title:"Bring your own AI",text:"Settings, Mnemo: add OpenAI, Anthropic or any OpenAI-compatible server, test it, pick a default model and write instructions in your own words. Mnemo is in the terminal app too."}]}]},{version:"2.0.1",title:"A calmer reader",lead:"Notes now read like a clean page, whatever reading settings you pick.",groups:[{kind:"better",items:[{icon:"note",title:"Cleaner note text",text:"Clearer headings, even lists, quieter code and tables, and real check boxes for tasks."},{icon:"menu",title:"Contents and Details",text:"The panel beside a note has two tabs. Contents holds the outline, links and mentions."},{icon:"settings",title:"Simpler reading settings",text:"The fonts and colours that look right everywhere stay. A choice that was removed moves to the nearest one."}]}]},{version:"2.0.0",title:"A calmer, clearer Memora",lead:"Every page was redesigned around one quiet look, and the places you use most got new tools: version history, tag patterns, a summary of what your AIs do, and a cleaner way to read.",groups:[{kind:"new",items:[{icon:"refresh",title:"Version history for every note",text:"See each version and who made it, compare it with now, and restore it. Restoring adds a new version, so nothing is lost."},{icon:"tags",title:"Find notes by a pattern of tags",text:"Build “session or (memora and plan) not docker” from chips on the Tags page, and see how many notes match before you apply it."},{icon:"activity",title:"Activity, summarised",text:"Numbers, a chart, what your AIs do most and what went wrong, with every action on its own Timeline tab."},{icon:"note",title:"A cleaner way to read",text:"Fold the toolbar away with F. Contents sits beside the note, with its details as a tab."},{icon:"brain",title:"Clean view on the maps",text:"Hide every control on 3D, Graph and Canvas with C, and bring them back the same way."}]},{kind:"better",items:[{icon:"trash",title:"A safer Trash",text:"Choose where a note goes back. Deleting forever asks you to type DELETE, and also erases the note from its history."},{icon:"bolt",title:"Faster",text:"Data travels compressed, Activity remembers each time range, and the start screen leaves the moment the app is ready."},{icon:"settings",title:"Settings you can change",text:"The server name and how long browsers stay signed in. Switching the notes folder now says what moves with it."},{icon:"agents",title:"Your AIs at a glance",text:"The Live panel leads with what your AIs did last, then who is working."}]},{kind:"admin",items:[{icon:"shield",title:"For whoever runs the server",text:"Deleting a note for good over the API now needs an admin key. The database needs no migration: a 1.3 install updates in place."},{icon:"book",title:"A new licence",text:"From 2.0.0 Memora is under the GNU AGPL v3.0 or later. Forks and hosted copies keep the source open and credit Memora."}]}]}],x$={new:"New",better:"Better",admin:"Good to know"},kE="/api/ui/layout/whats-new",b$=`
|
|
4903
4903
|
.modal:has(.wn){width:min(620px,100%);padding:0;overflow:hidden}
|
|
4904
4904
|
.modal:has(.wn) .modal-head{display:none}
|
|
4905
4905
|
.modal:has(.wn) .modal-body{padding:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}
|
|
@@ -13256,7 +13256,7 @@ publish its source under the same license and keep the attribution in
|
|
|
13256
13256
|
covered by [TRADEMARK.md](TRADEMARK.md).
|
|
13257
13257
|
|
|
13258
13258
|
Versions 1.3.8 and earlier were released under the MIT License.
|
|
13259
|
-
`,l6="# Installing Memora\n\nMemora ships as two binaries plus a folder of web UI assets:\n\n| Piece | Role |\n|---|---|\n| `memora` | The server: HTTP API, MCP, web UI, and WebSocket on **one TCP port** (default `8400`) |\n| `memora-cli` | The operator console. Run it with no arguments for slash commands (`/guide`, `/web`, `/config`, ...) |\n| `assets/` | Web UI files, found through `MEMORA_ASSETS` |\n\nIt runs on Linux (x86_64, aarch64) and Windows 10/11 (x64). Install it with\n**npm** (Linux and Windows, runs as you), **Docker**, the **native** installer\n(a systemd service on Linux) or from source. On Windows, use npm. All end the\nsame way: run `memora-cli setup`, open the link it prints and enter the code.\n\n**Fastest path** (pick one, in this order of ease), then open the link the\nsetup command prints and enter the code:\n\n```bash\n# npm (Linux x86_64 / arm64, Windows x64; Node.js 22 or newer)\nnpm install -g @codrihub/memora && memora\nmemora-cli setup --minutes 15 # in a second terminal\n\n# Docker: no clone or folder permissions needed (named volumes)\ndocker run -d --name memora --restart unless-stopped -p 8400:8400 \\\n -v memora-data:/data -v memora-state:/state ghcr.io/codrihub/memora:latest\ndocker exec -it memora memora-cli setup --minutes 15\n\n# Native installer (Linux server with systemd)\ncurl -fsSL https://raw.githubusercontent.com/Codrihub/memora/main/scripts/install.sh | sudo sh\nsudo memora-cli setup --minutes 15\n```\n\n- [Network exposure](#network-exposure)\n- [Native install](#native-install)\n- [Docker](#docker)\n- [npm](#npm)\n- [Start, stop and restart](#start-stop-and-restart)\n- [Update](#update)\n- [Uninstall with memora-cli](#uninstall-with-memora-cli)\n- [Uninstall by hand (versions before 1.3.2)](#uninstall-by-hand-versions-before-132)\n- [Troubleshooting](#troubleshooting)\n- [Reverse proxy](#reverse-proxy)\n- [Backups](#backups)\n- [Automation: `--check` and `--upgrade`](#automation---check-and---upgrade)\n\n## Network exposure\n\nMemora opens exactly **one TCP port**. The HTTP API, MCP (`/mcp`), the web UI,\nand the realtime WebSocket (`/ws`) all share it. The local event intake\n`/_bus` answers on the same port but only to loopback clients.\n\nThe state database is embedded SQLite (`<state>/memora.db`). The server creates\nand migrates it on first start; it opens no port and needs no separate\ndatabase server or install.\n\nNothing else listens. Allow only that one port through the firewall, or none at\nall when a reverse proxy on the same host is the entry point\n(`--behind-proxy`).\n\n## Native install\n\nRequirements: Linux on x86_64 or aarch64 with systemd, `curl` (or `wget`),\n`tar`, `sha256sum`, and `git` (vault history uses it).\n\n```sh\n# Inspect first: https://github.com/Codrihub/memora/blob/main/scripts/install.sh\ncurl -fsSL https://raw.githubusercontent.com/Codrihub/memora/main/scripts/install.sh | sudo sh\n```\n\nPass flags after `sh -s --`, for example:\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/Codrihub/memora/main/scripts/install.sh \\\n | sudo sh -s -- --version 1.0.0 --behind-proxy\n```\n\nor download the script and run it: `sudo sh install.sh --help`.\n\nThe script is idempotent: running it again reinstalls the same files and keeps\nthe port and bind address of the existing unit unless you pass new ones.\n\n### What it does\n\n1. Downloads `memora-<version>-<arch>-linux.tar.gz` for this CPU from GitHub\n Releases (the latest, or `--version`), downloads `SHA256SUMS` from the same\n release, and refuses to continue if the checksum does not match.\n2. Installs the binaries atomically (copy to a temp file, then `mv`).\n3. Creates the system user and group `memora` (no login shell, home\n `/var/lib/memora`).\n4. Creates `/var/lib/memora/state` (`0700`) and `/var/lib/memora/vault`\n (`0750`), owned by `memora`.\n5. Writes `/etc/systemd/system/memora.service`, enables and starts it, waits\n for `/healthz`, then verifies the state database with `memora-cli db check`.\n6. Prints the next step and, when listening on every interface, a firewall\n hint.\n\n### Paths\n\n| Path | Content |\n|---|---|\n| `/usr/local/bin/memora`, `/usr/local/bin/memora-cli` | Binaries |\n| `/usr/local/share/memora/assets/` | Web UI |\n| `/usr/local/share/memora/VERSION` | Installed version (read by `--check`) |\n| `/usr/local/share/memora/install.sh` | Copy of the installer, used for `--upgrade`, `--check`, `--uninstall`, and `memora-cli update` |\n| `/var/lib/memora/state/` | `memora.db` (owner, API key hashes, sessions, settings, activity log), `backups/` |\n| `/var/lib/memora/vault/` | Suggested vault folder (chosen in the browser after the first sign-in) |\n| `/etc/systemd/system/memora.service` | The unit |\n\n`--prefix` moves the first four (default `/usr/local`), `--data-dir` moves the\nlast two (default `/var/lib/memora`).\n\n### Flags\n\n| Flag | Meaning |\n|---|---|\n| *(none)* | Install or reinstall the latest release |\n| `--version X.Y.Z` | Install that release |\n| `--from-source` | Build with `cargo build --release --locked` in the checkout the script lives in (`sudo ./scripts/install.sh --from-source`); built as `$SUDO_USER` |\n| `--from-dir PATH` | Install `PATH/memora`, `PATH/memora-cli`, `PATH/assets/` (an unpacked release, or your own build). Version from `--version`, else `PATH/VERSION` |\n| `--port N` | Port (default `8400`) |\n| `--bind ADDR` | Bind address (default `0.0.0.0`) |\n| `--behind-proxy` | Bind `127.0.0.1`; a reverse proxy on this host is the only entry |\n| `--prefix DIR` | Install prefix (default `/usr/local`) |\n| `--data-dir DIR` | Data root (default `/var/lib/memora`) |\n| `--no-start` | Install and enable, but do not start |\n| `--no-systemd` | Skip the unit and the system user (containers, tests); prints the command to start the server by hand |\n| `--upgrade` | Replace binaries and assets, keep state, restart the service if it was running |\n| `--force` | With `--upgrade`: reinstall even when already up to date |\n| `--uninstall` | Stop and remove the unit, binaries, and assets; keep data |\n| `--purge` | With `--uninstall`: also delete the data dir and the `memora` user (asks first) |\n| `--check` | Print `MEMORA_LATEST=` and `MEMORA_INSTALLED=`; change nothing |\n| `--yes`, `-y` | Never ask (needed for `--purge` without a terminal) |\n| `--dry-run` | Print every action, change nothing |\n| `--repo OWNER/NAME` | Download from another GitHub repository (forks); also settable as `MEMORA_REPO` |\n\n`MEMORA_RELEASES_URL` points the installer at a mirror that serves the same\nlayout as GitHub (`<url>/latest`, `<url>/download/vX.Y.Z/<file>`).\n\nRoot is required except for `--check`, `--dry-run`, and `--no-systemd` into a\nprefix you can write to.\n\n### Exit codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Error (see the message) |\n| `2` | Bad usage |\n| `3` | Already up to date (`--upgrade`) |\n| `4` | Network or download failure |\n| `5` | Checksum mismatch or missing from `SHA256SUMS` |\n| `6` | Not running as root |\n| `7` | Unsupported OS or CPU |\n\n### The systemd unit\n\nThe installer writes this unit (shown with the default paths and port):\n\n```ini\n[Unit]\nDescription=Memora - long-term memory for AI agents (HTTP API + MCP + web UI)\nDocumentation=https://github.com/Codrihub/memora\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nUser=memora\nGroup=memora\nWorkingDirectory=/var/lib/memora\nEnvironment=HOME=/var/lib/memora\nEnvironment=MEMORA_STATE=/var/lib/memora/state\nEnvironment=MEMORA_ASSETS=/usr/local/share/memora/assets\nEnvironment=MEMORA_PORT=8400\nEnvironment=MEMORA_BIND=0.0.0.0\nEnvironment=MEMORA_VAULT=/var/lib/memora/vault\nEnvironment=GIT_AUTHOR_NAME=Memora\nEnvironment=GIT_AUTHOR_EMAIL=memora@localhost\nEnvironment=GIT_COMMITTER_NAME=Memora\nEnvironment=GIT_COMMITTER_EMAIL=memora@localhost\nEnvironment=RUST_LOG=info\nExecStart=/usr/local/bin/memora\nRestart=on-failure\nRestartSec=3\nTimeoutStopSec=15\nLimitNOFILE=65536\nUMask=0027\n\n# Hardening\nNoNewPrivileges=yes\nAmbientCapabilities=\nCapabilityBoundingSet=\nProtectSystem=strict\nReadWritePaths=/var/lib/memora\nProtectHome=yes\nPrivateTmp=yes\nPrivateDevices=yes\nProtectKernelTunables=yes\nProtectKernelModules=yes\nProtectKernelLogs=yes\nProtectControlGroups=yes\nProtectClock=yes\nProtectHostname=yes\nRestrictAddressFamilies=AF_UNIX AF_INET AF_INET6\nRestrictNamespaces=yes\nRestrictRealtime=yes\nRestrictSUIDSGID=yes\nLockPersonality=yes\nMemoryDenyWriteExecute=yes\nSystemCallArchitectures=native\nSystemCallFilter=@system-service\nSystemCallFilter=~@privileged\n\n[Install]\nWantedBy=multi-user.target\n```\n\nA port below 1024 adds `CAP_NET_BIND_SERVICE` instead of the empty capability\nset. There are no IP restrictions (`IPAddressDeny=`) by default; use the\nfirewall, `MEMORA_DOMAIN`, or the access rules in the UI.\n\nThe installer rewrites the unit on every run. Put local changes in a drop-in:\n\n```sh\nsudo systemctl edit memora # for example, a vault outside /var/lib/memora:\n# [Service]\n# ReadWritePaths=/srv/notes\nsudo systemctl restart memora\n```\n\nBecause of `ProtectSystem=strict` and `ProtectHome=yes`, the server can only\nwrite under `/var/lib/memora`. A vault anywhere else (including `/home`) needs\nthe drop-in above (and `ProtectHome=read-only` or `no` for `/home`).\n\n### Settings\n\nThe unit sets the basics (`MEMORA_STATE`, `MEMORA_ASSETS`, `MEMORA_PORT`,\n`MEMORA_BIND`, `MEMORA_VAULT`, `RUST_LOG`) as `Environment=` lines. Everything\nelse (`MEMORA_BASE_URL`, `MEMORA_DOMAIN`, `MEMORA_TRUSTED_PROXIES`, ...) is\nstored in the state database (table `server_config`). Edit it with the\nconsole: `sudo memora-cli` → `/config`, then `/restart`.\n\nA value stored with `/config` wins over the unit's `Environment=` lines; a key\nwith no stored value uses the environment. If you stored `MEMORA_PORT` with\n`/config` and later reinstall with `--port`, change or clear it in `/config`\ntoo, otherwise the stored value keeps applying. The provisioning owner\npassword and API key are environment-only and never stored (see\n[CONFIGURATION.md](CONFIGURATION.md)).\n\nSee [CONFIGURATION.md](CONFIGURATION.md) for every variable.\n\n### First run\n\n```sh\nsudo memora-cli # opens the console; it finds the running server itself\n/guide # step-by-step, or:\n/web # prints a one-time code\n```\n\nOpen `http://<host>:8400/login`, enter the code, create the owner account, then\nchoose the vault folder (`/var/lib/memora/vault` is suggested).\n\n### Day to day\n\n```sh\nsudo systemctl status memora\nsudo systemctl restart memora\nsudo journalctl -u memora -f\nsudo memora-cli # /status, /keys, /config, /restart, /mcp ...\n```\n\n### Upgrading\n\n```sh\nsudo /usr/local/share/memora/install.sh --upgrade # latest release\nsudo /usr/local/share/memora/install.sh --upgrade --version 1.0.1\nsudo memora-cli update # same, from the console\n```\n\nBinaries and assets are swapped atomically, the state directory and vault are\nuntouched, and the service is restarted if it was running. The server migrates\n`memora.db` itself on start. Take a `memora-cli db backup` before upgrading,\nand read the [CHANGELOG](../CHANGELOG.md) before a major version bump.\n\n### Uninstall\n\n```sh\nsudo /usr/local/share/memora/install.sh --uninstall # keeps /var/lib/memora and the memora user\nsudo /usr/local/share/memora/install.sh --uninstall --purge # also deletes notes, account, keys, and the user\n```\n\nOr run `memora-cli uninstall`, which asks what to keep (see\n[Uninstall with memora-cli](#uninstall-with-memora-cli)).\n\n### Firewall\n\nOpen only the Memora port, and only when clients connect directly:\n\n```sh\nsudo ufw allow 8400/tcp\n# or\nsudo firewall-cmd --permanent --add-port=8400/tcp && sudo firewall-cmd --reload\n```\n\nBehind a reverse proxy on the same host, install with `--behind-proxy` and open\nonly the proxy's 80/443.\n\n## Docker\n\n```sh\ngit clone https://github.com/Codrihub/memora.git && cd memora\nmkdir -p data state && sudo chown -R 1000:1000 data state\ndocker compose up -d\ndocker compose exec -it gateway memora-cli # then /guide, or /web\n```\n\n`docker compose up` pulls `ghcr.io/codrihub/memora:<version>`; if the image is\nnot available (or you set `IMAGE=memora:local`) it builds from the\n`Dockerfile`. Image tags: `<version>` (for example `1.0.0`), `<major>.<minor>`\n(for example `1.0`), and `latest` (stable releases only), for `linux/amd64`\nand `linux/arm64`. The compose file pins the release it ships with; set\n`IMAGE` in `.env` to run another tag.\n\n### Volumes: `/data` and `/state`\n\nBoth must be persistent (the Compose file bind-mounts `./data` and `./state`):\n\n- `/data` is the vault: your notes, their git history, and the event\n log. Lose it and the notes are gone.\n- `/state` holds `memora.db` (owner account, password hash, API key hashes,\n sessions, settings, setup/lock state, activity log). Lose it and\n every agent key stops working, the instance falls back to first-run setup,\n and anyone who reaches the port during that window could claim it.\n\nThe container runs as uid 1000; set `MEMORA_UID`/`MEMORA_GID` in `.env` if the\nhost directories belong to another user. `MEMORA_DATA_DIR` and\n`MEMORA_STATE_DIR` move the host directories, and `MEMORA_HTTP_PORT` changes\nthe published host port. See [CONFIGURATION.md](CONFIGURATION.md#docker-compose-env).\n\n### Verify\n\n```sh\ncurl -s http://127.0.0.1:8400/healthz\ndocker compose exec gateway memora-cli db check\ndocker compose exec gateway memora-cli status\nls -l state/memora.db\n```\n\n### Upgrading\n\n```sh\ngit pull\ndocker compose pull && docker compose up -d # or: docker compose up -d --build\n```\n\nSettings: `docker compose exec -it gateway memora-cli` → `/config`, then\n`docker compose restart gateway` (`/restart` cannot restart a container from\ninside).\n\n## npm\n\nRequirements: Linux on x86_64 or arm64, or Windows 10/11 on x64; Node.js 22 or\nnewer; and `git` (vault history uses it).\n\n```sh\nnpm install -g @codrihub/memora\nmkdir -p ~/memora && cd ~/memora\nMEMORA_VAULT=./vault MEMORA_STATE=./state memora\n# in a second terminal, same folder:\nMEMORA_STATE=./state memora-cli # then /guide, or /web\n```\n\nOn Windows, in PowerShell:\n\n```powershell\nnpm install -g @codrihub/memora\nmkdir ~\\memora; cd ~\\memora\n$env:MEMORA_VAULT = '.\\vault'; $env:MEMORA_STATE = '.\\state'; memora\n# in a second terminal, same folder:\n$env:MEMORA_STATE = '.\\state'; memora-cli # then /guide, or /web\n```\n\n`npx @codrihub/memora --version` runs it without a global install.\n\n`@codrihub/memora` holds the `memora` and `memora-cli` commands and the web UI\n(used unless `MEMORA_ASSETS` is set). The binaries come from\n`@codrihub/memora-linux-x64`, `@codrihub/memora-linux-arm64` or\n`@codrihub/memora-win32-x64`, optional dependencies npm installs only on a\nmatching machine. The Linux ones are the static binaries of the GitHub\nrelease with the same version, so glibc and musl distributions both work; the\nWindows one is built with a static C runtime and needs nothing else. There is\nno install script and nothing is downloaded at install time, so it works with\n`--ignore-scripts` and from a registry mirror; it does not work with\n`--omit=optional`, which leaves the binaries out. On macOS the commands print\nwhere to go instead: use [Docker](#docker) or build from source.\n\nThe npm install sets up no service, user or data folder: the server runs as\nyou, with `MEMORA_STATE` and `MEMORA_VAULT` where you point them (`./state`\nby default). Keep the state folder private (`chmod 700 state`; on Windows,\nkeep it under your user profile), since it holds the owner account and key\nhashes. On Windows, `memora-cli` runs every command as you: there is no root\nor service account to switch to. For a long-running server, prefer the\n[native install](#native-install).\n\nUpgrade with `npm install -g @codrihub/memora@latest` (`memora-cli update`\nprints this too) and restart the server; the state database is migrated on\nstart.\n\n## Start, stop and restart\n\n`memora-cli start`, `stop` and `restart` (or `/start`, `/shutdown` and\n`/restart` in the console) work out how this install runs and do the right\nthing:\n\n| Install | What `memora-cli start / stop / restart` does | By hand |\n|---|---|---|\n| Native (systemd) | runs `systemctl start / stop / restart memora` (as root) | `sudo systemctl start memora` |\n| npm, source | runs the server in the background, with `memora.pid`, `memora.log` and `stop.token` in the state folder; `stop` asks it to end over a local, token-protected request and waits, `stop --force` kills it | run `memora` and keep it open; Ctrl+C stops it |\n| Docker | prints the host commands (a container cannot stop itself) | `docker start / stop / restart memora` |\n\nFrom the browser, the owner can shut the server down in Settings, Server, Shut\ndown: the server answers, then stops gracefully and exits with status 0, the\nsame as Ctrl+C or `systemctl stop`. A supervisor that restarts a cleanly exited\nprocess starts it again (systemd `Restart=always`, Docker\n`--restart unless-stopped`); the installer's unit uses `Restart=on-failure`, so\nit stays stopped. API keys cannot shut the server down.\n\n## Update\n\nCheck what you run first: `memora --version` and `memora-cli --version`.\n`memora-cli update` (or `/update` in the console) works out how this copy was\ninstalled and prints, or runs, the right steps. By install method:\n\n| Install | Update with | Then |\n|---|---|---|\n| npm (Windows, Linux) | `npm install -g @codrihub/memora@latest` | `memora-cli restart`, or Ctrl+C the running `memora` and start it again |\n| Docker Compose | `docker compose pull && docker compose up -d` | nothing: the container is re-created |\n| Docker run | `docker pull ghcr.io/codrihub/memora:latest`, then `docker rm -f memora` and the same `docker run` again (same volumes) | nothing |\n| Native (systemd) | `sudo memora-cli update` (runs `install.sh --upgrade`) | nothing: the service is restarted |\n| Source | `git pull && cargo build --release` | `memora-cli restart` |\n\nSettings, accounts and notes stay; the server migrates `memora.db` on start.\nTake a `memora-cli db backup` first if you are unsure.\n\n**Release zip (older Windows installs).** Windows now installs with npm. To\nswitch, stop the old server (Ctrl+C in its window), run\n`npm install -g @codrihub/memora`, and start `memora` with the same folders so\neverything carries over, for example in PowerShell:\n\n```powershell\n$env:MEMORA_STATE = 'C:\\Users\\you\\memora\\state'; $env:MEMORA_VAULT = 'C:\\Users\\you\\memora\\vault'; memora\n```\n\nThen delete the old program folder (only the `.exe` files and `assets`, not\nyour state or vault folders).\n\n## Uninstall with memora-cli\n\n```bash\nmemora-cli uninstall # or /uninstall in the console\n```\n\nIt explains what it removes for this install (the service and program\nfiles, or the npm package, or the container), then shows a checklist; press\nspace to select and Enter to continue:\n\n- **Settings and accounts** (the state folder: database, keys, sessions)\n- **Vault notes** (your vault folder)\n\nBoth are **unticked**, so by default your settings and notes are kept and a\nlater install picks them up again. Deleting the vault asks you to type its\nfolder name. Before the state folder is deleted, a final database backup is\noffered. System folders, your home folder and the program's own folder are\nnever deleted.\n\n| Install | What uninstall does |\n|---|---|\n| Native (systemd) | runs the installed `install.sh --uninstall` (adds `--purge` only when both folders are the installer's own) |\n| npm | stops the server, deletes what you ticked, then tells you to run `npm uninstall -g @codrihub/memora` |\n| Source | stops the server, deletes what you ticked; delete the program folder yourself |\n| Docker | prints `docker rm -f memora` and, for what you ticked, `docker volume rm memora-state` / `docker volume rm memora-data` |\n\nWithout a terminal it needs `--yes` and deletes only what the flags say:\n`memora-cli uninstall --yes [--delete-config] [--delete-vault]`.\n\nOn a version older than 1.3.2 there is no `uninstall` command: see\n[Uninstall by hand](#uninstall-by-hand-versions-before-132).\n\n## Uninstall by hand (versions before 1.3.2)\n\n`memora-cli uninstall` arrived in 1.3.2. On an older version it answers\n``unknown command `uninstall` ``. Either update first and then run\n`memora-cli uninstall` (npm: `npm install -g @codrihub/memora@latest`), or\nremove Memora by hand with the steps below. They only touch Memora: never use\nwildcards, and never delete a parent folder or your home folder.\n\n**1. Check the version.** `memora --version` and `memora-cli --version`.\n\n**2. Find the folders.** Memora keeps two folders:\n\n- the **state folder** (settings, accounts, keys): `MEMORA_STATE`, or by\n default `state` inside the folder where you started `memora` (for example\n `C:\\Users\\you\\state` or `~/memora/state`);\n- the **vault folder**: your notes, wherever you chose.\n\nThe server prints both when it starts:\n`Memora HTTP server starting vault=... state=...`. `memora-cli status`, run in\nthe same folder, shows the state folder too.\n\n**3. Stop Memora.** Press Ctrl+C in the window where `memora` runs (or close\nthat window). Then make sure it is gone:\n\n| Shell | Check | Stop if still running |\n|---|---|---|\n| PowerShell | `Get-Process memora -ErrorAction SilentlyContinue` | `Stop-Process -Name memora` |\n| cmd | `tasklist /FI \"IMAGENAME eq memora.exe\"` | `taskkill /IM memora.exe` |\n| Linux, macOS | `pgrep -ax memora` | `pkill -x memora` |\n\n**4. Remove the program.**\n\n| Install | Commands |\n|---|---|\n| npm (any OS) | `npm uninstall -g @codrihub/memora`, then `npm ls -g --depth=0`: if `@codrihub/memora-win32-x64` (or `-linux-x64`, `-linux-arm64`) is still listed, `npm uninstall -g` that exact name |\n| Docker run | `docker rm -f memora`, then `docker image rm ghcr.io/codrihub/memora:latest` |\n| Docker Compose | `docker compose down` in the folder of `docker-compose.yml` (no `-v`) |\n| Native (systemd) | `sudo /usr/local/share/memora/install.sh --uninstall` (keeps `/var/lib/memora`) |\n| Release zip | delete the folder that holds `memora.exe`, `memora-cli.exe` and `assets` (check its contents first, as below) |\n\n**5. Delete the state folder (optional).** Look inside first: it should hold\n`memora.db` (and maybe `memora.log`, `memora.pid`, `stop.token`, `backups`).\nThen delete that exact path:\n\n```powershell\n# Windows, PowerShell\nGet-ChildItem -LiteralPath 'C:\\Users\\you\\state'\nRemove-Item -LiteralPath 'C:\\Users\\you\\state' -Recurse -Confirm\n```\n\n```bat\n:: Windows, cmd\ndir \"C:\\Users\\you\\state\"\nrmdir /S \"C:\\Users\\you\\state\"\n```\n\n```sh\n# Linux, macOS\nls -la ~/memora/state\nrm -rI -- ~/memora/state\n```\n\nDocker: `docker volume ls`, then remove the exact names,\n`docker volume rm memora-state`. Compose: check and delete the `./state`\nfolder next to `docker-compose.yml`. Native: `/var/lib/memora/state`\n(or `install.sh --uninstall --purge`, which also deletes the notes, see below).\n\n**6. The vault folder: only if you are sure.** It holds your notes. It is\noptional to delete it; copy it somewhere safe first (it is plain Markdown).\nUse the same two steps on its exact path: look inside (`Get-ChildItem` /\n`ls`), then `Remove-Item -LiteralPath '<vault>' -Recurse -Confirm` or\n`rm -rI -- <vault>`. Docker: `docker volume rm memora-data`, or the `./data`\nfolder with Compose. Native: `sudo /usr/local/share/memora/install.sh\n--uninstall --purge` deletes `/var/lib/memora` with the notes, the account\nand the `memora` user.\n\n## Troubleshooting\n\n**``memora-cli: unknown command `uninstall` ``** (or `start`, `stop`,\n`restart`). You run a version older than 1.3.2. Update, then run the command\nagain: `npm install -g @codrihub/memora@latest`, then `memora-cli uninstall`.\nOr remove it by hand: [Uninstall by hand](#uninstall-by-hand-versions-before-132).\n\n**`/update` says \"not installed with install.sh (built from source)\" on an\nnpm install.** Older versions could miss an npm install. Update with npm,\n`npm install -g @codrihub/memora@latest`, and restart the server; newer\nversions detect npm reliably. Never run `cargo build` for an npm install.\n\n**`/restart` says \"systemctl restart\" on npm or Windows.** Same cause (older\nversion). Stop the server with Ctrl+C in its window and run `memora` again, or\nupdate and use `memora-cli restart`.\n\n**Which version do I have?** `memora --version` and `memora-cli --version`.\nThe latest release is on\n[GitHub Releases](https://github.com/Codrihub/memora/releases).\n\n## Reverse proxy\n\nRun Memora on loopback (`--behind-proxy` natively; in Docker set\n`MEMORA_HTTP_PORT=127.0.0.1:8400` in `.env`) and let the proxy terminate TLS.\nThen set, with `/config` or in `.env`:\n\n| Variable | Why |\n|---|---|\n| `MEMORA_BASE_URL=https://memory.example.com` | Public URL; links and MCP snippets use it, and its host becomes an allowed domain |\n| `MEMORA_DOMAIN=memory.example.com` | Only these hostnames are served; requests for the bare IP or other names get 404 |\n| `MEMORA_TRUSTED_PROXIES=203.0.113.10` | Proxies whose forwarding headers are believed. Loopback (same-host nginx, cloudflared) is always trusted; only list remote proxies |\n\nIn Docker, a proxy on the host reaches the container through the Docker\nnetwork, so the container sees the network's gateway address (for example\n`172.18.0.1`) instead of loopback. Add that address to\n`MEMORA_TRUSTED_PROXIES`, otherwise every request appears to come from it.\n\nThe proxy must forward `Host`, `X-Forwarded-For`, and `X-Forwarded-Proto`, and\nupgrade WebSockets on `/ws`. nginx and Caddy examples are in\n[DEPLOYMENT.md](DEPLOYMENT.md).\n\n## Backups\n\nBack up **both** the state database and the vault. The database is small but\ncritical.\n\nState, online (the server keeps running):\n\n```sh\nsudo memora-cli db backup # state/backups/memora-<UTC time>.db, keeps the newest 10\nsudo memora-cli db backup --to /var/backups/memora.db\nsudo memora-cli db check # integrity, permissions, sizes, last backup age\ndocker compose exec gateway memora-cli db backup # Docker: lands in ./state/backups/\n```\n\nThe copy is a consistent snapshot (`VACUUM INTO`), checked with\n`integrity_check`, mode 0600. Never `cp` a live `memora.db`: recent commits sit\nin `memora.db-wal`. Restore with the server stopped:\n\n```sh\nsudo systemctl stop memora\nsudo memora-cli db restore /var/backups/memora.db # verifies it; keeps the replaced DB in state/backups/\nsudo systemctl start memora\n```\n\nAlso keep a copy of `state/key-seal.bin`, which encrypts the sealed API key\ncopies. Vault and state together: archive both with the server stopped:\n\n```sh\nsudo systemctl stop memora\nsudo tar -C /var/lib/memora -czf memora-backup-$(date +%F).tar.gz state vault\nsudo systemctl start memora\n```\n\nKeep backups private: the database holds password and key hashes (never\nplaintext secrets).\n\n## Automation: `--check` and `--upgrade`\n\nThese are the contract for scripts and automation.\n\n```sh\n$ /usr/local/share/memora/install.sh --check\nMEMORA_LATEST=1.0.1\nMEMORA_INSTALLED=1.0.0\n```\n\n`MEMORA_INSTALLED` comes from `/usr/local/share/memora/VERSION` (written by\nthe installer), else from `memora --version`, else `unknown` (or `none` when\nnothing is installed). `MEMORA_LATEST` is `unknown` and the exit code `4` when\nGitHub cannot be reached. `--check` needs no root.\n\n```sh\n$ sudo /usr/local/share/memora/install.sh --upgrade --yes [--version X.Y.Z]\n...\nMEMORA_UPGRADE_RESULT=ok FROM=1.0.0 TO=1.0.1\n```\n\n`--upgrade --yes` never prompts. The last line of output is always\n`MEMORA_UPGRADE_RESULT=<ok|uptodate|error> FROM=<old> TO=<new>`, and the exit\ncode is `0` (ok), `3` (already up to date), `4` (network), `5` (checksum),\n`6` (not root), or `1`/`2` for other errors.\n",yY="# Configuration\n\nAll server state, settings included, lives in one SQLite database,\n`<MEMORA_STATE>/memora.db` (see [DATABASE.md](DATABASE.md)). Server settings are\nrows in the `server_config` table, edited with `memora-cli` (`/config` in the\nconsole). The process environment (systemd `Environment=`, Docker\n`environment:`) applies to every key that has no row.\n\n## Precedence\n\nFor each server setting:\n\n1. a row in `server_config` (set with `/config`), else\n2. the process environment (non-empty value), else\n3. the built-in default.\n\nThe server reads `server_config` once at startup, before anything else, so a\nchange made with `/config` applies after a restart (`/restart` for a native\ninstall, `docker compose restart gateway` in Docker). Clearing a value in\n`/config` deletes the row, and the environment or default applies again.\n\nA row wins over the environment. If you set `MEMORA_PORT` with `/config` and\nlater change the port in the systemd unit or `.env`, the row still applies\nuntil you clear it.\n\n## Server settings\n\n| Name | Default | Where it can live | What it does |\n|---|---|---|---|\n| `MEMORA_PORT` | `8400` | `server_config` or env | HTTP port (API, MCP, web UI, WebSocket). 1-65535. |\n| `MEMORA_BIND` | `127.0.0.1` | `server_config` or env | Bind address. `0.0.0.0` for every interface (the container image and the installer set it). |\n| `MEMORA_BASE_URL` | empty | `server_config` or env | Public URL, for example `https://memory.example.com`. Used for OAuth metadata and connection snippets; its host is also an allowed domain. |\n| `MEMORA_DOMAIN` | empty (any host) | `server_config` or env | Allowed hostnames, comma separated (`*.example.com` works). Requests for other hosts get 404. Loopback names are always allowed. |\n| `MEMORA_TRUSTED_PROXIES` | empty | `server_config` or env | IPs of remote reverse proxies whose forwarding headers are trusted. Loopback is always trusted. |\n| `MEMORA_ARM_TTL` | `300` | `server_config` or env | Accepted and validated (30-86400 seconds), but the server and `memora-cli` do not read it: the setup / reset window length comes from `memora-cli --minutes` (default 5 minutes). |\n| `MEMORA_VAULT` | empty (`data` as last resort) | `server_config` or env | Suggested vault folder. The vault in use is chosen in the browser (or with `memora-cli vault`) and stored in the `settings` table. |\n| `MEMORA_VAULT_AUTO` | `false` | `server_config` or env | `true` (also `1`, `yes`, `on`): use `MEMORA_VAULT` at startup instead of asking in the browser, only while no vault is configured and if the folder is writable. |\n| `MEMORA_ADMIN_USER` | `admin` | `server_config` or env | Name of the owner created at startup when no owner exists (needs `MEMORA_ADMIN_PASSWORD`). |\n| `RUST_LOG` | `info` | `server_config` or env | Log filter, for example `info` or `memora=debug`. |\n\n`server_config` accepts only these ten keys. Values are trimmed and validated\n(numbers in range, `true`/`false`, a valid user name, no control characters, at\nmost 2048 bytes).\n\n## Environment only\n\n| Name | Default | What it does |\n|---|---|---|\n| `MEMORA_ADMIN_PASSWORD`, `MEMORA_ADMIN_PASSWORD_FILE` | unset | Creates the owner at startup when none exists (at least 10 characters). Only the argon2id hash is stored; an existing owner is never replaced. |\n| `MEMORA_API_KEY`, `MEMORA_API_KEY_FILE` | unset | Installs an agent API key with id `k_env` and scopes `mcp`, `read`, `write` (at least 24 characters). Only its SHA-256 is stored; the key is replaced when the value changes. |\n| `MEMORA_STATE` | `state` (relative to the working directory) | State directory holding `memora.db`. Created with mode 0700 if missing. |\n| `MEMORA_ASSETS` | the `crates/http/assets` folder of the build tree | Directory of the web UI assets. |\n| `MEMORA_INSTALL` | set by the npm launcher (`npm`) and the Docker image (`docker`) | How this copy was installed: `npm`, `docker`, `native`, `zip` or `source`. `memora-cli update`, `start`, `stop`, `restart` and `uninstall` use it to pick the right steps; when unset they work it out from the program's path. |\n| `MEMORA_SETUP_HINT` | `memora-cli setup (run on the server)` | Hint returned by `GET /api/auth/state` and shown on the login screen. |\n| `MEMORA_UPDATE_CHECK` | `true` | Release check: shortly after start and then every 6 hours the server asks GitHub (`api.github.com/repos/Codrihub/memora/releases/latest`) for the newest release and the web UI shows when an update is available. The same check reads the repository's star count (`api.github.com/repos/Codrihub/memora`), shown in What's new. `false` (also `0`, `no`, `off`) turns both off; no network call is made. |\n\nThe two secrets can never be stored in `server_config` (the schema rejects\nthem). The `_FILE` variants read the value from a file, for example a Docker\nsecret; a non-empty file wins over the plain variable.\n\nIn `/config`, `MEMORA_API_KEY` offers to create an API key directly, and\n`MEMORA_ADMIN_PASSWORD` points to `/setup` or `/reset`.\n\n## Instance settings (web UI)\n\nThe `settings` table holds one row, edited from the Settings page of the web UI:\n\n| Key | Default | Range | What it does |\n|---|---|---|---|\n| `realm` | `Memora` | 1-64 characters | Instance name shown in the UI and reported by `/api/config` and `/api/auth/state`. |\n| `session_ttl` | `10800` (3 hours) | 300-2592000 seconds | Idle timeout of a browser session: any use renews it (requests, and an open tab in use). |\n| `session_max_age` | `0` | `0` or at least `session_ttl` | Absolute session lifetime in seconds. `0` means no cap. |\n| `min_password_len` | `10` | 10-256 | Minimum owner password length. |\n| `log_max_mb` | `8` | 1-512 | Size limit in MB of the vault event log (`.events.jsonl`). |\n| `log_max_days` | `0` | 0-3650 | Age limit in days of the vault event log. `0` means no age limit. |\n| `vault_path` | unset | absolute path | The vault folder. Set in the browser after the first sign-in, or with `memora-cli vault PATH`. |\n\nTwo more settings live in the `ui_layout` table and in a file beside the database:\n\n| Setting | Default | Where | What it does |\n|---|---|---|---|\n| Largest image | 5 MB | Settings, Images (`POST /api/settings/media`, admin); stored as the `srv-media` document | Uploads above this size are refused, from the app, the HTTP API and MCP `upload_image` alike. 0.1 to 50 MB. |\n| Mnemo | not set up | Settings, Mnemo, or `/mnemo setup` in the console; stored in `assistant.sqlite3` | Providers (OpenAI, Anthropic, one OpenAI-compatible server) with sealed API keys, models (pinned, hidden, default, context window and reply limit), temperature, reply and context limits, tool steps per reply, your instructions, and the floating button. |\n\n## memora-cli options\n\n| Option | Default | What it does |\n|---|---|---|\n| `--state <DIR>` | `$MEMORA_STATE`, else the state directory of the running `memora` server, else `./state` | State directory to work on. |\n| `--minutes <N>` | `5` | Window length for `setup` and `reset-password`, 1-60. |\n| `--ttl <SECONDS>` | | Window length in seconds (at most 3600). `--minutes` wins when both are given. |\n| `--create` | | With `vault PATH`: create the folder if it does not exist. |\n\nRun as root, `memora-cli` does all database work as the owner of the state\ndirectory, so no root-owned `memora.db*` files appear. See\n[INSTALL.md](INSTALL.md) and [DEPLOYMENT.md](DEPLOYMENT.md) for the commands.\n\n## Docker Compose (`.env`)\n\nThese variables are read by `docker-compose.yml`, not by Memora itself:\n\n| Name | Default | What it does |\n|---|---|---|\n| `COMPOSE_PROJECT_NAME` | `memora` | Compose project name, also the container name prefix. |\n| `IMAGE` | `ghcr.io/codrihub/memora:<version>` | Image to run or build. The compose file pins the release it ships with. |\n| `MEMORA_HTTP_PORT` | `8400` | Host port mapped to the container's port 8400. Use `127.0.0.1:8400` to publish on loopback only. |\n| `MEMORA_DATA_DIR` | `./data` | Host path mounted at `/data` (the vault). |\n| `MEMORA_STATE_DIR` | `./state` | Host path mounted at `/state` (the state directory). |\n| `MEMORA_UID`, `MEMORA_GID` | `1000` | uid:gid the container runs as. Must own both host directories. |\n| `MEMORA_ARM_TTL` | `300` | Passed to the container unchanged. |\n\nCompose also passes these through from `.env` to the container:\n`MEMORA_BASE_URL`, `MEMORA_DOMAIN`, `MEMORA_TRUSTED_PROXIES`,\n`MEMORA_VAULT_AUTO`, `MEMORA_ADMIN_USER`, `MEMORA_ADMIN_PASSWORD`,\n`MEMORA_ADMIN_PASSWORD_FILE`, `MEMORA_API_KEY`, `MEMORA_API_KEY_FILE`,\n`MEMORA_SETUP_HINT`, `MEMORA_UPDATE_CHECK`, and `RUST_LOG`.\n\nInside the container the image sets `MEMORA_VAULT=/data`,\n`MEMORA_STATE=/state`, `MEMORA_PORT=8400`, `MEMORA_BIND=0.0.0.0`,\n`MEMORA_ARM_TTL=300`, `MEMORA_ASSETS=/app/assets`, `MEMORA_INSTALL=docker`,\nand `RUST_LOG=info`.\n\n## State directory\n\n| Path | Content |\n|---|---|\n| `memora.db` (+ `-wal`, `-shm`) | The state database: owner, API keys (hashes), tool switches and per-key permissions, OAuth clients and grants, privacy rules, sessions (hashed ids), setup window and lock state, access rules, settings, `server_config`, activity log. Mode 0600, WAL mode, must be on a local filesystem. See [DATABASE.md](DATABASE.md). |\n| `key-seal.bin` | 32-byte master key (mode 0600) that encrypts the copies of dashboard-created API keys, so the owner can show a key again. Created on first use. Back it up together with `memora.db`. |\n| `assistant.sqlite3` (+ `-wal`, `-shm`) | Mnemo, the built-in agent: providers (API keys sealed with `key-seal.bin`), models, preferences, chats and messages. Mode 0600. Separate from `memora.db`, so the main schema is unchanged; delete it to forget every Mnemo chat and key. Back it up with `memora.db` if you want to keep chats. |\n| `backups/` | `memora-cli db backup` output (newest 10 kept by default). |\n| `exchange/` | Zips written by the `export_memory` MCP tool and read by `import_memory` (mode 0700, created on first use). Private to this instance; delete old zips when no longer needed. |\n| `legacy-json-<unix time>/` | JSON state files found at startup, moved here after their one-time import into `memora.db`. |\n| `internal.token` | Created by the Docker entrypoint. Not used by Memora. |\n\n## Vault files\n\nThe vault holds the markdown notes plus derived and metadata files. See\n[ARCHITECTURE.md](ARCHITECTURE.md#vault-markdown-portable) for the full list.\nThe important ones for operations are `.git/` (history), `.events.jsonl`\n(event log), and `.Trash/`\n(soft-deleted notes; `.Trash/.index.json` remembers where each one came from,\nso `restore_trash` puts it back there; `.Trash/.assets/<entry>/` keeps the images\nof a trashed note until it is restored or deleted for good). Images uploaded to a\nnote are ordinary files in the note's folder.\n\n## Version history\n\nVersion history (`get_history`, `get_note_at`, `diff`, `restore_memory`,\n`snapshot`) is on when the vault folder is a git repository of its own, that is\nwhen it has a `.git/` directory. Memora does not create one, so a new vault has\nno history and these tools answer \"version history is off\". To turn it on,\ninstall `git` and run, once:\n\n```sh\ngit -C /path/to/vault init\ngit -C /path/to/vault add -A\ngit -C /path/to/vault commit -m \"start history\"\n```\n\n(In Docker, the vault is the host directory mounted at `/data`.) From then on\nevery change made through Memora is committed automatically. Each commit's\nauthor is the agent or user whose call made the change; the committer is the\nvault's git identity (`git config user.name` / `user.email`), or `Memora\n<memora@localhost>` when none is set. Git never searches above the vault, so a\nvault inside another repository still needs its own `git init`.\n\nA snapshot (`snapshot` tool) commits pending changes and tags the last commit\nas `snap-<label>`; pass that tag as `rev` to `get_note_at`, `diff` or\n`restore_memory`.\n\nDeleting a note for good (Delete forever or Empty trash in the app,\n`/api/trash/delete`, `/api/trash/empty`, `delete_memory` with `permanent`)\nalso erases it from the history: Memora rewrites the vault's git history so\nno commit, snapshot tag or object keeps its text, any name it had, its trash\nrecord or its path in a commit message, then expires the reflog and runs\n`git gc --prune=now`. Other notes keep all their versions, but their revision\nids change, so old revision ids (and clones or pushes of the vault made\nbefore) no longer match. Moving a note to the Trash keeps its history.\n",wY='# MCP\n\nMemora exposes the vault to agents through the Model Context Protocol. The\nserver speaks JSON-RPC 2.0 over the Streamable HTTP transport at `/mcp`, on the\nsame port as the HTTP API and the web UI. There is one MCP endpoint and one tool\ncatalog.\n\n| | |\n|---|---|\n| Endpoint | `POST /mcp` |\n| Protocol versions | `2025-06-18` (preferred), `2025-03-26`, `2024-11-05` |\n| Auth | API key in `Authorization: Bearer <key>` or `X-API-Key: <key>`, or an OAuth 2.1 access token |\n| Discovery card | `GET /.well-known/mcp.json` (public) |\n| Readable catalog | `GET /tools` (HTML page, public) |\n| Catalog size | 77 tools, plus 5 admin tools for keys with the `admin` scope |\n\n`initialize` answers with the protocol version the client asks for when it is\none of the three above, and with `2025-06-18` otherwise.\n\n## Transport\n\n- Requests are JSON-RPC 2.0 objects sent with `POST /mcp`. Batches (JSON\n arrays) are not supported.\n- Responses are plain JSON (`application/json`), with one exception below.\n- `initialize` returns an `Mcp-Session-Id` header (`<catalog epoch>.<random>`).\n The epoch is a hash of the server version and the tools the caller may use, so\n it changes when the server is upgraded, a tool is switched on or off, or the\n key\'s scopes or tool grant change. No session id is ever refused: unknown or\n old ids work, and malformed ones count as no session.\n- When a request carries a session id whose catalog has changed since that\n session last heard, and its `Accept` header allows `text/event-stream`, the\n answer is an SSE stream with two events: the notification\n `notifications/tools/list_changed`, then the normal response. Each change is\n sent once per session (remembered in memory; a restart forgets, and the\n epoch in the id takes over). JSON-only clients always get plain JSON.\n- `GET /mcp` returns `405 Method Not Allowed` (there is no standalone server\n stream). `DELETE /mcp` with a session id returns `204 No Content`; without\n one it returns `405`.\n- A notification (a `notifications/*` method without an `id`) gets\n `202 Accepted` and no body.\n- `/mcp` needs a configured vault. Until one is chosen it returns\n `409 {"error":"vault not configured","needs_vault":true}`.\n- A browser session (cookie) may also call `/mcp`. It then needs a same-origin\n request, like the rest of the JSON API.\n\nThe server speaks Streamable HTTP only. A client that can only launch local stdio\nservers can use a bridge such as `mcp-remote` (see below).\n\n## Connecting an agent\n\n### With an API key\n\nCreate a key in the web UI (Keys page), with `memora-cli` (`/keys`), or with\n`POST /api/keys`. The raw key (`memora_live_...`) is shown once. By default a key gets\nthe scopes `mcp`, `read` and `write` and may call every tool. See\n[Tool switches and per-key permissions](contracts/tools-permissions.md) to\nnarrow it.\n\nUse `http://localhost:8400/mcp` for a local install, or your public URL such as\n`https://memory.example.com/mcp` behind a reverse proxy. When the server sets\n`MEMORA_DOMAIN` or `MEMORA_BASE_URL`, requests for any other host get `404`, so\nuse that domain.\n\nClaude Code:\n\n```bash\nclaude mcp add --transport http memora https://memory.example.com/mcp \\\n --header "Authorization: Bearer memora_live_REPLACE_WITH_YOUR_KEY"\n```\n\nCursor, Windsurf and other clients with an `mcpServers` JSON config (VS Code\nuses the key `servers` in `.vscode/mcp.json`):\n\n```json\n{\n "mcpServers": {\n "memora": {\n "type": "http",\n "url": "http://localhost:8400/mcp",\n "headers": {\n "Authorization": "Bearer memora_live_REPLACE_WITH_YOUR_KEY"\n }\n }\n }\n}\n```\n\nCodex (`~/.codex/config.toml`), with the key in the `MEMORA_API_KEY`\nenvironment variable:\n\n```toml\n[mcp_servers.memora]\nurl = "https://memory.example.com/mcp"\nbearer_token_env_var = "MEMORA_API_KEY"\n```\n\nClients that only run local stdio servers, such as the Claude Desktop config\nfile, can bridge with `mcp-remote` (needs Node.js):\n\n```json\n{\n "mcpServers": {\n "memora": {\n "command": "npx",\n "args": [\n "-y", "mcp-remote", "https://memory.example.com/mcp",\n "--header", "Authorization: Bearer memora_live_REPLACE_WITH_YOUR_KEY"\n ]\n }\n }\n}\n```\n\nSome clients send the key as `X-API-Key: <key>` instead. Both headers are\naccepted.\n\n### With OAuth\n\nClients that support MCP authorization (for example Claude and ChatGPT custom\nconnectors, or Claude Code without a `--header`) can connect with only the URL:\n\n```bash\nclaude mcp add --transport http memora https://memory.example.com/mcp\n```\n\nThe flow:\n\n1. The client calls `/mcp` without credentials and gets `401` with\n `WWW-Authenticate: Bearer resource_metadata="https://memory.example.com/.well-known/oauth-protected-resource"`.\n2. It reads the protected resource metadata (RFC 9728) and the authorization\n server metadata at `/.well-known/oauth-authorization-server` (RFC 8414; also\n served at `/.well-known/openid-configuration` and under a `/mcp` suffix).\n3. It registers itself with dynamic client registration at\n `POST /oauth/register` (RFC 7591), or uses an HTTPS client metadata document\n URL as its `client_id`. The owner can also register clients in the web UI.\n Redirect URIs must be HTTPS, or plain HTTP on `localhost`, `127.0.0.1` or\n `[::1]`.\n4. It opens `/oauth/authorize` (authorization code with PKCE `S256` only). The\n browser lands on the Memora sign-in page, and the signed-in owner approves or\n denies the connection on a consent card. Codes are valid for 10 minutes.\n5. It exchanges the code at `POST /oauth/token` and receives an access token and\n a refresh token. The only OAuth scope is `mcp`.\n\nThe access token is a regular Memora API key named after the client. It starts\nwith the default scopes (`mcp`, `read`, `write`) and every tool, and it shows up\non the Keys page like any other key, so you can restrict, disable or delete it\nthere. The access token has no expiry. A `refresh_token` grant replaces it with\na fresh one (the old token stops working at once) and rotates the refresh token.\nDisabling or deleting the key ends the connection.\n\nSet `MEMORA_BASE_URL` (for example `https://memory.example.com`) when the server\nruns behind a proxy, so the issuer and endpoint URLs in the metadata are the\npublic ones. Without it the server derives them from the request headers.\n\n### Test from a shell\n\n```bash\ncurl -s -X POST http://localhost:8400/mcp \\\n -H "Authorization: Bearer memora_live_REPLACE_WITH_YOUR_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{"jsonrpc":"2.0","id":1,"method":"tools/list"}\'\n```\n\n## Discovery card\n\n`GET /.well-known/mcp.json` needs no auth and returns:\n\n| Field | Value |\n|---|---|\n| `name` | `memora` |\n| `version` | The server version |\n| `description` | One-line description of the server |\n| `mcp` | `{endpoint: "/mcp", transports: ["streamable-http"], protocolVersion: "2025-06-18"}` |\n| `auth` | `{type: "api-key", headers: ["Authorization: Bearer <key>", "X-API-Key: <key>"], oauth: "/.well-known/oauth-authorization-server"}` |\n| `capabilities` | `{tools: true, resources: true, prompts: false}` |\n| `tools` | Every catalog tool as `{name, category, description, enabled}`. `enabled` is `false` for tools switched off on this server. Admin tools are not listed. |\n| `resources` | `[{uri, name}]` for the three resources below |\n\nThe card is the same for every caller. To see what a given key may call, use\n`tools/list` with that key.\n\n## Methods\n\n| Method | Purpose |\n|---|---|\n| `initialize` | Handshake. Returns `protocolVersion`, `serverInfo` (`{name, version}`) and `capabilities` (`tools` with `listChanged: true`, `resources` with `listChanged: false`). |\n| `notifications/initialized` | Client notification. Without an `id` it gets `202 Accepted`. |\n| `tools/list` | The tools the caller may use, each with `name`, `description` (what it does and when to use it), `inputSchema`, and `_meta.category`. |\n| `tools/call` | Runs one tool. Params are `{name, arguments}`. |\n| `resources/list` | Lists the three resources below. |\n| `resources/read` | Reads one resource. Params are `{uri}`. |\n\nThere are no prompts and no pagination cursors. The only notification the server\nsends is `notifications/tools/list_changed` (see Transport).\n\n### Resources\n\n| URI | Content |\n|---|---|\n| `memory://catalog` | Every catalog tool with `name`, `category`, `description`, `when`, and `inputSchema` (JSON) |\n| `memory://schema` | Data shapes for a note, a folder, the graph, and activity (JSON) |\n| `memory://guide` | A short guide for agents using the vault (Markdown) |\n\n`resources/read` returns `{contents: [{uri, mimeType, text}]}`.\n\n## Results and errors\n\nA successful tool call returns the tool\'s JSON result as text:\n\n```json\n{\n "jsonrpc": "2.0",\n "id": 2,\n "result": {\n "content": [{ "type": "text", "text": "{...}" }],\n "isError": false\n }\n}\n```\n\nA tool that fails (bad arguments, note not found, unknown tool name) returns the\nsame envelope with `isError: true` and the error message as the text. The HTTP\nstatus stays `200`.\n\nJSON-RPC errors:\n\n| Code | When |\n|---|---|\n| `-32700` | The body is not valid JSON (HTTP `400`). |\n| `-32600` | The body is not a JSON-RPC request object (HTTP `400`). |\n| `-32601` | Unknown method: `unsupported method: <method>`. |\n| `-32602` | `resources/read` with an unknown URI: `unknown resource: <uri>`. |\n| `-32003` | The tool exists but the caller may not use it. Messages: `tool not allowed for this API key: <name>`, `tool disabled on this server: <name>`, `API key lacks the \'write\' scope for tool: <name>`. |\n\nHTTP errors before JSON-RPC runs:\n\n| Status | When |\n|---|---|\n| `401` | No key, or a key that is unknown, disabled, deleted or replaced by a roll (`invalid API key`). Carries a `WWW-Authenticate` header that points OAuth clients at the protected resource metadata. |\n| `403` | The key lacks the `mcp` scope (`{"error":"API key lacks the \'mcp\' scope","required_scope":"mcp"}`), or a browser request failed the same-origin check. |\n| `405` | Any method other than `POST`. |\n| `409` | No vault is configured yet. |\n| `429` | Rate limit or cooldown after failed attempts. |\n\n## What each key sees\n\n`tools/list` is filtered per caller:\n\n- A tool switched off on the server is hidden for everyone.\n- A key whose tool list is not `"*"` only sees the tools in its list.\n- A key without the `write` scope only sees read-only tools.\n- Admin tools are added for keys with the `admin` scope (and for browser\n sessions).\n\n`tools/call` on a tool that `tools/list` would hide returns `-32003`. Details\nare in [Tool switches and per-key permissions](contracts/tools-permissions.md).\n\n### Privacy rules\n\nThe owner can hide notes and folders from specific agents (web UI,\n`/api/privacy`, or the `privacy_*` admin tools). For an API key covered by a\nrule, every tool works as if the hidden paths did not exist: they are left out\nof listings, search, the graph, tags, events, logs, locks and folder metadata; a\nhidden path named in an argument is answered as not found, for reads and writes\nalike; and folder operations that would carry hidden items along are refused.\nIf the rules cannot be read, the key sees nothing (fail closed). Browser\nsessions are never filtered.\n\n## Tools\n\nR = read-only (needs only the `mcp` scope). W = changes the vault or server\nstate (also needs the `write` scope). Unless marked required, arguments are\noptional. Paths are vault-relative, for example `Projects/Plan.md`. A path\ncopied in the web app (Copy path in a note or folder menu) works as is as the\n`path` argument of `read_memory` and the other tools.\n\n### Notes (`note`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `list_memory` | R | none | Every note grouped by its folder, the full parent path (`Projects/Atlas`; `Root` for the top level): `{folder: [{path, name, folder, mtime}]}`. |\n| `read_memory` | R | `path` (string, required) | Markdown body, frontmatter, tags and backlinks of one note. A `\\` in a path is read as `/`; replies echo the normalized path. |\n| `create_memory` | W | `title` (string, required), `folder` (string relative to the vault, default `Memory` when omitted or empty; `Root` for the top level), `content` (string; default is a stub with `created` frontmatter and a heading) | Creates `<folder>/<title>.md` and returns `{ok, path}`. A trailing `.md` in the title is dropped; `/` and `\\` in a title, an absolute folder and a folder that is a note are refused. Spaces are kept; `: * ? " < > | # ^ [ ]` and a leading dot are removed and names are cut at 80 characters; the reply then adds `renamed_from` and a `note`. A note whose name differs only in case from an existing one is refused. |\n| `save_memory` | W | `path` (string, required), `content` (string, required) | Replaces the whole note. |\n| `patch_memory` | W | `path` (string, required), `ops` (array, required) | Partial edits. Each op is an object: `{op:"append", text}`, `{op:"prepend", text}`, `{op:"replace", find, with}`, `{op:"set_field", field, value}`, `{op:"add_tag", tag}`, `{op:"remove_tag", tag}`. |\n| `delete_memory` | W | `path` (string, required), `permanent` (boolean, default false) | Moves a note to the Trash (`.Trash`), remembering where it came from and who deleted it: `{ok, path, trashed, to}`. `list_trash` shows it and `restore_trash` brings it back. `permanent: true` deletes it for good instead (`{ok, path, permanent}`) and is refused for keys without the `admin` scope. With version history on, every earlier version is erased from the history as well (every name the note had, its trash record and the commit messages naming it; other notes keep their versions but their revision ids change), so no one, agents included, can read it again. |\n| `move_memory` | W | `path` (string, required), `folder` (string, required; relative to the vault, `Root` for the top level) | Moves a note into another folder. Wikilinks resolve by note name, so they keep working. |\n| `rename_memory` | W | `path` (string, required), `new_name` (string, required) | Renames a note in its folder. |\n| `upload_image` | W | `path` (string, required: the note the image belongs to), `name` (string, required, e.g. `diagram.png`), `data` (string, required: base64 or a `data:image/...;base64,` URL), `alt` (string), `append` (boolean, default false) | Stores a PNG, JPEG, WebP or GIF in the note\'s own folder (checked by content; the upload limit in Settings, Images applies, 5 MB by default). Identical bytes reuse the existing file; a taken name gets `-1`, `-2` ...: `{ok, path, name, bytes, url, markdown}`. Show it in the note with the returned `markdown` line, ``; `append: true` adds that line to the end of the note. The image then moves, goes to the Trash, is restored and is deleted with its note. |\n| `list_images` | R | `folder` (string; `Root` or empty for the top level) or `path` (a note) | The images of one folder (not its sub folders), each with `used_in` (the notes and sections that show it); with `path`, the images that note shows and every image of its folder. |\n\n### Search (`search`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_stats` | R | none | Counts of notes, links and folders. |\n| `search_memory` | R | `q` (string, required; `query` is accepted as an alias), `limit` (integer, default 12) | Search titles and bodies. Supports `tag:x` and `#x`. |\n\n### Query (`query`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `query_memory` | R | `folder`, `tags`, `author`, `type`, `status` (strings), `limit` (integer, default 50) | Filter notes by frontmatter. |\n| `find_similar` | R | `path` (string, required), `limit` (integer, default 8) | Notes most similar to one note (shared tags and words). |\n| `suggest_links` | R | `path` (string, required), `limit` (integer, default 8) | Similar notes not yet linked from this one. |\n| `list_tags` | R | none | Every tag with its usage count. |\n| `rename_tag` | W | `old` (string, required), `new` (string, required) | Renames a tag across the vault. |\n| `merge_tag` | W | `a` (string, required), `b` (string, required) | Merges tag `a` into tag `b` across every note. |\n\n### Tags (`tag`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_tags` | R | `path` (string; not in the advertised schema) | Every tag with its count, or the tags of one note when `path` is given. |\n| `search_by_tag` | R | `tag` (string, required), `limit` (integer, default 50; not in the advertised schema) | Every note carrying a tag. |\n| `add_tags` | W | `path` (string, required), `tags` (string, required, comma-separated) | Adds tags to a note. A leading `#` is stripped. |\n| `remove_tags` | W | `path` (string, required), `tags` (string, required, comma-separated) | Removes tags from a note. |\n| `set_tags` | W | `path` (string, required), `tags` (string, required, comma-separated) | Replaces a note\'s tag list. |\n\n### Folders (`folder`, `ops`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `list_folders` | R | none | `{count, folders: [{name, count, color}]}`. |\n| `create_folder` | W | `name` (string, required) | Creates a folder. |\n| `rename_folder` | W | `folder` (string, required), `name` (string, required, one segment) | Renames a folder in place. Notes, sub folders, color and icon move along. |\n| `move_folder` | W | `folder` (string, required), `into` (string; empty or `Root` = top level) | Moves a folder with everything in it. |\n| `move_folder_contents` | W | `folder` (string, required), `into` (string; empty = top level) | Moves everything inside a folder into another folder, then removes the empty folder. Name clashes get a `-N` suffix. |\n| `delete_folder` | W | `folder` (string, required), `into` (string), `mode` (`move` or `trash`) | Deletes a folder. By default its notes (at any depth) move to the folder\'s parent (Root for a top-level folder), keeping the sub folder structure below it; wikilinks to them are rewritten. `into` sends them to another existing folder instead (`Root` = top level). `mode: "trash"` moves every note to `.Trash` instead (`list_trash` / `restore_trash` bring them back) and cannot be combined with `into`. Other files in the folder are deleted. |\n| `folder_stats` | R | `folder` (string, required) | Note count and metadata for one folder. |\n| `get_folder_meta` | R | `folder` (string) | Color, icon and description of one folder, or of every folder. |\n| `set_folder_meta` | W | `folder` (string, required), `color`, `icon`, `desc` (strings) | Sets folder display metadata. A field sent as an empty string is cleared. |\n\n### Graph (`graph`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_graph` | R | none | Whole graph: `{nodes: [{id, path, folder, color, degree, tags, mtime}], links: [{source, target}]}`. |\n| `get_neighbors` | R | `path` (string, required), `depth` (integer, default 1) | Notes within N hops. |\n| `get_subgraph` | R | `path` (string, required), `depth` (integer, default 1), `max_nodes` (integer, default 60) | Subgraph around one note. |\n| `find_path` | R | `source` (string, required), `target` (string, required) | Shortest wikilink path between two notes. |\n| `get_hubs` | R | `limit` (integer, default 10) | Most connected notes. |\n| `get_isolated` | R | none | Notes with no links in or out. |\n| `link_stats` | R | `path` (string, required) | Outgoing, incoming and unresolved links of one note. |\n| `broken_links` | R | none | Wikilinks pointing at notes that do not exist. |\n\n### Versioning (`version`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_history` | R | `path` (string, required), `limit` (integer, default 20, at least 1) | Git history of a note, newest first, always an array of `{rev, date, author, message, version, total}` (plus `path` for commits under an earlier name: the history follows renames). `author` is the agent or user whose call made the change. `version` numbers the revisions from 1 (the oldest) to `total` (the current one), whatever `limit` is. |\n| `get_note_at` | R | `path` (string, required), `rev` (string, required) | `{ok, path, rev, content}` at a revision. `rev` is one revision: a `rev` from `get_history`, `snap-<label>`, `HEAD~1` or `HEAD@{<date>}`. Unknown revisions, dates before the history and empty `rev` are errors. |\n| `diff` | R | `path` (string, required), `rev_a` (string, required), `rev_b` (string) | `{path, from, to, changed, diff}` between two revisions, or `rev_a` against the current note. Ranges (`a..b`) and unknown revisions are errors. |\n| `restore_memory` | W | `path` (string, required), `rev` (string, required) | Restores a note to a revision (a new commit). Give the current path; content under an earlier name is found. Restoring the old path of a renamed note is refused and names the current one. |\n| `snapshot` | W | `label` (string, required) | Commits pending changes and tags the last commit `snap-<label>` (letters, digits, `.`, `_`, `-`; spaces become `-`; at most 40 characters; must be new). Use the tag as `rev`. |\n| `soft_delete` | W | `path` (string, required) | Moves a note to `.Trash` and remembers where it came from. |\n| `list_trash` | R | none | Notes in `.Trash`, newest first: `{name, path, original, deleted, by, title}` (`by` = `{id, name, kind}` of who deleted it, null when unknown). |\n| `restore_trash` | W | `name` (string, required; `.md` optional), `into` (string) | Restores a note from `.Trash` to the path it was deleted from, or into the folder `into` (`Root` = top level). |\n\nAll versioning tools except `soft_delete`, `list_trash` and `restore_trash`\nneed version history on (see [CONFIGURATION.md](CONFIGURATION.md#version-history));\notherwise they answer "version history is off".\n\n### Bulk writes (`write`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `batch_create` | W | `notes` (array, required) of `{title (required), folder (default `Memory`), content}` | Creates many notes in one call; titles and folders follow `create_memory`. Every item is checked first and nothing is created when one is malformed (missing title, wrong type, unknown key). The reply has one result per item: `{ok, path}` or `{ok: false, item, title, error}`. |\n| `duplicate_memory` | W | `path` (string, required) | Copies a note as `<name>-copy` in the same folder (a long name is shortened so the suffix fits in 80 characters). |\n| `merge_memory` | W | `paths` (array of strings, required: existing notes, each once, not `into`), `into` (string, required; `.md` optional) | Appends the body of each source, without its frontmatter, to `into` under `## from <name>`, and adds the sources\' tags to the target\'s tags. `into` is created when missing. The sources are kept. Returns `{ok, into, created, merged, sources, tags_added}`. |\n| `template_create` | W | `template` (string, required; a note in `Templates/`, as `Meeting` or `Meeting.md`), `title` (string, required), `folder` (string, default `Root`), `variables` (object) | Creates a note from a template with `{{var}}` substitution. `{{title}}` (the note title) and `{{date}}` (today, `YYYY-MM-DD`) are built in unless given in `variables`. Only notes in `Templates/` can be templates. |\n| `bulk_replace` | W | `find` (string, required), `replace` (string, required), `folder` (string), `regex` (boolean, default false), `dry_run` (boolean, default false) | Find and replace across notes. `find` must not be empty or (with `regex`) match an empty string. `folder` includes its subfolders (`Root` = top level only); a missing folder is an error. With `regex`, `replace` expands `$1` / `${name}` (`$$` is a literal `$`); unknown groups are errors. Needs `write` even with `dry_run`. |\n| `bulk_delete` | W | `paths` (array of strings), `folder` (string) | Moves many notes to `.Trash` (recoverable with `restore_trash`), by list and / or folder (with subfolders). Any invalid path (missing, outside the vault, a folder, not a note) refuses the whole call and is listed. |\n\n### Collaboration (`collab`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `lock_node` | W | `path` (string, required), `owner` (string, default the caller), `ttl` (integer seconds, default 300) | Soft lock on a note. |\n| `release_lock` | W | `path` (string, required), `owner` (string, default the caller) | Releases a lock. |\n| `get_locks` | R | none | Active locks. |\n| `mention_agent` | W | `agent` (string, required), `path` (string, required), `message` (string) | Writes `> @agent: message` into a note. With agent `mnemo`, Memora\'s own agent answers it in the note (the request is struck through and the reply quoted under it). |\n| `get_assignments` | R | `agent` (string) | Notes with `assigned_to` in their frontmatter. |\n\n### Activity and health (`ops`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_events` | R | `since` (number, unix time), `folder`, `actor` (strings), `limit` (integer, default 50) | Recent note created, updated and deleted events. |\n| `presence` | R | `window` (integer seconds, default 300) | Agents active within the window. |\n| `get_logs` | R | `range` (string, default `1d`; also `7d`, `today`, `yesterday`), `actor` (string), `limit` (integer, default 100) | Activity log for a period. |\n| `search_logs` | R | `q` (string, required), `range` (string, default `7d`), `actor` (string), `limit` (integer, default 100) | Keyword search in the activity log. |\n| `digest` | R | `folder` (string), `since` (number) | Event counts per actor and per type. |\n| `healthcheck` | R | none | Note count, broken links, orphans and git status. |\n| `stale_detection` | R | `days` (integer, default 30) | Notes untouched for more than N days. |\n\n### Identity (`identity`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `set_my_name` | W | `name` (string, required) | Sets the display alias shown in the activity feed and log. |\n| `set_my_color` | W | `color` (string, required; `#rrggbb`, or `""` to reset) | Sets the calling API key\'s display color. Fails for browser sessions. |\n| `list_actors` | R | none | `{me, aliases}`: the caller and every known alias. |\n\n### Import and export (`interop`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `export_memory` | W | `paths` (array of strings, required; notes or folders), `out_path` (string), `overwrite` (boolean, default false) | Writes a zip of the given paths to the server\'s exchange folder and returns `{ok, path, name, bytes, replaced}`, where `path` and `name` are the zip\'s file name. Every path must exist; missing ones are listed and nothing is written. `out_path` is a plain file name ending in `.zip` (letters, digits, `.`, `_`, `-`, at most 120 characters); the default is `memora-export-<unix seconds>.zip`. An existing zip of that name is only replaced with `overwrite: true`. |\n| `import_memory` | W | `zip_path` (string, required), `overwrite` (boolean, default false) | Imports the `.md` notes of a zip in the exchange folder, by the file name `export_memory` returned. Returns `{ok, added, overwritten, skipped, unsafe, failed}`: `skipped` are existing notes kept (no `overwrite`), `unsafe` are entries with an absolute or escaping path (`{entry, reason}`), `failed` are entries too large or unreadable. |\n\nThe exchange folder is `exchange` in the state directory (`<MEMORA_STATE>/exchange`),\none per Memora instance, created with mode 0700.\nTools never read or write anywhere else on the server\'s disk.\n\n### Checks, to-dos and pins (`ux`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_todos` | R | `path` (string) | Open checklist items (`- [ ]`) in one note or the whole vault. |\n| `follow_ups` | R | none | Notes whose status is still awaiting action. |\n| `validate_memory` | R | `path` (string, required) | Checks a note: frontmatter present and well formed, a valid `created` date, tags, and broken links (named in the issue and listed in `broken_links`). |\n| `list_pins` | R | none | The owner\'s pinned notes and folders in sidebar order: `{count, pins:[{kind, path, position, missing}]}`. `missing` is true when the path no longer exists (renamed or deleted outside Memora). |\n| `pin` | W | `path` (string, required), `kind` (`note` or `folder`; default: what the path is on disk), `position` (integer from 0; default: the end) | Pins an existing note or folder, or moves its pin. A note path may leave out `.md`. At most 200 pins. Returns the list. |\n| `unpin` | W | `path` (string, required), `kind` | Removes a pin; the note or folder is not touched. Returns the list with `removed`. |\n\nPins are shared by every browser of the owner (`/api/pins`). They follow their note or\nfolder through renames and moves done by Memora (over MCP or HTTP, including notes inside\na moved folder) and are removed when the item is deleted or moved to the trash; deleting a\nfolder removes every pin under it. A key whose privacy rules hide a path neither lists\nnor changes its pin, and `position` counts only the pins the key can see.\n\n### Admin tools (`admin`)\n\nListed and callable only for keys with the `admin` scope (and for browser\nsessions). They are not part of the switchable catalog: global tool switches and\na key\'s tool list do not apply to them, and they do not need `write`.\n\n| Tool | Arguments | Purpose |\n|---|---|---|\n| `admin_list_tools` | none | `{tools: [{name, category, description, enabled}]}` for every catalog tool. |\n| `admin_set_tool` | `name` (string, required), `enabled` (boolean, required) | Switches a catalog tool on or off for every key. Returns `{ok, name, enabled}`. |\n| `privacy_list` | `path` (string), `kind` (`node` or `folder`) | Without `path`: every privacy rule. With `path`: that note or folder\'s own rule, the folder rules it inherits, and which agents can see it. |\n| `privacy_set` | `path` (string, required), `agents` (array of key ids or names, required; a comma-separated string also works), `kind` (`node` or `folder`), `mode` (`deny` or `allow_only`, default `deny`) | Replaces the rule on a path. `deny` hides it from the listed agents; `allow_only` hides it from every other agent, including keys created later. `deny` with no agents removes the rule. A node rule follows its note through renames and moves. |\n| `privacy_clear` | `path` (string, required), `kind` (`node` or `folder`) | Removes the path\'s own rule. Rules on parent folders still apply. |\n\nWhen `kind` is omitted it is taken from the path on disk: a folder if a folder\nexists there, otherwise a note.\n\n## Identity and tracking\n\nEvery tool call is published to the web UI\'s realtime activity stream as an\n`ai_activity` start and end pair, named after the API key (or the signed-in\nuser), with the note paths involved. Calls are also counted per key: the Keys\npage and `GET /api/keys` show each key\'s `uses`, `last_ip`, and the tools it has\ncalled recently. `initialize` registers the connection under the key\'s name\n(`GET /api/aliases`). `set_my_name` changes the alias shown in the activity\nfeed and log, and `set_my_color` changes the key\'s color in the UI. See\n[API.md](API.md) for the HTTP endpoints.\n',kY='# HTTP API\n\nThe `memora` binary serves the HTTP API, the MCP endpoint, the OAuth endpoints,\nthe web UI, and the WebSocket on one port. This document lists the HTTP endpoints.\n\n## Authentication\n\nThe Auth column in the tables below uses these levels:\n\n- None: reachable without credentials.\n- Session: requires the `memora_sess` cookie set by a successful login.\n- Key (`scope`): an API key sent as `Authorization: Bearer <key>` or `X-API-Key: <key>`\n that carries the named scope.\n- Session or key (`scope`): either of the above.\n- Session only: an API key is not enough. API keys get `401` (or `403` where noted).\n- +CSRF: the same-origin check described below applies.\n\n### API key scopes\n\nA key carries any of the scopes `mcp`, `read`, `write`, and `admin`. New keys get\n`mcp`, `read`, and `write` unless other scopes are requested. The scope a route\nneeds is decided by its path and method:\n\n| Scope | Routes |\n|---|---|\n| `mcp` | `/mcp` |\n| `admin` | `/api/tools`, `/api/keys` and `/api/keys/*`, `/api/access` and `/api/access/*`, `/api/logs/settings`, `/api/settings/server`, `/api/oauth/clients` and `/api/oauth/clients/*`, `/api/privacy` and `/api/privacy/*`, `/api/trash/delete`, `/api/trash/empty`; deleting for good with `/api/delete` |\n| `read` | Every other `GET` or `HEAD` under `/api/` |\n| `write` | Every other method under `/api/` |\n\nA key without the needed scope gets `403 {error, required_scope}`. A missing key\ngets `401`; for `/mcp` the `401` carries a `WWW-Authenticate` header,\n`Bearer resource_metadata="<base>/.well-known/oauth-protected-resource"`, so OAuth\ncapable clients can start sign-in. An invalid key gets `401` and is logged; an\nIP that keeps presenting invalid keys is put on a cooldown (`429`).\n\n`/api/auth/*` never accepts an API key: without a valid session it answers `401`.\n\nAPI keys see the vault through their privacy rules (see [Privacy](#privacy)):\nnotes and folders hidden from a key behave as if they do not exist. A browser\nsession sees everything.\n\n### CSRF\n\nWrite endpoints that accept a session check the request origin whenever a\nsession cookie is present: `Origin` (or, without it, `Referer`) must match the\nrequest `Host` (or an `X-Forwarded-Host` sent by a trusted proxy), and\n`Sec-Fetch-Site: cross-site` is refused. A failed check is\n`403 {"error":"origin mismatch"}`. Requests without a session cookie (API-key\nclients) pass, since a browser cannot attach an API key on its own.\n\nThe public auth forms (`/api/auth/login`, `/api/auth/verify`,\n`/api/auth/bootstrap`, `/api/auth/reset`) also refuse a foreign or `null`\n`Origin` when no cookie exists yet. A request with neither `Origin` nor\n`Referer` (curl, the CLI) passes.\n\n### Locked instance\n\nWhile the instance is LOCKED, `/api/*` and `/mcp` answer\n`423 {error, locked: true, hint}` except for `/api/auth/state`, `/api/auth/verify`,\n`/api/auth/login`, `/api/auth/logout`, `/api/auth/bootstrap`, and\n`/api/auth/reset`. Other pages redirect to `/login?locked=1`; static assets,\n`/login`, `/logout`, `/healthz`, and `/favicon.ico` are still served.\n`/api/auth/login` itself answers `423` while locked.\n\n### Vault not configured\n\nUntil a vault folder is configured, `/mcp` and every `/api/*` route except\n`/api/auth/*`, `/api/settings*`, `/api/config`, `/api/keys*`, `/api/tools`,\n`/api/access*`, and `/api/ui/*` answer\n`409 {"error":"vault not configured", "needs_vault":true}`.\n\n### Limits and other gates\n\n- Requests for a host outside the configured domain list get a bare `404`.\n- Access rules (see `/api/access`) can block a caller:\n `403 {"error":"access denied by stack rule", ip}`.\n- Per-IP rate limits answer `429` with a `Retry-After` header and\n `{error, limited, cooldown, retry_after}`. Login, code check, setup, reset, profile,\n password, and username changes have a stricter limit and a cooldown after\n repeated failed attempts. Requests from the machine itself and `/healthz` are\n not limited.\n- A request that takes longer than 30 seconds is answered with `408`.\n- A password hashing pool that is busy answers `503` with `Retry-After: 2`.\n- `GET` answers under `/api/` (except `/api/auth/*`) are gzip-compressed when the\n request sends `Accept-Encoding: gzip`. Pages, writes, sign-in, `/mcp` and\n server-sent events are never compressed.\n\nResponses are JSON unless stated otherwise. Errors are `{"error": "..."}`. Vault\nerrors map to `404` for not-found (including paths hidden from the caller) and\n`400` for bad input.\n\n## Health and discovery\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/healthz` | None | `{ok, server}` for unauthenticated callers from other machines. A signed-in browser or a caller on the same machine gets `{ok, server, version, vault_configured, vault, armed, locked, base_url, base_url_configured}`. |\n| GET | `/.well-known/mcp.json` | None | The MCP discovery card: `{name, version, description, mcp, auth, capabilities, tools, resources}`. `tools` lists the full catalog with `enabled` per tool. |\n| GET | `/tools` | None | An HTML rendering of the tool catalog. A signed-in browser gets the app shell instead. |\n| POST | `/mcp` | Key (`mcp`), or Session (+CSRF) | MCP over streamable HTTP (JSON-RPC in, JSON-RPC out). See [MCP.md](MCP.md). A session has full access; a key is limited by its tool grant. Notifications get `202` with no body. Malformed JSON is `400` with a JSON-RPC error. Other methods get `405` with `Allow: POST`. |\n\n## Auth\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/auth/state` | None | `{bootstrap, realm, min_password_len, gateway, armed, locked, setup_hint, ready, checks:{vault, state}, code_required, cooldown, vault_configured}`. Adds `signed_out` (`password_changed` or `signed_out_remotely`) when the browser\'s session was ended on purpose, and `mode`, `expires_in`, `ttl` while a setup or reset window is open. |\n| POST | `/api/auth/verify` | None (+CSRF) | Checks the setup code shown on the server before the setup or reset form is shown. Body: `{code}`. Returns `{ok, mode, expires_in, user}`. `403` when no window is open or the instance is not ready. A wrong code answers `403 {error, burned:false}` and counts against the caller IP\'s budget of 3 wrong codes (then `429`); after 50 wrong codes in one window the window closes and the code is void: `403 {error, burned:true}`. |\n| POST | `/api/auth/login` | None (+CSRF) | `{ok, user, expires_in, redirect}` and sets the session cookie. Body: `{username, password}`. `400` when a field is missing, `401` on bad credentials, `403` if the account is disabled, `423` if locked, `429` during a cooldown of the caller IP (there is no account-wide lockout; see DEPLOYMENT.md, Failed sign-ins). |\n| POST | `/api/auth/logout` | None (+CSRF) | `{ok:true}`. Ends the session named by the cookie, if any, and clears the cookie. |\n| POST | `/api/auth/bootstrap` | None (+CSRF) | Creates the owner account. Body: `{code, username, password}`. Returns `{ok, user, redirect, persisted}` and sets a session cookie. The username is stored lowercase. `400` for an invalid username or password length; `403` unless a window is open, the code is right, the instance is ready, and no account exists. |\n| POST | `/api/auth/reset` | None (+CSRF) | Sets a new password for the single account, and may rename it. Body: `{code, username, password}`. Returns `{ok, user, persisted}`. Signs out every session. `400` for invalid input; `403` unless a window is open, the code is right, and an account exists. |\n| POST | `/api/auth/profile` | Session only (+CSRF) | With `password` in the body, changes the password exactly like `POST /api/settings/password` (body `{current, password, confirm}`). Otherwise sets `display_name` (at most 48 characters) and returns `{ok, changed, persisted, user, password_changed:false}`; with no `display_name` it returns `{ok, changed:false}`. |\n| GET | `/api/auth/me` | Session only | `{authenticated, user, enabled, expires_in}`. `401` without a session. |\n| GET | `/api/auth/events` | Session only | Recent entries of the security activity log, newest first: `{events:[{at, event, ip, user, detail, actor, actor_kind, actor_id}], count}`. `user` is the stored actor (`key:<id>` for API-key calls); `actor` is the display name (the key\'s current name, falling back to its id; the username for the browser), `actor_kind` is `agent` or `user` (null when there is no actor). Query: `limit` (default 200, max 2000), `q`. |\n\n## Pages\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/login` | None | The sign-in page. A signed-in browser is redirected to `/` unless the instance is locked or the query has `oauth` (the OAuth consent card). |\n| POST | `/logout` | None (+CSRF) | Ends the session, clears the cookie, and redirects to `/login`. With a session cookie the request must be same-origin (`403` otherwise); other methods get `405`. The web UI uses `POST /api/auth/logout`. |\n| GET | `/`, `/index.html` | Session | The web app shell. Without a session: `302` to `/login`. `503` when the UI assets are not installed. |\n| GET | App routes (see below) | Session | The same app shell as `/`. Without a session: `302` to `/login?r=<path>`, so sign-in returns to the page. |\n\nApp routes are the web app\'s client-side pages: `/brain`, `/nodes`, `/graph`,\n`/canvas`, `/tags`, `/activity`, `/agents`, `/access`, `/settings`,\n`/overview`, `/welcome`, `/trash`, `/mnemo`, the older names `/home`, `/vault`, `/logs`, `/keys`,\nand `/node/` or `/node/<percent-encoded vault path>`. The path is never used to\nread a file; a path holding NUL or another control character (raw or\npercent-encoded) is `400`. `/tools` is an app route for a signed-in browser and\nthe public tool catalog otherwise.\n\nHTML pages are sent with `Cache-Control: no-cache, no-store, must-revalidate`\nand a per-response CSP nonce.\n\nAny other `GET` that asks for HTML (`Accept: text/html`), is outside `/api/`,\n`/mcp`, `/oauth`, and `/.well-known`, and has no file extension in its last\nsegment gets the app shell (which shows its "page not found" view). Every other\nunmatched request is `404 {"error":"not found"}`.\n\n## Static assets\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/assets/{name}` | None | Static UI assets (whitelisted filenames only, else `404`). |\n| GET | `/app.js`, `/app.css`, `/login.css` | None | The UI bundle and styles. Revalidated on every load (`Cache-Control: no-cache`, ETag). |\n| GET | `/favicon.svg` | None | The icon. |\n| GET | `/favicon.ico` | None | `204` with no body. |\n| GET | `/manifest.webmanifest`, `/sw.js`, `/robots.txt`, `/offline.html`, `/icon-192.png`, `/icon-512.png`, `/icon-maskable-512.png`, `/apple-touch-icon.png` | None | PWA files and `robots.txt`. Images and the manifest are cached for 5 minutes; code is revalidated on every load. |\n\n## Vault\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/tree` | Session or key (`read`) | Notes grouped by folder: `{folder: [{path, name, folder, mtime, title}]}`; `title` is what the app shows (front matter `title`, else the first `# heading`, else the file name with `_` as spaces). |\n| GET | `/api/folders` | Session or key (`read`) | Every folder the caller may see, empty and nested ones included (`{folders:[path]}`); dot folders such as `.Trash` are left out. |\n| GET | `/api/note` | Session or key (`read`) | `{path, name, content, html, tags, frontmatter, backlinks, size, mtime}`. Query: `path` (`400` when empty). |\n| GET | `/api/vault/file` | Session or key (`read`) | The raw bytes of one image file in the vault (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO; never SVG). Query: `path` (vault-relative). The file content must match its type. At most 10 MiB (`413`). Sent with an `ETag` (`304` on `If-None-Match`), `Cache-Control: private, max-age=300`, and a sandbox CSP. `400` invalid path, `403` path not allowed, `404` not found, `415` not an image. |\n| GET | `/api/folder-meta` | Session or key (`read`) | Folder metadata keyed by folder name. Query: `folder` (optional). |\n| POST | `/api/save` | Session or key (`write`, +CSRF) | `{ok, path}`. Body: `{path, content}`. Overwrites the note. |\n| POST | `/api/create` | Session or key (`write`, +CSRF) | `{ok, path}`. Body: `{title, folder?, content?}`. |\n| POST | `/api/rename` | Session or key (`write`, +CSRF) | `{ok, path}` with the new path. Body: `{path, name}`. |\n| POST | `/api/move` | Session or key (`write`, +CSRF) | `{ok, path}` with the new path. Body: `{path, folder?}`. |\n| POST | `/api/delete` | Session or key (`write`; `admin` to delete for good, +CSRF) | `{ok:true}`. Body: `{path, mode?}`. Deletes the note for good (no trash); with version history on, its earlier versions are erased from the history too, so nothing can bring it back. Because that cannot be undone, an API key needs the `admin` scope for it (`403 {error, required_scope: "admin"}` otherwise, as MCP `delete_memory` with `permanent`); the owner\'s browser session may. `mode: "trash"` (what the web app sends) moves it to `.Trash` instead, remembering where it was and who deleted it: `{ok, trashed, to}`. |\n| GET | `/api/trash` | Session or key (`read`) | Notes in `.Trash` the caller may see, newest first: `{items: [{name, path, original, deleted, by, title}]}` (`by` = `{id, name, kind}`, null when unknown). Nothing is removed automatically. |\n| POST | `/api/trash/restore` | Session or key (`write`, +CSRF) | Body: `{name, into?}`. Back to where the note was deleted from (or into the folder `into`); a taken name gets `-1`, `-2` ...: `{ok, path, from, renamed?}`. 404 when the name is not in the trash. |\n| POST | `/api/trash/delete` | Session or key (`admin`, +CSRF) | Body: `{name}`. Deletes one trash entry for good: `{ok, deleted, name, history?}`. With version history on, the note is also erased from the history (every earlier version under every name it had, its trash record and its path in commit messages), and `history` is `{erased, ms, commits}`. Other notes keep their versions; their revision ids change. |\n| POST | `/api/trash/empty` | Session or key (`admin`, +CSRF) | Deletes every trash entry the caller may see, for good: `{ok, count, names, history?}`, erasing them from the version history in one rewrite (as `/api/trash/delete`). |\n| POST | `/api/folder` | Session or key (`write`, +CSRF) | `{ok, path}`. Body: `{name}`. |\n| POST | `/api/folder/rename` | Session or key (`write`, +CSRF) | `{ok, from, to, notes}`. Body: `{folder, name}`. |\n| POST | `/api/folder/move` | Session or key (`write`, +CSRF) | Moves a folder and everything in it. `{ok, from, to, notes}`. Body: `{folder, into}`; `into` empty or `Root` means the top level. |\n| POST | `/api/folder/move-contents` | Session or key (`write`, +CSRF) | Moves everything inside a folder into another one, then removes the emptied folder. Name clashes get a `-N` suffix. `{ok, from, to, moved}`. Body: `{folder, into}`; `into` empty or `Root` means the top level. |\n| POST | `/api/delete-folder` | Session or key (`write`, +CSRF) | Deletes a folder. Body: `{folder, into?, mode?}`. By default its notes move to the folder\'s parent (the top level for a top-level folder), keeping the sub folder structure below it, and wikilinks are rewritten: `{ok, deleted_folder, moved_to, moved, links_updated}` (`moved` lists the new paths; `moved_to_root` repeats it when they went to the top level). `into` names another existing folder for the notes (`Root` = top level). `mode: "trash"` moves every note to `.Trash` instead (restorable from the Trash on the Notes page, `/api/trash/restore`, or the MCP tools `list_trash` / `restore_trash`): `{ok, deleted_folder, mode, count, trashed}`. Other files in the folder are deleted. |\n| POST | `/api/folder-meta` | Session or key (`write`, +CSRF) | `{ok, folder}`. Body: `{folder, color?, icon?, desc?}`. |\n\nThe three folder operations also publish a `folder_changed` realtime event so\nopen browsers reload their tree.\n\n### Version history\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/history?path=&limit=` | Session or key (`read`) | A note\'s revisions, newest first (the vault\'s git history, following renames): `{path, total, versions: [{rev, date, author, message, version, total, path?, owner}]}`. `version` counts from 1 (the oldest) to `total` (the current one); `owner` is true when the signed-in owner made the change. `limit` defaults to 100 (at most 500). |\n| GET | `/api/note-at?path=&rev=` | Session or key (`read`) | The note as it was at one revision (a `rev` from `/api/history`, `snap-<label>`, `HEAD~1`, `HEAD@{<date>}`): `{path, rev, content, html}`, `html` rendered like `/api/note`. |\n| GET | `/api/diff?path=&a=&b=` | Session or key (`read`) | Unified diff of the note from revision `a` to `b`, or to the note as it is now when `b` is left out: `{path, from, to, changed, diff}`. |\n| POST | `/api/history/restore` | Session or key (`write`, +CSRF) | Body: `{path, rev}`. Gives the note its content from `rev` again as a new revision (restoring version 3 of 5 makes version 6; nothing is lost): `{ok, path, rev, changed, version, total}` (`changed` false when the note already had that content). |\n\nThe four history routes answer `409 {error, history: false}` while version history\nis off (the vault folder is not a git repository; see\n[CONFIGURATION.md](CONFIGURATION.md#version-history)) and `404` for a path that is\nnot in the vault or its history, or is hidden from the calling key. Web writes\n(save, create, rename, move, delete, restore) are committed with the caller as the\nauthor: the owner\'s username for the browser, the key\'s name for an API key.\n\n### Images\n\nImages live in the folder of the note that shows them, and a note shows one with\n`` (`path:` names a file in the note\'s own folder). Saving a\nnote that points with `path:Other/Folder/pic.png` to an image elsewhere copies that\nimage beside the note and rewrites the link, so notes never point across folders.\nImages follow their note: a move carries them, the Trash keeps them in\n`.Trash/.assets/<entry>/` until the note is restored (to the same or another\nfolder) or deleted for good, and a deleted folder takes its images along. An image\nthat another note of the same folder still shows is copied or kept instead.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| POST | `/api/vault/image?note=<path>&name=<file>` | Session or key (`write`, +CSRF) | The raw image bytes as the body (PNG, JPEG, WebP or GIF, checked by content). Stored beside the note; identical bytes reuse the existing file, a taken name gets `-1`, `-2` ...: `{ok, path, name, bytes, url, markdown}` (`markdown` is the line to put in the note). `400` for another file type, a size above the upload limit, or a missing note. |\n| POST | `/api/vault/image/delete` | Session or key (`write`, +CSRF) | Body: `{path}`. Deletes one image file (the version history keeps it): `{ok, deleted}`. |\n| GET | `/api/vault/images?folder=<folder>` | Session or key (`read`) | The images of that one folder (not its sub folders or parents): `{folder, images: [{path, name, folder, bytes, mtime, url, used_in: [{note, title, heading}]}]}`. `heading` is the section that shows the image (`null` before the first heading). |\n| GET | `/api/vault/images?note=<path>` | Session or key (`read`) | `{note, folder, images, folder_images}`: the images the note shows, and every image of its folder. |\n| GET | `/api/vault/storage` | Session or key (`read`) | `{notes, note_bytes, images, image_bytes, total_bytes, max_image_bytes}`. |\n\n## Search and graph\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/search` | Session or key (`read`) | `{q, count, hits:[{path, name, folder, score, snippet}]}`, at most 20 hits. Query: `q`. Supports `tag:x` and `#x`. |\n| GET | `/api/stats` | Session or key (`read`) | `{notes, links, folders}`. |\n| GET | `/api/graph` | Session or key (`read`) | `{nodes:[{id, path, folder, color, degree, tags}], links:[{source, target}]}`. `tags` holds inline `#tags` plus frontmatter `tags` (as the note view reports them). Realtime `node_*` events\' `node` payload carries `tags` too. |\n| GET | `/api/aliases` | Session or key (`read`) | `{aliases:[{alias, key_id, key_name, first_seen, last_seen, connections, actor, actor_kind}]}`: one record per API key that sent MCP `initialize`, kept in memory until the server restarts. `key_name` and `actor` are the key\'s current name (fallback: the id). |\n| GET | `/api/actors` | Session or key (`read`) | `{actors:[{actor, alias, display, events, tools, last_ip, last_ts, seen_minutes_ago}], count}`. `seen_minutes_ago` is `-1` when the actor has no events. |\n\n## Privacy\n\nPrivacy rules hide notes or folders from chosen agents (API keys). A rule has a\n`kind` (`node` or `folder`), a `path`, a `mode` (`deny`: hidden from the listed\nkeys; `allow_only`: hidden from every key except the listed ones), and a list\nof keys. Folder rules apply to everything inside the folder.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/privacy` | Session or key (`admin`) | `{count, rules:[{id, kind, path, mode, keys:[{id, name, color}], created_at, updated_at}], agents:[{id, name, color, enabled}]}`. |\n| GET | `/api/privacy/path` | Session or key (`admin`) | The privacy state of one path: `{path, kind, own, own_rules, inherited, agents:[{id, name, color, enabled, can_see, hidden_by}], private}`. `own` is `{mode, keys}` or `null`. Query: `path`, `kind` (optional; defaults to `folder` when the path is a folder on disk, else `node`). |\n| PUT | `/api/privacy/path` | Session or key (`admin`, +CSRF) | Replaces the rule on a path. Body: `{path, kind?, mode, keys}`. `mode` defaults to `deny`; `keys` is a list of key ids (or unique key names). `deny` with no keys removes the rule. Returns the same shape as `GET`. |\n| DELETE | `/api/privacy/path` | Session or key (`admin`, +CSRF) | Removes the rule on a path. Query: `path`, `kind` (optional). Returns the same shape as `GET`. |\n\nChanges are written to the activity log and publish a `privacy_changed`\nrealtime event.\n\n## API keys, tools, and access\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/keys` | Session or key (`admin`) | `{count, keys:[{id, name, enabled, scopes, tools, prefix, created, color, revealable, uses, last_ip, used_tools}]}`. `tools` is `"*"` or a list of tool names; `revealable` says whether the secret can be shown again; `used_tools` lists recently used tools and routes. |\n| POST | `/api/keys` | Session or key (`admin`, +CSRF) | Creates a key. Body: `{name?, tools?, scopes?, color?}`. `tools` is `"*"` or a list of tool names; `scopes` a list of scope names (an empty list means the defaults). Returns `{ok, id, key, name, prefix, persisted, color, tools, scopes}`. The raw `key` is returned once. `400` for an unknown tool or scope. |\n| POST | `/api/keys/roll` | Session or key (`admin`, +CSRF) | New secret for an existing id. Body: `{id}`. Returns `{ok, id, key, prefix, persisted}`. `404` for an unknown id. |\n| POST | `/api/keys/reveal` | Session only (+CSRF) | Shows the secret of a key created or rolled from the dashboard again. Body: `{id, current}` where `current` is the owner\'s password. Returns `{ok, id, key}`. `403` for a wrong password; `429` after 5 wrong passwords (5 minute pause); `404 {error:"not_stored", message}` when the secret is not stored (for example keys created by the CLI or by OAuth). |\n| POST | `/api/keys/update` | Session or key (`admin`, +CSRF) | Body: `{id, name?, enabled?, tools?, scopes?, color?}`. `color` as `""` or `null` clears it. Returns `{ok, id, name, enabled, color, tools, scopes, persisted}`. `400` for an unknown tool or scope, `404` for an unknown id. |\n| POST | `/api/keys/delete` | Session or key (`admin`, +CSRF) | `{ok, id, persisted}`. Moves the key to the trash. Body: `{id}`. |\n| POST | `/api/keys/restore` | Session or key (`admin`, +CSRF) | `{ok, id, persisted}`. Restores a deleted key. Body: `{id}`. `404` when no deleted key has that id. |\n| GET | `/api/tools` | Session or key (`admin`) | `{tools:[{name, category, description, enabled}]}`: the MCP tool catalog with the global on/off switch of each tool. |\n| POST | `/api/tools` | Session or key (`admin`, +CSRF) | Switches a tool on or off for every caller. Body: `{name, enabled}`. Returns `{ok, name, enabled}`. `400` for an unknown tool. |\n| GET | `/api/access` | Session or key (`admin`) | `{default_allow, rules, count}`. |\n| POST | `/api/access/test` | Session or key (`admin`) | `{action, would_lock_out_caller}` for the given address or domain. Body: `{ip?, domain?}`. |\n| POST | `/api/access/rules` | Session or key (`admin`, +CSRF) | `{ok, count, persisted}`. Body: `{op, kind, value, action}`. `op` is `add` (default) or `remove`. `kind` is `ip`, `range`, `cidr`, `domain`, or `all`; `value` is required unless `kind` is `all`. `action` is `allow` or `block` (default `block`). `remove` deletes every rule matching the given `kind` and `value`; `404` when none match. |\n| GET | `/api/config` | Session or key (`read`) | `{realm, min_password_len, session_ttl, vault, version, gateway, update}`. `update` is the cached release check: `{current, latest, available, url, checked_at, state, repo, stars}`, `state` one of `ok`, `none` (no release published), `error`, `disabled`, `pending`; `stars` is the repository\'s GitHub star count from the same check (`null` until known). |\n\n## Settings\n\nAll settings endpoints need a signed-in browser, except `/api/settings/server`, which also takes an API key with the `admin` scope.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/settings` | Session only | `{user, vault_configured, vault, vault_suggested, vault_writable, stats, min_password_len, expires_in, session_ttl, session_max_age, state_dir}`. `stats` is `{notes, links, folders}` or `null` without a vault. |\n| POST | `/api/settings/password` | Session only (+CSRF) | Body: `{current, password, confirm}`. Returns `{ok, user, password_changed, revoked_sessions, persisted}`. Every other session is signed out. `400` for a short, mismatched, or unchanged password; `403` for a wrong current password (counts toward the login cooldown). |\n| POST | `/api/settings/username` | Session only (+CSRF) | Renames the account. Body: `{username, current}`. Returns `{ok, user, changed}` (plus `persisted` when changed). The username is stored lowercase. Sessions stay signed in. `400` for an invalid username, `403` for a wrong password. |\n| POST | `/api/settings/vault` | Session only (+CSRF) | Sets the vault folder and switches the running server to it. Body: `{path, create?}`. `path` must be absolute, without `..`, writable, not a system folder, and not overlap the state folder; with `create` a missing folder is created (its parent must exist). Returns `{ok, vault, created, stats}`. `400` with a message when the folder is refused. |\n| POST | `/api/settings/server` | Session or key (`admin`, +CSRF) | Body: `{realm?, session_ttl?, session_max_age?}` (at least one). Sets the server name (1-64 characters), how long a browser may stay idle before it must sign in again (300 to 2592000 seconds) and the longest sign-in (`0` for no limit, else at least `session_ttl`). Returns `{realm, session_ttl, session_max_age}`; open sessions follow the new limits at once. `400` for a value out of range. |\n| GET | `/api/settings/sessions` | Session only | `{sessions:[{id, current, source, alias, ip, user_agent, created_at, last_seen, expires_in}], count}`: live browser sessions. API keys are not sessions and never appear here. |\n| POST | `/api/settings/sessions/revoke` | Session only (+CSRF) | Signs other browsers out. Body: `{id}` or `{others:true}`. Returns `{ok, revoked}`. `400` for the current session (use logout), `404` when the session has already ended. |\n| POST | `/api/settings/sessions/rename` | Session only (+CSRF) | Names a device. Body: `{id, alias}`; an empty alias clears it. Returns `{ok, alias}`. |\n| GET | `/api/settings/sessions/activity` | Session only | `{events, count, ip, since}`: activity log entries from that session\'s IP address since it signed in, API-key entries left out, newest first, at most 200. Query: `id`. |\n\n| GET | `/api/settings/media` | Session or key | `{max_image_mb, max_image_bytes}`: the largest image upload (5 MB by default). |\n| POST | `/api/settings/media` | Session or key (`admin`, +CSRF) | Body: `{max_image_mb}` (0.1 to 50). Applies at once to the app, the HTTP API and MCP `upload_image`. |\n\nSession `id` values are the short ids returned by `GET /api/settings/sessions`\n(a unique prefix also works). An ambiguous or malformed id is `400`.\n\n## OAuth\n\nMemora is an OAuth 2.1 authorization server for remote MCP clients. Only the\nauthorization code flow with PKCE (`S256`) is supported. The access token is a\nnew API key named after the client, with the default scopes (`mcp`, `read`,\n`write`) and every tool; it appears on the Agents page like any other key and\nis revoked by deleting or disabling that key. URLs in the metadata use\n`MEMORA_BASE_URL` when it is set, else the scheme and host of the request.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/.well-known/oauth-protected-resource`, `/.well-known/oauth-protected-resource/mcp` | None | Protected resource metadata (RFC 9728): `{resource, authorization_servers, bearer_methods_supported, scopes_supported, resource_name}`. |\n| GET | `/.well-known/oauth-authorization-server`, `/.well-known/oauth-authorization-server/mcp`, `/.well-known/openid-configuration` | None | Authorization server metadata (RFC 8414): `issuer`, the authorization, token, and registration endpoints, supported response types (`code`), grant types (`authorization_code`, `refresh_token`), PKCE methods (`S256`), token endpoint auth methods, `scopes_supported` (`mcp`), and `client_id_metadata_document_supported: true`. |\n| POST | `/oauth/register` | None | Dynamic client registration (RFC 7591). Body: `{redirect_uris, client_name?}`. `redirect_uris` holds 1 to 10 URIs, each HTTPS or plain HTTP on `localhost`, `127.0.0.1`, or `[::1]`, without a fragment. Returns `201 {client_id, client_name, redirect_uris, client_id_issued_at, token_endpoint_auth_method, grant_types, response_types}`. `400 {error, error_description}` for invalid metadata or when 500 clients are registered. `429` past 10 registrations from one IP (then one per minute). A client that has not completed an authorization within an hour is removed; it can register again. |\n| GET | `/oauth/authorize` | None | `302` to `/login?oauth=1&<query>`, where the sign-in page shows a consent card (after sign-in when needed). |\n| POST | `/oauth/token` | None | Form-encoded or JSON body. `grant_type=authorization_code` with `code`, `code_verifier`, `client_id` (or HTTP Basic), and optional `redirect_uri`; or `grant_type=refresh_token` with `refresh_token` and optional `client_id`. Returns `{access_token, token_type:"Bearer", refresh_token, scope:"mcp"}`. Codes are single use and expire after 10 minutes. A refresh gives the same key a new secret and a new refresh token. Errors are `400 {error, error_description}` (`invalid_request`, `invalid_grant`, `unsupported_grant_type`). |\n| GET | `/api/oauth/request` | None | What the consent card shows for an authorization request. Query: the `/oauth/authorize` query. Returns `{ok:true, client:{id, name, kind}, redirect_host, signed_in, user}` or `{ok:false, error, error_description, redirect}`. |\n| POST | `/api/oauth/approve` | Session only (+CSRF) | Body: `{query, allow}` where `query` is the authorization request query. Returns `{ok:true, redirect}`: the client\'s redirect URI with a `code` when `allow` is `true`, else with `error=access_denied`. An invalid request returns `{ok:false, error, error_description, redirect}`. `401` without a session. |\n| GET | `/api/oauth/clients` | Session or key (`admin`) | `{clients:[{client_id, name, redirect_uris, kind, created_at, fetched_at}], connections:[{key_id, client_id}]}`. `kind` is `dcr` (registered), `cimd` (metadata document), or `manual` (added by the owner). |\n| POST | `/api/oauth/clients` | Session or key (`admin`, +CSRF) | Registers a client by hand. Body: `{name?, redirect_uris}`. Returns `{ok, client}`. `400` for invalid redirect URIs. |\n| POST | `/api/oauth/clients/delete` | Session or key (`admin`, +CSRF) | Forgets a client and its refresh tokens. Body: `{client_id}`. Returns `{ok, deleted}`. Keys issued to the client stay until they are deleted. |\n\nA `client_id` may also be an HTTPS URL of a client metadata document. The\nserver fetches it (public addresses only, no redirects, at most 64 KiB), checks\nthat its `client_id` matches the URL, and caches it for 24 hours.\n\n## Logs and activity\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/logs` | Session or key (`read`) | `{range, count, events}`, newest first, each event with a local `time`. Query: `range` (for example `1d`, `7d`, `today`, `yesterday`, `all`; default `1d`), `days` (used when `range` is absent, at most 7), `since` and `until` (unix seconds; override `range`), `limit` (default 400, max 2000), `actor`, `q`. |\n| GET | `/api/logs/settings` | Session or key (`admin`) | `{max_mb, max_days, stats:{bytes, lines, oldest, newest, max_bytes, max_days}}` for the vault event log. |\n| POST | `/api/logs/settings` | Session or key (`admin`, +CSRF) | Body: `{max_mb?, max_days?}` (1 to 512 MB; 0 to 3650 days, 0 meaning no age limit). Returns the same shape as `GET`. The log is trimmed to the new limits at once. `400` for out-of-range values. |\n| GET | `/api/events` | Session or key (`read`) | `{events, count}`: the vault event log (`.events.jsonl`), oldest first, the newest `limit` entries. Query: `since` (unix seconds), `folder`, `actor` (the key name for agents), `limit` (default 100, max 2000). |\n\n### Realtime\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/ws` | Session only | WebSocket upgrade. The `Origin` must be same-origin (`403` otherwise). `503` when too many clients are connected. |\n| POST | `/_bus` | Loopback only | Publishes a JSON object (at most 64 KiB) into the event stream. Returns `{ok:true}`. `403` for callers that are not on the same machine, that come through a proxy (any forwarding header) or that are a web page (an `Origin` or `Sec-Fetch-*` header), `400` for a body that is not a JSON object, `413` for a body or event that is too large. |\n\nOn connect the server sends a `hello` event with the client count, replays the\nlast 40 stored events (each marked `replay: true`), then streams live events.\nWhen a client leaves, the others get a `presence` event with the new count.\nMessages from the client are ignored; the server pings every 30 seconds and\ncloses a connection that has been silent for 75 seconds.\n\n### Local stop\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| POST | `/_stop` | Loopback and stop token | Stops the server gracefully, like Ctrl+C (open requests finish, buffered usage is written). Returns `{ok:true}` and exits shortly after. `403` unless the caller is on the same machine, not behind a proxy (any forwarding header), and sends the `X-Memora-Stop-Token` header. Also accepted while the instance is locked. |\n\nAt startup, once the port is bound, the server writes a fresh random token to\n`<state>/stop.token` (readable by the server\'s user only on Linux and macOS)\nand removes it on exit. `memora-cli stop` reads that file and calls `/_stop`\nfirst on every OS; only if that fails does it fall back to SIGTERM (Linux,\nmacOS) or `taskkill` (Windows, where a server started without a console\nignores a polite `taskkill`). Anyone who can read the state folder can stop\nthe server; they can already read its database.\n\n### `ai_activity` events\n\nEvery MCP `tools/call` publishes a `start` and an `end` event sharing `call_id`:\n\n```json\n{"type":"ai_activity","phase":"start","call_id":"c1a2b3c4d5e6-0","actor":"research-bot",\n "actor_kind":"agent","actor_id":"k_1a2b3c4d","action":"read_memory","label":"Plan/Index.md",\n "paths":["Plan/Index.md"],"_ts":1760600000.12}\n{"type":"ai_activity","phase":"end","call_id":"c1a2b3c4d5e6-0","actor":"research-bot",\n "actor_kind":"agent","actor_id":"k_1a2b3c4d","action":"read_memory","label":"Plan/Index.md",\n "paths":["Plan/Index.md"],"ok":true,"ms":2,"_ts":1760600000.12}\n```\n\n- `actor`: the API key\'s name (fallback: key id) with `actor_kind: "agent"`; for a\n browser session the username with `actor_kind: "user"`. `actor_id` is the key id (or\n the username). Node events (`node_created`, ...) from the call carry the same `actor`.\n- `action`: the tool name.\n- `for` (optional): who the agent acted for and how it was asked. Mnemo, the built-in\n agent (`actor: "Mnemo"`, `actor_id: "mnemo"`), sets it: `owner · chat`,\n `owner · console`, `<who> · @mnemo in <note>`.\n- `paths`: vault-relative note paths from the arguments (`path`, `paths`, `from`, `to`,\n `old_path`, `new_path`, `into` of `merge_memory`, `source`/`target` of `find_path`)\n plus note paths found in the result (search hits, the created or moved note), at\n most 20, each at most 512 bytes (longer paths are dropped). Whole-vault overviews\n (`get_graph`, `list_memory`, logs, ...) add no result paths.\n- Read-only tools publish `start` after running (so it carries the result paths),\n immediately followed by `end`; mutating tools publish `start` before running and `end`\n after, with the result paths added.\n- `end` adds `ok`, `ms`, and on failure `error` (at most 200 characters). `label` is at\n most 160 characters. `_ts` is the publish time in unix seconds. `end` events are\n realtime only: they are not written to `.events.jsonl` or the replay buffer.\n\n## UI layout\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/ui/layout/{name}` | Session only | `{name, data, updated_at}`; `data` and `updated_at` are `null` if never saved. |\n| PUT | `/api/ui/layout/{name}` | Session only (+CSRF) | `{ok:true, updated_at}`. Body: `{data: <any JSON>}`. |\n\n`name` is `[a-z0-9_-]{1,40}` (else `400`). API keys get `403`. `data` is stored as\nserialized JSON of at most 512 KiB (`413` above); the request body limit is 600 KiB.\nNames starting with `srv-` are reserved for server settings (`403`).\nLayouts are stored in the `ui_layout` table of `memora.db`. The web UI uses them for\n`canvas` (card positions and frames) and `graph` (pinned positions).\n\n## Pins\n\nThe owner\'s pinned notes and folders (the sidebar\'s Pinned list), shared by every\nbrowser and device of the instance.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/pins` | Session only | `{count, pins:[{kind, path, position, missing}]}` in display order. |\n| PUT | `/api/pins` | Session only (+CSRF) | Same as GET. Body: `{pins:[{kind, path}]}`, the whole ordered list (reorder, remove). |\n| POST | `/api/pins/pin` | Session only (+CSRF) | Same as GET. Body: `{kind, path, position?}`. Pins an existing note or folder at `position` (default: the end), or moves its pin there; `404` if it does not exist. |\n| POST | `/api/pins/unpin` | Session only (+CSRF) | Same as GET plus `removed`. Body: `{kind, path}`. |\n\n`kind` is `note` or `folder`. `path` is vault-relative as the tree shows it (notes end in\n`.md`): absolute paths, `..`, empty or hidden segments, `\\`, control characters and paths\nover 1024 characters get `400`, as do more than 200 pins. API keys get `403` (agents use\nthe MCP tools `list_pins`, `pin` and `unpin`). Bodies are limited to 256 KiB for `PUT`\nand 8 KiB for `pin`/`unpin` (`413`). `missing` is true when the path no longer exists,\nfor example after a rename outside Memora; such a pin is kept until it is removed.\n\nRenames, moves and deletes done by Memora (HTTP or MCP) rewrite or drop pins in the same\ndatabase transaction, including pins on notes and folders inside a moved folder;\nmoving an item to the trash or deleting it removes its pin, and deleting a folder\nremoves every pin under it. Every change publishes a `pins_changed` realtime event with\nno other data; open browsers reload the list. Pins are stored in the `pin` table of\n`memora.db`.\n\n## Mnemo (built-in agent)\n\nMnemo is the notes agent built into Memora. Every route needs the signed-in\nbrowser session (API keys get `403`, writes need CSRF); the console\'s `/mnemo`\nuses a short local session. Mnemo\'s data lives in `assistant.sqlite3` beside\n`memora.db` (file mode 0600): providers with their API keys sealed\n(ChaCha20-Poly1305, the same key as the server\'s other secrets), models,\npreferences, chats and messages. A key is never returned; providers carry a\nfour-character `key_hint`.\n\n| Method | Path | Returns |\n|---|---|---|\n| GET | `/api/assistant/state` | `{name, ready, providers, models, prefs, tools, defaults}`. `ready` is true when a model can answer. `tools` is the fixed list Mnemo may use. Each model has `thinks`: it can think, so the chat offers a thinking level (a model that has shown its thinking in a reply, Claude 3.7 and later, OpenAI reasoning models, open reasoning models known by name). A level other than `auto` is sent as `output_config.effort` (Anthropic), `reasoning.effort` (Responses API, OpenAI-compatible servers) or `reasoning_effort` (OpenAI chat and OpenAI-style routers), and left out for a model that refuses it. |\n| POST | `/api/assistant/providers` | Adds or changes a provider. Body: `{id?, kind?, label?, api_style?, base_url?, api_key?, enabled?}`. Up to 20 providers, several of the same type allowed. `id` is the owner\'s own (1-32 characters of `a-z`, `0-9`, `-`; made from `label` when left out; it cannot change, since models are keyed `id/model`). `kind` is `openai`, `anthropic` or `custom` (any OpenAI-compatible server, which needs `base_url`, its `/v1` address); `api_style` is `chat` or `responses` (OpenAI and compatible) or `messages` (Anthropic). For an existing `id`, fields left out keep their value, so `{id, enabled: false}` switches a provider off (its models leave the model pickers). Leaving `api_key` out keeps the saved key; `""` removes it. Returns the state plus `saved` (the id). |\n| POST | `/api/assistant/providers/test` | Body: `{id}`. Lists the provider\'s models as a connection check: `{ok, models, ms}` or `{ok: false, error}`. |\n| POST | `/api/assistant/providers/delete` | Body: `{id}`. Removes the provider, its key and its models. |\n| POST | `/api/assistant/models/fetch` | Body: `{provider}`. Reads the provider\'s model list (`GET <base>/models`, every page for Anthropic) with the limits it reports: the context window from `max_input_tokens`, `context_length`, `context_window`, `max_context_length` or `max_model_len`, and the reply limit from `max_tokens` or `max_completion_tokens`. Pinned models stay; unpinned ones the provider no longer lists go. Returns the state plus `fetched`. `502` when the provider refuses. |\n| POST | `/api/assistant/models` | Body: `{provider, model, label?, context_window?, max_output?, pinned?, hidden?}`. Adds a model by hand or changes it; `null` clears a limit. The app sets only pinned, hidden and new models; limits normally come from the provider. |\n| POST | `/api/assistant/models/delete` | Body: `{provider, model}`. |\n| POST | `/api/assistant/prefs` | Any of `default_model` (`provider/model`), `system_prompt` (up to 4000 characters), `temperature` (0-2), `max_output_tokens` (64-200000), `context_tokens` (2000-2000000, for models without a window), `max_steps` (1-30 tool rounds per reply), `launcher` (the floating button), `thinking` (`auto`, `off`, `low`, `medium` or `high`: how hard models that can think do so; `auto` leaves it to the model), `fallback_models` (up to 5 `provider/model` keys: when a reply\'s model fails after its retries, Mnemo carries on with the next one, streamed as `fallback {from, model, reason}`; with none left the error stands and the owner tries again); `null` resets one. |\n| GET | `/api/assistant/sessions` | `{sessions: [{id, title, scope, model, pinned, created_at, updated_at, messages, running, seen}]}`. `messages` counts the owner\'s and Mnemo\'s messages (not tool results); `?about=<path>` lists only the chats about that note or folder (kept for it, with it attached, or naming it in a tool call). `seen` is how many of them the owner has read on any device (the unread count is `messages - seen`). The first list after 2.1.5 counts every existing chat as read. |\n| POST | `/api/assistant/sessions` | Body: `{scope?, model?, title?, fleeting?}`. A fleeting chat is left out of lists, search and Mnemo\'s look-back tools and is deleted (with the pictures sent in it) by `.../delete` when the owner leaves, or after 30 minutes idle. `scope` is `global`, `note:<path>` or `folder:<path>`. Returns `{session}`. |\n| GET | `/api/assistant/sessions/{id}` | `{session, messages: [{id, role, content, tool_calls, tool_call_id, tool_name, meta, created_at}], context}`. `context` is `{used, window, reserved_output, compact_at, compactions, model}` for the model the chat would use now (approximate tokens), or `null` without a usable model. A message with `meta.compact: true` is a summary that stands in for every message before `meta.keep_from`. |\n| GET | `/api/assistant/search` | Query `q` (every word must appear, any case), `limit` (default 60, at most 200). `{query, hits: [{chat, title, scope, message_id, role, snippet, at}]}`, newest first: the owner\'s messages and Mnemo\'s replies whose text or chat title holds the words; `message_id` is `null` for a chat matched by its title alone. |\n| POST | `/api/assistant/sessions/{id}/rerun` | Body: `{message_id?, model?}` (default: the last of the owner\'s messages). Runs that message\'s turn again: every message after it is removed, then the reply streams as for `/chat`. `400` when `message_id` is not one of the owner\'s messages in the chat, `409` while it answers. |\n| POST | `/api/assistant/sessions/{id}/steer` | Body: as for `/chat`. Send this message now: the reply running is cut where it is (what it wrote so far is kept, `meta.stopped`) and Mnemo answers this message as a new turn; with no reply running it goes at once. `{ok, queue}`. (Older chats may hold `meta.steer` messages from before 2.1.9.) |\n| GET | `/api/assistant/sessions/{id}/queue` | `{items: [{id, text, attach, at}], held}`: messages waiting for the reply running. They go out one by one, on the server, as each reply ends (finished, stopped or cut), whichever device queued them. A failed reply pauses the queue (`held`) until a message is sent now or the queue resumes. Kept in memory: a restart empties it. |\n| POST | `/api/assistant/sessions/{id}/queue` | Body: as for `/chat`. Queue a message (it goes at once when no reply runs). `{id, queue}`. |\n| POST | `/api/assistant/sessions/{id}/queue/{qid}` | Body: `{op: del \\| up \\| down \\| move \\| send, to?}` (`to` the new place for `move`). `send` puts it first and sends it now, cutting the reply running. `{qid}` may also be `clear` (drop every queued message) or `resume` (let a paused queue go on). Answers with the queue. |\n| GET | `/api/assistant/sessions/{id}/watch` | What happens in the chat from now on, as server-sent events, so every device with it open stays in step: `hello {running}`, `user {message, via, client}` (a message stored from any device or out of the queue; `client` is the id the sender put in its request), `running`, `idle {outcome}` (`done`, `stopped`, `failed`), `queue {items, held}`, `queue_error {message}`, `compacted`, `reload` (turns were replaced: read the chat again). |\n| GET | `/api/assistant/sessions/{id}/live` | The reply running in the chat as server-sent events: every event since it began, then live, until it ends. `204` when none is running. |\n| GET | `/api/assistant/sessions/{id}/export` | The chat as a Markdown file (`text/markdown`, a download): each message with its time, Mnemo\'s steps, what it showed, compaction summaries. |\n| GET | `/api/assistant/skills` | `{folder: "Skills", skills: [{name, path, description}]}`: the owner\'s skills (notes in `Skills/`). A message starting `/name` sends that skill\'s steps with it (`meta.skill`). |\n| GET | `/api/assistant/suggestions` | `{own, ai}`: the owner\'s suggestions and Mnemo\'s (from recent notes; written again in the background when older than 12 hours). |\n| POST | `/api/assistant/suggestions` | Body `{own: [text]}` (up to 30): the owner\'s own suggestions. |\n| POST | `/api/assistant/suggestions/refresh` | Mnemo writes its suggestions again now. `{own, ai, fresh}`. |\n| POST | `/api/assistant/sessions/prune` | Delete many chats: body `{ids}`, `{older_than_days}` (1 to 3650; not active for that long) or `{all: true}`, with `keep_pinned` (default `true`, used with age or all). Chats answering right now are skipped. `{deleted, skipped}`. |\n| POST | `/api/assistant/sessions/{id}/seen` | Body: `{messages}`. The owner has read the chat up to `messages` (capped at what it holds; never goes back). `{ok, seen}`. |\n| POST | `/api/assistant/sessions/{id}/stop` | End the reply running in the chat; what it wrote so far is kept (`meta.stopped`) and the next queued message goes out. `{stopped}`. |\n| POST | `/api/assistant/sessions/{id}/compact` | Fold the older turns into a summary now (the chat\'s model writes it; the last turn stays as it is). `{ok: true, messages, tokens, summary, context}`, or `{ok: false, reason, context}` when there is nothing older yet. `409` while the chat is answering. |\n| POST | `/api/assistant/sessions/{id}` | Body: `{title?, model?, pinned?}`. A chat keeps its `model` (set when it is created, from the request or the default model at that time); a reply uses it while it is listed and its provider can answer, else the default model, then the fallback models, then the first pinned or visible one. When a fallback model takes over a reply, the chat\'s `model` becomes that model and the reply\'s stored message carries `meta.fallback_from`. |\n| POST | `/api/assistant/sessions/{id}/delete` | Deletes the chat and its messages (notes are not touched). |\n| POST | `/api/assistant/sessions/{id}/chat` | Body: `{text, model?, attach?, tz?, tz_offset?, answer?}` (`answer` `{to, approve?, other?}` answers one of Mnemo\'s questions by its call id; `approve` is set when the tapped option approves a change) (`tz` an IANA zone name and `tz_offset` minutes east of UTC, from the browser, for Mnemo\'s `current_time`). `attach` lists up to 8 items `{kind, path}`: `note` (its text, up to 8000 characters), `folder` (the notes in it, up to 200) or `image` (`path` is an id from `/api/assistant/uploads`). A snapshot of them is stored with the message (`meta.attach`, `meta.context`) and stays in the chat\'s context. Replies as server-sent events, one JSON object per `data:` line: `start {model, context}`, `ask {id, question, options: [{label, description, approve}], allow_other}` (Mnemo\'s `ask_owner`: the reply ends and waits for the answer), `steered {text}`, `compacting` and `compacted {messages, tokens}` (the chat was near full and its older messages were folded into a summary first), `thinking {delta}` (the model\'s thinking, where the provider shows it), `text {delta}`, `tool_start {id, name, args}`, `tool_end {id, name, ok, summary, ms}`, `notice {text}`, `error {message}`, `done {input_tokens, output_tokens, title, context}`. `409` while the chat is already answering (queue it instead). Also `compact_text {delta}` (the summary as it is written, before `compacted {messages, tokens, summary}`) and `fallback {from, model, reason, detail}` (the model failed: `reason` in a few words, `detail` the provider\'s error; the next fallback model answers and becomes the chat\'s model). A model out of quota, refused or not found is not retried. A body may carry `client` (any short id) so the sender can tell its own message in `/watch`. The reply runs on the server: closing the stream does not stop it (watch it again with `/live`, end it with `/stop`); `GET /api/assistant/sessions` and `GET /api/assistant/sessions/{id}` say `running` meanwhile. |\n| POST | `/api/assistant/uploads?name=<file>` | The raw bytes of a PNG, JPEG, WebP or GIF (the Images upload limit applies): `{id, name, bytes, url}`. The image waits in `assistant-uploads/` in the state folder for a week. Attached to a chat message, it goes to the model as an image (OpenAI `image_url`, Responses `input_image`, Anthropic `image` blocks; the newest 6 images of the chat, each up to 4.5 MB; a model that refuses images gets their names instead), and Mnemo\'s `place_image` tool can put it beside a note through MCP `upload_image`. |\n| GET | `/api/assistant/uploads/{id}` | The staged image, for the chat\'s thumbnails. |\n\nMnemo runs its tools through the MCP server under the name **Mnemo** (actor id\n`mnemo`), so every call shows in Activity and respects tools switched off on the\nTools page. It has one tool of its own, `place_image {upload, note, name?, alt?,\nappend?}`, which hands a staged chat image to `upload_image` (and is off when\nthat tool is off).\n\nThinking: Anthropic models are asked for adaptive thinking with summaries\n(models that refuse the field are asked without it from then on), OpenAI GPT-5\nand o-series models on the Responses API for reasoning summaries, and\nOpenAI-compatible servers stream `reasoning_content` or `reasoning` on their\nown. A Claude reply that carried thinking is stored block for block\n(`meta.raw`) and sent back verbatim, and each chat keeps the system prompt it\nstarted with (`meta.system` on its first message), so the model\'s earlier\nthinking stays valid. Thinking from before a compaction is not replayed, and\nwhen the API refuses a replayed thinking block the request is sent again\nwithout it. Permission (`POST /api/assistant/prefs` `{permission: "ask" | "auto"}`, default `ask`): in Ask first mode a tool call that would change notes is refused until the owner\'s latest message approves (an `answer` with `approve: true`, or an `@mnemo:` request from a note); Auto lets changes through and runs up to 40 steps a reply (25 otherwise; `max_steps` overrides, up to 60). Besides `place_image` it has `ask_owner` (a question with 2 to 5 options and Other), `current_time` (date, time, weekday and the owner\'s time zone), `search_docs` and `read_docs` (Memora\'s own documentation, from `mnemo-docs.json` the web build writes next to the assets; answers link `/docs/<page>#<heading>`), `show_items` (cards in the reply for notes, folders,\nimages or the vault; `tool_end` carries the checked items as `shown`) and tools of its own over its chats: `list_chats` (newest first, optionally by\ntitle), `search_chats` (every word, newest first) and `read_chat` (one chat\'s\nmessages, 60 at a time with `page`), for when the owner refers to an earlier\nconversation; and over the pages it wrote (```` ```html ```` / ```` ```svg ```` blocks\nin its replies, named by their `<title>`; the same title again is a newer version):\n`list_artifacts` (across chats or in one) and `read_artifact` (a page\'s source, the\nlatest version unless `version` is given), so it reworks a page instead of starting\nover and can reuse one from another chat. Pages live in their chat\'s messages and\nare deleted with it. It may use 54 tools for reading and looking after notes, folders,\ntags, links, pins, history and the Trash; it never gets `delete_memory`,\n`bulk_delete`, `delete_folder`, export or import, admin or web tools. A line with `@mnemo: <request>` in a note (outside code; a struck\n`~~@mnemo: …~~` is done) is a request to Mnemo: a few seconds after the owner\nsaves the note (`POST /api/save` or `/api/create`), or after an agent\'s tool\ncall changes it (Mnemo\'s own changes from a chat or the console too; not those\nit makes while answering a request), Mnemo runs it in the note\'s chat (one per\nnote, titled `@mnemo · <note>`, scope `note:<path>`; every later request in the\nnote joins it, unless it is answering right now; each request\'s message holds it\nas written, `meta.mention` says `{path, line, by}` and `meta.attach` names\nthe note), then saves the note with\nthe request struck through and its reply quoted under it. Activity events of\nMnemo\'s tool calls carry `for` ("owner · chat", "owner · console",\n"<who> · @mnemo in <note>"). A chat keeps\nits whole conversation for its model: when its history fills all the tokens it\nmay use (the model\'s context minus the room kept for the reply), the chat\'s model folds the older turns into a summary (stored as a\nmessage with `meta.compact`, sent in front of the kept turns) before the next\nreply, keeping the last one or two turns as they are. Only if that fails are the\noldest turns left out (a reply and its tool results always stay together).\n\n## Status codes\n\n| Code | Meaning |\n|---|---|\n| 200 | Success. |\n| 201 | OAuth client registered. |\n| 202 | MCP notification accepted. |\n| 204 | `/favicon.ico`. |\n| 302 | Redirect (pages to `/login` without a session, `/login` to `/` when signed in, logout to `/login`, locked instance to `/login?locked=1`, `/oauth/authorize` to the consent page). |\n| 304 | Not modified (`/api/vault/file`, static assets). |\n| 400 | Bad request, for example a missing required field or an invalid value. |\n| 401 | Missing or invalid credentials, or a session-only endpoint called without a session. |\n| 403 | Blocked by an access rule, a CSRF origin mismatch, a missing key scope, a wrong password or setup code, or an endpoint that needs an open setup or reset window. |\n| 404 | Note, key, session, rule, or route not found; also any request for a host outside the domain list. |\n| 405 | `/mcp` called with a method other than `POST`. |\n| 408 | The request took longer than 30 seconds. |\n| 409 | No vault configured (`needs_vault: true`), or a state conflict. |\n| 413 | Body, layout, image, or event too large. |\n| 415 | `/api/vault/file` path is not an image. |\n| 423 | Instance is LOCKED. |\n| 429 | Rate limit or failed-attempt cooldown (`Retry-After` header). |\n| 500 | Internal error, for example the state database failed. |\n| 503 | UI assets are not installed, the password hashing pool is busy, or too many realtime clients. |\n',SY=`# Deployment
|
|
13259
|
+
`,l6="# Installing Memora\n\nMemora ships as two binaries plus a folder of web UI assets:\n\n| Piece | Role |\n|---|---|\n| `memora` | The server: HTTP API, MCP, web UI, and WebSocket on **one TCP port** (default `8400`) |\n| `memora-cli` | The operator console. Run it with no arguments for slash commands (`/guide`, `/web`, `/config`, ...) |\n| `assets/` | Web UI files, found through `MEMORA_ASSETS` |\n\nIt runs on Linux (x86_64, aarch64) and Windows 10/11 (x64). Install it with\n**npm** (Linux and Windows, runs as you), **Docker**, the **native** installer\n(a systemd service on Linux) or from source. On Windows, use npm. All end the\nsame way: run `memora-cli setup`, open the link it prints and enter the code.\n\n**Fastest path** (pick one, in this order of ease), then open the link the\nsetup command prints and enter the code:\n\n```bash\n# npm (Linux x86_64 / arm64, Windows x64; Node.js 22 or newer)\nnpm install -g @codrihub/memora && memora\nmemora-cli setup --minutes 15 # in a second terminal\n\n# Docker: no clone or folder permissions needed (named volumes)\ndocker run -d --name memora --restart unless-stopped -p 8400:8400 \\\n -v memora-data:/data -v memora-state:/state ghcr.io/codrihub/memora:latest\ndocker exec -it memora memora-cli setup --minutes 15\n\n# Native installer (Linux server with systemd)\ncurl -fsSL https://raw.githubusercontent.com/Codrihub/memora/main/scripts/install.sh | sudo sh\nsudo memora-cli setup --minutes 15\n```\n\n- [Network exposure](#network-exposure)\n- [Native install](#native-install)\n- [Docker](#docker)\n- [npm](#npm)\n- [Start, stop and restart](#start-stop-and-restart)\n- [Update](#update)\n- [Uninstall with memora-cli](#uninstall-with-memora-cli)\n- [Uninstall by hand (versions before 1.3.2)](#uninstall-by-hand-versions-before-132)\n- [Troubleshooting](#troubleshooting)\n- [Reverse proxy](#reverse-proxy)\n- [Backups](#backups)\n- [Automation: `--check` and `--upgrade`](#automation---check-and---upgrade)\n\n## Network exposure\n\nMemora opens exactly **one TCP port**. The HTTP API, MCP (`/mcp`), the web UI,\nand the realtime WebSocket (`/ws`) all share it. The local event intake\n`/_bus` answers on the same port but only to loopback clients.\n\nThe state database is embedded SQLite (`<state>/memora.db`). The server creates\nand migrates it on first start; it opens no port and needs no separate\ndatabase server or install.\n\nNothing else listens. Allow only that one port through the firewall, or none at\nall when a reverse proxy on the same host is the entry point\n(`--behind-proxy`).\n\n## Native install\n\nRequirements: Linux on x86_64 or aarch64 with systemd, `curl` (or `wget`),\n`tar`, `sha256sum`, and `git` (vault history uses it).\n\n```sh\n# Inspect first: https://github.com/Codrihub/memora/blob/main/scripts/install.sh\ncurl -fsSL https://raw.githubusercontent.com/Codrihub/memora/main/scripts/install.sh | sudo sh\n```\n\nPass flags after `sh -s --`, for example:\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/Codrihub/memora/main/scripts/install.sh \\\n | sudo sh -s -- --version 1.0.0 --behind-proxy\n```\n\nor download the script and run it: `sudo sh install.sh --help`.\n\nThe script is idempotent: running it again reinstalls the same files and keeps\nthe port and bind address of the existing unit unless you pass new ones.\n\n### What it does\n\n1. Downloads `memora-<version>-<arch>-linux.tar.gz` for this CPU from GitHub\n Releases (the latest, or `--version`), downloads `SHA256SUMS` from the same\n release, and refuses to continue if the checksum does not match.\n2. Installs the binaries atomically (copy to a temp file, then `mv`).\n3. Creates the system user and group `memora` (no login shell, home\n `/var/lib/memora`).\n4. Creates `/var/lib/memora/state` (`0700`) and `/var/lib/memora/vault`\n (`0750`), owned by `memora`.\n5. Writes `/etc/systemd/system/memora.service`, enables and starts it, waits\n for `/healthz`, then verifies the state database with `memora-cli db check`.\n6. Prints the next step and, when listening on every interface, a firewall\n hint.\n\n### Paths\n\n| Path | Content |\n|---|---|\n| `/usr/local/bin/memora`, `/usr/local/bin/memora-cli` | Binaries |\n| `/usr/local/share/memora/assets/` | Web UI |\n| `/usr/local/share/memora/VERSION` | Installed version (read by `--check`) |\n| `/usr/local/share/memora/install.sh` | Copy of the installer, used for `--upgrade`, `--check`, `--uninstall`, and `memora-cli update` |\n| `/var/lib/memora/state/` | `memora.db` (owner, API key hashes, sessions, settings, activity log), `backups/` |\n| `/var/lib/memora/vault/` | Suggested vault folder (chosen in the browser after the first sign-in) |\n| `/etc/systemd/system/memora.service` | The unit |\n\n`--prefix` moves the first four (default `/usr/local`), `--data-dir` moves the\nlast two (default `/var/lib/memora`).\n\n### Flags\n\n| Flag | Meaning |\n|---|---|\n| *(none)* | Install or reinstall the latest release |\n| `--version X.Y.Z` | Install that release |\n| `--from-source` | Build with `cargo build --release --locked` in the checkout the script lives in (`sudo ./scripts/install.sh --from-source`); built as `$SUDO_USER` |\n| `--from-dir PATH` | Install `PATH/memora`, `PATH/memora-cli`, `PATH/assets/` (an unpacked release, or your own build). Version from `--version`, else `PATH/VERSION` |\n| `--port N` | Port (default `8400`) |\n| `--bind ADDR` | Bind address (default `0.0.0.0`) |\n| `--behind-proxy` | Bind `127.0.0.1`; a reverse proxy on this host is the only entry |\n| `--prefix DIR` | Install prefix (default `/usr/local`) |\n| `--data-dir DIR` | Data root (default `/var/lib/memora`) |\n| `--no-start` | Install and enable, but do not start |\n| `--no-systemd` | Skip the unit and the system user (containers, tests); prints the command to start the server by hand |\n| `--upgrade` | Replace binaries and assets, keep state, restart the service if it was running |\n| `--force` | With `--upgrade`: reinstall even when already up to date |\n| `--uninstall` | Stop and remove the unit, binaries, and assets; keep data |\n| `--purge` | With `--uninstall`: also delete the data dir and the `memora` user (asks first) |\n| `--check` | Print `MEMORA_LATEST=` and `MEMORA_INSTALLED=`; change nothing |\n| `--yes`, `-y` | Never ask (needed for `--purge` without a terminal) |\n| `--dry-run` | Print every action, change nothing |\n| `--repo OWNER/NAME` | Download from another GitHub repository (forks); also settable as `MEMORA_REPO` |\n\n`MEMORA_RELEASES_URL` points the installer at a mirror that serves the same\nlayout as GitHub (`<url>/latest`, `<url>/download/vX.Y.Z/<file>`).\n\nRoot is required except for `--check`, `--dry-run`, and `--no-systemd` into a\nprefix you can write to.\n\n### Exit codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Error (see the message) |\n| `2` | Bad usage |\n| `3` | Already up to date (`--upgrade`) |\n| `4` | Network or download failure |\n| `5` | Checksum mismatch or missing from `SHA256SUMS` |\n| `6` | Not running as root |\n| `7` | Unsupported OS or CPU |\n\n### The systemd unit\n\nThe installer writes this unit (shown with the default paths and port):\n\n```ini\n[Unit]\nDescription=Memora - long-term memory for AI agents (HTTP API + MCP + web UI)\nDocumentation=https://github.com/Codrihub/memora\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nUser=memora\nGroup=memora\nWorkingDirectory=/var/lib/memora\nEnvironment=HOME=/var/lib/memora\nEnvironment=MEMORA_STATE=/var/lib/memora/state\nEnvironment=MEMORA_ASSETS=/usr/local/share/memora/assets\nEnvironment=MEMORA_PORT=8400\nEnvironment=MEMORA_BIND=0.0.0.0\nEnvironment=MEMORA_VAULT=/var/lib/memora/vault\nEnvironment=GIT_AUTHOR_NAME=Memora\nEnvironment=GIT_AUTHOR_EMAIL=memora@localhost\nEnvironment=GIT_COMMITTER_NAME=Memora\nEnvironment=GIT_COMMITTER_EMAIL=memora@localhost\nEnvironment=RUST_LOG=info\nExecStart=/usr/local/bin/memora\nRestart=on-failure\nRestartSec=3\nTimeoutStopSec=15\nLimitNOFILE=65536\nUMask=0027\n\n# Hardening\nNoNewPrivileges=yes\nAmbientCapabilities=\nCapabilityBoundingSet=\nProtectSystem=strict\nReadWritePaths=/var/lib/memora\nProtectHome=yes\nPrivateTmp=yes\nPrivateDevices=yes\nProtectKernelTunables=yes\nProtectKernelModules=yes\nProtectKernelLogs=yes\nProtectControlGroups=yes\nProtectClock=yes\nProtectHostname=yes\nRestrictAddressFamilies=AF_UNIX AF_INET AF_INET6\nRestrictNamespaces=yes\nRestrictRealtime=yes\nRestrictSUIDSGID=yes\nLockPersonality=yes\nMemoryDenyWriteExecute=yes\nSystemCallArchitectures=native\nSystemCallFilter=@system-service\nSystemCallFilter=~@privileged\n\n[Install]\nWantedBy=multi-user.target\n```\n\nA port below 1024 adds `CAP_NET_BIND_SERVICE` instead of the empty capability\nset. There are no IP restrictions (`IPAddressDeny=`) by default; use the\nfirewall, `MEMORA_DOMAIN`, or the access rules in the UI.\n\nThe installer rewrites the unit on every run. Put local changes in a drop-in:\n\n```sh\nsudo systemctl edit memora # for example, a vault outside /var/lib/memora:\n# [Service]\n# ReadWritePaths=/srv/notes\nsudo systemctl restart memora\n```\n\nBecause of `ProtectSystem=strict` and `ProtectHome=yes`, the server can only\nwrite under `/var/lib/memora`. A vault anywhere else (including `/home`) needs\nthe drop-in above (and `ProtectHome=read-only` or `no` for `/home`).\n\n### Settings\n\nThe unit sets the basics (`MEMORA_STATE`, `MEMORA_ASSETS`, `MEMORA_PORT`,\n`MEMORA_BIND`, `MEMORA_VAULT`, `RUST_LOG`) as `Environment=` lines. Everything\nelse (`MEMORA_BASE_URL`, `MEMORA_DOMAIN`, `MEMORA_TRUSTED_PROXIES`, ...) is\nstored in the state database (table `server_config`). Edit it with the\nconsole: `sudo memora-cli` → `/config`, then `/restart`.\n\nA value stored with `/config` wins over the unit's `Environment=` lines; a key\nwith no stored value uses the environment. If you stored `MEMORA_PORT` with\n`/config` and later reinstall with `--port`, change or clear it in `/config`\ntoo, otherwise the stored value keeps applying. The provisioning owner\npassword and API key are environment-only and never stored (see\n[CONFIGURATION.md](CONFIGURATION.md)).\n\nSee [CONFIGURATION.md](CONFIGURATION.md) for every variable.\n\n### First run\n\n```sh\nsudo memora-cli # opens the console; it finds the running server itself\n/guide # step-by-step, or:\n/web # prints a one-time code\n```\n\nOpen `http://<host>:8400/login`, enter the code, create the owner account, then\nchoose the vault folder (`/var/lib/memora/vault` is suggested).\n\n### Day to day\n\n```sh\nsudo systemctl status memora\nsudo systemctl restart memora\nsudo journalctl -u memora -f\nsudo memora-cli # /status, /keys, /config, /restart, /mcp ...\n```\n\n### Upgrading\n\n```sh\nsudo /usr/local/share/memora/install.sh --upgrade # latest release\nsudo /usr/local/share/memora/install.sh --upgrade --version 1.0.1\nsudo memora-cli update # same, from the console\n```\n\nBinaries and assets are swapped atomically, the state directory and vault are\nuntouched, and the service is restarted if it was running. The server migrates\n`memora.db` itself on start. Take a `memora-cli db backup` before upgrading,\nand read the [CHANGELOG](../CHANGELOG.md) before a major version bump.\n\n### Uninstall\n\n```sh\nsudo /usr/local/share/memora/install.sh --uninstall # keeps /var/lib/memora and the memora user\nsudo /usr/local/share/memora/install.sh --uninstall --purge # also deletes notes, account, keys, and the user\n```\n\nOr run `memora-cli uninstall`, which asks what to keep (see\n[Uninstall with memora-cli](#uninstall-with-memora-cli)).\n\n### Firewall\n\nOpen only the Memora port, and only when clients connect directly:\n\n```sh\nsudo ufw allow 8400/tcp\n# or\nsudo firewall-cmd --permanent --add-port=8400/tcp && sudo firewall-cmd --reload\n```\n\nBehind a reverse proxy on the same host, install with `--behind-proxy` and open\nonly the proxy's 80/443.\n\n## Docker\n\n```sh\ngit clone https://github.com/Codrihub/memora.git && cd memora\nmkdir -p data state && sudo chown -R 1000:1000 data state\ndocker compose up -d\ndocker compose exec -it gateway memora-cli # then /guide, or /web\n```\n\n`docker compose up` pulls `ghcr.io/codrihub/memora:<version>`; if the image is\nnot available (or you set `IMAGE=memora:local`) it builds from the\n`Dockerfile`. Image tags: `<version>` (for example `1.0.0`), `<major>.<minor>`\n(for example `1.0`), and `latest` (stable releases only), for `linux/amd64`\nand `linux/arm64`. The compose file pins the release it ships with; set\n`IMAGE` in `.env` to run another tag.\n\n### Volumes: `/data` and `/state`\n\nBoth must be persistent (the Compose file bind-mounts `./data` and `./state`):\n\n- `/data` is the vault: your notes, their git history, and the event\n log. Lose it and the notes are gone.\n- `/state` holds `memora.db` (owner account, password hash, API key hashes,\n sessions, settings, setup/lock state, activity log). Lose it and\n every agent key stops working, the instance falls back to first-run setup,\n and anyone who reaches the port during that window could claim it.\n\nThe container runs as uid 1000; set `MEMORA_UID`/`MEMORA_GID` in `.env` if the\nhost directories belong to another user. `MEMORA_DATA_DIR` and\n`MEMORA_STATE_DIR` move the host directories, and `MEMORA_HTTP_PORT` changes\nthe published host port. See [CONFIGURATION.md](CONFIGURATION.md#docker-compose-env).\n\n### Verify\n\n```sh\ncurl -s http://127.0.0.1:8400/healthz\ndocker compose exec gateway memora-cli db check\ndocker compose exec gateway memora-cli status\nls -l state/memora.db\n```\n\n### Upgrading\n\n```sh\ngit pull\ndocker compose pull && docker compose up -d # or: docker compose up -d --build\n```\n\nSettings: `docker compose exec -it gateway memora-cli` → `/config`, then\n`docker compose restart gateway` (`/restart` cannot restart a container from\ninside).\n\n## npm\n\nRequirements: Linux on x86_64 or arm64, or Windows 10/11 on x64; Node.js 22 or\nnewer; and `git` (vault history uses it).\n\n```sh\nnpm install -g @codrihub/memora\nmkdir -p ~/memora && cd ~/memora\nMEMORA_VAULT=./vault MEMORA_STATE=./state memora\n# in a second terminal, same folder:\nMEMORA_STATE=./state memora-cli # then /guide, or /web\n```\n\nOn Windows, in PowerShell:\n\n```powershell\nnpm install -g @codrihub/memora\nmkdir ~\\memora; cd ~\\memora\n$env:MEMORA_VAULT = '.\\vault'; $env:MEMORA_STATE = '.\\state'; memora\n# in a second terminal, same folder:\n$env:MEMORA_STATE = '.\\state'; memora-cli # then /guide, or /web\n```\n\n`npx @codrihub/memora --version` runs it without a global install.\n\n`@codrihub/memora` holds the `memora` and `memora-cli` commands and the web UI\n(used unless `MEMORA_ASSETS` is set). The binaries come from\n`@codrihub/memora-linux-x64`, `@codrihub/memora-linux-arm64` or\n`@codrihub/memora-win32-x64`, optional dependencies npm installs only on a\nmatching machine. The Linux ones are the static binaries of the GitHub\nrelease with the same version, so glibc and musl distributions both work; the\nWindows one is built with a static C runtime and needs nothing else. There is\nno install script and nothing is downloaded at install time, so it works with\n`--ignore-scripts` and from a registry mirror; it does not work with\n`--omit=optional`, which leaves the binaries out. On macOS the commands print\nwhere to go instead: use [Docker](#docker) or build from source.\n\nThe npm install sets up no service, user or data folder: the server runs as\nyou, with `MEMORA_STATE` and `MEMORA_VAULT` where you point them (`./state`\nby default). Keep the state folder private (`chmod 700 state`; on Windows,\nkeep it under your user profile), since it holds the owner account and key\nhashes. On Windows, `memora-cli` runs every command as you: there is no root\nor service account to switch to. For a long-running server, prefer the\n[native install](#native-install).\n\nUpgrade with `npm install -g @codrihub/memora@latest` (`memora-cli update`\nprints this too) and restart the server; the state database is migrated on\nstart.\n\n## Start, stop and restart\n\n`memora-cli start`, `stop` and `restart` (or `/start`, `/shutdown` and\n`/restart` in the console) work out how this install runs and do the right\nthing:\n\n| Install | What `memora-cli start / stop / restart` does | By hand |\n|---|---|---|\n| Native (systemd) | runs `systemctl start / stop / restart memora` (as root) | `sudo systemctl start memora` |\n| npm, source | runs the server in the background, with `memora.pid`, `memora.log` and `stop.token` in the state folder; `stop` asks it to end over a local, token-protected request and waits, `stop --force` kills it | run `memora` and keep it open; Ctrl+C stops it |\n| Docker | prints the host commands (a container cannot stop itself) | `docker start / stop / restart memora` |\n\nFrom the browser, the owner can shut the server down in Settings, Server, Shut\ndown: the server answers, then stops gracefully and exits with status 0, the\nsame as Ctrl+C or `systemctl stop`. A supervisor that restarts a cleanly exited\nprocess starts it again (systemd `Restart=always`, Docker\n`--restart unless-stopped`); the installer's unit uses `Restart=on-failure`, so\nit stays stopped. API keys cannot shut the server down.\n\n## Update\n\nCheck what you run first: `memora --version` and `memora-cli --version`.\n`memora-cli update` (or `/update` in the console) works out how this copy was\ninstalled and prints, or runs, the right steps. By install method:\n\n| Install | Update with | Then |\n|---|---|---|\n| npm (Windows, Linux) | `npm install -g @codrihub/memora@latest` | `memora-cli restart`, or Ctrl+C the running `memora` and start it again |\n| Docker Compose | `docker compose pull && docker compose up -d` | nothing: the container is re-created |\n| Docker run | `docker pull ghcr.io/codrihub/memora:latest`, then `docker rm -f memora` and the same `docker run` again (same volumes) | nothing |\n| Native (systemd) | `sudo memora-cli update` (runs `install.sh --upgrade`) | nothing: the service is restarted |\n| Source | `git pull && cargo build --release` | `memora-cli restart` |\n\nSettings, accounts and notes stay; the server migrates `memora.db` on start.\nTake a `memora-cli db backup` first if you are unsure.\n\n**Release zip (older Windows installs).** Windows now installs with npm. To\nswitch, stop the old server (Ctrl+C in its window), run\n`npm install -g @codrihub/memora`, and start `memora` with the same folders so\neverything carries over, for example in PowerShell:\n\n```powershell\n$env:MEMORA_STATE = 'C:\\Users\\you\\memora\\state'; $env:MEMORA_VAULT = 'C:\\Users\\you\\memora\\vault'; memora\n```\n\nThen delete the old program folder (only the `.exe` files and `assets`, not\nyour state or vault folders).\n\n## Uninstall with memora-cli\n\n```bash\nmemora-cli uninstall # or /uninstall in the console\n```\n\nIt explains what it removes for this install (the service and program\nfiles, or the npm package, or the container), then shows a checklist; press\nspace to select and Enter to continue:\n\n- **Settings and accounts** (the state folder: database, keys, sessions)\n- **Vault notes** (your vault folder)\n\nBoth are **unticked**, so by default your settings and notes are kept and a\nlater install picks them up again. Deleting the vault asks you to type its\nfolder name. Before the state folder is deleted, a final database backup is\noffered. System folders, your home folder and the program's own folder are\nnever deleted.\n\n| Install | What uninstall does |\n|---|---|\n| Native (systemd) | runs the installed `install.sh --uninstall` (adds `--purge` only when both folders are the installer's own) |\n| npm | stops the server, deletes what you ticked, then tells you to run `npm uninstall -g @codrihub/memora` |\n| Source | stops the server, deletes what you ticked; delete the program folder yourself |\n| Docker | prints `docker rm -f memora` and, for what you ticked, `docker volume rm memora-state` / `docker volume rm memora-data` |\n\nWithout a terminal it needs `--yes` and deletes only what the flags say:\n`memora-cli uninstall --yes [--delete-config] [--delete-vault]`.\n\nOn a version older than 1.3.2 there is no `uninstall` command: see\n[Uninstall by hand](#uninstall-by-hand-versions-before-132).\n\n## Uninstall by hand (versions before 1.3.2)\n\n`memora-cli uninstall` arrived in 1.3.2. On an older version it answers\n``unknown command `uninstall` ``. Either update first and then run\n`memora-cli uninstall` (npm: `npm install -g @codrihub/memora@latest`), or\nremove Memora by hand with the steps below. They only touch Memora: never use\nwildcards, and never delete a parent folder or your home folder.\n\n**1. Check the version.** `memora --version` and `memora-cli --version`.\n\n**2. Find the folders.** Memora keeps two folders:\n\n- the **state folder** (settings, accounts, keys): `MEMORA_STATE`, or by\n default `state` inside the folder where you started `memora` (for example\n `C:\\Users\\you\\state` or `~/memora/state`);\n- the **vault folder**: your notes, wherever you chose.\n\nThe server prints both when it starts:\n`Memora HTTP server starting vault=... state=...`. `memora-cli status`, run in\nthe same folder, shows the state folder too.\n\n**3. Stop Memora.** Press Ctrl+C in the window where `memora` runs (or close\nthat window). Then make sure it is gone:\n\n| Shell | Check | Stop if still running |\n|---|---|---|\n| PowerShell | `Get-Process memora -ErrorAction SilentlyContinue` | `Stop-Process -Name memora` |\n| cmd | `tasklist /FI \"IMAGENAME eq memora.exe\"` | `taskkill /IM memora.exe` |\n| Linux, macOS | `pgrep -ax memora` | `pkill -x memora` |\n\n**4. Remove the program.**\n\n| Install | Commands |\n|---|---|\n| npm (any OS) | `npm uninstall -g @codrihub/memora`, then `npm ls -g --depth=0`: if `@codrihub/memora-win32-x64` (or `-linux-x64`, `-linux-arm64`) is still listed, `npm uninstall -g` that exact name |\n| Docker run | `docker rm -f memora`, then `docker image rm ghcr.io/codrihub/memora:latest` |\n| Docker Compose | `docker compose down` in the folder of `docker-compose.yml` (no `-v`) |\n| Native (systemd) | `sudo /usr/local/share/memora/install.sh --uninstall` (keeps `/var/lib/memora`) |\n| Release zip | delete the folder that holds `memora.exe`, `memora-cli.exe` and `assets` (check its contents first, as below) |\n\n**5. Delete the state folder (optional).** Look inside first: it should hold\n`memora.db` (and maybe `memora.log`, `memora.pid`, `stop.token`, `backups`).\nThen delete that exact path:\n\n```powershell\n# Windows, PowerShell\nGet-ChildItem -LiteralPath 'C:\\Users\\you\\state'\nRemove-Item -LiteralPath 'C:\\Users\\you\\state' -Recurse -Confirm\n```\n\n```bat\n:: Windows, cmd\ndir \"C:\\Users\\you\\state\"\nrmdir /S \"C:\\Users\\you\\state\"\n```\n\n```sh\n# Linux, macOS\nls -la ~/memora/state\nrm -rI -- ~/memora/state\n```\n\nDocker: `docker volume ls`, then remove the exact names,\n`docker volume rm memora-state`. Compose: check and delete the `./state`\nfolder next to `docker-compose.yml`. Native: `/var/lib/memora/state`\n(or `install.sh --uninstall --purge`, which also deletes the notes, see below).\n\n**6. The vault folder: only if you are sure.** It holds your notes. It is\noptional to delete it; copy it somewhere safe first (it is plain Markdown).\nUse the same two steps on its exact path: look inside (`Get-ChildItem` /\n`ls`), then `Remove-Item -LiteralPath '<vault>' -Recurse -Confirm` or\n`rm -rI -- <vault>`. Docker: `docker volume rm memora-data`, or the `./data`\nfolder with Compose. Native: `sudo /usr/local/share/memora/install.sh\n--uninstall --purge` deletes `/var/lib/memora` with the notes, the account\nand the `memora` user.\n\n## Troubleshooting\n\n**``memora-cli: unknown command `uninstall` ``** (or `start`, `stop`,\n`restart`). You run a version older than 1.3.2. Update, then run the command\nagain: `npm install -g @codrihub/memora@latest`, then `memora-cli uninstall`.\nOr remove it by hand: [Uninstall by hand](#uninstall-by-hand-versions-before-132).\n\n**`/update` says \"not installed with install.sh (built from source)\" on an\nnpm install.** Older versions could miss an npm install. Update with npm,\n`npm install -g @codrihub/memora@latest`, and restart the server; newer\nversions detect npm reliably. Never run `cargo build` for an npm install.\n\n**`/restart` says \"systemctl restart\" on npm or Windows.** Same cause (older\nversion). Stop the server with Ctrl+C in its window and run `memora` again, or\nupdate and use `memora-cli restart`.\n\n**Which version do I have?** `memora --version` and `memora-cli --version`.\nThe latest release is on\n[GitHub Releases](https://github.com/Codrihub/memora/releases).\n\n## Reverse proxy\n\nRun Memora on loopback (`--behind-proxy` natively; in Docker set\n`MEMORA_HTTP_PORT=127.0.0.1:8400` in `.env`) and let the proxy terminate TLS.\nThen set, with `/config` or in `.env`:\n\n| Variable | Why |\n|---|---|\n| `MEMORA_BASE_URL=https://memory.example.com` | Public URL; links and MCP snippets use it, and its host becomes an allowed domain |\n| `MEMORA_DOMAIN=memory.example.com` | Only these hostnames are served; requests for the bare IP or other names get 404 |\n| `MEMORA_TRUSTED_PROXIES=203.0.113.10` | Proxies whose forwarding headers are believed. Loopback (same-host nginx, cloudflared) is always trusted; only list remote proxies |\n\nIn Docker, a proxy on the host reaches the container through the Docker\nnetwork, so the container sees the network's gateway address (for example\n`172.18.0.1`) instead of loopback. Add that address to\n`MEMORA_TRUSTED_PROXIES`, otherwise every request appears to come from it.\n\nThe proxy must forward `Host`, `X-Forwarded-For`, and `X-Forwarded-Proto`, and\nupgrade WebSockets on `/ws`. nginx and Caddy examples are in\n[DEPLOYMENT.md](DEPLOYMENT.md).\n\n## Backups\n\nBack up **both** the state database and the vault. The database is small but\ncritical.\n\nState, online (the server keeps running):\n\n```sh\nsudo memora-cli db backup # state/backups/memora-<UTC time>.db, keeps the newest 10\nsudo memora-cli db backup --to /var/backups/memora.db\nsudo memora-cli db check # integrity, permissions, sizes, last backup age\ndocker compose exec gateway memora-cli db backup # Docker: lands in ./state/backups/\n```\n\nThe copy is a consistent snapshot (`VACUUM INTO`), checked with\n`integrity_check`, mode 0600. Never `cp` a live `memora.db`: recent commits sit\nin `memora.db-wal`. Restore with the server stopped:\n\n```sh\nsudo systemctl stop memora\nsudo memora-cli db restore /var/backups/memora.db # verifies it; keeps the replaced DB in state/backups/\nsudo systemctl start memora\n```\n\nAlso keep a copy of `state/key-seal.bin`, which encrypts the sealed API key\ncopies. Vault and state together: archive both with the server stopped:\n\n```sh\nsudo systemctl stop memora\nsudo tar -C /var/lib/memora -czf memora-backup-$(date +%F).tar.gz state vault\nsudo systemctl start memora\n```\n\nKeep backups private: the database holds password and key hashes (never\nplaintext secrets).\n\n## Automation: `--check` and `--upgrade`\n\nThese are the contract for scripts and automation.\n\n```sh\n$ /usr/local/share/memora/install.sh --check\nMEMORA_LATEST=1.0.1\nMEMORA_INSTALLED=1.0.0\n```\n\n`MEMORA_INSTALLED` comes from `/usr/local/share/memora/VERSION` (written by\nthe installer), else from `memora --version`, else `unknown` (or `none` when\nnothing is installed). `MEMORA_LATEST` is `unknown` and the exit code `4` when\nGitHub cannot be reached. `--check` needs no root.\n\n```sh\n$ sudo /usr/local/share/memora/install.sh --upgrade --yes [--version X.Y.Z]\n...\nMEMORA_UPGRADE_RESULT=ok FROM=1.0.0 TO=1.0.1\n```\n\n`--upgrade --yes` never prompts. The last line of output is always\n`MEMORA_UPGRADE_RESULT=<ok|uptodate|error> FROM=<old> TO=<new>`, and the exit\ncode is `0` (ok), `3` (already up to date), `4` (network), `5` (checksum),\n`6` (not root), or `1`/`2` for other errors.\n",yY="# Configuration\n\nAll server state, settings included, lives in one SQLite database,\n`<MEMORA_STATE>/memora.db` (see [DATABASE.md](DATABASE.md)). Server settings are\nrows in the `server_config` table, edited with `memora-cli` (`/config` in the\nconsole). The process environment (systemd `Environment=`, Docker\n`environment:`) applies to every key that has no row.\n\n## Precedence\n\nFor each server setting:\n\n1. a row in `server_config` (set with `/config`), else\n2. the process environment (non-empty value), else\n3. the built-in default.\n\nThe server reads `server_config` once at startup, before anything else, so a\nchange made with `/config` applies after a restart (`/restart` for a native\ninstall, `docker compose restart gateway` in Docker). Clearing a value in\n`/config` deletes the row, and the environment or default applies again.\n\nA row wins over the environment. If you set `MEMORA_PORT` with `/config` and\nlater change the port in the systemd unit or `.env`, the row still applies\nuntil you clear it.\n\n## Server settings\n\n| Name | Default | Where it can live | What it does |\n|---|---|---|---|\n| `MEMORA_PORT` | `8400` | `server_config` or env | HTTP port (API, MCP, web UI, WebSocket). 1-65535. |\n| `MEMORA_BIND` | `127.0.0.1` | `server_config` or env | Bind address. `0.0.0.0` for every interface (the container image and the installer set it). |\n| `MEMORA_BASE_URL` | empty | `server_config` or env | Public URL, for example `https://memory.example.com`. Used for OAuth metadata and connection snippets; its host is also an allowed domain. |\n| `MEMORA_DOMAIN` | empty (any host) | `server_config` or env | Allowed hostnames, comma separated (`*.example.com` works). Requests for other hosts get 404. Loopback names are always allowed. |\n| `MEMORA_TRUSTED_PROXIES` | empty | `server_config` or env | IPs of remote reverse proxies whose forwarding headers are trusted. Loopback is always trusted. |\n| `MEMORA_ARM_TTL` | `300` | `server_config` or env | Accepted and validated (30-86400 seconds), but the server and `memora-cli` do not read it: the setup / reset window length comes from `memora-cli --minutes` (default 5 minutes). |\n| `MEMORA_VAULT` | empty (`data` as last resort) | `server_config` or env | Suggested vault folder. The vault in use is chosen in the browser (or with `memora-cli vault`) and stored in the `settings` table. |\n| `MEMORA_VAULT_AUTO` | `false` | `server_config` or env | `true` (also `1`, `yes`, `on`): use `MEMORA_VAULT` at startup instead of asking in the browser, only while no vault is configured and if the folder is writable. |\n| `MEMORA_ADMIN_USER` | `admin` | `server_config` or env | Name of the owner created at startup when no owner exists (needs `MEMORA_ADMIN_PASSWORD`). |\n| `RUST_LOG` | `info` | `server_config` or env | Log filter, for example `info` or `memora=debug`. |\n\n`server_config` accepts only these ten keys. Values are trimmed and validated\n(numbers in range, `true`/`false`, a valid user name, no control characters, at\nmost 2048 bytes).\n\n## Environment only\n\n| Name | Default | What it does |\n|---|---|---|\n| `MEMORA_ADMIN_PASSWORD`, `MEMORA_ADMIN_PASSWORD_FILE` | unset | Creates the owner at startup when none exists (at least 10 characters). Only the argon2id hash is stored; an existing owner is never replaced. |\n| `MEMORA_API_KEY`, `MEMORA_API_KEY_FILE` | unset | Installs an agent API key with id `k_env` and scopes `mcp`, `read`, `write` (at least 24 characters). Only its SHA-256 is stored; the key is replaced when the value changes. |\n| `MEMORA_STATE` | `state` (relative to the working directory) | State directory holding `memora.db`. Created with mode 0700 if missing. |\n| `MEMORA_ASSETS` | the `crates/http/assets` folder of the build tree | Directory of the web UI assets. |\n| `MEMORA_INSTALL` | set by the npm launcher (`npm`) and the Docker image (`docker`) | How this copy was installed: `npm`, `docker`, `native`, `zip` or `source`. `memora-cli update`, `start`, `stop`, `restart` and `uninstall` use it to pick the right steps; when unset they work it out from the program's path. |\n| `MEMORA_SETUP_HINT` | `memora-cli setup (run on the server)` | Hint returned by `GET /api/auth/state` and shown on the login screen. |\n| `MEMORA_UPDATE_CHECK` | `true` | Release check: shortly after start and then every 6 hours the server asks GitHub (`api.github.com/repos/Codrihub/memora/releases/latest`) for the newest release and the web UI shows when an update is available. The same check reads the repository's star count (`api.github.com/repos/Codrihub/memora`), shown in What's new. `false` (also `0`, `no`, `off`) turns both off; no network call is made. |\n\nThe two secrets can never be stored in `server_config` (the schema rejects\nthem). The `_FILE` variants read the value from a file, for example a Docker\nsecret; a non-empty file wins over the plain variable.\n\nIn `/config`, `MEMORA_API_KEY` offers to create an API key directly, and\n`MEMORA_ADMIN_PASSWORD` points to `/setup` or `/reset`.\n\n## Instance settings (web UI)\n\nThe `settings` table holds one row, edited from the Settings page of the web UI:\n\n| Key | Default | Range | What it does |\n|---|---|---|---|\n| `realm` | `Memora` | 1-64 characters | Instance name shown in the UI and reported by `/api/config` and `/api/auth/state`. |\n| `session_ttl` | `10800` (3 hours) | 300-2592000 seconds | Idle timeout of a browser session: any use renews it (requests, and an open tab in use). |\n| `session_max_age` | `0` | `0` or at least `session_ttl` | Absolute session lifetime in seconds. `0` means no cap. |\n| `min_password_len` | `10` | 10-256 | Minimum owner password length. |\n| `log_max_mb` | `8` | 1-512 | Size limit in MB of the vault event log (`.events.jsonl`). |\n| `log_max_days` | `0` | 0-3650 | Age limit in days of the vault event log. `0` means no age limit. |\n| `vault_path` | unset | absolute path | The vault folder. Set in the browser after the first sign-in, or with `memora-cli vault PATH`. |\n\nTwo more settings live in the `ui_layout` table and in a file beside the database:\n\n| Setting | Default | Where | What it does |\n|---|---|---|---|\n| Largest image | 5 MB | Settings, Images (`POST /api/settings/media`, admin); stored as the `srv-media` document | Uploads above this size are refused, from the app, the HTTP API and MCP `upload_image` alike. 0.1 to 50 MB. |\n| Mnemo | not set up | Settings, Mnemo, or `/mnemo setup` in the console; stored in `assistant.sqlite3` | Providers (OpenAI, Anthropic, one OpenAI-compatible server) with sealed API keys, models (pinned, hidden, default, context window and reply limit), temperature, reply and context limits, tool steps per reply, your instructions, and the floating button. |\n\n## memora-cli options\n\n| Option | Default | What it does |\n|---|---|---|\n| `--state <DIR>` | `$MEMORA_STATE`, else the state directory of the running `memora` server, else `./state` | State directory to work on. |\n| `--minutes <N>` | `5` | Window length for `setup` and `reset-password`, 1-60. |\n| `--ttl <SECONDS>` | | Window length in seconds (at most 3600). `--minutes` wins when both are given. |\n| `--create` | | With `vault PATH`: create the folder if it does not exist. |\n\nRun as root, `memora-cli` does all database work as the owner of the state\ndirectory, so no root-owned `memora.db*` files appear. See\n[INSTALL.md](INSTALL.md) and [DEPLOYMENT.md](DEPLOYMENT.md) for the commands.\n\n## Docker Compose (`.env`)\n\nThese variables are read by `docker-compose.yml`, not by Memora itself:\n\n| Name | Default | What it does |\n|---|---|---|\n| `COMPOSE_PROJECT_NAME` | `memora` | Compose project name, also the container name prefix. |\n| `IMAGE` | `ghcr.io/codrihub/memora:<version>` | Image to run or build. The compose file pins the release it ships with. |\n| `MEMORA_HTTP_PORT` | `8400` | Host port mapped to the container's port 8400. Use `127.0.0.1:8400` to publish on loopback only. |\n| `MEMORA_DATA_DIR` | `./data` | Host path mounted at `/data` (the vault). |\n| `MEMORA_STATE_DIR` | `./state` | Host path mounted at `/state` (the state directory). |\n| `MEMORA_UID`, `MEMORA_GID` | `1000` | uid:gid the container runs as. Must own both host directories. |\n| `MEMORA_ARM_TTL` | `300` | Passed to the container unchanged. |\n\nCompose also passes these through from `.env` to the container:\n`MEMORA_BASE_URL`, `MEMORA_DOMAIN`, `MEMORA_TRUSTED_PROXIES`,\n`MEMORA_VAULT_AUTO`, `MEMORA_ADMIN_USER`, `MEMORA_ADMIN_PASSWORD`,\n`MEMORA_ADMIN_PASSWORD_FILE`, `MEMORA_API_KEY`, `MEMORA_API_KEY_FILE`,\n`MEMORA_SETUP_HINT`, `MEMORA_UPDATE_CHECK`, and `RUST_LOG`.\n\nInside the container the image sets `MEMORA_VAULT=/data`,\n`MEMORA_STATE=/state`, `MEMORA_PORT=8400`, `MEMORA_BIND=0.0.0.0`,\n`MEMORA_ARM_TTL=300`, `MEMORA_ASSETS=/app/assets`, `MEMORA_INSTALL=docker`,\nand `RUST_LOG=info`.\n\n## State directory\n\n| Path | Content |\n|---|---|\n| `memora.db` (+ `-wal`, `-shm`) | The state database: owner, API keys (hashes), tool switches and per-key permissions, OAuth clients and grants, privacy rules, sessions (hashed ids), setup window and lock state, access rules, settings, `server_config`, activity log. Mode 0600, WAL mode, must be on a local filesystem. See [DATABASE.md](DATABASE.md). |\n| `key-seal.bin` | 32-byte master key (mode 0600) that encrypts the copies of dashboard-created API keys, so the owner can show a key again. Created on first use. Back it up together with `memora.db`. |\n| `assistant.sqlite3` (+ `-wal`, `-shm`) | Mnemo, the built-in agent: providers (API keys sealed with `key-seal.bin`), models, preferences, chats and messages. Mode 0600. Separate from `memora.db`, so the main schema is unchanged; delete it to forget every Mnemo chat and key. Back it up with `memora.db` if you want to keep chats. |\n| `backups/` | `memora-cli db backup` output (newest 10 kept by default). |\n| `exchange/` | Zips written by the `export_memory` MCP tool and read by `import_memory` (mode 0700, created on first use). Private to this instance; delete old zips when no longer needed. |\n| `legacy-json-<unix time>/` | JSON state files found at startup, moved here after their one-time import into `memora.db`. |\n| `internal.token` | Created by the Docker entrypoint. Not used by Memora. |\n\n## Vault files\n\nThe vault holds the markdown notes plus derived and metadata files. See\n[ARCHITECTURE.md](ARCHITECTURE.md#vault-markdown-portable) for the full list.\nThe important ones for operations are `.git/` (history), `.events.jsonl`\n(event log), and `.Trash/`\n(soft-deleted notes; `.Trash/.index.json` remembers where each one came from,\nso `restore_trash` puts it back there; `.Trash/.assets/<entry>/` keeps the images\nof a trashed note until it is restored or deleted for good). Images uploaded to a\nnote are ordinary files in the note's folder.\n\n## Version history\n\nVersion history (`get_history`, `get_note_at`, `diff`, `restore_memory`,\n`snapshot`) is on when the vault folder is a git repository of its own, that is\nwhen it has a `.git/` directory. Memora does not create one, so a new vault has\nno history and these tools answer \"version history is off\". To turn it on,\ninstall `git` and run, once:\n\n```sh\ngit -C /path/to/vault init\ngit -C /path/to/vault add -A\ngit -C /path/to/vault commit -m \"start history\"\n```\n\n(In Docker, the vault is the host directory mounted at `/data`.) From then on\nevery change made through Memora is committed automatically. Each commit's\nauthor is the agent or user whose call made the change; the committer is the\nvault's git identity (`git config user.name` / `user.email`), or `Memora\n<memora@localhost>` when none is set. Git never searches above the vault, so a\nvault inside another repository still needs its own `git init`.\n\nA snapshot (`snapshot` tool) commits pending changes and tags the last commit\nas `snap-<label>`; pass that tag as `rev` to `get_note_at`, `diff` or\n`restore_memory`.\n\nDeleting a note for good (Delete forever or Empty trash in the app,\n`/api/trash/delete`, `/api/trash/empty`, `delete_memory` with `permanent`)\nalso erases it from the history: Memora rewrites the vault's git history so\nno commit, snapshot tag or object keeps its text, any name it had, its trash\nrecord or its path in a commit message, then expires the reflog and runs\n`git gc --prune=now`. Other notes keep all their versions, but their revision\nids change, so old revision ids (and clones or pushes of the vault made\nbefore) no longer match. Moving a note to the Trash keeps its history.\n",wY='# MCP\n\nMemora exposes the vault to agents through the Model Context Protocol. The\nserver speaks JSON-RPC 2.0 over the Streamable HTTP transport at `/mcp`, on the\nsame port as the HTTP API and the web UI. There is one MCP endpoint and one tool\ncatalog.\n\n| | |\n|---|---|\n| Endpoint | `POST /mcp` |\n| Protocol versions | `2025-06-18` (preferred), `2025-03-26`, `2024-11-05` |\n| Auth | API key in `Authorization: Bearer <key>` or `X-API-Key: <key>`, or an OAuth 2.1 access token |\n| Discovery card | `GET /.well-known/mcp.json` (public) |\n| Readable catalog | `GET /tools` (HTML page, public) |\n| Catalog size | 77 tools, plus 5 admin tools for keys with the `admin` scope |\n\n`initialize` answers with the protocol version the client asks for when it is\none of the three above, and with `2025-06-18` otherwise.\n\n## Transport\n\n- Requests are JSON-RPC 2.0 objects sent with `POST /mcp`. Batches (JSON\n arrays) are not supported.\n- Responses are plain JSON (`application/json`), with one exception below.\n- `initialize` returns an `Mcp-Session-Id` header (`<catalog epoch>.<random>`).\n The epoch is a hash of the server version and the tools the caller may use, so\n it changes when the server is upgraded, a tool is switched on or off, or the\n key\'s scopes or tool grant change. No session id is ever refused: unknown or\n old ids work, and malformed ones count as no session.\n- When a request carries a session id whose catalog has changed since that\n session last heard, and its `Accept` header allows `text/event-stream`, the\n answer is an SSE stream with two events: the notification\n `notifications/tools/list_changed`, then the normal response. Each change is\n sent once per session (remembered in memory; a restart forgets, and the\n epoch in the id takes over). JSON-only clients always get plain JSON.\n- `GET /mcp` returns `405 Method Not Allowed` (there is no standalone server\n stream). `DELETE /mcp` with a session id returns `204 No Content`; without\n one it returns `405`.\n- A notification (a `notifications/*` method without an `id`) gets\n `202 Accepted` and no body.\n- `/mcp` needs a configured vault. Until one is chosen it returns\n `409 {"error":"vault not configured","needs_vault":true}`.\n- A browser session (cookie) may also call `/mcp`. It then needs a same-origin\n request, like the rest of the JSON API.\n\nThe server speaks Streamable HTTP only. A client that can only launch local stdio\nservers can use a bridge such as `mcp-remote` (see below).\n\n## Connecting an agent\n\n### With an API key\n\nCreate a key in the web UI (Keys page), with `memora-cli` (`/keys`), or with\n`POST /api/keys`. The raw key (`memora_live_...`) is shown once. By default a key gets\nthe scopes `mcp`, `read` and `write` and may call every tool. See\n[Tool switches and per-key permissions](contracts/tools-permissions.md) to\nnarrow it.\n\nUse `http://localhost:8400/mcp` for a local install, or your public URL such as\n`https://memory.example.com/mcp` behind a reverse proxy. When the server sets\n`MEMORA_DOMAIN` or `MEMORA_BASE_URL`, requests for any other host get `404`, so\nuse that domain.\n\nClaude Code:\n\n```bash\nclaude mcp add --transport http memora https://memory.example.com/mcp \\\n --header "Authorization: Bearer memora_live_REPLACE_WITH_YOUR_KEY"\n```\n\nCursor, Windsurf and other clients with an `mcpServers` JSON config (VS Code\nuses the key `servers` in `.vscode/mcp.json`):\n\n```json\n{\n "mcpServers": {\n "memora": {\n "type": "http",\n "url": "http://localhost:8400/mcp",\n "headers": {\n "Authorization": "Bearer memora_live_REPLACE_WITH_YOUR_KEY"\n }\n }\n }\n}\n```\n\nCodex (`~/.codex/config.toml`), with the key in the `MEMORA_API_KEY`\nenvironment variable:\n\n```toml\n[mcp_servers.memora]\nurl = "https://memory.example.com/mcp"\nbearer_token_env_var = "MEMORA_API_KEY"\n```\n\nClients that only run local stdio servers, such as the Claude Desktop config\nfile, can bridge with `mcp-remote` (needs Node.js):\n\n```json\n{\n "mcpServers": {\n "memora": {\n "command": "npx",\n "args": [\n "-y", "mcp-remote", "https://memory.example.com/mcp",\n "--header", "Authorization: Bearer memora_live_REPLACE_WITH_YOUR_KEY"\n ]\n }\n }\n}\n```\n\nSome clients send the key as `X-API-Key: <key>` instead. Both headers are\naccepted.\n\n### With OAuth\n\nClients that support MCP authorization (for example Claude and ChatGPT custom\nconnectors, or Claude Code without a `--header`) can connect with only the URL:\n\n```bash\nclaude mcp add --transport http memora https://memory.example.com/mcp\n```\n\nThe flow:\n\n1. The client calls `/mcp` without credentials and gets `401` with\n `WWW-Authenticate: Bearer resource_metadata="https://memory.example.com/.well-known/oauth-protected-resource"`.\n2. It reads the protected resource metadata (RFC 9728) and the authorization\n server metadata at `/.well-known/oauth-authorization-server` (RFC 8414; also\n served at `/.well-known/openid-configuration` and under a `/mcp` suffix).\n3. It registers itself with dynamic client registration at\n `POST /oauth/register` (RFC 7591), or uses an HTTPS client metadata document\n URL as its `client_id`. The owner can also register clients in the web UI.\n Redirect URIs must be HTTPS, or plain HTTP on `localhost`, `127.0.0.1` or\n `[::1]`.\n4. It opens `/oauth/authorize` (authorization code with PKCE `S256` only). The\n browser lands on the Memora sign-in page, and the signed-in owner approves or\n denies the connection on a consent card. Codes are valid for 10 minutes.\n5. It exchanges the code at `POST /oauth/token` and receives an access token and\n a refresh token. The only OAuth scope is `mcp`.\n\nThe access token is a regular Memora API key named after the client. It starts\nwith the default scopes (`mcp`, `read`, `write`) and every tool, and it shows up\non the Keys page like any other key, so you can restrict, disable or delete it\nthere. The access token has no expiry. A `refresh_token` grant replaces it with\na fresh one (the old token stops working at once) and rotates the refresh token.\nDisabling or deleting the key ends the connection.\n\nSet `MEMORA_BASE_URL` (for example `https://memory.example.com`) when the server\nruns behind a proxy, so the issuer and endpoint URLs in the metadata are the\npublic ones. Without it the server derives them from the request headers.\n\n### Test from a shell\n\n```bash\ncurl -s -X POST http://localhost:8400/mcp \\\n -H "Authorization: Bearer memora_live_REPLACE_WITH_YOUR_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{"jsonrpc":"2.0","id":1,"method":"tools/list"}\'\n```\n\n## Discovery card\n\n`GET /.well-known/mcp.json` needs no auth and returns:\n\n| Field | Value |\n|---|---|\n| `name` | `memora` |\n| `version` | The server version |\n| `description` | One-line description of the server |\n| `mcp` | `{endpoint: "/mcp", transports: ["streamable-http"], protocolVersion: "2025-06-18"}` |\n| `auth` | `{type: "api-key", headers: ["Authorization: Bearer <key>", "X-API-Key: <key>"], oauth: "/.well-known/oauth-authorization-server"}` |\n| `capabilities` | `{tools: true, resources: true, prompts: false}` |\n| `tools` | Every catalog tool as `{name, category, description, enabled}`. `enabled` is `false` for tools switched off on this server. Admin tools are not listed. |\n| `resources` | `[{uri, name}]` for the three resources below |\n\nThe card is the same for every caller. To see what a given key may call, use\n`tools/list` with that key.\n\n## Methods\n\n| Method | Purpose |\n|---|---|\n| `initialize` | Handshake. Returns `protocolVersion`, `serverInfo` (`{name, version}`) and `capabilities` (`tools` with `listChanged: true`, `resources` with `listChanged: false`). |\n| `notifications/initialized` | Client notification. Without an `id` it gets `202 Accepted`. |\n| `tools/list` | The tools the caller may use, each with `name`, `description` (what it does and when to use it), `inputSchema`, and `_meta.category`. |\n| `tools/call` | Runs one tool. Params are `{name, arguments}`. |\n| `resources/list` | Lists the three resources below. |\n| `resources/read` | Reads one resource. Params are `{uri}`. |\n\nThere are no prompts and no pagination cursors. The only notification the server\nsends is `notifications/tools/list_changed` (see Transport).\n\n### Resources\n\n| URI | Content |\n|---|---|\n| `memory://catalog` | Every catalog tool with `name`, `category`, `description`, `when`, and `inputSchema` (JSON) |\n| `memory://schema` | Data shapes for a note, a folder, the graph, and activity (JSON) |\n| `memory://guide` | A short guide for agents using the vault (Markdown) |\n\n`resources/read` returns `{contents: [{uri, mimeType, text}]}`.\n\n## Results and errors\n\nA successful tool call returns the tool\'s JSON result as text:\n\n```json\n{\n "jsonrpc": "2.0",\n "id": 2,\n "result": {\n "content": [{ "type": "text", "text": "{...}" }],\n "isError": false\n }\n}\n```\n\nA tool that fails (bad arguments, note not found, unknown tool name) returns the\nsame envelope with `isError: true` and the error message as the text. The HTTP\nstatus stays `200`.\n\nJSON-RPC errors:\n\n| Code | When |\n|---|---|\n| `-32700` | The body is not valid JSON (HTTP `400`). |\n| `-32600` | The body is not a JSON-RPC request object (HTTP `400`). |\n| `-32601` | Unknown method: `unsupported method: <method>`. |\n| `-32602` | `resources/read` with an unknown URI: `unknown resource: <uri>`. |\n| `-32003` | The tool exists but the caller may not use it. Messages: `tool not allowed for this API key: <name>`, `tool disabled on this server: <name>`, `API key lacks the \'write\' scope for tool: <name>`. |\n\nHTTP errors before JSON-RPC runs:\n\n| Status | When |\n|---|---|\n| `401` | No key, or a key that is unknown, disabled, deleted or replaced by a roll (`invalid API key`). Carries a `WWW-Authenticate` header that points OAuth clients at the protected resource metadata. |\n| `403` | The key lacks the `mcp` scope (`{"error":"API key lacks the \'mcp\' scope","required_scope":"mcp"}`), or a browser request failed the same-origin check. |\n| `405` | Any method other than `POST`. |\n| `409` | No vault is configured yet. |\n| `429` | Rate limit or cooldown after failed attempts. |\n\n## What each key sees\n\n`tools/list` is filtered per caller:\n\n- A tool switched off on the server is hidden for everyone.\n- A key whose tool list is not `"*"` only sees the tools in its list.\n- A key without the `write` scope only sees read-only tools.\n- Admin tools are added for keys with the `admin` scope (and for browser\n sessions).\n\n`tools/call` on a tool that `tools/list` would hide returns `-32003`. Details\nare in [Tool switches and per-key permissions](contracts/tools-permissions.md).\n\n### Privacy rules\n\nThe owner can hide notes and folders from specific agents (web UI,\n`/api/privacy`, or the `privacy_*` admin tools). For an API key covered by a\nrule, every tool works as if the hidden paths did not exist: they are left out\nof listings, search, the graph, tags, events, logs, locks and folder metadata; a\nhidden path named in an argument is answered as not found, for reads and writes\nalike; and folder operations that would carry hidden items along are refused.\nIf the rules cannot be read, the key sees nothing (fail closed). Browser\nsessions are never filtered.\n\n## Tools\n\nR = read-only (needs only the `mcp` scope). W = changes the vault or server\nstate (also needs the `write` scope). Unless marked required, arguments are\noptional. Paths are vault-relative, for example `Projects/Plan.md`. A path\ncopied in the web app (Copy path in a note or folder menu) works as is as the\n`path` argument of `read_memory` and the other tools.\n\n### Notes (`note`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `list_memory` | R | none | Every note grouped by its folder, the full parent path (`Projects/Atlas`; `Root` for the top level): `{folder: [{path, name, folder, mtime}]}`. |\n| `read_memory` | R | `path` (string, required) | Markdown body, frontmatter, tags and backlinks of one note. A `\\` in a path is read as `/`; replies echo the normalized path. |\n| `create_memory` | W | `title` (string, required), `folder` (string relative to the vault, default `Memory` when omitted or empty; `Root` for the top level), `content` (string; default is a stub with `created` frontmatter and a heading) | Creates `<folder>/<title>.md` and returns `{ok, path}`. A trailing `.md` in the title is dropped; `/` and `\\` in a title, an absolute folder and a folder that is a note are refused. Spaces are kept; `: * ? " < > | # ^ [ ]` and a leading dot are removed and names are cut at 80 characters; the reply then adds `renamed_from` and a `note`. A note whose name differs only in case from an existing one is refused. |\n| `save_memory` | W | `path` (string, required), `content` (string, required) | Replaces the whole note. |\n| `patch_memory` | W | `path` (string, required), `ops` (array, required) | Partial edits. Each op is an object: `{op:"append", text}`, `{op:"prepend", text}`, `{op:"replace", find, with}`, `{op:"set_field", field, value}`, `{op:"add_tag", tag}`, `{op:"remove_tag", tag}`. |\n| `delete_memory` | W | `path` (string, required), `permanent` (boolean, default false) | Moves a note to the Trash (`.Trash`), remembering where it came from and who deleted it: `{ok, path, trashed, to}`. `list_trash` shows it and `restore_trash` brings it back. `permanent: true` deletes it for good instead (`{ok, path, permanent}`) and is refused for keys without the `admin` scope. With version history on, every earlier version is erased from the history as well (every name the note had, its trash record and the commit messages naming it; other notes keep their versions but their revision ids change), so no one, agents included, can read it again. |\n| `move_memory` | W | `path` (string, required), `folder` (string, required; relative to the vault, `Root` for the top level) | Moves a note into another folder. Wikilinks resolve by note name, so they keep working. |\n| `rename_memory` | W | `path` (string, required), `new_name` (string, required) | Renames a note in its folder. |\n| `upload_image` | W | `path` (string, required: the note the image belongs to), `name` (string, required, e.g. `diagram.png`), `data` (string, required: base64 or a `data:image/...;base64,` URL), `alt` (string), `append` (boolean, default false) | Stores a PNG, JPEG, WebP or GIF in the note\'s own folder (checked by content; the upload limit in Settings, Images applies, 5 MB by default). Identical bytes reuse the existing file; a taken name gets `-1`, `-2` ...: `{ok, path, name, bytes, url, markdown}`. Show it in the note with the returned `markdown` line, ``; `append: true` adds that line to the end of the note. The image then moves, goes to the Trash, is restored and is deleted with its note. |\n| `list_images` | R | `folder` (string; `Root` or empty for the top level) or `path` (a note) | The images of one folder (not its sub folders), each with `used_in` (the notes and sections that show it); with `path`, the images that note shows and every image of its folder. |\n\n### Search (`search`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_stats` | R | none | Counts of notes, links and folders. |\n| `search_memory` | R | `q` (string, required; `query` is accepted as an alias), `limit` (integer, default 12) | Search titles and bodies. Supports `tag:x` and `#x`. |\n\n### Query (`query`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `query_memory` | R | `folder`, `tags`, `author`, `type`, `status` (strings), `limit` (integer, default 50) | Filter notes by frontmatter. |\n| `find_similar` | R | `path` (string, required), `limit` (integer, default 8) | Notes most similar to one note (shared tags and words). |\n| `suggest_links` | R | `path` (string, required), `limit` (integer, default 8) | Similar notes not yet linked from this one. |\n| `list_tags` | R | none | Every tag with its usage count. |\n| `rename_tag` | W | `old` (string, required), `new` (string, required) | Renames a tag across the vault. |\n| `merge_tag` | W | `a` (string, required), `b` (string, required) | Merges tag `a` into tag `b` across every note. |\n\n### Tags (`tag`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_tags` | R | `path` (string; not in the advertised schema) | Every tag with its count, or the tags of one note when `path` is given. |\n| `search_by_tag` | R | `tag` (string, required), `limit` (integer, default 50; not in the advertised schema) | Every note carrying a tag. |\n| `add_tags` | W | `path` (string, required), `tags` (string, required, comma-separated) | Adds tags to a note. A leading `#` is stripped. |\n| `remove_tags` | W | `path` (string, required), `tags` (string, required, comma-separated) | Removes tags from a note. |\n| `set_tags` | W | `path` (string, required), `tags` (string, required, comma-separated) | Replaces a note\'s tag list. |\n\n### Folders (`folder`, `ops`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `list_folders` | R | none | `{count, folders: [{name, count, color}]}`. |\n| `create_folder` | W | `name` (string, required) | Creates a folder. |\n| `rename_folder` | W | `folder` (string, required), `name` (string, required, one segment) | Renames a folder in place. Notes, sub folders, color and icon move along. |\n| `move_folder` | W | `folder` (string, required), `into` (string; empty or `Root` = top level) | Moves a folder with everything in it. |\n| `move_folder_contents` | W | `folder` (string, required), `into` (string; empty = top level) | Moves everything inside a folder into another folder, then removes the empty folder. Name clashes get a `-N` suffix. |\n| `delete_folder` | W | `folder` (string, required), `into` (string), `mode` (`move` or `trash`) | Deletes a folder. By default its notes (at any depth) move to the folder\'s parent (Root for a top-level folder), keeping the sub folder structure below it; wikilinks to them are rewritten. `into` sends them to another existing folder instead (`Root` = top level). `mode: "trash"` moves every note to `.Trash` instead (`list_trash` / `restore_trash` bring them back) and cannot be combined with `into`. Other files in the folder are deleted. |\n| `folder_stats` | R | `folder` (string, required) | Note count and metadata for one folder. |\n| `get_folder_meta` | R | `folder` (string) | Color, icon and description of one folder, or of every folder. |\n| `set_folder_meta` | W | `folder` (string, required), `color`, `icon`, `desc` (strings) | Sets folder display metadata. A field sent as an empty string is cleared. |\n\n### Graph (`graph`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_graph` | R | none | Whole graph: `{nodes: [{id, path, folder, color, degree, tags, mtime}], links: [{source, target}]}`. |\n| `get_neighbors` | R | `path` (string, required), `depth` (integer, default 1) | Notes within N hops. |\n| `get_subgraph` | R | `path` (string, required), `depth` (integer, default 1), `max_nodes` (integer, default 60) | Subgraph around one note. |\n| `find_path` | R | `source` (string, required), `target` (string, required) | Shortest wikilink path between two notes. |\n| `get_hubs` | R | `limit` (integer, default 10) | Most connected notes. |\n| `get_isolated` | R | none | Notes with no links in or out. |\n| `link_stats` | R | `path` (string, required) | Outgoing, incoming and unresolved links of one note. |\n| `broken_links` | R | none | Wikilinks pointing at notes that do not exist. |\n\n### Versioning (`version`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_history` | R | `path` (string, required), `limit` (integer, default 20, at least 1) | Git history of a note, newest first, always an array of `{rev, date, author, message, version, total}` (plus `path` for commits under an earlier name: the history follows renames). `author` is the agent or user whose call made the change. `version` numbers the revisions from 1 (the oldest) to `total` (the current one), whatever `limit` is. |\n| `get_note_at` | R | `path` (string, required), `rev` (string, required) | `{ok, path, rev, content}` at a revision. `rev` is one revision: a `rev` from `get_history`, `snap-<label>`, `HEAD~1` or `HEAD@{<date>}`. Unknown revisions, dates before the history and empty `rev` are errors. |\n| `diff` | R | `path` (string, required), `rev_a` (string, required), `rev_b` (string) | `{path, from, to, changed, diff}` between two revisions, or `rev_a` against the current note. Ranges (`a..b`) and unknown revisions are errors. |\n| `restore_memory` | W | `path` (string, required), `rev` (string, required) | Restores a note to a revision (a new commit). Give the current path; content under an earlier name is found. Restoring the old path of a renamed note is refused and names the current one. |\n| `snapshot` | W | `label` (string, required) | Commits pending changes and tags the last commit `snap-<label>` (letters, digits, `.`, `_`, `-`; spaces become `-`; at most 40 characters; must be new). Use the tag as `rev`. |\n| `soft_delete` | W | `path` (string, required) | Moves a note to `.Trash` and remembers where it came from. |\n| `list_trash` | R | none | Notes in `.Trash`, newest first: `{name, path, original, deleted, by, title}` (`by` = `{id, name, kind}` of who deleted it, null when unknown). |\n| `restore_trash` | W | `name` (string, required; `.md` optional), `into` (string) | Restores a note from `.Trash` to the path it was deleted from, or into the folder `into` (`Root` = top level). |\n\nAll versioning tools except `soft_delete`, `list_trash` and `restore_trash`\nneed version history on (see [CONFIGURATION.md](CONFIGURATION.md#version-history));\notherwise they answer "version history is off".\n\n### Bulk writes (`write`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `batch_create` | W | `notes` (array, required) of `{title (required), folder (default `Memory`), content}` | Creates many notes in one call; titles and folders follow `create_memory`. Every item is checked first and nothing is created when one is malformed (missing title, wrong type, unknown key). The reply has one result per item: `{ok, path}` or `{ok: false, item, title, error}`. |\n| `duplicate_memory` | W | `path` (string, required) | Copies a note as `<name>-copy` in the same folder (a long name is shortened so the suffix fits in 80 characters). |\n| `merge_memory` | W | `paths` (array of strings, required: existing notes, each once, not `into`), `into` (string, required; `.md` optional) | Appends the body of each source, without its frontmatter, to `into` under `## from <name>`, and adds the sources\' tags to the target\'s tags. `into` is created when missing. The sources are kept. Returns `{ok, into, created, merged, sources, tags_added}`. |\n| `template_create` | W | `template` (string, required; a note in `Templates/`, as `Meeting` or `Meeting.md`), `title` (string, required), `folder` (string, default `Root`), `variables` (object) | Creates a note from a template with `{{var}}` substitution. `{{title}}` (the note title) and `{{date}}` (today, `YYYY-MM-DD`) are built in unless given in `variables`. Only notes in `Templates/` can be templates. |\n| `bulk_replace` | W | `find` (string, required), `replace` (string, required), `folder` (string), `regex` (boolean, default false), `dry_run` (boolean, default false) | Find and replace across notes. `find` must not be empty or (with `regex`) match an empty string. `folder` includes its subfolders (`Root` = top level only); a missing folder is an error. With `regex`, `replace` expands `$1` / `${name}` (`$$` is a literal `$`); unknown groups are errors. Needs `write` even with `dry_run`. |\n| `bulk_delete` | W | `paths` (array of strings), `folder` (string) | Moves many notes to `.Trash` (recoverable with `restore_trash`), by list and / or folder (with subfolders). Any invalid path (missing, outside the vault, a folder, not a note) refuses the whole call and is listed. |\n\n### Collaboration (`collab`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `lock_node` | W | `path` (string, required), `owner` (string, default the caller), `ttl` (integer seconds, default 300) | Soft lock on a note. |\n| `release_lock` | W | `path` (string, required), `owner` (string, default the caller) | Releases a lock. |\n| `get_locks` | R | none | Active locks. |\n| `mention_agent` | W | `agent` (string, required), `path` (string, required), `message` (string) | Writes `> @agent: message` into a note. With agent `mnemo`, Memora\'s own agent answers it in the note (the request is struck through and the reply quoted under it). |\n| `get_assignments` | R | `agent` (string) | Notes with `assigned_to` in their frontmatter. |\n\n### Activity and health (`ops`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_events` | R | `since` (number, unix time), `folder`, `actor` (strings), `limit` (integer, default 50) | Recent note created, updated and deleted events. |\n| `presence` | R | `window` (integer seconds, default 300) | Agents active within the window. |\n| `get_logs` | R | `range` (string, default `1d`; also `7d`, `today`, `yesterday`), `actor` (string), `limit` (integer, default 100) | Activity log for a period. |\n| `search_logs` | R | `q` (string, required), `range` (string, default `7d`), `actor` (string), `limit` (integer, default 100) | Keyword search in the activity log. |\n| `digest` | R | `folder` (string), `since` (number) | Event counts per actor and per type. |\n| `healthcheck` | R | none | Note count, broken links, orphans and git status. |\n| `stale_detection` | R | `days` (integer, default 30) | Notes untouched for more than N days. |\n\n### Identity (`identity`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `set_my_name` | W | `name` (string, required) | Sets the display alias shown in the activity feed and log. |\n| `set_my_color` | W | `color` (string, required; `#rrggbb`, or `""` to reset) | Sets the calling API key\'s display color. Fails for browser sessions. |\n| `list_actors` | R | none | `{me, aliases}`: the caller and every known alias. |\n\n### Import and export (`interop`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `export_memory` | W | `paths` (array of strings, required; notes or folders), `out_path` (string), `overwrite` (boolean, default false) | Writes a zip of the given paths to the server\'s exchange folder and returns `{ok, path, name, bytes, replaced}`, where `path` and `name` are the zip\'s file name. Every path must exist; missing ones are listed and nothing is written. `out_path` is a plain file name ending in `.zip` (letters, digits, `.`, `_`, `-`, at most 120 characters); the default is `memora-export-<unix seconds>.zip`. An existing zip of that name is only replaced with `overwrite: true`. |\n| `import_memory` | W | `zip_path` (string, required), `overwrite` (boolean, default false) | Imports the `.md` notes of a zip in the exchange folder, by the file name `export_memory` returned. Returns `{ok, added, overwritten, skipped, unsafe, failed}`: `skipped` are existing notes kept (no `overwrite`), `unsafe` are entries with an absolute or escaping path (`{entry, reason}`), `failed` are entries too large or unreadable. |\n\nThe exchange folder is `exchange` in the state directory (`<MEMORA_STATE>/exchange`),\none per Memora instance, created with mode 0700.\nTools never read or write anywhere else on the server\'s disk.\n\n### Checks, to-dos and pins (`ux`)\n\n| Tool | | Arguments | Purpose |\n|---|---|---|---|\n| `get_todos` | R | `path` (string) | Open checklist items (`- [ ]`) in one note or the whole vault. |\n| `follow_ups` | R | none | Notes whose status is still awaiting action. |\n| `validate_memory` | R | `path` (string, required) | Checks a note: frontmatter present and well formed, a valid `created` date, tags, and broken links (named in the issue and listed in `broken_links`). |\n| `list_pins` | R | none | The owner\'s pinned notes and folders in sidebar order: `{count, pins:[{kind, path, position, missing}]}`. `missing` is true when the path no longer exists (renamed or deleted outside Memora). |\n| `pin` | W | `path` (string, required), `kind` (`note` or `folder`; default: what the path is on disk), `position` (integer from 0; default: the end) | Pins an existing note or folder, or moves its pin. A note path may leave out `.md`. At most 200 pins. Returns the list. |\n| `unpin` | W | `path` (string, required), `kind` | Removes a pin; the note or folder is not touched. Returns the list with `removed`. |\n\nPins are shared by every browser of the owner (`/api/pins`). They follow their note or\nfolder through renames and moves done by Memora (over MCP or HTTP, including notes inside\na moved folder) and are removed when the item is deleted or moved to the trash; deleting a\nfolder removes every pin under it. A key whose privacy rules hide a path neither lists\nnor changes its pin, and `position` counts only the pins the key can see.\n\n### Admin tools (`admin`)\n\nListed and callable only for keys with the `admin` scope (and for browser\nsessions). They are not part of the switchable catalog: global tool switches and\na key\'s tool list do not apply to them, and they do not need `write`.\n\n| Tool | Arguments | Purpose |\n|---|---|---|\n| `admin_list_tools` | none | `{tools: [{name, category, description, enabled}]}` for every catalog tool. |\n| `admin_set_tool` | `name` (string, required), `enabled` (boolean, required) | Switches a catalog tool on or off for every key. Returns `{ok, name, enabled}`. |\n| `privacy_list` | `path` (string), `kind` (`node` or `folder`) | Without `path`: every privacy rule. With `path`: that note or folder\'s own rule, the folder rules it inherits, and which agents can see it. |\n| `privacy_set` | `path` (string, required), `agents` (array of key ids or names, required; a comma-separated string also works), `kind` (`node` or `folder`), `mode` (`deny` or `allow_only`, default `deny`) | Replaces the rule on a path. `deny` hides it from the listed agents; `allow_only` hides it from every other agent, including keys created later. `deny` with no agents removes the rule. A node rule follows its note through renames and moves. |\n| `privacy_clear` | `path` (string, required), `kind` (`node` or `folder`) | Removes the path\'s own rule. Rules on parent folders still apply. |\n\nWhen `kind` is omitted it is taken from the path on disk: a folder if a folder\nexists there, otherwise a note.\n\n## Identity and tracking\n\nEvery tool call is published to the web UI\'s realtime activity stream as an\n`ai_activity` start and end pair, named after the API key (or the signed-in\nuser), with the note paths involved. Calls are also counted per key: the Keys\npage and `GET /api/keys` show each key\'s `uses`, `last_ip`, and the tools it has\ncalled recently. `initialize` registers the connection under the key\'s name\n(`GET /api/aliases`). `set_my_name` changes the alias shown in the activity\nfeed and log, and `set_my_color` changes the key\'s color in the UI. See\n[API.md](API.md) for the HTTP endpoints.\n',kY='# HTTP API\n\nThe `memora` binary serves the HTTP API, the MCP endpoint, the OAuth endpoints,\nthe web UI, and the WebSocket on one port. This document lists the HTTP endpoints.\n\n## Authentication\n\nThe Auth column in the tables below uses these levels:\n\n- None: reachable without credentials.\n- Session: requires the `memora_sess` cookie set by a successful login.\n- Key (`scope`): an API key sent as `Authorization: Bearer <key>` or `X-API-Key: <key>`\n that carries the named scope.\n- Session or key (`scope`): either of the above.\n- Session only: an API key is not enough. API keys get `401` (or `403` where noted).\n- +CSRF: the same-origin check described below applies.\n\n### API key scopes\n\nA key carries any of the scopes `mcp`, `read`, `write`, and `admin`. New keys get\n`mcp`, `read`, and `write` unless other scopes are requested. The scope a route\nneeds is decided by its path and method:\n\n| Scope | Routes |\n|---|---|\n| `mcp` | `/mcp` |\n| `admin` | `/api/tools`, `/api/keys` and `/api/keys/*`, `/api/access` and `/api/access/*`, `/api/logs/settings`, `/api/settings/server`, `/api/oauth/clients` and `/api/oauth/clients/*`, `/api/privacy` and `/api/privacy/*`, `/api/trash/delete`, `/api/trash/empty`; deleting for good with `/api/delete` |\n| `read` | Every other `GET` or `HEAD` under `/api/` |\n| `write` | Every other method under `/api/` |\n\nA key without the needed scope gets `403 {error, required_scope}`. A missing key\ngets `401`; for `/mcp` the `401` carries a `WWW-Authenticate` header,\n`Bearer resource_metadata="<base>/.well-known/oauth-protected-resource"`, so OAuth\ncapable clients can start sign-in. An invalid key gets `401` and is logged; an\nIP that keeps presenting invalid keys is put on a cooldown (`429`).\n\n`/api/auth/*` never accepts an API key: without a valid session it answers `401`.\n\nAPI keys see the vault through their privacy rules (see [Privacy](#privacy)):\nnotes and folders hidden from a key behave as if they do not exist. A browser\nsession sees everything.\n\n### CSRF\n\nWrite endpoints that accept a session check the request origin whenever a\nsession cookie is present: `Origin` (or, without it, `Referer`) must match the\nrequest `Host` (or an `X-Forwarded-Host` sent by a trusted proxy), and\n`Sec-Fetch-Site: cross-site` is refused. A failed check is\n`403 {"error":"origin mismatch"}`. Requests without a session cookie (API-key\nclients) pass, since a browser cannot attach an API key on its own.\n\nThe public auth forms (`/api/auth/login`, `/api/auth/verify`,\n`/api/auth/bootstrap`, `/api/auth/reset`) also refuse a foreign or `null`\n`Origin` when no cookie exists yet. A request with neither `Origin` nor\n`Referer` (curl, the CLI) passes.\n\n### Locked instance\n\nWhile the instance is LOCKED, `/api/*` and `/mcp` answer\n`423 {error, locked: true, hint}` except for `/api/auth/state`, `/api/auth/verify`,\n`/api/auth/login`, `/api/auth/logout`, `/api/auth/bootstrap`, and\n`/api/auth/reset`. Other pages redirect to `/login?locked=1`; static assets,\n`/login`, `/logout`, `/healthz`, and `/favicon.ico` are still served.\n`/api/auth/login` itself answers `423` while locked.\n\n### Vault not configured\n\nUntil a vault folder is configured, `/mcp` and every `/api/*` route except\n`/api/auth/*`, `/api/settings*`, `/api/config`, `/api/keys*`, `/api/tools`,\n`/api/access*`, and `/api/ui/*` answer\n`409 {"error":"vault not configured", "needs_vault":true}`.\n\n### Limits and other gates\n\n- Requests for a host outside the configured domain list get a bare `404`.\n- Access rules (see `/api/access`) can block a caller:\n `403 {"error":"access denied by stack rule", ip}`.\n- Per-IP rate limits answer `429` with a `Retry-After` header and\n `{error, limited, cooldown, retry_after}`. Login, code check, setup, reset, profile,\n password, and username changes have a stricter limit and a cooldown after\n repeated failed attempts. Requests from the machine itself and `/healthz` are\n not limited.\n- A request that takes longer than 30 seconds is answered with `408`.\n- A password hashing pool that is busy answers `503` with `Retry-After: 2`.\n- `GET` answers under `/api/` (except `/api/auth/*`) are gzip-compressed when the\n request sends `Accept-Encoding: gzip`. Pages, writes, sign-in, `/mcp` and\n server-sent events are never compressed.\n\nResponses are JSON unless stated otherwise. Errors are `{"error": "..."}`. Vault\nerrors map to `404` for not-found (including paths hidden from the caller) and\n`400` for bad input.\n\n## Health and discovery\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/healthz` | None | `{ok, server}` for unauthenticated callers from other machines. A signed-in browser or a caller on the same machine gets `{ok, server, version, vault_configured, vault, armed, locked, base_url, base_url_configured}`. |\n| GET | `/.well-known/mcp.json` | None | The MCP discovery card: `{name, version, description, mcp, auth, capabilities, tools, resources}`. `tools` lists the full catalog with `enabled` per tool. |\n| GET | `/tools` | None | An HTML rendering of the tool catalog. A signed-in browser gets the app shell instead. |\n| POST | `/mcp` | Key (`mcp`), or Session (+CSRF) | MCP over streamable HTTP (JSON-RPC in, JSON-RPC out). See [MCP.md](MCP.md). A session has full access; a key is limited by its tool grant. Notifications get `202` with no body. Malformed JSON is `400` with a JSON-RPC error. Other methods get `405` with `Allow: POST`. |\n\n## Auth\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/auth/state` | None | `{bootstrap, realm, min_password_len, gateway, armed, locked, setup_hint, ready, checks:{vault, state}, code_required, cooldown, vault_configured}`. Adds `signed_out` (`password_changed` or `signed_out_remotely`) when the browser\'s session was ended on purpose, and `mode`, `expires_in`, `ttl` while a setup or reset window is open. |\n| POST | `/api/auth/verify` | None (+CSRF) | Checks the setup code shown on the server before the setup or reset form is shown. Body: `{code}`. Returns `{ok, mode, expires_in, user}`. `403` when no window is open or the instance is not ready. A wrong code answers `403 {error, burned:false}` and counts against the caller IP\'s budget of 3 wrong codes (then `429`); after 50 wrong codes in one window the window closes and the code is void: `403 {error, burned:true}`. |\n| POST | `/api/auth/login` | None (+CSRF) | `{ok, user, expires_in, redirect}` and sets the session cookie. Body: `{username, password}`. `400` when a field is missing, `401` on bad credentials, `403` if the account is disabled, `423` if locked, `429` during a cooldown of the caller IP (there is no account-wide lockout; see DEPLOYMENT.md, Failed sign-ins). |\n| POST | `/api/auth/logout` | None (+CSRF) | `{ok:true}`. Ends the session named by the cookie, if any, and clears the cookie. |\n| POST | `/api/auth/bootstrap` | None (+CSRF) | Creates the owner account. Body: `{code, username, password}`. Returns `{ok, user, redirect, persisted}` and sets a session cookie. The username is stored lowercase. `400` for an invalid username or password length; `403` unless a window is open, the code is right, the instance is ready, and no account exists. |\n| POST | `/api/auth/reset` | None (+CSRF) | Sets a new password for the single account, and may rename it. Body: `{code, username, password}`. Returns `{ok, user, persisted}`. Signs out every session. `400` for invalid input; `403` unless a window is open, the code is right, and an account exists. |\n| POST | `/api/auth/profile` | Session only (+CSRF) | With `password` in the body, changes the password exactly like `POST /api/settings/password` (body `{current, password, confirm}`). Otherwise sets `display_name` (at most 48 characters) and returns `{ok, changed, persisted, user, password_changed:false}`; with no `display_name` it returns `{ok, changed:false}`. |\n| GET | `/api/auth/me` | Session only | `{authenticated, user, enabled, expires_in}`. `401` without a session. |\n| GET | `/api/auth/events` | Session only | Recent entries of the security activity log, newest first: `{events:[{at, event, ip, user, detail, actor, actor_kind, actor_id}], count}`. `user` is the stored actor (`key:<id>` for API-key calls); `actor` is the display name (the key\'s current name, falling back to its id; the username for the browser), `actor_kind` is `agent` or `user` (null when there is no actor). Query: `limit` (default 200, max 2000), `q`. |\n\n## Pages\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/login` | None | The sign-in page. A signed-in browser is redirected to `/` unless the instance is locked or the query has `oauth` (the OAuth consent card). |\n| POST | `/logout` | None (+CSRF) | Ends the session, clears the cookie, and redirects to `/login`. With a session cookie the request must be same-origin (`403` otherwise); other methods get `405`. The web UI uses `POST /api/auth/logout`. |\n| GET | `/`, `/index.html` | Session | The web app shell. Without a session: `302` to `/login`. `503` when the UI assets are not installed. |\n| GET | App routes (see below) | Session | The same app shell as `/`. Without a session: `302` to `/login?r=<path>`, so sign-in returns to the page. |\n\nApp routes are the web app\'s client-side pages: `/brain`, `/nodes`, `/graph`,\n`/canvas`, `/tags`, `/activity`, `/agents`, `/access`, `/settings`,\n`/overview`, `/welcome`, `/trash`, `/mnemo`, the older names `/home`, `/vault`, `/logs`, `/keys`,\nand `/node/` or `/node/<percent-encoded vault path>`. The path is never used to\nread a file; a path holding NUL or another control character (raw or\npercent-encoded) is `400`. `/tools` is an app route for a signed-in browser and\nthe public tool catalog otherwise.\n\nHTML pages are sent with `Cache-Control: no-cache, no-store, must-revalidate`\nand a per-response CSP nonce.\n\nAny other `GET` that asks for HTML (`Accept: text/html`), is outside `/api/`,\n`/mcp`, `/oauth`, and `/.well-known`, and has no file extension in its last\nsegment gets the app shell (which shows its "page not found" view). Every other\nunmatched request is `404 {"error":"not found"}`.\n\n## Static assets\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/assets/{name}` | None | Static UI assets (whitelisted filenames only, else `404`). |\n| GET | `/app.js`, `/app.css`, `/login.css` | None | The UI bundle and styles. Revalidated on every load (`Cache-Control: no-cache`, ETag). |\n| GET | `/favicon.svg` | None | The icon. |\n| GET | `/favicon.ico` | None | `204` with no body. |\n| GET | `/manifest.webmanifest`, `/sw.js`, `/robots.txt`, `/offline.html`, `/icon-192.png`, `/icon-512.png`, `/icon-maskable-512.png`, `/apple-touch-icon.png` | None | PWA files and `robots.txt`. Images and the manifest are cached for 5 minutes; code is revalidated on every load. |\n\n## Vault\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/tree` | Session or key (`read`) | Notes grouped by folder: `{folder: [{path, name, folder, mtime, title}]}`; `title` is what the app shows (front matter `title`, else the first `# heading`, else the file name with `_` as spaces). |\n| GET | `/api/folders` | Session or key (`read`) | Every folder the caller may see, empty and nested ones included (`{folders:[path]}`); dot folders such as `.Trash` are left out. |\n| GET | `/api/note` | Session or key (`read`) | `{path, name, content, html, tags, frontmatter, backlinks, size, mtime}`. Query: `path` (`400` when empty). |\n| GET | `/api/vault/file` | Session or key (`read`) | The raw bytes of one image file in the vault (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO; never SVG). Query: `path` (vault-relative). The file content must match its type. At most 10 MiB (`413`). Sent with an `ETag` (`304` on `If-None-Match`), `Cache-Control: private, max-age=300`, and a sandbox CSP. `400` invalid path, `403` path not allowed, `404` not found, `415` not an image. |\n| GET | `/api/folder-meta` | Session or key (`read`) | Folder metadata keyed by folder name. Query: `folder` (optional). |\n| POST | `/api/save` | Session or key (`write`, +CSRF) | `{ok, path}`. Body: `{path, content}`. Overwrites the note. |\n| POST | `/api/create` | Session or key (`write`, +CSRF) | `{ok, path}`. Body: `{title, folder?, content?}`. |\n| POST | `/api/rename` | Session or key (`write`, +CSRF) | `{ok, path}` with the new path. Body: `{path, name}`. |\n| POST | `/api/move` | Session or key (`write`, +CSRF) | `{ok, path}` with the new path. Body: `{path, folder?}`. |\n| POST | `/api/delete` | Session or key (`write`; `admin` to delete for good, +CSRF) | `{ok:true}`. Body: `{path, mode?}`. Deletes the note for good (no trash); with version history on, its earlier versions are erased from the history too, so nothing can bring it back. Because that cannot be undone, an API key needs the `admin` scope for it (`403 {error, required_scope: "admin"}` otherwise, as MCP `delete_memory` with `permanent`); the owner\'s browser session may. `mode: "trash"` (what the web app sends) moves it to `.Trash` instead, remembering where it was and who deleted it: `{ok, trashed, to}`. |\n| GET | `/api/trash` | Session or key (`read`) | Notes in `.Trash` the caller may see, newest first: `{items: [{name, path, original, deleted, by, title}]}` (`by` = `{id, name, kind}`, null when unknown). Nothing is removed automatically. |\n| POST | `/api/trash/restore` | Session or key (`write`, +CSRF) | Body: `{name, into?}`. Back to where the note was deleted from (or into the folder `into`); a taken name gets `-1`, `-2` ...: `{ok, path, from, renamed?}`. 404 when the name is not in the trash. |\n| POST | `/api/trash/delete` | Session or key (`admin`, +CSRF) | Body: `{name}`. Deletes one trash entry for good: `{ok, deleted, name, history?}`. With version history on, the note is also erased from the history (every earlier version under every name it had, its trash record and its path in commit messages), and `history` is `{erased, ms, commits}`. Other notes keep their versions; their revision ids change. |\n| POST | `/api/trash/empty` | Session or key (`admin`, +CSRF) | Deletes every trash entry the caller may see, for good: `{ok, count, names, history?}`, erasing them from the version history in one rewrite (as `/api/trash/delete`). |\n| POST | `/api/folder` | Session or key (`write`, +CSRF) | `{ok, path}`. Body: `{name}`. |\n| POST | `/api/folder/rename` | Session or key (`write`, +CSRF) | `{ok, from, to, notes}`. Body: `{folder, name}`. |\n| POST | `/api/folder/move` | Session or key (`write`, +CSRF) | Moves a folder and everything in it. `{ok, from, to, notes}`. Body: `{folder, into}`; `into` empty or `Root` means the top level. |\n| POST | `/api/folder/move-contents` | Session or key (`write`, +CSRF) | Moves everything inside a folder into another one, then removes the emptied folder. Name clashes get a `-N` suffix. `{ok, from, to, moved}`. Body: `{folder, into}`; `into` empty or `Root` means the top level. |\n| POST | `/api/delete-folder` | Session or key (`write`, +CSRF) | Deletes a folder. Body: `{folder, into?, mode?}`. By default its notes move to the folder\'s parent (the top level for a top-level folder), keeping the sub folder structure below it, and wikilinks are rewritten: `{ok, deleted_folder, moved_to, moved, links_updated}` (`moved` lists the new paths; `moved_to_root` repeats it when they went to the top level). `into` names another existing folder for the notes (`Root` = top level). `mode: "trash"` moves every note to `.Trash` instead (restorable from the Trash on the Notes page, `/api/trash/restore`, or the MCP tools `list_trash` / `restore_trash`): `{ok, deleted_folder, mode, count, trashed}`. Other files in the folder are deleted. |\n| POST | `/api/folder-meta` | Session or key (`write`, +CSRF) | `{ok, folder}`. Body: `{folder, color?, icon?, desc?}`. |\n\nThe three folder operations also publish a `folder_changed` realtime event so\nopen browsers reload their tree.\n\n### Version history\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/history?path=&limit=` | Session or key (`read`) | A note\'s revisions, newest first (the vault\'s git history, following renames): `{path, total, versions: [{rev, date, author, message, version, total, path?, owner}]}`. `version` counts from 1 (the oldest) to `total` (the current one); `owner` is true when the signed-in owner made the change. `limit` defaults to 100 (at most 500). |\n| GET | `/api/note-at?path=&rev=` | Session or key (`read`) | The note as it was at one revision (a `rev` from `/api/history`, `snap-<label>`, `HEAD~1`, `HEAD@{<date>}`): `{path, rev, content, html}`, `html` rendered like `/api/note`. |\n| GET | `/api/diff?path=&a=&b=` | Session or key (`read`) | Unified diff of the note from revision `a` to `b`, or to the note as it is now when `b` is left out: `{path, from, to, changed, diff}`. |\n| POST | `/api/history/restore` | Session or key (`write`, +CSRF) | Body: `{path, rev}`. Gives the note its content from `rev` again as a new revision (restoring version 3 of 5 makes version 6; nothing is lost): `{ok, path, rev, changed, version, total}` (`changed` false when the note already had that content). |\n\nThe four history routes answer `409 {error, history: false}` while version history\nis off (the vault folder is not a git repository; see\n[CONFIGURATION.md](CONFIGURATION.md#version-history)) and `404` for a path that is\nnot in the vault or its history, or is hidden from the calling key. Web writes\n(save, create, rename, move, delete, restore) are committed with the caller as the\nauthor: the owner\'s username for the browser, the key\'s name for an API key.\n\n### Images\n\nImages live in the folder of the note that shows them, and a note shows one with\n`` (`path:` names a file in the note\'s own folder). Saving a\nnote that points with `path:Other/Folder/pic.png` to an image elsewhere copies that\nimage beside the note and rewrites the link, so notes never point across folders.\nImages follow their note: a move carries them, the Trash keeps them in\n`.Trash/.assets/<entry>/` until the note is restored (to the same or another\nfolder) or deleted for good, and a deleted folder takes its images along. An image\nthat another note of the same folder still shows is copied or kept instead.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| POST | `/api/vault/image?note=<path>&name=<file>` | Session or key (`write`, +CSRF) | The raw image bytes as the body (PNG, JPEG, WebP or GIF, checked by content). Stored beside the note; identical bytes reuse the existing file, a taken name gets `-1`, `-2` ...: `{ok, path, name, bytes, url, markdown}` (`markdown` is the line to put in the note). `400` for another file type, a size above the upload limit, or a missing note. |\n| POST | `/api/vault/image/delete` | Session or key (`write`, +CSRF) | Body: `{path}`. Deletes one image file (the version history keeps it): `{ok, deleted}`. |\n| GET | `/api/vault/images?folder=<folder>` | Session or key (`read`) | The images of that one folder (not its sub folders or parents): `{folder, images: [{path, name, folder, bytes, mtime, url, used_in: [{note, title, heading}]}]}`. `heading` is the section that shows the image (`null` before the first heading). |\n| GET | `/api/vault/images?note=<path>` | Session or key (`read`) | `{note, folder, images, folder_images}`: the images the note shows, and every image of its folder. |\n| GET | `/api/vault/storage` | Session or key (`read`) | `{notes, note_bytes, images, image_bytes, total_bytes, max_image_bytes}`. |\n\n## Search and graph\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/search` | Session or key (`read`) | `{q, count, hits:[{path, name, folder, score, snippet}]}`, at most 20 hits. Query: `q`. Supports `tag:x` and `#x`. |\n| GET | `/api/stats` | Session or key (`read`) | `{notes, links, folders}`. |\n| GET | `/api/graph` | Session or key (`read`) | `{nodes:[{id, path, folder, color, degree, tags}], links:[{source, target}]}`. `tags` holds inline `#tags` plus frontmatter `tags` (as the note view reports them). Realtime `node_*` events\' `node` payload carries `tags` too. |\n| GET | `/api/aliases` | Session or key (`read`) | `{aliases:[{alias, key_id, key_name, first_seen, last_seen, connections, actor, actor_kind}]}`: one record per API key that sent MCP `initialize`, kept in memory until the server restarts. `key_name` and `actor` are the key\'s current name (fallback: the id). |\n| GET | `/api/actors` | Session or key (`read`) | `{actors:[{actor, alias, display, events, tools, last_ip, last_ts, seen_minutes_ago}], count}`. `seen_minutes_ago` is `-1` when the actor has no events. |\n\n## Privacy\n\nPrivacy rules hide notes or folders from chosen agents (API keys). A rule has a\n`kind` (`node` or `folder`), a `path`, a `mode` (`deny`: hidden from the listed\nkeys; `allow_only`: hidden from every key except the listed ones), and a list\nof keys. Folder rules apply to everything inside the folder.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/privacy` | Session or key (`admin`) | `{count, rules:[{id, kind, path, mode, keys:[{id, name, color}], created_at, updated_at}], agents:[{id, name, color, enabled}]}`. |\n| GET | `/api/privacy/path` | Session or key (`admin`) | The privacy state of one path: `{path, kind, own, own_rules, inherited, agents:[{id, name, color, enabled, can_see, hidden_by}], private}`. `own` is `{mode, keys}` or `null`. Query: `path`, `kind` (optional; defaults to `folder` when the path is a folder on disk, else `node`). |\n| PUT | `/api/privacy/path` | Session or key (`admin`, +CSRF) | Replaces the rule on a path. Body: `{path, kind?, mode, keys}`. `mode` defaults to `deny`; `keys` is a list of key ids (or unique key names). `deny` with no keys removes the rule. Returns the same shape as `GET`. |\n| DELETE | `/api/privacy/path` | Session or key (`admin`, +CSRF) | Removes the rule on a path. Query: `path`, `kind` (optional). Returns the same shape as `GET`. |\n\nChanges are written to the activity log and publish a `privacy_changed`\nrealtime event.\n\n## API keys, tools, and access\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/keys` | Session or key (`admin`) | `{count, keys:[{id, name, enabled, scopes, tools, prefix, created, color, revealable, uses, last_ip, used_tools}]}`. `tools` is `"*"` or a list of tool names; `revealable` says whether the secret can be shown again; `used_tools` lists recently used tools and routes. |\n| POST | `/api/keys` | Session or key (`admin`, +CSRF) | Creates a key. Body: `{name?, tools?, scopes?, color?}`. `tools` is `"*"` or a list of tool names; `scopes` a list of scope names (an empty list means the defaults). Returns `{ok, id, key, name, prefix, persisted, color, tools, scopes}`. The raw `key` is returned once. `400` for an unknown tool or scope. |\n| POST | `/api/keys/roll` | Session or key (`admin`, +CSRF) | New secret for an existing id. Body: `{id}`. Returns `{ok, id, key, prefix, persisted}`. `404` for an unknown id. |\n| POST | `/api/keys/reveal` | Session only (+CSRF) | Shows the secret of a key created or rolled from the dashboard again. Body: `{id, current}` where `current` is the owner\'s password. Returns `{ok, id, key}`. `403` for a wrong password; `429` after 5 wrong passwords (5 minute pause); `404 {error:"not_stored", message}` when the secret is not stored (for example keys created by the CLI or by OAuth). |\n| POST | `/api/keys/update` | Session or key (`admin`, +CSRF) | Body: `{id, name?, enabled?, tools?, scopes?, color?}`. `color` as `""` or `null` clears it. Returns `{ok, id, name, enabled, color, tools, scopes, persisted}`. `400` for an unknown tool or scope, `404` for an unknown id. |\n| POST | `/api/keys/delete` | Session or key (`admin`, +CSRF) | `{ok, id, persisted}`. Moves the key to the trash. Body: `{id}`. |\n| POST | `/api/keys/restore` | Session or key (`admin`, +CSRF) | `{ok, id, persisted}`. Restores a deleted key. Body: `{id}`. `404` when no deleted key has that id. |\n| GET | `/api/tools` | Session or key (`admin`) | `{tools:[{name, category, description, enabled}]}`: the MCP tool catalog with the global on/off switch of each tool. |\n| POST | `/api/tools` | Session or key (`admin`, +CSRF) | Switches a tool on or off for every caller. Body: `{name, enabled}`. Returns `{ok, name, enabled}`. `400` for an unknown tool. |\n| GET | `/api/access` | Session or key (`admin`) | `{default_allow, rules, count}`. |\n| POST | `/api/access/test` | Session or key (`admin`) | `{action, would_lock_out_caller}` for the given address or domain. Body: `{ip?, domain?}`. |\n| POST | `/api/access/rules` | Session or key (`admin`, +CSRF) | `{ok, count, persisted}`. Body: `{op, kind, value, action}`. `op` is `add` (default) or `remove`. `kind` is `ip`, `range`, `cidr`, `domain`, or `all`; `value` is required unless `kind` is `all`. `action` is `allow` or `block` (default `block`). `remove` deletes every rule matching the given `kind` and `value`; `404` when none match. |\n| GET | `/api/config` | Session or key (`read`) | `{realm, min_password_len, session_ttl, vault, version, gateway, update}`. `update` is the cached release check: `{current, latest, available, url, checked_at, state, repo, stars}`, `state` one of `ok`, `none` (no release published), `error`, `disabled`, `pending`; `stars` is the repository\'s GitHub star count from the same check (`null` until known). |\n\n## Settings\n\nAll settings endpoints need a signed-in browser, except `/api/settings/server`, which also takes an API key with the `admin` scope.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/settings` | Session only | `{user, vault_configured, vault, vault_suggested, vault_writable, stats, min_password_len, expires_in, session_ttl, session_max_age, state_dir}`. `stats` is `{notes, links, folders}` or `null` without a vault. |\n| POST | `/api/settings/password` | Session only (+CSRF) | Body: `{current, password, confirm}`. Returns `{ok, user, password_changed, revoked_sessions, persisted}`. Every other session is signed out. `400` for a short, mismatched, or unchanged password; `403` for a wrong current password (counts toward the login cooldown). |\n| POST | `/api/settings/username` | Session only (+CSRF) | Renames the account. Body: `{username, current}`. Returns `{ok, user, changed}` (plus `persisted` when changed). The username is stored lowercase. Sessions stay signed in. `400` for an invalid username, `403` for a wrong password. |\n| POST | `/api/settings/vault` | Session only (+CSRF) | Sets the vault folder and switches the running server to it. Body: `{path, create?}`. `path` must be absolute, without `..`, writable, not a system folder, and not overlap the state folder; with `create` a missing folder is created (its parent must exist). Returns `{ok, vault, created, stats}`. `400` with a message when the folder is refused. |\n| POST | `/api/settings/server` | Session or key (`admin`, +CSRF) | Body: `{realm?, session_ttl?, session_max_age?}` (at least one). Sets the server name (1-64 characters), how long a browser may stay idle before it must sign in again (300 to 2592000 seconds) and the longest sign-in (`0` for no limit, else at least `session_ttl`). Returns `{realm, session_ttl, session_max_age}`; open sessions follow the new limits at once. `400` for a value out of range. |\n| GET | `/api/settings/sessions` | Session only | `{sessions:[{id, current, source, alias, ip, user_agent, created_at, last_seen, expires_in}], count}`: live browser sessions. API keys are not sessions and never appear here. |\n| POST | `/api/settings/sessions/revoke` | Session only (+CSRF) | Signs other browsers out. Body: `{id}` or `{others:true}`. Returns `{ok, revoked}`. `400` for the current session (use logout), `404` when the session has already ended. |\n| POST | `/api/settings/sessions/rename` | Session only (+CSRF) | Names a device. Body: `{id, alias}`; an empty alias clears it. Returns `{ok, alias}`. |\n| GET | `/api/settings/sessions/activity` | Session only | `{events, count, ip, since}`: activity log entries from that session\'s IP address since it signed in, API-key entries left out, newest first, at most 200. Query: `id`. |\n\n| GET | `/api/settings/media` | Session or key | `{max_image_mb, max_image_bytes}`: the largest image upload (5 MB by default). |\n| POST | `/api/settings/media` | Session or key (`admin`, +CSRF) | Body: `{max_image_mb}` (0.1 to 50). Applies at once to the app, the HTTP API and MCP `upload_image`. |\n\nSession `id` values are the short ids returned by `GET /api/settings/sessions`\n(a unique prefix also works). An ambiguous or malformed id is `400`.\n\n## OAuth\n\nMemora is an OAuth 2.1 authorization server for remote MCP clients. Only the\nauthorization code flow with PKCE (`S256`) is supported. The access token is a\nnew API key named after the client, with the default scopes (`mcp`, `read`,\n`write`) and every tool; it appears on the Agents page like any other key and\nis revoked by deleting or disabling that key. URLs in the metadata use\n`MEMORA_BASE_URL` when it is set, else the scheme and host of the request.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/.well-known/oauth-protected-resource`, `/.well-known/oauth-protected-resource/mcp` | None | Protected resource metadata (RFC 9728): `{resource, authorization_servers, bearer_methods_supported, scopes_supported, resource_name}`. |\n| GET | `/.well-known/oauth-authorization-server`, `/.well-known/oauth-authorization-server/mcp`, `/.well-known/openid-configuration` | None | Authorization server metadata (RFC 8414): `issuer`, the authorization, token, and registration endpoints, supported response types (`code`), grant types (`authorization_code`, `refresh_token`), PKCE methods (`S256`), token endpoint auth methods, `scopes_supported` (`mcp`), and `client_id_metadata_document_supported: true`. |\n| POST | `/oauth/register` | None | Dynamic client registration (RFC 7591). Body: `{redirect_uris, client_name?}`. `redirect_uris` holds 1 to 10 URIs, each HTTPS or plain HTTP on `localhost`, `127.0.0.1`, or `[::1]`, without a fragment. Returns `201 {client_id, client_name, redirect_uris, client_id_issued_at, token_endpoint_auth_method, grant_types, response_types}`. `400 {error, error_description}` for invalid metadata or when 500 clients are registered. `429` past 10 registrations from one IP (then one per minute). A client that has not completed an authorization within an hour is removed; it can register again. |\n| GET | `/oauth/authorize` | None | `302` to `/login?oauth=1&<query>`, where the sign-in page shows a consent card (after sign-in when needed). |\n| POST | `/oauth/token` | None | Form-encoded or JSON body. `grant_type=authorization_code` with `code`, `code_verifier`, `client_id` (or HTTP Basic), and optional `redirect_uri`; or `grant_type=refresh_token` with `refresh_token` and optional `client_id`. Returns `{access_token, token_type:"Bearer", refresh_token, scope:"mcp"}`. Codes are single use and expire after 10 minutes. A refresh gives the same key a new secret and a new refresh token. Errors are `400 {error, error_description}` (`invalid_request`, `invalid_grant`, `unsupported_grant_type`). |\n| GET | `/api/oauth/request` | None | What the consent card shows for an authorization request. Query: the `/oauth/authorize` query. Returns `{ok:true, client:{id, name, kind}, redirect_host, signed_in, user}` or `{ok:false, error, error_description, redirect}`. |\n| POST | `/api/oauth/approve` | Session only (+CSRF) | Body: `{query, allow}` where `query` is the authorization request query. Returns `{ok:true, redirect}`: the client\'s redirect URI with a `code` when `allow` is `true`, else with `error=access_denied`. An invalid request returns `{ok:false, error, error_description, redirect}`. `401` without a session. |\n| GET | `/api/oauth/clients` | Session or key (`admin`) | `{clients:[{client_id, name, redirect_uris, kind, created_at, fetched_at}], connections:[{key_id, client_id}]}`. `kind` is `dcr` (registered), `cimd` (metadata document), or `manual` (added by the owner). |\n| POST | `/api/oauth/clients` | Session or key (`admin`, +CSRF) | Registers a client by hand. Body: `{name?, redirect_uris}`. Returns `{ok, client}`. `400` for invalid redirect URIs. |\n| POST | `/api/oauth/clients/delete` | Session or key (`admin`, +CSRF) | Forgets a client and its refresh tokens. Body: `{client_id}`. Returns `{ok, deleted}`. Keys issued to the client stay until they are deleted. |\n\nA `client_id` may also be an HTTPS URL of a client metadata document. The\nserver fetches it (public addresses only, no redirects, at most 64 KiB), checks\nthat its `client_id` matches the URL, and caches it for 24 hours.\n\n## Logs and activity\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/logs` | Session or key (`read`) | `{range, count, events}`, newest first, each event with a local `time`. Query: `range` (for example `1d`, `7d`, `today`, `yesterday`, `all`; default `1d`), `days` (used when `range` is absent, at most 7), `since` and `until` (unix seconds; override `range`), `limit` (default 400, max 2000), `actor`, `q`. |\n| GET | `/api/logs/settings` | Session or key (`admin`) | `{max_mb, max_days, stats:{bytes, lines, oldest, newest, max_bytes, max_days}}` for the vault event log. |\n| POST | `/api/logs/settings` | Session or key (`admin`, +CSRF) | Body: `{max_mb?, max_days?}` (1 to 512 MB; 0 to 3650 days, 0 meaning no age limit). Returns the same shape as `GET`. The log is trimmed to the new limits at once. `400` for out-of-range values. |\n| GET | `/api/events` | Session or key (`read`) | `{events, count}`: the vault event log (`.events.jsonl`), oldest first, the newest `limit` entries. Query: `since` (unix seconds), `folder`, `actor` (the key name for agents), `limit` (default 100, max 2000). |\n\n### Realtime\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/ws` | Session only | WebSocket upgrade. The `Origin` must be same-origin (`403` otherwise). `503` when too many clients are connected. |\n| POST | `/_bus` | Loopback only | Publishes a JSON object (at most 64 KiB) into the event stream. Returns `{ok:true}`. `403` for callers that are not on the same machine, that come through a proxy (any forwarding header) or that are a web page (an `Origin` or `Sec-Fetch-*` header), `400` for a body that is not a JSON object, `413` for a body or event that is too large. |\n\nOn connect the server sends a `hello` event with the client count, replays the\nlast 40 stored events (each marked `replay: true`), then streams live events.\nWhen a client leaves, the others get a `presence` event with the new count.\nMessages from the client are ignored; the server pings every 30 seconds and\ncloses a connection that has been silent for 75 seconds.\n\n### Local stop\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| POST | `/_stop` | Loopback and stop token | Stops the server gracefully, like Ctrl+C (open requests finish, buffered usage is written). Returns `{ok:true}` and exits shortly after. `403` unless the caller is on the same machine, not behind a proxy (any forwarding header), and sends the `X-Memora-Stop-Token` header. Also accepted while the instance is locked. |\n\nAt startup, once the port is bound, the server writes a fresh random token to\n`<state>/stop.token` (readable by the server\'s user only on Linux and macOS)\nand removes it on exit. `memora-cli stop` reads that file and calls `/_stop`\nfirst on every OS; only if that fails does it fall back to SIGTERM (Linux,\nmacOS) or `taskkill` (Windows, where a server started without a console\nignores a polite `taskkill`). Anyone who can read the state folder can stop\nthe server; they can already read its database.\n\n### `ai_activity` events\n\nEvery MCP `tools/call` publishes a `start` and an `end` event sharing `call_id`:\n\n```json\n{"type":"ai_activity","phase":"start","call_id":"c1a2b3c4d5e6-0","actor":"research-bot",\n "actor_kind":"agent","actor_id":"k_1a2b3c4d","action":"read_memory","label":"Plan/Index.md",\n "paths":["Plan/Index.md"],"_ts":1760600000.12}\n{"type":"ai_activity","phase":"end","call_id":"c1a2b3c4d5e6-0","actor":"research-bot",\n "actor_kind":"agent","actor_id":"k_1a2b3c4d","action":"read_memory","label":"Plan/Index.md",\n "paths":["Plan/Index.md"],"ok":true,"ms":2,"_ts":1760600000.12}\n```\n\n- `actor`: the API key\'s name (fallback: key id) with `actor_kind: "agent"`; for a\n browser session the username with `actor_kind: "user"`. `actor_id` is the key id (or\n the username). Node events (`node_created`, ...) from the call carry the same `actor`.\n- `action`: the tool name.\n- `for` (optional): who the agent acted for and how it was asked. Mnemo, the built-in\n agent (`actor: "Mnemo"`, `actor_id: "mnemo"`), sets it: `owner · chat`,\n `owner · console`, `<who> · @mnemo in <note>`.\n- `paths`: vault-relative note paths from the arguments (`path`, `paths`, `from`, `to`,\n `old_path`, `new_path`, `into` of `merge_memory`, `source`/`target` of `find_path`)\n plus note paths found in the result (search hits, the created or moved note), at\n most 20, each at most 512 bytes (longer paths are dropped). Whole-vault overviews\n (`get_graph`, `list_memory`, logs, ...) add no result paths.\n- Read-only tools publish `start` after running (so it carries the result paths),\n immediately followed by `end`; mutating tools publish `start` before running and `end`\n after, with the result paths added.\n- `end` adds `ok`, `ms`, and on failure `error` (at most 200 characters). `label` is at\n most 160 characters. `_ts` is the publish time in unix seconds. `end` events are\n realtime only: they are not written to `.events.jsonl` or the replay buffer.\n\n## UI layout\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/ui/layout/{name}` | Session only | `{name, data, updated_at}`; `data` and `updated_at` are `null` if never saved. |\n| PUT | `/api/ui/layout/{name}` | Session only (+CSRF) | `{ok:true, updated_at}`. Body: `{data: <any JSON>}`. |\n\n`name` is `[a-z0-9_-]{1,40}` (else `400`). API keys get `403`. `data` is stored as\nserialized JSON of at most 512 KiB (`413` above); the request body limit is 600 KiB.\nNames starting with `srv-` are reserved for server settings (`403`).\nLayouts are stored in the `ui_layout` table of `memora.db`. The web UI uses them for\n`canvas` (card positions and frames) and `graph` (pinned positions).\n\n## Pins\n\nThe owner\'s pinned notes and folders (the sidebar\'s Pinned list), shared by every\nbrowser and device of the instance.\n\n| Method | Path | Auth | Returns |\n|---|---|---|---|\n| GET | `/api/pins` | Session only | `{count, pins:[{kind, path, position, missing}]}` in display order. |\n| PUT | `/api/pins` | Session only (+CSRF) | Same as GET. Body: `{pins:[{kind, path}]}`, the whole ordered list (reorder, remove). |\n| POST | `/api/pins/pin` | Session only (+CSRF) | Same as GET. Body: `{kind, path, position?}`. Pins an existing note or folder at `position` (default: the end), or moves its pin there; `404` if it does not exist. |\n| POST | `/api/pins/unpin` | Session only (+CSRF) | Same as GET plus `removed`. Body: `{kind, path}`. |\n\n`kind` is `note` or `folder`. `path` is vault-relative as the tree shows it (notes end in\n`.md`): absolute paths, `..`, empty or hidden segments, `\\`, control characters and paths\nover 1024 characters get `400`, as do more than 200 pins. API keys get `403` (agents use\nthe MCP tools `list_pins`, `pin` and `unpin`). Bodies are limited to 256 KiB for `PUT`\nand 8 KiB for `pin`/`unpin` (`413`). `missing` is true when the path no longer exists,\nfor example after a rename outside Memora; such a pin is kept until it is removed.\n\nRenames, moves and deletes done by Memora (HTTP or MCP) rewrite or drop pins in the same\ndatabase transaction, including pins on notes and folders inside a moved folder;\nmoving an item to the trash or deleting it removes its pin, and deleting a folder\nremoves every pin under it. Every change publishes a `pins_changed` realtime event with\nno other data; open browsers reload the list. Pins are stored in the `pin` table of\n`memora.db`.\n\n## Mnemo (built-in agent)\n\nMnemo is the notes agent built into Memora. Every route needs the signed-in\nbrowser session (API keys get `403`, writes need CSRF); the console\'s `/mnemo`\nuses a short local session. Mnemo\'s data lives in `assistant.sqlite3` beside\n`memora.db` (file mode 0600): providers with their API keys sealed\n(ChaCha20-Poly1305, the same key as the server\'s other secrets), models,\npreferences, chats and messages. A key is never returned; providers carry a\nfour-character `key_hint`.\n\n| Method | Path | Returns |\n|---|---|---|\n| GET | `/api/assistant/state` | `{name, ready, providers, models, prefs, tools, defaults}`. `ready` is true when a model can answer. `tools` is the fixed list Mnemo may use. Each model has `thinks`: it can think, so the chat offers a thinking level (Claude 3.7 and later by name; any other model, router aliases included, until its provider refuses both the effort and the thinking fields). A level other than `auto` is sent as `output_config.effort` (Anthropic), `reasoning.effort` (Responses API, OpenAI-compatible servers) or `reasoning_effort` (OpenAI chat and OpenAI-style routers), and left out for a model that refuses it. |\n| POST | `/api/assistant/providers` | Adds or changes a provider. Body: `{id?, kind?, label?, api_style?, base_url?, api_key?, enabled?}`. Up to 20 providers, several of the same type allowed. `id` is the owner\'s own (1-32 characters of `a-z`, `0-9`, `-`; made from `label` when left out; it cannot change, since models are keyed `id/model`). `kind` is `openai`, `anthropic` or `custom` (any OpenAI-compatible server, which needs `base_url`, its `/v1` address); `api_style` is `chat` or `responses` (OpenAI and compatible) or `messages` (Anthropic). For an existing `id`, fields left out keep their value, so `{id, enabled: false}` switches a provider off (its models leave the model pickers). Leaving `api_key` out keeps the saved key; `""` removes it. Returns the state plus `saved` (the id). |\n| POST | `/api/assistant/providers/test` | Body: `{id}`. Lists the provider\'s models as a connection check: `{ok, models, ms}` or `{ok: false, error}`. |\n| POST | `/api/assistant/providers/delete` | Body: `{id}`. Removes the provider, its key and its models. |\n| POST | `/api/assistant/models/fetch` | Body: `{provider}`. Reads the provider\'s model list (`GET <base>/models`, every page for Anthropic) with the limits it reports: the context window from `max_input_tokens`, `context_length`, `context_window`, `max_context_length` or `max_model_len`, and the reply limit from `max_tokens` or `max_completion_tokens`. Pinned models stay; unpinned ones the provider no longer lists go. Returns the state plus `fetched`. `502` when the provider refuses. |\n| POST | `/api/assistant/models` | Body: `{provider, model, label?, context_window?, max_output?, pinned?, hidden?}`. Adds a model by hand or changes it; `null` clears a limit. The app sets only pinned, hidden and new models; limits normally come from the provider. |\n| POST | `/api/assistant/models/delete` | Body: `{provider, model}`. |\n| POST | `/api/assistant/prefs` | Any of `default_model` (`provider/model`), `system_prompt` (up to 4000 characters), `temperature` (0-2), `max_output_tokens` (64-200000), `context_tokens` (2000-2000000, for models without a window), `max_steps` (1-30 tool rounds per reply), `launcher` (the floating button), `thinking` (`auto`, `off`, `low`, `medium` or `high`: how hard models that can think do so; `auto` leaves it to the model), `fallback_models` (up to 5 `provider/model` keys: when a reply\'s model fails after its retries, Mnemo carries on with the next one, streamed as `fallback {from, model, reason}`; with none left the error stands and the owner tries again); `null` resets one. |\n| GET | `/api/assistant/sessions` | `{sessions: [{id, title, scope, model, pinned, created_at, updated_at, messages, running, seen}]}`. `messages` counts the owner\'s and Mnemo\'s messages (not tool results); `?about=<path>` lists only the chats about that note or folder (kept for it, with it attached, or naming it in a tool call). `seen` is how many of them the owner has read on any device (the unread count is `messages - seen`). The first list after 2.1.5 counts every existing chat as read. |\n| POST | `/api/assistant/sessions` | Body: `{scope?, model?, title?, fleeting?}`. A fleeting chat is left out of lists, search and Mnemo\'s look-back tools and is deleted (with the pictures sent in it) by `.../delete` when the owner leaves, or after 30 minutes idle. `scope` is `global`, `note:<path>` or `folder:<path>`. Returns `{session}`. |\n| GET | `/api/assistant/sessions/{id}` | `{session, messages: [{id, role, content, tool_calls, tool_call_id, tool_name, meta, created_at}], context}`. `context` is `{used, window, reserved_output, compact_at, compactions, model}` for the model the chat would use now (approximate tokens), or `null` without a usable model. A message with `meta.compact: true` is a summary that stands in for every message before `meta.keep_from`. |\n| GET | `/api/assistant/search` | Query `q` (every word must appear, any case), `limit` (default 60, at most 200). `{query, hits: [{chat, title, scope, message_id, role, snippet, at}]}`, newest first: the owner\'s messages and Mnemo\'s replies whose text or chat title holds the words; `message_id` is `null` for a chat matched by its title alone. |\n| POST | `/api/assistant/sessions/{id}/rerun` | Body: `{message_id?, model?}` (default: the last of the owner\'s messages). Runs that message\'s turn again: every message after it is removed, then the reply streams as for `/chat`. `400` when `message_id` is not one of the owner\'s messages in the chat, `409` while it answers. |\n| POST | `/api/assistant/sessions/{id}/steer` | Body: as for `/chat`. Send this message now: the reply running is cut where it is (what it wrote so far is kept, `meta.stopped`) and Mnemo answers this message as a new turn; with no reply running it goes at once. `{ok, queue}`. (Older chats may hold `meta.steer` messages from before 2.1.9.) |\n| GET | `/api/assistant/sessions/{id}/queue` | `{items: [{id, text, attach, at}], held}`: messages waiting for the reply running. They go out one by one, on the server, as each reply ends (finished, stopped or cut), whichever device queued them. A failed reply pauses the queue (`held`) until a message is sent now or the queue resumes. Kept in memory: a restart empties it. |\n| POST | `/api/assistant/sessions/{id}/queue` | Body: as for `/chat`. Queue a message (it goes at once when no reply runs). `{id, queue}`. |\n| POST | `/api/assistant/sessions/{id}/queue/{qid}` | Body: `{op: del \\| up \\| down \\| move \\| send, to?}` (`to` the new place for `move`). `send` puts it first and sends it now, cutting the reply running. `{qid}` may also be `clear` (drop every queued message) or `resume` (let a paused queue go on). Answers with the queue. |\n| GET | `/api/assistant/sessions/{id}/watch` | What happens in the chat from now on, as server-sent events, so every device with it open stays in step: `hello {running}`, `user {message, via, client}` (a message stored from any device or out of the queue; `client` is the id the sender put in its request), `running`, `idle {outcome}` (`done`, `stopped`, `failed`), `queue {items, held}`, `queue_error {message}`, `compacted`, `reload` (turns were replaced: read the chat again). |\n| GET | `/api/assistant/sessions/{id}/live` | The reply running in the chat as server-sent events: every event since it began, then live, until it ends. `204` when none is running. |\n| GET | `/api/assistant/sessions/{id}/export` | The chat as a Markdown file (`text/markdown`, a download): each message with its time, Mnemo\'s steps, what it showed, compaction summaries. |\n| GET | `/api/assistant/skills` | `{folder: "Skills", skills: [{name, path, description}]}`: the owner\'s skills (notes in `Skills/`). A message starting `/name` sends that skill\'s steps with it (`meta.skill`). |\n| GET | `/api/assistant/suggestions` | `{own, ai}`: the owner\'s suggestions and Mnemo\'s (from recent notes; written again in the background when older than 12 hours). |\n| POST | `/api/assistant/suggestions` | Body `{own: [text]}` (up to 30): the owner\'s own suggestions. |\n| POST | `/api/assistant/suggestions/refresh` | Mnemo writes its suggestions again now. `{own, ai, fresh}`. |\n| POST | `/api/assistant/sessions/prune` | Delete many chats: body `{ids}`, `{older_than_days}` (1 to 3650; not active for that long) or `{all: true}`, with `keep_pinned` (default `true`, used with age or all). Chats answering right now are skipped. `{deleted, skipped}`. |\n| POST | `/api/assistant/sessions/{id}/seen` | Body: `{messages}`. The owner has read the chat up to `messages` (capped at what it holds; never goes back). `{ok, seen}`. |\n| POST | `/api/assistant/sessions/{id}/stop` | End the reply running in the chat; what it wrote so far is kept (`meta.stopped`) and the next queued message goes out. `{stopped}`. |\n| POST | `/api/assistant/sessions/{id}/compact` | Fold the older turns into a summary now (the chat\'s model writes it; the last turn stays as it is). `{ok: true, messages, tokens, summary, context}`, or `{ok: false, reason, context}` when there is nothing older yet. `409` while the chat is answering. |\n| POST | `/api/assistant/sessions/{id}` | Body: `{title?, model?, pinned?}`. A chat keeps its `model` (set when it is created, from the request or the default model at that time); a reply uses it while it is listed and its provider can answer, else the default model, then the fallback models, then the first pinned or visible one. When a fallback model takes over a reply, the chat\'s `model` becomes that model and the reply\'s stored message carries `meta.fallback_from`. |\n| POST | `/api/assistant/sessions/{id}/delete` | Deletes the chat and its messages (notes are not touched). |\n| POST | `/api/assistant/sessions/{id}/chat` | Body: `{text, model?, attach?, tz?, tz_offset?, answer?}` (`answer` `{to, approve?, other?}` answers one of Mnemo\'s questions by its call id; `approve` is set when the tapped option approves a change) (`tz` an IANA zone name and `tz_offset` minutes east of UTC, from the browser, for Mnemo\'s `current_time`). `attach` lists up to 8 items `{kind, path}`: `note` (its text, up to 8000 characters), `folder` (the notes in it, up to 200) or `image` (`path` is an id from `/api/assistant/uploads`). A snapshot of them is stored with the message (`meta.attach`, `meta.context`) and stays in the chat\'s context. Replies as server-sent events, one JSON object per `data:` line: `start {model, context}`, `ask {id, question, options: [{label, description, approve}], allow_other}` (Mnemo\'s `ask_owner`: the reply ends and waits for the answer), `steered {text}`, `compacting` and `compacted {messages, tokens}` (the chat was near full and its older messages were folded into a summary first), `thinking {delta}` (the model\'s thinking, where the provider shows it), `text {delta}`, `tool_start {id, name, args}`, `tool_end {id, name, ok, summary, ms}`, `notice {text}`, `error {message}`, `done {input_tokens, output_tokens, title, context}`. `409` while the chat is already answering (queue it instead). Also `compact_text {delta}` (the summary as it is written, before `compacted {messages, tokens, summary}`) and `fallback {from, model, reason, detail}` (the model failed: `reason` in a few words, `detail` the provider\'s error; the next fallback model answers and becomes the chat\'s model). A model out of quota, refused or not found is not retried. A body may carry `client` (any short id) so the sender can tell its own message in `/watch`. The reply runs on the server: closing the stream does not stop it (watch it again with `/live`, end it with `/stop`); `GET /api/assistant/sessions` and `GET /api/assistant/sessions/{id}` say `running` meanwhile. |\n| POST | `/api/assistant/uploads?name=<file>` | The raw bytes of a PNG, JPEG, WebP or GIF (the Images upload limit applies): `{id, name, bytes, url}`. The image waits in `assistant-uploads/` in the state folder for a week. Attached to a chat message, it goes to the model as an image (OpenAI `image_url`, Responses `input_image`, Anthropic `image` blocks; the newest 6 images of the chat, each up to 4.5 MB; a model that refuses images gets their names instead), and Mnemo\'s `place_image` tool can put it beside a note through MCP `upload_image`. |\n| GET | `/api/assistant/uploads/{id}` | The staged image, for the chat\'s thumbnails. |\n\nMnemo runs its tools through the MCP server under the name **Mnemo** (actor id\n`mnemo`), so every call shows in Activity and respects tools switched off on the\nTools page. It has one tool of its own, `place_image {upload, note, name?, alt?,\nappend?}`, which hands a staged chat image to `upload_image` (and is off when\nthat tool is off).\n\nThinking: Anthropic models are asked for adaptive thinking with summaries\n(models that refuse the field are asked without it from then on), OpenAI GPT-5\nand o-series models on the Responses API for reasoning summaries, and\nOpenAI-compatible servers stream `reasoning_content` or `reasoning` on their\nown. A Claude reply that carried thinking is stored block for block\n(`meta.raw`) and sent back verbatim, and each chat keeps the system prompt it\nstarted with (`meta.system` on its first message), so the model\'s earlier\nthinking stays valid. Thinking from before a compaction is not replayed, and\nwhen the API refuses a replayed thinking block the request is sent again\nwithout it. Permission (`POST /api/assistant/prefs` `{permission: "ask" | "auto"}`, default `ask`): in Ask first mode a tool call that would change notes is refused until the owner\'s latest message approves (an `answer` with `approve: true`, or an `@mnemo:` request from a note); Auto lets changes through and runs up to 40 steps a reply (25 otherwise; `max_steps` overrides, up to 60). Besides `place_image` it has `ask_owner` (a question with 2 to 5 options and Other), `current_time` (date, time, weekday and the owner\'s time zone), `search_docs` and `read_docs` (Memora\'s own documentation, from `mnemo-docs.json` the web build writes next to the assets; answers link `/docs/<page>#<heading>`), `show_items` (cards in the reply for notes, folders,\nimages or the vault; `tool_end` carries the checked items as `shown`) and tools of its own over its chats: `list_chats` (newest first, optionally by\ntitle), `search_chats` (every word, newest first) and `read_chat` (one chat\'s\nmessages, 60 at a time with `page`), for when the owner refers to an earlier\nconversation; and over the pages it wrote (```` ```html ```` / ```` ```svg ```` blocks\nin its replies, named by their `<title>`; the same title again is a newer version):\n`list_artifacts` (across chats or in one) and `read_artifact` (a page\'s source, the\nlatest version unless `version` is given), so it reworks a page instead of starting\nover and can reuse one from another chat. Pages live in their chat\'s messages and\nare deleted with it. It may use 54 tools for reading and looking after notes, folders,\ntags, links, pins, history and the Trash; it never gets `delete_memory`,\n`bulk_delete`, `delete_folder`, export or import, admin or web tools. A line with `@mnemo: <request>` in a note (outside code; a struck\n`~~@mnemo: …~~` is done) is a request to Mnemo: a few seconds after the owner\nsaves the note (`POST /api/save` or `/api/create`), or after an agent\'s tool\ncall changes it (Mnemo\'s own changes from a chat or the console too; not those\nit makes while answering a request), Mnemo runs it in the note\'s chat (one per\nnote, titled `@mnemo · <note>`, scope `note:<path>`; every later request in the\nnote joins it, unless it is answering right now; each request\'s message holds it\nas written, `meta.mention` says `{path, line, by}` and `meta.attach` names\nthe note), then saves the note with\nthe request struck through and its reply quoted under it. Activity events of\nMnemo\'s tool calls carry `for` ("owner · chat", "owner · console",\n"<who> · @mnemo in <note>"). A chat keeps\nits whole conversation for its model: when its history fills all the tokens it\nmay use (the model\'s context minus the room kept for the reply), the chat\'s model folds the older turns into a summary (stored as a\nmessage with `meta.compact`, sent in front of the kept turns) before the next\nreply, keeping the last one or two turns as they are. Only if that fails are the\noldest turns left out (a reply and its tool results always stay together).\n\n## Status codes\n\n| Code | Meaning |\n|---|---|\n| 200 | Success. |\n| 201 | OAuth client registered. |\n| 202 | MCP notification accepted. |\n| 204 | `/favicon.ico`. |\n| 302 | Redirect (pages to `/login` without a session, `/login` to `/` when signed in, logout to `/login`, locked instance to `/login?locked=1`, `/oauth/authorize` to the consent page). |\n| 304 | Not modified (`/api/vault/file`, static assets). |\n| 400 | Bad request, for example a missing required field or an invalid value. |\n| 401 | Missing or invalid credentials, or a session-only endpoint called without a session. |\n| 403 | Blocked by an access rule, a CSRF origin mismatch, a missing key scope, a wrong password or setup code, or an endpoint that needs an open setup or reset window. |\n| 404 | Note, key, session, rule, or route not found; also any request for a host outside the domain list. |\n| 405 | `/mcp` called with a method other than `POST`. |\n| 408 | The request took longer than 30 seconds. |\n| 409 | No vault configured (`needs_vault: true`), or a state conflict. |\n| 413 | Body, layout, image, or event too large. |\n| 415 | `/api/vault/file` path is not an image. |\n| 423 | Instance is LOCKED. |\n| 429 | Rate limit or failed-attempt cooldown (`Retry-After` header). |\n| 500 | Internal error, for example the state database failed. |\n| 503 | UI assets are not installed, the password hashing pool is busy, or too many realtime clients. |\n',SY=`# Deployment
|
|
13260
13260
|
|
|
13261
13261
|
This guide covers health checks, running Memora behind a reverse proxy, in a
|
|
13262
13262
|
container, and under systemd, first-run and recovery, backups, and upgrades.
|
|
@@ -13681,6 +13681,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
13681
13681
|
|
|
13682
13682
|
## [Unreleased]
|
|
13683
13683
|
|
|
13684
|
+
## [2.1.11] - 2026-11-18
|
|
13685
|
+
|
|
13686
|
+
### Changed
|
|
13687
|
+
|
|
13688
|
+
- The Think chip shows for every model that is not an old Claude model,
|
|
13689
|
+
router aliases included, so the thinking level can be set even when the
|
|
13690
|
+
model's name says nothing. It hides once the provider refuses both the
|
|
13691
|
+
effort and the thinking fields.
|
|
13692
|
+
|
|
13684
13693
|
## [2.1.10] - 2026-11-18
|
|
13685
13694
|
|
|
13686
13695
|
Each chat keeps its own model, and a model change is always marked.
|