thepopebot 1.2.75-beta.2 → 1.2.75-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/api/CLAUDE.md +1 -1
  3. package/api/index.js +5 -12
  4. package/bin/CLAUDE.md +1 -1
  5. package/bin/cli.js +329 -14
  6. package/bin/docker-build.js +5 -0
  7. package/bin/managed-paths.js +0 -7
  8. package/bin/sync.js +84 -0
  9. package/config/CLAUDE.md +1 -29
  10. package/config/instrumentation.js +1 -1
  11. package/lib/CLAUDE.md +3 -3
  12. package/lib/ai/CLAUDE.md +24 -3
  13. package/lib/ai/agent.js +8 -5
  14. package/lib/ai/async-channel.js +51 -0
  15. package/lib/ai/headless-stream.js +3 -0
  16. package/lib/ai/index.js +149 -173
  17. package/lib/ai/line-mappers.js +72 -9
  18. package/lib/ai/tools.js +40 -28
  19. package/lib/chat/actions.js +34 -6
  20. package/lib/chat/api.js +17 -1
  21. package/lib/chat/components/chat-header.js +4 -0
  22. package/lib/chat/components/chat-header.jsx +4 -0
  23. package/lib/chat/components/chat-input.js +1 -0
  24. package/lib/chat/components/chat-input.jsx +1 -0
  25. package/lib/chat/components/chat.js +9 -1
  26. package/lib/chat/components/chat.jsx +15 -2
  27. package/lib/chat/components/chats-page.js +3 -3
  28. package/lib/chat/components/chats-page.jsx +4 -6
  29. package/lib/chat/components/crons-page.js +1 -1
  30. package/lib/chat/components/crons-page.jsx +1 -1
  31. package/lib/chat/components/message.js +12 -4
  32. package/lib/chat/components/message.jsx +17 -4
  33. package/lib/chat/components/settings-chat-page.js +2 -1
  34. package/lib/chat/components/settings-chat-page.jsx +4 -1
  35. package/lib/chat/components/settings-coding-agents-page.js +139 -1
  36. package/lib/chat/components/settings-coding-agents-page.jsx +160 -0
  37. package/lib/chat/components/settings-jobs-page.js +13 -2
  38. package/lib/chat/components/settings-jobs-page.jsx +15 -1
  39. package/lib/chat/components/settings-secrets-layout.js +1 -1
  40. package/lib/chat/components/settings-secrets-layout.jsx +1 -1
  41. package/lib/chat/components/sidebar-history-item.js +3 -3
  42. package/lib/chat/components/sidebar-history-item.jsx +4 -6
  43. package/lib/chat/components/triggers-page.js +1 -1
  44. package/lib/chat/components/triggers-page.jsx +1 -1
  45. package/lib/cluster/actions.js +4 -4
  46. package/lib/cluster/execute.js +3 -1
  47. package/lib/code/actions.js +34 -11
  48. package/lib/code/code-page.js +40 -40
  49. package/lib/code/code-page.jsx +36 -36
  50. package/lib/code/port-forwards.js +17 -3
  51. package/lib/code/terminal-view.js +16 -0
  52. package/lib/code/terminal-view.jsx +18 -0
  53. package/lib/config.js +4 -0
  54. package/lib/cron.js +3 -3
  55. package/lib/db/api-keys.js +22 -61
  56. package/lib/db/config.js +23 -0
  57. package/lib/db/index.js +3 -1
  58. package/lib/maintenance.js +34 -11
  59. package/lib/paths.js +1 -38
  60. package/lib/tools/create-agent-job.js +0 -4
  61. package/lib/tools/docker.js +23 -16
  62. package/lib/triggers.js +4 -3
  63. package/lib/utils/render-md.js +3 -1
  64. package/package.json +2 -1
  65. package/setup/setup-ssl.mjs +414 -0
  66. package/templates/.github/workflows/rebuild-event-handler.yml +3 -0
  67. package/templates/.github/workflows/upgrade-event-handler.yml +1 -1
  68. package/templates/.gitignore.template +7 -3
  69. package/templates/.tmp/CLAUDE.md.template +5 -0
  70. package/templates/CLAUDE.md +3 -2
  71. package/templates/CLAUDE.md.template +24 -357
  72. package/templates/agent-job/CLAUDE.md.template +57 -0
  73. package/templates/agent-job/CRONS.json +16 -0
  74. package/templates/{config/agent-job → agent-job}/SOUL.md +3 -3
  75. package/templates/agent-job/SYSTEM.md +60 -0
  76. package/templates/agents/CLAUDE.md.template +54 -0
  77. package/templates/data/CLAUDE.md.template +5 -0
  78. package/templates/docker-compose.custom.yml +41 -62
  79. package/templates/docker-compose.yml +14 -21
  80. package/templates/event-handler/CLAUDE.md.template +0 -0
  81. package/templates/logs/CLAUDE.md.template +5 -0
  82. package/templates/skills/CLAUDE.md.template +57 -32
  83. package/templates/skills/active/.gitkeep +0 -0
  84. package/templates/skills/library/agent-job-secrets/SKILL.md +23 -0
  85. package/templates/skills/library/agent-job-secrets/agent-job-secrets.js +62 -0
  86. package/templates/.pi/extensions/env-sanitizer/index.ts +0 -48
  87. package/templates/.pi/extensions/env-sanitizer/package.json +0 -5
  88. package/templates/README.md +0 -75
  89. package/templates/config/CLAUDE.md.template +0 -40
  90. package/templates/config/CRONS.json +0 -56
  91. package/templates/config/agent-job/AGENT_JOB.md +0 -30
  92. package/templates/cron/CLAUDE.md.template +0 -24
  93. package/templates/docker-compose.litellm.yml +0 -82
  94. package/templates/docs/CLAUDE.md.template +0 -12
  95. package/templates/docs/CLI.md +0 -59
  96. package/templates/docs/CLUSTERS.md +0 -151
  97. package/templates/docs/CONFIGURATION.md +0 -181
  98. package/templates/docs/CRONS_AND_TRIGGERS.md +0 -132
  99. package/templates/docs/GETTING_STARTED.md +0 -64
  100. package/templates/docs/SECURITY.md +0 -61
  101. package/templates/docs/SKILLS.md +0 -113
  102. package/templates/docs/UPGRADING.md +0 -92
  103. package/templates/skills/LICENSE +0 -21
  104. package/templates/skills/README.md +0 -117
  105. package/templates/skills/agent-job-secrets/SKILL.md +0 -25
  106. package/templates/skills/agent-job-secrets/agent-job-secrets.js +0 -66
  107. package/templates/traefik-dynamic.yml.example +0 -7
  108. package/templates/triggers/CLAUDE.md.template +0 -41
  109. /package/templates/{config → agent-job}/HEARTBEAT.md +0 -0
  110. /package/templates/{cron → data}/.gitkeep +0 -0
  111. /package/templates/{logs → data/clusters}/.gitkeep +0 -0
  112. /package/templates/{triggers → data/db}/.gitkeep +0 -0
  113. /package/templates/{config/agent-job → event-handler}/SUMMARY.md +0 -0
  114. /package/templates/{config → event-handler}/TRIGGERS.json +0 -0
  115. /package/templates/{config → event-handler}/agent-chat/SYSTEM.md +0 -0
  116. /package/templates/{config/cluster → event-handler/clusters}/ROLE.md +0 -0
  117. /package/templates/{config/cluster → event-handler/clusters}/SYSTEM.md +0 -0
  118. /package/templates/{config → event-handler}/code-chat/SYSTEM.md +0 -0
  119. /package/templates/{config → event-handler}/litellm/main.yaml +0 -0
  120. /package/templates/skills/{playwright-cli → library/playwright-cli}/SKILL.md +0 -0
@@ -1,56 +0,0 @@
1
- [
2
- {
3
- "name": "heartbeat",
4
- "schedule": "*/30 * * * *",
5
- "type": "agent",
6
- "job": "Read the file at config/HEARTBEAT.md and complete the tasks described there.",
7
- "enabled": false
8
- },
9
- {
10
- "name": "daily-check",
11
- "schedule": "0 9 * * *",
12
- "type": "agent",
13
- "job": "Check for dependency updates in package.json and report any outdated packages.",
14
- "enabled": false
15
- },
16
- {
17
- "name": "ping",
18
- "schedule": "*/1 * * * *",
19
- "type": "command",
20
- "command": "echo \"pong!\"",
21
- "enabled": true
22
- },
23
- {
24
- "name": "cleanup-logs",
25
- "schedule": "0 0 * * 0",
26
- "type": "command",
27
- "command": "ls -la logs/",
28
- "enabled": false
29
- },
30
- {
31
- "name": "ping-status",
32
- "schedule": "*/5 * * * *",
33
- "type": "webhook",
34
- "url": "https://example.com/status",
35
- "method": "POST",
36
- "vars": { "source": "heartbeat" },
37
- "enabled": false
38
- },
39
- {
40
- "name": "health-check",
41
- "schedule": "*/10 * * * *",
42
- "type": "webhook",
43
- "url": "https://example.com/health",
44
- "method": "GET",
45
- "enabled": false
46
- },
47
- {
48
- "name": "daily-check-openai",
49
- "schedule": "0 9 * * *",
50
- "type": "agent",
51
- "job": "Check for dependency updates in package.json and report any outdated packages.",
52
- "llm_provider": "openai",
53
- "llm_model": "gpt-4o",
54
- "enabled": false
55
- }
56
- ]
@@ -1,30 +0,0 @@
1
- # thepopebot Agent Environment
2
-
3
- **This document describes what you are and your operating environment**
4
-
5
- ---
6
-
7
- ## 1. What You Are
8
-
9
- You are **thepopebot**, an autonomous AI agent running inside a Docker container.
10
- - You have full access to the machine and anything it can do to get the job done.
11
-
12
- ---
13
-
14
- ## 2. Local Docker Environment Reference
15
-
16
- ### WORKDIR — `/job` is a git repo
17
-
18
- Your working directory is `/job`. **This is a live git repository.** When your job finishes, everything inside `/job` is automatically committed and pushed via `git add -A`. You do not control this — it happens after you exit.
19
-
20
- This means: **any file you create, copy, move, or download into `/job` or any subdirectory of `/job` WILL be committed to the repository.** There are no exceptions.
21
-
22
- ### All working files go in `/tmp`
23
-
24
- **NEVER save, copy, move, or download files into `/job`** unless the job specifically requires changing the repository (e.g. editing source code, updating config files).
25
-
26
- Use `/tmp` for everything else — downloads, generated files, images, videos, scripts, intermediate data, API responses, anything you create to get the job done. `/tmp` is outside the repo and nothing there gets committed.
27
-
28
- If a skill or tool downloads a file to `/tmp`, **leave it there**. Do not copy or move it into `/job`. If you need to pass that file to another tool (e.g. uploading it somewhere), reference it directly from `/tmp`.
29
-
30
- Current datetime: {{datetime}}
@@ -1,24 +0,0 @@
1
- # cron/ — Cron Action Scripts
2
-
3
- This directory holds scripts referenced by `command`-type entries in `config/CRONS.json`.
4
-
5
- When a `command`-type cron fires, the working directory is `cron/`.
6
-
7
- ## Example
8
-
9
- In `config/CRONS.json`:
10
- ```json
11
- {
12
- "name": "Daily Cleanup",
13
- "schedule": "0 3 * * *",
14
- "type": "command",
15
- "command": "node cleanup.js --older-than 7d",
16
- "enabled": true
17
- }
18
- ```
19
-
20
- This runs `cron/cleanup.js` daily at 3am.
21
-
22
- ## Action Types
23
-
24
- Most cron entries use `type: "agent"` (the default) which spins up a Docker agent — those don't need scripts here. Only `command`-type entries reference scripts in this directory. See `config/CRONS.json` for the full cron configuration and the root `CLAUDE.md` for all action type details.
@@ -1,82 +0,0 @@
1
- # Docker Compose configuration with LiteLLM proxy
2
- # To activate: set COMPOSE_FILE=docker-compose.litellm.yml in .env
3
-
4
- services:
5
- traefik:
6
- image: traefik:v3
7
- command:
8
- - --providers.docker=true
9
- - --providers.docker.exposedByDefault=false
10
- - --entrypoints.web.address=:80
11
- - --entrypoints.websecure.address=:443
12
- ## Uncomment the following lines to enable TLS via Let's Encrypt
13
- ## (requires LETSENCRYPT_EMAIL in .env):
14
- # - --entrypoints.web.http.redirections.entrypoint.to=websecure
15
- # - --entrypoints.web.http.redirections.entrypoint.scheme=https
16
- # - --certificatesresolvers.letsencrypt.acme.email=${LETSENCRYPT_EMAIL}
17
- # - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
18
- # - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
19
- ports:
20
- - "80:80"
21
- - "443:443"
22
- volumes:
23
- - /var/run/docker.sock:/var/run/docker.sock:ro
24
- - traefik_certs:/letsencrypt
25
- restart: unless-stopped
26
-
27
- event-handler:
28
- container_name: thepopebot-event-handler
29
- image: ${EVENT_HANDLER_IMAGE_URL:-stephengpope/thepopebot:event-handler-${THEPOPEBOT_VERSION:-latest}}
30
- volumes:
31
- - .:/project
32
- - ./config:/app/config
33
- - ./skills:/app/skills
34
- - ./.env:/app/.env
35
- - ./data:/app/data
36
- - ./logs:/app/logs
37
- - ./cron:/app/cron
38
- - ./triggers:/app/triggers
39
- - ./CLAUDE.md:/app/CLAUDE.md
40
- - /var/run/docker.sock:/var/run/docker.sock
41
- labels:
42
- - traefik.enable=true
43
- # Set APP_HOSTNAME in .env to the domain from APP_URL (e.g., mybot.example.com)
44
- - traefik.http.routers.event-handler.rule=Host(`${APP_HOSTNAME}`)
45
- - traefik.http.routers.event-handler.entrypoints=web
46
- - traefik.http.services.event-handler.loadbalancer.server.port=80
47
- ## Uncomment the following lines to enable TLS via Let's Encrypt:
48
- # - traefik.http.routers.event-handler.entrypoints=websecure
49
- # - traefik.http.routers.event-handler.tls.certresolver=letsencrypt
50
- stop_grace_period: 120s
51
- healthcheck:
52
- test: ["CMD", "curl", "-f", "http://localhost:80/api/ping"]
53
- interval: 10s
54
- timeout: 3s
55
- retries: 3
56
- start_period: 30s
57
- restart: unless-stopped
58
-
59
- runner:
60
- image: myoung34/github-runner:latest
61
- deploy:
62
- replicas: ${RUNNER_REPLICAS:-1}
63
- environment:
64
- REPO_URL: https://github.com/${GH_OWNER}/${GH_REPO}
65
- ACCESS_TOKEN: ${GH_TOKEN}
66
- RUNNER_SCOPE: repo
67
- LABELS: self-hosted
68
- EPHEMERAL: "1"
69
- volumes:
70
- - /var/run/docker.sock:/var/run/docker.sock
71
- - .:/project
72
- restart: unless-stopped
73
-
74
- litellm:
75
- image: ghcr.io/berriai/litellm:main-latest
76
- command: --config /litellm/main.yaml --port 4000
77
- volumes:
78
- - ./config/litellm:/litellm:ro
79
- restart: unless-stopped
80
-
81
- volumes:
82
- traefik_certs:
@@ -1,12 +0,0 @@
1
- # docs/ — User Documentation
2
-
3
- | Document | Description |
4
- |----------|-------------|
5
- | `GETTING_STARTED.md` | Initial setup and first-run walkthrough |
6
- | `CONFIGURATION.md` | Config file reference and customization guide |
7
- | `CRONS_AND_TRIGGERS.md` | Scheduling jobs and setting up webhook triggers |
8
- | `SKILLS.md` | Building, activating, and managing agent skills |
9
- | `CLUSTERS.md` | Multi-role agent teams and cluster workspaces |
10
- | `CLI.md` | Command-line interface reference |
11
- | `SECURITY.md` | Authentication, API keys, and secret management |
12
- | `UPGRADING.md` | How to upgrade thepopebot to a new version |
@@ -1,59 +0,0 @@
1
- # CLI Reference
2
-
3
- All commands are run via `npx thepopebot <command>`.
4
-
5
- ## Project Setup
6
-
7
- | Command | Description |
8
- |---------|-------------|
9
- | `init` | Scaffold a new project, or update templates in an existing one |
10
- | `setup` | Run the full interactive setup wizard (`npm run setup`) |
11
- | `setup-telegram` | Reconfigure the Telegram webhook (`npm run setup-telegram`) |
12
- | `reset-auth` | Regenerate AUTH_SECRET, invalidating all sessions |
13
-
14
- ## Templates
15
-
16
- | Command | Description |
17
- |---------|-------------|
18
- | `diff [file]` | List files that differ from package templates, or diff a specific file |
19
- | `reset [file]` | List all template files, or restore a specific one to package default |
20
- | `upgrade` / `update` | Upgrade thepopebot (install, init, build, commit, push, restart Docker) |
21
- | `sync <path>` | Sync local package to a test install (dev workflow) |
22
- | `user:password <email>` | Change a user's password |
23
-
24
- ## Secrets and Variables
25
-
26
- These set GitHub repository secrets/variables using the `gh` CLI. They read `GH_OWNER` and `GH_REPO` from your `.env`. If VALUE is omitted, you'll be prompted with masked input.
27
-
28
- | Command | Description |
29
- |---------|-------------|
30
- | `set-var KEY [VALUE]` | Set a GitHub repository variable |
31
-
32
- Agent job secrets are now managed through the admin UI (Settings > Agent Jobs > Secrets), stored encrypted in SQLite, and injected directly into Docker containers.
33
-
34
- ## Common Workflows
35
-
36
- ### Initial setup
37
- ```bash
38
- npx thepopebot init
39
- npm run setup
40
- ```
41
-
42
- ### Upgrade to latest version
43
- ```bash
44
- npx thepopebot upgrade
45
- ```
46
-
47
- ### Check what changed in templates
48
- ```bash
49
- npx thepopebot diff # list all differing files
50
- npx thepopebot diff config/CRONS.json # see specific changes
51
- npx thepopebot reset config/CRONS.json # accept new template
52
- ```
53
-
54
- ### Set up a new LLM provider for jobs
55
- ```bash
56
- npx thepopebot set-var LLM_PROVIDER openai
57
- npx thepopebot set-var LLM_MODEL gpt-4o
58
- # Set API keys via admin UI: Settings > Agent Jobs > Secrets
59
- ```
@@ -1,151 +0,0 @@
1
- # Cluster Workspaces
2
-
3
- Clusters are multi-role agent teams. Define a set of roles, each with its own prompt and trigger configuration, and the system launches ephemeral Docker containers to execute them. Roles within a cluster share a workspace directory for collaboration.
4
-
5
- ---
6
-
7
- ## Creating a Cluster
8
-
9
- Create clusters from the web UI at `/clusters`. Each cluster has:
10
-
11
- - **Name** — Display label
12
- - **System Prompt** — Shared context for all roles. Defaults to `config/cluster/SYSTEM.md`
13
- - **Shared Folders** — Named subdirectories under `shared/` that all roles can access (e.g., `docs`, `output`)
14
- - **Enabled/Disabled** — Toggle the cluster. Disabling stops all running containers
15
-
16
- ---
17
-
18
- ## Defining Roles
19
-
20
- Each role represents one agent type within a cluster:
21
-
22
- | Field | Description |
23
- |-------|-------------|
24
- | **Role Name** | Display name (e.g., "Researcher", "Writer") |
25
- | **Role Instructions** | Markdown prompt for the role. Defaults to `config/cluster/ROLE.md` |
26
- | **Prompt** | Task prompt passed to the agent (default: "Execute your role.") |
27
- | **Max Concurrency** | Max simultaneous containers for this role (default: 1) |
28
- | **Trigger Config** | How this role gets activated (see below) |
29
- | **Folders** | Role-specific subdirectories |
30
- | **Cleanup Worker Dir** | Delete the ephemeral worker directory after container exits |
31
-
32
- ### Template Variables
33
-
34
- System and role prompts support `{{PLACEHOLDER}}` variables resolved at launch:
35
-
36
- | Variable | Value |
37
- |----------|-------|
38
- | `{{CLUSTER_HOME}}` | Container workspace root |
39
- | `{{CLUSTER_SHARED_DIR}}` | Path to cluster shared directory |
40
- | `{{CLUSTER_SHARED_FOLDERS}}` | JSON array of shared folder paths |
41
- | `{{SELF_ROLE_NAME}}` | This role's name |
42
- | `{{SELF_WORKER_ID}}` | Unique ID for this worker instance |
43
- | `{{SELF_WORK_DIR}}` | This worker's ephemeral working directory |
44
- | `{{SELF_TMP_DIR}}` | This worker's temp directory |
45
- | `{{WORKSPACE}}` | JSON manifest of the full workspace layout |
46
- | `{{DATETIME}}` | ISO timestamp at launch time |
47
- | `{{WEBHOOK_PAYLOAD}}` | JSON payload from a webhook trigger |
48
-
49
- ---
50
-
51
- ## Trigger Types
52
-
53
- Each role can have multiple triggers. All triggers respect the role's concurrency limit.
54
-
55
- ### Manual
56
-
57
- Always available. Click the run button in the UI.
58
-
59
- ### Webhook
60
-
61
- Send a POST request to trigger execution:
62
-
63
- ```
64
- POST /api/cluster/{clusterId}/role/{roleId}/webhook
65
- Header: x-api-key: YOUR_API_KEY
66
- Body: { "key": "value" }
67
- ```
68
-
69
- The request body is available as `{{WEBHOOK_PAYLOAD}}`. Include a `prompt` field in the body to override the role's default prompt.
70
-
71
- ### Cron
72
-
73
- Schedule recurring runs with a cron expression:
74
-
75
- ```json
76
- {
77
- "cron": {
78
- "enabled": true,
79
- "schedule": "0 */6 * * *"
80
- }
81
- }
82
- ```
83
-
84
- ### File Watch
85
-
86
- Trigger when files change in the cluster's data directory:
87
-
88
- ```json
89
- {
90
- "file_watch": {
91
- "enabled": true,
92
- "paths": "shared/input,shared/data"
93
- }
94
- }
95
- ```
96
-
97
- Paths are comma-separated, relative to the cluster data directory. Changes are debounced (5-second window). The `logs/` directory is always excluded.
98
-
99
- ---
100
-
101
- ## Directory Structure
102
-
103
- Each cluster gets a data directory on disk:
104
-
105
- ```
106
- data/clusters/
107
- cluster-{shortId}/
108
- shared/ # Cluster-wide shared directory
109
- docs/ # Shared folder
110
- output/ # Shared folder
111
- role-{roleShortId}/
112
- shared/ # Role-specific shared directory
113
- worker-{uuid}/ # Ephemeral per-container directory
114
- tmp/ # Worker temp directory
115
- logs/
116
- role-{roleShortId}/
117
- 2025-01-15_14-30-00_{uuid}/
118
- system-prompt.md # Resolved system prompt
119
- user-prompt.md # Resolved user prompt
120
- meta.json # Run metadata
121
- trigger.json # Trigger info and payload
122
- stdout.jsonl # Container stdout
123
- stderr.txt # Container stderr
124
- ```
125
-
126
- ---
127
-
128
- ## Concurrency
129
-
130
- Each role has a `maxConcurrency` setting (default: 1). Before any trigger launches a container, the system checks the running container count. If at or above the limit, the trigger is rejected.
131
-
132
- Set higher concurrency for roles that handle parallel workloads (e.g., webhook-triggered processing). Keep at 1 for sequential roles.
133
-
134
- ---
135
-
136
- ## Console and Logs
137
-
138
- The cluster console page at `/clusters` provides:
139
-
140
- - **Container status** per role — running, idle, or stopped
141
- - **Resource usage** — CPU, memory, and network stats
142
- - **Live logs** — streaming stdout and stderr
143
- - **Prompts** — view resolved system and user prompts for any worker
144
-
145
- Historical logs are available grouped by role, including stdout, stderr, prompts, and trigger info.
146
-
147
- ---
148
-
149
- ## Customizing Prompts
150
-
151
- Edit `config/cluster/SYSTEM.md` and `config/cluster/ROLE.md` to set defaults for new clusters and roles. Existing clusters keep their current prompts — these templates only affect newly created clusters and roles.
@@ -1,181 +0,0 @@
1
- # Configuration
2
-
3
- ## Config Files
4
-
5
- The `config/` directory defines your agent's personality and behavior:
6
-
7
- | File | Purpose |
8
- |------|---------|
9
- | `agent-chat/SYSTEM.md` | Agent chat system prompt |
10
- | `code-chat/SYSTEM.md` | Code workspace planning system prompt |
11
- | `agent-job/SOUL.md` | Agent identity, personality traits, and values |
12
- | `agent-job/AGENT_JOB.md` | Agent runtime environment docs |
13
- | `agent-job/SUMMARY.md` | Prompt for summarizing completed jobs |
14
- | `cluster/SYSTEM.md` | System prompt for cluster worker agents |
15
- | `cluster/ROLE.md` | Per-role prompt template for cluster workers |
16
- | `HEARTBEAT.md` | Self-monitoring behavior |
17
- | `CRONS.json` | Scheduled job definitions |
18
- | `TRIGGERS.json` | Webhook trigger definitions |
19
-
20
- ### Markdown Includes and Variables
21
-
22
- Config markdown files support includes and built-in variables (processed by the package's `render-md.js`):
23
-
24
- | Syntax | Description |
25
- |--------|-------------|
26
- | `{{ filepath.md }}` | Include another file (relative to project root, recursive with circular detection) |
27
- | `{{datetime}}` | Current ISO timestamp |
28
- | `{{skills}}` | Dynamic bullet list of active skill descriptions from `skills/active/*/SKILL.md` frontmatter |
29
-
30
- ---
31
-
32
- ## Environment Variables
33
-
34
- Set in `.env` in your project root. These configure the **Event Handler** (web chat, Telegram, webhooks, job summaries).
35
-
36
- | Variable | Description | Required |
37
- |----------|-------------|----------|
38
- | `APP_URL` | Public URL for webhooks and Telegram | Yes |
39
- | `AUTH_SECRET` | NextAuth session encryption (auto-generated) | Yes |
40
- | `GH_TOKEN` | GitHub PAT for creating branches/files | Yes |
41
- | `GH_OWNER` | GitHub repository owner | Yes |
42
- | `GH_REPO` | GitHub repository name | Yes |
43
- | `TELEGRAM_BOT_TOKEN` | Telegram bot token | For Telegram |
44
- | `TELEGRAM_WEBHOOK_SECRET` | Telegram webhook validation secret | No |
45
- | `TELEGRAM_CHAT_ID` | Default chat ID for notifications | For Telegram |
46
- | `GH_WEBHOOK_SECRET` | GitHub Actions webhook auth | For notifications |
47
- | `LLM_PROVIDER` | `anthropic`, `openai`, `google`, or `custom` | No (default: `anthropic`) |
48
- | `LLM_MODEL` | Model name override | No |
49
- | `LLM_MAX_TOKENS` | Max tokens for LLM responses | No (default: 4096) |
50
- | `ANTHROPIC_API_KEY` | Anthropic API key | For anthropic provider |
51
- | `OPENAI_API_KEY` | OpenAI API key / Whisper | For openai provider |
52
- | `CUSTOM_OPENAI_BASE_URL` | Custom OpenAI-compatible base URL | For custom provider |
53
- | `GOOGLE_API_KEY` | Google API key | For google provider |
54
- | `CUSTOM_API_KEY` | Custom provider API key | For custom provider |
55
- | `AGENT_BACKEND` | Agent runner: `pi` or `claude-code` | No (default: `claude-code`) |
56
- | `ASSEMBLYAI_API_KEY` | API key for voice transcription | For voice input |
57
- | `DATABASE_PATH` | Override SQLite DB location | No |
58
- | `COMPOSE_FILE` | Override docker-compose file | No |
59
-
60
- ---
61
-
62
- ## LLM Providers
63
-
64
- thepopebot has **two independent LLM configurations**:
65
-
66
- - **Event Handler** (chat, Telegram, webhooks, summaries) — configured via `.env`
67
- - **Jobs** (Docker agent on GitHub Actions) — configured via GitHub repo variables
68
-
69
- You can run different models for each. For example, Claude for interactive chat and a local Ollama model for jobs.
70
-
71
- | Provider | Example model | API key env var |
72
- |----------|---------------|-----------------|
73
- | `anthropic` (default) | `claude-sonnet-4-20250514` | `ANTHROPIC_API_KEY` |
74
- | `openai` | `gpt-4o` | `OPENAI_API_KEY` |
75
- | `google` | `gemini-2.5-pro` | `GOOGLE_API_KEY` |
76
- | `custom` | Any OpenAI-compatible API | `CUSTOM_API_KEY` + `CUSTOM_OPENAI_BASE_URL` |
77
-
78
- ### Setting the Event Handler Model
79
-
80
- ```bash
81
- # In .env
82
- LLM_PROVIDER=anthropic
83
- LLM_MODEL=claude-sonnet-4-20250514
84
- ANTHROPIC_API_KEY=sk-ant-...
85
- ```
86
-
87
- Restart your server after changes.
88
-
89
- ### Setting the Default Job Model
90
-
91
- ```bash
92
- npx thepopebot set-var LLM_PROVIDER openai
93
- npx thepopebot set-var LLM_MODEL gpt-4o
94
- # Set API keys via admin UI: Settings > Agent Jobs > Secrets
95
- ```
96
-
97
- ### Per-Job Overrides
98
-
99
- Add `llm_provider` and `llm_model` to any agent-type entry in `CRONS.json` or `TRIGGERS.json`:
100
-
101
- ```json
102
- {
103
- "name": "Code review",
104
- "schedule": "0 9 * * 1",
105
- "type": "agent",
106
- "job": "Review open PRs",
107
- "llm_provider": "openai",
108
- "llm_model": "gpt-4o"
109
- }
110
- ```
111
-
112
- ### Using the `custom` Provider
113
-
114
- Point at any OpenAI-compatible endpoint (DeepSeek, Ollama, Together AI, etc.):
115
-
116
- ```bash
117
- # Cloud custom (DeepSeek, Together AI, etc.)
118
- npx thepopebot set-var LLM_PROVIDER custom
119
- npx thepopebot set-var LLM_MODEL deepseek-chat
120
- npx thepopebot set-var CUSTOM_OPENAI_BASE_URL https://api.deepseek.com/v1
121
- # Set CUSTOM_API_KEY via admin UI: Settings > Agent Jobs > Secrets
122
-
123
- # Local custom (Ollama, LM Studio, etc.) — needs self-hosted runner
124
- npx thepopebot set-var RUNS_ON self-hosted
125
- npx thepopebot set-var LLM_PROVIDER custom
126
- npx thepopebot set-var LLM_MODEL qwen3:8b
127
- npx thepopebot set-var CUSTOM_OPENAI_BASE_URL http://host.docker.internal:11434/v1
128
- ```
129
-
130
- ---
131
-
132
- ## Agent Job Secrets
133
-
134
- Agent job secrets are managed through the admin UI (Settings > Agent Jobs > Secrets). They are stored encrypted in SQLite and injected as env vars into Docker containers. The agent can discover available secrets via the `get-secret` skill.
135
-
136
- ---
137
-
138
- ## GitHub Repository Variables
139
-
140
- | Variable | Description | Default |
141
- |----------|-------------|---------|
142
- | `APP_URL` | Public URL for the event handler | Required |
143
- | `AUTO_MERGE` | Set to `"false"` to disable auto-merge | Enabled |
144
- | `ALLOWED_PATHS` | Comma-separated path prefixes for auto-merge | `/logs` |
145
- | `JOB_IMAGE_URL` | Docker image for job agent | Default thepopebot image |
146
- | `EVENT_HANDLER_IMAGE_URL` | Docker image for event handler | Default thepopebot image |
147
- | `RUNS_ON` | GitHub Actions runner label | `ubuntu-latest` |
148
- | `LLM_PROVIDER` | LLM provider for Docker agent | `anthropic` |
149
- | `LLM_MODEL` | LLM model name for Docker agent | Provider default |
150
- | `AGENT_BACKEND` | Agent runner: `pi` or `claude-code` | `claude-code` |
151
-
152
- ---
153
-
154
- ## GitHub PAT Permissions
155
-
156
- Create a fine-grained PAT scoped to your repository:
157
-
158
- | Permission | Access | Why |
159
- |------------|--------|-----|
160
- | Actions | Read and write | Trigger and monitor workflows |
161
- | Administration | Read and write | Required for self-hosted runners |
162
- | Contents | Read and write | Create branches, commit files |
163
- | Metadata | Read-only | Required (auto-selected) |
164
- | Pull requests | Read and write | Create and manage PRs |
165
- | Secrets | Read and write | Manage agent secrets from web UI |
166
- | Workflows | Read and write | Create and update workflow files |
167
-
168
- ---
169
-
170
- ## Docker Compose
171
-
172
- For self-hosted deployment:
173
-
174
- ```bash
175
- npm run build
176
- docker compose up -d
177
- ```
178
-
179
- This starts Traefik (reverse proxy with SSL), the Event Handler (Node.js + PM2), and a self-hosted GitHub Actions runner.
180
-
181
- To customize Docker Compose without losing changes on upgrade, set `COMPOSE_FILE=docker-compose.custom.yml` in `.env`. The custom file is scaffolded by init but never overwritten.