Skip to content

The open-source app everyone uses to manage agents at work

docs: define module ownership and shared change review (#17087)

Dotta14afc1212401
diff --git a/.greptile/files.json b/.greptile/files.json
index ccf54ad800..e7ff68bfd2 100644
--- a/.greptile/files.json
+++ b/.greptile/files.json
@@ -16,6 +16,10 @@
"path": "rules/product-harness-responsibility.mdc",
"description": "Product requirements and review criteria for harness responsibility, minimal user-facing internals, truthful progress, and human decisions."
},
+ {
+ "path": "rules/module-boundaries.mdc",
+ "description": "Module ownership, justification of shared contract changes, delivery scope, and verification across affected consumers."
+ },
{
"path": "rules/runtime-dependency-boundaries.mdc",
"description": "Dependency cost, responsiveness, and verification requirements for changed server, adapter, and runner execution paths.",
diff --git a/doc/connections/CONNECTOR-PLAYBOOK.md b/doc/connections/CONNECTOR-PLAYBOOK.md
index 87a458b787..f924f9aa9e 100644
--- a/doc/connections/CONNECTOR-PLAYBOOK.md
+++ b/doc/connections/CONNECTOR-PLAYBOOK.md
@@ -544,7 +544,16 @@ This is the implementation sequence an autonomous coding agent should follow.
task. Do not reset, rewrite, or format unrelated files.
4. Decide whether the request is research-only, definition-only, or a new
runtime capability. A store card is not evidence of runtime support.
-5. Write acceptance criteria before editing. At minimum: actionable store card,
+5. Apply [Module boundaries](../../rules/module-boundaries.mdc) before extending
+ shared code. Identify what the existing connection system already supports
+ and which requested features need a new platform capability. Keep new
+ connector-specific protocol behavior in
+ `server/src/services/connectors/<provider>/`; catalog definitions, branding,
+ and registration belong in their established locations. Shared gateway,
+ OAuth, and runtime code should use domain contracts, without interpreting
+ provider tool names or response formats. Separate ordinary MCP calls from
+ optional helpers such as local-file publishing when assessing the footprint.
+6. Write acceptance criteria before editing. At minimum: actionable store card,
setup completes, credentials are vaulted, tools list, one safe read runs,
refresh/reconnect works, revoke blocks use, and no secret appears in API or
logs.
@@ -1293,8 +1302,12 @@ unrelated worktree change, or temporary evidence file is staged.
### Phase 12: Prepare and submit the pull request
-1. Keep commits scoped. A typical split is definition/branding, generic runtime
- capability, and tests/docs. Do not split generated output from its source.
+1. Recheck [Module boundaries](../../rules/module-boundaries.mdc). Explain each
+ substantive shared change in the PR: the missing capability, why the existing
+ contract is insufficient, affected consumers, and behavior with the connector
+ absent or disabled. Separate substantial platform capabilities into reviewable
+ slices with explicit dependencies when appropriate. Keep tests and docs with
+ their behavior and generated output with its source.
2. Do not commit `pnpm-lock.yaml`; GitHub Actions owns it in this repository.
3. Read `.github/PULL_REQUEST_TEMPLATE.md` immediately before writing the PR
body.
diff --git a/rules/module-boundaries.mdc b/rules/module-boundaries.mdc
new file mode 100644
index 0000000000..33915cae0e
--- /dev/null
+++ b/rules/module-boundaries.mdc
@@ -0,0 +1,46 @@
+---
+description: Keep behavior with its owning module and justify changes to shared contracts and delivery scope.
+alwaysApply: true
+---
+
+# Module boundaries
+
+Apply to new or materially changed behavior across modules. Follow subsystem
+ownership rules; unrelated code need not be reorganized.
+
+- **Choose ownership first.** Identify the owner, existing contract, and missing
+ shared capability in the task's existing plan or PR. No separate document or
+ approval is required. Convenient local variables do not justify orchestrator logic.
+- **Isolate implementation details.** Provider protocols, payload parsing,
+ workarounds, and feature sequencing belong with their owner. Shared code consumes
+ normalized domain contracts, not provider payloads or SDK types. Small registries
+ and dispatch branches may select implementations and delegate behavior.
+- **Keep contracts narrow.** Reuse extension points; add only what the workflow
+ needs. Pass required dependencies, not the whole service context. Moving code
+ or renaming interfaces does not remove coupling. A coherent shared contract
+ should survive provider removal or substitution. One consumer can justify it;
+ speculative reuse or another fixture alone cannot. Preserve provider differences
+ rather than forcing a universal interface.
+- **Preserve invariant ownership.** Authorization, company isolation, audit,
+ transactions, and resource ownership retain their existing owners. Adapters
+ must neither bypass controls nor create parallel enforcement paths.
+- **Explain shared changes.** For each substantive change outside the owner,
+ explain the capability, why existing contracts are insufficient, affected
+ consumers, and behavior with the feature absent or disabled. Group related files.
+ Catalog entries, branding, schemas, and registration may stay in established
+ locations without teaching shared execution the provider protocol.
+- **Separate ownership from delivery scope.** Even well-factored platform work
+ may need a separate reviewable slice or explicit PR-stack dependency to clarify
+ effects on existing consumers. Keep tests and docs with behavior. Preserve
+ requested features and delivery constraints; avoid unusable intermediate states
+ and arbitrary PR/file counts.
+
+**Verify:** Exercise observable behavior through new and relevant existing
+consumers, including affected absent/disabled states—not just helper calls.
+A different-protocol fixture can expose coupling but proves neither production
+compatibility nor the abstraction's necessity.
+
+**Review:** Flag misplaced behavior, leaked private representations, duplicated
+invariant ownership, and unexplained shared changes; name the proper owner and
+contract. Recheck necessity and scope after refactoring. Identifier searches,
+line counts, and passing CI alone do not establish sound boundaries.