feat(session-anchors): configurable budget scale + research-backed truncation fix

Remove 500-char assistant text truncation in anchor serializer — research
consensus (JetBrains NeurIPS 2025, SWE-agent, OpenDev ACC) is that agent
reasoning must never be truncated; only tool outputs get observation-masked.

Add AnchorBudgetScale type with 4 presets (Small=2K, Medium=6K, Large=12K,
Full=20K) and per-project range slider in SettingsTab. Remove Ollama-specific
warning toast — budget slider handles context limits generically.
This commit is contained in:
Hibryda 2026-03-11 03:03:53 +01:00
parent 64e040ebfe
commit 0d9c473a06
9 changed files with 104 additions and 23 deletions

View file

@ -14,7 +14,7 @@
import { getInjectableAnchors, getProjectAnchors, addAnchors, removeAnchor } from '../../stores/anchors.svelte';
import { estimateTokens } from '../../utils/anchor-serializer';
import type { SessionAnchor } from '../../types/anchors';
import { notify } from '../../stores/notifications.svelte';
import AgentTree from './AgentTree.svelte';
import { getHighlighter, highlightCode, escapeHtml } from '../../utils/highlight';
import type {
@ -171,12 +171,6 @@
if (anchors.length > 0) {
// Anchors store pre-serialized content — join them directly
systemPrompt = anchors.map(a => a.content).join('\n');
// Warn if Ollama provider — default context windows (2K-4K) may be too small
if (providerId === 'ollama') {
const anchorTokens = anchors.reduce((sum, a) => sum + a.estimatedTokens, 0);
notify('warning', `Ollama: injecting ~${anchorTokens} anchor tokens into system prompt. Ensure num_ctx >= 8192 to avoid truncation.`);
}
}
}