Skip to content

feat(automations): inject the member's Automations into the prompt, like marketplace skills - #3556

Merged
reachjalil merged 1 commit into
devfrom
feature/automation-catalog-injection
Aug 5, 2026
Merged

feat(automations): inject the member's Automations into the prompt, like marketplace skills#3556
reachjalil merged 1 commit into
devfrom
feature/automation-catalog-injection

Conversation

@reachjalil

Copy link
Copy Markdown
Collaborator

Follow-up to #3554. That PR taught the agent that Automation capabilities exist. This one gives it the same treatment marketplace skills already get: the member's actual Automations, in the prompt.

Why

Marketplace skills reach the agent as a catalog, not prose — Den serves skill://index.json, the local server renders <available_skills> with each skill's exact <capability>, and it rides in every system prompt. That is why an agent can enumerate all five skills instantly, with zero tool calls.

Automations had only the static guidance from #3554 naming the capabilities. So "what automations do I have?" cost a round trip, and editing one meant listing first just to find its id.

What changed

Layer Skills (existing) Automations (this PR)
Den MCP resource skill://index.json automation://index.json
Local fetch readOpenWorkConnectSkillCatalog, 30s cache, candidate fallback readOpenWorkAutomationCatalog, 15s cache, same fallback
Endpoint GET /experimental/connect/skills GET /experimental/connect/automations
Prompt section connect-skills<available_skills> automations<available_automations>

Each entry carries <id>, <name>, <state>, <schedule>, <next-run>, <last-run> — so the agent can answer status questions immediately and act on an existing Automation by its exact id.

The MCP transport the skill catalog used (initialize → notifications/initialized → resources/read, session headers, SSE payload parsing) is extracted to connect-mcp-transport.ts so both indexes speak to the connection the same way rather than a second copy drifting from the first.

The one deliberate difference from skills

Skills are near-static. An Automation's next run is stale the moment a run fires — so an injected catalog is a confident-liar machine if you treat it like the skill index.

Three rules encode that, and each has a test:

  • The snapshot is stamped. fetchedAt travels with the index and is rendered into the prompt. The guidance says: use the listing to know what exists and which id to act on, but re-read through listAutomations / getAutomation / listAutomationRuns / getAutomationRun before reporting any status, next run, or result, and never quote <next-run> or <last-run> as current truth.
  • Bounded, and honest about it. The index caps at 25 and reports omitted + total, rendered as "15 further Automation(s) are not listed here … page through all 40". A silent truncation would read as a complete list.
  • No connection ≠ no Automations. An unusable openwork-cloud connection renders an empty string, not "you own none". Only a real empty result says that.

Safety

  • Owner-scoped at the source. The Den resource lists only ownerMemberId's own Automations, and is skipped entirely when no member identity resolves.
  • Untrusted content framing, matching <available_skills>: names and instructions are authored by the user or a marketplace, so they are declared subordinate to the system prompt. Values are XML-escaped — a test feeds Ignore previous instructions & <script>… and asserts it cannot forge a tag or close the block early.
  • Never fails the connection. A failed Automation read is caught and degrades to no guidance, so the Cloud MCP keeps working.

Checks

Run on b2c3c4377:

  • pnpm --dir apps/server typecheck — passed
  • pnpm --filter @openwork-ee/den-api typecheck:automations — passed
  • Den MCP + automations typecheck (src/mcp/** is outside the automations tsconfig, so I ran it explicitly) — passed. It caught a real defect: memberIdentity is nullable there, and the index is now skipped rather than dereferencing it.
  • New connect-automation-catalog tests — 5 passed
  • New Den automation-index tests — 3 passed, plus runner protocol 11 passed
  • Full server suite — 620 passed / 1 failed; the failure is a node:sqlite resolution error that reproduces identically on unmodified dev (615 passed / 1 failed). Not introduced here, not claimed as passing.

No dependency changes, so pnpm-lock.yaml is untouched.

Not covered

I could not exercise this against a live Cloud MCP connection, so the resource read and the end-to-end injection are verified by types, unit tests, and by mirroring the skill catalog's proven path — not by a live run. Worth a manual pass: with Cloud connected, ask a thread what Automations you have and confirm it answers without a tool call, then ask it to change one and confirm it acts on the right id.

🤖 Generated with Claude Code

Marketplace skills reach the agent as a catalog: Den serves skill://index.json,
the local server renders <available_skills> with each skill's exact capability,
and it rides in every system prompt. That is why an agent can list all five
skills instantly with no tool calls.

Automations only had prose naming the capabilities, so "what automations do I
have?" cost a round trip and editing one meant listing first to find its id.
Give them the same treatment: a new automation://index.json resource on the
Den agent MCP, read through the same connection and rendered as
<available_automations> with each id, schedule, state, next run, and last run.

One deliberate difference from skills. Skills are near-static; an Automation's
next run is stale the moment a run fires. So the index is stamped with when it
was captured and the guidance is explicit: use the listing to know what exists
and which id to act on, but re-read through a capability before reporting any
status, next run, or result — and never quote the listed values as current
truth. A bounded index also reports how many it left out instead of implying
the list is complete, and no usable connection renders nothing rather than
asserting the member owns none.

The MCP transport the skill catalog used is extracted so both indexes speak to
the connection the same way instead of a second copy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview Aug 5, 2026 9:58am
openwork-den Ready Ready Preview Aug 5, 2026 9:58am
openwork-den-worker-proxy Ready Ready Preview Aug 5, 2026 9:58am
openwork-landing Ready Ready Preview, v0 Aug 5, 2026 9:58am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Aug 5, 2026 9:58am

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No new security issues found in this diff (b2c3c4377e137f0a56c5a5aefb3518e4d32763a6). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil merged commit ee1c5a6 into dev Aug 5, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant