Skip to content

Add bounded automatic lifecycle memory capture - #59

Merged
TerminallyLazy merged 1 commit into
mainfrom
codex/tree-ring-auto-memory-0.15.5
Aug 28, 2026
Merged

Add bounded automatic lifecycle memory capture#59
TerminallyLazy merged 1 commit into
mainfrom
codex/tree-ring-auto-memory-0.15.5

Conversation

@TerminallyLazy

@TerminallyLazy TerminallyLazy commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • add native Codex and Claude lifecycle hook adapters for session and subagent start/stop
  • recall bounded, receipt-backed context at start and issue a single agent-mediated capture checkpoint at stop
  • add strict agent-scoped capture constraints that reject sensitive data, transcripts, unsupported rings, and more than three candidates
  • package validated Codex and Claude plugin hook surfaces and bump Tree Ring Memory to 0.15.5

Verification

  • cargo fmt --all -- --check
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • python3 scripts/validate-plugin-packages.py
  • sh scripts/certify-tree-ring.sh
  • native Linux x86_64 and aarch64 Docker builds validated on Bookworm with max GLIBC 2.34

High-level PR Summary

This PR adds native lifecycle hooks for Codex and Claude that perform bounded automatic memory capture at session and subagent start/stop events. Start hooks execute receipt-backed recall, while stop hooks enforce a single agent-mediated checkpoint allowing zero to three strict, normal-sensitivity automatic captures through a new tree-ring capture command. The implementation includes lifecycle event parsing that deliberately ignores transcripts and sensitive fields, agent-scoped capture constraints that reject sensitive data and unsupported rings, updated plugin manifests bumping Tree Ring Memory to version 0.15.5, and comprehensive hook validation ensuring the lifecycle bridge never scrapes transcripts or runs background recorders.

⏱️ Estimated Review Time: 1-3 hours

💡 Review Order Suggestion
Order File Path
1 README.md
2 Cargo.toml
3 Cargo.lock
4 crates/tree-ring-memory-cli/Cargo.toml
5 crates/tree-ring-memory-cli/src/actions/remember.rs
6 crates/tree-ring-memory-cli/src/activation/lifecycle.rs
7 crates/tree-ring-memory-cli/src/activation/preflight.rs
8 crates/tree-ring-memory-cli/src/activation/adapters.rs
9 crates/tree-ring-memory-cli/src/activation/bridge.rs
10 crates/tree-ring-memory-cli/src/activation/manifest.rs
11 crates/tree-ring-memory-cli/src/activation/mod.rs
12 crates/tree-ring-memory-cli/src/activation/launcher.rs
13 crates/tree-ring-memory-cli/src/main.rs
14 crates/tree-ring-memory-cli/src/agent_awareness.rs
15 crates/tree-ring-memory-cli/tests/harness_activation_acceptance.rs
16 plugins/tree-ring-memory/hooks/codex-hooks.json
17 plugins/tree-ring-memory/hooks/codex-hook.sh
18 plugins/tree-ring-memory/hooks/claude-hooks.json
19 plugins/tree-ring-memory/hooks/claude-hook.sh
20 plugins/tree-ring-memory/commands/tree-ring-capture.md
21 plugins/tree-ring-memory/.codex-plugin/plugin.json
22 plugins/tree-ring-memory/.claude-plugin/plugin.json
23 plugins/tree-ring-memory/README.md
24 plugins/tree-ring-memory/PRIVACY.md
25 plugins/tree-ring-memory/SECURITY.md
26 plugins/tree-ring-memory/TERMS.md
27 plugins/tree-ring-memory/skills/tree-ring-memory/SKILL.md
28 plugins/tree-ring-memory/packaging/build-codex-skills-only.py
29 plugins/tree-ring-memory/packaging/codex-skills-only/.codex-plugin/plugin.json
30 skills/tree-ring-memory/SKILL.md
31 docs/integrations/agent-skill.md
32 docs/launch/tree-ring-memory-framework.md
33 docs/protocol/harness-activation.md
34 fixtures/harness-activation/codex.json
35 fixtures/harness-activation/claude-code.json
36 .claude-plugin/marketplace.json
37 scripts/validate-plugin-packages.py

Need help? Join our Discord

Summary by CodeRabbit

  • New Features
    • Added lifecycle hooks for session and subagent start/stop events in Codex and Claude Code.
    • Added strict, privacy-filtered automatic memory capture with up to three durable candidates per checkpoint.
    • Added a tree-ring capture command and lifecycle hook integration command.
    • Added a skills-only Codex package for environments without lifecycle hooks.
  • Documentation
    • Updated setup, privacy, security, and usage guidance for lifecycle capture and hook behavior.
  • Maintenance
    • Updated package versions and expanded validation for hooks and distributable packages.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eaf48bc9-2def-4fe2-b975-8f1fb7702c39

📥 Commits

Reviewing files that changed from the base of the PR and between 8fba7f3 and 1547608.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (36)
  • .claude-plugin/marketplace.json
  • Cargo.toml
  • README.md
  • crates/tree-ring-memory-cli/Cargo.toml
  • crates/tree-ring-memory-cli/src/actions/remember.rs
  • crates/tree-ring-memory-cli/src/activation/adapters.rs
  • crates/tree-ring-memory-cli/src/activation/bridge.rs
  • crates/tree-ring-memory-cli/src/activation/launcher.rs
  • crates/tree-ring-memory-cli/src/activation/lifecycle.rs
  • crates/tree-ring-memory-cli/src/activation/manifest.rs
  • crates/tree-ring-memory-cli/src/activation/mod.rs
  • crates/tree-ring-memory-cli/src/activation/preflight.rs
  • crates/tree-ring-memory-cli/src/agent_awareness.rs
  • crates/tree-ring-memory-cli/src/main.rs
  • crates/tree-ring-memory-cli/tests/harness_activation_acceptance.rs
  • docs/integrations/agent-skill.md
  • docs/launch/tree-ring-memory-framework.md
  • docs/protocol/harness-activation.md
  • fixtures/harness-activation/claude-code.json
  • fixtures/harness-activation/codex.json
  • plugins/tree-ring-memory/.claude-plugin/plugin.json
  • plugins/tree-ring-memory/.codex-plugin/plugin.json
  • plugins/tree-ring-memory/PRIVACY.md
  • plugins/tree-ring-memory/README.md
  • plugins/tree-ring-memory/SECURITY.md
  • plugins/tree-ring-memory/TERMS.md
  • plugins/tree-ring-memory/commands/tree-ring-capture.md
  • plugins/tree-ring-memory/hooks/claude-hook.sh
  • plugins/tree-ring-memory/hooks/claude-hooks.json
  • plugins/tree-ring-memory/hooks/codex-hook.sh
  • plugins/tree-ring-memory/hooks/codex-hooks.json
  • plugins/tree-ring-memory/packaging/build-codex-skills-only.py
  • plugins/tree-ring-memory/packaging/codex-skills-only/.codex-plugin/plugin.json
  • plugins/tree-ring-memory/skills/tree-ring-memory/SKILL.md
  • scripts/validate-plugin-packages.py
  • skills/tree-ring-memory/SKILL.md

📝 Walkthrough

Walkthrough

The CLI now supports strict automatic memory capture and lifecycle hooks for Codex and Claude Code. The change adds validation, hook installation, generated guidance, plugin packaging, skills-only distribution, compatibility updates, and expanded package and acceptance tests.

Changes

Lifecycle capture integration

Layer / File(s) Summary
Strict capture and lifecycle request contract
crates/tree-ring-memory-cli/src/actions/remember.rs, crates/tree-ring-memory-cli/src/activation/lifecycle.rs, crates/tree-ring-memory-cli/src/activation/preflight.rs, crates/tree-ring-memory-cli/src/main.rs
Adds the capture command and lifecycle hook processing. Capture requires agent identity, provenance, valid event-ring pairing, normal sensitivity, and indexed operation IDs.
Codex and Claude lifecycle activation
crates/tree-ring-memory-cli/src/activation/adapters.rs, crates/tree-ring-memory-cli/src/activation/bridge.rs, crates/tree-ring-memory-cli/src/activation/launcher.rs, crates/tree-ring-memory-cli/src/activation/manifest.rs
Adds native lifecycle capabilities, four-event hook bundles, Codex hook-file ownership, and Claude legacy-handler upgrades.
Plugin lifecycle hook registration
plugins/tree-ring-memory/.claude-plugin/plugin.json, plugins/tree-ring-memory/.codex-plugin/plugin.json, plugins/tree-ring-memory/hooks/*
Registers and launches SessionStart, SubagentStart, Stop, and SubagentStop hooks for both harnesses. The scripts resolve the project-local CLI and suppress duplicate managed hooks.
Guidance and skills-only package
README.md, crates/tree-ring-memory-cli/src/agent_awareness.rs, docs/*, plugins/tree-ring-memory/{README.md,PRIVACY.md,SECURITY.md,TERMS.md}, plugins/tree-ring-memory/skills/*, plugins/tree-ring-memory/packaging/*
Documents the automatic checkpoint and its privacy rules. Adds deterministic skills-only Codex ZIP generation without repository lifecycle hooks.
Package and acceptance validation
scripts/validate-plugin-packages.py, crates/tree-ring-memory-cli/tests/harness_activation_acceptance.rs, Cargo.toml, crates/tree-ring-memory-cli/Cargo.toml, fixtures/harness-activation/*, .claude-plugin/marketplace.json
Updates versions and fixtures. Validation now covers hook structure, subprocess behavior, generated files, deterministic packaging, lifecycle responses, and strict capture output.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CodexOrClaude as Codex or Claude Code
  participant HookScript as Harness hook script
  participant TreeRingCLI as Tree Ring CLI
  participant SQLite as SQLite memory store
  CodexOrClaude->>HookScript: Send lifecycle event
  HookScript->>TreeRingCLI: Forward JSON to integrations hook
  TreeRingCLI->>CodexOrClaude: Return recall context or capture checkpoint
  CodexOrClaude->>TreeRingCLI: Submit validated capture candidate
  TreeRingCLI->>SQLite: Store agent-scoped memory
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/tree-ring-auto-memory-0.15.5

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.97.1)

Clippy execution failed


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.

@TerminallyLazy
TerminallyLazy merged commit ca17b0e into main Aug 28, 2026
1 of 3 checks passed
@TerminallyLazy
TerminallyLazy deleted the codex/tree-ring-auto-memory-0.15.5 branch August 28, 2026 06:04
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