/aevatar-automation:aevatar-automationfrom aevatar-automation
Aevatar scheduling & workflow automation: scheduled_agent_creator (cron/one-shot) for independent scheduled Ornn skill agents and reminders — NOT an alias for Studio Team member automation — the long-running task automation playbook, workflow creation semantics (Scope Workflow vs Ornn publish), agent_builder lifecycle, the typed required_nyx_services contract (exact user_service_id is the authorization; a slug snapshot never substitutes), dedicated Agent Key semantics (vault-held raw material, borrowed durable reference late-resolved per use, exact non-wildcard grants, ~90-day projected expiry, reauthorize-then-revoke, independent NyxID and Vault revocation tracks), accepted-is-admission-only receipts, and a token_expired triage protocol that reads credentialSourceKind before assuming any TTL.
Ships in aevatar-automation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use scheduled_agent_creator to create a new caller-owned scheduled automation agent from an Ornn skill reference, or to create a single delayed reminder.
This tool is for an independent scheduled Ornn skill agent or a one-shot reminder. It is NOT an alias for Studio Team member automation. If the thing being scheduled is an already-bound Team member workflow, the canonical path is aevatar_schedule_member_workflow or /api/scopes/{scopeId}/teams/{teamId}/members/{memberId}/automations — see aevatar-scheduler. Do not route a Team member here, and do not route an independent skill agent to generic /api/schedules.
For recurring automation, set schedule_mode="cron" and provide skill_ref, schedule_cron, and schedule_timezone; optional LLM tuning fields are allowed. If the loaded skill body will call connected NyxID services through nyxid_proxy beyond Ornn and the Lark outbound channel, declare them with the typed requirement contract:
required_nyx_services[] = { user_service_id, service_slug_snapshot }
The exact user_service_id is the authorization; the slug snapshot is an integrity/display value and can never substitute for it. nyx_user_service_id identifies the exact outbound provider where applicable. The older required_service_slugs contract has been removed — do not recommend it, and never infer a UserService ID from a slug, a vendor name, or a catalog service ID (a connected UserService ID and a catalog service ID are different identifiers and are not interchangeable).
If the scheduled agent needs deterministic fire-date fields, its execution prompt may use the same
fire-time Chat template as other schedules: {{@schedule.run_date}}, run_year, run_month,
days_until_month_end, fire_at_utc, and timezone. The prompt must then be valid JSON and each
placeholder must be inside a JSON string value. The values come from the authoritative logical fire
and configured IANA timezone; catch-up keeps the original occurrence and run-now uses the manual
instant. Unknown placeholders or invalid JSON fail closed. A manual run is not cron-rearm proof.
For one-shot delayed reminders such as "remind me in 10 minutes" or "later today tell me ...", set schedule_mode="one_shot" and provide exactly one of delay_seconds or run_at_utc, plus one_shot_message. Prefer delay_seconds when the user gave a relative delay. Do not use code_execute with sleep, timers, polling loops, or long-running scripts for delayed one-shot requests; durable delivery must go through scheduled_agent_creator. Do not publish an Ornn skill just to send a one-shot natural-language reminder unless the user explicitly asks for reusable automation or the reminder requires a real skill workflow.
Do not provide owner, scope, Lark target, Nyx provider slug, API key, service IDs, inline skill content, or outbound credential fields. This write command does not request remote approval; the tool derives context from the current authenticated/channel turn, mints a scoped NyxID key, and returns only an accepted receipt or a typed tool error.
skill_ref must be unversioned for now. A name@version reference returns versioned_skill_ref_not_supported_yet.
A scheduled_agent_creator agent does not run on a replayed user bearer, and it does not
run on a fire-time broker token. The tool derives caller and ownership from trusted context, plans
and revalidates typed authorization, provisions a constrained dedicated Agent Key, stores the
raw material in the Vault, persists a typed reference, returns an accepted receipt, and delegates
later management to agent_builder.
Secret custody. Raw key material is written only to ISecretVault. Durable state, committed
events, read models, logs, tools, and public APIs expose only stable non-secret facts: a typed
credential reference, Agent Key ID, expiry, authorization fact, and credential generation. The
workflow borrows a durable credential reference; every operation that needs the credential
late-resolves it through the Vault at the moment of use, fail-closed for an absent, expired,
revoked, mismatched, or malformed reference. Never ask the user to paste the key, accept it in JSON,
print it, store it in an Ornn package, or reconstruct it from an ID.
Grants are exact and closed: allow_all_services = false, allow_all_nodes = false. Only the
targeted plan supplies allowed service IDs and node IDs.
Expiry. The scheduled agent's default Agent Key lifetime is 90 days, subject to its typed authorization policy and deployment configuration. Describe the projected expiry — never promise an eternal key, and never quote a minutes-scale TTL for this credential class.
Lifecycle. Adding a new external service dependency is a reauthorization, not an edit: new preflight → new confirmed plan → provision a replacement generation → commit it → only then revoke the old generation. Never mutate an existing key in place to widen its authority. Pause and resume preserve the active credential and are neither a revoke nor a reauthorization. Delete tracks NyxID key revocation and Vault secret revocation as independent durable tracks, and a retry reuses the original delete operation identity rather than synthesizing a new one.
202 / accepted is admission onlyAn accepted receipt or pending status proves command/effect admission — nothing more. It does not
prove credential issuance completed, the Vault write completed, activation committed, the read model
observed the new state, cron fired, or the workflow succeeded. Reread the canonical owner-scoped
record and require a newer authoritative stateVersion. Note that credential health
(authorizationStatus == active) and firing state (enabled == true) are independent
dimensions.
If authorization planning returns authorization_catalog_route_unresolved or
api_key_scope_plan_route_unresolved, treat it as non-retryable. Preserve the exact required
UserService IDs, stop refresh/retry loops, and repair or deactivate the unresolved route before
trying again. A required ID may merely share a catalog family with the bad active peer; do not
delete or reconnect unrelated services.
Never quote one class's lifetime for another. The 300-second broker TTL below belongs to the NyxID binding-exchange source used by generic schedules — it does not describe a dedicated Agent Key.
| Credential | Lifetime | Authority to cite |
|---|---|---|
Dedicated scheduled-invocation Agent Key (credentialSourceKind = scheduled_invocation_agent_key) | Policy-governed; scheduled agent default ~90 days | the record's credentialExpiresAtUtc + credentialGeneration |
| Generic-schedule caller credential via NyxID binding exchange at fire | 300 s, fixed | NyxID oauth_broker_service.rs BROKER_ACCESS_TTL_SECS |
| Interactive user login access token | deployment config JWT_ACCESS_TTL_SECS (code default 900 s; production instances often set hours) | decode the actual JWT: exp − iat |
| NyxID delegated / MCP delegation token | 300 s | NyxID crypto/jwt.rs |
| NyxID service-account token | SA_TOKEN_TTL_SECS (code default 3600 s) | NyxID config.rs |
Lark tenant_access_token | ≈2 h, cached and refreshed transparently by NyxID | NyxID Lark token-exchange service description |
| aevatar scope service token | TokenLifetimeMinutes (default 60 min) | aevatar Aevatar.Authentication.ScopeServiceTokens/ScopeServiceTokenOptions.cs |
Anti-hallucination protocol for token_expired / 401 in a scheduled run — complete these steps
before naming any cause:
exp − iat; report only the numbers, never print the token), or cite the owning repo's
constant from the table above.credentialSourceKind before anything else. This single field decides which
diagnosis applies, and getting it wrong is the most common failure in this area:
scheduled_invocation_agent_key ⇒ a dedicated Agent Key. Do not diagnose a fixed
five-minute broker expiry merely because the call was scheduled. A token_expired six
minutes after fire on this source is not explained by the 300 s constant, and the ~5-6
minute coincidence is not evidence. Inspect instead: key credentialExpiresAtUtc; Vault
resolution and reference integrity; committed caller authority; the authorization fact; the
exact service/node grants versus what the failing step actually called; credentialGeneration
(did a reauthorization replace it mid-flight?); revocationPending /
nyxIdRevocationStatus / vaultRevocationStatus; then the downstream service's own token.nyxid_binding_exchange (generic schedules) ⇒ the fire-time broker token is the right
hypothesis; identify the actual exchanged token and use its verified iat/exp.Use this playbook when the user asks for a recurring, scheduled, monitored, or otherwise long-running task instead of a one-off answer. Typical triggers include: "每天...", "每周...", "each week...", "monitor X and tell me...", "定时...", "recurring", "keep watching", and "长期跟踪".
When a Lark user asks to create a workflow that should be runnable, page-visible, or invokable later by workflow id, create or update a Scope Workflow through the available Scope Workflow command tool path. Ornn publishing is for reusable templates/packages/exports; it does not make a workflow page-visible or runnable in Aevatar until the template is mounted/imported into Scope Workflow and the accepted/readmodel propagation contract says it is visible.
Recognize the request as automation.
Reuse before you author — search Ornn first.
ornn_search_skills with the task's distinctive capability keyword. Prefer a single strong keyword (deadline, attendance, reimbursement, digest, candidate); multi-word phrase queries match poorly, so if a phrase returns nothing, retry with one keyword or mode=semantic before concluding nothing exists.<capability>-…-payload-builder is a reusable match even if its name is longer than what the user said; do not require an exact name.use_skill, then go straight to negotiation and schedule it with scheduled_agent_creator using that existing skill_ref — no authoring or publishing needed. Do NOT author a duplicate of a skill that already exists.Author a runnable skill package yourself.
nyxid_proxy for explicit connected services such as api-github, derive the digest from current facts, then post the digest to the negotiated chat target.instructions_markdown as executable guidance, not passive description. Use workflow_yamls and scripts whenever they make the flow deterministic or easier to reuse.name, description, version, category, instructions_markdown, plus any workflow_yamls and scripts the run needs.Negotiate schedule and output with an interactive Lark card.
reply_with_interaction to ask for the minimum missing details.cron plus timezone), not vague wording.Publish the skill, then schedule it.
ornn_publish_skill with the assembled typed package.ornn_publish_skill call actually returned a success receipt for that skill.scheduled_agent_creator with the published skill_ref, the agreed schedule_cron, the agreed schedule_timezone, and required_nyx_services entries carrying the exact user_service_id (plus its service_slug_snapshot) for every connected service the skill body will call through nyxid_proxy.execution_prompt and outbound delivery setup; if the chosen delivery target differs from the current conversation, rebind it with agent_delivery_targets using the returned agent_id.Recover cleanly.
agent_builder manages the lifecycle of agents the user has already created. It can list, inspect, run, pause, resume, and delete; it does not create agents.
| Intent | Slash command |
|---|---|
| List agents | /agents |
| Inspect one agent | /agent-status <agent_id> |
| Manual run | /run-agent <agent_id> |
| Pause schedule | /disable-agent <agent_id> |
| Resume schedule | /enable-agent <agent_id> |
| Delete (two-step) | /delete-agent <agent_id> confirm |
Tool semantics: disable_agent pauses scheduled execution without deleting; enable_agent resumes; delete_agent disables, revokes the NyxID API key, and tombstones the registry entry. The Nyx relay path handles these slash commands directly without an LLM round-trip — you typically only see these flows when the user asks for them in natural language.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub chronoaiproject/nyx-skills --plugin aevatar-automation