8000 feat(automations): what people say to Lens as chat.message activities by adeelahmad · Pull Request #448 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): what people say to Lens as chat.message activities - #448

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-cyhjct
Oct 16, 2026
Merged

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

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Description

Before: automations could not start from something a person said to Lens.

After: a new chat.message activity for each message a person says to Lens, in the web app or through a chat app (Telegram, Slack, Matterbridge). A web-app message is its person's alone (not even admins see it). A chat-app message belongs to the namespace its room answers in, else to the account the bot answers as. Messages Lens never stores (group chatter not addressed to it) never become activities. An automation's own question to its agent carries its origin and is left out, so an automation can't trigger itself.

How: a chat_messages source reads chat_message rows with role user by (created_at, id) over a new (role, created_at) index. Room chats now keep where they came from (chat.via), and chat.add takes an origin.

Motivation and Context

Workflow Studio M3 (plan section 3): chat as a trigger for automations.

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/api/test_chat_activities.py, embedded and SurrealDB server)
  • My change requires documentation updates, and I have updated docs/ accordingly. (docs/automations.md, docs/chat-rooms.md)
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. n/a: the title says it.

Done questions (AGENTS.md)

  • Goal: chat becomes a trigger source; merged on green CI.
  • Agents: read through the events API and MCP like every other kind.
  • Zero setup: nothing to install or configure.
  • Fewest clicks and keystrokes: n/a, no new UI.
  • Configurable: n/a, no new settings.
  • Light: reads rows Lens already keeps over an index; no new service.
  • Private and secure: web-app messages are visible only to their person; message text is marked untrusted; threat model chat row updated.
  • Cost: no model calls.
  • User decides: an activity only; nothing acts on it until a person builds an automation. Defaults unchanged.
  • Upgrades: one new index defined at start-up with IF NOT EXISTS; older rows without via or origin read as before. Safe to run twice.
  • Honest: docs label the kind built and list what to refine later.
  • Tests, docs and generated files updated (no API shape change, so no OpenAPI change).
  • Open standards: W3C Activity Streams 2.0; no new dependencies.
  • Result reported with evidence; "refine later" items in docs/automations.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QewNs6jxSB2vRoag2EvdyX


Generated by Claude Code

Messages Lens already keeps (chat_message with role user) are read by
(created_at, id) over a new (role, created_at) index. A web-app message is its
person's alone; a chat app's belongs to the namespace its room answers in,
else to the answering account. Room chats keep where they are (chat.via), and
an automation's own question to its agent is marked with its origin so it
never counts as a person's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QewNs6jxSB2vRoag2EvdyX
@adeelahmad
adeelahmad merged commit d539b74 into main Oct 16, 2026
11 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-cyhjct branch October 16, 2026 00:19
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