How to choose the right trigger in an AI agent workspace
Context sharing, timed runs, and event reactions solve three different triggers inside a Space. Use the matrix below to pick the right mechanism before wiring commands.
Pick by what triggers the work
| What starts the work | Cohub mechanism | Does NOT replace | Go deeper |
|---|---|---|---|
| A person or agent needs files, skills, or answers from another Space | Context network | Does not merge Spaces or keep a live two-way sync of unsaved edits | Mentions, read-only Mods, Save forks, and cross-Space replies |
| The task has a wall-clock time or recurring cadence | Scheduled prompts | Does not watch files or react when something changes in the Space | Delays, one-off timestamps, and timezone-aware cron jobs |
| Something inside the Space changes or a webhook arrives | Space hooks | Does not run on a clock or replace human review before risky actions | Event-driven scripts, follow-up prompts, and App Actions |
All three mechanisms run inside Spaces you already own and leave an auditable Chat, Turn, or task record. Detailed flags and subcommands stay in the Cohub CLI reference and each dedicated feature page.
Three boundaries worth knowing before you wire them
- Read-only mounts and reply depth. A Mod mounts another Space under
/mods/<slug>from its latest Save, so unsaved edits never leak across, and changing attached Mods can restart the sandbox. Cross-Space hand-offs return one final reply and stop at nesting depth 4. - Clocks ignore workspace state. A scheduled prompt fires whenever its delay, timestamp, or cron hits, even if nothing in
/workspacechanged since the last run. If you only want work to happen after a file update or new Save, use a hook instead of polling on a short cron. - Hooks avoid self-loops and stay single-action. Each YAML rule under
.cohub/hooks/binds one event to one action (run,prompt, oruses), and edits inside.cohub/never fire file hooks so a hook cannot trigger itself endlessly. Hooks run under the Space owner's billing without automatic retries.
One real workflow that chains all three
These three primitives work best when each handles only its own trigger rather than stretching one tool to do everything. Consider a daily engineering digest built across two Spaces:
- Mount the shared rules once: keep your summary format in a central skills Space and mount it as a read-only Mod—see sharing a SKILL.md across Spaces for the exact layout.
- Wake the agent on a weekday clock: attach a morning cron prompt to the target Space so it pulls fresh issues and writes a Markdown report into
/workspace—walked through in morning GitHub issues digest workflow. - React when the report lands: add a file-change Space hook watching the output path so the newly written report automatically posts a summary or triggers a downstream webhook without a second cron job.
- Context network: share context between AI workspaces
Cohub's context network is how you share context between AI workspaces: @mention a Space for one message, mount it as a read-only Mod, fork a Save into a new Space, or hand work to another Space.
- Scheduled prompts: cron for AI agents
Scheduled prompts are cron for AI agents: a Cohub prompt sent to a Space after a delay, at an ISO time, or on a cron expression with a time zone, with each run recorded in a Chat.
- Space hooks: run scripts on AI agent events
Space hooks let you run scripts on AI agent events in Cohub: a YAML file in .cohub/hooks/ runs a command, sends a prompt or calls an App Action when a turn finishes, files change, a Save is created or a webhook arrives.