# Business Overview

## Business Context Diagram

```mermaid
graph TD
    User["Team Members\n(Members, PMs, Devs)"]
    Feishu["Feishu\n(Messaging & Wiki)"]
    OpenClaw["OpenClaw Agents\n(AI Assistants)"]
    Repo["GitHub Repo\n(data-service-infra-ai-configurations)"]
    Docker["Docker\n(Container Orchestration)"]
    External["External Services\n(GitHub API, Jira, Grafana, MiniMax)"]
    
    User --> Feishu
    Feishu --> OpenClaw
    OpenClaw --> Repo
    OpenClaw --> Docker
    OpenClaw --> External
    Docker --> Repo
```

## Business Description

This repository manages the AI-powered team automation infrastructure for the **Data Service Infra team** at PingCAP/TiDB Cloud. It provides:

- **Multi-role AI agents**: Personal assistants for each team member plus shared team agents
- **Automated workflows**: Cron-scheduled tasks for reporting, monitoring, and knowledge management
- **Standardized configuration**: GitOps-based configuration management for all agents
- **Code review automation**: AI-powered PR analysis and review workflows
- **Zero-port architecture**: All communication via Feishu (no exposed ports)

### Business Transactions

| Transaction | Description | Actor |
|-------------|-------------|-------|
| Agent Setup | Auto-configure OpenClaw agents based on role | team-admin |
| Daily Inspection | Automated health check and status report | team-admin |
| Memory Backup | Periodic backup of agent memory/context | team-admin |
| PR Review | AI analysis of code changes in PRs | team-code-expert |
| Task Sync | Synchronize task status across team | team-workflow |
| Alert Analysis | Analyze failed jobs and alert patterns | team-workflow |
| Oncall Report | Generate daily oncall metrics | team-workflow |
| Knowledge Management | Maintain team knowledge base | team-workflow |

## Component Level Business Descriptions

### agents-bootstrap/
- **Purpose**: Provide role-specific agent configuration templates
- **Responsibilities**: Define agent identity, capabilities, and context for each role (personal, team-admin, team-workflow, team-code-expert, team-assist)
- **Format**: Markdown files loaded by OpenClaw at agent startup

### cronjobs/
- **Purpose**: Scheduled automation tasks for team operations
- **Responsibilities**: Execute periodic jobs (daily reports, health checks, PR monitoring) via unified Python scheduler
- **Roles**: team-admin (management), team-workflow (reporting), team-code-expert (code analysis)
- **Key file**: `run_cronjob_every_10mins.py` - unified scheduler that reads cronjob.json configs and executes matching jobs

### docker-compose/
- **Purpose**: Container orchestration for all OpenClaw agents
- **Responsibilities**: Define, configure, and deploy 9+ Docker containers for team members and shared roles
- **Key characteristic**: Zero-port exposure (network_mode: host for most), Feishu-only communication

### knowledge/
- **Purpose**: Internal knowledge base for team operations
- **Responsibilities**: Store team-specific operational knowledge (debugging guides, workflows, context)

### memories/
- **Purpose**: Per-role agent memory and context files
- **Responsibilities**: Persist agent identity, configuration, and working context for each role
- **Structure**: team-admin/, team-code-expert/, team-workflow/ directories with IDENTITY.md, SOUL.md, USER.md, AGENTS.md, HEARTBEAT.md, configuration.md

### skills/
- **Purpose**: Reusable agent skills/capabilities
- **Responsibilities**: Modular skill packages that agents can invoke (daily-inspection, backup, PR review, etc.)
- **Teams**: team-admin, team-workflow, team-code-expert, team-common

### tests/
- **Purpose**: Test suite for the repository
- **Current Status**: Framework in place (pytest) but no Python test files exist yet

### .github/workflows/
- **Purpose**: CI/CD automation
- **Responsibilities**: Send Feishu notifications on PR events

### ruff.toml / .pre-commit-config.yaml
- **Purpose**: Code quality enforcement
- **Responsibilities**: Automated linting and formatting for Python code
