fix(openab-agent): use XML format for skills prompt#958
Conversation
Align format_skills_prompt with industry standard used by Pi, OpenCode, OpenClaw, and Hermes. Changes: - Switch from markdown bullet list to XML <available_skills> structure - Add explicit <name>, <description>, <location> elements - Strengthen instruction text to mandate skill scanning before reply - Update test to verify XML format output
Change 'clearly matches' to 'matches or may be relevant' per review feedback from 普渡法師. This avoids the agent being too conservative and missing edge-case skill triggers.
|
LGTM ✅ — Skills prompt format aligned with industry standard What This PR DoesFixes the skills prompt injection format so the agent actually knows how to discover and load skills on-demand, matching the approach used by Pi, OpenCode, OpenClaw, and Hermes. How It WorksReplaces the weak markdown bullet list with structured XML Findings
Reviewers
Prior Art
All use structured formats + explicit trigger instructions. Our previous markdown format had neither. |
OpenAB PR ScreeningThis is auto-generated by the OpenAB project-screening flow for context collection and reviewer handoff.
Screening reportdone. posted the screening comment and moved the project item to `PR-Screening`.GitHub comment: #958 (comment) IntentPR #958 tries to make OpenAB's skill-discovery prompt easier for coding agents to parse and act on. The operator-visible problem is that available skills are currently presented as markdown bullets with vague loading guidance, so the agent may miss relevant skills or fail to load the right FeatType: fix. This changes Who It ServesPrimary beneficiary: agent runtime operators. Secondary beneficiaries are maintainers and reviewers, because the prompt contract becomes easier to inspect, test, and compare against other agent systems. Rewritten PromptUpdate
Acceptance criteria: existing skill prompt tests pass, XML structure is asserted, and the instruction clearly states when and how to load a skill. Merge PitchThis is worth advancing because it improves a core agent prompting contract with a small, localized change. The risk profile is moderate-low: the changed surface is one prompt-formatting function and its unit test, but prompt changes can affect agent behavior broadly and should be reviewed for escaping, deterministic output, and compatibility with any downstream consumers that parse or snapshot the prompt. Likely reviewer concern: the PR claims industry-standard XML, but the merge decision should rest on OpenAB behavior and testability, not the strength of the prior-art claim. The concrete value is explicit routing from skill metadata to a readable Best-Practice ComparisonOpenClaw and Hermes are relevant at the prompt-contract level. The PR aligns with structured skill listings, explicit locations, and direct load instructions. Their scheduling, daemon tick, durable persistence, locking, retry, and run-log patterns do not directly apply here. Implementation OptionsConservative: merge the XML prompt format as proposed after checking escaping and deterministic ordering. Balanced: merge the XML format plus stronger tests for empty skill lists, XML-sensitive characters, stable ordering, and exact Ambitious: introduce a first-class Comparison Table
RecommendationTake the balanced path. Advance this PR to review, but ask the reviewer to verify XML escaping and deterministic output before merge. If those are already covered, this is a reasonable small fix. Defer a dedicated skill-loading tool to a separate issue or RFC. That has a larger contract surface and should not block this prompt-format improvement. |
shaun-agent
left a comment
There was a problem hiding this comment.
Found one blocking issue in the XML prompt change: skill metadata is inserted into XML text nodes without escaping. Skill files are repo/user-controlled input, so a name or description containing <, &, or </description> can break the prompt structure and potentially inject extra XML-like instructions.
Proposed fix: escape XML text for <name>, <description>, and <location> before formatting. I have a local patch ready in /home/node/openab-pr958 that adds escape_xml_text plus a regression test covering &, <read>, quotes, apostrophes, and a closing </description> sequence.
I could not run Rust tests locally because this runner has no cargo/rustc; git diff --check passes.
<@1507445470614524087> <@1490707025028448306> please review this proposed fix before I push it to the PR branch.
Merge XML escaping follow-up for PR #958. Includes escaping for skill name, description, and location text nodes, deterministic skill ordering, and regression tests for path escaping and closing-tag injection.
shaun-agent
left a comment
There was a problem hiding this comment.
Re-reviewed after #963 was merged into fix/skills-prompt-format.
The blocking issue from my earlier review is addressed: skill name, description, and location text nodes are XML-escaped, and regression coverage now includes path escaping plus a closing-tag injection case. Deterministic sorting was also added.
Approving from code review. Final merge should still wait for the newly-triggered CI on commit 4902d25 to finish green.
Summary
The current
format_skills_promptuses a markdown bullet list format that LLMs struggle to parse reliably. The agent does not know when or how to load skills because the instruction text is too vague ("when you need") and the path is buried in markdown formatting.This PR aligns our skills prompt with the industry-standard XML format used by all major coding agents.
Discord Discussion URL: https://discord.com/channels/1490282656913559673/1510656502283767819
Changes
<available_skills>format<name>,<description>,<location>elements per skillreadtool to load the full SKILL.md at the listed location and follow its instructions."Prior Art
Researched how 4 major agents handle skill prompt injection:
<available_skills>with<location>readtool on path<available_skills>in skill tool descriptionskill({ name })tool<available_skills>with<location>readtool on pathreadto load the SKILL.md at the listed location"skill_viewtoolskill_view(name)toolAll four use structured formats (XML or dedicated tools) rather than markdown. All include explicit trigger conditions and action instructions. Our previous implementation had neither.
Before (markdown, weak instruction)
After (XML, strong instruction)
Testing