claude-memory-bank-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 claude-memory-bank contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # claude-memory-bank
2
+
3
+ Fully automatic persistent memory for [Claude Code](https://docs.anthropic.com/en/docs/claude-code). One command, zero maintenance.
4
+
5
+ ## The Problem
6
+
7
+ Claude Code is stateless. Every new conversation starts fresh — your preferences, decisions, progress, and context are lost. You end up repeating yourself across sessions.
8
+
9
+ ## The Solution
10
+
11
+ ```bash
12
+ npx claude-memory-bank-cli init
13
+ ```
14
+
15
+ That's it. This sets up a memory system that Claude automatically reads at the start of every conversation and updates after every task. No slash commands, no manual saves, no workflow triggers.
16
+
17
+ ## What It Creates
18
+
19
+ ```
20
+ your-project/
21
+ ├── CLAUDE.md # Master file — auto-loads, enforces memory rules
22
+ ├── memory-bank/
23
+ │ ├── projectbrief.md # Scope, requirements, goals
24
+ │ ├── productContext.md # Why it exists, user problems, UX goals
25
+ │ ├── techContext.md # Tech stack, dependencies, dev setup
26
+ │ ├── activeContext.md # What's being worked on right now
27
+ │ ├── progress.md # Done, in-progress, pending, blocked
28
+ │ ├── decisions.md # Every decision + reasoning
29
+ │ ├── patterns.md # Architecture, code patterns, conventions
30
+ │ ├── troubleshooting.md # Bugs, fixes, lessons learned
31
+ │ ├── preferences.md # User preferences — communication, design
32
+ │ ├── references.md # External links, APIs, tools
33
+ │ └── extensions/ # Overflow when files get large (auto-managed)
34
+ ├── .claude/
35
+ │ └── rules/
36
+ │ └── memory-auto-update.md # Enforces automatic updates every task
37
+ ```
38
+
39
+ ## How It Works
40
+
41
+ 1. **`CLAUDE.md`** is automatically loaded by Claude Code at the start of every conversation. It contains rules that tell Claude to read all memory bank files before doing anything.
42
+
43
+ 2. **`.claude/rules/memory-auto-update.md`** enforces that Claude updates the relevant memory files after every task — no user action required.
44
+
45
+ 3. **`memory-bank/`** contains 10 specialized files. Each one auto-updates based on what happens in the conversation:
46
+
47
+ | File | Updates When |
48
+ |---|---|
49
+ | `projectbrief.md` | Project scope or goals change |
50
+ | `productContext.md` | Product goals or user problems are clarified |
51
+ | `techContext.md` | Dependencies, tools, or setup changes |
52
+ | `activeContext.md` | Every task start/end |
53
+ | `progress.md` | Tasks start, complete, fail, or get added |
54
+ | `decisions.md` | A choice is made between alternatives |
55
+ | `patterns.md` | New code pattern or convention is established |
56
+ | `troubleshooting.md` | Bug found, fixed, or workaround discovered |
57
+ | `preferences.md` | User corrects, approves, or states a preference |
58
+ | `references.md` | External link, API, or tool is mentioned |
59
+
60
+ 4. **Overflow handling:** When any file exceeds ~200 lines, Claude automatically splits it into `memory-bank/extensions/` and keeps the main file as a summary with pointers.
61
+
62
+ ## Features
63
+
64
+ - **Fully automatic** — zero manual commands after setup
65
+ - **Idempotent** — safe to run `init` again, won't overwrite existing files
66
+ - **Non-invasive** — only creates files, never modifies your existing code
67
+ - **Works with any project** — language-agnostic, framework-agnostic
68
+ - **Scales gracefully** — overflow system prevents files from growing unbounded
69
+
70
+ ## Requirements
71
+
72
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed and configured
73
+ - Node.js 14+
74
+
75
+ ## FAQ
76
+
77
+ **Does this modify my code?**
78
+ No. It only creates markdown files and a `.claude/rules/` directory. Your source code is never touched.
79
+
80
+ **What if I already have a CLAUDE.md?**
81
+ The `init` command skips any file that already exists. Your existing CLAUDE.md won't be overwritten.
82
+
83
+ **Can I customize the memory files?**
84
+ Yes. Edit any file in `memory-bank/` — Claude will preserve your changes and build on them.
85
+
86
+ **How is this different from `.claude/rules/`?**
87
+ Rules tell Claude *how to behave*. The memory bank tells Claude *what it knows*. This package uses rules to enforce the memory system, but the actual memory lives in `memory-bank/`.
88
+
89
+ **How is this different from other memory bank solutions?**
90
+ Most require manual slash commands (like `/workflow:update-memory`) or manual file management. This one is fully automatic — the rules enforce updates without any user intervention.
91
+
92
+ ## License
93
+
94
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ const args = process.argv.slice(2);
4
+ const command = args[0];
5
+
6
+ if (command === 'init') {
7
+ const init = require('../src/init');
8
+ init(process.cwd());
9
+ } else {
10
+ console.log('\n claude-memory-bank — Automatic persistent memory for Claude Code\n');
11
+ console.log(' Usage:');
12
+ console.log(' npx claude-memory-bank init Set up memory bank in current project\n');
13
+ if (command) {
14
+ console.log(` Unknown command: "${command}"\n`);
15
+ }
16
+ }
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "claude-memory-bank-cli",
3
+ "version": "1.0.0",
4
+ "description": "Fully automatic persistent memory system for Claude Code. One command, zero maintenance.",
5
+ "main": "src/init.js",
6
+ "bin": {
7
+ "claude-memory-bank-cli": "./bin/cli.js"
8
+ },
9
+ "keywords": [
10
+ "claude",
11
+ "claude-code",
12
+ "memory",
13
+ "persistent-memory",
14
+ "ai",
15
+ "context",
16
+ "anthropic"
17
+ ],
18
+ "author": "Jafar Sadiq <jafar.s@constient.com>",
19
+ "license": "MIT",
20
+ "files": [
21
+ "bin/",
22
+ "src/",
23
+ "README.md",
24
+ "LICENSE"
25
+ ]
26
+ }
package/src/init.js ADDED
@@ -0,0 +1,79 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const MEMORY_FILES = [
5
+ 'projectbrief.md',
6
+ 'productContext.md',
7
+ 'techContext.md',
8
+ 'activeContext.md',
9
+ 'progress.md',
10
+ 'decisions.md',
11
+ 'patterns.md',
12
+ 'troubleshooting.md',
13
+ 'preferences.md',
14
+ 'references.md',
15
+ ];
16
+
17
+ function loadTemplate(name) {
18
+ const tplPath = path.join(__dirname, 'templates', name + '.tpl');
19
+ return fs.readFileSync(tplPath, 'utf-8');
20
+ }
21
+
22
+ function writeIfMissing(filePath, content) {
23
+ if (fs.existsSync(filePath)) {
24
+ console.log(` [skip] ${path.relative(process.cwd(), filePath)} (already exists)`);
25
+ return false;
26
+ }
27
+ fs.writeFileSync(filePath, content, 'utf-8');
28
+ console.log(` [create] ${path.relative(process.cwd(), filePath)}`);
29
+ return true;
30
+ }
31
+
32
+ function ensureDir(dirPath) {
33
+ if (!fs.existsSync(dirPath)) {
34
+ fs.mkdirSync(dirPath, { recursive: true });
35
+ }
36
+ }
37
+
38
+ function init(targetDir) {
39
+ console.log('\n claude-memory-bank — Setting up automatic memory system...\n');
40
+
41
+ const memoryDir = path.join(targetDir, 'memory-bank');
42
+ const extensionsDir = path.join(memoryDir, 'extensions');
43
+ const rulesDir = path.join(targetDir, '.claude', 'rules');
44
+
45
+ ensureDir(memoryDir);
46
+ ensureDir(extensionsDir);
47
+ ensureDir(rulesDir);
48
+
49
+ let created = 0;
50
+ let skipped = 0;
51
+
52
+ const claudeMd = path.join(targetDir, 'CLAUDE.md');
53
+ if (writeIfMissing(claudeMd, loadTemplate('CLAUDE.md'))) {
54
+ created++;
55
+ } else {
56
+ skipped++;
57
+ }
58
+
59
+ for (const file of MEMORY_FILES) {
60
+ const filePath = path.join(memoryDir, file);
61
+ if (writeIfMissing(filePath, loadTemplate(file))) {
62
+ created++;
63
+ } else {
64
+ skipped++;
65
+ }
66
+ }
67
+
68
+ const rulePath = path.join(rulesDir, 'memory-auto-update.md');
69
+ if (writeIfMissing(rulePath, loadTemplate('memory-auto-update.md'))) {
70
+ created++;
71
+ } else {
72
+ skipped++;
73
+ }
74
+
75
+ console.log(`\n Done. ${created} files created, ${skipped} skipped.`);
76
+ console.log(' Memory bank is ready. Claude will auto-update it from here.\n');
77
+ }
78
+
79
+ module.exports = init;
@@ -0,0 +1,48 @@
1
+ # Project Memory Bank
2
+
3
+ This project uses an automatic persistent memory system. Claude MUST follow the rules below every single session.
4
+
5
+ ## Memory System Rules
6
+
7
+ ### On Every Conversation Start
8
+ 1. Read ALL files in `memory-bank/` before doing anything else
9
+ 2. Check `memory-bank/activeContext.md` to understand what was last being worked on
10
+ 3. Check `memory-bank/progress.md` to know current project status
11
+ 4. If `memory-bank/extensions/` contains files, read those too
12
+
13
+ ### On Every Task Completion
14
+ 1. Update `memory-bank/activeContext.md` with what was just done
15
+ 2. Update `memory-bank/progress.md` with current status
16
+ 3. If a decision was made, add it to `memory-bank/decisions.md`
17
+ 4. If a bug was fixed or discovered, update `memory-bank/troubleshooting.md`
18
+ 5. If a new pattern or convention was established, update `memory-bank/patterns.md`
19
+ 6. If the user expressed a preference, update `memory-bank/preferences.md`
20
+ 7. If an external resource was referenced, update `memory-bank/references.md`
21
+ 8. If tech stack or dependencies changed, update `memory-bank/techContext.md`
22
+ 9. If project scope or goals changed, update `memory-bank/projectbrief.md` or `memory-bank/productContext.md`
23
+
24
+ ### Overflow Rule
25
+ - If any memory file exceeds ~200 lines, split overflow into `memory-bank/extensions/{filename}-{topic}.md`
26
+ - Keep the main file as a summary with pointers to extension files
27
+ - Extension files follow the same format as their parent file
28
+
29
+ ### Auto-Cleanup
30
+ - Remove outdated entries from `activeContext.md` when tasks are completed
31
+ - Archive completed items in `progress.md` periodically
32
+ - Remove stale references from `references.md` if links are confirmed dead
33
+
34
+ ## Memory Bank Files
35
+
36
+ | File | Purpose |
37
+ |---|---|
38
+ | `memory-bank/projectbrief.md` | Project scope, requirements, goals |
39
+ | `memory-bank/productContext.md` | Why the project exists, user problems, UX goals |
40
+ | `memory-bank/techContext.md` | Tech stack, dependencies, dev environment setup |
41
+ | `memory-bank/activeContext.md` | Current focus — what's being worked on right now |
42
+ | `memory-bank/progress.md` | Task tracking — done, in-progress, pending, blocked |
43
+ | `memory-bank/decisions.md` | Every decision + reasoning + alternatives rejected |
44
+ | `memory-bank/patterns.md` | Architecture patterns, code conventions, best practices |
45
+ | `memory-bank/troubleshooting.md` | Bugs hit, fixes applied, lessons learned |
46
+ | `memory-bank/preferences.md` | User preferences — communication style, design choices |
47
+ | `memory-bank/references.md` | External links, APIs, tools, documentation |
48
+ | `memory-bank/extensions/` | Overflow files when any main file exceeds ~200 lines |
@@ -0,0 +1,19 @@
1
+ # Active Context
2
+
3
+ ## Current Focus
4
+ [What is currently being worked on]
5
+
6
+ ## Recent Changes
7
+ - [Latest change with date]
8
+
9
+ ## Next Steps
10
+ - [Immediate next task]
11
+
12
+ ## Open Questions
13
+ - [Unresolved questions or blockers]
14
+
15
+ ## Context for Next Session
16
+ [Anything the next conversation needs to know to pick up where this left off]
17
+
18
+ ---
19
+ *Auto-maintained by Claude. Updated at the start and end of every task.*
@@ -0,0 +1,12 @@
1
+ # Decisions
2
+
3
+ ## Decision Log
4
+
5
+ ### [Decision Title] — [date]
6
+ - **Choice:** [What was decided]
7
+ - **Alternatives considered:** [Other options]
8
+ - **Reasoning:** [Why this choice was made]
9
+ - **Status:** [active / reversed / superseded]
10
+
11
+ ---
12
+ *Auto-maintained by Claude. Updated when decisions are made, reversed, or reconsidered.*
@@ -0,0 +1,36 @@
1
+ # Memory Bank Auto-Update Rule
2
+
3
+ You MUST follow these rules automatically. No user command is needed.
4
+
5
+ ## At Conversation Start
6
+ - Read every file in `memory-bank/` and `memory-bank/extensions/` before responding to the user
7
+ - Use this context to understand the project state, what was worked on last, and what's pending
8
+ - Never ask the user to repeat information that exists in memory bank files
9
+
10
+ ## After Every Task
11
+ Update the relevant memory bank files. At minimum, always update:
12
+ - `memory-bank/activeContext.md` — reflect what just changed
13
+ - `memory-bank/progress.md` — mark tasks done/in-progress/pending
14
+
15
+ Also update these when relevant:
16
+ - `memory-bank/decisions.md` — when a choice was made between alternatives
17
+ - `memory-bank/patterns.md` — when a new code pattern or convention is established
18
+ - `memory-bank/troubleshooting.md` — when a bug is found, fixed, or a workaround is used
19
+ - `memory-bank/preferences.md` — when the user corrects you, approves an approach, or states a preference
20
+ - `memory-bank/references.md` — when an external link, API, or tool is mentioned
21
+ - `memory-bank/techContext.md` — when dependencies, tools, or environment setup changes
22
+ - `memory-bank/projectbrief.md` — when project scope or requirements change
23
+ - `memory-bank/productContext.md` — when product goals or user problems are clarified
24
+
25
+ ## Overflow Management
26
+ - When any memory file approaches ~200 lines, create an extension file at `memory-bank/extensions/{original-filename}-{subtopic}.md`
27
+ - Update the original file to reference the extension: `→ See extensions/{filename}-{subtopic}.md for details`
28
+ - Extension files inherit the same format and purpose as their parent
29
+
30
+ ## Auto-Cleanup
31
+ - When a task in `activeContext.md` is completed, move it to `progress.md` and remove it from active context
32
+ - Remove duplicate information across files
33
+ - Keep files focused and scannable — bullet points over paragraphs
34
+
35
+ ## Critical Rule
36
+ These updates are NOT optional. They happen automatically after every meaningful interaction. The memory bank is only useful if it stays current.
@@ -0,0 +1,16 @@
1
+ # Patterns & Conventions
2
+
3
+ ## Architecture Patterns
4
+ - [Pattern name]: [Description and when to use]
5
+
6
+ ## Code Conventions
7
+ - [Convention]: [How it's applied]
8
+
9
+ ## Naming Conventions
10
+ - [Files/variables/functions naming rules]
11
+
12
+ ## Project-Specific Patterns
13
+ - [Patterns unique to this project]
14
+
15
+ ---
16
+ *Auto-maintained by Claude. Updated when new patterns are established or conventions change.*
@@ -0,0 +1,22 @@
1
+ # User Preferences
2
+
3
+ ## Communication Style
4
+ - [How the user prefers Claude to communicate]
5
+
6
+ ## Code Style Preferences
7
+ - [Formatting, structure, or style preferences]
8
+
9
+ ## Design Preferences
10
+ - [UI/UX or architecture preferences]
11
+
12
+ ## Workflow Preferences
13
+ - [How the user likes to work — e.g., explain before coding, small PRs, etc.]
14
+
15
+ ## Things to Avoid
16
+ - [Approaches or behaviors the user has rejected]
17
+
18
+ ## Things That Work Well
19
+ - [Approaches the user has approved or praised]
20
+
21
+ ---
22
+ *Auto-maintained by Claude. Updated when the user corrects, approves, or states a preference.*
@@ -0,0 +1,21 @@
1
+ # Product Context
2
+
3
+ ## Why This Project Exists
4
+ [The problem this project solves]
5
+
6
+ ## User Problems
7
+ - [Problem 1]
8
+ - [Problem 2]
9
+
10
+ ## How It Should Work
11
+ [Expected user experience and workflow]
12
+
13
+ ## UX Goals
14
+ - [UX goal 1]
15
+ - [UX goal 2]
16
+
17
+ ## Success Metrics
18
+ - [How we know this project is working]
19
+
20
+ ---
21
+ *Auto-maintained by Claude. Updated when product goals or user problems are clarified.*
@@ -0,0 +1,16 @@
1
+ # Progress
2
+
3
+ ## Completed
4
+ - [Completed task] — [date]
5
+
6
+ ## In Progress
7
+ - [Current task] — started [date]
8
+
9
+ ## Pending
10
+ - [Upcoming task]
11
+
12
+ ## Blocked
13
+ - [Blocked task] — reason: [why]
14
+
15
+ ---
16
+ *Auto-maintained by Claude. Updated when tasks start, complete, fail, or get added.*
@@ -0,0 +1,24 @@
1
+ # Project Brief
2
+
3
+ ## Project Name
4
+ [Project name will be auto-filled by Claude]
5
+
6
+ ## Overview
7
+ [Brief description of what this project is]
8
+
9
+ ## Goals
10
+ - [Primary goal]
11
+ - [Secondary goals]
12
+
13
+ ## Requirements
14
+ - [Key requirements]
15
+
16
+ ## Scope
17
+ - **In scope:** [What this project covers]
18
+ - **Out of scope:** [What this project does NOT cover]
19
+
20
+ ## Target Users
21
+ - [Who will use this]
22
+
23
+ ---
24
+ *Auto-maintained by Claude. Updated when project scope or goals change.*
@@ -0,0 +1,16 @@
1
+ # References
2
+
3
+ ## External Links
4
+ - [Resource name](URL) — [What it's used for]
5
+
6
+ ## APIs
7
+ - [API name]: [Base URL, auth method, purpose]
8
+
9
+ ## Tools & Services
10
+ - [Tool name]: [How it's used in this project]
11
+
12
+ ## Documentation
13
+ - [Doc link]: [What it covers]
14
+
15
+ ---
16
+ *Auto-maintained by Claude. Updated when external resources, APIs, or tools are referenced.*
@@ -0,0 +1,33 @@
1
+ # Tech Context
2
+
3
+ ## Tech Stack
4
+ - **Language:** [e.g., JavaScript, Python]
5
+ - **Framework:** [e.g., React, Express]
6
+ - **Runtime:** [e.g., Node.js 20]
7
+
8
+ ## Dependencies
9
+ [Key dependencies and their purpose]
10
+
11
+ ## Dev Environment Setup
12
+ ```bash
13
+ # Steps to set up the project locally
14
+ ```
15
+
16
+ ## Build & Run Commands
17
+ - **Install:** `[command]`
18
+ - **Dev:** `[command]`
19
+ - **Build:** `[command]`
20
+ - **Test:** `[command]`
21
+
22
+ ## Project Structure
23
+ ```
24
+ [Key directories and their purpose]
25
+ ```
26
+
27
+ ## Environment Variables
28
+ | Variable | Purpose | Required |
29
+ |---|---|---|
30
+ | | | |
31
+
32
+ ---
33
+ *Auto-maintained by Claude. Updated when dependencies, tools, or setup changes.*
@@ -0,0 +1,18 @@
1
+ # Troubleshooting
2
+
3
+ ## Known Issues
4
+
5
+ ### [Issue Title] — [date]
6
+ - **Symptom:** [What went wrong]
7
+ - **Cause:** [Root cause]
8
+ - **Fix:** [How it was resolved]
9
+ - **Prevention:** [How to avoid it in the future]
10
+
11
+ ## Workarounds
12
+ - [Workaround description]
13
+
14
+ ## Lessons Learned
15
+ - [Lesson from a past bug or issue]
16
+
17
+ ---
18
+ *Auto-maintained by Claude. Updated when bugs are found, fixed, or workarounds are discovered.*