Skip to content

feat(content): add Write this to opportunities, building the brief and then the page in one run (item 9) - #1954

Merged
gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/content-write-this
Nov 2, 2026
Merged

gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/content-write-this

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Customer priorities, item 9, part 1: Write this takes an opportunity to a page to review in one go. No migration.

Before, going from an opportunity to a draft written from a brief took six clicks: Generate Brief, Send to Editor, pick the Content Agent, Start, Build brief, Rewrite from brief.

What changes

  • Where: a row's … menu ("Write this · Brief and draft in one go") and the opportunity panel's main button, next to Send to Editor.

  • The dialog says what happens:

    1. the brief, from the opportunity's prompts, their fan-outs and the pages AI cites for them;
    2. the page written from it, or, for an opportunity on a page you have, suggestions on that page;
    3. you review it; nothing is published.

    It shows about how much of the month's AI usage it takes and how much is used. The estimate comes from the server as a share of the plan's budget (ai-estimates.js); dollars stay on the server.

  • One run: the draft starts as Start opens it. The Content Agent builds the brief (the editor's Build brief, holding the draft's claim, so Stop lets go of it), then writes from it. A brief that can't be built leaves the page written from what there is.

  • Editor: the wait screen shows the brief's run first ("Content Agent is building this page's brief").

  • The read-only and AI-limit gates are today's.

  • Help: opportunity details and content opportunities.

Related issue

None. Customer priorities plan, item 9 (owner decision 2026-11-01).

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Content › Opportunities: open a row's … menu › Write this. The dialog lists the three steps and the AI share.
  2. Write this: the editor opens on the agent at work, the brief first, then the page.
  3. On an opportunity for an existing page, step 2 names the page, and the agent leaves suggestions on it.
  4. Unit tests: content-writer (brief then page, kept brief, failed brief, Stop), ai-estimates, plan-guard AI usage, billing route, the dialog, the menu, the panel, the editor's wait screen.

Checked in the browser at 1024px, light and dark, end to end on the dev database, with the agent's start answered by a local stand-in (no AI call). The owner approved the screens.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (0 errors; 7 old warnings in files this PR doesn't touch)
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

Full checks: CI passed on this PR (acf51aa): schema is up to date; web format:check, lint, typecheck, tests and yarn build pass; server lint, format:check and tests pass.

🤖 Generated with Claude Code

…d then the page in one run (item 9)

Customer priorities item 9: an opportunity to a draft written from a brief
took six clicks. Write this, in a row's menu and as the panel's main
button, does it in one: a dialog says what happens and about how much of
the month's AI usage it takes, then the draft starts as Start opens it
and the Content Agent builds its brief (the editor's Build brief, holding
the draft's claim so Stop lets go of it) and writes the page from it, or
suggests changes to the existing page an opportunity names. A brief that
can't be built leaves the page written from what there is.

The AI usage answer adds what Write this typically takes, as a share of
the budget (ai-estimates.js); the editor's wait screen shows the brief's
run first. Help: opportunity details and content opportunities.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	web/src/lib/help/approved-articles.json
@gkhngyk

gkhngyk commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This reformats the generated web/src/lib/help/approved-articles.json (inline arrays, ~300 lines), which conflicts with main and would fail search.test.ts, since that test compares the file byte for byte against JSON.stringify(index, null, 2). Please regenerate the file instead of formatting it, rebase on main and let CI run.

@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Fixed: web/src/lib/help/approved-articles.json is regenerated with yarn test -u src/lib/help, not formatted (no inline arrays in any of our branches now). Current main is merged in (no rebase), and PageType now comes from drafts after #1944. Type check and the related tests pass locally. CI on this PR is running now; I'll update the Full checks line when it's green.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gkhngyk
gkhngyk merged commit 88bc3d1 into ansvisor:main Nov 2, 2026
5 checks passed
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