scan_and_extract_patterns
Analyze code snippets, files, or directories to extract reusable patterns and decide whether to save them to the memory system. Supports scanning directories with configurable file and pattern limits.
Instructions
当需要从单段代码、单文件或整个目录中抽取可复用模式,再决定是否沉淀到记忆系统时使用。目录扫描时,优先传 project_root 为项目根目录绝对路径,并让 directory_path 传相对项目根的路径,例如 app/utils;只有无法确定项目根时,才把 directory_path 直接设为绝对路径。不要传带项目名的半相对路径,例如 font-miniapp-api/app/utils。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | 待分析的代码或文本内容。传入该字段时走单段分析模式 | |
| file_path | No | 来源文件路径。单段分析时作为来源路径使用 | |
| max_files | No | 最多扫描多少个文件,默认 30,最大 200 | |
| max_patterns | No | 最多返回多少个候选模式,默认 20,最大 100 | |
| project_name | No | 已废弃,扫描结果不再写入 source_project | |
| project_root | No | 项目根目录绝对路径。目录扫描时建议始终传入;传入后,`directory_path` 应写成相对项目根的路径。 | |
| directory_path | No | 要扫描的目录路径。最佳实践是传相对 `project_root` 的路径,例如 `app/utils`;如果拿不到 `project_root`,才传目录绝对路径。不要传带项目名的半相对路径,例如 `font-miniapp-api/app/utils`。 | |
| include_extensions | No | 允许扫描的文件扩展名列表,例如 [".ts", ".tsx", ".py"] |