From 248cbc320bec7fc5fd67e9778247c37c8f6c4699 Mon Sep 17 00:00:00 2001 From: Jerel John Velarde Date: Tue, 29 Sep 2026 16:24:20 -0700 Subject: [PATCH] Add per-Dot Automatic Learning and published skill delivery --- docs/SETUP.md | 45 ++++++++ src/client/WorkspaceDialog.tsx | 58 ++++++++++ src/server/dot-agent.ts | 20 +++- src/server/learning.ts | 35 ++++++ src/server/platform.ts | 5 + src/server/workspace-routes.ts | 44 ++++++++ src/server/workspace.ts | 61 +++++++++-- src/shared/learning.ts | 22 ++++ src/shared/types.ts | 4 + tests/dot-agent-channel.test.ts | 63 +++++++++++ tests/fixtures/README.md | 7 ++ tests/fixtures/learning-skills.zip | Bin 0 -> 646 bytes tests/learning-delivery.test.ts | 146 +++++++++++++++++++++++++ tests/learning.test.ts | 166 +++++++++++++++++++++++++++++ tests/page-routes.test.ts | 54 ++++++++++ 15 files changed, 722 insertions(+), 8 deletions(-) create mode 100644 src/server/learning.ts create mode 100644 src/shared/learning.ts create mode 100644 tests/fixtures/README.md create mode 100644 tests/fixtures/learning-skills.zip create mode 100644 tests/learning-delivery.test.ts create mode 100644 tests/learning.test.ts diff --git a/docs/SETUP.md b/docs/SETUP.md index 1241380b..645c2cfb 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -130,6 +130,51 @@ docker compose down For remote hosting, configure an HTTPS reverse proxy and the matching `APP_ORIGIN`. See [Security](../SECURITY.md) for the template's deployment boundary. +## Automatic Learning + +OpenDots connects [CopilotKit Automatic Learning](https://docs.copilotkit.ai/learning) +to individual Dots. It uses the existing server-side `INTELLIGENCE_API_KEY` and +optional `INTELLIGENCE_API_URL`; no additional model key or frontend key is needed. + +1. Open **Learning** in the same Intelligence project and create a container for + one focused workflow, such as `research-workflow`. IDs use 1–64 lowercase + letters, numbers, and single hyphens. +2. In OpenDots, edit the Dot and enter that ID under **Automatic Learning**. + Saving the ID configures routing; it does not create or verify the remote container. +3. Start new conversations and complete related workflows. Each conversation keeps + the container assigned when it was created. Existing conversations, including + ones created before this integration, are not enrolled retroactively. Changing + or clearing the Dot's ID affects only new conversations. This applies to page + chat, scheduled and voice compute in those conversations, and new Slack threads. +4. In Intelligence, inspect the evidence, run Learning manually or use its schedule, + and review and publish proposed skills. The default automatic threshold is 15 + eligible threads; use the readiness count shown in your deployment. +5. Enable **Skill delivery** on the Intelligence container, then enable **Use + published skills** in the Dot's settings. Start a new turn in an enrolled + conversation. The native BuiltInAgent integration loads the latest published + catalog and exposes `copilotkit_load_skill` and `copilotkit_read_skill_file`. + The model decides which relevant skills to load. Check the run's tool calls to + verify actual use; saving settings alone does not establish connectivity. + +Skill delivery always uses the conversation's original container, even after the +Dot is pointed at another container. The Dot's delivery checkbox applies to all its +conversations. Unchecking it stops delivery on subsequent turns; changing Learning +settings also stops active work. Conversations without a container do not request +skills. Existing research, memory, page, and computer permissions still apply. + +Ingestion and delivery are separate. Clearing the container does not unenroll older +conversations; pause Learning in Intelligence to stop its analysis. Turning off +delivery does not stop evidence collection. A delivery denial or an unavailable +initial skill snapshot fails the turn rather than silently continuing without the +configured skills. Restore delivery or uncheck **Use published skills** to continue +without them. Skills require review and publication in Intelligence; OpenDots does +not automatically approve them. + +The integration uses an explicit container list, so ambient +`CPK_INTELLIGENCE_LEARNING_CONTAINER_ID` and `CPK_INTELLIGENCE_SKILLS_REVISION` +variables do not override a conversation's configuration. Self-hosted Intelligence +must support the [skill delivery endpoints](https://docs.copilotkit.ai/intelligence/learned-skills). + ## Development checks ```sh diff --git a/src/client/WorkspaceDialog.tsx b/src/client/WorkspaceDialog.tsx index 7106aeda..234fa4d2 100644 --- a/src/client/WorkspaceDialog.tsx +++ b/src/client/WorkspaceDialog.tsx @@ -47,6 +47,12 @@ export function WorkspaceDialog({ dialog.type === 'dot' ? (dialog.dot?.spaceId ?? dialog.spaceId) : '', ); const [interval, setInterval] = useState('86400'); + const [learningContainer, setLearningContainer] = useState( + dialog.type === 'dot' ? (dialog.dot?.learningContainerId ?? '') : '', + ); + const [skillDelivery, setSkillDelivery] = useState( + dialog.type === 'dot' ? (dialog.dot?.skillDeliveryEnabled ?? false) : false, + ); const [busy, setBusy] = useState(false); const [error, setError] = useState(''); const container = useRef(null); @@ -134,6 +140,8 @@ export function WorkspaceDialog({ instructions: text, researchAllowed: research, memoryAllowed: memory, + learningContainerId: learningContainer.trim() || null, + skillDeliveryEnabled: skillDelivery, }; } if (dialog.type === 'settings') { @@ -279,6 +287,56 @@ export function WorkspaceDialog({ )} + {dialog.type === 'dot' && ( +
+ Automatic Learning + + { + setLearningContainer(event.target.value); + if (!event.target.value.trim()) setSkillDelivery(false); + }} + /> +

+ Create this container in your Intelligence project first. New + conversations will contribute evidence to it. Leave blank to + keep new conversations out of Learning. Existing conversations + retain their original assignment. +

+ + + Set up Learning and review skills ↗ + +
+ )} {dialog.type === 'schedule' && ( <>