Skip to content

Add piia-engram-cross-tool-memory rules#295

Open
Patdolitse wants to merge 1 commit into
PatrickJS:mainfrom
Patdolitse:add-piia-engram
Open

Add piia-engram-cross-tool-memory rules#295
Patdolitse wants to merge 1 commit into
PatrickJS:mainfrom
Patdolitse:add-piia-engram

Conversation

@Patdolitse
Copy link
Copy Markdown

@Patdolitse Patdolitse commented May 28, 2026

Adds cursor rules for using piia-engram, an MCP-based local memory layer.

These rules help Cursor make full use of piia-engram's MCP tools (get_user_context / add_lesson / add_decision / wrap_up_session etc.) — without them, Cursor tends to forget to call the MCP server proactively and the cross-tool benefit is lost.

The rules also encode piia-engram's core governance: AI-proposed knowledge lands in staging and only becomes verified after explicit user approval. This is the structural difference from auto-capture memory tools (Mem0, Letta) — and the rules make sure Cursor respects it.

Tested with my own daily setup. piia-engram itself is Apache-2.0 (https://github.com/Patdolitse/piia-engram), v3.30.1 on PyPI, in MCP Registry, listed in punkpeye/awesome-mcp-servers + kyrolabs/awesome-agents.

Summary by CodeRabbit

  • New Features
    • AI assistant now supports persistent context storage with local-first memory management.
    • Enhanced privacy safeguards prevent storage of sensitive information or chat history without explicit user approval.
    • Improved cross-tool context sharing enables seamless workflow continuity across applications.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

Adds a new cursor rules file (rules/piia-engram-cross-tool-memory.mdc) defining operational guidance for AI use of a local-first MCP memory layer. The rules cover context loading at conversation start, memory classification into lessons and decisions with staging-tier approval, privacy boundaries, session wrap-up triggers, cross-tool consistency expectations, context separation mechanisms, and memory freshness maintenance.

Changes

piia-engram Cross-Tool Memory Rules

Layer / File(s) Summary
Rule metadata and core purpose
rules/piia-engram-cross-tool-memory.mdc
Rule file configured to apply globally and always activate. Defines primary purpose of loading user context once at conversation start and avoiding repeated identity/preference re-asking.
Memory classification and governance
rules/piia-engram-cross-tool-memory.mdc
Distinguishes lessons (reusable knowledge) from decisions (context-specific choices). Establishes staging tier governance routing all memory additions into pending state requiring explicit user promotion before verification.
Privacy boundaries and session behavior
rules/piia-engram-cross-tool-memory.mdc
Specifies privacy constraints excluding secrets, tokens, PII, and verbatim chat content from memory storage. Defines when to trigger session wrap-up for long-running tool sessions vs when to skip it for short sessions.
Context separation and memory maintenance
rules/piia-engram-cross-tool-memory.mdc
Establishes cross-tool consistency and resume behavior when switching tools mid-task. Clarifies separation of personal preferences from project state using appropriate storage mechanisms. Specifies engram doctor usage for detecting stale or contradictory memory. Provides closing rationale emphasizing shared memory necessity to prevent repeated explanations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • PatrickJS

Poem

🐰 A memory layer springs to life,
Cross-tools now share, without the strife,
Staging gates keep secrets tight,
Context loads at morning light,
No more re-asking—just delight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description explains the purpose and governance model of the rules, provides context about piia-engram, and includes source attribution and testing information. However, it does not formally fill out the required template sections (Summary, Contribution Type checkboxes, Added/Changed Files list, Quality Checklist). Fill out the template sections including: mark the appropriate Contribution Type checkbox, list the added file with reasoning in Added/Changed Files, and verify all Quality Checklist items are addressed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add piia-engram-cross-tool-memory rules' is clear, concise, and directly summarizes the main change: adding a new Cursor rule file for piia-engram memory integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
rules/piia-engram-cross-tool-memory.mdc (1)

3-4: ⚡ Quick win

Scope this rule more narrowly unless it is truly universal.

Line 4 sets alwaysApply: true with a global glob. That forces piia-engram behavior on all contexts, including ones where this tool is irrelevant/unavailable. Prefer scoped attach (alwaysApply: false) unless this repository intends hard global enforcement.

🤖 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 `@rules/piia-engram-cross-tool-memory.mdc` around lines 3 - 4, The rule
currently uses a global glob pattern ("globs: **/*") with alwaysApply: true
which forces piia-engram behavior everywhere; change this to a narrower scope or
disable automatic attachment by setting alwaysApply: false (or replace the glob
with specific paths/dirs where the tool is relevant) so the
piia-engram-cross-tool-memory rule only applies in intended
repositories/environments; update the rule header referencing globs and
alwaysApply accordingly.
🤖 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 `@rules/piia-engram-cross-tool-memory.mdc`:
- Line 3: The front-matter contains an unquoted glob pattern (globs: **/*) which
breaks YAML parsing; update the front-matter by quoting the pattern (e.g., set
globs: "**/*") so the YAML loader treats the asterisks as a string, and while
editing consider whether to tighten the globs or remove reliance on alwaysApply:
true (reference the globs key and alwaysApply: true in the rule).

---

Nitpick comments:
In `@rules/piia-engram-cross-tool-memory.mdc`:
- Around line 3-4: The rule currently uses a global glob pattern ("globs: **/*")
with alwaysApply: true which forces piia-engram behavior everywhere; change this
to a narrower scope or disable automatic attachment by setting alwaysApply:
false (or replace the glob with specific paths/dirs where the tool is relevant)
so the piia-engram-cross-tool-memory rule only applies in intended
repositories/environments; update the rule header referencing globs and
alwaysApply accordingly.
🪄 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

Run ID: d9d7b919-2629-4974-853c-56514a61602a

📥 Commits

Reviewing files that changed from the base of the PR and between 9ec9007 and 0578994.

📒 Files selected for processing (1)
  • rules/piia-engram-cross-tool-memory.mdc

@@ -0,0 +1,70 @@
---
description: "Cursor rules for piia-engram — a local-first MCP memory layer that persists user identity, preferences, lessons, and decisions across every AI tool. AI proposes knowledge; the user approves what becomes permanent."
globs: **/*
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.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether the front matter parses as YAML before/after quoting globs.
python - <<'PY'
from pathlib import Path
import sys
try:
    import yaml
except Exception:
    print("PyYAML missing; install with: pip install pyyaml", file=sys.stderr)
    sys.exit(1)

p = Path("rules/piia-engram-cross-tool-memory.mdc")
text = p.read_text(encoding="utf-8")
if not text.startswith("---"):
    print("No front matter found")
    sys.exit(1)
parts = text.split("---", 2)
fm = parts[1]
print("Front matter content:\\n", fm)
try:
    obj = yaml.safe_load(fm)
    print("Parsed OK:", obj)
except Exception as e:
    print("YAML parse error:", e)
    sys.exit(2)
PY

Repository: PatrickJS/awesome-cursorrules

Length of output: 601


Quote globs in front-matter to keep the rule YAML valid.

Unquoted globs: **/* (line 3) fails YAML parsing with while scanning an alias (* is treated as YAML alias syntax). Quote the pattern so the rule can load correctly.

Proposed fix
-globs: **/*
+globs: "**/*"
  • If this rule is meant to be tool-specific, consider tightening globs rather than relying on alwaysApply: true.
🤖 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 `@rules/piia-engram-cross-tool-memory.mdc` at line 3, The front-matter contains
an unquoted glob pattern (globs: **/*) which breaks YAML parsing; update the
front-matter by quoting the pattern (e.g., set globs: "**/*") so the YAML loader
treats the asterisks as a string, and while editing consider whether to tighten
the globs or remove reliance on alwaysApply: true (reference the globs key and
alwaysApply: true in the rule).

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