8000 feat(automations): fire on any entity of a type, or names matching a pattern by adeelahmad · Pull Request #686 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): fire on any entity of a type, or names matching a pattern - #686

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn
Oct 19, 2026
Merged

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

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: an automation could fire on one named entity only, and a processed asset was tagged with just its ten most mentioned entities, with no entity type.

After: a trigger's where, an If and a condition node's tree can test what an activity mentions with the new mentions test. {"type": "PERSON"} fires on any person (the type or its label, in any case), {"name": "Acme*"} fires on names matching * and ? wildcards, and {"id": "lens:entity/9"} fires on one entity. A processed asset is now tagged with its fifty most mentioned entities, and every entity tag carries its entityType. Conditions saved before work as they did.

How: domain/match.py gains the mentions operator, with a wildcard matcher that runs in linear time. events_content.py tags up to fifty entities with their type. The MCP tool descriptions name the new test.

Motivation and Context

Item from the personal feature plan sheet (automations on entity mentions).

Screenshots (if appropriate):

n/a

Steps to reproduce (if appropriate):

Make an automation whose trigger is "asset processed" with where {"op": "mentions", "value": {"type": "PERSON"}}, then import a recording that names a person: the automation runs.

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 (tests/domain/test_automation_mentions.py).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/automations.md#operators).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. Written as changelog.d/automation-mentions.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI.
  • Agents: usable through the API, MCP or an assistant tool. Automations are written through the API and MCP, whose tool descriptions name mentions.
  • Zero s 8000 etup: no new prerequisite, .env edit or manual step.
  • Fewest clicks and keystrokes. One condition covers a whole type instead of one rule per entity.
  • Configurable: new settings in the web app with defaults; wizard asks only what is required. n/a: no settings.
  • Light: default install still runs on a Raspberry Pi with cloud models. Matching is linear-time string work; no model calls.
  • Private and secure: data local and encrypted, passkeys, threat model updated. No new surface; wildcard matching is linear, so a pattern can't stall the event loop.
  • Cost: cheapest path, model calls in the activity ledger, budgets respected. n/a: no model calls.
  • User decides: consequential or new actions wait for the user; defaults unchanged. Saved conditions behave as before.
  • Upgrades: existing installs upgrade safely (upgrade step for stored-data changes). Nothing stored changes shape; new activities carry more tags.
  • Honest: sources cited; labelled built, in progress or planned. README built list and docs/requirements.md name the checks.
  • Tests, docs and generated files updated (make openapi). No API shape change.
  • Open standards; dependencies keep Lens MIT. n/a: no dependencies.
  • Result reported with evidence; "refine later" items written down.
  • Reuse: existing Lens code and permissive libraries reused, nothing reinvented. Extends the existing condition matcher.

Local CI: the container runs several times slower than usual, so I ran the changed tests directly: all automation, events and MCP tests plus test_setup_assistant.py (139 passed), and ruff check and format are clean. GitHub CI decides the merge.


Generated by Claude Code

…pattern

A trigger's where, an If and a condition node's tree can test the entities
an activity mentions with the new `mentions` test: any entity of a type
(PERSON, or its label in any case), a name with * and ? wildcards matched
in linear time, or an id. A processed asset is now tagged with its fifty
most mentioned entities (as many as an activity holds) instead of ten, and
every entity tag carries its entityType. Conditions saved before pass as
they did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
@adeelahmad adeelahmad self-assigned this Oct 19, 2026
@adeelahmad
adeelahmad merged commit ffb9e96 into main Oct 19, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-xfmkzn branch October 19, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet
< 4ADC div class="discussion-sidebar-item js-discussion-sidebar-item js-socket-channel js-updatable-content" data-channel="eyJjIjoicHVsbF9yZXF1ZXN0OjQ5MjI1NTI1MDQiLCJ0IjoxNzk0MTE5NjAxfQ==--b6bcef5d82701e864ad819a5ba80eb0fd49d58063366c0a50f5a05fb944344b4" data-gid="PR_kwDOU0-AH88AAAABJWgwuA" data-url="/adeelahmad/lense/issues/686/show_partial?partial=issues%2Fsidebar%2Fshow%2Fprojects" data-channel-event-name="projects_updated" >

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0