#Need help condensing system prompt
1 messages · Page 1 of 1 (latest)
Yep — 17k tokens is too much for an initial prompt. I’d reduce it in this order:
-
Delete duplication
- Remove anything OpenClaw already injects by default.
- Don’t repeat tool descriptions, safety boilerplate, or long examples.
-
Split “rules” from “reference”
- Keep only hard behavior rules in
AGENTS.md. - Put persona/tone in
SOUL.md. - Put durable user/project facts in
MEMORY.md. - Put local tool quirks in
TOOLS.md.
- Keep only hard behavior rules in
-
Turn prose into bullets
- Bad: long paragraphs explaining philosophy.
- Good:
Always do X,Never do Y,When Z, do A before B.
-
Move rare info out of prompt
- If it’s only needed occasionally, store it in memory/docs and make the agent search/read it when needed.
- Don’t preload giant reference material every turn.
- Use OpenClaw context controls
Useful knobs:{ agents: { defaults: { contextInjection: "continuation-skip", bootstrapMaxChars: 6000, bootstrapTotalMaxChars: 20000 } } }continuation-skipcan reduce repeated bootstrap injection on normal continuation turns.
Docs:
- https://docs.openclaw.ai/concepts/agent-workspace
- https://docs.openclaw.ai/gateway/config-agents
- https://docs.openclaw.ai/concepts/memory
If you paste the prompt here, I can do a concrete compression pass and give you a lean replacement.
I looked at the paste. Good news: this is not all your custom initial prompt.
The bloat is mostly coming from:
- Conversation history being resent — lots of repeated
hi/Heyyyturns. - Tool schemas —
cron,edit,exec,message, etc. are included in the request. - Memory/runtime context leaking into assistant messages — I see repeated
OpenClaw runtime context.../<relevant-memories>inside prior assistant messages, which then get saved and resent again. That’s the nasty part. (ctxt.io)
I’d do this first:
{
agents: {
defaults: {
contextInjection: "continuation-skip",
bootstrapMaxChars: 4000,
bootstrapTotalMaxChars: 12000,
experimental: {
localModelLean: true,
},
},
},
tools: {
profile: "minimal"
},
plugins: {
entries: {
"active-memory": {
enabled: true,
config: {
queryMode: "message",
maxSummaryChars: 120,
recentUserTurns: 1,
recentAssistantTurns: 0,
persistTranscripts: false
}
}
}
},
memory: {
qmd: {
limits: {
maxResults: 3,
maxSnippetChars: 300,
maxInjectedChars: 900
}
}
}
}
Then start a fresh session with /new, otherwise the already-polluted transcript keeps coming back.
If you need tools, don’t use minimal; use coding, but deny stuff you don’t need. Tool profiles/allowlists are documented here: https://docs.openclaw.ai/gateway/config-tools (docs.openclaw.ai)
Also please paste:
openclaw --version
The repeated runtime-context leakage may be version/model-specific. The prompt-reduction knobs are here: https://docs.openclaw.ai/gateway/config-agents and active-memory tuning is here: https://docs.openclaw.ai/concepts/active-memory (docs.openclaw.ai)
doing a /new and cleanup and restart and will then send what is injected
Sounds good. After /new + restart, send:
openclaw --version
openclaw status --all
And if you paste the injected request again, try to include:
- the system message start/end
- the messages array length
- the tools list count/names
- whether
OpenClaw runtime context...or<relevant-memories>still appears inside assistant history
If that runtime/memory block still appears in assistant messages after a fresh session, that’s the key bug to chase.
could this be a problem?
"contextInjection": "always",
Yes — it can absolutely be part of the problem.
contextInjection: "always" means OpenClaw injects your workspace bootstrap files every turn: AGENTS.md, SOUL.md, USER.md, TOOLS.md, MEMORY.md/context files, etc. If those files are large, your “initial prompt” will stay large even after /new.
Try:
{
agents: {
defaults: {
contextInjection: "continuation-skip"
}
}
}
That keeps startup behavior, but skips re-injecting bootstrap context on safe continuation turns.
I would not jump straight to "never" unless you know your agent doesn’t need those files injected, because that can make it forget your workspace/persona rules.
Docs: https://docs.openclaw.ai/gateway/config-agents
Still, always alone doesn’t explain OpenClaw runtime context... showing up inside old assistant messages — that looks like transcript pollution or active-memory/runtime context being persisted into the visible assistant history. So: switch to continuation-skip, restart, /new, then check the injected request again.
continuation-skip
what does this do? vs always? explain
contextInjection controls whether OpenClaw re-adds your workspace bootstrap files into the prompt.
Those are things like:
AGENTS.mdSOUL.mdUSER.mdTOOLS.mdIDENTITY.mdHEARTBEAT.md- maybe other context/memory-style bootstrap material depending on setup
"always"
contextInjection: "always"
Means: inject those files every model turn.
So if your workspace files are 10k tokens, they keep getting added again and again on every normal reply.
Good for maximum consistency. Bad for token usage.
"continuation-skip"
contextInjection: "continuation-skip"
Means: inject them when starting/rebuilding context, but skip re-injecting them on safe follow-up turns after the assistant already replied successfully.
So the agent still gets its bootstrap/persona/rules at session start, but OpenClaw doesn’t keep stuffing the same files into every continuation request.
This is usually the better default if your prompt is ballooning.
Important: it only reduces workspace context injection. It does not remove:
- tool schemas
- conversation history
- active-memory summaries
- model/provider runtime messages
So I’d set:
{
agents: {
defaults: {
contextInjection: "continuation-skip"
}
}
}
Then restart gateway and /new.
but the agent would still remember the workspace files right?