Skip to content

feat: Memory using mempalace#121

Open
adrianriobo wants to merge 1 commit into
aipcc-cicd:mainfrom
adrianriobo:fix-46
Open

feat: Memory using mempalace#121
adrianriobo wants to merge 1 commit into
aipcc-cicd:mainfrom
adrianriobo:fix-46

Conversation

@adrianriobo

@adrianriobo adrianriobo commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

This commit introduces a memory framework for claude, this allow claudio to extend its usage beyond a single session

Fixes #46

Summary by CodeRabbit

  • New Features

    • Added persistent memory functionality via MemPalace integration, allowing Claude to retain information across conversations with optional setup instructions for local and CI/CD environments.
  • Bug Fixes

    • Enhanced security by pinning Python OpenSSL to version 26.0.0+.
  • Documentation

    • Added comprehensive guides for container setup, memory configuration, and integration steps.
  • Chores

    • Updated dependency version management automation.

@adrianriobo

Copy link
Copy Markdown
Contributor Author

@jrusz Added as WIP but it is fully functional in case you wanna give a try to compare.

@adrianriobo adrianriobo changed the title WIP: feat: Memory using mempalace feat: Memory using mempalace Apr 21, 2026

@jrusz jrusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall the integration approach is solid and follows claudio's patterns well. Renovate tracking, opt-in gating via env var, and hook placement all look good.

One thing I couldn't comment on inline: conf/.mempalace/config.json is empty (0 bytes). If mempalace expects valid JSON, this could cause parse errors — should it be {} at minimum?

Comment thread conf/.claude/settings.json Outdated
Comment thread Containerfile Outdated
Comment thread conf/.mempalace/config.json

@jrusz jrusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added some mostly nitpick comments, should be fine as is though

@jrusz jrusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1dd79082-551a-41bf-9593-8f1b55b99305

📥 Commits

Reviewing files that changed from the base of the PR and between fc0191b and 393d376.

📒 Files selected for processing (8)
  • CLAUDE.md
  • Containerfile
  • README.md
  • conf/.claude/context.d/CLAUDE-base.md
  • conf/.claude/context.d/CLAUDE-memory.md
  • conf/.claude/settings.json
  • conf/.mempalace/config.json
  • renovate.json
✅ Files skipped from review due to trivial changes (3)
  • conf/.mempalace/config.json
  • README.md
  • conf/.claude/context.d/CLAUDE-base.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • conf/.claude/settings.json
  • renovate.json
  • Containerfile

📝 Walkthrough

Walkthrough

Integrates MemPalace as an opt-in persistent memory plugin into the Claudio container image. The Containerfile installs the pinned MemPalace package, registers and configures its hooks, and fixes a pyopenssl CVE. Claude agent configuration gains MCP permissions and a memory-protocol context file. Renovate tracks the MemPalace PyPI version. README and a new CLAUDE.md document the full feature.

Changes

MemPalace Memory Integration

Layer / File(s) Summary
Container build: pyopenssl fix and MemPalace provisioning
Containerfile, renovate.json, conf/.mempalace/config.json
Containerfile pins pyopenssl>=26.0.0 for a CVE fix and adds a RUN layer that sets MEMPALACE_V/MEMPAL_SAVE_INTERVAL, installs the MemPalace Python package, registers and installs the plugin, validates the hook script structure, and rewrites SAVE_INTERVAL to use ${MEMPAL_SAVE_INTERVAL:-15}. renovate.json adds a customManagers entry to auto-update MEMPALACE_V from PyPI. conf/.mempalace/config.json sets palace_path to /home/claudio/.mempalace/palace.
Claude agent memory protocol and permissions
conf/.claude/settings.json, conf/.claude/context.d/CLAUDE-memory.md, conf/.claude/context.d/CLAUDE-base.md
settings.json adds four mempalace MCP capability entries (mempalace_status, mempalace_diary_read, mempalace_search, mempalace_add_drawer). New CLAUDE-memory.md defines the full memory-protocol: sole-memory-store rule, mandatory wake-up tool calls, post-work mempalace_add_drawer obligations, and fact update rules. CLAUDE-base.md removes stale tool-guidance bullets and adds an absolute-path directive for claudio-skills scripts.
User-facing documentation
README.md, CLAUDE.md
README.md gains a Memory section documenting MEMPAL_ENABLED, the fixed palace path, hook scripts, MEMPAL_SAVE_INTERVAL default, and local/GitLab CI enablement steps. New CLAUDE.md documents the full project: purpose, key files, build/run, architecture, dependency management, release process, CI/CD outputs, GitLab CI integration, and MemPalace integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • aipcc-cicd/claudio#136: Also modifies Containerfile to pin pyopenssl>=26.0.0 to address the same CVE fix introduced in this PR.
  • aipcc-cicd/claudio#153: Modifies the same Containerfile pyopenssl CVE workaround that this PR introduces, removing it in the retrieved PR.

Suggested reviewers

  • jrusz
  • gnaponie
  • ppitonak

Poem

🐇 Hop, hop, I skip through the palace halls,
Each memory stored behind MemPalace walls.
A hook fires on Stop, another on Compact,
The claudio bunny keeps all knowledge intact!
MEMPAL_ENABLED=true — the past never fades,
My kingdom of facts through the session cascade. 🏰

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Memory using mempalace' clearly summarizes the main change: introducing memory capabilities via the mempalace integration for session persistence.
Linked Issues check ✅ Passed The PR implements long-lived sessions by integrating MemPalace for persistent memory across sessions and configures environment variables for session management, directly addressing issue #46 requirements.
Out of Scope Changes check ✅ Passed All changes are in-scope: CLAUDE.md and README documentation, Containerfile with MemPalace provisioning, Claude context/settings configuration, MemPalace configuration, and Renovate update automation all support the memory feature.
Description check ✅ Passed The PR has a clear description explaining the memory framework integration with mempalace and references issue #46 about long-lived sessions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLAUDE.md`:
- Line 71: Update the version string in CLAUDE.md to match the Makefile VERSION
value; specifically change the current line containing "Current version:
`0.6.0-dev`" to reflect `0.6.1-dev` (or alternatively update the Makefile
VERSION to `0.6.0-dev` if the Makefile is wrong) so the documented version and
the VERSION variable are consistent.
- Line 16: Update the documentation entry referencing the environment variable
for starting MemPalace: replace the incorrect `MEMPAL_DIR` with the actual
variable `MEMPAL_ENABLED` (or vice-versa if you prefer to change the
implementation) so docs and code match; check `entrypoint.sh`, README.md, and
CLAUDE.md for any other occurrences of `MEMPAL_DIR` and ensure they consistently
use `MEMPAL_ENABLED` (or update the code to use `MEMPAL_DIR`) and keep the
descriptive text about starting MemPalace unchanged.

In `@conf/.claude/context.d/CLAUDE-memory.md`:
- Around line 12-14: The fenced code block containing the ToolSearch call lacks
a language identifier (MD040); update the triple-backtick fence that wraps the
line starting with ToolSearch(...) to include a language tag such as text (e.g.,
```text) so markdownlint passes; ensure the opening fence immediately preceding
the ToolSearch(...) line is changed and the closing fence remains intact.
- Around line 7-20: The startup steps are contradictory: the text says run steps
1–3 but then instructs to call “both tools in parallel” while three tool calls
are listed (ToolSearch, mempalace_status, mempalace_diary_read, and
mempalace_search). Fix by making the language consistent: replace the “both
tools in parallel” phrase with “all three tools in parallel” (or explicitly
state which two if only two are intended) and ensure ordering: run
ToolSearch(query: ...) first, then call mempalace_status and
mempalace_diary_read (agent_name: "session-hook", last_n: 5) in parallel and
call mempalace_search(query: "<topic>") as required before answering about past
work; update the documentation text to reference the exact tool names
(ToolSearch, mempalace_status, mempalace_diary_read, mempalace_search) so there
is no ambiguity.

In `@Containerfile`:
- Around line 99-105: The Dockerfile sets ENV MEMPAL_SAVE_INTERVAL to 5 but the
sed replacement in the mempal_save_hook.sh uses a different fallback
(${MEMPAL_SAVE_INTERVAL:-15}), causing inconsistent defaults; update the sed
command to use the same default (change ${MEMPAL_SAVE_INTERVAL:-15} to
${MEMPAL_SAVE_INTERVAL:-5}) or alternatively change ENV MEMPAL_SAVE_INTERVAL to
15 so both places match; modify the sed invocation that targets SAVE_INTERVAL in
${HOME}/.claude/plugins/marketplaces/mempalace/hooks/mempal_save_hook.sh so its
fallback aligns with the ENV value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f16d28e5-7c33-4f17-94a5-3d279790f8f2

📥 Commits

Reviewing files that changed from the base of the PR and between 1a272b3 and fc0191b.

📒 Files selected for processing (9)
  • CLAUDE.md
  • Containerfile
  • Makefile
  • README.md
  • conf/.claude/context.d/CLAUDE-base.md
  • conf/.claude/context.d/CLAUDE-memory.md
  • conf/.claude/settings.json
  • conf/.mempalace/config.json
  • renovate.json

Comment thread CLAUDE.md
| File | Purpose |
|---|---|
| `Containerfile` | Multi-stage OCI image build (preparer → final) |
| `entrypoint.sh` | Container startup: configures git identity, SSH signing key, gcloud auth, starts MemPalace if `MEMPAL_DIR` is set |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistent variable name in documentation.

Line 16 mentions MEMPAL_DIR but the actual variable used throughout README.md and the implementation is MEMPAL_ENABLED. This could confuse users.

Proposed fix
-| `entrypoint.sh` | Container startup: configures git identity, SSH signing key, gcloud auth, starts MemPalace if `MEMPAL_DIR` is set |
+| `entrypoint.sh` | Container startup: configures git identity, SSH signing key, gcloud auth, starts MemPalace if `MEMPAL_ENABLED` is set |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `entrypoint.sh` | Container startup: configures git identity, SSH signing key, gcloud auth, starts MemPalace if `MEMPAL_DIR` is set |
| `entrypoint.sh` | Container startup: configures git identity, SSH signing key, gcloud auth, starts MemPalace if `MEMPAL_ENABLED` is set |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CLAUDE.md` at line 16, Update the documentation entry referencing the
environment variable for starting MemPalace: replace the incorrect `MEMPAL_DIR`
with the actual variable `MEMPAL_ENABLED` (or vice-versa if you prefer to change
the implementation) so docs and code match; check `entrypoint.sh`, README.md,
and CLAUDE.md for any other occurrences of `MEMPAL_DIR` and ensure they
consistently use `MEMPAL_ENABLED` (or update the code to use `MEMPAL_DIR`) and
keep the descriptive text about starting MemPalace unchanged.

Comment thread CLAUDE.md
2. Tag the commit: `make tag` (creates `v<VERSION>` git tag)
3. Push the tag — the `build.yml` workflow publishes to Quay and GHCR

Current version: `0.6.0-dev`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Version mismatch with Makefile.

The documented version 0.6.0-dev doesn't match the VERSION in Makefile which is 0.6.1-dev.

Proposed fix
-Current version: `0.6.0-dev`
+Current version: `0.6.1-dev`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Current version: `0.6.0-dev`
Current version: `0.6.1-dev`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CLAUDE.md` at line 71, Update the version string in CLAUDE.md to match the
Makefile VERSION value; specifically change the current line containing "Current
version: `0.6.0-dev`" to reflect `0.6.1-dev` (or alternatively update the
Makefile VERSION to `0.6.0-dev` if the Makefile is wrong) so the documented
version and the VERSION variable are consistent.

Comment thread conf/.claude/context.d/CLAUDE-memory.md
Comment on lines +12 to +14
```
ToolSearch(query: "select:mcp__plugin_mempalace_mempalace__mempalace_status,mcp__plugin_mempalace_mempalace__mempalace_diary_read")
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language identifier to the fenced code block (MD040).

This currently violates markdownlint and can fail docs quality gates.

Suggested fix
-```
+```text
 ToolSearch(query: "select:mcp__plugin_mempalace_mempalace__mempalace_status,mcp__plugin_mempalace_mempalace__mempalace_diary_read")
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 12-12: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @conf/.claude/context.d/CLAUDE-memory.md around lines 12 - 14, The fenced
code block containing the ToolSearch call lacks a language identifier (MD040);
update the triple-backtick fence that wraps the line starting with
ToolSearch(...) to include a language tag such as text (e.g., ```text) so
markdownlint passes; ensure the opening fence immediately preceding the
ToolSearch(...) line is changed and the closing fence remains intact.


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- d98c2f50 -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment thread Containerfile
Comment on lines +99 to +105
ENV MEMPAL_SAVE_INTERVAL 5
RUN pip install --no-cache-dir MemPalace==${MEMPALACE_V}; \
claude plugin marketplace add MemPalace/mempalace@v${MEMPALACE_V};\
claude plugin install --scope user mempalace; \
grep -q '^SAVE_INTERVAL=[0-9]' ${HOME}/.claude/plugins/marketplaces/mempalace/hooks/mempal_save_hook.sh || \
{ echo 'ERROR: SAVE_INTERVAL pattern not found in hook script'; exit 1; }; \
sed -i 's/^SAVE_INTERVAL=[0-9]\+/SAVE_INTERVAL="${MEMPAL_SAVE_INTERVAL:-15}"/' ${HOME}/.claude/plugins/marketplaces/mempalace/hooks/mempal_save_hook.sh;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistent default values for MEMPAL_SAVE_INTERVAL.

The ENV MEMPAL_SAVE_INTERVAL 5 sets the container default to 5, but the sed replacement on line 105 uses ${MEMPAL_SAVE_INTERVAL:-15} as a fallback. While the ENV ensures the runtime default is effectively 5, the fallback of 15 in the script is confusing and inconsistent with the documented default.

Consider aligning the fallback value:

Proposed fix
-    sed -i 's/^SAVE_INTERVAL=[0-9]\+/SAVE_INTERVAL="${MEMPAL_SAVE_INTERVAL:-15}"/' ${HOME}/.claude/plugins/marketplaces/mempalace/hooks/mempal_save_hook.sh;
+    sed -i 's/^SAVE_INTERVAL=[0-9]\+/SAVE_INTERVAL="${MEMPAL_SAVE_INTERVAL:-5}"/' ${HOME}/.claude/plugins/marketplaces/mempalace/hooks/mempal_save_hook.sh;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Containerfile` around lines 99 - 105, The Dockerfile sets ENV
MEMPAL_SAVE_INTERVAL to 5 but the sed replacement in the mempal_save_hook.sh
uses a different fallback (${MEMPAL_SAVE_INTERVAL:-15}), causing inconsistent
defaults; update the sed command to use the same default (change
${MEMPAL_SAVE_INTERVAL:-15} to ${MEMPAL_SAVE_INTERVAL:-5}) or alternatively
change ENV MEMPAL_SAVE_INTERVAL to 15 so both places match; modify the sed
invocation that targets SAVE_INTERVAL in
${HOME}/.claude/plugins/marketplaces/mempalace/hooks/mempal_save_hook.sh so its
fallback aligns with the ENV value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Claudio <claudio@aipcc-cicd.com>
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.

[feat] Long live session

2 participants