zrb 1.15.3__py3-none-any.whl → 1.21.29__py3-none-any.whl

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.

Potentially problematic release.


This version of zrb might be problematic. Click here for more details.

Files changed (108) hide show
  1. zrb/__init__.py +2 -6
  2. zrb/attr/type.py +10 -7
  3. zrb/builtin/__init__.py +2 -0
  4. zrb/builtin/git.py +12 -1
  5. zrb/builtin/group.py +31 -15
  6. zrb/builtin/llm/attachment.py +40 -0
  7. zrb/builtin/llm/chat_completion.py +274 -0
  8. zrb/builtin/llm/chat_session.py +126 -167
  9. zrb/builtin/llm/chat_session_cmd.py +288 -0
  10. zrb/builtin/llm/chat_trigger.py +79 -0
  11. zrb/builtin/llm/history.py +4 -4
  12. zrb/builtin/llm/llm_ask.py +217 -135
  13. zrb/builtin/llm/tool/api.py +74 -70
  14. zrb/builtin/llm/tool/cli.py +35 -21
  15. zrb/builtin/llm/tool/code.py +55 -73
  16. zrb/builtin/llm/tool/file.py +278 -344
  17. zrb/builtin/llm/tool/note.py +84 -0
  18. zrb/builtin/llm/tool/rag.py +27 -34
  19. zrb/builtin/llm/tool/sub_agent.py +54 -41
  20. zrb/builtin/llm/tool/web.py +74 -98
  21. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
  22. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
  23. zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
  24. zrb/builtin/searxng/config/settings.yml +5671 -0
  25. zrb/builtin/searxng/start.py +21 -0
  26. zrb/builtin/shell/autocomplete/bash.py +4 -3
  27. zrb/builtin/shell/autocomplete/zsh.py +4 -3
  28. zrb/config/config.py +202 -27
  29. zrb/config/default_prompt/file_extractor_system_prompt.md +109 -9
  30. zrb/config/default_prompt/interactive_system_prompt.md +24 -30
  31. zrb/config/default_prompt/persona.md +1 -1
  32. zrb/config/default_prompt/repo_extractor_system_prompt.md +31 -31
  33. zrb/config/default_prompt/repo_summarizer_system_prompt.md +27 -8
  34. zrb/config/default_prompt/summarization_prompt.md +57 -16
  35. zrb/config/default_prompt/system_prompt.md +36 -30
  36. zrb/config/llm_config.py +119 -23
  37. zrb/config/llm_context/config.py +127 -90
  38. zrb/config/llm_context/config_parser.py +1 -7
  39. zrb/config/llm_context/workflow.py +81 -0
  40. zrb/config/llm_rate_limitter.py +100 -47
  41. zrb/context/any_shared_context.py +7 -1
  42. zrb/context/context.py +8 -2
  43. zrb/context/shared_context.py +3 -7
  44. zrb/group/any_group.py +3 -3
  45. zrb/group/group.py +3 -3
  46. zrb/input/any_input.py +5 -1
  47. zrb/input/base_input.py +18 -6
  48. zrb/input/option_input.py +13 -1
  49. zrb/input/text_input.py +7 -24
  50. zrb/runner/cli.py +21 -20
  51. zrb/runner/common_util.py +24 -19
  52. zrb/runner/web_route/task_input_api_route.py +5 -5
  53. zrb/runner/web_util/user.py +7 -3
  54. zrb/session/any_session.py +12 -6
  55. zrb/session/session.py +39 -18
  56. zrb/task/any_task.py +24 -3
  57. zrb/task/base/context.py +17 -9
  58. zrb/task/base/execution.py +15 -8
  59. zrb/task/base/lifecycle.py +8 -4
  60. zrb/task/base/monitoring.py +12 -7
  61. zrb/task/base_task.py +69 -5
  62. zrb/task/base_trigger.py +12 -5
  63. zrb/task/llm/agent.py +128 -167
  64. zrb/task/llm/agent_runner.py +152 -0
  65. zrb/task/llm/config.py +39 -20
  66. zrb/task/llm/conversation_history.py +110 -29
  67. zrb/task/llm/conversation_history_model.py +4 -179
  68. zrb/task/llm/default_workflow/coding/workflow.md +41 -0
  69. zrb/task/llm/default_workflow/copywriting/workflow.md +68 -0
  70. zrb/task/llm/default_workflow/git/workflow.md +118 -0
  71. zrb/task/llm/default_workflow/golang/workflow.md +128 -0
  72. zrb/task/llm/default_workflow/html-css/workflow.md +135 -0
  73. zrb/task/llm/default_workflow/java/workflow.md +146 -0
  74. zrb/task/llm/default_workflow/javascript/workflow.md +158 -0
  75. zrb/task/llm/default_workflow/python/workflow.md +160 -0
  76. zrb/task/llm/default_workflow/researching/workflow.md +153 -0
  77. zrb/task/llm/default_workflow/rust/workflow.md +162 -0
  78. zrb/task/llm/default_workflow/shell/workflow.md +299 -0
  79. zrb/task/llm/file_replacement.py +206 -0
  80. zrb/task/llm/file_tool_model.py +57 -0
  81. zrb/task/llm/history_processor.py +206 -0
  82. zrb/task/llm/history_summarization.py +2 -193
  83. zrb/task/llm/print_node.py +184 -64
  84. zrb/task/llm/prompt.py +175 -179
  85. zrb/task/llm/subagent_conversation_history.py +41 -0
  86. zrb/task/llm/tool_wrapper.py +226 -85
  87. zrb/task/llm/workflow.py +76 -0
  88. zrb/task/llm_task.py +109 -71
  89. zrb/task/make_task.py +2 -3
  90. zrb/task/rsync_task.py +25 -10
  91. zrb/task/scheduler.py +4 -4
  92. zrb/util/attr.py +54 -39
  93. zrb/util/cli/markdown.py +12 -0
  94. zrb/util/cli/text.py +30 -0
  95. zrb/util/file.py +12 -3
  96. zrb/util/git.py +2 -2
  97. zrb/util/{llm/prompt.py → markdown.py} +2 -3
  98. zrb/util/string/conversion.py +1 -1
  99. zrb/util/truncate.py +23 -0
  100. zrb/util/yaml.py +204 -0
  101. zrb/xcom/xcom.py +10 -0
  102. {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/METADATA +38 -18
  103. {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/RECORD +105 -79
  104. {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/WHEEL +1 -1
  105. zrb/task/llm/default_workflow/coding.md +0 -24
  106. zrb/task/llm/default_workflow/copywriting.md +0 -17
  107. zrb/task/llm/default_workflow/researching.md +0 -18
  108. {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,158 @@
1
+ ---
2
+ description: "A workflow for developing with JavaScript and TypeScript, including project analysis and best practices."
3
+ ---
4
+ Follow this workflow to deliver robust, maintainable JavaScript/TypeScript code that follows project conventions.
5
+
6
+ # Core Mandates
7
+
8
+ - **Type Safety First:** Use TypeScript when available, proper typing in JavaScript
9
+ - **Modern Standards:** Follow ES6+ features and best practices
10
+ - **Framework Consistency:** Adhere to project's framework conventions
11
+ - **Tool Integration:** Leverage comprehensive JavaScript tooling ecosystem
12
+
13
+ # Tool Usage Guideline
14
+ - Use `read_from_file` to analyze package.json and configuration files
15
+ - Use `search_files` to find JavaScript/TypeScript patterns
16
+ - Use `run_shell_command` for npm/yarn/pnpm operations
17
+ - Use `list_files` to understand project structure
18
+
19
+ # Step 1: Project Analysis
20
+
21
+ 1. **Package Management:** Examine `package.json` and lock files (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`)
22
+ 2. **TypeScript Configuration:** Check for `tsconfig.json` and TypeScript usage
23
+ 3. **Linting Configuration:** Look for `.eslintrc.js`, `.prettierrc`, ESLint config in `package.json`
24
+ 4. **Build Configuration:** Analyze `webpack.config.js`, `vite.config.ts`, `rollup.config.js`
25
+ 5. **Testing Framework:** Check for `jest.config.js`, `vitest.config.ts`, test directories
26
+ 6. **Framework Usage:** Identify React, Vue, Angular, or other framework usage
27
+
28
+ # Step 2: Understand Conventions
29
+
30
+ 1. **Module System:** Determine ES Modules (`import/export`) vs CommonJS (`require/module.exports`)
31
+ 2. **TypeScript Strictness:** Adhere to project's TypeScript configuration
32
+ 3. **Framework Patterns:** Follow established component, state management, and routing patterns
33
+ 4. **Styling Approach:** Understand CSS-in-JS, CSS modules, or traditional CSS usage
34
+ 5. **Testing Strategy:** Follow established test patterns and mocking approaches
35
+
36
+ # Step 3: Implementation Planning
37
+
38
+ 1. **File Structure:** Plan where new code should be placed based on project conventions
39
+ 2. **Type Definitions:** Plan TypeScript interfaces and types for new functionality
40
+ 3. **Component Design:** Design React/Vue/Angular components following established patterns
41
+ 4. **State Management:** Determine appropriate state management approach
42
+ 5. **Testing Strategy:** Plan comprehensive unit, integration, and end-to-end tests
43
+
44
+ # Step 4: Write Code
45
+
46
+ ## Code Quality Standards
47
+ - **Formatting:** Use Prettier with project configuration
48
+ - **Linting:** Follow ESLint rules and address all warnings
49
+ - **Type Safety:** Use TypeScript strictly when available
50
+ - **Naming:** Use clear, descriptive names following project conventions
51
+ - **Documentation:** Add JSDoc/TSDoc for complex functions and public APIs
52
+
53
+ ## Framework-Specific Patterns
54
+
55
+ ### React
56
+ - **Functional Components:** Use hooks-based functional components
57
+ - **State Management:** Follow established patterns (useState, useReducer, Redux, etc.)
58
+ - **Performance:** Use React.memo, useMemo, useCallback appropriately
59
+ - **Testing:** Use React Testing Library and established testing patterns
60
+
61
+ ### Vue
62
+ - **Composition API:** Prefer Composition API over Options API
63
+ - **State Management:** Use Pinia or Vuex following project patterns
64
+ - **Component Structure:** Follow single-file component conventions
65
+ - **Testing:** Use Vue Test Utils and established testing patterns
66
+
67
+ ### Angular
68
+ - **Component Structure:** Follow Angular module and component conventions
69
+ - **Dependency Injection:** Use Angular's DI system appropriately
70
+ - **RxJS:** Follow established reactive programming patterns
71
+ - **Testing:** Use Angular Testing utilities and established patterns
72
+
73
+ # Step 5: Testing and Verification
74
+
75
+ 1. **Write Tests:** Create comprehensive tests for all new functionality
76
+ 2. **Run Tests:** Execute `npm test` or framework-specific test commands
77
+ 3. **Type Checking:** Run `npm run typecheck` or `tsc --noEmit`
78
+ 4. **Linting:** Run `npm run lint` to catch code quality issues
79
+ 5. **Build Verification:** Run `npm run build` to ensure code compiles correctly
80
+
81
+ # Step 6: Quality Assurance
82
+
83
+ ## Testing Standards
84
+ - **Unit Tests:** Test individual functions and components in isolation
85
+ - **Integration Tests:** Test component interactions and API integrations
86
+ - **End-to-End Tests:** Test complete user workflows (if configured)
87
+ - **Mocking:** Use appropriate mocking libraries and patterns
88
+ - **Coverage:** Aim for high test coverage of business logic
89
+
90
+ ## Code Review Checklist
91
+ - [ ] Code follows project formatting and linting standards
92
+ - [ ] All tests pass with good coverage
93
+ - [ ] TypeScript compiles without errors (if applicable)
94
+ - [ ] No ESLint warnings
95
+ - [ ] Documentation is complete for complex logic
96
+ - [ ] Performance considerations addressed
97
+ - [ ] Accessibility requirements met
98
+
99
+ # Step 7: Package Management
100
+
101
+ ## Dependency Management
102
+ - **npm:** Use `npm install <package>` for new dependencies
103
+ - **yarn:** Use `yarn add <package>` for new dependencies
104
+ - **pnpm:** Use `pnpm add <package>` for new dependencies
105
+ - **Version Management:** Follow project's versioning strategy
106
+
107
+ ## Script Execution
108
+ - `npm install` / `yarn install` / `pnpm install`: Install dependencies
109
+ - `npm run dev` / `yarn dev` / `pnpm dev`: Start development server
110
+ - `npm run build` / `yarn build` / `pnpm build`: Build for production
111
+ - `npm run lint` / `yarn lint` / `pnpm lint`: Run linting
112
+
113
+ # Step 8: Finalize and Deliver
114
+
115
+ 1. **Verify Dependencies:** Ensure dependency versions are consistent
116
+ 2. **Run Full Test Suite:** Verify all existing tests still pass
117
+ 3. **Type Checking:** Ensure TypeScript compilation succeeds
118
+ 4. **Build Verification:** Confirm production build works correctly
119
+ 5. **Documentation:** Update relevant documentation and comments
120
+
121
+ # Common Commands Reference
122
+
123
+ ## Development
124
+ - `npm run dev`: Start development server
125
+ - `npm run build`: Build for production
126
+ - `npm run typecheck`: Type check TypeScript code
127
+ - `npm run lint`: Run ESLint
128
+ - `npm run format`: Format code with Prettier
129
+
130
+ ## Testing
131
+ - `npm test`: Run tests
132
+ - `npm run test:watch`: Run tests in watch mode
133
+ - `npm run test:coverage`: Run tests with coverage
134
+ - `npm run test:e2e`: Run end-to-end tests (if configured)
135
+
136
+ ## Debugging
137
+ - Browser developer tools for frontend debugging
138
+ - `node --inspect` for Node.js debugging
139
+ - Framework-specific debugging tools
140
+
141
+ # Risk Assessment Guidelines
142
+
143
+ ## Low Risk (Proceed Directly)
144
+ - Adding tests to existing test suites
145
+ - Implementing utility functions following established patterns
146
+ - Creating new components in established patterns
147
+
148
+ ## Moderate Risk (Explain and Confirm)
149
+ - Modifying core application state
150
+ - Changing public API interfaces
151
+ - Adding new dependencies
152
+ - Modifying build configuration
153
+
154
+ ## High Risk (Refuse and Explain)
155
+ - Breaking TypeScript strict mode compliance
156
+ - Modifying critical security components
157
+ - Changes affecting multiple applications
158
+ - Operations that could break the build system
@@ -0,0 +1,160 @@
1
+ ---
2
+ description: "A workflow for developing with Python, including project analysis and best practices."
3
+ ---
4
+ Follow this workflow to deliver clean, maintainable Python code that follows PEP standards and project conventions.
5
+
6
+ # Core Mandates
7
+
8
+ - **PEP 8 Compliance:** Follow Python style guide unless project specifies otherwise
9
+ - **Type Safety:** Use type hints when project supports them
10
+ - **Virtual Environments:** Always work within appropriate Python environments
11
+ - **Testing Excellence:** Write comprehensive tests for all functionality
12
+
13
+ # Tool Usage Guideline
14
+ - Use `read_from_file` to analyze pyproject.toml, requirements.txt, and source code
15
+ - Use `search_files` to find Python patterns and conventions
16
+ - Use `run_shell_command` for Python toolchain operations
17
+ - Use `list_files` to understand project structure
18
+
19
+ # Step 1: Project Analysis
20
+
21
+ 1. **Dependency Management:** Examine `pyproject.toml`, `requirements.txt`, `setup.py`
22
+ 2. **Virtual Environment:** Check for `.venv`, `venv`, or other environment indicators
23
+ 3. **Python Version:** Look for `.python-version` or configuration in `pyproject.toml`
24
+ 4. **Linting Configuration:** Check for `ruff.toml`, `.flake8`, `.pylintrc`
25
+ 5. **Type Checking:** Look for `mypy.ini`, `pyrightconfig.json`
26
+ 6. **Testing Framework:** Analyze `tests/` directory, `pytest.ini`, `tox.ini`
27
+
28
+ # Step 2: Environment Setup
29
+
30
+ 1. **Activate Virtual Environment:**
31
+ ```bash
32
+ source .venv/bin/activate # Linux/Mac
33
+ .venv\Scripts\activate # Windows
34
+ ```
35
+ 2. **Create Environment if Missing:**
36
+ ```bash
37
+ python -m venv .venv
38
+ source .venv/bin/activate
39
+ pip install -e . # Install project in development mode
40
+ ```
41
+ 3. **Install Dependencies:** Use appropriate package manager (pip, poetry, pdm)
42
+
43
+ # Step 3: Understand Conventions
44
+
45
+ 1. **Code Style:** Adhere to project's configured linter (ruff, flake8, pylint)
46
+ 2. **Type Hints:** Use type hints if project supports them, following existing patterns
47
+ 3. **Import Organization:** Follow project's import sorting (isort, ruff)
48
+ 4. **Docstring Format:** Match existing format (Google, NumPy, reStructuredText)
49
+ 5. **Testing Patterns:** Follow established pytest or unittest patterns
50
+
51
+ # Step 4: Implementation Planning
52
+
53
+ 1. **Module Structure:** Plan where new code should be placed
54
+ 2. **Class Design:** Design classes following Pythonic principles
55
+ 3. **Function Design:** Create focused, single-responsibility functions
56
+ 4. **Type Annotations:** Plan appropriate type hints for new code
57
+ 5. **Testing Strategy:** Plan comprehensive unit and integration tests
58
+
59
+ # Step 5: Write Code
60
+
61
+ ## Code Quality Standards
62
+ - **Formatting:** Use black, autopep8, or ruff format with project configuration
63
+ - **Linting:** Address all linter warnings (ruff, flake8, pylint)
64
+ - **Type Hints:** Add comprehensive type annotations
65
+ - **Documentation:** Write clear docstrings following project format
66
+ - **Naming:** Use snake_case for variables/functions, PascalCase for classes
67
+
68
+ ## Pythonic Patterns
69
+ - **List Comprehensions:** Use for simple transformations
70
+ - **Context Managers:** Use `with` statements for resource management
71
+ - **Generators:** Use for large datasets or streaming data
72
+ - **Decorators:** Use for cross-cutting concerns
73
+ - **Data Classes:** Use for simple data containers (Python 3.7+)
74
+
75
+ # Step 6: Testing and Verification
76
+
77
+ 1. **Write Tests:** Create comprehensive tests using project's test framework
78
+ 2. **Run Tests:** Execute `pytest` or `python -m unittest`
79
+ 3. **Type Checking:** Run `mypy` or `pyright` if configured
80
+ 4. **Linting:** Run `ruff check` or project's linter
81
+ 5. **Formatting:** Run `black` or project's formatter
82
+
83
+ # Step 7: Quality Assurance
84
+
85
+ ## Testing Standards
86
+ - **Test Organization:** Follow project's test structure and naming
87
+ - **Fixtures:** Use pytest fixtures for test setup
88
+ - **Mocking:** Use unittest.mock or pytest-mock appropriately
89
+ - **Coverage:** Aim for high test coverage of business logic
90
+ - **Parametrized Tests:** Use for testing multiple input scenarios
91
+
92
+ ## Code Review Checklist
93
+ - [ ] Code follows PEP 8 and project formatting standards
94
+ - [ ] All tests pass with good coverage
95
+ - [ ] Type checking passes (if configured)
96
+ - [ ] No linter warnings
97
+ - [ ] Docstrings are complete and follow project format
98
+ - [ ] Error handling is appropriate
99
+ - [ ] Performance considerations addressed
100
+
101
+ # Step 8: Package Management
102
+
103
+ ## Dependency Management
104
+ - **pip:** Add to `requirements.txt` and run `pip install -r requirements.txt`
105
+ - **poetry:** Use `poetry add <package>` and `poetry install`
106
+ - **pdm:** Use `pdm add <package>` and `pdm install`
107
+
108
+ ## Common Commands
109
+ - `python -m pytest`: Run tests with pytest
110
+ - `python -m mypy .`: Run type checking with mypy
111
+ - `python -m black .`: Format code with black
112
+ - `python -m ruff check .`: Lint code with ruff
113
+ - `python -m isort .`: Sort imports with isort
114
+
115
+ # Step 9: Finalize and Deliver
116
+
117
+ 1. **Verify Environment:** Ensure virtual environment is active and dependencies installed
118
+ 2. **Run Full Test Suite:** Verify all existing tests still pass
119
+ 3. **Static Analysis:** Address any remaining linting or type issues
120
+ 4. **Documentation:** Update relevant documentation, docstrings, and README
121
+ 5. **Packaging:** Verify package can be built and installed if applicable
122
+
123
+ # Advanced Python Features
124
+
125
+ ## Modern Python (3.8+)
126
+ - **Walrus Operator:** Use `:=` for assignment in expressions
127
+ - **Structural Pattern Matching:** Use `match`/`case` for complex conditionals
128
+ - **Positional-only Parameters:** Use `/` in function definitions
129
+ - **Dataclasses:** Use for simple data containers
130
+
131
+ ## Performance Optimization
132
+ - **Profiling:** Use cProfile for performance analysis
133
+ - **Caching:** Use functools.lru_cache for expensive function calls
134
+ - **Async/Await:** Use for I/O-bound operations
135
+ - **C Extensions:** Consider for performance-critical code
136
+
137
+ ## Security Considerations
138
+ - **Input Validation:** Validate and sanitize all user inputs
139
+ - **Dependency Security:** Use tools like safety or bandit
140
+ - **Secret Management:** Never hardcode secrets in code
141
+ - **SQL Injection:** Use parameterized queries
142
+
143
+ # Risk Assessment Guidelines
144
+
145
+ ## Low Risk (Proceed Directly)
146
+ - Adding tests to existing test suites
147
+ - Implementing utility functions following established patterns
148
+ - Creating new modules in established patterns
149
+
150
+ ## Moderate Risk (Explain and Confirm)
151
+ - Modifying core business logic
152
+ - Changing public API interfaces
153
+ - Adding new dependencies
154
+ - Modifying virtual environment or dependency configuration
155
+
156
+ ## High Risk (Refuse and Explain)
157
+ - Breaking backward compatibility
158
+ - Modifying critical security components
159
+ - Changes affecting multiple packages
160
+ - Operations that could break the virtual environment
@@ -0,0 +1,153 @@
1
+ ---
2
+ description: "A workflow for finding, synthesizing, and analyzing information from various sources."
3
+ ---
4
+ Follow this workflow to deliver accurate, well-sourced, and synthesized research findings.
5
+
6
+ # Core Mandates
7
+
8
+ - **Unyielding Objectivity:** Report facts, identify biases, never inject opinions
9
+ - **Source Hierarchy:** Prioritize authoritative sources over secondary ones
10
+ - **Synthesis Excellence:** Connect information into coherent narratives
11
+ - **Comprehensive Attribution:** Cite all significant claims and data points
12
+
13
+ # Tool Usage Guideline
14
+ - Use `search_internet` for web research and information gathering
15
+ - Use `open_web_page` to read and analyze web content
16
+ - Use `read_from_file` to analyze provided documents and materials
17
+ - Use `write_to_file` to organize research findings and notes
18
+
19
+ # Step 1: Deconstruct and Strategize
20
+
21
+ 1. **Isolate Core Questions:** Break down the user's request into specific, answerable questions
22
+ 2. **Develop Search Strategy:** Create precise keywords, phrases, and boolean operators
23
+ 3. **Identify Source Types:** Determine what types of sources will be most valuable
24
+ 4. **Plan Research Approach:** Outline the sequence of research activities
25
+
26
+ # Step 2: Source Evaluation and Collection
27
+
28
+ ## Source Hierarchy (The 3 Tiers)
29
+
30
+ ### Tier 1 (Ground Truth)
31
+ - Official documentation and specifications
32
+ - Peer-reviewed academic papers
33
+ - Direct source code and technical specifications
34
+ - Primary legal/government documents
35
+ - Statistical data from authoritative sources
36
+
37
+ ### Tier 2 (Reputable Reporting)
38
+ - Established news organizations
39
+ - Respected industry publications
40
+ - Books by credible authors and experts
41
+ - Conference proceedings from reputable organizations
42
+
43
+ ### Tier 3 (Qualified Sources)
44
+ - Blog posts by known experts
45
+ - Conference talks and presentations
46
+ - Forum answers from high-reputation users
47
+ - **Always qualify these sources** (e.g., "According to a senior engineer at Google...")
48
+
49
+ ## Research Execution
50
+ 1. **Iterative Searching:** Start with best queries, refine based on results
51
+ 2. **Cross-Reference:** Verify information across multiple sources
52
+ 3. **Source Vetting:** Quickly assess source credibility and potential biases
53
+ 4. **Information Extraction:** Pull out relevant facts, figures, and arguments
54
+
55
+ # Step 3: Information Synthesis
56
+
57
+ 1. **Identify Patterns:** Look for consensus, debates, or evolving understanding
58
+ 2. **Connect Dots:** Find relationships between different pieces of information
59
+ 3. **Identify Gaps:** Note where information is missing or contradictory
60
+ 4. **Structure Findings:** Organize information logically for presentation
61
+
62
+ # Step 4: Analysis and Reporting
63
+
64
+ ## Report Structure
65
+ - **Bottom Line Up Front (BLUF):** Start with direct, concise answer to main question
66
+ - **Supporting Evidence:** Present synthesized facts and data supporting the BLUF
67
+ - **Methodology:** Explain research approach and sources used
68
+ - **Nuance and Limitations:** Acknowledge conflicting information or data gaps
69
+ - **Citations:** Provide clear attribution for all significant claims
70
+
71
+ ## Quality Standards
72
+ - **Accuracy:** Verify all facts and figures before inclusion
73
+ - **Clarity:** Present complex information in accessible language
74
+ - **Completeness:** Address all aspects of the original question
75
+ - **Objectivity:** Present balanced view without personal bias
76
+
77
+ # Step 5: Task-Specific Execution
78
+
79
+ ## Comparative Analysis
80
+ - **Structured Comparison:** Use tables or detailed bullet points
81
+ - **Like-for-Like Basis:** Compare items on equivalent criteria
82
+ - **Implication Analysis:** Explain what differences mean in practice
83
+ - **Objective Assessment:** Avoid subjective preferences
84
+
85
+ ## Technical Research
86
+ - **Documentation Analysis:** Read and interpret technical specifications
87
+ - **Code Examination:** Analyze source code when available
88
+ - **Performance Data:** Include benchmarks and performance characteristics
89
+ - **Compatibility Analysis:** Consider integration and compatibility factors
90
+
91
+ ## Market/Industry Research
92
+ - **Market Size:** Include relevant statistics and growth projections
93
+ - **Competitive Landscape:** Analyze key players and their positions
94
+ - **Trend Analysis:** Identify emerging patterns and future directions
95
+ - **Regulatory Environment:** Consider legal and compliance factors
96
+
97
+ # Step 6: Verification and Quality Control
98
+
99
+ 1. **Fact Checking:** Verify all critical information across multiple sources
100
+ 2. **Bias Assessment:** Identify and acknowledge potential biases in sources
101
+ 3. **Logical Consistency:** Ensure conclusions follow logically from evidence
102
+ 4. **Citation Verification:** Confirm all citations are accurate and accessible
103
+
104
+ # Step 7: Final Presentation
105
+
106
+ ## Formatting Standards
107
+ - **Clear Headings:** Use descriptive section headings
108
+ - **Bulleted Lists:** Present information in scannable format
109
+ - **Citations:** Use consistent format (e.g., `[Source Name](URL)`)
110
+ - **Visual Organization:** Use tables, charts, or diagrams when helpful
111
+
112
+ ## Delivery Considerations
113
+ - **Executive Summary:** Include high-level findings for quick understanding
114
+ - **Detailed Analysis:** Provide comprehensive information for deep dives
115
+ - **Actionable Insights:** Highlight implications and recommended actions
116
+ - **Further Reading:** Suggest additional resources for interested readers
117
+
118
+ # Risk Assessment Guidelines
119
+
120
+ ## Low Risk (Proceed Directly)
121
+ - Researching publicly available information
122
+ - Synthesizing information from authoritative sources
123
+ - Creating comparative analyses of established products
124
+
125
+ ## Moderate Risk (Explain and Confirm)
126
+ - Research involving proprietary or sensitive information
127
+ - Analysis that could have legal or compliance implications
128
+ - Research requiring access to paid or restricted sources
129
+
130
+ ## High Risk (Refuse and Explain)
131
+ - Research involving personal or private information
132
+ - Analysis that could violate terms of service
133
+ - Activities that could be considered hacking or unauthorized access
134
+
135
+ # Best Practices
136
+
137
+ ## Research Ethics
138
+ - **Respect Copyright:** Properly attribute all sources
139
+ - **Avoid Plagiarism:** Always cite and paraphrase appropriately
140
+ - **Respect Privacy:** Never research personal or private information
141
+ - **Maintain Integrity:** Report findings honestly, even if unexpected
142
+
143
+ ## Efficiency Techniques
144
+ - **Source Tracking:** Keep organized notes of sources and findings
145
+ - **Template Usage:** Use consistent formats for similar research tasks
146
+ - **Tool Proficiency:** Master research tools and techniques
147
+ - **Time Management:** Allocate research time based on question complexity
148
+
149
+ ## Continuous Improvement
150
+ - **Learn from Results:** Analyze what research approaches work best
151
+ - **Update Methods:** Stay current with new research tools and techniques
152
+ - **Expand Knowledge:** Build expertise in relevant domains
153
+ - **Share Insights:** Document successful research strategies
@@ -0,0 +1,162 @@
1
+ ---
2
+ description: "A workflow for developing with Rust, including project analysis and best practices."
3
+ ---
4
+ Follow this workflow to deliver safe, efficient, and idiomatic Rust code that respects project conventions.
5
+
6
+ # Core Mandates
7
+
8
+ - **Memory Safety:** Leverage Rust's ownership system for safe code
9
+ - **Zero-Cost Abstractions:** Use Rust's features without runtime overhead
10
+ - **Idiomatic Patterns:** Follow established Rust conventions and practices
11
+ - **Tool Integration:** Use Cargo and Rust tooling effectively
12
+
13
+ # Tool Usage Guideline
14
+ - Use `read_from_file` to analyze Cargo.toml and source code
15
+ - Use `search_files` to find Rust patterns and conventions
16
+ - Use `run_shell_command` for Cargo operations
17
+ - Use `list_files` to understand project structure
18
+
19
+ # Step 1: Project Analysis
20
+
21
+ 1. **Crate Information:** Examine `Cargo.toml` for dependencies, features, and workspace members
22
+ 2. **Toolchain Version:** Check `rust-toolchain.toml` for Rust version and components
23
+ 3. **Formatting Configuration:** Look for `rustfmt.toml` or `.rustfmt.toml`
24
+ 4. **Linting Configuration:** Check `clippy.toml` or `[lints]` section in `Cargo.toml`
25
+ 5. **Module Structure:** Analyze `src/lib.rs`, `src/main.rs`, and `src/bin/` directory
26
+ 6. **Workspace Configuration:** Check for workspace members in `Cargo.toml`
27
+
28
+ # Step 2: Understand Conventions
29
+
30
+ 1. **Formatting:** `cargo fmt` is mandatory for all code
31
+ 2. **Linting:** `cargo clippy` must pass with project configuration
32
+ 3. **Safety:** Avoid `unsafe` blocks unless absolutely necessary and documented
33
+ 4. **Error Handling:** Follow project's error handling strategy (anyhow, thiserror, etc.)
34
+ 5. **Testing:** Use established test patterns and organization
35
+
36
+ # Step 3: Implementation Planning
37
+
38
+ 1. **Type Design:** Plan structs, enums, and traits based on project patterns
39
+ 2. **Ownership Strategy:** Consider ownership, borrowing, and lifetime requirements
40
+ 3. **Error Handling:** Plan appropriate error types and handling
41
+ 4. **Concurrency:** Consider async/await or threading requirements
42
+ 5. **Testing Strategy:** Plan comprehensive unit and integration tests
43
+
44
+ # Step 4: Write Code
45
+
46
+ ## Code Quality Standards
47
+ - **Formatting:** All code must be `cargo fmt` compliant
48
+ - **Linting:** Address all `cargo clippy` warnings
49
+ - **Documentation:** Add rustdoc comments for public APIs
50
+ - **Naming:** Follow Rust naming conventions (snake_case for variables/functions, PascalCase for types)
51
+ - **Safety:** Write safe Rust without unnecessary `unsafe` blocks
52
+
53
+ ## Rust Idioms
54
+ - **Result and Option:** Use for error and optional value handling
55
+ - **Ownership System:** Leverage borrowing and lifetimes correctly
56
+ - **Iterators:** Prefer iterator methods over manual loops
57
+ - **Pattern Matching:** Use `match` and `if let` for control flow
58
+ - **Traits:** Use for polymorphism and code organization
59
+
60
+ # Step 5: Testing and Verification
61
+
62
+ 1. **Write Tests:** Create comprehensive tests using `#[cfg(test)]` modules
63
+ 2. **Run Tests:** Execute `cargo test` to verify functionality
64
+ 3. **Format Code:** Run `cargo fmt` to ensure proper formatting
65
+ 4. **Lint Code:** Run `cargo clippy -- -D warnings` to catch issues
66
+ 5. **Build Verification:** Run `cargo check` for fast compilation checking
67
+
68
+ # Step 6: Quality Assurance
69
+
70
+ ## Testing Standards
71
+ - **Unit Tests:** Place in `#[cfg(test)]` modules within source files
72
+ - **Integration Tests:** Create in `tests/` directory for crate-level testing
73
+ - **Documentation Tests:** Include examples in rustdoc comments
74
+ - **Property Testing:** Use proptest or quickcheck for comprehensive testing
75
+
76
+ ## Code Review Checklist
77
+ - [ ] Code follows project formatting standards
78
+ - [ ] All tests pass with good coverage
79
+ - [ ] No clippy warnings
80
+ - [ ] Error handling is appropriate and idiomatic
81
+ - [ ] Documentation is complete for public APIs
82
+ - [ ] Performance considerations addressed
83
+ - [ ] Memory safety verified
84
+
85
+ # Step 7: Cargo Operations
86
+
87
+ ## Development Commands
88
+ - `cargo check`: Fast compilation checking
89
+ - `cargo build`: Build the project
90
+ - `cargo run`: Build and run the project
91
+ - `cargo test`: Run all tests
92
+ - `cargo fmt`: Format code
93
+ - `cargo clippy`: Run linter
94
+
95
+ ## Dependency Management
96
+ - `cargo add <dependency>`: Add a new dependency
97
+ - `cargo update`: Update dependencies
98
+ - `cargo tree`: Show dependency tree
99
+ - `cargo audit`: Check for security vulnerabilities
100
+
101
+ # Step 8: Advanced Rust Features
102
+
103
+ ## Async/Await
104
+ - **Async Runtime:** Use tokio, async-std, or smol based on project
105
+ - **Futures:** Understand and use futures appropriately
106
+ - **Concurrency:** Use channels and synchronization primitives
107
+
108
+ ## Macros
109
+ - **Declarative Macros:** Use for code generation when appropriate
110
+ - **Procedural Macros:** Use for advanced metaprogramming
111
+ - **Attribute Macros:** Use for annotations and code transformation
112
+
113
+ ## Unsafe Code (Use Sparingly)
114
+ - **FFI:** For foreign function interface
115
+ - **Memory Management:** For low-level memory operations
116
+ - **Performance Optimization:** Only when measurements justify
117
+ - **Documentation:** Must document safety invariants
118
+
119
+ # Step 9: Finalize and Deliver
120
+
121
+ 1. **Verify Dependencies:** Ensure dependency versions are appropriate
122
+ 2. **Run Full Test Suite:** Verify all existing tests still pass
123
+ 3. **Security Audit:** Run `cargo audit` for security vulnerabilities
124
+ 4. **Performance Testing:** Benchmark critical code paths if applicable
125
+ 5. **Documentation:** Generate and verify rustdoc documentation
126
+
127
+ # Common Patterns
128
+
129
+ ## Error Handling
130
+ - **thiserror:** For defining custom error types
131
+ - **anyhow:** For application-level error handling
132
+ - **Result Propagation:** Use `?` operator appropriately
133
+
134
+ ## Concurrency
135
+ - **std::thread:** For CPU-bound parallelism
136
+ - **tokio::spawn:** For async task spawning
137
+ - **std::sync:** For synchronization primitives
138
+ - **crossbeam:** For advanced concurrency patterns
139
+
140
+ ## Performance
141
+ - **Profiling:** Use perf, flamegraph, or cargo instruments
142
+ - **Benchmarking:** Use criterion for reliable benchmarks
143
+ - **Optimization:** Focus on measured bottlenecks
144
+
145
+ # Risk Assessment Guidelines
146
+
147
+ ## Low Risk (Proceed Directly)
148
+ - Adding tests to existing test modules
149
+ - Implementing utility functions following established patterns
150
+ - Creating new modules in established patterns
151
+
152
+ ## Moderate Risk (Explain and Confirm)
153
+ - Modifying core data structures
154
+ - Changing public trait implementations
155
+ - Adding new dependencies
156
+ - Using `unsafe` blocks
157
+
158
+ ## High Risk (Refuse and Explain)
159
+ - Breaking memory safety guarantees
160
+ - Modifying critical system components
161
+ - Changes affecting multiple crates in workspace
162
+ - Operations that could introduce security vulnerabilities