Skip to content

feat(bin): add the free-tier routing guard, pilot config, and provider survey - #1

Merged
TastyTom13 merged 12 commits into
mainfrom
fm/fm-free-tier-pilot
Aug 31, 2026
Merged

TastyTom13 merged 12 commits into
mainfrom
fm/fm-free-tier-pilot

Conversation

@TastyTom13

Copy link
Copy Markdown
Owner

What this adds

The free-tier routing pilot from the fm-free-tier-routing scout design, plus the wider multi-provider survey it asked for.

bin/fm-free-tier-guard.sh is the enforcement point, run at brief-writing time.
It exits 0 (eligible) only when the target repo is named in a home-local config/free-tier-repos allowlist AND the brief text matches no deny term.
Everything else refuses.
An absent, empty, or unreadable allowlist refuses every repo, so free-tier routing stays off until a home opts a repo in by name.

The guard is deliberately fail-closed and deliberately over-refuses: a false refusal costs one fallback to the paid tier, while a miss publishes content to an external vendor.
It is documented as a mechanical backstop for obvious mis-scoping, not a classifier - firstmate's judgement at intake remains the real gate.

docs/free-tier-routing.md is the operator procedure: Groq provider entries for opencode and pi, the crew-dispatch rule JSON to install into the home-local gitignored config, the guard's contract, the paid-vs-free comparison procedure, and the ranked keys the owner must create.

docs/free-tier-providers.md is the evidence survey across 24 vendors, each either quoted from its own terms or explicitly marked unverified.

The dispatch rule (not shippable as a file)

config/crew-dispatch.json is home-local and gitignored, so this PR ships the rule text rather than the file.
Add this object to the rules array of the home's own config, ahead of the general cheap-model rule:

{
  "when": "Boilerplate test generation in a registered non-core repo: fixtures, mocks, or assertion scaffolding with no design judgement, in a project where free-tier routing has been enabled and bin/fm-free-tier-guard.sh returns eligible for this repo and brief.",
  "use": { "harness": "opencode", "model": "groq/openai/gpt-oss-120b", "effort": "low" },
  "why": "Free-tier relief for the highest-volume, lowest-judgement task class, on the vendor whose terms forbid training on inputs regardless of tier. Never select this profile without a passing bin/fm-free-tier-guard.sh check; see docs/free-tier-routing.md."
}

The repo allowlist file config/free-tier-repos is one repo name per line, blank lines and # comments ignored, and is covered by the existing gitignored config/ directory.

Survey findings that correct the prior scout report

  • Cerebras is resolved. The scout report marked its training stance unverified because the Inference Terms PDF would not extract. Reading the PDF pages directly closes it: §3(c) limits the purpose to providing the service and complying with law, and §3(d) Usage Data is drafted as explicitly excluding User Content before granting the broad improve-and-develop rights. Cerebras joins Groq as a no-training posture.
  • OrcaRouter is more than free routing. Beyond the 0-markup Hacker plan it runs a real $0-per-token free model pool at 10 RPM / 50 per day, and its Trust Center states "We do not use your prompts or completions to train models."
  • Scaleway is the strongest written promise found, and the only EU one: "Your data is not used for training, retraining, or improving the base models", with zero data retention by default and 1M free tokens.

Vendors that state in their own terms that they train on free-tier input are recorded as rejected with the quote, not omitted: NVIDIA NIM (API Trial ToS §3.3, which also restricts the trial to non-production use), GitHub Copilot Free (training on by default since 2026-04-24), Google Gemini free tier, Z.ai, Agnes AI, and Cohere.
Sources that cannot be verified, or that are not dispatchable at all, are likewise recorded with the reason rather than wired in: b.ai, Puter AI (browser-JS only, no server key), Grok (no free API tier), GitHub Models (retired 2026-07-30).

Keys the owner must create

Account creation is deliberately the owner's step; no accounts were created.

Rank Provider Env var
1 Groq GROQ_API_KEY
2 Cerebras CEREBRAS_API_KEY
3 Scaleway SCW_SECRET_KEY
4 Cloudflare Workers AI CLOUDFLARE_API_TOKEN
5 OpenRouter OPENROUTER_API_KEY

Validation

Validated through the no-mistakes pipeline, run 01M1C1T61KE993PS1B64FVDAWN.
Review, Test, Document and Lint all completed.

Review took seven fix rounds, every one of them closing a way the guard said "eligible" when it should have refused, each proved by running the script rather than by reading it:

  • a multi-line --repo value carrying a listed name
  • an empty or zero-byte brief (a broken upstream command reading as permission)
  • a deny word missed when the brief is not valid UTF-8
  • a grep error reading as a clean scan
  • --help exiting 0, the same code that means eligible
  • deny words hidden inside candidateProfile, secretKey, apiToken
  • deny words hidden behind an acronym prefix: APIKey, DBConnection, PIIRedact

tests/fm-free-tier-guard.test.sh pins all of them, plus the innocent words that must keep passing (bulletin, tokenizer, secretary).

Two honest notes on that run:

  • The pipeline's Lint step could not find ShellCheck on this machine's PATH. When the pinned linters are installed, bin/fm-lint.sh exits 0 with ShellCheck 0.11.0 and actionlint 1.7.12, verified both inside the pipeline's own worktree and again locally on this exact head. The step was approved on that evidence.
  • The Push step failed with a 403: this machine's account has no write access to the upstream repo, so this branch is pushed to the fork and this PR is opened on the fork with base main. CI checks therefore run only if the fork has Actions enabled; if it does not, this PR carries no automated checks and the validation evidence above is the record.

Not done, and why

  • The opencode and pi provider config blocks could not be dispatched against a real harness because no Groq key exists yet. Both are marked unverified in the docs rather than asserted.
  • No AGENTS.md trigger line was added. Per the coding guidelines' size discipline, an optional opt-in home-local pilot does not earn per-session token cost in the always-loaded file; discoverability is carried by docs/scripts.md, the docs page, and the dispatch rule's own why text.

kunchenguid and others added 12 commits August 30, 2026 11:27
* fix: publish promote and Relay meta rewrites through contained replace

Bare mv still rewrote live task records in place, so a symlink meta could
be followed to a target outside state/. Route those field rewrites through
the shared publisher and drop the unused library aliases.

Co-authored-by: Cursor <[email protected]>

* no-mistakes(review): Refuse dangling symlinks during X metadata clear

* no-mistakes(review): Refuse unsafe metadata before follow-up and promotion side effects

* no-mistakes(review): Exercise dangling symlink refusal through clear helper

---------

Co-authored-by: Cursor <[email protected]>
* fix(watch): absorb a turn-end whose pane churned since the previous poll

The watcher's "absorb a benign turn-end when the crew is provably working"
triage was structurally unreachable for any harness whose semantic busy state
has no verified source. crew_absorb_class only reports working for an actively
running no-mistakes step or an exact busy verdict, and bin/fm-crew-state.sh can
only answer unknown for such an adapter, so codex crewmates surfaced a signal
wake at every turn boundary with nothing to act on - a full supervisor drain,
inspect and acknowledge turn per worker turn, scaling with the number of workers
in flight and drowning the wakes that matter in identical noise.

Widen the proof rather than bound the wake rate. A wake carrying only bare
turn-ended markers is now also benign when the task's pane content changed since
the previous poll, compared against the same state/.hash-* marker the staleness
backbone already records and already trusts as liveness. That evidence claims no
harness semantics, so it fabricates no busy verdict an adapter has not earned,
and it needs no adapter cooperation.

Absorb stays evidence-driven in both directions. A wake naming any status file
keeps the strict proof, every captain-relevant verb still surfaces immediately,
and an unresolvable task, a missing prior hash, a failed or empty capture, or an
unchanged pane all surface exactly as before. The absorb defers rather than
swallows: a crew that has stopped renders nothing further, so its now-static pane
surfaces through the staleness backbone within a poll or two. Bounding the
surfacing rate instead would have suppressed genuinely stopped workers.

The derivation lives with the .hash-* marker format in bin/fm-watch.sh, which
owns it, and costs one bounded capture reached only for a no-verb turn-end whose
crew is not already provably working.

* no-mistakes(review): Captain, guard pane-churn absorption from collisions and secondmates

* no-mistakes(review): Captain, make watcher marker identities injective

* no-mistakes(review): Captain, isolate ambiguous legacy markers and restore Herdr sourcing

* no-mistakes(review): Captain, localize pane-churn collision guard

* no-mistakes(review): Captain, reject malformed pane-churn hashes

* no-mistakes(document): Document pane-churn turn-end evidence

* no-mistakes: apply CI fixes

* fix(watch): gate and bound the pane-churn turn-end absorb

Make the pane-churn form of positive work evidence opt-in per home and
bound how long it may defer one endpoint's bare turn-ends.

Absorbing a bare turn-end on pane churn is now reached only when the home
creates config/turnend-churn-absorb. The other two proofs read a verdict
the harness itself vouches for, while this one infers execution from
rendered bytes, so widening the absorb is a home's choice rather than a
default every fleet inherits. With the flag absent the predicate returns
on its first line and triage is unchanged.

Churn and pane staleness read the same pane, so neither can be the
other's only backstop. A pane that renders continuously never presents
the two consecutive identical hashes the staleness backbone needs, so an
unbounded churn absorb left a worker that had genuinely stopped behind
such a renderer with no path to surface at all. One endpoint's turn-ends
may now ride churn evidence for at most FM_TURNEND_CHURN_ABSORB_SECS,
tracked in state/.churn-since-*, after which the wake surfaces and the
window restarts. The bound is evaluated before any .stale- state is
touched, so a wake that surfaces there leaves the staleness backbone's
own classification alone.

Covers both with behavioral tests: the same churning fixture that absorbs
with the flag surfaces and queues without it, and a spent deferral window
surfaces and restarts. The four existing safety guards now run with the
flag enabled so they keep proving their specific guard.

* no-mistakes(review): Fail closed on invalid churn deferral state

* no-mistakes(review): Validate persisted churn deadlines before arithmetic

* no-mistakes(review): Make churn deadlines transactional and bounds safe

* no-mistakes(review): Compose turn-end evidence per task from one snapshot

* no-mistakes(review): Restore strict turn-end fallback guards

* no-mistakes(document): Clarify pane-churn supervision documentation

* no-mistakes(lint): Fix watcher arithmetic lint issues

* no-mistakes: apply CI fixes

* no-mistakes(document): Clarify pane-churn fail-closed documentation

* fix(bin): prioritize active pipeline-owned crew runs (#3194)

* fix(bin): bind the live pipeline-owned run instead of a superseded failed row

fm-crew-state.sh bound a superseded FAILED no-mistakes run to a task instead
of the LIVE replacement run: the live run's pipeline-owned lane head is not a
git object in the task worktree, so head-equality attribution rejected it and
the coarse runs-list fallback silently continued past the RUNNING row onto an
older failed row whose head equalled the stale worktree HEAD. The home summary
then flipped invalid and Bearings hid the home's live work (F10).

Attribution precedence now follows the daemon's own identity:
- An ACTIVE run for the task's branch binds without head equality while
  branch_sync.state is pipeline_owned (fm_nm_run_is_pipeline_owned_active);
  the pipeline owning the branch is itself the attribution.
- A genuinely failed run with no later run on the branch still reports failed
  through the unchanged head-equality path - real failures are not hidden.
- In the coarse runs scan, an unresolvable head is unknown attribution and
  stops the scan (fm_nm_head_resolvable) instead of falling through to an
  older row; a resolvable-but-mismatched head keeps the historical
  reused-branch skip.

The exemption never applies to a terminal run and requires pipeline_owned
specifically, both pinned by negative-control tests. Fixture shape verified
against the live incident run's real axi status output.

* no-mistakes(document): Updated run-attribution documentation ownership

* no-mistakes(review): Captain, make watcher marker identities injective

* no-mistakes(review): Captain, localize pane-churn collision guard

* no-mistakes(review): Compose turn-end evidence per task from one snapshot

* no-mistakes(review): Restore strict turn-end fallback guards

* no-mistakes(document): Align pane-churn watcher documentation

* no-mistakes(ci): Captain, fixed the flaky cooldown boundary test by freezing its executable clock. The failure reproduced before the fix and passed five consecutive full-suite runs afterward. Extended ShellCheck passed; full lint stopped because actionlint 1.7.12 is not installed

---------

Co-authored-by: Kun Chen <[email protected]>
* fix(bin): add a safe owner for custom-check retirement

Agents were improvising rm of check files with unset STATE/ID, which wedges
headless panes. Unregister validates the id and state directory first.

Co-authored-by: Cursor <[email protected]>

* no-mistakes(review): Refuse explicitly empty custom-check state overrides

* no-mistakes(document): Document custom-check retirement safety contract

---------

Co-authored-by: Cursor <[email protected]>
…r survey

Adds the pilot from the fm-free-tier-routing scout design plus the wider
multi-provider survey it asked for.

bin/fm-free-tier-guard.sh is the enforcement point: it refuses unless the
target repo is named in a home-local config/free-tier-repos allowlist and the
brief text matches no deny term (credential, secret, token, candidate, PII,
Article 9, Bull, strategy). An absent allowlist refuses everything, so
free-tier routing stays off until a home opts a repo in by name.

docs/free-tier-routing.md carries the operator procedure: the Groq provider
entries for opencode and pi, the crew-dispatch rule JSON to install into the
home-local gitignored config, the guard's contract, the paid-vs-free
comparison procedure, and the ranked keys the owner must create.

docs/free-tier-providers.md is the evidence survey across 24 vendors, each
either quoted from its own terms or marked unverified. It closes the scout
report's open Cerebras question from the actual Inference Terms PDF, and
records rejected sources with the reason rather than wiring them in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants