Skip to content

Add evidence-preserving context packing and governed Memory packet adapter - #22

Merged
rhein1 merged 3 commits into
mainfrom
codex/evidence-preserving-context-pack
Oct 14, 2026
Merged

rhein1 merged 3 commits into
mainfrom
codex/evidence-preserving-context-pack

Conversation

@rhein1

@rhein1 rhein1 commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Current-head review and validation — October 3, 2026

Exact head: c652d12a49749fcef54b7555ca0da002528c01dd; current main: 154bf0b220566d91d1a4aaf4390d9c3a54926c3a.

Independent read-only review completed all nine changed files and the relevant imports/callers, covering budget/dependency preservation, evidence and source binding, CLI I/O, the Memory adapter and package inclusion. No actionable source defect remained. This is a source-review result, not the repository's required approving GitHub review.

  • Current local targeted tests: node --test test/context-pack.test.mjs — 58 passed, 0 failed, 0 skipped.
  • Controlled producer-to-consumer gate: node scripts/validate-memory-context-pack.mjs <PINNED_MEMORY_CHECKOUT> — passed and verified producer blob 79ab8f628c003ec2834b4de09ed7f42ed4d53c53. Result-count and byte-cap cases retain selected=3, emitted snippets=1 and omitted=2. No Memory database, model or network was used.
  • Existing current-head CI: all eight checks pass. Literal checkout 8b78ae4d02f9478337065061cb9e24c5bcae0d5f has the same tracked tree as the reviewed branch. Full matrix tests: Ubuntu/macOS 176 passed + 1 platform skip; Windows 175 passed + 2 platform skips; zero failures.
  • git diff --check passed; the isolated review checkout remained clean. No CI rerun or source edit was needed.

All review conversations are resolved. The selected_chunks concern is refuted by the pinned actual producer and executed integration gate; the earlier Unicode, symlink-entrypoint and sparse-array findings have corrections and focused regressions at this head.

Required independent GitHub approval remains missing. Merge this PR normally before retargeting #23 to actual main; #25's independent Windows fixes remain preserved. Current tests do not qualify native Codex compaction/resume, real host Memory integration or token/task-quality savings.

Workflow trace: parent refreshed heads/base/protection/CI and owns record updates; worker /root/fable_ecf_review completed the source/caller review and targeted validation, read-only with no recursive delegation. The original author validation and single-agent trace below remain historical.

Summary

Implements the requested Fable context-packing augmentation on top of merged Laya PR #21. Working Node library/CLI, an adapter for Memory's inspected context-mode packet, executable synthetic demo, and regression tests—not only a design scaffold.

  • Whole redacted records retained verbatim and in original order; protected constraints, failures, findings, test results, actions, approvals, corrections, unknowns and run contracts cannot be dropped for a size target.
  • Tool-call/result atomic pairing; side-effecting and unknown-effect pairs protected; transitive dependencies and explicit required evidence preserved.
  • Deterministic optional-record ranking; complete JSON plus newline bounded by actual UTF-8 bytes; protected-context overflow fails rather than silently chopping evidence.
  • Separate host scope/policy/head/source-revision/digest binding; explicit omission manifest and upstream omission accounting. Hashes are integrity bindings, not signatures, authority or factual truth.
  • Explicit-file CLI pack / verify; bounded regular-file reads; no transcript discovery, model/API call, file mutation, Codex launch or configuration changes.
  • packReviewedMemory uses current host authorization/source-verification callbacks before and after verification, preserves required evidence refs, and never writes Memory or promotes completion evidence.

Preservation

Existing six skills, catalog, coordinator/worker models, wrappers, approval boundaries, Laya behavior, package/plugin versions, release claims, root marketplace and Actions workflow are unchanged. No native compaction replacement or automatic hook is installed. Source-only addition, not part of tagged alpha.2.

Validation performed

Local Node 22.16.0 on Linux:

  • node --test test/context-pack.test.mjs: 52 passed, 0 failed, 0 skipped.
  • Synthetic demo ran and emitted valid packed JSON, retaining the required failure/constraint and explicitly omitting the large old read.
  • Authored UTF-8 files checked for trailing whitespace/final newlines.

Coverage includes protected kinds, dependencies and cycles, pair integrity, Unicode byte limits, scope/head/policy/revision mismatches, digest tampering, incomplete upstream coverage, Memory denial/revocation, and actual CLI execution from an unrelated working directory.

Validation limitations

Container GitHub DNS failed, so a full checkout was unavailable. Current main, repository instructions, package validator and relevant source contracts were read through the GitHub connector. The full existing suite, PowerShell wrapper, packed-artifact gate and OS/Node matrix were not run locally; hosted checks must pass at this exact head before merge. No real Memory/context-mode/Codex process, native compaction/resume or resumed-task quality was evaluated. No token/cost/quality improvement is claimed.

The Memory adapter uses the inspected packet shape and controlled callbacks in tests. Real production ECF/source verification remains the trusted host's responsibility. The pure packer checks supplied bindings rather than querying live permissions. Neither packing nor pinning sanitizes prompt injection or renews historical approval.

Try it

node examples/context-pack/demo.mjs
node plugins/fable5-codex/scripts/context-pack.mjs pack --input REVIEWED_INPUT.json --binding REVIEWED_BINDING.json

Read docs/context-packing.md for the contract, privacy/retention boundary and integration requirements.

Sources

Original Agoragentic MIT code; selective-retention design inspiration from https://github.com/tamaratran/fast-jev-compaction . No upstream code, hosted transport, replay policy or Claude hook was imported.

Memory bridge.cjs blob inspected: 79ab8f628c003ec2834b4de09ed7f42ed4d53c53.
Official Codex hooks reviewed: https://developers.openai.com/codex/hooks . Post-compaction SessionStart context is documented; replacing the message list via PreCompact is not.

Workflow Trace

Single-agent multi-lens: source compatibility; evidence/authority; data/privacy; executable correctness; packaging. No real subagents available. No merge, deployment, registry publication, dependency installation, paid call or user configuration mutation. A separately reviewable standalone OSS Codex package will build on this core.

Retain protected records, paired tool calls and dependency closures within an
actual JSON byte budget. Add explicit host bindings, omission manifests,
Memory source revalidation, 52 offline regression tests, and a synthetic demo.
No model calls, automatic hooks, transcript edits or authority changes.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T03:16:43.328972Z 446f995 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 446f9958f5

ℹ️ 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 plugins/fable5-codex/lib/context-pack.mjs Outdated
Comment thread plugins/fable5-codex/scripts/context-pack.mjs Outdated
Comment thread plugins/fable5-codex/lib/context-pack.mjs Outdated
Comment thread plugins/fable5-codex/lib/context-pack-memory.mjs

rhein1 commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Validation update at 446f9958f5207b7b3ca1590b66f747e4499d18a3

Hosted Validate run #46 (35812894010) completed successfully. All eight jobs passed: Ubuntu/macOS/Windows on Node 18 and 24, Packed artifact, and the required Release gate. Each matrix job completed the existing repository tests, package checks, syntax/dry-run and whitespace steps. Those are hosted results; the complete gates were not claimed as run locally.

Local focused suite remains 52 passed, zero failed/skipped. The three core/IO/Memory source blob SHAs were read back at this exact head and match local tested bytes.

The requested independent OSS Codex edition is now implemented in stacked PR #23, based on this branch. Its extra 32 standalone tests and one shared-core parity test bring the combined focused local run to 85 passed. PR #23 has its own head/checks; this successful parent run does not validate that child head.

Review and merge this PR first, then retarget/review #23 against main. No merge, plugin activation, publication, live Memory/Codex session, or native compaction replacement has been performed.

@jmborden1112-beep jmborden1112-beep left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Needs Fixing

None. Reviewed context packing preserves protected constraints, provenance and explicit partial coverage. The governed Memory adapter rechecks host-controlled authorization and current source before and after assembly. The refresh incorporates the already-reviewed Windows cleanup fix from merged PR25.

Requires Human Review

None beyond the repository approval gate fulfilled here under the owner's second-account authorization. This is agent source review, not independent human sign-off.

Recommended Optional

None.

Create Follow-up Issue

None.

Workflow Trace: exact head1b5e00d9d63ee0c6e3c2b290702de78e514ef021; /root/fable_stack_review source lenses plus root verification, gpt-6-luna medium fallback. Refreshed local npm test174passed/3platformskips/0failed; real pinned Memory producer contract gate, Node/PowerShell package validators, and diff check pass. All eight refreshed-head CI checks pass, including packed artifact and Windows/POSIX matrices. No model calls, native compaction qualification, publication or user-plugin activation is claimed.

@rhein1
rhein1 merged commit 92ad926 into main Oct 14, 2026
8 checks passed
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.

2 participants