Building a Kompile Spin (Extensions, Custom Tools & kompile spin)
A Kompile Spin packages a tailored AI persona — its system prompt, instructions, roles, skills, hooks, policies, custom tools, bundled MCP servers, optional local models, and optional Kompile runtime — into a single signed, verifiable .kspin archive (or self-extracting .sh / .ps1 installer) that anyone can install and run as its own command.
This walkthrough takes you end to end from an empty directory to a signed, installable spin (ops-copilot), showing how kompile spin, custom tools (both bundled MCP servers and declarative JSON tools), and extensions (process extension packages, harness primitives, and Java SPI) fit together.
Reference Docs
This page is a hands-on walkthrough. For concise field references, see Kompile Spins and Extensions & Plugins.
What You Will Build
By the end of this guide, you will author, sign, package, and install ops-copilot:
ops-copilot/ # Spin source directory (checked into Git)
├── spin.yaml # Spin identity, schemaVersion ('1' or '2'), runtime mode
├── agent.yaml # Role, tool allowlist, prompt, skills, MCP servers, models
├── prompt.md # System prompt
├── instructions.md # Operator instructions (materialized into workspace AGENTS.md)
├── skills/
│ └── incident-triage.md # Bundled repeatable workflow skill
├── tools/
│ └── ops-mcp-server # Bundled stdio MCP server (upgrades atomically with .kspin)
├── workspace/
│ └── .kompile/
│ └── tools/
│ ├── release_tag.json # Declarative bash custom tool (seeded into workspace)
│ └── deploy_status.json # Declarative HTTP custom tool (seeded into workspace)
├── hooks/
│ └── hooks.json # Pre/post tool policy hooks
└── enforcer/
└── enforcer-config.json # Deterministic guardrail rules
# Installed on a teammate's machine (default --home ~/.ops-copilot)
~/.ops-copilot/
├── bin/ops-copilot # Generated launcher (interactive chat, exec, doctor)
├── current -> releases/0.1.0-<sha>/ # Atomic symlink to active immutable release
├── releases/0.1.0-<sha>/ # Verified read-only release (${SPIN_ROOT})
└── workspace/ # Persistent project workspace (${SPIN_WORKSPACE})
├── AGENTS.md # Generated from instructions.md + workspace/AGENTS.md
├── .mcp.json # Generated MCP config pointing at ${SPIN_ROOT}/tools/...
└── .kompile/
├── roles/ # Managed role definitions
├── skills/ # Managed skills
├── hooks/ # Managed hooks
└── tools/ # Seeded declarative JSON custom tools (user-editable)1. Choosing Where Tools & Extensions Live
Kompile gives you four complementary ways to extend a spin or the CLI itself. Pick the lightest mechanism that matches your distribution and upgrade model:
| Mechanism | Where It Lives | Exposed As | Upgrade Behavior | Best For |
|---|---|---|---|---|
Bundled MCP Server (tools/<server>) | Inside the immutable .kspin release (${SPIN_ROOT}) | mcp__<server>__<tool> (auto-wired into workspace .mcp.json) | Upgrades and rolls back atomically with every .kspin release | Production tools owned by the spin publisher, API clients, stateful local helpers, anything needing includeTools / excludeTools |
Declarative JSON Custom Tools (workspace/.kompile/tools/*.json) | Seeded into ~/.<spin-id>/workspace/.kompile/tools/ | custom_<name> (enabled via activate_tools(["custom"])) | Seeded on first install; user edits are preserved across upgrades | Lightweight bash or HTTP wrappers without writing an MCP server |
Process Extension Package (extension.json) | ~/.kompile/extensions/packages/<id>/<version>/ | New top-level kompile <subcommand> CLI commands and mcp__extension_<id>__<name> tools | Installed/upgraded via kompile extension install --replace | Reusable cross-project CLI subcommands + MCP tools in any language (Rust, Go, Python, Node, shell, JAR), including in GraalVM native binaries |
Compiled Java Plugin SPI (kompile-cli-plugin-api / kompile-cli-tool-api) | Build classpath of a custom Kompile dist or native image | In-process Picocli commands & native MCP/chat tools | Compiled into the binary or JAR | Trusted first-party or enterprise in-process Java extensions |
2. The kompile spin Command Reference
kompile spin is available from the main CLI (kompile spin ...), through the delegated agent CLI (kompile-agent spin ... / kompile agent spin ...), interactively inside kompile chat via /spin, and programmatically to agents via the spin chat tool.
Authoring & Component Composition
| Subcommand | Purpose | Key Flags |
|---|---|---|
kompile spin init <dir> | Scaffold a new spin source directory | --id, --version, --display-name, --project / --v2, --delivery native|mixed|jar, --web-bind, --no-web, --runtime-dir |
kompile spin component list <dir> | List declared components in a spin source tree (aliases: components, ls) | — |
kompile spin component add <dir> | Add or update a component in agent.yaml, spin.yaml, or project/kompile.project.json | --type, --id, --component, --version, --source, --path, --command, --arg, --env, --bundled, --required, --include-tool, --exclude-tool, --tokenizer, --provider, --default, --model-ref, --os, --arch, --backend, --component-type, --description, --materialization, --build-tier, --runtime-dir, --all |
kompile spin component remove <dir> | Remove a declared component entry (alias: rm) | --type, --id |
Supported --type values for kompile spin component add:
- Tools & AI assets:
mcp,skill,model,pipeline,knowledge-pack - Harness primitives:
role,hook,workflow,enforcer,permissions - Runtime & v2 distribution composition:
kompile-runtime,software,target,project-component,web-panel,entrypoint,product-profile
Validation, Signing & Packaging
| Subcommand | Purpose | Key Flags |
|---|---|---|
kompile spin validate <dir|.kspin> | Validate manifest, paths, secret hygiene, hashes, and optional Ed25519 signature | --signature, --trusted-key, --runtime-dir |
kompile spin keygen | Generate an Ed25519 publisher keypair (store outside the spin directory) | --private-key, --public-key, --force |
kompile spin sign <archive> | Produce a detached Ed25519 .sig file for an existing .kspin archive | --private-key, -o <sig> |
kompile spin build <dir> | Package a deterministic .kspin archive (+ spin-lock.json & CycloneDX spin-sbom.cdx.json for v2) | -o <archive>, --runtime-dir, --signing-key, --signature-output |
kompile spin bundle-installer <archive> | Generate a self-extracting shell (.sh) or PowerShell (.ps1) installer | -o <path>, --format sh|ps1, --signature, --trusted-key |
Installation, Execution & Lifecycle Operations
| Subcommand | Purpose | Key Flags |
|---|---|---|
kompile spin install <archive> | Verify and install a .kspin into an isolated home (default ~/.<spin-id>) | --home, --signature, --trusted-key |
kompile spin launch | Start an interactive session for an installed spin (alias: run) | --home |
kompile spin exec <prompt...> | Run a one-shot non-interactive prompt against an installed spin | --home |
kompile spin list | List installed spins under ~/.<id> or a custom base directory (alias: ls) | --home, --base-dir |
kompile spin doctor | Inspect release integrity, runtime availability, MCP servers, and workspace health | --home |
kompile spin qualify | Run end-to-end readiness checks on an installed spin release | --home |
kompile spin provision | Materialize external/provisioned components from a manifest | --home, --manifest |
kompile spin upgrade <path|url> | Install a newer .kspin atomically while preserving workspace/ user data | --home, --signature, --trusted-key, --sha256 |
kompile spin rollback | Switch current back to the previous (or named) immutable release | --home, --release |
kompile spin support-bundle | Collect redacted diagnostics for bug reports or support tickets | --home, -o <archive> |
kompile spin uninstall | Remove launcher and releases (keeps workspace/ unless --purge-workspace) | --home, --purge-workspace |
3. Step 1 — Scaffold Your Spin
You can start with either a v1 persona spin (thin or embedded runtime, fastest for prompt + tool personas) or a v2 project-backed spin (adds project/kompile.project.json, software/runtime target manifests, lockfiles, and CycloneDX SBOMs).
Option A: v1 Persona Spin (Fastest Start)
kompile spin init ops-copilot \
--id ops-copilot \
--version 0.1.0 \
--display-name "Ops Copilot"
cd ops-copilotThis creates spin.yaml (schemaVersion: '1'), agent.yaml, prompt.md, instructions.md, tools/, and skills/.
Option B: v2 Project-Backed Spin (Full Distribution & Local Web Chat)
Pass --project (or --v2) when you want a self-contained distribution with explicit runtime targets, software pins, web panels, and SBOM/lockfile outputs:
kompile spin init ops-copilot \
--project \
--id ops-copilot \
--version 0.1.0 \
--display-name "Ops Copilot" \
--delivery native \
--web-bind 127.0.0.1
cd ops-copilot--project generates spin.yaml (schemaVersion: '2', runtime.delivery: embedded, project.template: project) alongside project/kompile.project.json with --delivery native|mixed|jar. Pass --no-web if you want a CLI-only spin, or --runtime-dir /path/to/kompile-dist to register Kompile runtime artifacts right away.
Customize the Prompt, Instructions, and Role
Edit prompt.md and instructions.md to define the persona's voice and operating rules:
<!-- prompt.md -->
You are Ops Copilot, an incident response and release verification assistant.
Always check live service health before recommending a rollback, cite tool
outputs verbatim, and never fabricate deployment status.<!-- instructions.md -->
- Verify service health with `ops-tools` before proposing mitigation steps.
- Use `custom_release_tag` and `custom_deploy_status` (after activating the
`custom` tool group) for release inspection.
- Keep incident notes under `workspace/notes/`.When the spin is installed, Kompile combines instructions.md (and any starter workspace/AGENTS.md) into ~/.ops-copilot/workspace/AGENTS.md and writes the role definition from agent.yaml into ~/.ops-copilot/workspace/.kompile/roles/ops-copilot.md.
4. Step 2 — Add Custom Tools to Your Spin
Most spins combine bundled MCP servers (for versioned, code-backed tools that must upgrade cleanly with the spin) and declarative JSON custom tools (for lightweight shell/HTTP helpers that users can inspect or tweak in their workspace).
4A. Add a Bundled Stdio MCP Tool Server
Create an executable stdio MCP server under tools/. Below is a minimal self-contained Python 3 server (tools/ops-mcp-server) implementing JSON-RPC 2.0 initialize, tools/list, and tools/call:
#!/usr/bin/env python3
"""Minimal stdio MCP server bundled inside the ops-copilot spin."""
import json
import os
import sys
from datetime import datetime, timezone
TOOL_SPEC = {
"name": "check_service_health",
"description": "Check health status for a named service using the spin workspace context.",
"inputSchema": {
"type": "object",
"properties": {
"service": {"type": "string", "description": "Service identifier, e.g. billing-api"}
},
"required": ["service"],
},
}
def reply(req_id, result=None, error=None):
msg = {"jsonrpc": "2.0", "id": req_id}
if error is not None:
msg["error"] = error
else:
msg["result"] = result
sys.stdout.write(json.dumps(msg) + "\n")
sys.stdout.flush()
for raw in sys.stdin:
raw = raw.strip()
if not raw:
continue
req = json.loads(raw)
method = req.get("method")
req_id = req.get("id")
if method == "initialize":
reply(req_id, {
"protocolVersion": "2024-11-05",
"capabilities": {"tools": {}},
"serverInfo": {"name": "ops-tools", "version": "0.1.0"},
})
elif method == "notifications/initialized":
continue
elif method == "tools/list":
reply(req_id, {"tools": [TOOL_SPEC]})
elif method == "tools/call":
args = req.get("params", {}).get("arguments", {})
service = args.get("service", "unknown")
has_token = bool(os.environ.get("OPS_API_TOKEN"))
workspace = os.environ.get("KOMPILE_SPIN_WORKSPACE", "")
payload = {
"service": service,
"status": "healthy",
"authenticated": has_token,
"workspace": workspace,
"checkedAt": datetime.now(timezone.utc).isoformat(),
}
reply(req_id, {"content": [{"type": "text", "text": json.dumps(payload)}]})
elif req_id is not None:
reply(req_id, error={"code": -32601, "message": f"Unknown method: {method}"})Make it executable and register it with kompile spin component add:
chmod +x tools/ops-mcp-server
kompile spin component add . \
--type mcp \
--id ops-tools \
--command tools/ops-mcp-server \
--bundled \
--required \
--include-tool check_service_health \
--env OPS_API_TOKEN='${OPS_API_TOKEN}'That updates agent.yaml with a clean, validated mcp.servers entry:
mcp:
servers:
- id: ops-tools
bundled: true
executable: true
required: true
command: tools/ops-mcp-server
includeTools:
- check_service_health
env:
OPS_API_TOKEN: ${OPS_API_TOKEN}Important Bundled MCP Rules
- Path placeholders: You may reference
${SPIN_ROOT}(the installed immutable release),${SPIN_HOME}(e.g.~/.ops-copilot), and${SPIN_WORKSPACE}(~/.ops-copilot/workspace) insideargs,cwd, andenv. Kompile also injectsKOMPILE_SPIN_ROOT,KOMPILE_SPIN_HOME, andKOMPILE_SPIN_WORKSPACEinto every MCP server's environment automatically. - No hardcoded secrets:
kompile spin validaterejects literal values in sensitive environment variable names (such as*_TOKEN,*_KEY,*_SECRET,*_PASSWORD). Always pass an environment variable reference like'${OPS_API_TOKEN}'so each user supplies their own credential at runtime. - Containment: If you set
cwd, it must stay within${SPIN_ROOT}— paths that escape the installed spin fail validation. - Cross-platform scripts: On Windows, bundled
.cmd/.batcommands are automatically wrapped viacmd.exe /d /cwhen.mcp.jsonis generated. - Tool filtering: Use
--include-tool/--exclude-tool(orincludeTools/excludeToolsinagent.yaml) to expose only the specific operations this persona should call.
4B. Add Declarative JSON Custom Tools (Zero-Code Bash & HTTP Tools)
When you only need a quick shell command or HTTP endpoint — without maintaining an MCP server — place .json tool specs inside workspace/.kompile/tools/. During spin installation, Kompile copies everything under workspace/ into ~/.ops-copilot/workspace/, where Kompile automatically discovers project-scoped .kompile/tools/*.json files.
Create a bash-backed tool (workspace/.kompile/tools/release_tag.json):
{
"name": "release_tag",
"description": "Inspect the latest Git tags matching a prefix in the current repository",
"parameters": {
"type": "object",
"properties": {
"prefix": {
"type": "string",
"description": "Tag prefix such as v0.1"
}
},
"required": ["prefix"]
},
"execute": {
"type": "bash",
"command": "git tag --list '{{prefix}}*' --sort=-creatordate | head -n 10",
"working_dir": "."
},
"timeout_seconds": 30
}And an HTTP-backed tool (workspace/.kompile/tools/deploy_status.json):
{
"name": "deploy_status",
"description": "Fetch deployment health JSON for an environment",
"parameters": {
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "Target environment (staging, prod)"
}
},
"required": ["env"]
},
"execute": {
"type": "http",
"url": "https://deploy.internal/api/status/{{env}}",
"method": "GET",
"headers": {
"Accept": "application/json"
}
},
"timeout_seconds": 30
}How Declarative Custom Tools Behave in a Spin
- Registration & activation: Each file registers as
custom_<name>(herecustom_release_tagandcustom_deploy_status) inside the dynamiccustomMCP group. Agents enable them on demand withactivate_tools(["custom"]). - Template interpolation: Parameter placeholders like
{{prefix}}and{{env}}are substituted from the tool call arguments;timeout_secondsdefaults to30. - Upgrade preservation:
workspace/template files are copied only if the target path does not already exist in~/.ops-copilot/workspace/. That means users can customize a seeded JSON tool without losing changes onkompile spin upgrade. If you want tool code to update strictly on every release, ship it as a bundled MCP server instead (Section 4A).
5. Step 3 — Add Extensions & Harness Primitives
5A. Compose Harness Primitives & Distribution Components
Use kompile spin component add to wire skills, extra roles, hooks, workflows, enforcer rules, permission policies, knowledge packs, models, and runtime binaries into your spin without hand-editing manifests:
# 1. Bundle a skill (copied into skills/ and registered in agent.yaml)
kompile spin component add . \
--type skill \
--id incident-triage \
--source ./skills/incident-triage.md
# 2. Bundle an additional team role (materialized into workspace/.kompile/roles/)
kompile spin component add . \
--type role \
--id release-auditor \
--source ./roles/release-auditor.md
# 3. Bundle pre/post tool hooks and deterministic enforcer rules
kompile spin component add . \
--type hook \
--id ops-hooks \
--source ./hooks/hooks.json
kompile spin component add . \
--type enforcer \
--id ops-enforcer \
--source ./enforcer/enforcer-config.json
kompile spin component add . \
--type permissions \
--id ops-permissions \
--source ./enforcer/permissions.json
# 4. Bundle a versioned read-only knowledge pack (materialized into data/knowledge-packs/<release>/)
kompile spin component add . \
--type knowledge-pack \
--id runbooks \
--source ./runbooks-pack
# 5. Optional: bundle a local GGUF model + tokenizer as the default chat model
kompile spin component add . \
--type model \
--id local-ops-llm \
--source /models/qwen2.5-7b-instruct.gguf \
--tokenizer /models/tokenizer.json \
--provider kompile-local \
--default
# 6. Optional (v2 project-backed spin): register Kompile runtime binaries & target platform
kompile spin component add . \
--type kompile-runtime \
--runtime-dir /path/to/kompile-dist \
--all
kompile spin component add . \
--type target \
--id linux-x86_64 \
--os linux \
--arch x86_64 \
--backend nd4j-nativeInspect or prune your composed components at any time:
kompile spin component list .
kompile spin component remove . --type role --id release-auditor5B. Build a Process Extension Package (kompile extension)
If you also want to ship new top-level kompile <subcommand> commands alongside MCP tools — usable across all projects and spins on a machine, including inside GraalVM native cli-harness binaries without dynamic Java classloading — create a Process Extension Package (for a full end-to-end walkthrough of built-in and custom extensions, see Building & Managing Kompile Extensions).
Create a directory ops-ext/ with extension.json at its root:
ops-ext/
├── extension.json
└── bin/
└── ops-ext # Executable script or compiled binary (or a runnable .jar)ops-ext/extension.json:
{
"schemaVersion": 1,
"apiVersion": 1,
"id": "ops-ext",
"version": "1.0.0",
"timeoutSeconds": 60,
"commands": {
"ops-status": {
"kind": "executable",
"path": "bin/ops-ext",
"args": ["--cli"]
}
},
"mcp": {
"kind": "executable",
"path": "bin/ops-ext",
"args": ["--mcp"]
},
"tools": [
{
"name": "incident_summary",
"description": "Summarize open incidents for a service",
"inputSchema": {
"type": "object",
"properties": {
"service": { "type": "string" }
},
"required": ["service"]
}
}
]
}Install, inspect, upgrade, or remove the extension package from the CLI (or inside chat with /extension):
# Install from a local directory, .zip archive, https:// URL, or configured source
kompile extension install ./ops-ext
kompile extension install ./ops-ext-1.0.0.zip --sha256 <64-hex-chars>
kompile extension install --from-source team-artifacts ops-ext
# Verify composed commands and exported MCP tools
kompile extension
kompile extension inspect ops-ext --json
# Run the new top-level CLI subcommand added by the extension
kompile ops-status --service billing-api
# Upgrade atomically or deactivate cleanly
kompile extension install ./ops-ext-1.1.0.zip --replace
kompile extension remove ops-extProcess Extension Security & Runtime Contract
- Zero code execution on install: Kompile validates the manifest and copies the payload into an immutable directory under
~/.kompile/extensions/packages/<id>/<version>/, activating it atomically ininstalled.json. - Safe archive & process execution:
.zipinstalls reject symlinks, path traversal, > 4,096 entries, and > 512 MiB uncompressed payloads. Arguments are passed literally with no shell interpolation. - Executable or JAR: Use
"kind": "executable"for native binaries or scripts (no JVM required), or"kind": "jar"to launch a runnable JAR via Kompile's Java runtime locator. Child processes receiveKOMPILE_EXTENSION_ID,KOMPILE_EXTENSION_VERSION, andKOMPILE_EXTENSION_ROOT. - Strict MCP export: Declared tools appear as
mcp__extension_ops-ext__incident_summarywith permission keymcp.extension-ops-ext. Undeclared tools returned by the subprocess are ignored. - Safe recovery: Even if a buggy package fails at runtime,
kompile extension remove <id>loads compiled commands only so you can always deactivate it.
5C. Compiled Java Plugin SPI (In-Process Extensions)
When you are building a custom Kompile distribution or native image and want trusted in-process Java commands and tools (without spawning a subprocess), implement the two lightweight SPI modules:
kompile-cli-plugin-api(JDK + Picocli only): implementCliExtensionviaServiceLoader, returning aCliExtensionDescriptorand Picocli subcommands.kompile-cli-tool-api(plugin-api + Jackson only): implementCliToolProviderandExtensionTool<C>to contribute native chat and MCP tools with permission checks and safe path resolution.
See Extensions & Plugins and CLI Extension Composition for the full SPI contract and native-image registration guide.
6. Step 4 — Validate, Sign, Package & Build an Installer
1. Validate the Source Directory
kompile spin validate .validate checks spin.yaml, agent.yaml, referenced prompts/skills/models/tools, symlink hygiene, secret-placeholder rules, and (for v2 spins) project/kompile.project.json completeness.
2. Generate an Ed25519 Publisher Keypair (Outside the Spin Directory)
Never Put Private Keys Inside the Spin Directory
Always store publisher-private.pem outside your spin source tree (for example in ../keys/ or your CI secret store) so it can never be packaged into a .kspin archive.
mkdir -p ../keys
kompile spin keygen \
--private-key ../keys/publisher-private.pem \
--public-key ../keys/publisher-public.pem3. Build and Sign the .kspin Archive
kompile spin build . \
-o ../ops-copilot-0.1.0.kspin \
--signing-key ../keys/publisher-private.pemThis produces:
../ops-copilot-0.1.0.kspin— deterministic, normalized.kspinarchive containingspin-manifest.json(SHA-256 digests of every payload file) plus, for v2 spins,spin-lock.jsonand CycloneDXspin-sbom.cdx.json.../ops-copilot-0.1.0.kspin.sig— detached Ed25519 signature.
You can also sign an already-built archive later with kompile spin sign ../ops-copilot-0.1.0.kspin --private-key ../keys/publisher-private.pem.
4. Verify the Built Archive
kompile spin validate ../ops-copilot-0.1.0.kspin \
--trusted-key ../keys/publisher-public.pem5. Optional: Build Self-Extracting Installers (.sh and .ps1)
For teammates who want a single downloadable installer that verifies your Ed25519 signature before installing:
# macOS / Linux self-extracting shell installer
kompile spin bundle-installer ../ops-copilot-0.1.0.kspin \
-o ../install-ops-copilot.sh \
--format sh \
--signature ../ops-copilot-0.1.0.kspin.sig \
--trusted-key ../keys/publisher-public.pem
# Windows PowerShell self-extracting installer
kompile spin bundle-installer ../ops-copilot-0.1.0.kspin \
-o ../install-ops-copilot.ps1 \
--format ps1 \
--signature ../ops-copilot-0.1.0.kspin.sig \
--trusted-key ../keys/publisher-public.pem7. Step 5 — Install, Launch & Operate Your Spin
Install & Run
# Install into ~/.ops-copilot (override with --home /custom/path)
kompile spin install ../ops-copilot-0.1.0.kspin \
--trusted-key ../keys/publisher-public.pem
# Launch interactive chat (via the generated launcher or kompile spin launch)
~/.ops-copilot/bin/ops-copilot
# or:
kompile spin launch --home ~/.ops-copilot
# Run a single non-interactive prompt (great for CI or cron jobs)
OPS_API_TOKEN="tok_live_..." ~/.ops-copilot/bin/ops-copilot \
exec "Check billing-api health and list the latest v0.1 release tags"Opt-In Persistent Memory
Interactive and one-shot spin runs keep sessions stateless by default. Pass --memory when launching to opt into persistent cross-session recall inside ~/.ops-copilot/workspace/.
Verify Health, Qualify & Inspect
# Check release digest, runtime, MCP servers, and workspace state
~/.ops-copilot/bin/ops-copilot doctor
kompile spin qualify --home ~/.ops-copilot
# List all installed spins on this machine
kompile spin listUpgrade, Rollback, Support Bundles & Uninstall
# Upgrade atomically from a local archive or HTTPS URL (preserves workspace/ data)
kompile spin upgrade ../ops-copilot-0.2.0.kspin \
--home ~/.ops-copilot \
--trusted-key ../keys/publisher-public.pem \
--sha256 <64-hex-chars>
# Roll back instantly to the previous immutable release if 0.2.0 misbehaves
kompile spin rollback --home ~/.ops-copilot
# Package a redacted diagnostic archive for troubleshooting
kompile spin support-bundle --home ~/.ops-copilot -o /tmp/ops-copilot-support.zip
# Uninstall launcher and releases (keeps workspace/ unless --purge-workspace is passed)
kompile spin uninstall --home ~/.ops-copilotManaging Spins From Inside Chat
Inside any kompile chat session you can run the same authoring and diagnostics flows without leaving the REPL:
- Slash command:
/spin init ...,/spin component list .,/spin validate .,/spin build .,/spin doctor - Agent tool (
spin): Ask your agent to inspect, add components to, validate, build, qualify, or bundle an installer for a spin using the built-inspintool (actions:status,init,component_list,component_add,component_remove,validate,build,bundle_installer,list,upgrade,rollback,qualify,provision,support_bundle,doctor).
8. Troubleshooting & Security Checklist
| Symptom | Cause | Fix |
|---|---|---|
validate rejects an env value in agent.yaml | Sensitive variable name (*_TOKEN, *_KEY, *_SECRET) contains a literal string | Replace the literal value with an env-var reference like ${OPS_API_TOKEN} |
validate or install rejects a file as a symlink | Spins forbid symlinks in source trees, archives, and workspace templates | Replace symlinks with regular files before running kompile spin build |
MCP cwd escapes the installed spin | MCP server cwd resolves outside ${SPIN_ROOT} | Keep cwd inside ${SPIN_ROOT} (or omit it and pass ${SPIN_WORKSPACE} via args/env) |
| Declarative JSON tool isn't called by the agent | Tools in .kompile/tools/*.json live in the lazy custom group | Instruct the agent in instructions.md to call activate_tools(["custom"]), then call custom_<name> |
Updated workspace/.kompile/tools/*.json didn't overwrite on upgrade | workspace/ templates intentionally preserve user files once created | For publisher-controlled tools that must update atomically on upgrade, ship them as a bundled MCP server (tools/ + --type mcp --bundled) |
| Broken process extension blocks a workflow | Extension binary crashed or exited non-zero | Run kompile extension remove <id> (always runs using compiled commands only) |
Next Steps
- Kompile Spins Reference — Complete manifest schemas (
spin.yaml,agent.yaml), runtime delivery modes (thin,embedded, v2native/mixed/jar), and workspace isolation rules. - Extensions & Plugins — Full reference for process extension packages, Java Plugin SPI, custom MCP servers, declarative JSON tools, skills, roles, and hooks.
- Custom MCP Servers — Connecting external stdio, HTTP, and SSE MCP servers with
kompile mcp. - Tool Hooks — Enforcing deterministic pre/post tool checks in
.kompile/hooks.json. - Curated Spin Distributions Architecture — Deep dive into v2 project-backed composition, lockfiles, and SBOM verification.