Repository navigation
Conversation
The model could already emit a skill-shaped document via create_artifact, but an artifact is not a skill: nothing wrote it into SKILLS_DIR, so "build me a skill" ended at a download button with no way to install the result. And /skill-builder was not a command, so it fell through commands.parse and was sent to the model as an ordinary prompt. Adds ocd_core/skill_tools.py (a save_skill tool + an authoring system-prompt section, wired like artifact_tools) and skills.save_skill(), a create-or- replace write keyed on the skill name. - Gated: run_turn(skill_builder=True) is set only by the route when commands.parse sees /skill-builder on the user's own message. A saved skill is instructions later turns obey, so an ambient tool would let injected tool output plant a persistent backdoor; unattended runs never pass the flag. - The route checks the command before resolve_skill, so a user-saved skill named skill-builder cannot shadow the built-in. - Re-saving the same name rewrites the file the previous save wrote instead of leaving duplicates that shadow each other in resolve_skill (first match wins). Only files in the .imported.json manifest are ever rewritten, so a bundled skill is refused rather than clobbered. - Frontmatter is line-oriented and triggers is comma-split, so single-line fields are flattened before writing. Not surfaced yet: desktop slashCommands.ts suggests skills only, so the command works when typed but does not appear in the composer's / menu. Tests: backend/tests/test_skill_builder.py (22) — command parsing, markdown round-trip through the loader, sanitization, idempotence, bundled-skill refusal, tool dispatch, gating on/off, route wiring, and an end-to-end turn where a model calls save_skill and the skill resolves in the next chat. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
/skill-builder worked only if you already knew to type it — slashSuggestions fed on skills + MCP prompts, and a built-in command is neither. Adds BUILTIN_COMMANDS + withBuiltins() to slashCommands.ts: built-ins are prepended to the suggestion list, and a skill whose name shadows one is dropped. The drop mirrors the backend — the route parses the command before resolve_skill, so a skill named "skill-builder" can never run and listing it would be a dead entry. The list holds only commands a route actually consumes. The rest of ocd_core/commands.py (/projects, /skills, /reload-skills, /set-instructions, /learn-finding, /lint-knowledge, /refresh-catalog) is still parsed but no route acts on it — leftovers from the retired Chainlit client — so suggesting one would just send its literal text to the model. accept() widens to SlashItem | SkillInfo; a built-in has no `sid`, so it takes the plain applySlash path and lands "/skill-builder " ready for its argument. Tests: 4 added to slashCommands.test.ts (exposure, filtering, shadow-drop ordering, no-op on unrelated skills). typecheck + 408 vitest tests + build all pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
Author
|
Merged and shipped as part of the clean-slate VersoWork v0.1.0 open-source release. |
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.
Problem
create_artifactcan render a skill-shaped document, but an artifact is not a skill — nothing writes it intoSKILLS_DIR. And/skill-builderwas not a command, so it fell throughcommands.parseand reached the model as an ordinary prompt.The user-visible result: "build me a skill" produced a markdown artifact whose only affordances were Download / Print, with no way to install it. The skill could never be invoked again.
Change
ocd_core/skill_tools.py(new) — asave_skilltool + an authoring system-prompt section, wired the same way asartifact_tools. The brief tells the model to verify identifiers before writing them into a skill, write the body as a procedure, and save rather than emit an artifact.skills.save_skill()— create-or-replace keyed on the skill name, distinct fromimport_skill(which always lands a new file and uniquifies the stem — right for uploads, wrong for authoring).commands.py—/skill-builderregistered as a prefix command; bare form is valid and builds from the conversation so far.app/routes/agent.py— turns the command into a skill-building turn.Contracts worth reviewing
run_turn(skill_builder=True)is set only by the route whencommands.parsesees/skill-builderon the user's own message. A saved skill is instructions every later turn obeys, so an ambient tool would let injected tool output plant a persistent backdoor. Unattended paths (Cowork, scheduler) never pass the flag — consistent with the existing "Unattended tool posture" rule in CLAUDE.md.resolve_skill, so a user-saved skill namedskill-buildercannot shadow the built-in.resolve_skillreturns the FIRST name match, so without this, iterating ("fix the trigger and save again") would leave files that silently shadow each other. Only paths recorded in.imported.jsonare rewritten, so a bundled skill is refused rather than clobbered.triggersis comma-split by the loader, so a stray newline or comma from the model would corrupt every field after it; single-line fields are flattened before writing.Tests
backend/tests/test_skill_builder.py(22): command parsing, markdown round-trip through the real loader, sanitization, name slugification, fence handling, validation, idempotence, bundled-skill refusal, tool dispatch, gating on/off, route wiring, and an end-to-end turn where a model callssave_skilland the skill then resolves in a later chat both as/nameand by trigger.ruff check .clean.Full backend suite: 4 failures —
test_alembic,test_providers_route::test_set_and_delete_key, and two intest_workspace. Verified identical on an untouchedorigin/mainworktree, so they are environmental to my machine, not from this change.test_anthropic_native.pycannot be collected locally (anthropicnot installed); CI covers it.Not included
desktop/src/state/slashCommands.tssuggests skills only, so/skill-builderworks when typed but does not appear in the composer's/menu. Adding a built-ins list needs the desktop verification loop (npm run typecheck && test && build) andnode_moduleswas not installed locally, so I left it out rather than ship an unverified desktop change. Noted in CLAUDE.md as a known gap.🤖 Generated with Claude Code