Skip to content

Desktop: Pending review list for learned skills (ATO-67) - #1721

Draft
sosidudku1 wants to merge 2 commits into
rel/xp-buildfrom
feat/ato-67-desktop-pending-skills
Draft

sosidudku1 wants to merge 2 commits into
rel/xp-buildfrom
feat/ato-67-desktop-pending-skills

Conversation

@sosidudku1

Copy link
Copy Markdown
Collaborator

What

Settings › Skills gets a Pending review group at the top of the skill list whenever the agent holds learned skills waiting for confirmation:

  • a count badge, and one row per draft: skill name, kind (New skill / Update), the model's reason as plain escaped text;
  • Show opens a read-only preview where a skill's detail sits: the diff for an update (or the new text if no diff), the draft SKILL.md for a new skill, and the sources it was learned from;
  • Approve runs atag skill learned approve <id> and re-reads both lists (the skill is now installed);
  • Discard asks first, with the same red confirm as Remove skill (y / Enter, n / Esc), then runs atag skill learned discard <id>.

Main side (desktop/main/skill-drafts-cli.ts pure, desktop/main/skill-drafts-ipc.ts wiring):

  • skillDrafts() reads atag skill list --json and keeps rows with status: "pending"; an older agent (no --json, plain TSV, error, no pending rows) gives an empty list and no error;
  • skillDraftShow(id) → atag skill learned show <id> --json; skillDraftApprove(id) / skillDraftDiscard(id) → exit 0 is success, otherwise the agent's message;
  • every call goes through atagRun with an argv array; the id is checked (/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/, no leading -) in main and in the renderer;
  • IPC cli:skillDrafts, cli:skillDraftShow, cli:skillDraftApprove, cli:skillDraftDiscard plus preload entries. While the app runs chats on another computer the list is empty (drafts live in that agent's state folder).

A plain skill list row (TSV or the cloud route) with status pending is dropped, so a draft never shows up as a disabled skill.

Logic lives in desktop/renderer/workspace-skills.js (pure helpers and a small controller); renderer.js changes are 9 lines. The draft list is read on entering the tab, at most every 15 s with the skills poll, and at once on Refresh.

Why

Core PR #1696 (ATO-67 self-learning) saves a skill learned from a turn that read outside content (a web page, a file, a tool's output) as a draft pending the person's confirmation, so injected text cannot quietly become a standing instruction. Nadya decided on 18.11 that the desktop must show those drafts as "Pending review" with Show / Approve / Discard.

Precedent: OpenClaw skill-workshop's Learned tab (learned skills are reviewed before they join the set), and Claude Code asking the person to approve project MCP servers from .mcp.json before they are used.

Depends on core PR #1696 for skill list --json pending rows and skill learned show|approve|discard. Without it the group simply never appears.

Tests

  • desktop/test/skill-drafts.test.mjs (node:test, like skill-eval.test.mjs): argv shapes, id validation, skill list --json parsing (pending only, dedupe, bad ids, older agent's TSV), learned show --json parsing, the plain-list filter, grouping and count, HTML escaping of the reason / skill name / preview / sources, the Discard confirm, the controller (show, approve, discard only after confirm, throttle, failures, no bridge), and wiring pins for preload, IPC, main, the CLI filter and the Skills tab.
  • Not run here (no builds or tests on this Mac).

Verification (the MBP run must check)

  • npm run build && npm run test:unit (the new test needs out/main/skill-drafts-cli.js), tsc and lint clean.
  • With an agent from Self-learning: background skill review after long turns, with /learn undo (ATO-67) #1696 and at least one draft of each kind (a skill learned after a web fetch, and a patch to an existing skill): Settings › Skills shows Pending review (2) above the rows; the reason reads as plain text.
  • Show: an Update shows the diff, a New skill its SKILL.md, both read-only, with the sources; Esc and "All skills" go back.
  • Approve: the draft leaves the group and the skill appears in the list; Discard: the confirm appears, Cancel keeps the draft, Discard removes it.
  • The drafts never appear a second time as disabled rows.
  • With the current released agent (no --json): no group, no error banner, the skill list as before.

Not yet checked on the second Mac.

The agent now keeps a skill it learned from a turn that read outside
content as a draft until the person confirms it (core PR #1696). Nadya
decided on 18.11 that the desktop shows those drafts in Settings > Skills
as "Pending review" with Show / Approve / Discard, so a learned skill is
never saved behind the person's back.

Main reads `atag skill list --json` for rows with status "pending" (an
older agent without --json or without drafts gives an empty list, no
error) and runs `atag skill learned show|approve|discard <id>` with argv
arrays and a checked id. The renderer draws the group above the skill
rows with a count, a read-only preview (the diff for an update, the
draft SKILL.md for a new skill, plus its sources) and the same red
confirm as Remove skill before a discard. A plain `skill list` row with
status "pending" is dropped so a draft never shows as a disabled skill.

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.

1 participant