Ski layer embed
Skill luisdomarco/AiAgentArchitect/.codex/skills/ski-layer-embed
AI Agent Architect: A comprehensive framework for designing, building, and exporting agentic workflows. Seamlessly transition from initial concept to production-ready agents equipped with custom commands, specialized skills, knowledge bases and rules.
npx -y skills add luisdomarco/AiAgentArchitect --skill ski-layer-embedAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Embeds, unembeds or updates a modular layer into a destination system (root or subsystem) by reading its MANIFEST.yaml, copying entities to the correct platform directories, injecting context-root sections (CLAUDE.md/AGENTS.md), wiring hooks (settings.json), updating the destination's manifest, and resolving dependencies. Use when activating, deactivating or upgrading any layer (qa, memory, context-ledger, mcp, help-router, onboarding, etc.) on AiAgentArchitect itself or on any generated subsystem.
SKILL.md
7.8 KB, as published. Nobody here has run it
Layer Embed
Generic layer-management skill. Generalizes the legacy ski-qa-embed for any layer declared in .agents/layers/{layer-id}/MANIFEST.yaml.
Input
operation:embed|unembed|updatelayer_id: identifier of the layer (e.g.qa,memory,help-router)destination: absolute or relative path to the target system root (e.g..for root,exports/foo-systemfor a subsystem)platforms: subset of[antigravity, claude_code, codex]declared in the destination'sconfig/manifest.yaml. If omitted, use all platforms enabled in destination.auto_resolve_deps:true(default) |false. Overrides the layer's MANIFEST default.
Output
- Files created/removed under
{destination}/.agents/layers/{layer_id}/,{destination}/.claude/layers/{layer_id}/,{destination}/.codex/layers/{layer_id}/(depending on platforms). {destination}/CLAUDE.md,{destination}/AGENTS.mdregenerated from template + active layer sections.{destination}/.claude/settings.jsonupdated with hook entries (only ifclaude_codeis in platforms).{destination}/config/manifest.yamlupdated withlayers.{layer_id}.enabledandversion.fallback_promote_on_disablehonored onunembed.- Confirmation message with inventory of what changed.
Procedure
Step 1 — Read layer source MANIFEST
Read ${SOURCE_ROOT}/.agents/layers/{layer_id}/MANIFEST.yaml from the AiAgentArchitect source (the calling system, not the destination). Validate:
- File exists and parses as YAML.
layer_idfield matches the requested layer.compatible_withis satisfied by destination'saiagent_architect_version(semver range check).
If validation fails, abort with error and do not modify destination.
Step 2 — Read destination manifest
Read {destination}/config/manifest.yaml. If absent, treat as a fresh install with no layers active. Determine which platforms are enabled in destination.
Step 3 — Operation dispatch
Branch by operation:
Step 3a — embed
- Resolve dependencies: for each
depends_onentry, check if it is enabled in destination's manifest.- If enabled: continue.
- If not enabled and
auto_resolve_deps: true: invokeski-layer-embedrecursively for that dependency before continuing. Notify the user:"Auto-enabled dependency: {dep_id}". - If not enabled and
auto_resolve_deps: false: abort with:"Layer {layer_id} requires {dep_id}. Activate {dep_id} first or pass --auto-deps."
- Detect circular dependencies: maintain a stack of currently-resolving layers; if
dep_idis already in the stack, abort with:"Circular dependency detected: {chain}". - Copy entities: for each platform in
platforms, readplatform_targets.{platform}.entities_dirand recursively copy the layer's entity tree there. Preserve subdirectory structure (workflows/,skills/,rules/,knowledge_base/,resources/,hooks/). - Inject context root: for each platform with
context_root_injectdefined:- Read the destination's
{file}(e.g.CLAUDE.md). - If a section with the heading from
sectionalready exists, replace it. Otherwise, append after the last## Active Layersblock (or append to file end if none).
- Read the destination's
- Inject hooks: for each platform with
hooksdefined:- Claude Code: read
{destination}/.claude/settings.json, parse JSON, append entries fromhooks.entries. Each entry tagged with_layer: {layer_id}for later removal. - Antigravity: hooks live as
.mdfiles underentities_dir/hooks/; already copied in step 3. - Codex: skip; respect
degradationtext already injected viacontext_root_inject.
- Claude Code: read
- Update destination manifest: in
{destination}/config/manifest.yaml, setlayers.{layer_id}.enabled: true,layers.{layer_id}.version: {layer_version},layers.{layer_id}.embedded_at: {ISO_timestamp}. - Confirmation: print inventory (entities copied, hooks added, files modified).
Step 3b — unembed
- Check reverse dependencies: scan destination manifest for layers that have
{layer_id}in theirdepends_on. If any are still enabled, abort with:"Cannot disable {layer_id}: required by {dependents}. Disable those first."(unless--forceis passed; never auto-disable dependents). - Apply
fallback_promote_on_disable: for each entry in the layer's MANIFESTfallback_promote_on_disable:- Move
{destination}/{platform_entities_dir}/{source}to{destination}/.agents/{target_root}(and equivalents for other platforms). - This preserves entities that the framework still needs even when the layer is off.
- Move
- Remove entities: delete
{destination}/.agents/layers/{layer_id}/,.claude/layers/{layer_id}/,.codex/layers/{layer_id}/. - Retire context root: remove the layer's section from
CLAUDE.mdandAGENTS.md(matched by section heading). - Retire hooks: in
{destination}/.claude/settings.json, remove all entries tagged_layer: {layer_id}. - Update destination manifest: set
layers.{layer_id}.enabled: false, keepversionfor history. - Confirmation: print inventory of what was removed and what was promoted (if any).
Step 3c — update
- Read current installed version from destination's manifest. Read source layer's current version.
- If equal: print
"Layer {layer_id} is already at version {x}. No update needed."and exit. - If source is newer: execute
unembedfollowed byembedatomically (rollback on failure: restore previous state from a temp snapshot). - If source is older: refuse unless
--downgradeflag is passed.
Step 4 — Final manifest write
After any successful operation, write {destination}/config/manifest.yaml to disk and update its last_modified timestamp.
Error handling
| Error | Behavior |
|---|---|
| Layer source MANIFEST not found | Abort with "Layer {layer_id} not found in source layers/" |
| Destination not a valid AiAgentArchitect system | Abort with "Destination {path} does not have config/manifest.yaml. Run install.mjs first." |
| Circular dependency | Abort, no changes |
| Compat range mismatch | Abort with "Layer {layer_id} v{x} requires AiAgentArchitect {range}, got {y}" |
| Embed when already enabled | Print "Layer already enabled. Re-run with operation=update to refresh." and exit cleanly |
| Unembed when not enabled | Print "Layer not enabled. Nothing to do." and exit cleanly |
| Filesystem error mid-operation | Roll back: restore from temp snapshot taken at step start |
Confirmation message format
✅ Layer {layer_id} v{version} {operation}ded on {destination}
Platforms affected: {antigravity, claude_code, codex}
Entities {added|removed}: {count} workflows, {count} skills, ...
Hooks {added|removed}: {count} entries in settings.json
Context root: {file}#{section} {injected|retired}
Promotions: {list of fallback_promote_on_disable applied, if any}
Dependencies auto-resolved: {list, if any}
Destination manifest updated.
Notes on the context-root template
The destination's CLAUDE.md and AGENTS.md are not edited by hand. They are regenerated by ski-layer-embed from {SOURCE_ROOT}/.agents/templates/CLAUDE.md.tpl and AGENTS.md.tpl (created in the templates phase) plus concatenation of all active layer sections. If those templates do not exist yet, ski-layer-embed falls back to direct in-place editing of the existing files (legacy mode) and prints a warning.