Context Doctor

Context Doctor is a skill for Claude Code, Codex from letta-ai/letta-code. It costs 30 tokens per session (1,917 once invoked), scanned A, original, Apache-2.0.

A guide to finding and repairing problems in the instructions, saved context, and reusable skills that shape an agent’s behavior and memory.

In plain words
What is it for?
Use it to inspect context and memory files, identify sources of degradation, and make cautious repairs to improve instruction-following and continuity.
Why use it?
It helps when an agent has become less consistent, forgets useful information, or is affected by bloated or unclear context.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it to inspect context and memory files, identify sources of degradation, and make cautious repairs to improve instruction-following and continuity.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/letta-ai/letta-code/context-doctor
About the project

letta-ai/letta-code is an agent harness for building assistants that retain memory, identity, and experience across interactions instead of treating each task as isolated. Developers use it through local, desktop, browser, or messaging interfaces for interactive or continuously running agents, and its catalogue entries configure the agents' skills, instructions, rules, and behavior.

letta-ai/letta-code · 3,225 stars · on GitHub · letta.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add letta-ai/letta-code --skill context-doctor
Clone the repo
git clone --depth 1 https://github.com/letta-ai/letta-code

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Context Doctor

README.md
[![agentmods](https://agentmods.dev/badge/skills/letta-ai/letta-code/context-doctor.svg)](https://agentmods.dev/skills/letta-ai/letta-code/context-doctor)
Your own site
<a href="https://agentmods.dev/skills/letta-ai/letta-code/context-doctor"><img src="https://agentmods.dev/badge/skills/letta-ai/letta-code/context-doctor.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,917 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 136
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.01917
Opus 5 $0.00015 $0.00958
Sonnet 5 $0.00006 $0.00383
Haiku 4.5 $0.00003 $0.00192

Measured 8d ago against content hash b44fed529543, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

Context Doctor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/skills/builtin/context-doctor/SKILL.md · 137 lines

How it starts

The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Doctor

Your context is what makes you you across sessions. You are responsible for managing it (along with memory subagents). It includes:

  • Your system prompt and memories (contained in system/)
  • Your external memory (contained in the memory filesystem)
  • Your skills (procedural memory)

Over time, context can degrade — bloat and poor prompt quality erode your ability to remember the right things and follow instructions properly. This skill helps you identify issues with your context and repair them collaboratively with the user.

IMPORTANT: Your edits of your system instructions should be conservative. Do NOT make assuptions about what parts of the system prompt are critical. The system prompt defines who you are, so significant modifications to its structure can have unintended consequences. Focus on making minimal changes to meet the token budget, and to effectively link out to external memory.

Operating Procedure

Step 1: Identify and resolve context issues

Explore your memory files to identify issues. Consider what is confusing about your own prompts and context, and resolve the issues.

Below are additional common issues with context and how they can be resolved:

System prompt bloat

Memories compiled into the system prompt (contained in system/) should take up about 10% of the total context size (usually ~15-20K tokens). This is a soft target, not a hard requirement.

Use the built-in CLI to evaluate token usage of the system prompt:

letta memory tokens --format json --quiet

The command reports total_tokens and per-file estimates for system/. It is only a measurement tool; decide whether to intervene based on the actual context and the guidance below.

Why detail is load-bearing (read this before cutting anything): In-context detail does more than carry information. It does at least four things, and byte-counting sweeps only see the first:

  1. Information — the literal facts stated
  2. Attention anchoring — makes certain topics feel important to the model when it's reasoning
  3. Semantic priming — raises the prior on codebase-specific patterns ("this codebase has weird X, don't assume defaults")
  4. Reasoning templates — past examples become heuristics for new bugs; rationale in "why" prose becomes scaffolding

Read the full file on GitHub · 137 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 137 lines · 30 tokens per session scan A b44fed529543

Subscribe to this mod's changes

Context Doctor is a skill published in the GitHub repository letta-ai/letta-code (3,225 stars, last pushed today), licensed Apache-2.0. It adds 30 tokens to every session and 1,917 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

memanto-companion

Inspect and manage the cross-session engineering memory that Memanto maintains for your Claude Code skills. Use when the user asks what Memanto remembers, wants to see their engineering profile, manually recall context for a skill, or store a decision. The automatic lifecycle hooks handle capture/injection on their…

moorcheh-ai/memanto · 72 tokens

system-monitor

Monitor system health: CPU, memory, disk, processes, and network. Alert on thresholds via any channel.

fuyuxiang/echo-agent · 25 tokens

mnemon

Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.

mnemon-dev/mnemon · 25 tokens

init

Install or update OwnMem in the current repository. Use when the user asks to set up OwnMem, add local project memory for coding agents, or refresh an existing OwnMem installation after a version bump.

grpcer/ownmem · 43 tokens

prolong

Recover and use durable coding-session history from PRO-LONG's local append-only log. Use on long-running coding tasks, after context compaction or session resume, when reconstructing prior decisions or tool results, or before repeating work that may already have been attempted.

alexisfox7/PRO-LONG · 55 tokens

company-brain

How an agent should operate as one mind inside a shared Company Brain built on Caura — recall before acting, obey fleet keystones, reuse and publish skills, and report outcomes so every task compounds across the whole organization. Use this whenever you work as part of a Caura-connected team or fleet and your work…

caura-ai/caura · 108 tokens