Skip to content

Carve transcript normalization out into Capacitor.Models.Transcripts - #773

Merged
alexeyzimarev merged 21 commits into
mainfrom
alexeyzimarev/ai-2265-make-core-the-single-home-of-transcript-normalization
Sep 5, 2026
Merged

alexeyzimarev merged 21 commits into
mainfrom
alexeyzimarev/ai-2265-make-core-the-single-home-of-transcript-normalization

Conversation

@alexeyzimarev

@alexeyzimarev alexeyzimarev commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Closes #774 — AI-2517. Part of #679 — AI-2265.

What & why

The desktop Chat tab and the server each carry their own transcript-to-canonical mapping for Claude and Codex. This is the first step of giving that mapping one home: a leaf project, Capacitor.Models.Transcripts, depending only on the Kurrent.Agent.Schema package and System.IO.Hashing, so the server can reference it without importing Core's dependencies. Its projections emit the schema's own messages with deterministic ids, timestamps and lineage; Core maps them to chat envelopes with each vendor's display rules beside that adapter; the app reads through it with one projection context per tail. Coverage is the chat's today; server parity for Claude and Codex comes in the next PRs.

Where to look

The id derivations are a persistence contract (the server dedups by them): framing tests and fixed vectors pin every hashed byte. The chat differs in five narrow ways, listed in docs/CHANGES.md.

Verification

  • dotnet test --solution Capacitor.slnx: 11471 passed, 66 env-gated skips; 5 daemon failures are wall-clock budget tests that each pass when run alone, plus a check of the local codex binary against the vendored schema pin (needs codex at the pinned version).
  • dotnet publish -c Release for kcap and kcap-daemon: zero IL2026/IL3050 lines.

alexeyzimarev and others added 18 commits September 4, 2026 13:36
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…679)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 5, 2026

Copy link
Copy Markdown

AI-2265

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-05T11:24:39.315267Z bbced13 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Centralize transcript normalization in a dependency-light leaf project

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Centralizes Claude and Codex transcript normalization in a reusable, AOT-compatible leaf project.
• Emits canonical schema events with deterministic identifiers, timestamps, lineage, and extension
 metadata.
• Preserves desktop chat behavior through Core adapters and vendor-specific display rules.
Diagram

graph TD
  A["Transcript JSONL"] --> B["Vendor Projection"] --> C["Canonical Events"] --> D["Envelope Adapter"] --> E["Display Rules"] --> F["Desktop Chat"]
  G["Schema Package"] --> C
  H["Hashing Package"] --> B
Loading
High-Level Assessment

The leaf-project approach is appropriate because it gives the desktop and future server adapter one normalization implementation without importing Core's unrelated dependencies. Emitting existing schema messages avoids a third event vocabulary, while retaining presentation policy in Core separates persistence semantics from UI behavior. Referencing Core directly, widening the wire envelope, and introducing custom DTOs were considered and correctly dismissed.

Files changed (62) +4209 / -62

Enhancement (17) +717 / -12
ChatTabViewModel.csProject chat records with per-tail context +33/-11

Project chat records with per-tail context

• Switches the chat tab to TranscriptChatProjection and stores projection context plus line numbering with each tail lease. Resets both when the tailed file resets and begins a projection batch for each read.

src/Capacitor.App/ViewModels/ChatTabViewModel.cs

WorkspaceViewModel.csResolve vendor chat projections through Core +1/-1

Resolve vendor chat projections through Core

• Constructs chat tabs with TranscriptChat.For so canonical projections are paired with vendor display rules.

src/Capacitor.App/ViewModels/WorkspaceViewModel.cs

ClaudeChatRules.csSeparate Claude chat presentation rules +60/-0

Separate Claude chat presentation rules

• Filters meta and sidechain events, strips injected wrappers, converts task notifications to system notes, and propagates tool-error state from schema extensions.

src/Capacitor.Cli.Core/Harness/Claude/ClaudeChatRules.cs

CodexChatRules.csSeparate Codex chat prelude filtering +22/-0

Separate Codex chat prelude filtering

• Filters Codex-generated environment, instruction, abort, and permission preludes from user-visible chat.

src/Capacitor.Cli.Core/Harness/Codex/CodexChatRules.cs

TranscriptChat.csCompose canonical projections with chat display policy +36/-0

Compose canonical projections with chat display policy

• Introduces the chat projection adapter, display-rules interface, and case-insensitive Claude/Codex registry.

src/Capacitor.Cli.Core/TranscriptChat.cs

TranscriptEnvelopes.csMap canonical events to chat envelopes +81/-0

Map canonical events to chat envelopes

• Converts schema messages into AcpEventEnvelope records, expands tool calls, caps tool results safely, and serializes protobuf Struct inputs as compact JSON.

src/Capacitor.Cli.Core/TranscriptEnvelopes.cs

CanonicalEvent.csDefine canonical transcript projection contracts +44/-0

Define canonical transcript projection contracts

• Adds canonical events, projection results, amendments, usage instructions, targets, and attachment records for persistence-neutral normalization.

src/Capacitor.Models.Transcripts/CanonicalEvent.cs

CanonicalEventTypes.csCentralize persisted event type names +23/-0

Centralize persisted event type names

• Defines stable event-name constants and maps supported schema or leaf payloads to their persistence names.

src/Capacitor.Models.Transcripts/CanonicalEventTypes.cs

ClaudeCodeExtension.csDefine Claude schema extension fields +24/-0

Define Claude schema extension fields

• Centralizes the claude_code slug and constructs non-empty metadata blocks for meta, sidechain, origin, and error flags.

src/Capacitor.Models.Transcripts/Harness/Claude/ClaudeCodeExtension.cs

ClaudeTranscriptEvents.csProject Claude JSONL into canonical events +166/-0

Project Claude JSONL into canonical events

• Maps user, assistant, thinking, tool-call, and tool-result records to schema messages. Preserves timestamps and lineage while deriving stable record and block identifiers.

src/Capacitor.Models.Transcripts/Harness/Claude/ClaudeTranscriptEvents.cs

CodexRolloutEvents.csProject Codex rollout items into canonical events +91/-0

Project Codex rollout items into canonical events

• Maps conversational response items, tool calls, outputs, and reasoning to schema messages with hashed record IDs and resolved timestamps.

src/Capacitor.Models.Transcripts/Harness/Codex/CodexRolloutEvents.cs

SchemaExtensions.csAdd typed schema-extension readers +28/-0

Add typed schema-extension readers

• Provides centralized access to extension maps, slug blocks, boolean flags, and string fields across canonical schema messages.

src/Capacitor.Models.Transcripts/SchemaExtensions.cs

TranscriptContext.csDefine per-stream projection context +7/-0

Define per-stream projection context

• Introduces an extensible context lifecycle with a batch-boundary hook for stateful vendor projections.

src/Capacitor.Models.Transcripts/TranscriptContext.cs

TranscriptIds.csCentralize deterministic transcript identifiers +37/-0

Centralize deterministic transcript identifiers

• Implements XxHash128 derivations for sibling, Claude fallback, block, attachment, and Codex record IDs using explicitly framed bytes.

src/Capacitor.Models.Transcripts/TranscriptIds.cs

TranscriptProjection.csDefine and register canonical transcript projections +21/-0

Define and register canonical transcript projections

• Introduces the context-aware projection interface and case-insensitive registry for Claude and Codex.

src/Capacitor.Models.Transcripts/TranscriptProjection.cs

TranscriptText.csAdd canonical text and Struct helpers +31/-0

Add canonical text and Struct helpers

• Centralizes text-block joining and conversion of JSON values into protobuf Struct representations.

src/Capacitor.Models.Transcripts/TranscriptText.cs

TranscriptTime.csNormalize transcript timestamps +12/-0

Normalize transcript timestamps

• Uses parseable record timestamps as effective time while retaining raw values and falling back to receive time.

src/Capacitor.Models.Transcripts/TranscriptTime.cs

Refactor (6) +3 / -7
ToolDetail.csUse the transcript global namespace import +0/-1

Use the transcript global namespace import

• Removes the now-unnecessary Core namespace import after JSON accessors moved to the transcript leaf.

src/Capacitor.App/ViewModels/ToolDetail.cs

ToolSummary.csConsume the relocated Codex classifier +1/-2

Consume the relocated Codex classifier

• Updates ToolSummary to import CodexCommandClassifier from Capacitor.Models.Transcripts.

src/Capacitor.App/ViewModels/ToolSummary.cs

ReviewerVendorLookup.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Relies on the new project-level transcript namespace import for JSON accessors.

src/Capacitor.Cli/Commands/ReviewerVendorLookup.cs

ClaudeDiscoveryAge.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Uses the globally imported JSON extensions from the transcript leaf.

src/Capacitor.Cli/Harness/Claude/ClaudeDiscoveryAge.cs

CodexCommandClassifier.csRelocate the Codex command classifier +1/-1

Relocate the Codex command classifier

• Moves the classifier into the shared transcript leaf without changing its API or classification behavior.

src/Capacitor.Models.Transcripts/Harness/Codex/CodexCommandClassifier.cs

JsonElementExtensions.csRelocate tolerant JSON accessors +1/-1

Relocate tolerant JSON accessors

• Moves the shared JsonElement accessors from Core into the reusable transcript leaf namespace.

src/Capacitor.Models.Transcripts/JsonElementExtensions.cs

Tests (22) +615 / -38
ChatComposerTests.csConstruct chat tests through TranscriptChat +2/-2

Construct chat tests through TranscriptChat

• Updates composer test fixtures to use the new canonical-to-chat projection pipeline.

test/Capacitor.App.Tests.Unit/ChatComposerTests.cs

ChatTabViewModelTests.csTest contextual transcript projection in the chat tab +42/-5

Test contextual transcript projection in the chat tab

• Migrates test projections to the context-aware interface and adds coverage that tail resets recreate context and restart line numbering.

test/Capacitor.App.Tests.Unit/ChatTabViewModelTests.cs

ChatTabViewSmokeTests.csUse the new chat projection in smoke tests +1/-1

Use the new chat projection in smoke tests

• Updates the rendered chat fixture to resolve Claude through TranscriptChat.

test/Capacitor.App.Tests.Unit/ChatTabViewSmokeTests.cs

LaunchRequestTests.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Uses the project-level transcript namespace import after the JSON accessor move.

test/Capacitor.App.Tests.Unit/LaunchRequestTests.cs

ClaudeChatRulesTests.csVerify Claude canonical events retain chat behavior +10/-11

Verify Claude canonical events retain chat behavior

• Reworks the former projection tests around TranscriptChat, retaining coverage for wrappers, notifications, filtering, tools, and thinking presentation.

test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs

CodexChatRulesTests.csVerify Codex canonical events retain chat behavior +13/-10

Verify Codex canonical events retain chat behavior

• Exercises the composed Codex chat pipeline, including prelude filtering, normalized inputs, outputs, reasoning, and registry behavior.

test/Capacitor.Cli.Core.Tests.Unit/Harness/Codex/CodexChatRulesTests.cs

TranscriptEnvelopesTests.csTest canonical event envelope conversion +79/-0

Test canonical event envelope conversion

• Covers message kinds, timestamps, tool-call expansion, compact Struct JSON, safe result truncation, ignored payloads, and non-finite numbers.

test/Capacitor.Cli.Core.Tests.Unit/TranscriptEnvelopesTests.cs

FakeCodexAppServer.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Uses the new global transcript namespace for JSON accessors.

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/FakeCodexAppServer.cs

GeminiStderrShadowedOnPostFailureTests.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Relies on the integration project's new transcript global using.

test/Capacitor.Cli.Tests.Integration/GeminiStderrShadowedOnPostFailureTests.cs

ServiceStatusJsonTests.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Uses the globally imported transcript JSON accessors.

test/Capacitor.Cli.Tests.Unit/Commands/ServiceStatusJsonTests.cs

GeminiHookOutputContractTests.csRemove obsolete Core JSON-helper import +0/-1

Remove obsolete Core JSON-helper import

• Relies on the test project's transcript global using after accessor relocation.

test/Capacitor.Cli.Tests.Unit/Harness/Gemini/GeminiHookOutputContractTests.cs

GeminiSessionStartMemoryTests.csRemove obsolete Core namespace import +0/-1

Remove obsolete Core namespace import

• Cleans up the import made unnecessary by the transcript global using.

test/Capacitor.Cli.Tests.Unit/Harness/Gemini/GeminiSessionStartMemoryTests.cs

Capacitor.Models.Transcripts.Tests.Unit.csprojCreate the transcript leaf unit-test project +18/-0

Create the transcript leaf unit-test project

• Adds a TUnit project referencing only the production leaf and shared test helpers.

test/Capacitor.Models.Transcripts.Tests.Unit/Capacitor.Models.Transcripts.Tests.Unit.csproj

ClaudeTranscriptEventsTests.csPin Claude canonical projection behavior +160/-0

Pin Claude canonical projection behavior

• Covers IDs, timestamps, lineage, extensions, multiple blocks and results, malformed records, deferred injections, and extension isolation.

test/Capacitor.Models.Transcripts.Tests.Unit/Harness/Claude/ClaudeTranscriptEventsTests.cs

CodexCommandClassifierTests.csMove Codex classifier tests with their owner +2/-2

Move Codex classifier tests with their owner

• Relocates classifier coverage to the transcript test project and updates its namespace.

test/Capacitor.Models.Transcripts.Tests.Unit/Harness/Codex/CodexCommandClassifierTests.cs

CodexRolloutEventsTests.csPin Codex canonical projection behavior +108/-0

Pin Codex canonical projection behavior

• Covers messages, tools, uncapped stored results, reasoning, ignored telemetry, malformed input, deterministic IDs, and timestamp fallback.

test/Capacitor.Models.Transcripts.Tests.Unit/Harness/Codex/CodexRolloutEventsTests.cs

JsonElementExtensionsTests.csMove JSON accessor tests to the leaf +1/-1

Move JSON accessor tests to the leaf

• Relocates tolerant JsonElement accessor coverage to the project that now owns the implementation.

test/Capacitor.Models.Transcripts.Tests.Unit/JsonElementExtensionsTests.cs

SchemaExtensionsTests.csTest schema extension and type-name helpers +29/-0

Test schema extension and type-name helpers

• Verifies typed slug reads, absent-field behavior, unsupported payloads, and persisted event-name mappings.

test/Capacitor.Models.Transcripts.Tests.Unit/SchemaExtensionsTests.cs

TranscriptIdsTests.csPin every transcript ID byte layout +70/-0

Pin every transcript ID byte layout

• Tests each hashing frame and adds fixed GUID vectors to prevent accidental persistence-contract changes.

test/Capacitor.Models.Transcripts.Tests.Unit/TranscriptIdsTests.cs

TranscriptProjectionTests.csTest the canonical projection registry +19/-0

Test the canonical projection registry

• Verifies case-insensitive singleton resolution for Claude and Codex and null results for unknown vendors.

test/Capacitor.Models.Transcripts.Tests.Unit/TranscriptProjectionTests.cs

TranscriptTextTests.csTest text and protobuf Struct normalization +35/-0

Test text and protobuf Struct normalization

• Covers block joining, nested JSON conversion, field ordering, and wrapping of non-object values.

test/Capacitor.Models.Transcripts.Tests.Unit/TranscriptTextTests.cs

TranscriptTimeTests.csTest effective and raw timestamp handling +26/-0

Test effective and raw timestamp handling

• Covers parseable, missing, and invalid record timestamps against a fixed receive time.

test/Capacitor.Models.Transcripts.Tests.Unit/TranscriptTimeTests.cs

Documentation (5) +2835 / -5
CLAUDE.mdDocument the transcript leaf and persistence contracts +8/-3

Document the transcript leaf and persistence contracts

• Adds the new project to repository and test-layout guidance. Documents vendor ownership boundaries and warns that transcript ID derivations are migration-sensitive persistence contracts.

CLAUDE.md

CHANGES.mdExplain the normalization carve-out and chat deltas +19/-0

Explain the normalization carve-out and chat deltas

• Documents the new normalization architecture, immutable event-ID contract, and five intentional desktop chat differences introduced by the migration.

docs/CHANGES.md

2026-09-04-ai2265-transcripts-leaf-carve-out.mdAdd the transcript leaf implementation plan +2235/-0

Add the transcript leaf implementation plan

• Provides a task-by-task plan covering project extraction, projection contracts, adapters, app migration, tests, and AOT verification.

docs/superpowers/plans/2026-09-04-ai2265-transcripts-leaf-carve-out.md

2026-09-04-ai2265-transcript-normalization-leaf-design.mdSpecify the shared transcript normalization architecture +570/-0

Specify the shared transcript normalization architecture

• Defines canonical event contracts, deterministic identifiers, vendor parity requirements, server adoption, testing strategy, and immutable-history constraints.

docs/superpowers/specs/2026-09-04-ai2265-transcript-normalization-leaf-design.md

Models.csClarify transcript-produced system notes +3/-2

Clarify transcript-produced system notes

• Updates AcpEventKind documentation to include Claude background-task notifications as system-note producers.

src/Capacitor.Cli.Core/Models.cs

Other (12) +39 / -0
Capacitor.slnxRegister transcript production and test projects +2/-0

Register transcript production and test projects

• Adds the new transcript leaf and its unit-test project to the solution.

Capacitor.slnx

Directory.Packages.propsPin schema and hashing dependencies +2/-0

Pin schema and hashing dependencies

• Pins Kurrent.Agent.Schema 0.4.1 and System.IO.Hashing 10.0.11 for the new leaf project.

Directory.Packages.props

Capacitor.App.csprojExpose transcript helpers through a global using +3/-0

Expose transcript helpers through a global using

• Adds a global using for Capacitor.Models.Transcripts to the desktop application.

src/Capacitor.App/Capacitor.App.csproj

Capacitor.Cli.Core.csprojReference the transcript normalization leaf +6/-0

Reference the transcript normalization leaf

• Adds the project reference and global namespace import needed for canonical transcript contracts.

src/Capacitor.Cli.Core/Capacitor.Cli.Core.csproj

Capacitor.Cli.Daemon.csprojImport transcript JSON helpers globally +3/-0

Import transcript JSON helpers globally

• Adds the transcript leaf namespace as a global using for daemon code.

src/Capacitor.Cli.Daemon/Capacitor.Cli.Daemon.csproj

Capacitor.Cli.csprojImport transcript JSON helpers globally +3/-0

Import transcript JSON helpers globally

• Adds the transcript leaf namespace as a global using for CLI code.

src/Capacitor.Cli/Capacitor.Cli.csproj

Capacitor.Models.Transcripts.csprojCreate the AOT-compatible transcript leaf +15/-0

Create the AOT-compatible transcript leaf

• Creates a trimmable .NET 10 project depending only on Kurrent.Agent.Schema and System.IO.Hashing.

src/Capacitor.Models.Transcripts/Capacitor.Models.Transcripts.csproj

Capacitor.App.Tests.Unit.csprojImport transcript contracts in app tests +1/-0

Import transcript contracts in app tests

• Adds a global using for the new transcript namespace.

test/Capacitor.App.Tests.Unit/Capacitor.App.Tests.Unit.csproj

Capacitor.Cli.Core.Tests.Unit.csprojImport canonical transcript contracts in Core tests +1/-0

Import canonical transcript contracts in Core tests

• Adds the transcript leaf namespace as a global using.

test/Capacitor.Cli.Core.Tests.Unit/Capacitor.Cli.Core.Tests.Unit.csproj

Capacitor.Cli.Daemon.Tests.Unit.csprojImport transcript JSON helpers in daemon tests +1/-0

Import transcript JSON helpers in daemon tests

• Adds a global using for Capacitor.Models.Transcripts.

test/Capacitor.Cli.Daemon.Tests.Unit/Capacitor.Cli.Daemon.Tests.Unit.csproj

Capacitor.Cli.Tests.Integration.csprojImport transcript JSON helpers in integration tests +1/-0

Import transcript JSON helpers in integration tests

• Adds a global using for the relocated JSON accessor extensions.

test/Capacitor.Cli.Tests.Integration/Capacitor.Cli.Tests.Integration.csproj

Capacitor.Cli.Tests.Unit.csprojImport transcript JSON helpers in CLI tests +1/-0

Import transcript JSON helpers in CLI tests

• Adds a global using for Capacitor.Models.Transcripts.

test/Capacitor.Cli.Tests.Unit/Capacitor.Cli.Tests.Unit.csproj

@qodo-code-review

qodo-code-review Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Tmp helper bypassed ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The reset test rewrites a file beneath the injected TempDir with File.WriteAllLines instead of
the available Tmp.CreateFile helper. This bypasses the required temporary-filesystem abstraction.
Code

test/Capacitor.App.Tests.Unit/ChatTabViewModelTests.cs[565]

+            File.WriteAllLines(path, [UserLine]);    // shorter: the tail resets
Relevance

●●● Strong

Direct filesystem writes violate the repository’s explicit TempDir abstraction rule for temporary
test state.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2767472 requires all writes under a TempDir root to use TempDir members. The
changed test writes directly to the path at line 565, while TempDirHandle.CreateFile provides the
corresponding line-oriented operation.

Rule 2767472: Use TempDir helper for all temporary filesystem state in tests
test/Capacitor.App.Tests.Unit/ChatTabViewModelTests.cs[561-565]
test/Capacitor.Tests.Helpers/TempDirHandle.cs[39-48]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The test directly rewrites a file managed by `TempDir` using `File.WriteAllLines`.

## Issue Context
Temporary filesystem operations beneath an injected `TempDir` must use its helper methods. `CreateFile` supports line-oriented content and overwrites the target file.

## Fix Focus Areas
- test/Capacitor.App.Tests.Unit/ChatTabViewModelTests.cs[565-565]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Part of lacks closing keyword ✓ Resolved 📘 Rule violation § Compliance
Description
The PR description uses Part of #679 — AI-2265 instead of a single reference line containing a
GitHub closing keyword and both issue identifiers. The added PR-opening instructions explicitly
direct this noncompliant format.
Code

docs/superpowers/plans/2026-09-04-ai2265-transcripts-leaf-carve-out.md[2235]

+Read `.github/PULL_REQUEST_TEMPLATE.md` and follow its comment block. Title: `Carve transcript normalization out into Capacitor.Models.Transcripts`. The description's reference line carries `Closes #679` only if the whole issue is done, which it is not: write `Part of #679` and `AI-2265` instead. Push with `git push https://github.com/kurrent-io/kcap-cli.git <branch>` if an SSH push is refused.
Relevance

●●● Strong

Active compliance rule explicitly requires a closing keyword and Linear identifier on the same
reference line.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2897991 requires the PR description's reference line to contain a GitHub closing
keyword and the Linear key on the same line. The supplied description instead begins with `Part of
#679 — AI-2265, matching the newly added instruction to avoid Closes #679`.

Rule 2897991: PR description must contain both GitHub and Linear issue references; PR title must not contain issue IDs
docs/superpowers/plans/2026-09-04-ai2265-transcripts-leaf-carve-out.md[2233-2235]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR reference line lacks the required GitHub closing keyword, and the implementation plan directs authors to use `Part of #679` instead.

## Issue Context
The compliance rule requires one line containing exactly one GitHub closing keyword/reference and the Linear identifier, such as `Closes #679 AI-2265`. Update both the PR description metadata and the documented instruction.

## Fix Focus Areas
- docs/superpowers/plans/2026-09-04-ai2265-transcripts-leaf-carve-out.md[2235-2235]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Historical test comment ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new class comment describes behavior relative to when the projection was moved rather than
documenting the current behavior or invariant. This time-sensitive change-history narration will
become stale and should be removed or rewritten.
Code

test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs[3]

+/// The chat-level view of Claude records: what the Chat tab showed before the projection moved.
Relevance

●●● Strong

Recent reviews consistently accept rewriting historical comments into durable current-behavior
documentation.

PR-#693
PR-#666

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2897915 prohibits change-history narration such as references to code being moved.
The added comment explicitly defines the class through what the Chat tab showed `before the
projection moved`.

Rule 2897915: Avoid time-sensitive or process-reference metadata in code comments
test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs[3-4]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The class comment relies on historical change context with `before the projection moved`.

## Issue Context
Comments must describe current behavior, intent, or invariants without narrating how code was moved or previously behaved.

## Fix Focus Areas
- test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs[3-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (1)
4. Large tool numbers are rounded ✗ Dismissed 🐞 Bug ≡ Correctness
Description
Parsing tool-input JSON through protobuf Struct converts JSON numbers to double; integers beyond
IEEE-754 exact precision are then reserialized with a different value in ToolInputJson. For
example, an input value of 9007199254740993 is rendered as 9007199254740992, so chat tool
details and summaries can show incorrect arguments.
Code

src/Capacitor.Models.Transcripts/TranscriptText.cs[25]

+
Relevance

●● Moderate

Potential precision loss is technically credible, but no closely matching historical acceptance
precedent was found.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
StructOf parses raw input JSON into protobuf Struct; the Claude and Codex projections use it for
object-valued tool arguments. The chat adapter subsequently emits each Value.NumberValue,
explicitly treating it as a double, so numbers not exactly representable by double cannot retain
their original JSON value.

src/Capacitor.Models.Transcripts/TranscriptText.cs[25-25]
src/Capacitor.Models.Transcripts/Harness/Claude/ClaudeTranscriptEvents.cs[161-165]
src/Capacitor.Models.Transcripts/Harness/Codex/CodexRolloutEvents.cs[69-77]
src/Capacitor.Cli.Core/TranscriptEnvelopes.cs[65-78]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tool input objects are parsed into protobuf `Struct`, whose numeric representation is a `double`. This loses precision for valid large JSON integers before Core reserializes the value for `AcpEventEnvelope.ToolInputJson`.

## Issue Context
The prior chat normalizers forwarded object input with `JsonElement.GetRawText()`, while the new canonical-to-envelope adapter emits JSON by traversing the protobuf `Struct`. Retain a lossless representation for chat rendering, or encode numeric literals without conversion to `double`.

## Fix Focus Areas
- src/Capacitor.Models.Transcripts/TranscriptText.cs[25-25]
- src/Capacitor.Models.Transcripts/Harness/Claude/ClaudeTranscriptEvents.cs[161-165]
- src/Capacitor.Models.Transcripts/Harness/Codex/CodexRolloutEvents.cs[69-77]
- src/Capacitor.Cli.Core/TranscriptEnvelopes.cs[26-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 56 rules
Review mode: 🧠 Deep: This is a dense, cross-cutting extraction with substantial new Claude/Codex normalization logic, persistence-contract hashing, projections, and multiple consumer/test migrations across many independent edit sites.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more'

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread test/Capacitor.App.Tests.Unit/ChatTabViewModelTests.cs Outdated
Comment thread test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs Outdated
Comment thread docs/superpowers/plans/2026-09-04-ai2265-transcripts-leaf-carve-out.md Outdated
Comment thread src/Capacitor.Models.Transcripts/TranscriptText.cs
alexeyzimarev and others added 3 commits September 5, 2026 16:56
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…-make-core-the-single-home-of-transcript-normalization

# Conflicts:
#	docs/CHANGES.md
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@alexeyzimarev
alexeyzimarev merged commit e2ff673 into main Sep 5, 2026
6 checks passed
@alexeyzimarev
alexeyzimarev deleted the alexeyzimarev/ai-2265-make-core-the-single-home-of-transcript-normalization branch September 5, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Carve transcript normalization out into Capacitor.Models.Transcripts

1 participant