Skip to content

Commit b5ba161

Browse files
committed
Adding a sequence diagram
1 parent f698259 commit b5ba161

3 files changed

Lines changed: 130 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Modern Java IDEs, such as **Cursor AI**, provide ways to customize how the `Agen
1111

1212
A system prompt is a set of instructions given to an AI model that defines how it should behave, what role it should take on, and what guidelines it should follow when responding to users. Think of it as the "operating manual" that shapes the AI's personality, capabilities, and boundaries.
1313

14+
[Further information](./docs/cursor-interaction-sequence.png)
15+
1416
## How to use the Cursor rules?
1517

1618
Using the Cursor rules is straightforward: simply `drag and drop` the cursor rule that you need into the chat textbox where you are typing your `User prompt`.
264 KB
Loading
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
@startuml
2+
!define RECTANGLE class
3+
4+
skinparam backgroundColor white
5+
skinparam handwritten false
6+
skinparam monochrome false
7+
skinparam shadowing false
8+
9+
title Cursor AI Assistant Interaction Flow (Enhanced)
10+
11+
actor "Software Engineer" as SE
12+
participant "Cursor IDE" as Cursor
13+
participant "System Prompt\nProcessor" as SystemPrompt
14+
participant "Context Manager" as Context
15+
participant "Memory System" as Memory
16+
participant "AI Model\n(Claude/GPT-4/etc.)" as AI
17+
participant "Tool Executor" as Tools
18+
participant "Web Search" as Web
19+
participant "Git Integration" as Git
20+
participant "Linter/Error\nChecker" as Linter
21+
22+
== Prompt Initiation ==
23+
SE -> Cursor: Enter prompt/query in chat
24+
activate Cursor
25+
26+
== Context & Memory Gathering ==
27+
Cursor -> Context: Gather current context
28+
activate Context
29+
Context -> Context: Collect open files\ncursor position\nproject structure
30+
Context -> Context: Analyze recent edits\nand file history
31+
Context --> Cursor: Return context data
32+
deactivate Context
33+
34+
Cursor -> Memory: Retrieve relevant memories
35+
activate Memory
36+
Memory -> Memory: Search for related\nconversation history
37+
Memory --> Cursor: Return memory context
38+
deactivate Memory
39+
40+
== System Prompt Processing ==
41+
Cursor -> SystemPrompt: Process user query with context
42+
activate SystemPrompt
43+
SystemPrompt -> SystemPrompt: Apply workspace rules\nand coding guidelines
44+
SystemPrompt -> SystemPrompt: Format system instructions\n(tool usage, constraints)
45+
SystemPrompt -> SystemPrompt: Combine user query +\nsystem prompt + context + memories
46+
SystemPrompt --> Cursor: Return formatted prompt
47+
deactivate SystemPrompt
48+
49+
== AI Model Selection & Interaction ==
50+
Cursor -> AI: Send complete prompt with:\n- System instructions\n- User query\n- Context data\n- Available tools\n- Memory context
51+
activate AI
52+
53+
AI -> AI: Select appropriate model\n(Claude Sonnet, GPT-4, etc.)
54+
AI -> AI: Process prompt and determine\nrequired actions
55+
56+
== Parallel Tool Execution ==
57+
alt Multiple Tools Required
58+
AI -> Tools: Execute file operations\n(read_file, edit_file, etc.)
59+
activate Tools
60+
Tools --> AI: Return file results
61+
deactivate Tools
62+
63+
AI -> Web: Search for real-time info
64+
activate Web
65+
Web --> AI: Return search results
66+
deactivate Web
67+
68+
AI -> Git: Fetch PR/commit info
69+
activate Git
70+
Git --> AI: Return Git data
71+
deactivate Git
72+
73+
AI -> AI: Process all tool results\nand synthesize response
74+
end
75+
76+
== Error Detection & Correction ==
77+
alt Code Changes Made
78+
AI -> Linter: Check for linting errors
79+
activate Linter
80+
Linter --> AI: Return error status
81+
deactivate Linter
82+
83+
alt Errors Found
84+
AI -> AI: Plan error corrections
85+
AI -> Tools: Apply fixes (up to 3 iterations)
86+
activate Tools
87+
Tools --> AI: Confirm fixes applied
88+
deactivate Tools
89+
end
90+
end
91+
92+
== Memory Management ==
93+
AI -> Memory: Update/create memories\nif new insights gained
94+
activate Memory
95+
Memory -> Memory: Store relevant information\nfor future conversations
96+
deactivate Memory
97+
98+
AI --> Cursor: Return AI response with:\n- Code suggestions\n- Explanations\n- Next steps\n- Memory updates
99+
deactivate AI
100+
101+
== Response Delivery ==
102+
Cursor -> Cursor: Format response for display
103+
Cursor -> SE: Display AI response in chat
104+
deactivate Cursor
105+
106+
== Code Application & Iteration ==
107+
alt Code Changes Suggested
108+
SE -> Cursor: Accept/Apply code changes
109+
activate Cursor
110+
Cursor -> Cursor: Apply edits to files
111+
Cursor -> SE: Confirm changes applied
112+
deactivate Cursor
113+
114+
alt Further Clarification Needed
115+
SE -> Cursor: Follow-up questions/refinements
116+
note right: Multi-turn conversation continues\nwith maintained context and memory
117+
activate Cursor
118+
Cursor -> Context: Update context with new changes
119+
Cursor -> AI: Process follow-up with updated context
120+
note over AI: Iterative refinement cycle\ncan repeat multiple times
121+
deactivate Cursor
122+
end
123+
end
124+
125+
== Background Processes ==
126+
note over Tools: Some operations can run\nin background (long-running tasks)
127+
128+
@enduml

0 commit comments

Comments
 (0)