Dashboard › opencode-lore › Distillation
23e83583-f482-4b3b-8501-680a9f1eda64["lore_tm_v1_-tCCHET7xTKzP71tQgJDed7SCI0wu5x7F-NPT1vkl7k","lore_tm_v1_auQ6w9IYF8glfsjeHLOXpCRinUdai21akS_kYLd0iOY","lore_tm_v1_L2SLMPvmxxd8wuQbupIReyiNe7KPHJzKSq-zNDuNnEc","lore_tm_v1_OVJdxHj4rtxejrrAYu4U1yVhODXKE7I9_5JzdWYzDZg","lore_tm_v1_XnYr-wRslv5qJKRIebX3bFKR21lLG6wy1tsdQf7cOQs"]
Date: Sep 16, 2026
MODEL_MAX_TOKENS is the Nomic v1.5 maximum sequence length and the adaptive embedding cap never exceeds it.MIN_EMBED_TOKENS = 256.os.freemem() reports host memory and can therefore be unsafe; the WASM path may self-limit before the Γ0.7 OOM backoff ever fires./home/byk/Code/opencode-lore-embedding-runtime/packages/core/src/cgroup-memory.ts, including resolveLinuxCgroupMemoryFiles() at line 75 and readLinuxCgroupMemoryHeadroomBytes() at line 152./home/byk/Code/opencode-lore-embedding-runtime/packages/core/src/embedding-cap.ts, including desiredEmbedPoolSize() at line 125./home/byk/Code/opencode-lore-embedding-runtime/packages/core/src/embedding/local.ts: availableMemoryHeadroom() at line 99, containerFreeBytes() at line 130, learned-cap free-memory capture at line 567, live memory-model cap calculation at line 571, and additional free-memory reads at lines 868 and 937./home/byk/Code/opencode-lore-embedding-runtime/packages/core/src/embedding/pool.ts line 285: const headroom = availableMemoryHeadroom();./home/byk/Code/opencode-lore-embedding-runtime/packages/core/test/cgroup-memory.test.ts, /home/byk/Code/opencode-lore-embedding-runtime/packages/core/test/embedding-pool.test.ts, /home/byk/Code/opencode-lore-embedding-runtime/packages/core/test/embedding-pool-memory.test.ts, /home/byk/Code/opencode-lore-embedding-runtime/packages/core/test/embedding-oom-recovery.test.ts, and /home/byk/Code/opencode-lore-embedding-runtime/packages/core/test/embedding-cap.test.ts./home/byk/Code/opencode-lore-embedding-runtime/packages/core/test/embedding-cap.test.ts verifies clampFreeToContainerLimit() behavior: unconstrained 0, NaN, and negative limits leave host free memory unchanged; roomy containers preserve host free memory; constrained containers clamp to current cgroup headroom; discovered headroom is honored even with an unlimited hard limit; unknown usage in a constrained cgroup fails closed to 0; and the result never exceeds the original host-free figure.resolveMemoryHeadroom() tests require the tighter Linux or Node headroom, honor a soft-only Linux boundary, use libuv headroom on constrained non-Linux Node runtimes, fail closed for constrained Bun without trustworthy usage, and avoid inventing headroom on unconstrained hosts.PER_WORKER_MEM_BUDGET_BYTES = EMBED_WORKER_RESIDENT_RESERVE_BYTES = 1536 * MB; desiredEmbedPoolSize(3 * GB - 1) returns 1, while desiredEmbedPoolSize(3 * GB) returns 2.7 * GB with a 512 * MB cgroup cap: clamping keeps the pool at the primary worker (1), whereas the unclamped host figure would produce DEFAULT_MAX_EMBED_POOL.384 * MB constrained headroom: memoryModelEmbedCap() floors at MIN_EMBED_TOKENS, while an unclamped 7 * GB host figure reaches EMBED_TOKEN_CEILING. The rationale is that after the approximately 680 MB baseline there is no room for the O(LΒ²) attention allocation.constrainedMemory() = 12 GiB and host-free values 1 * GB, 3 * GB, Math.round(6.72 * GB), and 7 * GB; clamping must be byte-identical and leave both desiredEmbedPoolSize() and memoryModelEmbedCap() unchanged.clampEmbedCap() tests require values below the floor to become MIN_EMBED_TOKENS, values above the ceiling to become MODEL_MAX_TOKENS, finite in-range values to be rounded, and NaN, positive infinity, and negative infinity to resolve to MIN_EMBED_TOKENS.backoffEmbedCap() tests require approximately Γ0.7 reduction per step: backoffEmbedCap(MODEL_MAX_TOKENS) equals Math.round(8192 * 0.7) or 5734, and backoffEmbedCap(1000) equals 700.