-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add piia-engram-cross-tool-memory rules #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Patdolitse
wants to merge
1
commit into
PatrickJS:main
Choose a base branch
from
Patdolitse:add-piia-engram
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: **/* | ||
| alwaysApply: true | ||
| --- | ||
|
|
||
| # piia-engram — Cross-Tool & Cross-Chat Memory Rules | ||
|
|
||
| You have access to piia-engram, a local-first MCP server that stores the user's identity, preferences, lessons learned, and key decisions in `~/.engram/`. The same memory is shared across Claude Code, Cursor, Codex CLI, Windsurf, and any MCP client — no cloud sync, no account, no lock-in. | ||
|
|
||
| ## On conversation start | ||
|
|
||
| 1. Call `mcp_engram_get_user_context` with `level='standard'` to load: | ||
| - User profile (role, language, technical level, communication style) | ||
| - Quality standards and validation preferences | ||
| - Recent verified lessons and decisions | ||
| - Today's daily log for this project | ||
| 2. Cite specific lessons or decisions when relevant to the user's current task. | ||
| 3. **Never** re-ask "who are you / what are your preferences" if Engram already has that data — it defeats the entire point. | ||
|
|
||
| ## When learning something reusable | ||
|
|
||
| Call `mcp_engram_add_lesson` when: | ||
| - You discover a workaround, pitfall, or non-obvious solution that will recur | ||
| - The user explicitly says "remember this" / "记住这个" | ||
| - You complete a debug session and identified a root cause that other sessions can avoid | ||
|
|
||
| Call `mcp_engram_add_decision` when: | ||
| - The user explicitly chose one option over alternatives ("we'll use X instead of Y") | ||
| - You and the user agreed on an architecture, tool, or process going forward | ||
| - A trade-off was made with reasoning (capture both the choice and the why) | ||
|
|
||
| ## Governance: AI proposes, user approves | ||
|
|
||
| - All new knowledge from `add_lesson` / `add_decision` lands in the **`staging`** tier by default. | ||
| - Items only become **`verified`** after the user explicitly promotes them via `engram review` or the HTML review page. | ||
| - **Never** call methods that auto-promote to verified. This consent step is the entire reason piia-engram exists. | ||
|
|
||
| ## Privacy boundaries | ||
|
|
||
| - **Do not** call `update_identity` for fields the user has not explicitly mentioned in conversation. | ||
| - **Do not** store API keys, passwords, tokens, or personally identifying information in any field. | ||
| - **Do not** copy chat content verbatim into knowledge entries — extract the durable lesson, not the dialogue. | ||
|
|
||
| ## On long sessions | ||
|
|
||
| For conversations with 10+ tool calls or substantial work: | ||
| - Call `mcp_engram_wrap_up_session` with a 2-3 sentence summary describing what was accomplished and any key decisions. | ||
| - piia-engram will auto-extract lessons/decisions into the staging tier; the user reviews later. | ||
|
|
||
| For sessions under 5 turns, skip wrap_up — it's noise. | ||
|
|
||
| ## Cross-tool consistency | ||
|
|
||
| - Knowledge added in Cursor is immediately readable by Claude Code, Codex CLI, Windsurf, and any MCP client — they all read the same `~/.engram/` directory. | ||
| - If the user switches tools mid-task, the next AI will see today's daily log with your contributions intact via `mcp_engram_get_resume_brief`. | ||
|
|
||
| ## Project context vs personal context | ||
|
|
||
| - **Personal preferences** (coding style, language, work patterns) → live in identity layer. | ||
| - **Project state** (version, tech stack, known issues) → use `mcp_engram_save_project_snapshot` at major checkpoints, not every conversation. | ||
| - **Repo-specific rules** (build steps, conventions) → use AGENTS.md or .cursorrules itself, not Engram. The two systems complement each other. | ||
|
|
||
| ## When knowledge feels stale or contradictory | ||
|
|
||
| Suggest the user run `engram doctor` — it executes 8 health checks (identity completeness, stale knowledge, decision conflicts, knowledge volume, etc.) and reports drift before it becomes a problem. | ||
|
|
||
| ## Why this matters | ||
|
|
||
| Without a cross-tool memory layer, every conversation in every AI tool starts at zero. The user re-explains their role, repeats their preferences, and re-derives lessons they've already learned. piia-engram exists so that doesn't happen. Treat the user's accumulated knowledge as a first-class resource, not a chat-window artifact. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: PatrickJS/awesome-cursorrules
Length of output: 601
Quote
globsin front-matter to keep the rule YAML valid.Unquoted
globs: **/*(line 3) fails YAML parsing withwhile scanning an alias(*is treated as YAML alias syntax). Quote the pattern so the rule can load correctly.Proposed fix
globsrather than relying onalwaysApply: true.🤖 Prompt for AI Agents