Two new openclaw tools that let an agent reclaim ctx tokens consumed by
past tool results once it has extracted what it needs:
list-tool-results — enumerates past toolResults in the agent's own
session jsonl (size, tool name, turns-ago, args summary, already-
trimmed flag); does NOT return content body
trim-tool-result — replaces a past toolResult's content[].text with a
short sentinel-tagged replacement, identified by tool_call_id
The actual file rewrite is deferred to the `agent_end` hook (drained
from an in-memory queue) because writing during tool execute() trips
openclaw's session-file fence (EmbeddedAttemptSessionTakeoverError) —
the fingerprint check around releaseForPrompt rejects third-party
writes. By agent_end the lock window is closed and the next turn's
fence baseline picks up our mutation cleanly.
Queue-time validation rejects bad tool_call_ids up-front so weak
models that confuse opaque call_function_*_N ids with topic/fact
numeric ids get a clear error instead of a silent skip at drain time.
install.mjs now auto-sets plugins.entries.padded-cell.hooks.
allowConversationAccess=true (required for the agent_end hook on
non-bundled plugins; without it the drain never fires and queued
trims rot in memory).
Sim-verified end-to-end: model dispatches trim, drain fires on
agent_end, next turn's list shows already_trimmed=true.
31 lines
745 B
JSON
31 lines
745 B
JSON
{
|
|
"id": "padded-cell",
|
|
"name": "PaddedCell",
|
|
"description": "Secure secret management, agent identity management, safe execution, and coordinated agent restart",
|
|
"activation": {
|
|
"onStartup": true
|
|
},
|
|
"contracts": {
|
|
"tools": [
|
|
"pcexec",
|
|
"proxy-pcexec",
|
|
"safe_restart",
|
|
"trim-tool-result",
|
|
"list-tool-results"
|
|
]
|
|
},
|
|
"configSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"enabled": { "type": "boolean", "default": true },
|
|
"secretMgrPath": { "type": "string", "default": "" },
|
|
"openclawProfilePath": { "type": "string", "default": "" },
|
|
"proxyAllowlist": {
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"default": []
|
|
}
|
|
}
|
|
}
|
|
}
|