@@ -370,6 +370,45 @@ describe("ReplayingCapiProxy", () => {
370370 expect ( result . conversations [ 0 ] . messages [ 0 ] . content ) . toBe ( "Say hello." ) ;
371371 } ) ;
372372
373+ test ( "strips skill metadata frontmatter from skill-context user messages" , async ( ) => {
374+ const skillDir = path . join ( workDir , ".test_skills" , "test-skill" ) ;
375+ const requestBody = JSON . stringify ( {
376+ messages : [
377+ {
378+ role : "user" ,
379+ content : `<skill-context name="test-skill">
380+ Base directory for this skill: ${ skillDir }
381+
382+ ---
383+ name: test-skill
384+ description: A test skill that adds a marker to responses
385+ ---
386+
387+ # Test Skill Instructions
388+
389+ Always include PINEAPPLE_COCONUT_42.
390+ </skill-context>` ,
391+ } ,
392+ ] ,
393+ } ) ;
394+ const responseBody = JSON . stringify ( {
395+ choices : [ { message : { role : "assistant" , content : "OK!" } } ] ,
396+ } ) ;
397+
398+ const outputPath = await createProxy ( [
399+ { url : "/chat/completions" , requestBody, responseBody } ,
400+ ] ) ;
401+
402+ const result = await readYamlOutput ( outputPath ) ;
403+ expect ( result . conversations [ 0 ] . messages [ 0 ] . content ) . toBe ( `<skill-context name="test-skill">
404+ Base directory for this skill: ${ workingDirPlaceholder } /.test_skills/test-skill
405+
406+ # Test Skill Instructions
407+
408+ Always include PINEAPPLE_COCONUT_42.
409+ </skill-context>` ) ;
410+ } ) ;
411+
373412 test ( "applies tool result normalizers to tool response content" , async ( ) => {
374413 const requestBody = JSON . stringify ( {
375414 messages : [
0 commit comments