Skip to content

refactor(runtime): split skills.ts along discovery/metadata/context/state seams #1408

Closed

Description

@Astro-Han

Part of #1084 (second-pass sink-file and boundary governance). The file grew from 1189 to 1921 lines since the original scan (context governance + bounded search landed in between); the split is more valuable now. Scope re-verified against current main.

Scope

Split packages/runtime/src/skills.ts by the clusters visible today, keeping @maka/runtime exports (20+ symbols via index.ts) stable through re-exports:

  • skills-discovery.ts: resolveSkillDiscoveryPaths, normalizeSkillSource, the scanSkills* family, scanSkillDir.
  • skills-metadata.ts: validateSkillMetadata, parseSkillFrontMatter, the manifest-parsing family (~L1649–1901).
  • skills-context.ts: gateSkillsByHostCapabilities, selectSkillsForContext, searchSkills + scoring, prompt rendering.
  • skills-state.ts: readSkillRuntimeState, writeSkillRuntimeState.
  • skills-agent-tools.ts: buildSkillAgentTool, buildSkillSearchAgentTool.
  • Move readContainedRegularFile and the contained-file I/O helpers (~L1570–1645) into path-containment.ts — they are generic infrastructure and are already imported cross-package by apps/desktop/src/main/skills.ts.

Notes

Check overlap with #1385's child-session tool changes around buildSkillAgentTool before starting.

Invariants

Same as #1084: behavior-neutral; stable public exports via re-exports; no reverse imports; flat PR off main.

Verification

Typecheck/build + skills tests.

Activity

  1. sunheyi6 commented on Jul 24, 2026

    @sunheyi6
    Contributor

    I'd like to claim this task. I've already completed the split and opened PR #1428 for review.

  2. added a commit that references this issue on Jul 24, 2026
    5bdc0cf
  3. added a commit that references this issue on Jul 24, 2026
    1c260de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions