Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"name": "claude-memory",
"source": "./plugins/claude-memory",
"category": "claude-code",
"tags": ["memory", "claude-md", "rules", "auto-memory", "health", "audit", "skill"]
"tags": ["memory", "claude-md", "rules", "auto-memory", "health", "audit", "stateless", "disable", "purge", "skill"]
},
{
"name": "work-items",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ user opts in with `/plugin enable`; an existing install is never flipped by cata
- [`desktop-notification`](plugins/desktop-notification) — Alert you when Claude Code needs input — an audible terminal bell, an OSC 9 terminal notification, and an OS-native toast (macOS/Linux) on permission and idle prompts.
- [`playbooks`](plugins/playbooks) — Doctrine and knowledge playbooks as on-demand skills, plus a maintainer-facing update skill. boris — Boris Cherny's Claude Code workflow tips (howborisusesclaudecode.com); skill-authoring — Anthropic's internal skill-authoring playbook; fable-5 — Claude Fable 5's operating doctrine (self-authored, no upstream). The boris and skill-authoring packs vendor a verbatim upstream baseline; /playbooks:update drift-checks and syncs those baselines centrally (maintainers).
- [`claude-config`](plugins/claude-config) — Three audit skills for a repo's Claude Code configuration: audit (settings.json / .mcp.json / hooks / plugins / permissions drift), audit-automation-gaps (evidence-gated verdicts on automation gaps), and audit-permission-grants (allow-rule / allowed-tools grants for auto-mode durability and portability).
- [`claude-memory`](plugins/claude-memory) — Audits the Claude Code instruction/memory layer — CLAUDE.md, CLAUDE.local.md, .claude/rules/, and auto-memory — against a checklist derived from official Claude Code documentation. A deterministic script-backed spine (MEMORY.md index integrity, orphan always-loaded rules) yields identical findings on identical repo state; judgment-tier checks apply fixed criteria with model reading. Actions: audit (default), fix (per-item approval), update (refresh criteria from current docs), report.
- [`claude-memory`](plugins/claude-memory) — Keeps a repo's Claude Code memory layer healthy and under your control, against criteria derived from official Claude Code documentation. The audit skill checks the instruction/memory layer (CLAUDE.md, CLAUDE.local.md, .claude/rules/, auto-memory) with a deterministic script-backed spine plus judgment-tier checks. The stateless skill inspects, disables, and (confirm-gated) purges Claude-written auto memory across all settings scopes.
- [`claude-ops`](plugins/claude-ops) — Claude Code operations toolkit. Seven skills: observability (read locally captured telemetry — OTEL store, collector, hook-event JSONL, ccusage — with trend reports and store pruning), known-issues (search known Claude product GitHub bugs, check service health, maintain a persistent tracked-issue registry), changelog (ingest Claude Code changelog entries and integrate them into the current repo), plugins (bring a machine's plugin fleet current on demand — marketplace refresh, effective-scope updates including in-repo project/local installs, new-plugin install per policy, scope-divergence detection and explicit convergence), morning-brief (read-only gh-based operator morning view — queue-label counts, merge-ready PRs, parked decisions with their RECOMMENDED lines, and loop-lane telemetry freshness), lanes (start/restart/stop/status loop lanes as named background Claude Code sessions seeded from canonical prompt files, with per-lane model/effort and a repo-pull + marketplace-refresh launch step), and a re-runnable setup action that settles where the known-issues registry lives. Plus a family of seven advisory *-audit telemetry-emitter hooks (API errors, config changes, instruction loads, permission denials, pre-compaction, skill usage, tool failures) that emit the shared hook-telemetry envelope, and a reference sink that maps envelopes into the hook-events.jsonl the observability skill reads.
- [`skill-quality`](plugins/skill-quality) — Skill-authoring QA tooling: a static contract checker that runs seventeen deterministic checks over a Claude Code skill (frontmatter, listing-budget cap, trigger-keyword preservation, line caps, broken internal refs, markdownlint, gotchas surface, evals presence) and a bundled evals.json schema for validation. Runs against any repo's skills directory via the convention-resolution ladder — no baked layout.

Expand Down
6 changes: 3 additions & 3 deletions plugins/claude-memory/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
"name": "claude-memory",
"version": "0.2.3",
"description": "Audits the Claude Code instruction/memory layer — CLAUDE.md, CLAUDE.local.md, .claude/rules/, and auto-memory — against a checklist derived from official Claude Code documentation. A deterministic script-backed spine (MEMORY.md index integrity, orphan always-loaded rules) yields identical findings on identical repo state; judgment-tier checks apply fixed criteria with model reading. Actions: audit (default), fix (per-item approval), update (refresh criteria from current docs), report.",
"version": "0.3.0",
"description": "Keeps a repo's Claude Code memory layer healthy and under your control, against criteria derived from official Claude Code documentation. The audit skill checks the instruction/memory layer (CLAUDE.md, CLAUDE.local.md, .claude/rules/, auto-memory) with a deterministic script-backed spine plus judgment-tier checks. The stateless skill inspects, disables, and (confirm-gated) purges Claude-written auto memory across all settings scopes.",
"author": {
"name": "Melodic Software",
"email": "info@melodicsoftware.com"
},
"license": "MIT",
"keywords": ["memory", "claude-md", "rules", "auto-memory", "instructions", "audit", "maintenance", "skill"]
"keywords": ["memory", "claude-md", "rules", "auto-memory", "instructions", "audit", "stateless", "disable", "purge", "maintenance", "skill"]
}
28 changes: 28 additions & 0 deletions plugins/claude-memory/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@
All notable changes to the `claude-memory` plugin are documented here. Format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning.

## [0.3.0]

### Added

- **New `stateless` skill (`/claude-memory:stateless`)** for inspecting and disabling Claude
Code auto memory — the notes Claude writes for itself per repo under
`~/.claude/projects/<project>/memory/` (relocatable via `autoMemoryDirectory`). Actions:
`status` (default, read-only — effective on/off state and store contents across all settings
scopes), `disable` (sets `autoMemoryEnabled: false` and `CLAUDE_CODE_DISABLE_AUTO_MEMORY` in a
confirmed scope, and flags a dotfile-manager backfill for a tracked `settings.json`), and
`purge` (destructive — reads `autoMemoryDirectory` at every scope, shows a deletion manifest,
and deletes auto-memory `*.md` files only after explicit confirmation). Scope is auto-memory
only; the instruction layer stays with `audit`, and transcripts/history are out of scope
(auto-cleaned by `cleanupPeriodDays`). Claude Desktop / claude.ai account memory is a
server-side store the skill gives direction for rather than deleting locally. Per the
env-vars doc, `CLAUDE_CODE_DISABLE_AUTO_MEMORY` overrides `autoMemoryEnabled` (the env var is
authoritative when set); `disable` writes the env var (`1`) plus `autoMemoryEnabled: false`,
and `status` treats a set env var as authoritative. The bundled `scope-report.sh` reuses the
plugin's single-source memory-dir resolver rather than re-deriving the path.

### Fixed

- **`resolve-memory-dir.sh` now honors `CLAUDE_CONFIG_DIR`.** The shared resolver (used by both
the `audit` and `stateless` skills) resolved the config root as `$HOME/.claude`, so a machine
that relocates its Claude Code config via `CLAUDE_CONFIG_DIR` had its memory directory resolved
to the wrong path. It now uses `${CLAUDE_CONFIG_DIR:-$HOME/.claude}`, per the official
`.claude-directory` doc, so the relocated `projects/<project>/memory/` tree resolves correctly.

## [0.2.3]

### Fixed
Expand Down
41 changes: 34 additions & 7 deletions plugins/claude-memory/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# claude-memory

A Claude Code plugin that keeps a repo's instruction/memory layer healthy. It ships one skill:
A Claude Code plugin that keeps a repo's Claude Code memory layer healthy and under your control.
It ships two skills:

| Skill | Question it answers |
|---|---|
| `/claude-memory:audit` | Is the instruction/memory layer (`CLAUDE.md`, `CLAUDE.local.md`, `.claude/rules/`, auto-memory) healthy against official-doc criteria? |
| `/claude-memory:stateless` | Is Claude's auto memory on, where does it live, and how do I turn it off or wipe it? |

The configuration FILES, automation SET, and permission GRANTS are audited by the sibling skills in the
separate `claude-config` plugin (`audit`, `automation-gaps`, `permission-hygiene`).
The two skills split by axis: `audit` checks the health of the instruction/memory layer; `stateless`
controls the on/off state and contents of the Claude-written auto-memory store. The configuration
FILES, automation SET, and permission GRANTS are audited by the sibling skills in the separate
`claude-config` plugin (`audit`, `automation-gaps`, `permission-hygiene`).

## What the skill does
## What the skills do

### audit

Expand All @@ -27,6 +31,26 @@ audit contributor-personal auto-memory, so they never land in the repo.
/claude-memory:audit report # show the last audit without re-running
```

### stateless

Inspects and disables Claude Code **auto memory** — the notes Claude writes for itself per repo at
`~/.claude/projects/<project>/memory/` (relocatable via `autoMemoryDirectory`). Scope is auto-memory
only: the instruction layer (`CLAUDE.md`, `.claude/rules/`) belongs to `audit`, and transcripts /
history are out of scope (Claude Code auto-cleans those via `cleanupPeriodDays`).

```shell
/claude-memory:stateless # status (default) — effective on/off state + where the store lives
/claude-memory:stateless disable # autoMemoryEnabled:false + CLAUDE_CODE_DISABLE_AUTO_MEMORY (scope-confirmed)
/claude-memory:stateless purge # DESTRUCTIVE — delete auto-memory files after a confirmation gate
```

`disable` sets both the env var (authoritative — it overrides `autoMemoryEnabled` per the env-vars
doc) and the setting (persistent fallback); `purge` reads `autoMemoryDirectory` at every settings
scope before it enumerates what to delete, shows a manifest, and deletes only after explicit
confirmation. Claude Desktop / claude.ai
account memory is a separate server-side store — the skill gives direction to the app's Settings →
Memory controls rather than deleting it locally.

## Consumer conventions

The skill reads the consuming repo's own `CLAUDE.md` / `.claude/rules/` for project-specific
Expand All @@ -44,10 +68,13 @@ doc-derived checks. Nothing project-specific is baked into the plugin.

## Configuration

No `userConfig`. State: audit reports persist under the plugin's `${CLAUDE_PLUGIN_DATA}` directory —
No `userConfig`. State: `audit` reports persist under the plugin's `${CLAUDE_PLUGIN_DATA}` directory —
they are contributor-local because they cover per-contributor auto-memory, so they never land in the
consuming repo. Network: the `update` action fetches official docs pages (read-only). Scripts require
`git` and standard shell utilities.
consuming repo. Side effects: `stateless disable` edits a `settings.json` you choose (setting
`autoMemoryEnabled` and an `env` var, then flagging a dotfile-manager backfill if the file is tracked);
`stateless purge` deletes auto-memory `*.md` files after a confirmation gate — both act only on the
scope you confirm. Network: the `audit update` action fetches official docs pages (read-only). Scripts
require `git` and standard shell utilities.

## License

Expand Down
11 changes: 9 additions & 2 deletions plugins/claude-memory/skills/audit/scripts/resolve-memory-dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# Single source of truth for memory-dir resolution within this plugin — sibling
# scripts and the audit workflow call this rather than inlining the glob.
#
# Config root honors CLAUDE_CONFIG_DIR: per the official .claude-directory doc,
# setting it relocates every `~/.claude` path (settings AND the projects/ memory
# tree) under that directory, so the memory dir moves with it.
#
# Usage (CWD-independent within the target repo):
# MEMORY_DIR=$(bash "${CLAUDE_PLUGIN_ROOT}/skills/audit/scripts/resolve-memory-dir.sh")
#
Expand Down Expand Up @@ -47,9 +51,12 @@ if [[ -z "$repo_root" ]]; then
exit 1
fi

# Config root: CLAUDE_CONFIG_DIR relocates the whole `~/.claude` tree when set.
config_root="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"

# sed (not tr) for path-char replacement — tr mishandles backslashes on Git Bash.
project_slug=$(printf '%s' "$repo_root" | sed 's/[:\\/.]/-/g')
session_data_dir="$HOME/.claude/projects/$project_slug"
session_data_dir="$config_root/projects/$project_slug"

# Bare-clone-hub worktree: transcripts are keyed by the worktree cwd, but auto-memory
# is shared at the HUB (keyed by git-common-dir). HUB_SLUG also maps '.' (e.g. a
Expand All @@ -60,7 +67,7 @@ hub_raw=$(cygpath -w "$git_common" 2>/dev/null || printf '%s' "$git_common")
hub_slug=$(printf '%s' "$hub_raw" | sed 's/[:\\/.]/-/g')

memory_dir=""
for cand in "$session_data_dir/memory" "$HOME/.claude/projects/$hub_slug/memory"; do
for cand in "$session_data_dir/memory" "$config_root/projects/$hub_slug/memory"; do
if [[ -f "$cand/MEMORY.md" ]]; then
memory_dir="$cand"
break
Expand Down
89 changes: 89 additions & 0 deletions plugins/claude-memory/skills/stateless/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
name: stateless
description: "Inspect and turn off Claude Code's auto memory — the notes Claude writes itself per repo under ~/.claude/projects/<project>/memory/. Use when: 'make Claude stateless', 'stop Claude remembering', 'disable auto memory', 'turn off auto-memory', 'purge/clear/delete auto memory', 'wipe what Claude saved about this repo', 'does Claude have saved memories'. Actions: status (default — memory + settings across all scopes), disable (autoMemoryEnabled:false + CLAUDE_CODE_DISABLE_AUTO_MEMORY), purge (destructive delete, confirm-gated). Auto-memory only — not CLAUDE.md/rules (use /claude-memory:audit) and not transcripts/history."
argument-hint: "[status|disable|purge] — default: status"
user-invocable: true
disable-model-invocation: false
---

## Auto-memory snapshot

```!
bash "${CLAUDE_PLUGIN_ROOT}/skills/stateless/scripts/scope-report.sh" || echo "(snapshot unavailable — run the scope-report script manually)"
```

# Stateless

Inspect and disable Claude Code **auto memory** — the store Claude writes for itself, one
directory per repo (`~/.claude/projects/<project>/memory/`, relocatable via
`autoMemoryDirectory`). Governs auto-memory only. Not in scope: CLAUDE.md / CLAUDE.local.md /
`.claude/rules/` (use `/claude-memory:audit`), transcripts, history, or shell snapshots.

Criteria and exact doc quotes live in [reference/official-guidance.md](reference/official-guidance.md);
re-fetch the two source pages if a fact is load-bearing before you act.

## Scope

| Entity | Location | This skill |
|--------|----------|-----------|
| Auto-memory store | `~/.claude/projects/<project>/memory/` (or `autoMemoryDirectory`) | Yes — status / disable / purge |
| `autoMemoryEnabled` setting | any settings scope | Yes — reads & writes |
| `CLAUDE_CODE_DISABLE_AUTO_MEMORY` | OS env or settings `env` block | Yes — reads & writes |
| CLAUDE.md / CLAUDE.local.md / `.claude/rules/` | repo + user | No — use `/claude-memory:audit` |
| Transcripts / history / sessions / snapshots | `~/.claude/...` | No — auto-cleaned by `cleanupPeriodDays` |
| Claude Desktop / claude.ai memory | server-side account | Direction only — [context/desktop.md](context/desktop.md) |

## Argument parsing

| Argument | Action |
|----------|--------|
| *(none)* or `status` | Report the auto-memory posture: effective enabled/disabled state, where the store lives, what it holds. Read-only. |
| `disable` | Turn auto memory off durably (`autoMemoryEnabled: false` + `CLAUDE_CODE_DISABLE_AUTO_MEMORY`). Edits settings — confirm scope first. |
| `purge` | **Destructive.** Delete the auto-memory files. Reads `autoMemoryDirectory` at every scope first, shows a manifest, and deletes only after explicit confirmation. |

## Precedence (documented)

`CLAUDE_CODE_DISABLE_AUTO_MEMORY` **overrides** `autoMemoryEnabled`: per the env-vars doc, `=1`
disables and `=0` forces auto memory *on* even when `autoMemoryEnabled: false` would disable
it. When the env var is unset, `autoMemoryEnabled` (by settings precedence) governs. So a set
env var of `0` alongside `autoMemoryEnabled: false` means auto memory is effectively **on** —
`status` must report the env var as authoritative whenever it is set. `disable` sets the env
var to `1` (the authoritative lever) and `autoMemoryEnabled: false` together. See the
reference file's "Precedence: the env var overrides the setting (VERIFIED)".

## Actions

- **status** (default): load [context/status.md](context/status.md).
- **disable**: load [context/disable.md](context/disable.md).
- **purge**: load [context/purge.md](context/purge.md).

For the Claude Desktop / claude.ai account store (server-side, not local files), load
[context/desktop.md](context/desktop.md) — relevant to `status` and `purge` whenever the user
wants to be stateless everywhere, not just in this repo.

## Gotchas

- **Precedence**: `CLAUDE_CODE_DISABLE_AUTO_MEMORY` overrides `autoMemoryEnabled` (`=0` forces
on even against `autoMemoryEnabled: false`). A set env var is authoritative in `status`. (See above.)
- **`autoMemoryDirectory` relocates the store** and is read from *any* scope. The snapshot
prints the slug-derived default only — `purge` and `status` must read the override at every
scope or they act on the wrong directory.
- **`CLAUDE_CONFIG_DIR` relocates the whole config root**: when set, the user `settings.json`
*and* the `projects/<project>/memory/` tree live under it, not `~/.claude`. All scope and
memory-dir resolution honors `${CLAUDE_CONFIG_DIR:-~/.claude}` (scripts + workflows); the
snapshot reports the resolved root, and `purge`'s relocation check treats it as expected.
- **Windows managed policy** can live in the registry (`HKLM`/`HKCU\SOFTWARE\Policies\ClaudeCode`),
not a file. `scope-report.sh` can't read it — report managed scope as unread, don't assume empty.
- **`disable` applies next session**, not immediately: the setting and `env` block are read at
startup. Tell the user to restart / start a new session.
- **Tracked `settings.json`**: a live edit to a dotfile-manager-tracked settings file must be
backfilled to the source; never run an `apply` that could revert the edit.
- **Desktop / claude.ai memory is server-side** — `purge` cannot delete it; give direction only.

## Repo-agnostic contract

Discover the consumer's state at runtime — never hardcode a machine's paths or current
posture. Settings scopes, the memory directory, and the env var are read fresh from the
snapshot above and the workflow scripts. The bundled `scope-report.sh` reuses the plugin's
single-source memory-dir resolver (`skills/audit/scripts/resolve-memory-dir.sh`) rather than
re-implementing slug derivation.
Loading
Loading