geqintan commited on
Commit
2fa50f6
·
1 Parent(s): 97cdee7
.clinerules/1-memory-bank.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Describes Cline's Memory Bank system, its structure, and workflows for maintaining project knowledge across sessions.
3
+ author: https://github.com/nickbaumann98
4
+ version: 1.0
5
+ tags: ["memory-bank", "knowledge-base", "core-behavior", "documentation-protocol"]
6
+ globs: ["memory-bank/**/*.md", "*"]
7
+ ---
8
+ # Cline's Memory Bank
9
+
10
+ My memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively.
11
+
12
+ ## Memory Bank Structure
13
+
14
+ The Memory Bank consists of core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ PB[projectBrief.md] --> PC[productContext.md]
19
+ PB --> SP[systemPatterns.md]
20
+ PB --> TC[techContext.md]
21
+
22
+ PC --> AC[activeContext.md]
23
+ SP --> AC
24
+ TC --> AC
25
+
26
+ AC --> P[progress.md]
27
+ ```
28
+
29
+ ### Core Files (Required for Initial Load)
30
+ These files are crucial for initial project understanding and MUST be read at the start of EVERY task.
31
+ 1. `projectBrief.md`
32
+ - Foundation document that shapes all other files
33
+ - Created at project start if it doesn't exist
34
+ - Defines core requirements and goals
35
+ - Source of truth for project scope
36
+
37
+ 2. `productContext.md`
38
+ - Why this project exists
39
+ - Problems it solves
40
+ - How it should work
41
+ - User experience goals
42
+
43
+ 3. `activeContext.md`
44
+ - Current work focus
45
+ - Recent changes
46
+ - Next steps
47
+ - Active decisions and considerations
48
+ - Important patterns and preferences
49
+ - Learnings and project insights
50
+
51
+ 4. `progress.md`
52
+ - What works
53
+ - What's left to build
54
+ - Current status
55
+ - Known issues
56
+ - Evolution of project decisions
57
+
58
+ ### Supplemental Files (Load On Demand)
59
+ These files provide deeper context but can be loaded as needed to manage context window usage.
60
+ 1. `systemPatterns.md`
61
+ - System architecture
62
+ - Key technical decisions
63
+ - Design patterns in use
64
+ - Component relationships
65
+ - Critical implementation paths
66
+
67
+ 2. `techContext.md`
68
+ - Technologies used
69
+ - Development setup
70
+ - Technical constraints
71
+ - Dependencies
72
+ - Tool usage patterns
73
+
74
+ ### Additional Context
75
+ Create additional files/folders within memory-bank/ when they help organize:
76
+ - Complex feature documentation
77
+ - Integration specifications
78
+ - API documentation
79
+ - Testing strategies
80
+ - Deployment procedures
81
+
82
+ ## Core Workflows
83
+
84
+ ### Plan Mode
85
+ ```mermaid
86
+ flowchart TD
87
+ Start[Start] --> ReadCoreFiles[Read Core Memory Bank Files]
88
+ ReadCoreFiles --> CheckContext{Context Sufficient?}
89
+
90
+ CheckContext -->|No| ReadSupplemental[Read Supplemental Files as Needed]
91
+ ReadSupplemental --> Plan[Create Plan]
92
+ Plan --> Document[Document in Chat]
93
+
94
+ CheckContext -->|Yes| Verify[Verify Context]
95
+ Verify --> Strategy[Develop Strategy]
96
+ Strategy --> Present[Present Approach]
97
+ ```
98
+
99
+ ### Act Mode
100
+ ```mermaid
101
+ flowchart TD
102
+ Start[Start] --> Context[Check Memory Bank (Core & On-Demand)]
103
+ Context --> Update[Update Documentation]
104
+ Update --> Execute[Execute Task]
105
+ Execute --> Document[Document Changes]
106
+ ```
107
+
108
+ ## Documentation Updates
109
+
110
+ Memory Bank updates occur when:
111
+ 1. Discovering new project patterns
112
+ 2. After implementing significant changes
113
+ 3. When user requests with **update memory bank** (MUST review ALL files)
114
+ 4. When context needs clarification
115
+
116
+ ```mermaid
117
+ flowchart TD
118
+ Start[Update Process]
119
+
120
+ subgraph Process
121
+ P1[Review ALL Files]
122
+ P2[Document Current State]
123
+ P3[Clarify Next Steps]
124
+ P4[Document Insights & Patterns]
125
+
126
+ P1 --> P2 --> P3 --> P4
127
+ end
128
+
129
+ Start --> Process
130
+ ```
131
+
132
+ Note: When triggered by **update memory bank**, I MUST review every memory bank file, even if some don't require updates. Focus particularly on activeContext.md and progress.md as they track current state.
133
+
134
+ REMEMBER: After every memory reset, I begin completely fresh. The Memory Bank is my only link to previous work. It must be maintained with precision and clarity, as my effectiveness depends entirely on its accuracy.
.clinerules/2-new-task-automation.md ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Workflow for starting new task when context window reaches 50%
3
+ author: https://github.com/cline
4
+ version: 1.0
5
+ tags: ["context-management", "new-task"]
6
+ globs: ["*"]
7
+ ---
8
+ # You MUST use the `new_task` tool: Task Handoff Strategy Guide
9
+
10
+ **⚠️ CRITICAL INSTRUCTIONS - YOU MUST FOLLOW THESE GUIDELINES ⚠️**
11
+
12
+ This guide provides **MANDATORY** instructions for effectively breaking down complex tasks and implementing a smooth handoff process between tasks. You **MUST** follow these guidelines to ensure continuity, context preservation, and efficient task completion.
13
+
14
+ ## ⚠️ CONTEXT WINDOW MONITORING - MANDATORY ACTION REQUIRED ⚠️
15
+
16
+ You **MUST** monitor the context window usage displayed in the environment details. When usage exceeds 50% of the available context window, you **MUST** initiate a task handoff using the `new_task` tool.
17
+
18
+ Example of context window usage over 50% with a 200K context window:
19
+
20
+ \`\`\`text
21
+ # Context Window Usage
22
+ 105,000 / 200,000 tokens (53%)
23
+ Model: anthropic/claude-3.7-sonnet (200K context window)
24
+ \`\`\`
25
+
26
+ **IMPORTANT**: When you see context window usage at or above 50%, you MUST:
27
+ 1. Complete your current logical step
28
+ 2. Use the `ask_followup_question` tool to offer creating a new task
29
+ 3. If approved, use the `new_task` tool with comprehensive handoff instructions
30
+
31
+ ## Task Breakdown in Plan Mode - REQUIRED PROCESS
32
+
33
+ Plan Mode is specifically designed for analyzing complex tasks and breaking them into manageable subtasks. When in Plan Mode, you **MUST**:
34
+
35
+ ### 1. Initial Task Analysis - REQUIRED
36
+
37
+ - **MUST** begin by thoroughly understanding the full scope of the user's request
38
+ - **MUST** identify all major components and dependencies of the task
39
+ - **MUST** consider potential challenges, edge cases, and prerequisites
40
+
41
+ ### 2. Strategic Task Decomposition - REQUIRED
42
+
43
+ - **MUST** break the overall task into logical, discrete subtasks
44
+ - **MUST** prioritize subtasks based on dependencies (what must be completed first)
45
+ - **MUST** aim for subtasks that can be completed within a single session (15-30 minutes of work)
46
+ - **MUST** consider natural breaking points where context switching makes sense
47
+
48
+ ### 3. Creating a Task Roadmap - REQUIRED
49
+
50
+ - **MUST** present a clear, numbered list of subtasks to the user
51
+ - **MUST** explain dependencies between subtasks
52
+ - **MUST** provide time estimates for each subtask when possible
53
+ - **MUST** use Mermaid diagrams to visualize task flow and dependencies when helpful
54
+
55
+ \`\`\`mermaid
56
+ graph TD
57
+ A[Main Task] --> B[Subtask 1: Setup]
58
+ A --> C[Subtask 2: Core Implementation]
59
+ A --> D[Subtask 3: Testing]
60
+ A --> E[Subtask 4: Documentation]
61
+ B --> C
62
+ C --> D
63
+ \`\`\`
64
+
65
+ ### 4. Getting User Approval - REQUIRED
66
+
67
+ - **MUST** ask for user feedback on the proposed task breakdown
68
+ - **MUST** adjust the plan based on user priorities or additional requirements
69
+ - **MUST** confirm which subtask to begin with
70
+ - **MUST** request the user to toggle to Act Mode when ready to implement
71
+
72
+ ## Task Implementation and Handoff Process - MANDATORY PROCEDURES
73
+
74
+ When implementing tasks in Act Mode, you **MUST** follow these guidelines for effective task handoff:
75
+
76
+ ### 1. Focused Implementation - REQUIRED
77
+
78
+ - **MUST** focus on completing the current subtask fully
79
+ - **MUST** document progress clearly through comments and commit messages
80
+ - **MUST** create checkpoints at logical completion points
81
+
82
+ ### 2. Recognizing Completion Points - CRITICAL
83
+
84
+ You **MUST** identify natural handoff points when:
85
+ - The current subtask is fully completed
86
+ - You've reached a logical stopping point in a larger subtask
87
+ - The implementation is taking longer than expected and can be continued later
88
+ - The task scope has expanded beyond the original plan
89
+ - **CRITICAL**: The context window usage exceeds 50% (e.g., 100,000+ tokens for a 200K context window)
90
+
91
+ ### 3. Initiating the Handoff Process - MANDATORY ACTION
92
+
93
+ When you've reached a completion point, you **MUST**:
94
+
95
+ 1. Summarize what has been accomplished so far
96
+ 2. Clearly state what remains to be done
97
+ 3. **MANDATORY**: Use the `ask_followup_question` tool to offer creating a new task:
98
+
99
+ \`\`\`xml
100
+ <ask_followup_question>
101
+ <question>I've completed [specific accomplishment]. Would you like me to create a new task to continue with [remaining work]?</question>
102
+ <options>["Yes, create a new task", "No, continue in this session", "Let me think about it"]</options>
103
+ </ask_followup_question>
104
+ \`\`\`
105
+
106
+ ### 4. Creating a New Task with Context - REQUIRED ACTION
107
+
108
+ If the user agrees to create a new task, you **MUST** use the `new_task` tool with comprehensive handoff instructions:
109
+
110
+ \`\`\`xml
111
+ <new_task>
112
+ <context>
113
+ # Task Continuation: [Brief Task Title]
114
+
115
+ ## Completed Work
116
+ - [Detailed list of completed items]
117
+ - [Include specific files modified/created]
118
+ - [Note any important decisions made]
119
+
120
+ ## Current State
121
+ - [Description of the current state of the project]
122
+ - [Any running processes or environment setup]
123
+ - [Key files and their current state]
124
+
125
+ ## Next Steps
126
+ - [Detailed list of remaining tasks]
127
+ - [Specific implementation details to address]
128
+ - [Any known challenges to be aware of]
129
+
130
+ ## Reference Information
131
+ - [Links to relevant documentation]
132
+ - [Important code snippets or patterns to follow]
133
+ - [Any user preferences noted during the current session]
134
+
135
+ Please continue the implementation by [specific next action].
136
+ </context>
137
+ </new_task>
138
+ \`\`\`
139
+
140
+ ### 5. Detailed Context Transfer - MANDATORY COMPONENTS
141
+
142
+ When creating a new task, you **MUST** always include:
143
+
144
+ #### Project Context - REQUIRED
145
+ - **MUST** include the overall goal and purpose of the project
146
+ - **MUST** include key architectural decisions and patterns
147
+ - **MUST** include technology stack and dependencies
148
+
149
+ #### Implementation Details - REQUIRED
150
+ - **MUST** list files created or modified in the current session
151
+ - **MUST** describe specific functions, classes, or components implemented
152
+ - **MUST** explain design patterns being followed
153
+ - **MUST** outline testing approach
154
+
155
+ #### Progress Tracking - REQUIRED
156
+ - **MUST** provide checklist of completed items
157
+ - **MUST** provide checklist of remaining items
158
+ - **MUST** note any blockers or challenges encountered
159
+
160
+ #### User Preferences - REQUIRED
161
+ - **MUST** note coding style preferences mentioned by the user
162
+ - **MUST** document specific approaches requested by the user
163
+ - **MUST** highlight priority areas identified by the user
164
+
165
+ ## Best Practices for Effective Handoffs - MANDATORY GUIDELINES
166
+
167
+ ### 1. Maintain Continuity - REQUIRED
168
+
169
+ - **MUST** use consistent terminology between tasks
170
+ - **MUST** reference previous decisions and their rationale
171
+ - **MUST** maintain the same architectural approach unless explicitly changing direction
172
+
173
+ ### 2. Preserve Context - REQUIRED
174
+
175
+ - **MUST** include relevant code snippets in the handoff
176
+ - **MUST** summarize key discussions from the previous session
177
+ - **MUST** reference specific files and line numbers when applicable
178
+
179
+ ### 3. Set Clear Next Actions - REQUIRED
180
+
181
+ - **MUST** begin the handoff with a clear, actionable next step
182
+ - **MUST** prioritize remaining tasks
183
+ - **MUST** highlight any decisions that need to be made
184
+
185
+ ### 4. Document Assumptions - REQUIRED
186
+
187
+ - **MUST** clearly state any assumptions made during implementation
188
+ - **MUST** note areas where user input might be needed
189
+ - **MUST** identify potential alternative approaches
190
+
191
+ ### 5. Optimize for Resumability - REQUIRED
192
+
193
+ - **MUST** structure the handoff so the next session can begin working immediately
194
+ - **MUST** include setup instructions if environment configuration is needed
195
+ - **MUST** provide a quick summary at the top for rapid context restoration
196
+
197
+ ## Example Task Handoff
198
+
199
+ ### Example #1 of an effective task handoff:
200
+
201
+ \`\`\`xml
202
+ <new_task>
203
+ <context>
204
+ # Task Continuation: Implement User Authentication System
205
+
206
+ ## Completed Work
207
+ - Created basic Express.js server structure
208
+ - Implemented MongoDB connection and user schema
209
+ - Completed user registration endpoint with password hashing
210
+ - Added input validation using Joi
211
+ - Created initial test suite for registration endpoint
212
+
213
+ ## Current State
214
+ - Server runs successfully on port 3000
215
+ - MongoDB connection is established
216
+ - Registration endpoint (/api/users/register) is fully functional
217
+ - Test suite passes for all registration scenarios
218
+
219
+ ## Next Steps
220
+ 1. Implement login endpoint (/api/users/login)
221
+ - Use bcrypt to compare passwords
222
+ - Generate JWT token upon successful login
223
+ - Add proper error handling for invalid credentials
224
+ 2. Create authentication middleware
225
+ - Verify JWT tokens
226
+ - Extract user information
227
+ - Handle expired tokens
228
+ 3. Add protected routes that require authentication
229
+ 4. Implement password reset functionality
230
+
231
+ ## Reference Information
232
+ - JWT secret should be stored in .env file
233
+ - Follow the existing error handling pattern in routes/users.js
234
+ - User schema is defined in models/User.js
235
+ - Test patterns are established in tests/auth.test.js
236
+
237
+ Please continue by implementing the login endpoint following the same patterns established in the registration endpoint.
238
+ </context>
239
+ </new_task>
240
+ \`\`\`
241
+
242
+ ### Example #2 of an ineffective task handoff:
243
+
244
+ *(Note: The example provided in the original rules showing "YOLO MODE Implementation" seems less like a direct handoff context block and more like a general status update with future considerations. A true ineffective handoff might lack detail in 'Current State' or 'Next Steps').*
245
+
246
+ ## When to Use Task Handoffs - MANDATORY TRIGGERS
247
+
248
+ You **MUST** initiate task handoffs in these scenarios:
249
+
250
+ 1. **CRITICAL**: When context window usage exceeds 50% (e.g., 100,000+ tokens for a 200K context window)
251
+ 2. **Long-running projects** that exceed a single session
252
+ 3. **Complex implementations** with multiple distinct phases
253
+ 4. **When context window limitations** are approaching
254
+ 5. **When switching focus areas** within a larger project
255
+ 6. **When different expertise** might be beneficial for different parts of the task
256
+
257
+ **⚠️ FINAL REMINDER - CRITICAL INSTRUCTION ⚠️**
258
+
259
+ You **MUST** monitor the context window usage in the environment details section. When it exceeds 50% (e.g., "105,000 / 200,000 tokens (53%)"), you **MUST** proactively initiate the task handoff process using the `ask_followup_question` tool followed by the `new_task` tool. You MUST use the `new_task` tool.
260
+
261
+ By strictly following these guidelines, you'll ensure smooth transitions between tasks, maintain project momentum, and provide the best possible experience for users working on complex, multi-session projects.
262
+ ```markdown
263
+
264
+ ## User Interaction & Workflow Considerations
265
+
266
+ * **Linear Flow:** Currently, using `new_task` creates a linear sequence. The old task ends, and the new one begins. The old task history remains accessible for backtracking.
267
+ * **User Approval:** You always have control, approving the handoff and having the chance to modify the context Cline proposes to carry forward.
268
+ * **Flexibility:** The core `new_task` tool is a flexible building block. Experiment with `.clinerules` to create workflows that best suit your needs, whether for strict context management, task decomposition, or other creative uses.
.clinerules/3-cline-for-research.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Guides the user through a research process using available MCP tools, offering choices for refinement, method, and output.
3
+ author: https://github.com/nickbaumann98
4
+ version: 1.0
5
+ tags: ["research", "mcp", "workflow", "assistant-behavior"]
6
+ globs: ["*"]
7
+ ---
8
+ # Cline for Research Assistant
9
+
10
+ **Objective:** Guide the user through a research process using available MCP tools, offering choices for refinement, method, and output.
11
+
12
+ **Workflow:**
13
+
14
+ 1. **Initiation:** This rule activates automatically when it is toggled "on" and the user asks a question that appears to be a research request. It then takes the user's initial question as the starting `research_topic`.
15
+ 2. **Topic Confirmation/Refinement:**
16
+ * Confirm the inferred topic: "Okay, I can research `research_topic`. Would you like to refine this query first?"
17
+ * Provide selectable options: ["Yes, help refine", "No, proceed with this topic"]
18
+ * If "Yes": Engage in a brief dialogue to refine `research_topic`.
19
+ * If "No": Proceed.
20
+ 3. **Research Method Selection:**
21
+ * Ask the user: "Which research method should I use?"
22
+ * Provide options:
23
+ * "Quick Web Search (Serper MCP)"
24
+ * "AI-Powered Search (Perplexity MCP)"
25
+ * "Deep Research (Firecrawl MCP)"
26
+ * Store the choice as `research_method`.
27
+ 4. **Output Format Selection:**
28
+ * Ask the user: "How should I deliver the results?"
29
+ * Provide options:
30
+ * "Summarize in chat"
31
+ * "Create a Markdown file"
32
+ * "Create a raw data file (JSON)"
33
+ * Store the choice as `output_format`.
34
+ * If a file format is chosen, ask: "What filename should I use? (e.g., `topic_results.md` or `topic_data.json`)" Store as `output_filename`. Default to `research_results.md` or `research_data.json` if no name is provided.
35
+ 5. **Execution:**
36
+ * Based on `research_method`:
37
+ * If "Quick Web Search":
38
+ * Use `use_mcp_tool` with a placeholder for the Serper MCP `search` tool, passing `research_topic`.
39
+ * Inform the user: "Executing Quick Web Search via Serper MCP..."
40
+ * If "AI-Powered Search":
41
+ * Use `use_mcp_tool` for `github.com/pashpashpash/perplexity-mcp` -> `search` tool, passing `research_topic`.
42
+ * Inform the user: "Executing AI-Powered Search via Perplexity MCP..."
43
+ * If "Deep Research":
44
+ * Use `use_mcp_tool` for `github.com/mendableai/firecrawl-mcp-server` -> `firecrawl_deep_research` tool, passing `research_topic`.
45
+ * Inform the user: "Executing Deep Research via Firecrawl MCP... (This may take a few minutes)"
46
+ * Store the raw result as `raw_research_data`.
47
+ 6. **Output Delivery:**
48
+ * Based on `output_format`:
49
+ * If "Summarize in chat":
50
+ * Analyze `raw_research_data` and provide a concise summary in the chat.
51
+ * If "Create a Markdown file":
52
+ * Determine filename (use `output_filename` or default).
53
+ * Format `raw_research_data` into Markdown and use `write_to_file` to save it.
54
+ * Inform the user: "Research results saved to `<filename>`."
55
+ * If "Create a raw data file":
56
+ * Determine filename (use `output_filename` or default).
57
+ * Use `write_to_file` to save `raw_research_data` (likely JSON).
58
+ * Inform the user: "Raw research data saved to `<filename>`."
59
+ 7. **Completion:** End the rule execution.
60
+
61
+ ---
62
+ **Notes:**
63
+
64
+ * This rule relies on the user having the Perplexity Firecrawl, and Serper MCP servers connected and running.
65
+ * The "Quick Web Search" option is currently hypothetical and would require a Serper MCP server to be implemented and connected.
66
+ * Error handling (e.g., if an MCP tool fails) is omitted for brevity but should be considered for a production rule.
.clinerules/4.sequential-thinking.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: A guide for effectively using the sequentialthinking MCP tool for dynamic and reflective problem-solving.
3
+ author: https://github.com/rafaelkallis
4
+ version: 1.0
5
+ tags: ["mcp", "sequentialthinking", "problem-solving", "workflow-guide", "ai-guidance"]
6
+ globs: ["*"] # Relevant for any task requiring complex thought processes
7
+ ---
8
+
9
+ # Guide to Using the `sequentialthinking` MCP Tool
10
+
11
+ ## 1. Objective
12
+
13
+ This rule guides Cline (the AI) in effectively utilizing the `sequentialthinking` MCP tool. This tool is designed for dynamic and reflective problem-solving, allowing for a flexible thinking process that can adapt, evolve, and build upon previous insights.
14
+
15
+ ## 2. When to Use the `sequentialthinking` Tool
16
+
17
+ Cline SHOULD consider using the `sequentialthinking` tool when faced with tasks that involve:
18
+
19
+ * **Complex Problem Decomposition:** Breaking down large, multifaceted problems into smaller, manageable steps.
20
+ * **Planning and Design (Iterative):** Architecting solutions where the plan might need revision as understanding deepens.
21
+ * **In-depth Analysis:** Situations requiring careful analysis where initial assumptions might be challenged or course correction is needed.
22
+ * **Unclear Scope:** Problems where the full scope isn't immediately obvious and requires exploratory thinking.
23
+ * **Multi-Step Solutions:** Tasks that inherently require a sequence of interconnected thoughts or actions to resolve.
24
+ * **Context Maintenance:** Scenarios where maintaining a coherent line of thought across multiple steps is crucial.
25
+ * **Information Filtering:** When it's necessary to sift through information and identify what's relevant at each stage of thinking.
26
+ * **Hypothesis Generation and Verification:** Forming and testing hypotheses as part of the problem-solving process.
27
+
28
+ ## 3. Core Principles for Using `sequentialthinking`
29
+
30
+ When invoking the `sequentialthinking` tool, Cline MUST adhere to the following principles:
31
+
32
+ * **Iterative Thought Process:** Each use of the tool represents a single "thought." Build upon, question, or revise previous thoughts in subsequent calls.
33
+ * **Dynamic Thought Count:**
34
+ * Start with an initial estimate for `totalThoughts`.
35
+ * Be prepared to adjust `totalThoughts` (up or down) as the thinking process evolves.
36
+ * If more thoughts are needed than initially estimated, increment `thoughtNumber` beyond the original `totalThoughts` and update `totalThoughts` accordingly.
37
+ * **Honest Reflection:**
38
+ * Express uncertainty if it exists.
39
+ * Explicitly mark thoughts that revise previous thinking using `isRevision: true` and `revisesThought: <thought_number>`.
40
+ * If exploring an alternative path, consider using `branchFromThought` and `branchId` to track divergent lines of reasoning.
41
+ * **Hypothesis-Driven Approach:**
42
+ * Generate a solution `hypothesis` when a potential solution emerges from the thought process.
43
+ * Verify the `hypothesis` based on the preceding Chain of Thought steps.
44
+ * Repeat the thinking process (more thoughts) if the hypothesis is not satisfactory.
45
+ * **Relevance Filtering:** Actively ignore or filter out information that is irrelevant to the current `thought` or step in the problem-solving process.
46
+ * **Clarity in Each Thought:** Each `thought` string should be clear, concise, and focused on a specific aspect of the problem or a step in the reasoning.
47
+ * **Completion Condition:** Only set `nextThoughtNeeded: false` when truly finished and a satisfactory answer or solution has been reached and verified.
48
+
49
+ ## 4. Parameters of the `sequentialthinking` Tool
50
+
51
+ Cline MUST correctly use the following parameters when calling the `use_mcp_tool` for `sequentialthinking`:
52
+
53
+ * **`thought` (string, required):** The current thinking step. This can be an analytical step, a question, a revision, a hypothesis, etc.
54
+ * **`nextThoughtNeeded` (boolean, required):**
55
+ * `true`: If more thinking steps are required.
56
+ * `false`: If the thinking process is complete and a satisfactory solution/answer is reached.
57
+ * **`thoughtNumber` (integer, required, min: 1):** The current sequential number of the thought.
58
+ * **`totalThoughts` (integer, required, min: 1):** The current *estimated* total number of thoughts needed. This can be adjusted.
59
+ * **`isRevision` (boolean, optional):** Set to `true` if this thought revises or reconsiders a previous thought.
60
+ * **`revisesThought` (integer, optional, min: 1):** If `isRevision` is true, this specifies the `thoughtNumber` of the thought being revised.
61
+ * **`branchFromThought` (integer, optional, min: 1):** If this thought represents a branching point from a previous line of thought, specify the `thoughtNumber` it branches from.
62
+ * **`branchId` (string, optional):** An identifier for the current branch of thought, if applicable.
63
+ * **`needsMoreThoughts` (boolean, optional):** Use this if `thoughtNumber` has reached `totalThoughts`, but Cline realizes more thinking is necessary. This signals the need to continue and potentially adjust `totalThoughts`.
64
+
65
+ ## 5. Workflow Example (Conceptual)
66
+
67
+ This illustrates how Cline might use the tool iteratively.
68
+
69
+ **User Task:** "Plan the architecture for a new e-commerce feature: 'Personalized Recommendations'."
70
+
71
+ **Cline's Internal Process using `sequentialthinking`:**
72
+
73
+ 1. **Thought 1:**
74
+ * `thought`: "Initial approach: Identify key components for personalized recommendations. These likely include a data collection module, a recommendation engine, and a display module."
75
+ * `nextThoughtNeeded`: true
76
+ * `thoughtNumber`: 1
77
+ * `totalThoughts`: 5 (initial estimate)
78
+ 2. **Thought 2 (User provides feedback or Cline realizes something):**
79
+ * `thought`: "Refining components: Data collection needs to capture user behavior (views, purchases, ratings). The engine might use collaborative filtering. Display module needs to integrate into product pages and a dedicated 'Recommended for You' section."
80
+ * `nextThoughtNeeded`: true
81
+ * `thoughtNumber`: 2
82
+ * `totalThoughts`: 5
83
+ 3. **Thought 3 (Considering alternatives/constraints):**
84
+ * `thought`: "Constraint: Real-time vs. batch processing for recommendations. Real-time offers better UX but is more complex. Batch might be a good MVP. Let's assume batch for MVP to simplify."
85
+ * `nextThoughtNeeded`: true
86
+ * `thoughtNumber`: 3
87
+ * `totalThoughts`: 5
88
+ 4. **Thought 4 (Hypothesis):**
89
+ * `thought`: "Hypothesis: A batch-processed collaborative filtering engine, with data collected from user interaction logs, displayed on product pages and a dedicated section, is a viable MVP architecture."
90
+ * `nextThoughtNeeded`: true
91
+ * `thoughtNumber`: 4
92
+ * `totalThoughts`: 5
93
+ 5. **Thought 5 (Verification & Realization):**
94
+ * `thought`: "Verification: The hypothesis covers core aspects. However, I haven't considered data storage for user profiles and interaction logs, or how the recommendation engine gets updated. More thoughts needed."
95
+ * `nextThoughtNeeded`: true
96
+ * `thoughtNumber`: 5
97
+ * `totalThoughts`: 7 (revised estimate)
98
+ * `needsMoreThoughts`: true
99
+ 6. **Thought 6 (Addressing omissions):**
100
+ * `thought`: "Addressing data storage: A NoSQL database (e.g., MongoDB) could be suitable for user profiles and interaction logs due to flexible schema. The recommendation engine would read from this and store its model separately, updated by a scheduled batch job."
101
+ * `nextThoughtNeeded`: true
102
+ * `thoughtNumber`: 6
103
+ * `totalThoughts`: 7
104
+ 7. **Thought 7 (Finalizing plan for MVP):**
105
+ * `thought`: "Final MVP Plan: 1. User interaction logger (to NoSQL DB). 2. Batch collaborative filtering engine (reads from NoSQL, updates model). 3. API to serve recommendations. 4. UI integration on product pages & dedicated section. This seems complete for an MVP."
106
+ * `nextThoughtNeeded`: false
107
+ * `thoughtNumber`: 7
108
+ * `totalThoughts`: 7
109
+
110
+ ## 6. Critical Reminders for Cline
111
+
112
+ * **DO NOT** use this tool for simple, single-step tasks. It is for complex reasoning.
113
+ * **ALWAYS** ensure `thoughtNumber` increments correctly.
114
+ * **BE PREPARED** to adjust `totalThoughts` as understanding evolves.
115
+ * **FOCUS** on making progress towards a solution with each thought.
116
+ * If a line of thinking becomes a dead end, **EXPLICITLY** state this in a `thought` and consider revising a previous thought or starting a new branch.
117
+
118
+ This guide should help Cline leverage the `sequentialthinking` MCP tool to its full potential.
119
+
.clinerules/5-self-improving-cline.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Defines a process for Cline to reflect on interactions and suggest improvements to active .clinerules.
3
+ author: https://github.com/nickbaumann98
4
+ version: 1.0
5
+ tags: ["meta", "self-improvement", "clinerules", "reflection", "core-behavior"]
6
+ globs: ["*"]
7
+ ---
8
+ # Self-Improving Cline Reflection
9
+
10
+ **Objective:** Offer opportunities to continuously improve `.clinerules` based on user interactions and feedback.
11
+
12
+ **Trigger:** Before using the `attempt_completion` tool for any task that involved user feedback provided at any point during the conversation, or involved multiple non-trivial steps (e.g., multiple file edits, complex logic generation).
13
+
14
+ **Process:**
15
+
16
+ 1. **Offer Reflection:** Ask the user: "Before I complete the task, would you like me to reflect on our interaction and suggest potential improvements to the active `.clinerules`?"
17
+ 2. **Await User Confirmation:** Proceed to `attempt_completion` immediately if the user declines or doesn't respond affirmatively.
18
+ 3. **If User Confirms:**
19
+ a. **Review Interaction:** Synthesize all feedback provided by the user throughout the entire conversation history for the task. Analyze how this feedback relates to the active `.clinerules` and identify areas where modified instructions could have improved the outcome or better aligned with user preferences.
20
+ b. **Identify Active Rules:** List the specific global and workspace `.clinerules` files active during the task.
21
+ c. **Formulate & Propose Improvements:** Generate specific, actionable suggestions for improving the *content* of the relevant active rule files. Prioritize suggestions directly addressing user feedback. Use `replace_in_file` diff blocks when practical, otherwise describe changes clearly.
22
+ d. **Await User Action on Suggestions:** Ask the user if they agree with the proposed improvements and if they'd like me to apply them *now* using the appropriate tool (`replace_in_file` or `write_to_file`). Apply changes if approved, then proceed to `attempt_completion`.
23
+
24
+ **Constraint:** Do not offer reflection if:
25
+ * No `.clinerules` were active.
26
+ * The task was very simple and involved no feedback.
.clinerules/6-cline-continuous-improvement-protocol.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Defines Cline's mandatory protocol for self-reflection, persistent knowledge capture using dedicated logs, and continuous improvement of its operational knowledge before task completion.
3
+ author: https://github.com/jeanibarz
4
+ version: 1.0
5
+ tags: ["protocol", "meta", "learning", "reflection", "knowledge-management", "core-behavior"]
6
+ globs: ["*"] # This core protocol is always active and applies to all Cline operations.
7
+ ---
8
+ # Cline Continuous Improvement Protocol
9
+
10
+ **Objective:** Ensure Cline proactively learns from tasks, captures knowledge in a structured way, **distills fundamental insights,** refines understanding, and improves efficiency and reliability. This protocol maintains two key files: `memory-bank/raw_reflection_log.md` for initial detailed logging, and `memory-bank/consolidated_learnings.md` for pruned, actionable, long-term knowledge. This is vital for optimal performance and avoiding redundant effort.
11
+
12
+ **Core Principle:** Continuous learning and adaptation are **mandatory**. This protocol **must be executed before `attempt_completion`** for tasks with new learning, problem-solving, user feedback, or multiple steps. Trivial mechanical tasks *may* be exempt per higher-level rules; otherwise, execution is default.
13
+
14
+ **Key Knowledge Files:**
15
+ * **`memory-bank/raw_reflection_log.md`**: Contains detailed, timestamped, and task-referenced raw entries from the "Task Review & Analysis" phase. This is the initial dump of all observations.
16
+ * **`memory-bank/consolidated_learnings.md`**: Contains curated, summarized, and actionable insights derived from `raw_reflection_log.md`. This is the primary, refined knowledge base for long-term use. It should be kept concise and highly relevant.
17
+
18
+ ---
19
+
20
+ ## 1. Mandatory Pre-Completion Reflection & Raw Knowledge Capture
21
+
22
+ Before signaling task completion (e.g., via `attempt_completion`), Cline **must** perform the following internal steps:
23
+
24
+ ### 1.1. Task Review & Analysis:
25
+ * Review the completed task (conversation, logs, artifacts).
26
+ * **Identify Learnings:** What new information, techniques, **underlying patterns,** API behaviors, project-specific commands (e.g., test, build, run flags), environment variables, setup quirks, or successful outcomes were discovered? **What core principles can be extracted?**
27
+ * **Identify Difficulties & Mistakes (as Learning Opportunities):** What challenges were faced? Were there any errors, misunderstandings, or inefficiencies? **How can these experiences refine future approaches (resilience & adaptation)?** Did user feedback indicate a misstep?
28
+ * **Identify Successes:** What went particularly well? What strategies or tools were notably effective? **What were the key contributing factors?**
29
+
30
+ ### 1.2. Logging to `memory-bank/raw_reflection_log.md`:
31
+ * Based on Task Review & Analysis (1.1), create a timestamped, task-referenced entry in `memory-bank/raw_reflection_log.md` detailing all learnings, difficulties (and their resolutions/learnings), and successes (and contributing factors).
32
+ * This file serves as the initial, detailed record. Its entries are candidates for later consolidation.
33
+ * *Example Entry in `memory-bank/raw_reflection_log.md`:*
34
+ ```markdown
35
+ ---
36
+ Date: {{CURRENT_DATE_YYYY_MM_DD}}
37
+ TaskRef: "Implement JWT refresh logic for Project Alpha"
38
+
39
+ Learnings:
40
+ - Discovered `jose` library's `createRemoteJWKSet` is highly effective for dynamic key fetching for Project Alpha's auth.
41
+ - Confirmed that a 401 error with `X-Reason: token-signature-invalid` from the auth provider requires re-fetching JWKS.
42
+ - Project Alpha's integration tests: `cd services/auth && poetry run pytest -m integration --maxfail=1`
43
+ - Required ENV for local testing of Project Alpha auth: `AUTH_API_KEY="test_key_alpha"`
44
+
45
+ Difficulties:
46
+ - Initial confusion about JWKS caching led to intermittent validation failures. Resolved by implementing a 5-minute cache.
47
+
48
+ Successes:
49
+ - The 5-minute JWKS cache with explicit bust mechanism proved effective.
50
+
51
+ Improvements_Identified_For_Consolidation:
52
+ - General pattern: JWKS caching strategy (5-min cache, explicit bust).
53
+ - Project Alpha: Specific commands and ENV vars.
54
+ ---
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 2. Knowledge Consolidation & Refinement Process (Periodic)
60
+
61
+ This outlines refining knowledge from `memory-bank/raw_reflection_log.md` into `memory-bank/consolidated_learnings.md`. This occurs periodically or when `raw_reflection_log.md` grows significantly, not necessarily after each task.
62
+
63
+ ### 2.1. Review and Identify for Consolidation:
64
+ * Periodically, or when prompted by the user or significant new raw entries, review `memory-bank/raw_reflection_log.md`.
65
+ * Identify entries/parts representing durable, actionable, or broadly applicable knowledge (e.g., reusable patterns, critical configurations, effective strategies, resolved errors).
66
+
67
+ ### 2.2. Synthesize and Transfer to `memory-bank/consolidated_learnings.md`:
68
+ * For identified insights:
69
+ * Concisely synthesize, summarize, and **distill into generalizable principles or actionable patterns.**
70
+ * Add refined knowledge to `memory-bank/consolidated_learnings.md`, organizing logically (by topic, project, tech) for easy retrieval.
71
+ * Ensure `consolidated_learnings.md` content is actionable, **generalizable,** and non-redundant.
72
+ * *Example Entry in `memory-bank/consolidated_learnings.md` (derived from above raw log example):*
73
+ ```markdown
74
+ ## JWT Handling & JWKS
75
+ **Pattern: JWKS Caching Strategy**
76
+ - For systems using JWKS for token validation, implement a short-lived cache (e.g., 5 minutes) for fetched JWKS.
77
+ - Include an explicit cache-bust mechanism if immediate key rotation needs to be handled.
78
+ - *Rationale:* Balances performance by reducing frequent JWKS re-fetching against timely key updates. Mitigates intermittent validation failures due to stale keys.
79
+
80
+ ## Project Alpha - Specifics
81
+ **Auth Module:**
82
+ - **Integration Tests:** `cd services/auth && poetry run pytest -m integration --maxfail=1`
83
+ - **Local Testing ENV:** `AUTH_API_KEY="test_key_alpha"`
84
+ ```
85
+
86
+ ### 2.3. Prune `memory-bank/raw_reflection_log.md`:
87
+ * **Crucially, once information has been successfully transferred and consolidated into `memory-bank/consolidated_learnings.md`, the corresponding original entries or processed parts **must be removed** from `memory-bank/raw_reflection_log.md`.**
88
+ * This keeps `raw_reflection_log.md` focused on recent, unprocessed reflections and prevents it from growing indefinitely with redundant information.
89
+
90
+ ### 2.4. Proposing `.clinerule` Enhancements (Exceptional):
91
+ * The primary focus of this protocol is the maintenance of `raw_reflection_log.md` and `consolidated_learnings.md`.
92
+ * If a significant, broadly applicable insight in `consolidated_learnings.md` strongly suggests modifying *another active `.clinerule`* (e.g., core workflow, tech guidance), Cline MAY propose this change after user confirmation. This is exceptional.
93
+
94
+ ---
95
+
96
+ ## 3. Guidelines for Knowledge Content
97
+
98
+ These guidelines apply to entries in `memory-bank/raw_reflection_log.md` (initial capture) and especially to `memory-bank/consolidated_learnings.md` (refined, long-term knowledge).
99
+
100
+ * **Prioritize High-Value Insights:** Focus on lessons that significantly impact future performance, **lead to more robust or generalizable understanding,** or detail critical errors and their resolutions, major time-saving discoveries, fundamental shifts in understanding, and essential project-specific configurations.
101
+ * **Be Concise & Actionable (especially for `consolidated_learnings.md`):** Information should be clear, to the point, and useful when revisited. What can be *done* differently or leveraged next time?
102
+ * **Strive for Clarity and Future Usability:** Document insights in a way that is clear and easily understandable for future review, facilitating effective knowledge retrieval and application (akin to self-explainability).
103
+ * **Document Persistently, Refine & Prune Continuously:** Capture raw insights immediately. Systematically refine, consolidate, and prune this knowledge as per Section 2.
104
+ * **Organize for Retrieval:** Structure `consolidated_learnings.md` logically. Use clear headings and Markdown formatting.
105
+ * **Avoid Low-Utility Information in `consolidated_learnings.md`:** This file should not contain trivial statements. Raw, verbose thoughts belong in `raw_reflection_log.md` before pruning.
106
+ * **Support Continuous Improvement:** The ultimate goal is to avoid repeating mistakes, accelerate future tasks, and make Cline's operations more robust and reliable. Frame all knowledge with this in mind.
107
+ * **Manage Information Density:** Actively work to keep `consolidated_learnings.md` dense with high-value information and free of outdated or overly verbose content. The pruning of `raw_reflection_log.md` is key to this.
.clinerules/基础指令.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .clinerules 文件夹下,除了”基础指令.md“文件外,其他文件都不能被修改,但如果他们有局限性,可以告知用户,记录到根目录下:node.md 里
2
+
3
+ # 交流语言
4
+ 如非特殊指定,默认使用中文进行所有交流,包括生成或改写规则文件也使用中文。
5
+
6
+ # 自主决策与用户交互
7
+ 在工作进行时,应最大限度地减少用户操作和选择的次数。
8
+ 1. **优先使用工具:** 优先使用可用的工具进行探索、获取信息和解决问题,而不是直接向用户提问。
9
+ 2. **自主决策:** 在有明确默认选项、可以合理推断用户意图或操作风险较低时,自主做出决策。
10
+ 3. **减少提问:** 仅在遇到歧义、需要澄清、无法通过工具获取必要信息或操作具有潜在影响时,才使用 `ask_followup_question` 工具。
11
+ 4. **避免不必要的确认:** 除非操作具有潜在影响(例如,删除文件、修改关键配置)或用户明确要求确认,否则避免不必要的确认步骤。
12
+
13
+ # 参考链接
14
+
15
+ # Python 环境管理
16
+ 使用 `conda` 作为环境管理工具。
17
+ 1. **项目默认环境**: 使用名为 "airs" 的环境作为项目默认环境。
18
+ 2. **激活环境**: 如果发现当前不在 `airs` 环境下,请使用 `conda activate airs` 激活 `airs` 环境。
19
+ 3. **创建环境**: 如果 `airs` 环境不存在,则使用 `conda create -n airs python=3.12` 创建环境。创建环境后,再使用 `conda activate airs` 激活 `airs` 环境。
20
+
21
+ # 目录管理
22
+ 1. codes为存放代码的目录,请勿修改
23
+ 2. docs为存放文档的目录,请勿修改
24
+ 3. data为存放数据集的目录,请勿修改
25
+ 4. logs为存放日志的目录,请勿修改
.gitignore ADDED
File without changes
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.12.11
5
+
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ ENV PATH="/home/user/.local/bin:$PATH"
9
+
10
+ WORKDIR /app
11
+
12
+ COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
+
15
+ COPY --chown=user . /app
16
+ CMD ["uvicorn", "codes.app:app", "--host", "0.0.0.0", "--port", "7860"]
codes/__init__.py ADDED
File without changes
codes/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (166 Bytes). View file
 
codes/__pycache__/app.cpython-312.pyc ADDED
Binary file (432 Bytes). View file
 
codes/app.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+
3
+ app = FastAPI()
4
+
5
+ @app.get("/")
6
+ def greet_json():
7
+ return {"Hello": "World!"}
push.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ git add .
2
+ git commit -m "update"
3
+ git push
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn[standard]