How Temperature Inference Works for Converted Agents in the Compound Engineering Plugin
When converting Claude Code plugins to OpenCode or other targets, the Compound Engineering Plugin automatically assigns optimal temperature values between 0.1 and 0.6 based on agent names and descriptions, defaulting to 0.3 when no specific pattern matches.
The EveryInc/compound-engineering-plugin CLI tool streamlines the migration of Claude Code plugins to alternative formats like OpenCode, Codex, and Pi. A key feature of this conversion process is temperature inference, which automatically assigns appropriate creativity parameters to generated agents based on their intended functionality.
How Temperature Inference Works in Agent Conversion
The conversion pipeline implements temperature inference through a boolean CLI flag, conditional logic in the agent converter, and regex-based pattern matching against agent metadata.
The inferTemperature CLI Flag
The convert command defines an inferTemperature boolean flag that defaults to true in src/commands/convert.ts (lines 57–61). When users run the conversion command without explicit flags, the system automatically attempts to determine appropriate temperature values for each generated agent.
# Default behavior enables temperature inference
compound-engineering-plugin convert ./my-plugin --to opencode
Agent Conversion Logic
Inside the convertAgent function in src/converters/claude-to-opencode.ts (lines 99–103), the converter checks the inferTemperature option. When enabled, it calls the inferTemperature(agent) helper function and, if a number is returned, injects the value into the agent's front-matter under the temperature key.
// From src/converters/claude-to-opencode.ts
if (options.inferTemperature) {
const temp = inferTemperature(agent);
if (typeof temp === 'number') {
frontMatter.temperature = temp;
}
}
Regex-Based Temperature Mapping
The core inference logic resides in the inferTemperature function (lines 77–91 of the same file). This function inspects the agent's name and description (converted to lowercase) and matches them against a series of regular expressions that map to specific temperature values:
- Security-oriented agents (review, audit, sentinel):
0.1 - Planning and analysis agents (plan, research):
0.2 - Documentation agents (doc, readme):
0.3 - Creative and brainstorming agents (creative, design):
0.6 - Fallback default:
0.3
The function returns the first matching temperature value, ensuring deterministic behavior based on agent classification.
Temperature Values by Agent Type
The inference system categorizes agents into distinct operational modes, each receiving an optimized temperature setting:
- 0.1 – Security reviewers, auditors, and sentinel agents requiring maximum precision and minimal hallucination
- 0.2 – Planning, research, and analytical agents needing structured, methodical outputs
- 0.3 – Documentation generators and README writers (also the global default)
- 0.6 – Creative designers and brainstorming agents benefiting from higher variability and novel suggestions
Disabling Temperature Inference
Users retain full control over the conversion process. To prevent automatic temperature assignment and omit the temperature field from generated front-matter entirely, pass the --inferTemperature=false flag (or --no-inferTemperature depending on your CLI parser version):
# Disable temperature inference
compound-engineering-plugin convert ./my-plugin --to opencode --inferTemperature=false
# Alternative syntax
compound-engineering-plugin convert ./my-plugin --to opencode --no-inferTemperature
When disabled, the generated OpenCode agent files will contain front-matter without a temperature specification, relying on the target platform's default behavior.
Programmatic Usage
For developers integrating the conversion logic directly into Node.js applications, the temperature inference option is available through the programmatic API:
import { convert } from "@everyinc/compound-engineering-plugin";
import { readFileSync } from "fs";
const plugin = JSON.parse(readFileSync("./my-plugin/plugin.json", "utf8"));
const options = {
inferTemperature: true,
agentMode: "subagent",
permissions: "broad"
};
const { agents } = convert(plugin, options);
console.log(agents[0].frontMatter.temperature); // Outputs: 0.2 (inferred)
The OpenCode type definition in src/types/opencode.ts (lines 18–19) declares the optional temperature?: number field, ensuring type safety when serializing the inferred values.
Summary
- Temperature inference automatically assigns creativity parameters (0.1–0.6) to converted agents based on name and description patterns.
- The feature is controlled by the
--inferTemperatureflag, defaulting totrueinsrc/commands/convert.ts. - Regex matching in
src/converters/claude-to-opencode.tscategorizes agents into security (0.1), planning (0.2), documentation (0.3), and creative (0.6) roles. - Users can disable inference via CLI flags or programmatic options to omit temperature from generated front-matter.
Frequently Asked Questions
What is the default temperature value for converted agents?
When no specific pattern matches the agent's name or description, the inference system defaults to 0.3. This value is also assigned to documentation-oriented agents and represents a balanced setting between creativity and determinism.
Can I override the inferred temperature for specific agents?
The current implementation does not support per-agent temperature overrides during batch conversion. However, you can disable inference entirely using --inferTemperature=false and manually edit the generated front-matter files to add specific temperature values before deployment.
Which agent types receive the lowest temperature setting?
Security-oriented agents receive the most conservative temperature value of 0.1. This includes agents with names or descriptions containing terms like "review," "audit," or "sentinel," ensuring maximum precision and minimal hallucination for critical security tasks.
Is temperature inference supported for all conversion targets?
The analysis focuses on the claude-to-opencode converter, where temperature inference is fully implemented. Support for other targets (such as Codex or Pi) depends on whether those specific converters implement the inferTemperature option and whether the target format supports temperature parameters in their front-matter schemas.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →