Skip to content

feat: add the inherit_repo_rules performer option so adapters keep the repository's agent rules by default - #511

Open
BeomSeogKim wants to merge 2 commits into
mainfrom
feat/cast-inherit-repo-rules
Open

BeomSeogKim wants to merge 2 commits into
mainfrom
feat/cast-inherit-repo-rules

Conversation

@BeomSeogKim

Copy link
Copy Markdown
Owner

What changed

Both shipped adapters stripped the target repository's own agent rules from the performer: Claude passed --setting-sources "" (no CLAUDE.md or project settings) and Codex passed --ignore-rules (no AGENTS.md).

  • Cast: a performer takes inherit_repo_rules (Boolean, optional, default true). A non-Boolean or null value is a schema error, the same as allow_advisory_enforcement.
  • Wire: the value reaches the adapter as execute.request.inherit_repo_rules, next to model. It uses the same driver path, and no new abstraction is added.
  • Adapters: when the value is true, Claude omits --setting-sources "" and Codex omits --ignore-rules. When it is false, both pass the flag exactly as before. All other isolation flags stay the same (--safe-mode, --strict-mcp-config, --ignore-user-config, …).
  • Journal: adapter.probed records the value that was sent, so a run's journal shows whether each attempt inherited the rules. The field is optional, so journals written before this change still validate.
  • Identity: the resolved-cast projection includes inherit_repo_rules only when it is false. Every existing cast keeps its hash. A run-owned resolved-cast.yaml from before this change still matches its run.started hash when the run resumes. An opt-out is still persisted and survives a resume.

Why the default is true

A performer working in a user's repository should see that repository's AGENTS.md/CLAUDE.md. Other agent orchestrators inject these files by default, so stripping them loses on first contact. Stripping was chosen for reproducibility, and it is still one line away: inherit_repo_rules: false.

DESIGN sentences touched

  • §3 cast defaults: "inherit_repo_rules defaults to true;" (new anchor inherit-repo-rules.default).
  • §4 adapter-method clauses: new bullet for execute.request.inherit_repo_rules (anchor execute-inherit-repo-rules.rule-suppression), and inherit_repo_rules, added to the execute request specimen.
  • B.2: new adapter.probed.inherit_repo_rules clause (anchor adapter-probed.inherit-repo-rules), and inherit_repo_rules? added to the adapter.probed specimen (adapter-probed.payload-shape re-supplied).
  • A.4 partitur/resolved-cast row: states the one exception to "every effective default materialized" (domain.resolved-cast re-supplied).

The clause-staging ledger was regenerated with cmd/partitur-spec-regions -regenerate … -classification-delta … -emit-pins, starting from the pre-edit blob. Other updates:

  • Baseline pins in internal/docclause/baseline_test.go were re-emitted.
  • The docmarker carrier and specimen hashes for the adapter-method block and B.2 were updated. Each new clause is counted with its neighbouring annotation run.
  • The region 7/8 continuation pin now names blocking-proposal.route-order, the clause that straddles that boundary after the insertion.

Tests

The new tests failed before the change and pass after it.

  • internal/cast: TestInheritRepoRulesDefaultsTrueAndAcceptsFalse, TestCastSchemaConformance/inherit_repo_rules_boolean, TestCastSchemaConformance/inherit_repo_rules_not_null, TestResolvedCastProjectionRecordsOnlyAnOptOutOfRepoRules. TestCastDefaultsHaveEffectiveViewGoldens was updated for the new default.
  • internal/adapters/claude, internal/adapters/codex: TestBuildCommandStripsRepositoryRulesOnlyWhenNotInherited. The stripping flag is present only when the option is false. For Codex, the test also checks that --ignore-user-config stays.
  • internal/driver: TestExecuteRequestAndAdapterProbedCarryInheritRepoRules. A default performer and an opted-out fallback each get the right request value and adapter.probed record, through resolved-cast.yaml.
  • internal/runstate: TestAdapterProbedInheritRepoRulesIsAnOptionalBoolean.

The existing adapter argument-list tests are unchanged. Their requests leave the field at its zero value, which still means stripping.

Gate: gofmt -l internal cmd is empty, and go build ./..., go vet ./... and go test -count=1 ./... all pass. -tags=mutation for internal/docclause, internal/docmarker and cmd/partitur-spec-regions also passes.

Not in this PR

  • The A.5 execution-dependency projection does not include the option. Changing it would move every attempt's execution_dependency_hash and needs its own projection-version decision.
  • README and example casts do not mention the option yet.
  • With the option on, Claude now runs without --setting-sources, so it loads its default sources: user, project and local. A narrower choice would be --setting-sources project,local, which loads the repository's rules but not the user's. That choice was left for review, because the requested behaviour was to omit the flag.

🤖 Generated with Claude Code

BeomSeogKim and others added 2 commits September 28, 2026 23:10
…e repository's agent rules by default

Both shipped adapters stripped the target repository's own agent rules:
Claude with --setting-sources "" (no CLAUDE.md or project settings) and
Codex with --ignore-rules (no AGENTS.md). A performer working in a user's
repository therefore never saw that repository's rules.

A cast performer now takes inherit_repo_rules (Boolean, default true). It
travels to the adapter as execute.request.inherit_repo_rules, next to
model. When it is true the adapters omit the stripping flag; when false
they pass it exactly as before. Every other isolation flag is unchanged.
adapter.probed records the value sent, so the journal shows whether an
attempt inherited the rules; the field is optional so earlier journals
stay valid. The resolved-cast projection carries the option only when it
is false, so the identity of every existing cast, and of every run-owned
resolved-cast.yaml, is unchanged.

DESIGN names the option and its default in §3, the request field and its
effect in §4 (clause and wire specimen), the adapter.probed field in B.2
(clause and specimen), and the projection exception in the A.4
partitur/resolved-cast row. The clause-staging ledger is regenerated with
cmd/partitur-spec-regions from the pre-edit blob with those ranges as the
classification delta; baseline pins are re-emitted, the two docmarker
carrier and specimen hashes they touch are updated with each new clause
counted with its neighbouring annotation run, and the region 7/8
continuation pin names the clause that now straddles that boundary.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant