Skip to content

feat: consolidate TraceDecay V2 PR8-PR13 delivery - #421

Draft
ScriptedAlchemy wants to merge 6772 commits into
masterfrom
codex/tracedecay-total-redesign-plan
Draft

feat: consolidate TraceDecay V2 PR8-PR13 delivery#421
ScriptedAlchemy wants to merge 6772 commits into
masterfrom
codex/tracedecay-total-redesign-plan

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

This draft PR is the consolidated delivery branch for TraceDecay V2 PR8 through PR13.

  • PR8: completed session/LCM temporal retrieval authority.
  • PR9/PR10: code intelligence, exact/lexical/graph retrieval, FastEmbed semantic projection, calibration, and byte-stable fallback.
  • PR11: application, policy, configuration, catalog, Git transaction, and feedback-cycle core.
  • PR12: CLI/MCP/HTTP/LSP production bindings and canonical diagnostics/impact readers.
  • PR13: Hook V2, Context Scout, host lifecycle/bundles, read-only GitHub/CI feedback, and agent proximity.

The branch also contains the supporting rusqlite runtime cutover, worktree-aware incremental indexing, storage retention/Doctor integration, and direct product tests required by the canonical V2 plans.

Verification

  • Focused PR8-PR13 product tests
  • cargo check --all-features
  • cargo test --all-features
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • Dashboard and host integration checks
  • Distribution/FastEmbed acceptance
  • Linux, macOS, and Windows CI

Current status: implementation is still being consolidated from the shared checkout and CI is red. This PR remains draft until the working tree is committed, broad verification is stable, and the historical conventional-commit blocker is resolved. It must not be merged in its current state.

Safety boundaries

GitHub review ingestion is read-only. Semantic indexing never blocks exact/lexical/graph retrieval and publishes only complete compatible generations. Local coordination logs, private transcript evidence, secrets, and ad hoc artifacts are excluded from commits.

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 89559b7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy ScriptedAlchemy added the WIP Work in progress; do not merge label Jul 10, 2026
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch from e50f8f5 to 4f5ab66 Compare July 10, 2026 05:54
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 986f25cca6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/plans/2026-07-09-tracedecay-brain-rewrite.md Outdated
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch 4 times, most recently from 5862bd6 to 53502de Compare July 11, 2026 16:52
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch 4 times, most recently from 642a33a to 5f2f610 Compare July 23, 2026 17:06
@ScriptedAlchemy ScriptedAlchemy changed the title [WIP] Plan TraceDecay V2 brain rewrite feat: consolidate TraceDecay V2 PR8-PR13 delivery Jul 24, 2026
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch from 76dee0f to 0258866 Compare July 24, 2026 17:16
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch from 062285a to b73f8bf Compare August 1, 2026 18:32
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch from ef68e05 to f92b7f9 Compare August 7, 2026 08:32
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/tracedecay-total-redesign-plan branch 2 times, most recently from 1486ceb to f44f5c5 Compare August 7, 2026 21:43
ScriptedAlchemy and others added 5 commits August 14, 2026 00:29
The plugin bundle is the roster agents actually read, and a tool nothing
references is a tool nothing calls. Add the mount audit to the Cursor
mcpAllowlist, the code-health auditor agent, the audit-safety,
check-health and clean-dead-code commands, and the code-health and
reviewing-changes skills — alongside dead_code and unused_imports, whose
findings it precedes: a file no build root reaches is dead wholesale, and
every symbol in it reads as live to the other three tools.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The README workflow groups and the USER-GUIDE code-quality table are
where a reader learns the tool exists at all, and the Rust probe matrix
is where it gets exercised against real repositories. Describe it by what
it answers rather than by one ecosystem's mechanism, so the entry stays
true as more ecosystems gain a reachability model.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
BREAKING CHANGE: cursor transcript records now write their session-location
metadata under `cursor_session_*` like every other provider. The previous
`cursor_event_*` namespace existed only so readers of already-persisted
metadata resolved the same keys — a persisted-shape compatibility exception
the V2 fresh-store cutover forbids. There is no dual-read fallback: readers
resolve the canonical key only, and an old store fails typed at admission
through the existing reset-required machinery, which this change does not
touch.

Because the namespace is now provider-uniform, `metadata_namespace` and its
cursor constants carry no decision and are gone; the reducer formats
`{provider}_session` at its one call site and the descriptor honestly
documents two provider-shaped decisions instead of three.

Also renames the misnamed "compatibility metadata hook": appending
`tool_calls`/`tool_events`/`tool_use_id` is live V2 normalization of cursor
records into the cross-provider shape, not legacy support. The type, the
selector, and the cursor implementation are now `ToolMetadataNormalizer`,
`tool_metadata_normalizer`, and `normalize_cursor_tool_metadata`.

The canonical_projection characterization tests that pinned `cursor_event`
are re-pinned to `cursor_session`. That is an intentional behavior change
under the cutover mandate, not a test repair.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Ingest failure classification named a reason code and a retryability
verdict but not the admission status, so the status had to be recovered
downstream by matching the reason-code string. One match now owns all
three: `classify_transcript_ingest_disposition` returns the new
`TranscriptIngestDisposition`, and `ClaudeObservationFailureClass`
carries a `status` alongside its reason code.

`TraceDecayError::hook_runtime_with_status` records that status on the
error so it survives the crate boundary. The status enum lives above
the runtime kernel, so the value travels as its canonical serde wire
spelling and `HostAdmissionStatus::as_wire`/`from_wire` round-trip it
without anyone re-deriving it. The spool open paths, which already hold
a `HostAdmissionOutcome`, report its status directly.

`classify_transcript_ingest_failure` keeps its signature and its
`TranscriptCatchUpFailure` shape, so catch-up telemetry is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ScriptedAlchemy and others added 30 commits August 15, 2026 02:52
The evaluation journey requires 7 projection cases (REQUIRED_PROJECTION_CASES) at 2 scales (REQUIRED_RESOURCE_SCALES = current, 10x), so it performs 14 real publishes, each re-hashing the whole recovered generation. Measuring only prepare understated the per-case cost.

Measured (768-d, prepare + publish + settle): 2048 chunks 2036ms, 4096 2766ms, 8192 5557ms, 22016 15011ms. Flat at 675-682us per chunk beyond the smallest scale: linear in corpus, paid once per case.
The digest probe timed only prepare+publish, so the per-pass corpus build
cost was invisible. At real width (43 pages / 22016 chunks, 768-d) the
corpus build is 28119ms against a 15629ms publish case: the build, not the
digest, dominates a pass. Reported as corpus_build_ms and pass_total_ms.
measure_evaluation_projection_cases stands up a fresh TempDir, grafeo
graph, and metadata store, then re-projects the whole corpus and runs
five real FastEmbed batches. It was called unconditionally once per
evaluation pass, while the driver runs one pass per profile x partition
x scale -- so the identical measurement was rebuilt six times per scale.

The measurement reads only the clean generation and the three mutation
sources, never the profile or partition, so memoize it on exactly those
four generation ids, mirroring the prepared_native cache beside it. The
lock is released across the measurement so a race duplicates work once
instead of blocking.
generate_candidate_outputs_with_native called generate_candidate_outputs, which publishes the 1x and 10x corpora, and then published byte-identical 1x and 10x corpora again for the native phase -- four full builds per evaluate-and-publish where two suffice.

publish_corpus_with_scale is a pure function of its four arguments: its content_identity hashes the corpus digest and copy count, captured_at and sealed_at are constants, files are sorted before building, and the publication store is created and dropped inside the call. Equal arguments therefore yield byte-identical generations down to the generation id, so sharing one build between the two phases is unobservable.

Cache the corpora by scale for the span of one call and let both phases read the same builds.
79211a2 added the required AutomationRunResultV1::request_digest but left
two fixtures behind it: the curation terminal passed a bare 64-hex string
the domain has always rejected as noncanonical, and the untagged
variant-selection fixture omitted the field entirely so it matched no
RetainedSurfaceResultV1 variant. Both now take the digest from
AutomationRunRequestV1::input_digest, reusing the helpers the sibling
automation tests already use, so no digest is hand-written.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Prices one publish_corpus_with_scale build against the real packaged workload, which is exactly what sharing the corpora between the fallback and native phases saves.

Measured: 1x = 2170 chunks in 2312ms; 10x = 21700 chunks in 23249ms. Linear at 1065-1071us per chunk, so the removed duplicate pair costs 25.6s per evaluate-and-publish.
Message search and the direct LCM anchor query carried the multi-MiB
ExecutionLimits defaults, which the admitted application binding refuses
terminally — every such retrieval answered Saturated instead of
searching. All admitted-path queries now size against one shared
APPLICATION_RETRIEVAL_MAX_BYTES via admitted_execution_limits, which
narrows only the four checked budgets and leaves ranking pools at their
defaults so recall is not silently traded away. Completes 11184ac;
lcm_claude_recall passes 4/4.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
measure_incremental_evaluation_projection reloads the semantic artifact
and re-projects the incremental generation's changed chunks. It reads
only the prepared generation and the incremental generation -- never the
profile or the partition -- so the twelve passes the driver runs
(3 profiles x 2 partitions x 2 scales) rebuilt one identical observation
per scale six times over.

Memoize it on exactly that generation pair, mirroring the projection-case
cache beside it. Every field it returns is a property of the pair, each
pass records them as its own single-element sample vectors with no
averaging across passes, and the existing post-measurement binding check
re-validates the cached resources against the pass context, so a stale or
mismatched entry is rejected rather than reported.

The lock is released across the measurement so a race duplicates work
once instead of blocking.
The planner-scale root-retrieval test seeded 100k occurrence and summary
rows with ordinary exact-SQL batches, which carry the 30s per-statement
deadline enforced by the exact SQL guard's progress handler. Chunking at
20k rows only widened the margin; under CPU contention a seeding chunk
still crossed the deadline and SQLite returned SQLITE_INTERRUPT, so the
fixture aborted before a single asserted query ran. Reproduced at load
average 104 on 96 cores.

Bulk seeding is exactly the work authorized long-lease transactions
exist for, alongside schema installation and full-index replacement.
Route the chunks and the trailing ANALYZE through
execute_authority_revalidated_batch, which drops the ordinary statement
deadline while keeping shutdown, idleness, and authority revocation as
cancellation conditions, and renews the lease on each committed chunk.

No assertion changes: row counts, index-keyset checks, and query-plan
expectations are untouched, and the fixture stays planner-scale at 100k
rows per table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP Work in progress; do not merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant