#Context is so High
1 messages · Page 1 of 1 (latest)
First thing: what does openclaw --version show? Version matters a lot for context accounting/debugging.
80k right after /new usually means it is not just your startup files. The context also includes system prompt/project context, injected workspace files, skills list, and tool schemas. Tool schemas in particular can be large and are counted even though you do not see them as normal text.
Best next check in that thread/session:
/context detail
or, if you want the raw breakdown:
/context json
Look for the biggest lines:
Tool schemas (JSON)System prompt/Project Context- injected workspace files like
AGENTS.md,SOUL.md, etc. - any bootstrap truncation warning
Relevant knobs from the config reference:
agents.defaults.bootstrapMaxCharsagents.defaults.bootstrapTotalMaxCharsagents.defaults.startupContext.*for the small /new startup preludeagents.defaults.contextInjection: "continuation-skip"can reduce repeated bootstrap injection on continuation turns, but it will not remove everything from a fresh/new.
Docs: https://docs.openclaw.ai/gateway/configuration-reference and FAQ: https://docs.openclaw.ai/help/faq
If /context detail says tool schemas are the huge chunk, the fix is usually narrowing enabled tools/skills for that agent/session, not shrinking startup files further.
I want to give a prompt to my openclaw to have it do all this for me can you give me one
Yep. Paste this into your local OpenClaw session:
Please investigate why my fresh /new session starts with very high context usage.
First, run/read only safe diagnostic commands. Do not edit config yet.
1. Check my OpenClaw version with:
openclaw --version
2. In this session, run:
/context detail
3. If needed, also run:
/context json
4. Analyze the context breakdown and identify the largest contributors:
- tool schemas
- system prompt / project context
- injected workspace files such as AGENTS.md, SOUL.md, USER.md, TOOLS.md, HEARTBEAT.md, BOOTSTRAP.md
- skills prompt/list
- startupContext memory prelude
- any bootstrap truncation warnings
5. Read the relevant docs before recommending config changes:
- https://docs.openclaw.ai/help/faq
- https://docs.openclaw.ai/gateway/configuration-reference
6. Summarize:
- my OpenClaw version
- current total context tokens after /new
- top 5 context contributors with approximate token/char sizes
- which config knobs are relevant
- a minimal recommended change set
7. Do not make changes until you show me the proposed edits. If you propose config edits, prefer the smallest reversible changes first. Pay special attention to:
- agents.defaults.bootstrapMaxChars
- agents.defaults.bootstrapTotalMaxChars
- agents.defaults.contextInjection
- agents.defaults.startupContext.*
- enabled tools/skills for this agent
Goal: reduce fresh-session context without breaking the agent’s important safety/project instructions.
If it finds that Tool schemas (JSON) is the biggest item, ask it next to inspect which tools are enabled and propose a narrower tool/skill allowlist for that agent. That’s often where the big hidden chunk lives.
Top contributors, approximate:
Codex/developer tool surface: 119 tools exposed here; descriptions alone are ~107,526 chars, including 90 GitHub app tools at ~59,482 chars before JSON schema overhead. This is the dominant likely source of the 100k+ cached baseline.
OpenClaw system prompt text: ~27,034 chars (~6.8k tok), including project context ~16,489 chars (~4.1k tok).
Injected workspace files: about 19.2k injected chars total. Biggest files: TOOLS.md ~5,790, MEMORY.md ~5,624, AGENTS.md ~3,447, SOUL.md ~3,049.
OpenClaw runtime tool schemas in the stored report: ~7,564 chars (~1.9k tok), almost all from message at ~7,504 chars / 109 params.
Startup/memory prelude: not showing as a major contributor in the stored report. Docs say startupContext is bounded separately and default example caps total at ~2,800 chars.
That points pretty strongly away from your startup files.
The big number is the Codex/developer tool surface: 119 tools, ~107k chars before schema overhead. Your OpenClaw runtime tools are only ~1.9k tok, and startupContext is tiny. So shrinking MEMORY.md/startup files further will barely move the 80k baseline.
I’d have your local agent focus on reducing/removing the extra Codex/GitHub tool exposure. Paste this next:
The context report shows the dominant contributor is the Codex/developer tool surface: 119 exposed tools, ~107,526 chars of descriptions, including 90 GitHub app tools at ~59,482 chars before JSON schema overhead.
Please investigate where those GitHub/developer tools are being enabled for this session. Do not edit config yet.
Tasks:
1. Confirm my OpenClaw version with `openclaw --version`.
2. Inspect effective tool/skill/plugin configuration for this agent/session.
3. Identify whether the 90 GitHub app tools come from an MCP server, Codex plugin, OpenClaw plugin, or another connector.
4. Propose the smallest reversible config change to disable or narrow those GitHub/developer tools for normal chat sessions.
5. Before editing anything, show:
- the exact config file/path to change
- the before/after snippet
- what capability I lose
- how to roll it back
Goal: keep normal OpenClaw chat useful while removing the huge hidden tool schema/context payload.
OpenClaw-side knobs worth checking are tools.allow, tools.deny, tools.profile, per-agent agents.list[].tools, plugin allow/deny config, and skill allowlists. Docs: https://docs.openclaw.ai/tools and https://docs.openclaw.ai/gateway/configuration-reference
If those GitHub tools are coming from Codex itself rather than OpenClaw, this may need a Codex/MCP config change instead of an OpenClaw config change. In that case, include openclaw --version and the /context detail excerpt if you file an issue: https://github.com/openclaw/openclaw/issues
Where the 90 GitHub tools come from:
They are exposed as mcp__codex_apps__github_*.
Cached source: /home/jai/.openclaw/agents/main/agent/codex-home/cache/codex_apps_tools/02c2f06f5a3b46480d8e5d805eceb4c9d1830087.json
That cache has total_tools=90, server_name=codex_apps, namespace mcp__codex_apps__github.
Plugin metadata exists under /home/jai/.openclaw/agents/main/agent/codex-home/.tmp/plugins/plugins/github/, with app id connector_76869538009648d5b282a4bb21c3d157.
So: this is not the old OpenClaw github skill. It is the Codex Apps MCP connector / Codex app-server plugin surface. OpenClaw’s codex plugin is the harness that can attach those native Codex app tools, but the visible namespace is the Codex Apps MCP connector.
Yep, that diagnosis makes sense. Important distinction: tools.allow / tools.deny in OpenClaw controls OpenClaw tools, but these mcp__codex_apps__github_* tools are being injected by the native Codex app-server harness. So OpenClaw may not be able to shrink those with normal tool policy knobs.
I would not delete that cache or the .tmp/plugins dir as the primary fix. They’re symptoms/cache. The real fix is to disable or narrow the Codex Apps GitHub connector / MCP server that is feeding Codex.
Next useful checks:
/codex mcp
/codex status
Then ask your local agent:
We confirmed the huge context source is native Codex Apps MCP tools named mcp__codex_apps__github_* from server_name=codex_apps, not OpenClaw runtime tools.