Metadata-Version: 2.3
Name: takopi-cron
Version: 0.1.0
Summary: Cron command plugin for Takopi.
Keywords: takopi,cron,scheduler,plugin
Author: takopi contributors
License: MIT License
         
         Copyright (c) 2026
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
         
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Requires-Dist: takopi>=0.22,<0.23
Requires-Python: >=3.14
Project-URL: Homepage, https://takopi.dev
Description-Content-Type: text/markdown

# takopi-cron

cron command plugin for takopi. run a prompt on an interval and post results back into your chat.

This is intentionally simple:

- It runs **in-process** inside Takopi (so Takopi must be running).
- It does **not** survive restarts (you re-run `/cron start` after restart).

## requirements

`uv` for installation (`curl -LsSf https://astral.sh/uv/install.sh | sh`)

python 3.14+ (`uv python install 3.14`)

takopi installed

## install

recommended (installs the plugin into takopi's `uv tool` environment):

```sh
uv tool install -U takopi --with takopi-cron
```

if you installed takopi via `pip` (or you're running takopi from a project venv), install the plugin into the same environment:

```sh
pip install -U takopi-cron
```

enable it:

```toml
[plugins]
enabled = ["takopi-cron"]
```

## usage

Start a job (runs once immediately, then repeats):

```text
/cron start 6 Write a summary of today's PRs and what I should review next.
```

Stop the job for the current chat/thread:

```text
/cron stop
```

Status:

```text
/cron status
```

List all running cron jobs:

```text
/cron list
```

Run once (no scheduling):

```text
/cron run What changed since yesterday?
```

Seed presets (configured in `takopi.toml`):

```text
/cron seed list
/cron seed start daily_summary
/cron start seed
```

Seed presets start in the chat/thread where you run the command. `/cron start seed`
starts every seed preset at once in that chat/thread.

If you start multiple seed jobs in one chat/thread, `/cron stop` stops all of them
for that chat/thread.

Tips:

- Put an engine directive at the start of the prompt, e.g. `/claude ...`
- Put a project directive at the start of the prompt, e.g. `/myproj ...`
- Put a branch directive at the start of the prompt, e.g. `@feat/foo ...`

## breaking changes

Breaking changes in `0.1.0`:

- `plugins.cron.seed[].prompt` was removed
- `plugins.cron.seed[].prompt_file` is now required
- `prompt_file` is resolved relative to the directory containing `takopi.toml`
- `/cron stop` now stops all cron jobs running in the current chat/thread, not just one
- `/cron start seed` now starts every configured seed preset in the current chat/thread

Migration example:

Before:

```toml
[[plugins.cron.seed]]
id = "daily_summary"
every_hours = 6
prompt = "/codex summarize what changed since the last cron tick"
```

After:

```toml
[[plugins.cron.seed]]
id = "daily_summary"
every_hours = 6
prompt_file = "cron-prompts/daily_summary.prompt.md"
```

## config

In `~/.takopi/takopi.toml`:

```toml
[plugins.cron]
# Optional: restrict who can control cron jobs
allowed_user_ids = [12345678]

# Optional: whether cron ticks should notify (default: true)
notify = true

# Optional: seed presets. prompts live in separate files so takopi.toml stays
# smaller, but the schedule metadata stays here.
[[plugins.cron.seed]]
id = "daily_summary"
every_hours = 6
prompt_file = "cron-prompts/daily_summary.prompt.md"
# notify = true            # optional override
# enabled = false          # optional
```

`prompt_file` is resolved relative to the directory containing `takopi.toml`, so
this layout works:

```text
~/.takopi/
  takopi.toml
  cron-prompts/
    daily_summary.prompt.md
```

`~/.takopi/cron-prompts/daily_summary.prompt.md`

```text
/codex summarize what changed since the last cron tick
```
