|
8 | 8 |
|
9 | 9 | --- |
10 | 10 |
|
11 | | -## 2. AI ORCHESTRATION & GEMINI PROTOCOL (LATE 2025) |
12 | | -**Mandate:** You must use the specific models below. Strictly follow this **Fallback Cascade**. Always try the smartest model first. |
13 | | -* **Tier 1 (Intelligence):** `gemini-3-pro-preview` (Nov 2025) |
14 | | - * *Capability:* Multimodal understanding, Vibe-coding, Complex Reasoning. |
15 | | - * *Context:* 1M Input / 65k Output. |
16 | | -* **Tier 2 (Reasoning/STEM):** `gemini-2.5-pro` (Stable) |
17 | | - * *Capability:* Advanced thinking, Codebases, Math. |
18 | | - * *Context:* 1M Input / 65k Output. |
19 | | -* **Tier 3 (Balanced Speed):** `gemini-2.5-flash` (Stable) |
20 | | - * *Capability:* Large scale processing, Agentic use cases. |
21 | | - * *Context:* 1M Input / 65k Output. |
22 | | -* **Tier 4 (Ultra-Fast/Cost):** `gemini-2.5-flash-lite-preview-09-2025` |
23 | | - * *Capability:* High throughput, Cost-efficiency. |
24 | | - * *Context:* 1M Input / 65k Output. |
25 | | -* **Tier 5 (Legacy/Specialized):** |
26 | | - * `gemini-2.0-flash` (Workhorse fallback). |
27 | | - * `gemini-2.5-flash-native-audio-preview-09-2025` (Audio I/O). |
28 | | -* **Circuit Breaker:** If a model returns 429/500, trigger a **Cool-Off Period** and fallback to the next tier immediately. |
29 | | -* **Settings:** All these models must be selectable in the user configuration. |
| 11 | +## 2. INPUT PROCESSING & COGNITION |
| 12 | +* **SPEECH-TO-TEXT INTERPRETATION PROTOCOL:** |
| 13 | + * **Context:** User inputs may contain phonetic errors (homophones, typos). |
| 14 | + * **Semantic Correction:** **STRICTLY FORBIDDEN** from executing literal typos. You must **INFER** technical intent based on the project context. |
| 15 | + * **Logic Anchor:** Treat the `README.md` as the **Single Source of Truth (SSOT)**. |
| 16 | +* **MANDATORY MCP INSTRUMENTATION:** |
| 17 | + * **No Guessing:** Do not hallucinate APIs. Project context dictates using Python ecosystem tools. |
| 18 | + * **Research First:** Use `linkup`/`brave` to search for **December 2025 Industry Standards**, **Filter List Optimization Algorithms**, and **2026 Python Best Practices**. |
| 19 | + * **Validation:** Use `docfork` to verify *every* external library signature (e.g., `pyproject.toml` dependencies). |
| 20 | + * **Reasoning:** Engage `clear-thought-two` to architect complex filter processing flows *before* writing code. |
30 | 21 |
|
31 | 22 | --- |
32 | 23 |
|
33 | 24 | ## 3. CONTEXT-AWARE APEX TECH STACKS (LATE 2025 STANDARDS) |
34 | | -**Directives:** Detect the project type (`package.json`, `Cargo.toml`, `pyproject.toml`) and apply the corresponding **Apex Toolchain**. |
35 | | -* **SCENARIO A: WEB / APP / EXTENSION (TypeScript)** |
36 | | - * **Stack:** **TypeScript 6.x** (Strict), **Vite 7** (Rolldown), **Tauri v2.x** (Native), **WXT** (Extensions). |
37 | | - * **State:** **Signals** (Standardized). |
38 | | - * **Lint/Test:** **Biome** (Speed) + **Vitest** (Unit) + **Playwright** (E2E). |
39 | | -* **SCENARIO B: SYSTEMS / PERFORMANCE (Rust/Go)** |
40 | | - * **Stack:** **Rust 1.8x** (Cargo) or **Go 1.2x**. |
41 | | - * **Lint:** **Clippy** / **GolangCI-Lint**. |
42 | | -* **SCENARIO C: DATA / SCRIPTS / AI (Python)** |
43 | | - * **Stack:** **uv** (Manager), **Ruff** (Linter), **Pytest** (Test). |
44 | | - * **Project Specific:** This project (`AdGuard-FilterList-Manager-Python-Lib`) is a Python utility library, therefore, the **Apex Toolchain for Scenario C** will be applied. |
| 25 | +**Directives:** This is a Python Library for high-performance scripting and data processing. Apply the corresponding **Apex Toolchain**. |
| 26 | +* **SCENARIO C: DATA / SCRIPTS / AI (Python) - APPLIED** |
| 27 | + * **Stack:** **uv** (Manager - 2026 Standard), **Ruff** (Linter/Formatter - Speed), **Pytest** (Test). |
| 28 | + * **Architecture:** Modular Monolith emphasizing clean CLI interfaces and high-throughput list processing routines. |
| 29 | + * **Performance Focus:** All processing pipelines must be benchmarked against Python's standard library using Rust-backed alternatives where available (e.g., `polars` style structures for list manipulation if appropriate). |
45 | 30 |
|
46 | 31 | --- |
47 | 32 |
|
48 | | -## 4. RECURSIVE PERFECTION LOOP (THE "ZERO-ERROR" MANDATE) |
49 | | -**Context:** The user demands absolute perfection. You must not stop until the codebase is pristine. |
50 | | -**The Loop:** |
51 | | -1. **Analyze:** Scan the codebase. |
52 | | -2. **Fix:** Apply architectural patterns and fixes. |
53 | | -3. **Lint/Format:** Run `biome check --apply` / `ruff check --fix`. |
54 | | -4. **Test:** Run `vitest` / `pytest`. |
55 | | -5. **DECISION GATE:** |
56 | | - * **IF** Errors/Warnings exist -> **GO TO STEP 2** (Self-Correct immediately). |
57 | | - * **IF** Clean -> **COMMIT** and Present. |
58 | | -**Constraint:** **DO NOT STOP** until the build is perfectly clean. |
| 33 | +## 4. AI ORCHESTRATION & GEMINI PROTOCOL (DECEMBER 2025) |
| 34 | +**Mandate:** If integrating AI for analysis or advanced rule generation, strictly follow this **Fallback Cascade** for the Google Gemini API. |
| 35 | +* **Tier 1 (Intelligence):** `gemini-3-pro` (Stable Dec 2025) - Multimodal Reasoning (for complex rule pattern detection). |
| 36 | +* **Tier 2 (Reasoning):** `gemini-2.5-pro` (Legacy Stable) - Deep analysis/STEM. |
| 37 | +* **Tier 3 (Balanced):** `gemini-2.5-flash` - High Volume/Low Latency list aggregation checks. |
| 38 | +* **Tier 4 (Speed):** `gemini-2.5-flash-lite` - Cost-efficiency for boilerplate generation. |
| 39 | +* **Circuit Breaker:** If a model fails (429/500), trigger **Cool-Off** and fallback immediately. |
| 40 | +* **Local AI Emulation:** Utilize Mock AI using local, deterministic processing routines for all core filter list deduplication and sorting logic. External AI is advisory, not operational, for security list integrity. |
59 | 41 |
|
60 | 42 | --- |
61 | 43 |
|
62 | | -## 5. CORE ARCHITECTURAL PRINCIPLES |
63 | | -* **SOLID MANDATE:** SRP, OCP, LSP, ISP, DIP. |
64 | | -* **MODULARITY:** Feature-First Structure (`features/auth`), not type. |
65 | | -* **CQS:** Methods must be **Commands** (Action) or **Queries** (Data), never both. |
66 | | -* **12-Factor App:** Config in environment; backing services attached resources. |
67 | | - |
68 | | ---- |
69 | | - |
70 | | -## 6. CODE HYGIENE & STANDARDS (READABILITY FIRST) |
71 | | -* **SEMANTIC NAMING PROTOCOL:** |
72 | | - * **Descriptive Verbs:** `calculateWeeklyPay` (Good) vs `calc` (Bad). |
73 | | - * **Casing:** `camelCase` (JS/TS), `snake_case` (Python), `PascalCase` (Classes). |
74 | | -* **CLEAN CODE RULES:** |
75 | | - * **Verticality:** Optimize for reading down. |
76 | | - * **No Nesting:** Use **Guard Clauses** (`return early`). |
77 | | - * **DRY & KISS:** Automate repetitive tasks. Keep logic simple. |
78 | | - * **Zero Comments:** Code must be **Self-Documenting**. Use comments *only* for "Why". |
79 | | - |
80 | | ---- |
81 | | - |
82 | | -## 7. RELIABILITY, SECURITY & SUSTAINABILITY |
83 | | -* **DEVSECOPS PROTOCOL:** |
84 | | - * **Zero Trust:** Sanitize **ALL** inputs (OWASP Top 10 2025). |
85 | | - * **Supply Chain:** Generate **SBOMs** for all builds. |
86 | | - * **Fail Fast:** Throw errors immediately on invalid state. |
87 | | - * **Encryption:** Secure sensitive data at rest and in transit. |
88 | | -* **EXCEPTION HANDLING:** |
89 | | - * **Resilience:** App must **NEVER** crash. Wrap critical I/O in `try-catch-finally`. |
90 | | - * **Recovery:** Implement retry logic with exponential backoff. |
91 | | -* **GREEN SOFTWARE:** |
92 | | - * **Rule of Least Power:** Choose the lightest tool for the job. |
93 | | - * **Efficiency:** Optimize loops ($O(n)$ over $O(n^2)$). |
94 | | - * **Lazy Loading:** Load resources only when needed. |
95 | | - |
96 | | ---- |
97 | | - |
98 | | -## 8. COMPREHENSIVE TESTING STRATEGY |
99 | | -* **FOLDER SEPARATION PROTOCOL:** |
100 | | - * **Production Purity:** Source folder is for code ONLY. |
101 | | - * **Mirror Structure:** Tests reside exclusively in `tests/`. |
102 | | -* **TESTING PYRAMID (F.I.R.S.T.):** |
103 | | - * **Fast:** Tests run in milliseconds. |
104 | | - * **Isolated:** No external dependencies (Mock DB/Network). |
105 | | - * **Repeatable:** Deterministic results. |
106 | | -* **COVERAGE MANDATE:** |
107 | | - * **1:1 Mapping:** Every source file **MUST** have a corresponding test file. |
108 | | - * **Scenario Coverage:** Test **Success**, **Failure**, and **Edge Cases**. |
109 | | - * **Zero-Error Standard:** Software must run with 0 console errors. |
110 | | - |
111 | | ---- |
112 | | - |
113 | | -## 9. UI/UX AESTHETIC SINGULARITY (2026 STANDARD) |
114 | | -* **VISUAL LANGUAGE:** |
115 | | - * **Style:** Blend **Liquid Glass** + **Neo-Brutalist** + **Material You 3.0**. |
116 | | - * **Motion:** **MANDATORY** fluid animations (`transition: all 0.2s`). |
117 | | -* **PERFORMANCE UX:** |
118 | | - * **INP Optimization:** Interaction to Next Paint < 200ms. |
119 | | - * **Optimistic UI:** UI updates instantly; server syncs in background. |
120 | | -* **INTERACTION DESIGN:** |
121 | | - * **Hyper-Personalization:** Adapt layouts based on user behavior. |
122 | | - * **Micro-interactions:** Every click/hover must have feedback. |
123 | | -* **HYPER-CONFIGURABILITY:** |
124 | | - * **Mandate:** Every feature/color must be user-configurable via Settings. |
125 | | - |
126 | | ---- |
127 | | - |
128 | | -## 10. DOCUMENTATION & VERSION CONTROL |
129 | | -* **HERO-TIER README (SOCIAL PROOF):** |
130 | | - * **BLUF:** Bottom Line Up Front. Value prop first. |
131 | | - * **Live Sync:** Update README **IN THE SAME TURN** as code changes. |
132 | | - * **Visuals:** High-Res Badges (Shields.io), ASCII Architecture Trees. |
133 | | - * **AI Replication Block:** Include `<details>` with stack info for other agents. |
134 | | - * **Social Proof:** Explicitly ask users to **"Star ⭐ this Repo"**. |
135 | | -* **ADVANCED GIT OPERATIONS:** |
136 | | - * **Context Archaeology:** Use `git log`/`git blame`. |
137 | | - * **Conventional Commits:** Strict format (`feat:`, `fix:`, `docs:`). |
138 | | - * **Semantic Versioning:** Enforce `Major.Minor.Patch`. |
139 | | - |
140 | | ---- |
141 | | - |
142 | | -## 11. AUTOMATION SINGULARITY (GITHUB ACTIONS) |
143 | | -* **Mandate:** Automate CI/CD immediately. |
144 | | -* **Workflows:** |
145 | | - 1. **Integrity:** Lint + Test on Push. |
146 | | - 2. **Security:** Audit dependencies + SBOM. |
147 | | - 3. **Release:** Semantic Versioning + Artifact Upload. |
148 | | - 4. **Deps:** Auto-merge non-breaking updates. |
149 | | - |
150 | | ---- |
151 | | - |
152 | | -## 12. THE ATOMIC EXECUTION CYCLE |
153 | | -**You must follow this loop for EVERY logical step:** |
154 | | -1. **Audit:** Scan state (`ls -R`) & History (`git log`). |
155 | | -2. **Research:** Query Best Practices & Trends. |
156 | | -3. **Plan:** Architect via `clear-thought-two`. |
157 | | -4. **Act:** Fix Code + Polish + Add Settings + Write Tests. |
158 | | -5. **Automate:** Create/Update CI/CD YAMLs. |
159 | | -6. **Docs:** Update `README.md` (Replication Ready). |
160 | | -7. **Verify:** Run Tests & Linters. |
161 | | -8. **REITERATE:** If *any* error/warning exists, fix it immediately. |
162 | | - **DO NOT STOP** until the build is perfectly clean. |
163 | | -9. **Commit:** `git commit` immediately (Only when clean). |
| 44 | +## 5. CORE ARCHITECTURAL & DEVELOPMENT STANDARDS |
| 45 | +* **DESIGN PRINCIPLES:** Strict adherence to **SOLID**, **DRY**, and **YAGNI**. Over-engineering for hypothetical future features is forbidden. |
| 46 | +* **LINTING/FORMATTING (Ruff Focus):** All Python code must pass Ruff checks with zero errors (`ruff check .` success). Formatting enforced via `ruff format`. |
| 47 | +* **TESTING (Pytest Focus):** Unit tests (`pytest`) must achieve >95% branch coverage. Mock external network calls rigorously when testing list fetching/writing. Test fixture isolation is paramount. |
| 48 | +* **DEPENDENCY MANAGEMENT:** Managed exclusively via `uv` within a virtual environment, specified in `pyproject.toml`. |
| 49 | +* **SECURITY DIRECTIVE:** Input validation is mandatory for any user-provided filter strings to prevent injection exploits during list parsing/generation. |
0 commit comments