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

@ -1,8 +1,8 @@
// Session Anchors store — Svelte 5 runes
// Per-project anchor management with re-injection support
import type { SessionAnchor, AnchorType, SessionAnchorRecord } from '../types/anchors';
import { DEFAULT_ANCHOR_SETTINGS } from '../types/anchors';
import type { SessionAnchor, AnchorType, AnchorBudgetScale, SessionAnchorRecord } from '../types/anchors';
import { DEFAULT_ANCHOR_SETTINGS, ANCHOR_BUDGET_SCALE_MAP } from '../types/anchors';
import {
saveSessionAnchors,
loadSessionAnchors,
@ -119,7 +119,11 @@ export async function loadAnchorsForProject(projectId: string): Promise<void> {
}
}
/** Get anchor settings (uses defaults for now — per-project config can be added later) */
export function getAnchorSettings(_projectId: string) {
return DEFAULT_ANCHOR_SETTINGS;
/** Get anchor settings, resolving budget from per-project scale if provided */
export function getAnchorSettings(budgetScale?: AnchorBudgetScale) {
if (!budgetScale) return DEFAULT_ANCHOR_SETTINGS;
return {
...DEFAULT_ANCHOR_SETTINGS,
anchorTokenBudget: ANCHOR_BUDGET_SCALE_MAP[budgetScale],
};
}