8000 feat(timeline): the agent answers when tagged in a comment by adeelahmad · Pull Request #622 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(timeline): the agent answers when tagged in a comment - #622

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

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

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: people and agents could react to and comment on timeline items (#570), but a comment was only read by other people. Asking the agent about an item meant leaving the feed for the Chat page and describing the item again.

After: a comment on the timeline, or on an asset's page, that tags @lens (or the assistant's own name from Settings → Chat rooms) gets the agent's answer as a comment by Lens on the same thread, marked with a sparkle, with its links clickable. The agent answers as the person who tagged it, with their namespaces and tools, in a conversation of theirs titled after the item (one per thread, so a later tag carries on in it, and they can continue on the Chat page). It reads the item and the comments on it so far as data. It only reads: every change it proposes becomes an approval, and the reply says "Waiting for approval in Lens: …" with the link. Without a model, or within a used-up namespace budget, the reply says so instead. Settings → AI assistant → Answer when tagged in a comment (ai.answer_comments, on) turns it off. The composer hints "ask @lens".

How: domain/comment_agent.py runs the assistant's existing tool loop (chat.tool_answer) with an actions_ai.Box (every change waits, as an automation's does), inside activity.scope so the ledger carries the calls against the conversation and the item's namespace, and writes the reply through comments.create(author="assistant"). The routes that create comments call comment_agent.wake, which answers on a thread of its own when the text tags the agent. comment rows gain author (assistant) and chat; Comment gains by_agent.

Motivation and Context

Step 4 of the activity stream design (thread above): tag the agent in a comment or task it directly from the feed, with consequential steps waiting for the user's pick. Follows #570 (reactions and comments), now merged.

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 as a fragment in changelog.d/ (comment-agent.md).

Done questions (AGENTS.md)

  • Goal: the agent can be asked about, or tasked from, any item in the feed without leaving it; merged on green CI.
  • Agents: an agent commenting over MCP (comment_on_activity) or the API with @lens in the text gets the same answer, as the person its token acts for, and reads it with activity_comments.
  • Zero setup: works once a model is set up (as chat does); nothing else to configure.
  • Fewest clicks: type @lens … in the comment box and press Enter; the reply appears in the thread.
  • Configurable: ai.answer_comments is a switch under Settings → AI assistant, on by default, not in the setup wizard.
  • Light: no model call until someone tags the agent; the match is a regex on the comment's text.
  • Private and secure: the agent runs as the person who tagged it, with their reads and approvals only; the reply follows the comment's audience; the item's outside text and the comments are marked as data (N-PROMPT); every change waits for approval (P-APPROVAL). No new entry in the threat model: it is the chat assistant's own surface, started from a comment by a signed-in member, as a chat room message starts it.
  • Cost: every model call is in the activity ledger against the person's conversation and the item's namespace; a used-up budget stops it before it starts and the reply says so.
  • User decides: the agent only reads; every change is an approval the person decides; nothing acts without a tag; existing defaults unchanged.
  • Upgrades: two new optional fields on comment (author, chat), DEFINE ... IF NOT EXISTS; no migration.
  • Honest: docs/timeline.md's status table moves "Tagging the agent in a comment" to built; the README's built line names it; refine-later items are listed.
  • Tested and documented: test_comment_agent.py (2 tests, fake model with tool calls, approvals, ledger, budget, no model, off switch), jest timeline-social-model.test.ts; docs timeline.md, assistant.md, requirements.md, changelog.d; make openapi regenerated the client.
  • Open standards: the reply is a comment.added activity (AS2 Note with inReplyTo) by lens:assistant; no new dependency.
  • Reported: result goes back in the thread; refine later: excerpts opening at their moment, tagging a namespace's own assistant by name.
  • Reuse: chat.tool_answer, actions_ai.Box and _context, activity.scope, bridge._web_line/sources/safe_links, comments.create; no new loop or prompt machinery.

Local CI (ci/local-ci.sh) on this head: FastAPI embedded and server, Next.js, pre-commit, PR title and upgrade all pass.


Generated by Claude Code

A comment on the timeline or on an asset that tags @lens (or the
assistant's own name) gets the agent's answer as a comment by Lens on
the same thread. It answers as the person who tagged it, with their
tools, in a conversation of theirs titled after the item (one per
thread); every change it proposes waits for their approval and the reply
links where to decide. Its model calls run in the ledger against that
conversation and the item's namespace, and without a model or within a
used-up budget the reply says so. Settings › AI assistant › Answer when
tagged in a comment (ai.answer_comments, on) turns it off.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ln25ykE6uBDqx21WBU94SX
@adeelahmad
adeelahmad merged commit ff3cc69 into main Oct 18, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-pf8kii branch October 18, 2026 15:07
adeelahmad pushed a commit that referenced this pull request Oct 18, 2026
#622 added ai.answer_comments; the Kokoro test's view left it out, so the
AI section saved it too and the test saw two saves instead of one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3
adeelahmad pushed a commit that referenced this pull request Oct 18, 2026
…swers setting

#622 added ai.answer_comments after #538's test was written, so the test's view
lacked it and Save also saved the AI section, failing on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
adeelahmad pushed a commit that referenced this pull request Oct 18, 2026
#622 added ai.answer_comments (answer when tagged in a comment) after #538
wrote the Kokoro settings test's view of the section, so Save sent an ai
update beside the voice one and main's Next.js check went red at 2deac7a.
The fixture names the default, the same line #621 and #624 carry.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NY27LFMbLezbvQQQeHT19a
adeelahmad pushed a commit that referenced this pull request Oct 18, 2026
#622 added ai.answer_comments; without it in the fixture the AI section saved too, so updateSettings was called twice and main's Next.js job went red.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTrHPwWHtEvFJFq3M1YpH4
adeelahmad added a commit that referenced this pull request Oct 18, 2026
* feat(scaling): add providers and make groups in Settings

Settings › Auto scaling lists the providers with their last check in
words, Check again, and Remove with Undo (the delete waits a few seconds,
or runs as the page is left, since sealed credentials can't be put back).
Add a provider picks a driver and fills a form drawn from its fields:
defaults filled, the name focused, secrets as password fields sent in
`secrets`, lists one per line or ticked from their options, Enter saves,
and the driver's extra and licence named; a failed check is shown in
words. New group on a provider asks for a name, min, max, a budget only
when the driver is priced, and the driver's template; rules stay with
the assistant, MCP and the API for now.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3

* test(voice): the Kokoro settings test sets the comment answers default

#622 added ai.answer_comments; the Kokoro test's view left it out, so the
AI section saved it too and the test saw two saves instead of one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
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