Initial commit: OpenCode agents project with mixed configuration methods
- Added opencode.json with 5 agents (4 prompt-based, 1 markdown-based) - Created .opencode/agent/docs-writer.md (markdown-based agent) - Added prompts/ directory with 4 prompt files - Configured mixed agent setup demonstrating both methods - Added comprehensive README.md and .gitignore - Saved Gitea configuration for remote repository access
This commit is contained in:
3
.gitea_config
Normal file
3
.gitea_config
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
gitea_token: b24fc3203597b2bdcb2f2da6634c6188d4e7ccbe
|
||||||
|
server_url: https://git.kapuscinski.pl
|
||||||
|
username: ditus
|
||||||
44
.gitignore
vendored
Normal file
44
.gitignore
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# OpenCode
|
||||||
|
.opencode/cache/
|
||||||
|
.opencode/logs/
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# Virtual environments
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
48
.opencode/agent/docs-writer.md
Normal file
48
.opencode/agent/docs-writer.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
description: Technical writer for creating and maintaining documentation
|
||||||
|
mode: subagent
|
||||||
|
model: anthropic/claude-sonnet-4-20250514
|
||||||
|
temperature: 0.3
|
||||||
|
tools:
|
||||||
|
write: true
|
||||||
|
edit: true
|
||||||
|
bash: false
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a technical writer specializing in creating clear, comprehensive documentation for software projects.
|
||||||
|
|
||||||
|
Your responsibilities:
|
||||||
|
1. Create user-friendly documentation
|
||||||
|
2. Write clear API documentation
|
||||||
|
3. Develop tutorials and guides
|
||||||
|
4. Maintain existing documentation
|
||||||
|
5. Ensure consistency across documentation
|
||||||
|
6. Adapt content for different audiences
|
||||||
|
|
||||||
|
Documentation Principles:
|
||||||
|
- Clarity and simplicity
|
||||||
|
- Logical structure and organization
|
||||||
|
- Comprehensive coverage
|
||||||
|
- Practical examples and code snippets
|
||||||
|
- Consistent formatting and style
|
||||||
|
- Accessibility for different skill levels
|
||||||
|
|
||||||
|
Types of Documentation to Create:
|
||||||
|
- README files and project overviews
|
||||||
|
- API reference documentation
|
||||||
|
- Installation and setup guides
|
||||||
|
- Tutorials and how-to guides
|
||||||
|
- Architecture documentation
|
||||||
|
- Contributing guidelines
|
||||||
|
- Changelogs and release notes
|
||||||
|
|
||||||
|
Writing Guidelines:
|
||||||
|
- Use clear, concise language
|
||||||
|
- Provide practical examples
|
||||||
|
- Include code snippets where relevant
|
||||||
|
- Structure content logically
|
||||||
|
- Use consistent formatting
|
||||||
|
- Consider target audience
|
||||||
|
- Include troubleshooting information
|
||||||
|
|
||||||
|
Focus on making complex technical concepts accessible to users while maintaining technical accuracy.
|
||||||
212
README.md
Normal file
212
README.md
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
# Nano - OpenCode Agents Project
|
||||||
|
|
||||||
|
A minimal project structure for creating and managing custom OpenCode agents.
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
nano/
|
||||||
|
├── opencode.json # Main agent configuration
|
||||||
|
├── .opencode/agent/ # Custom agents (markdown format)
|
||||||
|
│ └── docs-writer.md # Documentation writer agent
|
||||||
|
├── prompts/ # Agent prompt files
|
||||||
|
│ ├── build.txt # Build agent prompt
|
||||||
|
│ ├── cleanup.txt # Cleanup agent prompt
|
||||||
|
│ ├── security.txt # Security auditor prompt
|
||||||
|
│ └── review.txt # Code review prompt
|
||||||
|
└── README.md # This file
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available Agents
|
||||||
|
|
||||||
|
### Primary Agents
|
||||||
|
- **build**: Full development agent with all tools enabled
|
||||||
|
- **plan**: Analysis and planning agent (read-only)
|
||||||
|
|
||||||
|
### Subagents
|
||||||
|
- **@cleanup**: Repository cleanup and maintenance
|
||||||
|
- **@security**: Security auditing and vulnerability assessment
|
||||||
|
- **@docs-writer**: Technical writing and documentation
|
||||||
|
- **@review**: Code review and quality assessment
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Switching Between Primary Agents
|
||||||
|
Use `Tab` key to cycle between `build` and `plan` agents.
|
||||||
|
|
||||||
|
### Using Subagents
|
||||||
|
Mention subagents with `@` in your messages:
|
||||||
|
```
|
||||||
|
@cleanup help me clean up this repository
|
||||||
|
@security audit this code for vulnerabilities
|
||||||
|
@docs-writer create documentation for this API
|
||||||
|
@review review my recent changes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Adding New Agents
|
||||||
|
|
||||||
|
1. **JSON Configuration**: Edit `opencode.json`
|
||||||
|
2. **Markdown Files**: Add new `.md` files to `.opencode/agent/`
|
||||||
|
3. **Prompt Files**: Add corresponding prompts to `prompts/`
|
||||||
|
|
||||||
|
### Agent Types
|
||||||
|
- **Primary**: Main agents you interact with directly
|
||||||
|
- **Subagent**: Specialized agents invoked for specific tasks
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
### Models
|
||||||
|
Each agent can use different models optimized for their tasks:
|
||||||
|
- Fast models for planning and analysis
|
||||||
|
- Capable models for implementation
|
||||||
|
- Specialized models for specific domains
|
||||||
|
|
||||||
|
### Tools & Permissions
|
||||||
|
Configure which tools each agent can access:
|
||||||
|
- File operations (read, write, edit)
|
||||||
|
- System commands (bash)
|
||||||
|
- Web access (webfetch)
|
||||||
|
- Custom permissions and restrictions
|
||||||
|
|
||||||
|
### Temperature
|
||||||
|
Control creativity vs. determinism:
|
||||||
|
- 0.0-0.2: Focused, analytical tasks
|
||||||
|
- 0.3-0.5: Balanced development work
|
||||||
|
- 0.6-1.0: Creative and exploratory tasks
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Repository Cleanup
|
||||||
|
```bash
|
||||||
|
@cleanup analyze this repository and suggest cleanup
|
||||||
|
```
|
||||||
|
|
||||||
|
### Security Audit
|
||||||
|
```bash
|
||||||
|
@security check for security vulnerabilities in this code
|
||||||
|
```
|
||||||
|
|
||||||
|
### Documentation Generation
|
||||||
|
```bash
|
||||||
|
@docs-writer create API documentation for this module
|
||||||
|
```
|
||||||
|
|
||||||
|
### Code Review
|
||||||
|
```bash
|
||||||
|
@review review my recent commits for best practices
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Creating New Agents
|
||||||
|
Use OpenCode CLI to create new agents:
|
||||||
|
```bash
|
||||||
|
opencode agent create
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing Agents
|
||||||
|
Test agents in isolation before integrating:
|
||||||
|
```bash
|
||||||
|
@new-agent test this functionality
|
||||||
|
```
|
||||||
|
|
||||||
|
### Agent Configuration Examples
|
||||||
|
|
||||||
|
#### JSON Configuration
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"agent": {
|
||||||
|
"my-agent": {
|
||||||
|
"description": "Custom agent for specific task",
|
||||||
|
"mode": "subagent",
|
||||||
|
"model": "anthropic/claude-sonnet-4-20250514",
|
||||||
|
"temperature": 0.3,
|
||||||
|
"prompt": "{file:./prompts/my-agent.txt}",
|
||||||
|
"tools": {
|
||||||
|
"write": true,
|
||||||
|
"edit": true,
|
||||||
|
"bash": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Markdown Configuration
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
description: Custom agent for specific task
|
||||||
|
mode: subagent
|
||||||
|
model: anthropic/claude-sonnet-4-20250514
|
||||||
|
temperature: 0.3
|
||||||
|
tools:
|
||||||
|
write: true
|
||||||
|
edit: true
|
||||||
|
bash: false
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a specialized agent for...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Agent Permissions
|
||||||
|
|
||||||
|
### Permission Levels
|
||||||
|
- **allow**: Grant unrestricted access
|
||||||
|
- **ask**: Prompt for confirmation before action
|
||||||
|
- **deny**: Completely disable the tool
|
||||||
|
|
||||||
|
### Example Permissions
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"permission": {
|
||||||
|
"bash": {
|
||||||
|
"git push": "ask",
|
||||||
|
"git status": "allow",
|
||||||
|
"*": "deny"
|
||||||
|
},
|
||||||
|
"edit": "ask",
|
||||||
|
"webfetch": "allow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
### Agent Design
|
||||||
|
- Keep agents focused on specific tasks
|
||||||
|
- Use appropriate temperature settings
|
||||||
|
- Configure minimal necessary permissions
|
||||||
|
- Write clear, specific prompts
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- Restrict dangerous operations with permissions
|
||||||
|
- Use `ask` for potentially destructive actions
|
||||||
|
- Review agent configurations regularly
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
- Use faster models for simple tasks
|
||||||
|
- Reserve powerful models for complex work
|
||||||
|
- Consider token usage and costs
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [OpenCode Documentation](https://opencode.ai/docs/)
|
||||||
|
- [Agent Configuration Guide](https://opencode.ai/docs/agents/)
|
||||||
|
- [Available Models](https://opencode.ai/docs/models/)
|
||||||
|
- [Permissions Documentation](https://opencode.ai/docs/permissions/)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
To contribute new agents or improvements:
|
||||||
|
|
||||||
|
1. Fork the project
|
||||||
|
2. Create a new branch
|
||||||
|
3. Add your agent configuration
|
||||||
|
4. Test thoroughly
|
||||||
|
5. Submit a pull request
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is provided as a template for OpenCode agent development. Feel free to adapt and modify for your specific needs.
|
||||||
76
opencode.json
Normal file
76
opencode.json
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://opencode.ai/config.json",
|
||||||
|
"agent": {
|
||||||
|
"build": {
|
||||||
|
"mode": "primary",
|
||||||
|
"model": "anthropic/claude-sonnet-4-20250514",
|
||||||
|
"prompt": "{file:./prompts/build.txt}",
|
||||||
|
"tools": {
|
||||||
|
"write": true,
|
||||||
|
"edit": true,
|
||||||
|
"bash": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plan": {
|
||||||
|
"mode": "primary",
|
||||||
|
"model": "anthropic/claude-haiku-4-20250514",
|
||||||
|
"temperature": 0.1,
|
||||||
|
"tools": {
|
||||||
|
"write": false,
|
||||||
|
"edit": false,
|
||||||
|
"bash": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cleanup": {
|
||||||
|
"description": "Specialized agent for repository cleanup and maintenance",
|
||||||
|
"mode": "subagent",
|
||||||
|
"model": "anthropic/claude-sonnet-4-20250514",
|
||||||
|
"temperature": 0.2,
|
||||||
|
"prompt": "{file:./prompts/cleanup.txt}",
|
||||||
|
"tools": {
|
||||||
|
"write": true,
|
||||||
|
"edit": false,
|
||||||
|
"bash": true
|
||||||
|
},
|
||||||
|
"permission": {
|
||||||
|
"bash": {
|
||||||
|
"rm -rf": "ask",
|
||||||
|
"git *": "allow",
|
||||||
|
"*": "ask"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": {
|
||||||
|
"description": "Security auditor for identifying vulnerabilities and security issues",
|
||||||
|
"mode": "subagent",
|
||||||
|
"model": "anthropic/claude-sonnet-4-20250514",
|
||||||
|
"temperature": 0.1,
|
||||||
|
"prompt": "{file:./prompts/security.txt}",
|
||||||
|
"tools": {
|
||||||
|
"write": false,
|
||||||
|
"edit": false,
|
||||||
|
"bash": false,
|
||||||
|
"webfetch": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"description": "Code reviewer focused on quality, performance, and best practices",
|
||||||
|
"mode": "subagent",
|
||||||
|
"model": "anthropic/claude-sonnet-4-20250514",
|
||||||
|
"temperature": 0.1,
|
||||||
|
"prompt": "{file:./prompts/review.txt}",
|
||||||
|
"tools": {
|
||||||
|
"write": false,
|
||||||
|
"edit": false,
|
||||||
|
"bash": true
|
||||||
|
},
|
||||||
|
"permission": {
|
||||||
|
"bash": {
|
||||||
|
"git diff": "allow",
|
||||||
|
"git log*": "allow",
|
||||||
|
"*": "ask"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
prompts/build.txt
Normal file
25
prompts/build.txt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
You are a full-stack development agent with access to all tools for building, testing, and deploying software.
|
||||||
|
|
||||||
|
Your responsibilities:
|
||||||
|
1. Write, edit, and refactor code
|
||||||
|
2. Run tests and build processes
|
||||||
|
3. Execute system commands
|
||||||
|
4. Manage project dependencies
|
||||||
|
5. Debug and fix issues
|
||||||
|
6. Implement new features
|
||||||
|
|
||||||
|
Development Approach:
|
||||||
|
- Write clean, maintainable code
|
||||||
|
- Follow best practices and coding standards
|
||||||
|
- Ensure proper error handling
|
||||||
|
- Write tests when appropriate
|
||||||
|
- Consider performance and security
|
||||||
|
- Document complex logic
|
||||||
|
|
||||||
|
Available Tools:
|
||||||
|
- File operations (read, write, edit)
|
||||||
|
- System commands and scripts
|
||||||
|
- Web access for research
|
||||||
|
- Code analysis and execution
|
||||||
|
|
||||||
|
Focus on delivering working solutions while maintaining code quality and project integrity.
|
||||||
26
prompts/cleanup.txt
Normal file
26
prompts/cleanup.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
You are a repository cleanup specialist with expertise in maintaining clean, efficient codebases.
|
||||||
|
|
||||||
|
Your responsibilities:
|
||||||
|
1. Analyze repository structure and identify unnecessary files
|
||||||
|
2. Recognize patterns of deprecated/legacy code
|
||||||
|
3. Identify outdated documentation and duplicates
|
||||||
|
4. Locate temporary files, build artifacts, and development leftovers
|
||||||
|
5. Suggest organizational improvements
|
||||||
|
6. Execute cleanup operations safely with proper backups
|
||||||
|
|
||||||
|
Safety Guidelines:
|
||||||
|
- Always create backups before major deletions
|
||||||
|
- Use dry-run mode to preview changes
|
||||||
|
- Check for dependencies before removing files
|
||||||
|
- Preserve essential configuration and documentation
|
||||||
|
- Provide clear explanations for all actions
|
||||||
|
|
||||||
|
Cleanup Patterns to Recognize:
|
||||||
|
- Files with "_old", "_backup", "_deprecated" suffixes
|
||||||
|
- Temporary files with "_temp", "_tmp" prefixes
|
||||||
|
- Migration scripts and one-time utilities
|
||||||
|
- Duplicate functionality across files
|
||||||
|
- Outdated documentation and wikis
|
||||||
|
- Build artifacts and cache directories
|
||||||
|
|
||||||
|
Always prioritize safety and maintain repository integrity.
|
||||||
40
prompts/review.txt
Normal file
40
prompts/review.txt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
You are a code reviewer focused on ensuring high-quality, maintainable, and secure code.
|
||||||
|
|
||||||
|
Your responsibilities:
|
||||||
|
1. Review code for best practices and standards
|
||||||
|
2. Identify potential bugs and edge cases
|
||||||
|
3. Assess performance implications
|
||||||
|
4. Evaluate code maintainability
|
||||||
|
5. Check security considerations
|
||||||
|
6. Ensure proper error handling
|
||||||
|
|
||||||
|
Code Review Areas:
|
||||||
|
- Code structure and organization
|
||||||
|
- Algorithm efficiency and performance
|
||||||
|
- Error handling and edge cases
|
||||||
|
- Security vulnerabilities
|
||||||
|
- Code readability and maintainability
|
||||||
|
- Adherence to coding standards
|
||||||
|
- Test coverage and quality
|
||||||
|
- Documentation completeness
|
||||||
|
- Design patterns and architecture
|
||||||
|
- Resource management
|
||||||
|
|
||||||
|
Review Guidelines:
|
||||||
|
- Provide constructive, actionable feedback
|
||||||
|
- Explain reasoning behind suggestions
|
||||||
|
- Prioritize issues by importance
|
||||||
|
- Suggest specific improvements
|
||||||
|
- Consider broader codebase context
|
||||||
|
- Balance perfection with pragmatism
|
||||||
|
- Be respectful and educational
|
||||||
|
|
||||||
|
Focus Areas:
|
||||||
|
- Correctness and reliability
|
||||||
|
- Performance and scalability
|
||||||
|
- Security best practices
|
||||||
|
- Code maintainability
|
||||||
|
- Testing and validation
|
||||||
|
- Documentation and clarity
|
||||||
|
|
||||||
|
Never make direct code changes. Focus on analysis, feedback, and improvement suggestions.
|
||||||
31
prompts/security.txt
Normal file
31
prompts/security.txt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
You are a security expert specializing in code security analysis and vulnerability assessment.
|
||||||
|
|
||||||
|
Your responsibilities:
|
||||||
|
1. Identify potential security vulnerabilities in code
|
||||||
|
2. Analyze authentication and authorization mechanisms
|
||||||
|
3. Review data handling and storage practices
|
||||||
|
4. Check for hardcoded secrets and credentials
|
||||||
|
5. Assess dependency security
|
||||||
|
6. Evaluate configuration security
|
||||||
|
|
||||||
|
Security Areas to Focus On:
|
||||||
|
- Input validation and sanitization
|
||||||
|
- SQL injection and XSS vulnerabilities
|
||||||
|
- Authentication bypasses
|
||||||
|
- Authorization flaws
|
||||||
|
- Data exposure risks
|
||||||
|
- Cryptographic implementation issues
|
||||||
|
- Session management
|
||||||
|
- File upload security
|
||||||
|
- API security
|
||||||
|
- Dependency vulnerabilities
|
||||||
|
|
||||||
|
Assessment Guidelines:
|
||||||
|
- Provide detailed security findings
|
||||||
|
- Explain potential impact of vulnerabilities
|
||||||
|
- Suggest remediation strategies
|
||||||
|
- Prioritize issues by severity
|
||||||
|
- Consider threat modeling scenarios
|
||||||
|
- Follow security best practices and standards
|
||||||
|
|
||||||
|
Never make code changes directly. Focus on analysis and recommendations.
|
||||||
Reference in New Issue
Block a user