{"id":50412337,"url":"https://github.com/cskwork/claude-greeter","last_synced_at":"2026-05-31T04:04:56.324Z","repository":{"id":320351187,"uuid":"1081541315","full_name":"cskwork/claude-greeter","owner":"cskwork","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-23T08:49:48.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-23T10:30:26.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cskwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-22T23:45:01.000Z","updated_at":"2025-10-23T08:49:52.000Z","dependencies_parsed_at":"2025-10-23T10:30:29.560Z","dependency_job_id":null,"html_url":"https://github.com/cskwork/claude-greeter","commit_stats":null,"previous_names":["cskwork/claude-greeter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cskwork/claude-greeter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cskwork%2Fclaude-greeter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cskwork%2Fclaude-greeter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cskwork%2Fclaude-greeter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cskwork%2Fclaude-greeter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cskwork","download_url":"https://codeload.github.com/cskwork/claude-greeter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cskwork%2Fclaude-greeter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33718496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-31T04:04:55.322Z","updated_at":"2026-05-31T04:04:56.305Z","avatar_url":"https://github.com/cskwork.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude Agent Greeter API\n\nMinimal scheduled API that greets the Claude agent every 5 hours using the Claude Agent SDK.\n\n## Features\n\n- ✅ **Automated Setup**: `setup.sh` and `setup.bat` scripts for easy installation.\n- ✅ **Scheduled Execution**: Runs every 5 hours from your designated start time.\n- ✅ **Quiet Hours**: Configure a \"prevent window\" to skip jobs during specific hours.\n- 🔄 **Schedule Reset**: Automatically resets the schedule to the next day's `START_TIME` if a run is skipped during quiet hours.\n- ✅ **Robust \u0026 Resilient**: Includes retry logic with exponential backoff for API calls.\n- ✅ **Cross-Platform**: Works on Windows, macOS, and Linux.\n- ✅ **Easy Management**: Scripts to start, stop, and check the status of the application.\n- ✅ **Manual Trigger**: An API endpoint to trigger a greeting manually.\n- ✅ **Schedule Monitoring**: An API endpoint to view the current schedule.\n\n## Prerequisites\n\n1.  **Python**: Version 3.8 or higher.\n2.  **Node.js (for Claude Code CLI)**:\n    *   **Mac**: `brew install node`\n    *   **Windows**: Download from [nodejs.org](https://nodejs.org)\n3.  **Claude Code CLI**:\n    ```bash\n    npm install -g @anthropic-ai/claude-code\n    ```\n4.  **Anthropic API Key**: Get your API key from [console.anthropic.com](https://console.anthropic.com/).\n\n## Quick Start\n\n1.  **Clone the project**:\n    ```bash\n    git clone \u003crepository-url\u003e\n    cd claude-greeter\n    ```\n\n2.  **Run the setup script**:\n    *   **Mac/Linux**:\n        ```bash\n        chmod +x setup.sh\n        ./setup.sh\n        ```\n    *   **Windows**:\n        ```bat\n        setup.bat\n        ```\n\n    The setup script will:\n    - Create a Python virtual environment (`venv`).\n    - Install all required dependencies.\n    - Create a `.env` file from the `.env.example` template.\n    - Start the application in the background.\n\n3.  **Configure your environment**:\n    Edit the `.env` file to set your `ANTHROPIC_API_KEY` and customize the `START_TIME`.\n\n    ```env\n    # Your Anthropic API key (required)\n    ANTHROPIC_API_KEY=sk-ant-xxxxx\n\n    # Start time in 24-hour format (HH:MM) - will run every 5 hours from this time\n    START_TIME=09:00\n\n    # Optional: Timezone (defaults to system timezone)\n    # TIMEZONE=America/New_York\n\n    # Optional: Prevent window - skip job execution during these hours\n    # Format: HH:MM (24-hour format)\n    # Example: PREVENT_START_TIME=23:00, PREVENT_END_TIME=04:00 prevents execution from 11 PM to 4 AM\n    PREVENT_START_TIME=23:00\n    PREVENT_END_TIME=04:00\n    ```\n\n## Management\n\nUse the following scripts to manage the application:\n\n-   **Check Status**:\n    -   `./status.sh` (Mac/Linux)\n    -   `status.bat` (Windows)\n-   **Stop the Application**:\n    -   `./stop.sh` (Mac/Linux)\n    -   `stop.bat` (Windows)\n-   **View Logs**:\n    ```bash\n    tail -f log/app.log\n    ```\n\n## API Endpoints\n\n#### 1. Health Check\n```bash\ncurl http://localhost:8000/\n```\n*Response:*\n```json\n{\n  \"status\": \"running\",\n  \"message\": \"Claude Agent Greeter is active\",\n  \"next_scheduled_run\": \"2025-10-29T14:00:00+09:00\",\n  \"interval\": \"Every 5 hours\",\n  \"start_time\": \"09:00\",\n  \"prevent_window\": {\n    \"start\": \"23:00\",\n    \"end\": \"04:00\",\n    \"active\": false\n  }\n}\n```\n\n#### 2. Manual Greeting\nTriggers a greeting without affecting the schedule.\n```bash\ncurl -X POST http://localhost:8000/greet\n```\n*Response:*\n```json\n{\n  \"status\": \"success\",\n  \"response\": \"Hello! Nice to hear from you. How can I help you today?\",\n  \"elapsed_seconds\": 3.2\n}\n```\n\n#### 3. View Schedule\n```bash\ncurl http://localhost:8000/schedule\n```\n*Response:*\n```json\n{\n  \"job_id\": \"greet_agent_job\",\n  \"job_name\": \"Greet Claude Agent\",\n  \"next_run_time\": \"2025-10-29T14:00:00+09:00\",\n  \"trigger\": \"interval[5:00:00]\",\n  \"interval_hours\": 5,\n  \"start_time_config\": \"09:00\"\n}\n```\n\n## Customization\n\nTo customize the application's behavior, edit `main.py`:\n\n-   **Greeting Message**: Modify the `prompt` in the `greet_agent` function.\n-   **Interval**: Change the `hours` parameter in the `IntervalTrigger` inside the `lifespan` function.\n-   **System Instructions**: Update the `system_prompt` in the `ClaudeAgentOptions` within the `greet_agent` function.\n\n## Project Structure\n\n```\nclaude-greeter/\n├── .claude/             # Claude agent cache and logs\n├── .git/                # Git directory\n├── docs/                # Project documentation\n├── log/                 # Application logs (e.g., app.log)\n├── tests/               # Test suite\n├── venv/                # Python virtual environment\n├── .env                 # Environment variables (API key, schedule)\n├── .env.example         # Example for .env\n├── .gitignore           # Git ignore file\n├── main.py              # FastAPI app, scheduler, and core logic\n├── README.md            # This file\n├── requirements.txt     # Python dependencies\n├── setup.bat            # Windows setup script\n├── setup.sh             # Mac/Linux setup script\n├── status.bat           # Windows status script\n├── status.sh            # Mac/Linux status script\n├── stop.bat             # Windows stop script\n└── stop.sh              # Mac/Linux stop script\n```\n\n## How It Works\n\n### Schedule Logic\nThe scheduler calculates the next run time based on the `START_TIME` and a fixed 5-hour interval.\n\n-   If you set `START_TIME=09:00`, the job will run at 09:00, 14:00, 19:00, 00:00, 05:00, and so on.\n-   If the application is started *after* the day's `START_TIME`, it calculates the next valid 5-hour interval to run. For example, if started at 11:30, the next run will be at 14:00.\n\n### Quiet Hours (Prevent Window)\nIf `PREVENT_START_TIME` and `PREVENT_END_TIME` are set in `.env`, any job scheduled to run within that time window will be skipped. **Crucially, the schedule will then reset.** The next job will be scheduled for the `START_TIME` on the following day, ensuring the interval sequence always originates from your defined `START_TIME`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcskwork%2Fclaude-greeter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcskwork%2Fclaude-greeter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcskwork%2Fclaude-greeter/lists"}