fix(block-writer): רתימת חלון-1M של Opus 4.8 לבלוק-י (#216)
הגבול _MAX_PROMPT_CHARS=400_000 היה שומר מלאכותי שתאם את קיר ה-200K-טוקן של בניית-Opus הסטנדרטית (~400K תווים עברית @~2 תווים/טוקן) — לא גבול-מודל. Opus 4.8 מציע חלון 1M-טוקן במחיר רגיל; `claude -p` חושף אותו ישירות כ-model-id `claude-opus-4-8[1m]` (אומת CLI 2.1.196, בלי beta-header). בלוק-י (דיון), שנושא את התיק המלא כ-source-context (805K/891K תווים), נחסם רק ע"י השומר המיושן. שינויים: - block_writer: GENERATION_MODEL_1M + סף אסקלציה _CTX_1M_THRESHOLD_CHARS=350_000. פרומפט > הסף → `[1m]`; אחרת הבנייה הסטנדרטית (בלוקים קטנים נשארים זולים/מהירים). - _MAX_PROMPT_CHARS 400_000 → 1_500_000 (~750K טוקנים; מרווח מתחת ל-1M) כשומר-קשיח סופי גם על בניית-ה-1M; הודעת-השגיאה מפנה לצמצום-source-context. - model_used (provenance) משקף את הבנייה בפועל (200K/[1m]). - claude_session: אזהרת-גודל מעודכנת (350K + רמז ל-[1m]). - ספ 04-analysis-writing §1.3: תיעוד האסקלציה כעידון של אותו pin (לא מסלול מקביל, G2). Invariants: מקיים G2 (אותו מודל-נעוץ, חלון רחב — לא מסלול מקביל), G1, INV-WR*; לא בולע שגיאות (שומר-קשיח סופי נשאר). xhigh לבלוק-י ללא שינוי. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -146,8 +146,15 @@ async def query(
|
||||
"""
|
||||
full_prompt = f"{system}\n\n{prompt}" if system else prompt
|
||||
|
||||
if len(full_prompt) > 150_000:
|
||||
logger.warning("Large prompt: %d chars — may hit context limits", len(full_prompt))
|
||||
# ~350K chars ≈ the 200K-token wall of the default Opus build (~2 Hebrew
|
||||
# chars/token). Above it callers should pass the 1M-context model id
|
||||
# (`claude-opus-4-8[1m]`) — block_writer escalates automatically (#216).
|
||||
if len(full_prompt) > 350_000 and "[1m]" not in (model or ""):
|
||||
logger.warning(
|
||||
"Large prompt: %d chars on a non-[1m] model (%s) — may overflow the "
|
||||
"200K-token context. Pass claude-opus-4-8[1m] for the 1M window.",
|
||||
len(full_prompt), model or "CLI-default",
|
||||
)
|
||||
|
||||
cmd = [
|
||||
"claude", "-p",
|
||||
|
||||
Reference in New Issue
Block a user