Skip to content

Commit 6efd720

Browse files
committed
Add Codex workspace cron skill
1 parent aed3224 commit 6efd720

5 files changed

Lines changed: 557 additions & 0 deletions

File tree

docker/codex-workspace/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ ENV LANG=en_US.UTF-8 \
103103
PATH=/home/boxp/.local/bin:/home/boxp/go/bin:/usr/local/bin:/usr/bin:/bin
104104

105105
COPY entrypoint.sh /usr/local/bin/codex-workspace-entrypoint
106+
COPY skills/ /opt/codex-workspace/skills/
106107
RUN chmod 0755 /usr/local/bin/codex-workspace-entrypoint
107108

108109
EXPOSE 2222 3456

docker/codex-workspace/entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ set -euo pipefail
44
install -d -m 0755 /run/sshd
55
install -d -o boxp -g boxp -m 0755 /home/boxp
66
install -d -o boxp -g boxp -m 0700 /home/boxp/.ssh
7+
install -d -o boxp -g boxp -m 0755 /home/boxp/.codex/skills
78
install -d -o boxp -g boxp -m 0755 /home/boxp/ghq
89

10+
if [[ -d /opt/codex-workspace/skills ]]; then
11+
cp -a /opt/codex-workspace/skills/. /home/boxp/.codex/skills/
12+
chown -R boxp:boxp /home/boxp/.codex/skills
13+
fi
14+
915
if [[ -f /tmp/authorized_keys/authorized_keys ]]; then
1016
install -o boxp -g boxp -m 0600 /tmp/authorized_keys/authorized_keys /home/boxp/.ssh/authorized_keys
1117
fi
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
name: codex-workspace-cron
3+
description: Manage Codex workspace scheduled prompt jobs in boxp/lolice. Use when the user asks to list, show, add, edit, enable, disable, delete, or manually run Codex cron jobs backed by argoproj/codex-workspace jobs.yaml and Kubernetes CronJobs.
4+
---
5+
6+
# Codex Workspace Cron
7+
8+
Use this skill to operate the Codex workspace prompt scheduler from inside the Codex workspace.
9+
10+
The scheduler is GitOps-managed in `boxp/lolice`:
11+
12+
- `argoproj/codex-workspace/cron-configmap.yaml`
13+
- embedded `jobs.yaml` registry
14+
- `prompt-*.md` prompt bodies
15+
- runner scripts
16+
- `argoproj/codex-workspace/cronjob.yaml`
17+
- one Kubernetes CronJob per registered job
18+
19+
## Workflow
20+
21+
1. Work in a `boxp/lolice` worktree, preferably using the `worktree` skill.
22+
2. Use the bundled script for manifest CRUD:
23+
24+
```bash
25+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice list
26+
```
27+
28+
3. After changes, run:
29+
30+
```bash
31+
kustomize build argoproj/codex-workspace
32+
git diff --check
33+
```
34+
35+
4. Commit and update the `boxp/lolice` PR.
36+
37+
## Commands
38+
39+
List jobs:
40+
41+
```bash
42+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice list
43+
```
44+
45+
Show one job:
46+
47+
```bash
48+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice show <job-id>
49+
```
50+
51+
Add a job:
52+
53+
```bash
54+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice add \
55+
--id daily-report \
56+
--name "Daily report" \
57+
--schedule "0 22 * * *" \
58+
--prompt-file prompt-daily-report.md \
59+
--prompt "調査して日本語で報告してください。" \
60+
--enabled false
61+
```
62+
63+
Update metadata or prompt:
64+
65+
```bash
66+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice update daily-report \
67+
--schedule "30 22 * * *" \
68+
--prompt "新しいプロンプト"
69+
```
70+
71+
Enable or disable:
72+
73+
```bash
74+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice enable daily-report
75+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice disable daily-report
76+
```
77+
78+
Delete:
79+
80+
```bash
81+
python3 <this-skill>/scripts/codex_cron_jobs.py --repo /path/to/lolice delete daily-report
82+
```
83+
84+
## Safety
85+
86+
- New jobs should default to disabled unless the user explicitly asks to enable them.
87+
- Keep `jobs.yaml enabled` and CronJob `spec.suspend` consistent.
88+
- Do not run `kubectl` mutations unless the user explicitly asks for live cluster operations.
89+
- For manual live runs, prefer documenting the command from `argoproj/codex-workspace/cron.md`.

0 commit comments

Comments
 (0)