Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions packages/opencode/src/session/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,14 +728,19 @@ export namespace SessionPrompt {
system.push(STRUCTURED_OUTPUT_SYSTEM_PROMPT)
}

// altimate_change start - trace system prompt
Tracer.active?.logSpan({
name: "system-prompt",
startTime: Date.now(),
endTime: Date.now(),
input: { agent: agent.name, step },
output: { parts: system.length, content: system.join("\n\n") },
})
// altimate_change start - trace system prompt once per loop() call.
// The system prompt is functionally identical across steps within a single
// loop() invocation (same agent, same environment). Agent switches re-enter
// loop() with step reset to 0, so each agent's prompt is traced separately.
if (step === 1) {
Tracer.active?.logSpan({
name: "system-prompt",
startTime: Date.now(),
endTime: Date.now(),
input: { agent: agent.name, step },
output: { parts: system.length, content: system.join("\n\n") },
})
}
// altimate_change end

const result = await processor.process({
Expand Down
Loading