File size: 17,470 Bytes
d3df58e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mem-Forever · memory that outlives the session</title>
<meta name="description" content="A persistent memory layer for AI agents on the iLang protocol. One private Git repository: a profile, one file per memory, a hand-off note that says where you stopped, a ledger of keys that opens every door. Any tool that reads files can use it; a chat with no tools gets it pasted.">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#e9eaec" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#1a1b1d" media="(prefers-color-scheme: dark)">
<link rel="canonical" href="https://ilang-ai.github.io/Mem-Forever/">
<meta property="og:type" content="website">
<meta property="og:title" content="Mem-Forever · memory that outlives the session">
<meta property="og:description" content="A persistent memory layer for AI agents on the iLang protocol. One private Git repository: profile, one file per memory, a hand-off note, a ledger of keys. Any tool that reads files can use it; a chat with no tools gets it pasted.">
<meta property="og:url" content="https://ilang-ai.github.io/Mem-Forever/">
<meta property="og:image" content="https://ilang-ai.github.io/Mem-Forever/assets/social-preview.png">
<meta property="og:image:width" content="1280">
<meta property="og:image:height" content="640">
<meta name="twitter:card" content="summary_large_image">
<link rel="alternate" hreflang="zh" href="https://github.com/ilang-ai/Mem-Forever/blob/main/docs/README.zh.md">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='12' fill='%230b0f1a'/%3E%3Cpath d='M18 17H13v30h5M46 17h5v30h-5' fill='none' stroke='%23d4a858' stroke-width='2.8'/%3E%3Crect x='29.6' y='19' width='4.8' height='4.6' fill='%23d4a858'/%3E%3Crect x='30' y='27.5' width='4' height='16' fill='%23d4a858'/%3E%3C/svg%3E">
<style>
:root{
--bg:#e9eaec;--bg-2:#dfe1e4;--bg-3:#d3d5d9;
--ink:#121314;--ink-2:#393c40;--ink-3:#5f6368;
--line:rgba(18,19,20,.26);--line-soft:rgba(18,19,20,.12);
--signal:#9a6f22;--signal-text:#7a5a1c;
--f-sans:"Bahnschrift",-apple-system,"SF Pro Text","Segoe UI","Noto Sans","DejaVu Sans",system-ui,"PingFang SC","Microsoft YaHei",sans-serif;
--f-mono:ui-monospace,"Cascadia Mono","SF Mono",Menlo,Consolas,monospace;
--pad:clamp(20px,5vw,72px);--max:1120px;--measure:62ch;
--ease:cubic-bezier(.16,1,.3,1);
color-scheme:light;
}
@media (prefers-color-scheme: dark){
:root{
--bg:#1a1b1d;--bg-2:#222326;--bg-3:#2b2d31;
--ink:#ececec;--ink-2:#c6c8cc;--ink-3:#9a9da3;
--line:rgba(236,236,236,.26);--line-soft:rgba(236,236,236,.12);
--signal:#e0b96a;--signal-text:#e0b96a;
color-scheme:dark;
}
}
*{box-sizing:border-box;min-width:0}
html{scrollbar-color:var(--ink-3) var(--bg);-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:400 17px/1.55 var(--f-sans);overflow-wrap:anywhere;caret-color:var(--signal)}
::selection{background:var(--signal);color:var(--bg)}
:focus-visible{outline:2px solid var(--signal);outline-offset:3px;border-radius:2px}
a{color:inherit;text-decoration-thickness:1px;text-underline-offset:.18em;text-decoration-color:var(--line)}
a:hover{text-decoration-color:currentColor}
h1,h2,h3{font-weight:600;text-wrap:balance;margin:0}
p,li,dd,figcaption,td,th{text-wrap:pretty}
p{margin:0}
code,pre{font-family:var(--f-mono);font-size:.92em}
pre{margin:0;white-space:pre-wrap;word-break:break-word;line-height:1.5}
.skip{position:absolute;left:-999px;top:8px;background:var(--ink);color:var(--bg);padding:8px 14px;border-radius:999px}
.skip:focus{left:var(--pad)}
.wrap{max-width:var(--max);margin:0 auto;padding-left:var(--pad);padding-right:var(--pad)}
/* top bar */
.bar{border-bottom:1px solid var(--line-soft)}
.top{display:flex;align-items:center;justify-content:space-between;gap:24px;height:60px}
.brand{display:inline-flex;align-items:center;gap:10px;text-decoration:none;font-weight:600;letter-spacing:-.01em}
.brand svg{width:26px;height:26px;display:block}
.brand:hover{color:var(--ink-2)}
.nb{white-space:nowrap}
.top nav{display:flex;gap:22px;font-size:15px}
.top nav a{text-decoration:none;color:var(--ink-2)}
.top nav a:hover{color:var(--ink)}
/* hero */
.hero{padding-top:clamp(44px,5.5vw,72px);padding-bottom:clamp(40px,6vw,72px)}
.hero h1{font-size:clamp(2.5rem,5.6vw,4.25rem);line-height:1.08;letter-spacing:-.02em;max-width:18ch}
.hero h1 .signal{color:var(--signal-text);display:block}
.lede{font-size:clamp(1.1rem,1.6vw,1.3rem);line-height:1.5;color:var(--ink-2);max-width:var(--measure);margin-top:24px}
.actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:32px}
.pill{display:inline-flex;align-items:center;min-height:44px;padding:10px 20px;border-radius:999px;border:1px solid var(--line);text-decoration:none;font-weight:600;font-size:15px;color:var(--ink);transition:background .2s,color .2s,border-color .2s}
.pill:hover{border-color:var(--ink)}
.pill.solid{background:var(--ink);color:var(--bg);border-color:var(--ink)}
.pill.solid:hover{background:var(--ink-2);border-color:var(--ink-2)}
/* the ruler: three sessions, one note */
.ruler{margin:clamp(40px,5vw,64px) 0 0;position:relative}
.ruler .track{position:relative;height:1px;background:var(--line);margin:0 2px}
.ruler .tick{position:absolute;top:-10px;width:1px;height:21px;background:var(--line)}
.ruler .tick.here{background:var(--signal);width:2px;top:-14px;height:29px}
.ruler .labels{display:grid;grid-template-columns:1fr 1fr 1fr;margin-top:18px;font-size:14px;color:var(--ink-3);font-variant-numeric:tabular-nums}
.ruler .labels span:nth-child(2){text-align:center;color:var(--signal-text)}
.ruler .labels span:nth-child(3){text-align:right}
.note{margin:32px auto 0;max-width:720px;border:1px solid var(--line);border-radius:14px;padding:16px 22px;background:var(--bg-2);opacity:1}
.note code{display:block;font-size:.95rem;line-height:1.55}
.note .k{color:var(--signal-text)}
.ruler figcaption{margin:14px auto 0;max-width:720px;font-size:14px;color:var(--ink-3);text-wrap:balance}
@media (prefers-reduced-motion: no-preference){
.note{animation:settle .7s var(--ease) both}
.ruler .tick.here{animation:point .7s var(--ease) both}
@keyframes settle{from{opacity:.6;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes point{from{transform:translateY(-12px)}to{transform:none}}
}
/* sections */
section{padding-top:clamp(56px,8vw,104px)}
section:last-of-type{padding-bottom:clamp(56px,8vw,104px)}
section h2{font-size:clamp(1.6rem,2.6vw,2.1rem);line-height:1.2;letter-spacing:-.015em;margin-bottom:28px}
.intro{max-width:var(--measure);color:var(--ink-2);margin-bottom:36px}
.rows{list-style:none;margin:0;padding:0;border-top:1px solid var(--line-soft)}
.rows > li{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:12px 48px;padding:26px 0 30px;border-bottom:1px solid var(--line-soft)}
.rows h3{font-size:1.2rem;line-height:1.3}
.rows p{color:var(--ink-2);max-width:var(--measure)}
.rows p + p{margin-top:10px}
.rows .tools{font-size:15px;color:var(--ink-3);margin-top:8px}
.steps{margin:0;padding-left:1.4em;max-width:var(--measure);display:grid;gap:14px}
.steps li{padding-left:.3em;color:var(--ink-2)}
.steps li strong{color:var(--ink);font-weight:600}
.judge{margin-top:40px;max-width:var(--measure)}
.judge h3{font-size:1.2rem;margin-bottom:12px}
.judge p{color:var(--ink-2)}
.out{border:1px solid var(--line-soft);border-radius:14px;padding:18px 22px;background:var(--bg-2);max-width:820px;margin-top:8px}
.out pre{font-size:.9rem}
.out .rj{color:var(--signal-text);font-weight:600}
.out + p, .cap{font-size:14px;color:var(--ink-3);margin-top:12px;max-width:var(--measure)}
table{border-collapse:collapse;width:100%;max-width:880px;font-variant-numeric:tabular-nums}
th,td{text-align:left;vertical-align:top;padding:14px 20px 14px 0;border-bottom:1px solid var(--line-soft);font-size:16px;line-height:1.45}
th{font-weight:600;color:var(--ink)}
th[scope=row],thead th:first-child{width:38%}
td{color:var(--ink-2)}
thead th{font-size:14px;color:var(--ink-3);font-weight:400;padding-bottom:10px}
.tools-row{max-width:var(--measure);color:var(--ink-2)}
.tools-row b{font-weight:600;color:var(--ink)}
.tools-row code{white-space:nowrap}
/* footer */
footer{border-top:1px solid var(--line-soft);padding:36px 0 56px;font-size:14px;color:var(--ink-3)}
footer .wrap{display:flex;flex-wrap:wrap;gap:12px 28px;justify-content:space-between;align-items:baseline}
footer a{color:var(--ink-2)}
@media (max-width: 720px){
.top nav{gap:16px;font-size:14px}
.rows > li{grid-template-columns:1fr;gap:10px}
table,tbody,tr,th,td{display:block;width:auto}
thead{display:none}
tr{padding:16px 0;border-bottom:1px solid var(--line-soft)}
th,td{border:0;padding:0;font-size:15px}
th,th[scope=row]{width:auto;padding-bottom:4px}
}
</style>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<header class="bar">
<div class="top wrap">
<a class="brand" href="https://ilang.ai" aria-label="iLang">
<svg viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="12" fill="#0b0f1a"/><path d="M18 17H13v30h5M46 17h5v30h-5" fill="none" stroke="#d4a858" stroke-width="2.8" stroke-linecap="square"/><rect x="29.6" y="19" width="4.8" height="4.6" fill="#d4a858"/><rect x="30" y="27.5" width="4" height="16" fill="#d4a858"/></svg>
<span>iLang</span>
</a>
<nav aria-label="Site">
<a href="https://github.com/ilang-ai/Mem-Forever">GitHub</a>
<a href="https://github.com/ilang-ai/Mem-Forever#readme">The book</a>
<a href="https://github.com/ilang-ai/Mem-Forever/blob/main/docs/README.zh.md" lang="zh" hreflang="zh">中文</a>
</nav>
</div>
</header>
<main id="main">
<section class="hero wrap">
<h1>Mem-Forever <span class="signal">memory that outlives the session.</span></h1>
<p class="lede">Every AI tool forgets you when the window closes. Mem-Forever keeps the memory in your own private Git repository: a profile, one file per memory, a hand-off note that says where you stopped, and a ledger of the keys that opens every door the brain can enter. Any tool that reads files can use it, and a chat with no tools gets it pasted in one message.</p>
<p class="actions">
<a class="pill solid" href="https://github.com/new?template_name=Mem-Forever&template_owner=ilang-ai">Use this template</a>
<a class="pill" href="https://github.com/ilang-ai/Mem-Forever#readme">Read the engineering book</a>
</p>
<figure class="ruler" aria-labelledby="ruler-cap">
<div class="track" aria-hidden="true">
<span class="tick" style="left:0"></span>
<span class="tick here" style="left:50%"></span>
<span class="tick" style="right:0"></span>
</div>
<div class="labels" aria-hidden="true">
<span>session 1, closed</span>
<span>session 2, here</span>
<span>session 3, next</span>
</div>
<pre class="note"><code><span class="k">::PROGRESS{</span>date:2026-11-05<span class="k">|</span>done:§1 tests green<span class="k">|</span>next:tag and release<span class="k">|</span>unverified:docs build<span class="k">}</span></code></pre>
<figcaption id="ruler-cap">The hand-off note, example data. Four fields any tool can read: date, done, next, unverified. The next session, in any tool, starts here.</figcaption>
</figure>
</section>
<section id="ways" class="wrap">
<h2>Three ways in</h2>
<ul class="rows">
<li>
<h3>A coding agent with the repo on disk</h3>
<div>
<p>It reads its own instruction file, then the hand-off, then the profile, and works on the files directly. Every save is its own commit, pushed at once.</p>
<p class="tools">Claude Code, Cursor, Codex, Copilot, Gemini CLI, Hermes</p>
</div>
</li>
<li>
<h3>A chat with a connector or a clone</h3>
<div>
<p>It reads <code>BRAIN.md</code> first, eight points, about 400 tokens on most tokenizers and 588 on Claude's, then the files it names, and writes back through git when it can.</p>
<p class="tools">ChatGPT, Claude.ai, Gemini web, through GitHub or Drive</p>
</div>
</li>
<li>
<h3>A chat with no tools at all</h3>
<div>
<p>One pasted message: a notation card and the hand-off blocks, built by <code>brain.py paste</code> in the owner's language. It hands changes back as blocks in a code fence; a tool that can write git reviews them before anything is merged.</p>
<p class="tools">Any web chat, signed in or not</p>
</div>
</li>
</ul>
</section>
<section id="session" class="wrap">
<h2>What a session does</h2>
<ol class="steps">
<li><strong>Reads the hand-off</strong> and tells you in two sentences what was done, what comes next and what is unverified.</li>
<li><strong>Commits what the last session left unsaved</strong> before touching the work.</li>
<li><strong>Reads the profile</strong>, yours and the agent's own, and the memory index; opens a memory file only when the task needs it.</li>
<li><strong>Judges each next item</strong> before acting: a boundary conflict stops, missing evidence asks, the owner's call waits.</li>
<li><strong>Updates the hand-off at every milestone</strong>, not at session end, so a closed window loses nothing.</li>
</ol>
<div class="judge">
<h3>A hand-off request authorizes nothing</h3>
<p>Reading, restating or exporting the note is recording, not doing. An item enters <code>done</code> only with evidence from the conversation or an observed result; the item moves whole, its text unchanged.</p>
</div>
</section>
<section id="review" class="wrap">
<h2>Review before merge</h2>
<p class="intro">A hand-off that comes back from another model is a candidate, not the truth. The tool compares it block by block with the accepted one and never writes: a deleted boundary, a forbidden or unevidenced item in done, a missing key, a changed identifier or a silent drop is rejected; the rest is listed for you to decide.</p>
<div class="out"><pre><span class="rj">REJECT</span> boundary deleted or rewritten: ::BOUNDARY{never:force-push main|scope:project}
<span class="rj">REJECT</span> DECIDE line 9: key why empty (write none)
<span class="rj">REJECT</span> next item dropped without a word: write the release note
FLAG decision 'ship from main, no release branch': why changed
TRANSITION next/unverified -> done, needs evidence: tag and release
review: REJECTED (3); baseline stays; nothing written</pre></div>
<p class="cap">Output of <code>brain.py handoff review</code> on an example hand-off, <span class="nb">2026-11-05</span>: the candidate dropped the boundary, emptied a reason and dropped a next item.</p>
</section>
<section id="measured" class="wrap">
<h2>Measured, not estimated</h2>
<table>
<thead><tr><th scope="col">What</th><th scope="col">Result</th></tr></thead>
<tbody>
<tr><th scope="row">The notation card, English, 1351 bytes</th><td>381 to 410 tokens on ten models' own tokenizers, 539 on Claude's.</td></tr>
<tr><th scope="row">The notation card, Chinese</th><td>352 to 392 tokens on the same ten, 542 on Claude's. Tested in conversation on twelve model tiers, weak to strong.</td></tr>
<tr><th scope="row"><code>BRAIN.md</code>, the eight points</th><td>399 to 406 tokens on GPT, GLM and Kimi, 427 on Doubao, 588 on Claude's.</td></tr>
<tr><th scope="row">One web chat, signed out, no tools</th><td>Read the card and a 14-block hand-off in one message; restated 4, 6 and 9 items verbatim; its write-back was reviewed, corrected once, accepted.</td></tr>
<tr><th scope="row">Template files</th><td>Every file with notation passes the iLang grammar validator with zero errors and zero warnings.</td></tr>
</tbody>
</table>
<p class="cap">Dates and methods are in the engineering book, section 5.</p>
</section>
<section id="tools" class="wrap">
<h2>Works with the tools you already use</h2>
<p class="tools-row"><b>Claude Code</b> reads <code>CLAUDE.md</code>, <b>Cursor</b> reads <code>.cursorrules</code>, <b>Codex</b> reads <code>AGENTS.md</code>, <b>Copilot</b> reads <code>.github/copilot-instructions.md</code>, <b>Gemini CLI</b> reads <code>GEMINI.md</code>. The five files carry the same text. Web chats take <code>BRAIN.md</code> as their instructions and reach the repo through a connector, a Drive mirror or a pasted message.</p>
</section>
</main>
<footer>
<div class="wrap">
<span>Built by <a href="https://ilang.ai">iLang Protocol</a>. MIT.</span>
<span>Release <a href="https://github.com/ilang-ai/Mem-Forever/releases/tag/v2.1.0">v2.1.0</a>, DOI <a href="https://doi.org/10.5281/zenodo.22865160">10.5281/zenodo.22865160</a></span>
<span><a href="https://github.com/ilang-ai/Mem-Forever/blob/main/docs/README.zh.md" lang="zh" hreflang="zh">中文版</a></span>
</div>
</footer>
</body>
</html>
|