blob: 99dbb5da9b36740cfee24a988f7f0507ee197a34 [file] [log] [blame] [view]
iomodo3b548942025-07-27 15:27:01 +04001# CLAUDE.md
2
3This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
5## Project Overview
6
7This is an AI multi-agent system called "Staff" that simulates a tech startup organization with different specialized AI agents (CEO, Product Manager, Engineers, etc.). The system integrates multiple LLM providers and implements a comprehensive task management workflow with Git-based operations.
8
9### Core Architecture
10
11- **Multi-Agent System**: Different AI agents with specialized roles (CEO, PM, Backend Engineer, Frontend Engineer, etc.)
12- **Task Management**: Git-based task tracking system with automated PR creation
13- **LLM Integration**: Unified interface supporting multiple providers (OpenAI, xAI, Claude, Gemini, local models)
14- **Agent Workflow**: Agents fetch tasks process with LLM create solutions submit PRs
15
16### Key Components
17
181. **`/server/`** - Go backend with core agent infrastructure
19 - **`agent/`** - Agent system that processes tasks autonomously using LLMs
20 - **`llm/`** - Unified LLM provider interface and factory system
21 - **`tm/`** - Task management interfaces and types
22 - **`git/`** - Git operations for PR creation and repository management
23 - **`cmd/`** - CLI commands and main entry point
24
252. **`/operations/`** - Company operational structure
26 - **`agents/`** - Agent role definitions and system prompts
27 - **`tasks/`** - Task files and examples
28
29## Development Commands
30
31### Building and Running
32```bash
33# Build the application
34cd server && go build -o staff ./cmd/main.go
35
36# Run with specific commands
37./staff [command] [args]
38
39# Run tests
40go test ./server/...
41
42# Run specific package tests
43go test ./server/agent/...
44go test ./server/llm/...
45go test ./server/tm/...
46```
47
48### Common Development Tasks
49
50```bash
51# Format code
52go fmt ./...
53
54# Check for linting issues
55go vet ./...
56
57# Update dependencies
58go mod tidy
59
60# View available commands
61./staff --help
62```
63
64## Agent System Architecture
65
66### Agent Lifecycle
671. **Configuration**: Each agent has a unique name, role, Git credentials, LLM provider, and system prompt
682. **Task Processing Loop**: Continuously fetches assigned tasks from task manager
693. **LLM Integration**: Sends task descriptions to configured LLM for solutions
704. **Git Operations**: Creates branch, commits solution, pushes PR
715. **Task Completion**: Marks task as completed in task management system
72
73### Agent Configuration
74- Each agent requires unique name, role, Git credentials, working directory
75- LLM configuration includes provider type, model, API credentials
76- System prompts define agent behavior and expertise area
77- Task manager integration for fetching and updating tasks
78
79### Task Management
80- Tasks have states: todo in_progress completed archived
81- Task priorities: low, medium, high
82- Git-based task tracking with markdown files
83- Automated PR creation for task solutions
84
85## LLM Provider System
86
87### Supported Providers
88- OpenAI (GPT models)
89- xAI (Grok models)
90- Claude (Anthropic)
91- Gemini (Google)
92- Local models
93
94### Provider Interface
95All providers implement the same interface:
96- `ChatCompletion()` - Main chat completion endpoint
97- `CreateEmbeddings()` - Text embedding generation
98- `Close()` - Resource cleanup
99
100### Configuration
101Each provider requires:
102- API key and base URL
103- Timeout and retry settings
104- Provider-specific extra parameters
105
106## File Structure Patterns
107
108### Agent Definitions
109- Agent system prompts stored in `/operations/agents/{role}/system.md`
110- Each agent has detailed role definition and behavioral guidelines
111
112### Task Files
113- Task templates in `/operations/tasks/`
114- Format: `task-{timestamp}-{id}.md`
115- Include task metadata, description, and assignment info
116
117### Solution PRs
118- Agents create branches: `task/{task-id}-{clean-title}`
119- Solutions formatted as markdown with task metadata
120- Automated commit messages and PR descriptions
121
122## Key Dependencies
123
124### Go Modules
125- `github.com/spf13/cobra` - CLI framework
126- `github.com/google/uuid` - UUID generation
127- `github.com/stretchr/testify` - Testing framework
128- `golang.org/x/text` - Text processing
129- `gopkg.in/yaml.v3` - YAML parsing
130
131### Development Dependencies
132- Go 1.24.4+ required
133- Git for version control and PR operations
134- Access to LLM provider APIs (OpenAI, etc.)
135
136## Testing Strategy
137
138### Test Coverage
139- Unit tests for all major components
140- Agent configuration validation
141- LLM provider interface compliance
142- Task management operations
143- Git operations and branch creation
144
145### Test Execution
146```bash
147# Run all tests
148go test ./server/...
149
150# Run with coverage
151go test -cover ./server/...
152
153# Run specific test suites
154go test ./server/agent/ -v
155go test ./server/llm/ -v
156go test ./server/tm/ -v
157```
158
159## Security Considerations
160
161- API keys managed through environment variables
162- No hardcoded credentials in codebase
163- Git operations use configured user credentials
164- LLM responses processed but not executed directly
165
166## Integration Points
167
168### External Systems
169- Git repositories for task management and code storage
170- LLM provider APIs for agent intelligence
171- Task management systems (GitHub Projects, Asana, Jira)
172
173### Internal Communication
174- Agents communicate through task management system
175- PR review process for human oversight
176- Automated task assignment and completion tracking