docs: scope policy guidance in MCP instructions, README, and ADRs 0021/0022#3
docs: scope policy guidance in MCP instructions, README, and ADRs 0021/0022#35queezer wants to merge 2 commits into
Conversation
…1/0022 - mcp.rs: add scope policy sentence (explicit override vs resolved scope, scope_walk semantics) to the MCP tool instructions card - scope_resolution.rs: fix stale migration reference 0084 -> 0085 - README: document ADR-0021/0022 scoped memory parameters and scope_walk usage - ADR 0021/0022: content updates to match implementation - mcp_instructions.rs: pin the new instruction text - autoresearch.jsonl: append run logs 539-540
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR updates scope-related ADRs, README guidance, MCP instruction text, and instruction tests. It also corrects a migration reference and records two schema-hardening experiments, including one failed legacy migration replay. ChangesScope contract alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@doc/adr/0021-scope-as-first-class-memory-dimension.md`:
- Around line 78-97: Update the consequences section of the ADR to state that
the migration adds four scope indexes, including candidate_claims_scope, instead
of three. Keep the surrounding cost discussion unchanged.
In `@doc/adr/0022-connection-scope-resolution.md`:
- Around line 214-217: The scope fallback documentation is inconsistent across
layers. In doc/adr/0022-connection-scope-resolution.md lines 214-217, align the
origin-less repository fallback with ADR-0021’s canonical behavior instead of
documenting a conflicting absolute-worktree-root hash rule; in README.md lines
222-223, document that AVER_DEFAULT_SCOPE is checked before falling back to the
hardcoded global scope.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a553a094-9c1f-4e67-9ec2-b2e76414e62e
📒 Files selected for processing (7)
README.mdautoresearch.jsonlcrates/aver-server/src/mcp.rscrates/aver-server/src/scope_resolution.rscrates/aver-server/tests/mcp_instructions.rsdoc/adr/0021-scope-as-first-class-memory-dimension.mddoc/adr/0022-connection-scope-resolution.md
| Migration `migrations/0085_scope_column.sql` adds: | ||
|
|
||
| ```sql | ||
| ALTER TABLE claims ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
| ALTER TABLE events ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
| ALTER TABLE observations ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
|
|
||
| CREATE INDEX claims_scope ON claims(scope); | ||
| CREATE INDEX events_scope ON events(scope); | ||
| CREATE INDEX observations_scope ON observations(scope); | ||
| ALTER TABLE claims ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
| ALTER TABLE episodic_events ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
| ALTER TABLE observations ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
| ALTER TABLE candidate_claims ADD COLUMN scope TEXT NOT NULL DEFAULT 'global'; | ||
|
|
||
| CREATE INDEX claims_scope ON claims(scope); | ||
| CREATE INDEX episodic_events_scope ON episodic_events(scope); | ||
| CREATE INDEX observations_scope ON observations(scope); | ||
| CREATE INDEX candidate_claims_scope ON candidate_claims(scope); | ||
| ``` | ||
|
|
||
| Triggers analogous to `claims_agent_id_*_insert/update` | ||
| (`migrations/0060`–`0061`) enforce `scope` non-blank and a charset of | ||
| `[A-Za-z0-9_/-]` (note the `/` — paths are first-class). | ||
|
|
||
| The candidate-claim staging table inherits a `scope` column on the same | ||
| migration so candidates carry the writer's intended scope through promotion. | ||
| The candidate-claim staging table carries the writer's intended scope through | ||
| promotion. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Correct the index count in the consequences section.
This migration creates four scope indexes, including candidate_claims_scope, but the ADR still describes the cost as “three indexes.” Update that statement so the schema contract is internally consistent.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@doc/adr/0021-scope-as-first-class-memory-dimension.md` around lines 78 - 97,
Update the consequences section of the ADR to state that the migration adds four
scope indexes, including candidate_claims_scope, instead of three. Keep the
surrounding cost discussion unchanged.
| without an origin (fresh clones, local-only experiments) fall back to hashing | ||
| the absolute worktree root. That avoids basename collisions but means moving a | ||
| local-only repository changes its derived scope. Mitigation: | ||
| `AVER_DEFAULT_SCOPE` override; explicit `--scope` flag on the shim. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Align the documented scope fallback contract across layers.
The current documentation gives clients conflicting expectations about how scopes are derived when no explicit per-call scope is supplied. Canonicalize both the origin-less repository fallback and the configured environment fallback.
doc/adr/0022-connection-scope-resolution.md#L214-L217: reconcile the absolute-path hash rule with ADR-0021’s origin-less fallback.README.md#L222-L223: document thatAVER_DEFAULT_SCOPEis checked before the hardcodedglobalfallback.
📍 Affects 2 files
doc/adr/0022-connection-scope-resolution.md#L214-L217(this comment)README.md#L222-L223
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@doc/adr/0022-connection-scope-resolution.md` around lines 214 - 217, The
scope fallback documentation is inconsistent across layers. In
doc/adr/0022-connection-scope-resolution.md lines 214-217, align the origin-less
repository fallback with ADR-0021’s canonical behavior instead of documenting a
conflicting absolute-worktree-root hash rule; in README.md lines 222-223,
document that AVER_DEFAULT_SCOPE is checked before falling back to the hardcoded
global scope.
Commits the previously-uncommitted working tree changes:
scopeonly as an explicit per-call override, otherwise the ADR-0022 resolved scope applies;scope_walk=ancestorsfor normal project memory,exactfor isolation,descendantsfor subtree audits,anyonly for cross-scope search.scope_walkusage; notes vector chunks inherit their claim's scope.Verified:
cargo test -p aver-server --test mcp_instructionsgreen,cargo fmt --checkclean.Summary by CodeRabbit
scopeandscope_walk.