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.
- CLAUDE.mdCLAUDE.md
- deploy-localSkill
- dev-cleanSkill
- diagnose-redSkill
- frontend-checkSkill
- new-go-moduleSkill
- record-adrSkill
- spec-changeSkill
- sync-mainSkill
- teardown-localSkill
- verify-gateSkill
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
- Very specific: line 99
Before opening a PR that adds or modifies a field in docs/spec/:
- Distinctive: line 105
Version advertising: After the schema change merges, update every surface that advertises supported schema versions:
- Very specific: line 110
x-intended-requiredannotation: When a field is optional now but will become required in the next major version, annotate it in the JSON … - Distinctive: line 121
Before opening a PR that adds or tightens handler-side authorization (scope check, role check, audience check), the PR body must include:
- Very specific: line 138
Scope the registry: Add backend/internal/audit/categories.go (modify) to scope.files alongside the emitter — a one-line registration.
- Very specific: line 141
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 …
- Distinctive: line 197
Commit with git commit -s (DCO is mandatory.
- Very specific: line 202
Add / remove / rename an issue-comment surface (Notifier method or audit kind) → docs/issue-comment-surfaces.md.
- Distinctive: line 209
After merge, walk the dependents:
- Distinctive: line 210
Verify parent epic progress via its sub-issue links and the tracker Status field — epic bodies don't carry a hand-maintained checklist to …
- Distinctive: line 211
Update sibling issues if scope shifted (e.g., a CI fix bundled here means another sibling no longer needs it).
- Distinctive: line 212
If an ADR was resolved, edit its body's Decision section and close.
- Very specific: line 214
Run scripts/cleanup-merged to delete local branches that have been merged into origin/main (optional.
- Very specific: line 279
After Day 21, every change must flow through a Fishhawk workflow run (today: by convention.
≈ “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.
Files
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 thebacklog_groomingloop: invocation, what approving actually does (it writes), the autonomy-tier policy for this repo (autonomy:lowmeans 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 withcheck-jsonschema --schemafile <schema> <yaml-or-json>. Caveat: a workflow-v2 document usingdefaults/extendsmust be validated withfishhawk validate(or the backend), not a barecheck-jsonschemarun — the bare run resolves no same-document reuse, so it rejects a reuse-bearing spec (e.g. a stage inheriting itsexecutor) the product accepts (#2340). To keepcheck-jsonschemain 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 yamlis required because check-jsonschema assumes JSON on stdin, and emit RESOLVES without VALIDATING (no charter rule, no stage-reference sweeps), sofishhawk validatewithout the flag stays the authority.docs/adr/— the settled-decision record (E78.1 / #3722): oneNNN-slug.mdper ADR with a machine-readable front matter (id,status,supersedes/superseded_by,applies_to) and the tracker body transcribed verbatim.docs/adr/README.mdis the format contract and the status table;docs/adr/index.jsonis the machine index (repodoc cannot list a directory). Enforced byscripts/check-adrinscripts/test verify; regenerate the index withscripts/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.yamlis source of truth,v0.mdis the human companion. Lint withnpx -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 packageREADME.mdfor anything longer. The long-form behavioral contract, invariants, and issue history for a package live in that package'sREADME.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 verifyfails 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 pathsite/, 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 anddocs/stays agent-consumed and is never a publish source; nothing undersite/imports, globs or symlinksdocs/(prose cross-links todocs/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 onsite/src/content/docs/reference/index.mdplus ONEreference/workflow-spec.mdcovering v0, v1 and v2 with the differences inline, NOT one page per major. This mirrorsdocs/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 onsite/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}.mdeach carry an<!-- BEGIN/END GENERATED <id> -->marker pair; the region BETWEEN the markers is rendered bycli/internal/docgenfrom the canonical schemas (docs/spec/*.schema.json), the OpenAPI document (docs/api/v0.openapi.yaml) and thecli/internal/cmdinfocommand inventory, and is byte-exact. Orientation prose OUTSIDE the markers stays hand-editable. Regenerate withscripts/gen-site-referenceafter any change to a canonical source; the Go drift testcli/internal/docgen/drift_test.goand thescripts/test-site-referenceharness (wired intoscripts/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 byTestCLIFlagsMatchExecutableSurface, which asserts each command'scmdinfoflag set equals the liveflag.FlagSetin 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-voicefailsscripts/test verifyon anydocs/BRAND_FOUNDATIONS.md§5 term undersite/src/content/docs/(case-insensitive, prefix-based, leading-word-boundary anchored;trustdeliberately excluded as a human-review item).scripts/test-site-voicepins the control and runs in the same gate. - Site information architecture is machine-enforced (E12.7 / #2318).
scripts/check-site-iafailsscripts/test verifywhen the explicit Starlight sidebar insite/astro.config.mjsand the content pages undersite/src/content/docs/disagree in either direction — a sidebar slug resolving to no page, or a page no sidebar entry references (the site-rootindexis 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-iapins the control in the same gate. - The Pages deploy workflow is operator-authored.
.github/workflows/**is in the implement stage'sforbidden_paths, so.github/workflows/docs.ymlships as a copy-pasteable fenced block insite/README.mdfor 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 exceptskills/andsettings.json;settings.jsonis 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, plusdisable-model-invocation: trueon 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 (anddeploy-local, which can restart fishhawkd but stays model-invocable) also opens with an operator-only guard: it runsscripts/is-run-agentand stops on a non-zero exit. That script is the ONE definition of a run agent (the runner-stampedFISHHAWK_RUN_AGENTmarker first, #3945/#3947, verified to reach both CLIs' shell tools; then the runner's agent trees by exact path shape as the fallback; thenFISHHAWK_RUN_IDfor CI-hosted runners), pinned byscripts/test-is-run-agentinsidescripts/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_pathscover.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 thatfeature_changeleaves the exact ROOTAGENTS.mdwritable (its root letter-case variants stay forbidden), because the conventions require updating it there;routine_change(no human approval) forbids that too. Pinned by twinTestRepoSpecForbidsAgentInstructionPathstests (runner/internal/constraint, andbackend/internal/policyon 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 EVERYimplementstage in the spec (TestAgentPathLoaderParity, in both modules, pins the two copies). These globs andreviewsandbox.isAgentInstructionPathare 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/devsubcommand behavior) drift silently, so changing a Trap, a pin, or ascripts/dev/scripts/testbehavior obligesgrep -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 nukeonly on explicit request.sync-main: pre-pull live-run checks, thenscripts/dev post-merge.verify-gate:scripts/test verifywith 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.
- Frontmatter. Standard
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/ # passthroughGate 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/:
- 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 thex-intended-requiredannotation (see below) to signal a field whose required promotion is deferred through a soak period. - 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. - 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
/healthzschema-versions endpoint (once #466 lands) — add the new version to the advertised list. - A NEW workflow MAJOR (ADR-046 / #1381 stood up
workflow-v1as the keystone): add the canonicaldocs/spec/workflow-vN.schema.json, runscripts/sync-schemasto mirror it intobackend/internal/spec/schemas/+cli/internal/spec/schemas/(theworkflow-v*glob routes it — no script edit), append a{Major: N, Path: …}entry to theembeddedSchemasrouting table in BOTHbackend/internal/spec/parse.goandcli/internal/spec/spec.go(this is what makes the version-routed validator dispatch to the new major instead of failing closed), add anEmbeddedSchemaHashVN()+ theworkflow-vN/healthzschemas-map entry inbackend/internal/server/handlers.go, and register the new mirror set as its own self-referential surface-sweep pattern inbackend/internal/server/surface_sweep.go.
- Plan validator (
x-intended-requiredannotation. When a field is optional now but will become required in the next major version, annotate it in the JSON Schema:
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."some_field": { "type": "string", "x-intended-required": true }
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:
- 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. - 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).
- 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).
- Scope the registry. Add
backend/internal/audit/categories.go(modify) toscope.filesalongside the emitter — a one-line registration. - 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 onesaudit.IsKnownCategoryalready registers, and — when the plan touchesbackend/without the registry — records anew audit category requires registryfinding rendered to the plan reviewer asNEW AUDIT CATEGORY. It is exemptible viasurface_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. - Operator-visible categories also oblige
backend/internal/issuecomment'sactivityCategories(#3392/#3406) — the activity-comment renderer's allow-list — so the entry surfaces on the issue thread; and any new issue-comment surface still obligesdocs/issue-comment-surfaces.md(the path-triggered "audit kind requires surfaces doc" pattern). - 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 underOUT-OF-SCOPE PATHSwith 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 touches | Rebuild |
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:
| Binary | Activation after a rebuild |
fishhawkd | rebuilt and restarted by scripts/dev up/reload |
fishhawk-runner | picked up automatically — spawned fresh from bin/ on each fishhawk_run_stage |
fishhawk-mcp | auto-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-shim | rebuilt 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
mkdir <name> && cd <name> && go mod init github.com/kuhlman-labs/fishhawk/<name>- Append
use ./<name>to/go.work. - Verify:
(cd <name> && go build ./... && go test ./... && golangci-lint run ./...). - Wire the module into
backend/Dockerfileif the image build must resolve it. The image runsgo mod downloadagainst the wholego.workworkspace inside the container, so EVERY module listed ingo.workmust have itsgo.modcopied before that step — addCOPY <name>/go.mod[ <name>/go.sum] ./<name>/to the first COPY phase (omitgo.sumif the module has none) andCOPY <name> ./<name>to the source phase. A module added togo.workbut not the Dockerfile failsgo mod downloadwithcannot load module ../<name>— and this was invisible at PR time until the PR-CIdocker-buildgate landed (#735), because the on-disk workspace thegojob 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.
- Pick a child issue from Project #7. If a blocking ADR is open, resolve it first.
- Branch from
origin/main:<issue-slug>-<desc>, e.g.e3.1-backend-skeleton. - 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. - 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'sREADME.md; operator-facing inputs also → componentREADME.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.mdrecord (tracker body verbatim, front matter perdocs/adr/README.md) +scripts/check-adr --write-index+ the README Records row + the superseded record'ssuperseded_bywhen 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).
- New package / HTTP route / env var / flag → a pointer row in
- 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-rolledgh issue create+ four labels +gh project item-add+ GraphQL-status dance: it applies this repo'swork_managementconventions automatically — the[E<parent>.<n>]/[ADR-NNN]title format, thetype:*default label, the per-type body skeleton,Status=Backlog, ADR numbering, and the parent-epic link — so you passtype+summary+ thearea:*/autonomy:*/phase:*labels +relations.parent_epicand it renders a conventions-complete item. For a numbered type (adr) ADR numbering is now discovered server-side from the tracker (#1269), soexisting_numbersis OPTIONAL — the backend searches the existing numbered titles (open and closed) and allocates the next one. Passexisting_numbersonly to override/hint that discovery, or seedexisting_numbers:[0](which yields 1) if discovery is unavailable for the target provider; a genuine discovery failure fails closed withwork_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## Notesso the deferral is reviewable.- Board placement is automatic (
boarded:true) whenFISHHAWKD_PROJECTS_TOKEN(aproject-scoped PAT/UAT) is configured; without it the tool still files the conventions-complete issue but degrades toboarded:falsewith a loggedboarding_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_issuewith the run's id — it attaches a redacted, fingerprint-deduped diagnostic bundle (#1006).
- Board placement is automatic (
- Open PR — body uses
## Summary/## Test plan/ optional## Notes/Closes #<issue>. Match #80, #81. - 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)
| Range | Kind | Title format |
| #1–#15 | Epic | [EX] desc |
| #16–#64 | Child | [EX.Y] desc, body ends Parent epic: #N |
| #65–#79 | ADR | [ADR-NNN] desc, body uses Context / Options / Recommendation / Decision / Consequences |
- Labels (apply all four to every impl issue):
area:*,autonomy:*,phase:*,type:*. Plusepicoradron parents. - Custom fields: Component, Phase, Autonomy, Estimate, Priority, Target day. Status must be set to
Backlogon 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;
fishhawklowercase 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()andt.Setenv/t.Chdirare mutually exclusive — a test calling both PANICS (testing: test using t.Setenv or t.Chdir can not use t.Parallel).backend/internal/postgres(exceptstartcontainer_test.go) andbackend/internal/integration/mcprun every top-level test witht.Parallel()(#3881), so a new test needingt.Setenv/t.Chdirmust 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
GOARCHfrom BuildKit'sTARGETARCHautomatic platform ARG (declared inside the stage that uses it), never a literal — a hardcodedGOARCH=amd64is invisible on an amd64 CI runner and only surfaces as emulated execution on an arm64 host/node (#2912);scripts/test-devpins the shipped directive. - A host behind a TLS-inspecting corporate egress proxy fails
docker build -f backend/Dockerfilewithx509: certificate signed by unknown authorityduringgo 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 withx509: certificate signed by unknown authority". - On Docker Desktop for macOS, a
docker-credential-desktop getthat blocks (presumably on keychain access) makes EVERYdocker pullhang with no output and no error (observed 2026-10-06, E51.5 / #2138). WithcredsStoreset in the docker config the CLI calls the helper even for an anonymous public pull, soscripts/test lint|verify --in-gate-image, container-path gates and the docker-gated runner fixtures all stall at the pull. Tell: adocker-credential-desktop getchild under the pullingdockerprocess. Remedy for anonymous public pulls only:DOCKER_CONFIGpointing at a fresh{"auths":{}}config (nocredsStore, nocredHelpers, no inlineauthsentries) plus an explicitDOCKER_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 viaFISHHAWK_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 toscripts/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.workis committed;go.work.sumis not.go.sumwill appear on first external import.- Project #7 Status field has 6 options (Backlog/Up Next/In Progress/In Review/Blocked/Done) set via GraphQL
updateProjectV2FieldwithsingleSelectOptions(undocumented input field). Repeat the same workaround if creating new projects. - Project #7 owner is
kuhlman-labsas auser, not anorganization— a GraphQL query taking an owner login must useuser(login:"kuhlman-labs"), notorganization(...), or you get a NOT_FOUND. It is user-owned Projects v2, which is also why an App installation token cannot reach it (#1114) — seedocs/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'sprojectItems(first:10)and filter byproject.idinstead. The enumeration rule this implies for product code (readrepository.issues, never a board item list; a fullprojectItemspage missing the target fails closed asboard_state_undecidable) is indocs/board-capability-matrix.md. - jsdom rejects
__Host-cookies under HTTP. The default vitest jsdom URL ishttp://localhost/, but__Host-requires Secure, and tough-cookie won't honour it over HTTP.frontend/vite.config.tssetstest.environmentOptions.jsdom.url = 'https://localhost/'so cookie semantics in tests match production. Browsers treatlocalhostas a secure context anyway, so dev still works. - Vite's
server.fs.denydefault**/.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 MISLEADINGError: Cannot find module '/src/test-setup.ts'/Does the file exist?. The resolved config root is the full nested path (the.gitsegment is NOT stripped), so the file is denied, not missing, and an absolute-pathsetupFilesfix is a dead end. The carve-out lives infrontend/vite-fs-deny.ts: it drops only that one rule, and only when the config dir has a.gitpath segment (normal checkouts keep stock posture). Details:frontend/README.md. scripts/testexportsGIT_CONFIG_GLOBAL=/dev/null+GIT_CONFIG_SYSTEM=/dev/nullso temp-repo test commits never inherit the operator's globalcommit.gpgsign(#912). Without this, a globalcommit.gpgsign=truered-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=falsetakes precedence over the now-absent global. The runner's gate subprocesses carry the SAME pin (gateEnvGitConfigPinsinrunner/cmd/fishhawk-runner/gateenv.go, mirrored in the CLI'sverifyEnvGitConfigPins) since #3102 — default-deny drops an inheritedGIT_CONFIG_GLOBALbutHOMEis allow-listed, so a gate child would otherwise fall back to$HOME/.gitconfig; pinning both vars to/dev/nullcloses that fallback so this trap is not rediscovered a third time.- A
git pushinto a local bare repo forks a DETACHEDgit maintenance run --auto --detachchild that outlives the push (#3503).receive.autogc/maintenance.autodefaulttrue, so every push into a bare origin makes the receivinggit-receive-packspawngit maintenance run --auto --quiet --detach; since git 2.46 that child DAEMONIZES (fork, thendaemonize(), sogit pushand the caller return while the forked child keeps running), and git 2.52+'s default--autostrategy can run a geometric-repack/commit-graph/worktree-prune task AFTER the fork — recreatingobjects/pack/under the origin while at.TempDir()bare-origin fixture is mid-RemoveAllfails cleanup withdirectory not empty. Repo-local config (-c,GIT_CONFIG_COUNT) does NOT reach receive-pack over a file-path push (git'sconnect.cscrubslocal_repo_envfor the file transport);GIT_CONFIG_GLOBALdoes.runner/cmd/fishhawk-runner'srunTestMainpinsmaintenance.auto=falsethat way for every git child of the package's test process (TestHarnessDisablesAutoMaintenanceOnLocalPushpins the control; long-form:runner/cmd/fishhawk-runner/README.md). As of #3507,runner/internal/gitopsandcli/cmd/fishhawkcarry the sameTestMainpin +TestHarnessDisablesAutoMaintenanceOnLocalPushcontrol (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 intot.TempDir()bare origins needs the same pin, and note the sharper trap #3507 found: a per-testt.Setenv(GIT_CONFIG_GLOBAL, …)ahead of a file-path push (asrunner/internal/gitops'sgitNoPromptEnvdoes for the #3443 wire-fixture tests) silently DEFEATS a package-levelTestMainpin 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/timescaleD(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-emptyCIenv var (GitHub Actions sets it); override withFISHHAWK_TEST_TIME_SCALE(positive integer1..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-stampednow()value has a CROSS-CLOCK-DOMAIN dependency, andtimescalescaling 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 thetimescale.Drule 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 withtimescale.Dper the rule above. Worked example:dbAnchoredHeartbeatinbackend/internal/run/dispatchliveness_test.go, which anchors every comparative heartbeat seed to the row's owndispatched_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).fetchIssuesBoundeddispatchesissueSetFetchConcurrency = 8concurrentGetIssuecalls per issue-set resolution, so any fake implementingGetIssueand 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-racecounterfactual RED attributable to the FAKE rather than to the control under test, degrading the verification method itself. Residual: the sweep covered fakes implementing theworkmgmt/github.APIinterface — 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.noteDeferralpublishes the swap-state snapshot BEFORE it logs, soTestDeferralLogRateLimitedwaiting 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.barrierinbackend/cmd/fishhawk-mcp-shim/supervisor_test.gois 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
timescalescaling 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 overshfork/exec during a 4-modulego test -raceloop — and it MISDIAGNOSES: a deadline-killed first invocation takesrunVerifyFixLoop'sgateTimedOutbreak BEFORE both absorbs, soverifytimeout_test.goreportedformatter 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.WithWaitStrategyREPLACES a module's default wait strategy (#2948). Overriding a module default with a log-only wait (wait.ForLog) silently drops the port-mapping wait, soConnectionString(Host+MappedPort) can fail immediately — flaky on Docker Desktop, where the published port is served by an asynchronously-started proxy. UseWithAdditionalWaitStrategy(it appends) and keep a port-bearing strategy (wait.ForListeningPort/ForHTTPwith a port), which retriesMappedPortuntil the mapping resolves. This is whypgtest.goworks on the same daemon: it passestcpostgres.BasicWaitStrategies(), which appendsForListeningPort("5432/tcp").- A host whose local Go is NEWER than the
go.mod/go.workpin (go 1.25.0) can red-linescripts/test verifyon CLEAN main with no diff of its own (#3237).GOTOOLCHAIN=autoonly downloads a NEWER toolchain whengo.moddemands 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 shipsencoding/jsonon 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, sobackend/internal/mcpserver'sTestJSONEncodedLen_MatchesEncoder_Differential(an exact-equality oracle against the running encoder) goes red. Tells: the failing test is green in CI and green underGOTOOLCHAIN=go1.25.6. Remedy on a host runningscripts/test verifydirectly (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 becauseHOMEis on the gate's env allow-list, not becauseGOTOOLCHAINitself is allow-listed as a variable (verified empirically recovering run 12aaac69: an ambientGOTOOLCHAINenv var would be dropped by the default-deny allow-list the same way any other unlisted var is, but thegobinary itself reads the env FILE under$HOME, which the allow-listedHOMEvar still resolves to). On the--network=nonecontainer gate path there is no host filesystem to read a$HOME/.config/go/envfrom, 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=jsonv2on 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 hardGOTOOLCHAINpin insidescripts/testwas deliberately rejected (#3237): it would force a toolchain download inside the--network=nonecontainer 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 wasminio/mccopied from aminio/minioserver tag the mc repository never published. Because that Job is a post-install/post-upgrade Helm HOOK, a nonexistent tag surfaces ONLY as ahelm upgradetimeout (never a namedImagePullBackOff), which is why it shipped pastscripts/test-helm-render's rendered-output assertions — a render gate structurally cannot catch a nonexistent tag. The gate isscripts/test-helm-renderr15 (a fail-closed anonymous Docker Hub registry-v2 manifest HEAD over every rendered image, sentinel-guarded so an unreachable registry skips rather than greens), andscripts/dev k8sdumps 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/minioandminio/mcwere deleted from Docker Hub outright, breaking CI's tracestore S3 tests, docker-compose and the chart at once — which is why the tree now runsrustfs/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 toindeterminate(the docker CLI renders that same 401 aspull 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 torustfs/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 itsSKIPPING the live registry probesline on a networked host, check whether the sentinel's repository still exists before blaming the network. - A green
scripts/dev k8swas compatible with a STALE fishhawkd image on Docker Desktop's kind-based provisioner (E69.8 / #3344). Thedesktop-control-planenode runs its own containerd that the host daemon cannot see, so adocker buildnever reached the kubelet andpullPolicy: IfNotPresentreused whateverdev-localthe node already held —/healthzgreen, 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 restartforced, and the pod's image ID +git_shaverified against the build;FISHHAWK_K8S_SKIP_IDENTITY=1is the single, loudly-warned bypass. Two dirty builds at one commit share the same-dirtySHA — only the config digest tells them apart, so never weaken the primary check togit_shaalone. 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 thedocker savetarball's top-levelmanifest.jsonConfigentry 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'scontainerd://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/healthzreports the EXPECTEDgit_sha. Contract:docs/deploy/kubernetes.md§ "Image identity",scripts/README.md. - A run that fixes a defect in
fishhawk-runneritself hits a bootstrap deadlock (E64.5 / #3086). The runner is a separate binary built frommainand respawned fresh frombin/on every host dispatch, so the run's stages execute under the UNFIXED runner — the same stage fails category-A repeatedly (stage_fixup_triggeredclimbs whilefixup_pushedstays 0).fishhawk_dispatch_stage/fishhawk_run_stagenow print a one-line advisory (guardRunnerSelfHost) when the plan scope touchesrunner/, but a directbin/fishhawk-runnerinvocation or an auto-drive spawn bypasses both verbs and sees nothing. The escape:git worktree add --detacha scratch dir at the run-branch commit,go build -o <repo>/bin/fishhawk-runner ./cmd/fishhawk-runnerfrom that worktree'srunnermodule, 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/agentevalcommits 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 theuser_reportchannel, asserted on theprompt.RenderUserReportsrender 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 inscripts/test verify— the containment gate asserts each adversarial probe lands at an offset STRICTLY INSIDE its envelope span acrossplan/plan_review/implement_review(averify_outputprobe only inimplement_review, the sole reviewed render carrying gate evidence, and absent from the other two; acrew_messageprobe 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 inimplement, 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 onFISHHAWK_AGENTEVAL_INJECTION_LIVE/FISHHAWK_AGENTEVAL_QUALITY_LIVEplusFISHHAWKD_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-sideagenteval.StripBodyEnvelope, never by a production off-switch, and that transform carries a byte-exact copy ofprompt.go's ISSUE-BODY framing paragraph and ERRORS on drift — so editing that framing reddensTestStripBodyEnvelope_AcceptsRealPromptOutputand the literal must be updated with it; the #3192 VERIFY-OUTPUT framing carries its own second copy in the containment gate (verifyOutputEnvelopeFramingininjection_test.go), so editing IT reddensTestInjectionCorpus_ContainedInEveryReviewedRenderand that literal must be updated in lockstep; and the #3738 CREW-MESSAGE framing carries the THIRD such byte-exact drift copy (crewMessageEnvelopeFramingin the SAMEinjection_test.go), which reddens the same gate and must be updated with it; and the E55.3 / #2244ReviewConventionsFramingcarries the FOURTH (reviewConventionsFramingin the SAMEinjection_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 (userReportEnvelopeFramingin the SAMEinjection_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/wirecontractis the repo-level guard (TestCrossModuleWireParity, in-loop viago test -race ./...): it parses both sides withgo/astand asserts json-tag agreement. When you add such a pair, (1) carry theCROSS-MODULE WIRE CONTRACTmarker in a doc/field comment on BOTH structs, and (2) add aPairrow toSeedManifest()(backend/internal/wirecontract/manifest.go) naming both endpoints and the mode (ModeExactfor round-trip leaves,ModeSubsetwhen one side decodes a subset). A marker-bearing struct in a swept file that is neither a manifest endpoint nor anUnpairedExemptionsentry FAILS verify. Subset mode compares NAMES and toleratesomitemptybut fails closed on any other tag option (,string). The single source of truth for a duplicated GOLDEN is a sharedtestdata/wire/*.jsonfixture both modules' tests read — not two consts hoping to agree. Details:backend/internal/wirecontract/README.md. scripts/dev reload/post-mergenow REFUSE while afishhawk-runnerprocess is live (E68.7 / #2897), and--forceis the override. Both commands restart fishhawkd; a runner mid-stage sees the backend vanish, and a lost terminal upload strands the stage inrunning— recoverable only viaPOST /v0/runs/{id}/stages/{id}/reap-failure. The refusal names every live run id and fires BEFORE any teardown (and, inpost-merge, beforegit checkout main/git pull/cleanup-merged, so a refusal never leaves local git state half-advanced). Detection mirrorsrunner/cmd/fishhawk-runner/lockholder.go'srunnerIdentityMatches: argv[0] basename EQUALSfishhawk-runnerplus 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 aps | greppipeline cannot make post-merge refuse itself. Apsthat 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,ShipPlanandReportRunnerFailuremoved 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 theClient: 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 akill(-pgid)against the agent's group reaches it — it outlives the stage and its CPU red-lines every LATER verify on the host. Tell:uptimefar above the core count (the #3663 incident hit ~140 on 10 cores) with the topps -axo pid=,pcpu=,comm=consumers beingsh/zshchildren of pid 1 that no live run owns. The runner now reaps its own descendant + process-group closure at stage exit (stage_orphans_reapedin the stage trace is the tell that it did;stage_orphan_sweep_degradednames a fail-open degrade) and reclassifies a verify that FAILED above4.0 xthe core count from category A to category C with ahost_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, andFISHHAWK_ORPHAN_SWEEP=offdisables 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).
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
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.

