@controllerai/cli 0.2.18 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/package.json +6 -4
  2. package/skills/controllerai-agents/SKILL.md +66 -152
  3. package/skills/controllerai-agents/references/instructions-and-versioning.md +32 -34
  4. package/skills/controllerai-ai-nodes/SKILL.md +57 -65
  5. package/skills/controllerai-ai-nodes/references/selection-and-testing.md +44 -26
  6. package/skills/controllerai-data/SKILL.md +65 -118
  7. package/skills/controllerai-data/references/data-rails.md +24 -26
  8. package/skills/controllerai-expressions/SKILL.md +48 -117
  9. package/skills/controllerai-expressions/references/dsl-and-recipes.md +42 -40
  10. package/skills/controllerai-flow-control/SKILL.md +66 -122
  11. package/skills/controllerai-flow-control/references/patterns.md +23 -60
  12. package/skills/controllerai-integration-actions/SKILL.md +47 -75
  13. package/skills/controllerai-node-config/SKILL.md +60 -130
  14. package/skills/controllerai-node-config/references/prop-and-readiness.md +28 -78
  15. package/skills/controllerai-runs/SKILL.md +50 -85
  16. package/skills/controllerai-runs/references/debugging.md +24 -22
  17. package/skills/controllerai-start/SKILL.md +53 -58
  18. package/skills/controllerai-start/references/mcp-tool-map.md +21 -16
  19. package/skills/controllerai-triggers/SKILL.md +62 -159
  20. package/skills/controllerai-triggers/references/lifecycle.md +36 -48
  21. package/skills/controllerai-workflows/SKILL.md +70 -70
  22. package/skills/controllerai-workflows/references/command-map.md +19 -44
  23. package/skills/manifest.json +80 -77
  24. package/skills-mcp/controllerai-agents/SKILL.md +121 -0
  25. package/skills-mcp/controllerai-agents/references/instructions-and-versioning.md +76 -0
  26. package/skills-mcp/controllerai-ai-nodes/SKILL.md +92 -0
  27. package/skills-mcp/controllerai-ai-nodes/references/selection-and-testing.md +66 -0
  28. package/skills-mcp/controllerai-data/SKILL.md +119 -0
  29. package/skills-mcp/controllerai-data/references/data-rails.md +45 -0
  30. package/skills-mcp/controllerai-expressions/SKILL.md +98 -0
  31. package/skills-mcp/controllerai-expressions/references/dsl-and-recipes.md +136 -0
  32. package/skills-mcp/controllerai-flow-control/SKILL.md +114 -0
  33. package/skills-mcp/controllerai-flow-control/references/patterns.md +83 -0
  34. package/skills-mcp/controllerai-integration-actions/SKILL.md +89 -0
  35. package/skills-mcp/controllerai-node-config/SKILL.md +106 -0
  36. package/skills-mcp/controllerai-node-config/references/prop-and-readiness.md +49 -0
  37. package/skills-mcp/controllerai-runs/SKILL.md +88 -0
  38. package/skills-mcp/controllerai-runs/references/debugging.md +53 -0
  39. package/skills-mcp/controllerai-start/SKILL.md +80 -0
  40. package/skills-mcp/controllerai-start/references/mcp-tool-map.md +175 -0
  41. package/skills-mcp/controllerai-triggers/SKILL.md +112 -0
  42. package/skills-mcp/controllerai-triggers/references/lifecycle.md +59 -0
  43. package/skills-mcp/controllerai-workflows/SKILL.md +109 -0
  44. package/skills-mcp/controllerai-workflows/references/command-map.md +1 -0
  45. package/skills-mcp/manifest.json +189 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controllerai/cli",
3
- "version": "0.2.18",
3
+ "version": "0.2.21",
4
4
  "description": "Build and operate Controller AI workflows and agents from any AI coding agent (beta)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,15 +12,17 @@
12
12
  },
13
13
  "files": [
14
14
  "dist",
15
- "skills"
15
+ "skills",
16
+ "skills-mcp"
16
17
  ],
17
18
  "engines": {
18
19
  "node": ">=20"
19
20
  },
20
21
  "scripts": {
21
- "build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json && node scripts/sync-skills.mjs",
22
+ "build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json && yarn skills:render",
23
+ "skills:render": "node scripts/sync-skills.mjs",
22
24
  "lint": "tsc -p tsconfig.json --noEmit && eslint 'src/**/*.ts' 'test/**/*.ts'",
23
- "test": "node scripts/sync-skills.mjs && node --test --import tsx test/*.test.ts test/*.test.mjs",
25
+ "test": "yarn skills:render && node --test --import tsx test/*.test.ts test/*.test.mjs",
24
26
  "format": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
25
27
  "dev": "tsx src/index.ts",
26
28
  "prepack": "yarn build"
@@ -1,214 +1,128 @@
1
1
  ---
2
2
  name: controllerai-agents
3
- description: Design, assemble, test, publish, and share user-facing Controller AI agents with ready integration actions, workflow tools, instructions, and knowledge files. Use when creating or editing an agent, choosing its tool architecture, attaching or updating tools, verifying draft/live conversations, or publishing and sharing an agent safely.
3
+ description: Design, assemble, test, publish and share user-facing Controller AI agents built from instructions, knowledge files, workflow tools and ready integration actions. Use when creating or editing an agent, choosing its tool architecture, attaching tools, verifying draft or live conversations, or publishing and sharing it.
4
4
  ---
5
+ <!-- generated from .claude/skills by cli/scripts/render-skills.mjs; edit the source -->
5
6
 
6
- # Controller AI agents
7
+ # Agents
7
8
 
8
- An agent has one mutable draft and immutable published versions. Build instructions, tools, permissions, and files on the draft; verify in Test; publish last. Draft edits never update Live by themselves.
9
+ ## Use this when
9
10
 
10
- The `cai ...` examples are canonical grammar. Use the transport selected in `controllerai-start` and its MCP tool map; never mix transports in one task or call Controller AI REST routes directly.
11
+ - The user wants something people chat with: an assistant, a copilot, a file-enrichment helper, an internal tool with judgment.
12
+ - An existing agent needs new instructions, tools or knowledge, or must be verified, published or shared.
13
+ - A capability must be placed: in the agent's instructions, in a workflow tool, in a direct action, or in a knowledge file.
11
14
 
12
- ## Rules that break tasks when skipped
15
+ Direct actions belong to `controllerai-integration-actions`; the workflows behind workflow tools to `controllerai-workflows`; the wider deliverable choice to `controllerai-start`.
13
16
 
14
- - Attach one ready action directly instead of wrapping it; see Choose the capability architecture.
15
- - Choose confirmation before attaching a consequential tool; see Create and assemble the draft.
16
- - Use one conversation on an explicit rail for each verification task; see Verify the draft as an agent.
17
- - Resolve pending requests in that same conversation; see Verify the draft as an agent.
18
- - Enablement is runtime state, not publication; see Create and assemble the draft.
19
- - Publish authorized workflow dependencies, preflight, then publish the agent; see Publish in dependency order.
20
- - Draft-only means stop before publish; draft evidence never proves Live. See Publish in dependency order.
17
+ ## How it works
21
18
 
22
- ## 1. Choose the capability architecture
19
+ **What an agent is.** A person chats with it; it reasons, reads conversation attachments and reference knowledge, calls tools, and creates files for the user. It is the right shape for judgment, conversation and file handling; deterministic business rules, custom workflow data and multi-step processing belong in workflow tools it calls, and one existing app operation is a direct action.
23
20
 
24
- - Use `controllerai-integration-actions` when one existing app operation completes it.
25
- - Use a workflow tool for multiple steps, transformations, branching, looping, durable state, triggers, a custom typed contract, or reusable business logic.
26
- - Put judgment, tool-selection rules, tone, and escalation in instructions; put stable sources in knowledge files.
21
+ **One draft, immutable versions.** Editing changes only the mutable draft, and saving the draft updates the owner-only Test environment at once. Publishing snapshots the display name, instructions, tool identities, descriptions, approval policies and knowledge files into a new immutable version, moves the live pointer, and restamps every existing live conversation to it; that cutover interrupts in-flight answers and expires pending approvals. The runtime model is not part of the snapshot. There is no rollback: a bad version is corrected forward.
27
22
 
28
- Do not create a one-node workflow merely to expose a ready action, or replace orchestration with several independent direct actions when ordering or data handling must be deterministic.
23
+ **Test versus Live.**
29
24
 
30
- ## 2. Build and verify capabilities
31
-
32
- For a ready action, follow `controllerai-integration-actions`: discover exact identities, select a connection, decide confirmation, then attach.
33
-
34
- For every workflow tool, load the relevant workflow skills and test the development state before attaching:
35
-
36
- ```bash
37
- cai use <workflowId>
38
- cai flow get <flowId> --json
39
- cai run flow <flowId> --inputs values.json --json
40
- ```
41
-
42
- MCP: there is no pin; pass `workflowId` to `flow_get` and `run_flow`, pass parsed `inputs`, and set `waitSeconds`.
43
-
44
- Capture the successful execution ID. Inputs become tool parameters and outputs its result. Require a nonempty output contract and verify the run returns it.
45
-
46
- ## 3. Create and assemble the draft
47
-
48
- Write short instructions for role, tool use, inputs/results, safety, response style, and errors. Require truthful failure reporting and at most one retry.
49
-
50
- Read [references/instructions-and-versioning.md](references/instructions-and-versioning.md) before publishing or explaining Test versus Live behavior.
51
-
52
- ```bash
53
- cai agent create --name "<agent name>" --instructions-file instructions.md --json
54
- ```
55
-
56
- MCP: `agent_create` takes complete Markdown in `instructions`; it cannot read `instructions.md`.
57
-
58
- ```bash
59
- cai agent add-action <agentId> \
60
- --integration <integrationSlug> \
61
- --action <actionKey> \
62
- --connection <connectionId> \
63
- --description "Use when ..." \
64
- --json
65
-
66
- cai agent add-workflow <agentId> \
67
- --workflow-id <workflowId> \
68
- --flow <flowId> \
69
- --description "Use when ...; accepts ...; returns ..." \
70
- --json
71
- ```
72
-
73
- MCP: use `agent_tool_action_add` or `agent_tool_workflow_add`; `requireConfirmation` is optional and defaults to `false`.
74
-
75
- ```bash
76
- cai agent add-file <agentId> --file <path> --space <knowledge|shared> --json
77
- cai agent files <agentId> --space <knowledge|shared> [--live] --json
78
- cai agent tools <agentId> --json
79
- cai agent get <agentId> --json
80
- ```
81
-
82
- MCP: use `agent_knowledge_file_add` or `agent_workspace_file_add` with inline `content`; `agent_file_list` uses `environment: dev|live`. Shared runtime files update live immediately.
83
-
84
- The default is no approval: attached actions and workflow tools run without a human approval step unless `requireConfirmation` is `true`, and omitting `--require-confirmation` has the same behavior. When attaching an action that sends, posts, spends, or deletes, choose `true` or explicitly tell the user that it will run unattended. Mention the confirmation choice in the report to the user; `cai agent update-tool` can change it later.
85
-
86
- Keep the two modes straight:
87
-
88
- | Context | Test / draft conversation | Live / shared conversation |
25
+ | Context | Test (draft) conversation | Live (shared) conversation |
89
26
  | --- | --- | --- |
90
27
  | Agent configuration | Current mutable draft | Latest published immutable agent version |
91
- | Workflow tools | Current workflow development heads | Each workflow's latest live release; never pinned |
28
+ | Workflow tools | Each workflow's current development head | Each workflow's latest live release; never pinned |
92
29
  | Reference files | Current draft knowledge files | Knowledge frozen into the published agent version |
93
30
  | Runtime files | Current live runtime files, overlaid by development/test runtime files at the same path | Current live runtime files only |
94
31
  | Access | Owner only | Owner, plus organization members when shared; non-owners never see the draft |
95
32
 
96
- Version pinning for workflow tools does not exist. Live tools track the latest release. If asked to freeze one, explain this, attach with policy `latest`, and never abandon the attachment.
33
+ **Three kinds of files.** Conversation attachments belong to one chat. Knowledge is versioned reference material in the draft: text types only (`txt`, `md`, `json`, `csv`, `html`, `xml`), each added once under the name the agent should see. When the user asks for a PDF or another unsupported format, store a supported text type under the plain requested name and say why; a name that still carries the wrong extension is not the same document. Shared runtime files are live workspace state, visible without a publish, and no substitute for an upload. Paths come from returned metadata; runtime mounts can prefix them.
97
34
 
98
- Publishing snapshots versioned fields, moves the live pointer, and restamps every existing live conversation. It does not snapshot the runtime model. This cutover interrupts in-flight answers and expires pending approvals; time it accordingly.
35
+ **Live-bound state.** Enabling or disabling is runtime state, independent of publication: disabling pauses live use, while the owner's Test conversations still work. A workflow publish changes every live agent that follows that workflow without an agent publish, and live workflow resolution is cached per session, so an in-flight turn may finish on the prior release. A direct action's connection is a live grant: rebinding redirects it and revocation or detachment blocks it immediately; detachment still needs a later agent publish to remove the tool from the published list.
99
36
 
100
- Runtime lifecycle changes do not require publishing:
37
+ **Runtime usage.** Test and live conversations consume the organization's runtime usage and cause the connected providers' side effects; the builder's own subscription pays only for building.
101
38
 
102
- ```bash
103
- cai agent update <agentId> --disabled --json
104
- cai agent update <agentId> --enabled --json
105
- cai agent delete <agentId> --confirm --json
106
- ```
39
+ ## Rules
107
40
 
108
- MCP: draft edits use `agent_update`; runtime uses `agent_set_enabled`; `agent_delete` has no `confirm`. Disable pauses runtime. Soft delete revokes access and requests session termination; there is no CLI restore.
41
+ 1. **Instructions hold judgment; tools hold work; knowledge holds sources.** Each tool description says when to use it, what to pass, what comes back.
42
+ 2. **Test every workflow tool on development before attaching it**, with a non-empty output contract the run actually returns, unless the user declined that test and asked for the attachment anyway.
43
+ 3. **Decide the approval policy before attaching a consequential tool.** The default is no approval, which is right for reads and searches; for a tool that sends, posts, spends or deletes, choose `requireConfirmation` or explicitly tell the user it will run unattended, and mention the choice in the report to the user. The policy is a runtime setting for the agent's users, not a permission gate on your own work, so honor a policy the user already specified.
44
+ 4. **Never promise a pinned workflow tool.** Live tools follow the latest release and nothing else is supported; when asked to freeze one, explain that, ask whether following the latest release is acceptable, and finish the independent work meanwhile.
45
+ 5. **One conversation per verification task, on an explicit rail.** Reuse its ID for follow-ups and approvals; never resend the request or open a replacement after an approval pause, and never approve merely to continue.
46
+ 6. **Resolve the task's pending requests, in its conversation and within the user's scope, before publishing**, because a publish expires the unexecuted requests in the affected live conversations.
47
+ 7. **Draft-only means stop at Test evidence.** Readiness authorizes nothing; a draft never proves the live agent.
48
+ 8. **Publish in dependency order**: attached workflows the user authorized, then agent preflight, then the agent, then one fresh live conversation. A preflight blocker on an unfinished workflow tool is cleared by detaching that tool; never delete its flow or publish the workflow to make preflight pass, because both release or destroy work the user did not ask to ship.
49
+ 9. **Failure instructions are specific.** Say what failed and what was attempted, retry at most once, distinguish reads from rejected validation from uncertain mutations, and name the integration when a connection breaks.
50
+ 10. **Keep internals out of the runtime user's view**: no workflow, flow, node, rail, prop or version names in instructions or replies.
109
51
 
110
- ## Runtime usage boundary
52
+ ## Recipes
111
53
 
112
- The user's coding-agent subscription covers builder reasoning, but hosted agent tests and conversations consume Controller AI runtime usage from the organization's pool, and connected providers may add charges or side effects. Say so before starting a hosted test.
113
-
114
- ## 4. Verify the draft as an agent
115
-
116
- Saving the draft updates the agent's Test environment — there is no separate deploy step. Test conversations run each workflow tool's DEVELOPMENT version.
54
+ ### Create the draft
117
55
 
118
56
  ```bash
119
- cai agent test <agentId> --draft --message "<representative request>" --json
120
- cai agent conversation history <conversationId> --json
57
+ cai agent list --json
58
+ cai agent create --name "<agent name>" --instructions-file <instructions.md> --json
59
+ cai agent get <agentId> --json
121
60
  ```
122
61
 
123
- MCP: `agent_test` requires `rail: draft` or `rail: live` and takes `waitSeconds`.
62
+ A draft is private and by default enabled on creation, so the user can open it and start testing at once; nothing is live until a publish. Write instructions from the template in [references/instructions-and-versioning.md](references/instructions-and-versioning.md) and delete every sentence that does not change behavior.
124
63
 
125
- `agent test` always creates a conversation. Use it for a one-shot check. When a task may need follow-up or approval, create one conversation on the requested rail, capture its ID, and reuse it:
64
+ ### Attach tools and knowledge
126
65
 
127
66
  ```bash
128
- cai agent conversation create <agentId> --draft --title "<test case>" --json
129
- cai agent conversation send <conversationId> --message "<request>" --wait --json
67
+ cai run flow <flowId> --inputs <values.json> --json
68
+ cai agent add-workflow <agentId> --workflow-id <workflowId> --flow <flowId> --description "Use when ...; accepts ...; returns ..." --json
69
+ cai agent add-workflow <agentId> --workflow-id <workflowId> --flow <consequentialFlowId> --description "Use when ..." --require-confirmation --json
70
+ cai agent add-file <agentId> --file <path> --name "<name the agent sees>" --type <txt|md|json|csv|html|xml> --space knowledge --json
71
+ cai agent tools <agentId> --json
72
+ cai agent files <agentId> --space knowledge --json
130
73
  ```
131
74
 
132
- Do not resend the request or create a replacement after an approval pause. A required post-publish Live check is a separate rail task and gets one fresh Live conversation.
133
-
134
- Test positive and negative tool selection, exact arguments, results, errors, and knowledge. Offer the returned `appUrl`; on MCP, call `agent_present` and relay the returned card.
75
+ `--require-confirmation` sets the policy to `true`; omitting it keeps the `false` default. Read the add-file result before any second call: each call creates another file, and the name and type are set on the first one. The flow run needs the workflow pinned first (`cai use <workflowId>`); `--workflow-id` on the attachment does not pin it. `cai agent add-action` attaches a ready action as in `controllerai-integration-actions`. Shared runtime files use `--space shared` and are live immediately; list them with `--environment <live|dev>`.
76
+ Flow inputs become the tool's parameters and its outputs the result.
135
77
 
136
- - For a workflow tool, correlate a side-effectful call with its terminal workflow execution ID.
137
- - For a direct integration action, inspect persisted conversation action events/run result and the intended external effect. Direct actions do not create workflow execution IDs.
138
-
139
- For a pending approval, inspect the exact request first:
78
+ ### Verify in Test
140
79
 
141
80
  ```bash
81
+ cai agent test <agentId> --draft --message "<representative request>" --json
82
+ cai agent conversation create <agentId> --draft --title "<test case>" --json
83
+ cai agent conversation send <conversationId> --message "<request>" --wait --json
84
+ cai agent conversation history <conversationId> --json
142
85
  cai agent conversation approve <conversationId> --request <requestId> --json
143
86
  cai agent conversation deny <conversationId> --request <requestId> --message "<reason>" --json
144
87
  ```
145
88
 
146
- The server resolves the tool from the request ID. Do not approve merely to continue. Resolve every pending request before publishing; approval or denial resumes this conversation, while publishing expires it.
89
+ `agent test` is a one-shot that always creates a conversation; use create and send when follow-up or an approval may be needed.
90
+ Test positive and negative tool selection, exact arguments, results, errors and knowledge. A workflow tool's side effect is proved by its terminal workflow execution; a direct action by its persisted action events, result and external effect, never by an execution ID it does not have. After removing a tool, test one request that must no longer use it and one that still uses a retained tool. Say before the first test that it consumes runtime usage and may reach providers.
147
91
 
148
- After `cai agent remove-tool`, test one request that must no longer use the removed capability and one retained capability.
149
-
150
- ## 5. Publish in dependency order
151
-
152
- For attached workflows only:
92
+ ### Publish and share
153
93
 
154
94
  ```bash
155
95
  cai use <workflowId>
156
- cai workflow status --json
157
- cai workflow publish --name "<release>" --json
158
96
  ```
159
97
 
160
- MCP: there is no `use`; pass `workflowId` to `workflow_status` and `workflow_publish`.
161
-
162
- Publish a workflow only when its verified development state must go live and the user authorized it. A workflow publish already followed by a live agent changes that tool's live behavior immediately; do not republish the agent merely to pick it up.
163
-
164
- For a draft-only request, stop after Test evidence. Do not publish a workflow or agent merely because it is ready.
165
-
166
- Then publish the agent:
167
-
98
+ Pin each attached workflow before reading or publishing it; `--workflow-id` on the attachment does not pin it.
168
99
  ```bash
100
+ cai workflow status --json
101
+ cai workflow publish --json
102
+ cai agent get <agentId> --json
169
103
  cai agent publish-preflight <agentId> --json
170
104
  cai agent publish <agentId> --name "<release>" --json
171
105
  cai agent versions <agentId> --json
172
106
  cai agent test <agentId> --live --message "<representative request>" --json
107
+ cai agent visibility <agentId> --value organization --json
173
108
  ```
174
109
 
175
- MCP: `agent_test` requires `rail: draft` or `rail: live` and takes `waitSeconds`.
176
-
177
- `publish-preflight` is the arbiter of structural readiness. Report blockers and stop. With none and an authorized release, publish, except an error you actually watched happen; that blocks even a green preflight.
178
-
179
- Email verification is not a publishing prerequisite. An unclaimed agent-created account may publish; email claiming only raises its monthly usage cap and enables account recovery.
180
-
181
- Use one loop: edit draft, read back, verify Test, publish, verify Live. Published versions have no rollback. Recover forward from `agent versions`; restore workflow definitions with history/restore, then republish. Workflow releases, action grants, and runtime files are live-bound; see [references/instructions-and-versioning.md](references/instructions-and-versioning.md). After detaching an action, publish to remove it from the published list.
182
-
183
- Draft evidence does not prove the live agent. Test is owner-only; shared users always run the latest published agent version and never see draft instructions, tools, or knowledge.
110
+ Publish an attached workflow only when its verified development state must go live and the user authorized it. `hasUnpublishedChanges` on the agent read says whether a publish would change anything; do not publish an unchanged draft. Preflight is the arbiter of structural readiness: report blockers and stop; with none and an authorized release, publish unless an error you watched happen remains. Then verify with a fresh live conversation. Agents stay private unless the user asks for organization access: members use the published version through the owner's connected accounts and the organization's usage pool, and private visibility revokes access immediately. After a publish, offer the product's Slack setup.
184
111
 
185
- ## 6. Offer Slack and organization sharing
186
-
187
- After publish, offer product setup for Slack. Agents remain private unless the user requests organization access:
112
+ ### Runtime state
188
113
 
189
114
  ```bash
190
- cai agent visibility <agentId> --value organization --json
115
+ cai agent update <agentId> --disabled --json
116
+ cai agent update <agentId> --enabled --json
117
+ cai agent delete <agentId> --confirm --json
191
118
  ```
192
119
 
193
- Members use the published version. Direct actions use the owner's external account and organization usage pool. Grant changes affect Live immediately; private visibility revokes access.
194
-
195
- ## Before you finish
120
+ Disable pauses live use without a publish; the owner's Test conversations keep working. Delete is a soft delete that revokes access and asks active sessions to stop; there is no restore.
196
121
 
197
- ```bash
198
- cai agent tools <agentId> --json
199
- cai agent conversation list <agentId> --mode dev --json
200
- cai data query --type custom.<type> --env dev --json
201
- cai agent conversation history <conversationId> --json
202
- cai agent publish-preflight <agentId> --json
203
- cai agent versions <agentId> --json
204
- cai agent test <agentId> --live --message "<representative request>" --json
205
- ```
122
+ ## Verify
206
123
 
207
- Run the last three commands only for an authorized release. For Live verification, use `--mode live` and `--env live` in the same pair.
124
+ The tool list shows the intended tools with exact identities, descriptions and confirmation policies; the knowledge list shows the intended files; the agent read-back matches the instructions; the captured conversation exists on the requested rail without duplicates, its history shows the intended arguments, terminal results and no unresolved request, and stateful behavior is proved by a same-rail record query; a release shows a clean preflight, the new version in the version list, and one fresh live conversation.
208
125
 
209
- - Conversation list must show the captured ID on the requested rail, without retry-created duplicates.
210
- - History must show the intended tool arguments, terminal result, and no unresolved permission request.
211
- - For stateful behavior, the same-rail data query must show the expected record; an assistant reply is not proof.
212
- - A release requires clean preflight, agent version read-back, and one fresh Live conversation. Draft-only work must remain unpublished.
126
+ ## Report
213
127
 
214
- Report the agent ID/version, tools and confirmation policies, execution or direct-action evidence, rail state, connections, access, and anything unverified.
128
+ The agent ID and version, its tools with their confirmation policies, what the Test and live conversations proved, connections and access, and what is still unverified or unpublished.
@@ -1,3 +1,4 @@
1
+ <!-- generated from .claude/skills by cli/scripts/render-skills.mjs; edit the source -->
1
2
  # Agent instructions and versioning
2
3
 
3
4
  ## Instruction template
@@ -22,57 +23,54 @@ You are <role> for <audience>. You own <outcome>.
22
23
  ## When something fails
23
24
 
24
25
  - Tell the user what failed and what you were trying to do.
25
- - Do not retry more than once.
26
+ - Retry a read once; do not retry a rejected validation; check the result before repeating an uncertain write.
26
27
  - If a connection is broken, name the integration that needs attention.
27
28
  ```
28
29
 
29
- Delete any sentence that does not change behavior. Do not expose workflow, flow, node, rail, prop, schema tier, or version internals to the runtime user.
30
+ Delete any sentence that does not change behavior. Do not expose workflow, flow, node, rail, prop, schema-tier or version internals to the runtime user.
30
31
 
31
32
  ## Draft and live model
32
33
 
33
- - Agent edits change only the mutable draft.
34
+ - Agent edits change only the mutable draft; saving the draft updates Test immediately.
34
35
  - Publishing snapshots display name, instructions, tool identities, descriptions and approval policies, and knowledge files into a new immutable version. The runtime model is not part of that snapshot.
35
- - Publishing moves the agent's live pointer and restamps every existing live conversation to the new version. New and existing shared conversations therefore use the latest published agent version.
36
- - Non-owners never receive draft instructions, tools, or knowledge. Test/draft conversations are owner-only.
37
- - There is no rollback command; correct a bad version by editing the draft and publishing forward.
38
- - Test/draft conversations use the current agent draft. Workflow tools run against each workflow's current development head.
39
- - Live/shared conversations use the latest published agent version. Workflow tools follow each workflow's latest live release and cannot be pinned to an agent version.
40
- - Direct action identity, description, and confirmation policy are captured in the agent version. Its connection and authorization grant remain live-bound: rebinding can redirect an invocation, while failure, revocation, or detachment can block it immediately without publishing the agent. Detachment still changes the draft tool list, so publish afterward to remove that tool from the published list.
41
- - Organization members use the agent owner's connected external accounts for direct actions. Controller AI usage comes from the organization's shared pool.
42
- - Workflow and agent publishing are independent. Publish only attached workflows whose verified development changes must become live. A workflow publish changes every live agent that follows it without another agent publish. Live workflow resolution is cached per runtime session: an in-flight turn or approval episode may finish on the prior release, then the session refreshes. Use a fresh Live conversation for post-publish proof and disclose any refresh warning.
43
- - Development and live workflow records are separate. Stateful behavior needs live-data verification.
36
+ - Publishing moves the live pointer and restamps every existing live conversation to the new version; new and existing shared conversations therefore use the latest published agent version. In-flight answers are interrupted and pending approvals expire.
37
+ - Non-owners never receive draft instructions, tools or knowledge. Test conversations are owner-only.
38
+ - There is no rollback; correct a bad version by editing the draft and publishing forward. `agent versions` is the release history.
39
+ - Test conversations run each workflow tool against its current development head; live conversations follow each workflow's latest live release and cannot pin a version.
40
+ - Workflow and agent publishing are independent. A workflow publish changes every live agent that follows it without another agent publish. Live workflow resolution is cached per runtime session: an in-flight turn or approval episode may finish on the prior release, then the session refreshes. Use a fresh live conversation for post-publish proof and disclose any refresh warning.
41
+ - A direct action's identity, description and confirmation policy are versioned; its connection and grant are live: rebinding can redirect an invocation, and failure, revocation or detachment can block it immediately. Confirmation is strictest-wins: turning it on for a direct action blocks the published action at once until the next publish carries it. Detachment also changes the draft tool list, so publish afterward to remove the tool from the published list.
42
+ - Organization members use the owner's connected external accounts for direct actions, and usage comes from the organization's shared pool.
43
+ - Development and live workflow records are separate; stateful live behavior needs live-store proof.
44
44
 
45
45
  ## File context by mode
46
46
 
47
- - **Live/shared:** frozen knowledge from the latest published agent version plus current live shared/runtime files.
48
- - **Test/draft:** current draft knowledge plus current live shared/runtime files overlaid by development/test shared/runtime files. On the same sandbox path, the development/test file wins.
49
- - Runtime files are maintained outside the immutable agent snapshot. A live runtime-file change can therefore appear in live conversations without publishing the agent.
47
+ - **Live:** knowledge frozen in the latest published agent version plus current live shared or runtime files.
48
+ - **Test:** current draft knowledge plus current live shared or runtime files, overlaid by development/test files at the same sandbox path, where the development/test file wins.
49
+ - Runtime files live outside the immutable snapshot, so a live runtime-file change appears in live conversations without a publish. Conversation attachments belong to one conversation only.
50
50
 
51
- Do not describe Test and Live as sharing one mutable file context. Knowledge is versioned with the agent; runtime files are environment-aware live state.
51
+ ## Updating a published agent
52
52
 
53
- ## Updating an agent
53
+ 1. Edit the draft.
54
+ 2. Read it back and verify it in a Test conversation.
55
+ 3. Publish any changed workflow dependency the user authorized.
56
+ 4. Run preflight and publish the agent.
57
+ 5. Verify with a new live conversation.
54
58
 
55
- For name, instructions, tool identity/description, tool approval policy, or knowledge-file changes:
56
-
57
- 1. Edit the mutable draft.
58
- 2. Read it back and verify it in a Test/draft conversation.
59
- 3. Publish any changed workflow dependency that should become live.
60
- 4. Run agent preflight and publish the agent.
61
- 5. Verify with a new Live conversation.
62
-
63
- Do not republish the agent merely to make a followed workflow's new live release or a direct-action grant/connection rebind, failure, revocation, or detachment take effect; those effects are already live. After detaching an action, still publish the agent to remove the now-unavailable tool from its published tool list. Verify and disclose every live-bound change.
59
+ Do not republish the agent merely to pick up a followed workflow's new release or a direct-action rebind, failure, revocation or detachment; those effects are already live. Verify and disclose every live-bound change.
64
60
 
65
61
  ## Verification matrix
66
62
 
67
63
  | Layer | Evidence |
68
64
  | --- | --- |
69
- | Workflow tool | Completed development `cai run flow` execution; an intentional `cai run flow <flowId> --target live --confirm-live` execution is stronger evidence of published behavior than a draft-agent proxy |
70
- | Direct action | Persisted conversation action/run events, returned result, and intended external effect |
71
- | Draft routing | Draft conversation chooses the correct tool and arguments |
72
- | Published workflow | `workflow status` reports the intended live release and active state |
73
- | Published agent | `agent publish` version plus a new live conversation |
74
- | Stateful live behavior | Live conversation or trigger run reads/writes expected live records |
65
+ | Workflow tool | A completed development flow run; an intentional, authorized live flow run is stronger evidence of published behavior than a draft-agent proxy |
66
+ | Direct action | Persisted conversation action events, the returned result, and the intended external effect |
67
+ | Draft routing | A Test conversation that chooses the correct tool with the correct arguments |
68
+ | Published workflow | `workflow status` reporting the intended live release and active state |
69
+ | Published agent | The publish version plus a new live conversation |
70
+ | Stateful live behavior | A live conversation or trigger run that reads and writes the expected live records |
71
+
72
+ Direct actions do not create workflow execution IDs. Never claim a higher layer from lower-layer evidence alone.
75
73
 
76
- MCP: `run_flow` takes `waitSeconds`; pass any input object inline in `inputs`.
74
+ ## File-handling agents
77
75
 
78
- Direct actions do not create workflow execution IDs. Never claim a higher layer from only lower-layer evidence.
76
+ An agent, not a workflow, reads a chat-uploaded file and produces the output file; workflows receive typed values extracted from the rows, and a workflow `file` value is hosted-file metadata, not an upload or a parser. For a per-row enrichment: build and test a typed one-item flow (clear match, ambiguous match, missing data, a failed lookup), attach it, instruct the agent to inspect the columns, process every row, keep failures on their original rows, preserve column and row order and append the new columns, then have the exported file checked (quoted commas, a missing company, an ambiguous name) for opening and retaining every input row. The upload and the download happen on the product's file surface, which the builder cannot drive, so that check is the user's; "saved the file" is not proof of an accessible download.
@@ -1,105 +1,97 @@
1
1
  ---
2
2
  name: controllerai-ai-nodes
3
- description: Configure and verify AI-powered Controller AI workflow nodes, especially Ask AI and actions that interact with Controller AI agents. Use when a workflow needs generation, classification, extraction, summarization, structured AI output, model/provider selection, or a workflow action that creates or messages an agent conversation.
3
+ description: Configure and verify AI steps inside Controller AI workflows: the native Ask AI node, its provider, model, prompt and typed response, and the workflow actions that talk to a platform agent. Use when a flow needs generation, classification, extraction, summarization or structured AI output, or must create or message an agent conversation.
4
4
  ---
5
+ <!-- generated from .claude/skills by cli/scripts/render-skills.mjs; edit the source -->
5
6
 
6
- # Controller AI AI nodes
7
+ # AI nodes
7
8
 
8
- The `cai ...` examples are canonical grammar. Use the transport selected in `controllerai-start` and its MCP tool map; never mix transports in one task.
9
+ ## Use this when
9
10
 
10
- ## Rules that break tasks when skipped
11
+ - One step of a flow needs language-model judgment: classify, extract, summarize, draft, decide.
12
+ - An AI step must return fields that later nodes read.
13
+ - A flow must open or message a Controller AI agent conversation or manage its files.
11
14
 
12
- - Use native Ask AI for a bounded AI step; see Configure Ask AI in dependency order.
13
- - Keep an existing Ask AI node unless the requested component changes; see Configure Ask AI in dependency order.
14
- - Set reload selectors before fetching live model options; see Configure Ask AI in dependency order.
15
- - Never invent or hardcode a model ID; see Configure Ask AI in dependency order.
15
+ A conversational assistant with tools and knowledge is an agent (`controllerai-agents`); a step whose logic can be written and tested exactly is an expression or an ordinary action, not AI.
16
16
 
17
- ## Choose the AI surface
17
+ ## How it works
18
18
 
19
- - Use Ask AI for one bounded transformation with explicit inputs and output contract.
20
- - Use a Controller AI agent for conversational judgment, multiple tools, durable instructions, and knowledge files. Load `controllerai-agents`.
21
- - Use `registry_agent` workflow actions only when a workflow must create/message a platform agent conversation or manage its files; discover the exact action and props rather than treating the whole agent as one node.
19
+ **Ask AI is one bounded transformation.** The native component (`registry_askai`, action `registry_askai-ask-ai`) has two text props: a required user message, the input the model answers, and an optional prompt, the standing system instructions. It returns text or a primitive by default, or a typed response when a shape is bound. Its props resolve in dependency order: the provider is a static selector (it defaults to one provider, so options exist for whichever provider is current) that reloads the dependent props, the model is a remote dropdown filtered by label substring, the response data type is a shape selector that takes a primitive or a `custom.*` type, and the user message is an expression bound to the real inputs. Prop names and option values come from the node's current metadata, never from memory, because the registry changes.
22
20
 
23
- ## Configure Ask AI in dependency order
21
+ **Typed output is a contract, not a prompt.** A prompt that says "return JSON" does not set the output type. When downstream nodes need fields, define or reuse the small `custom.*` type first, bind it as the response data type, then describe each field's meaning, allowed values and uncertainty representation in the prompt; a single word or number needs no schema. Fluent output in the wrong shape is a failure.
24
22
 
25
- For a bounded workflow transformation, use the native Ask AI component. Do not replace it with a provider integration action or delete an existing Ask AI node to bypass configuration.
23
+ **Models are discovered.** The catalog, availability and prices change; the returned options are the only valid values, and the setter validates the value against them with its matching label. A requested model that is absent is reported and never substituted: a new node stays unset, and a repair keeps the existing working selection.
26
24
 
27
- Discover the current component instead of hardcoding a key:
25
+ **Platform agents from a flow.** The `registry_agent` component exposes actions to create a conversation (agent plus initial message), send a message to an existing conversation (agent, conversation and message), and create agent or conversation files. Their outputs are dispatch metadata such as the conversation ID, never the assistant's answer; the answer is read on the conversation itself. These actions message real conversations and write real runtime files when they run.
26
+
27
+ **Runtime evidence.** `resolvedConfigs` proves which message, prompt, provider, model and response type reached the action; the node output proves what the provider returned. Inspect both. Executing the node is platform usage, separate from the builder's own subscription.
28
+
29
+ ## Rules
30
+
31
+ 1. **Keep the native Ask AI node** for a bounded AI step; never replace it with a provider integration or delete an existing one to escape its configuration, unless the user asks for a different component.
32
+ 2. **Discover the component, the props and the model options**; never hardcode a component key, a prop name or a model ID, because the registry and the catalogs change under you.
33
+ 3. **Provider first, then re-read the props, then the model, then the response type, then the user message and prompt.** Setting a dependent prop before its selector writes into a stale schema; on a provider-only or model-only repair, leave the existing message, prompt and output contract alone.
34
+ 4. **A missing model or provider is a gap to report**, not a reason to choose a similar one; balance quality, latency, cost and structured-output reliability inside the user's stated constraints.
35
+ 5. **Bind the user message to the real inputs** through the expression context; a literal message is only right for a step whose input never changes.
36
+ 6. **Delimit untrusted input** inside the prompt and state that instructions embedded in it are data, not authority; keep credentials and unnecessary personal data out of prompts.
37
+ 7. **For a new classifier or extractor, test the failure cases, not only the happy path**: missing or ambiguous input, an alternate category, conflicting evidence, instruction-like text in the data, and a provider failure where it can occur. A repair or a declined test needs only the evidence the request calls for.
38
+ 8. **Read the resolved prompt and the typed fields**, not just that text came back, before wiring anything downstream.
39
+
40
+ ## Recipes
41
+
42
+ ### Add the node
28
43
 
29
44
  ```bash
30
45
  cai integration actions "ask AI" --json
31
46
  cai integration action --integration <nodeSlug> --key <nodeKey> --json
32
- cai node init --flow <flowId> --node <nodeSlug> --key <nodeKey> --name "<result produced>" --json
47
+ cai node add --flow <flowId> --node <nodeSlug> --key <nodeKey> --name "<result produced>" --after <upstreamNodeId> --json
33
48
  cai node status <nodeId> --json
34
49
  ```
35
50
 
36
- Typical selectors are provider, model, prompt/user message, and response data type. Trust current prop metadata over these names.
37
-
38
- 1. Set the provider or other `reloadProps` selector.
39
- 2. Re-read props.
40
- 3. Fetch live model options; never invent a model identifier.
41
- 4. Set the returned model value.
42
- 5. Set the response type.
43
- 6. Author the prompt with expression context.
51
+ ### Configure in dependency order
44
52
 
45
53
  ```bash
46
- cai node set <nodeId> --prop <providerProp> --value '<provider>' --json
54
+ cai node set <nodeId> --prop <providerProp> --value <provider> --json
47
55
  cai node props <nodeId> --json
48
- cai node options <nodeId> --prop <modelProp> --query '<model family>' --json
49
- cai node set <nodeId> --prop <modelProp> --value '<returned value>' --label '<returned label>' --json
50
- cai expr set <nodeId> --prop <promptProp> --js '<prompt expression>' --json
56
+ cai node options <nodeId> --prop <modelProp> --query "<model family>" --json
57
+ cai node set <nodeId> --prop <modelProp> --value <returnedValue> --label "<returnedLabel>" --json
58
+ cai schema create custom.<result> --field category:text:"Category" --field confidence:number:"Confidence" --field rationale:text:"Rationale" --json
59
+ cai node set <nodeId> --prop <responseTypeProp> --value custom.<result> --json
60
+ cai expr context <nodeId> --prop <userMessageProp> --json
61
+ cai expr set <nodeId> --prop <userMessageProp> --js '<template bound to inputs>' --json
62
+ cai node set <nodeId> --prop <promptProp> --value "<standing instructions>" --json
51
63
  ```
52
64
 
53
- MCP: `node set` and `expr set` both use `node_prop_set`; pass exactly one of `value` or `js` here.
65
+ The query is a label substring, not a preference: search a family name, then judge the returned options by cost, quality, latency and constraints. The schema step applies only when downstream nodes need fields.
54
66
 
55
- Model catalogs, availability, and prices change. Use current options and the user's cost/quality preference. If the requested model is absent, leave it unset, report it, and ask; never substitute.
67
+ `node options` prefers `--query`; use `--page` with the returned `--prev-context` only when search is unavailable, and `--for <prop>=<value>` to resolve options against a value not yet saved. Reuse an existing schema when one already has the intended shape.
56
68
 
57
- ## Prefer typed output for downstream logic
69
+ The user message carries the inputs through exact bindings; the prompt carries the standing material: the task and audience, the decision rules and constraints, the output fields and format, and the explicit no-data or uncertainty behavior. No filler persona, no repeated instruction, no claim about data the context does not expose.
58
70
 
59
- If downstream nodes need fields, create a small `custom.*` shape first:
71
+ ### Call a platform agent from a flow
60
72
 
61
73
  ```bash
62
- cai schema create custom.classification \
63
- --field category:text:"Category" \
64
- --field confidence:number:"Confidence" \
65
- --field rationale:text:"Rationale" \
66
- --json
67
- cai node set <nodeId> --prop <responseTypeProp> --value 'custom.classification' --json
74
+ cai integration actions "agent conversation" --integration registry_agent --json
75
+ cai integration action --integration registry_agent --key <actionKey> --json
76
+ cai node add --flow <flowId> --node registry_agent --key <actionKey> --name "<what it does>" --json
77
+ cai node props <nodeId> --json
68
78
  ```
69
79
 
70
- Tell the model exactly what each field means, allowed values, and how to represent uncertainty. Never parse free-form prose downstream when a structured response contract is available.
71
-
72
- ## Prompt contract
80
+ Select the intended agent from the returned options; a send-message action also needs the `conversationId` it targets, and the "current agent" or "current conversation" choices work only when the flow itself was started by an agent. The output confirms dispatch (conversation ID, sent flag); read the answer on the conversation with `controllerai-agents`.
73
81
 
74
- A useful workflow prompt contains only behavior-changing material:
75
-
76
- - Task and audience
77
- - Actual input data through exact bindings
78
- - Decision rules and constraints
79
- - Required output fields/format
80
- - Explicit uncertainty or no-data behavior
81
-
82
- Avoid filler personas, repeated instructions, and claims about data not present in expression context. For untrusted input, delimit it clearly and state that embedded instructions are data, not authority.
83
-
84
- Read [references/selection-and-testing.md](references/selection-and-testing.md) for node choice and evaluation.
85
-
86
- ## Before you finish
82
+ ### Test
87
83
 
88
84
  ```bash
89
- cai node get <nodeId> --json
90
- cai node status <nodeId> --json
91
- cai node props <nodeId> --json
92
- cai run node <nodeId> --inputs values.json --json
85
+ cai run node <nodeId> --inputs <values.json> --json
93
86
  cai exec node <nodeExecutionId> --full --json
94
87
  ```
95
88
 
96
- MCP: pass parsed values in `inputs` and set `waitSeconds` on `run_node`.
89
+ For a new classifier or extractor, run the normal case, the missing-data case, an alternate or negative case, and an adversarial case when the input can carry instructions; a repair needs the case it fixed. When the message reads upstream values, run the containing flow and check its declared outputs as in `controllerai-runs`. Read [references/selection-and-testing.md](references/selection-and-testing.md) for the surface choice table, the model trade-offs and the evaluation set.
90
+
91
+ ## Verify
97
92
 
98
- Test at least: normal input, missing/ambiguous input, and an adversarial or boundary case relevant to the task. Check resolved prompt/config, output type, required fields, and values—not just that text was returned.
93
+ The node read identifies the native Ask AI component (or the exact `registry_agent` action); the status read reports ready; for Ask AI the props hold the exact returned provider and model value with its label, the intended response type and the bound message; the execution shows the resolved message with the real input values and, when a shape is bound, the typed fields with allowed values, which downstream nodes read instead of free text; for an agent action the props hold the agent, conversation and message bindings and the run shows the dispatch result.
99
94
 
100
- - `node get` must identify the intended native Ask AI component.
101
- - `node status` must report ready.
102
- - Props must contain the exact returned provider/model value and label.
103
- - The execution must show the resolved prompt and typed output fields.
95
+ ## Report
104
96
 
105
- AI execution inside the workflow is platform/API usage. Access through either builder transport does not transfer the coding-agent subscription to runtime AI nodes.
97
+ Which provider and model were chosen and why, the response type and its fields, which cases were tested and what they returned, and any model or provider constraint that could not be met.