Project Persistent Instructions: Help AI Coding Assistants Understand Your Project Quickly

    Persistent project instructions give AI coding assistants the context they need at the start of a session, reducing repeated explanations and inconsistent code. This article outlines the five parts of a useful project brief, how to place instruction files at system, user, project, and subdirectory levels, and practical rules for keeping briefs concise and actionable with concrete commands.

    1. Why a Project Brief Is Needed

    Every new AI coding session starts from zero. The model does not know what the project does, which frameworks it uses, or which mandatory rules the team follows. It can only traverse directories and read files one by one to piece together the full picture. This process is time-consuming and often misses key information. As a result, the same questions are explained repeatedly, generated code does not match team conventions, and manual rework is required.

    A project brief organizes this background into a document in advance. When a session starts, the tool automatically loads it into context, so the model has global project information from the beginning.

    A qualified brief usually contains five categories of content:

    • Project positioning: what problem the project solves and which core modules it contains
    • Tech stack: language versions, main frameworks, data storage, and middleware
    • Mandatory rules: required coding, naming, commit, and security requirements
    • Common commands: specific instructions for installing dependencies, starting, testing, building, and deploying
    • Pitfalls and notes: error-prone areas and legacy issues

    2. Hierarchical Placement and Loading Order

    The same tool usually supports instruction files at multiple levels, with different levels serving different scopes:

    Level Typical location Load timing Suitable content
    System-level Shared OS management directory Always loaded Organization-wide security and compliance requirements
    User-level Current user’s configuration directory Always loaded Personal expression and writing preferences
    Project-level Repository root Loaded when entering the project Project conventions, tech stack, common commands
    Subdirectory-level Directory of a specific module Loaded when accessing that directory Module-specific conventions, such as amount handling rules in a billing module

    Specific file names and paths vary by tool. Refer to the official documentation for the tool you use.

    The key to hierarchy design is single responsibility. System-level files hold hard constraints that do not change by project, project-level files hold shared team conventions, and subdirectory-level files hold local details. If everything is piled into the repository root, the brief will expand quickly, and the model will struggle to determine which rule applies to which module.

    When instructions from different levels conflict, the brief should explicitly state precedence or exceptions. Otherwise, the model can only make its own tradeoffs, and its behavior becomes unpredictable.

    3. Principles for Writing Effective Briefs

    1. Be Concise and Specific

    The model loads the entire brief into context. The longer the brief, the more context it consumes, leaving less room for code and conversation. Each rule should directly guide action.

    Bad example: Please write high-quality, maintainable code.

    Good example: New functions must include type annotations; functions with bodies longer than 60 lines must be split into subfunctions.

    2. Provide Executable Commands

    Rather than describing how to run tests, write the commands directly:

    1. ## Common commands
    2. - Install dependencies: `<install dependencies command>`
    3. - Start the local development environment: `<start command>`
    4. - Run unit tests: `<test command>`
    5. - Static checks: `<check command>`