Thank you for your interest in contributing to Lucid Agents! This document provides guidelines and instructions for contributing to the project.
- Getting Started
- Development Workflow
- Making Changes
- Testing
- Pull Requests
- Release Process
- Code Standards
- Bun >= 20.9.0 (install from bun.sh)
- Git for version control
- A code editor (VS Code recommended)
- Clone the repository
git clone https://github.com/lucid-dreams-ai/lucid-agents.git
cd lucid-agents- Install dependencies
bun installThis installs all dependencies for the monorepo and individual packages.
The repository is organized as a monorepo with multiple packages:
lucid-agents/
├── packages/
│ ├── agent-kit/ # Core agent runtime
│ ├── agent-kit-identity/ # ERC-8004 identity toolkit
│ └── create-agent-kit/ # CLI scaffolding tool
├── scripts/ # Build and release scripts
├── package.json # Root package configuration
└── readme.md # Main documentation
Each package has its own:
package.json- Dependencies and scriptssrc/- Source code__tests__/- Test files (where applicable)README.md- Package-specific documentation
Build all packages:
bun run build:packagesBuild a specific package:
cd packages/agent-kit
bun run buildMost packages support watch mode for development:
cd packages/agent-kit
bun run devPackages include example files demonstrating usage:
# Run an example from agent-kit
cd packages/agent-kit
bun run examples/full-agent.ts
# Run an example from agent-kit-identity
cd packages/agent-kit-identity
bun run examples/quick-start.tsUse descriptive branch names that indicate the type of change:
feature/add-new-entrypoint-type- New featuresfix/payment-validation-bug- Bug fixesdocs/update-api-reference- Documentation updatesrefactor/simplify-config-loading- Code refactoringtest/add-identity-registry-tests- Test additions
Write clear, concise commit messages following these guidelines:
Format:
<type>: <subject>
<body>
<footer>
Types:
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, no logic change)refactor- Code refactoringtest- Adding or updating testschore- Maintenance tasks
Examples:
feat: add streaming support to entrypoints
Implements Server-Sent Events (SSE) streaming for long-running
agent operations. Adds stream() handler alongside existing handler().
Closes #42
fix: resolve payment validation error for zero prices
Previously, zero prices would cause validation to fail. Now correctly
handles zero as valid when payments are optional.
Fixes #123
When working on a specific package:
-
Navigate to the package directory
cd packages/agent-kit -
Make your changes in
src/ -
Update tests in
__tests__/(if applicable) -
Update documentation in
README.md -
Build and test locally
bun run build bun test
Run all tests across the monorepo:
bun testRun tests for a specific package:
cd packages/agent-kit
bun testRun tests in watch mode:
bun test --watchTests are located in __tests__/ directories within each package.
Test file naming:
*.test.ts- Unit tests*.integration.test.ts- Integration tests
Example test structure:
import { describe, test, expect } from "bun:test";
import { createAgentApp } from "../src/app";
describe("createAgentApp", () => {
test("creates app with metadata", () => {
const { app, config } = createAgentApp({
name: "test-agent",
version: "1.0.0",
});
expect(app).toBeDefined();
expect(config).toBeDefined();
});
});Aim for good test coverage, especially for:
- Public APIs
- Core functionality
- Edge cases and error handling
- Breaking changes
-
Test your changes
bun test -
Build packages
bun run build:packages
-
Check TypeScript types
bunx tsc --noEmit
-
Update documentation if you've changed APIs
- Code follows TypeScript and ESM standards
- Tests pass locally
- New functionality includes tests
- Documentation is updated (README, inline comments)
- Commit messages follow guidelines
- PR description explains the changes
- Related issues are referenced
## Description
Brief description of what this PR does.
## Motivation
Why is this change needed?
## Changes
- List of specific changes made
- Can be bullet points
## Testing
How was this tested?
## Related Issues
Closes #123
Fixes #456- Submit PR - Create a pull request with a clear description
- Automated checks - CI/CD runs tests and builds
- Code review - Maintainers review your changes
- Address feedback - Make requested changes
- Approval - PR is approved by maintainers
- Merge - Maintainers merge the PR
Releases are managed by maintainers using Changesets.
When making changes that should be included in release notes:
-
Create a changeset
bun run changeset
-
Follow the prompts:
- Select which packages are affected
- Choose version bump type (major, minor, patch)
- Write a summary of the change
-
Commit the changeset file along with your changes
- Major (1.0.0 → 2.0.0) - Breaking changes
- Minor (1.0.0 → 1.1.0) - New features (backward compatible)
- Patch (1.0.0 → 1.0.1) - Bug fixes
Release workflow:
# 1. Version packages (updates package.json and CHANGELOG.md)
bun run release:version
# 2. Build and publish to npm
bun run release:publish- Strict mode enabled - Use strict TypeScript settings
- Explicit types - Prefer explicit return types for public APIs
- No
any- Avoidany; useunknownor proper types - ESM modules - Use ES modules (
import/export)
Example:
// Good
export function createAgent(name: string): Agent {
return { name };
}
// Avoid
export function createAgent(name) {
return { name };
}- Formatting - Use consistent indentation (2 spaces)
- Naming - Use descriptive names
- Functions:
camelCase - Classes:
PascalCase - Constants:
UPPER_SNAKE_CASE - Private members: prefix with
_
- Functions:
- Comments - Write clear comments for complex logic
- JSDoc - Document public APIs with JSDoc comments
Example:
/**
* Creates a new agent application with the given metadata.
*
* @param meta - Agent metadata including name, version, and description
* @param options - Optional configuration for payments, trust, etc.
* @returns Agent app instance with helper methods
*/
export function createAgentApp(
meta: AgentMeta,
options?: CreateAgentAppOptions
): CreateAgentAppReturn {
// Implementation
}- One export per file (for major exports)
- Group related utilities in separate files
- Index files for clean public APIs
- Types in separate files when complex
- Use custom errors for specific error cases
- Provide context in error messages
- Don't swallow errors - Always handle or propagate
Example:
// Good
if (!config.payTo) {
throw new Error(
"PaymentsConfig.payTo is required when payments are enabled"
);
}
// Avoid
if (!config.payTo) {
throw new Error("Missing payTo");
}- README files - Keep package READMEs up to date
- Inline comments - Explain complex logic
- Examples - Provide usage examples
- API docs - Document public APIs with JSDoc
If you have questions or need help:
- Open an issue - For bugs or feature requests
- Discussions - For general questions or ideas
- Discord - Join our community (link in main README)
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).