Updated on 2026-08-03 GMT+08:00

Scheduled Tasks

You can create and manage scheduled tasks using natural language, including periodic tasks (such as daily code checks) and one-time tasks (such as tomorrow's submission reminders), achieving flexible task scheduling and control.

Scheduled Task Commands

Table 1 Scheduled task commands

Development Environment

Command

Function

TUI

/schedule

Natural language prompt

In the TUI development environment, you can create a scheduled task by entering the /schedule command or using a natural language description.

CLI

codearts run --command schedule "Prompt"

codearts run "Prompt"

In the CLI development environment, you can create a scheduled task by entering the /schedule command or using a natural language description.

A scheduled task created using a command will be executed immediately, while a scheduled task created using a natural language description will not.

Scheduled Task Configuration Files

Running scheduled tasks in the CodeArts Agent CLI depends on the following files. The data is automatically generated by the system.

Table 2 Files on which scheduled tasks depend

File Type

File Path

Description

Task data file (configuration file)

~/.codeartsdoer/cli-data/cron/scheduled_tasks.json

Stores the definitions of all scheduled tasks, such as the interval, prompt, and status. For the specific fields in the data file, see Table 3.

Execution log file (execution record)

~/.codeartsdoer/cli-data/cron/cron_log/task_{TASK_ID}.json

Records the execution result of each task, including the status, duration, and result summary.

Table 3 Data file fields

Field

Value Range/Format

Description

Example

id

A random ID consisting of 8 characters (automatically generated by the system)

Unique task ID

10e366d0

cron

A 5-segment Cron expression: minute hour day month weekday

Supported formats: *, */N, N, N-M, and N,M,O

Value range: minute (0–59), hour (0–23), day (1–31), month (1–12), and weekday (0–6, where 0 indicates Sunday)

Execution schedule (local time), which is used to trigger a task at a scheduled time

*/5 * * * * (every 5 minutes) and 0 9 * * * (9:00 every day)

prompt

Any text

AI prompt (instruction content) executed when a task is triggered

Check the remaining storage space of the local drive C.

projectPath

Absolute path

Project path (The system automatically binds the current project context.)

D:\tmp\test_hc_cli

status

  • active: The task is running.
  • paused: The task is paused.
  • expired: The task has expired.
  • deleted: The task has been deleted.

Current task status (It is automatically managed by the system, and its initial value is active.)

active

recurring

  • true: a recurring task, which is repeatedly executed based on the cron interval
  • false: a one-time task, which is executed only once and then automatically ends.

Whether to enable recurring execution

true

durable

  • true: persistent scheduled task. A persistent task is automatically restored and executed upon restart. A persistent task is created only when you explicitly require cross-restart retention, daily execution, or permanent retention.
  • false: session-level scheduled task. By default, a session-level task is executed. After you exit the program, the task will not be retained, and will not be restored upon the next startup. This task type is suitable for scenarios such as temporary reminders and short-term polling.

Whether the task is a persistent task. The default value is false.

false

createdAt

Unix timestamp (ms)

Task creation time, which is automatically generated by the system

1783996637621

humanSchedule

Description

Scheduling description, which is automatically generated by the system based on the cron expression

Every minute, 09:00 every day, every 5 minutes

sessionID

String

Session ID. A session is created for each scheduled task. The session is updated with the task.

ses_0a16ceba1ffeXQHnpNW0jh20J8

agentID

Built-in agent name

Agent used to execute a task. It is automatically obtained by the system.

build, code

modelID

ID of a configured model

ID of the model used to execute a task. It is automatically obtained by the system.

deepseek-v3.2

providerID

Provider ID that has been configured

ID of provider of the model used to execute a task. It is automatically obtained by the system.

huaweicloud-maas

isCustom

  • true: custom agent
  • false: built-in agent

Whether to use a custom agent, which is automatically determined by the system

false

sessionType

kernel or other

Session type, which is automatically obtained by the system

kernel

category

  • code
  • office

Task category, which is automatically obtained by the system

code

Creating a Scheduled Task on the TUI

In the TUI development environment, you can create a scheduled task using a command or natural language. A scheduled task created using a command will be executed immediately, while a scheduled task created using a natural language description will not.

Command syntax:

/schedule [Interval] <Prompt>
Table 4 Parameters in the /schedule command

Parameter

Description

Interval

(Optional) Interval at which the scheduled task is executed. If this parameter is not set, the command is executed every 10 minutes by default.

Format: number + unit letter. The unit letter can be s (second), m (minute), h (hour), or d (day).

Prompt

(Mandatory) The command that you want AI to execute

After a scheduled task command is submitted for the first time, AI immediately executes the specified prompt and then sets and runs a scheduled task. Subsequent scheduled tasks will be generated in an independent session. You can run the /sessions command to view all sessions. For example, if you deliver a /schedule 5m check the deployment status command, AI will immediately check the deployment status once and then check the deployment status every five minutes.

Example:

  1. Enter the TUI development environment.

    1. Open the root directory of the target project.
    2. Right-click in the blank area and select Open Windows Terminal here.
    3. Enter /codearts in the terminal and press Enter to enter the TUI development environment.

  2. Run the /schedule command to create a scheduled task.

    1. In the TUI dialog box, enter / and select /schedule.
    2. Enter the following command and press Enter:
      1m Create a TXT file with an increasing suffix and write the current system date and time into the file.
    3. AI creates a scheduled task and executes it immediately. In addition, the two files listed in Table 5 are generated.
      Figure 1 Creating a session-level scheduled task
      Table 5 Generated files

      File

      Storage Path

      Description

      scheduled_tasks.json

      %USERPROFILE%/.codeartsdoer/cli-data/cron/

      Records the current task information.

      task_{TASK_ID}.json

      %USERPROFILE%/.codeartsdoer/cli-data/cron/cron_log/

      Records the execution records of the current task.

    4. Run the /sessions command to view the session created for the scheduled task.
      Figure 2 Viewing the session created for the scheduled task

In addition to the /schedule command, you can also use a natural language description to create a scheduled task. Scheduled tasks created using natural language will not be executed immediately.

  1. Enter the TUI development environment.

    1. Open the root directory of the target project.
    2. Right-click in the blank area and select Open Windows Terminal here.
    3. Enter /codearts in the terminal and press Enter to enter the TUI development environment.

  2. In the TUI dialog box, enter the operation you want AI to perform and press Enter.

    • Example of creating a recurring task using natural language
      Table 6 Creating a recurring task using natural language

      Prompt

      What AI Will Do

      Check error logs in the production environment every 30 minutes.

      Create a recurring task that runs every 30 minutes.

      Run a unit test at 9:00 a.m. every day.

      Create a recurring task that runs at 9:00 every day.

      Scan for security vulnerabilities every hour.

      Create a recurring task that runs every hour.

    • Example of creating a one-off task using natural language
      Table 7 Creating a one-off task using natural language

      Prompt

      What AI Will Do

      Remind me to review PR#42 at 9:00 a.m. tomorrow.

      Create a one-off task that runs at 9:00 tomorrow and automatically ends after execution.

      Remind me to confirm the database migration result in 3 minutes.

      Create a one-off task that runs once in 3 minutes.

      Remind me to submit a weekly report at 10:00 next Monday.

      Create a one-off task that runs at 10:00 next Monday.

Creating a Scheduled Task on the CLI

In the CLI development environment, you can create a scheduled task using a command or natural language. A scheduled task created using a command will be executed immediately, while a scheduled task created using a natural language description will not.

CLI dialogs are one-off. The scheduled tasks created on the CLI are only written to the scheduled_tasks.json configuration file. Scheduled tasks will be executed only when the TUI or other CodeArts Agent CLI processes are started. Keep CodeArts Agent CLI running to ensure that tasks can be executed stably as scheduled.

Command syntax:

codearts run --command schedule "Prompt"
Table 8 Parameters in the command

Parameter

Description

Prompt

(Mandatory) The operation that you want AI to perform

Example:

  1. In the CLI development environment, enter the command for creating a scheduled task and press Enter.

    For example, to create a scheduled task that reminds you to perform a CLI test every two minutes, you can use the following prompt. If no time is specified in the command, a scheduled task that is executed every 10 minutes by default is created (for example, you can run codearts run --command schedule to list all scheduled tasks).
    codearts run --command schedule "Remind me to perform a CLI test every 2 minutes."

  2. AI will create a scheduled task based on your instruction and run it immediately.

    Figure 3 Creating and running a scheduled task

  1. In the CLI development environment, enter the command for creating a scheduled task and press Enter.

    codearts run "Prompt"

    For example, to create a scheduled task that reminds you to write a weekly CLI report every minute, you can use the following prompt.

    codearts run "Remind me to write a weekly CLI report every minute."

  2. AI will create a scheduled task based on your instruction.

    Figure 4 Creating a scheduled task

Managing Scheduled Tasks

Scheduled tasks cannot be managed using commands. You can manage them only using natural language descriptions.

Table 9 Managing scheduled tasks

Natural Language Prompt

Execution Result

  • TUI: List all scheduled tasks.
  • CLI: codearts run "List all scheduled tasks."

The list of all scheduled tasks is displayed.

  • TUI: View paused scheduled tasks.
  • CLI: codearts run "List all scheduled tasks."

Only paused tasks are displayed.

  • TUI: View details about a task with a specified task ID.
  • CLI: codearts run "View details about a task with a specified task ID."

The task details are displayed, including the execution history and next execution time.

  • TUI: Pause a task with a specified ID.
  • CLI: codearts run "Pause a task with a specified ID."

The task stops, with no configuration lost. After the task is resumed, it continues running at the original interval.

  • TUI: Resume a task with a specified ID.
  • CLI: codearts run "Resume a task with a specified ID."

The paused task is reactivated and continues running as planned.

  • TUI: Delete a task with a specified ID.
  • CLI: codearts run "Resume a task with a specified ID."

The task is permanently deleted and cannot be restored.

  • TUI: Immediately execute a scheduled task with a specified ID.
  • CLI: codearts run "Immediately execute a scheduled task with a specified ID."

The task is immediately executed, without affecting the original schedule. For example, you can immediately execute a scheduled task that is paused.