Custom Instructions

Custom Instructions enable you to tailor Gamecraft Agent's behavior by providing specific guidance.

You can influences the agent's responses, coding style preferences, and decision-making processes to match your development workflow and standards.

Instruction File Locations

You can configure custom instructions through multiple approaches: global rules that apply across all projects, workspace-specific rules for individual projects, or direct configuration through the Prompts interface.

Global Rules Directory: Automatically applied to all projects across your development environment.

  • Linux/macOS: ~/.gamecraft/rules/ and ~/.gamecraft/rules-{modeSlug}/

  • Windows: %USERPROFILE%\.gamecraft\rules\ and %USERPROFILE%\.gamecraft\rules-{modeSlug}\

Workspace Rules: Project-specific instructions that can override global configurations.

  • Preferred Method: Directory Structure (.gamecraft/rules/)

    .
    ├── .gamecraft/
    │   └── rules/                # Workspace-wide rules
    │       ├── 01-general.md
    │       └── 02-coding-style.txt
    └── ... (other project files)
  • Fallback Method: Single File (.gamecraftrules)

    .
    ├── .gamecraftrules           # Workspace-wide rules (single file)
    └── ... (other project files)

Mode-Specific Instructions: Apply only to designated operational modes (e.g., code mode).

  • Preferred Method: Directory Structure (.gamecraft/rules-{modeSlug}/)

    .
    ├── .gamecraft/
    │   └── rules-agent/           # Rules for "agent" mode
    │       ├── 01-js-style.md
    │       └── 02-ts-style.md
    └── ... (other project files)
  • Fallback Method: Single File (.gamecraftrules-{modeSlug})

    .
    ├── .gamecraftrules-agent      # Rules for "agent" mode (single file)
    └── ... (other project files)

Loading Priority: Instructions are processed in hierarchical order - global rules load first, followed by workspace rules that can override global configurations. See Global Rules Directory section for comprehensive details.

Understanding Custom Instructions

Custom Instructions establish specific behavioral patterns, preferences, and constraints that extend beyond Gamecraft Agent's foundational capabilities. These encompass game setup and structure, coding style guidelines, documentation standards, testing requirements, workflow protocols, and project-specific development practices.

Configuring Custom Instructions

Global Custom Instructions

Global instructions maintain consistency across all workspaces, ensuring your development preferences persist regardless of the current project context.

Global Rules Directory System

The Global Rules Directory provides a sophisticated system for creating reusable instructions that automatically apply across your entire development environment, supporting both universal configurations and project-specific overrides.

System Advantages

Without Global Rules: Traditional approach requiring manual maintenance:

  • Copy identical rules to each new project manually

  • Update rules individually across multiple projects

  • No consistency guarantees between different projects

With Global Rules: Centralized configuration management:

  • Establish preferred coding standards once, apply everywhere

  • Override specific rules per project when circumstances require

  • Maintain development consistency across your entire portfolio

  • Update rules universally with single modifications

Directory Organization

Global rules directory locations are standardized and non-configurable:

Linux/macOS: ~/.gamecraft/rules/ Windows: %USERPROFILE%\.gamecraft\rules\

Global Rules Setup

  1. Create Global Rules Directory:

    # Linux/macOS
    mkdir -p ~/.gamecraft/rules
    
    # Windows
    mkdir %USERPROFILE%\.gamecraft\rules
  2. Add General Rules (~/.gamecraft/rules/coding-standards.md):

    # Global Coding Standards
    1. Always use C# for new projects
    2. Write unit tests for all new scripts
    3. Use descriptive variable names
  3. Add Mode-Specific Rules (~/.gamecraft/rules-code/c-sharp-rules.md):

    # C# Code Mode Rules
    1. Use available Unity APIs wherever possible
    2. Use a SerializedField when it makes sense for configurable properties

Available Rule Directories

Directory
Purpose

rules/

General rules applied to all operational modes

rules-code/

Rules specific to Code mode operations

rules-architect/

Rules for system architecture tasks

rules-debug/

Rules for debugging workflows

rules-{mode}/

Rules for any custom operational mode

Rule Processing Order

Instructions are loaded and applied in this hierarchical sequence:

  1. Global Rules (from ~/.gamecraft/)

  2. Project Rules (from project/.gamecraft/) - can override global configurations

  3. Legacy Files (.gamecraftrules)

Within each hierarchy level, mode-specific rules are processed before general rules.

Workspace-Level Instructions

Workspace instructions provide project-specific customization, allowing Gamecraft Agent to adapt its behavior for individual project requirements and constraints.

Workspace-Wide Instructions via Files/Directories

Workspace-wide instructions apply to all operational modes within the current project and can be configured through file-based approaches:

  • Preferred Method: Directory-Based (.gamecraft/rules/)

    Create a .gamecraft/rules/ directory in your workspace root directory. Place instruction files (.md, .txt, etc.) inside the directory. Gamecraft Agent reads files recursively, appending content to the system prompt in alphabetical filename order. This method takes precedence when the directory exists and contains instruction files.

  • Fallback Method: File-Based (.gamecraftrules)

    If .gamecraft/rules/ doesn't exist or contains no files, Gamecraft Agent searches for a single .gamecraftrules file in the workspace root. When found, the file content is loaded and applied.

Mode-Specific Instructions

Using Rule Files/Directories: Provide mode-specific instructions through file-based configuration:

  • Preferred Method: Directory-Based (.gamecraft/rules-{modeSlug}/)

    Create a directory named .gamecraft/rules-{modeSlug}/ (e.g., .gamecraft/rules-docs-writer/) in your workspace root. Place instruction files inside (supports recursive loading). Files are processed and appended to the system prompt in alphabetical filename order. This method takes precedence over the fallback file method for the specific mode when the directory exists and contains files.

  • Fallback Method: File-Based (.gamecraftrules-{modeSlug})

    If .gamecraft/rules-{modeSlug}/ doesn't exist or is empty, Gamecraft Agent searches for a single .gamecraftrules-{modeSlug} file (e.g., .gamecraftrules-code) in the workspace root. When found, the file content is loaded for that specific mode.

Instructions from the global rules, workspace rules, and mode-specific rules are all integrated. See the following section for the precise combination order.

Instruction Combination Process

Instructions are integrated into the system prompt using this exact hierarchical format:

Note: Global rules load first, followed by workspace rules that can override global configurations. Mode-specific rules appear before general rules within each hierarchy level, and directory-based rules take precedence over file-based fallback methods.

Rules File Guidelines

  • File Location: The preferred approach uses directories within .gamecraft/ (.gamecraft/rules/ and .gamecraft/rules-{modeSlug}/). The fallback approach uses single files (.gamecraftrules and .gamecraftrules-{modeSlug}) located directly in the workspace root.

  • Empty Files: Empty or missing rule files are silently ignored without errors

  • Source Headers: Each rule file's content is included with a header indicating its source location

  • Rule Interaction: Mode-specific rules complement global rules rather than replacing them entirely

Custom Instruction Examples

  • "Always use spaces for indentation, with a width of 4 spaces"

  • "Use camelCase for variable names"

  • "Write unit tests for all new functions"

  • "Explain your reasoning before providing code"

  • "Focus on code readability and maintainability"

  • "Prioritize using the most common library in the community"

  • "When adding new features to scripts, ensure they are responsive and accessible"

Team Standardization Strategies

For collaborative development environments, consider these organizational approaches:

Project Standards: Use workspace .gamecraft/rules/ directories under version control to standardize Gamecraft Agent's behavior for specific projects. This ensures consistent code style and development workflows across all team members.

Organization Standards: Use global rules (~/.gamecraft/rules/) to establish organization-wide coding standards that apply to all projects. Team members can configure identical global rules for consistency across all development work.

Hybrid Approach: Combine global rules for organization standards with project-specific workspace rules for project-unique requirements. Workspace rules can override global rules when specific project needs require different approaches.

The directory-based approach offers superior organization compared to single .gamecraftrules files and supports both global and project-level customization strategies.

Last updated