artifact_write
Create or update validated KB-root artifact files, enforcing schemas and conflict checks so writes succeed only with correct content and version hashes.
Instructions
Creates or updates a KB-root artifact file (skills//, agents/.md, hooks/, mcp/.json, instructions.md, templates/.md, paths.yaml, glossary.yaml). On an existing file, if_match is required (sha256 of the current content, from artifact_read/artifact_list) — fails with stale_write if it's missing or doesn't match. On a new file, omit if_match — fails with already_exists if the file is actually already there. Validates structured artifacts, including template frontmatter and variables the paths.yaml schema (paths:/repos: key -> {description, default: ~/…, remote}) and the glossary.yaml schema (terms: list of {canonical, aliases: [..], forbidden: [..]}), before writing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path relative to the KB root, e.g. skills/my-skill/SKILL.md | |
| reason | No | Why (commit trailer) | |
| content | Yes | New file content, text by default or base64 when encoding is base64 | |
| encoding | No | Content encoding; defaults to text | |
| if_match | No | Expected sha256 of the current content — required when overwriting an existing file, omit when creating a new one | |
| executable | No | Optional executable bit; omitted preserves an existing file mode and defaults false for a new file |