Skip to content

refactor: add QMD session artifact identity mapping#89360

Closed
jalehman wants to merge 1 commit into
clawdbot-d02.1.9.1.25/31b-memory-session-sync-identity-apifrom
clawdbot-d02.1.9.1.26/31b-qmd-session-artifact-identity-contract
Closed

refactor: add QMD session artifact identity mapping#89360
jalehman wants to merge 1 commit into
clawdbot-d02.1.9.1.25/31b-memory-session-sync-identity-apifrom
clawdbot-d02.1.9.1.26/31b-qmd-session-artifact-identity-contract

Conversation

@jalehman

@jalehman jalehman commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What

Adds an internal QMD session artifact identity mapping so generated QMD Markdown session artifacts resolve back to stable transcript memory/session identity before deprecated filename fallback.

Why

Path 3 needs QMD search hits to stop treating generated Markdown artifact names as canonical session identity. QMD still needs Markdown files to index transcript content, but those files are search artifacts; identity should come from a storage-neutral transcript memory key/session mapping.

Refs #88838. Builds on #89348.

Changes

  • Add QMD artifact mapping
  • Store identity in QMD index
  • Prefer mapped session identity
  • Preserve archived compatibility
  • Guard live orphan hits
  • Cover visibility regressions
File Change
extensions/memory-core/src/qmd-session-artifacts.ts Adds private artifact mapping helper
extensions/memory-core/src/memory/qmd-manager.ts Writes and attaches QMD mappings
extensions/memory-core/src/session-search-visibility.ts Prefers mapped session identity
extensions/memory-core/src/session-search-visibility.test.ts Covers mapped visibility behavior

Testing

  • node scripts/run-vitest.mjs extensions/memory-core/src/session-search-visibility.test.ts extensions/memory-core/src/memory/qmd-manager.slugified-paths.test.ts
  • pnpm exec oxfmt --check <touched files>
  • node scripts/run-oxlint.mjs <touched files>
  • pnpm tsgo:extensions
  • pnpm tsgo:test:extensions
  • git diff --check
  • Autoreview completed with no accepted/actionable findings

This uses memory-core's existing QMD SQLite index/cache only. It does not add a public SessionCorpusEntry SDK, 3.2 session/transcript SQLite store modules, production storage flip, runtime dual-read/fallback, JSON sidecar, or doctor migration.

@clawsweeper

clawsweeper Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 22, 2026, 12:34 AM ET / 04:34 UTC.

Summary
This PR adds a private memory-core QMD artifact-to-session identity mapping table, attaches mapped identity to QMD session search hits, and makes session search visibility prefer that mapped identity before filename fallback.

PR surface: Source +425, Tests +242. Total +667 across 4 files.

Reproducibility: not applicable. this is an internal staged refactor/migration PR rather than a standalone bug report. Source inspection shows the intended mapped-identity path, but this PR body and comments do not show real QMD export/search proof.

Review metrics: 1 noteworthy metric.

  • Private QMD identity storage: 1 SQLite table added. The PR adds persisted artifact-to-session identity state inside QMD's index, so stale-index and session-visibility behavior matter before merge.

Stored data model
Persistent data-model change detected: database schema: extensions/memory-core/src/qmd-session-artifacts.ts, serialized state: extensions/memory-core/src/session-search-visibility.test.ts, serialized state: extensions/memory-core/src/session-search-visibility.ts, unknown-data-model-change: extensions/memory-core/src/memory/qmd-manager.ts, unknown-data-model-change: extensions/memory-core/src/qmd-session-artifacts.ts, unknown-data-model-change: extensions/memory-core/src/session-search-visibility.test.ts, and 4 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal output or logs showing a real QMD export/search hit resolving through mapped session identity, with private paths, tokens, phone numbers, endpoints, and other sensitive details redacted.
  • Have maintainers decide whether this protected draft should stay parked behind refactor: add memory and QMD session identity mapping #95087 or be revived as the smaller slice.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body and comments list tests/checks and supersession notes, but do not include redacted live output, logs, terminal output, screenshots, recordings, or linked artifacts showing after-fix QMD mapped identity behavior; after adding proof, update the PR body so ClawSweeper can re-review, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The protected maintainer label means cleanup closure and merge routing need explicit maintainer handling.
  • [P1] The replacement at refactor: add memory and QMD session identity mapping #95087 has real behavior proof but is currently conflicting, so it is not yet a safe terminal superseding target for this PR.
  • [P1] This PR itself still lacks after-fix real behavior proof showing QMD export/search hits resolving through mapped session identity.
  • [P1] The private QMD identity table changes session search visibility; stale or wrong mappings could hide or mis-associate session search results.

Maintainer options:

  1. Park Behind The Combined Replacement (recommended)
    Keep this PR open but inactive while maintainers resolve refactor: add memory and QMD session identity mapping #95087 conflicts and decide whether that combined branch is the review path.
  2. Revive The Smaller Slice With Proof
    If maintainers prefer this narrow branch, require redacted terminal output or logs showing a real QMD export/search hit resolving through mapped session identity before merge.
  3. Accept The Session-State Risk
    Maintainers may intentionally merge a smaller QMD-only slice, but they should explicitly accept stale-index and visibility behavior for the private mapping table first.

Next step before merge

  • [P1] The remaining action is maintainer stack direction plus real behavior proof or conflict resolution on the replacement PR; this is not a narrow automated repair.

Security
Cleared: No concrete security or supply-chain concern found; the diff is internal memory-core TypeScript/tests and does not change dependencies, workflows, secrets, permissions, or downloaded code.

Review details

Best possible solution:

Park this protected draft while maintainers resolve or review #95087 as the combined replacement, or explicitly revive this smaller slice with real QMD mapped-identity proof.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is an internal staged refactor/migration PR rather than a standalone bug report. Source inspection shows the intended mapped-identity path, but this PR body and comments do not show real QMD export/search proof.

Is this the best way to solve the issue?

Unclear for this PR as the landing path: the QMD mapping shape is plausible, but the author now points to #95087 as the combined replacement. The best solution depends on maintainer stack direction and a clean replacement branch or fresh proof for this smaller slice.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a594d2ce7325.

Label changes

Label justifications:

  • P2: This is a normal-priority internal memory-core migration slice with bounded scope but meaningful session search visibility impact.
  • merge-risk: 🚨 session-state: The PR changes how QMD search artifacts resolve to session identity before visibility filtering, which could mis-associate or hide session history if mappings are stale or wrong.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body and comments list tests/checks and supersession notes, but do not include redacted live output, logs, terminal output, screenshots, recordings, or linked artifacts showing after-fix QMD mapped identity behavior; after adding proof, update the PR body so ClawSweeper can re-review, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +425, Tests +242. Total +667 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 441 16 +425
Tests 1 243 1 +242
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 684 17 +667

What I checked:

  • Repository policy applied: Root policy requires full AGENTS review and treats plugin APIs, auth/session state, persisted preferences, migrations, fallback behavior, and session-state surfaces as compatibility-sensitive review areas. (AGENTS.md:28, a594d2ce7325)
  • Scoped extension policy applied: The scoped extensions guide says bundled plugin production code should use plugin SDK imports and treats extension files as private unless promoted through documented plugin surfaces. (extensions/AGENTS.md:27, a594d2ce7325)
  • Live PR state is protected and unproven: GitHub reports this PR open, draft, mergeable, labeled maintainer and status: 📣 needs proof, and the PR body has no real behavior proof section; the author comments twice say it is superseded by refactor: add memory and QMD session identity mapping #95087. (c14d91e43907)
  • Current main does not implement the mapping: Current main has no qmd-session-artifacts module, QMD_SESSION_ARTIFACT symbol, openclaw_qmd_session_artifacts table, or readQmdSessionArtifactIdentity path under the relevant memory-core/session files. (a594d2ce7325)
  • Current main uses filename-derived visibility: The current visibility filter still calls extractTranscriptIdentityFromSessionsMemoryHit(hit.path) directly for session hits, so QMD Markdown artifact names remain part of the identity fallback path on main. (extensions/memory-core/src/session-search-visibility.ts:87, a594d2ce7325)
  • Current main exports QMD markdown without identity mapping: Current exportSessions() writes <session>.md artifacts and tracks exported state, but does not persist a separate artifact-to-session mapping. (extensions/memory-core/src/memory/qmd-manager.ts:2528, a594d2ce7325)

Likely related people:

  • jalehman: Authored the current PR, the proof-positive replacement PR, and the merged adjacent SDK transcript identity target API that this QMD mapping builds on. (role: recent Path 3 API contributor and stack context holder; confidence: high; commits: c14d91e43907, 0c90ccb6c280, 7a0d36f3d0e1; files: extensions/memory-core/src/qmd-session-artifacts.ts, extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/session-search-visibility.ts)
  • vincentkoc: Current-main blame and recent history for the visibility filter, QMD manager, and memory host types point to recent work by Vincent Koc on the affected area. (role: recent memory-core and QMD area contributor; confidence: high; commits: 095a44c8de4d, c645ec4555c0, 118a4974966d; files: extensions/memory-core/src/session-search-visibility.ts, extensions/memory-core/src/memory/qmd-manager.ts, packages/memory-host-sdk/src/host/types.ts)
  • steipete: Shortlog and path history show substantial earlier ownership of qmd-manager.ts and memory/QMD architecture refactors adjacent to this change. (role: major QMD and memory refactor contributor; confidence: medium; commits: 77e6e4cf87f7, 645c7b189757, 30c686423f12; files: extensions/memory-core/src/memory/qmd-manager.ts)
  • Takhoffman: Path history shows adjacent QMD recall and memory excerpt work that shares the search-result visibility surface touched here. (role: adjacent QMD search/context contributor; confidence: medium; commits: 4f00b769251d, 885209ed0330; files: extensions/memory-core/src/memory/qmd-manager.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 2, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

Superseded by #95087.

The replacement draft bundles this QMD artifact identity mapping slice with its memory session sync identity dependency from #89348, stacked on #95030. That keeps the QMD search-visibility behavior and identity-targeted refresh API together under one current review/proof bundle.

@jalehman

Copy link
Copy Markdown
Contributor Author

Superseded by #95087.

#95087 combines this QMD artifact-to-session identity mapping slice with the memory session sync identity API from #89348 so mapped QMD visibility and identity-scoped memory sync are reviewed and proved together on the post-#95030 main base.

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 20, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #95087, which merged the QMD session artifact identity mapping together with the memory session sync identity API in one reviewed Path 3 replacement PR. #89360 remains useful history, but it is no longer the active review/merge target.

@jalehman jalehman closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant