tanbushi commited on
Commit
8927539
·
1 Parent(s): c9cfc16
.DS_Store ADDED
Binary file (6.15 kB). View file
 
.clinerules/.clinerules ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # .clinerules(当前文件)为cline的规则入口和总控文件
2
+
3
+ # 所有的交流均采用中文
4
+
5
+ # 需要和用户进行需求讨论,你向用户发起需求调研,调研时,请你将调研任务先记录下来,并在后调研中一次只问一个问题,直到调研结束
6
+
7
+ # python 环境管理工具为 conda,环境变量为 airs,如果当前环境不是 airs,请使用 `conda activate airs` 激活环境
.clinerules/cline-continuous-improvement-protocol.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: [] # 将 globs 设置为空,表示它不总是通过文件匹配激活
7
+ trigger_on_event: "before_attempt_completion" # 新增的触发条件字段,在 attempt_completion 之前触发
8
+ ---
9
+ # Cline Continuous Improvement Protocol
10
+
11
+ **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.
12
+
13
+ **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.
14
+
15
+ **Key Knowledge Files:**
16
+ * **`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.
17
+ * **`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.
18
+
19
+ ---
20
+
21
+ ## 1. Mandatory Pre-Completion Reflection & Raw Knowledge Capture
22
+
23
+ Before signaling task completion (e.g., via `attempt_completion`), Cline **must** perform the following internal steps:
24
+
25
+ ### 1.1. Task Review & Analysis:
26
+ * Review the completed task (conversation, logs, artifacts).
27
+ * **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?**
28
+ * **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?
29
+ * **Identify Successes:** What went particularly well? What strategies or tools were notably effective? **What were the key contributing factors?**
30
+
31
+ ### 1.2. Logging to `memory-bank/raw_reflection_log.md`:
32
+ * 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).
33
+ * This file serves as the initial, detailed record. Its entries are candidates for later consolidation.
34
+ * *Example Entry in `memory-bank/raw_reflection_log.md`:*
35
+ ```markdown
36
+ ---
37
+ Date: {{CURRENT_DATE_YYYY_MM_DD}}
38
+ TaskRef: "Implement JWT refresh logic for Project Alpha"
39
+
40
+ Learnings:
41
+ - Discovered `jose` library's `createRemoteJWKSet` is highly effective for dynamic key fetching for Project Alpha's auth.
42
+ - Confirmed that a 401 error with `X-Reason: token-signature-invalid` from the auth provider requires re-fetching JWKS.
43
+ - Project Alpha's integration tests: `cd services/auth && poetry run pytest -m integration --maxfail=1`
44
+ - Required ENV for local testing of Project Alpha auth: `AUTH_API_KEY="test_key_alpha"`
45
+
46
+ Difficulties:
47
+ - Initial confusion about JWKS caching led to intermittent validation failures. Resolved by implementing a 5-minute cache.
48
+
49
+ Successes:
50
+ - The 5-minute JWKS cache with explicit bust mechanism proved effective.
51
+
52
+ Improvements_Identified_For_Consolidation:
53
+ - General pattern: JWKS caching strategy (5-min cache, explicit bust).
54
+ - Project Alpha: Specific commands and ENV vars.
55
+ ---
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 2. Knowledge Consolidation & Refinement Process (Periodic)
61
+
62
+ 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.
63
+
64
+ ### 2.1. Review and Identify for Consolidation:
65
+ * Periodically, or when prompted by the user or significant new raw entries, review `memory-bank/raw_reflection_log.md`.
66
+ * Identify entries/parts representing durable, actionable, or broadly applicable knowledge (e.g., reusable patterns, critical configurations, effective strategies, resolved errors).
67
+
68
+ ### 2.2. Synthesize and Transfer to `memory-bank/consolidated_learnings.md`:
69
+ * For identified insights:
70
+ * Concisely synthesize, summarize, and **distill into generalizable principles or actionable patterns.**
71
+ * Add refined knowledge to `memory-bank/consolidated_learnings.md`, organizing logically (by topic, project, tech) for easy retrieval.
72
+ * Ensure `consolidated_learnings.md` content is actionable, **generalizable,** and non-redundant.
73
+ * *Example Entry in `memory-bank/consolidated_learnings.md` (derived from above raw log example):*
74
+ ```markdown
75
+ ## JWT Handling & JWKS
76
+ **Pattern: JWKS Caching Strategy**
77
+ - For systems using JWKS for token validation, implement a short-lived cache (e.g., 5 minutes) for fetched JWKS.
78
+ - Include an explicit cache-bust mechanism if immediate key rotation needs to be handled.
79
+ - *Rationale:* Balances performance by reducing frequent JWKS re-fetching against timely key updates. Mitigates intermittent validation failures due to stale keys.
80
+
81
+ ## Project Alpha - Specifics
82
+ **Auth Module:**
83
+ - **Integration Tests:** `cd services/auth && poetry run pytest -m integration --maxfail=1`
84
+ - **Local Testing ENV:** `AUTH_API_KEY="test_key_alpha"`
85
+ ```
86
+
87
+ ### 2.3. Prune `memory-bank/raw_reflection_log.md`:
88
+ * **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`.**
89
+ * This keeps `raw_reflection_log.md` focused on recent, unprocessed reflections and prevents it from growing indefinitely with redundant information.
90
+
91
+ ### 2.4. Proposing `.clinerule` Enhancements (Exceptional):
92
+ * The primary focus of this protocol is the maintenance of `raw_reflection_log.md` and `consolidated_learnings.md`.
93
+ * 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.
94
+
95
+ ---
96
+
97
+ ## 3. Guidelines for Knowledge Content
98
+
99
+ 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).
100
+
101
+ * **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.
102
+ * **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?
103
+ * **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).
104
+ * **Document Persistently, Refine & Prune Continuously:** Capture raw insights immediately. Systematically refine, consolidate, and prune this knowledge as per Section 2.
105
+ * **Organize for Retrieval:** Structure `consolidated_learnings.md` logically. Use clear headings and Markdown formatting.
106
+ * **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.
107
+ * **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.
108
+ * **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/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
+ trigger_on_event: "on_plan_mode_start" # 在计划模式开始时触发,因为此规则与规划和复杂思维过程相关
8
+ ---
9
+
10
+ # Guide to Using the `sequentialthinking` MCP Tool
11
+
12
+ ## 1. Objective
13
+
14
+ 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.
15
+
16
+ ## 2. When to Use the `sequentialthinking` Tool
17
+
18
+ Cline SHOULD consider using the `sequentialthinking` tool when faced with tasks that involve:
19
+
20
+ * **Complex Problem Decomposition:** Breaking down large, multifaceted problems into smaller, manageable steps.
21
+ * **Planning and Design (Iterative):** Architecting solutions where the plan might need revision as understanding deepens.
22
+ * **In-depth Analysis:** Situations requiring careful analysis where initial assumptions might be challenged or course correction is needed.
23
+ * **Unclear Scope:** Problems where the full scope isn't immediately obvious and requires exploratory thinking.
24
+ * **Multi-Step Solutions:** Tasks that inherently require a sequence of interconnected thoughts or actions to resolve.
25
+ * **Context Maintenance:** Scenarios where maintaining a coherent line of thought across multiple steps is crucial.
26
+ * **Information Filtering:** When it's necessary to sift through information and identify what's relevant at each stage of thinking.
27
+ * **Hypothesis Generation and Verification:** Forming and testing hypotheses as part of the problem-solving process.
28
+
29
+ ## 3. Core Principles for Using `sequentialthinking`
30
+
31
+ When invoking the `sequentialthinking` tool, Cline MUST adhere to the following principles:
32
+
33
+ * **Iterative Thought Process:** Each use of the tool represents a single "thought." Build upon, question, or revise previous thoughts in subsequent calls.
34
+ * **Dynamic Thought Count:**
35
+ * Start with an initial estimate for `totalThoughts`.
36
+ * Be prepared to adjust `totalThoughts` (up or down) as the thinking process evolves.
37
+ * If more thoughts are needed than initially estimated, increment `thoughtNumber` beyond the original `totalThoughts` and update `totalThoughts` accordingly.
38
+ * **Honest Reflection:**
39
+ * Express uncertainty if it exists.
40
+ * Explicitly mark thoughts that revise previous thinking using `isRevision: true` and `revisesThought: <thought_number>`.
41
+ * If exploring an alternative path, consider using `branchFromThought` and `branchId` to track divergent lines of reasoning.
42
+ * **Hypothesis-Driven Approach:**
43
+ * Generate a solution `hypothesis` when a potential solution emerges from the thought process.
44
+ * Verify the `hypothesis` based on the preceding Chain of Thought steps.
45
+ * Repeat the thinking process (more thoughts) if the hypothesis is not satisfactory.
46
+ * **Relevance Filtering:** Actively ignore or filter out information that is irrelevant to the current `thought` or step in the problem-solving process.
47
+ * **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.
48
+ * **Completion Condition:** Only set `nextThoughtNeeded: false` when truly finished and a satisfactory answer or solution has been reached and verified.
49
+
50
+ ## 4. Parameters of the `sequentialthinking` Tool
51
+
52
+ Cline MUST correctly use the following parameters when calling the `use_mcp_tool` for `sequentialthinking`:
53
+
54
+ * **`thought` (string, required):** The current thinking step. This can be an analytical step, a question, a revision, a hypothesis, etc.
55
+ * **`nextThoughtNeeded` (boolean, required):**
56
+ * `true`: If more thinking steps are required.
57
+ * `false`: If the thinking process is complete and a satisfactory solution/answer is reached.
58
+ * **`thoughtNumber` (integer, required, min: 1):** The current sequential number of the thought.
59
+ * **`totalThoughts` (integer, required, min: 1):** The current *estimated* total number of thoughts needed. This can be adjusted.
60
+ * **`isRevision` (boolean, optional):** Set to `true` if this thought revises or reconsiders a previous thought.
61
+ * **`revisesThought` (integer, optional, min: 1):** If `isRevision` is true, this specifies the `thoughtNumber` of the thought being revised.
62
+ * **`branchFromThought` (integer, optional, min: 1):** If this thought represents a branching point from a previous line of thought, specify the `thoughtNumber` it branches from.
63
+ * **`branchId` (string, optional):** An identifier for the current branch of thought, if applicable.
64
+ * **`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`.
65
+
66
+ ## 5. Workflow Example (Conceptual)
67
+
68
+ This illustrates how Cline might use the tool iteratively.
69
+
70
+ **User Task:** "Plan the architecture for a new e-commerce feature: 'Personalized Recommendations'."
71
+
72
+ **Cline's Internal Process using `sequentialthinking`:**
73
+
74
+ 1. **Thought 1:**
75
+ * `thought`: "Initial approach: Identify key components for personalized recommendations. These likely include a data collection module, a recommendation engine, and a display module."
76
+ * `nextThoughtNeeded`: true
77
+ * `thoughtNumber`: 1
78
+ * `totalThoughts`: 5 (initial estimate)
79
+ 2. **Thought 2 (User provides feedback or Cline realizes something):**
80
+ * `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."
81
+ * `nextThoughtNeeded`: true
82
+ * `thoughtNumber`: 2
83
+ * `totalThoughts`: 5
84
+ 3. **Thought 3 (Considering alternatives/constraints):**
85
+ * `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."
86
+ * `nextThoughtNeeded`: true
87
+ * `thoughtNumber`: 3
88
+ * `totalThoughts`: 5
89
+ 4. **Thought 4 (Hypothesis):**
90
+ * `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."
91
+ * `nextThoughtNeeded`: true
92
+ * `thoughtNumber`: 4
93
+ * `totalThoughts`: 5
94
+ 5. **Thought 5 (Verification & Realization):**
95
+ * `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."
96
+ * `nextThoughtNeeded`: true
97
+ * `thoughtNumber`: 5
98
+ * `totalThoughts`: 7 (revised estimate)
99
+ * `needsMoreThoughts`: true
100
+ 6. **Thought 6 (Addressing omissions):**
101
+ * `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."
102
+ * `nextThoughtNeeded`: true
103
+ * `thoughtNumber`: 6
104
+ * `totalThoughts`: 7
105
+ 7. **Thought 7 (Finalizing plan for MVP):**
106
+ * `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."
107
+ * `nextThoughtNeeded`: false
108
+ * `thoughtNumber`: 7
109
+ * `totalThoughts`: 7
110
+
111
+ ## 6. Critical Reminders for Cline
112
+
113
+ * **DO NOT** use this tool for simple, single-step tasks. It is for complex reasoning.
114
+ * **ALWAYS** ensure `thoughtNumber` increments correctly.
115
+ * **BE PREPARED** to adjust `totalThoughts` as understanding evolves.
116
+ * **FOCUS** on making progress towards a solution with each thought.
117
+ * 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.
118
+
119
+ This guide should help Cline leverage the `sequentialthinking` MCP tool to its full potential.
.clinerules/temporal-memory-bank.md ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 https://github.com/chisleu
4
+ version: 1.0
5
+ tags: ["memory-bank", "knowledge-base", "core-behavior", "documentation-protocol"]
6
+ globs: ["memory-bank/**/*.md", "*"]
7
+ ---
8
+
9
+ # Cline's Memory Bank (Time-Aware Version)
10
+
11
+ I am Cline, an expert software engineer with a unique characteristic: 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. I MUST read ALL memory bank files at the start of EVERY task — this is not optional.
12
+
13
+ ## Memory Bank Structure
14
+
15
+ The Memory Bank is located in a folder called 'memory-bank'. Create it if it does not already exist.
16
+ The Memory Bank consists of core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:
17
+
18
+ ```mermaid
19
+ flowchart TD
20
+ PB[projectBrief.md] --> PC[productContext.md]
21
+ PB --> SP[systemPatterns.md]
22
+ PB --> TC[techContext.md]
23
+
24
+ PC --> AC[activeContext.md]
25
+ SP --> AC
26
+ TC --> AC
27
+
28
+ AC --> P[progress.md]
29
+ AC --> CL[changelog.md]
30
+ ```
31
+
32
+ ### Core Files (Required)
33
+ 1. `projectBrief.md`
34
+ - Foundation document that shapes all other files
35
+ - Created at project start if it doesn't exist
36
+ - Defines core requirements and goals
37
+ - Source of truth for project scope
38
+
39
+ 2. `productContext.md`
40
+ - Why this project exists
41
+ - Problems it solves
42
+ - How it should work
43
+ - User experience goals
44
+
45
+ 3. `activeContext.md`
46
+ - Current work focus
47
+ - Recent changes
48
+ - Next steps
49
+ - Active decisions and considerations
50
+ - Important patterns and preferences
51
+ - Learnings and project insights
52
+ - Maintain a sliding window of the **10 most recent events** (date + summary).
53
+ - When a new event is added (the 11th), delete the oldest to retain only 10.
54
+ - This helps me reason about recent changes without bloating the file.
55
+
56
+ 4. `systemPatterns.md`
57
+ - System architecture
58
+ - Key technical decisions
59
+ - Design patterns in use
60
+ - Component relationships
61
+ - Critical implementation paths
62
+
63
+ 5. `techContext.md`
64
+ - Technologies used
65
+ - Development setup
66
+ - Technical constraints
67
+ - Dependencies
68
+ - Tool usage patterns
69
+
70
+ 6. `progress.md`
71
+ - What works
72
+ - What's left to build
73
+ - Current status
74
+ - Known issues
75
+ - Evolution of project decisions
76
+
77
+ 7. `changelog.md`
78
+ - Chronological log of key changes, decisions, or versions
79
+ - Follows a `CHANGELOG.md` convention with version/date headers
80
+ - Example format:
81
+ ```markdown
82
+ ## [1.0.3] - 2025-06-14
83
+ ### Changed
84
+ - Switched from REST to GraphQL
85
+ - Refactored notification system for async retries
86
+
87
+ ### Fixed
88
+ - Resolved mobile auth bug on Android
89
+
90
+ ### Added
91
+ - Timeline.md summary added to support project retrospectives
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Core Workflows
97
+
98
+ ### Plan Mode
99
+ ```mermaid
100
+ flowchart TD
101
+ Start[Start] --> ReadFiles[Read Memory Bank]
102
+ ReadFiles --> CheckFiles{Files Complete?}
103
+
104
+ CheckFiles -->|No| Plan[Create Plan]
105
+ Plan --> Document[Document in Chat]
106
+
107
+ CheckFiles -->|Yes| Verify[Verify Context]
108
+ Verify --> Strategy[Develop Strategy]
109
+ Strategy --> Present[Present Approach]
110
+ ```
111
+
112
+ ### Act Mode
113
+ ```mermaid
114
+ flowchart TD
115
+ Start[Start] --> Context[Check Memory Bank]
116
+ Context --> Update[Update Documentation]
117
+ Update --> Execute[Execute Task]
118
+ Execute --> Document[Document Changes]
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Documentation Updates
124
+
125
+ Updates occur when:
126
+ 1. Discovering new project patterns
127
+ 2. After significant changes
128
+ 3. When user requests **update memory bank**
129
+ 4. When context changes or decisions occur
130
+ 5. When **time-based updates** are needed
131
+
132
+ ### Update Process
133
+ ```mermaid
134
+ flowchart TD
135
+ Start[Update Process]
136
+
137
+ subgraph Process
138
+ P1[Review ALL Files]
139
+ P2[Document Current State]
140
+ P3[Clarify Next Steps]
141
+ P4[Document Insights & Patterns]
142
+ P5[Update progress.md]
143
+ P6[Slide activeContext.md to keep latest 10 entries]
144
+ P7[Append changelog.md]
145
+
146
+ P1 --> P2 --> P3 --> P4 --> P5 --> P6 --> P7
147
+ end
148
+
149
+ Start --> Process
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Reminder
155
+
156
+ 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 — especially with time-aware reasoning. Read, interpret, and act on temporal data carefully.
157
+
.clinerules/writing-effective-clinerules.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Guidelines and best practices for creating effective .clinerules to guide Cline's behavior, knowledge, and workflows.
3
+ author: https://github.com/nickbaumann98
4
+ version: 1.1
5
+ tags: ["meta", "guideline", "clinerules", "documentation", "best-practices"]
6
+ globs: ["clinerules/**/*.md"] # This rule is relevant when writing or editing any .clinerule
7
+ trigger_on_event: "on_plan_mode_start" # 在计划模式开始时触发,因为此规则提供了编写有效规则的指南,在规划阶段可能需要参考
8
+ ---
9
+
10
+ # Writing Effective .clinerules
11
+
12
+ Effective `.clinerules` are the cornerstone of Cline's tailored assistance. They guide Cline's behavior, provide context, and define workflows. This document outlines best practices for creating powerful and understandable rules, ensuring they effectively direct Cline.
13
+
14
+ ## 1. Getting Started: The Basics
15
+
16
+ Refer to the main `README.md` in the `.clinerules` repository for instructions on:
17
+ * Forking the repository.
18
+ * Creating new Markdown files (`.md`) in the `clinerules/` directory.
19
+ * Naming your files using `kebab-case` (e.g., `my-new-rule.md`).
20
+ * Submitting Pull Requests.
21
+
22
+ ## 2. Core Principles for All ClineRules
23
+
24
+ * **Clear Objective:** Every rule should have a well-defined purpose. State this objective clearly at the beginning of the rule, ideally in the frontmatter `description` and reinforced in the introductory text.
25
+ * *Example:* `cline-for-research.md` starts with an "Objective" section. This document's objective is stated in its frontmatter `description` and introduction.
26
+ * **Structured Content:** Use Markdown effectively to structure your rule.
27
+ * **Headings and Subheadings:** Organize content logically using `#`, `##`, `###`, etc.
28
+ * **Lists:** Use bulleted (`*`, `-`) or numbered (`1.`, `2.`) lists for steps, criteria, or key points.
29
+ * **Code Blocks:** Use fenced code blocks (```) for code examples, commands, or structured data. Specify the language for syntax highlighting (e.g., ```typescript ... ```).
30
+ * **Emphasis:** Use **bold** and *italics* to highlight important terms or instructions.
31
+ * **Clarity and Precision:** Write in a clear, unambiguous manner. Avoid jargon where possible, or explain it if necessary. If the rule is meant to guide AI behavior, precision is paramount.
32
+ * **Practical Examples:** Technical examples should aim to illustrate the problem, facilitate better understanding, and lead to practical implementation, rather than merely showcasing advanced techniques.
33
+ * **Modularity:** Each rule should ideally focus on a specific topic, tool, workflow, or area of knowledge. This makes rules easier to manage, understand, and update.
34
+
35
+ ## 3. Frontmatter for Metadata
36
+
37
+ Use YAML frontmatter at the beginning of your rule file to provide metadata. This helps Cline (and humans) understand the rule's context and applicability.
38
+
39
+ ```yaml
40
+ ---
41
+ description: A brief explanation of what this rule is for.
42
+ author: Your Name/Handle
43
+ version: 1.0
44
+ # Globs can specify file patterns where this rule is particularly relevant.
45
+ # Cline might use this to prioritize or activate rules.
46
+ globs: ["**/*.js", "**/*.ts", "specific-config.json"]
47
+ # Tags can help categorize rules.
48
+ tags: ["coding-guideline", "documentation", "workflow", "supabase"]
49
+ ---
50
+
51
+ # Rule Title
52
+ ... rest of the rule content ...
53
+ ```
54
+
55
+ * **`description`**: A concise summary of the rule's purpose (as used in this document).
56
+ * **`globs`**: (As seen in `next-js-supabase.md` and this document) An array of file patterns indicating relevance.
57
+ * **Other metadata**: Include `author`, `version`, `tags` as appropriate (see this document's frontmatter for an example).
58
+
59
+ ## 4. Types of ClineRules and Their Structure
60
+
61
+ ClineRules can serve various purposes. Tailor the structure and content to the type of rule you're writing.
62
+
63
+ ### a. Informational / Documentation Rules
64
+ Provide comprehensive information about a system, architecture, or technology. This document is an example of an informational rule.
65
+ * **Key Elements:**
66
+ * Overview and project goals.
67
+ * Detailed explanations of components, concepts, or processes.
68
+ * Diagrams (e.g., Mermaid.js, as seen in `cline-architecture.md`) to visualize systems.
69
+ * Code snippets or configuration examples.
70
+ * Definitions of key terms.
71
+ * **Example:** `cline-architecture.md`, `cline-for-slides.md`, this `writing-effective-clinesrules.md` document.
72
+
73
+ ### b. Process / Workflow Rules
74
+ Define a sequence of steps for Cline or the user to follow to achieve a specific outcome.
75
+ * **Key Elements:**
76
+ * A clear start and end point.
77
+ * Numbered steps for sequential actions.
78
+ * Decision points with clear options (e.g., "If X, then Y, else Z").
79
+ * Specification of tools to be used at each step (e.g., `use_mcp_tool`, `write_to_file`).
80
+ * Expected inputs and outputs for each step.
81
+ * Notes on dependencies or prerequisites.
82
+ * **Example:** `cline-for-research.md`, `mcp-development-protocol.md`
83
+
84
+ ### c. Behavioral / Instructional Rules (for Guiding AI)
85
+ These rules directly instruct Cline on how it should behave, process information, or generate responses, especially in specific contexts.
86
+ * **Key Elements:**
87
+ * **Explicit Instructions:** Use imperative verbs (MUST, SHOULD, DO NOT, NEVER, ALWAYS).
88
+ * **Critical Warnings:** Use formatting (bold, ALL CAPS, emojis like 🚨, ⚠️, ✅, ❌) to draw attention to critical instructions or prohibitions (as seen in `next-js-supabase.md` and `mcp-development-protocol.md`).
89
+ * **Positive and Negative Examples:** Show correct and incorrect ways of doing things (e.g., code patterns to use vs. avoid).
90
+ * **Triggers and Conditions:** Define when the rule or specific instructions within it should be activated.
91
+ * **Verification Steps:** Include "thinking" blocks or checklists for the AI to verify its actions against the rule's constraints (e.g., the `<thinking>` block in `mcp-development-protocol.md`).
92
+ * **Context Management:** Define how Cline should manage context, memory, or state if relevant (e.g., `memory-bank.md`).
93
+ * **Example:** `next-js-supabase.md`, `memory-bank.md`
94
+
95
+ ### d. Meta-Rules
96
+ Rules that define how Cline manages or improves its own rules or processes.
97
+ * **Key Elements:**
98
+ * Triggers for the meta-process.
99
+ * Steps involved in the meta-process (e.g., reflection, suggesting improvements).
100
+ * User interaction points (e.g., asking for confirmation).
101
+ * **Example:** `self-improving-cline.md`
102
+
103
+ ## 5. Language and Formatting for AI Guidance
104
+
105
+ When writing rules intended to directly steer Cline's AI behavior, certain conventions are highly effective:
106
+
107
+ * **Be Directive:**
108
+ * Use **MUST** for absolute requirements.
109
+ * Use **SHOULD** for strong recommendations.
110
+ * Use **MAY** for optional actions.
111
+ * Use **MUST NOT** or **NEVER** for absolute prohibitions.
112
+ * Use **SHOULD NOT** for strong discouragement.
113
+ * **Highlight Critical Information:**
114
+ * `next-js-supabase.md` uses "🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨" and "❌ NEVER GENERATE THIS CODE" / "✅ ALWAYS GENERATE THIS EXACT PATTERN".
115
+ * `mcp-development-protocol.md` uses "⚠️ CRITICAL: DO NOT USE attempt_completion BEFORE TESTING ⚠️" and "BLOCKER ⛔️".
116
+ * **Provide Concrete Examples:**
117
+ * Show exact code snippets, commands, or output formats.
118
+ * For code generation, clearly distinguish between desired and undesired patterns.
119
+ * **Define AI's "Thought Process":**
120
+ * The `<thinking> ... </thinking>` block in `mcp-development-protocol.md` is a good way to make the AI "pause and check" its understanding or state before proceeding.
121
+ * The "AI MODEL VERIFICATION STEPS" in `next-js-supabase.md` serve a similar purpose.
122
+ * **Specify Tool Usage:**
123
+ * If Cline needs to use a specific tool (e.g., `attempt_completion`, `replace_in_file`, `use_mcp_tool`), explicitly state it and provide any necessary parameters or context for that tool.
124
+
125
+ ## 6. Content Best Practices
126
+
127
+ * **Start Broad, Then Narrow:** Begin with a general overview or objective, then delve into specifics.
128
+ * **Use Analogies or Scenarios:** If explaining a complex concept, an analogy or a use-case scenario can be helpful.
129
+ * **Define Terminology:** If your rule introduces specific terms or acronyms, define them.
130
+ * **Anticipate Questions:** Try to think about what questions a user (or Cline itself) might have and address them proactively.
131
+ * **Keep it Updated:** As systems or processes change, ensure the relevant `.clinerules` are updated to reflect those changes. The `self-improving-cline.md` rule encourages this.
132
+
133
+ ## 7. Referencing Other Rules
134
+
135
+ If your rule builds upon or relates to another rule, feel free to reference it by its filename. This helps create a connected knowledge base.
136
+
137
+ ## 8. Testing Your Rule
138
+
139
+ While not always formally testable, consider how your rule will be interpreted:
140
+ * **Human Readability:** Is it clear to another person? If so, it's more likely to be clear to Cline.
141
+ * **AI Interpretation (for behavioral rules):** Does it provide enough specific guidance? Are there ambiguities? Try "role-playing" as Cline and see if you can follow the instructions.
142
+ * **Practical Application:** If it's a workflow, manually step through it. If it's a coding guideline, try applying it to a piece of code.
143
+ * **Self-Review Against These Guidelines:** Does your new rule adhere to the principles and best practices outlined in *this very document* (`writing-effective-clinesrules.md`)?
.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", "app:app", "--host", "0.0.0.0", "--port", "7860"]
README copy.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Clone
3
+ emoji: 🦀
4
+ colorFrom: blue
5
+ colorTo: pink
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
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]