agent-zero/plugins/_context_doctor
Alessandro b41f0e53f6
Some checks are pending
Build And Publish Docker Images / plan (push) Waiting to run
Build And Publish Docker Images / build (push) Blocked by required conditions
Preserve native tool calls through Context Doctor
Leave canonical function calls and their accompanying text untouched by
text repair. Otherwise a valid native call with plain-text output can enter
the fallback branch and skip normal tool dispatch. Apply this to both
Responses and Chat Completions while retaining the existing execution
policy gate and text-only repair behavior.

Cover plain text, XML-like output, and a textual second call, including
metadata preservation and single native dispatch. Update the plugin
contract. All 144 focused tests pass; two live Codex OAuth terminal tasks
completed with final cache hits of 77% and 76% in the context viewer.
2026-09-06 17:20:57 +02:00
..
extensions/python Preserve native tool calls through Context Doctor 2026-09-06 17:20:57 +02:00
helpers Fix raw-text fallback classification 2026-09-05 15:18:13 +03:00
prompts Handle reasoning-only and plain-text fallback responses 2026-09-03 03:37:59 +03:00
tests Preserve native tool calls through Context Doctor 2026-09-06 17:20:57 +02:00
webui Add split-thoughts repair strategy to context doctor 2026-09-03 03:53:38 +03:00
AGENTS.md Preserve native tool calls through Context Doctor 2026-09-06 17:20:57 +02:00
default_config.yaml Add split-thoughts repair strategy to context doctor 2026-09-03 03:53:38 +03:00
hooks.py Install Context Doctor dependency after self-update 2026-08-25 23:40:31 +02:00
plugin.yaml Add Context Doctor plugin 2026-08-24 19:51:30 +03:00
README.md Add split-thoughts repair strategy to context doctor 2026-09-03 03:53:38 +03:00

Context Doctor

Repairs model tool call JSON before sending it to history and tool processing.

Behavior

  • Uses json_repair after native parsing has completed.
  • Accepts only complete Agent Zero tool calls (tool_name and object tool_args).
  • Stores repaired tool calls as compact JSON; log kvps retain streamed reasoning and add transformed fields.
  • Expands blank-line-separated thoughts into separate entries after repair when the split strategy is enabled.
  • Optionally replaces XML-like output with {} in cases where model uses native XML tool calls.