agentleFS
MHouseMHouse/claude-global-memory/CLAUDE.md

claude-global-memory

CLAUDE.md0 starsChanged 5 months agoMITView on GitHub

Repo-specific guidance for working in this project. General/global preferences live in ~/.claude/CLAUDE.md; ongoing-work context lives in this project's auto-memory index (~/.claude/projects/<slug>/memory/MEMORY.md). The public scaffold + bootstrap for a cross-project Claude Code memory layer at ~/.claude/memory/. It ships the structure (templates, bootstrap scripts, docs) — never anyone's actual memories. - This repo (MHouse/claude-global-memory) is the scaffold. It is distinct from a separate, private contents repo that holds real memory entries and backup/restore tooling. Don't conflate them; features that belong to one…

The file

We split this CLAUDE.md into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't invent new ones in shipped examples.

    line 109

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — claude-global-memory

Repo-specific guidance for working in this project. General/global preferences live in ~/.claude/CLAUDE.md; ongoing-work context lives in this project's auto-memory index (~/.claude/projects/<slug>/memory/MEMORY.md).

What this repo is

The public scaffold + bootstrap for a cross-project Claude Code memory layer at ~/.claude/memory/. It ships the structure (templates, bootstrap scripts, docs) — never anyone's actual memories.

  • This repo (MHouse/claude-global-memory) is the scaffold. It is distinct from a separate, private contents repo that holds real memory entries and backup/restore tooling. Don't conflate them; features that belong to one rarely belong to the other.
  • The memory store is machine-local and not synced by this repo. Anything you add here must preserve that boundary (see README's "What this repo deliberately does not do").

Hard constraints

  • Never commit real memory content. Examples and templates only. ## Entries in any shipped MEMORY.md-like file stays empty/illustrative.
  • Bootstrap stays idempotent and non-destructive. bootstrap.sh and bootstrap.ps1 must produce the same result, be safe to re-run, and never overwrite user content outside the managed regions. Keep the two scripts in lockstep — a change to one needs the matching change to the other.
  • Respect the managed-region contract (documented in BOOTSTRAP.md):
    • ~/.claude/memory/MEMORY.md: bootstrap owns everything above ## Entries; never touches ## Entries and below.
    • ~/.claude/rules/cross-project-memory.md: whole-file surface with a .delivered stamp, default ON with loader semantics (unmodified-but-stale auto-updates on a bare run; edited needs --force). The opt-out gesture is deletion: target gone while the stamp remains means "removed by the user" — bare re-runs skip it; --force (or deleting the stamp too) reinstalls. Canonical source: rules/cross-project-memory.md.
    • ~/.claude/CLAUDE.md: bootstrap no longer writes here — except the one-time migration that removes the ## Cross-project memory section older versions managed in it. Marker-gated: pristine (matches the byte-frozen snippets/cross-project-memory-claude-md.md) → silent removal; edited-but-marked → diff + --force; no ownership marker → never touched. Never edit that snippet — it exists only as the migration comparator.
    • ~/.claude/hooks/REGISTRY.md: bootstrap owns everything above ## Registered hooks; never touches the rows below — except the single row whose first cell is memory-loader, which bootstrap itself adds on install and removes on --uninstall-loader.
    • ~/.claude/hooks/memory-loader.sh: whole-file surface with a .delivered stamp, installed by default (--no-loader / -NoLoader skips this run). One deliberate divergence from skill semantics: an unmodified-but-stale copy auto-updates on a bare run (the stamp proves no user edit is lost); an edited copy still requires --force. Runtime config (the skip-list override) lives beside it in memory-loader.conf — pure user territory that bootstrap never writes, stamps, or removes, so configuring the loader never trips the stamp.
    • ~/.claude/settings.json: bootstrap owns exactly the two memory-loader registration blocks under hooks.SessionStart / hooks.SubagentStart (identified by the command containing /hooks/memory-loader.sh). Everything else — keys, events, sibling entries — is preserved. The merge always goes through a real JSON parser (python in bootstrap.sh, native in bootstrap.ps1), never text-munging; writes are build→validate→atomic- rename; an unparseable file is never touched. --uninstall-loader / -UninstallLoader is sticky (drops a .memory-loader.optout sentinel honored by bare re-runs; --install-loader / -InstallLoader clears it).
    • Each managed region carries an HTML-comment marker as the ownership boundary; whole-file surfaces use a .delivered sidecar hash instead. Changing rules/cross-project-memory.md flows to installs through the stamp machinery on its own — no drift-detection paths to keep in sync.
    • Bundled skills (skills/<name>/SKILL.md → ~/.claude/skills/<name>/): whole-file managed surfaces (not regions-in-a-file), installed only with --install-skills / -InstallSkills (default off; names select a subset, omit for all). Driven by the $bundled_skills / $bundledSkills registry + the manage_skill / Manage-Skill routine. Bootstrap owns each entire file; a .delivered stamp distinguishes an unmodified-but-stale copy from a user-edited one, re-sync is on demand (--force or re-install, never automatic), and bootstrap refuses to write through a symlink/junction at that path. --uninstall-skills removes them. Add a skill by dropping skills/<name>/SKILL.md and listing <name> in the registry.
  • The memory-loader is the only hook bootstrap installs, and its two registrations are the only settings.json writes. The loader is the cross-project layer's load mechanism (HOOKS.md, "The load-bearing exception") — default-on, opt-out, cleanly and stickily uninstallable per the settings.json bullet above. Nothing else may install a hook or touch settings.json: guardrail hooks remain a documented, user-added exception governed by the admission policy in HOOKS.md and logged in ~/.claude/hooks/REGISTRY.md. Everything else bootstrap writes is Markdown: the memory store, the cross-project rule, the hooks registry, and — only with the explicit opt-in --install-skills flag — copies of the bundled skill files.
  • Keep docs and scripts in sync. README.md, BOOTSTRAP.md, HOOKS.md, RULES.md, the templates, and the bootstrap scripts describe one system. A behavior change in the scripts usually needs a doc change too.

Conventions

  • The index (MEMORY.md) is a routing surface, not storage: one-line entries, file kept under ~200 lines and its ## Entries under ~9KB (the harness truncates bigger injections to a ~2KB preview). Lead a line with the imperative rule itself only for the frequent-and-costly gotchas, and keep those lines at the top — the preview keeps the head. An optional standalone <!-- fold --> line in ## Entries (user territory — bootstrap never touches it) splits ambient from on-demand: subagents are injected with only what sits above it, and main sessions auto-degrade to the same once the full index exceeds the ~9KB budget.
  • Four memory types only: user, feedback, project, reference. Don't invent new ones in shipped examples.
  • Prose voice in docs is terse and opinionated; match it. Don't add features, abstractions, or tooling that wasn't asked for.

Workflow

  • Feature branch + squash-merge PR via gh. Never push to main.
  • PR title = eventual squash subject; body uses ## What / ## Why / ## Verification.
  • "Testing" here is mostly running the bootstrap scripts against a throwaway HOME/$env:USERPROFILE and confirming idempotency + drift detection, since there's no app to run. The bundled harness automates exactly that — run both bash test/verify.sh and pwsh -NoProfile -File test/verify.ps1 before landing a bootstrap change (CI also runs both on every PR and gates merges via the required ci-success check; they cover the managed surfaces, the memory-loader contract, the rule surface + CLAUDE.md migration, + the per-skill matrix and are kept in lockstep, same as the two bootstrap scripts).

Deploy Configuration

This repo doesn't deploy. It's a clone-and-run scaffold — distribution is git clone + ./bootstrap.sh (or .\bootstrap.ps1) per machine, and the release mechanism is a git tag + GitHub Release cut by hand from main after PRs merge (first one: v1.0.0). There's no server, host, or health-check URL, so /land-and-deploy has nothing to act on here — use the feature-branch + squash-merge PR flow above, then tag a release when a milestone warrants it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.