{"id":31848371,"url":"https://github.com/danielgerlag/daemon","last_synced_at":"2026-07-26T15:31:52.446Z","repository":{"id":317403874,"uuid":"1045264412","full_name":"danielgerlag/daemon","owner":"danielgerlag","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-22T16:05:23.000Z","size":1793,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-23T12:16:53.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/danielgerlag.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-08-26T22:41:30.000Z","updated_at":"2025-09-22T16:10:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"17440920-f7c7-4e86-b7d2-d187e53c05ef","html_url":"https://github.com/danielgerlag/daemon","commit_stats":null,"previous_names":["danielgerlag/daemon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danielgerlag/daemon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgerlag%2Fdaemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgerlag%2Fdaemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgerlag%2Fdaemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgerlag%2Fdaemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielgerlag","download_url":"https://codeload.github.com/danielgerlag/daemon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgerlag%2Fdaemon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35919181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-26T02:00:06.503Z","response_time":89,"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":"2025-10-12T10:24:39.385Z","updated_at":"2026-07-26T15:31:52.425Z","avatar_url":"https://github.com/danielgerlag.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Agent Daemon\n\nA powerful CLI tool for running AI agents in the background with support for MCP (Model Context Protocol) tools, scheduled jobs, inter-agent collaboration, and advanced workflow patterns.\n\n## Features\n\n- **Background AI Agents**: Run AI agents as daemons with Azure OpenAI integration\n- **Advanced Workflow Patterns**: Support for Reason+Act, Plan+Solve, Reflection, Reflexion, LLM-Compiler, ReWOO, STORM, and Reflection+Refinement patterns\n- **MCP Tool Integration**: Support for both stdio command and HTTP-based MCP servers\n- **Notification Handling**: React to notifications from MCP tools with custom workflow executions\n- **Cron Job Scheduling**: Run workflows on schedule or at startup\n- **Conversation API**: Optional HTTP endpoint for human or agent interaction\n- **Agent Collaboration**: Communicate with other agent instances using A2A (Agent-to-Agent) protocol\n- **Interactive Web UI**: Monitor agent activity with a modern web interface\n- **History Tracking**: Persistent storage of conversations, tool invocations, and collaborations\n\n## Installation\n\n```bash\nnpm install\nnpm run build\n```\n\nFor global installation:\n```bash\nnpm install -g .\n```\n\n## Configuration\n\nCreate a YAML configuration file for your agent. See the `samples/` directory for detailed examples.\n\n### Basic Configuration\n\n```yaml\nid: my-agent\n\n# Named model configurations\nmodels:\n  main-model:\n    kind: azure-openai\n    endpoint: ${AZURE_OPENAI_ENDPOINT}\n    apiKey: ${AZURE_OPENAI_API_KEY}\n    deployment: ${AZURE_OPENAI_DEPLOYMENT}\n    temperature: 0.7\n    maxTokens: 1500\n\ndefaultModel: main-model\n\n# Workflow configuration with pattern selection\nworkflow:\n  kind: Reason+Act  # Options: Reason+Act, Plan+Solve, Reflection, Reflexion, LLM-Compiler, ReWOO, STORM, Reflection+Refinement\n  model: main-model\n  prompt: |\n    Initialize the agent and perform startup tasks\n\n# MCP servers (tools)\nmcpServers:\n  - name: my-tool\n    kind: command\n    command: node\n    args: [\"path/to/mcp-server.js\"]\n    on:\n      event_type: \n        workflow:\n          kind: Reason+Act\n          model: main-model\n          prompt: \"Handle this notification: {{message}}\"\n\n# Cron jobs with workflow execution\ncron:\n  - job: periodic-task\n    schedule: \"0 */6 * * *\"\n    workflow:\n      kind: Plan+Solve\n      model: main-model\n      prompt: \"Run periodic maintenance tasks\"\n      maxPlanSteps: 5\n\nendpoint: 127.0.0.1:9000\n\n# A2A (Agent-to-Agent) collaboration\ncollaborators:\n  - id: other-agent\n    url: http://localhost:9001\n```\n\n### Environment Variables\n\nCopy `.env.example` to `.env` and fill in your Azure OpenAI credentials:\n\n```bash\ncp .env.example .env\n```\n\n## Usage\n\n### Basic Usage\n\n```bash\n# Run agent with configuration file\ndaemon config.yaml\n\n# Run with verbose logging\ndaemon config.yaml --verbose\n\n# For development (if not globally installed)\nnode dist/cli.js config.yaml --verbose\n```\n\n### Global Installation\n\n```bash\nnpm install -g .\ndaemon config.yaml\n```\n\n## API Endpoints\n\nIf you configure an endpoint, the agent exposes these HTTP endpoints:\n\n- `POST /api/conversation` - Send messages to the agent\n- `GET /api/status` - Get agent status\n- `GET /api/config` - Get agent configuration\n- `GET /api/tools` - Get available tools\n- `GET /api/mcp-servers` - Get MCP server information\n- `GET /api/history` - Get conversation and activity history\n- `GET /api/cron-jobs` - Get cron job status\n- `GET /api/health` - Health check\n- `GET /api/logs` - Get agent logs\n- `GET /api/tool-invocations` - Get tool invocation history\n- `GET /api/tool-invocations/:toolName` - Get history for specific tool\n- `GET /api/tool-streams` - Get MCP tool stream data\n- `GET /api/websocket` - WebSocket endpoint information\n- `WS /hub` - WebSocket endpoint for real-time events\n\n### Conversation API\n\n```bash\ncurl -X POST http://localhost:9000/api/conversation \\\\\n  -H \"Content-Type: application/json\" \\\\\n  -d '{\n    \"type\": \"User\",\n    \"clientId\": \"user-123\",\n    \"message\": \"Hello, agent!\"\n  }'\n```\n\n## MCP Server Integration\n\nThe daemon supports both command-line and HTTP-based MCP servers:\n\n### Command-based MCP Servers\n\n```yaml\nmcpServers:\n  - name: fs-watcher\n    kind: command\n    command: npx\n    args: [\"@example/file-watcher-mcp\"]\n    env:\n      NODE_ENV: production\n    on:\n      file_change: \n        workflow:\n          kind: Reflection\n          model: main-model\n          prompt: \"File {{filename}} was modified at {{path}}\"\n          reflectionInterval: 3\n```\n\n### HTTP-based MCP Servers\n\n```yaml\nmcpServers:\n  - name: github-api\n    kind: http\n    url: https://api.githubcopilot.com/mcp/\n    headers:\n      Authorization: \"Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}\"\n```\n\n### MCP Server Configuration Options\n\nEach MCP server supports these configuration parameters:\n\n- **`on`**: Notification handlers that execute workflows when the server sends notifications\n- **`env`**: Environment variables for command-based servers\n- **`headers`**: HTTP headers for HTTP-based servers\n\nThe agent automatically discovers tool schemas from MCP servers and includes them in the system prompt, so the LLM knows the exact parameter names and types required by each tool.\n\nExample workflow execution with tools:\n```json\n{\"tool\": \"file-watcher\", \"method\": \"subscribe_file_watch\", \"arguments\": {\"directory\": \"/path\", \"watchId\": \"my-watch\", \"recursive\": true}}\n```\n\n## Workflow Patterns\n\nThe daemon supports multiple advanced workflow patterns:\n\n### Reason+Act\nSimple reasoning and action execution pattern.\n\n```yaml\nworkflow:\n  kind: Reason+Act\n  model: main-model\n  prompt: \"Analyze and take action on the given task\"\n```\n\n### Plan+Solve\nSystematic planning followed by step-by-step execution.\n\n```yaml\nworkflow:\n  kind: Plan+Solve\n  model: main-model\n  prompt: \"Create a plan and solve this complex problem\"\n  maxPlanSteps: 8\n  planningPrompt: \"Create a detailed plan for: ${TASK}\"\n```\n\n### Reflection\nPeriodic self-reflection during task execution.\n\n```yaml\nworkflow:\n  kind: Reflection\n  model: main-model\n  prompt: \"Execute the task with periodic reflection\"\n  reflectionInterval: 3\n  reflectionModel: reflection-model\n  reflectionPrompt: \"Reflect on the progress and adjust if needed\"\n```\n\n### Reflexion\nSelf-correction through reflexive analysis.\n\n```yaml\nworkflow:\n  kind: Reflexion\n  model: main-model\n  prompt: \"Execute with self-correction capabilities\"\n  maxReflexions: 5\n  reflexionPrompt: \"Analyze errors and provide corrections\"\n```\n\n### LLM-Compiler\nMulti-step compilation and optimization of responses.\n\n```yaml\nworkflow:\n  kind: LLM-Compiler\n  model: main-model\n  prompt: \"Compile and optimize the solution\"\n  maxCompilationSteps: 3\n  enableRecompilation: true\n```\n\n### ReWOO\nReasoning Without Observation pattern for complex problem solving.\n\n```yaml\nworkflow:\n  kind: ReWOO\n  model: main-model\n  prompt: \"Solve using reasoning without observation\"\n  maxReasoningSteps: 5\n```\n\n### STORM\nSynthesis of Topic Outline through Retrieval and Multi-perspective question asking.\n\n```yaml\nworkflow:\n  kind: STORM\n  model: main-model\n  prompt: \"Research and synthesize comprehensive information\"\n  maxPerspectives: 4\n  researchDepth: 3\n```\n\n## Agent Collaboration (A2A Protocol)\n\nAgents can communicate with each other using the standardized Agent-to-Agent (A2A) protocol:\n\n```yaml\ncollaborators:\n  - id: agent-2\n    url: http://localhost:9001\n```\n\nThe system automatically:\n- Converts legacy collaboration to A2A protocol\n- Generates agent cards at `/.well-known/agent-card.json`\n- Enables standardized message exchange\n- Supports task delegation and coordination\n\nThe agent can collaborate by responding with JSON:\n\n```json\n{\"collaborate\": \"agent-2\", \"message\": \"Please help with this task\"}\n```\n\n### A2A Features\n- **Agent Discovery**: Automatic capability discovery through agent cards\n- **Standardized Messaging**: Consistent message format across all agents\n- **Task Management**: Built-in support for complex, multi-agent tasks\n- **Error Handling**: Standardized error responses and retry mechanisms\n\nSee `examples/a2a-collaboration-example.md` for detailed A2A setup examples.\n\n## Cron Jobs\n\nSchedule workflows to run automatically:\n\n```yaml\ncron:\n  - job: daily-summary\n    schedule: \"0 9 * * *\"  # Daily at 9 AM\n    workflow:\n      kind: Plan+Solve\n      model: main-model\n      prompt: \"Generate a daily summary report\"\n      maxPlanSteps: 5\n    \n  - job: startup-task\n    on-startup: true\n    schedule: \"0 */6 * * *\"  # Every 6 hours\n    workflow:\n      kind: Reflection\n      model: main-model\n      prompt: \"Perform maintenance checks\"\n      reflectionInterval: 2\n```\n\n## History and Monitoring\n\nAll agent activity is automatically tracked:\n\n- **Conversations**: User/agent message exchanges\n- **Tool Invocations**: MCP server calls and results\n- **Collaborations**: Inter-agent communications via A2A protocol\n- **Workflow Executions**: Detailed execution logs for all workflow patterns\n- **Cron Jobs**: Scheduled task execution history\n\nHistory is stored in `~/.ai-agent-daemon/{agent-id}-history.json`\n\n## Web UI\n\nThe daemon includes a modern web interface for monitoring agent activity:\n\n- **Real-time Dashboard**: Live agent status and activity\n- **Conversation History**: Browse and search conversation logs\n- **Tool Monitoring**: Track MCP server invocations and performance\n- **Collaboration Tracking**: Monitor A2A protocol communications\n- **Workflow Visualization**: View workflow execution patterns\n- **Cron Job Management**: Monitor scheduled tasks\n\nAccess the web UI at `http://localhost:{port}` when an endpoint is configured.\n\n## Examples\n\nSee the `samples/` directory for complete configuration examples including:\n\n- **Basic Agents**: Simple Reason+Act and Plan+Solve configurations\n- **Workflow Patterns**: Examples for all supported workflow types\n- **GitHub Integration**: Issue monitoring and management with collaboration\n- **Financial Trading**: Complex reflection-based trading analysis\n- **File System Monitoring**: Notification-driven file watching\n- **Multi-Agent Collaboration**: A2A protocol examples\n\nAlso see `examples/a2a-collaboration-example.md` for detailed multi-agent setup guides.\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Development mode with auto-reload (backend only)\nnpm run dev config.yaml\n\n# Build for production (both backend and frontend)\nnpm run build\n\n# Build only backend\nnpm run build:backend\n\n# Build only frontend\nnpm run build:frontend\n\n# Development mode with frontend hot reload\nnpm run dev:frontend\n\n# Run built version\nnpm start config.yaml\n\n# Run tests\nnpm test\n```\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgerlag%2Fdaemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgerlag%2Fdaemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgerlag%2Fdaemon/lists"}