agentleFS
Hugging FaceKnown publisherhuggingface/mlclaw/assets/hf-tooling/skills/hf-broker/SKILL.md

hf-broker

Skill10 starsChanged 3 months agoMITView on GitHub

Use ML Claw's HF Broker for protected Hugging Face repository and bucket reads, writes, temporary grants, recovery, and revocation. Use instead of asking for or exposing a Hugging Face access token.

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Use the preconfigured HF Broker for protected Hugging Face operations.

    line 10
  2. Very specific:

    Use the advertised hf_* MCP tools for ordinary typed operations and grant management.

    line 16
  3. Distinctive:

    Every mutation needs a stable request ID.

    line 21
  4. Distinctive:

    If it is unclear whether arguments may change, ask one short question before requesting the grant.

    line 38
  5. Distinctive:

    Before requesting approval, say either "any job arguments for this target" or "exact job arguments only." Never silently narrow an any-job …

    line 41
  6. Distinctive:

    Keep the repository type, ref, and path selectors exact.

    line 70
  7. Distinctive:

    Read into a new destination and let the client verify the returned stream:

    line 107
  8. Very specific:

    Use hf_bucket_object_list or the matching client command to inspect only the approved bucket prefix.

    line 119
  9. Very specific:

    If the operation ID was lost, call the hf_operation_list MCP tool with the stable request_id, then continue with the returned operation ID.

    line 135
  10. Distinctive:

    Stop only after a terminal result, explicit cancellation, or an unrecoverable broker error.

    line 138

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

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

Hugging Face Broker

Use the preconfigured HF Broker for protected Hugging Face operations. Never ask for, print, copy, or export the broker's Hugging Face token. Do not run hf auth login to work around a broker decision.

Choose a workflow

Use the advertised hf_* MCP tools for ordinary typed operations and grant management. Use hf-broker client when a local file must enter or leave the protected stream store. The runtime already provides the broker endpoint and a limited agent credential.

Every mutation needs a stable request ID. Reuse it only for an exact retry of the same operation. If a response is lost, recover the existing operation or grant instead of submitting another mutation.

Request reusable write access

Request a temporary grant only when repeated operations are needed. Keep the scope as narrow as the user requested, and always use the number of uses the user requested. Do not substitute a fixed example value. A day is 1,440 minutes and a week is 10,080 minutes.

For job.run and job.uv.run:

  • "Allow any N jobs" means max_uses: N with attrs omitted or empty, so job arguments may change between uses for the same target.
  • "Run this exact job N times" means max_uses: N with exact target and argument digest attrs.
  • If it is unclear whether arguments may change, ask one short question before requesting the grant.

Before requesting approval, say either "any job arguments for this target" or "exact job arguments only." Never silently narrow an any-job request with exact digests.

Set REQUESTED_USES to the number the user requested. For one bucket key prefix:

hf-broker client grant request bucket.object.write OWNER/BUCKET \
  --key 'artifacts/**' \
  --minutes 10080 \
  --max-uses "$REQUESTED_USES" \
  --reason "Write the requested artifacts for one week" \
  --request-id STABLE-GRANT-REQUEST-ID

For one repository path prefix:

hf-broker client grant request repo.commit.create OWNER/REPO \
  --type dataset \
  --path 'data/**' \
  --minutes 1440 \
  --max-uses "$REQUESTED_USES" \
  --reason "Update the requested dataset path for one day" \
  --request-id STABLE-GRANT-REQUEST-ID

Normal append-only Git pushes can also use a scoped git.push.append grant. Keep the repository type, ref, and path selectors exact. Force pushes, ref deletion, repository deletion, visibility changes, and access management stay short-lived or single-use.

A pending grant requires an operator decision. Keep waiting on the same grant rather than creating another request:

hf-broker client grant wait --wait-timeout 15m GRANT-ID
hf-broker client grant get GRANT-ID

MCP grant calls use bounded waits. If hf_grant_request or hf_grant_wait returns pending, call hf_grant_wait again with the same grant ID. Use hf_grant_cancel for an unapproved request and hf_grant_revoke when reusable access is no longer needed.

Write and read bucket objects

Upload a local file through the broker's stream store. File bytes do not belong in MCP JSON, chat messages, plans, approvals, or logs.

hf-broker client bucket object write \
  --target-json '{"kind":"bucket","namespace":"OWNER","name":"BUCKET"}' \
  --arguments-json '{"path":"artifacts/result.bin"}' \
  --source ./result.bin \
  --media-type application/octet-stream \
  --reason "Upload the requested result" \
  --request-id STABLE-WRITE-REQUEST-ID \
  --wait=true \
  --wait-timeout 15m

Set "overwrite":true only when replacing the currently observed object is intentional. The broker checks the bound precondition again before commit.

Read into a new destination and let the client verify the returned stream:

hf-broker client bucket object read \
  --target-json '{"kind":"bucket","namespace":"OWNER","name":"BUCKET"}' \
  --arguments-json '{"path":"artifacts/result.bin"}' \
  --output ./downloaded-result.bin \
  --reason "Read the requested result" \
  --wait=true \
  --wait-timeout 15m

Use hf_bucket_object_list or the matching client command to inspect only the approved bucket prefix. Do not use the ML Claw state bucket for agent work. Its exact target is denied by deployment policy, and approval cannot override that deny.

Recover operations

A timeout may leave a durable operation pending. Continue with its operation ID or recover it by request ID:

hf-broker client operation get OPERATION-ID
hf-broker client operation wait --wait-timeout 15m OPERATION-ID
hf-broker client operation cancel OPERATION-ID

If the operation ID was lost, call the hf_operation_list MCP tool with the stable request_id, then continue with the returned operation ID.

Stop only after a terminal result, explicit cancellation, or an unrecoverable broker error. Revocation and expiry prevent later matching writes from reaching Hugging Face.

Download now (ZIP)

Does it work?

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

No reviews yet

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

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

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

Your trail

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

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

Now do this for your own.

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