commit 93f01c19d78a76b73809fa2e6e1d4fd2fefd448e
parent bbad07dc9f979cc67d38dbca649cf44ba5105b6e
Author: Brian Graham <brian@buildingbetterteams.de>
Date: Fri, 3 Apr 2026 20:13:21 +0200
Include prompt and context in transcript
The harness now injects the original prompt (and context file if provided)
as the first entries in transcript.jsonl. The transcript viewer renders
the prompt with a purple PROMPT header and the context file as a
collapsible section. Future runs will show what the agent was given.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/dashboard/src/components/TranscriptViewer.tsx b/dashboard/src/components/TranscriptViewer.tsx
@@ -451,6 +451,35 @@ function renderEvent(event: TranscriptEvent, index: number): ReactNode {
);
}
+ // User prompt (injected by harness)
+ if (type === "user" && event.subtype === "prompt") {
+ const content = event.message?.content as string || "";
+ return (
+ <EventCard key={index} borderColor="#818cf8" bgTint="rgba(129, 140, 248, 0.08)">
+ <div style={{ fontSize: "0.7rem", fontFamily: theme.fontMono, color: "#818cf8", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6 }}>
+ PROMPT
+ </div>
+ <div style={{ fontSize: "0.875rem", lineHeight: 1.6, color: theme.text, whiteSpace: "pre-wrap" }}>
+ {renderMarkdown(content)}
+ </div>
+ </EventCard>
+ );
+ }
+
+ // Context file (injected by harness)
+ if (type === "user" && event.subtype === "context") {
+ const content = event.message?.content as string || "";
+ return (
+ <EventCard key={index} borderColor="#4b5563" bgTint="rgba(75, 85, 99, 0.05)">
+ <Collapsible label="context file" labelColor="#6b7280" defaultOpen={false}>
+ <div style={{ fontSize: "0.82rem", color: theme.textMuted, whiteSpace: "pre-wrap" }}>
+ {renderMarkdown(content)}
+ </div>
+ </Collapsible>
+ </EventCard>
+ );
+ }
+
// User event (tool results)
if (type === "user") {
const result = event.tool_use_result;
diff --git a/harness/run.py b/harness/run.py
@@ -159,7 +159,28 @@ def invoke_claude(cell: dict, workspace: Path, run_dir: Path, project_dir: Path)
transcript_path = run_dir / "transcript.jsonl"
stderr_path = run_dir / "claude_stderr.log"
- with open(transcript_path, "w") as transcript_f, open(stderr_path, "w") as stderr_f:
+ # Inject the prompt and context as the first transcript entries
+ with open(transcript_path, "w") as transcript_f:
+ # The user's prompt
+ prompt_event = {
+ "type": "user",
+ "subtype": "prompt",
+ "message": {"role": "user", "content": prompt},
+ }
+ transcript_f.write(json.dumps(prompt_event) + "\n")
+
+ # The context file if provided
+ if cell.get("context_file") == "provided":
+ ctx_file = project_dir / "tasks" / cell["task"] / "context.md"
+ if ctx_file.exists():
+ ctx_event = {
+ "type": "user",
+ "subtype": "context",
+ "message": {"role": "system", "content": ctx_file.read_text()},
+ }
+ transcript_f.write(json.dumps(ctx_event) + "\n")
+
+ with open(transcript_path, "a") as transcript_f, open(stderr_path, "w") as stderr_f:
try:
result = subprocess.run(
cmd,