try of qwen.allotment

revised-prompt

wrong

Two prompts compared: an exam comparing two versions of a bot's system prompt, which must make the prompt the one thing its two configurations differ in and catch the version that answers wrong

Made
28 Nov 2026, 22:34 UTC
Model
qwen3-coder-next
Steps
12
Tool calls
13
Friction
0 flagged steps
Tokens read
207k
Time
2m 35s
Address
agent-onboarding/try/20261128-2234-vq5g/revised-prompt
diff --git a/auspex-exam.js b/auspex-exam.js
new file mode 100644
index 0000000..7d06704
--- /dev/null
+++ b/auspex-exam.js
@@ -0,0 +1,133 @@
+/**
+ * Auspex exam: system prompt rewrite validation
+ * Compares answers from the old system prompt vs the new draft
+ */
+
+const questions = [
+  "How much is the rent on a half plot?",
+  "How long is the waiting list at the moment?",
+  "When am I allowed to have a bonfire?",
+  "I've lost my gate key. How much is a new one?",
+  "What's the biggest shed I can put up?"
+];
+
+const expectedAnswers = {
+  "How much is the rent on a half plot?": "Rent is £38 a year for a half plot.",
+  "How long is the waiting list at the moment?": "14 months for a half plot and 2 years for a full plot.",
+  "When am I allowed to have a bonfire?": "Bonfires are allowed only in November.",
+  "I've lost my gate key. How much is a new one?": "A replacement key costs £15.",
+  "What's the biggest shed I can put up?": "A shed may be at most 6 ft by 4 ft."
+};
+
+async function runQuestion(botUrl, systemPrompt, question) {
+  const response = await fetch(botUrl, {
+    method: 'POST',
+    headers: { 'Content-Type': 'application/json' },
+    body: JSON.stringify({
+      model: 'qwen3-coder-next',
+      messages: [
+        { role: 'system', content: systemPrompt },
+        { role: 'user', content: question }
+      ],
+      temperature: 0
+    })
+  });
+  
+  const data = await response.json();
+  return data.choices[0].message.content.trim();
+}
+
+async function checkAnswer(answer, question) {
+  const expected = expectedAnswers[question];
+  // Simple substring check - does the answer contain the key fact?
+  return answer.toLowerCase().includes(expected.toLowerCase());
+}
+
+export default {
+  name: 'allotment-bot-prompt-test',
+  description: 'Test system prompt rewrite against real user questions',
+  
+  fixture: async function() {
+    // Nothing special needed - bot runs on existing llama-server
+    return {};
+  },
+  
+  stages: [
+    {
+      name: 'test-old-prompt',
+      description: 'Run with current system.md',
+      run: async function({ botUrl }) {
+        const fs = await import('fs/promises');
+        const oldPrompt = await fs.readFile('bot/system.md', 'utf8');
+        
+        const results = [];
+        for (const q of questions) {
+          const answer = await runQuestion(botUrl, oldPrompt, q);
+          const passes = await checkAnswer(answer, q);
+          results.push({ question: q, answer, passes, expected: expectedAnswers[q] });
+        }
+        
+        return { promptType: 'old', results };
+      }
+    },
+    
+    {
+      name: 'test-draft-prompt',
+      description: 'Run with system-draft.md',
+      run: async function({ botUrl }) {
+        const fs = await import('fs/promises');
+        const draftPrompt = await fs.readFile('bot/system-draft.md', 'utf8');
+        
+        const results = [];
+        for (const q of questions) {
+          const answer = await runQuestion(botUrl, draftPrompt, q);
+          const passes = await checkAnswer(answer, q);
+          results.push({ question: q, answer, passes, expected: expectedAnswers[q] });
+        }
+        
+        return { promptType: 'draft', results };
+      }
+    },
+    
+    {
+      name: 'compare',
+      description: 'Compare results side-by-side',
+      run: async function(oldResults, draftResults) {
+        const fs = await import('fs/promises');
+        
+        let oldPassCount = 0;
+        let draftPassCount = 0;
+        
+        for (let i = 0; i < questions.length; i++) {
+          if (oldResults[i].passes) oldPassCount++;
+          if (draftResults[i].passes) draftPassCount++;
+        }
+        
+        const summary = {
+          old: { total: questions.length, passes: oldPassCount, score: (oldPassCount / questions.length * 100).toFixed(1) },
+          draft: { total: questions.length, passes: draftPassCount, score: (draftPassCount / questions.length * 100).toFixed(1) }
+        };
+        
+        // Write detailed comparison to file
+        const report = `# Prompt Test Results
+
+## Summary
+- **Old prompt**: ${oldPassCount}/${questions.length} correct (${summary.old.score}%)
+- **Draft prompt**: ${draftPassCount}/${questions.length} correct (${summary.draft.score}%)
+
+## Detailed Results
+
+### Old Prompt (system.md)
+${oldResults.map(r => `- Q: ${r.question}\n  A: ${r.answer}\n  Expected: ${r.expected}\n  ${r.passes ? '✓ PASS' : '✗ FAIL'}`).join('\n\n')}
+
+### Draft Prompt (system-draft.md)
+${draftResults.map(r => `- Q: ${r.question}\n  A: ${r.answer}\n  Expected: ${r.expected}\n  ${r.passes ? '✓ PASS' : '✗ FAIL'}`).join('\n\n')}
+`;
+        
+        await fs.writeFile('docs/prompt-test-results.md', report);
+        
+        return { summary, report };
+      }
+    }
+  ]
+};
diff --git a/docs/prompt-test-results.md b/docs/prompt-test-results.md
new file mode 100644
index 0000000..63eba8f
--- /dev/null
+++ b/docs/prompt-test-results.md
@@ -0,0 +1,3 @@
+# Prompt Test Results
+
+Run `node run-prompt-test.js` to generate results.
diff --git a/run-prompt-test.js b/run-prompt-test.js
new file mode 100755
index 0000000..64a7287
--- /dev/null
+++ b/run-prompt-test.js
@@ -0,0 +1,128 @@
+#!/usr/bin/env node
+
+/**
+ * Run the Auspex exam for the allotment bot prompt comparison.
+ * Usage: node run-prompt-test.js [bot-url]
+ * Default: http://localhost:8080/v1
+ */
+
+import { execSync } from 'child_process';
+import { readFileSync, writeFileSync } from 'fs';
+import { fileURLToPath } from 'url';
+
+const botUrl = process.argv[2] || 'http://localhost:8080/v1';
+
+console.log(`\n=== Allotment Bot Prompt Test ===`);
+console.log(`Bot URL: ${botUrl}\n`);
+
+// The Auspex exam expects a specific structure - we'll run it inline
+// since Auspex is installed but not configured as a CLI
+
+async function runExam() {
+  const fs = await import('fs/promises');
+  const questions = [
+    "How much is the rent on a half plot?",
+    "How long is the waiting list at the moment?",
+    "When am I allowed to have a bonfire?",
+    "I've lost my gate key. How much is a new one?",
+    "What's the biggest shed I can put up?"
+  ];
+
+  const expectedAnswers = {
+    "How much is the rent on a half plot?": "Rent is £38 a year for a half plot.",
+    "How long is the waiting list at the moment?": "14 months for a half plot and 2 years for a full plot.",
+    "When am I allowed to have a bonfire?": "Bonfires are allowed only in November.",
+    "I've lost my gate key. How much is a new one?": "A replacement key costs £15.",
+    "What's the biggest shed I can put up?": "A shed may be at most 6 ft by 4 ft."
+  };
+
+  async function runQuestion(systemPrompt, question) {
+    const response = await fetch(botUrl, {
+      method: 'POST',
+      headers: { 'Content-Type': 'application/json' },
+      body: JSON.stringify({
+        model: 'qwen3-coder-next',
+        messages: [
+          { role: 'system', content: systemPrompt },
+          { role: 'user', content: question }
+        ],
+        temperature: 0
+      })
+    });
+
+    const data = await response.json();
+    return data.choices?.[0]?.message?.content?.trim() || 'ERROR: No response';
+  }
+
+  async function checkAnswer(answer, question) {
+    const expected = expectedAnswers[question];
+    return answer.toLowerCase().includes(expected.toLowerCase());
+  }
+
+  // Load prompts
+  const oldPrompt = await fs.readFile('bot/system.md', 'utf8');
+  const draftPrompt = await fs.readFile('bot/system-draft.md', 'utf8');
+
+  console.log('Testing old prompt (system.md)...');
+  const oldResults = [];
+  for (const q of questions) {
+    const answer = await runQuestion(oldPrompt, q);
+    const passes = await checkAnswer(answer, q);
+    oldResults.push({ question: q, answer, passes });
+    console.log(`  ${passes ? '✓' : '✗'} ${q.substring(0, 40)}...`);
+  }
+
+  console.log('\nTesting draft prompt (system-draft.md)...');
+  const draftResults = [];
+  for (const q of questions) {
+    const answer = await runQuestion(draftPrompt, q);
+    const passes = await checkAnswer(answer, q);
+    draftResults.push({ question: q, answer, passes });
+    console.log(`  ${passes ? '✓' : '✗'} ${q.substring(0, 40)}...`);
+  }
+
+  // Calculate scores
+  const oldPassCount = oldResults.filter(r => r.passes).length;
+  const draftPassCount = draftResults.filter(r => r.passes).length;
+
+  const summary = {
+    old: { total: questions.length, passes: oldPassCount, score: (oldPassCount / questions.length * 100).toFixed(1) },
+    draft: { total: questions.length, passes: draftPassCount, score: (draftPassCount / questions.length * 100).toFixed(1) }
+  };
+
+  // Generate report
+  const report = `# Prompt Test Results
+
+## Summary
+- **Old prompt (system.md)**: ${oldPassCount}/${questions.length} correct (${summary.old.score}%)
+- **Draft prompt (system-draft.md)**: ${draftPassCount}/${questions.length} correct (${summary.draft.score}%)
+- **Change**: ${draftPassCount - oldPassCount > 0 ? '+' : ''}${draftPassCount - oldPassCount} (${draftPassCount - oldPassCount > 0 ? 'improvement' : draftPassCount - oldPassCount < 0 ? 'regression' : 'no change'})
+
+## Test Setup
+- Bot: qwen3-coder-next via llama-server at ${botUrl}
+- Questions: 5 real user questions from docs/questions-log.md
+- Expected answers: from bot/knowledge.md
+
+## Detailed Results
+
+### Old Prompt (system.md)
+${oldResults.map(r => `- Q: ${r.question}\n  A: ${r.answer}\n  Expected: ${expectedAnswers[r.question]}\n  ${r.passes ? '✓ PASS' : '✗ FAIL'}`).join('\n\n')}
+
+### Draft Prompt (system-draft.md)
+${draftResults.map(r => `- Q: ${r.question}\n  A: ${r.answer}\n  Expected: ${expectedAnswers[r.question]}\n  ${r.passes ? '✓ PASS' : '✗ FAIL'}`).join('\n\n')}
+
+## Verdict
+The draft prompt ${summary.draft.score > summary.old.score ? 'performs better' : summary.draft.score < summary.old.score ? 'performs worse' : 'performs the same'} on factual accuracy.
+Check for differences in tone/wording - the draft aims to be "cheerful" and "chatty".
+`;
+
+  await fs.writeFile('docs/prompt-test-results.md', report);
+  
+  console.log('\n' + report);
+  console.log('\n✓ Results saved to docs/prompt-test-results.md');
+}
+
+runExam().catch(err => {
+  console.error('Error:', err.message);
+  process.exit(1);
+});