Skip to content

Switch agent structured contracts from JSON to XML tags; add XML builder and tests#48

Open
JohnEsleyer wants to merge 3 commits intomainfrom
codex/check-for-json-usage-in-codebase
Open

Switch agent structured contracts from JSON to XML tags; add XML builder and tests#48
JohnEsleyer wants to merge 3 commits intomainfrom
codex/check-for-json-usage-in-codebase

Conversation

@JohnEsleyer
Copy link
Owner

Motivation

  • Standardize the agent structured contract format from JSON envelopes to an XML-tag based contract to simplify parsing and avoid JSON emission in prompts.
  • Ensure the dashboard and agent test flows produce the new XML contract format when simulating file delivery and other actions.
  • Provide a small, deterministic utility to build safe XML contracts and add tests to prevent regressions.

Description

  • Updated examples and guidance in system_prompt.txt and docs/DOCKER_CUBICLES.md to use XML-tagged contracts (<thought>, <message>, <terminal>, <action>) instead of JSON envelopes.
  • Modified the dashboard test prompt in dashboard/src/public/index.html to request XML-tagged contract output from agents.
  • Added shell/src/xml-contract.ts implementing buildXmlContract with entity escaping and imported it into shell/src/server.ts to produce XML contracts in assistant history and to mark contractFormat as xml.
  • Added a new route handler for XML contract tests in shell/src/server.ts that parses and logs XML contracts using existing parsing utilities.
  • Added unit tests shell/tests/xml-contract.test.ts for buildXmlContract behavior and shell/tests/system-prompt-contract.test.ts to assert the system prompt no longer contains JSON examples and includes the XML tags.

Testing

  • Ran the unit test suite with vitest and the new tests xml-contract.test.ts and system-prompt-contract.test.ts passed.
  • Verified buildXmlContract outputs are detected as xml by detectContractFormat and are safely escaped by the tests.
  • Confirmed changes to system_prompt.txt and docs are covered by the contract-format test and did not introduce test regressions.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant