Skip to content

Commit 11376a7

Browse files
eastriverleeclaude
andcommitted
refactor: name our own schemas after ourselves, and delete what nothing calls
Every structured-output request carried a schema named blueclaw_*, and that name goes out in the provider API call. Anyone adopting this library would find their provider logs naming a host they do not run. Twenty-four schemas produced here are now bluecollar_*; the host keeps the ones it produces itself. The debug environment variable and the no-callable-tools sentinel moved with them. Deleted, after confirming nothing in this module, the host, or the outer repository calls them: AgentProfile; the workflow-contract pair, one of which returned nil and the other false and neither of which had a live call site; and the planner/researcher/responder plan compiler together with RunTask, the vestigial entry point that was its only consumer. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 62f89b9 commit 11376a7

36 files changed

Lines changed: 71 additions & 182 deletions

agent_kernel.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
)
1515

1616
type AgentKernel struct {
17-
planCompiler PlanCompiler
1817
taskRunService taskstate.TaskRunStore
1918
taskStepService taskstate.TaskStepStore
2019
taskArtifactService taskstate.TaskArtifactStore
@@ -37,7 +36,6 @@ type AgentKernel struct {
3736

3837
func NewAgentKernel(taskRunService taskstate.TaskRunStore, taskStepService taskstate.TaskStepStore) *AgentKernel {
3938
return &AgentKernel{
40-
planCompiler: PlanCompiler{},
4139
taskRunService: taskRunService,
4240
taskStepService: taskStepService,
4341
taskArtifactService: taskstate.NewTaskArtifactService(),
@@ -597,30 +595,6 @@ func (agentKernel *AgentKernel) pauseForClarification(responseContext context.Co
597595
return AgentTurnResult{TaskRun: waitingTaskRun, UserNotice: reply, ToolNames: toolNamesForEvent(request.ToolSet)}, nil
598596
}
599597

600-
func (agentKernel *AgentKernel) RunTask(requesterPersonID string, originConversationID string, prompt string) (taskstate.TaskRun, error) {
601-
return agentKernel.RunTaskWithOrigin(requesterPersonID, taskstate.TaskRunOrigin{ConversationID: originConversationID}, prompt)
602-
}
603-
604-
func (agentKernel *AgentKernel) RunTaskWithOrigin(requesterPersonID string, origin taskstate.TaskRunOrigin, prompt string) (taskstate.TaskRun, error) {
605-
taskRun := agentKernel.taskRunService.CreateTaskRunWithOrigin(requesterPersonID, origin, prompt)
606-
taskPlan, errorValue := agentKernel.planCompiler.CompilePlan(prompt)
607-
if errorValue != nil {
608-
return taskstate.TaskRun{}, errorValue
609-
}
610-
611-
for _, taskPlanStep := range taskPlan.TaskSteps {
612-
agentKernel.taskStepService.AddTaskStep(taskstate.TaskStep{
613-
TaskStepID: taskRun.TaskRunID + ":" + taskPlanStep.Name,
614-
TaskRunID: taskRun.TaskRunID,
615-
AssignedAgentProfileName: taskPlanStep.AssignedAgentProfileName,
616-
Instruction: taskPlanStep.Instruction,
617-
Status: taskstate.TaskStatusPlanned,
618-
})
619-
}
620-
621-
return agentKernel.taskRunService.AdvanceTaskRun(taskRun.TaskRunID, "planner")
622-
}
623-
624598
func (agentKernel *AgentKernel) ResumeTask(taskRunID string) (taskstate.TaskRun, error) {
625599
return agentKernel.taskRunService.ResumeTaskRun(taskRunID)
626600
}

agent_profile.go

Lines changed: 0 additions & 6 deletions
This file was deleted.

agent_turn_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ func buildAgentActionRequest(state agentTaskState, includeToolDescription bool)
427427
return model.StructuredResponseRequest{
428428
Messages: messages,
429429
StructuredOutputSchema: model.StructuredOutputSchema{
430-
Name: "blueclaw_agent_turn_action",
430+
Name: "bluecollar_agent_turn_action",
431431
Document: actionSchemaForToolSet(modelToolSet, allowQualityCriteria, blockedToolNames, hasFailureDebt, allowFail, allowFinish),
432432
IsStrictlyEnforced: true,
433433
},

agent_turn_state_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ func TestBuildAgentActionRequestPreservesNativeToolCallingWireShape(t *testing.T
10301030

10311031
request := BuildAgentActionRequest(state)
10321032

1033-
if request.StructuredOutputSchema.Name != "blueclaw_agent_turn_action" {
1033+
if request.StructuredOutputSchema.Name != "bluecollar_agent_turn_action" {
10341034
t.Fatalf("expected agent action schema name, got %q", request.StructuredOutputSchema.Name)
10351035
}
10361036
if !request.StructuredOutputSchema.IsStrictlyEnforced {

agentcontract/failure_notice.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (generator FailureNoticeGenerator) Generate(ctx context.Context, report Fai
7878
status.Reason = "language_model_unavailable"
7979
return BuildRawErrorFailureNotice(report), status
8080
}
81-
reply, errorValue := generator.generateRecoveryText(generationContext, "blueclaw_failure_notice", BuildFailureNoticePrompt(report))
81+
reply, errorValue := generator.generateRecoveryText(generationContext, "bluecollar_failure_notice", BuildFailureNoticePrompt(report))
8282
if errorValue == nil {
8383
if notice, source, hasNotice := PrepareFailureNoticeWithGenerator(generator, generationContext, reply, "generated", report); hasNotice {
8484
status.Source = source
@@ -94,7 +94,7 @@ func (generator FailureNoticeGenerator) Generate(ctx context.Context, report Fai
9494
if strings.TrimSpace(reply) != "" {
9595
status.FirstInvalid = true
9696
for repairCount := 1; repairCount <= 2; repairCount++ {
97-
repairedReply, repairError := generator.generateRecoveryText(generationContext, "blueclaw_failure_notice_repair", BuildFailureNoticeRepairPrompt(report, reply, repairCount))
97+
repairedReply, repairError := generator.generateRecoveryText(generationContext, "bluecollar_failure_notice_repair", BuildFailureNoticeRepairPrompt(report, reply, repairCount))
9898
if repairError != nil || strings.TrimSpace(repairedReply) == "" {
9999
status.RepairCount = repairCount
100100
status.TextRecoveryError = firstNonEmptyString(errorString(repairError), "empty_repair")
@@ -146,7 +146,7 @@ func (generator FailureNoticeGenerator) GenerateIntakeNotice(ctx context.Context
146146
generationContext, cancel := context.WithCancel(ctx)
147147
defer cancel()
148148
prompt := BuildIntakeNoticePrompt(report.Classification, failureReport)
149-
reply, errorValue := generator.generateRecoveryText(generationContext, "blueclaw_intake_notice", prompt)
149+
reply, errorValue := generator.generateRecoveryText(generationContext, "bluecollar_intake_notice", prompt)
150150
if errorValue == nil {
151151
if notice := BuildFailureNotice(reply, "generated", failureReport); notice.IsSendable {
152152
return notice
@@ -155,7 +155,7 @@ func (generator FailureNoticeGenerator) GenerateIntakeNotice(ctx context.Context
155155
if RecoveryContextError(generationContext, errorValue) != nil {
156156
return BuildRawErrorFailureNotice(failureReport)
157157
}
158-
localReply, localError := generator.generateLocalRecoveryText(generationContext, "blueclaw_intake_notice", prompt)
158+
localReply, localError := generator.generateLocalRecoveryText(generationContext, "bluecollar_intake_notice", prompt)
159159
if localError == nil {
160160
if notice := BuildFailureNotice(localReply, "local_generated", failureReport); notice.IsSendable {
161161
return notice
@@ -276,7 +276,7 @@ func (generator FailureNoticeGenerator) generateLocalFailureNotice(ctx context.C
276276
if strings.TrimSpace(rejectedReply) != "" {
277277
prompt = BuildFailureNoticeRepairPrompt(report, rejectedReply, 3)
278278
}
279-
reply, errorValue := generator.generateLocalRecoveryText(ctx, "blueclaw_failure_notice", prompt)
279+
reply, errorValue := generator.generateLocalRecoveryText(ctx, "bluecollar_failure_notice", prompt)
280280
if errorValue != nil || strings.TrimSpace(reply) == "" {
281281
return FailureNotice{}, firstNonEmptyString(errorString(errorValue), "empty_local_reply"), false
282282
}
@@ -285,7 +285,7 @@ func (generator FailureNoticeGenerator) generateLocalFailureNotice(ctx context.C
285285
return notice, "", true
286286
}
287287
for repairCount := 1; repairCount <= 2; repairCount++ {
288-
repairedReply, repairError := generator.generateLocalRecoveryText(ctx, "blueclaw_failure_notice_repair", BuildFailureNoticeRepairPrompt(report, reply, repairCount))
288+
repairedReply, repairError := generator.generateLocalRecoveryText(ctx, "bluecollar_failure_notice_repair", BuildFailureNoticeRepairPrompt(report, reply, repairCount))
289289
if repairError != nil || strings.TrimSpace(repairedReply) == "" {
290290
return FailureNotice{}, firstNonEmptyString(errorString(repairError), "empty_local_repair"), false
291291
}
@@ -301,7 +301,7 @@ func (generator FailureNoticeGenerator) generateLocalFailureNotice(ctx context.C
301301
func PrepareFailureNoticeWithGenerator(generator FailureNoticeGenerator, ctx context.Context, reply string, source string, report FailureReport) (FailureNotice, string, bool) {
302302
candidate := strings.TrimSpace(reply)
303303
if TextExceedsCharacterBudget(candidate, failureNoticeMaximumCharacters) {
304-
compressedReply, errorValue := generator.generateRecoveryText(ctx, "blueclaw_failure_notice_compression", BuildFailureNoticeCompressionPrompt(report, reply, failureNoticeMaximumCharacters))
304+
compressedReply, errorValue := generator.generateRecoveryText(ctx, "bluecollar_failure_notice_compression", BuildFailureNoticeCompressionPrompt(report, reply, failureNoticeMaximumCharacters))
305305
if errorValue != nil || strings.TrimSpace(compressedReply) == "" {
306306
return FailureNotice{}, "", false
307307
}
@@ -352,9 +352,9 @@ func (generator FailureNoticeGenerator) reviewFailureNotice(ctx context.Context,
352352

353353
func (generator FailureNoticeGenerator) generateFailureNoticeReview(ctx context.Context, source string, prompt string) (string, error) {
354354
if strings.HasPrefix(source, "local_") {
355-
return generator.generateLocalRecoveryText(ctx, "blueclaw_failure_notice_review", prompt)
355+
return generator.generateLocalRecoveryText(ctx, "bluecollar_failure_notice_review", prompt)
356356
}
357-
return generator.generateRecoveryText(ctx, "blueclaw_failure_notice_review", prompt)
357+
return generator.generateRecoveryText(ctx, "bluecollar_failure_notice_review", prompt)
358358
}
359359

360360
func BuildRawErrorFailureNotice(report FailureReport) FailureNotice {

agentcontract/failure_notice_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func TestFailureNoticeGeneratorUsesRecoveryChatBeforeLegacyText(t *testing.T) {
117117
if provider.chatCalls != 1 || provider.legacyCalls != 0 {
118118
t.Fatalf("expected chat-first generation, got chat=%d legacy=%d", provider.chatCalls, provider.legacyCalls)
119119
}
120-
if len(provider.chatRequests) != 1 || provider.chatRequests[0].SchemaName != "blueclaw_failure_notice" {
120+
if len(provider.chatRequests) != 1 || provider.chatRequests[0].SchemaName != "bluecollar_failure_notice" {
121121
t.Fatalf("expected named failure notice chat request, got %+v", provider.chatRequests)
122122
}
123123
}
@@ -170,7 +170,7 @@ func TestFailureNoticeGeneratorDoesNotUseLegacyAfterRecoveryChatCancellation(t *
170170
responseContext, cancel := context.WithCancel(context.Background())
171171
cancel()
172172

173-
reply, errorValue := (FailureNoticeGenerator{LanguageModel: provider}).generateRecoveryText(responseContext, "blueclaw_failure_notice", "failure prompt")
173+
reply, errorValue := (FailureNoticeGenerator{LanguageModel: provider}).generateRecoveryText(responseContext, "bluecollar_failure_notice", "failure prompt")
174174
if reply != "" || !errors.Is(errorValue, context.Canceled) {
175175
t.Fatalf("expected canceled recovery chat, got %q and %v", reply, errorValue)
176176
}

agentcontract/llm_call_ledger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
)
1212

1313
const llmCallErrorMaximumCharacters = 300
14-
const TurnRouterSchemaName = "blueclaw_turn_router"
15-
const AgentActionSchemaName = "blueclaw_agent_turn_action"
14+
const TurnRouterSchemaName = "bluecollar_turn_router"
15+
const AgentActionSchemaName = "bluecollar_agent_turn_action"
1616

1717
type LLMCallRecord struct {
1818
Kind string `json:"kind"`

agentcontract/llm_call_ledger_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ func TestObserveLanguageModelRecordsStructuredCalls(t *testing.T) {
1919

2020
_, errorValue := observed.GenerateStructuredResponse(context.Background(), model.StructuredResponseRequest{
2121
Messages: []model.Message{{Role: "user", Content: "hello"}},
22-
StructuredOutputSchema: model.StructuredOutputSchema{Name: "blueclaw_agent_turn_action"},
22+
StructuredOutputSchema: model.StructuredOutputSchema{Name: "bluecollar_agent_turn_action"},
2323
})
2424
if errorValue != nil {
2525
t.Fatalf("expected structured call: %v", errorValue)
2626
}
2727
if len(records) != 1 {
2828
t.Fatalf("expected one call record, got %d", len(records))
2929
}
30-
if records[0].Kind != "structured" || records[0].SchemaName != "blueclaw_agent_turn_action" {
30+
if records[0].Kind != "structured" || records[0].SchemaName != "bluecollar_agent_turn_action" {
3131
t.Fatalf("expected structured record with schema, got %+v", records[0])
3232
}
3333
if records[0].PromptBytes != len("hello") || records[0].ContentBytes == 0 {
@@ -132,7 +132,7 @@ func TestObserveLanguageModelRecordsExplicitChatSchemaOnly(t *testing.T) {
132132
if len(records) != 2 {
133133
t.Fatalf("expected action and plain chat records, got %+v", records)
134134
}
135-
if records[0].SchemaName != "blueclaw_agent_turn_action" || records[1].SchemaName != "" {
135+
if records[0].SchemaName != "bluecollar_agent_turn_action" || records[1].SchemaName != "" {
136136
t.Fatalf("expected only explicitly identified action chat to carry schema, got %+v", records)
137137
}
138138
}
@@ -142,9 +142,9 @@ func nativeActionChatRequest() model.ChatCompletionRequest {
142142
SchemaName: AgentActionSchemaName,
143143
Tools: []model.ChatCompletionTool{{
144144
Type: "function",
145-
Function: model.ChatCompletionFunction{Name: "blueclaw_agent_turn_action"},
145+
Function: model.ChatCompletionFunction{Name: "bluecollar_agent_turn_action"},
146146
}},
147-
ToolChoice: json.RawMessage(`{"type":"function","function":{"name":"blueclaw_agent_turn_action"}}`),
147+
ToolChoice: json.RawMessage(`{"type":"function","function":{"name":"bluecollar_agent_turn_action"}}`),
148148
}
149149
}
150150

@@ -157,7 +157,7 @@ func TestChatCallRecordPreservesActionRoutingMetadata(t *testing.T) {
157157
FinishReason: "tool_calls",
158158
UsedFallback: true,
159159
}, time.Now(), nil)
160-
if record.SchemaName != "blueclaw_agent_turn_action" || record.Provider != "llmd" || record.Model != "low-model" || record.ModelTier != "low" || record.SelectedBackend != "device" || record.FinishReason != "tool_calls" || !record.UsedFallback {
160+
if record.SchemaName != "bluecollar_agent_turn_action" || record.Provider != "llmd" || record.Model != "low-model" || record.ModelTier != "low" || record.SelectedBackend != "device" || record.FinishReason != "tool_calls" || !record.UsedFallback {
161161
t.Fatalf("expected action routing metadata, got %+v", record)
162162
}
163163
}

approval_gate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func (agentTurnRunner *AgentTurnRunner) generateHeldCallConfirmationWording(ctx
342342
{Role: "user", Content: string(contextDocumentBytes)},
343343
},
344344
StructuredOutputSchema: model.StructuredOutputSchema{
345-
Name: "blueclaw_approval_question",
345+
Name: "bluecollar_approval_question",
346346
Document: `{"type":"object","properties":{"question":{"type":"string"}},"required":["question"],"additionalProperties":false}`,
347347
IsStrictlyEnforced: true,
348348
},

approval_gate_wording_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestHeldCallConfirmationWordingAsksModelForDeclarativeDraft(t *testing.T) {
6060
if len(languageModel.requests) != 1 {
6161
t.Fatalf("expected one approval-question model call, got %d", len(languageModel.requests))
6262
}
63-
if languageModel.requests[0].StructuredOutputSchema.Name != "blueclaw_approval_question" {
63+
if languageModel.requests[0].StructuredOutputSchema.Name != "bluecollar_approval_question" {
6464
t.Fatalf("expected approval question schema, got %q", languageModel.requests[0].StructuredOutputSchema.Name)
6565
}
6666
}

0 commit comments

Comments
 (0)