Skip to content

Instantly share code, notes, and snippets.

@MisreadableMind
Created April 9, 2026 20:37
Show Gist options
  • Select an option

  • Save MisreadableMind/e0e0e4cf2428abb7aed375d04112257d to your computer and use it in GitHub Desktop.

Select an option

Save MisreadableMind/e0e0e4cf2428abb7aed375d04112257d to your computer and use it in GitHub Desktop.
description Initialize a .memory-bank folder with structured project documentation templates
allowed-tools Bash, Read, Write, Glob, Grep, AskUserQuestion

Initialize a Memory Bank for the current project. Memory Bank is a .memory-bank folder in the project root that serves as a persistent knowledge base storing structured documentation about the project: goals, architecture, conventions, tech stack, and current tasks.

Steps

1. Check for existing Memory Bank

Look for an existing .memory-bank folder in the project root. If one exists, inform the user and ask whether to overwrite or skip.

2. Analyze the project

Before creating files, analyze the current project to pre-fill templates with real data:

  • Read package.json, Cargo.toml, pyproject.toml, go.mod, or similar to detect tech stack and project name
  • Check for .git and inspect git conventions (branch names, recent commit message styles)
  • Look for existing README, docs, CI configs (.github/workflows, .gitlab-ci.yml, Dockerfile, etc.)
  • Identify test frameworks and test file patterns
  • Detect linters/formatters from config files (.eslintrc, .prettierrc, ruff.toml, etc.)

3. Create folder structure

Create the following structure:

.memory-bank/
├── index.md
├── product-overview/
│   ├── README.md
│   ├── user-stories.md
│   └── features-epics.md
├── steerings/
│   ├── README.md
│   └── development-conventions.md
├── tech-details/
│   ├── README.md
│   ├── testing-conventions.md
│   ├── infrastructure.md
│   └── tech-stack.md
└── tasks/
    ├── README.md
    ├── active.md
    └── backlog.md

4. Fill templates with project data

Use the templates below. Replace placeholder values with real data discovered in step 2. Leave sections as templates (with placeholder text) only when no data can be inferred.

index.md

# [Project Name] - Memory Bank

## Quick Links

- [Product Overview](./product-overview/README.md)
- [Steerings](./steerings/README.md)
- [Tech Details](./tech-details/README.md)
- [Tasks](./tasks/README.md)

## Project Summary

One paragraph describing what this project does.

## Current Status

- **Phase**: Development / MVP / Production
- **Version**: x.x.x
- **Last Updated**: YYYY-MM-DD

product-overview/README.md

# Product Overview

## What is this?

Describe the product in 2-3 sentences.

## Problem Statement

What problem does this solve?

## Target Audience

Who uses this product?

## Success Metrics

How do we measure success?

product-overview/user-stories.md

# User Stories

## Format

Each story follows: **As a [role], I want [feature], so that [benefit].**

## Stories

### [Feature Group Name]

- As a [role], I want [feature], so that [benefit].

product-overview/features-epics.md

# Features & Epics

## Epic 1: [Name]

**Goal**: What this epic achieves

### Features

| Feature | Status | Priority |
|---------|--------|----------|
| Feature A | Done | High |
| Feature B | In Progress | High |
| Feature C | Planned | Medium |

steerings/README.md

# Steerings

General project rules and conventions.

- [Development Conventions](./development-conventions.md)

steerings/development-conventions.md

# Development Conventions

## Git Flow

- **Main branch**: `main` - production-ready code
- **Development branch**: `develop` - integration branch
- **Feature branches**: `feature/short-description`
- **Bugfix branches**: `bugfix/short-description`

## Commit Messages

Format: `type(scope): description`

Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`

Example: `feat(auth): add password reset flow`

## Code Style

- Linter: [tool name]
- Formatter: [tool name]

## Pull Request Rules

1. PR title follows commit message format
2. Description includes "What" and "Why"
3. At least 1 approval required
4. All CI checks must pass

tech-details/README.md

# Tech Details

- [Tech Stack](./tech-stack.md)
- [Testing Conventions](./testing-conventions.md)
- [Infrastructure](./infrastructure.md)

tech-details/tech-stack.md

# Tech Stack

## Frontend

| Technology | Version | Purpose |
|------------|---------|---------|
| [framework] | x.x | UI framework |

## Backend

| Technology | Version | Purpose |
|------------|---------|---------|
| [runtime] | x.x | Runtime |
| [database] | x.x | Database |

## Infrastructure

| Technology | Purpose |
|------------|---------|
| Docker | Containerization |

## Why These Choices?

Brief explanation of architectural decisions.

tech-details/testing-conventions.md

# Testing Conventions

## Test Types

- **Unit tests**: Test individual functions/components
- **Integration tests**: Test module interactions
- **E2E tests**: Test full user flows

## Running Tests

```bash
# All tests
[test command here]

Coverage Requirements

  • Minimum coverage: 80%
  • Critical paths: 100%

Naming Convention

[Detected or placeholder naming convention]


#### tech-details/infrastructure.md

```markdown
# Infrastructure

## Environments

| Environment | URL | Branch | Purpose |
|-------------|-----|--------|---------|
| Development | localhost | develop | Testing |
| Production | [url] | main | Live |

## CI/CD Pipeline

[Describe detected CI/CD or leave as template]

## Environment Variables

List required env vars (without values):

- `DATABASE_URL` - Database connection string

tasks/README.md

# Tasks

- [Active Tasks](./active.md)
- [Backlog](./backlog.md)

tasks/active.md

# Active Tasks

## Current Sprint

**Period**: YYYY-MM-DD to YYYY-MM-DD

## In Progress

_No active tasks yet._

tasks/backlog.md

# Backlog

## Upcoming

_No backlog items yet._

5. Summary

After creating all files, print a summary:

  • List all created files
  • Highlight which sections were pre-filled with detected project data
  • Remind the user to review and fill in remaining placeholder sections
  • Suggest adding this to their AI assistant prompt: Read .memory-bank/index.md and linked files to understand this project before answering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment