Repository navigation
feat(chat): create a skill in Chat on an editable draft card (W3-08) - #2026
Merged
Merged
Conversation
…-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]>
…rt (W2-03)
Before work in several like parts (drafts, pages, tasks), the model calls
the engine's plan_parts with how many; the server counts how many the AI
limit left covers (fitChatUnits and POST /api/internal/chat/budget/fit,
each part one write step's worst case, an agent run's own cap included):
a count, never dollars.
All covered, the work goes on. None, the run pauses at the AI limit as
before. Some, a question card asks "Your remaining AI limit covers about
{k} of the {n} ...": Do the first {k} now (Recommended), Get more AI
credits (pauses at the limit) or Cancel (stops). With no one there (an
agent's or a scheduled run), the first {k} are done and filed and the run
stops at the AI limit as it ends. A skill's run is checked as it starts,
before anything is read. Nothing is checked on the workspace's own key.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…duled jobs Move the RRULE subset (DAILY/WEEKLY/MONTHLY on a zone's clock) from agent-schedule.ts to schedule/rule.ts, which agent-schedule.ts re-exports, and add nextJobRun for a chat_schedules row. Extract openHeadlessRun (headless-run.ts) from openAgentRun: the chat, the message, the answer, the Chat run and its state, written in the same order; agent runs use it unchanged. No behaviour change: the agent tests pass as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Chat's scheduled jobs (CHAT-12) now run by themselves, behind CHAT_AGENTIC. The server's minute cron calls the new /api/internal/chat/schedules/tick (CHAT_INTERNAL_SECRET) right after the agents' tick; it settles open runs, resumes jobs the AI limit paused and runs the due ones (schedule/worker.ts): - A due job is claimed by moving next_run_at (or retry_at) from what was read, so two workers run a slot once; chat_schedule_runs' unique slot and attempt is the backstop. A recurring slot over an hour late is skipped (no catch-up); a busy workspace waits for the next minute. - Each run re-checks its creator: Admin or Manager and the brand still theirs (else owner_role), brand there (missing_source), skill on (skill_off), AI limit (paused_cap, the job pauses at cap). A read-only workspace skips the slot; with Chat off nothing is touched. - The run opens in the job's own chat as its creator (openHeadlessRun), Queued then claimRunSlot, always Auto · Normal, with no session, so every change waits as a card. - A failed run retries once 10 minutes on; 3 failures in a row turn the job off. After the reset a cap-paused job goes on at its next slot. Engine (thin hooks): a job's own run is metered as feature 'schedule' with its scheduleId (budget.ts meteredAs; the server passes p_schedule_id), and a question in it takes the Recommended option and lists it at the top of the answer (schedule/unattended.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…API (W3-06)
A workspace's own skills (CHAT-13, chat_skills from 00458), behind
CHAT_AGENTIC, with no new screen:
- skills/store.ts: saving a skill made in Chat (Admins and Managers),
checked as its SKILL.md with checkSkillFile, never with an Ansvisor
skill's name, under the plan's My skills limit (trial 3, Starter 10,
Growth 50, Enterprise 200; none self-hosted). Approved, on and private
to its creator at once. Its checksum is of the file as stored.
- What a person may use (enabledSkillsFor): the library but for what the
workspace turned off (chat_settings.disabled_skills), then the approved
skills that are on and theirs or shared. The / menu reads the same
(skillMenuFor), so a saved skill shows there at once.
- Engine, a thin hook: a workspace skill's body is read from its row when
a run loads it, only while it matches its checksum (else it is switched
off). "Used skill" says where it comes from (Ansvisor library, You, Your
workspace, the repo owner). An imported skill taints the run (CHAT-20
§16a): a change shows its card even in Full auto, and its block is
marked as written outside the workspace.
- Agents: an agent whose skill is off, rejected, gone or changed is
refused on Activate/Resume/Run now, and a triggered one pauses with
skill_off. Workspace skills need no connection.
- Registry: save_skill (CHAT-20 §9 row 75: AskFA, Admins and Managers,
Undo 30 days by deleting it while private and unchanged), through the
saveChatSkill server action (assertWritable first).
- API: GET /api/chat/skills; PATCH and DELETE /api/chat/skills/{id} (an
Admin or the creator); POST /api/chat/skills/{id}/share (an Admin
shares and answers the requests; the creator asks the Admins through
chat_access_requests); PATCH /api/chat/skills/library/{name} (Admins).
Every write checks the plan first (writeRefusal).
- Help: skills.md gets "Save your own skill" (still unapproved).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…worker Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r off (W3-07)
Chat Wave 3 W3-07: /dashboard/chat/skills and a Skills item in the Chat
menu. Ansvisor skills and My skills in two tabs with their counts, search
and the library's filter chips. A card shows its /command, what it does
and the connections it uses on the brand open (green, or grey "not
connected"; Connect in place of Run when a Required one is missing), with
Run (a new chat with the skill), Schedule (Chat Home's box filled with
"Every Monday at 9:00, /{name} ", new ?compose=), Create agent and the
on/off switch for an Admin or the skill's creator. A workspace skill says
where it came from and its review; its details offer Share (or ask an
Admin) and Delete.
GET /api/chat/skills/connections reads the kinds a brand the person
reaches has connected. connectionKindOf moves into the pure
agent-skills.ts, and Chat Home's start of a chat into lib/chat/start-chat.ts,
shared with Run. Help: Skills in Chat, "The Skills page".
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ld for an Admin's review (W3-09a/b backend)
Chat Wave 3 W3-09a and W3-09b, without screens. lib/chat/skills/import.ts
reads an upload (a SKILL.md, or a .zip of the skill's folder, at most 5 MB)
as instructions only: the archive is checked from its central directory
before anything unpacks (size, file count, unpacked total, paths that leave
the folder, symlinks, archives inside, files that aren't text); its one
SKILL.md is kept, cleaned of allowed-tools and the front matter's other
fields, !command lines and HTML comments, and scripts, hooks and other
files are left out, each listed in words for the reviewer. Its license must
be MIT, Apache-2.0, BSD-2/3-Clause or ISC (front matter or LICENSE file).
A wrong form refuses it; what the scan blocks keeps it blocked.
lib/chat/skills/github.ts reads a public github.com folder at one commit
(the ref resolved to its SHA, the source pinned to it), from GitHub's own
hosts only, never following a redirect, with size limits; GITHUB_TOKEN,
when set, signs the API's requests.
store.ts: importSkill keeps it off, private and pending_review (Admins and
Managers, paid plans, under the My skills limit; a Manager's asks the
Admins), readSkillReview shows the cleaned file, scan, removed parts,
source and license to an Admin or its creator, and reviewSkill lets an
Admin approve it (on for its creator, if its checksum still matches) or
reject it; a blocked one is only rejected. skillFileText and skillChecksum
move to skill-file.ts, re-exported as before. Routes: POST
/api/chat/skills/import, GET and POST /api/chat/skills/{id}/review.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # web/src/lib/chat/skills/store.ts
…tore Co-Authored-By: Claude Opus 5.5 <[email protected]>
…W3-02)
- schedule/when.ts reads a date phrase on the person's clock: 09:00 for a
day with no time, working days only when said, ready by vs run at, the
RRULE subset for repeats (at most once a day), and ambiguous phrases
("next Friday", "the 31st") returned with their likely dates for a
question card. CHAT-12's acceptance examples are its tests.
- create_schedule registry row (Scheduling area, row 78): WRITE, Ask, a
card in every mode, Admins and Managers; its precheck refuses what
won't read, a skill that's off and a full plan (Trial 1 · Starter 5 ·
Growth 25 · Enterprise 100 active jobs; follow-up checks don't count).
It runs through a session server action and logs with a 30-day Undo
that deletes the job.
- A reusable editable approval card: ChatConfirm.form, FormCard and the
row hooks form/stepKind/doneStep. The Approve sends the edited values;
the server applies them and checks them against the row's schema
before the change runs. W3-08 and W3-12a reuse it.
- The schedule step shows "Scheduled: {title}" with when and where.
- The card's usage line comes from a new internal estimate route (the
workspace's average Chat run over 30 days, as a share; never dollars).
- Help article help/chat/scheduling.md (approved: false).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e-card # Conflicts: # server/src/routes/internal-chat-budget.js # server/src/routes/internal-chat-budget.test.js
The worker checked a job's /skill against the library alone, so a job on a workspace skill was turned off as skill_off, and a library skill the workspace turned off still ran. It now reads the creator's skills as a run does (enabledSkillsFor) and checks the skill's checksum. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A workspace skill could be saved as /analyze or another shortcut's command (W2-09), which would then mean two things. Saving refuses the seven shortcut names as it refuses the library's, and a skill that already has one stays out of the / menu and the run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
My skills' plan limit (Trial 3 / Starter 10 / Growth 50 / Enterprise 200) counted every skill row, so an import an Admin rejected kept taking a place. The count, and the list's "used", now leave rejected skills out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The layout now reads the / menu's skills from skills/store.ts, which
opens the admin client, so the test file failed to load ("supabaseUrl
is required"). The test stubs skillMenuFor as it stubs the other Chat
reads.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es it (W3-09 screens)
Chat Wave 3 W3-09a/b, the screens on top of their backend. Skills gets
New skill (Admins and Managers): Upload a SKILL.md or .zip, or Import from
GitHub, in a dialog that checks 5 MB before the upload goes and keeps the
API's refusal in its own words, then opens the skill's review.
The review page (/dashboard/chat/skills/{id}, mockup #s-skill-review)
shows the cleaned SKILL.md as plain text with each hidden character marked
by its code point (hidden-marks.ts, the scan's own HIDDEN), the safety
scan (Blocks it / Worth a look), what was removed before review and the
source (link, commit, license and its text). An Admin approves or rejects
it; a blocked skill says why it can't be approved; its creator sees that
an Admin reviews it. An import's card on My skills gets Review while it
isn't approved. Help: Skills in Chat, "Import a skill".
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…echnical (W3-07) The owner's review of the Skills page (2026-11-02): the Visibility chip reads Brand Visibility, as the sidebar names that area, beside Product Visibility, and a Technical chip lists the skills that fix the site itself: Site audit fixes, FAQ from fan-outs (FAQPage schema), AI shopping readiness (product pages and feed) and Ready to publish (page fields). Chips: All, Content, Brand Visibility, Product Visibility, Technical, Reports. library.json rebuilt from the SKILL.md files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
W3-06's final state (e90a0a2, with W3-01, W2-09 and W2-03). Chat Home's start of a chat, moved into lib/chat/start-chat.ts by W3-07, now carries W2-09's shortcut id; the Skills page's Run checks the read-only lock first, as Chat Home's shortcuts do (fix/chat-home-shortcuts-lock).
# Conflicts: # web/messages/en.json # web/src/lib/chat/engine.test.ts # web/src/lib/chat/registry/define-tool.ts # web/src/lib/chat/registry/tools.test.ts # web/src/lib/chat/registry/tools.ts # web/src/lib/chat/undo.ts
Chat Wave 3 W3-08, on W3-02's editable card. save_skill's card is the
skill's draft: its /name, title, what it does and its steps, each
editable, in every mode (alwaysCard: nothing is kept before Save), with
"Save skill". The card says why a /name can't be kept as the person types
(skill-name.ts: the format, and never an Ansvisor skill's or a shortcut's
name, reserved-names.ts) and save_skill's apply says it again on Save.
Done, the step reads "Saved skill: /{name}". "Create a skill that…" asks
at most two questions before the draft.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
New skill › Create in Chat opens Chat with "Create a skill that " in the box. The draft card's tests: its fields, notes, edited values and a refused /name (tools, engine), the card in every mode for Admins and Managers (write), the /name check (skill-name). The Chat pieces preview gets a "Skill draft" group: the draft, a reserved name, saved. Help's "Save your own skill" says how. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s card context needs (W3-08) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…first - The zip check and fflate could read different entries: the check counted the end record's total (+10) while fflate counts the entries on this disk (+8) and follows a ZIP64 locator. An archive is now refused when the two counts differ, when a ZIP64 locator sits before the end record, or when its entries don't fill the central directory exactly. While unpacking, only checked names inflate, each once, at the size checked, within MAX_UNPACKED in all. - The import route asks canImportSkill (role, read-only, trial) right after it knows the person, before it reads an upload or GitHub. - An import may not take a shortcut's name either (RESERVED_NAMES, as a skill saved in Chat). - Refusals instead of failed inserts: each line of the removed list is trimmed to 200 characters and a list too long for removed_json is refused; an empty LICENSE file is kept as no text; a GitHub link with a malformed % sequence is refused.
…heck hits
The fit check (fitChatUnits) took the smaller of what is left of the
month's AI limit and what an agent run's own cap leaves, but only returned
the count. The engine then paused every new cap path (a skill's run that
can't start, a job none of whose parts fit, Get more AI credits, and the
parts done with no one there) at the month's limit. For a triggered run
stopped by its own cap, the agent driver read capHit 'month' and paused
the whole agent until the month resets instead of ending the run as
"Stopped at its limit".
The server now returns which limit binds ('run' when the run's cap leaves
no more than the month, as reserveChatStep's run_cap), the route passes it
on, and the web client reads it (the month's when absent). The engine
pauses with that limit, keeping it on the parts card and on limitStop, as
modelStep already does for run_cap refusals.
…e input A one-time job that has run stays enabled with no next run, so it kept counting toward the plan's job limit: on a trial every later schedule was refused until the finished job was deleted. The limit now counts live jobs only, enabled with a next run or a retry still to come. The count and the insert were separate steps, so two creates at once could go one over the limit. After the insert the new job must be among the first `limit` live jobs, oldest first; otherwise it is deleted and the create is refused as quota_exceeded. Both racers see the same order, so exactly one of them keeps the last place. No schema change. createChatSchedule is a server action and can be called with anything. It now parses the job with the create_schedule tool's schema (moved to schedule/input.ts so the action and the tool share it) and the run's place with a small schema, refusing bad input as invalid before any check or write. The test fake's or() gains `column.not.op.value` terms.
8 of 13 tasks
gkhngyk
previously approved these changes
Nov 3, 2026
# Conflicts: # server/src/lib/chat-budget.js # server/src/lib/chat-budget.test.js # server/src/routes/internal-chat-budget.js # server/src/routes/internal-chat-budget.test.js # web/src/lib/chat/engine.test.ts # web/src/lib/chat/engine.ts
# Conflicts: # web/src/lib/chat/engine.test.ts
gkhngyk
previously approved these changes
Nov 3, 2026
# Conflicts: # help/chat/chat.md # server/src/lib/chat-budget.test.js # web/messages/en.json # web/src/lib/chat/budget.test.ts # web/src/lib/chat/engine.test.ts # web/src/lib/chat/engine.ts
# Conflicts: # help/chat/chat.md # web/messages/en.json # web/src/lib/chat/engine.ts # web/src/lib/chat/schedule/worker.test.ts # web/src/lib/chat/schedule/worker.ts
# Conflicts: # help/chat/chat.md # help/chat/skills.md # web/messages/en.json # web/src/lib/chat/agent-connections.ts # web/src/lib/chat/engine.ts # web/src/lib/chat/skills/store.ts # web/src/lib/help/approved-articles.json
The previous merge of main took the parent's last head as the common version, so main's newer additions (en.json keys, engine code) read as removed. This commit carries the tree of the merge redone against the version of the parent this PR was built on.
# Conflicts: # help/chat/skills.md # web/messages/en.json # web/src/components/chat/skills/chat-skills.test.tsx # web/src/components/chat/skills/chat-skills.tsx # web/src/lib/chat/engine.test.ts # web/src/lib/chat/engine.ts # web/src/lib/chat/registry/define-tool.ts # web/src/lib/chat/registry/tools.test.ts # web/src/lib/chat/registry/tools.ts # web/src/lib/chat/skills/api.ts # web/src/lib/chat/skills/store.ts # web/src/lib/chat/undo.ts # web/src/lib/chat/write.test.ts # web/src/lib/help/approved-articles.json
# Conflicts: # help/chat/chat.md # server/src/routes/internal-chat-budget.js # server/src/routes/internal-chat-budget.test.js # web/messages/en.json # web/src/lib/chat/engine.test.ts # web/src/lib/chat/engine.ts # web/src/lib/chat/registry/define-tool.ts # web/src/lib/chat/registry/tools.test.ts # web/src/lib/chat/registry/tools.ts # web/src/lib/chat/schedule/worker.test.ts # web/src/lib/chat/schedule/worker.ts # web/src/lib/chat/undo.ts
Contributor
|
This PR now conflicts with main: #2011 and #2014 were squash-merged, so its commits are on main under new hashes. Could you merge main into this branch (or rebase it onto main) and resolve the conflicts? Once CI is green I'll merge it. Stacked on it and needing the same, in order: #2027. Updating each after the one below it has merged keeps the conflicts small. |
…chat-skill-create # Conflicts: # web/messages/en.json # web/src/lib/chat/agent-connections.ts # web/src/lib/chat/engine.ts
…chat-skill-create # Conflicts: # web/messages/en.json
…chat-skill-create # Conflicts: # help/chat/chat.md # web/messages/en.json # web/src/lib/chat/agent-connections.ts # web/src/lib/chat/engine.ts
…chat-skill-create # Conflicts: # help/chat/chat.md # help/chat/skills.md # web/messages/en.json # web/src/lib/chat/agent-connections.ts # web/src/lib/chat/engine.test.ts # web/src/lib/chat/engine.ts # web/src/lib/chat/registry/define-tool.ts # web/src/lib/chat/registry/tools.test.ts # web/src/lib/chat/registry/tools.ts # web/src/lib/chat/undo.ts # web/src/lib/help/approved-articles.json
…chat-skill-create # Conflicts: # help/chat/skills.md # web/messages/en.json # web/src/components/chat/skills/chat-skills.test.tsx # web/src/components/chat/skills/chat-skills.tsx # web/src/lib/chat/engine.test.ts # web/src/lib/chat/engine.ts # web/src/lib/chat/registry/define-tool.ts # web/src/lib/chat/registry/tools.test.ts # web/src/lib/chat/registry/tools.ts # web/src/lib/chat/undo.ts # web/src/lib/help/approved-articles.json
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
previously approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chat Wave 3 W3-08: create a skill in Chat on an editable draft card. Stacked on #2014 (the editable form card) and #2011 (skill import, which is on #2005 and #2004). No migration. Screens: shown to the owner in a local preview.
The draft card (
registry/skill-tools.ts)save_skill's card is now the skill's draft, on W3-02'sFormCard. Each field can be edited before Save:applyreads the /name again and refuses a bad one in words. The store's own checks (scan, limits, roles) still run.The /name check (
skills/skill-name.ts,skills/reserved-names.ts)readSkillNamegives one problem: missing, wrong format, or reserved.library.json) or a shortcut's id. The store now uses the same set (RESERVED_SKILL_NAMES).form-assist.ts).Behavior change:
save_skillshows its card in every mode (flags.alwaysCard, default and max policyask). Before, Full auto saved a skill without a card unless outside text had shaped it. Now nothing is kept before Save, in Ask first, Auto and Full auto alike. With outside text, the decision's reason isalways_cardinstead oftainted; the card is the same.Starting it
save_skillwith a draft.composeHref).Preview:
/dashboard/chat/previewhas a "Skill draft" group: the draft, a reserved name (/winback), and saved.Help:
chat/skills.md, "Save your own skill" rewritten (Create in Chat, at most two questions, Save skill in every mode).Not in this PR: the "Save these steps as a skill" chip on a result card (W4-32, its own PR on this one).
Related issue
None. Chat Wave 3 plan, W3-08.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Unit tests:
skill-name.test.ts: format, length, reserved names.tools.test.ts("save_skill's draft card"): fields, notes,applywith edited values and a refused name, the done step.write.test.ts: the card in every mode for Admins and Managers; Analysts and Agency partners refused.engine.test.ts("the skill draft card"): Full auto waits for the card; edited values are saved; a reserved name returns the refusal.chat-skills.test.tsx: New skill › Create in Chat opens the compose link.Manually (
CHAT_AGENTIC=true, 00458 applied, Admin or Manager):winback: the card says it's an Ansvisor skill's name and Save skill is off. Change it topricing-faq, edit the steps, Save skill.Screenshots:
.claude/mockups/w3-08/(the draft card, a reserved name, saved; New skill menu; light and dark at 1024 px).Checklist
yarn lintpassesyarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)Screens: shown to the owner in a local preview (1024px, light and dark) and approved on 2026-11-02.
CI passed on this branch (0517ccd), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41521763677): schema is up to date; web
format:check, lint, typecheck, all tests andyarn buildpass; server lint,format:checkand all tests pass.🤖 Generated with Claude Code