From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemreboot.net; s=default; t=1795182174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9ikhadX3l0PSSOat6CpDFNUYKWdkUU08RUmjwRZs020=; b=DQODLG+tNadxalqcjpl5y7+7IucCI5KujH09d5kzfpT1rs86Gl5S13KX0gBdvPE4l7IZUo yDdY1YAZx+Ojm/ifrKvLLeMqezII9yMA0sJztgQp1cv/AiMlzvR57AufdC2aywUthSAX0W gtjFo58g1qYsali3TPXEM4iqNVRLcpMFnvzQ8Z+o7aoFr0pzSxmO6Y8/flKc3ueIDuX0MS 1LQu+45/dDKR8qEUiQx9Rizb4NDYfj2EEgHYBDZxe4dDJfHJbhWPoND+3hjEVu4ctpWiUY eYOXfvKzLFvFnisti1kdJDUSyv2/EY80CFpoaZGAw92II7kUARypJrLGqJynyQ== Received: from localhost ( [192.168.1.1]) by hrrol.systemreboot.net (OpenSMTPD) with ESMTPSA id 3d5b5bdc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 20 Nov 2026 13:42:54 +0000 (UTC) From: Arun Isaac To: Ricardo Wurmus Cc: kaagum@systemreboot.net Subject: Re: [PATCH v2 0/5] Context compaction In-Reply-To: <87fqww3v17.fsf@elephly.net> References: <87ik20nycd.fsf@systemreboot.net> <20261115044752.5595-1-arunisaac@systemreboot.net> <87wlq851zs.fsf@elephly.net> <87tslcoe5r.fsf@systemreboot.net> <87ld6o3vum.fsf@elephly.net> <87fqww3v17.fsf@elephly.net> Date: Fri, 20 Nov 2026 13:42:52 +0000 Message-ID: <87a4n3obz7.fsf@systemreboot.net> MIME-Version: 1.0 Content-Type: text/plain List-Id: Hi Ricardo, Looking at your backtrace from earlier, you are missing not just the context-length but also the tokens used (see third frame from the bottom in the backtrace). Not sure how to mitigate this on kaagum's side. Any suggestions? We could estimate the tokens used from the number of characters in the message. But, we can't do much about the context length. Perhaps we should fall back to having a fixed threshold for the tokens used rather than computing the fraction of the context that has been used. Or, perhaps we should only ever use a fixed threshold and not bother to compute the fraction at all. This is what Pi does: https://docs.pi.dev/latest/compaction (look for "reserveTokens"). That page explains that their compaction triggers when contextTokens > contextWindow - reserveTokens Regards, Arun