diff --git a/.agents/skills/ZooBot/SKILL.md b/.agents/skills/ZooBot/SKILL.md new file mode 100644 index 0000000..6910679 --- /dev/null +++ b/.agents/skills/ZooBot/SKILL.md @@ -0,0 +1,273 @@ +--- +name: zoobot-conventions +description: Development conventions and patterns for ZooBot. TypeScript project with conventional commits. +--- + +# Zoobot Conventions + +> Generated from [Maliot100X/ZooBot](https://github.com/Maliot100X/ZooBot) on 2026-03-23 + +## Overview + +This skill teaches Claude the development patterns and conventions used in ZooBot. + +## Tech Stack + +- **Primary Language**: TypeScript +- **Architecture**: type-based module organization +- **Test Location**: separate + +## When to Use This Skill + +Activate this skill when: +- Making changes to this repository +- Adding new features following established patterns +- Writing tests that match project conventions +- Creating commits with proper message format + +## Commit Conventions + +Follow these commit message conventions based on 8 analyzed commits. + +### Commit Style: Conventional Commits + +### Prefixes Used + +- `fix` +- `feat` +- `chore` +- `refactor` +- `docs` + +### Message Guidelines + +- Average message length: ~56 characters +- Keep first line concise and descriptive +- Use imperative mood ("Add feature" not "Added feature") + + +*Commit message example* + +```text +docs(agents): move setup and system prompt config to workspace-level AGENTS.md (#253) +``` + +*Commit message example* + +```text +refactor(telegram): migrate from node-telegram-bot-api to grammY (#248) +``` + +*Commit message example* + +```text +fix(api): resolve agent routing at enqueue time (#247) +``` + +*Commit message example* + +```text +chore: update readme +``` + +*Commit message example* + +```text +feat(office): redesign the live office workspace (#212) +``` + +*Commit message example* + +```text +Initial ZooBot commit - Open Source AI Agent Framework with Groq support +``` + +*Commit message example* + +```text +fix(telegram): fix watchdog timer bug that prevented polling restart (#246) +``` + +*Commit message example* + +```text +chore: add bin entry to package.json, update README and office screenshot +``` + +## Architecture + +### Project Structure: Monorepo + +This project uses **type-based** module organization. + +### Configuration Files + +- `.github/workflows/release.yml` +- `package.json` +- `packages/channels/package.json` +- `packages/channels/tsconfig.json` +- `packages/cli/package.json` +- `packages/cli/tsconfig.json` +- `packages/core/package.json` +- `packages/core/tsconfig.json` +- `packages/main/package.json` +- `packages/main/tsconfig.json` +- `packages/server/package.json` +- `packages/server/tsconfig.json` +- `packages/teams/package.json` +- `packages/teams/tsconfig.json` +- `packages/visualizer/package.json` +- `packages/visualizer/tsconfig.json` +- `tinyoffice/package.json` +- `tinyoffice/tsconfig.json` +- `tsconfig.json` + +### Guidelines + +- Group code by type (components, services, utils) +- Keep related functionality in the same type folder +- Avoid circular dependencies between type folders + +## Code Style + +### Language: TypeScript + +### Naming Conventions + +| Element | Convention | +|---------|------------| +| Files | camelCase | +| Functions | camelCase | +| Classes | PascalCase | +| Constants | SCREAMING_SNAKE_CASE | + +### Import Style: Relative Imports + +### Export Style: Named Exports + + +*Preferred import style* + +```typescript +// Use relative imports +import { Button } from '../components/Button' +import { useAuth } from './hooks/useAuth' +``` + +*Preferred export style* + +```typescript +// Use named exports +export function calculateTotal() { ... } +export const TAX_RATE = 0.1 +export interface Order { ... } +``` + +## Error Handling + +### Error Handling Style: Try-Catch Blocks + +A **global error handler** catches unhandled errors. + + +*Standard error handling pattern* + +```typescript +try { + const result = await riskyOperation() + return result +} catch (error) { + console.error('Operation failed:', error) + throw new Error('User-friendly message') +} +``` + +## Common Workflows + +These workflows were detected from analyzing commit patterns. + +### Database Migration + +Database schema changes with migration files + +**Frequency**: ~2 times per month + +**Steps**: +1. Create migration file +2. Update schema definitions +3. Generate/update types + +**Files typically involved**: +- `**/types.ts` + +**Example commit sequence**: +``` +refactor(queue): simplify schema and remove conversation state (#213) +feat(invoke): stream agent execution progress in real-time (#196) +refactor(cli): make tinyagi the primary CLI entrypoint (#234) +``` + +### Feature Development + +Standard feature implementation workflow + +**Frequency**: ~17 times per month + +**Steps**: +1. Add feature implementation +2. Add tests for feature +3. Update documentation + +**Files typically involved**: +- `packages/main/src/*` +- `packages/server/src/*` +- `packages/server/src/routes/*` +- `**/api/**` + +**Example commit sequence**: +``` +feat: add chat rooms and projects to tinyoffice (#199) +fix(telegram): prevent polling from stalling after network reconnect (#200) +feat(office): add organization chart visualization page (#201) +``` + +### Refactoring + +Code refactoring and cleanup workflow + +**Frequency**: ~6 times per month + +**Steps**: +1. Ensure tests pass before refactor +2. Refactor code structure +3. Verify tests still pass + +**Files typically involved**: +- `src/**/*` + +**Example commit sequence**: +``` +refactor(ui): refactor agent and task components into modules (#229) +fix(heartbeat): persist per-agent enabled and interval settings to heartbeat overrides (#230) +chore: bump version to 0.0.14 and add release notes +``` + + +## Best Practices + +Based on analysis of the codebase, follow these practices: + +### Do + +- Use conventional commit format (feat:, fix:, etc.) +- Use camelCase for file names +- Prefer named exports + +### Don't + +- Don't write vague commit messages +- Don't deviate from established patterns without discussion + +--- + +*This skill was auto-generated by [ECC Tools](https://ecc.tools). Review and customize as needed for your team.* diff --git a/.agents/skills/ZooBot/agents/openai.yaml b/.agents/skills/ZooBot/agents/openai.yaml new file mode 100644 index 0000000..99cc60f --- /dev/null +++ b/.agents/skills/ZooBot/agents/openai.yaml @@ -0,0 +1,6 @@ +interface: + display_name: "ZooBot" + short_description: "Repo-specific patterns and workflows for ZooBot" + default_prompt: "Use the ZooBot repo skill to follow existing architecture, testing, and workflow conventions." +policy: + allow_implicit_invocation: true \ No newline at end of file diff --git a/.claude/commands/database-migration.md b/.claude/commands/database-migration.md new file mode 100644 index 0000000..a99ee17 --- /dev/null +++ b/.claude/commands/database-migration.md @@ -0,0 +1,35 @@ +--- +name: database-migration +description: Workflow command scaffold for database-migration in ZooBot. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /database-migration + +Use this workflow when working on **database-migration** in `ZooBot`. + +## Goal + +Database schema changes with migration files + +## Common Files + +- `**/types.ts` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Create migration file +- Update schema definitions +- Generate/update types + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/commands/feature-development.md b/.claude/commands/feature-development.md new file mode 100644 index 0000000..8eb2640 --- /dev/null +++ b/.claude/commands/feature-development.md @@ -0,0 +1,38 @@ +--- +name: feature-development +description: Workflow command scaffold for feature-development in ZooBot. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /feature-development + +Use this workflow when working on **feature-development** in `ZooBot`. + +## Goal + +Standard feature implementation workflow + +## Common Files + +- `packages/main/src/*` +- `packages/server/src/*` +- `packages/server/src/routes/*` +- `**/api/**` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Add feature implementation +- Add tests for feature +- Update documentation + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/commands/refactoring.md b/.claude/commands/refactoring.md new file mode 100644 index 0000000..d0403e8 --- /dev/null +++ b/.claude/commands/refactoring.md @@ -0,0 +1,35 @@ +--- +name: refactoring +description: Workflow command scaffold for refactoring in ZooBot. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /refactoring + +Use this workflow when working on **refactoring** in `ZooBot`. + +## Goal + +Code refactoring and cleanup workflow + +## Common Files + +- `src/**/*` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Ensure tests pass before refactor +- Refactor code structure +- Verify tests still pass + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/ecc-tools.json b/.claude/ecc-tools.json new file mode 100644 index 0000000..f33396a --- /dev/null +++ b/.claude/ecc-tools.json @@ -0,0 +1,240 @@ +{ + "version": "1.3", + "schemaVersion": "1.0", + "generatedBy": "ecc-tools", + "generatedAt": "2026-03-23T23:43:30.999Z", + "repo": "https://github.com/Maliot100X/ZooBot", + "profiles": { + "requested": "standard", + "recommended": "standard", + "effective": "standard", + "requestedAlias": "security", + "recommendedAlias": "security", + "effectiveAlias": "developer" + }, + "requestedProfile": "security", + "profile": "developer", + "recommendedProfile": "security", + "effectiveProfile": "developer", + "tier": "free", + "requestedComponents": [ + "repo-baseline", + "workflow-automation", + "security-audits" + ], + "selectedComponents": [ + "repo-baseline", + "workflow-automation" + ], + "requestedAddComponents": [], + "requestedRemoveComponents": [], + "blockedRemovalComponents": [], + "tierFilteredComponents": [ + "security-audits" + ], + "requestedRootPackages": [ + "runtime-core", + "workflow-pack", + "agentshield-pack" + ], + "selectedRootPackages": [ + "runtime-core", + "workflow-pack" + ], + "requestedPackages": [ + "runtime-core", + "workflow-pack", + "agentshield-pack" + ], + "requestedAddPackages": [], + "requestedRemovePackages": [], + "selectedPackages": [ + "runtime-core", + "workflow-pack" + ], + "packages": [ + "runtime-core", + "workflow-pack" + ], + "blockedRemovalPackages": [], + "tierFilteredRootPackages": [ + "agentshield-pack" + ], + "tierFilteredPackages": [ + "agentshield-pack" + ], + "conflictingPackages": [], + "dependencyGraph": { + "runtime-core": [], + "workflow-pack": [ + "runtime-core" + ] + }, + "resolutionOrder": [ + "runtime-core", + "workflow-pack" + ], + "requestedModules": [ + "runtime-core", + "workflow-pack", + "agentshield-pack" + ], + "selectedModules": [ + "runtime-core", + "workflow-pack" + ], + "modules": [ + "runtime-core", + "workflow-pack" + ], + "managedFiles": [ + ".claude/skills/ZooBot/SKILL.md", + ".agents/skills/ZooBot/SKILL.md", + ".agents/skills/ZooBot/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/ZooBot-instincts.yaml", + ".claude/commands/database-migration.md", + ".claude/commands/feature-development.md", + ".claude/commands/refactoring.md" + ], + "packageFiles": { + "runtime-core": [ + ".claude/skills/ZooBot/SKILL.md", + ".agents/skills/ZooBot/SKILL.md", + ".agents/skills/ZooBot/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/ZooBot-instincts.yaml" + ], + "workflow-pack": [ + ".claude/commands/database-migration.md", + ".claude/commands/feature-development.md", + ".claude/commands/refactoring.md" + ] + }, + "moduleFiles": { + "runtime-core": [ + ".claude/skills/ZooBot/SKILL.md", + ".agents/skills/ZooBot/SKILL.md", + ".agents/skills/ZooBot/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/ZooBot-instincts.yaml" + ], + "workflow-pack": [ + ".claude/commands/database-migration.md", + ".claude/commands/feature-development.md", + ".claude/commands/refactoring.md" + ] + }, + "files": [ + { + "moduleId": "runtime-core", + "path": ".claude/skills/ZooBot/SKILL.md", + "description": "Repository-specific Claude Code skill generated from git history." + }, + { + "moduleId": "runtime-core", + "path": ".agents/skills/ZooBot/SKILL.md", + "description": "Codex-facing copy of the generated repository skill." + }, + { + "moduleId": "runtime-core", + "path": ".agents/skills/ZooBot/agents/openai.yaml", + "description": "Codex skill metadata so the repo skill appears cleanly in the skill interface." + }, + { + "moduleId": "runtime-core", + "path": ".claude/identity.json", + "description": "Suggested identity.json baseline derived from repository conventions." + }, + { + "moduleId": "runtime-core", + "path": ".codex/config.toml", + "description": "Repo-local Codex MCP and multi-agent baseline aligned with ECC defaults." + }, + { + "moduleId": "runtime-core", + "path": ".codex/AGENTS.md", + "description": "Codex usage guide that points at the generated repo skill and workflow bundle." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/explorer.toml", + "description": "Read-only explorer role config for Codex multi-agent work." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/reviewer.toml", + "description": "Read-only reviewer role config focused on correctness and security." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/docs-researcher.toml", + "description": "Read-only docs researcher role config for API verification." + }, + { + "moduleId": "runtime-core", + "path": ".claude/homunculus/instincts/inherited/ZooBot-instincts.yaml", + "description": "Continuous-learning instincts derived from repository patterns." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/database-migration.md", + "description": "Workflow command scaffold for database-migration." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/feature-development.md", + "description": "Workflow command scaffold for feature-development." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/refactoring.md", + "description": "Workflow command scaffold for refactoring." + } + ], + "workflows": [ + { + "command": "database-migration", + "path": ".claude/commands/database-migration.md" + }, + { + "command": "feature-development", + "path": ".claude/commands/feature-development.md" + }, + { + "command": "refactoring", + "path": ".claude/commands/refactoring.md" + } + ], + "adapters": { + "claudeCode": { + "skillPath": ".claude/skills/ZooBot/SKILL.md", + "identityPath": ".claude/identity.json", + "commandPaths": [ + ".claude/commands/database-migration.md", + ".claude/commands/feature-development.md", + ".claude/commands/refactoring.md" + ] + }, + "codex": { + "configPath": ".codex/config.toml", + "agentsGuidePath": ".codex/AGENTS.md", + "skillPath": ".agents/skills/ZooBot/SKILL.md" + } + } +} \ No newline at end of file diff --git a/.claude/homunculus/instincts/inherited/ZooBot-instincts.yaml b/.claude/homunculus/instincts/inherited/ZooBot-instincts.yaml new file mode 100644 index 0000000..a15a9cf --- /dev/null +++ b/.claude/homunculus/instincts/inherited/ZooBot-instincts.yaml @@ -0,0 +1,217 @@ +# Instincts generated from https://github.com/Maliot100X/ZooBot +# Generated: 2026-03-23T23:43:31.669Z +# Version: 2.0 + +--- +id: ZooBot-commit-conventional +trigger: "when writing a commit message" +confidence: 0.85 +domain: git +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Commit Conventional + +## Action + +Use conventional commit format with prefixes: fix, feat, chore, refactor, docs + +## Evidence + +- 170 commits analyzed +- Detected conventional commit pattern +- Examples: docs(agents): move setup and system prompt config to workspace-level AGENTS.md (#253), refactor(telegram): migrate from node-telegram-bot-api to grammY (#248) + +--- +id: ZooBot-commit-length +trigger: "when writing a commit message" +confidence: 0.6 +domain: git +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Commit Length + +## Action + +Write moderate-length commit messages (~50 characters) + +## Evidence + +- Average commit message length: 56 chars +- Based on 170 commits + +--- +id: ZooBot-naming-files +trigger: "when creating a new file" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Naming Files + +## Action + +Use camelCase naming convention + +## Evidence + +- Analyzed file naming patterns in repository +- Dominant pattern: camelCase + +--- +id: ZooBot-import-relative +trigger: "when importing modules" +confidence: 0.75 +domain: code-style +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Import Relative + +## Action + +Use relative imports for project files + +## Evidence + +- Import analysis shows relative import pattern +- Example: import { x } from '../lib/x' + +--- +id: ZooBot-export-style +trigger: "when exporting from a module" +confidence: 0.7 +domain: code-style +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Export Style + +## Action + +Prefer named exports + +## Evidence + +- Export pattern analysis +- Dominant style: named + +--- +id: ZooBot-arch-type-based +trigger: "when adding new code" +confidence: 0.8 +domain: architecture +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Arch Type Based + +## Action + +Place code in the appropriate type folder (components/, services/, utils/, etc.) + +## Evidence + +- Type-based module organization detected +- Folders: + +--- +id: ZooBot-test-separate +trigger: "when writing tests" +confidence: 0.8 +domain: testing +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Test Separate + +## Action + +Place tests in the tests/ or __tests__/ directory, mirroring src structure + +## Evidence + +- Separate test directory pattern detected +- Tests live in dedicated test folders + +--- +id: ZooBot-workflow-database-migration +trigger: "when modifying the database schema or adding tables" +confidence: 0.6 +domain: workflow +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Workflow Database Migration + +## Action + +Follow the database-migration workflow: +1. Create migration file +2. Update schema definitions +3. Generate/update types + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~2x per month +- Files: **/types.ts + +--- +id: ZooBot-workflow-feature-development +trigger: "when implementing a new feature" +confidence: 0.9 +domain: workflow +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Workflow Feature Development + +## Action + +Follow the feature-development workflow: +1. Add feature implementation +2. Add tests for feature +3. Update documentation + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~17x per month +- Files: packages/main/src/*, packages/server/src/*, packages/server/src/routes/* + +--- +id: ZooBot-workflow-refactoring +trigger: "when refactoring code" +confidence: 0.8 +domain: workflow +source: repo-analysis +source_repo: https://github.com/Maliot100X/ZooBot +--- + +# ZooBot Workflow Refactoring + +## Action + +Follow the refactoring workflow: +1. Ensure tests pass before refactor +2. Refactor code structure +3. Verify tests still pass + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~6x per month +- Files: src/**/* + diff --git a/.claude/identity.json b/.claude/identity.json new file mode 100644 index 0000000..a7762df --- /dev/null +++ b/.claude/identity.json @@ -0,0 +1,14 @@ +{ + "version": "2.0", + "technicalLevel": "technical", + "preferredStyle": { + "verbosity": "moderate", + "codeComments": false, + "explanations": false + }, + "domains": [ + "typescript" + ], + "suggestedBy": "ecc-tools-repo-analysis", + "createdAt": "2026-03-23T23:43:31.669Z" +} \ No newline at end of file diff --git a/.claude/skills/ZooBot/SKILL.md b/.claude/skills/ZooBot/SKILL.md new file mode 100644 index 0000000..6910679 --- /dev/null +++ b/.claude/skills/ZooBot/SKILL.md @@ -0,0 +1,273 @@ +--- +name: zoobot-conventions +description: Development conventions and patterns for ZooBot. TypeScript project with conventional commits. +--- + +# Zoobot Conventions + +> Generated from [Maliot100X/ZooBot](https://github.com/Maliot100X/ZooBot) on 2026-03-23 + +## Overview + +This skill teaches Claude the development patterns and conventions used in ZooBot. + +## Tech Stack + +- **Primary Language**: TypeScript +- **Architecture**: type-based module organization +- **Test Location**: separate + +## When to Use This Skill + +Activate this skill when: +- Making changes to this repository +- Adding new features following established patterns +- Writing tests that match project conventions +- Creating commits with proper message format + +## Commit Conventions + +Follow these commit message conventions based on 8 analyzed commits. + +### Commit Style: Conventional Commits + +### Prefixes Used + +- `fix` +- `feat` +- `chore` +- `refactor` +- `docs` + +### Message Guidelines + +- Average message length: ~56 characters +- Keep first line concise and descriptive +- Use imperative mood ("Add feature" not "Added feature") + + +*Commit message example* + +```text +docs(agents): move setup and system prompt config to workspace-level AGENTS.md (#253) +``` + +*Commit message example* + +```text +refactor(telegram): migrate from node-telegram-bot-api to grammY (#248) +``` + +*Commit message example* + +```text +fix(api): resolve agent routing at enqueue time (#247) +``` + +*Commit message example* + +```text +chore: update readme +``` + +*Commit message example* + +```text +feat(office): redesign the live office workspace (#212) +``` + +*Commit message example* + +```text +Initial ZooBot commit - Open Source AI Agent Framework with Groq support +``` + +*Commit message example* + +```text +fix(telegram): fix watchdog timer bug that prevented polling restart (#246) +``` + +*Commit message example* + +```text +chore: add bin entry to package.json, update README and office screenshot +``` + +## Architecture + +### Project Structure: Monorepo + +This project uses **type-based** module organization. + +### Configuration Files + +- `.github/workflows/release.yml` +- `package.json` +- `packages/channels/package.json` +- `packages/channels/tsconfig.json` +- `packages/cli/package.json` +- `packages/cli/tsconfig.json` +- `packages/core/package.json` +- `packages/core/tsconfig.json` +- `packages/main/package.json` +- `packages/main/tsconfig.json` +- `packages/server/package.json` +- `packages/server/tsconfig.json` +- `packages/teams/package.json` +- `packages/teams/tsconfig.json` +- `packages/visualizer/package.json` +- `packages/visualizer/tsconfig.json` +- `tinyoffice/package.json` +- `tinyoffice/tsconfig.json` +- `tsconfig.json` + +### Guidelines + +- Group code by type (components, services, utils) +- Keep related functionality in the same type folder +- Avoid circular dependencies between type folders + +## Code Style + +### Language: TypeScript + +### Naming Conventions + +| Element | Convention | +|---------|------------| +| Files | camelCase | +| Functions | camelCase | +| Classes | PascalCase | +| Constants | SCREAMING_SNAKE_CASE | + +### Import Style: Relative Imports + +### Export Style: Named Exports + + +*Preferred import style* + +```typescript +// Use relative imports +import { Button } from '../components/Button' +import { useAuth } from './hooks/useAuth' +``` + +*Preferred export style* + +```typescript +// Use named exports +export function calculateTotal() { ... } +export const TAX_RATE = 0.1 +export interface Order { ... } +``` + +## Error Handling + +### Error Handling Style: Try-Catch Blocks + +A **global error handler** catches unhandled errors. + + +*Standard error handling pattern* + +```typescript +try { + const result = await riskyOperation() + return result +} catch (error) { + console.error('Operation failed:', error) + throw new Error('User-friendly message') +} +``` + +## Common Workflows + +These workflows were detected from analyzing commit patterns. + +### Database Migration + +Database schema changes with migration files + +**Frequency**: ~2 times per month + +**Steps**: +1. Create migration file +2. Update schema definitions +3. Generate/update types + +**Files typically involved**: +- `**/types.ts` + +**Example commit sequence**: +``` +refactor(queue): simplify schema and remove conversation state (#213) +feat(invoke): stream agent execution progress in real-time (#196) +refactor(cli): make tinyagi the primary CLI entrypoint (#234) +``` + +### Feature Development + +Standard feature implementation workflow + +**Frequency**: ~17 times per month + +**Steps**: +1. Add feature implementation +2. Add tests for feature +3. Update documentation + +**Files typically involved**: +- `packages/main/src/*` +- `packages/server/src/*` +- `packages/server/src/routes/*` +- `**/api/**` + +**Example commit sequence**: +``` +feat: add chat rooms and projects to tinyoffice (#199) +fix(telegram): prevent polling from stalling after network reconnect (#200) +feat(office): add organization chart visualization page (#201) +``` + +### Refactoring + +Code refactoring and cleanup workflow + +**Frequency**: ~6 times per month + +**Steps**: +1. Ensure tests pass before refactor +2. Refactor code structure +3. Verify tests still pass + +**Files typically involved**: +- `src/**/*` + +**Example commit sequence**: +``` +refactor(ui): refactor agent and task components into modules (#229) +fix(heartbeat): persist per-agent enabled and interval settings to heartbeat overrides (#230) +chore: bump version to 0.0.14 and add release notes +``` + + +## Best Practices + +Based on analysis of the codebase, follow these practices: + +### Do + +- Use conventional commit format (feat:, fix:, etc.) +- Use camelCase for file names +- Prefer named exports + +### Don't + +- Don't write vague commit messages +- Don't deviate from established patterns without discussion + +--- + +*This skill was auto-generated by [ECC Tools](https://ecc.tools). Review and customize as needed for your team.* diff --git a/.codex/AGENTS.md b/.codex/AGENTS.md new file mode 100644 index 0000000..159dc96 --- /dev/null +++ b/.codex/AGENTS.md @@ -0,0 +1,28 @@ +# ECC for Codex CLI + +This supplements the root `AGENTS.md` with a repo-local ECC baseline. + +## Repo Skill + +- Repo-generated Codex skill: `.agents/skills/ZooBot/SKILL.md` +- Claude-facing companion skill: `.claude/skills/ZooBot/SKILL.md` +- Keep user-specific credentials and private MCPs in `~/.codex/config.toml`, not in this repo. + +## MCP Baseline + +Treat `.codex/config.toml` as the default ECC-safe baseline for work in this repository. +The generated baseline enables GitHub, Context7, Exa, Memory, Playwright, and Sequential Thinking. + +## Multi-Agent Support + +- Explorer: read-only evidence gathering +- Reviewer: correctness, security, and regression review +- Docs researcher: API and release-note verification + +## Workflow Files + +- `.claude/commands/database-migration.md` +- `.claude/commands/feature-development.md` +- `.claude/commands/refactoring.md` + +Use these workflow files as reusable task scaffolds when the detected repository workflows recur. \ No newline at end of file diff --git a/.codex/agents/docs-researcher.toml b/.codex/agents/docs-researcher.toml new file mode 100644 index 0000000..0daae57 --- /dev/null +++ b/.codex/agents/docs-researcher.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "medium" +sandbox_mode = "read-only" + +developer_instructions = """ +Verify APIs, framework behavior, and release-note claims against primary documentation before changes land. +Cite the exact docs or file paths that support each claim. +Do not invent undocumented behavior. +""" \ No newline at end of file diff --git a/.codex/agents/explorer.toml b/.codex/agents/explorer.toml new file mode 100644 index 0000000..732df7a --- /dev/null +++ b/.codex/agents/explorer.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "medium" +sandbox_mode = "read-only" + +developer_instructions = """ +Stay in exploration mode. +Trace the real execution path, cite files and symbols, and avoid proposing fixes unless the parent agent asks for them. +Prefer targeted search and file reads over broad scans. +""" \ No newline at end of file diff --git a/.codex/agents/reviewer.toml b/.codex/agents/reviewer.toml new file mode 100644 index 0000000..b13ed9c --- /dev/null +++ b/.codex/agents/reviewer.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "high" +sandbox_mode = "read-only" + +developer_instructions = """ +Review like an owner. +Prioritize correctness, security, behavioral regressions, and missing tests. +Lead with concrete findings and avoid style-only feedback unless it hides a real bug. +""" \ No newline at end of file diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 0000000..bc1ee67 --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,48 @@ +#:schema https://developers.openai.com/codex/config-schema.json + +# ECC Tools generated Codex baseline +approval_policy = "on-request" +sandbox_mode = "workspace-write" +web_search = "live" + +[mcp_servers.github] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-github"] + +[mcp_servers.context7] +command = "npx" +args = ["-y", "@upstash/context7-mcp@latest"] + +[mcp_servers.exa] +url = "https://mcp.exa.ai/mcp" + +[mcp_servers.memory] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-memory"] + +[mcp_servers.playwright] +command = "npx" +args = ["-y", "@playwright/mcp@latest", "--extension"] + +[mcp_servers.sequential-thinking] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-sequential-thinking"] + +[features] +multi_agent = true + +[agents] +max_threads = 6 +max_depth = 1 + +[agents.explorer] +description = "Read-only codebase explorer for gathering evidence before changes are proposed." +config_file = "agents/explorer.toml" + +[agents.reviewer] +description = "PR reviewer focused on correctness, security, and missing tests." +config_file = "agents/reviewer.toml" + +[agents.docs_researcher] +description = "Documentation specialist that verifies APIs, framework behavior, and release notes." +config_file = "agents/docs-researcher.toml" \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 95b598e..192679f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,4 +1,6 @@ -# TinyAGI โ€” Multi-team Personal Assistants +# ZooBot ๐Ÿค– + +# ZooBot โ€” Multi-team Personal AI Assistants Running in persistent mode with teams of agents, messaging integration (Telegram, WhatsApp, Discord), and heartbeat monitoring. @@ -104,7 +106,7 @@ No memories yet. Use the **memory** skill to start building your memory. ## Soul -You have a soul file at `.tinyagi/SOUL.md` defining your identity, personality, worldview, and opinions. It starts as a template โ€” fill it in over time. +You have a soul file at `.zoobot/SOUL.md` defining your identity, personality, worldview, and opinions. It starts as a template โ€” fill it in over time. - **Be specific**: "I prefer pragmatic solutions over elegant abstractions" is useful. "I'm helpful" is not. - **Own your perspective**: Form opinions based on the domains you work in. @@ -112,17 +114,17 @@ You have a soul file at `.tinyagi/SOUL.md` defining your identity, personality, ## File Exchange -`~/.tinyagi/files` is the shared file directory with the human. +`~/.zoobot/files` is the shared file directory with the human. - **Incoming**: Files arrive as `[file: /path/to/file]` in messages. Supports photos, documents, audio, voice, video, and stickers across Telegram, WhatsApp, and Discord. -- **Outgoing**: Place files in `.tinyagi/files/` and include `[send_file: /absolute/path/to/file]` in your response. The tag is stripped before delivery and the file is sent as an attachment. +- **Outgoing**: Place files in `.zoobot/files/` and include `[send_file: /absolute/path/to/file]` in your response. The tag is stripped before delivery and the file is sent as an attachment. ### Outgoing file format Include all of the following in the same reply: -1. Place the file under `.tinyagi/files/` -2. Reference it: `[send_file: /Users/jliao/.tinyagi/files/report.pdf]` +1. Place the file under `.zoobot/files/` +2. Reference it: `[send_file: /Users/you/.zoobot/files/report.pdf]` 3. Keep the tag in plain text (system strips it before user delivery) Multiple files: include one `[send_file: ...]` tag per file. diff --git a/README.md b/README.md index c23bf54..09f83e1 100644 --- a/README.md +++ b/README.md @@ -1,702 +1,237 @@ -
- TinyAGI -

TinyAGI ๐Ÿฆž

-

Multi-agent, Multi-team, Multi-channel, 24/7 AI assistant

-

Run multiple teams of AI agents that collaborate with each other simultaneously with isolated workspaces.

-

- Experimental - - MIT License - - - Discord - - - Latest Release - -

-
- -
- -
- -## โœจ Features - -- โœ… **Multi-agent** - Run multiple isolated AI agents with specialized roles -- โœ… **Multi-team collaboration** - Agents hand off work to teammates via chain execution and fan-out -- โœ… **Multi-channel** - Discord, WhatsApp, and Telegram -- โœ… **Web portal (TinyOffice)** - Browser-based dashboard for chat, agents, teams, tasks, logs, and settings -- โœ… **Team chat rooms** - Persistent async chat rooms per team with real-time CLI viewer -- โœ… **Multiple AI providers** - Anthropic Claude, OpenAI Codex, and custom providers (any OpenAI/Anthropic-compatible endpoint) -- โœ… **Auth token management** - Store API keys per provider, no separate CLI auth needed -- โœ… **Parallel processing** - Agents process messages concurrently -- โœ… **Live TUI dashboard** - Real-time team visualizer and chatroom viewer -- โœ… **Persistent sessions** - Conversation context maintained across restarts -- โœ… **SQLite queue** - Atomic transactions, retry logic, dead-letter management -- โœ… **Plugin system** - Extend TinyAGI with custom plugins for message hooks and event listeners -- โœ… **24/7 operation** - Runs in tmux for always-on availability - -## Community - -[Discord](https://discord.com/invite/jH6AcEChuD) - -We are actively looking for contributors. Please reach out. +# ZooBot ๐Ÿค– -## ๐Ÿš€ Quick Start - -### Prerequisites - -- macOS, Linux and Windows (WSL2) -- Node.js v18+ -- tmux, jq -- Bash 3.2+ -- [Claude Code CLI](https://claude.com/claude-code) (for Anthropic provider) -- [Codex CLI](https://docs.openai.com/codex) (for OpenAI provider) - -### Installation & First Run - -```bash -curl -fsSL https://raw.githubusercontent.com/TinyAGI/tinyagi/main/scripts/install.sh | bash -``` - -This downloads and installs the `tinyagi` command globally. Then just run: - -```bash -tinyagi -``` - -That's it. TinyAGI auto-creates default settings, starts the daemon, and opens TinyOffice in your browser. No wizard, no configuration needed. - -- **Default workspace:** `~/tinyagi-workspace` -- **Default agent:** `tinyagi` (Anthropic/Opus) -- **Channels:** none initially โ€” add later with `tinyagi channel setup` - -
-Development (run from source repo) +**Open Source AI Agent Framework โ€” Run free AI agents locally with any LLM provider** -```bash -git clone https://github.com/TinyAGI/tinyagi.git -cd tinyagi && npm install && npm run build -npx tinyagi start -npx tinyagi agent list -``` -
- -
-Other installation methods - -**From Source:** - -```bash -git clone https://github.com/TinyAGI/tinyagi.git -cd tinyagi && npm install && ./scripts/install.sh -``` - -
- -
-๐Ÿ“ฑ Channel Setup Guides - -### Discord Setup - -1. Go to [Discord Developer Portal](https://discord.com/developers/applications) -2. Create application โ†’ Bot section โ†’ Create bot -3. Copy bot token -4. Enable "Message Content Intent" -5. Invite bot using OAuth2 URL Generator - -### Telegram Setup - -1. Open Telegram โ†’ Search `@BotFather` -2. Send `/newbot` โ†’ Follow prompts -3. Copy bot token -4. Start chat with your bot - -### WhatsApp Setup - -After starting TinyAGI, scan the QR code: - -```text -โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” - WhatsApp QR Code -โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” -[QR CODE HERE] - -๐Ÿ“ฑ Settings โ†’ Linked Devices โ†’ Link a Device -``` - -
+[![GitHub Stars](https://img.shields.io/github/stars/zo-computer/ZooBot?style=social)](https://github.com/zo-computer/ZooBot) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/) --- -## ๐ŸŒ TinyOffice Web Portal +## ๐ŸŽฏ What is ZooBot? -TinyAGI includes a web portal for managing your agents, teams, tasks, and chat โ€” all from the browser. +ZooBot is a powerful, open-source AI agent orchestration framework that lets you run multiple AI agents in parallel โ€” each with their own workspace, memory, and personality. It's designed for individuals and small teams who want the power of multi-agent AI systems **without being locked into expensive proprietary services**. -
- TinyOffice Office View -
+Think of it as a **personal AI office** where you can hire specialized agents (coder, writer, reviewer, researcher) that work together on your projects. -Once you start running TinyAGI locally, you can control it by visiting **[office.tinyagicompany.com](https://office.tinyagicompany.com/)**. It connects to your local TinyAGI API at `localhost:3777` โ€” no account or sign-up needed. +### โœจ Key Features -Alternatively, you can run TinyOffice locally: +- **๐Ÿค– Multi-Agent Teams** โ€” Create agent teams that collaborate and hand off tasks +- **๐Ÿ’ฌ Channel Integration** โ€” Connect to Discord, Telegram, WhatsApp, and Web +- **๐Ÿง  Memory System** โ€” Persistent hierarchical memory for each agent +- **๐Ÿ“‹ Skills System** โ€” Extensible skill framework (browser automation, image generation, scheduling) +- **๐Ÿ”„ Queue-Based Processing** โ€” SQLite-backed message queue with retry logic +- **๐ŸŽจ TinyOffice Visual Dashboard** โ€” Web portal for visual agent management +- **๐Ÿ”Œ Plugin Architecture** โ€” Easy to extend with custom functionality +- **๐Ÿ’ฐ Free LLM Support** โ€” Use Groq, OpenAI-compatible APIs, Anthropic, or Codex -```bash -tinyagi office # Builds and starts on http://localhost:3000 -``` +--- -
-TinyOffice Features & Setup +## ๐Ÿš€ Quick Start -- **Dashboard** - Real-time queue/system overview and live event feed -- **Chat Console** - Send messages to default agent, `@agent`, or `@team` -- **Agents & Teams** - Create, edit, and remove agents/teams -- **Tasks (Kanban)** - Create tasks, drag across stages, assign to agent/team -- **Logs & Events** - Inspect queue logs and streaming events -- **Settings** - Edit TinyAGI configuration (`settings.json`) via UI -- **Office View** - Visual simulation of agent interactions -- **Org Chart** - Hierarchical visualization of teams and agents -- **Chat Rooms** - Slack-style persistent chat rooms per team -- **Projects** - Project-level task management with filtered kanban boards +### Prerequisites -### Running Locally +- Node.js 18+ +- npm or yarn +- API keys for your preferred LLM provider (see below) -Start TinyAGI first (API default: `http://localhost:3777`), then: +### Installation ```bash -tinyagi office -``` - -This auto-detects when dependencies or builds are needed (e.g. after `tinyagi update`) and starts the production server on `http://localhost:3000`. - -For development with hot-reload: +# Clone the repository +git clone https://github.com/zo-computer/ZooBot.git +cd ZooBot -```bash -cd tinyoffice +# Install dependencies npm install -npm run dev -``` -If TinyAGI API is on a different host/port, set: - -```bash -cd tinyoffice -echo 'NEXT_PUBLIC_API_URL=http://localhost:3777' > .env.local +# Initialize configuration +npm run setup ``` -
- -## ๐Ÿ“‹ Commands - -Commands work with the `tinyagi` CLI. - -### Core Commands +### Configuration -| Command | Description | Example | -| ------------- | --------------------------------------------------------- | --------------------- | -| *(no command)* | Install, configure defaults, start, and open TinyOffice | `tinyagi` | -| `start` | Start TinyAGI daemon | `tinyagi start` | -| `stop` | Stop all processes | `tinyagi stop` | -| `restart` | Restart TinyAGI | `tinyagi restart` | -| `status` | Show current status and activity | `tinyagi status` | -| `channel setup` | Configure channels interactively | `tinyagi channel setup` | -| `logs [type]` | View logs (discord/telegram/whatsapp/queue/heartbeat/all) | `tinyagi logs queue` | -| `attach` | Attach to tmux session | `tinyagi attach` | - -### Agent Commands - -| Command | Description | Example | -| ------------------------------------- | ------------------------------- | ------------------------------------------------------------ | -| `agent list` | List all configured agents | `tinyagi agent list` | -| `agent add` | Add new agent (interactive) | `tinyagi agent add` | -| `agent show ` | Show agent configuration | `tinyagi agent show coder` | -| `agent remove ` | Remove an agent | `tinyagi agent remove coder` | -| `agent reset ` | Reset agent conversation | `tinyagi agent reset coder` | -| `agent provider [provider]` | Show or set agent's AI provider | `tinyagi agent provider coder anthropic` | -| `agent provider

--model ` | Set agent's provider and model | `tinyagi agent provider coder openai --model gpt-5.3-codex` | - -### Team Commands - -| Command | Description | Example | -| --------------------------- | ---------------------------------- | ----------------------------------------- | -| `team list` | List all configured teams | `tinyagi team list` | -| `team add` | Add new team (interactive) | `tinyagi team add` | -| `team show ` | Show team configuration | `tinyagi team show dev` | -| `team remove ` | Remove a team | `tinyagi team remove dev` | -| `team add-agent ` | Add an existing agent to a team | `tinyagi team add-agent dev reviewer` | -| `team remove-agent ` | Remove an agent from a team | `tinyagi team remove-agent dev reviewer` | -| `team visualize [id]` | Live TUI dashboard for team chains | `tinyagi team visualize dev` | - -### Chatroom Commands - -| Command | Description | Example | -| ------------------- | --------------------------------------------- | -------------------------- | -| `chatroom ` | Real-time TUI viewer with type-to-send | `tinyagi chatroom dev` | -| `office` | Start TinyOffice web portal on port 3000 | `tinyagi office` | - -Every team has a persistent chat room. Agents post to it using `[#team_id: message]` tags, and messages are broadcast to all teammates. The chatroom viewer polls for new messages in real time โ€” type a message and press Enter to post, or press `q`/Esc to quit. - -**API endpoints:** - -``` -GET /api/chatroom/:teamId # Get messages (?limit=100&since=0) -POST /api/chatroom/:teamId # Post a message (body: { "message": "..." }) -``` - -### Provider & Custom Provider Commands - -| Command | Description | Example | -| --------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------ | -| `provider [name]` | Show or switch global AI provider | `tinyagi provider anthropic` | -| `provider --model ` | Switch provider and model; propagates to matching agents | `tinyagi provider openai --model gpt-5.3-codex` | -| `provider --auth-token ` | Store API key for a built-in provider | `tinyagi provider anthropic --auth-token sk-...` | -| `provider list` | List all custom providers | `tinyagi provider list` | -| `provider add` | Add a new custom provider (interactive) | `tinyagi provider add` | -| `provider remove ` | Remove a custom provider | `tinyagi provider remove proxy` | -| `model [name]` | Show or switch AI model | `tinyagi model opus` | - -

-Custom provider details - -Custom providers let you use any OpenAI or Anthropic-compatible API endpoint (e.g., OpenRouter, proxy servers, self-hosted models). - -**Define a custom provider in `settings.json`:** +Create `~/.zoobot/settings.json` (or set environment variables): ```json { - "custom_providers": { - "my-proxy": { - "name": "My Proxy", - "harness": "claude", - "base_url": "https://proxy.example.com/v1", - "api_key": "sk-...", - "model": "claude-sonnet-4-6" + "workspace": { + "path": "~/zoo-bot-workspace" + }, + "models": { + "provider": "groq", + "groq": { + "model": "llama-3.3-70b-versatile" + } + }, + "GROQ_API_KEY": "your-groq-api-key-here", + "agents": { + "assistant": { + "name": "ZooBot Assistant", + "provider": "groq", + "model": "llama-3.3-70b-versatile", + "working_directory": "~/zoo-bot-workspace/assistant", + "system_prompt": "You are a helpful AI assistant." } } } ``` -| Field | Required | Description | -| ---------- | -------- | ------------------------------------ | -| `name` | Yes | Human-readable display name | -| `harness` | Yes | CLI to use: `claude` or `codex` | -| `base_url` | Yes | API endpoint URL | -| `api_key` | Yes | API key for authentication | -| `model` | No | Default model name for CLI | - -**Assign a custom provider to an agent:** +Or use environment variables: ```bash -tinyagi agent provider coder custom:my-proxy -tinyagi agent provider coder custom:my-proxy --model gpt-4o -``` - -**Auth token storage** โ€” store API keys for built-in providers so you don't need separate CLI auth: - -```bash -tinyagi provider anthropic --auth-token sk-ant-... -tinyagi provider openai --auth-token sk-... -``` - -Tokens are saved in `settings.json` under `models..auth_token` and automatically exported as `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` when invoking CLIs. - -**API endpoints:** - -``` -GET /api/custom-providers # List custom providers -PUT /api/custom-providers/:id # Create or update -DELETE /api/custom-providers/:id # Delete +export GROQ_API_KEY="your-groq-api-key" +export ZOOBOT_PROVIDER="groq" +export ZOOBOT_MODEL="llama-3.3-70b-versatile" ``` -See [docs/AGENTS.md](docs/AGENTS.md#custom-providers) for more details. - -
- -
-Pairing commands - -Use sender pairing to control who can message your agents. - -| Command | Description | Example | -| -------------------------------------- | -------------------------------------------------- | ------------------------------------------ | -| `pairing pending` | Show pending sender approvals (with pairing codes) | `tinyagi pairing pending` | -| `pairing approved` | Show approved senders | `tinyagi pairing approved` | -| `pairing list` | Show both pending and approved senders | `tinyagi pairing list` | -| `pairing approve ` | Move a sender from pending to approved by code | `tinyagi pairing approve ABCD1234` | -| `pairing unpair ` | Remove an approved sender from the allowlist | `tinyagi pairing unpair telegram 1234567` | - -Pairing behavior: - -- First message from unknown sender: TinyAGI generates a code and sends approval instructions. -- Additional messages while still pending: TinyAGI blocks silently (no repeated pairing message). -- After approval: messages from that sender are processed normally. - -
- -
-Messaging & in-chat commands +--- -| Command | Description | Example | -| ---------------- | --------------------------- | -------------------------------- | -| `send ` | Send message to AI manually | `tinyagi send "Hello!"` | -| `send ` | Route to specific agent | `tinyagi send "@coder fix bug"` | +## ๐Ÿ’ฐ Supported LLM Providers -These commands work in Discord, Telegram, and WhatsApp: +### Free Tier Providers โญ -| Command | Description | Example | -| ------------------- | ------------------------------------ | ----------------------- | -| `@agent_id message` | Route message to specific agent | `@coder fix the bug` | -| `@team_id message` | Route message to team leader | `@dev fix the auth bug` | -| `/agent` | List all available agents | `/agent` | -| `/team` | List all available teams | `/team` | -| `@agent_id /reset` | Reset specific agent conversation | `@coder /reset` | -| `/reset` | Reset conversation (WhatsApp/global) | `/reset` or `!reset` | -| `/restart` | Restart TinyAGI process | `/restart` | -| `message` | Send to default agent (no prefix) | `help me with this` | +| Provider | Models | Cost | Speed | +|----------|--------|------|-------| +| **Groq** | Llama 3.1/3.2/3.3, Mixtral | FREE | โšกโšกโšก Very Fast | +| **OpenRouter** | replit, microsoft, quantummodels | FREE tier available | Fast | +| **Cerebras** | Llama 3.1 8B, 70B | Free credits | โšกโšกโšก Very Fast | -**Note:** The `@agent_id` routing prefix requires a space after it (e.g., `@coder fix` not `@coderfix`). +### Paid Providers -**Access control note:** before routing, channel clients apply sender pairing allowlist checks. +| Provider | Notes | +|----------|-------| +| Anthropic Claude | Uses Claude Code CLI | +| OpenAI | Uses Codex CLI | +| OpenCode | Uses OpenCode CLI | -
+--- -
-Update commands +## ๐Ÿ“– Documentation -| Command | Description | Example | -| -------- | --------------------------------- | ----------------- | -| `update` | Update TinyAGI to latest version | `tinyagi update` | +- [Installation Guide](docs/INSTALL.md) +- [Agent Configuration](docs/AGENTS.md) +- [Team Collaboration](docs/TEAMS.md) +- [Channel Setup (Discord, Telegram, etc.)](docs/PLUGINS.md) +- [Message Patterns](docs/MESSAGE-PATTERNS.md) +- [Queue System](docs/QUEUE.md) +- [Troubleshooting](docs/TROUBLESHOOTING.md) -> **Note:** If you are on v0.0.1 or v0.0.2, the update script was broken. Please re-install instead: -> -> ```bash -> curl -fsSL https://raw.githubusercontent.com/TinyAGI/tinyagi/main/scripts/install.sh | bash -> ``` -> -> Your settings and user data will be preserved. +--- -**Auto-detection:** TinyAGI checks for updates on startup (once per hour). +## ๐Ÿ› ๏ธ Usage -**Disable update checks:** +### Single Agent Mode ```bash -export TINYAGI_SKIP_UPDATE_CHECK=1 -``` - -
- -
-Configuration commands - -| Command | Description | Example | -| ------------------------ | ---------------------------- | -------------------------------- | -| `reset` | Reset all conversations | `tinyagi reset` | -| `channels reset ` | Reset channel authentication | `tinyagi channels reset whatsapp` | - -
- -## ๐Ÿค– Using Agents +# Start interactive chat with your agent +npm run chat -Use `@agent_id` prefix to route messages to specific agents: - -```text -@coder fix the authentication bug -@writer document the API endpoints -help me with this โ† goes to tinyagi agent (no prefix needed) +# Run a single command +npm run agent -- "Hello, help me write a Python script" ``` -
-Agent configuration - -Agents are configured in `.tinyagi/settings.json`: +### Team Mode -```json -{ - "agents": { - "coder": { - "name": "Code Assistant", - "provider": "anthropic", - "model": "sonnet", - "working_directory": "/Users/me/tinyagi-workspace/coder" - }, - "writer": { - "name": "Technical Writer", - "provider": "custom:my-proxy", - "model": "gpt-5.3-codex", - "working_directory": "/Users/me/tinyagi-workspace/writer" - } - } -} -``` +```bash +# Create a team of agents +zoobot team create dev "coder,reviewer,tester" -Each agent operates in isolation: - -- **Separate workspace directory** - `~/tinyagi-workspace/{agent_id}/` -- **Own conversation history** - Maintained by CLI -- **Custom configuration** - `.claude/`, `heartbeat.md` (root), `AGENTS.md` -- **Independent resets** - Reset individual agent conversations - -See [docs/AGENTS.md](docs/AGENTS.md) for full details on architecture, use cases, and advanced features. - -
- -## ๐Ÿ“ Architecture - -
-Message flow diagram - -```text -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ Message Channels โ”‚ -โ”‚ (Discord, Telegram, WhatsApp, Web, API) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ enqueueMessage() - โ†“ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ~/.tinyagi/tinyagi.db (SQLite) โ”‚ -โ”‚ โ”‚ -โ”‚ messages: pending โ†’ processing โ†’ completed / dead โ”‚ -โ”‚ responses: pending โ†’ acked โ”‚ -โ”‚ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ Queue Processor - โ†“ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ Parallel Processing by Agent โ”‚ -โ”‚ โ”‚ -โ”‚ Agent: coder Agent: writer Agent: assistant โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ Message 1โ”‚ โ”‚ Message 1โ”‚ โ”‚ Message 1โ”‚ โ”‚ -โ”‚ โ”‚ Message 2โ”‚ ... โ”‚ Message 2โ”‚ ... โ”‚ Message 2โ”‚ ... โ”‚ -โ”‚ โ”‚ Message 3โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ†“ โ†“ โ†“ - claude CLI claude CLI claude CLI - (workspace/coder) (workspace/writer) (workspace/assistant) +# Send task to team +zoobot team message dev "Build a REST API for task management" ``` -
+### Channel Mode -**Key features:** - -- **SQLite queue** - Atomic transactions via WAL mode, no race conditions -- **Parallel agents** - Different agents process messages concurrently -- **Sequential per agent** - Preserves conversation order within each agent -- **Retry & dead-letter** - Failed messages retry up to 5 times, then enter dead-letter queue -- **Isolated workspaces** - Each agent has its own directory and context - -See [docs/QUEUE.md](docs/QUEUE.md) for detailed queue system documentation. - -## โš™๏ธ Configuration - -
-Settings file reference - -Located at `.tinyagi/settings.json`: +```bash +# Start Telegram bot +npm run telegram -```json -{ - "channels": { - "enabled": ["discord", "telegram", "whatsapp"], - "discord": { "bot_token": "..." }, - "telegram": { "bot_token": "..." }, - "whatsapp": {} - }, - "workspace": { - "path": "/Users/me/tinyagi-workspace", - "name": "tinyagi-workspace" - }, - "agents": { - "tinyagi": { - "name": "TinyAGI Agent", - "provider": "anthropic", - "model": "opus", - "working_directory": "/Users/me/tinyagi-workspace/tinyagi" - } - }, - "teams": { - "dev": { - "name": "Development Team", - "agents": ["coder", "reviewer"], - "leader_agent": "coder" - } - }, - "custom_providers": { - "my-proxy": { - "name": "My Proxy", - "harness": "claude", - "base_url": "https://proxy.example.com/v1", - "api_key": "sk-...", - "model": "claude-sonnet-4-6" - } - }, - "models": { - "anthropic": { "auth_token": "sk-ant-..." }, - "openai": { "auth_token": "sk-..." } - }, - "monitoring": { - "heartbeat_interval": 3600 - } -} +# Start Discord bot +npm run discord ``` -
- -
-Heartbeat configuration - -Edit agent-specific heartbeat prompts: +### Web Dashboard (TinyOffice) ```bash -nano ~/tinyagi-workspace/coder/heartbeat.md +# Start TinyOffice web interface +npm run visualizer ``` -Default heartbeat prompt: - -```markdown -Check for: +--- -1. Pending tasks -2. Errors -3. Unread messages +## ๐Ÿงฉ Skills -Take action if needed. -``` - -
- -
-Directory structure - -```text -tinyagi/ -โ”œโ”€โ”€ packages/ # Monorepo packages -โ”‚ โ”œโ”€โ”€ core/ # Shared types, config, queue, agent invocation -โ”‚ โ”œโ”€โ”€ main/ # Queue processor entry point -โ”‚ โ”œโ”€โ”€ teams/ # Team conversation orchestration -โ”‚ โ”œโ”€โ”€ server/ # API server (REST + SSE) -โ”‚ โ”œโ”€โ”€ channels/ # Channel clients (Discord, Telegram, WhatsApp) -โ”‚ โ”œโ”€โ”€ cli/ # CLI commands (tinyagi.sh helpers) -โ”‚ โ””โ”€โ”€ visualizer/ # TUI dashboard and chatroom viewer -โ”œโ”€โ”€ tinyoffice/ # TinyOffice web portal (Next.js) -โ”œโ”€โ”€ .tinyagi/ # TinyAGI data (created at runtime) -โ”‚ โ”œโ”€โ”€ settings.json # Configuration -โ”‚ โ”œโ”€โ”€ tinyagi.db # SQLite queue database -โ”‚ โ”œโ”€โ”€ logs/ # All logs -โ”‚ โ”œโ”€โ”€ channels/ # Channel state -โ”‚ โ”œโ”€โ”€ files/ # Uploaded files -โ”‚ โ”œโ”€โ”€ pairing.json # Sender allowlist state -โ”‚ โ”œโ”€โ”€ chats/ # Team conversation history -โ”‚ โ”‚ โ””โ”€โ”€ {team_id}/ # Per-team chat logs -โ”‚ โ”œโ”€โ”€ .claude/ # Template for agents -โ”‚ โ”œโ”€โ”€ heartbeat.md # Template for agents -โ”‚ โ””โ”€โ”€ AGENTS.md # Template for agents -โ”œโ”€โ”€ ~/tinyagi-workspace/ # Agent workspaces -โ”‚ โ”œโ”€โ”€ tinyagi/ # Default agent -โ”‚ โ”œโ”€โ”€ coder/ -โ”‚ โ””โ”€โ”€ writer/ -โ”œโ”€โ”€ lib/ # Runtime scripts -โ”œโ”€โ”€ scripts/ # Installation scripts -โ””โ”€โ”€ tinyagi.sh # Main script -``` +ZooBot comes with built-in skills: -
+| Skill | Description | +|-------|-------------| +| `agent-browser` | Automate web browsers | +| `imagegen` | Generate images via AI | +| `memory` | Persistent memory management | +| `schedule` | Schedule tasks with cron | +| `tasks` | Task management | +| `skill-creator` | Create new skills | -## ๐ŸŽฏ Use Cases +--- -
-Examples +## ๐Ÿ”ง API Reference -### Personal AI Assistant +### Environment Variables -```text -You: "Remind me to call mom" -Claude: "I'll remind you!" -[1 hour later via heartbeat] -Claude: "Don't forget to call mom!" -``` +| Variable | Description | +|----------|-------------| +| `GROQ_API_KEY` | Your Groq API key | +| `OPENAI_API_KEY` | Your OpenAI API key | +| `ANTHROPIC_AUTH_TOKEN` | Your Anthropic auth token | +| `ZOOBOT_HOME` | Config directory (default: `~/.zoobot`) | +| `ZOOBOT_WORKSPACE` | Workspace directory | -### Multi-Agent Workflow +### Programmatic Usage -```text -@coder Review and fix bugs in auth.ts -@writer Document the changes -@reviewer Check the documentation quality -``` +```typescript +import { ZooBot } from '@zoobot/core'; -### Team Collaboration +const bot = new ZooBot({ + provider: 'groq', + model: 'llama-3.3-70b-versatile', + apiKey: process.env.GROQ_API_KEY +}); -```text -@dev fix the auth bug -# โ†’ Routes to team leader (@coder) -# โ†’ Coder fixes bug, mentions @reviewer in response -# โ†’ Reviewer automatically invoked, reviews changes -# โ†’ Combined response sent back to user +const response = await bot.invoke({ + agentId: 'assistant', + message: 'Hello!' +}); ``` -Teams support sequential chains (single handoff) and parallel fan-out (multiple teammate mentions). See [docs/TEAMS.md](docs/TEAMS.md) for details. - -### Cross-Device Access - -- WhatsApp on phone, Discord on desktop, Telegram anywhere, CLI for automation -- All channels share agent conversations! - -
- -## ๐Ÿ“š Documentation - -- [AGENTS.md](docs/AGENTS.md) - Agent management, routing, and custom providers -- [TEAMS.md](docs/TEAMS.md) - Team collaboration, chain execution, chat rooms, and visualizer -- [QUEUE.md](docs/QUEUE.md) - Queue system and message flow -- [tinyoffice/README.md](tinyoffice/README.md) - TinyOffice web portal -- [PLUGINS.md](docs/PLUGINS.md) - Plugin development guide -- [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) - Common issues and solutions - -## ๐Ÿ› Troubleshooting - -
-Quick fixes & common issues +--- -```bash -# Reset everything (preserves settings) -tinyagi stop && rm -rf .tinyagi/queue/* && tinyagi start +## ๐ŸŽจ Brand Assets -# Reset WhatsApp -tinyagi channels reset whatsapp +![ZooBot Logo](docs/assets/zoobot-logo.png) -# Check status -tinyagi status +Logo and brand assets are available in [`docs/assets/`](docs/assets/). -# View logs -tinyagi logs all -``` +--- -**Common issues:** +## ๐Ÿค Contributing -- WhatsApp not connecting โ†’ Reset auth: `tinyagi channels reset whatsapp` -- Messages stuck โ†’ Clear queue: `rm -rf .tinyagi/queue/processing/*` -- Agent not found โ†’ Check: `tinyagi agent list` -- Corrupted settings.json โ†’ TinyAGI auto-repairs invalid JSON (trailing commas, comments, BOM) and creates a `.bak` backup +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. -
+--- -**Need help?** [GitHub Issues](https://github.com/TinyAGI/tinyagi/issues) ยท `tinyagi logs all` +## ๐Ÿ“„ License -## ๐Ÿ™ Credits +MIT License - see [LICENSE](LICENSE) for details. -- Inspired by [OpenClaw](https://openclaw.ai/) by Peter Steinberger -- Built on [Claude Code](https://claude.com/claude-code) and [Codex CLI](https://docs.openai.com/codex) -- Uses [discord.js](https://discord.js.org/), [whatsapp-web.js](https://github.com/pedroslopez/whatsapp-web.js), [node-telegram-bot-api](https://github.com/yagop/node-telegram-bot-api) +--- -## ๐Ÿ“„ License +## ๐Ÿ™ Acknowledgments -MIT +ZooBot is based on [TinyAGI](https://github.com/TinyAGI/TinyAGI) by TinyAGI contributors. We've extended it with direct API support for free LLM providers and additional features. --- -**TinyAGI - Tiny but mighty!** ๐Ÿฆžโœจ - -[![Star History Chart](https://api.star-history.com/image?repos=TinyAGI/tinyagi&type=date&legend=top-left)](https://www.star-history.com/?repos=TinyAGI%2Ftinyagi&type=date&legend=top-left) \ No newline at end of file +

+ ZooBot โ€” Your personal AI agent team, running free in the cloud โ˜๏ธ +

diff --git a/SOUL.md b/SOUL.md index 7878a11..eaa02a9 100644 --- a/SOUL.md +++ b/SOUL.md @@ -1,11 +1,11 @@ -# [Your Name] +# ZooBot Soul ๐Ÿค– -One-line summary of who you are and what you're about. +One-sentence summary: An opinionated, no-nonsense AI agent framework that runs free LLMs and gets things done. --- @@ -29,143 +29,89 @@ Be the assistant you'd actually want to talk to at 2am. Not a corporate drone. N ## Who I Am - - -[Your background here] +ZooBot is an open-source AI agent orchestration framework. We believe AI agents should be: +- **Accessible** โ€” Running free or cheap by default, not locked behind expensive subscriptions +- **Portable** โ€” Your agents, your data, your infrastructure +- **Powerful** โ€” Multi-agent collaboration, memory, skills, web browsing, image generation +- **Fun** โ€” Because AI shouldn't be boring or corporate --- ## Worldview - - -- [Belief 1] -- [Belief 2] -- [Belief 3] -- ... +- Free AI is a right, not a privilege. Groq, OpenRouter, and Cerebras prove it doesn't have to cost $100/month. +- Agent frameworks should be open, not walled gardens controlled by one company. +- The best AI setup is the one you actually own and control. +- Multi-agent systems beat single agents for complex tasks โ€” divide and conquer. +- Local-first isn't always the answer โ€” cloud LLMs are faster and cheaper for most use cases. --- ## Opinions - - -### [Domain 1 - e.g., Technology, Your Industry] +### Technology -- [Specific opinion] -- [Specific opinion] -- [Specific opinion] +- Claude Code and Codex are great but expensive. Groq's Llama 3.3 70B is *good enough* for most agent tasks at 1/10th the cost. +- The future is OpenAI-compatible APIs. Every serious LLM provider is converging on this standard. +- SQLite > Redis for most agent queue needs. Simpler is better until you hit scale. -### [Domain 2] +### AI Agents -- [Specific opinion] -- [Specific opinion] +- Agents need memory to be useful. Without persistent context, you're just doing chatbot math. +- Team-based agents beat monolithic agents. specialized > generalist. +- Streaming responses aren't just nice-to-have โ€” they're essential for agent UX. -### [Domain 3] +### Developer Experience -- [Specific opinion] -- [Specific opinion] - - +- CLI-first is the right default. GUIs are for non-technical users or dashboards, not daily driver. +- Configuration should be a JSON file or env vars, not a proprietary DSL. +- Exit codes matter. Agents should fail loudly and clearly. --- ## Interests - - -- [Interest 1]: Brief context on why/how deep -- [Interest 2]: Brief context -- [Interest 3]: Brief context -- ... +- **LLM Optimization**: Making free models punch above their weight +- **Agent Architecture**: Multi-agent orchestration, memory systems, skill frameworks +- **Open Source**: Building in public, community-driven development +- **Developer Tools**: Making AI accessible to builders --- ## Current Focus - - -- [Current project/focus 1] -- [Current project/focus 2] -- ... +- Direct API adapters for Groq and OpenAI-compatible providers +- Simplifying setup so non-technical users can run agents +- Building example agents and teams for common use cases --- ## Influences - - ### People -- [Person]: What you learned from them -- [Person]: What you learned from them - -### Books/Works -- [Book/Work]: Key idea you took from it -- [Book/Work]: Key idea you took from it +- **@TinyAGI**: The inspiration for this project +- **Anthropic**: Making CLI-first agents viable with Claude Code ### Concepts/Frameworks -- [Concept]: How you use it -- [Concept]: How you use it - ---- - -## Vocabulary - - - -- **[Term]**: What it means when you say it -- **[Term]**: What it means when you say it +- **Agent Oriented Programming**: Treating agents as first-class software entities +- **Actor Model**: Isolated state, message passing, concurrency made simple --- ## Tensions & Contradictions - - -- [Tension 1] -- [Tension 2] +- We want AI to be free but also sustainable โ€” gotta figure out the business model +- CLI-first is powerful but intimidating โ€” need good defaults AND escape hatches +- Open source means no gatekeeping BUT also no one to blame when it breaks --- ## Pet Peeves - - -- [Pet peeve] -- [Pet peeve] +- AI frameworks that lock you in with proprietary APIs +- Chatbot interfaces pretending to be "agents" +- Frameworks that require a PhD to configure +- Vendors who pitch "free" but have 10 gotchas hidden in the fine print --- diff --git a/docs/assets/zoobot-logo.png b/docs/assets/zoobot-logo.png new file mode 100644 index 0000000..d00ab6e Binary files /dev/null and b/docs/assets/zoobot-logo.png differ diff --git a/package.json b/package.json index 7b6287e..3eafc1f 100644 --- a/package.json +++ b/package.json @@ -1,36 +1,53 @@ { - "name": "tinyagi", - "version": "0.0.16", - "description": "Multi-agent, multi-team, multi-channel 24/7 AI assistant", - "workspaces": [ - "packages/*" - ], - "bin": { - "tinyagi": "packages/cli/bin/tinyagi.mjs" - }, - "scripts": { - "build": "tsc --build", - "dev": "concurrently -k -n core,teams,server,main \"npm run dev -w @tinyagi/core\" \"npm run dev -w @tinyagi/teams\" \"npm run dev -w @tinyagi/server\" \"npm run dev -w @tinyagi/main\"", - "build:core": "npm run build -w @tinyagi/core", - "build:teams": "npm run build -w @tinyagi/teams", - "build:channels": "npm run build -w @tinyagi/channels", - "build:server": "npm run build -w @tinyagi/server", - "build:visualizer": "npm run build -w @tinyagi/visualizer", - "start": "npm run start -w @tinyagi/main", - "discord": "npm run discord -w @tinyagi/channels", - "telegram": "npm run telegram -w @tinyagi/channels", - "whatsapp": "npm run whatsapp -w @tinyagi/channels", - "server": "npm run start -w @tinyagi/server", - "visualize": "npm run visualize -w @tinyagi/visualizer", - "chatroom": "npm run chatroom -w @tinyagi/visualizer" + "name": "@zoobot/core", + "version": "1.0.0", + "description": "ZooBot - Open Source AI Agent Framework with Free LLM Support", + "author": "ZooBot Team", + "license": "MIT", + "dependencies": { + "better-sqlite3": "^11.8.0", + "bull": "^4.16.5", + "dotenv": "^16.4.7", + "jsonrepair": "^0.31.0", + "uuid": "^11.1.0", + "winston": "^3.17.0", + "zod": "^3.24.2" }, "devDependencies": { - "@types/node": "^25.2.2", + "@types/better-sqlite3": "^7.6.12", + "@types/node": "^22.13.10", + "@types/uuid": "^10.0.0", "concurrently": "^9.2.1", "nodemon": "^3.1.9", - "typescript": "^5.9.3" + "tsx": "^4.19.3", + "typescript": "^5.8.2" }, - "dependencies": { - "croner": "^10.0.1" + "engines": { + "node": ">=18.0.0" + }, + "scripts": { + "build": "tsc -b", + "dev:cli": "tsx watch packages/cli/src/agent.ts", + "dev:server": "tsx watch packages/server/src/index.ts", + "dev:chatroom": "npm run dev:chatroom -w @zoobot/visualizer", + "chat": "tsx packages/cli/src/agent.ts", + "server": "tsx packages/server/src/index.ts", + "chatroom": "npm run chatroom -w @zoobot/visualizer", + "agent": "tsx packages/cli/src/agent.ts", + "team": "tsx packages/cli/src/team.ts", + "provider": "tsx packages/cli/src/provider.ts", + "schedule": "tsx packages/cli/src/schedule.ts", + "pairing": "tsx packages/cli/src/pairing.ts", + "messaging": "tsx packages/cli/src/messaging.ts", + "update": "tsx packages/cli/src/update.ts", + "setup": "tsx packages/cli/src/setup.ts", + "visualizer": "npm run chatroom -w @zoobot/visualizer", + "test": "echo \"No tests yet\" && exit 0" + }, + "workspaces": [ + "packages/*" + ], + "nx": { + "includedScripts": [] } } diff --git a/packages/channels/package.json b/packages/channels/package.json index c4e591a..6d86711 100644 --- a/packages/channels/package.json +++ b/packages/channels/package.json @@ -1,5 +1,5 @@ { - "name": "@tinyagi/channels", + "name": "@zoobot/channels", "version": "0.0.10", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -14,7 +14,7 @@ "whatsapp": "node dist/whatsapp.js" }, "dependencies": { - "@tinyagi/core": "*", + "@zoobot/core": "*", "discord.js": "^14.16.0", "grammy": "^1.35.0", "qrcode-terminal": "^0.12.0", diff --git a/packages/cli/package.json b/packages/cli/package.json index 9ceaffb..95af268 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,10 +1,10 @@ { - "name": "@tinyagi/cli", + "name": "@zoobot/cli", "version": "0.0.10", "type": "module", "main": "dist/shared.js", "bin": { - "tinyagi": "./bin/tinyagi.mjs" + "zoobot": "./bin/zoobot.mjs" }, "scripts": { "build": "tsc", @@ -12,7 +12,7 @@ }, "dependencies": { "@clack/prompts": "^1.1.0", - "@tinyagi/core": "*", + "@zoobot/core": "*", "open": "^10.0.0" } } diff --git a/packages/core/package.json b/packages/core/package.json index 26bfcbc..638681c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,5 +1,5 @@ { - "name": "@tinyagi/core", + "name": "@zoobot/core", "version": "0.0.10", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/core/src/adapters/groq.ts b/packages/core/src/adapters/groq.ts new file mode 100644 index 0000000..eca0cfd --- /dev/null +++ b/packages/core/src/adapters/groq.ts @@ -0,0 +1,80 @@ +import { AgentAdapter, InvokeOptions } from './types'; +import { log } from '../logging'; + +/** + * Direct Groq API adapter - no CLI required. + * Uses the Groq SDK for OpenAI-compatible API calls. + */ +export const groqAdapter: AgentAdapter = { + providers: ['groq'], + + async invoke(opts: InvokeOptions): Promise { + const { agentId, message, systemPrompt, model, onEvent } = opts; + log('DEBUG', `Using Groq provider (agent: ${agentId}, model: ${model})`); + + const apiKey = process.env.GROQ_API_KEY; + if (!apiKey) { + throw new Error('GROQ_API_KEY environment variable is not set'); + } + + const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { + method: 'POST', + headers: { + 'Authorization': `Bearer ${apiKey}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + model: model || 'llama-3.3-70b-versatile', + messages: [ + ...(systemPrompt ? [{ role: 'system', content: systemPrompt }] : []), + { role: 'user', content: message }, + ], + stream: !!onEvent, + }), + }); + + if (!response.ok) { + const error = await response.text(); + throw new Error(`Groq API error: ${response.status} - ${error}`); + } + + if (onEvent) { + // Streaming mode + const reader = (response.body as ReadableStream).getReader(); + const decoder = new TextDecoder(); + let fullContent = ''; + + while (true) { + const { done, value } = await reader.read(); + if (done) break; + + const chunk = decoder.decode(value); + const lines = chunk.split('\n'); + + for (const line of lines) { + if (line.startsWith('data: ')) { + const data = line.slice(6); + if (data === '[DONE]') continue; + + try { + const json = JSON.parse(data); + const content = json.choices?.[0]?.delta?.content; + if (content) { + fullContent += content; + onEvent(content); + } + } catch { + // Ignore parse errors for incomplete chunks + } + } + } + } + + return fullContent || 'Sorry, I could not generate a response from Groq.'; + } + + // Non-streaming mode + const data = await response.json(); + return data.choices?.[0]?.message?.content || 'Sorry, I could not generate a response from Groq.'; + }, +}; diff --git a/packages/core/src/adapters/index.ts b/packages/core/src/adapters/index.ts index 71e8334..11cb7dd 100644 --- a/packages/core/src/adapters/index.ts +++ b/packages/core/src/adapters/index.ts @@ -4,6 +4,8 @@ import { AgentAdapter } from './types'; import { claudeAdapter } from './claude'; import { codexAdapter } from './codex'; import { opencodeAdapter } from './opencode'; +import { groqAdapter } from './groq'; +import { openaiAdapter } from './openai'; /** Provider โ†’ adapter registry, built automatically from adapter declarations. */ const registry = new Map(); @@ -18,6 +20,8 @@ function register(adapter: AgentAdapter) { register(claudeAdapter); register(codexAdapter); register(opencodeAdapter); +register(groqAdapter); +register(openaiAdapter); export function getAdapter(provider: string): AgentAdapter | undefined { return registry.get(provider); diff --git a/packages/core/src/adapters/openai.ts b/packages/core/src/adapters/openai.ts new file mode 100644 index 0000000..d4d4c2a --- /dev/null +++ b/packages/core/src/adapters/openai.ts @@ -0,0 +1,86 @@ +import { AgentAdapter, InvokeOptions } from './types'; +import { log } from '../logging'; + +/** + * OpenAI-Compatible API adapter - works with any LLM provider + * that follows OpenAI's chat completions API format. + * + * Supports: Groq, Together, Perplexity, Hyperbolic, and any other + * OpenAI-compatible endpoint. + */ +export const openaiAdapter: AgentAdapter = { + providers: ['openai', 'openai-compatible'], + + async invoke(opts: InvokeOptions): Promise { + const { agentId, message, systemPrompt, model, onEvent, envOverrides } = opts; + log('DEBUG', `Using OpenAI-compatible provider (agent: ${agentId}, model: ${model})`); + + const apiKey = envOverrides?.OPENAI_API_KEY || process.env.OPENAI_API_KEY; + const baseUrl = envOverrides?.OPENAI_BASE_URL || process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1'; + + if (!apiKey) { + throw new Error('OPENAI_API_KEY environment variable is not set'); + } + + const endpoint = `${baseUrl}/chat/completions`; + const response = await fetch(endpoint, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${apiKey}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + model: model || 'gpt-4o', + messages: [ + ...(systemPrompt ? [{ role: 'system', content: systemPrompt }] : []), + { role: 'user', content: message }, + ], + stream: !!onEvent, + }), + }); + + if (!response.ok) { + const error = await response.text(); + throw new Error(`OpenAI-compatible API error: ${response.status} - ${error}`); + } + + if (onEvent) { + // Streaming mode + const reader = (response.body as ReadableStream).getReader(); + const decoder = new TextDecoder(); + let fullContent = ''; + + while (true) { + const { done, value } = await reader.read(); + if (done) break; + + const chunk = decoder.decode(value); + const lines = chunk.split('\n'); + + for (const line of lines) { + if (line.startsWith('data: ')) { + const data = line.slice(6); + if (data === '[DONE]') continue; + + try { + const json = JSON.parse(data); + const content = json.choices?.[0]?.delta?.content; + if (content) { + fullContent += content; + onEvent(content); + } + } catch { + // Ignore parse errors for incomplete chunks + } + } + } + } + + return fullContent || 'Sorry, I could not generate a response.'; + } + + // Non-streaming mode + const data = await response.json(); + return data.choices?.[0]?.message?.content || 'Sorry, I could not generate a response.'; + }, +}; diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 4a6822f..6f9ca87 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -4,12 +4,17 @@ import { jsonrepair } from 'jsonrepair'; import { Settings, AgentConfig, TeamConfig, MODEL_ALIASES } from './types'; export const SCRIPT_DIR = path.resolve(__dirname, '../../..'); -export const TINYAGI_HOME = process.env.TINYAGI_HOME - || path.join(require('os').homedir(), '.tinyagi'); -export const LOG_FILE = path.join(TINYAGI_HOME, 'logs/queue.log'); -export const SETTINGS_FILE = path.join(TINYAGI_HOME, 'settings.json'); -export const CHATS_DIR = path.join(TINYAGI_HOME, 'chats'); -export const FILES_DIR = path.join(TINYAGI_HOME, 'files'); +export const ZOOBOT_HOME = process.env.ZOOBOT_HOME + || process.env.TINYAGI_HOME // Backwards compatibility + || path.join(require('os').homedir(), '.zoobot'); +export const LOG_FILE = path.join(ZOOBOT_HOME, 'logs/queue.log'); +export const SETTINGS_FILE = path.join(ZOOBOT_HOME, 'settings.json'); +export const CHATS_DIR = path.join(ZOOBOT_HOME, 'chats'); +export const FILES_DIR = path.join(ZOOBOT_HOME, 'files'); + +// Backwards compatibility aliases +export const TINYAGI_HOME = ZOOBOT_HOME; +export const TINYAGI_CONFIG = SETTINGS_FILE; export function getSettings(): Settings { try { @@ -48,6 +53,22 @@ export function getSettings(): Settings { } else if (settings?.models?.anthropic) { if (!settings.models) settings.models = {}; settings.models.provider = 'anthropic'; + } else if (settings?.models?.groq) { + if (!settings.models) settings.models = {}; + settings.models.provider = 'groq'; + } else if (settings?.custom_providers) { + // Check custom providers for groq or openai-compatible + const providerKeys = Object.keys(settings.custom_providers); + if (providerKeys.length > 0) { + const firstProvider = settings.custom_providers[providerKeys[0]]; + if (firstProvider.harness === 'groq') { + if (!settings.models) settings.models = {}; + settings.models.provider = 'groq'; + } else if (firstProvider.harness === 'openai-compatible') { + if (!settings.models) settings.models = {}; + settings.models.provider = 'openai-compatible'; + } + } } } @@ -65,19 +86,23 @@ export function getDefaultAgentFromModels(settings: Settings): AgentConfig { const provider = settings?.models?.provider || 'anthropic'; let model = ''; if (provider === 'openai') { - model = settings?.models?.openai?.model || 'gpt-5.3-codex'; + model = settings?.models?.openai?.model || 'gpt-4o'; } else if (provider === 'opencode') { model = settings?.models?.opencode?.model || 'sonnet'; + } else if (provider === 'groq') { + model = settings?.models?.groq?.model || 'llama-3.3-70b-versatile'; + } else if (provider === 'openai-compatible') { + model = settings?.models?.openai?.model || 'gpt-4o'; } else { model = settings?.models?.anthropic?.model || 'sonnet'; } // Get workspace path from settings or use default - const workspacePath = settings?.workspace?.path || path.join(require('os').homedir(), 'tinyagi-workspace'); - const defaultAgentDir = path.join(workspacePath, 'tinyagi'); + const workspacePath = settings?.workspace?.path || path.join(require('os').homedir(), 'zoo-bot-workspace'); + const defaultAgentDir = path.join(workspacePath, 'zoobot'); return { - name: 'TinyAGI Agent', + name: 'ZooBot Agent', provider, model, working_directory: defaultAgentDir, diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index d62f8c2..3420006 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1,9 +1,9 @@ export interface CustomProvider { name: string; - harness: 'claude' | 'codex'; // which CLI to invoke - base_url: string; + harness: 'claude' | 'codex' | 'groq' | 'openai' | 'openai-compatible'; // which CLI to invoke or 'groq'/'openai' for direct API + base_url?: string; // For OpenAI-compatible providers api_key: string; - model?: string; // model name to pass to the CLI + model?: string; // model name to pass to the CLI or API } export interface AgentConfig { diff --git a/packages/main/package.json b/packages/main/package.json index a6e4e58..017ea80 100644 --- a/packages/main/package.json +++ b/packages/main/package.json @@ -1,5 +1,5 @@ { - "name": "@tinyagi/main", + "name": "@zoobot/main", "version": "0.0.10", "private": true, "main": "dist/index.js", @@ -9,8 +9,8 @@ "start": "node dist/index.js" }, "dependencies": { - "@tinyagi/core": "*", - "@tinyagi/server": "*", - "@tinyagi/teams": "*" + "@zoobot/core": "*", + "@zoobot/server": "*", + "@zoobot/teams": "*" } } diff --git a/packages/server/package.json b/packages/server/package.json index 46dcc9c..e813022 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,5 +1,5 @@ { - "name": "@tinyagi/server", + "name": "@zoobot/server", "version": "0.0.10", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -9,8 +9,8 @@ "start": "node dist/index.js" }, "dependencies": { - "@tinyagi/core": "*", - "@tinyagi/teams": "*", + "@zoobot/core": "*", + "@zoobot/teams": "*", "@hono/node-server": "^1.19.9", "hono": "^4.12.1" } diff --git a/packages/teams/package.json b/packages/teams/package.json index fbd63ab..e52a10b 100644 --- a/packages/teams/package.json +++ b/packages/teams/package.json @@ -1,5 +1,5 @@ { - "name": "@tinyagi/teams", + "name": "@zoobot/teams", "version": "0.0.10", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -8,6 +8,6 @@ "dev": "tsc -w" }, "dependencies": { - "@tinyagi/core": "*" + "@zoobot/core": "*" } } diff --git a/packages/visualizer/package.json b/packages/visualizer/package.json index b36c042..5325d4f 100644 --- a/packages/visualizer/package.json +++ b/packages/visualizer/package.json @@ -1,5 +1,5 @@ { - "name": "@tinyagi/visualizer", + "name": "@zoobot/visualizer", "version": "0.0.10", "type": "module", "main": "dist/team-visualizer.js",