[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M723E99VBZ6D9XCG10RPJMM1":3,"skill-same:01M723E99VBZ6D9XCG10RPJMM1":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M723E99VBZ6D9XCG10RPJMM1","scaffold-a-harbor-agent",null,"Scaffold a new Harbor agent project with `harbor init` + `harbor scaffold`. Use when starting a fresh agent from zero — drops a tiered, commented `harbor.yaml`, the companion AGENTS.md \u002F CLAUDE.md \u002F README.md, and materialises the Go project so `harbor dev` boots a working runtime in under five minutes.","hurtener\u002FHarbor","hurtener","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F117486687?v=4","01M723BZXGKZDHCZ9JHRV24W4D","Santi Benvenuto","01M723BZY77XR795N9PK1BS4GX",6,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fscaffold-a-harbor-agent\u002FSKILL.md",[],[],"2026-11-10 18:39:20",false,"---\nname: scaffold-a-harbor-agent\ndescription: \"Scaffold a new Harbor agent project with `harbor init` + `harbor scaffold`. Use when starting a fresh agent from zero — drops a tiered, commented `harbor.yaml`, the companion AGENTS.md \u002F CLAUDE.md \u002F README.md, and materialises the Go project so `harbor dev` boots a working runtime in under five minutes.\"\nlicense: Apache-2.0\nmetadata:\n  framework: harbor\n  surface: cli\n  verbs: \"init, scaffold, validate, serve, tui\"\n---\n\n# Scaffold a new Harbor agent\n\nHarbor ships one static binary — `harbor` — and a four-step flow that lands a working agent in under five minutes:\n\n```bash\nharbor init --target \u003Cdir>         # drop the tiered yaml + companion docs\n$EDITOR \u003Cdir>\u002Fharbor.yaml          # pick a provider, set api_key\nharbor validate \u003Cdir>\u002Fharbor.yaml  # fail-loud config check\nharbor scaffold --name \u003Cname>      # materialise the Go project\n```\n\nThe flow is deliberately bounded — `harbor init` does not assume what LLM you have keys for or what tools you need. It drops a *tiered* `harbor.yaml` (REQUIRED → COMMON → ADVANCED sections) plus three companion files (AGENTS.md \u002F CLAUDE.md \u002F README.md) that document the project for human contributors and AI coding agents alike. You edit the yaml, validate it, then scaffold a Go project around it.\n\nBuilding Harbor or its generated projects requires Go 1.27.1 or newer. Install\nthat toolchain before running the build steps below; prebuilt Harbor binaries\ndo not require Go on the operator's machine.\n\n## 1. Drop the tiered yaml\n\n```bash\nharbor init --target ~\u002Fmy-first-agent\n```\n\nYou get:\n\n```text\n~\u002Fmy-first-agent\u002F\n├── harbor.yaml      # the tiered config (REQUIRED \u002F COMMON \u002F ADVANCED)\n├── AGENTS.md        # contributor + AI-agent rules (verbatim mirror of CLAUDE.md)\n├── CLAUDE.md        # same\n└── README.md        # quickstart pointer for human contributors\n```\n\nThe yaml has a `REQUIRED` block at the top with four commented LLM-provider examples (OpenRouter \u002F Anthropic direct \u002F OpenAI direct \u002F NVIDIA NIM). **Uncomment exactly one block and set `api_key: env.YOUR_KEY_NAME`.** Bifrost (Harbor's LLM driver) speaks many providers under one wire surface; the four examples cover the common cases. The full provider list is in `docs\u002FCONFIG.md`.\n\n`AGENTS.md` and `CLAUDE.md` are verbatim mirrors — Claude Code picks up `CLAUDE.md` automatically; other agents pick up `AGENTS.md`. Edit one, then `cp AGENTS.md CLAUDE.md` (or vice versa). If they drift, your project's drift-audit catches it.\n\n## 2. Pick a provider, set an API key\n\n```bash\n$EDITOR ~\u002Fmy-first-agent\u002Fharbor.yaml\n```\n\nUncomment one provider block:\n\n```yaml\nllm:\n  driver: bifrost\n  provider: openrouter\n  model: anthropic\u002Fclaude-haiku-4.5\n  api_key: env.OPENROUTER_API_KEY\n  timeout: 60s\n```\n\nThen export the key:\n\n```bash\nexport OPENROUTER_API_KEY=sk-or-...   # or set via .env\n```\n\nHarbor's LLM driver reads the env var at boot. A missing key fails LOUDLY at startup with `ErrMissingAPIKey` — there is no silent fallback to a stub (CLAUDE.md §13: test stubs are never production defaults). If you want a dev-only mock for first-clone convenience, set `HARBOR_DEV_ALLOW_MOCK=1` and see [`wire-the-llm-provider`](..\u002Fwire-the-llm-provider\u002FSKILL.md).\n\n## 3. Validate before scaffolding\n\n```bash\nharbor validate ~\u002Fmy-first-agent\u002Fharbor.yaml\n```\n\n`harbor validate` runs Harbor's config loader against your yaml with **file:line precision** error messages — a missing `llm.driver`, a malformed `tools.mcp_servers[0].command`, or a `memory.budget_tokens` set to a negative number all surface here. Run this every time you edit the yaml; the failure modes are usually obvious from the message.\n\nIf `validate` is clean, you're cleared to scaffold the Go project.\n\n## 4. Materialise the Go project\n\n```bash\ncd ~\u002Fmy-first-agent\nharbor scaffold --name my-first-agent\n```\n\n`harbor scaffold` reads the yaml and drops a Go project around it:\n\n```text\nmy-first-agent\u002F\n├── go.mod\n├── README.md\n├── agent.go                    # your agent code (worked EchoAgent + RegisterTools)\n├── agent_test.go               # harbortest-driven smoke test\n├── tools\u002F                      # one typed stub per tools.custom[] yaml entry\n│   └── \u003Cname>.go \u002F \u003Cname>_test.go\n└── harbor.yaml                 # the same yaml init dropped (copied verbatim)\n```\n\nWhen the yaml declares tools (`tools.built_in` \u002F `tools.custom`), `agent.go` gains a generated `RegisterTools` function and each **custom** tool gets a typed stub (input struct, output struct, handler) under `tools\u002F`. The generated imports are the public `sdk\u002F` facade paths, so the project builds as a standalone external module. When the yaml declares custom tools, the generated `agent_test.go` also gains a register-and-dispatch test that calls `RegisterTools` and invokes a declared tool **through the tool catalog** — so `go test .\u002F...` proves your tools are actually wired, not just that the project compiles. Keep that test green as you replace the stubs with real tools. Use the stubs as the template for your real tools (see [`add-an-in-process-tool`](..\u002Fadd-an-in-process-tool\u002FSKILL.md)).\n\n**`RegisterTools` carries your COMPILED tools only — never built-ins.** A tool you opt into under `tools.built_in` (`clock.now`, `artifact_fetch`, the `skill_*` set, …) is registered **by the runtime** at boot, straight from config, with its backing stores (skill store, artifact store, event bus, redactor) already threaded in. Registering one in `RegisterTools` as well hands the catalog the same name twice and the boot dies with `duplicate tool name`. The registrar seam exists for the tools *your module compiles*; the yaml is the whole opt-in for everything Harbor ships.\n\n`go.mod` requires the Harbor release that scaffolded the project, so `go mod tidy && go build .\u002F...` resolves straight from the module proxy — no edit needed. (Building against a local Harbor checkout? Uncomment the `replace` at the bottom of `go.mod`.)\n\n## 5. Boot the runtime\n\n```bash\ngo build -o bin\u002Fharbor .\u002Fcmd\u002Fharbor   # only the first time; harbor dev re-builds incrementally\nharbor dev\n```\n\n`harbor dev` boots the Runtime on `127.0.0.1:18080` and mints an ephemeral `HARBOR_DEV_TOKEN` (printed on stderr). The Console is a separate process — see [`run-the-dev-loop`](..\u002Frun-the-dev-loop\u002FSKILL.md) for the attach flow.\n\n### Verify the effective composition before you trust the run (`harbor composition-preview`)\n\nWhen the yaml declares `skills.boot_agent_packs` — or you simply want to confirm exactly what the run-start composer would compose for the scaffolded agent (operator pack + durable revision + personal skills, deduped into one combined operator tier) — preview it read-only against the running runtime:\n\n```bash\nHARBOR_TOKEN=$jwt harbor composition-preview \\\n  --tenant dev --user dev --session dev --agent harbor-dev-agent\n```\n\nThe verb is a thin caller over the read-only `agent_config.composition.preview` Protocol method. It reports the typed outcome (`available | unavailable | conflict | retired`), the deterministic set hashes (`boot_pack_set_hash` \u002F `combined_hash` \u002F `revision_hash`), and each operator-tier item with its exact `boot|revision|both` provenance and canonical semantic hash — what the next run would actually compose. It never mutates: no lifecycle creation, no revision write, no skill\u002Fartifact store write. `--json` re-emits the canonical wire response for scripting. The same strict resolver feeds boot preflight, run, and preview, so a preview here is the ground truth for the scaffolded config. (The `boot_agent_packs` block itself is node-local, eager, immutable, and restart-required — see [`validate-and-package`](..\u002Fvalidate-and-package\u002FSKILL.md) before shipping it.)\n\n## 6. Serve the Protocol from your own binary (`--with-server`)\n\n`harbor dev` is the development loop; when you want your agent — with its compiled in-process Go tools — to serve the Harbor Protocol from its **own** binary at parity with the stock `harbor serve`, add `--with-server`:\n\n```bash\nharbor scaffold --name my-first-agent --with-server\n```\n\nThis is purely additive — the default (flagless) scaffold stays headless. `--with-server` also emits a serving entry point:\n\n```text\nmy-first-agent\u002F\n├── cmd\u002Fmy-first-agent\u002F\n│   └── main.go        # loads harbor.yaml, blank-imports sdk\u002Fdrivers\u002Fprod,\n│                      # passes agent.RegisterTools to sdk\u002Fserver.Open, serves\n└── ... (the usual skeleton)\n```\n\n`main.go` mirrors `harbor serve`'s `--config` \u002F `--port` \u002F `--bind` flags and reaches the Protocol through the public `sdk\u002Fserver` facade, so the module builds and serves as a standalone external binary. It is **production-only by construction**: `server.Open` always builds the JWKS verifier from `identity.*` and fails loud when the JWKS source is missing — there is no dev signer and no mock. Your `RegisterTools` runs at the pre-policy catalog seam, so every tool keeps its declared `tools.entries` approval \u002F OAuth \u002F policy wrapping (see [`add-an-in-process-tool`](..\u002Fadd-an-in-process-tool\u002FSKILL.md)).\n\nFor a release-built host, also set `server.Options.Framework` to the exact\nHarbor version and immutable source commit your release pins. `runtime.info`\nthen exposes additive `framework_version` \u002F `framework_commit` fields while\nits existing `build_*` fields keep reporting the host binary's own build\nmetadata. The scaffold intentionally leaves `Framework` zero: it knows the Go\nmodule requirement but cannot truthfully infer the immutable commit selected by\nyour release process. Set both values together in release configuration; a\npartial pair fails `server.Open` loud.\n\nBecause the server verifies every request against your identity provider's JWK Set, the **local-development loop** is the three-command `harbor token` flow — the same loop a self-hosted `harbor serve` operator uses:\n\n```bash\n# 1. Generate a signing keypair + public JWK Set.\nharbor token keygen --out .\u002Fkeys\n\n# 2. In harbor.yaml, point identity.jwks_file at the emitted set\n#    (and remove identity.jwks_url — set exactly one source):\n#      identity:\n#        jwks_file: .\u002Fkeys\u002Fjwks.json\n\n# 3. Build + run the server.\ngo build .\u002Fcmd\u002Fmy-first-agent && .\u002Fmy-first-agent --config .\u002Fharbor.yaml\n\n# 4. Mint a short-lived JWT whose iss\u002Faud match harbor.yaml, then call the\n#    Protocol with it (Authorization: Bearer \u003Ctoken>):\nharbor token mint --key .\u002Fkeys\u002Fprivate.pem \\\n  --tenant acme --user alice --session s1 \\\n  --issuer \u003Cidentity.issuer> --audience \u003Cidentity.audience>\n```\n\nSee [`configure-production-identity`](..\u002Fconfigure-production-identity\u002FSKILL.md) for the JWKS posture and [`use-the-harbor-protocol`](..\u002Fuse-the-harbor-protocol\u002FSKILL.md) for driving the wire surface.\n\n### Co-launch the native TUI (`--with-tui`)\n\nPass `--with-tui` (with `--with-server`) to make the generated binary's opt-in `--tui` flag co-launch the native terminal client after the server is ready:\n\n```bash\nharbor scaffold --name my-first-agent --with-server --with-tui\n```\n\nThe generated `cmd\u002F\u003Cname>\u002Fmain.go` gains a `--tui` flag. Flagless behavior remains headless and unchanged. When `--tui` is set, the binary:\n\n1. Opens the Protocol server via `sdk\u002Fserver.Open`.\n2. Waits for readiness (`h.WaitReady(ctx)`) — no polling.\n3. Resolves the operator token from `HARBOR_TOKEN` or `~\u002F.harbor\u002Ftoken`.\n4. Attaches the TUI through `sdk\u002Ftui.Run` — authenticated REST\u002FSSE, no Runtime handle.\n5. On TUI quit, drains the owned server.\n\nRuntime logs go to a captured buffer (not the terminal) so Bubble Tea frames are never overwritten; on server failure the terminal is restored before the log is printed. The operator supplies the token — there is no anonymous loopback, automatic token minting, or mock fallback.\n\n```bash\n# Build + run with the TUI co-launched.\ngo build .\u002Fcmd\u002Fmy-first-agent\nHARBOR_TOKEN=\u003Cjwt> .\u002Fmy-first-agent --config .\u002Fharbor.yaml --bind 127.0.0.1:0 --tui\n```\n\nSee [`drive-the-harbor-tui`](..\u002Fdrive-the-harbor-tui\u002FSKILL.md) for the TUI's keyboard surface, session model, and intervention flow.\n\n## Common failure modes\n\n- **`harbor init` overwrote my edits.** It won't — `harbor init --target \u003Cdir>` refuses to overwrite any of its four target files: if `harbor.yaml`, `AGENTS.md`, `CLAUDE.md`, or `README.md` already exists it errors out (per-file, fail-loud). Delete the conflicting file or pick a fresh `--target` directory and re-run.\n- **`harbor validate` says `unknown field \"tools\"`.** You're either on an old `harbor` binary or your yaml uses a renamed key. Run `harbor version` and check the upgrade notes; field renames are flagged in the CHANGELOG.\n- **`harbor dev` exits with `ErrMissingAPIKey` immediately.** Your provider block declares `api_key: env.OPENROUTER_API_KEY` (or similar) but the env var isn't set in the shell that ran `harbor dev`. Check with `echo $OPENROUTER_API_KEY` before re-running. Source your `.env` if you keep keys there.\n- **`harbor scaffold` says `name must match ^[a-z0-9][a-z0-9_-]{0,63}$`.** The `--name` flag is the Go module name, not a free string — it must start with a lowercase letter or digit and contain only lowercase letters, digits, hyphens, or underscores (up to 64 chars). It does *not* have to match the directory name; `kebab-case` keeps imports clean.\n\n## See also\n\n- [`define-the-agent-yaml`](..\u002Fdefine-the-agent-yaml\u002FSKILL.md) — every field in `harbor.yaml` explained.\n- [`wire-the-llm-provider`](..\u002Fwire-the-llm-provider\u002FSKILL.md) — provider selection, models, the mock-vs-real posture.\n- [`run-the-dev-loop`](..\u002Frun-the-dev-loop\u002FSKILL.md) — `harbor dev` + Console attach.\n- [`drive-the-playground`](..\u002Fdrive-the-playground\u002FSKILL.md) — chat against your agent once it's running.\n- Sibling project: Dockyard's [`scaffold-a-server`](https:\u002F\u002Fgithub.com\u002Fhurtener\u002Fdockyard) — the same flow for MCP-server projects (different product, identical convention).\n","# Scaffold a new Harbor agent\n\nHarbor ships one static binary — `harbor` — and a four-step flow that lands a working agent in under five minutes:\n\n```bash\nharbor init --target \u003Cdir>         # drop the tiered yaml + companion docs\n$EDITOR \u003Cdir>\u002Fharbor.yaml          # pick a provider, set api_key\nharbor validate \u003Cdir>\u002Fharbor.yaml  # fail-loud config check\nharbor scaffold --name \u003Cname>      # materialise the Go project\n```\n\nThe flow is deliberately bounded — `harbor init` does not assume what LLM you have keys for or what tools you need. It drops a *tiered* `harbor.yaml` (REQUIRED → COMMON → ADVANCED sections) plus three companion files (AGENTS.md \u002F CLAUDE.md \u002F README.md) that document the project for human contributors and AI coding agents alike. You edit the yaml, validate it, then scaffold a Go project around it.\n\nBuilding Harbor or its generated projects requires Go 1.27.1 or newer. Install\nthat toolchain before running the build steps below; prebuilt Harbor binaries\ndo not require Go on the operator's machine.\n\n## 1. Drop the tiered yaml\n\n```bash\nharbor init --target ~\u002Fmy-first-agent\n```\n\nYou get:\n\n```text\n~\u002Fmy-first-agent\u002F\n├── harbor.yaml      # the tiered config (REQUIRED \u002F COMMON \u002F ADVANCED)\n├── AGENTS.md        # contributor + AI-agent rules (verbatim mirror of CLAUDE.md)\n├── CLAUDE.md        # same\n└── README.md        # quickstart pointer for human contributors\n```\n\nThe yaml has a `REQUIRED` block at the top with four commented LLM-provider examples (OpenRouter \u002F Anthropic direct \u002F OpenAI direct \u002F NVIDIA NIM). **Uncomment exactly one block and set `api_key: env.YOUR_KEY_NAME`.** Bifrost (Harbor's LLM driver) speaks many providers under one wire surface; the four examples cover the common cases. The full provider list is in `docs\u002FCONFIG.md`.\n\n`AGENTS.md` and `CLAUDE.md` are verbatim mirrors — Claude Code picks up `CLAUDE.md` automatically; other agents pick up `AGENTS.md`. Edit one, then `cp AGENTS.md CLAUDE.md` (or vice versa). If they drift, your project's drift-audit catches it.\n\n## 2. Pick a provider, set an API key\n\n```bash\n$EDITOR ~\u002Fmy-first-agent\u002Fharbor.yaml\n```\n\nUncomment one provider block:\n\n```yaml\nllm:\n  driver: bifrost\n  provider: openrouter\n  model: anthropic\u002Fclaude-haiku-4.5\n  api_key: env.OPENROUTER_API_KEY\n  timeout: 60s\n```\n\nThen export the key:\n\n```bash\nexport OPENROUTER_API_KEY=sk-or-...   # or set via .env\n```\n\nHarbor's LLM driver reads the env var at boot. A missing key fails LOUDLY at startup with `ErrMissingAPIKey` — there is no silent fallback to a stub (CLAUDE.md §13: test stubs are never production defaults). If you want a dev-only mock for first-clone convenience, set `HARBOR_DEV_ALLOW_MOCK=1` and see [`wire-the-llm-provider`](..\u002Fwire-the-llm-provider\u002FSKILL.md).\n\n## 3. Validate before scaffolding\n\n```bash\nharbor validate ~\u002Fmy-first-agent\u002Fharbor.yaml\n```\n\n`harbor validate` runs Harbor's config loader against your yaml with **file:line precision** error messages — a missing `llm.driver`, a malformed `tools.mcp_servers[0].command`, or a `memory.budget_tokens` set to a negative number all surface here. Run this every time you edit the yaml; the failure modes are usually obvious from the message.\n\nIf `validate` is clean, you're cleared to scaffold the Go project.\n\n## 4. Materialise the Go project\n\n```bash\ncd ~\u002Fmy-first-agent\nharbor scaffold --name my-first-agent\n```\n\n`harbor scaffold` reads the yaml and drops a Go project around it:\n\n```text\nmy-first-agent\u002F\n├── go.mod\n├── README.md\n├── agent.go                    # your agent code (worked EchoAgent + RegisterTools)\n├── agent_test.go               # harbortest-driven smoke test\n├── tools\u002F                      # one typed stub per tools.custom[] yaml entry\n│   └── \u003Cname>.go \u002F \u003Cname>_test.go\n└── harbor.yaml                 # the same yaml init dropped (copied verbatim)\n```\n\nWhen the yaml declares tools (`tools.built_in` \u002F `tools.custom`), `agent.go` gains a generated `RegisterTools` function and each **custom** tool gets a typed stub (input struct, output struct, handler) under `tools\u002F`. The generated imports are the public `sdk\u002F` facade paths, so the project builds as a standalone external module. When the yaml declares custom tools, the generated `agent_test.go` also gains a register-and-dispatch test that calls `RegisterTools` and invokes a declared tool **through the tool catalog** — so `go test .\u002F...` proves your tools are actually wired, not just that the project compiles. Keep that test green as you replace the stubs with real tools. Use the stubs as the template for your real tools (see [`add-an-in-process-tool`](..\u002Fadd-an-in-process-tool\u002FSKILL.md)).\n\n**`RegisterTools` carries your COMPILED tools only — never built-ins.** A tool you opt into under `tools.built_in` (`clock.now`, `artifact_fetch`, the `skill_*` set, …) is registered **by the runtime** at boot, straight from config, with its backing stores (skill store, artifact store, event bus, redactor) already threaded in. Registering one in `RegisterTools` as well hands the catalog the same name twice and the boot dies with `duplicate tool name`. The registrar seam exists for the tools *your module compiles*; the yaml is the whole opt-in for everything Harbor ships.\n\n`go.mod` requires the Harbor release that scaffolded the project, so `go mod tidy && go build .\u002F...` resolves straight from the module proxy — no edit needed. (Building against a local Harbor checkout? Uncomment the `replace` at the bottom of `go.mod`.)\n\n## 5. Boot the runtime\n\n```bash\ngo build -o bin\u002Fharbor .\u002Fcmd\u002Fharbor   # only the first time; harbor dev re-builds incrementally\nharbor dev\n```\n\n`harbor dev` boots the Runtime on `127.0.0.1:18080` and mints an ephemeral `HARBOR_DEV_TOKEN` (printed on stderr). The Console is a separate process — see [`run-the-dev-loop`](..\u002Frun-the-dev-loop\u002FSKILL.md) for the attach flow.\n\n### Verify the effective composition before you trust the run (`harbor composition-preview`)\n\nWhen the yaml declares `skills.boot_agent_packs` — or you simply want to confirm exactly what the run-start composer would compose for the scaffolded agent (operator pack + durable revision + personal skills, deduped into one combined operator tier) — preview it read-only against the running runtime:\n\n```bash\nHARBOR_TOKEN=$jwt harbor composition-preview \\\n  --tenant dev --user dev --session dev --agent harbor-dev-agent\n```\n\nThe verb is a thin caller over the read-only `agent_config.composition.preview` Protocol method. It reports the typed outcome (`available | unavailable | conflict | retired`), the deterministic set hashes (`boot_pack_set_hash` \u002F `combined_hash` \u002F `revision_hash`), and each operator-tier item with its exact `boot|revision|both` provenance and canonical semantic hash — what the next run would actually compose. It never mutates: no lifecycle creation, no revision write, no skill\u002Fartifact store write. `--json` re-emits the canonical wire response for scripting. The same strict resolver feeds boot preflight, run, and preview, so a preview here is the ground truth for the scaffolded config. (The `boot_agent_packs` block itself is node-local, eager, immutable, and restart-required — see [`validate-and-package`](..\u002Fvalidate-and-package\u002FSKILL.md) before shipping it.)\n\n## 6. Serve the Protocol from your own binary (`--with-server`)\n\n`harbor dev` is the development loop; when you want your agent — with its compiled in-process Go tools — to serve the Harbor Protocol from its **own** binary at parity with the stock `harbor serve`, add `--with-server`:\n\n```bash\nharbor scaffold --name my-first-agent --with-server\n```\n\nThis is purely additive — the default (flagless) scaffold stays headless. `--with-server` also emits a serving entry point:\n\n```text\nmy-first-agent\u002F\n├── cmd\u002Fmy-first-agent\u002F\n│   └── main.go        # loads harbor.yaml, blank-imports sdk\u002Fdrivers\u002Fprod,\n│                      # passes agent.RegisterTools to sdk\u002Fserver.Open, serves\n└── ... (the usual skeleton)\n```\n\n`main.go` mirrors `harbor serve`'s `--config` \u002F `--port` \u002F `--bind` flags and reaches the Protocol through the public `sdk\u002Fserver` facade, so the module builds and serves as a standalone external binary. It is **production-only by construction**: `server.Open` always builds the JWKS verifier from `identity.*` and fails loud when the JWKS source is missing — there is no dev signer and no mock. Your `RegisterTools` runs at the pre-policy catalog seam, so every tool keeps its declared `tools.entries` approval \u002F OAuth \u002F policy wrapping (see [`add-an-in-process-tool`](..\u002Fadd-an-in-process-tool\u002FSKILL.md)).\n\nFor a release-built host, also set `server.Options.Framework` to the exact\nHarbor version and immutable source commit your release pins. `runtime.info`\nthen exposes additive `framework_version` \u002F `framework_commit` fields while\nits existing `build_*` fields keep reporting the host binary's own build\nmetadata. The scaffold intentionally leaves `Framework` zero: it knows the Go\nmodule requirement but cannot truthfully infer the immutable commit selected by\nyour release process. Set both values together in release configuration; a\npartial pair fails `server.Open` loud.\n\nBecause the server verifies every request against your identity provider's JWK Set, the **local-development loop** is the three-command `harbor token` flow — the same loop a self-hosted `harbor serve` operator uses:\n\n```bash\n# 1. Generate a signing keypair + public JWK Set.\nharbor token keygen --out .\u002Fkeys\n\n# 2. In harbor.yaml, point identity.jwks_file at the emitted set\n#    (and remove identity.jwks_url — set exactly one source):\n#      identity:\n#        jwks_file: .\u002Fkeys\u002Fjwks.json\n\n# 3. Build + run the server.\ngo build .\u002Fcmd\u002Fmy-first-agent && .\u002Fmy-first-agent --config .\u002Fharbor.yaml\n\n# 4. Mint a short-lived JWT whose iss\u002Faud match harbor.yaml, then call the\n#    Protocol with it (Authorization: Bearer \u003Ctoken>):\nharbor token mint --key .\u002Fkeys\u002Fprivate.pem \\\n  --tenant acme --user alice --session s1 \\\n  --issuer \u003Cidentity.issuer> --audience \u003Cidentity.audience>\n```\n\nSee [`configure-production-identity`](..\u002Fconfigure-production-identity\u002FSKILL.md) for the JWKS posture and [`use-the-harbor-protocol`](..\u002Fuse-the-harbor-protocol\u002FSKILL.md) for driving the wire surface.\n\n### Co-launch the native TUI (`--with-tui`)\n\nPass `--with-tui` (with `--with-server`) to make the generated binary's opt-in `--tui` flag co-launch the native terminal client after the server is ready:\n\n```bash\nharbor scaffold --name my-first-agent --with-server --with-tui\n```\n\nThe generated `cmd\u002F\u003Cname>\u002Fmain.go` gains a `--tui` flag. Flagless behavior remains headless and unchanged. When `--tui` is set, the binary:\n\n1. Opens the Protocol server via `sdk\u002Fserver.Open`.\n2. Waits for readiness (`h.WaitReady(ctx)`) — no polling.\n3. Resolves the operator token from `HARBOR_TOKEN` or `~\u002F.harbor\u002Ftoken`.\n4. Attaches the TUI through `sdk\u002Ftui.Run` — authenticated REST\u002FSSE, no Runtime handle.\n5. On TUI quit, drains the owned server.\n\nRuntime logs go to a captured buffer (not the terminal) so Bubble Tea frames are never overwritten; on server failure the terminal is restored before the log is printed. The operator supplies the token — there is no anonymous loopback, automatic token minting, or mock fallback.\n\n```bash\n# Build + run with the TUI co-launched.\ngo build .\u002Fcmd\u002Fmy-first-agent\nHARBOR_TOKEN=\u003Cjwt> .\u002Fmy-first-agent --config .\u002Fharbor.yaml --bind 127.0.0.1:0 --tui\n```\n\nSee [`drive-the-harbor-tui`](..\u002Fdrive-the-harbor-tui\u002FSKILL.md) for the TUI's keyboard surface, session model, and intervention flow.\n\n## Common failure modes\n\n- **`harbor init` overwrote my edits.** It won't — `harbor init --target \u003Cdir>` refuses to overwrite any of its four target files: if `harbor.yaml`, `AGENTS.md`, `CLAUDE.md`, or `README.md` already exists it errors out (per-file, fail-loud). Delete the conflicting file or pick a fresh `--target` directory and re-run.\n- **`harbor validate` says `unknown field \"tools\"`.** You're either on an old `harbor` binary or your yaml uses a renamed key. Run `harbor version` and check the upgrade notes; field renames are flagged in the CHANGELOG.\n- **`harbor dev` exits with `ErrMissingAPIKey` immediately.** Your provider block declares `api_key: env.OPENROUTER_API_KEY` (or similar) but the env var isn't set in the shell that ran `harbor dev`. Check with `echo $OPENROUTER_API_KEY` before re-running. Source your `.env` if you keep keys there.\n- **`harbor scaffold` says `name must match ^[a-z0-9][a-z0-9_-]{0,63}$`.** The `--name` flag is the Go module name, not a free string — it must start with a lowercase letter or digit and contain only lowercase letters, digits, hyphens, or underscores (up to 64 chars). It does *not* have to match the directory name; `kebab-case` keeps imports clean.\n\n## See also\n\n- [`define-the-agent-yaml`](..\u002Fdefine-the-agent-yaml\u002FSKILL.md) — every field in `harbor.yaml` explained.\n- [`wire-the-llm-provider`](..\u002Fwire-the-llm-provider\u002FSKILL.md) — provider selection, models, the mock-vs-real posture.\n- [`run-the-dev-loop`](..\u002Frun-the-dev-loop\u002FSKILL.md) — `harbor dev` + Console attach.\n- [`drive-the-playground`](..\u002Fdrive-the-playground\u002FSKILL.md) — chat against your agent once it's running.\n- Sibling project: Dockyard's [`scaffold-a-server`](https:\u002F\u002Fgithub.com\u002Fhurtener\u002Fdockyard) — the same flow for MCP-server projects (different product, identical convention).\n",{"name":5,"license":15,"metadata":24,"description":7},{"verbs":25,"surface":26,"framework":27},"init, scaffold, validate, serve, tui","cli","harbor","main","7de2201d2ff639d1227fb0624684b328d943eea9","docs\u002Fskills\u002Fscaffold-a-harbor-agent",1,"https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor","https:\u002F\u002Fgithub.com\u002Fhurtener","2026-11-15 04:22:13",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add hurtener\u002FHarbor --skill scaffold-a-harbor-agent",{"tool":41,"command":42},"bunx","bunx skills add hurtener\u002FHarbor --skill scaffold-a-harbor-agent",{"tool":44,"command":45},"pnpm","pnpm dlx skills add hurtener\u002FHarbor --skill scaffold-a-harbor-agent","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fscaffold-a-harbor-agent\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M723EVVMQQH8MFVBKTYMTW22","wire-the-llm-provider","Pick a real LLM provider and wire it through Bifrost — OpenRouter \u002F Anthropic \u002F OpenAI \u002F Azure \u002F NVIDIA NIM \u002F OpenAI-compatible endpoints. Use when configuring the `llm:` block beyond the scaffold default, swapping models, setting model_profiles, or using the dev-only mock escape hatch.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fwire-the-llm-provider\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M723ESCAV3DX4FSWHB9QRXDT","validate-and-package","Run `harbor validate` + `make preflight` + the per-phase smoke gates before shipping an agent. Use when packaging an agent for a non-dev environment — production deploy, share with a teammate, hand off to CI, or ship a release tag.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fvalidate-and-package\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M723E52YP0JSH9R22APN4T5M","run-the-dev-loop","Use `harbor dev` + `harbor console` to run an agent locally with the Console attached. Use when iterating on a Harbor project — single-process or multi-process attach posture, the `HARBOR_DEV_TOKEN` handshake, hot reload on yaml changes, and which posture to pick when.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Frun-the-dev-loop\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M723E1M9CF4V7ZMHAMA3GY2Y","observe-with-the-console","Tour the Console's observability pages — Overview, Live Runtime, Observability, Sessions, Tasks, Agents, Tools, Events, Background Jobs, Playground, Flows, Memory, MCP Connections, Artifacts, Settings. Use when debugging an agent's behavior, hunting a regression, or building intuition for what the runtime is actually doing under the hood.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fobserve-with-the-console\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M723DXYEMV4VWKM7A65BHR5E","drive-the-playground","Use the Console's Playground page to chat against your agent, attach files (images \u002F PDFs \u002F audio), and steer or queue input during a run. Use when validating the agent end-to-end interactively, the foreground\u002Fbackground task posture, image-vs-PDF MIME dispatch, and the playground's steering UI.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fdrive-the-playground\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M723DTS3RZ9NPSKF0T2D4YZ5","drive-the-harbor-tui","Attach Harbor's native terminal Runtime test\u002Fcontrol client with authenticated REST\u002FSSE. Use when testing sessions, tasks, tools, artifacts, events, posture, interventions, controls, reconnect, or transcript export without opening the Console.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fdrive-the-harbor-tui\u002FSKILL.md",[],[]]