I hope Cursor can add a manual context management feature.

Feature request for product/service

Chat

Describe the request

To develop large and complex projects, I used AI to create a simple tool for managing all the prompts in the project. By splitting the project into small, simple modules using a certain method, as long as each module adheres to the corresponding protocols and includes the appropriate references, the integrity and correctness of the integrated project can be ensured. If naming conflicts or reference overrides occur during integration, appropriate renaming can be done before adding them to the project.

However, my team members and I dislike the feeling of switching between pages repeatedly, as it affects the fluency of our operations. We also don’t want to spend effort learning to develop extensions for Cursor. Therefore, it would be very convenient for us if Cursor could incorporate this feature.

This feature is actually similar to the header file inclusion functionality in C/C++. However, we did not implement recursive inclusion (as we believe recursive inclusion is not very useful). For such a simple feature, we can easily develop it using AI.

Detailed usage description: We will tell the AI in the prompt which existing code files there are (these files are introduced via {{[[file path]]}}, and each introduced file contains only the necessary declarations). Later, we will use a tool to replace the content in this format with the content of the file pointed to by the intermediate path. This is somewhat similar to Cursor’s indexing. However, we only provide the necessary declarations instead of the entire file at once, as this can save a significant number of tokens.

Of course, if a declaration in a module is referenced by other modules, we must ensure that this module contains those declarations. Therefore, in the prompt corresponding to this module, we will specify which declarations to include (also introduced via {{[[file path]]}}).

This template inclusion feature allows us to modify only the template when we want to change a part of the content in the prompt. For example, if we feel that the previous role setting is not good, we can only modify the role-playing template. If a variable is renamed, deleted, or some declarations are added, we only need to modify the template.

We really like the new Agent parallel system in Cursor 2.0 because we usually write and optimize all prompts first, then use tools for template replacement, and then run 8 Agents at once, each with different prompts. This can greatly improve our generation efficiency.

The following is a prompt from our project, which can help you better understand our specific needs:

You are a senior Unity developer. The client is using Unity 2019 to develop a 3D action-adventure game for the Windows 64-bit platform. Now, please complete the task based on the following documents provided by the client.

  1. Task Description Document:
    “”"

Implement Boss Attack Control

Logic Overview

IF Boss is not dead AND Boss is awake AND Boss is not in attack state AND Boss is not in takeoff phase AND Boss is not in landing phase AND player is not dead:
    IF Boss is flying:
        IF Attack 3 is cooled down:
            Play Attack 3 animation and sound effects
            Generate a fireball at 0.728s, then generate a fireball every 0.3s, stop generating when Attack 3 ends, and stop generating when Boss dies
    ELIF Attack 2 is cooled down:
        Play Attack 2 animation and sound effects
        Generate a fireball at 0.536s, then generate a fireball every 0.3s, stop generating when Attack 2 ends, and stop generating when Boss dies
    ELIF Attack 1 is cooled down:
        IF Boss is within a certain distance from the player:
            Play Attack 1 animation and sound effects
            IF within the damage window of Attack 1:
                IF the hit detection collider of Attack 1 has just contacted the player'■■■■■ detection collider:
                    Call the player'■■■■■ method (the incoming damage value must be of int type)

Supplementary Instructions

  • You must ensure that the client can: adjust the cooldown time parameters of each attack, adjust the trigger distance parameter of Attack 1, specify the specific sound effects for each attack, specify the specific Prefab for the fireball prefab, and specify the specific fireball launch point object.
  • Attacks 2 and 3 use the same fireball prefab.
  • The fireball capacity is unlimited.
  • Attacks 2 and 3 use the same launch point.
  • Each time a fireball is about to be generated, the Z-axis of the launch point must point to the center of the protagonist’s local coordinates in both horizontal and vertical directions.
  • The position and direction of the generated fireball are the same as those of the launch point at the time of generation.
  • Note: For the fireball, you only need to implement the generation; do not implement the movement logic or interaction with the protagonist, as the client has already completed the fireball prefab.
  • The damage window of Attack 1 is: from 0.445s after each Attack 1 is triggered until the end. The player’■■■■■ method can only be called once within each damage window.

Code Writing Rules

  • The following files must exist in the code files you write, and these files must contain the declarations or definitions in the corresponding code below. Moreover, the scope, name, type, accessibility, and readability/writability of these declarations or definitions must be consistent with those in the corresponding code below.

BossAttack.cs (Boss attack control):

using UnityEngine;

namespace MyGame9
{
    public class BossAttack : MonoBehaviour
    {
        public bool IsAttacking { get; private set; } = false;
    }
}
  • Each new code file (non-existing code file) must declare the namespace MyGame9.
  • Follow good programming practices.
  • The code must handle the following situations (if they exist): possible abnormal situations, unreasonable input or output, memory that needs to be released, or data that needs to be destroyed.
  • In a single code file, except for parameters that may need to be adjusted, there must be no optional items, as this will increase the complexity for the client to use.
    “”"
  1. Information Description Document:
    “”"

Note

To complete the task, this information may not all be necessary; use it as needed.

Information Description

Component Information

Unless specifically emphasized, all components mentioned in this document are the first component of the corresponding type at the corresponding position, and all have been properly configured.

  • Boss’s Audio Source component

    • Mounting position: Boss root object
  • Protagonist’■■■■■ detection collider

    • Mounting position: Protagonist root object
    • Is trigger: Yes
  • Boss Attack 1’■■■■■ detection collider:

    • Acquisition method: Specified by the client through the editor
    • Is trigger: Yes
  • Boss animation component:

    • Mounting position: Boss root object
    • State machine parameters:
      • Trigger type: IsAttack01, IsAttack02, IsAttack03, IsTakeOff (takeoff), IsLand (landing), IsWakeUp (wake up)
      • Bool type: IsDead, IsRunning, IsFlyingForward

Boss Animation Clip Information

  • Animation duration:
    • Sleep: 1.333s
    • Roar: 3s
    • Fly forward: 1s
    • Attack 3: 3.267s
    • Landing: 3.7s
    • Death: 1.5s
    • Idle: 1.333s
    • Attack 1: 1s
    • Attack 2: 2.333s
    • Run: 0.8s
    • Takeoff: 2.867s

Tag Information

  • Player includes: Protagonist root object

Existing Code Information

  • The following shows the content of some existing code files. To keep the information clear and concise, some content that does not need to be presented may be omitted here. Pay attention to the scope of the declarations or definitions in the code to correctly reference them.

BossMovement.cs (Boss movement control, mounted to Boss root object):

using UnityEngine;

namespace MyGame10
{
    public class BossMovement : MonoBehaviour
    {
        public bool IsFlying { get; private set; } = false;  // Whether in flight phase
        public bool IsLanding { get; private set; } = false;  // Whether in landing phase

        public bool IsTakingOff { get; private set; } = false;  // Whether in takeoff phase
    }
}

BossHealth.cs (Boss health control, mounted to Boss root object):

using UnityEngine;

namespace MyGame5
{
    public class BossHealth : MonoBehaviour
    {
        public bool IsAwake { get; private set; } = false; // Whether the Boss is awake; it is considered awake only after the roar animation ends after waking up
        public bool IsDead { get; private set; } = false;
    }
}

PlayerHealth.cs (Protagonist health control, mounted to protagonist root object):

using UnityEngine;

namespace MyGame4
{
    public class PlayerHealth : MonoBehaviour
    {
        public bool IsDead {  get; private set; } = false;

        // Hit method
        public void TakeDamage(int damage)
        {

        }
    }
}

“”"

Cursor has always been our favorite AI programming IDE. Thank you to the Cursor team for listening to our suggestions!