Skip to content

[codex] Render memory context packs - #224

Merged
delete-cloud merged 1 commit into
mainfrom
codex/context-system-g23-memory-context-pack
May 19, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
codex/context-system-g23-memory-context-pack

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • render MemoryPlugin grounding through ContextPack as reference material
  • omit unevidenced memories from default grounding
  • add session/tape-entry evidence fields to ContextPack EvidenceRef
  • add G23 task packet and progress ledger

Verification

  • Baseline: uv run pytest tests/coding_agent/plugins/test_memory.py -v (21 passed before G23 edits)
  • Red: uv run pytest tests/coding_agent/plugins/test_memory.py -k "build_context or TopicScopedRecall" -v (3 failed, 3 passed, 16 deselected before implementation)
  • Red: uv run pytest tests/coding_agent/test_context_pack.py -k "memory_session_evidence" -v (1 failed, 4 deselected before EvidenceRef support)
  • uv run pytest tests/coding_agent/plugins/test_memory.py -k "build_context or TopicScopedRecall" -v (6 passed, 16 deselected)
  • uv run pytest tests/coding_agent/test_context_pack.py -k "memory" -v (3 passed, 2 deselected)
  • uv run ruff format --check src/coding_agent/plugins/memory.py src/coding_agent/context_pack.py tests/coding_agent/plugins/test_memory.py tests/coding_agent/test_context_pack.py
  • uv run ruff check src/coding_agent/plugins/memory.py src/coding_agent/context_pack.py tests/coding_agent/plugins/test_memory.py tests/coding_agent/test_context_pack.py
  • git diff --check -- .
  • uv run pytest tests/coding_agent/plugins/test_memory.py tests/coding_agent/test_context_pack.py -v (27 passed)
  • uv run pytest tests/coding_agent/ -k "context_pack or retrieval or memory or evaluation" -v (51 passed, 585 deselected)
  • uv run pytest tests/agentkit/runtime/test_pipeline.py -k "build_context" -v (7 passed, 30 deselected)

Review

  • Local subagent review was requested but did not return within the configured timeout; manual staged-diff review found no P1/P2 issues.
  • CodeRabbit is not a blocking gate per user instruction when unavailable or pending.

Summary by CodeRabbit

  • New Features

    • Memory context now includes evidence-backed references with session and tape entry identifiers to trace memory origins.
    • Improved memory filtering and rendering for more accurate context grounding and selection.
  • Documentation

    • Added G23 goal progress documentation detailing memory retrieval and evidence-backed reference context implementation.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 68e38f2a-5525-440f-8013-da7c463d6bfa

📥 Commits

Reviewing files that changed from the base of the PR and between 9a0e2ae and 42600ee.

📒 Files selected for processing (6)
  • coding-agent/.opencode/prompts/tasks/context-system-g23-memory-context-pack.md
  • coding-agent/docs/context_system/GOAL_PROGRESS.md
  • coding-agent/src/coding_agent/context_pack.py
  • coding-agent/src/coding_agent/plugins/memory.py
  • coding-agent/tests/coding_agent/plugins/test_memory.py
  • coding-agent/tests/coding_agent/test_context_pack.py

📝 Walkthrough

Walkthrough

Memory grounding is converted from simple string-based system messages to evidence-backed ContextPack reference material. EvidenceRef gains optional session and tape-entry identifiers. MemoryPlugin.build_context() now renders memories through ContextPack with deterministic source hashing, and tests are updated to validate the new output format.

Changes

Memory Evidence-Backed Context Rendering

Layer / File(s) Summary
EvidenceRef extension and rendering
coding-agent/src/coding_agent/context_pack.py, coding-agent/tests/coding_agent/test_context_pack.py
EvidenceRef gains optional session_id and tape_entry_id fields that are serialized and rendered in evidence output. New test validates rendering of memory evidence with session and tape identifiers.
Memory plugin context-pack grounding
coding-agent/src/coding_agent/plugins/memory.py
MemoryPlugin.build_context() is refactored to render memories as ContextPack sections instead of string messages. New helpers normalize summaries, convert evidence to EvidenceRef objects, and compute deterministic source_id via SHA-256 hash of normalized summary/tags/evidence.
Memory plugin test updates
coding-agent/tests/coding_agent/plugins/test_memory.py
Fixtures now include evidence dicts. Assertions tightened to exact expected formatted output with evidence-referenced memory lines. New helper _repo_file_evidence() generates standardized evidence. Topic-scoped and tag-overlap tests adjusted to match filtering and output format.
Task specification and progress tracking
coding-agent/.opencode/prompts/tasks/context-system-g23-memory-context-pack.md, coding-agent/docs/context_system/GOAL_PROGRESS.md
New task spec defines G23 acceptance criteria and scope. Progress entry documents implementation changes, test results, and remaining risks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#213: Establishes the G12–G24 phase ledger structure in GOAL_PROGRESS.md that this PR extends with the new G23 evidence-backed memory context entry.

Poem

🐇 Hopping through memories with evidence in tow,
Session IDs dancing in context's grand show,
Hash-based sourcing, no mysteries remain,
Reference and render—a cleaner refrain!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/context-system-g23-memory-context-pack

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@delete-cloud
delete-cloud merged commit ff5a58e into main May 19, 2026
1 check was pending
@delete-cloud
delete-cloud deleted the codex/context-system-g23-memory-context-pack branch May 19, 2026 09:21
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.

1 participant