Goals Plugin
The Goals plugin provides long-lived intents: a goal is a knowledge-base tree on disk plus one or more workers that fire on a cron task, share that knowledge base, and pursue the intent over time. You (or the agent, through tools) set up a goal once; the Task Runtime runs its workers after that.
Ask the agent to create a goal, list yours, pause one, or inspect what a worker last wrote — or use the Goals page in the web UI (/plugins/goals, also reachable from a chat-header chip and a welcome-page widget). You do not talk to a worker directly: input goes through the goal tools, or through a message left in the workers' inboxes from the Goals page.
Configuration
plugins:
- module: codumentor.plugins.goals
class: GoalsPlugin
priority: 10
args:
enabled: true
default_timezone: UTC
# storage_repo: my-repo # optional; see Storage below
| Parameter | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Enable or disable the plugin. |
default_timezone | string | "UTC" | IANA timezone for interpreting worker cron expressions. |
storage_repo | string | unset | Name of a configured repo (a key under repos) where goal trees are stored. When unset, falls back to the Agentic Memory plugin's repo, then to the managed goal store in the instance home (see Storage below). |
storage_path | string | "goals" | Path under the resolved repo root for goal trees. Not used by the managed goal store. |
setup_agent.enabled | bool | false | When true, setup_goal can draft the goal via a goal-role sub-agent and validate it before writing. |
setup_agent.max_iterations | int | 12 | Re-prompt budget for that proposal. |
commit_enabled | bool | true | Commit each goal's knowledge-base subtree into git so state is never only an uncommitted working tree. Set to false for a configured storage repo that is not a git repo — otherwise the plugin warns once that it cannot commit. The managed goal store needs no setting: it is versioned when git is installed and plain files otherwise. |
push_enabled | bool | true | Push after committing, through the push path shared with the Agentic Memory plugin. Ignored when commit_enabled is false, and a no-op for a repo with no remote (such as the managed goal store). |
push_timeout | int | 30 | Push timeout in seconds. |
push_max_consecutive_failures | int | 5 | Consecutive push failures before the circuit breaker opens. |
commit_signature | string | "Made with Codumentor" | Trailer appended to every goal commit. |
flush_after_minutes | int | 30 | Commit a running worker's subtree once its state has gone this long uncommitted, so a long tick does not hold everything until it ends. 0 disables the flush. |
worker_denied_tools | list | unset | Extra tools hidden from every goal worker. By default workers keep the general file and shell tools like any agent. Lifecycle tools and the allowed-subagents gate always apply. |
target_agents | string | "main" | Which agents get the goal tools: "main", "subagent", or "all". Default keeps create/delete/write off subagents. |
Tools
The Goals tools are discovered on demand (they are not in the default tool list), so they do not clutter every turn.
| Tool | Description |
|---|---|
setup_goal | Create a goal: validate, write the knowledge-base tree, and register its workers (cron or event-fired); optional until ends the goal |
list_goals | List the caller's goals with status and worker summaries |
get_goal | Read a goal's definition, state, and live worker tasks |
delete_goal | Cancel all worker tasks (optionally delete the knowledge base) |
pause_goal / resume_goal | Halt or restart every worker's ticks without deleting the goal; resume also reopens a concluded goal |
snooze_goal | Skip a goal's (or one worker's) cron fires until a time (TaskEngine.snooze); event workers are reported as skipped |
goal_run_history | A goal's recent runs, newest first, for every worker or one (read from the run store) |
conclude_goal | Worker-only. Pause every worker of the caller's own goal and record why; offered only to goal workers |
import_goal | Re-register a goal tree copied into the storage root (restore/portability) |
add_worker | Add a worker (cron or event-fired) to an existing goal |
remove_worker | Remove one worker (task and its subtree) |
run_worker_now | Fire one worker immediately as a one-off |
update_worker | Change a worker's trigger (cron, or on/when/scope/mode/debounce_seconds), instructions, role, allowed sub-agents, timeout_seconds, token_budget, model, effort ("" clears either), or access_profile |
goal_kb_read | Read a file from the goal knowledge base by goal-relative path |
goal_kb_write | Write, append to or delete a file in the goal knowledge base by goal-relative path; the text inline (content) or from a workspace file (from_path), optionally only if the file still has the sha256 goal_kb_read returned (if_match) |
goal_kb_append_entry | Append one item to a YAML list in a knowledge-base file (for growing logs that are too large to rewrite whole) |
goal_kb_list | List files/directories under a goal knowledge-base sub-path |
list_event_types | The event types a trigger can fire on, with each type's payload paths (what a when: clause may test and bind: may substitute), what emits it, and how its scope/dedupe keys are formed. Pass type for one type in full detail — kinds, required fields, and which values are untrusted. Read this before writing an on:: the type is a closed vocabulary, and a typo makes a trigger that never fires rather than an error. |
test_trigger | Dry-run a trigger against an event (a ledger event, or an inline one) and get back the stage that decided — the event type, the scope, a named when[i] clause with the value found at its path, a paused task, or the provenance guard. The trigger is a goal worker's live task (task_id = the worker's schedule_id, from get_goal; only your own) or an inline on/scope/when (inline_spec). A malformed clause is reported as invalid, not as "no match". |
Web UI and HTTP API
The plugin ships a web bundle (ui/plugins/goals) and an API mounted at /ui/plugins/goals: a fleet view with a "needs you" queue, per-goal activity, workers, knowledge-base browser and setup tabs, a per-worker history page, a run drawer showing each tick's commit diff, and a new-goal wizard. The API calls the same operations as the tools, with the same ownership rule (a goal you do not own answers 404). It is repository-scoped: a user whose access profile lacks full repository access gets neither the page's data nor the header chip. Alert acknowledgments are per user and kept in the app data dir (goal_alert_acks.sqlite3; override with CODUMENTOR_GOALS_ACK_DB_PATH), never in the goal's knowledge base.
Storage
The location is resolved in order: explicit storage_repo → Agentic Memory's repo → the managed goal store, {data_dir}/goals-store/goals/<goal_id>/ in the instance home. Goal state is written into the opened folder only when you name it as storage_repo, or when Agentic Memory stores there (it has no repo_name and the folder is the single repo) — goals follow memory.
The managed store belongs to Codumentor: it is not one of your repos, and it stays put when you open a different folder. When git is installed, Codumentor makes it a git repo on the first goal write (with its own committer identity, so no global git setup is needed, and no remote); each goal's history is then in git log goals/<goal_id> inside it. Without git the goal files are stored as plain files, and the log says so once at startup. Installing git later is enough: the next start versions the store and commits what is there.
Goals an earlier version kept in the opened folder (<folder>/goals/<goal_id>/) are moved into the managed store at startup, when the store is where goal state now goes. Each moved goal records the folder it worked on (workspace: in its definition.yaml, with write access). A goal id the store already has is left in the folder and named in a warning. Nothing is committed in your folder: if it is a git repo, the moved files show there as deletions. Anything in goals/ that is not a goal is left alone.
Under workspace isolation, every agent reads and writes the goal's files with the goal_kb_* tools. Those tools work on the shared tree on disk; a file-tool write into the goal tree would land in the session's sandbox and not persist, so it is refused with a pointer to goal_kb_write. A chat whose workspace holds the goal storage repo sees its goals folder as a snapshot taken when the workspace was made; the first file or shell call naming that folder carries a note saying so. To change a large goal file, an agent repairs a copy in its workspace with a script and publishes it with goal_kb_write(from_path=..., if_match=...), which is refused if a worker changed the file meanwhile. Workers use the ordinary file and shell tools for everything else.
Notes
- The knowledge base is the source of truth. Worker instructions live in the goal tree; editing them takes effect on the next tick without rescheduling.
- Registration is all-or-nothing: if any worker fails to register, the whole goal is rolled back.
- Your own changes are committed under your name. Creating a goal, adding, editing or removing a worker, deleting a goal, and (from the Goals page) messaging a goal or editing its
protocol.mdeach commit just the files they wrote, asgoal/<id>/userwith aUser:trailer — so a goal's git log separates human steering from worker ticks (goal/<id>/<worker>). - Commits recover on their own. A tick normally commits its subtree when the run ends. If that never happens (restart, timeout), the next tick of any worker — and the next server start — commits whatever is still dirty.
- Editing a goal tree by hand: pause first, commit in one go. The tree is live. The tick-start sweep commits (and pushes) any dirty
goals/<id>/aschore(goals): recover uncommitted tick stateat the next tick of any goal, so a half-finished edit can be committed mid-way, and a worker of that goal may overwrite the file you are editing. Runpause_goal(or drop aSTOPfile at the goal root) so its own workers stay off the files, make the edit andgit add+git commitit straight away — pausing does not stop other goals' sweeps — thenresume_goal. Changing the storage repo'sbranch:/ref:pin still force-checks-out the new ref and discards uncommitted goal state (logged as a warning); re-pinning to the branch it is already on leaves the working tree alone. - Requirements: the Task Runtime plugin and the job queue (both on by default); the propose flow additionally needs the Model Profiles
goalrole. - Per-worker
tools. A worker may list the tools its role calls every tick (e.g.gmail_sendfor a reporter). Those the deployment has (and the owner's access profile allows) are loaded up front for its runs instead of waiting to be discovered. This adds no permission — the worker keeps its other tools. Editable viaupdate_worker. - Per-worker model and effort (cost lever).
setup_goal,add_workerandupdate_workertake an optionalmodelandeffortper worker; both are pinned for every run of that worker, editable live viaupdate_worker(""returns either to the default) and inherited byrun_worker_nowand the wizard's test fire. Unset means the default model and its default effort. modelis a list of every model the goal owner can use on this turn — the organization's models and the owner's own connections (e.g. a ChatGPT subscription, see OpenAI Codex), whatever the owner's subagent-choice setting — each with a one-line description and, when the administrator stated one, a relative cost (Luna [cost 1]: fast, cheap — Company OpenAI; see Configuration). The same names the subagent tools'modeluses. The list is rebuilt every turn, so a model the owner connects later can be put on an existing worker withupdate_worker. The chosen model runs the worker's whole run conversation, so the privacy rule decides its helpers against it. A name that is not a model the owner can use is refused, with the list. A model that disappears later (the owner disconnected ChatGPT) runs the worker on the default model, and the log warns once.effortisoff,low,medium,highormax— how hard each run reasons. It is mapped onto the chosen model's own levels (nearest one), as for a chat; no effort ceiling applies to a worker.- Choosing. Put high-frequency collectors on a cheap model at
loweffort and analysts and reporters on a stronger model; omit both when unsure.get_goaland the Workers tab show each worker's model and effort. The worker editor on the Goals page offers the same list as a select (Default plus the owner's models; a stored model that is not in the list, such as an admin-pinned role or a disconnected model, stays as (not currently available) until another one is chosen). The web API takesmodellike the tools (PATCH/POSTworker bodies and workers'proposals/*.md), withmodel_roleas the deprecated alias, and lists the models atGET /ui/plugins/goals/worker-models. - Admin note: a worker may instead name a role the deployment pins under
models.subagent_profiles(see Model Profiles) through the deprecatedmodel_roleargument. It is accepted by all three tools but hidden from their schema whenever the model list is offered; a stored worker keeps itsmodel_roleindefinition.yaml(the chosen model is stored there too, as its reference). - Per-worker
token_budget(spend guard). A worker may settoken_budget(whole tokens, at least 10000 — the base prompt alone is several thousand; a stored value below that, saved before the floor was raised, keeps loading and is enforced as 10000 with a warning; the next edit of that worker must raise or clear it) in itsdefinition.yaml, fromsetup_goal/add_worker/update_worker, or in the worker edit form on the Goals page. It caps each tick's agent tokens — cached prompt tokens included, subagents and external agents included, auxiliary calls (titles, recall, compaction, judges) not — and rides besidetimeout_secondson the live task, sorun_worker_nowand the wizard's test fire use it too. Clearing it (emptying the form field, ornulltoupdate_worker/PATCH; the same works fortimeout_seconds) returns the worker to the operator default (tasks.default_run_token_budget, often unlimited);tasks.max_run_token_budgetcaps any value. A tick that spends it stops at the next agent-loop iteration (it can overshoot by up to one iteration; the worker is told to wrap up at 80 %), is recordedfailedwitherror_kind: token_budget, commits a<worker>: tick stopped at its token budgetmarker, and counts toward the worker's consecutive-failure auto-disable like a timeout. A tick stopped by the loop detector (the model kept repeating the same step) is likewisefailed,error_kind: loop, with a<worker>: tick stopped repeating itselfmarker. A tick whose turn ends on a reply nothing can use (the empty/degenerate/truncated-reply retry budget spent, or unusable tool calls) isfailedwitherror_kind: unusable_replyand a<worker>: tick ended on an unusable replymarker. See Admin Configuration Reference → Per-run token budgets. - Event-fired workers. A worker sets exactly one of
cronoron(plus optionalwhen,scope,mode,debounce_seconds, built by the samecore/tasks/firing_args.build_event_firing). Registration runs the §12.1 agent-task gate (task_runtime.authorization.authorize_agent_task): only in-instancetask.,job.,kb.andplugin.events. The trigger round-trips throughdefinition.yaml, export, templates, import and fork. - Per-worker
access_profile. Validated likecreate_task's (an undefined profile is refused) and carried in task metadata beside the worker's model and effort, where the run handler resolves it at fire time;run_worker_nowinherits it. A worker with a profile cannot be test-fired (a test fire has no task row to carry it). untiland concluded goals.definition.yamlmay carryuntil(epoch seconds). The pre-run gate concludes a goal whoseuntilhas passed: every worker task is paused, aconcludedrecord (at,reason,by) is written beside it and alog/<ts>-concluded.mdentry is added, and the tick is skipped.conclude_goal(reason)does the same from a worker, for its own goal only.list_goalsand the web API report the goal asconcluded; resuming clears the record (and a passeduntil).- Follow-ups. A
create_taskmade from a goal worker's tick is taggedfollowup_of_goal_id/followup_of_worker(core/tasks/lineage.py), nevergoal_id, so it is not counted as a worker.get_goaland the goal page list follow-ups separately, anddelete_goalcancels them. A task created from a run under a declaredaccess_profileinherits that profile. - Token reporting. The run panel shows each tick's tokens against its budget (
84k / 100k (84 %), a Stopped at token budget badge on a budget stop), with input / cached / output and cost in its tooltip; cost readsunknownfor an unpriced model, never$0. The worker page shows average tokens and the worker's budget per run. - Recurring work is a goal.
create_taskis one-shot only; a single-worker goal (name+ one worker withcronoron) is the lightweight form of a recurring or event-fired run. - Migrating old recurring tasks.
codumentor tasks migrate-to-goals [--dry-run] [--json]is an explicit admin command (never run automatically) that turns each pre-existing recurring or event-fired agent task into a single-worker goal, adopting its schedule row in place. It needs this plugin enabled and stores the goals in itsstorage_repo/storage_path. See Task engine.