Problem
The keyword trigger for the workflow tool is so loose that merely talking about workflows, the repo, or a file named workflow.ts rewrites the user's message and forces a workflow invocation. This is hostile to natural language: questions about the tool are converted into executions of the tool without the user asking for it.
Repro Steps
- Ensure default settings (no
/workflows-trigger off) on QuintinShaw/pi-dynamic-workflows v2.13.2.
- Send any of these messages:
github.com/QuintinShaw/pi-dynamic-workflows
workflowRunner function
my-workflow-helper
Look at workflow.ts
the workflow tool engages any time
- Observe that the message is rewritten with a forcing directive (
You MUST handle this request by calling the tool named exactly workflow) and the workflow tool is invoked.
Expected vs Actual
Expected: The workflow tool should only run when the user explicitly asks for it, e.g. via /workflows run <prompt> or an explicit keyword like workflow: / run a workflow / backticks-wrapped workflow.
Actual: Any substring match for workflow (with only a / lookbehind exclusion) arms the trigger. URLs, camelCase identifiers, hyphenated identifiers, filenames, and plain English sentences all fire it.
Proposed Fix
- Slash-command-only by default: Make
/workflows run <prompt> the primary invocation path and change keywordTriggerEnabled default from true to false in src/workflow-editor.ts:563. Users who want keyword triggering can opt in with /workflows-trigger on.
- Narrow the default regex: If keyword triggering stays on by default, make the default
'workflow' regex use the same boundary matching as custom words ((?<![/A-Za-z0-9_-])workflow(?![A-Za-z0-9_-])) instead of the legacy substring (?<!\/)workflows?. Require the trigger word to be a standalone token, or only match workflow:, run a workflow, workflow_id, or backticks-wrapped workflow.
- Reduce self-priming in the tool description: Remove the 22 repetitions of
For workflow, in src/workflow-tool.ts:162-185 and replace them with neutral phrasing so the LLM is not primed to call the tool whenever it sees the word.
Environment
- Repository: QuintinShaw/pi-dynamic-workflows
- Version: v2.13.2 (local clone commit
2f28a74)
- Runtime: OMP (Oh My Pi)
- Settings:
model-tiers.json absent at session start (created later); keywordTriggerEnabled defaults to true
Related
Problem
The keyword trigger for the
workflowtool is so loose that merely talking about workflows, the repo, or a file namedworkflow.tsrewrites the user's message and forces a workflow invocation. This is hostile to natural language: questions about the tool are converted into executions of the tool without the user asking for it.Repro Steps
/workflows-trigger off) on QuintinShaw/pi-dynamic-workflows v2.13.2.github.com/QuintinShaw/pi-dynamic-workflowsworkflowRunner functionmy-workflow-helperLook at workflow.tsthe workflow tool engages any timeYou MUST handle this request by calling the tool named exactly workflow) and the workflow tool is invoked.Expected vs Actual
Expected: The workflow tool should only run when the user explicitly asks for it, e.g. via
/workflows run <prompt>or an explicit keyword likeworkflow:/run a workflow/ backticks-wrappedworkflow.Actual: Any substring match for
workflow(with only a/lookbehind exclusion) arms the trigger. URLs, camelCase identifiers, hyphenated identifiers, filenames, and plain English sentences all fire it.Proposed Fix
/workflows run <prompt>the primary invocation path and changekeywordTriggerEnableddefault fromtruetofalseinsrc/workflow-editor.ts:563. Users who want keyword triggering can opt in with/workflows-trigger on.'workflow'regex use the same boundary matching as custom words ((?<![/A-Za-z0-9_-])workflow(?![A-Za-z0-9_-])) instead of the legacy substring(?<!\/)workflows?. Require the trigger word to be a standalone token, or only matchworkflow:,run a workflow,workflow_id, or backticks-wrappedworkflow.For workflow,insrc/workflow-tool.ts:162-185and replace them with neutral phrasing so the LLM is not primed to call the tool whenever it sees the word.Environment
2f28a74)model-tiers.jsonabsent at session start (created later);keywordTriggerEnableddefaults totrueRelated