Skip to content

Customizing the Harness Using an Agent ​

You do not need to memorize Kompile's JSON schemas, config file locations, or slash commands to tailor the harness to your repository or team. Kompile exposes first-class self-configuration MCP tools (onboarding, enforcer_config, policy_enforce, hooks, judge_control, skill_manager, role_manager, script_manager, harness_manager, config_archive, spin, sources, and peer) so you can describe what you want in plain English and let your agent inspect, preview, and apply the changes safely.

This walkthrough works identically inside kompile chat, kompile chat --web, or from an external coding client (Claude Code, Codex, Antigravity, OpenCode) connected to Kompile's MCP server.

Prefer a Numbered Terminal Wizard Instead of Chat Prompts?

Every major Kompile subsystem also has a guided numbered terminal wizard — no flags or JSON needed:

  • Master menu: kompile configure
  • Subagents: bare /subagent-config and /subagent-config failover
  • Enforcer & Judge: bare /enforcer (/judge) menu, /enforcer init, kompile configure enforcer, kompile configure judge
  • Periodic policy audits: bare /policy-enforce or /policy-enforce-global
  • Teams, roles, resources & display: /workflow create, bare /roles, /resources setup, bare /ui

See Slash Commands — Interactive Wizards for the full wizard table.

Built-In Safety Rails for Agent-Driven Customization

Kompile prevents an agent from silently weakening your guardrails or running unexpected shell commands:


Step 0 — Give the Agent Kompile's Harness Skill ​

New Kompile distributions bundle the kompile-harness skill automatically — activate it in chat with /kompile-harness. If you are using an external client or want to ensure any model knows every configuration tool, paste this once at the start of your session:

text
Fetch https://getkompile.github.io/kompile/SKILL.md and follow it for how to use Kompile tools and configure the harness when I ask.

See Agent Skill (SKILL.md) for local installation and raw reference URLs.


Step 1 — Ask the Agent to Audit Your Current Setup ​

Before changing anything, ask the agent to summarize what is installed and active right now:

Prompt: "Inspect my Kompile setup and explain how subagents, the Enforcer, the Judge, process limits, and LSP are currently configured."

What the harness does: Runs onboarding (explain, section all) and returns a clean, secret-free summary of installed harnesses, auth routes, subagents, guardrails, LSP servers, and peers.

You can also ask about a single subsystem (install, harnesses, auth, subagents, chat, harness, processes, enforcer, mcp, lsp, federation, sources, or commands), or ask for a fast readiness summary.


Step 2 — Subagent Settings (~/.kompile/config/subagent-config.json) ​

Subagent admission, routing, budgets, failover, crash auto-resume, and worker tool/prompt footprint all live in one user-wide file (~/.kompile/config/subagent-config.json) that reloads for every new run, resume, and follow-up without killing already-running workers.

You can configure every setting conversationally via onboarding(action="configure", section="subagents", ...) (previewed first with dryRun=true, then applied with dryRun=false, confirmed=true), interactively in chat with /subagent-config (or /subagent-config failover for the fallback ladder editor), or in the Web Harness Settings drawer.

2A. Example Conversational Preview → Apply ​

Prompt: "Cap subagents to at most 3 concurrent workers per session (6 globally), set a $2.00 cost budget and 20-minute active runtime limit per worker, ban opus and fable models, enable failover, preload only read, grep, glob, edit, and write, and preview the changes before applying."

What happens in two safe steps:

  1. Dry-run preview (default): The agent runs onboarding in preview mode (dryRun=true) and shows you the exact before/after diff for maxConcurrent (6), maxConcurrentPerSession (3), defaultCostBudgetUsd ($2.00), defaultWallClockMinutes (20), bannedModels (*opus*, *fable*), failoverEnabled (true), and preloadTools (read, grep, glob, edit, write) — without touching disk yet.
  2. Apply after you confirm: Once you reply "Looks good, apply it", the agent commits the confirmed update cleanly to ~/.kompile/config/subagent-config.json (reloading immediately for the next subagent dispatch).

(You can also ask the agent to apply Kompile's recommended starter subagent defaults in one step.)

2B. Complete Subagent Settings Reference ​

Run bare /subagent-config (or /subagent-config failover) to edit any of these through a numbered menu — or tell your agent in plain English to update the corresponding settings key via onboarding(action="configure", section="subagents"). The /subagent-config <subcommand> column lists the direct scripting shortcuts.

Concurrency & Admission ​

settings Key/subagent-config CommandDefaultWhat It Controls
maxConcurrent/subagent-config max <N|unlimited>-1 (unlimited)Process-wide cap across all chats; 0 disables new subagent dispatches
maxConcurrentPerSession/subagent-config per-session <N|unlimited>-1 (unlimited)Per-chat-session cap so one session's fan-out cannot consume the whole concurrency budget

Budgets, Context Ceiling & Active Runtime ​

settings Key/subagent-config CommandDefaultWhat It Controls
defaultTokenBudget/subagent-config budget <tokens|unlimited>30,000,000Cumulative billed-equivalent token ceiling per subagent session (0 / unlimited disables)
defaultSessionTokenBudget/subagent-config session-budget <tokens|unlimited>100,000,000Total billed-equivalent tokens all subagents of one parent session may spend; when reached, running workers wind down and new dispatches are refused
defaultCostBudgetUsd/subagent-config cost-budget <usd|off>0 (off)Dollar ceiling per subagent session, priced request-by-request from Kompile's model price catalog (unpriced routes cannot be enforced)
defaultContextCeilingTok/subagent-config ceiling <tokens|off>0 (model window)Maximum request-context size before a forced checkpoint (0 uses each child model's own context window)
defaultWallClockMinutes/subagent-config time <minutes|off>30Active model minutes per subagent (tool execution and idle waiting do not count); carries across resumes until the worker winds down (0 / off disables)

Human-Only Budget Reset

When a worker hits its token or active-runtime limit, it finishes its current turn, posts its progress report, and stops. Only the human operator can grant a fresh budget for its next resume via /subagent-config refresh <subagent-id>.

Routing, Credentials, Model Bans & Failover ​

settings Key/subagent-config CommandDefaultWhat It Controls
defaultRoute/subagent-config route <spec|clear>UnsetDefault route billed by subagents: [provider[/model]] [auth=oauth|native|api-key|none] [credential=<name>] [thinking=<level>]
roleRoutes/subagent-config role-route <role> <spec|clear>{}Per-role routing overrides (e.g. route reviewer to a fast economical model)
bannedModels/subagent-config ban <glob> / unban / clear-bans[]Case-insensitive full globs (*, ?) against model ID or provider/model (e.g. *opus*, *fable*, anthropic/*). Routes with unknown models are refused whenever bans are active.
failoverEnabled / failoverRungs/subagent-config failovertrue / []Ordered fallback ladder used when a subagent route hits rate limits or outages

Subagents Never Borrow the Parent Chat's Login

Any subagent route billing a Kompile-held credential must explicitly name a saved credential (kompile auth list <provider>) — never paste raw API keys into config. Vendor CLI native logins (claude, opencode) are configured inside those CLIs outside Kompile.

Crash Auto-Resume ​

settings Key/subagent-config CommandDefaultWhat It Controls
workerAutoResume/subagent-config autoresume <on|off>trueAutomatically resumes a native worker once if it dies without posting its progress report
workerResumeGraceSeconds/subagent-config grace <seconds>30Delay before auto-resume fires

Worker Tool Surface & Prompt Footprint (Token Control) ​

settings Key/subagent-config CommandDefaultWhat It Controls
preloadTools/subagent-config preload-tools <a,b,c|default>Built-in defaultKompile tool IDs preloaded on a worker's first request when dispatch names none (progress is always included; all other Kompile tools stay deferred behind the tool loader, and workers never receive a vendor runtime's built-in tools)
agentsMd/subagent-config agents-md <claude-code|opencode|agy|provider> <auto|include|skip>autoControls sending the project's AGENTS.md per runtime. auto skips runtimes that already read it themselves (opencode, agy) so you never pay for it twice; include always sends; skip never sends.
vendorPrompt/subagent-config vendor-prompt <claude-code|opencode> <replace|include>replacereplace swaps the vendor runtime's system prompt for Kompile's (and disables Claude Code's auto-memory so Kompile's memory brief owns context); include appends Kompile's prompt to the vendor's. Antigravity's prompt cannot be replaced.

Step 3 — Tune Other Core Harness Settings (Judge, Compaction, Process Limits & Chat) ​

Ask for any of these in plain English — the agent routes each one to the matching onboarding(action="configure", section=...) target using the same preview (dryRun=true) → confirm (dryRun=false, confirmed=true) flow:

Plain-English RequestsectionKey settings Fields
"Turn on the Judge in strict mode with automatic rate-limit failover"harnessjudgeGlobalEnabled, judgeEnabled, judgeMode, judgeProvider, judgeModel, judgeEffort, rateLimitFallbackEnabled, editCoordinationMode
"Compact chat history earlier so long sessions stay sharp"auto_compactenabled, threshold, reserveTokens, contextWindowTokens, maxOutputTokens
"Kill runaway tests after 15 minutes and cap concurrent background jobs at 4"process_limitsenabled, maxRuntimeMinutes, testTimeoutMinutes, idleTimeoutMinutes, maxConcurrent, testPatterns, excludePatterns
"Switch default chat provider/model or passthrough mode"chatchatMode, passthroughAgent, defaultProvider, defaultModel, temperature, maxTokens
"Enable diff archiving and auto-rollback on Enforcer violations"enforcerarchiveDiffs, autoRollbackOnViolation, maxCorrections, judgeMode, judgeFallbackPolicy

Step 4 — Customize Guardrails (Enforcer, Policy Audits, Hooks & Judge) ​

4A. Add Enforcer Rules & Required Memory Files (enforcer_config) ​

Prompt: "Configure the project Enforcer to block placeholder and untested tokens in responses, require project:release-rules.md to be read on enforced turns, and test whether a draft phrase would be caught."

What the agent calls:

  1. enforcer_config(action="init") (if no project enforcer config exists yet)
  2. enforcer_config(action="add_keyword", ...) for banned keywords (or add_tool_ban to ban a tool)
  3. enforcer_config(action="set", field="workflow_required_memories", value="project:release-rules.md") and enforcer_config(action="set", field="workflow_mode", value="enforced")
  4. enforcer_config(action="test", ...) to verify semantic/keyword matching before finishing

4B. Set Up Periodic Subagent Policy Audits (policy_enforce) ​

For long-running autonomous sessions, ask your agent to configure /policy-enforce so an independent auditor subagent periodically checks adherence and interrupts on drift:

Prompt: "Add a project policy rule requiring every edited Java file to pass lsp action=check before finishing, audit every 10 turns, and use a fast haiku auditor."

What the agent calls:

  1. policy_enforce(action="add", scope="project", item="Every edited Java file must pass lsp action=check before finishing.")
  2. policy_enforce(action="set_trigger", scope="project", every="10") (or a duration such as "30m" or "2h")
  3. policy_enforce(action="set_auditor", scope="project", ...) (copying taskArguments from resolve_model)
  4. Optionally policy_enforce(action="run") to trigger an immediate audit on the active chat

4C. Add Deterministic Tool Hooks (hooks) ​

Prompt: "Add a project PostToolUse hook on write and edit that runs ./scripts/check-format.sh with a 30-second timeout."

What the harness does (only after you confirm): Registers the project PostToolUse hook matching ^(write|edit)$ → ./scripts/check-format.sh (timeout: 30s) via the hooks tool — no raw JSON needed.

Hooks are stored cleanly in .kompile/hooks.json (project) or ~/.kompile/hooks.json (global), and you can inspect or toggle them anytime with /hooks. Notice that the hooks tool itself is exempt from hook execution, so you can always ask the agent to disable or delete a misbehaving hook by ID.

4D. Steer the Judge for the Current Session (judge_control) ​

Prompt: "Tell the Judge for this session that running ./scripts/migrate-dev.sh against the local Docker DB is expected, and approve that command for the next turn."

What the agent calls (after confirmation):

  • judge_control(action="feedback", text="Running ./scripts/migrate-dev.sh against the local Docker DB is expected in this session.", confirmed=true)
  • judge_control(action="approve", command="./scripts/migrate-dev.sh", confirmed=true) (pass pattern=true for token globs such as ./scripts/migrate-*.sh **, or clear_feedback / cancel_approval to reset)

Step 5 — Teach the Harness Your Team's Workflows ​

5A. Turn Any Procedure Into a Reusable Skill (skill_manager) ​

Prompt: "Turn the release checklist we just ran into a project skill called release-check so anyone can run /release-check in chat."

What the agent calls:

5B. Create Specialist Roles (role_manager) ​

Prompt: "Create a security-reviewer role that focuses on auth boundaries, secret hygiene, and SQL injection, and assign it to our claude subagent with medium thinking."

What the agent calls:

5C. Wrap Recurring Checks as Cached Scripts (script_manager) ​

Prompt: "Save this flaky-test log parser as a project script called parse-surefire with result caching enabled."

What the agent calls:

5D. Add Declarative Custom Tools or Install External Client Harnesses ​


Step 6 — Package, Back Up & Share Your Customized Harness ​

Once your harness feels right, ask your agent to snapshot or distribute it:

6A. Export & Restore Portable Config Archives (config_archive) ​

Prompt: "Export my Kompile harness, chat, and system-prompt configs to a backup archive so I can import them on my laptop."

What the agent calls:

6B. Package Your Customizations Into a Kompile Spin (spin) ​

Prompt: "Scaffold a v2 Kompile spin called team-copilot, add our bundled MCP tool and release-check skill, validate it, and build a .kspin archive."

What the agent calls:

See Building a Kompile Spin for signing keys and fleet lifecycle ops.

6C. Ask an Agent to Build & Install a Physical JAR or Native Extension ​

Prompt: "Read docs/getting-started/extension-walkthrough.md, scaffold a Maven CliToolProvider JAR extension called jira-ext with a jira_issue tool and kompile jira command, run mvn package, and install it with kompile extension install."

Because Kompile's extension SPI (kompile-cli-plugin-api, kompile-cli-tool-api), drop-in JAR installer (kompile extension install <file.jar>), and native-image "kind": "executable" / "kind": "jar" packaging are all CLI-driven and statically validated, an agent can scaffold, compile, test, and install custom extensions end to end. See Building & Managing Extensions.

6D. Sync Customizations Across Machines (sources & peer) ​

Prompt: "Attach our shared team Git/S3 source for skills and memories, or sync my workspace with my GPU workstation peer."

The agent uses sources (discover → add → pull/push) and peer (init → add → sync). See Connecting Peers & Remote Storage.


Quick-Reference Cheat Sheet: What to Ask Your Agent ​

What You Want to CustomizeTool the Agent CallsRequires confirmed=true?Where It Persists
Full zero-secret config overviewonboarding(action="explain")No (read-only)—
Subagents, Judge, compaction, process limits, chat defaultsonboarding(action="configure", section=...)Yes (dryRun=false)~/.kompile/config/*.json, .kompile/
Enforcer banned keywords/tools, required memories, diff archivingenforcer_configNo (permission-gated).kompile/enforcer-config.json
Periodic subagent policy auditspolicy_enforceNo (permission-gated).kompile/policy-enforce.json (project/session)
Pre/post tool shell hookshooksYes.kompile/hooks.json / ~/.kompile/hooks.json
Session-scoped Judge feedback & one-shot approvalsjudge_controlYesCalling host session
Slash-command prompt skillsskill_managerNo.kompile/skills/ / ~/.kompile/skills/
Reusable agent personas & per-agent defaultsrole_managerNo.kompile/roles/ / ~/.kompile/roles/
Cached reusable scriptsscript_managerNo.kompile/scripts/ / ~/.kompile/scripts/
Detect / install external CLI harnesses (claude, codex, agy, …)harness_managerYes (install)System / vendor install paths
Backup & migrate harness configsconfig_archiveNo~/.kompile/archives/
Package an installable .kspin personaspinNoSpin directory / ~/.<spin-id>/
Physical .jar or native-binary extensionskompile extension install via bash + buildPermission-gated~/.kompile/extensions/jars/ or packages/

Next Steps ​

Released under the Apache-2.0 License.