Repository navigation
feat(runtime): extract shared skills module and adopt it in desktop - #749
Merged
Merged
Conversation
Add a @maka/runtime skills module owning the runtime-facing skill read path: scanWorkspaceSkills (scan + parse + per-workspace enablement read), buildSkillsPromptFragment, loadSkillInstructions, buildSkillAgentTool, parseSkillFrontMatter, readSkillRuntimeState / writeSkillRuntimeState, and the shared path-safety primitives. Exports RuntimeSkillDefinition (stable, no content) and ScannedSkill (adds content + contentSha256) so a future CLI host can consume skills without duplicating the read path or pulling in desktop governance. 11 behavior tests cover scan, prompt, lazy load, the Skill tool, enablement state, and symlink hardening. Refs #748 (ticket 1: runtime module).
Switch apps/desktop to the new @maka/runtime skills module: InstalledSkill extends RuntimeSkillDefinition and readInstalledSkillDefinitions calls scanWorkspaceSkills then enriches governance (lock, provenance, managed-source status, Office seeding). The runtime-facing functions (buildSkillsPromptFragment, loadSkillInstructions, buildSkillAgentTool, parseSkillFrontMatter, MAX_*, path primitives, enablement state) are deleted from desktop and re-exported from @maka/runtime, so desktop call sites (system-prompt-main.ts, main.ts, workspace-resources-ipc-main.ts) and the 1407-line desktop suite keep importing from ./skills.js unchanged. Desktop behavior is preserved: the 2316-test desktop suite stays green, matching the pre-change baseline. Refs #748 (ticket 1: desktop adoption).
Astro-Han
force-pushed
the
feat/748-extract-runtime-skills
branch
from
July 12, 2026 04:23
81cdf2e to
f06fedf
Compare
This was referenced Jul 12, 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
apps/desktopinto a shared@maka/runtimeskills module, then adopt it in desktop.InstalledSkill extends RuntimeSkillDefinition;readInstalledSkillDefinitionscallsscanWorkspaceSkillsand enriches governance on top; runtime-facing functions are deleted from desktop and re-exported so call sites and tests keep importing from./skills.jsunchanged.Why
The CLI has zero skill support — neither the skill catalog in the system prompt nor the
Skilltool is wired — while desktop and CLI share the sameworkspaceRoot. #748 moves skills into scope. Ticket 1 establishes the shared runtime module as a behavior-preserving foundation so ticket 2 (host-compatibility gate) and ticket 3 (wire CLI injection) build on it without duplicating skill logic.Refs #748 (ticket 1 of 3: extract + adopt). Closes nothing yet — tickets 2 and 3 land separately.
Scope
Two commits:
feat(runtime): add shared workspace skills module— newpackages/runtime/src/skills.ts(RuntimeSkillDefinition,scanWorkspaceSkills,buildSkillsPromptFragment,loadSkillInstructions,buildSkillAgentTool,parseSkillFrontMatter,readSkillRuntimeState/writeSkillRuntimeState, shared path-safety primitives),index.tsre-exports, and 11 runtime behavior tests.refactor(desktop): adopt the shared runtime skills module—apps/desktop/src/main/skills.tsswitches to the runtime module; governance (lock, provenance, managed-source status, Office seeding) stays in desktop.Non-goals: host-compatibility gating (ticket 2) and CLI wiring (ticket 3) are out of scope for this PR.
Verification
npm run -w @maka/runtime test— 1287 pass, 0 fail (includes the 11 new skills tests).npm run -w @maka/desktop test— 2320 pass, 0 fail, matching the rebasedmainbaseline (behavior-preserving).npm run typecheckandnpm run buildgreen across all workspaces.codexreview (max effort, read-only sandbox) — PASS, no P0–P3 findings. It noted non-blocking coverage gaps: runtime unit tests do not separately cover the prompt char/count limit branches, SKILL.md / skill-directory symlink scan, and "ignore a corrupted lock and load the workspace copy"; all three remain covered by the desktop integration suite.Impact
None for end users — desktop behavior is unchanged. No migration, compatibility, documentation, or release-note requirements. Internally,
@maka/runtimegains a shared skills module andapps/desktopdepends on it for the skill read path; desktop governance stays local.Reviewer notes
Focus on:
buildSkillsPromptFragmentnow scans viascanWorkspaceSkills(no governance read) instead of the oldreadInstalledSkillDefinitions;loadSkillInstructionsavailableSkillstype changed fromPick<InstalledSkill, ...>toPick<RuntimeSkillDefinition, ...>;contentSha256now comes fromScannedSkill(raw file bytes hash) and is passed toreadSkillLockStatusascurrentHash. Confirm these are equivalent for desktop callers and IPC.sha256Buffer,SkillStateFile,SkillRuntimeStateReadResult,SkillDefinitiontypes; the path primitives) is left duplicated in desktop.contentSha256spread — inreadInstalledSkillDefinitions, a missing lock must not letScannedSkill.contentSha256leak intoInstalledSkill.contentSha256(the explicit field copy +...statusspread handles this; missing-lock status omitscontentSha256).Ready for review
Verificationexplains why it is not applicable — N/A: internal refactor with no UI changes