Skip to content

Canvas: comment pins, designed reports, helpers and the /canvas page - #691

Draft
5hirish wants to merge 6 commits into
mainfrom
claude/eloquent-lamport-ah3fkb
Draft

5hirish wants to merge 6 commits into
mainfrom
claude/eloquent-lamport-ah3fkb

Conversation

@5hirish

@5hirish 5hirish commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Draft because: A to E are in; it waits on CI for the E commit (WebKit and the layout job could not run locally) and on your read of the per-message helper cap (below).

What and why

The plan (docs/engineering/2026-12-05-canvas-plan.md): one session writes the report, the fix and the post, and the person corrects any part by clicking on it. Five pieces, cheapest test first. The riskiest assumption is that people correct by pointing at all, so comments on reports ship first, in today's workspace, before any new screen.

A: comment pins on report blocks (367901f). In the SEO audit workspace, press Comment, click any part of the report, type, send. The comment reaches the agent with its address (which report, which part, the data that part draws from); the reply lands in the pin's thread and in the chat; a tick resolves it.

  • No new table: a comment is the user message with a pin beside it, a resolve is one pin_resolved event in agent_events.
  • The address is client-written, so every field is bounded and escaped before the model reads it (tested with a label that tries to close the tag).
  • The generic artifact write tools now refuse a run of an artifact, which they could rewrite past its schema.

Known limits of A, kept on purpose until real use says otherwise:

  • A comment sent while Duct is mid-answer may get its reply in the chat rather than the thread; the pin then stays "waiting" until the next turn.
  • Pins belong to one report version; another version shows its own.
  • The agent can answer a pin but not yet revise the report from it: that is B and C.

B: the agent designs a report from catalogue blocks (92d986a). When no shipped report answers the question ("Google Ads costs me $1,500 a month, when do I stop?"), the insights agent calls BuildReport. The report opens in the document pane, is versioned when revised, and takes comment pins from A.

  • The agent writes sections (one catalogue block each) and data. Duct builds the layout and derives the schema, reusing the shipped growth reports' $defs. The model never writes a layout or a schema.
  • Bad data comes back as the tool's answer (run/path: what is wrong); nothing is stored; the next call is the repair.
  • The row carries its layout and schema (meta.layout, meta.schema). Catalogue blocks only, no pages, so nothing runs as code.
  • lib/__fixtures__/designed-report.json is written by the backend builder; the backend fails when it is stale and vitest runs the app's validator on it.
  • PostHog: artifact_created with origin: runtime and attempts, for the first-try rate.

Known limits of B: Chromium only so far (not WebKit); the 80% first-try target needs the eval cases from #532; the Chart block only draws lines, so the catalogue offers no bar chart.

C: refresh a designed report every week (87782fc). The report the agent built gets a one-line bar: "Fresh numbers every Monday. [Refresh weekly]". One press makes a schedule; each Monday the same sections are filled for a window as long as the last one and stored as the next version. The Scheduled page shows it beside the plan schedules, and each run opens the version it stored.

  • No template editor: a designed report already is a template, since its sections are fixed and only the data moves. The sections now ride with the report (meta.sections).
  • The unattended run reuses the report run's contract and its one repair turn, held to the report's own schema. One that never fits stores nothing and shows "the new numbers did not fit the report".
  • The schedule names the report's group, checked at write time (a designed report, same project). A deleted report reads "Needs you".
  • PostHog: report_scheduled (app) and report_refreshed (backend).

Known limits of C: shipped reports have no "save as a copy" yet; a refresh that runs while the person is revising the same report in chat stores the old sections as the newest version; no conversation is left behind, so a failed refresh can't be inspected from the app.

D: helpers in the insights chat (b01c36c). The chat agent can now bring in helpers with Spawn: it names a helper, writes its task and picks what it may reach. Typical use: read Google Ads and Search Console side by side, then revise the report. Each helper is a row in the chat, and its own tool calls stream under it, indented.

  • No new agent type, page or route. Capabilities are names Duct maps to the chat's own tools: read_data, read_web, read_files, edit_report (pinned to one named report). A helper cannot ask, pause, propose, publish, remember or spawn.
  • At most four run at once. Helpers run in a clean context, so they never stream into the chat or write to its checkpoint; each model call is priced as subagent usage.
  • The $1 cap is per message the person sends, not per chat, because the runner is built per turn. A per-chat cap would mean summing the conversation's stored usage; say if you want it.

Known limits of D: the nested rows are live only (a reloaded chat shows the Spawn row and its answer); Draft text and Publish are not offered until a pause inside a helper is proven to come back through the chat; a retry notice inside a helper is not shown.

E: the canvas (f9c4155). /canvas, in the sidebar: one session's whole job on one page. The chat is on the left; on the right every report and brief the session wrote is a frame at reading size, and a report frame takes comment pins. Sessions sit in tabs, each marked when it is working or needs you.

  • It is the insights workspace with board set: one session hook, one chat, one set of events, no new agent and no backend route.
  • Tabs are the browser's (per project, at most eight); no table knows a tab exists. A blank tab creates nothing until the first message, only the tab on screen is mounted, and closing a tab never stops its run.
  • Shipped ahead of the plan's own gate. The plan held this screen until comment pins had four weeks of data; you chose to ship it now. The plan is updated: under 10% of report sessions with a comment after four weeks, on either surface, and /canvas comes out of the sidebar.
  • Events added for that read: canvas_session_started and canvas_session_opened (with tabs), surface on the comment events, and the backend's helper_finished (one per helper: capabilities, tool calls, cost, stopped by the cap; never its name or task).

Known limits of E: no posts on the board (a session cannot draft or publish yet); approval cards stay in the chat so their state has one copy; a run working on the canvas still pulses Home in the sidebar, not Canvas; the two new entries in design/tools/screens.mjs were not captured here (the tool timed out), though the same journey passes in the smoke test.

Area

  • Backend
  • App
  • CI / tooling / docs

Verification

backend: ruff clean; pytest 3,480 passed (one pre-existing, unrelated failure deselected:
         test_mcp_work_tools::test_an_image_without_a_key_declines_with_the_providers_that_would_work)
         dump_prompts --check up to date
app:     typecheck, vitest 756 passed, check:i18n, fill.py --check, check:parity, build: all pass
security: no critical findings

The /preview scenes site-health-report-pins, brief-designed-report, brief-designed-report-scheduled and activity-helpers were driven in Playwright at 1100px light and 390px dark: drop a pin, send, reply arrives, resolve; the designed report draws every section. No console errors. The runs found and fixed: the popover off-screen on a phone, pins styled like the report's ranked-fix badges, untitled parts labelled by raw id, a bar-chart option the Chart block cannot draw.

Translations for the new strings were written by hand through fill.py --provider manual, because the translation provider returned 401 here. Worth a native-speaker glance.

The agent smoke test (scripts/smoke-agent-workspaces.mjs) gained canvas steps and passes in Chromium: start from a blank tab, the "Needs you" mark, a second tab and back, answer, the brief on the board. The live page showed no horizontal overflow at 390, 820, 1100, 1440 and 2560px.

  • I read my own diff back looking for the reason to reject it

AI assistance

  • An AI coding agent wrote or substantially shaped this change

https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK


Generated by Claude Code

The canvas prototype argued for one session that writes the report, the
fix and the post, corrected by clicking on any part of it. This records
how it ships: five pieces with the cheapest test first. Comments on
reports go out in today's document pane before any new screen, because
the riskiest assumption is that people correct by pointing at all.

Also records what main already settled (the publish double-send and
scheduled proposals are fixed), the helper capabilities and limits,
the save-as-template lifecycle, and the estimated cost per question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK
Piece A of the canvas plan (docs/engineering/2026-12-05-canvas-plan.md).
In the SEO audit workspace a person presses Comment, clicks any part of
the report and types; the comment reaches the agent with its address
(artifact, block, the JSON Pointer the block draws from) so the model
answers about the exact data on screen.

Why no new table: a comment is the USER event with a `pin` beside its
content, the reply is the assistant rows after it, and a resolve is one
`pin_resolved` event. agent_events already records what was said; the
thread is read off the transcript on both sides (lib/pins.js), so the
reducer and a reload agree.

The address is client-written, so every field is bounded and escaped
before it reaches the model (agents/core/pins.py, with a test that a
label closing the tag stays text).

Also: the generic artifact write tools now refuse a run of an artifact,
which they could rewrite past its schema; a run is revised by the run
that made it.

Pins are drawn in ink, not orange, because the reports number their own
ranked fixes in orange circles. Translations for the 12 new strings were
written by hand through fill.py's manual path: the translation provider
returned 401 in this environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK
@5hirish 5hirish changed the title docs(canvas): plan for one session that does the whole job Canvas: plan and comment pins Dec 5, 2026
Piece B of the canvas plan. When no shipped report answers the person's
question, the insights agent can build one in the chat (BuildReport). The
report opens in the document pane, is versioned when revised, and takes
comment pins, so a comment on one section asks the agent to revise that
report.

Why the agent writes sections and data, never a layout or a schema: each
section is one catalogue block, and Duct builds the layout and derives the
schema from fixed per-block shapes (agents/artifacts/runtime.py). The
shared shapes are the shipped growth reports' own $defs, read from the
bundle, so they cannot drift from what the blocks draw. That leaves the
data as the only thing a model can get wrong, and the data goes through
the same two validators a shipped run does.

Why a tool, not a tagged payload: a refusal comes back as the tool's
answer, so the agent's next call is the repair turn, with no second repair
mechanism. A report that never fits is not stored.

The row carries its layout and schema (meta.layout, meta.schema) because
no build of the app has them. Only catalogue blocks and no pages of its
own, so nothing in it runs as code. A fixture written by the backend
builder holds the app's validator to the same verdict as the backend's.

The Chart block draws one line with its floor at zero, so the catalogue
offers no bar mark and refuses negative points.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK
@5hirish 5hirish changed the title Canvas: plan and comment pins Canvas: plan, comment pins, reports the agent designs Dec 5, 2026
A report the agent designed was a one-off: the person got the answer once
and had to ask again next week. Refresh weekly makes it a standing report
without a template editor, because the report already is one: its sections
are fixed, only the numbers move.

- The sections are kept with the report (meta.sections), so a refresh can
  fill the same ones again.
- A new schedule job, insights.refresh_report, runs the unattended report
  turn with the report's own sections and schema in the plan, last week's
  verdict for comparison, and a window as long as the last one. The run is
  held to the sections' schema (parse_designed_run), gets the one repair
  turn every report run gets, and is stored as the report's next version.
  One that never fits stores nothing.
- The schedule names the report's group, checked at write time to be a
  designed report in the same project. A deleted report says "Needs you".
- The Scheduled page words the new outcome, links a refresh to the stored
  version, and the report pane gets a one-line Refresh weekly bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK
@5hirish 5hirish changed the title Canvas: plan, comment pins, reports the agent designs Canvas: plan, comment pins, reports the agent designs and refreshes Dec 5, 2026
The insights chat can now bring in helpers for one part of a job: the
model names a helper, writes its task and picks capabilities (read_data,
read_web, read_files, edit_report). Duct maps the names to the chat's own
tools, so a helper never gets a tool the chat lacks, cannot ask, pause,
propose, publish, remember or spawn, and an edit_report helper is pinned
to the one report it was given.

At most four run at once, and the helpers started for one message stop at
$1 between them: each helper model call is priced and emitted as subagent
usage. The cap is per message because the runner is built per turn; a
per-chat cap would need the conversation's stored usage summed.

A helper runs in a clean LangChain context so it never streams into the
chat or writes to its checkpoint. Its tool calls are emitted as activity
rows under the Spawn row (parent_id) and drawn nested in the app. They are
live only: a reloaded chat shows the Spawn row and the answer.

Draft text and Publish are not offered: a pause raised inside a helper is
not yet proven to come back through the chat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK
@5hirish 5hirish changed the title Canvas: plan, comment pins, reports the agent designs and refreshes Canvas: comment pins, reports the agent designs and refreshes, helpers Dec 5, 2026
/canvas is the insights session with its right pane as a board: every
report and brief the session wrote is a frame at reading size, and a
report frame takes comment pins. It is InsightsWorkspace with `board`
set, so there is one session hook, one chat and one set of events.

Sessions sit in tabs. Which are open is the browser's (lib/canvasTabs.js,
per project, at most eight); no table knows a tab exists. A blank tab
creates nothing until the first message, only the tab on screen is
mounted, and closing a tab never stops its run. The other tabs' "Needs
you" and working marks come from the conversation list's run_status.

The plan held this screen until comment pins had four weeks of data. The
maintainer chose to ship it with A to D, so the same number now decides
whether it stays; the plan says so and lists what to read.

The events that read were missing: canvas_session_started and
canvas_session_opened (with how many tabs were open), `surface` on the
comment events, and the backend's helper_finished, one per helper with
counts only (capabilities, tool calls, cost, stopped by the cap).

Not on the board yet: posts (a session cannot draft or publish) and
approval cards, which stay in the chat so there is one copy of their
state.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbmWxEi25k3Xm3AMqNK
@5hirish 5hirish changed the title Canvas: comment pins, reports the agent designs and refreshes, helpers Canvas: comment pins, designed reports, helpers and the /canvas page Dec 5, 2026

This branch has not been deployed

No deployments
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