docs: add context optimization design spec, implementation plan, and pi-layer research#3474
docs: add context optimization design spec, implementation plan, and pi-layer research#3474
Conversation
…pi-layer research - Spec: 6-change design for GSD extension context optimization - Plan: 9-task TDD implementation plan with exact file paths and code - Pi-layer doc: 10 infrastructure opportunities (research only, not planned) Part of #3171, #3406, #3452, #3433. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces PhaseAnchor read/write utilities so downstream agents can inherit decisions, blockers, and intent written at phase boundaries without re-inferring from conversation history. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ent preferences Implement ADR-004 Phase 2 capability scoring with 7-dimension model profiles, task requirement vectors, and weighted scoring. Add ContextManagementConfig preferences for observation masking thresholds. Wire capability scoring into auto-model-selection dispatch path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cation Register observation masker in before_provider_request hook to replace old tool results with placeholders during auto-mode. Add tool result truncation (configurable via context_management.tool_result_max_chars). Inject phase handoff anchors into prompt builders so downstream phases inherit decisions from research/planning. Write anchors after successful phase completion. Update ADR-004 status to Implemented. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ment Update dynamic-model-routing.md with capability-aware scoring section. Update token-optimization.md with observation masking, tool truncation, and phase handoff anchor documentation. Update configuration.md with context_management preference block and capability_routing flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix slice anchor collisions: key anchors by (phase, sliceId) so research-slice/plan-slice anchors from different slices no longer overwrite each other within the same milestone. - Fix payload shape mismatch: context-masker and tool result truncation now handle both internal message format (type field) and provider API formats (role=tool, content arrays with tool_result blocks). - Plumb context_management into KNOWN_PREFERENCE_KEYS and mergePreferences() so the config is properly recognized and merged. - Remove dead compaction_threshold_percent config that was validated and documented but never read at runtime. - Populate structured handoff data in phase anchors by extracting decisions, blockers, and next steps from the artifact files produced by each phase. https://claude.ai/code/session_012ysgpj3kKCNcZdEL7W5eRe
🔴 PR Risk Report — CRITICAL
Affected Systems
File Breakdown
|
Adversarial Review — Context Management & Handoff BehaviorsVerdict: needs-attention This change introduces context-management and handoff behaviors that can silently fail or propagate stale state under realistic runtime conditions. Findings[high] Tool-result truncation misses canonical tool result messages (
Recommendation: Handle the canonical [high] Observation masking can become a no-op for valid Anthropic-style user turns ( Turn detection treats a user turn as Recommendation: Count [medium] Phase anchors written based on artifact existence, not successful unit completion ( Anchor writing is documented as happening after successful research/planning completion, but the guard is Recommendation: Gate anchor writes on explicit successful unit status (and preferably artifact freshness tied to current run timestamp/session) before calling Next Steps
Review generated via Codex adversarial review |
|
think the bot went rogue last night on this, was supposed to be a doc update |
Part of #3171, #3406, #3452, #3433.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com