Skip to content

feat(chat): add the Ansvisor skills library, and load a skill by its /name or when Chat picks it (W2-04) - #1885

Merged
gkhngyk merged 6 commits into
ansvisor:mainfrom
cihan-gyk:feature/chat-w2-04-skills
Oct 31, 2026
Merged

gkhngyk merged 6 commits into
ansvisor:mainfrom
cihan-gyk:feature/chat-w2-04-skills

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Chat W2-04: the Ansvisor skills library (CHAT-13 items 3–5). It has the v2 mockup's fourteen skills, each a SKILL.md in skills/. Chat loads a skill when a person starts a message with its /name, or when Chat picks one itself. Behind CHAT_AGENTIC.

The library (skills/*/SKILL.md, web/src/lib/chat/skills/)

  • The fourteen skills, by the ids CHAT-21's agents use: winback, tasks, quality, faq, report, beat, refresh, publish, shopping, wrongclaim, answerfirst, facts, compare, translate. They use the mockup's titles and card lines.
  • Six reuse the earlier skill bodies. The nine earlier skills that map to none of the fourteen are removed.
  • Format: each skill is in the Agent Skills format, instructions only, with no references/ and no scripts.
  • How Chat reads them: library.json is generated from the files (yarn test -u src/lib/chat/skills) and is what Chat reads.
  • CI checks every skill (library.test.ts):
    • front matter: name = folder, description ≤ 1,024 characters, title, filters, license: MIT;
    • a body of at most 500 lines;
    • every snake_case tool name in backticks must be one of Chat's tools;
    • a scan of the raw text and the parsed front-matter values. It refuses emails, prices, tracking parameters, hidden characters, base64 blobs, secrets and text that tries to override Chat's rules, and a quoted escape can't hide them.
  • The front-matter reader is strict: metadata without a prototype, a space after each colon, no tabs or mixed indents.

In Chat (engine.ts, prompt.ts)

  • Picking skills: the prompt lists the enabled skills' names and descriptions. Starting a message with /name loads that skill; Chat can also pick one itself with use_skill. At most 3 skills load per run, and the prompt says when a /name wasn't loaded.
  • After outside text: once a run has read outside text (tainted), a skill the model picks isn't loaded. The person's own /name still is.
  • Showing it: a loaded skill shows as a step, Used skill: its title, with Ansvisor library under it. Later steps keep its text.
  • What a skill can't do: a skill shapes how Chat works, not what it may do. It adds no tools, skips no approval and publishes nothing. The role, plan and Chat settings still decide.
  • A message calls a skill only by the /commands it starts with, so a page path like "/faq" later in the text isn't one.

The / menu (composer-menus.tsx)

  • Skills group: a Skills group follows the shortcuts, filtered as you type by name, a part of it, or a title word.
  • /report: the /report skill takes the old /report shortcut's place.
  • Who sees it: Analysts and Agency partners have no / menu, but Chat still uses skills for them.
  • Placement: the /, @ and + menus now pick their side as they open, and again on resize. On Chat Home the box sits high, so the menu opens below instead of running off the top of the page. The active row stays in view as the arrows move it.

Help: new help/chat/skills.md ("Skills in Chat", approved: false), and help/chat/chat.md links it. skills/README.md:

  • lists the fourteen skills;
  • says how a Chat skill is added;
  • says outside skills come later through import, cleaned, scanned and approved by an Admin.

Copy: three card lines differ from the mockup on purpose, to say what Chat actually does. The owner approved them in the preview:

  • report: "…Ready to share with your team." (Chat doesn't email);
  • facts: "Checks every draft against your approved brand facts.";
  • publish: "Checks, page fields and a CMS draft. Going live is always your click."

Related issue

None. Chat Wave 2 (W2-04, CHAT-13).

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. With Chat on, open Chat Home and type /. The menu opens below the box: Shortcuts, then Skills with the fourteen skills.
    • Type /fa: only /faq is left.
    • ↑↓ keeps the active row in view; Enter puts /faq in the box.
  2. In a chat, type / at the bottom of the thread. The menu opens above the box.
  3. Send /faq for our pricing page. The steps show Used skill: FAQ from fan-outs and Ansvisor library.
  4. Run yarn vitest run src/lib/chat/skills src/lib/chat/engine.test.ts src/components/chat/composer.

Screenshots (1024px, light and dark) were reviewed in the preview by the owner.

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/

Checks:

Follow-ups, not in this PR

  • Browse all skills: the "Browse all skills" link and a Skills page wait for W3.
  • Outside skills: importing a skill (upload or GitHub link), with cleaning, a scan and Admin approval, is later.
  • One catalog: after feat(chat): create, edit and delete an agent in four steps (W2-15) #1869, agent-skills.ts (agent create) and this library should share one catalog of the skill ids.

🤖 Generated with Claude Code

cihan-gyk and others added 4 commits October 31, 2026 03:42
…ad a skill when Chat picks it (W2-04)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… skills (W2-04)

The library is now the v2 mockup's Ansvisor skills, by the ids CHAT-21's
agents use (winback, tasks, quality, faq, report, beat, refresh, publish,
shopping, wrongclaim, answerfirst, facts, compare, translate), with the
mockup's titles and card lines. Six reuse the earlier bodies; the nine
earlier skills that map to none are removed. A message calls a skill by
the /commands it starts with, so a page path like "/faq" later in the text
isn't one, and the /report skill takes the /report shortcut's place in the
/ menu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l name a skill writes (W2-04)

- The scan also reads the front matter's values once parsed, so a
  double-quoted escape can't hide an instruction, hidden character, email
  or price. The reader keeps metadata without a prototype, needs a space
  after each colon and refuses tabs and mixed indents.
- Every snake_case name in backticks must be one of Chat's tools.
- report, facts and publish describe what Chat does: no email, approved
  facts only, a CMS draft.
- A skill the model picks after the run read outside text isn't loaded;
  the person's /name still is. The prompt says a /name without a block
  wasn't loaded.
- skills/README.md says how a Chat skill is added, and that outside
  skills come later through import.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (W2-04)

On Chat Home the box sits high on the page, so the / menu with the
fourteen skills ran past the header. The /, @ and + menus now pick their
side as they open, and again when the window changes size: above when
their rows fit between the box and the nearest clipping box (the page's
scroll area under the header) or the window, else below when there's more
room there. Their height is the room on that side less the gap, at most
300px, and the active row stays in view as the arrows move it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ding outside text (W2-04)

A run started from a tainted run's next move starts tainted (fromTaintedMove):
its message is that model's text, so a leading /name in it is the model's
pick, not the person's. Such a run now loads no typed skill; the person's own
/name in the same chat still loads.
gkhngyk
gkhngyk previously approved these changes Oct 31, 2026

@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.

Looks good with 58b0371: one fix commit on this branch, described below.

The fix: a next move's /name isn't the person's (CHAT-20 §16a)

  • A run started from a next move that a run wrote after reading outside text starts tainted (fromTaintedMove), because its message is that model's text.
  • loadTypedSkills still loaded a leading /name in that message. So a move like /winback the two pages loaded a skill the model picked after outside text, which the PR's own rule refuses for use_skill.
  • Now a run that starts tainted loads no typed skill. The person's own /name in the same chat still loads.
  • Test: engine.test.ts › skills › "loads no /name from a move a run wrote after outside text". It fails without the fix.

What I checked

  • Where skills come from.
    • Only library.json, which is bundled at build time and kept in step with skills/*/SKILL.md by library.test.ts.
    • No path, URL or user-editable text reaches the prompt.
    • /name is matched against the library by exact name ([a-z0-9-]), so there's no path to traverse. An unknown name loads nothing.
    • No client component imports library.ts. A page gets names and titles only (skillMenuOf), never bodies.
  • What a skill can't do.
    • The bodies come after the core rules and the workspace block, in their own block that says they change no rule.
    • use_skill is handled before the tool registry and only loads library text.
    • The tools offered, the cards, the role matrix, the plan facts and the read-only and demo gates are unchanged. The "changes no rule" test compares the tool lists and checks that the card still waits.
    • A body can't name a tool Chat doesn't have, or carry override text, emails, prices or secrets (library.test.ts).
  • After outside text: pickSkill refuses once tainted is set. With the fix, a typed /name in a tainted next move is refused too.
  • Budget.
    • The list has the names and descriptions of up to 20 skills, inside the cached workspace block.
    • Up to 3 bodies a run, each about 2 KB, unmarked so the cache isn't broken by a mid-run load.
  • Skill text. I read all fourteen. They're public-safe: the only competitor name is a fictional example. They never publish, send or close anything, and they defer to "the app asks them first".
  • Flag off: no list, no tool, no body, no step, and an empty / menu (tested).
  • Embeds, migrations, read-only: no embeds, no migrations, no new write route or action.

Checks on this branch (based on main 703a68600, merges clean):

  • src/lib/chat, src/components/chat, the chat pages and plan-row.test.ts: 1,252 of 1,253 pass. The one failure is chat-menu.test.tsx's clock case, which this PR doesn't touch and #1876 fixes.
  • tsc, eslint (touched areas) and yarn format:check pass.

Follow-up (not blocking): a message that starts with a page path (/pricing needs an FAQ) has no skill block. The prompt then tells the model to say a /name wasn't loaded. Telling it so only for library names would avoid a confusing line.

@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.

Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.

@gkhngyk
gkhngyk merged commit f7a6591 into ansvisor:main Oct 31, 2026
4 of 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