Skip to content

init --harness ID --role ROLE: propose a per-role harness override #413

Closed

Description

@DanielNetzer

Slice 1 of #388.

Problem

There is no supported way to add or change a per-role harness override (harnesses.analysis, harnesses.coding, harnesses.meta). The only path is editing the Formula YAML by hand and running init --lab DIR to propose it. init --role today works only with --model (--role needs --model, lab/internal/cli/cli.go), and init --harness cursor on an approved Formula refuses and says to declare harnesses.analysis first, without saying how.

Change

Add forgecell init --lab DIR --harness ID --role analysis|coding|meta. It proposes a reviewed, binding-only change to that one role, through the same proposal flow as --rebind and --model --role (pending assay, --review, --approve):

  • If harnesses.ROLE is declared, it rebinds it to ID (native command [launcher, "__adapter", ID, provider] on the running launcher). If not, it declares it.
  • It refuses a harness that can't do that role, with the adapter's reason. For example, --role analysis with Cursor is refused with Cursor's own reason.
  • --role coding with the same harness as the default binding removes nothing and is refused as "nothing to change". Don't add a remove mode in this slice.
  • The proposal is verified to equal the approved Formula with only harnesses.ROLE changed, like verifyRebindExact. The note lists the change as path: old -> new (or path: (none) -> new).
  • --role without --harness or --model keeps failing; the message names both.
  • The refusal from CheckAnalysisFallback (init --harness cursor on an approved Formula with no harnesses.analysis) names the new command, for example forgecell init --lab DIR --harness claude-code --role analysis.
  • --help/usage and lab/README.md (the init section, where it says init never creates an override) describe the flag.

Done when

  • Unit tests in lab/internal/onboarding cover: declaring a new analysis override; rebinding an existing one; refusing Cursor for analysis; refusing an unready or unknown harness; the exact-diff verification; and "nothing to change".
  • A CLI test covers the flag combinations (--harness --role, --model --role, --role alone, and --role with --rebind, which is refused).
  • No change to --rebind, --model --role or bootstrap behaviour.

Review checklist (read before coding)

The adversarial review checks these every time. Recent slices failed review on all of them, so build them in from the start:

  • Bounds: sizes, counts, time and total work are bounded, and hitting a bound fails safe (incomplete or truncated, never silently accepted).
  • Filesystem safety: paths cannot traverse. Use Lstat and O_NOFOLLOW, and check symlinks and ownership. Watch for TOCTOU races on shared dirs (/tmp). Only ever delete Forgecell-owned, marked paths.
  • Untrusted input: issue text, repository files, model and tool output, and ledgers can be malformed, huge or hostile. Validate them, never interpolate them into HTML or a shell, and never let them trigger retries or approvals.
  • No local leaks: no absolute local paths, environment variables or credentials in output, logs, the UI or ledgers.
  • Contract changes: a changed adapter invocation bumps the protocol, and approved digests still bind exactly what was shown.
  • Tests: deterministic. Use no wall-clock budgets (use readiness markers or seams), write nothing into the user's real temp or home, and cover the failure path as well as the happy path.

Plan checks (for intake)

Check category must be one of regression, candidate or setup. Use targeted package tests only as plain go test -timeout 20m commands (for example go test -timeout 20m ./internal/<pkg>/...; without -timeout, go test stops a package after 10 minutes, and cli and molecule exceed that on a loaded machine); the protected view adds -json itself when protected deltas are declared. The Formula baseline already runs the full suite once, so don't add another full go test ./... check, and don't repeat its go vet or gofmt checks. A plan may hold at most 16 checks in total, counting the 5 Formula baseline checks, so prefer one combined targeted command over one check per package.

  • Keep base tests compiling: the protected view runs the base _test.go files against your code. Never change the signature of an existing function, method or type that a base test file calls. Add a new function or field instead. A protected build failure can't be declared as an expected delta.
  • Keep base tests runnable: changed defaults or behaviour must not make a base test hang or panic. A package that aborts in the protected view hides every test after it, and nothing can be declared. Keep the old default when unconfigured and opt in to the new one.
  • Plan checks: the operator's visual or browser check is a manual step after delivery, never a plan check. Every check leaves reviewedAcceptance and independentProvenance empty.
  • Plan structure: new files need a parent component (in this repo, under lab/; a new root-level file blocks intake). A check's definitions must never include a file the change edits. A file the check only reads as data under test is not a definition.
  • Scope lists files, not directories: list every new file path, including each golden fixture under testdata/. A directory entry doesn't cover the files inside it, and the scope audit blocks them.

Activity

  1. DanielNetzer commented on Nov 8, 2026

    @DanielNetzer
    OwnerAuthor

    Merged as #416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions