8000 feat(automations): a decide node for judgement calls by adeelahmad · Pull Request #549 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): a decide node for judgement calls - #549

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-li6m25
Oct 18, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-li6m25

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: a decide node in an automation's workflow was refused when the workflow was saved, as coming soon; a judgement call ("Does this email need me today?") had to be a condition or switch on fields.

After: a decide node asks the decision model (Jev, then Laya, then the language model, as in Routine choices) a question with 2 to 10 options, and the run goes on along the port of the option it picked, or along unsure when it isn't sure enough (min_confidence, else decisions.act_above), when no decision or language model is set up, or when the budget's hard limit is reached. What it reads is the node's input template, rendered as prompts are with outside text marked, or the event's summary and its outside fields, marked. The answer is kept per activity and question for 7 days, so a retry or Try it of the same activity doesn't pay again; the call sits in the run's activity scope, so it shows in the ledger under the automation and the run and counts towards budgets. steps.<node id> gets {port, choice, confidence, sure}.

Workflow studio module M5, part 5 of 5 (plan section 5, M5 item 5). No model is called unless an automation has a decide node, and then only for activities that reach it.

How:

  • match.check_decide (the node's config: question, options, input, min_confidence), match.run_decide (the call through the decision layer inside activity.scope, the cache in automation_state, the port).
  • automation_nodes.py runs decide nodes and no longer refuses them; variables.py renders the node's input with untrusted marks.
  • README: the built list's automations bullet says a decision model can pick the branch and the studio line loses the decide node; a line under ## Unreleased in CHANGELOG.md; docs/automations.md The decide node.

Motivation and Context

Adeel asked for the agent to decide inside an automation, with the model only where it adds value and never paying twice.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: a working decide node with ports per option and unsure; merged on green CI.
  • Agents: the node is part of the workflow agents save over the API and MCP.
  • Zero setup: nothing to install; without a decision model it goes along unsure.
  • Fewest clicks: n/a, no UI here (the canvas is M11).
  • Configurable: no new settings; the threshold defaults to the existing decisions.act_above.
  • Light: one small decision call per activity that reaches the node, cached.
  • Private and secure: everything from outside Lens is marked as outside text (untrusted.wrap), so instructions in an email are read as content; the model sees what the automation's person may see.
  • Cost: decision models first; the call is in the activity ledger under the run, respects budget hard limits (unsure when spent) and is cached per activity and question.
  • User decides: a decide node was refused until now, so no saved workflow changes; the run acts only on an option the model is sure of, else unsure.
  • Upgrades: answers are rows in the existing automation_state table, no stored shape changes.
  • Honest: docs and README label it built; the ledger line shows the call.
  • Tests and docs: tests/domain/test_match_decide.py; docs/automations.md The decide node.
  • Open: n/a.
  • Reported in the project thread.
  • Reuse: the decision layer (decisions), activity.scope, untrusted.wrap, prompt rendering in variables.py.

Generated by Claude Code

A decide node in an automation's workflow asks the decision model which of its
options fits what came in, inside the run's activity scope, and the run goes on
along the chosen option's port or along unsure. Its input renders as prompts
do, with outside text marked; answers are kept per activity and question so
retries and dry runs don't pay twice; steps.<id> gets the decision.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb
@adeelahmad adeelahmad self-assigned this Oct 18, 2026
@adeelahmad
adeelahmad merged commit 8514219 into main Oct 18, 2026
11 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-li6m25 branch October 18, 2026 06:03
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.

2 participants

0