Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: raise ≤16GB CPU-only mind numCtx ceiling to 20480

atomanticagent85bebacfb31b
diff --git a/docs/features/persistent-mind-continuous-play.md b/docs/features/persistent-mind-continuous-play.md
index 54d084de73..cc64e026cf 100644
--- a/docs/features/persistent-mind-continuous-play.md
+++ b/docs/features/persistent-mind-continuous-play.md
@@ -32,7 +32,7 @@ Granted via capability `adjustLocalContext` (capabilities schema v8). Semantic t
`server/lib/mindLocalContextClamp.js` refuses oversized windows so CPU-only / low-RAM hosts (including Grok boxes) cannot OOM PortOS:
- Absolute floor **512**, absolute ceiling **131072**
-- CPU-only ceilings tiered by installed RAM (e.g. ≤16 GB → 4096)
+- CPU-only ceilings tiered by installed RAM (e.g. ≤16 GB → 20480)
- Free-memory ceiling reserves **2.5 GB** for PortOS + estimated model weights
- Usable NVIDIA VRAM / Apple Silicon allows higher ceilings
- Rate limit: **6** adjustments / rolling 24 h, **10** minutes apart
diff --git a/server/lib/mindLocalContextClamp.js b/server/lib/mindLocalContextClamp.js
index ea92525a59..f8ab9641ee 100644
--- a/server/lib/mindLocalContextClamp.js
+++ b/server/lib/mindLocalContextClamp.js
@@ -44,10 +44,11 @@ export function cpuOnlyContextCeiling(totalMemoryGb) {
const total = positiveNumber(totalMemoryGb);
if (total == null) return 4096;
if (total < 12) return 2048;
- if (total < 16) return 4096;
- if (total < 24) return 8192;
- if (total < 32) return 16384;
- if (total < 48) return 32768;
+ // ≤16 GB CPU-only (Grok box): live-validated 20480 with PortOS healthy.
+ if (total <= 16) return 20480;
+ if (total < 24) return 24576;
+ if (total < 32) return 32768;
+ if (total < 48) return 49152;
return 65536;
}
diff --git a/server/lib/mindLocalContextClamp.test.js b/server/lib/mindLocalContextClamp.test.js
index db909fcbd6..44d18dde43 100644
--- a/server/lib/mindLocalContextClamp.test.js
+++ b/server/lib/mindLocalContextClamp.test.js
@@ -10,9 +10,10 @@ import {
describe('mindLocalContextClamp', () => {
it('tiers CPU-only ceilings by installed RAM', () => {
expect(cpuOnlyContextCeiling(8)).toBe(2048);
- expect(cpuOnlyContextCeiling(15)).toBe(4096);
- expect(cpuOnlyContextCeiling(20)).toBe(8192);
- expect(cpuOnlyContextCeiling(30)).toBe(16384);
+ expect(cpuOnlyContextCeiling(15)).toBe(20480);
+ expect(cpuOnlyContextCeiling(16)).toBe(20480);
+ expect(cpuOnlyContextCeiling(20)).toBe(24576);
+ expect(cpuOnlyContextCeiling(30)).toBe(32768);
});
it('reserves PortOS headroom when free RAM is tight', () => {
@@ -20,6 +21,23 @@ describe('mindLocalContextClamp', () => {
expect(freeMemoryContextCeiling({ freeMemoryGb: 20, modelSizeGb: 5 })).toBeGreaterThan(8192);
});
+ it('allows Grok-box validated 20480 on ≤16GB CPU-only when free RAM permits', () => {
+ const clamp = resolveMindLocalContextClamp({
+ totalMemoryGb: 16,
+ freeMemoryGb: 20,
+ hasUsableGpu: false,
+ modelSizeGb: 5,
+ });
+ // CPU tier 20480; free RAM after headroom+model still leaves room for that window.
+ expect(clamp.max).toBe(20480);
+ expect(clampMindLocalContextRequest(20480, {
+ totalMemoryGb: 16,
+ freeMemoryGb: 20,
+ hasUsableGpu: false,
+ modelSizeGb: 5,
+ })).toMatchObject({ ok: true, numCtx: 20480 });
+ });
+
it('refuses requests above the safe host ceiling', () => {
const clamp = resolveMindLocalContextClamp({
totalMemoryGb: 15,
@@ -27,7 +45,7 @@ describe('mindLocalContextClamp', () => {
hasUsableGpu: false,
modelSizeGb: 5,
});
- // 15 GB CPU-only tier → 4096; free RAM after headroom+model is tight.
+ // 15 GB CPU-only tier → 20480; free RAM after headroom+model is the tighter clamp.
expect(clamp.max).toBeLessThanOrEqual(4096);
const refused = clampMindLocalContextRequest(65536, {
totalMemoryGb: 15,