summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorClaude Agent <agent@claudomator>2026-03-26 09:06:03 +0000
committerClaude Agent <agent@claudomator>2026-03-26 09:06:03 +0000
commita13ec6aa94550bce5caaee6bc01e690cabb5d4dc (patch)
tree997dc2a384c468ce59f1b191bcd23eb6be760a9f /internal/api
parent4affaae6853c260346afe344dfb8d46ff497530f (diff)
update elaboration prompt to use structured acceptance_criteria schema
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/elaborate.go8
-rw-r--r--internal/api/elaborate_test.go13
2 files changed, 19 insertions, 2 deletions
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 <branch>
-- 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",