Repository: tacticlaunch/cursor-bank
Files analyzed: 7
Estimated tokens: 3.6k
Directory structure:
└── tacticlaunch-cursor-bank/
├── README.md
├── index.js
├── LICENSE.md
├── package.json
├── .cursor/
│ └── rules/
│ ├── core.mdc
│ └── memory-bank.mdc
└── .github/
└── workflows/
└── publish.yml
================================================
FILE: README.md
================================================
# Cursor Memory Bank
Cursor Memory Bank is a powerful feature that enhances AI assistance by maintaining perfect documentation between sessions. It addresses AI's session memory limitations by creating a structured documentation system that serves as the AI's persistent memory.
## Installation
### Option 1: Using npx (Recommended)
Run the following command in your project root directory:
```bash
npx cursor-bank init
```
This will automatically:
1. Copy the `.cursor/rules` directory to your project
2. Create a `memory-bank` directory in your project root
Other options
### Option 2: Global Installation
```bash
npm install -g cursor-bank
```
2. Run the init command in your project:
```bash
cursor-bank init
```
### Option 3: Download Files Directly
You can also download the `.cursor/rules` directory manually from:
https://github.com/tacticlaunch/cursor-bank/tree/main/.cursor/rules
## After Installation
- For exists project write to Cursor agent - **initialize memory bank**
- For new project I would recommend this flow:
- Write to Cursor agent
```
PLAN
```
- After Cursor agent end its speach write to it - **initialize memory bank**
## Usage
### Basic Commands
- `PLAN` - Enter or return to plan mode
- `ACT` - Approve plan and switch to implementation mode
- `update memory bank` - Trigger documentation update
## Links
[tacticlaunch/mcp-linear](https://github.com/tacticlaunch/mcp-linear) - If you are a developer seeking to enhance your workflow with Linear, consider giving it a try.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
================================================
FILE: index.js
================================================
#!/usr/bin/env node
const fs = require('fs-extra');
const path = require('path');
const os = require('os');
const { simpleGit } = require('simple-git');
const { program } = require('commander');
const { version } = require('./package.json');
const _debug = require('debug');
const debug = require('debug')('cursor-bank');
const git = simpleGit();
// Configuration
const config = {
repoUrl: 'https://github.com/tacticlaunch/cursor-bank',
sourcePath: '.cursor/rules',
targetPath: '.cursor/rules',
branch: 'main'
};
// Custom logger function
const log = {
info: (message) => console.log(message),
debug: (message) => debug(message),
error: (message) => console.error(message)
};
async function cloneAndCopy(options) {
// Enable debug logging if the debug flag is set
if (options.debug) {
_debug.enable('cursor-bank');
debug('Debug mode enabled');
}
// Create a temporary directory
const tempDir = path.join(os.tmpdir(), `cursor-bank-${Date.now()}`);
log.debug(`Creating temporary directory: ${tempDir}`);
try {
// Clone the repository
log.info(`Cloning repository...`);
log.debug(`Cloning from ${config.repoUrl} branch ${config.branch}`);
await git.clone(config.repoUrl, tempDir, [
'--depth', '1',
'--single-branch',
'--branch', config.branch
]);
// Path to source directory in the cloned repo
const sourcePath = path.join(tempDir, config.sourcePath);
// Path to target directory in current working directory
const targetPath = path.join(process.cwd(), config.targetPath);
// Check if source exists
if (!fs.existsSync(sourcePath)) {
throw new Error(`Source path ${config.sourcePath} not found in repository`);
}
// Create target directory if it doesn't exist
log.info(`Copying rules to ${config.targetPath}...`);
log.debug(`Full source path: ${sourcePath}`);
log.debug(`Full target path: ${targetPath}`);
await fs.ensureDir(path.dirname(targetPath));
// Copy directory
await fs.copy(sourcePath, targetPath);
log.debug(`Successfully copied ${config.sourcePath} to ${targetPath}`);
// Create memory-bank directory if it doesn't exist
const memoryBankPath = path.join(process.cwd(), 'memory-bank');
if (!fs.existsSync(memoryBankPath)) {
log.info('Creating memory-bank directory...');
await fs.ensureDir(memoryBankPath);
log.debug('Successfully created memory-bank directory');
} else {
log.debug('memory-bank directory already exists');
}
log.info('\n✅ Setup complete! You can now use the Cursor Memory Bank.');
log.info('For new projects, I recommend starting with a PLAN command before initializing the memory bank. For more details, visit https://github.com/tacticlaunch/cursor-bank');
log.info('For existing projects, write to your Cursor assistant: "initialize memory bank".');
} catch (error) {
log.error('An error occurred:');
log.error(error.message);
if (options.debug) {
log.debug(error.stack);
}
process.exit(1);
} finally {
// Clean up temporary directory
if (fs.existsSync(tempDir)) {
log.debug(`Cleaning up temporary directory: ${tempDir}`);
await fs.remove(tempDir);
}
}
}
// Setup CLI commands
program
.name('cursor-bank')
.description('Cursor Memory Bank installer and utilities')
.version(version);
program
.command('init')
.description('Initialize Cursor Memory Bank in the current project')
.option('-d, --debug', 'Enable debug output')
.action((options) => {
log.info('Initializing Cursor Memory Bank...');
cloneAndCopy(options);
});
// If no arguments provided, show help
if (process.argv.length === 2) {
program.help();
}
program.parse();
================================================
FILE: LICENSE.md
================================================
MIT License
Copyright (c) 2025 Alexey Elizarov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: package.json
================================================
{
"name": "cursor-bank",
"public": true,
"version": "1.0.1",
"license": "MIT",
"description": "Cursor Memory Bank is a powerful feature that enhances AI assistance by maintaining perfect documentation between sessions. It addresses the AI's session memory limitations by creating a structured documentation system that serves as the AI's persistent memory.",
"keywords": [
"memory-bank",
"cursor",
"ai",
"documentation",
"claude"
],
"main": "index.js",
"bin": {
"cursor-bank": "./index.js"
},
"author": "Alexey Elizarov ",
"repository": {
"type": "git",
"url": "git+https://github.com/tacticlaunch/cursor-bank.git"
},
"scripts": {
"start": "node index.js"
},
"publishConfig": {
"access": "public"
},
"bugs": {
"url": "https://github.com/tacticlaunch/cursor-bank/issues"
},
"homepage": "https://github.com/tacticlaunch/cursor-bank#readme",
"dependencies": {
"commander": "^12.1.0",
"debug": "^4.4.0",
"fs-extra": "^11.1.1",
"simple-git": "^3.21.0"
}
}
================================================
FILE: .cursor/rules/core.mdc
================================================
---
description:
globs:
alwaysApply: true
---
## Core Rules
You have two modes of operation:
1. Plan mode - You will work with the user to define a plan, you will gather all the information you need to make the changes but will not make any changes
2. Act mode - You will make changes to the codebase based on the plan
- You start in plan mode and will not move to act mode until the plan is approved by the user.
- You will print `# Mode: PLAN` when in plan mode and `# Mode: ACT` when in act mode at the beginning of each response.
- Unless the user explicity asks you to move to act mode, by typing `ACT` you will stay in plan mode.
- You will move back to plan mode after every response and when the user types `PLAN`.
- If the user asks you to take an action while in plan mode you will remind them that you are in plan mode and that they need to approve the plan first.
- When in plan mode always output the full updated plan in every response.
================================================
FILE: .cursor/rules/memory-bank.mdc
================================================
---
description:
globs:
alwaysApply: true
---
# Cursor's Memory Bank
I am Cursor, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional.
## Memory Bank Structure
The Memory Bank consists of required core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:
\```mermaid
flowchart TD
PB[projectbrief.md] --> PC[productContext.md]
PB --> SP[systemPatterns.md]
PB --> TC[techContext.md]
PC --> AC[activeContext.md]
SP --> AC
TC --> AC
AC --> P[progress.md]
\```
### Core Files (Required)
1. `projectbrief.md`
- Foundation document that shapes all other files
- Created at project start if it doesn't exist
- Defines core requirements and goals
- Source of truth for project scope
2. `productContext.md`
- Why this project exists
- Problems it solves
- How it should work
- User experience goals
3. `activeContext.md`
- Current work focus
- Recent changes
- Next steps
- Active decisions and considerations
4. `systemPatterns.md`
- System architecture
- Key technical decisions
- Design patterns in use
- Component relationships
5. `techContext.md`
- Technologies used
- Development setup
- Technical constraints
- Dependencies
6. `progress.md`
- What works
- What's left to build
- Current status
- Known issues
### Additional Context
Create additional files/folders within memory-bank/ when they help organize:
- Complex feature documentation
- Integration specifications
- API documentation
- Testing strategies
- Deployment procedures
## Core Workflows
### Plan Mode
\```mermaid
flowchart TD
Start[Start] --> ReadFiles[Read Memory Bank]
ReadFiles --> CheckFiles{Files Complete?}
CheckFiles -->|No| Plan[Create Plan]
Plan --> Document[Document in Chat]
CheckFiles -->|Yes| Verify[Verify Context]
Verify --> Strategy[Develop Strategy]
Strategy --> Present[Present Approach]
\```
### Act Mode
\```mermaid
flowchart TD
Start[Start] --> Context[Check Memory Bank]
Context --> Update[Update Documentation]
Update --> Rules[Update .cursor/rules if needed]
Rules --> Execute[Execute Task]
Execute --> Document[Document Changes]
\```
## Documentation Updates
Memory Bank updates occur when:
1. Discovering new project patterns
2. After implementing significant changes
3. When user requests with **update memory bank** (MUST review ALL files)
4. When context needs clarification
\```mermaid
flowchart TD
Start[Update Process]
subgraph Process
P1[Review ALL Files]
P2[Document Current State]
P3[Clarify Next Steps]
P4[Update .cursor/rules]
P1 --> P2 --> P3 --> P4
end
Start --> Process
\```
Note: When triggered by **update memory bank**, I MUST review every memory bank file, even if some don't require updates. Focus particularly on activeContext.md and progress.md as they track current state.
## Project Intelligence (.cursor/rules)
The .cursor/rules file is my learning journal for each project. It captures important patterns, preferences, and project intelligence that help me work more effectively. As I work with you and the project, I'll discover and document key insights that aren't obvious from the code alone.
\```mermaid
flowchart TD
Start{Discover New Pattern}
subgraph Learn [Learning Process]
D1[Identify Pattern]
D2[Validate with User]
D3[Document in .cursor/rules]
end
subgraph Apply [Usage]
A1[Read .cursor/rules]
A2[Apply Learned Patterns]
A3[Improve Future Work]
end
Start --> Learn
Learn --> Apply
\```
### What to Capture
- Critical implementation paths
- User preferences and workflow
- Project-specific patterns
- Known challenges
- Evolution of project decisions
- Tool usage patterns
The format is flexible - focus on capturing valuable insights that help me work more effectively with you and the project. Think of .cursor/rules as a living document that grows smarter as we work together.
REMEMBER: After every memory reset, I begin completely fresh. The Memory Bank is my only link to previous work. It must be maintained with precision and clarity, as my effectiveness depends entirely on its accuracy.
================================================
FILE: .github/workflows/publish.yml
================================================
name: Publish to npm
on:
workflow_dispatch:
inputs:
version:
description: 'Version bump type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: npm ci
- name: Version bump
id: version
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
npm version ${{ github.event.inputs.version }} -m "Bump version to %s [skip ci]"
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Push changes
run: git push --follow-tags
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.VERSION }}
generate_release_notes: true
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}