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-configand/subagent-config failover - Enforcer & Judge: bare
/enforcer(/judge) menu,/enforcer init,kompile configure enforcer,kompile configure judge - Periodic policy audits: bare
/policy-enforceor/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:
- Preview before mutating:
onboarding(action="configure"|"auto_configure")defaults todryRun=trueso you review the exact plan first. - Explicit operator confirmation: Mutating
onboarding,hooks,judge_control, andharness_manager(action="install")requiresconfirmed=trueplus permission approval. - Subagents cannot touch guardrails: Delegated child workers are hard-blocked from installing harnesses, changing shell hooks, or altering Judge supervision.
- Zero-secret inspection:
onboarding(action="explain")reports what is configured without ever exposing raw API keys or tokens.
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:
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, andwrite, and preview the changes before applying."
What happens in two safe steps:
- Dry-run preview (default): The agent runs
onboardingin preview mode (dryRun=true) and shows you the exact before/after diff formaxConcurrent(6),maxConcurrentPerSession(3),defaultCostBudgetUsd($2.00),defaultWallClockMinutes(20),bannedModels(*opus*,*fable*),failoverEnabled(true), andpreloadTools(read,grep,glob,edit,write) — without touching disk yet. - 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 Command | Default | What 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 Command | Default | What It Controls |
|---|---|---|---|
defaultTokenBudget | /subagent-config budget <tokens|unlimited> | 30,000,000 | Cumulative billed-equivalent token ceiling per subagent session (0 / unlimited disables) |
defaultSessionTokenBudget | /subagent-config session-budget <tokens|unlimited> | 100,000,000 | Total 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> | 30 | Active 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 Command | Default | What It Controls |
|---|---|---|---|
defaultRoute | /subagent-config route <spec|clear> | Unset | Default 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 failover | true / [] | 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 Command | Default | What It Controls |
|---|---|---|---|
workerAutoResume | /subagent-config autoresume <on|off> | true | Automatically resumes a native worker once if it dies without posting its progress report |
workerResumeGraceSeconds | /subagent-config grace <seconds> | 30 | Delay before auto-resume fires |
Worker Tool Surface & Prompt Footprint (Token Control)
settings Key | /subagent-config Command | Default | What It Controls |
|---|---|---|---|
preloadTools | /subagent-config preload-tools <a,b,c|default> | Built-in default | Kompile 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> | auto | Controls 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> | replace | replace 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 Request | section | Key settings Fields |
|---|---|---|
| "Turn on the Judge in strict mode with automatic rate-limit failover" | harness | judgeGlobalEnabled, judgeEnabled, judgeMode, judgeProvider, judgeModel, judgeEffort, rateLimitFallbackEnabled, editCoordinationMode |
| "Compact chat history earlier so long sessions stay sharp" | auto_compact | enabled, threshold, reserveTokens, contextWindowTokens, maxOutputTokens |
| "Kill runaway tests after 15 minutes and cap concurrent background jobs at 4" | process_limits | enabled, maxRuntimeMinutes, testTimeoutMinutes, idleTimeoutMinutes, maxConcurrent, testPatterns, excludePatterns |
| "Switch default chat provider/model or passthrough mode" | chat | chatMode, passthroughAgent, defaultProvider, defaultModel, temperature, maxTokens |
| "Enable diff archiving and auto-rollback on Enforcer violations" | enforcer | archiveDiffs, 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
placeholderanduntestedtokens in responses, requireproject:release-rules.mdto be read on enforced turns, and test whether a draft phrase would be caught."
What the agent calls:
enforcer_config(action="init")(if no project enforcer config exists yet)enforcer_config(action="add_keyword", ...)for banned keywords (oradd_tool_banto ban a tool)enforcer_config(action="set", field="workflow_required_memories", value="project:release-rules.md")andenforcer_config(action="set", field="workflow_mode", value="enforced")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=checkbefore finishing, audit every 10 turns, and use a fast haiku auditor."
What the agent calls:
policy_enforce(action="add", scope="project", item="Every edited Java file must pass lsp action=check before finishing.")policy_enforce(action="set_trigger", scope="project", every="10")(or a duration such as"30m"or"2h")policy_enforce(action="set_auditor", scope="project", ...)(copyingtaskArgumentsfromresolve_model)- Optionally
policy_enforce(action="run")to trigger an immediate audit on the active chat
4C. Add Deterministic Tool Hooks (hooks)
Prompt: "Add a project
PostToolUsehook onwriteandeditthat runs./scripts/check-format.shwith 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.shagainst 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)(passpattern=truefor token globs such as./scripts/migrate-*.sh **, orclear_feedback/cancel_approvalto 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-checkso anyone can run/release-checkin chat."
What the agent calls:
skill_manager(action="create_skill", name="release-check", description="Run pre-release checks and tag verification", ...)— writes into.kompile/skills/(project) or~/.kompile/skills/(user).- Have existing Claude Code, Codex, Gemini, Qwen, or OpenCode skills in the repo? Ask "Scan our existing Claude and Codex skills and list what we can reuse" → calls
skill_manager(action="scan_provider_skills").
5B. Create Specialist Roles (role_manager)
Prompt: "Create a
security-reviewerrole that focuses on auth boundaries, secret hygiene, and SQL injection, and assign it to ourclaudesubagent with medium thinking."
What the agent calls:
role_manager(action="create_role", name="security-reviewer", display_name="Security Reviewer", category="development", system_prompt="...", agent_defaults={...})role_manager(action="assign_role", name="security-reviewer", agent="claude")
5C. Wrap Recurring Checks as Cached Scripts (script_manager)
Prompt: "Save this flaky-test log parser as a project script called
parse-surefirewith result caching enabled."
What the agent calls:
script_manager(action="create_script", ...)so future sessions invokescript(name="parse-surefire", ...)instead of rewriting ad-hoc inline shell commands.
5D. Add Declarative Custom Tools or Install External Client Harnesses
- Declarative JSON tools: Ask "Create a declarative custom tool
.kompile/tools/deploy_status.jsonthat queries our staging health endpoint" → the agent writes the JSON spec viawrite, immediately available ascustom_deploy_statusunderactivate_tools(["custom"]). - External CLI harnesses (
harness_manager): Ask "Check which coding harnesses are installed on this machine and installcodexif it's missing" → callsharness_manager(action="detect"), then after you confirm,harness_manager(action="install", harness="codex", confirmed=true). You can also ask "Find and import my existing Claude Code and Codex conversations" →harness_manager(action="detect_conversations")+onboarding(action="import_all", confirmed=true).
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:
config_archive(action="export", description="Team baseline harness config", components=["kompile-harness-config", "kompile-chat-config", "system-prompts"])→ writes a portable archive under~/.kompile/archives/.- On the new machine:
config_archive(action="preview", fileName="...")followed byconfig_archive(action="import", fileName="...", mode="append")(or"override").
6B. Package Your Customizations Into a Kompile Spin (spin)
Prompt: "Scaffold a v2 Kompile spin called
team-copilot, add our bundled MCP tool andrelease-checkskill, validate it, and build a.kspinarchive."
What the agent calls:
spin(action="init", directory="team-copilot", id="team-copilot", project=true)spin(action="component_add", directory="team-copilot", type="skill", ...)andtype="mcp"/type="hook"/type="enforcer"spin(action="validate", directory="team-copilot")→spin(action="build", ...)→spin(action="bundle_installer", ...)
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 MavenCliToolProviderJAR extension calledjira-extwith ajira_issuetool andkompile jiracommand, runmvn package, and install it withkompile 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 Customize | Tool the Agent Calls | Requires confirmed=true? | Where It Persists |
|---|---|---|---|
| Full zero-secret config overview | onboarding(action="explain") | No (read-only) | — |
| Subagents, Judge, compaction, process limits, chat defaults | onboarding(action="configure", section=...) | Yes (dryRun=false) | ~/.kompile/config/*.json, .kompile/ |
| Enforcer banned keywords/tools, required memories, diff archiving | enforcer_config | No (permission-gated) | .kompile/enforcer-config.json |
| Periodic subagent policy audits | policy_enforce | No (permission-gated) | .kompile/policy-enforce.json (project/session) |
| Pre/post tool shell hooks | hooks | Yes | .kompile/hooks.json / ~/.kompile/hooks.json |
| Session-scoped Judge feedback & one-shot approvals | judge_control | Yes | Calling host session |
| Slash-command prompt skills | skill_manager | No | .kompile/skills/ / ~/.kompile/skills/ |
| Reusable agent personas & per-agent defaults | role_manager | No | .kompile/roles/ / ~/.kompile/roles/ |
| Cached reusable scripts | script_manager | No | .kompile/scripts/ / ~/.kompile/scripts/ |
Detect / install external CLI harnesses (claude, codex, agy, …) | harness_manager | Yes (install) | System / vendor install paths |
| Backup & migrate harness configs | config_archive | No | ~/.kompile/archives/ |
Package an installable .kspin persona | spin | No | Spin directory / ~/.<spin-id>/ |
Physical .jar or native-binary extensions | kompile extension install via bash + build | Permission-gated | ~/.kompile/extensions/jars/ or packages/ |
Next Steps
- Agent Skill (
SKILL.md) — Give any model Kompile's complete operating & self-configuration manual. - Building a Kompile Spin — Package your customized harness into a signed
.kspinor self-extracting installer. - Building & Managing Extensions — Build physical SPI JARs, runnable JAR packages, and GraalVM native-image plugins.
- Standard Daily Workflow — Day-to-day rhythm for growing skills, scripts, roles, and cost controls across sessions.
- The Enforcer, The Judge, and Tool Hooks — Deep dives into Kompile's guardrail layers.