Skip to navigation

Cargo Workspace Inheritance: Centralize Metadata Without Hiding Crates

In short: Find which Cargo manifest fields can be shared while keeping package-specific metadata visible to reviewers.

Published 18 min read
On this page

Direct answer

Cargo workspaces can share selected manifest fields through a workspace.package table, and each member crate opts into an inherited value rather than repeating it. The point of the feature is to stop the same version, license, repository, and edition strings from drifting across a dozen Cargo.toml files. It is a metadata-sharing mechanism, not a dependency-resolution change: inheriting a version field does not alter which crates get built or which features unify. The concrete win is a workspace where policy fields have one source of truth, so a license or edition bump is a single edit. The concrete loss is that every key does not support inheritance, and over-centralizing hides crate identity, so the migration is a per-field decision rather than a bulk move.

Ask Claude Code to list repeated fields across members first, then inherit only the fields that are genuinely policy. Fields that make a crate distinctive, such as its description or its publish target, stay local. The artifact worth keeping is a two-column record of what is shared and what deliberately is not.

Why repeated metadata costs a review

Three problems come from copying policy strings into every member manifest. A version bump that touches ten files is easy to get half-right, and a crate left behind ships with the old value. A license field that differs by a typo across crates makes an automated compliance scan noisy. A repository URL that is wrong in one crate sends a bug report or a source link to the wrong place.

None of these are build failures on your machine. They surface during release automation, compliance review, or when a consumer clicks through to a source link that does not go where it claims. The cost is quiet, and the fix is to give each repeated field exactly one home.

There is a revert advantage too. Inheritance lives in Cargo.toml, so a migration is a set of small, reviewable edits with no source changes and no data migration. That makes it a reasonable Claude Code task: the agent drafts the workspace.package block and the per-member opt-ins, and a reviewer checks each one against a recorded shared-versus-local decision.

Evidence and its limits

Official, F021: The Cargo Book documents workspaces as able to share selected manifest fields through workspace.package, with member manifests opting into inherited values. The manifest format reference documents the inheritance syntax members use to reference a workspace value. The workspaces page was search-indexed but not full-page fetched during research, so the exact list of inheritable fields should be verified against the current reference before drafting a migration.

Official, overview: The Rust Book chapter on Cargo workspaces gives the conceptual overview of how a workspace root relates to member crates. It is a starting point, not a substitute for the reference’s field list.

Official, F022 support: Claude Code best practices recommends giving the agent a check that returns pass or fail. For an inheritance migration the check is a build of every member plus a manifest diff review. Claude Code common workflows covers iterating an edit against a command.

Derived, F022: A migration method that lists shared fields and crate-local exceptions so the resulting manifests remain reviewable is an editorial review practice built on the manifest documentation. It is not a Cargo rule about which fields a project must share, and no Cargo version requirement is claimed here.

No Cargo version number is asserted for when inheritance support landed, because inventing one is a guardrail this post avoids. The post describes the mechanism as documented, not a version-specific behavior.

What workspace inheritance does

A workspace root Cargo.toml can carry a [workspace.package] table holding values that members inherit. A member references a workspace value instead of writing its own literal, and Cargo resolves the reference at build time. The workspaces reference documents this sharing mechanism and the manifest reference documents the member-side syntax.

Layer Holds Role in inheritance
Workspace root [workspace.package] Shared policy values The single source of truth for inherited fields
Member [package] Crate-specific fields plus opt-ins Declares identity and references shared values
Member [dependencies] The crate’s own graph Not changed by inheritance

Read the table as an ownership map. Inheritance moves repeated policy to the root and leaves crate identity and the dependency graph with the member. The dependency-graph row is the important boundary: this feature is about metadata, and the workspaces reference does not present it as a resolver change.

The distinction matters because a reviewer who assumes inheritance affects resolution will look for graph effects that are not there. Inheriting a version string changes what the manifest says about the crate, not which crates are selected or which features unify. Feature resolution is covered separately in the Cargo feature unification guide.

Identify repeated manifest fields

Before inheriting anything, inventory what is actually repeated. A workspace with a handful of crates can be inventoried by eye; a larger one benefits from a script that prints each field and its values across members.

bash
for f in */Cargo.toml; do echo "== $f"; grep -E '^(version|edition|license|repository|description) ' "$f"; done

The output is raw material for a decision, not a to-do list. Repeated does not automatically mean shareable. A field that happens to have the same value today but means something different per crate should stay local even if inheriting it would be convenient.

Three questions sort the inventory. Is the value genuinely policy that should be identical everywhere? Does the field make a crate distinctive rather than expressing policy? Does every member actually need the same value, or are there legitimate exceptions? A field that fails the first or passes the second stays local.

Read workspace.package

The [workspace.package] table holds the values members inherit. The workspaces reference documents this table. Each entry is a normal manifest field value, and a member opts in by referencing it rather than restating it.

bash
[workspace.package]
version = "1.4.0"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/example/repo"

The block above is the shape, not a recommendation for those exact values. What makes it reviewable is that each line is a policy decision with a name. A reviewer can look at the root block and see the license, edition, and version the workspace has committed to, then check each member against it.

Two things to confirm from the reference during planning. That the fields you intend to inherit are actually supported for inheritance, since not every manifest key is. And that the inheritance syntax a member uses matches the current documented form, because the exact syntax is the kind of detail a draft should verify rather than assume.

Map member inheritance syntax

A member opts into an inherited value using a workspace reference in place of a literal. The manifest reference documents this syntax. The member still has a [package] table; it simply points at the root for the fields it does not restate.

Member field written as Meaning Review note
A workspace reference Inherits the root value Confirm the field supports inheritance
A literal value Crate-local, overrides nothing at root Fine for crate-specific fields
Absent No value, or default Confirm whether a default is acceptable

Read the table as the migration unit. Each row is a decision about one field in one crate. The migration is complete when every field the workspace decided to share is a reference and every field it decided to keep local is an intentional literal.

The review hazard is a field left as a literal that should have been a reference, because it keeps drifting exactly the way it did before the migration. The two-column record described later in this post is what catches that in a follow-up.

Keep crate metadata local

Centralizing policy is the goal. Erasing crate identity is not. Fields that make a crate meaningful as a distinct package, such as its name, description, and the specific set of things it publishes, belong with the crate even when a bulk migration would be convenient.

Field kind Where it belongs Reason
License, edition, version policy Workspace root Genuinely identical across the workspace
Crate name Member Identity, never shared
Description Member Distinctive per crate
Publish target or exceptions Member Publishing intent is crate-specific

Read the table as the boundary this post is named after. Inheritance is a metadata-sharing mechanism, and it is not a reason to erase meaningful differences between crates. A description inherited from the root would make every crate describe itself identically, which defeats the purpose of having a description.

The same boundary discipline appears across the batch. The Go workspace boundaries guide covers separating local development composition from each module’s published dependency contract, which is the same local-versus-published question for Go. Here the question is which metadata is policy and which is identity.

Migrate one field family at a time

A migration that moves every inheritable field in one commit is hard to review and harder to revert. Moving one field family at a time keeps each diff small and each decision explicit.

Field family Move when Check after
License and edition Values are genuinely identical Every member builds
Version policy Release automation expects one version Version references resolve
Repository and homepage URLs are correct and identical Links point where they claim

The order is a preference, not a requirement. License and edition are usually the least ambiguous starting point, because a workspace almost always wants one value for each. Version policy is the more consequential move, since release tooling may assume per-crate versions, and that assumption needs checking before the field moves to the root.

bash
cargo build --workspace

The pass condition for each family is concrete. Every member builds, and the manifest diff shows only the intended references replacing the intended literals. The official best-practices guidance favors this kind of check over a prose report, because a build across the workspace is unambiguous about whether the references resolve.

Review the manifest diff

The final review is a pass over the diff with one question per changed field: is this field genuinely policy, or does it make the crate distinctive? The first category belongs at the root. The second stays local even if the migration left it behind.

Diff change Likely cause Action
A literal replaced by a workspace reference Field moved to shared policy Confirm the field supports inheritance
A literal left in place Field kept crate-local Confirm that is intentional, not an oversight
A field removed entirely Field was redundant or default Confirm the default is acceptable
A field added at the root New shared policy Confirm every member wants this value

Two defects to catch in review. A field that should be shared but was left as a literal, which keeps drifting and defeats the migration. And a distinctive field that was centralized, which erases crate identity and makes the published packages harder to tell apart.

The record that prevents both is a two-column list: shared fields and crate-local exceptions. It is the artifact that makes the migration reviewable after the fact, because it states the intended boundary rather than leaving it to be inferred from the manifests.

Field Shared at root or crate-local Reason
license Shared One license for the workspace
edition Shared One edition policy
version Shared Release automation expects alignment
description Crate-local Distinctive per crate
publish Crate-local Publishing intent differs

Read the table as the deliverable. A reviewer who sees this table can evaluate any future manifest change against a stated boundary instead of re-deriving it.

The concrete win, loss, and implication

The concrete win is one source of truth for policy fields. A license change, an edition bump, or a version alignment becomes a single edit at the workspace root instead of a sweep across every member. That removes the class of bug where one crate ships with a stale value because its manifest was missed.

The concrete loss is that not every key supports inheritance, and a migration that assumes it does will fail or silently do nothing for some fields. Per-field verification against the current reference is part of the cost. Centralizing also hides values behind a reference, so a reviewer reading a member manifest has to follow the reference to the root to see the effective value.

The practical implication is that shared metadata is a policy boundary, and boundaries deserve explicit records. Teams that write down which fields are shared and which are crate-local spend less time arguing about where a new field goes. Teams that leave it implicit re-litigate the question every time a crate is added.

Workspace metadata is one boundary among several this batch covers. On the same workspace, the Cargo feature unification guide covers how features combine across selected packages, and the Cargo profile boundaries guide covers workspace-level profile definition and review by purpose. Inheritance shares metadata; features and profiles change what and how code is built. Keeping the three mechanisms distinct is most of the work.

The workspace-local-versus-published boundary in Go is covered by the Go workspace boundaries guide, and Go module graph behavior by the Go module graph pruning guide. On the JVM side, NuGet Central Package Management covers centralizing package versions across projects, which is the closest .NET analogue to sharing manifest policy.

Version and resolution selection also appear in Gradle Constraints vs Dependencies, Gradle Capability Conflicts, and Maven Optional Dependencies. None of those is a metadata-centralization feature, which is the distinction this post draws.

Review and verification habits around manifest migrations

Manifest migrations are easy to get half-right, which makes verification habits relevant. Before calling an inheritance migration done, ask what Claude Code verification requires, and prevent false success from passing tests when the check is a build of one crate rather than the whole workspace. A member that was not rebuilt may still hold a stale literal.

The cost of building every member to verify a small manifest edit connects to Claude Code cost per verified change. A workspace build is a cheap check that earns its place on every migration step. When a metadata move turns into a repo-wide reformat, that is the pattern the Claude Code overengineering guide warns about, so keep the diff to the inheritance.

On the review side, Claude Code code review covers what happens when faster generation outpaces the review that has to accept it. A manifest migration is exactly the kind of low-risk-looking diff that deserves a slow look, because the effective values are now one hop away.

Evidence map showing workspace inheritance as a metadata-sharing mechanism that does not change dependency resolution or erase crate differences.
Editorial evidence map based on F021 and F022. workspace.package shares selected fields; crate identity and the dependency graph stay with the member. Labels are the post author’s.

Checklist before you migrate a field

Run this list before approving an inheritance change. Each row is a pass condition.

Check Pass condition If it fails
Field supports inheritance The field is confirmed inheritable against the current reference Keep it local or verify support
Value is genuinely policy The value should be identical across the workspace Keep it crate-local
Not crate identity Name, description, and publish intent stay local Move identity fields back
Every member builds cargo build --workspace succeeds Fix before merging
Diff scoped Only intended references replace intended literals Investigate unintended changes
Exceptions recorded The shared-versus-local table is updated Record the decision
No drift left No field that should be shared remains a literal Convert it or record why not
Workflow from inventorying repeated fields through reading workspace.package, migrating one field family, building the workspace, and reviewing the manifest diff.
Editorial workflow based on F021 and F022. The sequence describes a reviewable routine; it is not an official Cargo command sequence.

Working with Claude Code on the migration

Give the agent three inputs: the workspace root and member manifests, the field families you intend to share, and the definition of done. Ask for a repeated-field inventory first, then a workspace.package block plus per-member opt-ins, and a workspace build as verification. Ask it to leave crate-identity fields local.

Reviewing the agent’s shared-versus-local split is the reviewer’s job. The agent can read manifests and run builds, but deciding whether a field is policy or identity is a project decision that needs your input. The Claude Code verification guide covers the review questions: what changed, what proves it, and what was not checked.

Tradeoff between centralized policy fields with one source of truth and the per-field verification plus one-hop indirection each inherited value adds.
Editorial tradeoff diagram based on F021 and F022. Centralization removes drift; the trade is per-field verification and values that resolve one hop from the member.

Data gap and future update

The workspaces page was search-indexed but not full-page fetched during the research pass behind this post, so the exact list of inheritable fields and the member-side syntax should be verified against the current Cargo Book before relying on a specific field. F021 states that selected fields can be shared; it does not enumerate every supported key, and this post does not claim a complete list.

No Cargo version requirement is asserted for inheritance support, because inventing a version is a guardrail this post avoids. A future update naming the version at which a specific field became inheritable would need a verification pass against the reference and, where relevant, release notes. No such evidence was collected.

The interaction between inherited metadata and publishing is deliberately left to the publishing tooling. Whether a particular registry or release pipeline accepts an inherited value is a property of that tooling, not of Cargo’s mechanism, and this post does not generalize.

One AI API Key option for OpenAI-format agents

Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.

OpenAI-format agents have a separate route: One AI API Key offers https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. It is a different client and request format, not a workaround for Claude Code authentication. Check the free model list and eligibility notes before choosing an agent route, or read the quickstart for the request shape.

FAQ

Does inheriting a field change which crates get built?

No. Workspace inheritance is a metadata-sharing mechanism. It changes what a manifest says about a crate, not which crates are selected or which features unify. The workspaces reference presents it as sharing manifest fields, not as a resolver change.

Can every manifest field be inherited?

No. Selected fields support inheritance, and this post does not claim a complete list. Verify each field you intend to share against the current Cargo Book, because assuming every key is inheritable is a guardrail the post explicitly avoids.

Should crate descriptions be centralized?

No. A description makes a crate distinctive, and centralizing it would make every crate describe itself identically. Description, name, and publishing intent stay with the member. The shared-versus-local table in this post is the record that keeps that boundary explicit.

What proves an inheritance migration is complete?

That cargo build --workspace succeeds, and that the manifest diff shows only intended references replacing intended literals. A single-crate build is not enough, because a member that was not rebuilt may still hold a stale literal.

Why do inherited values feel hidden during review?

Because the effective value resolves one hop away, at the workspace root. That indirection is the cost of having one source of truth. The two-column shared-versus-local table is the remedy: it states the intended boundary so a reviewer does not have to re-derive it from the manifests.

This post is one of six language and build-system guides written together. The Rust side continues with Cargo Feature Unification, Cargo Profile Boundaries, and Cargo Build Scripts. The Go side is covered by Go Module Compatibility, Go Workspace Boundaries, and Go Module Graph Pruning.

JVM and .NET posts cover version and variant selection: Gradle Constraints vs Dependencies, Gradle Capability Conflicts, Gradle Variant Attributes, Maven Optional Dependencies, NuGet Central Package Management, and .NET Multi-Targeting.

Generated-code boundaries across the batch include C# Source Generators, OpenAPI Generator Customization, GraphQL Code Generator Client Presets, sqlc Query Annotations, and Protocol Buffer Reserved Fields. Framework maintenance is covered by Django Deprecation Runway, Rails Upgrade Sequence, and Angular Update Guide.

More from this batch

More Claude Code troubleshooting

Sources

Control checklist covering field inheritance support, policy versus identity classification, a workspace build, and a scoped manifest diff.
Editorial control checklist derived from F021 and F022. Passing the checklist shows the migration was reviewed honestly; it does not change dependency resolution.
Verdict that centralizing policy fields one family at a time keeps manifests reviewable while preserving crate identity.
Editorial verdict based on F021 and F022. Share genuine policy at the root, keep crate identity local, and record the boundary.
More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →