| name | clone |
| description | Selects the best-matching Kamino agent template for a given task, fills its template variables from the provided task and context, verifies no placeholders remain, and writes the completed agent file into the per-task folder .kamino/tasks/<task_id>/. Use when the user provides a task and wants a Kamino agent chosen and instantiated, mentions selecting or creating an agent from .kamino/agents, references the kamino agent index, or asks to run template-replace on an agent template. |
Clone
Use this skill when the user provides a task and wants the best matching Kamino agent template selected, instantiated, verified, and copied into the per-task folder .kamino/tasks/<task_id>/.
The skill discovers available agents from .kamino/agents/index.md, ranks candidate agents, fills the selected agent template, verifies that no template variables remain, and writes the completed agent file to .kamino/tasks/<task_id>/ (the task id comes from task-evaluate; create the folder if it does not exist). All artifacts of one task live together in that folder.
Inputs
The user must provide:
<task>
{{TASK}}
</task>
<context>
{{CONTEXT}}
</context>
Optional:
<output_name>
{{OUTPUT_NAME}}
</output_name>
<model>haiku</model>
<effort>medium</effort>
If <output_name> is not provided, derive a safe filename from the selected agent name.
If <model> / <effort> are provided (e.g. by the factory's model binding or an escalation attempt), bind them into the copied agent's frontmatter before verification — replace the model: / effort: values in the copy only. Never edit the original blueprint, and never bind values silently: report the binding and its source in the result. Without these inputs, the blueprint's frontmatter defaults stand.
Paths
Use these paths:
.kamino/agents/index.md
.kamino/scripts/template-replace.sh
.kamino/scripts/template-replace-completed.sh
Agent template files are discovered through .kamino/agents/index.md.
Rules
- Treat
.kamino/agents/index.md as the source of truth for available agents.
- Do not guess agent files that are not listed or referenced in the index.
- First scan the index to identify likely candidate agents.
- Then inspect the full Markdown files for the strongest candidates.
- Rank agents by task fit, tool fit, required template variables, available context, and output suitability.
- Prefer the agent that can complete the task with the fewest unsupported assumptions. Search the
library/ (tested) tier first and prefer it; fall back to an ad-hoc/ agent only when no library/ agent fits.
- Inspect required template variables before selecting the final agent.
- Do not invent values for required template variables.
- Use values from
<task> and <context> when replacing template variables.
- If a required template variable cannot be filled, agent creation must fail with a clear error.
- Copy the selected agent Markdown file into a temporary folder before modifying it.
- Never modify the original agent template.
- Use
.kamino/scripts/template-replace.sh to replace template variables.
- Use
.kamino/scripts/template-replace-completed.sh to verify completion.
- If verification shows any remaining template variables, agent creation failed.
- Only copy the completed agent file to
.kamino/tasks/<task_id>/ after verification succeeds. When filling {{OUTPUT_FILE}}, point it to .kamino/tasks/<task_id>/run-report.json unless the task dictates otherwise.
- Return a concise summary of the selected agent, ranking rationale, filled variables, and output path.
Template Variable Rules
Template variables are placeholders inside the selected agent Markdown file.
Common formats may include:
{{VARIABLE_NAME}}
{{ VARIABLE_NAME }}
<VARIABLE_NAME>
Before replacement:
- Extract all template variables from the candidate agent file.
- Classify each variable as:
- Required and fillable from task/context.
- Required but missing.
- Optional.
- Fail before writing the final file if any required variable is missing.
- Do not leave placeholder values such as
TODO, TBD, or {{VARIABLE}}.
Script Usage
template-replace.sh takes the template file as its only argument and reads the replacement from stdin. The piped input must begin with the {{TOKEN}} itself, followed by a space, then the replacement text (which may span multiple lines and contain any characters — replacement is literal, not regex). It replaces one token per invocation, so call it once per variable. It exits 1 if the token is not present in the file.
echo '{{TOKEN}} replacement text' | .kamino/scripts/template-replace.sh <file>
Example:
echo '{{GOAL}} Review this pull request for security risks' | .kamino/scripts/template-replace.sh /tmp/agent.md
Multi-line values work too (here-doc / heredoc or piped variable):
printf '%s' "{{CONTEXT}} $context_text" | .kamino/scripts/template-replace.sh /tmp/agent.md
Verification — template-replace-completed.sh takes the file as its only argument and exits 1 if any {{...}} token remains:
.kamino/scripts/template-replace-completed.sh <file>
Neither script supports --help; read the header comment in the script source for usage.
Steps
- Read the user-provided
<task> and <context>.
- Open
.kamino/agents/index.md.
- Extract the list of available agents and their referenced Markdown file paths.
- Perform a first-pass scan of the index.
- Select a shortlist of candidate agents that appear relevant to the task.
- Open and inspect each candidate agent Markdown file.
- Extract each candidate's purpose, tools, constraints, required inputs, required template variables, and output format.
- Rank the candidates using this scoring model:
Task fit: 0 to 5
Required tool fit: 0 to 5
Context fit: 0 to 5
Template variable fillability: 0 to 5
Output fit: 0 to 5
Risk / ambiguity penalty: 0 to -5
- Pick the highest-ranked agent.
- If there is a tie, prefer the agent with fewer missing assumptions and fewer required template variables.
- Create a temporary folder:
mkdir -p .kamino/tmp
tmp_dir="$(mktemp -d .kamino/tmp/agent.XXXXXX)"
- Copy the selected agent Markdown file into the temporary folder:
cp "<selected_agent_file>" "$tmp_dir/"
- Replace all required template variables in the copied file using
.kamino/scripts/template-replace.sh.
13a. If <model> / <effort> were provided, bind them by editing the copied file's frontmatter model: / effort: lines (the copy only — the original blueprint is never modified).
- Verify the copied file using
.kamino/scripts/template-replace-completed.sh.
- If verification fails, stop and report failure.
- If verification succeeds, copy the completed agent Markdown file to
.kamino/tasks/<task_id>/ (create the folder if needed).
- Return the final result.
Failure Conditions
Agent creation fails if:
.kamino/agents/index.md does not exist.
- No suitable agent is found.
- The selected agent file cannot be found.
- Required template variables cannot be filled from task/context.
template-replace.sh fails.
template-replace-completed.sh fails.
- Any template variables remain after replacement.
- The completed file cannot be copied to
.kamino/tasks/<task_id>/.
Output Format
Return Markdown with this structure:
# Agent Creation Result
## Selected Agent
- Agent: `<agent_name>`
- Source file: `<selected_agent_file>`
- Output file: `<completed_agent_file>`
## Ranking
| Rank | Agent | Score | Reason |
|---:|---|---:|---|
| 1 | | | |
## Filled Template Variables
| Variable | Value Source |
|---|---|
## Model Binding
- Model: `<blueprint default | bound value>` (source: blueprint | factory binding | escalation)
- Effort: `<blueprint default | bound value>`
## Verification
- Template replacement completed: yes/no
- Remaining template variables: none / list variables
- Verification command: `<command>`
## Result
State whether the completed agent file was copied to `.kamino/tasks/<task_id>/`.
If creation failed, state the exact failure reason.
Success Criteria
The skill succeeds only when:
- The best matching agent was selected.
- All required template variables were replaced.
- Verification confirms that no template variables remain.
- The completed agent Markdown file exists in
.kamino/tasks/<task_id>/.