From a13ec6aa94550bce5caaee6bc01e690cabb5d4dc Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Thu, 26 Mar 2026 09:06:03 +0000 Subject: update elaboration prompt to use structured acceptance_criteria schema Co-Authored-By: Claude Sonnet 4.6 --- internal/api/elaborate.go | 8 ++++++-- internal/api/elaborate_test.go | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'internal/api') diff --git a/internal/api/elaborate.go b/internal/api/elaborate.go index 37380c2..6ddb64f 100644 --- a/internal/api/elaborate.go +++ b/internal/api/elaborate.go @@ -327,7 +327,9 @@ Output ONLY valid JSON matching this schema: ], "validation": { "type": "build|test|smoke", - "acceptance_criteria": [{"name": "...", "verification": "...", "test_ref": "optional"}], + "acceptance_criteria": [ + {"name": "criterion name", "verification": "how to verify (e.g. run test X, curl Y)", "test_ref": "optional: TestFuncName or file:line"} + ], "success_criteria": "what success looks like" } } @@ -337,7 +339,9 @@ Rules: - Subtasks within a task are order-dependent and run sequentially - Instructions must include specific file paths, function names, and exact changes - Instructions must end with: git add -A && git commit -m "..." && git push origin -- Validation should match the scope: small change = build check; new feature = smoke test` +- Validation should match the scope: small change = build check; new feature = smoke test +- Each acceptance criterion must be independently verifiable (e.g. a curl command, a specific test run, a file check) +- Include a test_ref when a specific test covers the criterion (e.g. "TestFoo" or "internal/api/foo_test.go:42")` } func (s *Server) elaborateStoryWithClaude(ctx context.Context, workDir, goal string) (*elaboratedStory, error) { diff --git a/internal/api/elaborate_test.go b/internal/api/elaborate_test.go index 34269e9..69bb1dc 100644 --- a/internal/api/elaborate_test.go +++ b/internal/api/elaborate_test.go @@ -477,6 +477,19 @@ func TestElaborateTask_NoRawNarrativeWithoutExplicitProjectDir(t *testing.T) { } } +func TestBuildStoryElaboratePrompt_ContainsAcceptanceCriteriaSchema(t *testing.T) { + prompt := buildStoryElaboratePrompt() + if !strings.Contains(prompt, "acceptance_criteria") { + t.Error("buildStoryElaboratePrompt should contain 'acceptance_criteria'") + } + if !strings.Contains(prompt, "verification") { + t.Error("buildStoryElaboratePrompt should contain 'verification'") + } + if strings.Contains(prompt, `"steps"`) { + t.Error("buildStoryElaboratePrompt should not contain '\"steps\"'") + } +} + func TestElaboratedStoryValidation_AcceptanceCriteriaSchema(t *testing.T) { raw := `{ "type": "test", -- cgit v1.2.3