Skip to content

feat(workflow-executor): add user context and date/time to AI prompts#1531

Merged
Scra3 merged 1 commit intofeat/prd-214-setup-workflow-executor-packagefrom
feat/workflow-executor-user-context-in-prompts
Apr 7, 2026
Merged

feat(workflow-executor): add user context and date/time to AI prompts#1531
Scra3 merged 1 commit intofeat/prd-214-setup-workflow-executor-packagefrom
feat/workflow-executor-user-context-in-prompts

Conversation

@Scra3
Copy link
Copy Markdown
Member

@Scra3 Scra3 commented Apr 3, 2026

Summary

Every AI call now includes a SystemMessage with user context and current date/time:

Current user: John Doe (john@example.com, id: 42)
Role: admin | Team: operations
Current date and time: 2026-04-03T12:34:56.789Z (UTC)

Added to all executors: condition, read-record, update-record, trigger-action, load-related-record, mcp, and record selection.

Why

  • AI can make date-aware decisions ("update last visit date")
  • AI knows who is executing the workflow (useful for user-specific logic)
  • Matches what the frontend provides to the AI

Test plan

  • yarn workspace @forestadmin/workflow-executor tsc --noEmit — compiles
  • yarn workspace @forestadmin/workflow-executor test — 427 tests pass

🤖 Generated with Claude Code

Note

Add user context and current UTC timestamp to AI prompts in workflow executors

  • Adds a new buildContextMessage() method to BaseStepExecutor that returns a SystemMessage containing the executing user's name, email, id, role, team, and current UTC timestamp in ISO format.
  • Prepends this context message to all LLM invocations across all step executor types: condition, load-related-record, MCP, read-record, trigger-record-action, and update-record.
  • Updates all corresponding executor tests to account for the additional leading SystemMessage.

Macroscope summarized 0fe5ea4.

@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 3, 2026

2 new issues

Tool Category Rule Count
qlty Duplication Found 17 lines of similar code in 2 locations (mass = 97) 2

Every AI call now includes a SystemMessage with:
- User info: name, email, id, role, team
- Current date and time in UTC (ISO 8601)

This gives the AI better context for decisions like date-aware
field updates or user-specific actions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Scra3 Scra3 force-pushed the feat/workflow-executor-user-context-in-prompts branch from 62962b9 to 0fe5ea4 Compare April 3, 2026 14:40
@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 3, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/executors/base-step-executor.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@Scra3 Scra3 merged commit 22450d1 into feat/prd-214-setup-workflow-executor-package Apr 7, 2026
56 of 57 checks passed
@Scra3 Scra3 deleted the feat/workflow-executor-user-context-in-prompts branch April 7, 2026 08:04
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