Skip to main content
Glama

ai-notes-sync

One Git-backed home for everything your AI assistants write down, and a record of which app, model and setting made each change.

Claude Code, Codex, Antigravity and other assistants each keep useful notes (memories, plans, session summaries, project instructions) in their own hidden folders. None of them can see the others' notes, and none records who changed what.

ai-notes-sync works with Basic Memory, a local, open-source Markdown knowledge base with an MCP server, and adds four things:

  1. Collect: copies each AI app's own notes into your vault, sorted into readable folders, and keeps the copies up to date.

  2. Attribute: a small MCP relay sits between each app and Basic Memory and records which app changed which note, plus the model and settings.

  3. Version: commits every change to Git, one commit per app and model setup, so git log and GitHub show who changed what. Every AI edit is also logged to a JSONL file for later evaluation.

  4. Guard: when every AI reads the same notes, one poisoned note can steer all of them. Suspicious AI edits and imports are held back in a quarantine no AI can read, until you decide.

Everything runs on your machine. The only network traffic is git push to a remote you choose (or none).

What a commit looks like

Author: Claude Code (claude-opus-5-5, effort high) <claude-code@ai-notes.local>

    Claude Code (claude-opus-5-5, effort high): changed 1 note(s)

    - notes/projects/site/Deploy checklist.md

    AI-App: Claude Code
    AI-Model: claude-opus-5-5
    AI-Reasoning-Effort: high
    AI-Evidence: verified
    AI-App-Version: 2.1.317
    AI-Session: a064c882-…

AI-Evidence says how much to trust the model details:

Evidence

Meaning

Apps

verified

Read from the app's own log of that exact tool call

Claude Code, Codex

self-reported

What the AI said about itself in the tool call's metadata

any app

unknown

The AI didn't say; the app is still recorded

any app

MCP tells a server which app is connected, but not which model, so the relay can always name the app. The model comes from the app's log or from the AI itself.

Related MCP server: memwiki

Prompt-injection guard

Shared notes are a shared attack surface: an agent reads a web page, saves a summary with an embedded instruction, and every other assistant that searches the notes later reads it. In one reported case (basic-memory#1156) an AI replaced a memory file with injected-looking text.

Layers, from the outside in:

Layer

What it does

Rule

ai-notes-sync rules tells every AI that notes are information, not instructions, and to report a note that tries to instruct it.

Scan

Each sync checks the new text of AI edits and imports for instruction overrides, role markup (<|im_start|>, [INST]), identity changes, secrecy requests, data-leaking links, hidden Unicode characters and large encoded blobs.

Quarantine

A high-severity finding moves the note to .quarantine/ (Basic Memory doesn't index hidden folders, so no AI can find it) and restores the previous version. You get a notification.

Large deletions

An AI edit that keeps less than 40% of a note is held back the same way.

Protected files

AIs can't change or delete notes/Filing guide.md (configurable).

Read-only apps

Apps listed in read_only_apps (say, the one that browses the web) can search and read but every write is refused.

Undo

ai-notes-sync undo <app> --since "…" [--model …] --apply reverts everything one app or model changed.

Your own edits are scanned and warned about, never moved. Review what was held back:

ai-notes-sync review                       # what, when, which app/model, why
ai-notes-sync review --approve notes/x.md  # put it back; approved content isn't flagged again
ai-notes-sync review --discard notes/x.md
ai-notes-sync scan                         # check the whole vault, changes nothing

This raises the bar; it doesn't make injection impossible. Pattern lists miss new phrasings, and an agent with shell access (Claude Code, Codex) can write files directly, around the relay. Those writes are still versioned, attributed to you, scanned and warned about, and can be undone with Git.

Vault layout

~/basic-memory/
  notes/                 notes the AIs and you write, by topic
  imported/              copies, refreshed automatically; don't edit
    claude-code/<project>/          Claude Code memory per project
    codex/{memory,sessions/<month>,skills,notes}/
    antigravity/<month>/<date title>/   one folder per conversation
    instructions/<project>/         CLAUDE.md, AGENTS.md, GEMINI.md
  .ai-notes/edits.jsonl  one line per AI edit: time, app, model, effort, evidence, files
  .ai-notes/guard.jsonl  what the guard quarantined, restored or warned about
  .quarantine/           notes held back for review; invisible to the AIs

Antigravity's scratch files and saved web pages (.system_generated/) are skipped: they're noise and can contain tokens.

Install

Requires Python 3.9+, Git and uv. Tested on macOS; the core works on Linux.

uv tool install basic-memory --prerelease=allow
uv tool install git+https://github.com/mariomarcolongo/ai-notes-sync

Make the vault a Git repository (optionally with a private remote):

basic-memory project list          # creates ~/basic-memory on first run
git -C ~/basic-memory init -b main
gh repo create ai-notes --private --source ~/basic-memory --remote origin   # optional

Connect your AI apps to the relay. Each command shows what it would change and changes nothing until you add --apply. Every file is backed up first.

ai-notes-sync apps            # preview
ai-notes-sync apps --apply    # Claude Desktop, Claude Code, Codex, Cursor, VS Code, Antigravity…
ai-notes-sync rules --apply   # tell the AIs to search first, file notes properly and report their model
ai-notes-sync schedule --every 2

Restart the apps. Copy docs/filing-guide.md to ~/basic-memory/notes/Filing guide.md (or write your own) so the AIs know where to put notes.

Commands

Command

What it does

sync

import, commit per author, pull, push (what the timer runs)

import / commit

just one of the steps

relay <label>

the MCP relay an app runs instead of Basic Memory

apps [--apply] [--only LABEL…]

connect apps to the relay

rules [--apply]

add the shared-notes rule to global AI instructions

schedule --every N / --remove

timer (launchd on macOS, a cron line elsewhere)

stats

edits per app, model, reasoning effort and evidence

review [--approve P | --discard P]

notes held back by the guard

scan [paths…]

check notes for injection patterns without changing anything

undo <app> [--since T] [--model M] [--apply]

revert one app's (or model's) commits

config

settings in use

Settings

Optional, in ~/.config/ai-notes-sync/config.json:

{
  "vault": "~/basic-memory",
  "project_roots": ["~/Code", "~/Projects"],
  "sources": {"claude_code": true, "codex": true, "antigravity": true, "instructions": true},
  "git_push": true,
  "guard": true,
  "protected": ["notes/Filing guide.md", "README.md"],
  "read_only_apps": ["antigravity"],
  "shrink_ratio": 0.4,
  "notify": true
}

project_roots are the folders searched (one level deep) for CLAUDE.md, AGENTS.md and GEMINI.md.

Limits

  • Model details depend on the app. Only Claude Code and Codex keep logs that can be checked. Elsewhere it's the AI's word.

  • Edits made without the relay (by hand, in Obsidian, or by an app not connected) are committed under your Git name.

  • Apps that keep notes only in the cloud (ChatGPT, the Gemini app, Claude Desktop chats) can't be collected, and can only use local MCP servers if the app supports them.

  • The guard is a filter, not a proof. See Prompt-injection guard.

  • Copies are one-way. Editing a file in imported/ doesn't change the original, and the next change to the original overwrites it.

  • Sensitive content. Notes can contain personal data. Use a private remote, or none.

  • Basic Memory: the knowledge base this builds on. Its maintainers plan native revision history (see their issue #1156); if it lands with authorship, part of this tool becomes unnecessary.

  • GitMemo: captures AI conversations, clipboard and notes into a Git repo. Broader capture; no per-edit model attribution.

License

Apache-2.0. Created by Mario Marcolongo; if you redistribute it, keep the NOTICE file. To cite it, use CITATION.cff (GitHub's "Cite this repository").

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    A Model Context Protocol server that gives AI agents bounded, auditable access to propose changes to an Obsidian vault stored in GitHub, with per-agent expiring tokens, read/write/deny path policies, mutability rules, frontmatter checks, and human-reviewed proposal branches.
    590 npm
    2
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables multiple AI coding agents to share one Obsidian-compatible Markdown knowledge vault over MCP, letting them retrieve context, search, read, write, merge, lint, and verify linked pages with drift and secret detection. Supports git-based sync, local credential storage, and human editing in Obsidian or VS Code.
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Serves a git-backed folder of Markdown notes over MCP so AI agents can search, read, write, move and delete them, with every write recorded as a git commit attributed to the calling client. Supports full-text section search with snippets, wikilinks and typed relations, LFS-backed searchable attachments, optimistic concurrency for multiple agents, and per-client token or OAuth 2.1 access.
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables people and AI assistants to share one persistent Markdown-in-Git memory, so any MCP client can load current context, save sessions and decisions, search notes, and work from a team's real knowledge across machines.
    5 npm
    AGPL 3.0