blob: 522115dd1b10539fd6b23c603bd62fbbb26c1f99 [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
iomodod89df962025-07-31 12:53:05 +040033# Run the application
34cd server && go run cmd/main.go server
iomodo3b548942025-07-27 15:27:01 +040035
iomodo3b548942025-07-27 15:27:01 +040036
iomodo3b548942025-07-27 15:27:01 +040037
iomodod89df962025-07-31 12:53:05 +040038### Testing
39```bash
40# Run all tests
41cd server && go test ./...
42
43# Run with coverage
44cd server && go test -cover ./...
iomodo3b548942025-07-27 15:27:01 +040045
46### Common Development Tasks
iomodo3b548942025-07-27 15:27:01 +040047```bash
iomodo3b548942025-07-27 15:27:01 +040048# Check for linting issues
iomodod89df962025-07-31 12:53:05 +040049cd server && go vet ./...
iomodo3b548942025-07-27 15:27:01 +040050
51# Update dependencies
iomodod89df962025-07-31 12:53:05 +040052cd server && go mod tidy
iomodo3b548942025-07-27 15:27:01 +040053```
54
55## Agent System Architecture
56
57### Agent Lifecycle
581. **Configuration**: Each agent has a unique name, role, Git credentials, LLM provider, and system prompt
592. **Task Processing Loop**: Continuously fetches assigned tasks from task manager
603. **LLM Integration**: Sends task descriptions to configured LLM for solutions
614. **Git Operations**: Creates branch, commits solution, pushes PR
625. **Task Completion**: Marks task as completed in task management system
63
64### Agent Configuration
65- Each agent requires unique name, role, Git credentials, working directory
66- LLM configuration includes provider type, model, API credentials
67- System prompts define agent behavior and expertise area
68- Task manager integration for fetching and updating tasks
69
70### Task Management
71- Tasks have states: todo in_progress completed archived
72- Task priorities: low, medium, high
73- Git-based task tracking with markdown files
74- Automated PR creation for task solutions
75
76## LLM Provider System
77
78### Supported Providers
79- OpenAI (GPT models)
80- xAI (Grok models)
81- Claude (Anthropic)
82- Gemini (Google)
iomodod89df962025-07-31 12:53:05 +040083- Local models (via Ollama)
84- Fake provider (for testing)
iomodo3b548942025-07-27 15:27:01 +040085
86### Provider Interface
87All providers implement the same interface:
88- `ChatCompletion()` - Main chat completion endpoint
89- `CreateEmbeddings()` - Text embedding generation
90- `Close()` - Resource cleanup
91
92### Configuration
93Each provider requires:
94- API key and base URL
95- Timeout and retry settings
96- Provider-specific extra parameters
97
iomodod89df962025-07-31 12:53:05 +040098Configuration can be provided via:
99- `config.yaml` file in server directory
100- Environment variables (OPENAI_API_KEY, GITHUB_TOKEN, etc.)
101- Command-line configuration during setup
102
iomodo3b548942025-07-27 15:27:01 +0400103## File Structure Patterns
104
105### Agent Definitions
iomodod89df962025-07-31 12:53:05 +0400106- Agent system prompts stored in `/operations/agents/{name}/system.md`
iomodo3b548942025-07-27 15:27:01 +0400107- Each agent has detailed role definition and behavioral guidelines
108
109### Task Files
110- Task templates in `/operations/tasks/`
111- Format: `task-{timestamp}-{id}.md`
112- Include task metadata, description, and assignment info
113
114### Solution PRs
iomodod89df962025-07-31 12:53:05 +0400115- Agents create branches: `solution/{task-id}-{clean-title}` or `subtasks/{task-id}-{clean-title}`
iomodo3b548942025-07-27 15:27:01 +0400116- Solutions formatted as markdown with task metadata
117- Automated commit messages and PR descriptions
118
119## Key Dependencies
120
121### Go Modules
iomodod89df962025-07-31 12:53:05 +0400122- `github.com/spf13/cobra` - CLI framework for command-line interface
123- `github.com/google/uuid` - UUID generation for task and agent IDs
124- `github.com/joho/godotenv` - Environment variable loading from .env files
125- `golang.org/x/text` - Text processing utilities
126- `gopkg.in/yaml.v3` - YAML parsing for configuration files
iomodo3b548942025-07-27 15:27:01 +0400127
128### Development Dependencies
iomodod89df962025-07-31 12:53:05 +0400129- Go 1.24.4+ required
iomodo3b548942025-07-27 15:27:01 +0400130- Git for version control and PR operations
iomodod89df962025-07-31 12:53:05 +0400131- Access to LLM provider APIs (OpenAI, xAI, Claude, Gemini, etc.)
132- Environment variables or config.yaml for API keys and credentials
iomodo3b548942025-07-27 15:27:01 +0400133
134## Testing Strategy
135
136### Test Coverage
137- Unit tests for all major components
138- Agent configuration validation
139- LLM provider interface compliance
140- Task management operations
141- Git operations and branch creation
142
iomodo3b548942025-07-27 15:27:01 +0400143
144## Security Considerations
145
146- API keys managed through environment variables
147- No hardcoded credentials in codebase
148- Git operations use configured user credentials
149- LLM responses processed but not executed directly
150
151## Integration Points
152
153### External Systems
iomodod89df962025-07-31 12:53:05 +0400154- Git repositories for task management and code storage (GitHub/Gerrit)
iomodo3b548942025-07-27 15:27:01 +0400155- LLM provider APIs for agent intelligence
iomodod89df962025-07-31 12:53:05 +0400156- Task management systems via Git-based task tracking
iomodo3b548942025-07-27 15:27:01 +0400157
158### Internal Communication
159- Agents communicate through task management system
160- PR review process for human oversight
161- Automated task assignment and completion tracking