NAME

Skilletor::Convert - A Claude agent as a Codex agent role, a rule as its section of the Codex rules file

VERSION

version 0.008000

SYNOPSIS

use Skilletor::Convert qw( codex_agent_toml codex_rule_section convert_for_target );

my $conv = codex_agent_toml( $agent_markdown, 'reviewer' );
# { toml => "name = \"reviewer\"\n...", warnings => [ 'codex.x: null has no TOML form; dropped' ] }

my $section = codex_rule_section( $rule_markdown, 'style' );   # undef for a blank body

my $r = convert_for_target( 'codex', 'agent', 'reviewer', $output );
# { output => [ [ 'agents/reviewer.toml', $bytes ] ], skipped => 0, warnings => [...] }

DESCRIPTION

The reference's convert.ts (spec §14.7, §14.8): the per-target output conversion between render and apply. It knows neither sources nor the target filesystem; its texts are the reference's, byte for byte.

A Claude agent becomes a Codex agent role: name (else the item's name), description and the body as developer_instructions, a multi-line string. A codex: mapping in the frontmatter passes its scalars, string lists and one level of tables through and overrides the derived keys; a value outside those shapes is dropped with one warning. briefing.skills becomes the comment line # briefing: skills = [...] the briefing plugin reads, right before developer_instructions. Claude-only keys (tools, model, …) are not carried.

A rule becomes its section of the Codex rules file: the body without frontmatter, led by an "Applies when working with files matching: …" line for a paths: frontmatter, since Codex cannot load a rule conditionally.

Errors are Skilletor::Error::Convert with the reference's message; unreadable frontmatter is one too, with the reader's message. A float TOML cannot write (1e999) is a Skilletor::Error::TOML, as in the reference.

codex_agent_toml

my $conv = codex_agent_toml( $markdown, $item_name );

{ toml => $text, warnings => [ ... ] }; no toml key when the body is blank (the agent does not apply to Codex). Text in, text out.

codex_rule_section

my $text = codex_rule_section( $markdown, $item_name );

The section text, normalized (see "normalize_section" in Skilletor::AgentsMD); undef when the body is blank. A body with a skilletor marker line is an error.

convert_for_target

my $r = convert_for_target( $harness, $type, $name, $output );

Maps an item's built output ("build" in Skilletor::Render: [ [ path, bytes ], ... ]) to what a harness installs: { output, skipped, warnings }. Claude, Hermes and Codex skills take it as it is (the same array). A Codex agent becomes agents/<name>.toml; a Codex rule becomes its section under the key skilletor-rules.md, which the engine assembles into the rules file. skipped is true where the item does not apply to the target, as for an empty render. Files are read and written as UTF-8, an ill-formed byte read as U+FFFD as Node reads it.

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/skilletor/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)