Repository navigation
Closed
Labels
Description
Scope
Fix provider schema and parser drift for current Claude Code, Codex, ChatGPT, Claude, Drive/Gemini data.
This issue owns schema regeneration, structural privacy-threshold fixes, drift detection, and parser coverage for provider events/content blocks that the archive already intends to understand.
Claude Code gaps
Schema gaps:
- record types suppressed by privacy threshold:
attachment,custom-title,file-history-snapshot,last-prompt,permission-mode,queue-operation,system; - content block types such as
thinking,redacted_thinking, andserver_tool_usemissing or under-modeled; - semantic annotations beyond
message_roleare not shipped.
Parser gaps:
- redacted/server thinking/tool-use variants;
- tool annotations and approval state;
- structured MCP tool result/error metadata;
- richer permission/error lifecycle fields when present.
Codex gaps
Schema gaps:
- envelope payload is modeled too generically;
- EventMsg / ThreadItem variants are not discriminated enough;
- content block and event-type semantics are under-modeled.
Parser gaps:
extract_reasoning_traces()still has a known hardcoded empty path;- reasoning, guardian/security, patch, review, exec, MCP, abort, rollback, and plan events need explicit handling or classification;
- tool_use/tool_result imbalance needs correction and regression evidence.
Tooling gaps
- Regenerate provider schemas from current data.
- Exempt structural identifiers /
message_rolefields from privacy suppression where appropriate. - Wire
detect_drift()intodevtools schema-auditwith actionable output. - Exercise
schema-promotefor at least one v2 package. - Add stale/drift schema checks where they produce reliable signal.
Boundaries
- Provider protocol events that are already parser-emitted as archive rows were handled by fix(storage): make provider protocol events first-class archive rows #837/fix(storage): persist provider protocol events (#843) #843; broader semantic rematerialization is fix(archive): store context and protocol artifacts semantically, not via projection fallbacks #839.
- Universal-vs-provider metadata classification is chore(schema): inventory universal archive semantics vs provider metadata #840.
- Conversation write-boundary/hash honesty is refactor(storage): make conversation writes bundle/hash-honest #841.
- ChatGPT message metadata storage contract is fix(chatgpt): align parsed message metadata with persisted archive contract #842.
- Embedding config/vector dimension ownership is feat(config): unified config system — polylogue.toml, four-layer precedence, shared daemon/CLI config #829/feat(daemon): post-ingest embedding task — voyage-4 integration, cost tracking, status surface #828; this issue should only touch schema pieces that are genuinely provider-schema drift.
Acceptance criteria
- Provider schemas are regenerated or explicitly marked current with evidence.
- Structural values are not suppressed by privacy thresholds meant for user content.
-
devtools schema-auditreports drift/staleness in an actionable way. -
schema-promoteis exercised end-to-end for at least one package where drift exists. - Missing Claude Code content block / record types are represented or intentionally rejected with evidence.
- Codex reasoning/tool/event coverage improves and production or fixture evidence shows the tool_use/tool_result imbalance is addressed.
- Parser/property/null-guard tests cover the new provider shapes.
Activity
Sinity commentedon May 4, 2026
Schema Audit Details
Claude Code schema (conversation_record_stream.schema.json.gz)
Generated 2026-03-16 from 151,159 samples. 63 top-level properties.
Record type gap: The
typefield'sx-polylogue-valuescontains only["assistant", "progress", "user"]. Real session data has 9 types. Six are missing from the schema:attachmentcustom-titlefile-history-snapshotlast-promptpermission-modequeue-operationsystemRoot cause: The evidence shows
distinct_values: 7— inference saw 7 values, butmin_conversation_count=3suppressed 4. The privacy threshold treats record type identifiers (structural) the same as user text content (private). Fields classified asmessage_roleshould be exempt.Content block gap: The schema models
thinkingMetadataat message level but does NOT recognize"type": "thinking"as a content block type. Real data has thinking blocks inmessage.content[]alongside text/tool_use/tool_result.Missing semantic annotations: Zero
x-polylogue-semantic-roleannotations beyondmessage_role. The inference pipeline (infer_semantic_roles → select_best_roles → annotate_semantic_and_relational) produces them but output is never integrated into shipped files.Codex schema (conversation_record_stream.schema.json.gz)
Generated 2026-03-16 from 151,159 samples. Only 3 top-level properties:
payload,timestamp,type.The
payloadfield istype: object— all 54 EventMsg variants collapsed into a generic bucket. No event type discrimination. Norecord_typeorformat_typefields. No content block types within messages (unlike the CC schema which captures them).Root causes (all fixable without changing inference engine)
message_rolefields should bypassmin_conversation_countdetect_drift()atschemas/validator.py:135exists but is never called by any audit toolschema-promoteexists but has never been used — all providers stuck on v1Sinity commentedon May 4, 2026
Codex Event Type Inventory
The Codex protocol defines 54 EventMsg variants in
codex-rs/protocol/src/protocol.rsplus 17 ThreadItem variants inapp-server-protocol/src/protocol/v2.rs. Polylogue's parser (sources/parsers/codex.py) deeply handles only 4: user message, agent message, function call, function call output.High-severity unhandled events (the core agent audit trail):
AgentReasoningEventextract_reasoning_traces()hardcodesreturn []for Codex. Production DB confirms: 0% thinking across 2,048 sessions.GuardianAssessmentEventApplyPatchApprovalRequestReviewOutputEventTurnAbortedEventExecCommandBegin/EndMcpToolCallBegin/EndPatchApplyBegin/EndThreadRolledBackPlanDelta/ThreadItem::PlanAlso: the
external-agent-sessionscrate (codex-rs/external-agent-sessions/src/) reveals a new JSONL format for importing sessions from other tools —"type": "user"/"assistant"records withcustom-title/ai-titlemetadata andthinking/tool_use/tool_resultcontent blocks. Not yet seen in production sessions (May 2026 sessions still use envelope format) but present in the source.Calibration from production DB
Sinity commentedon May 4, 2026
Record type coverage (Claude Code)
Schema has
x-polylogue-values: ["assistant", "progress", "user"]. Real data has 9 types:Evidence shows
distinct_values: 7butmin_conversation_count=3suppressed 4 values. This is a privacy suppression issue, not an inference failure: the values were seen but filtered. Record type identifiers should NOT be subject to the privacy threshold — they're structural, not user content.Content block type coverage (Claude Code)
The schema captures
thinkingMetadataat message level but does NOT recognize"type": "thinking"as a content block type. Thinking blocks exist in real data but the schema doesn't model them.What the schema gets right
63 top-level properties capturing full record diversity. Correctly identifies
message.content[].typeas a semantic field with tool_use/tool_result enumeration. Captures rare fields at correct frequencies (agentName: 0.002).message_rolesemantic annotation ontypefield with score 0.85.What the schema misses
min_conversation_count=3suppresses legitimate record type values. Structural identifiers should be exempt.thinkingcontent block typemessage_role— should annotatemessage_body,message_timestamp,conversation_title, working directory, git branch.Sinity commentedon May 4, 2026
Sinity commentedon May 4, 2026
Also: VEC0_DDL hardcodes float[1024] in schema_ddl_aux.py. If model changed to voyage-4-large (2048 dim), vec0 table rejects vectors. Dimension should be model-config-driven, not hardcoded.
Sinity commentedon May 4, 2026
Acceptance Criteria
message_rolefields exempt frommin_conversation_countprivacy thresholddetect_drift()wired intodevtools schema-audit— drift detection produces actionable outputschema-promoteexercised end-to-end at least once (v2 package created)devtools schema-audit --checkfails when schemas are stale (>30 days) or drift detectedextract_reasoning_traces()no longer hardcodesreturn []— production DB shows >0% thinking for CodexWhen closing: comment on this issue or the PR explicitly stating how each criterion was satisfied, deferred, or found misframed.
Sinity commentedon May 4, 2026
File correction: Codex extract_reasoning_traces() is at polylogue/sources/providers/codex.py:266, not sources/parsers/codex.py. The function does return [] as claimed.
Sinity commentedon May 4, 2026
Prerequisite for embedding-powered features (L10-L16): once VEC0_DDL dimension is fixed, configure VOYAGE_API_KEY and run to populate the vec0 table. Currently 0 messages embedded — the entire semantic search, clustering, anomaly detection, dedup, and project memory designs depend on embeddings being live.
Sinity commentedon May 4, 2026
Correction: polylogue run embed does NOT work — the run command is not in the CLI command inventory. The embedding pipeline is fully built (execute_embed_stage, embed_conversation_sync, SqliteVecProvider, vec0 table) but has no surface.
Correct architecture: polylogued runs embedding as part of the ingestion convergence loop. After ingest, if a Voyage API key is configured (from a proper config entry, not scattered os.environ.get() calls), embed new messages automatically. If no key is configured, skip embedding — no error, just no embeddings. This is zero-config: the user sets one config value, everything else is automatic.
Currently 0 messages embedded. Error messages in query.py:384 and query.py:392 still reference polylogue run embed — stale, needs updating to point to polylogued config.
Sinity commentedon May 5, 2026
Linked focused implementation issue: #837.
Provider schema/parser drift remains tracked here, but the concrete storage problem found during analysis is now separate: parser-emitted provider protocol events, especially context compactions, need durable first-class archive rows instead of being read from
provider_meta.context_compactions. This keeps #800 focused on schema/parser coverage while #837 gives the immediate PR a precise closure target.Sinity commentedon May 5, 2026
Linked follow-up issue: #839.
Separate from schema regeneration, current archive rows still need semantic rematerialization for context/protocol artifacts. #839 tracks removing runtime projection fallbacks by making stored message/content/artifact rows authoritative for known Claude Code/Codex protocol artifacts.
Sinity commentedon May 6, 2026
Execution supplement
Mass-execution wave: #852 Wave 3 after #840 gives enough inventory direction.
Focused verification:
detect_drift()andschema-promotetests if those paths change;devtools schema-audit,devtools verify-schema-roundtrip,devtools render-all --check,devtools verify --quick, then fulldevtools verifybefore PR.Do not fold #841/#842/#839 implementation work back into this schema-drift root unless the PR explicitly closes those children too.
10 remaining items
docs(schema): inventory universal vs provider metadata (#874)
fix(schemas): annotate semantic roles before privacy threshold (#887)
fix(schemas): wire schema-staleness check into audit (#904)
fix(schemas): drop non-existent check_schema_drift from __all__
fix(schemas): structural role exemption, detect_drift wiring (#921)
docs(schema): inventory universal vs provider metadata (#874)
fix(schemas): annotate semantic roles before privacy threshold (#887)
fix(schemas): wire schema-staleness check into audit (#904)
fix(schemas): drop non-existent check_schema_drift from __all__
fix(schemas): structural role exemption, detect_drift wiring (#921)
Sinity commentedon May 8, 2026
Reopened during the closed-issue audit.
The closeout explicitly left core acceptance criteria unfinished: live provider schema regeneration, schema-promote end-to-end exercise, regenerated Claude Code content block coverage, and parser-side Codex reasoning/tool-use corrections. #818 may block regeneration, and #839/#864/#803 own adjacent semantic-storage work, but this issue is still the durable owner for the provider-schema regeneration/promote contract itself.
#944 should list this as reopened separately, not reconciled.
Sinity commentedon May 8, 2026
Closing: core implementation landed. Remaining edges are incremental.