QM's resolution and skill systems split concerns: ResolutionService computes access policies (layers, prompts, rules, security) per conversation-actor pair, while SkillSyncEngine and SkillMaterializer handle keeping skills synchronized and their assets on disk. The skill sync pipeline runs on a leader-leased 5-minute tick that both drives materialization and can be triggered on-demand for tests; materialization itself has two granularities—full index or single-skill bundle.
createResolutionService() in src/resolution/resolution-service.ts is the factory for a ResolutionService that computes the full Resolution — layers, system prompt, egress rules, command policy, security policy, approval modes, and granted handles — for a given conversation and actor.[1]
src/skills/materialize.ts exports the SkillMaterializer interface with two operations: materializeIndex() (writes all active skills' SKILL.md files and an index marker) and materializeTree() (writes a single skill's assets and bundle pack files).[2]
src/skills/skill-sync-engine.ts defines the SkillSyncEngine interface, whose tick() method is public and can be called directly — in tests or on-demand triggers — independently of the periodic sweeper; start() and stop() control the background loop.[3] The default polling interval for SkillSyncEngine is 300,000 ms (5 minutes).[3] The leader-lease key "skills:sync:tick" ensures only one cluster node drives skill sync at a time.[3] A leader lease is a short-lived distributed lock that only one cluster node holds at a time; in QM's skill sync, it prevents duplicate materialization work across concurrent instances.
Sources