Skip to content

docs: scope policy guidance in MCP instructions, README, and ADRs 0021/0022#3

Open
5queezer wants to merge 2 commits into
masterfrom
docs/scope-policy-and-adr-accuracy
Open

docs: scope policy guidance in MCP instructions, README, and ADRs 0021/0022#3
5queezer wants to merge 2 commits into
masterfrom
docs/scope-policy-and-adr-accuracy

Conversation

@5queezer

@5queezer 5queezer commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Commits the previously-uncommitted working tree changes:

  • mcp.rs: adds a scope-policy sentence to the MCP tool instructions card — pass scope only as an explicit per-call override, otherwise the ADR-0022 resolved scope applies; scope_walk=ancestors for normal project memory, exact for isolation, descendants for subtree audits, any only for cross-scope search.
  • scope_resolution.rs: fixes stale migration reference in comment (0084 → 0085).
  • README: documents ADR-0021/0022 scoped memory parameters and scope_walk usage; notes vector chunks inherit their claim's scope.
  • ADR 0021/0022: content updates to match implementation.
  • mcp_instructions.rs: pins the new instruction text.
  • autoresearch.jsonl: appends run logs 539–540.

Verified: cargo test -p aver-server --test mcp_instructions green, cargo fmt --check clean.

Summary by CodeRabbit

  • Documentation
    • Clarified scope handling across memory operations, including defaults, overrides, and read traversal modes.
    • Documented scope inheritance for vector data and updated connection-scope resolution guidance.
    • Corrected migration and audit-trail references.
  • Improvements
    • Added clearer MCP instructions for using scope and scope_walk.
    • Documented stronger validation for ontology relationships and scope values.

…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
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@5queezer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4112f7d9-b61b-4f06-9b3c-3cb818fe5bea

📥 Commits

Reviewing files that changed from the base of the PR and between 510b907 and c989c27.

📒 Files selected for processing (2)
  • doc/adr/0021-scope-as-first-class-memory-dimension.md
  • doc/adr/0022-connection-scope-resolution.md
📝 Walkthrough

Walkthrough

The 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.

Changes

Scope contract alignment

Layer / File(s) Summary
Memory scope schema and write semantics
doc/adr/0021-scope-as-first-class-memory-dimension.md
Documents scoped memory columns, indexes, candidate promotion, and claim-inherited vector scope.
Connection resolution and audit provenance
doc/adr/0022-connection-scope-resolution.md, crates/aver-server/src/scope_resolution.rs
Updates episodic-event audit references, absolute-path fallback hashing, and the migration citation.
MCP scope discovery guidance
README.md, crates/aver-server/src/mcp.rs, crates/aver-server/tests/mcp_instructions.rs
Describes scope overrides, defaults, and scope_walk modes in documentation and progressive-discovery tests.
Schema experiment records
autoresearch.jsonl
Records ontology self-parenting checks and a failed created_via trigger during legacy migration replay.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • 5queezer/aver#1: Updates the same MCP instruction generation and verification paths.

Poem

Scope walks the memory halls,
Ancestors rise, descendants call.
Claims hold vectors close and true,
Logs record the path they knew.
One trigger fell; the checks stand guard.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main documentation-focused scope policy updates across MCP instructions, README, and ADRs 0021/0022.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/scope-policy-and-adr-accuracy

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f84fd7e and 510b907.

📒 Files selected for processing (7)
  • README.md
  • autoresearch.jsonl
  • crates/aver-server/src/mcp.rs
  • crates/aver-server/src/scope_resolution.rs
  • crates/aver-server/tests/mcp_instructions.rs
  • doc/adr/0021-scope-as-first-class-memory-dimension.md
  • doc/adr/0022-connection-scope-resolution.md

Comment on lines +78 to +97
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.

Comment on lines +214 to +217
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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 that AVER_DEFAULT_SCOPE is checked before the hardcoded global fallback.
📍 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.

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