Verdicts first, ranked by results and evidence.
-
Explainer
Pydantic AI: Save and reload message history as JSON
As of November 2026, serialize messages with to_json, reload them with ModelMessagesTypeAdapter.validate_json, and pass the result as message_history on another run. Begin with ModelMessagesTypeAdapter
-
Explainer
Pydantic AI: Keep the five most recent messages
As of November 2026, wrap keep_recent_messages in ProcessHistory to send only the last five messages before each model request. Keep tool calls paired with their results when those exchanges matter. Begin with ProcessHistory
-
Explainer
OpenAI API: Replay history with store=False
As of November 2026, maintain history yourself, append every response.output item and the next user message, and send the full history with store=False on both calls. Start with from openai import OpenAI
-
Explainer
OpenAI API: Prewarm the prompt cache
As of November 2026, prewarm known context without generating output, wait for completion, then send the real question with the same prefix and prewarm omitted or false. Set prompt_cache_options.prewarm
-
Explainer
OpenAI API: Chain turns with previous_response_id
As of November 2026, create a response, then pass its id as previous_response_id on the next request to retain earlier context. The follow-up can explain the first answer. Start with from openai import OpenAI
-
Explainer
Anthropic SDK: Count message tokens before sending
As of November 2026, estimate input tokens for a Claude message before creating it, using the same model, system prompt and messages. Start with client = anthropic.Anthropic()
-
Explainer
Roo Code: set the context condensing threshold
As of November 2026, Set the percentage slider to attempt summarization earlier in long conversations; its default is 100%. Threshold to trigger intelligent context condensing
-
Explainer
LiteLLM: set keepalive for idle streams
As of November 2026, configure deployment SSE pings to keep silent streams active through idle connection timeouts. After the first ping, later failures arrive as SSE frames under status 200. Start with keepalive_seconds
-
Explainer
OpenAI API: set explicit prompt cache breakpoints
As of November 2026, choose cache boundaries with explicit-only mode and mark reusable input blocks; unmarked requests create no cache writes. Start with prompt_cache_options.mode
-
Explainer
Ollama: set a 64000-token context length
As of November 2026, set the serving context to 64000 tokens and inspect allocated context and GPU offloading with ollama ps. Start with OLLAMA_CONTEXT_LENGTH=64000 ollama serve
-
Explainer
OpenAI Agents SDK: Save chat history in SQLite
As of November 2026, pass the same file-backed session to successive agent runs to retain conversation history without manually rebuilding input. Start with SQLiteSession
-
Explainer
Claude Code 2.1.311–312: which session fixes matter?
As of November 2026, update Claude Code to 2.1.331 (checked 2026-11-24) for the session, compaction, MCP and policy fixes shipped across 2.1.311–2.1.312 (checked 2026-10-28); test long sessions, delayed MCP connections, hooks, nested instructions and VS Code sign-in.
-
Explainer
'Not enough messages to compact.' in Claude Code: why?
As of October 2026, Anthropic’s official troubleshooting page says this message means too few conversation turns to summarize, even if one large paste fills the context; fix: no message-specific recovery is given in that section.
-
Explainer
Claude Code: 'Error during compaction: Conversation too long'?
If Claude Code hits the context limit while
/compactis running, the issue was closed by a bot as not planned with no Anthropic reply. Reported workarounds are/compactafter pressing Esc twice,/clear, or compacting earlier; the suggested timing numbers are one commenter's estimate. -
Explainer
How do I start a Claude Code subagent that knows our conversation?
Claude Code's sub-agents docs describe a fork: a subagent that inherits the full conversation, system prompt, tools and model, started with /subtask (v2.1.212 or later; /fork on v2.1.161 to v2.1.211), with its tool calls kept out of your main conversation and only its final result returned.
-
Explainer
Why is Claude Code cutting off my command output, and can I raise it?
As of October 2026, Claude Code's environment variable docs list BASH_MAX_OUTPUT_LENGTH (default 30000 characters, maximum 150000) for how much bash output is read back, and CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS (default 25,000 tokens) for file reads; bigger limits cost context.
-
Explainer
How do I keep my agent remembering across sessions: memory plugin, notes, lessons?
When each Claude Code session repeats corrected mistakes, compare memory plugins or notes, SQLite or Markdown, lesson capture after fixes, correction mining, session resets, and skill trimming; expiring or conflicting memory has no tested answer.
-
Explainer
RAG over PDFs: how do I parse, chunk, embed and build an eval set?
When building question answering over PDFs, compare converters while preserving section hierarchy, benchmark chunk sizes on your documents, evaluate embeddings before re-indexing, check cited evidence and absent answers, and score changes with an eval set. Showing source passages per answer has no tested answer yet.
-
Explainer
Claude Code repeats the same wrong fix after corrections: what now?
As of November 2026, Claude Code’s guide recommends restarting after two failed corrections and putting what you learned into one new prompt. To stop the current action, press Esc; to restart the conversation, use
/clear. -
Explainer
How do I make Claude Code keep going until the tests pass?
As of November 2026, Claude Code's /goal sets a completion condition such as all tests in test/auth pass and lint is clean. After every turn a separate model checks it and Claude keeps working until met, judged impossible, or an error you must fix clears the goal.
-
Explainer
Claude Code forgot details after /compact: how do I steer the summary?
As of October 2026, Claude Code's docs give three controls over compaction: /compact with instructions (for example Focus on the API changes), a Compact instructions section in CLAUDE.md, and Summarize from here in the /rewind menu to condense only part of the conversation.
-
Explainer
I joined a codebase I don't know: how do I learn it with an agent?
As of October 2026, Claude Code's docs suggest starting broad (an overview, architecture patterns, key data models, how auth works), then narrowing, and asking for a glossary of project terms. In an r/ClaudeCode thread commenters add: have it write the architecture notes, but read some code yourself and have the agent poke holes.
-
Explainer
Claude Code: how do I see context and usage limits all the time?
As of October 2026, Claude Code's status line runs a script of yours after each update and passes session JSON on stdin, including context_window.used_percentage and, for Pro, Max and Ultra, rate_limits.five_hour and seven_day. /statusline writes the script for you; popular community configs add git branch and reset timers.
-
Explainer
Why does my Cursor weekly usage vanish so fast, and what spends it?
r/cursor users on the new tiers report limits gone in days: 8 Grok chat messages used about 1.5M tokens (62% cached context) and cloud agents took about 3.3% of a week per hour. Cursor's docs say one weekly pool covers the agent, CLI, Cloud Agents and Grok Bot.
Missing something? Request a thread. Requests with the most votes become the next ones.