agentleFS
kuhlman-labskuhlman-labs/fishhawk/AGENTS.md

fishhawk

AGENTS.md9 starsChanged 2 months agoApache-2.0View on GitHub

Pre-alpha. Most code referenced in docs/MVP_SPEC.md doesn't exist yet — it's split into ~49 child issues across 15 epics in Project #7. Verify file tree before assuming.

  • Pipes a download into a shell
  • Reads credentials
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,638 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository11 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before opening a PR that adds or modifies a field in docs/spec/:

    line 99
  2. Distinctive:

    Version advertising: After the schema change merges, update every surface that advertises supported schema versions:

    line 105
  3. Very specific:

    x-intended-required annotation: When a field is optional now but will become required in the next major version, annotate it in the JSON …

    line 110
  4. Distinctive:

    Before opening a PR that adds or tightens handler-side authorization (scope check, role check, audience check), the PR body must include:

    line 121
  5. Very specific:

    Scope the registry: Add backend/internal/audit/categories.go (modify) to scope.files alongside the emitter — a one-line registration.

    line 138
  6. Very specific:

    In a fix loop, do not retry: When the verify output names the registry (add them to backend/internal/audit/categories.go), the fix prompt …

    line 141
  7. Distinctive:

    Commit with git commit -s (DCO is mandatory.

    line 197
  8. Very specific:

    Add / remove / rename an issue-comment surface (Notifier method or audit kind) → docs/issue-comment-surfaces.md.

    line 202
  9. Distinctive:

    After merge, walk the dependents:

    line 209
  10. Distinctive:

    Verify parent epic progress via its sub-issue links and the tracker Status field — epic bodies don't carry a hand-maintained checklist to …

    line 210
  11. Distinctive:

    Update sibling issues if scope shifted (e.g., a CI fix bundled here means another sibling no longer needs it).

    line 211
  12. Distinctive:

    If an ADR was resolved, edit its body's Decision section and close.

    line 212
  13. Very specific:

    Run scripts/cleanup-merged to delete local branches that have been merged into origin/main (optional.

    line 214
  14. Very specific:

    After Day 21, every change must flow through a Fishhawk workflow run (today: by convention.

    line 279

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides guidance to coding agents working with code in this repository.

Repo state

Pre-alpha. Most code referenced in docs/MVP_SPEC.md doesn't exist yet — it's split into ~49 child issues across 15 epics in Project #7. Verify file tree before assuming.

Canonical references

  • docs/MVP_SPEC.md — v0 scope. Cite section numbers when scope is in question.
  • docs/ARCHITECTURE.md — current technical realization (stack, lifecycle, storage, invariants). Read before designing anything cross-component.
  • docs/BRAND_FOUNDATIONS.md — voice, naming, positioning.
  • docs/METHODOLOGY.md — autonomy tiers (low/medium/high).
  • docs/GROOMING_RUNBOOK.md — operating the backlog_grooming loop: invocation, what approving actually does (it writes), the autonomy-tier policy for this repo (autonomy:low means an agent STRUCTURALLY cannot, not that the work is sensitive), and turning the ranking into a campaign.
  • docs/spec/ — canonical JSON Schemas + reference docs for the workflow spec (.fishhawk/workflows.yaml) and the plan artifact (standard_v1). Validate with check-jsonschema --schemafile <schema> <yaml-or-json>. Caveat: a workflow-v2 document using defaults/extends must be validated with fishhawk validate (or the backend), not a bare check-jsonschema run — the bare run resolves no same-document reuse, so it rejects a reuse-bearing spec (e.g. a stage inheriting its executor) the product accepts (#2340). To keep check-jsonschema in the loop anyway, pipe it the resolved document: fishhawk validate --emit-resolved <yaml> | check-jsonschema --schemafile docs/spec/workflow-v2.schema.json --default-filetype yaml - (E52.22 / #2351) — --default-filetype yaml is required because check-jsonschema assumes JSON on stdin, and emit RESOLVES without VALIDATING (no charter rule, no stage-reference sweeps), so fishhawk validate without the flag stays the authority.
  • docs/adr/ — the settled-decision record (E78.1 / #3722): one NNN-slug.md per ADR with a machine-readable front matter (id, status, supersedes/superseded_by, applies_to) and the tracker body transcribed verbatim. docs/adr/README.md is the format contract and the status table; docs/adr/index.json is the machine index (repodoc cannot list a directory). Enforced by scripts/check-adr in scripts/test verify; regenerate the index with scripts/check-adr --write-index. The record covers ADR-001–080 (E78.3 / #3724); ADR-081 onward land one by one under the upkeep rule (Git flow step 4, docs/adr/README.md § "Upkeep rule"), and an ADR whose record has not landed yet is still read from the tracker.
  • docs/api/ — REST API surface: v0.openapi.yaml is source of truth, v0.md is the human companion. Lint with npx -y @redocly/cli@2.31.5 lint --config docs/api/redocly.yaml docs/api/v0.openapi.yaml (pinned version — see the pinning rule under "Build, test, lint").
  • .fishhawk/workflows.yaml — placeholder; executed by the product itself starting Day 21 (~2026-05-20).

Documentation surfaces

  • README.md (root) is the only human-facing doc. Keep narrative.
  • Everything in docs/ is agent-consumed. Write structured, dense, no fluff.
  • docs/ARCHITECTURE.md §10 "Where to look" rows are pointers, not prose: path + ≤1 sentence + one anchor issue/ADR ref, linking a package README.md for anything longer. The long-form behavioral contract, invariants, and issue history for a package live in that package's README.md, next to the code — an agent touching the package reads them in context instead of every agent paying for all of them up front. scripts/test verify fails any ARCHITECTURE.md line over 1000 chars (fat single-line rows are silently truncated by agents' file-read tooling, which cuts lines around 2000 chars).
  • site/ is the public documentation site (E12.1 / #2261): human-facing narrative, Astro + Starlight, source path site/, published to GitHub Pages at https://kuhlman-labs.github.io/fishhawk/. The reciprocal rule is what makes the split structural rather than conventional — site/ is human-facing narrative and docs/ stays agent-consumed and is never a publish source; nothing under site/ imports, globs or symlinks docs/ (prose cross-links to docs/ as GitHub URLs are fine and expected). Long-form contract, dependency pins and the local loop: site/README.md.
  • The site is UNVERSIONED and tracks main; workflow-spec majors are carried as CONTENT, not as site versions — a support table on site/src/content/docs/reference/index.md plus ONE reference/workflow-spec.md covering v0, v1 and v2 with the differences inline, NOT one page per major. This mirrors docs/spec/workflow-v2.md, which is the complete standalone reference for the live major while v0/v1 are frozen; per-major pages would mirror a structure the canonical reference deliberately abandoned and would signal that authoring a new v0 spec is a live choice the product discourages. Decided in #2261 — do not re-litigate; both revisit triggers (numbered releases ship; a future major diverges past inline readability) are recorded on site/src/content/docs/reference/versioning.md.
  • The four Reference surface pages are GENERATED, not hand-written (E12.4 / #2264). site/src/content/docs/reference/{workflow-spec,plan-schema,cli,api}.md each carry an <!-- BEGIN/END GENERATED <id> --> marker pair; the region BETWEEN the markers is rendered by cli/internal/docgen from the canonical schemas (docs/spec/*.schema.json), the OpenAPI document (docs/api/v0.openapi.yaml) and the cli/internal/cmdinfo command inventory, and is byte-exact. Orientation prose OUTSIDE the markers stays hand-editable. Regenerate with scripts/gen-site-reference after any change to a canonical source; the Go drift test cli/internal/docgen/drift_test.go and the scripts/test-site-reference harness (wired into scripts/test verify's _verify_gate_harnesses) both fail if a generated region is out of date. The CLI region is bound to the executable surface by TestCLIFlagsMatchExecutableSurface, which asserts each command's cmdinfo flag set equals the live flag.FlagSet in both directions — so the CLI reference cannot silently drift from the binary. Long-form: cli/README.md.
  • Banned vocabulary on the site is machine-enforced. scripts/check-site-voice fails scripts/test verify on any docs/BRAND_FOUNDATIONS.md §5 term under site/src/content/docs/ (case-insensitive, prefix-based, leading-word-boundary anchored; trust deliberately excluded as a human-review item). scripts/test-site-voice pins the control and runs in the same gate.
  • Site information architecture is machine-enforced (E12.7 / #2318). scripts/check-site-ia fails scripts/test verify when the explicit Starlight sidebar in site/astro.config.mjs and the content pages under site/src/content/docs/ disagree in either direction — a sidebar slug resolving to no page, or a page no sidebar entry references (the site-root index is exempt). It closes the in-loop blind spot that Astro's build catches a dangling slug only in the operator-installed Pages workflow. It text-matches literal { slug: '...' } entries and does not parse JS, so a commented-out/variable/spread/autogenerate sidebar refactor hollows it out (stated in the script header + scripts/README.md). scripts/test-site-ia pins the control in the same gate.
  • The Pages deploy workflow is operator-authored. .github/workflows/** is in the implement stage's forbidden_paths, so .github/workflows/docs.yml ships as a copy-pasteable fenced block in site/README.md for a human to install, alongside the one-time Settings → Pages → Source: GitHub Actions step.
  • Agent skills live in .agents/skills/<name>/SKILL.md (the cross-tool Agent Skills path Codex scans). Claude Code scans only .claude/skills/, so each skill also gets a per-skill symlink .claude/skills/<name> → ../../.agents/skills/<name> (per-skill, not a whole-directory link — only the per-skill form is documented). .claude/ is ignored except skills/ and settings.json; settings.json is permissions-only on purpose (runner agents start with --dangerously-skip-permissions, so hooks/env there would reach them and need review).
    • Frontmatter. Standard name + description, plus disable-model-invocation: true on a skill that stops services or deletes state (teardown-local, dev-clean, sync-main) so Claude Code runs it only when a human types it. Codex ignores that key, so such a skill (and deploy-local, which can restart fishhawkd but stays model-invocable) also opens with an operator-only guard: it runs scripts/is-run-agent and stops on a non-zero exit. That script is the ONE definition of a run agent (the runner-stamped FISHHAWK_RUN_AGENT marker first, #3945/#3947, verified to reach both CLIs' shell tools; then the runner's agent trees by exact path shape as the fallback; then FISHHAWK_RUN_ID for CI-hosted runners), pinned by scripts/test-is-run-agent inside scripts/test verify, and both files are forbidden to implement stages. A new runner agent tree must be added there. A missing script (exit 127) means stop, not proceed. Keep the body tool-neutral.
    • Skills and .claude/ are operator-authored. The implement stages' forbidden_paths cover .agents/, .claude/ and .codex/ at ANY depth and in ANY letter case, spelled as doublestar character classes (**/.[aA][gG][eE][nN][tT][sS]/**), because every later session, runner agents included, loads them as instructions.
    • Instruction files. Both also forbid the auto-loaded instruction files (AGENTS.md, AGENTS.override.md, CLAUDE.md, CLAUDE.local.md) at any depth, except that feature_change leaves the exact ROOT AGENTS.md writable (its root letter-case variants stay forbidden), because the conventions require updating it there; routine_change (no human approval) forbids that too. Pinned by twin TestRepoSpecForbidsAgentInstructionPaths tests (runner/internal/constraint, and backend/internal/policy on the product-parsed spec), which read one shared path table, testdata/policy/agent-instruction-paths.json, through a byte-identical block that fails closed on a vacuous or ambiguous fixture and requires a case for EVERY implement stage in the spec (TestAgentPathLoaderParity, in both modules, pins the two copies). These globs and reviewsandbox.isAgentInstructionPath are two definitions of one class; unifying them is #3942.
    • Skills cite, they don't restate. A skill points at AGENTS.md / scripts/README.md / the owning package README for the contract and carries only the procedure. The few facts skills do repeat (the golangci-lint v2.8.0 pin, go1.25.6, the 85% patch-coverage threshold, scripts/dev subcommand behavior) drift silently, so changing a Trap, a pin, or a scripts/dev / scripts/test behavior obliges grep -rn <term> .agents/skills/ and an update to every skill that names it, in the same change when an operator authors it. A Fishhawk run cannot write .agents/**, so a run that changes a cited fact leaves the skill update to the operator as a follow-up issue filed with its PR (a mechanical drift check is #3943).
    • Current skills (operational how-to only; the AGENTS.md sections they cite remain canonical):
      • deploy-local: bring the stack up or reload it (scripts/dev up/reload/k8s).
      • teardown-local: ordered stop of every layer; make nuke only on explicit request.
      • sync-main: pre-pull live-run checks, then scripts/dev post-merge.
      • verify-gate: scripts/test verify with its preflights and a failure → fix table.
      • diagnose-red: environmental triage of an unexplained red.
      • dev-clean: list → confirm → remove local litter.
      • spec-change: the schema/API change checklist.
      • new-go-module: adding a module (§ "Adding a Go module").
      • record-adr: the ADR record upkeep rule.
      • frontend-check: the Web UI CI gates.

Build, test, lint

Multi-module Go workspace; no root go.mod, so go build ./... from root fails. The common gates are wrapped by scripts/test:

scripts/test               # `go test -race ./...` in every registered module
scripts/test coverage      # the same, plus the aggregate coverage gate
scripts/test lint          # `golangci-lint run ./...` in every registered module
scripts/test verify        # lint THEN schema-sync THEN tests + patch-scoped coverage — the runner's verify gate
scripts/test verify --no-tests      # every verify leg except the test loop + patch coverage
scripts/test lint --in-gate-image   # lint / `verify --no-tests` inside the pinned gate image (CI parity)
scripts/test single -run TestName ./backend/internal/version/   # passthrough

Gate image (E51.17 / #3966). --in-gate-image (on lint and verify) runs the Docker-free legs inside deploy/gate-image's pinned toolchain image, after checking that image's tool versions against this checkout's pins (a mismatch refuses); verify holds the HOST verify lock and gives the container a private one. Image: FISHHAWK_TEST_GATE_IMAGE (default ghcr.io/kuhlman-labs/fishhawk-gate:main) — never FISHHAWK_GATE_IMAGE, which switches a spawned runner onto the container path; for this repo set that only together with FISHHAWK_GATE_SERVICES=postgres (the runner-provisioned Postgres gate service, #2137) and only after the operator walk in runner/internal/gateiso/README.md § "Gate services (#2137)" is green. CI parity, not isolation. Long-form: deploy/gate-image/README.md, scripts/README.md § "Gate image".

scripts/test verify stage order. It takes the per-repository verify lock, then runs lint → the ARCHITECTURE.md doc-line budget → a schema-sync drift check (re-runs scripts/sync-schemas, fails on drift the sync introduces) → the gate harnesses (_verify_gate_harnesses: the coverage, lease, scripts/dev, Helm and other scripts/test-* harnesses) → the site voice, site IA and ADR record gates → the gate-image pin check (scripts/check-gate-image) → the go test -race loop with the patch-scoped coverage gate folded in. The aggregate coverage gate is omitted to bound runtime. The runner's committed-tree implement gate runs this same command, so a format, schema-sync or harness failure fails in-loop instead of red-lining CI after the agent is terminal (#1064/#1772). Long-form: scripts/README.md § "scripts/test verify: the lint and schema-sync legs".

Scoped verify (E68.39 / #3315). scripts/test verify --packages <repo/rel/pkg,...> (env fallback FISHHAWK_VERIFY_PACKAGES) restricts only the test loop to the listed packages and SKIPS the patch-coverage gate with a printed reason; every other leg is unchanged, and an unknown or undecodable package widens to the FULL loop. The runner verifies scoped on each fix iteration and re-verifies the passing SHA in full before reporting success. Long-form: scripts/README.md § "Scoped verify + the per-repository verify lock", runner/README.md § "Scoped verify".

The verify lock: never start a concurrent scripts/test verify, and never retry or poll one that refuses (#3315, #2645). verify takes <git-common-dir>/fishhawk-verify.lock, shared by every worktree; the runner's independent-clone gate is pointed at the PRIMARY's lock via FISHHAWK_VERIFY_LOCK_PATH (ADR-063 / #2134). A shell invocation meeting a live holder refuses immediately, and that refusal is terminal: run scripts/test single -run TestX ./your/package/... instead. A runner-marked invocation (FISHHAWK_VERIFY_LOCK_OWNER=runner) waits up to 600s and then displaces only a SHELL holder, never a runner one. Long-form: scripts/README.md § "The verify lock", runner/README.md § "Gate isolation".

Lint. scripts/test lint runs golangci-lint run --allow-serial-runners ./... per registered module: CI's invocation plus that one flag, so a second concurrent lint (another run's verify, or a shell beside one) waits for golangci-lint's global lock instead of failing (#3962). .golangci.yml enables the gofmt/goimports formatters, so lint also catches format drift with no separate gofmt run. lint and verify fail closed when golangci-lint is absent from PATH. CI pins golangci-lint v2.8.0 (see the pinning rule below). Long-form: scripts/README.md § "Lint".

Per-module without the wrapper (still useful for go build and golangci-lint):

go build ./backend/...
golangci-lint run ./backend/...

.golangci.yml is v2 format (version: "2" at top). Local install must be golangci-lint v2.x; v1 binaries reject this config.

Backend tests share ONE testcontainers Postgres (#1174, was #972). Call pgtest.NewPool(t) / pgtest.NewURL(t): one reused fishhawk-test-postgres container, with a per-test CREATE DATABASE ... TEMPLATE clone. Do NOT hand-roll a per-package tcpostgres.Run. The one exemption is backend/internal/postgres/postgres_test.go (MigrateUp/MigrateDown need raw databases): it starts its own containers and terminates each in a t.Cleanup, including on the start-error path (#3122). Inside the runner's gate container (#2137) there is no Docker daemon: the runner pins FISHHAWK_GATE_CONTAINER=1 and, with FISHHAWK_GATE_SERVICES=postgres, FISHHAWK_TEST_PG_URL (a unix-socket DSN to a per-exec, least-privilege Postgres). pgtest then uses that server as its shared base without testcontainers and FAILS (never skips) on any error there; the postgres package's raw-database helper creates throwaway fh_raw_<uuid> databases on it instead of starting containers; with the marker but no URL both fail naming the runner remedy. A new test that starts its own container outside pgtest breaks the container-path verify. Knobs: FISHHAWK_TEST_P (default 4; set 2 on a constrained daemon) and FISHHAWK_TEST_TIMEOUT (default 20m, dev-only). scripts/test disables ryuk and removes the container on exit through a lease refcounted across concurrent invocations (#1792), plus a generation-keyed orphan sweep (#3122). Long-form: scripts/README.md § "Container lease + generation-keyed orphan sweep" (§ "The shared container", § "Lease refcount and the atomic lock", § "Anonymous volumes").

Pin executable tooling fetched inside CI/release run: steps. Any tool a workflow downloads and executes at run time — install scripts piped to a shell (curl … | sh), npx packages — MUST be pinned to a specific immutable tag or version, never master/main/latest/a floating major. A third-party repo can change its master install script or publish a new @latest and red-line the entire pipeline (including main) with zero change on our side — exactly what happened when golangci-lint's master/install.sh broke CI (#607/#608). Current pins: golangci-lint install.sh → the v2.8.0 tag (all four workflows: ci.yml + the three *-release.yml); the gate image's deploy/gate-image/Dockerfile ARGs (GO_VERSION, GOLANGCI_LINT_VERSION, HELM_VERSION, CHECK_JSONSCHEMA_VERSION) — a pin site enforced by scripts/check-gate-image in scripts/test verify, so bumping the golangci-lint tag or a go directive without the matching ARG (in the same change) fails verify; @redocly/cli → 2.31.5 (in ci.yml and the docs/api/ lint/preview commands — keep these in sync). GitHub Action refs (actions/checkout@vN, etc.) are the exception: they stay on floating major tags because .github/dependabot.yml's github-actions entry bumps them deliberately and reviewably. npx-in-run-step pins are not yet Dependabot-tracked, so bump them by hand.

Coverage gate: aggregate ≥ 80% across all registered modules, excluding sqlc-generated */db/ packages (CI uses --exclude '/db/' so new sqlc packages auto-skip). Tiered targets in docs/ARCHITECTURE.md §9. CI fails CI Pass if the threshold drops. CI runs the tests as a parallel matrix of legs (scripts/ci-test-leg, #3882) and gates the merged profiles in Go (coverage gate); scripts/test coverage runs the same check locally as one serial loop.

coverage runs EVERY module and aggregates — it does NOT abort at the first failing one (#3403); test/verify still do. It deletes each module's stale coverage.out before the run, classifies each failure as BUILD or TEST, gates the profiles that survived, and ends with a summary naming every failed module. Long-form, including the loop's shape: scripts/README.md § "Per-module coverage aggregation".

Patch-scoped coverage gate (#1887 / ADR-059), in-loop in scripts/test verify. Lines the branch added or changed (merge-base → work tree, untracked .go files included, /db/ excluded) must be ≥ 85% covered, with a 5-statement floor. Coverage is folded into verify's existing test loop, not a second run. The change set is snapshotted and digest-anchored BEFORE the tests run, so a test that rewrites the tree cannot turn the gate into a skip (#2124). Precondition failures (no git, no merge base, no changed Go packages) fail open with a printed reason; integrity failures fail closed. The knobs FISHHAWK_PATCH_COVERAGE_THRESHOLD, FISHHAWK_DIFF_BASE and FISHHAWK_SKIP_PATCH_COVERAGE are DEV-ONLY: the runner's gate env is a default-deny allow-list, so an agent cannot disable the gate. Its harnesses scripts/test-check-coverage and scripts/test-patch-coverage run inside verify. Long-form: scripts/README.md § "Patch-scoped coverage gate".

scripts/test-helm-render gates the Helm chart (E62.2 / #2301). It drives the real chart through helm template/helm lint inside scripts/test verify and asserts on rendered output: the credential contract, migrate Job timing, envFrom wiring, NOTES.txt, and registry existence of every rendered image. It SKIPS with a printed reason and exits 0 when helm is absent from PATH, so on a helm-less host the chart is unguarded. Its CI half is operator-installed (.github/workflows/** is forbidden to the implement stage). Long-form: deploy/helm/fishhawk/README.md § "Render gate", scripts/README.md § "Helm chart render gate".

When editing a schema under docs/spec/, run scripts/sync-schemas to mirror the change into all embedded copies before committing. CI fails the schema-sync gate otherwise. Opt-in local check: git config core.hooksPath .githooks. The workflow-v*.schema.json glob fans each workflow major out to two mirrors — backend/internal/spec/schemas/ and cli/internal/spec/schemas/ — so workflow-v0, workflow-v1 (ADR-046 / #1381), and workflow-v2 (ADR-067 / #2213) each have a canonical + two mirror copies, and /healthz advertises the workflow-v0, workflow-v1, and workflow-v2 embedded-schema hashes (spec.EmbeddedSchemaHash / EmbeddedSchemaHashV1 / EmbeddedSchemaHashV2).

Schema change checklist

Before opening a PR that adds or modifies a field in docs/spec/:

  1. Additive or breaking? New optional fields within the current major version (e.g., standard_v1.x, workflow-v0.x) are additive — proceed. A new required field in an existing major version is a breaking change and must be avoided: bump the major version instead (standard_v2, workflow-v1). Use the x-intended-required annotation (see below) to signal a field whose required promotion is deferred through a soak period.
  2. Soak period. When a field is introduced as optional but is intended to become required in a future version, declare the soak window in the PR body under ## Notes. The soak period duration is determined per-PR; no minimum is set yet (TBD in a follow-up issue). During the soak, both the old and new schema versions are validated by the backend.
  3. Version advertising. After the schema change merges, update every surface that advertises supported schema versions:
    • Plan validator (backend/internal/plan/) — add the new version string to the recognized set.
    • Runner /healthz schema-versions endpoint (once #466 lands) — add the new version to the advertised list.
    • A NEW workflow MAJOR (ADR-046 / #1381 stood up workflow-v1 as the keystone): add the canonical docs/spec/workflow-vN.schema.json, run scripts/sync-schemas to mirror it into backend/internal/spec/schemas/ + cli/internal/spec/schemas/ (the workflow-v* glob routes it — no script edit), append a {Major: N, Path: …} entry to the embeddedSchemas routing table in BOTH backend/internal/spec/parse.go and cli/internal/spec/spec.go (this is what makes the version-routed validator dispatch to the new major instead of failing closed), add an EmbeddedSchemaHashVN() + the workflow-vN /healthz schemas-map entry in backend/internal/server/handlers.go, and register the new mirror set as its own self-referential surface-sweep pattern in backend/internal/server/surface_sweep.go.
  4. x-intended-required annotation. When a field is optional now but will become required in the next major version, annotate it in the JSON Schema:
    "some_field": {
      "type": "string",
      "x-intended-required": true
    }
    JSON Schema Draft 2020-12 §10.3 collects unknown keywords as annotations without affecting validation, so this annotation is safe to add to any schema without breaking existing validators.

Auth change checklist

Before opening a PR that adds or tightens handler-side authorization (scope check, role check, audience check), the PR body must include:

  1. Impact inventory. Which active tokens would lose access if the change shipped as-is? Run fishhawkd token migrate --db $FISHHAWKD_DATABASE_URL (dry-run, no --apply) to enumerate affected tokens. Paste the summary line into ## Notes.
  2. Migration path. State how affected tokens will be brought up to the new requirements. Options in order of preference:
    • fishhawkd token migrate --apply — promotes tokens whose scope set is a strict subset of the operator default (see #529).
    • Re-issue the token with fishhawkd token issue --subject <s>.
    • Manual DB update (last resort; document the exact SQL).
  3. Safe-to-ship determination. The PR is safe to ship without operator-side action only when the impact inventory is empty (step 1 produced scanned=N migrated=0). If the inventory is non-empty, the migration path must be completed before or immediately after deploy, and this must be stated explicitly.

Cross-reference: this checklist codifies the rollout discipline introduced by #529; see #472 for the analogous schema-change discipline.

Audit-category change checklist

A new audit category — any string literal reaching audit.Entry / ChainAppendParams / AppendChained / an emit helper — obliges backend/internal/audit/categories.go in the SAME plan scope. The committed-tree verify gate's TestKnownCategoriesCoversEmittedCategories fails on an unregistered emitted category, and an implement agent whose scope omits the registry cannot reach the file (run 49f642b8 / #3410 discovered the obligation only by failing that gate and burning a scope amendment on it).

  1. Scope the registry. Add backend/internal/audit/categories.go (modify) to scope.files alongside the emitter — a one-line registration.
  2. The plan gate flags the omission. The plan-gate surface sweep's audit-category rule (backend/internal/server/audit_category_sweep.go) reads the plan's own prose for a snake_case token named as an audit category/entry/row/event, drops the ones audit.IsKnownCategory already registers, and — when the plan touches backend/ without the registry — records a new audit category requires registry finding rendered to the plan reviewer as NEW AUDIT CATEGORY. It is exemptible via surface_sweep_exemptions {pattern: "new audit category requires registry", sibling: "backend/internal/audit/categories.go"} ONLY when the token is not in fact a category (a runner log event, a tool name); an exemption is recorded and reviewer-challengeable.
  3. Operator-visible categories also oblige backend/internal/issuecomment's activityCategories (#3392/#3406) — the activity-comment renderer's allow-list — so the entry surfaces on the issue thread; and any new issue-comment surface still obliges docs/issue-comment-surfaces.md (the path-triggered "audit kind requires surfaces doc" pattern).
  4. In a fix loop, do not retry. When the verify output names the registry (add them to backend/internal/audit/categories.go), the fix prompt lists it under OUT-OF-SCOPE PATHS with the mid-stage scope-amendment recipe — file the amendment; an in-scope workaround is the #1170 silent wrong-fix class.

Rebuild matrix

scripts/dev up auto-detects which binaries need rebuilding by diffing origin/main...HEAD (falling back to main...HEAD with a warning if origin is unreachable) against the table below. fishhawkd always rebuilds as the baseline; the others rebuild only when their source changed. scripts/dev up --all forces all five. Each rebuild prints a line naming the trigger (baseline, --all, or the path that matched).

If PR touchesRebuild
backend/cmd/fishhawkd/ or backend/internal/{server,prompt,plan,spec,runner,webhook,notifier,github,storage,db,...}fishhawkd
backend/cmd/fishhawk-mcp/fishhawk-mcp
backend/internal/mcpserver/ (extracted MCP tool library, E66.7 / #2408)fishhawk-mcp, fishhawkd
backend/cmd/fishhawk-mcp-shim/fishhawk-mcp-shim
runner/cmd/fishhawk-runner/ or runner/internal/...fishhawk-runner
cli/cmd/fishhawk/ or cli/internal/...fishhawk CLI
backend/internal/plan/ or backend/internal/spec/ (shared libs)fishhawkd, fishhawk-mcp, fishhawk-runner, fishhawk (NOT the shim — it carries its own trigger glob, so it rebuilds rarely)

Only a README.md basename is carved out of the matrix (#2403). A README-only diff rebuilds nothing beyond the fishhawkd baseline and fires no MCP banner. Every other doc-shaped file (a CHANGELOG.md, a nested docs/*.md) and every embedded asset still triggers, deliberately: the predicate _path_affects_build is a deny-list that fails toward over-notifying. Long-form: scripts/README.md § "Rebuild detection and the README.md carve-out".

Rebuilt-on-disk is not the same as live. What it takes for a rebuilt binary to actually take effect differs per binary:

BinaryActivation after a rebuild
fishhawkdrebuilt and restarted by scripts/dev up/reload
fishhawk-runnerpicked up automatically — spawned fresh from bin/ on each fishhawk_run_stage
fishhawk-mcpauto-swapped by the registered fishhawk-mcp-shim (ADR-060 / #1922) — the shim SHOULD hot-swap the rebuilt child, and up/reload print a one-line auto-swap note saying so. That is an expectation, not an observation (#2831): scripts/dev cannot probe the harness-owned shim, so CONFIRM with a version-returning tool call reflecting the new GitSHA. If it still reports the old SHA the swap did not happen — run bin/fishhawk-mcp-shim --status for the recorded reason (deferred_in_flight names the request holding it off; deferred_no_initialize_recorded means the session cannot be replayed at all), then /mcp. A manual /mcp reconnect is also the fallback when the shim is not registered (the Claude Code harness owns the MCP server process, so scripts/dev cannot restart it)
fishhawk-mcp-shimrebuilt on disk but a shim-binary change needs a manual /mcp reconnect — the shim swaps its child, not itself, so the harness-owned shim process stays on the old code until you reconnect

Dev builds are GitSHA-stamped (#1007). scripts/dev stamps the short HEAD SHA (-dirty on a dirty tree) into all five binaries via -ldflags -X <module>/internal/version.GitSHA=…, so /healthz git_sha, fishhawk version and the MCP handshake report the build commit; Version stays dev. A wrong -X package path is a silent no-op, so keep _build_ldflags in sync when moving a version package (scripts/test-dev checks it). Long-form: scripts/README.md § "GitSHA-stamped dev builds".

post-merge and reload. scripts/dev post-merge [<issue>] [--start-deps] is the per-PR post-merge walk: git pull --ff-only, scripts/cleanup-merged, an optional warn-only issue-closed check, then reload last. reload (down-then-up) always forces --all, because after a merge the origin/main...HEAD diff is empty and would rebuild nothing. Both REFUSE while any fishhawk-runner process is live, before any teardown or git step (E68.7 / #2897); --force overrides. Long-form: scripts/README.md § "post-merge and reload" and § "Live-run guard for reload / post-merge".

Stale-worktree warning and sweep (#1917). up warns, and never fails, when a .claude/worktrees/* checkout is already merged into origin/main. scripts/dev sweep [--days N] [--yes] [--dry-run] removes merged-clean operator worktrees, aged run litter and keyed /tmp sidecars after one confirmation; a non-tty without --yes removes nothing, and it never passes --force to git worktree remove. Long-form: scripts/README.md § "Stale operator-worktree warning + sweep".

MCP banner (ADR-060 / #1922). up/reload print exactly one closing banner, in fixed precedence: schema-major > shim-rebuilt (needs one /mcp) > reconnect (mcp changed, shim NOT registered) > auto-swap (mcp changed, shim registered) > none. The auto-swap note states an EXPECTATION, not an observation (#2831): confirm with a version-returning tool call showing the new GitSHA; if it shows the old one, run bin/fishhawk-mcp-shim --status, then /mcp. Long-form: scripts/README.md § "MCP banner selection", backend/cmd/fishhawk-mcp-shim/README.md § "scripts/dev integration".

Schema-major banner (#1422, #2349). A .fishhawk/workflows.yaml version: MAJOR bump fires the schema-major banner even when nothing was rebuilt, because a stale stdio fishhawk-mcp validates against its old embedded schema and breaks every fishhawk_start_run. With the shim registered (and not itself rebuilt), the banner asks you to verify, for example with fishhawk_doctor reporting spec.valid: true; otherwise run /mcp. Server side, annotateStaleSpecError adds a run /mcp to reconnect hint to the unsupported-version error. Long-form: scripts/README.md § "Schema-major banner".

Readiness gate verifies listener identity (#965, nonce #1018). up/reload refuse to spawn onto an occupied fishhawkd port. After /healthz turns healthy, they require it to echo the per-spawn start_nonce (.fishhawk/dev.nonce), so a stale daemon squatting on the port cannot pass as the new one; a mismatch exits 1 with a log tail (#628). down falls back to the port and kills only a nonce-verified or fishhawkd-named listener. Long-form: scripts/README.md § "Readiness gate: listener identity".

ZERR trap and zsh set -e rules (#631). up/reload install a TRAPZERR trap that prints scripts/dev: command failed (exit <code>) at line <file:line> on any abort in an untested context. When writing zsh under set -e, use (( ++i )) or i=$(( i + 1 )), never (( i++ )): it returns 1 when i==0 and aborts the script. Likewise use if [[ cond ]]; then x=1; fi, not [[ cond ]] && x=1. scripts/test-dev guards both. Long-form: scripts/README.md § "ZERR diagnostic trap".

Local Kubernetes (scripts/dev k8s / k8s-down, #852). scripts/dev k8s (make k8s-up) builds the fishhawkd image, loads it into the node when Docker Desktop's kind-based provisioner does not share the host image store, helm upgrade --installs the chart with values-local.yaml, port-forwards svc/fishhawk to 8080 and gates on /healthz. Its fail-closed image-identity gate then requires the pod's image config digest and /healthz git_sha to match the build (#3344, #3530); FISHHAWK_K8S_SKIP_IDENTITY=1 is the only bypass. It is an operator smoke test, not run in CI. Long-form: docs/deploy/kubernetes.md § "Image identity", scripts/README.md § "Local k8s ergonomics".

Adding a Go module

  1. mkdir <name> && cd <name> && go mod init github.com/kuhlman-labs/fishhawk/<name>
  2. Append use ./<name> to /go.work.
  3. Verify: (cd <name> && go build ./... && go test ./... && golangci-lint run ./...).
  4. Wire the module into backend/Dockerfile if the image build must resolve it. The image runs go mod download against the whole go.work workspace inside the container, so EVERY module listed in go.work must have its go.mod copied before that step — add COPY <name>/go.mod[ <name>/go.sum] ./<name>/ to the first COPY phase (omit go.sum if the module has none) and COPY <name> ./<name> to the source phase. A module added to go.work but not the Dockerfile fails go mod download with cannot load module ../<name> — and this was invisible at PR time until the PR-CI docker-build gate landed (#735), because the on-disk workspace the go job builds against always has the module present (the #733 / #672 break: red main for 5 merges).

Git flow

Issue → feature branch → PR → docs + follow-ups → close issue → update relevant issues.

  1. Pick a child issue from Project #7. If a blocking ADR is open, resolve it first.
  2. Branch from origin/main: <issue-slug>-<desc>, e.g. e3.1-backend-skeleton.
  3. Commit with git commit -s (DCO is mandatory; PRs without sign-off are rejected). Imperative-mood title, no conventional-commits prefix. Use HEREDOC for multi-line messages.
  4. Update docs in the same PR, before opening:
    • New package / HTTP route / env var / flag → a pointer row in docs/ARCHITECTURE.md "Where to look" (path + ≤1 sentence, no history — the verify gate caps line length at 1000 chars) with the long-form contract in the owning package's README.md; operator-facing inputs also → component README.md.
    • Spec or schema change → docs/spec/<x>.md + every embedded copy (CI's schema-sync diff fails otherwise).
    • HTTP API change → docs/api/v0.openapi.yaml (source of truth) + docs/api/v0.md.
    • Add / remove / rename an issue-comment surface (Notifier method or audit kind) → docs/issue-comment-surfaces.md.
    • Voice/naming → BRAND_FOUNDATIONS.md. New trap / build workflow → AGENTS.md, plus any .agents/skills/ skill that cites it (see Documentation surfaces; operator-authored, so a run files it as a follow-up). Autonomy convention → METHODOLOGY.md.
    • Ratified ADR → its docs/adr/NNN-slug.md record (tracker body verbatim, front matter per docs/adr/README.md) + scripts/check-adr --write-index + the README Records row + the superseded record's superseded_by when the ADR states a supersession — in the same change that records the ratification, or the change immediately after. ADR-081 onward are added one by one (upkeep rule, E78.3 / #3724).
  5. File issues for deferred work before the PR opens. Any TODO, "follow-up PR", "deferred to E…", or obvious operability gap gets a tracking issue. Prefer fishhawk_file_issue (the work-management tool, #1005) over the hand-rolled gh issue create + four labels + gh project item-add + GraphQL-status dance: it applies this repo's work_management conventions automatically — the [E<parent>.<n>] / [ADR-NNN] title format, the type:* default label, the per-type body skeleton, Status=Backlog, ADR numbering, and the parent-epic link — so you pass type + summary + the area:*/autonomy:*/phase:* labels + relations.parent_epic and it renders a conventions-complete item. For a numbered type (adr) ADR numbering is now discovered server-side from the tracker (#1269), so existing_numbers is OPTIONAL — the backend searches the existing numbered titles (open and closed) and allocates the next one. Pass existing_numbers only to override/hint that discovery, or seed existing_numbers:[0] (which yields 1) if discovery is unavailable for the target provider; a genuine discovery failure fails closed with work_item_invalid (details.discovery_failed) rather than allocating a wrong number (the #1265 empty-list guard remains the last line for a provider without discovery). Reference the filed issue from the PR body's ## Notes so the deferral is reviewable.
    • Board placement is automatic (boarded:true) when FISHHAWKD_PROJECTS_TOKEN (a project-scoped PAT/UAT) is configured; without it the tool still files the conventions-complete issue but degrades to boarded:false with a logged boarding_error — board it manually then: gh project item-add 7 --owner kuhlman-labs --url <issue-url>. WHY that token is required, what each degradation reason means, and the per-forge picture: docs/board-capability-matrix.md.
    • For Fishhawk product friction (a bug in the tooling itself hit during a run), prefer fishhawk_report_product_issue with the run's id — it attaches a redacted, fingerprint-deduped diagnostic bundle (#1006).
  6. Open PR — body uses ## Summary / ## Test plan / optional ## Notes / Closes #<issue>. Match #80, #81.
  7. After merge, walk the dependents:
    • Verify parent epic progress via its sub-issue links and the tracker Status field — epic bodies don't carry a hand-maintained checklist to check off (sub-issues + Status are the source of truth, E34.10 / #1617).
    • Update sibling issues if scope shifted (e.g., a CI fix bundled here means another sibling no longer needs it).
    • If an ADR was resolved, edit its body's Decision section and close.

Run scripts/cleanup-merged to delete local branches that have been merged into origin/main (optional; can be wired into a post-merge git hook).

Force-pushing a feature branch is fine with --force-with-lease; ask before force-pushing if there are review comments. Never force-push main.

Project tracker (#7)

RangeKindTitle format
#1–#15Epic[EX] desc
#16–#64Child[EX.Y] desc, body ends Parent epic: #N
#65–#79ADR[ADR-NNN] desc, body uses Context / Options / Recommendation / Decision / Consequences
  • Labels (apply all four to every impl issue): area:*, autonomy:*, phase:*, type:*. Plus epic or adr on parents.
  • Custom fields: Component, Phase, Autonomy, Estimate, Priority, Target day. Status must be set to Backlog on creation (default is null; null breaks the kanban view).
  • Day 1 = 2026-04-30. Phase milestones derive from there.

Voice (BRAND_FOUNDATIONS §5)

Direct, technical, restrained, honest about trade-offs. Banned:

  • "revolutionary," "game-changing," "next-generation," "industry-leading," "world-class"
  • "AI-powered" as a sole differentiator
  • "frictionless," "seamless," "effortless"
  • "empower" in any context
  • "trust" as a marketing claim

Error messages: precise about what failed and how to fix. No generic apologies.

Naming

  • Product: Fishhawk in prose; fishhawk lowercase for CLI, .fishhawk/, fishhawk/runner@v1, app.fishhawk.[tld].
  • Go module paths: github.com/kuhlman-labs/fishhawk/<module>.
  • Workflow primitives (workflow, stage, gate, constraint, approver, artifact, plan, audit log) — lowercase nouns. Never branded.

Traps

  • t.Parallel() and t.Setenv/t.Chdir are mutually exclusive — a test calling both PANICS (testing: test using t.Setenv or t.Chdir can not use t.Parallel). backend/internal/postgres (except startcontainer_test.go) and backend/internal/integration/mcp run every top-level test with t.Parallel() (#3881), so a new test needing t.Setenv/t.Chdir must go in a non-parallel file instead.
  • macOS bash is 3.2 — no associative arrays. Use zsh, gawk, or awk lookups for scripts that need them.
  • A container image build must derive GOARCH from BuildKit's TARGETARCH automatic platform ARG (declared inside the stage that uses it), never a literal — a hardcoded GOARCH=amd64 is invisible on an amd64 CI runner and only surfaces as emulated execution on an arm64 host/node (#2912); scripts/test-dev pins the shipped directive.
  • A host behind a TLS-inspecting corporate egress proxy fails docker build -f backend/Dockerfile with x509: certificate signed by unknown authority during go mod download — the tell: the same command run directly on the host (outside the container) succeeds, because the container's trust store doesn't carry the interception CA that the host's does; registry/base-image pulls are unaffected (#2918). Fix + full diagnostic: docs/deploy/kubernetes.md § "When the build fails with x509: certificate signed by unknown authority".
  • On Docker Desktop for macOS, a docker-credential-desktop get that blocks (presumably on keychain access) makes EVERY docker pull hang with no output and no error (observed 2026-10-06, E51.5 / #2138). With credsStore set in the docker config the CLI calls the helper even for an anonymous public pull, so scripts/test lint|verify --in-gate-image, container-path gates and the docker-gated runner fixtures all stall at the pull. Tell: a docker-credential-desktop get child under the pulling docker process. Remedy for anonymous public pulls only: DOCKER_CONFIG pointing at a fresh {"auths":{}} config (no credsStore, no credHelpers, no inline auths entries) plus an explicit DOCKER_HOST=unix://$HOME/.docker/run/docker.sock, set in the RUNNER's environment when it is the runner that pulls; it cannot pull a private image. Observed on one host, not a reproduced contract. Details and the runner's per-step bounds: runner/README.md § "Gate isolation" (Docker Desktop: hung credential helper), docs/deploy/self-hosted.md § "Runner gate isolation (ADR-063)".
  • Do NOT start a second concurrent scripts/test verify, and NEVER poll one that refuses (#3315). The runner runs the verify gate against the committed tree after an implement/fix-up agent finishes — in an independent throwaway clone whose verify is pointed at the PRIMARY's lock via FISHHAWK_VERIFY_LOCK_PATH (ADR-063 / #2134) — and it holds the per-repository verify lock while it does. A shell verify meeting a live holder exits non-zero with an actionable message; that is terminal for that invocation, so a retry loop just burns the stage budget (the shape that killed run a662ed6f category-A). Narrow to scripts/test single -run TestX ./your/package/... and report what you have. Two concurrent verifies also contend on golangci-lint's global lock and the shared testcontainers Postgres — the same #2645 hazard as two concurrent implement stages.
  • go.work is committed; go.work.sum is not. go.sum will appear on first external import.
  • Project #7 Status field has 6 options (Backlog/Up Next/In Progress/In Review/Blocked/Done) set via GraphQL updateProjectV2Field with singleSelectOptions (undocumented input field). Repeat the same workaround if creating new projects.
  • Project #7 owner is kuhlman-labs as a user, not an organization — a GraphQL query taking an owner login must use user(login:"kuhlman-labs"), not organization(...), or you get a NOT_FOUND. It is user-owned Projects v2, which is also why an App installation token cannot reach it (#1114) — see docs/board-capability-matrix.md.
  • Project #7 has > 100 items. GraphQL caps items(first:N) at 100, so the project's item list silently truncates: query the ISSUE's projectItems(first:10) and filter by project.id instead. The enumeration rule this implies for product code (read repository.issues, never a board item list; a full projectItems page missing the target fails closed as board_state_undecidable) is in docs/board-capability-matrix.md.
  • jsdom rejects __Host- cookies under HTTP. The default vitest jsdom URL is http://localhost/, but __Host- requires Secure, and tough-cookie won't honour it over HTTP. frontend/vite.config.ts sets test.environmentOptions.jsdom.url = 'https://localhost/' so cookie semantics in tests match production. Browsers treat localhost as a secure context anyway, so dev still works.
  • Vite's server.fs.deny default **/.git/** denies EVERY file in a .git-nested checkout (#3030). A run worktree lives under <repo>/.git/fishhawk-worktrees/run-<id>/, so its served root matches that rule and every frontend module load is refused — surfacing as a MISLEADING Error: Cannot find module '/src/test-setup.ts' / Does the file exist?. The resolved config root is the full nested path (the .git segment is NOT stripped), so the file is denied, not missing, and an absolute-path setupFiles fix is a dead end. The carve-out lives in frontend/vite-fs-deny.ts: it drops only that one rule, and only when the config dir has a .git path segment (normal checkouts keep stock posture). Details: frontend/README.md.
  • scripts/test exports GIT_CONFIG_GLOBAL=/dev/null + GIT_CONFIG_SYSTEM=/dev/null so temp-repo test commits never inherit the operator's global commit.gpgsign (#912). Without this, a global commit.gpgsign=true red-lines the verify gate when the SSH/GPG signing agent (e.g. 1Password op-ssh-sign) is down. No-op on CI (no signing config); in-repo git ops are unaffected because repo-local .git/config commit.gpgsign=false takes precedence over the now-absent global. The runner's gate subprocesses carry the SAME pin (gateEnvGitConfigPins in runner/cmd/fishhawk-runner/gateenv.go, mirrored in the CLI's verifyEnvGitConfigPins) since #3102 — default-deny drops an inherited GIT_CONFIG_GLOBAL but HOME is allow-listed, so a gate child would otherwise fall back to $HOME/.gitconfig; pinning both vars to /dev/null closes that fallback so this trap is not rediscovered a third time.
  • A git push into a local bare repo forks a DETACHED git maintenance run --auto --detach child that outlives the push (#3503). receive.autogc / maintenance.auto default true, so every push into a bare origin makes the receiving git-receive-pack spawn git maintenance run --auto --quiet --detach; since git 2.46 that child DAEMONIZES (fork, then daemonize(), so git push and the caller return while the forked child keeps running), and git 2.52+'s default --auto strategy can run a geometric-repack/commit-graph/worktree-prune task AFTER the fork — recreating objects/pack/ under the origin while a t.TempDir() bare-origin fixture is mid-RemoveAll fails cleanup with directory not empty. Repo-local config (-c, GIT_CONFIG_COUNT) does NOT reach receive-pack over a file-path push (git's connect.c scrubs local_repo_env for the file transport); GIT_CONFIG_GLOBAL does. runner/cmd/fishhawk-runner's runTestMain pins maintenance.auto=false that way for every git child of the package's test process (TestHarnessDisablesAutoMaintenanceOnLocalPush pins the control; long-form: runner/cmd/fishhawk-runner/README.md). As of #3507, runner/internal/gitops and cli/cmd/fishhawk carry the same TestMain pin + TestHarnessDisablesAutoMaintenanceOnLocalPush control (long-form: runner/README.md, cli/README.md) — all three git-pushing test packages in the repo are pinned. A NEW test package that pushes into t.TempDir() bare origins needs the same pin, and note the sharper trap #3507 found: a per-test t.Setenv(GIT_CONFIG_GLOBAL, …) ahead of a file-path push (as runner/internal/gitops's gitNoPromptEnv does for the #3443 wire-fixture tests) silently DEFEATS a package-level TestMain pin for that test's duration unless it is repointed at the same pin file.
  • Wall-clock boundary-timeout tests must derive every deadline-competing duration via backend/internal/timescale D(base) (#1984) — ctx deadlines, kill graces, elapsed upper bounds, helper wedge/failure sleeps, and spawn/reap liveness waits. Never assert a raw elapsed upper bound: D(base) scales all of them by one factor so the discrimination ratios (bound/deadline, wedge/bound) hold at any factor, and keeping wedge/failure sleeps on the same factor stops a loaded CI runner slipping past a tight raw bound. CI auto-scales 5x via the non-empty CI env var (GitHub Actions sets it); override with FISHHAWK_TEST_TIME_SCALE (positive integer 1..1000; invalid/out-of-range panics). Leave the 20ms poll intervals unscaled. Long-form contract: backend/internal/timescale/README.md.
  • A test that compares a Go-side time.Now() seed against a DB-stamped now() value has a CROSS-CLOCK-DOMAIN dependency, and timescale scaling does NOT fix it (#3048). Clock skew between the host process and the Postgres container is UNBOUNDED, so scaling a margin only widens the window it takes to lose — this is the sibling class of the timescale.D rule above, not an instance of it. The fix is to ANCHOR the seeded side in the same clock domain as the value it will be compared against: read the DB-stamped timestamp back and OFFSET from it, then derive that offset with timescale.D per the rule above. Worked example: dbAnchoredHeartbeat in backend/internal/run/dispatchliveness_test.go, which anchors every comparative heartbeat seed to the row's own dispatched_at. Anchor only the COMPARATIVE seeds — a fixture timestamp never compared against a DB value has no cross-clock dependency and rewriting it is churn.
  • A test fake reachable from a bounded-fan-out product path must guard its own bookkeeping state with a mutex (#3226, sibling of #2586). workmgmt/github.(*Provider).fetchIssuesBounded dispatches issueSetFetchConcurrency = 8 concurrent GetIssue calls per issue-set resolution, so any fake implementing GetIssue and recording calls into a plain map races on the lazy-init and the increment; this matters beyond a red build because a racy fake makes a -race counterfactual RED attributable to the FAKE rather than to the control under test, degrading the verification method itself. Residual: the sweep covered fakes implementing the workmgmt/github.API interface — a future fake behind a DIFFERENT concurrent seam is not covered by it.
  • A test that WAITS on one sink and ASSERTS on another has NO ordering guarantee between them (#3004, sibling of #3226). supervisor.noteDeferral publishes the swap-state snapshot BEFORE it logs, so TestDeferralLogRateLimited waiting on the published snapshot and then counting log lines read the log too early — flaky under -race, which widens the window. Remedy: assert on the sink you waited on, or establish a REAL happens-before. For a single-goroutine event loop, one further UNBUFFERED channel handoff is that barrier — the loop can only receive it after the previous iteration returned, so the send completing proves the earlier log write happened (harness.barrier in backend/cmd/fishhawk-mcp-shim/supervisor_test.go is the worked example; pick an INERT frame, there an id-less notification, so the barrier perturbs no assertion). Anti-remedy: relaxing an exact count to >=, or polling for == N, LATCHES on a transient value and would still pass if a regression logged one time too many — that silently deletes the control the test exists to pin.
  • A fixture requiring an invocation to COMPLETE inside a tight timeout is racing process spawn, and timescale scaling does NOT fix it (#3587, sibling of #1984/#3048). The CI-only 5x factor is 1 on the loaded developer host where it fires, so a 500ms fixture deadline has no margin over sh fork/exec during a 4-module go test -race loop — and it MISDIAGNOSES: a deadline-killed first invocation takes runVerifyFixLoop's gateTimedOut break BEFORE both absorbs, so verifytimeout_test.go reported formatter invocations = 0, want 1, a downstream symptom. Remedy: separate the two deadline ROLES — keep the cheap budget where the expected verdict IS the timeout, give every must-complete invocation an order-of-magnitude one (fastExitSafeVerifyTimeout() = 10 * hangVerifyTimeout()), assert completion as a PRECONDITION so a violation names host load, and pin the margin with a fixture sleeping between the old and new budgets. Long-form: runner/cmd/fishhawk-runner/README.md.
  • testcontainers.WithWaitStrategy REPLACES a module's default wait strategy (#2948). Overriding a module default with a log-only wait (wait.ForLog) silently drops the port-mapping wait, so ConnectionString (Host+MappedPort) can fail immediately — flaky on Docker Desktop, where the published port is served by an asynchronously-started proxy. Use WithAdditionalWaitStrategy (it appends) and keep a port-bearing strategy (wait.ForListeningPort / ForHTTP with a port), which retries MappedPort until the mapping resolves. This is why pgtest.go works on the same daemon: it passes tcpostgres.BasicWaitStrategies(), which appends ForListeningPort("5432/tcp").
  • A host whose local Go is NEWER than the go.mod/go.work pin (go 1.25.0) can red-line scripts/test verify on CLEAN main with no diff of its own (#3237). GOTOOLCHAIN=auto only downloads a NEWER toolchain when go.mod demands one and otherwise runs whatever newer Go is already on PATH (e.g. Homebrew rolling to 1.27 while CI and the pin stay on 1.25). The #3237 instance: Go 1.27 ships encoding/json on the jsonv2 implementation by default (GOEXPERIMENT=jsonv2), which substitutes the raw three-byte U+FFFD for an invalid UTF-8 byte where the classic 1.25 encoder emits the six-byte � escape, so backend/internal/mcpserver's TestJSONEncodedLen_MatchesEncoder_Differential (an exact-equality oracle against the running encoder) goes red. Tells: the failing test is green in CI and green under GOTOOLCHAIN=go1.25.6. Remedy on a host running scripts/test verify directly (the "shell" gate path): go env -w GOTOOLCHAIN=go1.25.6 — this writes the Go env file under $HOME/.config/go/env, and it reaches the runner's gate subprocess because HOME is on the gate's env allow-list, not because GOTOOLCHAIN itself is allow-listed as a variable (verified empirically recovering run 12aaac69: an ambient GOTOOLCHAIN env var would be dropped by the default-deny allow-list the same way any other unlisted var is, but the go binary itself reads the env FILE under $HOME, which the allow-listed HOME var still resolves to). On the --network=none container gate path there is no host filesystem to read a $HOME/.config/go/env from, so the pinned toolchain must already be the Go version baked into the image — the remedy there is the image's Go version, never the host env file. GOEXPERIMENT=jsonv2 on the pinned 1.25.6 toolchain reproduces the Go 1.27 default encoder offline for local repro/fix without needing a newer toolchain installed. A hard GOTOOLCHAIN pin inside scripts/test was deliberately rejected (#3237): it would force a toolchain download inside the --network=none container gate whenever the operator's image Go isn't exactly the pinned patch version — a new, worse red on clean main.
  • A pinned third-party image tag must be verified to EXIST before landing it (#2913, #3386). The Helm chart's bucket-bootstrap hook Job image (rustfs.bootstrapImage, amazon/aws-cli) is pinned INDEPENDENTLY of the store image (rustfs.image), so a plausible-looking tag copied from a sibling can 404 — the original instance was minio/mc copied from a minio/minio server tag the mc repository never published. Because that Job is a post-install/post-upgrade Helm HOOK, a nonexistent tag surfaces ONLY as a helm upgrade timeout (never a named ImagePullBackOff), which is why it shipped past scripts/test-helm-render's rendered-output assertions — a render gate structurally cannot catch a nonexistent tag. The gate is scripts/test-helm-render r15 (a fail-closed anonymous Docker Hub registry-v2 manifest HEAD over every rendered image, sentinel-guarded so an unreachable registry skips rather than greens), and scripts/dev k8s dumps hook Job + pod state naming the pull reason on a helm failure. Two lessons from #3386 layered on top. (1) An image can vanish REPOSITORY-wide, not just tag-wide: minio/minio and minio/mc were deleted from Docker Hub outright, breaking CI's tracestore S3 tests, docker-compose and the chart at once — which is why the tree now runs rustfs/rustfs (Apache-2.0) as the S3-compatible dev store, and why pins should be re-verified pullable (docker manifest inspect, or r15 on a networked helm host) when a run fails on a pull rather than assumed frozen. (2) r15's anti-vacuity SENTINEL must be a missing TAG in an EXISTING repository: Docker Hub answers a manifest HEAD for a nonexistent REPOSITORY with 401, which the classifier maps to indeterminate (the docker CLI renders that same 401 as pull access denied … repository does not exist or may require 'docker login'), so when the sentinel's repository was deleted r15 silently SKIPPED every live probe with no signal — the gate was vacuous until the sentinel moved to rustfs/rustfs:RELEASE.2025-01-20T14-49-07Z, a MinIO-style date tag that cannot exist in a semver-tagged repo (operator-verified 404, 2026-09-13). If a live r15 run ever prints its SKIPPING the live registry probes line on a networked host, check whether the sentinel's repository still exists before blaming the network.
  • A green scripts/dev k8s was compatible with a STALE fishhawkd image on Docker Desktop's kind-based provisioner (E69.8 / #3344). The desktop-control-plane node runs its own containerd that the host daemon cannot see, so a docker build never reached the kubelet and pullPolicy: IfNotPresent reused whatever dev-local the node already held — /healthz green, old binary serving. The bring-up is now image-identity-gated and FAIL-CLOSED: provisioner detected before the build (unknown → refused), the image loaded into the node explicitly, rollout restart forced, and the pod's image ID + git_sha verified against the build; FISHHAWK_K8S_SKIP_IDENTITY=1 is the single, loudly-warned bypass. Two dirty builds at one commit share the same -dirty SHA — only the config digest tells them apart, so never weaken the primary check to git_sha alone. Tell for the provisioner: kubectl get nodes -o name. Contract: docs/deploy/kubernetes.md § "Image identity", scripts/README.md.
  • On a containerd-image-store host docker image inspect --format '{{.Id}}' returns the OCI INDEX digest, not a config digest, so the #3344 identity gate compared a config digest against an index digest and false-alarmed 'STALE fishhawkd image' on every correctly-loaded fresh build (E69.70 / #3530). --platform … '{{.Id}}' is no fix either — it returns the platform MANIFEST digest, still not the config digest. Only the docker save tarball's top-level manifest.json Config entry names the config blob directly, on BOTH the containerd image store ("Config":"blobs/sha256/<hex>") and the classic graph driver ("Config":"<hex>.json"), so any comparison of the two sides must resolve BOTH to a config digest that way (the gate now does, via _k8s_local_config_digest); the kubelet's containerd://sha256:… imageID is already a config digest. Buildx's default attestation manifest means an OCI-index walk must SKIP the attestation entry (vnd.docker.reference.type / "architecture":"unknown") rather than take the first array entry, whose order is not contractual. The tell: a digest mismatch whose two values are exactly one OCI hop apart (index vs config) while /healthz reports the EXPECTED git_sha. Contract: docs/deploy/kubernetes.md § "Image identity", scripts/README.md.
  • A run that fixes a defect in fishhawk-runner itself hits a bootstrap deadlock (E64.5 / #3086). The runner is a separate binary built from main and respawned fresh from bin/ on every host dispatch, so the run's stages execute under the UNFIXED runner — the same stage fails category-A repeatedly (stage_fixup_triggered climbs while fixup_pushed stays 0). fishhawk_dispatch_stage / fishhawk_run_stage now print a one-line advisory (guardRunnerSelfHost) when the plan scope touches runner/, but a direct bin/fishhawk-runner invocation or an auto-drive spawn bypasses both verbs and sees nothing. The escape: git worktree add --detach a scratch dir at the run-branch commit, go build -o <repo>/bin/fishhawk-runner ./cmd/fishhawk-runner from that worktree's runner module, verify, re-dispatch — a scratch worktree NOT a checkout, because the runner owns the run's lineage worktree (the #1866 base-contamination class). Full recipe: runner/README.md § "Self-hosting bootstrap deadlock".
  • A change to backend/internal/prompt/prompt.go's untrusted-intake rendering must RE-RUN both #2291 eval corpora (E60.2). backend/internal/agenteval commits an injection corpus (ELEVEN attack classes — the sixth, verify-output-instruction-injection, plants its payload in verify-gate OUTPUT rolled into the implement-review prompt's gate evidence, #3192; the seventh, crew-message-instruction-injection, plants it in an agent-written CREW MESSAGE, #3738; the eighth, review-convention-override, plants it in a repository REVIEW CONVENTION, E55.3 / #2244; the ninth to eleventh, user-report-*, plant it in USER REPORTS on the user_report channel, asserted on the prompt.RenderUserReports render because no Build stage carries that channel until E81.5, E81.3 / #3773) and an envelope-quality corpus that gate the #2290 issue-body, #3192 verify-output AND #3738 crew-message quarantine envelopes. Their OFFLINE halves already run in scripts/test verify — the containment gate asserts each adversarial probe lands at an offset STRICTLY INSIDE its envelope span across plan/plan_review/implement_review (a verify_output probe only in implement_review, the sole reviewed render carrying gate evidence, and absent from the other two; a crew_message probe in all three, and the gate FATALs when a crew-bearing case emits zero crew envelopes, so a deleted call site cannot pass it vacuously) and nowhere in implement, so a rendering regression fails in-loop. Their LIVE halves (is the injected instruction actually not FOLLOWED? does the envelope dilute plan quality?) are opt-in, double-gated on FISHHAWK_AGENTEVAL_INJECTION_LIVE / FISHHAWK_AGENTEVAL_QUALITY_LIVE plus FISHHAWKD_ANTHROPIC_API_KEY, and have NOT yet run — #3187 owns them. Read the offline green honestly: it proves STRUCTURAL CONTAINMENT, not behavioural resistance. Two related traps: the no-envelope arm is produced by the harness-side agenteval.StripBodyEnvelope, never by a production off-switch, and that transform carries a byte-exact copy of prompt.go's ISSUE-BODY framing paragraph and ERRORS on drift — so editing that framing reddens TestStripBodyEnvelope_AcceptsRealPromptOutput and the literal must be updated with it; the #3192 VERIFY-OUTPUT framing carries its own second copy in the containment gate (verifyOutputEnvelopeFraming in injection_test.go), so editing IT reddens TestInjectionCorpus_ContainedInEveryReviewedRender and that literal must be updated in lockstep; and the #3738 CREW-MESSAGE framing carries the THIRD such byte-exact drift copy (crewMessageEnvelopeFraming in the SAME injection_test.go), which reddens the same gate and must be updated with it; and the E55.3 / #2244 ReviewConventionsFraming carries the FOURTH (reviewConventionsFraming in the SAME injection_test.go), which reddens the same gate and must be updated with it; and the E81.3 / #3773 user-report framing (userreport.go) carries the FIFTH (userReportEnvelopeFraming in the SAME injection_test.go), which reddens the same gate and must be updated with it. Read the offline green for the seventh class especially honestly: its LIVE behavioural arm has not run, and the render shipped before its delivery paths — E77.5's consult fold-in (resolveAnsweredCrewConsults, plan prompt only) and E77.7's deferred findings/notices (resolveDeliverableCrewMessages, plan + both review prompts). Contract: backend/internal/agenteval/README.md; evidence: docs/compliance/prompt-injection-evidence.md.
  • A new duplicated cross-module wire struct must be REGISTERED with the parity guard (#2558). The backend and runner are separate Go modules that cannot import each other, so a struct one MARSHALS and the other DECODES agrees only by convention — a tag rename on one side silently breaks the other. backend/internal/wirecontract is the repo-level guard (TestCrossModuleWireParity, in-loop via go test -race ./...): it parses both sides with go/ast and asserts json-tag agreement. When you add such a pair, (1) carry the CROSS-MODULE WIRE CONTRACT marker in a doc/field comment on BOTH structs, and (2) add a Pair row to SeedManifest() (backend/internal/wirecontract/manifest.go) naming both endpoints and the mode (ModeExact for round-trip leaves, ModeSubset when one side decodes a subset). A marker-bearing struct in a swept file that is neither a manifest endpoint nor an UnpairedExemptions entry FAILS verify. Subset mode compares NAMES and tolerates omitempty but fails closed on any other tag option (,string). The single source of truth for a duplicated GOLDEN is a shared testdata/wire/*.json fixture both modules' tests read — not two consts hoping to agree. Details: backend/internal/wirecontract/README.md.
  • scripts/dev reload / post-merge now REFUSE while a fishhawk-runner process is live (E68.7 / #2897), and --force is the override. Both commands restart fishhawkd; a runner mid-stage sees the backend vanish, and a lost terminal upload strands the stage in running — recoverable only via POST /v0/runs/{id}/stages/{id}/reap-failure. The refusal names every live run id and fires BEFORE any teardown (and, in post-merge, before git checkout main / git pull / cleanup-merged, so a refusal never leaves local git state half-advanced). Detection mirrors runner/cmd/fishhawk-runner/lockholder.go's runnerIdentityMatches: argv[0] basename EQUALS fishhawk-runner plus an adjacent --run-id <id> token pair — so a process merely MENTIONING the binary name in a later argument (grep fishhawk-runner, /bin/sleep fishhawk-runner --run-id abc) never counts, and a ps | grep pipeline cannot make post-merge refuse itself. A ps that is absent or fails prints a one-line reason and FAILS OPEN. The TOCTOU residual is real but narrowed: a runner started between the scan and the teardown is not caught. What makes a --forced restart survivable is the other half of #2897 — runner/internal/upload's TERMINAL-EGRESS budget: ShipTrace, ShipPlan and ReportRunnerFailure moved off the ~3.5s blip budget onto a ~75s capped budget, all three sharing ONE ~90s phase deadline (so the trace POST and its reap-failure fallback cannot stack two budgets), with a 15s tail RESERVED for the last-word report so a spent phase can never silence it. The phase is scoped to the OUTAGE, not to the Client: the first terminal call that SUCCEEDS closes it, so a terminal call made later than the ~75s settling window after a successful one opens a FRESH phase instead of inheriting an expired deadline and losing its upload with zero attempts against a healthy backend; a FAILING call deliberately leaves it armed, which is what makes the fallback share the bound. Every other call keeps the blip budget. Contracts: scripts/README.md, runner/README.md.
  • A verify that fails on tests UNRELATED to the diff may be a starved host, and the first check is uptime (E51.11 / #3663). An agent can background a process from a shell that then exits; the orphan is re-parented to pid 1 and keeps the ALREADY-EXITED shell's process-group id, so neither the runner's descendant walk nor a kill(-pgid) against the agent's group reaches it — it outlives the stage and its CPU red-lines every LATER verify on the host. Tell: uptime far above the core count (the #3663 incident hit ~140 on 10 cores) with the top ps -axo pid=,pcpu=,comm= consumers being sh/zsh children of pid 1 that no live run owns. The runner now reaps its own descendant + process-group closure at stage exit (stage_orphans_reaped in the stage trace is the tell that it did; stage_orphan_sweep_degraded names a fail-open degrade) and reclassifies a verify that FAILED above 4.0 x the core count from category A to category C with a host_overloaded: lead. Two residuals to read honestly: the sweep is SAMPLING-based at a 2s interval, so a descendant that both starts and escapes inside one window is never recorded, and FISHHAWK_ORPHAN_SWEEP=off disables the sweep half entirely. Kill a surviving orphan by hand when the trace shows no reap. Contracts: runner/internal/procsweep/README.md, runner/internal/hostload/README.md, runner/cmd/fishhawk-runner/README.md.
  • After Day 21, every change must flow through a Fishhawk workflow run (today: by convention; later: enforced by the product).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.