feat(memory): add structured provenance metadata#141
Merged
Conversation
fixes #106 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a structured MemoryProvenance record to replace ad-hoc provenance strings across session-memory extraction, hosted review memory candidates, and headless review artifacts, and bumps the headless contract to v3 to require provenance fields in review memory reporting.
Changes:
- Add
MemoryProvenance(structured fields + compact rendering) and extend memory frontmatter parsing/formatting to carry repository/commit/actor/session metadata. - Update session-memory persistence and hosted memory candidate JSON to store structured provenance, including best-effort git context capture.
- Extend headless review artifacts/schema/docs to report memory IDs plus file-level provenance and inline per-entry provenance strings; bump contract to v3.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src-rust/crates/query/src/session_memory.rs | Switch candidates and persistence APIs to MemoryProvenance; add frontmatter injection + provenance rendering in durable entries; add tests. |
| src-rust/crates/query/src/lib.rs | Capture git/actor context to build structured provenance for session-memory extraction; add origin parsing tests. |
| src-rust/crates/core/src/claudemd.rs | Add structured provenance type + new frontmatter fields; extend hosted prompt rendering and trust gating tests. |
| src-rust/crates/cli/tests/headless_contract/session-brief.schema.json | Bump contract version constant to v3. |
| src-rust/crates/cli/tests/headless_contract/session-brief.example.json | Update example to contract v3. |
| src-rust/crates/cli/tests/headless_contract/result.schema.json | Bump to v3 and require provenance fields for review memory entries. |
| src-rust/crates/cli/tests/headless_contract/result.example.json | Update example to contract v3. |
| src-rust/crates/cli/src/main.rs | Update headless contract-version test fixtures to v3. |
| src-rust/crates/cli/src/headless.rs | Bump contract constant; include structured provenance fields and inline provenance extraction in review artifacts; update tests. |
| docs/headless-contract.md | Document contract v3 and the new memory provenance fields; add migration note. |
| docs/configuration.md | Update memory-candidate and frontmatter docs to describe structured provenance and what is (not) stored. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+664
to
+667
| let after_first = &existing[3..]; | ||
| let Some(end) = after_first.find("\n---") else { | ||
| return format!("---\n{rendered_pairs}\n---\n{existing}"); | ||
| }; |
Comment on lines
+2104
to
+2107
| let memory_provenance = build_session_memory_provenance( | ||
| &session_id_clone, | ||
| &working_dir_clone, | ||
| ); |
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
Context
claurst-corememory metadata,claurst-querysession memory persistence, headless review artifact schema/docs.Changes
MemoryProvenancewith structured fields, compact rendering, frontmatter population helpers, and secure git context capture for session-memory extraction.Validation
Record exact commands and outcomes. Mark items N/A with a reason when they do not apply.
git diff --check— passed after rebase, exit 0.cargo fmt --all— passed after rebase, exit 0.cargo check --workspace— passed after rebase, exit 0.cargo clippy --workspace --all-targets -- -D warnings— passed after rebase, exit 0.cargo test --workspace— not run; targeted package tests covered touched Rust surfaces per issue instructions.cargo test --package claurst-query -- session_memory— 26 passed, 0 failed.cargo test --package claurst-core -- claudemd memdir— 57 passed, 0 failed.cargo test --package claurst -- headless— 40 passed, 0 failed.PR Readiness