Skip to main content
In this lesson we continue building an “ideal” development setup — a collection of tools and patterns you can adopt to make your environment consistent, secure, and productive. The ideal setup is the one that works for you; the suggestions here are practical defaults you can adapt. This article focuses on two complementary components:
  • Client rules — persistent, system-level guidance that the assistant will apply to every conversation and code generation task.
  • The Cline memory bank — a structured, persistent documentation system that preserves project context across sessions.

Client rules

Client rules let you encode project-level guidance that the assistant consults automatically. Use them for coding standards, security constraints (for example, “do not access repository X”), forbidden actions, network restrictions, or any team-wide policy you want enforced. You can create client rules via the product UI or with shortcuts like /new rule. If you prefer editing locally, manage rules inside your editor (for example, Visual Studio Code). Rules can be:
  • Global — apply to all projects for your account.
  • Workspace — apply to the current workspace.
  • Project-specific — apply only to the repository where they live.
Project-specific rules typically live under .client/rules/. For example, adding a file named Python-rules.md will create .client/rules/Python-rules.md, which the assistant will consult for that project.
Client rules are persistent and applied automatically. Use them to encode team conventions, forbidden actions (for example, “do not access repository X”), or project-wide safety constraints.

Example: Python coding rules

Below is a sample rules document you could add at .client/rules/Python-rules.md. Store it once and the assistant will consult it when generating or reviewing Python code for the project.
## Formatting

- **Indentation:** Use 4 spaces per indentation level.
- **Line Length:** Limit lines to 79 characters.
- **Blank Lines:**
  - Two blank lines between top-level functions/classes
  - One blank line between class methods
- **Whitespace:**
  - No extra whitespace inside `()`, `[]`, or `{}`.
  - No extra whitespace before `,`, `;`, or `:`.

## Naming

- **Variables:** Use `snake_case`
- **Functions:** Use `snake_case`
- **Classes:** Use `PascalCase`
- **Constants:** Use `UPPER_CASE`
- **Descriptive Names:** Use clear, descriptive names
- **Single-letter Variables:** Only for counters (`i`, `j`, `k`)

## Imports

- **Order:** Standard library, third-party, local imports
- **Grouping:** Group imports by type
- **Placement:** Place imports at the top of the file

## Comparisons

- Use `is`/`is not` for `None`
- Avoid `== True` or `== False`

## Code Structure

- Follow modular design and keep functions small and focused.
- Add docstrings to public modules, classes, and functions.
Once .client/rules/Python-rules.md exists, the assistant will follow these guidelines for Python-related requests in that repository.

Memory bank

The memory bank is a structured documentation system that turns the assistant from a stateless helper into a persistent development partner. It preserves project context across sessions, making the assistant more effective on long-lived or large codebases.
A screenshot of a dark-themed documentation webpage (docs.cline.bot) about the "Cline Memory Bank," showing left and right navigation sidebars and central content. The main text explains what the memory bank is and lists key benefits in bullet points.
The memory bank typically includes core markdown files that describe the project at multiple levels: high-level brief, product rationale, the current sprint, system patterns, progress, and known issues. See the official docs for more details: https://docs.cline.bot/prompting/client-memory-bank.
A dark-mode screenshot of a documentation webpage (docs.cline.bot) about the "Cline Memory Bank," showing a central flowchart diagram of markdown files. Left and right sidebars display navigation menus while the main content shows headings and bullet points explaining memory bank files.

Typical memory-bank files and purposes

FilePurposeNotes
projectbrief.mdHigh-level overview: what you’re building and whyFoundation for new contributors
productContext.mdWhy the product exists, user problems, goalsUpdated frequently
activeContext.mdCurrent sprint or active tasksShort-lived; refreshed often
systemPatterns.mdArchitecture overview and technical decisionsUseful for onboarding and design work
progress.mdWhat works, what’s left, known issuesTracks status and decision evolution
A dark-themed browser screenshot of documentation titled "Memory Bank Files Explained," showing a three-column layout with a left navigation menu, a central content area listing core files (e.g., projectbrief.md, productContext.md, activeContext.md), and a right-side table of contents.

Creating and updating the memory bank

A simple workflow:
  1. Create a memory-bank/ folder at the project root and add the core markdown files listed above.
  2. Use the assistant’s “initialize memory bank” action to scaffold standard files automatically.
  3. As the project evolves, run the “update memory bank” action to push new or changed content into the memory bank so the assistant always reads the latest context.
  4. Allow the assistant to perform tasks while consulting the memory bank for more accurate, context-aware results.

Example scaffolding templates

Product Context (scaffold)
## Purpose
This document outlines why this project exists and the
problems it aims to solve.

## Problems Addressed
- [Placeholder: List specific problems or needs this project addresses.]

## User Experience Goals
- [Placeholder: Define how the product should work and feel for users.]

## Target Audience
- [Placeholder: Describe the intended users or stakeholders.]

**Note**: This file will be updated with detailed information as the project progresses.
System Patterns (scaffold)
## Architecture Overview
- [Placeholder: Describe the overall system architecture.]

## Key Technical Decisions
- [Placeholder: List significant technical choices made for the project.]

## Design Patterns
- [Placeholder: Outline design patterns currently in use.]

## Critical Implementation Paths
- [Placeholder: Detail important implementation paths or workflows.]

**Note**: This file will be updated with detailed information as the project's technical structure evolves.
Progress (scaffold)
## What Works
- [Placeholder: List features or components that are currently functional.]

## What's Left to Build
- [Placeholder: Outline remaining tasks or features to be implemented.]

## Current Status
- [Placeholder: Summarize the overall state of the project.]

## Known Issues
- [Placeholder: Document any identified bugs or issues.]

## Evolution of Decisions
- [Placeholder: Track how project decisions have changed over time.]

**Note**: This file will be updated regularly to reflect the project's advancement and challenges.
Core workflows (illustration)

Using Act mode to scaffold and update

When you enable the assistant to perform actions (for example, the “initialize memory bank” action), it can:
  • Generate scaffold files under memory-bank/.
  • Create or update the core markdown files.
  • Keep documentation synchronized with development changes as you push updates.
Run the “update memory bank” action whenever you make substantive changes so the assistant has the latest context for future tasks.
Do not store secrets (API keys, passwords, or private certificates) in the memory bank. Treat it as project documentation only. Use secure secret management for credentials.

Why this matters

A well-maintained memory bank plus explicit client rules give the assistant:
  • Clear policies and style preferences to apply automatically.
  • Project context that informs design, implementation, and reviews.
  • Reduced onboarding friction for new contributors.
  • Better consistency for refactors and long-lived work.
For long-term projects, backfill the memory bank with historical decisions and then iterate. This makes the assistant immediately useful across many kinds of tasks.
In short: combine client rules (policy and style) with a maintained memory bank (project context) to make the assistant a consistent, persistent development partner.

Watch Video