programmatic-tool-calling
Multi-step tool workflows via code orchestration to reduce latency, context pollution, and token overhead.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Multi-step tool workflows via code orchestration to reduce latency, context pollution, and token overhead.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Rules and strategies for managing agent context window size, avoiding bloat, and preserving signal-to-noise ratio.
Standard patterns for error handling, retry logic, circuit breakers, and graceful degradation.
Detect and remove contradictions across agent policies before execution.
Bind project-specific prompts to local schema and workflow artifacts while keeping the harness core generic and globally reusable.
Operational session protocol for task-scoped leases, reconciliation, checkpoints, inspection, queue promotion, and handoff across long-running work.
Operational session protocol for task-scoped leases, reconciliation, checkpoints, inspection, queue promotion, and handoff across long-running work.
| name | programmatic-tool-calling |
| description | Multi-step tool workflows via code orchestration to reduce latency, context pollution, and token overhead. |
Execute multi-step tool workflows via code orchestration to reduce latency, context pollution, and token overhead.
Treat tools as callable functions inside an orchestration runtime (script/runner), not as one-turn-at-a-time chat actions.
// Instead of N separate tool calls returning full output to context:
async function lintAllFiles(files) {
const results = [];
// Fan-out: run lint on all files in parallel
const promises = files.map(file =>
runTool("run_command", { cmd: `eslint ${file} --format json` })
);
const outputs = await Promise.allSettled(promises);
// Filter: keep only failures
for (const [i, output] of outputs.entries()) {
if (output.status === "rejected" || output.value.exitCode !== 0) {
const parsed = JSON.parse(output.value?.stdout || "[]");
const errors = parsed.filter(r => r.errorCount > 0);
if (errors.length) {
results.push({
file: files[i],
errorCount: errors[0].errorCount,
topError: errors[0].messages[0]?.message
});
}
}
}
// Return only summary — not raw lint output
return {
totalFiles: files.length,
failedFiles: results.length,
failures: results // compact: file + count + top error only
};
}
Key: the raw lint JSON never enters the model context — only the filtered summary does.
Use code orchestration when the workflow is “discover -> claim -> checkpoint -> close” and intermediate payloads are large:
async function executeReadyIssue(projectName) {
const capabilities = await runTool("harness_inspector", { action: "capabilities" });
validateCapabilities(capabilities);
const begin = await runTool("harness_session", {
action: "begin",
projectName,
});
if (begin.status !== "ok" || !begin.sessionToken) {
return { claimed: false, reason: "No ready issue" };
}
const summary = await performWorkOutsideModelContext(begin.issueId);
await runTool("harness_session", {
action: "checkpoint",
sessionToken: begin.sessionToken,
input: {
title: "Implementation complete",
summary,
taskStatus: "in_progress",
nextStep: "Run final validation",
},
});
return runTool("harness_session", {
action: "close",
sessionToken: begin.sessionToken,
closeInput: {
title: "Task complete",
summary,
taskStatus: "done",
nextStep: "Wait for feedback",
},
});
}
The important part is not the exact code — it is that the heavy work stays in the orchestration runtime and only compact lifecycle summaries come back to the model.