Skip to content

feat(chat): run each shortcut from its own playbook and data plan (W2-09) - #1993

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/chat-shortcut-playbooks
Nov 2, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/chat-shortcut-playbooks

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Chat's / menu shortcuts (CHAT-08) now each run from a playbook of their own, behind CHAT_AGENTIC. A shortcut's run reads only the data its job needs. No migration: it writes chat_messages.shortcut_id (00417), which nothing wrote until now. Plan: Chat waves plan, W2-09. The owner approved the shortcut screens on 2026-11-02.

Playbooks

  • Seven hidden skills in skills/, marked metadata.hidden: "true": start, analyze, new-report, create, optimize, opportunities and audit.
  • Each one sets its allowed reads (metadata.reads), its default scope (the chat's brand; the page's date range or the last 30 days; the plan's platforms), its output, when to ask a question, and its next moves.
  • They pass the same format check, scan and CI as the library skills. library.json keeps them apart from the 21 skills (SHORTCUT_PLAYBOOKS). They are never listed, never offered to use_skill and never shown in the Skills group.
  • skills/README.md lists them.

The / menu

  • New shortcuts: /start (Get started), /optimize, /opportunities and /audit (Improve with audit), next to /analyze and /create.
  • "Create a report on" moves from /report to /new-report. /report stays the Weekly report skill (owner decision 13).
  • The list is in lib/chat/shortcuts.ts, shared by the browser and the server.

Sending a shortcut

  • The composer sends shortcutId with the message while the shortcut's first words stay in the box. If the person rewrites them, the id drops and the message runs as their own question, with every read. Retry keeps the id.
  • Chat Home: a "For you now" chip whose job is a shortcut's sends that shortcut's id. For example, What changed this week runs as /analyze.
  • The chips of the focus areas' seven skills now start with the skill's /name (for example "/questions …"), so the skill loads.

Running it on the server

  • The server never trusts the id as sent. messageShortcut keeps it only when the message still starts with the shortcut's first words, or is the chip's own text. A next move written by a tainted run never carries one.
  • The server writes chat_messages.shortcut_id.
  • The engine loads the playbook first, as one of the run's three skill bodies, with the step "Used shortcut: {title}".
  • The run gets only the reads in the playbook's data plan. Changes still go through their own cards: a playbook narrows what is read, never what may be changed.
  • When the plan leaves out one of those reads, the model gets one line telling it to say so, naming the plan, and to answer with what the plan includes.

Help: help/chat/chat.md (Shortcuts) and help/chat/skills.md are updated. Both stay approved: false.

Related issue

None. Chat waves plan, W2-09 (CHAT-08).

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

Unit tests:

  • shortcuts.test.ts, shortcut-playbooks.test.ts: when a message is still a shortcut's, the reads its run gets, and the plan line.
  • skills/library.test.ts: one playbook per shortcut, titled as the menu names it; MIT; metadata.reads names only read tools Chat has; never listed, offered or in the / menu.
  • engine.test.ts: the message keeps the shortcut, the playbook loads first, a read outside the data plan is refused, a Home chip's own words count, the playbook counts in the 3 bodies, nothing is kept with the new Chat off.
  • focus-home.test.ts, chat-composer.test.tsx, chat-home.test.tsx, chat-thread-view.test.tsx: the chips, the composer sending and dropping the id, Retry.

Manually (CHAT_AGENTIC=true, as the demo Admin, at /dashboard/chat):

  1. Type / in an empty box. Shortcuts lists /start Get started, /analyze Analyze, /new-report Reports, /create Create content, /optimize Optimize content, /opportunities Find opportunities and /audit Improve with audit. Skills follows, with /report as the Weekly report.
  2. Pick /analyze, finish the message ("Analyze our visibility this month") and send. The first step is "Used shortcut: Analyze". The run reads only tools listed in skills/analyze/SKILL.md. The message row has shortcut_id = 'analyze'.
  3. Pick /analyze again, change "Analyze" to "Tell me about" and send. There is no "Used shortcut" step, and shortcut_id is null.
  4. Retry the answer from step 2. It runs with the shortcut again.
  5. On Chat Home, with a focus picked, click What changed this week: it runs with "Used shortcut: Analyze". Buyer questions starts with /questions and shows "Used skill".

Screenshots: shown to the owner in a local preview and approved.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

CI passed on this branch (a3b3be5), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41411445729): schema is up to date; web format:check, lint, typecheck, all tests and yarn build pass; server lint, format:check and all tests pass.

🤖 Generated with Claude Code

…-09)

Each / menu shortcut (CHAT-08) now has a hidden playbook in skills/
(metadata.hidden: "true"): its allowed reads, default scope, output,
question rules and next moves, checked by the same format, scan and CI as
the library skills. The menu gains /start, /optimize, /opportunities and
/audit; "Create a report on" moves to /new-report, as /report is the
Weekly report skill's.

The composer sends shortcutId with the message while its trigger words
stay (rewritten, it drops), and keeps it on Retry. Home chips whose job
is a shortcut's send its id; chips for the focus areas' skills ask with
the skill's /name. The server takes the id only for a message that is
still that shortcut's, writes chat_messages.shortcut_id, loads the
playbook first as one of the run's three skill bodies, offers only the
reads in its data plan, and tells the model in one line what the plan
leaves out.

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

@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 bbb20ce into ansvisor:main Nov 2, 2026
6 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