Thank you for your interest in contributing! We welcome contributions from everyone. This document provides guidelines for developing in our monorepo.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior via GitHub issues.
There are many ways to contribute to AI Agent Platform:
- 🐛 Report bugs via GitHub Issues
- 💡 Suggest features via GitHub Issues
- 📝 Improve documentation by submitting PRs
- 🔧 Fix bugs or implement features
- ❓ Answer questions in GitHub Discussions
- ⭐ Star the project to show your support
- 📖 Read the README for project overview
- 🏗️ Check ARCHITECTURE.md for design details
- 💬 Ask questions in GitHub Discussions
- 🐛 Search existing issues before creating new ones
- Node.js 20+ (required)
- pnpm 8+ (required)
- Git for version control
For external contributors:
# Fork the repository on GitHub first, then:
git clone https://github.com/YOUR_USERNAME/agent.git
cd agent
pnpm installFor maintainers or direct access:
git clone https://github.com/Phoenixrr2113/agent.git
cd agent
pnpm installcp .env.example .envEdit .env with your API keys:
- Required:
OPENROUTER_API_KEY,GOOGLE_GENERATIVE_AI_API_KEY - Optional:
BRAVE_API_KEY,TAVILY_API_KEY
pnpm build# Run interactive chat
pnpm chat
# Or start HTTP server
pnpm serveragent-platform/
├── packages/
│ ├── shared/ # Base utilities (logger, performance)
│ ├── core/ # Agent runtime engine
│ └── server/ # HTTP API server
├── apps/
│ └── cli/ # CLI applications
├── pnpm-workspace.yaml
├── turbo.json
└── package.json
@agent/shared (no dependencies)
↓
@agent/core (depends on: @agent/shared)
↓
@agent/server (depends on: @agent/core, @agent/shared)
↓
@agent/cli (depends on: @agent/core, @agent/server, @agent/shared)
- Create a branch for your changes
- Make your changes to the appropriate package
- Build to compile TypeScript
- Test your changes
- Commit with clear messages
- Push and create a pull request
# Build all packages (Turborepo handles dependencies automatically)
pnpm build
# Build specific package
pnpm --filter @agent/core build
# Clean and rebuild
pnpm clean && pnpm buildTurborepo automatically:
- Builds packages in dependency order
- Caches build outputs (< 1s on cache hit!)
- Rebuilds dependent packages when needed
# Run all tests
pnpm test
# Test specific package
pnpm --filter @agent/core test
# Watch mode (specific package)
pnpm --filter @agent/core test --watch# Interactive chat CLI
pnpm chat
# HTTP server (auto-restarts on changes)
pnpm server
# All packages in dev mode (parallel)
pnpm dev# Add to specific package
pnpm --filter @agent/core add <package-name>
# Add dev dependency
pnpm --filter @agent/core add -D <package-name>
# Add to root (for build tools, etc.)
pnpm add -Dw <package-name>Packages can depend on each other using the workspace:* protocol:
{
"dependencies": {
"@agent/shared": "workspace:*"
}
}- Create package directory:
mkdir -p packages/new-package/src- Create
package.json:
{
"name": "@agent/new-package",
"version": "0.1.0",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"clean": "rm -rf dist"
},
"dependencies": {
"@agent/shared": "workspace:*"
}
}- Create
tsconfig.json:
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"composite": true
},
"include": ["src/**/*"]
}- Update
pnpm-workspace.yamlif needed - Build:
pnpm build
- Use strict mode (enabled in tsconfig.base.json)
- Prefer explicit types for public APIs
- Use async/await over promises
- Avoid
any- useunknownif type is truly unknown
- Files: kebab-case (e.g.,
agent-runtime.ts) - Classes: PascalCase (e.g.,
AgentRuntime) - Functions/variables: camelCase (e.g.,
createSession) - Constants: UPPER_SNAKE_CASE (e.g.,
DEFAULT_TIMEOUT) - Types/Interfaces: PascalCase (e.g.,
AgentConfig)
- Use absolute imports for workspace packages:
import { logger } from '@agent/shared' - Use relative imports within the same package:
import { helper } from './utils' - Group imports: workspace packages → third-party → relative
// Good
import { logger } from '@agent/shared';
import { generateText } from 'ai';
import { helper } from './utils';
// Bad
import { helper } from './utils';
import { generateText } from 'ai';
import { logger } from '@agent/shared';Place tests alongside source files with .test.ts extension:
src/
├── runtime/
│ ├── agent-runtime.ts
│ └── agent-runtime.test.ts
import { describe, it, expect } from 'vitest';
describe('FeatureName', () => {
describe('specific behavior', () => {
it('should do something specific', () => {
// Arrange
const input = 'test';
// Act
const result = functionUnderTest(input);
// Assert
expect(result).toBe('expected');
});
});
});# All tests
pnpm test
# Specific package
pnpm --filter @agent/core test
# Watch mode
pnpm --filter @agent/core test --watch
# Coverage
pnpm --filter @agent/core test --coverage<type>: <description>
[optional body]
[optional footer]
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- refactor: Code refactoring
- test: Adding or updating tests
- chore: Build process, dependencies, etc.
- perf: Performance improvements
feat: add device-use package for cross-platform control
Implements native device control for desktop and mobile platforms.
Supports macOS, Linux, Windows, iOS, and Android.
Closes #123
fix: resolve memory leak in session cleanup
Sessions were not properly disposing of event listeners,
causing memory to accumulate over time.
docs: update README with monorepo structure
- ✅ Build passes:
pnpm build - ✅ Tests pass:
pnpm test - ✅ No TypeScript errors: Build should complete without errors
- ✅ Code follows style guidelines
- ✅ Commits are clean and descriptive
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
How were these changes tested?
## Checklist
- [ ] Build passes (`pnpm build`)
- [ ] Tests pass (`pnpm test`)
- [ ] Documentation updated (if needed)
- [ ] No new warnings or errorsProblem: Turborepo cache issues
# Clear Turborepo cache
rm -rf .turbo
pnpm buildProblem: TypeScript errors after pulling changes
# Reinstall and rebuild
pnpm install
pnpm buildProblem: Peer dependency warnings
# These are usually safe to ignore if the build passes
# If needed, check which packages need updates
pnpm outdatedProblem: Tests fail due to missing API keys
# Ensure .env file exists with required keys
cp .env.example .env
# Add your API keys to .envProblem: Tests timeout
# Some tests (especially with LLM calls) can be slow
# The timeout is disabled in vitest.config.ts
# If needed, you can skip slow tests:
pnpm test -- --exclude "**/*.integration.test.ts"- Keep minimal dependencies
- Must not depend on other workspace packages
- All exports should be pure utilities
- Core business logic only
- No HTTP-specific code (that goes in @agent/server)
- No CLI-specific code (that goes in @agent/cli)
- Properly export types for consumers
- HTTP layer only
- Use @agent/core for business logic
- Follow REST conventions
- Document all endpoints
- CLI interface only
- Use @agent/core and @agent/server for functionality
- Provide clear error messages
- Support --help for all commands
For major architectural changes:
- Open an issue to discuss the proposal
- Get consensus from maintainers
- Update docs/ARCHITECTURE.md with the design
- Implement in phases if large
- Update this CONTRIBUTING.md if development workflow changes
- Open an issue for bugs or feature requests
- Start a discussion for questions or ideas
- Check existing issues and discussions first
By contributing, you agree that your contributions will be licensed under the MIT License.