Skip to content

Commit 8bd6791

Browse files
committed
Add tiered agent routing and migrate prompt logic tests
1 parent 3d6da09 commit 8bd6791

129 files changed

Lines changed: 3094 additions & 2480 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2026 Gili Tzabari. All rights reserved.
3+
*
4+
* Licensed under the CAT Commercial License.
5+
* See LICENSE.md in the project root for license terms.
6+
*/
7+
package io.github.cowwoc.cat.claude.engine;
8+
9+
import io.github.cowwoc.cat.tool.skills.ModelIdResolver;
10+
import io.github.cowwoc.cat.tool.skills.SprtMetadataResolver;
11+
import tools.jackson.databind.JsonNode;
12+
13+
import java.io.IOException;
14+
import java.nio.file.Path;
15+
16+
import static io.github.cowwoc.requirements13.java.DefaultJavaValidators.requireThat;
17+
18+
/**
19+
* Resolves SPRT model/effort metadata for Claude.
20+
*/
21+
public final class ClaudeSprtMetadataResolver implements SprtMetadataResolver
22+
{
23+
private static final String DEFAULT_TEST_MODEL = "haiku";
24+
private static final String DEFAULT_TEST_EFFORT = "low";
25+
private final String claudeCodeVersion;
26+
27+
/**
28+
* Creates a new resolver.
29+
*
30+
* @param claudeCodeVersion Claude Code version used for model id resolution
31+
*/
32+
public ClaudeSprtMetadataResolver(String claudeCodeVersion)
33+
{
34+
requireThat(claudeCodeVersion, "claudeCodeVersion").isNotBlank();
35+
this.claudeCodeVersion = claudeCodeVersion;
36+
}
37+
38+
@Override
39+
public ResolvedConfig resolve(Path instructionPath, JsonNode frontmatter) throws IOException
40+
{
41+
requireThat(instructionPath, "instructionPath").isNotNull();
42+
requireThat(frontmatter, "frontmatter").isNotNull();
43+
String model = extractStringField(frontmatter, "model");
44+
String effort = extractStringField(frontmatter, "effort");
45+
String source = CONFIG_SOURCE_FRONTMATTER;
46+
if (model.isBlank() && effort.isBlank())
47+
source = CONFIG_SOURCE_DEFAULT;
48+
if (model.isBlank())
49+
model = DEFAULT_TEST_MODEL;
50+
if (effort.isBlank())
51+
effort = DEFAULT_TEST_EFFORT;
52+
return new ResolvedConfig(ModelIdResolver.resolve(claudeCodeVersion, model), effort, source);
53+
}
54+
55+
/**
56+
* Extracts a string field from parsed YAML frontmatter.
57+
*
58+
* @param frontmatter parsed YAML frontmatter
59+
* @param fieldName the field to extract
60+
* @return the field value, or blank if absent
61+
*/
62+
private static String extractStringField(JsonNode frontmatter, String fieldName)
63+
{
64+
JsonNode node = frontmatter.get(fieldName);
65+
if (node == null || node.isNull() || node.isMissingNode())
66+
return "";
67+
return node.asString("");
68+
}
69+
}

client/claude-cli/src/main/java/io/github/cowwoc/cat/claude/engine/ClaudeSprtRunner.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import io.github.cowwoc.cat.claude.tool.MainClaudeTool;
1010
import io.github.cowwoc.cat.tool.CliTool;
11+
import io.github.cowwoc.cat.tool.skills.ModelIdResolver;
1112
import io.github.cowwoc.cat.tool.skills.SprtRunner;
1213
import org.slf4j.Logger;
1314
import org.slf4j.LoggerFactory;
@@ -35,7 +36,9 @@ public static void main(String[] args)
3536
{
3637
try
3738
{
38-
SprtRunner.run(scope, args, System.out);
39+
String claudeCodeVersion = ModelIdResolver.detectClaudeCodeVersionOrLatestMapping();
40+
SprtRunner.run(scope, args, System.out,
41+
new ClaudeSprtMetadataResolver(claudeCodeVersion));
3942
}
4043
catch (IllegalArgumentException | IOException | InterruptedException e)
4144
{

0 commit comments

Comments
 (0)