Commit fa0370e
refactor(ai): skills-only AI surface — real Actions instead of 10 fictional tools, retire the two agents (#512)
* refactor(ai): skills-only AI surface — real Actions instead of 10 fictional tools, retire the two agents (objectstack#3820, ADR-0109)
HotCRM was the corpus that motivated objectstack#3820: 6 skills declaring
16 tool references, of which 10 named tools that exist nowhere. The
copilot's instructions therefore claimed abilities it did not have — the
runtime silently drops an unresolved tool, so the model improvised or
failed when asked to use one. Every instance passed `objectstack
validate` and `lint` cleanly.
The fix is mostly deletion, because the references were a category error:
"analyze the pipeline", "generate email copy", "score this lead" are
REASONING, not tools. What actually needed a tool was the handful of
steps that change state — and those already exist as HotCRM Actions,
reachable through the `action_<name>` tools the runtime materialises from
them (ADR-0109's default path: no tool records to author).
- case_triage: `triage_case` → the priority rubric moves into
instructions; `action_escalate_case` / `action_close_case` do the work.
Also repoints the hand-off that named `response_drafting`, a skill that
never existed (the audit's "hand-off to a nonexistent skill"), at the
real `email_drafting`.
- email_drafting: 4 fictional copy tools → the model writes the copy;
`action_send_email` sends it, so recipient resolution, permissions and
audit match the UI path.
- lead_qualification: `analyze_lead` / `suggest_next_action` → BANT
reasoning in instructions over `get_record`; `action_convert_lead` /
`action_schedule_followup` act, and conversion requires confirmation.
- revenue_forecasting: 3 fictional analytics tools → `aggregate_data` /
`query_records` / `visualize_data` with the actual forecasting method
spelled out in instructions.
- live_data, customer_360: already correct, untouched but for prose.
The two agents (`sales_copilot`, `service_copilot`) are DELETED. ADR-0063
§2 closed `*.agent.ts` to third parties and cloud#904 made the runtime
refuse non-platform agent records, so they were unreachable metadata —
carrying them is the ADR-0078 lie. The capability lives in the skills,
which attach to the platform assistant by surface affinity.
Verified with the merged reference-integrity rule
(objectstack#3885 `validate-ai-tool-references`): 22 tool references, 0
findings — was 16 references with 10 dead. typecheck, `objectstack
validate`, and the 67-test suite pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHjroNkLkajskKbJaidko4
* fix(ai): only reference Actions that actually materialise as tools (ADR-0011)
Follow-up to the skills rewrite in this PR. The first pass routed state
changes through `action_escalate_case` / `action_close_case` /
`action_send_email` — but the runtime materialises `action_<name>` ONLY
for an Action that opts in (`ai.exposed` + `ai.description`) AND has a
headless path. All three are `type: 'modal'`: they collect a reason /
resolution / final copy from a person, so they are UI-only and no tool is
ever generated. Referencing them would have re-created the bug this PR
fixes, one layer down.
- `convert_lead` and `schedule_followup` are flow-typed with targets, so
they only needed the opt-in: both now carry `ai.exposed` + an
LLM-facing description. `convert_lead` keeps its `confirmText`, which
the runtime reads as approval-required — an agent invocation lands in
the HITL queue instead of converting a lead unattended, which is what
we want for an irreversible outcome.
- `case_triage` and `email_drafting` no longer claim to act. They read,
reason, and hand a ready-to-paste `reason` / `resolution` / draft to
the user, pointing at the Escalate / Close / Send Email button. The
instructions say plainly that the assistant cannot press it — a modal
Action staying human-driven is the right shape for these, not a gap.
Re-verified with the corrected rule (objectstack#3894, which now models
AI exposure): 19 tool references, 0 findings. Both directions hold — the
two opted-in flow Actions resolve, the three modal ones would not.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHjroNkLkajskKbJaidko4
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a257433 commit fa0370e
12 files changed
Lines changed: 160 additions & 144 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
29 | 40 | | |
30 | 41 | | |
31 | 42 | | |
| |||
56 | 67 | | |
57 | 68 | | |
58 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
59 | 77 | | |
60 | 78 | | |
61 | 79 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
5 | 20 | | |
6 | 21 | | |
7 | 22 | | |
8 | | - | |
| 23 | + | |
9 | 24 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 25 | + | |
17 | 26 | | |
18 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
19 | 47 | | |
20 | 48 | | |
21 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
5 | 15 | | |
6 | 16 | | |
7 | 17 | | |
8 | | - | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 21 | | |
19 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
20 | 39 | | |
21 | 40 | | |
22 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | | - | |
11 | | - | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
25 | 40 | | |
26 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
27 | 48 | | |
28 | 49 | | |
29 | 50 | | |
| |||
0 commit comments