Skip to content

Commit a4b6ffe

Browse files
committed
test(system-prompt): update assertions to match rewritten agent prompt
## Intent Adapt unit tests that were asserting against the old five-sentence prompt to reflect the new structured, meta-level system prompt. ## Key decisions - system-prompt-resource.test.ts: replaced stale string checks ('You are an AI assistant that helps users develop software features', 'development plan') with assertions on the actual new content ('workflow-driven agent', 'plan_file_path', 'clarifying question', etc.); removed the 1000-char upper bound since the prompt is now intentionally more comprehensive; third test now verifies all five named sections are present (Core loop, Before acting, Scope discipline, Subagent delegation, Task management) - resume-workflow.test.ts: removed the 1000-char upper bound (prompt is now ~2250 chars); updated the content assertion from 'workflows server' to 'workflow-driven agent' and 'whats_next()'
1 parent fb8942a commit a4b6ffe

2 files changed

Lines changed: 36 additions & 27 deletions

File tree

packages/mcp-server/test/unit/resume-workflow.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ describe('resume_workflow tool', () => {
6060
const result = await server.handleResumeWorkflow({});
6161

6262
expect(result.system_prompt).toBeTypeOf('string');
63-
// Streamlined prompt is ~400-600 chars (was 2000+ before)
64-
expect(result.system_prompt.length).toBeGreaterThan(200);
65-
expect(result.system_prompt.length).toBeLessThan(1000);
66-
expect(result.system_prompt).toContain('workflows server');
63+
expect(result.system_prompt.length).toBeGreaterThan(500);
64+
expect(result.system_prompt).toContain('workflow-driven agent');
65+
expect(result.system_prompt).toContain('whats_next()');
6766
});
6867

6968
it('should exclude system prompt when requested', async () => {

packages/mcp-server/test/unit/system-prompt-resource.test.ts

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,15 @@ describe('System Prompt Resource', () => {
3030
expect(data.text).toBeDefined();
3131
expect(typeof data.text).toBe('string');
3232

33-
// Verify content contains expected system prompt elements (streamlined version)
34-
expect(data.text).toContain(
35-
'You are an AI assistant that helps users develop software features'
36-
);
37-
expect(data.text).toContain('workflows server');
33+
// Verify content contains expected system prompt elements
34+
expect(data.text).toContain('You are a structured, workflow-driven agent');
3835
expect(data.text).toContain('whats_next()');
3936
expect(data.text).toContain('instructions');
40-
expect(data.text).toContain('development plan');
37+
expect(data.text).toContain('plan_file_path');
4138

42-
// Verify it's concise but not empty (streamlined prompt is ~400 chars)
43-
expect(data.text.length).toBeGreaterThan(200);
44-
expect(data.text.length).toBeLessThan(1000);
39+
// Prompt is more comprehensive now — verify it's substantive but not unbounded
40+
expect(data.text.length).toBeGreaterThan(500);
41+
expect(data.text.length).toBeLessThan(5000);
4542
});
4643

4744
it('should be workflow-independent and consistent', async () => {
@@ -70,14 +67,15 @@ describe('System Prompt Resource', () => {
7067
expect(result1.data!.text).toBe(result2.data!.text);
7168
expect(result2.data!.text).toBe(result3.data!.text);
7269

73-
// Verify the prompt contains standard elements (streamlined version)
74-
expect(result1.data!.text).toContain('You are an AI assistant');
70+
// Verify the prompt contains standard elements
71+
expect(result1.data!.text).toContain(
72+
'You are a structured, workflow-driven agent'
73+
);
7574
expect(result1.data!.text).toContain('whats_next()');
76-
expect(result1.data!.text).toContain('development');
7775
expect(result1.data!.text).toContain('instructions');
7876
});
7977

80-
it('should use streamlined system prompt', async () => {
78+
it('should contain all major sections of the meta-level agent prompt', async () => {
8179
const handler = new SystemPromptResourceHandler();
8280

8381
const result = await handler.handle(
@@ -87,16 +85,28 @@ describe('System Prompt Resource', () => {
8785

8886
expect(result.success).toBe(true);
8987

90-
// The streamlined system prompt should be concise and focused
91-
// It relies on tool responses for detailed phase instructions
92-
expect(result.data!.text).toContain(
93-
'You are an AI assistant that helps users develop software features'
94-
);
95-
expect(result.data!.text).toContain('whats_next()');
96-
expect(result.data!.text).toContain('instructions');
97-
expect(result.data!.text).toContain('development plan');
88+
const text = result.data!.text;
89+
90+
// Core loop section
91+
expect(text).toContain('## Core loop');
92+
expect(text).toContain('whats_next()');
93+
expect(text).toContain('plan_file_path');
94+
95+
// Before acting section
96+
expect(text).toContain('## Before acting');
97+
expect(text).toContain('clarifying question');
98+
99+
// Scope discipline section
100+
expect(text).toContain('## Scope discipline');
101+
expect(text).toContain('proceed_to_phase');
102+
103+
// Subagent delegation section
104+
expect(text).toContain('## Subagent delegation');
105+
expect(text).toContain('Capability hint');
106+
expect(text).toContain('thinking-specialized subagent');
98107

99-
// Streamlined prompt should be concise (~400 chars vs old 2000+)
100-
expect(result.data!.text.length).toBeLessThan(1000);
108+
// Task management section
109+
expect(text).toContain('## Task management');
110+
expect(text).toContain('Do not use your own task management tools.');
101111
});
102112
});

0 commit comments

Comments
 (0)