feat(transcript): add canonical agent exchange transcript (F106)#370
Merged
Merged
Conversation
- `.go-arch-lint.yml`: Register transcript domain and infrastructure packages with dependency rules - `.golangci.yml`: Add linter configuration for new transcript packages - `docs/reference/transcript-schema.md`: Add full transcript JSON schema reference - `docs/user-guide/audit-trail.md`: Document transcript as audit trail mechanism - `docs/user-guide/transcript.md`: Add user guide for transcript feature - `internal/domain/ports/recorder.go`: Add Recorder port interface for append-only event recording - `internal/domain/ports/recorder_contract_test.go`: Add contract tests for Recorder port - `internal/domain/ports/agent_output_normalizer.go`: Add AgentOutputNormalizer port interface - `internal/domain/transcript/event.go`: Add canonical transcript event types and schema - `internal/domain/transcript/content.go`: Add content block types for provider-agnostic output - `internal/domain/transcript/payload.go`: Add payload types for transcript events - `internal/domain/transcript/doc.go`: Add package documentation with architecture overview - `internal/domain/transcript/architecture_test.go`: Add architecture constraint tests - `internal/domain/transcript/event_test.go`: Add event type unit tests - `internal/domain/transcript/content_test.go`: Add content block unit tests - `internal/domain/transcript/doc_test.go`: Add doc example tests - `internal/domain/workflow/agent_config.go`: Add RunID field for transcript correlation - `internal/domain/workflow/context.go`: Expose RunID accessor for execution context - `internal/domain/workflow/conversation.go`: Wire RunID into conversation context - `internal/infrastructure/agents/claude_to_content_blocks.go`: Normalize Claude output to canonical content blocks - `internal/infrastructure/agents/codex_to_content_blocks.go`: Normalize Codex output to canonical content blocks - `internal/infrastructure/agents/copilot_to_content_blocks.go`: Normalize Copilot output to canonical content blocks - `internal/infrastructure/agents/gemini_to_content_blocks.go`: Normalize Gemini output to canonical content blocks - `internal/infrastructure/agents/openai_compatible_to_content_blocks.go`: Normalize OpenAI-compatible output to canonical content blocks - `internal/infrastructure/agents/content_block_normalizer.go`: Add ContentBlockNormalizer aggregating all provider converters - `internal/infrastructure/agents/base_cli_provider.go`: Wire AgentOutputNormalizer into base provider - `internal/infrastructure/agents/testdata/transcript/`: Add golden test fixtures for all five providers - `internal/infrastructure/agents/*_test.go`: Add unit and golden tests for all provider normalizers - `internal/infrastructure/transcript/recorder.go`: Add JSONL-backed Recorder implementation - `internal/infrastructure/transcript/jsonl_writer.go`: Add atomic append-only JSONL writer - `internal/infrastructure/transcript/fanout.go`: Add FanoutRecorder for multi-sink event dispatch - `internal/infrastructure/transcript/reader.go`: Add transcript JSONL reader for replay - `internal/infrastructure/transcript/doc.go`: Add package documentation - `internal/infrastructure/transcript/*_test.go`: Add unit tests including atomicity and fanout tests - `internal/application/execution_service.go`: Integrate Recorder into execution lifecycle - `internal/application/execution_service_transcript.go`: Add transcript emission helpers for all event types - `internal/application/execution_setup.go`: Wire RecorderFactory into ExecutionSetup.Build() - `internal/application/execution_tool_proxy.go`: Emit tool call and result events to transcript - `internal/application/subworkflow_executor.go`: Emit subworkflow events to transcript - `internal/application/tools/router.go`: Forward transcript recorder through tool router - `internal/application/conversation_manager.go`: Propagate recorder into conversation manager - `internal/application/execution_service_runid_test.go`: Add RunID propagation tests - `internal/application/execution_service_transcript_test.go`: Add transcript emission unit tests - `internal/application/execution_service_transcript_assistant_test.go`: Add assistant response emission tests - `internal/application/execution_service_transcript_callworkflow_test.go`: Add subworkflow transcript tests - `internal/application/execution_service_transcript_loop_test.go`: Add loop transcript tests - `internal/application/execution_setup_recorder_factory_test.go`: Add recorder factory wiring tests - `internal/application/execution_tool_proxy_recorder_test.go`: Add tool proxy recorder tests - `internal/application/tools/router_transcript_test.go`: Add router transcript forwarding tests - `internal/interfaces/cli/wiring_transcript.go`: Add CLI wiring for transcript recorder factory - `internal/interfaces/cli/run.go`: Wire transcript recorder into run command - `tests/integration/features/transcript_test.go`: Add end-to-end transcript integration tests Closes #369
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ContentBlocknormalisation layer that translates raw Claude, Gemini, Codex, Copilot, and OpenAI-compatible output into a unified schema before writingFanoutRecorderthat multiplexes writes to multiple backends (file + future sinks) without coupling execution logic to any specific output destinationChanges
Domain — transcript schema
internal/domain/transcript/content.go:ContentBlockunion type covering text, tool-use, tool-result, thinking, and error variantsinternal/domain/transcript/event.go:Eventenvelope (role, content blocks, metadata, run ID) that forms one line in the JSONL fileinternal/domain/transcript/payload.go: payload helper types shared by event constructorsinternal/domain/transcript/doc.go: package documentation and architecture rationaleDomain — ports
internal/domain/ports/recorder.go:Recorderport interface (Emit / Close); consumed by application layerinternal/domain/ports/agent_output_normalizer.go:AgentOutputNormalizerport for provider-to-ContentBlock translationApplication — execution wiring
internal/application/execution_service.go: integrate recorder into the main agent step loop; emit user, assistant, and error eventsinternal/application/execution_service_transcript.go:emitTranscriptAgentResponsehelper; normalises agent output and writes an assistant eventinternal/application/execution_setup.go:RecorderFactorywiring; inject recorder intoExecutionServiceviaSetRecorderinternal/application/execution_tool_proxy.go: intercept tool calls and results through the proxy; emit tool-use and tool-result eventsinternal/application/subworkflow_executor.go: propagate recorder into nestedcall_workflowexecutionsinternal/application/conversation_manager.go: expose run ID accessor needed by transcript event constructioninternal/application/tools/router.go: pass recorder reference through the tool router for tool-level recordingInfrastructure — transcript I/O
internal/infrastructure/transcript/recorder.go:JSONLRecorder— writes events as newline-delimited JSON to a file per run IDinternal/infrastructure/transcript/jsonl_writer.go: low-level atomic append writer with fsync guaranteesinternal/infrastructure/transcript/fanout.go:FanoutRecorder— fans outEmitcalls to N child recorders; closes all onCloseinternal/infrastructure/transcript/reader.go:Readerfor replaying a transcript file event-by-eventInfrastructure — provider normalisers
internal/infrastructure/agents/content_block_normalizer.go:ContentBlockNormalizerdispatches to per-provider functionsinternal/infrastructure/agents/claude_to_content_blocks.go: Claude JSONL → ContentBlockinternal/infrastructure/agents/codex_to_content_blocks.go: Codex JSONL → ContentBlockinternal/infrastructure/agents/copilot_to_content_blocks.go: Copilot JSONL → ContentBlockinternal/infrastructure/agents/gemini_to_content_blocks.go: Gemini JSONL → ContentBlockinternal/infrastructure/agents/openai_compatible_to_content_blocks.go: OpenAI-compatible JSONL → ContentBlockinternal/infrastructure/agents/base_cli_provider.go: expose output lines to normaliserinternal/infrastructure/agents/testdata/transcript/*/input.jsonl: per-provider raw fixture filesinternal/infrastructure/agents/testdata/transcript/golden/*.json: golden expected ContentBlock outputsCLI wiring
internal/interfaces/cli/run.go: pass transcript recorder factory intoExecutionSetup.Buildinternal/interfaces/cli/wiring_transcript.go:BuildTranscriptRecorder— resolves storage path, createsJSONLRecorder+ optional fanoutTests
internal/application/execution_service_transcript_test.go: unit tests for assistant event emissioninternal/application/execution_service_transcript_assistant_test.go: assistant content-block normalisation coverageinternal/application/execution_service_transcript_callworkflow_test.go: nested call-workflow transcript propagationinternal/application/execution_service_transcript_loop_test.go: loop step transcript continuityinternal/application/execution_service_runid_test.go: run ID generation and uniquenessinternal/application/execution_setup_recorder_factory_test.go: recorder factory injectioninternal/application/execution_setup_test.go: updated setup wiring testsinternal/application/execution_tool_proxy_recorder_test.go: tool proxy recording assertionsinternal/application/tools/router_transcript_test.go: router-level recording testsinternal/domain/ports/recorder_contract_test.go: port contract tests (Emit idempotency, Close behaviour)internal/domain/transcript/content_test.go: ContentBlock construction and serialisationinternal/domain/transcript/event_test.go: Event serialisation round-tripsinternal/domain/transcript/doc_test.go: package example testsinternal/domain/transcript/architecture_test.go: dependency rule enforcementinternal/infrastructure/agents/*_test.go: per-provider normaliser unit testsinternal/infrastructure/agents/golden_transcript_test.go: golden-file regression suiteinternal/infrastructure/transcript/fanout_test.go: fanout multiplexing and error propagationinternal/infrastructure/transcript/jsonl_writer_test.go: writer append / close semanticsinternal/infrastructure/transcript/jsonl_writer_atomicity_test.go: crash-safety and atomicity testsinternal/infrastructure/transcript/reader_test.go: reader replay correctnessinternal/infrastructure/transcript/recorder_test.go: full recorder lifecycleinternal/interfaces/cli/wiring_transcript_test.go: CLI wiring integrationtests/integration/features/transcript_test.go: end-to-end transcript creation viaawf runConfiguration
.go-arch-lint.yml: registerinternal/domain/transcriptandinternal/infrastructure/transcriptwith their allowed dependency sets.golangci.yml: add transcript packages to linter scopeDocumentation
docs/reference/transcript-schema.md: full JSONL schema reference with field descriptions and examplesdocs/user-guide/transcript.md: user-facing guide — enable, locate, and interpret transcriptsdocs/user-guide/audit-trail.md: updated to reference transcript as the audit mechanismdocs/README.md: link to new transcript docsREADME.md: mention transcript feature in feature listZPM knowledge base
.zpm/kb/feedback/journal.wal: feedback rules learned during F106 implementation.zpm/kb/pr_feature_f106_canonical_agent_exchange_transcript_j/journal.wal: PR-scoped tracking facts.zpm/kb/pr_feature_f106_canonical_agent_exchange_transcript_j/knowledge.pl: compiled knowledge snapshotTest plan
make buildcompletes without errors;awf runproduces a.jsonlfile understorage/transcripts/<run-id>.jsonlmake test-unitpasses with zero failures; verify transcript-related packages in outputmake test-integrationpassestests/integration/features/transcript_test.go; confirm file contains valid JSON lines with correct rolesmake lintreports zero violations for new packagesCloses #369
Generated with awf commit workflow