Working in Large Projects

Gamecraft Agent excels at handling projects of all scales, though large codebases benefit from strategic context management approaches.

This guide provides proven techniques for effectively working with extensive development projects.

Context Window Fundamentals

Gamecraft Agent operates using advanced large language models (LLMs) that process information within a finite "context window." This represents the maximum volume of text (measured in tokens) that the model can analyze simultaneously. Exceeding this limit may result in incomplete understanding of your requests or reduced response accuracy.

The context window encompasses:

  • System prompts (core instructions for Gamecraft Agent)

  • Complete conversation history

  • Content from files referenced using @ mentions or drag-and-drop to context

  • Output from executed commands and integrated tools

Effective Context Management Strategies

  1. Maintain Precision: When referencing code elements, utilize exact file paths and function names. Avoid ambiguous references such as "the main file" that can confuse the agent's understanding.

  2. Leverage Context Mentions Strategically: Employ @/path/to/file.ts to include specific files in your context. Use @problems to incorporate current errors and warnings. Reference specific Git commits with @ followed by a commit hash for historical context.

  3. Decompose Complex Tasks: Segment large-scale tasks into smaller, focused sub-tasks. This approach maintains context clarity and improves Gamecraft Agent's ability to provide accurate assistance.

  4. Implement Strategic Summarization: When dealing with extensive code sections, consider providing concise summaries of relevant portions in your prompt rather than including entire code blocks.

  5. Optimize Conversation History: Gamecraft Agent automatically manages conversation history by truncating older messages to maintain context window efficiency. Stay aware of this behavior and re-include critical context when necessary.

  6. Utilize Prompt Caching: Take advantage of prompt caching capabilities offered by API providers. This feature caches your prompts for future tasks, reducing both cost and response latency.

Practical Example: Large File Refactoring

Consider a scenario where you need to refactor an extensive C# MonoBehavior script file (Assets/Scripts/MyScript.cs). Here's an effective approach:

  1. Initial Code Analysis:

    @/Assets/Scripts/MyScript.cs List the functions and behaviors in this file.
  2. Targeted Function Modification:

    @/Assets/Scripts/MyScript.cs Refactor the `processData` function to be asynchronous.
  3. Incremental Implementation: Execute small, focused changes while reviewing and validating each modification step.

By decomposing the task and providing precise context, you can efficiently work with large files while respecting Gamecraft Agent's context window limitations.

Last updated