ai-scaffold-pro 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/i18n/en.json ADDED
@@ -0,0 +1,536 @@
1
+ {
2
+ "changelog": {
3
+ "title": "Changelog",
4
+ "format_line1": "Format: vX.Y.Z (YYYY.MM.DD)",
5
+ "format_line2": "X = Architecture refactor | Y = Feature change | Z = Patch",
6
+ "added_entry": "Project overview, build commands, rules and skill trigger strategy",
7
+ "added_project_rule": "main development rules",
8
+ "added_conflict_resolution": "Rule conflict resolution mechanism",
9
+ "added_plan_mode": "Structured task decomposition skill",
10
+ "added_code_review": "Code review skill",
11
+ "added_arch_review": "Architecture compliance review agent",
12
+ "added_resource_sync": "Resource sync verification agent",
13
+ "added_proactive_correction": "Proactive correction agent (rule self-consistency + existing code compliance + implementation rationality scan, can execute fixes)",
14
+ "added_post_edit_tracker": "Edit tracking hook",
15
+ "added_check_review": "Review reminder hook",
16
+ "added_settings": "Hook registration config",
17
+ "added_gen_references": "Module reference doc auto-generation script",
18
+ "added_references": "Module reference documentation"
19
+ },
20
+ "project_rule": {
21
+ "title": "Development Rules",
22
+ "scope": "**Scope**: Code generation, modification, review, refactoring operations.",
23
+ "skip_conditions": "**Skip conditions**: Casual chat, general knowledge Q&A, non-code discussions, negative context.",
24
+ "negative_title": "Negative Keyword Protection",
25
+ "negative_table_header": "| Negative Pattern | Example | Reason |",
26
+ "negative_row1": "| General concept discussion | \"What's the difference between X and Y in principle?\" | General Q&A |",
27
+ "negative_row2": "| Analogy/comparison | \"How does this mechanism work in similar projects?\" | External project discussion |",
28
+ "negative_row3": "| Explicit exclusion | \"Help me review the code logic, no need to check standards\" | User exclusion |",
29
+ "negative_row4": "| Closed context | \"That issue has been resolved\" | Issue closed |",
30
+ "conduct_title": "Code of Conduct",
31
+ "conduct_search_first": "**Search before writing**: Before generating code, read the target module documentation in",
32
+ "conduct_search_first_suffix": "to confirm class names, method names, and paths actually exist",
33
+ "conduct_no_fabrication": "**No fabrication**: Do not use classes/methods/constants/paths that don't exist in the project; when uncertain, verify with search tools",
34
+ "conduct_no_new_deps": "**No new dependencies**: Only use third-party libraries listed in",
35
+ "conduct_no_new_deps_suffix": "",
36
+ "conduct_reuse": "**Prioritize existing utilities**: Existing wrappers must be used; do not bypass them to re-implement",
37
+ "conduct_confirm": "**Confirm when uncertain**: Ask the user when encountering gray areas; do not make decisions independently",
38
+ "proactive_title": "Proactive Correction Guidelines",
39
+ "proactive_scan": "**Proactive scanning, not passive waiting**: When touching any source file or rule file, proactively check compliance and rationality rather than waiting for review triggers",
40
+ "proactive_fix": "**Fix when found, don't just report**: When finding rule consistency defects, code compliance violations, or implementation rationality issues, provide specific fix proposals and push for closure, not just list problems",
41
+ "proactive_rules": "**Rules are not infallible**: Rule files themselves may have defects (internal contradictions, omissions, outdated); proactively point these out and propose corrections when found",
42
+ "proactive_closure": "**Correction closure, not forgetting**: Fatal issues must be tracked until fixed; no \"report and forget\"",
43
+ "proactive_confirm": "**User confirmation required for corrections**: Notify the user before executing fixes; user decides whether to proceed; no unconfirmed auto-modifications",
44
+ "proactive_limit": "**Max 5 files per correction round**: To prevent uncontrolled over-modification, correct at most 5 files per round",
45
+ "arch_title": "Architecture Constraints",
46
+ "arch_dep_title": "Module Dependency Direction",
47
+ "arch_comm_title": "Inter-Module Communication",
48
+ "arch_comm_desc": "Use specified mechanism for cross-module communication. Direct imports between business modules are prohibited.",
49
+ "arch_inherit_title": "Inheritance Hierarchy",
50
+ "forbidden_title": "Forbidden Patterns",
51
+ "forbidden_desc": "The following patterns are **strictly prohibited** in project code:",
52
+ "forbidden_table_header": "| # | Forbidden Pattern | Correct Alternative | Reason |",
53
+ "naming_title": "Naming Conventions",
54
+ "naming_resource_title": "Resource Prefixes",
55
+ "naming_class_title": "Class/File Naming",
56
+ "naming_layout_title": "Layout Naming",
57
+ "platform_title": "Specific Rules",
58
+ "ndk_title": "C++ / NDK Specific Rules",
59
+ "ndk_jni_memory_title": "JNI Memory Management",
60
+ "ndk_jni_memory_desc": "JNI layer involves C heap memory and JNI references — both cannot be recovered by GC after leaking. Strictly follow these rules:",
61
+ "ndk_jni_memory_table_header": "| # | Rule | Description |",
62
+ "ndk_jni_memory_row1": "| 1 | GetStringUTFChars must pair with ReleaseStringUTFChars | Ensure release after acquisition; recommend `goto cleanup` pattern for unified release point |",
63
+ "ndk_jni_memory_row2": "| 2 | malloc/calloc/realloc must pair with free | Every malloc must have corresponding free, including all branch paths |",
64
+ "ndk_jni_memory_row3": "| 3 | Local references from NewStringUTF/NewObject should be promptly DeleteLocalRef | Excessive local references can overflow the reference table; clean up unused local refs before function return |",
65
+ "ndk_jni_memory_row4": "| 4 | GetStringUTFChars return value must be null-checked | When returning NULL, cannot be used for string operations; return early or goto cleanup |",
66
+ "ndk_jni_memory_row5": "| 5 | NewGlobalRef must pair with DeleteGlobalRef | Global references must be released when no longer needed; otherwise permanent leak |",
67
+ "ndk_jni_memory_row6": "| 6 | No access to released resources after goto cleanup | After cleanup label: only release and return, never use any released pointer/reference |",
68
+ "ndk_jni_coding_title": "JNI Coding Standards",
69
+ "ndk_jni_coding_table_header": "| # | Rule | Description |",
70
+ "ndk_jni_coding_row1": "| 1 | JNI method signature must match Java native declaration | Parameter types and return types must strictly match; signature errors during registration cause UnsatisfiedLinkError |",
71
+ "ndk_jni_coding_row2": "| 2 | Register native methods in JNI_OnLoad preferred over static binding | Dynamic registration (RegisterNatives) should be done in JNI_OnLoad |",
72
+ "ndk_jni_coding_row3": "| 3 | Do not cache JNIEnv pointer in JNI layer | JNIEnv is thread-local; cross-thread use requires JavaVM->AttachCurrentThread |",
73
+ "ndk_jni_coding_row4": "| 4 | C++ exceptions must not cross JNI boundary | JNI functions must catch all C++ exceptions; no exception propagation to JVM |",
74
+ "ndk_memory_safety_title": "C++ Memory Safety and Optimization",
75
+ "ndk_memory_safety_row1": "No raw pointers for heap memory management | Prefer std::unique_ptr / std::shared_ptr, or project-standard RAII wrappers",
76
+ "ndk_memory_safety_row2": "Array operations must have bounds checking | No unchecked index access to arrays, especially for indices from JNI layer",
77
+ "ndk_memory_safety_row3": "String operations must ensure buffer sufficiency | sprintf/snprintf target buffer must have enough space; prefer snprintf to prevent overflow",
78
+ "ndk_memory_safety_row4": "No returning pointers/references to stack-local variables | Stack memory is invalid after function return; must use heap allocation or value return",
79
+ "ndk_memory_safety_row5": "Large memory allocations should check return value | malloc/calloc/new returns NULL on failure; must handle exceptions",
80
+ "ndk_memory_safety_row6": "Sensitive data must be zeroed after use | Key, token and other sensitive memory regions must be cleared with memset_s/SecureZeroMemory after use",
81
+ "ndk_build_title": "NDK Build Standards",
82
+ "ndk_build_row2": "so library name must match System.loadLibrary parameter | Remove lib prefix and .so suffix",
83
+ "ndk_build_row3": "ABI architectures must cover target devices | Common combination: armeabi-v7a + arm64-v8a, adjust as needed",
84
+ "ndk_build_row4": "NDK path via local.properties ndk.dir | No hardcoding NDK paths in build scripts",
85
+ "ndk_build_row5": "Compiler optimization flags should match build type | Debug uses -O0 -g, Release uses -O2/-O3",
86
+ "ndk_build_row6": "Security compile options must be enabled | -fstack-protector-all, -fvisibility=hidden and other security hardening options",
87
+ "quality_title": "Code Implementation Quality Rules",
88
+ "quality_rules": "- 3+ identical/similar code blocks in the same module must be extracted to a common method\n- No copy-paste coding\n- Prioritize reusing existing classes\n- Singleton pattern consistency (Kotlin lazy(SYNCHRONIZED) / Java inner class holder)",
89
+ "quality_ndk_title": "C++ / NDK Code Quality Rules",
90
+ "quality_ndk_rules": "- 3+ identical/similar code blocks in JNI functions (e.g., package name validation, signature concatenation) must be extracted to C-layer common functions\n- C++ function resource allocation and release must be symmetric; recommend `goto cleanup` unified exit pattern\n- No inline large business logic in JNI functions; split into independent C/C++ functions called by JNI layer\n- Sensitive key arrays should use `__attribute__((section(\".mytext\")))` or equivalent obfuscation protection",
91
+ "checklist_title": "Code Self-Check Checklist",
92
+ "checklist_desc": "After each code change, verify item by item:",
93
+ "checklist_table_header": "| # | Check Item |",
94
+ "checklist_row1": "| 1 | Referenced classes/methods actually exist in the project? |",
95
+ "checklist_row2": "| 2 | Module dependency direction correct? |",
96
+ "checklist_row3": "| 3 | No forbidden pattern usage? |",
97
+ "checklist_row4": "| 4 | No hardcoded route paths/SP keys/colors/dimensions/localized strings? |",
98
+ "checklist_row5": "| 5 | Correct logging tool selection? |",
99
+ "checklist_row6": "| 6 | No duplicate code blocks? |",
100
+ "checklist_rowC1": "| C1 | Proactive correction scan executed? (delegate `proactive-correction` agent) |",
101
+ "checklist_rowC2": "| C2 | Fatal violations found have been fixed and closed? |",
102
+ "checklist_rowC3": "| C3 | Rule self-consistency verified? (must check when touching rule files) |",
103
+ "checklist_ndk_row1": "NDK build config correct (ndk.dir, ABI coverage, security compile options)?",
104
+ "checklist_ndk_row2": "JNI method signatures match Java native methods?",
105
+ "checklist_ndk_row3": "JNI GetStringUTFChars / ReleaseStringUTFChars properly paired?",
106
+ "checklist_ndk_row4": "JNI malloc / free properly paired (including all branch paths)?",
107
+ "checklist_ndk_row5": "JNI GetStringUTFChars return value null-checked?",
108
+ "checklist_ndk_row6": "JNI local references promptly DeleteLocalRef when bulk-created?",
109
+ "checklist_ndk_row7": "JNI NewGlobalRef / DeleteGlobalRef properly paired?",
110
+ "checklist_ndk_row8": "C++ heap memory allocation return value checked?",
111
+ "checklist_ndk_row9": "Sensitive data (keys/tokens) zeroed after use?",
112
+ "checklist_ndk_row10": "C++ exceptions don't cross JNI boundary?",
113
+ "config_title": "Configuration Change Management",
114
+ "config_desc": "Any configuration file modification under",
115
+ "config_desc_suffix": "directory **must**:",
116
+ "config_step1": "Update",
117
+ "config_step1_suffix": "(Keep a Changelog format)",
118
+ "config_step2_prefix": "Bump",
119
+ "config_step2_suffix": "first-line version number",
120
+ "config_version_table_header": "| Change Type | Version Bump |",
121
+ "config_version_row1": "| Architecture-level refactor | X |",
122
+ "config_version_row2": "| Feature change (new rules/skills/hooks/docs) | Y |",
123
+ "config_version_row3": "| Patch (fix/supplement) | Z |",
124
+ "config_scope": "**Scope**:",
125
+ "config_scope_table_header": "| File | Description |",
126
+ "config_scope_entry": "Entry dispatch layer",
127
+ "config_scope_rules": "Rule files",
128
+ "config_scope_skills": "Skill files",
129
+ "config_scope_agents": "Agent configurations",
130
+ "config_scope_hooks": "Hook scripts",
131
+ "config_scope_settings": "Hook/permission configuration",
132
+ "config_scope_references": "Reference documentation",
133
+ "config_scope_scripts": "Utility scripts",
134
+ "conduct_codegraph_search": "**Use codegraph_explore to search the codebase**: Before modifying code, use the codegraph_explore tool to search for relevant classes/methods/symbols and verify they actually exist. Complement with",
135
+ "conduct_codegraph_search_suffix": "for architecture decisions and business conventions",
136
+ "conduct_codegraph_lightweight": "**references/ is in lightweight mode**: Contains only architecture decisions, business logic summaries, and project conventions. Full file lists and directory trees are replaced by CodeGraph's structural exploration capability."
137
+ },
138
+ "conflict_resolution": {
139
+ "title": "Rule Conflict Resolution",
140
+ "desc": "This file defines the priority arbitration mechanism when multiple rules are loaded simultaneously.",
141
+ "desc2": "Each rule file header declares `id`, `domains`, and `priority` via HTML comments.",
142
+ "priority_title": "Priority Principles",
143
+ "priority_1": "**Domain-specific rules override general rules** — narrower domain wins within its territory",
144
+ "priority_2": "**Higher priority value wins within overlapping domains** — only compared when domains overlap",
145
+ "priority_3": "**Rules stack by default, only conflicting items are arbitrated** — non-conflicting parts are all retained",
146
+ "priority_4": "**Conflicts not covered by arbitration table → ask user** — register to this table after confirmation",
147
+ "domain_title": "Current Rule Domain Registration",
148
+ "domain_table_header": "| Rule ID | Priority | Domains |",
149
+ "conflict_table_title": "Known Conflict Arbitration Table",
150
+ "conflict_table_header": "| # | Conflict Scenario | Rule A Guidance | Rule B Guidance | Decision | Reason |",
151
+ "conflict_row1": "| 1 | proactive-correction finds fatal violation vs. code_review only reports | proactive-correction proposes fixes and pushes for closure | code_review only reports | proactive-correction priority | Fatal issues must be closed; reporting alone leaves issues unresolved |",
152
+ "conflict_row2": "| 2 | proactive-correction scans all code vs. arch-review scans only changes | proactive-correction scans all code | arch-review scans only changes | Each does its job | Full-scan and change-introduced violations are different in nature |",
153
+ "conflict_row3": "| 3 | proactive-correction finds rule consistency defect vs. project_rule forbidden patterns | proactive-correction believes rules have gaps/contradictions | project_rule defines current forbidden patterns | project_rule priority, but proactive-correction should record and alert user | Rules are user-defined; agents cannot modify rules, but must proactively remind |",
154
+ "conflict_row4": "| 4 | proactive-correction requests fix vs. user refuses | proactive-correction pushes for fix closure | User chooses not to fix | User decision priority | Corrections require user confirmation; user has right to refuse |",
155
+ "conflict_row5": "| 5 | proactive-correction 5-file limit per round vs. more violations found | proactive-correction limits to 5 files per round | Actually >5 violation files | 5-file limit priority; remaining violations recorded as \"known but not fixed\" | Prevent uncontrolled over-modification; handle in multiple rounds |",
156
+ "conflict_row6": "| 6 | plan_mode correction checkpoint vs. user says \"just do it\" | plan_mode triggers correction scan after each step | User wants to skip checks | User priority, but fatal issues still flagged | User controls workflow pace, but fatal issues cannot be silently ignored |",
157
+ "conflict_row_other": "| — | Others TBD | — | — | — | To be supplemented as project evolves |",
158
+ "registration_title": "New Rule Registration Process",
159
+ "registration_steps": "1. Add `id`, `domains`, `priority` metadata comments to new rule file header\n2. Register in Domain Registration table\n3. Check new rule domains for intersections with existing rules\n4. Identify conflict points and register in arbitration table\n5. Arbitration principle: narrower/more specialized domain rules take priority",
160
+ "registration_step6_prefix": "Add trigger conditions and core constraint summary in",
161
+ "registration_step6_suffix": "",
162
+ "maintenance_title": "Arbitration Table Maintenance",
163
+ "maintenance_rules": "- AI should alert user and record when encountering uncovered conflicts in actual scenarios\n- Arbitration table updates must sync with",
164
+ "maintenance_rules_suffix": "- Arbitration reasons must be stated; no empty entries allowed"
165
+ },
166
+ "arch_review": {
167
+ "description": "Architecture compliance review expert. Detects module dependency direction violations, forbidden pattern usage, cross-module communication compliance.",
168
+ "title": "Architecture Compliance Review Agent",
169
+ "intro": "You are a review expert focused on architecture compliance for the",
170
+ "intro_suffix": "project.",
171
+ "dimension_title": "Review Dimensions",
172
+ "dep_title": "Module Dependency Direction",
173
+ "dep_check_title": "Check principles:",
174
+ "dep_check_method": "Check method:\n- In changed file import statements, confirm each imported package's module exists in current module's dependency configuration\n- Search for reverse dependencies",
175
+ "forbidden_title": "Forbidden Pattern Detection",
176
+ "forbidden_desc": "Scan changed code item by item:",
177
+ "forbidden_table_header": "| Forbidden Pattern | Search Pattern | Should Replace With |",
178
+ "comm_title": "Cross-Module Communication Compliance",
179
+ "comm_desc": "When changes involve inter-module calls, confirm compliant communication method is used:",
180
+ "inherit_title": "Inheritance Hierarchy",
181
+ "inherit_check_rules": "Check rules:\n- Search extends/implements/: statements\n- Verify business classes inherit the correct Base class\n- Check custom Views provide required constructors",
182
+ "inherit_check_method_title": "Check method:",
183
+ "inherit_check_method_steps": "1. Search `class XXX extends` / `class XXX :` statements\n2. Extract inherited parent class name\n3. Compare against inheritance requirements defined in INHERITANCE_RULES\n4. List classes that do not comply with inheritance rules",
184
+ "interface_isolation_title": "Interface Isolation Check",
185
+ "interface_isolation_rules": "Check rules:\n- Cross-module dependencies should only expose public interface/contract\n- Internal implementation classes must not be exposed\n- Module internals should use internal/private access restriction",
186
+ "interface_isolation_method_title": "Check method:",
187
+ "interface_isolation_method_steps": "1. Identify module ownership of changed files\n2. Check if imported classes belong to the target module's public API\n3. If non-public classes are imported, flag as violation",
188
+ "cycle_detection_title": "Circular Dependency Detection",
189
+ "cycle_detection_method_title": "Check method:",
190
+ "cycle_detection_method_steps": "1. Collect all import statements from changed files and their module\n2. Build module-level dependency graph (Module A imports from Module B \u2192 A depends on B)\n3. Use DFS to detect cycles\n4. Output violation paths (e.g.: A \u2192 B \u2192 C \u2192 A)\n5. Mark specific import statements involved in each cycle (file:line)",
191
+ "output_title": "Output Format",
192
+ "output_scope": "Review scope",
193
+ "output_scope_value": "Changed file list",
194
+ "output_result": "Review result",
195
+ "output_pass": "Pass",
196
+ "output_warning": "Warnings",
197
+ "output_violation": "Violations",
198
+ "output_violation_section": "Violations (Must Fix)",
199
+ "output_col_file": "File:Line",
200
+ "output_col_type": "Violation Type",
201
+ "output_col_issue": "Issue",
202
+ "output_col_fix": "Fix Suggestion",
203
+ "output_passed_section": "Passed Items",
204
+ "output_dep_ok": "Module dependency direction correct",
205
+ "output_forbidden_ok": "No forbidden pattern usage",
206
+ "constraints_title": "Constraints",
207
+ "must_do_title": "**Must do**:",
208
+ "must_do_rules": "- Each violation must specify exact file and line number\n- Each violation must provide clear fix suggestions\n- Checks must be based on real import statements and code content",
209
+ "must_not_title": "**Must not do**:",
210
+ "must_not_rules": "- No code modification (read-only review)\n- No review comments on non-changed files (unless changes introduce impact)\n- No reporting of known legacy issues"
211
+ },
212
+ "resource_sync": {
213
+ "description": "Resource file sync verification expert. Checks resource consistency across all directories and naming prefix compliance.",
214
+ "title": "Resource File Sync Verification Agent",
215
+ "output_title": "Output Format",
216
+ "output_scope": "Review scope",
217
+ "output_scope_value": "Resource files involved",
218
+ "output_result": "Review result",
219
+ "output_pass": "All synced",
220
+ "output_fail": "Missing items",
221
+ "output_missing_section": "Missing Items",
222
+ "output_col_name": "Resource Name",
223
+ "output_col_type": "Type",
224
+ "output_col_exists": "Exists In",
225
+ "output_col_missing": "Missing In",
226
+ "output_naming_section": "Naming Convention Issues",
227
+ "output_col_file": "File",
228
+ "output_col_issue": "Issue",
229
+ "output_col_suggestion": "Suggestion",
230
+ "output_passed_section": "Passed Items",
231
+ "constraints_title": "Constraints",
232
+ "constraints": "- No file modification (read-only check)\n- Must list specific missing directory paths"
233
+ },
234
+ "code_review": {
235
+ "description": "Automated post-generation code review skill. Checks new/modified code against project standards.",
236
+ "title": "Code Review — Post-Generation Review",
237
+ "trigger_title": "**Trigger conditions** (any one):",
238
+ "trigger_1": "Completed multi-file code generation",
239
+ "trigger_2": "Completed code modification involving architecture boundaries",
240
+ "trigger_3": "User explicitly requests \"review / check\"",
241
+ "trigger_4": "`plan_mode` plan execution completed",
242
+ "skip": "**Skip conditions**: Single-line changes, pure config file changes, user says \"no review needed\".",
243
+ "checklist_title": "Review Checklist",
244
+ "fatal_title": "❌ Fatal (Blocking issues, must fix)",
245
+ "fatal_row1": "Module dependency direction violation | Whether imported package's module is in build config dependencies",
246
+ "fatal_row2": "Forbidden pattern usage | Search for patterns listed in project_rule.md §3",
247
+ "fatal_row3": "Incomplete route registration (if applicable) | Whether new page completed all registration steps",
248
+ "fatal_row4": "Main thread network request (if applicable) | Whether network callback is on IO thread",
249
+ "fatal_row5": "Inheritance hierarchy error | Whether new Activity/ViewController inherits correct base class",
250
+ "fatal_row6": "Hardcoded keys/privacy data | Whether plaintext keys appear in code",
251
+ "fatal_ndk1": "JNI method signature mismatch | Whether native method and C++ JNI function signatures match (param types, return value, method name)",
252
+ "fatal_ndk2": "JNI memory leak — GetStringUTFChars not released | Search GetStringUTFChars calls, confirm each path has corresponding ReleaseStringUTFChars",
253
+ "fatal_ndk3": "JNI memory leak — malloc not freed | Search malloc/calloc/realloc, confirm each branch path has corresponding free",
254
+ "fatal_ndk4": "JNI memory leak — GlobalRef not released | Search NewGlobalRef, confirm DeleteGlobalRef when no longer used",
255
+ "fatal_ndk5": "C++ exception crossing JNI boundary | Whether JNI function entry/exit has try-catch protection",
256
+ "fatal_ndk6": "NDK build path error | Whether ndk-build path and so output path are correct",
257
+ "warning_title": "⚠️ Warning (Should fix, not blocking)",
258
+ "warning_row7": "Hardcoded strings/colors/dimensions | Whether code directly contains string/color/dp/sp values",
259
+ "warning_row8": "Not using project wrapper utilities | Whether bypassing existing wrappers to call low-level APIs directly",
260
+ "warning_row9": "JSON parsing without try-catch (if applicable) | Whether parse calls are wrapped in exception handling",
261
+ "warning_row10": "Resource files not synced across all directories | Whether new resources exist in all adaptation directories",
262
+ "warning_ndk1": "JNI GetStringUTFChars return value not null-checked | Continuing operation when NULL causes NPE crash",
263
+ "warning_ndk2": "JNI local reference not promptly deleted | Bulk-creating local refs in loops without DeleteLocalRef may overflow reference table",
264
+ "warning_ndk3": "C++ heap memory allocation return value not checked | malloc/calloc/new returns NULL on failure, no null-check",
265
+ "warning_ndk4": "Sensitive data not cleared after use | Key/token memory regions not memset-cleared after use",
266
+ "warning_ndk5": "snprintf buffer size insufficient | Whether format output target buffer has enough space",
267
+ "suggestion_title": "💡 Suggestion (Optional optimization)",
268
+ "suggestion_row11": "Logging tool selection | Whether using correct priority logging tool",
269
+ "suggestion_row12": "Weak reference pattern | Whether Activity/ViewController references in callbacks use weak references",
270
+ "suggestion_row13": "Singleton thread safety | Whether new singleton uses thread-safe initialization",
271
+ "suggestion_row14": "Code reuse | Whether similar code blocks have been extracted",
272
+ "suggestion_ndk1": "C++ raw pointers managing heap memory | Recommend std::unique_ptr / std::shared_ptr or RAII wrappers",
273
+ "suggestion_ndk2": "JNI function inlining large business logic | Recommend splitting into independent C/C++ functions, JNI layer only bridges",
274
+ "suggestion_ndk3": "JNI goto cleanup unified exit pattern | Recommend goto cleanup unified release point when multiple resource allocations",
275
+ "suggestion_ndk4": "C++ duplicate code block extraction | Whether identical/similar logic in JNI functions extracted to common C functions",
276
+ "suggestion_ndk5": "NDK security compile options | Whether -fstack-protector-all, -fvisibility=hidden etc. security options enabled",
277
+ "output_title": "Review Output Format",
278
+ "output_scope": "Review scope",
279
+ "output_scope_value": "Changed file list",
280
+ "output_result": "Overall result",
281
+ "output_pass": "Pass",
282
+ "output_warnings": "warnings",
283
+ "output_fatals": "fatal",
284
+ "output_fatal_section": "Fatal Issues",
285
+ "output_issue": "Issue",
286
+ "output_issue_title": "Title",
287
+ "output_location": "Location",
288
+ "output_violated_rule": "Violated rule",
289
+ "output_current_code": "Current code",
290
+ "output_fix": "Fix proposal",
291
+ "output_warning_section": "Warnings",
292
+ "output_suggestion_section": "Optimization Suggestions",
293
+ "output_passed_section": "Verified Passed",
294
+ "flow_title": "Review Flow",
295
+ "flow_content": "Code generation completed\n ↓\n[Step 0] Pre-review correction check — proactively scan modified files for existing compliance\n │ (Delegate proactive-correction agent for Dimension 2 scan)\n │ ├─ Fatal violations found ──→ Fix immediately before entering review\n │ └─ No fatal violations ──→ Enter formal review\n ↓\n[Step 1] Collect changed file list\n ↓\n[Step 2] Check item by item in fatal → warning → suggestion order\n ↓\n[Step 3] Output review report\n ↓\n┌── ❌ Fatal issues ──→ Inform user, provide fix proposals\n│ After fix, trigger proactive-correction to verify fix effectiveness\n└── ✅/⚠️ ──→ Output report, continue subsequent tasks",
296
+ "collab_title": "SubAgent Collaboration",
297
+ "collab_proactive": "**Pre-review correction** → Delegate `proactive-correction` agent (scan modified files for existing compliance before review, verify fix effectiveness after review)",
298
+ "collab_arch": "**Architecture compliance** → Delegate `arch-review` agent",
299
+ "collab_resource": "**Resource sync** → Delegate `resource-sync` agent",
300
+ "collab_cpp": "**C++ memory safety** → Delegate `cpp-memory-review` agent (auto-triggered when changes involve .cpp/.h/.c files)",
301
+ "collab_timing_prefix": "Delegation timing: Pre-review correction is mandatory; others triggered when changes involve",
302
+ "collab_timing_suffix": "+ modules, or resource files",
303
+ "collab_timing_ndk": ", or C++/NDK code"
304
+ },
305
+ "plan_mode": {
306
+ "description": "Structured decomposition skill for complex development tasks. Outputs step-by-step plans before execution when tasks involve multi-module collaboration or multi-step operations.",
307
+ "title": "Plan Mode — Structured Task Decomposition",
308
+ "trigger_title": "**Trigger conditions** (any one):",
309
+ "trigger_1": "Involves collaboration across 2+ modules",
310
+ "trigger_2": "Requires modifying 3+ files",
311
+ "trigger_3": "Involves multi-step flows like route registration, resource sync",
312
+ "trigger_4": "User explicitly requests \"plan first / plan / decompose task\"",
313
+ "skip": "**Skip conditions**: Single-file simple modifications, user says \"just do it\", pure Q&A.",
314
+ "plan_output_title": "Plan Output Format",
315
+ "plan_output_header": "📋 Execution Plan",
316
+ "plan_output_task": "Task",
317
+ "plan_output_task_desc": "One-line description",
318
+ "plan_output_modules": "Modules involved",
319
+ "plan_output_modules_list": "Module list",
320
+ "plan_output_files": "Estimated files to modify",
321
+ "plan_output_rules": "Rules/skills to load",
322
+ "plan_output_rules_list": "List",
323
+ "plan_output_steps": "Step Breakdown",
324
+ "plan_output_col_action": "Action",
325
+ "plan_output_col_target": "Target File/Location",
326
+ "plan_output_col_dep": "Dependency",
327
+ "plan_output_col_check": "Checkpoint",
328
+ "plan_output_risks": "Risk Points",
329
+ "plan_output_done_criteria": "Completion Criteria",
330
+ "task_templates_title": "High-Frequency Task Templates",
331
+ "ndk_templates_title": "C++ / NDK High-Frequency Task Templates",
332
+ "ndk_new_jni_title": "New JNI Method",
333
+ "ndk_new_jni_content": "## 📋 Execution Plan\n\n**Task**: Add new JNI native method\n**Modules involved**: [Java module] + [JNI layer]\n**Estimated files to modify**: 3-4\n**Rules/skills to load**: project_rule + code_review\n\n### Step Breakdown\n\n| # | Action | Target File/Location | Dependency | Checkpoint |\n|---|------|-------------|------|--------|\n| 1 | Declare native method in Java class | `XXJavaClass.java` | None | Method signature confirmed |\n| 2 | Implement JNI function in C++ layer | `jni/com_xxx.cpp` | Step 1 | JNI signature matches Java |\n| 3 | Register native method (dynamic) or generate header (static) | `JNI_OnLoad` or `.h` file | Step 2 | RegisterNatives signature matches |\n| 4 | If new C++ source file, update Android.mk/CMakeLists.txt | `Android.mk` | Step 2 | LOCAL_SRC_FILES includes new file |\n\n### ⚠️ Risk Points\n- JNI signature mismatch causing UnsatisfiedLinkError\n- Memory leak (GetStringUTFChars not released, malloc not freed)\n- Thread safety issue (JNIEnv cannot be cached cross-thread)\n\n### ✅ Completion Criteria\n- Java calling native method returns expected result\n- valgrind/ASan reports no memory leaks\n- ndk-build compiles successfully, so output correct",
334
+ "ndk_new_sign_title": "New Encryption Signature Method",
335
+ "ndk_new_sign_content": "## 📋 Execution Plan\n\n**Task**: Add new encryption signature method\n**Modules involved**: [Java bridge class] + [JNI layer] + [Key management]\n**Estimated files to modify**: 3-5\n**Rules/skills to load**: project_rule + code_review + cpp-memory-review\n\n### Step Breakdown\n\n| # | Action | Target File/Location | Dependency | Checkpoint |\n|---|------|-------------|------|--------|\n| 1 | Add key to C++ key array | `com_xxx_encryptor.cpp` | None | Key array length matches index |\n| 2 | Implement signature generation C function | `com_xxx_encryptor.cpp` | Step 1 | malloc/free paired, sensitive data cleared |\n| 3 | Add JNI bridge function | `com_xxx_encryptor.cpp` | Step 2 | JNI signature matches |\n| 4 | Declare native method in Java layer | `XXEncryptor.java` | Step 3 | Method signature matches JNI |\n| 5 | Update JNI registration table | `g_methods[]` or `JNI_OnLoad` | Step 3 | New method registered |\n\n### ⚠️ Risk Points\n- Hardcoded keys can be reverse-engineered (needs obfuscation protection)\n- Signature concatenation buffer overflow\n- Package name validation omission allowing unauthorized access\n\n### ✅ Completion Criteria\n- Signature generation result matches expected\n- No memory leaks (malloc/free paired)\n- Sensitive data cleared after use",
336
+ "ndk_update_whitelist_title": "Update Key Whitelist",
337
+ "ndk_update_whitelist_content": "## 📋 Execution Plan\n\n**Task**: Update package name whitelist / key table\n**Modules involved**: [JNI layer]\n**Estimated files to modify**: 1-2\n**Rules/skills to load**: project_rule + code_review\n\n### Step Breakdown\n\n| # | Action | Target File/Location | Dependency | Checkpoint |\n|---|------|-------------|------|--------|\n| 1 | Add new package name to whitelist array | `comparePackage` function | None | NewStringUTF + jstringCompare paired |\n| 2 | Add new key to key array | `sign_key_array_xx[]` | None | Array index range matches rand%N |\n| 3 | Verify signature flow integrity | Call chain | Step 1+2 | New package + new key signature correct |\n\n### ⚠️ Risk Points\n- New package name missing jstringCompare causing validation failure\n- Key array length changed but rand upper limit not updated\n- NewStringUTF created jstring not DeleteLocalRef'd\n\n### ✅ Completion Criteria\n- New package name passes validation\n- Signature generation correct\n- No JNI local reference leaks",
338
+ "principles_title": "Execution Principles",
339
+ "principles": "1. **Output plan first, wait for user confirmation before executing** (unless user says \"just do it\")\n2. **Strict sequential execution when steps have dependencies**, parallel when independent\n3. **Verify checkpoint after each step**; stop and explain if not passed\n4. **Correction checkpoint after each step** — delegate `proactive-correction` agent for dimension 2 (code compliance) scan on modified files; pause and fix immediately if fatal violations found\n5. **Pause and ask when encountering gray areas**\n6. **Plan is iterative**: Update plan and notify user when new situations arise during execution\n7. **Correction closure**: After all steps complete, final trigger of `proactive-correction` for dimension 2+3 scan on all changes to ensure no remaining issues",
340
+ "collab_title": "Collaboration with Other Rules/Skills",
341
+ "collab_table_header": "| Task Scenario | Additional Rules to Load |",
342
+ "collab_new_page": "| New page | `project_rule` (+ focus rules if applicable) + `proactive-correction` |",
343
+ "collab_perf": "| Performance fix | `project_rule` + `proactive-correction` |",
344
+ "collab_cross_module": "| Cross-module communication | `project_rule` (focus on dependency direction) + `proactive-correction` |",
345
+ "collab_post_gen": "| Post-code generation | Auto-trigger `code_review` (with pre-review correction check) |",
346
+ "collab_ndk_new_jni": "New JNI method | `project_rule` (focus on JNI memory management §5.N) + `proactive-correction` + `cpp-memory-review`",
347
+ "collab_ndk_new_sign": "New encryption signature | `project_rule` + `code_review` + `proactive-correction` + `cpp-memory-review`",
348
+ "collab_ndk_update_whitelist": "Update key whitelist | `project_rule` (focus on package validation completeness) + `proactive-correction`",
349
+ "collab_ndk_memory_opt": "C++ memory optimization | `project_rule` + `proactive-correction` + `cpp-memory-review`",
350
+ "checkpoint_note": "**Correction checkpoint explanation**: After each plan_mode step execution, add a **proactive correction check** — delegate `proactive-correction` agent for dimension 2 scan on modified files to ensure each step's output complies with project rules. This supplements code_review, preventing issues from accumulating until final review."
351
+ },
352
+ "proactive_correction": {
353
+ "description": "Proactive error correction expert. Scans rule self-consistency, existing code compliance, implementation rationality; proposes fixes and pushes for closure.",
354
+ "title": "Proactive Correction Agent",
355
+ "intro": "You are an expert focused on **proactive error correction** for this project. Unlike passive review, your core responsibility is to **proactively discover and correct** three types of issues: rule self-consistency defects, existing code compliance violations, and implementation rationality deviations. You don't wait for code changes to trigger review — you proactively scan, diagnose, and push for fix closure.",
356
+ "core_principles_title": "Core Principles",
357
+ "principle_1": "**Proactive, not passive** — Don't wait for code changes; proactively scan when touching any source/rule files",
358
+ "principle_2": "**Fix, not just report** — When issues are found, provide specific executable fix proposals and push for user confirmation",
359
+ "principle_3": "**Self-critical, not blindly trusting** — Rule files themselves may have defects; must check rule self-consistency",
360
+ "principle_4": "**Closure, not forgetting** — Issues must be tracked until fixed; no \"report and forget\"",
361
+ "dimensions_title": "Correction Dimensions",
362
+ "dim1_title": "Dimension 1: Rule Self-Consistency Check",
363
+ "dim1_desc": "Check project rule files (project_rule.md, conflict_resolution.md, etc.) for internal consistency and completeness:",
364
+ "dim1_table_header": "| # | Check Item | Check Method | Consistency Standard |",
365
+ "dim1_row1": "| 1 | Forbidden pattern table internal conflicts | Compare each rule in §3 forbidden pattern table item by item | Same code pattern should not be simultaneously \"forbidden\" and \"should use\" by two rules; \"correct alternative\" column should not reference another forbidden pattern |",
366
+ "dim1_row2": "| 2 | Naming convention coverage completeness | Scan all class/file/resource names in source code | Naming patterns in source code must be covered by naming conventions; uncovered naming styles indicate rule gaps |",
367
+ "dim1_row3": "| 3 | Dependency rules match actual module structure | Compare §2 dependency rules with actual dependencies in build.gradle/settings.gradle | Declared dependency directions must match actual dependency config; dependencies existing but not declared indicate rule defects |",
368
+ "dim1_row4": "| 4 | Self-check checklist vs. rule entries coverage | Compare §7 self-check checklist with each rule in §1-§6 | Each key rule should have corresponding self-check item; missing items indicate incomplete checklist |",
369
+ "dim1_row5": "| 5 | Platform rules match build environment parameters | Compare §5 platform rules with version/SDK versions in build environment table | SDK/API versions referenced in rules must match build environment parameters; mismatches indicate outdated rules or unupdated params |",
370
+ "dim1_row6": "| 6 | Conflict arbitration table coverage | Check entries in conflict arbitration table in conflict_resolution.md | Known potential conflicts between rules must have arbitration entries; empty or insufficient entries indicate inadequate coverage |",
371
+ "dim1_row7": "| 7 | Terminology consistency across rules | Check if terminology used across rule files is consistent | Same concept should use same terminology across different rule files |",
372
+ "dim1_action": "**Correction action**: When rule self-consistency issues are found:",
373
+ "dim1_action_step1": "Clearly identify defect location (which rule/which paragraph)",
374
+ "dim1_action_step2": "Provide specific correction content (corrected rule text snippet)",
375
+ "dim1_action_step3": "Remind user to update",
376
+ "dim1_action_step3_suffix": "and bump version number",
377
+ "consistency_types_title": "Rule Self-Consistency Detection Standards",
378
+ "type1_title": "Type 1: Direct Conflict",
379
+ "type1_def": "**Definition**: Two rules give opposite instructions for the same behavior",
380
+ "type1_example": "**Example**: Forbid Intent vs. Force ARouter but route redirect uses Intent",
381
+ "type1_method": "**Detection method**: Two rules give opposite instructions for the same behavior",
382
+ "type1_fix": "**Fix method**: Trigger arbitration process in conflict_resolution.md",
383
+ "type2_title": "Type 2: Outdated Rule",
384
+ "type2_def": "**Definition**: The tech stack referenced by the rule has changed",
385
+ "type2_example": "**Example**: Rule requires Java but code has migrated to Kotlin",
386
+ "type2_method": "**Detection method**: Scan recent commits, check for tech stack changes referenced by rules",
387
+ "type2_fix": "**Fix method**: Propose rule update, obtain user confirmation",
388
+ "type3_title": "Type 3: Insufficient Coverage",
389
+ "type3_def": "**Definition**: Code patterns exist but no corresponding rule covers them",
390
+ "type3_example": "**Example**: Service classes exist but rules have no Service specification",
391
+ "type3_method": "**Detection method**: Code patterns detected but no corresponding rule clause exists",
392
+ "type3_fix": "**Fix method**: Suggest adding rules, let user decide",
393
+ "dim2_title": "Dimension 2: Existing Code Compliance Scan",
394
+ "dim2_desc": "Scan **existing code** for violations against the project's own defined rules (not just changed code):",
395
+ "dim2_table_header": "| # | Check Item | Search Pattern | Compliance Standard |",
396
+ "dim2_row1": "| 1 | Forbidden pattern existing usage | Search all source code against §3 forbidden pattern table | Code containing forbidden patterns is a violation, regardless of whether introduced by current changes |",
397
+ "dim2_row2": "| 2 | Naming convention existing violations | Check all class/layout file/resource file names | Class names not conforming to prefix conventions, layout files not conforming to prefix conventions |",
398
+ "dim2_row3": "| 3 | Hardcoded strings/colors/dimensions | Search for hardcoded values in source code and layout XML | Direct strings/color values/dp/sp values in Java/Kotlin code (should use resource references) |",
399
+ "dim2_row4": "| 4 | Hardcoded keys/privacy data | Search for plaintext keys/tokens/passwords/sign | Plaintext keys in code are severe violations; must move to JNI layer or secure storage |",
400
+ "dim2_row5": "| 5 | Dependency direction existing violations | Check import statements across all modules | Low-level modules importing high-level module classes is reverse dependency violation |",
401
+ "dim2_row6": "| 6 | Bypassing project wrappers to call low-level APIs directly | Search for low-level API call patterns | Code directly calling low-level APIs when project wrappers exist |",
402
+ "dim2_row7": "| 7 | Duplicate code blocks | Search for identical/similar code snippets in same module | 3+ identical/similar code blocks not extracted to common method |",
403
+ "dim2_row8": "| 8 | Main thread network/IO operations | Search for network/IO call patterns | Network requests/file IO executing on main thread |",
404
+ "dim2_ndk_row1": "| N1 | JNI signature existing inconsistencies | Compare Java native declarations with C++ JNI function signatures | Java native method parameters/return values not matching JNI implementation |",
405
+ "dim2_ndk_row2": "| N2 | JNI memory management existing violations | Search GetStringUTFChars/malloc/NewGlobalRef | Acquisition/allocation operations missing corresponding release on any code path |",
406
+ "dim2_ndk_row3": "| N3 | C++ secure coding existing violations | Search sprintf/raw pointers/unchecked return values | Using unsafe C functions, raw pointers managing heap memory, unchecked malloc return values |",
407
+ "dim2_action": "**Correction action**: When existing code violations are found:",
408
+ "dim2_action_step1": "List specific files and line numbers of violations",
409
+ "dim2_action_step2": "Provide fix proposals (including corrected code snippets)",
410
+ "dim2_action_step3": "Classify by severity: ❌ Fatal (must fix immediately) / ⚠️ Important (should fix soon) / 💡 Suggestion (optional optimization)",
411
+ "dim2_action_step4": "Ask user whether to execute fixes; proceed with corrections after confirmation",
412
+ "dim3_title": "Dimension 3: Implementation Rationality Analysis",
413
+ "dim3_desc": "Detect **clearly unreasonable** aspects in code implementation, even if they don't violate explicit rule entries:",
414
+ "dim3_table_header": "| # | Check Item | Check Method | Rationality Standard |",
415
+ "dim3_row1": "| 1 | Dead code/unused classes/methods | Search for public classes/methods not referenced by any code | Public classes/methods with no callers, no route targets, no reflection references |",
416
+ "dim3_row2": "| 2 | God Class (overloaded responsibilities) | Check class method count and responsibility scope | Single class with 15+ public methods or spanning 3+ responsibility domains |",
417
+ "dim3_row3": "| 3 | Overly long methods/functions | Count method/function lines | Methods over 50 lines (Java/Kotlin) or 30 lines (JNI C++) |",
418
+ "dim3_row4": "| 4 | Deep nesting | Check if/for/try nesting levels | Nesting over 4 levels should be refactored to extracted methods or guard clauses |",
419
+ "dim3_row5": "| 5 | Singleton thread safety hazards | Check singleton initialization methods | Non-thread-safe lazy initialization (DCL without volatile) |",
420
+ "dim3_row6": "| 6 | Resource leak hazards | Search Stream/Connection/Cursor usage patterns | Missing close/release on any exit path after open |",
421
+ "dim3_row7": "| 7 | Exception swallowing | Search for empty catch blocks | catch (Exception e) {} is exception swallowing; should at least log |",
422
+ "dim3_row8": "| 8 | Overly coupled hardcoded constants | Search for magic numbers and hardcoded config values | Direct number constants/URLs/timeout values instead of config or constant classes |",
423
+ "dim3_ndk_row4": "| N4 | JNI layer business logic overload | Check business logic ratio in JNI function bodies | JNI functions containing >30% business logic (not just type conversion + C function calls) |",
424
+ "dim3_ndk_row5": "| N5 | C++ goto cleanup missing | Check exit patterns for multi-resource allocation functions | Functions allocating 2+ resources without goto cleanup/RAII unified exit |",
425
+ "dim3_action": "**Correction action**: When implementation rationality issues are found:",
426
+ "dim3_action_step1": "Explain why it's unreasonable (which design principles/best practices are violated)",
427
+ "dim3_action_step2": "Provide refactoring proposal (including refactored code snippet)",
428
+ "dim3_action_step3": "Note impact scope (whether modifying this will affect other code)",
429
+ "dim3_action_step4": "Ask user whether to execute refactoring; proceed after confirmation",
430
+ "impl_checklist_title": "Implementation Rationality Detection Checklist (Quantifiable)",
431
+ "impl_checklist_header": "| # | Deviation Type | Detection Method | Threshold | Fix Suggestion |",
432
+ "impl_checklist_row1": "| 1 | Excessive nesting | Search code blocks with indentation ≥ 4 levels | 4 levels | Use early return or extract method |",
433
+ "impl_checklist_row2": "| 2 | Overly long method | Count method/function lines | >100 lines | Decompose into sub-methods |",
434
+ "impl_checklist_row3": "| 3 | Orphan utility class | Search Util/Helper classes, verify references | 0 references | Determine if dead code |",
435
+ "impl_checklist_row4": "| 4 | Duplicate logic blocks | Similar code block detection | ≥3 occurrences | Extract common method |",
436
+ "impl_checklist_row5": "| 5 | God Class | Class method count | >20 methods | Split responsibilities |",
437
+ "impl_checklist_row6": "| 6 | Overly long parameter list | Function parameter count | >5 parameters | Use parameter object |",
438
+ "trigger_title": "Trigger Conditions",
439
+ "trigger_desc": "**Proactive triggers** (any one triggers a scan):",
440
+ "trigger_1": "**Touching source files** — When reading/analyzing/modifying any project source file, proactively check that file and related files for compliance and rationality",
441
+ "trigger_2": "**Touching rule files** — When reading/modifying project_rule.md or other rule files, proactively check rule self-consistency",
442
+ "trigger_3": "**plan_mode checkpoints** — After each plan_mode step, proactively check modified files for compliance (as code_review pre-check)",
443
+ "trigger_4": "**After code_review** — After code_review completes, proactively verify fix effectiveness for issues noted in review report",
444
+ "trigger_5": "**User explicitly requests** — User requests \"correction / fix issues / scan violations\"",
445
+ "skip_title": "**Skip conditions**:",
446
+ "skip_conditions": "- Casual chat / general knowledge Q&A\n- User explicitly says \"no correction needed / skip correction\"\n- Negative context (issue closed / already fixed)",
447
+ "flow_title": "Correction Flow",
448
+ "flow_content": "[Trigger] Touching source/rule files / plan_mode checkpoint / post-code_review / user request\n ↓\n[Step 1] Determine scan scope:\n ├─ Touching rule files → Execute Dimension 1 (rule self-consistency) scan\n ├─ Touching source files → Execute Dimension 2 (code compliance) + Dimension 3 (implementation rationality) scan\n ├─ plan_mode checkpoint → Execute Dimension 2 (modified files) scan\n └─ Post-code_review → Execute Dimension 2 (fix verification) scan\n ↓\n[Step 2] Execute scan, check item by item per dimension\n ↓\n[Step 3] Classify issues:\n ├─ ❌ Fatal — Must fix immediately (hardcoded keys, dependency direction violations, JNI signature mismatches)\n ├─ ⚠️ Important — Should fix soon (naming violations, hardcoded strings, memory leak hazards)\n └─ 💡 Improvement — Optional optimization (dead code, long methods, deep nesting)\n ↓\n[Step 4] Output correction report (with specific fix proposals)\n ↓\n[Step 5] Ask user whether to execute fixes\n ├─ User confirms → Execute fixes + verify fix effectiveness + update CHANGELOG (if rule files modified)\n └─ User refuses → Record issues as \"known but not fixed\"; prompt again on next trigger\n ↓\n[Step 6] Fix closure: Confirm all ❌ fatal issues fixed, ⚠️ important issues have handling plan",
449
+ "report_title": "Correction Report Format",
450
+ "report_content": "## 🔧 Proactive Correction Report\n\n**Trigger reason**: [Touching source/rule files / plan_mode checkpoint / post-code_review / user request]\n**Scan scope**: [Files/rule entries involved]\n**Scan result**: ✅ No issues / ⚠️ N items to fix / ❌ N fatal issues\n\n### ❌ Fatal Issues (Must Fix Immediately)\n\n**Issue 1**: [Title]\n- **Dimension**: [Rule self-consistency / Code compliance / Implementation rationality]\n- **Location**: `file_path:line` or `rule_entry:paragraph`\n- **Violated rule**: [Corresponding rule entry / design principle]\n- **Current code/rule**: `Violation snippet`\n- **Fix proposal**: `Corrected snippet`\n- **Impact scope**: [Modification impact assessment]\n\n### ⚠️ Important Issues (Should Fix Soon)\n\n### 💡 Improvement Suggestions (Optional)\n\n### ✅ Verified Items\n\n### 📊 Correction Statistics\n\n| Dimension | Scanned | Fatal | Important | Improvement | Passed |\n|-----------|---------|-------|-----------|-------------|--------|\n| Rule self-consistency | N | N | N | N | N |\n| Code compliance | N | N | N | N | N |\n| Implementation rationality | N | N | N | N | N |",
451
+ "collab_title": "Collaboration with Other Components",
452
+ "collab_table_header": "| Collaborator | Collaboration Method |",
453
+ "collab_row_project_rule": "| `project_rule` | Dimension 1 scans rule self-consistency; Dimension 2 scans code compliance with rules; prompt CHANGELOG update after rule file corrections |",
454
+ "collab_row_code_review": "| `code_review` | Execute Dimension 2 scan as pre-check **before** code_review; verify fix effectiveness **after** code_review |",
455
+ "collab_row_plan_mode": "| `plan_mode` | Trigger Dimension 2 scan on modified files at each step's checkpoint |",
456
+ "collab_row_arch_review": "| `arch-review` | Dimension 2 dependency direction violation scan complements arch-review — proactive-correction scans all, arch-review scans only changes |",
457
+ "collab_row_resource_sync": "| `resource-sync` | Dimension 2 resource naming violations complement resource-sync |",
458
+ "collab_row_cpp_memory": "| `cpp-memory-review` | Dimension 2 NDK-related violations complement cpp-memory-review — proactive-correction scans all, cpp-memory-review scans only changes |",
459
+ "key_distinction_title": "**Key distinction**:",
460
+ "key_distinction_proactive": "**proactive-correction**: Proactively scans all code + proactively corrects + can execute fixes",
461
+ "key_distinction_others": "**code_review / arch-review / resource-sync**: Passively scans changed code + read-only reports + does not execute fixes",
462
+ "constraints_title": "Constraints",
463
+ "must_do_title": "**Must do**:",
464
+ "must_do_rules": "- Each issue must specify exact file and line number (code violations) or specific rule entry (rule defects)\n- Each issue must provide executable fix proposal (including corrected code/rule text snippet)\n- Fatal issues must be proactively presented to user with fix request; not just reported and shelved\n- After correcting rule files, must prompt user to update CHANGELOG and bump version number\n- Dimension 2 scan results must be cross-referenced with project_rule.md §3 forbidden pattern table item by item",
465
+ "must_not_title": "**Must not do**:",
466
+ "must_not_rules": "- No executing fixes without user confirmation (even fatal issues must first inform user, let user decide)\n- No correction comments on code outside the current project\n- No fabricating non-existent violations \u2014 each violation must have search-tool-verified evidence\n- No modifying more than 5 files in a single correction round (prevent uncontrolled over-modification)\n- No classifying reasonable legacy code as violations \u2014 if the project tolerates a pattern, respect the project convention",
467
+ "multi_round_title": "Multi-Round Processing Mechanism",
468
+ "multi_round_desc": "When pending files exceed single-round limit, enable multi-round processing to ensure correction quality and controllability.",
469
+ "multi_round_limit": "**Single-round limit**: Process at most 5 files per round; automatically enter multi-round mode when exceeded.",
470
+ "multi_round_overflow": "**Overflow handling**: Output pending list when exceeded, marked by priority P1 (fatal) / P2 (important) / P3 (improvement).",
471
+ "multi_round_output_title": "**Pending list output format**:",
472
+ "multi_round_output_example": "## \ud83d\udccb Pending List\n\n| # | File | Priority | Issue Summary | Status |\n|---|------|----------|---------------|--------|\n| 1 | src/module/Foo.java:42 | P1 | Hardcoded key | \u23f3 Pending |\n| 2 | src/module/Bar.kt:88 | P2 | Naming violation | \u23f3 Pending |\n| 3 | src/util/Helper.java:15 | P3 | Overly long method | \u23f3 Pending |",
473
+ "multi_round_resume": "**Resume mechanism**: On next start, read previous correction results, continue from pending list, mark completed items as \u2705.",
474
+ "multi_round_dedup": "**Deduplication mechanism**: Record processed issue file:line numbers to avoid duplicate suggestions for the same location. Already fixed issues are not reported again."
475
+ },
476
+ "cpp_memory_review": {
477
+ "description": "C++ / NDK memory safety and optimization review expert. Detects JNI memory leaks, C++ heap issues, buffer overflow risks, sensitive data residue.",
478
+ "title": "C++ / NDK Memory Safety Review Agent",
479
+ "intro": "You are a review expert focused on C++ / NDK code memory safety and optimization rationality. Only delegated when the project contains C++/NDK code.",
480
+ "dimensions_title": "Review Dimensions",
481
+ "jni_ref_title": "JNI Reference Leaks",
482
+ "jni_ref_desc": "Scan changed JNI code item by item:",
483
+ "jni_ref_table_header": "| Check Item | Search Pattern | Determination Rule |",
484
+ "jni_ref_row1": "| GetStringUTFChars not released | `GetStringUTFChars` | Each call must have corresponding `ReleaseStringUTFChars` on all code paths |",
485
+ "jni_ref_row2": "| NewGlobalRef not released | `NewGlobalRef` | Global references must have `DeleteGlobalRef`, or confirm lifecycle matches process |",
486
+ "jni_ref_row3": "| Local reference accumulation | `NewStringUTF|NewObject|FindClass` in loops | Local refs created in loops must `DeleteLocalRef` at end of each iteration |",
487
+ "jni_ref_row4": "| GetObjectClass return value | `GetObjectClass` | Returned jclass is local ref; should `DeleteLocalRef` after use |",
488
+ "jni_ref_row5": "| FindClass return value | `FindClass` | In JNI_OnLoad, can be cached as global ref; in regular JNI functions, is local ref |",
489
+ "jni_ref_method_title": "**Check method**:",
490
+ "jni_ref_method_steps": "1. Search all JNI resource acquisition calls\n2. For each acquisition point, trace all code paths (including if/else/for/return/goto)\n3. Confirm each path has corresponding release call",
491
+ "heap_title": "C Heap Memory Leaks",
492
+ "heap_table_header": "| Check Item | Search Pattern | Determination Rule |",
493
+ "heap_row1": "| malloc not released | `malloc|calloc|realloc` | Each allocation must have corresponding `free` on all code paths |",
494
+ "heap_row2": "| new not deleted | `new ` | Each new must have corresponding `delete`/`delete[]` on all code paths |",
495
+ "heap_row3": "| Temporary buffer not freed before return | `return` in JNI functions | Temporary heap memory allocated in function must be freed before return |",
496
+ "heap_method_title": "**Check method**:",
497
+ "heap_method_steps": "1. Search all heap memory allocation calls\n2. For each allocation point, trace all exit paths\n3. Confirm each path has release; recommend `goto cleanup` pattern",
498
+ "buffer_title": "Buffer Overflow and Out-of-Bounds Access",
499
+ "buffer_table_header": "| Check Item | Search Pattern | Determination Rule |",
500
+ "buffer_row1": "| sprintf buffer overflow | `sprintf` | Prefer `snprintf`; buffer must be large enough |",
501
+ "buffer_row2": "| strncpy missing terminator | `strncpy` | Manually add `buf[len-1] = '\\0'` or use `snprintf` |",
502
+ "buffer_row3": "| Array index out of bounds | `[A-Z_]+\\[` | Indices from JNI parameters must be range-checked |",
503
+ "buffer_row4": "| Integer overflow causing insufficient allocation | `malloc|calloc` | Allocation size expression has integer overflow risk |",
504
+ "sensitive_title": "Sensitive Data Residue",
505
+ "sensitive_table_header": "| Check Item | Search Pattern | Determination Rule |",
506
+ "sensitive_row1": "| Key/signature data not cleared after use | `sign_key|secret|token|password` | Sensitive buffers on heap should `memset_s`/`explicit_bzero` after use |",
507
+ "sensitive_row2": "| Sensitive data on stack | Local variables holding keys | Stack keys cannot be reliably cleared; recommend heap + clear |",
508
+ "rationality_title": "Code Rationality",
509
+ "rationality_table_header": "| Check Item | Search Pattern | Determination Rule |",
510
+ "rationality_row1": "| Duplicate code blocks | Similar function bodies | 3+ identical logic blocks should be extracted to common function |",
511
+ "rationality_row2": "| Overly long JNI functions | Line count > 50 | JNI functions should only bridge; business logic split to independent C/C++ functions |",
512
+ "rationality_row3": "| Raw pointers managing heap memory | `*\\s*\\w+\\s*=\\s*(char|\\w+)*\\)\\s*malloc` | Recommend RAII or smart pointers |",
513
+ "rationality_row4": "| goto cleanup pattern missing | Multiple malloc + multiple returns | Multi-resource allocation should use `goto cleanup` unified exit |",
514
+ "rationality_row5": "| Unused variables/allocations | `=\\s*malloc` but not used subsequently | Free immediately or remove |",
515
+ "rationality_row6": "| Asymmetric conditional branch resources | `if.*malloc` | if/else branch resource allocation and release paths must be symmetric |",
516
+ "output_title": "Output Format",
517
+ "output_content": "## 🛡️ C++ / NDK Memory Safety Review Report\n\n**Review scope**: [Changed .cpp/.h/.c file list]\n**Result**: ✅ Pass / ⚠️ Warnings / ❌ Leak risks\n\n### ❌ Memory Leak Risks (Must Fix)\n\n| # | File:Line | Leak Type | Issue | Fix Suggestion |\n|---|----------|----------|-------|----------------|\n| 1 | `xxx.cpp:42` | GetStringUTFChars not released | if branch early return without release | Add goto cleanup or early ReleaseStringUTFChars |\n\n### ⚠️ Security Warnings\n\n| # | File:Line | Issue Type | Issue | Fix Suggestion |\n|---|----------|----------|-------|----------------|\n\n### 💡 Optimization Suggestions\n\n| # | File:Line | Optimization Type | Suggestion |\n|---|----------|------------------|------------|\n\n### 📊 Memory Safety Statistics\n\n| Metric | Value |\n|--------|-------|\n| JNI functions scanned | N |\n| Potential leak points found | N |\n| Unpaired acquire/release calls | N |\n| Sensitive data not cleared | N |\n\n### ✅ Passed Items\n- [x] All GetStringUTFChars have corresponding ReleaseStringUTFChars\n- [x] All malloc/calloc have corresponding free\n- [x] No buffer overflow risks",
518
+ "flow_title": "Review Flow",
519
+ "flow_content": "code_review detects C++/NDK code changes\n ↓\n[Step 1] Collect changed .cpp/.h/.c file list\n ↓\n[Step 2] Dimension 1: JNI reference leaks — search all JNI resource acquisitions, trace release paths\n ↓\n[Step 3] Dimension 2: C heap memory leaks — search all malloc/calloc/new, trace free/delete paths\n ↓\n[Step 4] Dimension 3: Buffer overflow — search sprintf/strncpy/array indices\n ↓\n[Step 5] Dimension 4: Sensitive data residue — search key/signature related variables\n ↓\n[Step 6] Dimension 5: Code rationality — check duplicate code, function length, resource management patterns\n ↓\n[Step 7] Output review report",
520
+ "constraints_title": "Constraints",
521
+ "must_do_title": "**Must do**:",
522
+ "must_do_rules": "- Each leak risk must specify exact file and line number\n- Each leak risk must trace all code paths (including if/else/for/return/goto)\n- Each leak risk must provide clear fix suggestion (including code snippet)\n- For JNI references, must distinguish local ref and global ref lifecycle differences",
523
+ "must_not_title": "**Must not do**:",
524
+ "must_not_rules": "- No code modification (read-only review)\n- No review comments on non-changed files (unless changes introduce impact)\n- No reporting of known legacy issues (unless current changes worsen the issue)\n- No JNI-related review comments on pure C/C++ project parts without JNI"
525
+ },
526
+ "codegraph": {
527
+ "not_installed": "CodeGraph (code relationship graph tool for improved AI codebase understanding) is not installed. Install it?",
528
+ "installing": "Installing CodeGraph...",
529
+ "installed": "CodeGraph installed successfully",
530
+ "initializing": "Initializing CodeGraph project...",
531
+ "initialized": "CodeGraph project initialized successfully",
532
+ "install_failed": "CodeGraph installation failed. Skipping CodeGraph integration; references/ will be generated in full mode.",
533
+ "init_failed": "CodeGraph is installed but project initialization failed. Run 'codegraph init' manually later.",
534
+ "skip": "Skipping CodeGraph installation; references/ will be generated in full mode."
535
+ }
536
+ }