Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(profile): exclude auto-approved auto-improve pages from the profile harvest

AkitaOnRailse4e1db2cc1ff
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84390c7e..6d20fd2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
+- Fixed the cross-project profile harvester treating pages the auto-improve
+ scheduler auto-approved as curated human input: model output nobody
+ reviewed fed the profile like a hand-written rule. A page stamped from an
+ auto-improve proposal is now skipped when the proposal's decider is the
+ scheduler's auto-approve actor; a page a human approved still counts, and a
+ page whose proposal id resolves to no row (legacy or imported) stays
+ curated. (#1211)
- Fixed consolidation inventing `[[_global:…]]` and `[[project:…]]` wikilinks to
pages that never existed, which `ai-memory lint` then reported as
`broken_link`. The single, batch and bootstrap prompts told the model that a
diff --git a/crates/ai-memory-consolidate/src/auto_improve_schedule.rs b/crates/ai-memory-consolidate/src/auto_improve_schedule.rs
index 299e9eff..387d34b1 100644
--- a/crates/ai-memory-consolidate/src/auto_improve_schedule.rs
+++ b/crates/ai-memory-consolidate/src/auto_improve_schedule.rs
@@ -30,6 +30,11 @@ use crate::{
run_auto_improve_review,
};
+/// `ActorContext.agent` the scheduler stamps on proposals it auto-approves
+/// (`decided_by_actor_json`). The profile harvester reads it to keep model
+/// output nobody reviewed out of the cross-project profile (#1211).
+pub const AUTO_IMPROVE_AUTO_APPROVE_AGENT: &str = "auto_improve_scheduler_auto_approve";
+
/// Settings for the scheduled auto-improvement loop, already mapped from
/// the host's configuration. Bundles the review config with the
/// scheduler-only knobs so the tick driver takes a single value.
@@ -568,7 +573,7 @@ async fn stage_and_apply(
ctx.project_id,
*proposal_id,
ActorContext {
- agent: Some("auto_improve_scheduler_auto_approve".into()),
+ agent: Some(AUTO_IMPROVE_AUTO_APPROVE_AGENT.into()),
..ActorContext::default()
},
None,
diff --git a/crates/ai-memory-consolidate/src/profile.rs b/crates/ai-memory-consolidate/src/profile.rs
index e98a0b87..55ae73fe 100644
--- a/crates/ai-memory-consolidate/src/profile.rs
+++ b/crates/ai-memory-consolidate/src/profile.rs
@@ -31,19 +31,22 @@ use ai_memory_core::profile::{
ProfileEntry, ProfileGenerality, ProfileSettings, is_metadata_field,
};
use ai_memory_core::{
- ActorContext, IdentityKey, PagePath, Tier, UserId, WorkspaceId, find_marker_line,
+ ActorContext, AutoImproveProposalId, IdentityKey, PagePath, Tier, UserId, WorkspaceId,
+ find_marker_line,
};
use ai_memory_llm::{ChatMessage, ChatRequest, LlmProvider, complete_structured};
use ai_memory_store::{
NewProfileCandidate, PROFILE_CANDIDATES_LIMIT, PROFILE_HARVEST_BATCH, ProfileCandidateRow,
- ProfileHarvestProject, ProfileLedgerEntry, ProfileScopePage, ProjectAccess, ReaderPool,
- ResolvedScope, WriterHandle,
+ ProfileHarvestProject, ProfileLedgerEntry, ProfilePageRow, ProfileScopePage, ProjectAccess,
+ ReaderPool, ResolvedScope, WriterHandle,
};
use ai_memory_wiki::{Wiki, WritePageRequest};
use schemars::JsonSchema;
use serde::Deserialize;
use sha2::{Digest, Sha256};
+use crate::auto_improve_schedule::AUTO_IMPROVE_AUTO_APPROVE_AGENT;
+
/// Frontmatter value stamping a page the harvester wrote.
pub const PROFILE_GENERATED_BY: &str = "profile-harvest";
@@ -1898,6 +1901,15 @@ async fn harvest_project(
PROFILE_HARVEST_BATCH,
)
.await?;
+ // A page stamped from an auto-improve proposal the scheduler
+ // auto-approved is model output nobody reviewed (#1211): it never feeds
+ // the profile. A human-approved proposal page still counts, and a page
+ // whose proposal id resolves to no row (legacy, imported) stays curated.
+ let proposal_ids: Vec<AutoImproveProposalId> =
+ pages.iter().filter_map(auto_improve_proposal_of).collect();
+ let decided_by = reader
+ .auto_improve_decided_by(project.workspace_id, project.project_id, proposal_ids)
+ .await?;
let mut mark = project.mark;
let mut candidates = Vec::new();
let (mut calls, mut fallbacks) = (0, 0);
@@ -1973,6 +1985,13 @@ async fn harvest_project(
// otherwise.
for page in &pages {
mark.pages_until = mark.pages_until.max(page.updated_at);
+ if let Some(id) = auto_improve_proposal_of(page)
+ && decided_by
+ .get(&id)
+ .is_some_and(|agent| agent.as_deref() == Some(AUTO_IMPROVE_AUTO_APPROVE_AGENT))
+ {
+ continue;
+ }
let Some(entry) =
ProfileEntry::from_page(&page.path, &page.title, &page.body, &page.frontmatter)
else {
@@ -2028,6 +2047,17 @@ async fn harvest_project(
Ok((added, calls, fallbacks))
}
+/// The proposal a page was approved from, when its frontmatter carries a
+/// parseable `auto_improve_proposal_id` (stamped by
+/// `Wiki::approve_auto_improve_proposal`).
+fn auto_improve_proposal_of(page: &ProfilePageRow) -> Option<AutoImproveProposalId> {
+ page.frontmatter
+ .get("auto_improve_proposal_id")?
+ .as_str()?
+ .parse()
+ .ok()
+}
+
fn candidate_from(
source: ProfileCandidateSource,
source_ref: String,
diff --git a/crates/ai-memory-consolidate/tests/suite/profile_harvest.rs b/crates/ai-memory-consolidate/tests/suite/profile_harvest.rs
index b9b505e4..0b0738c7 100644
--- a/crates/ai-memory-consolidate/tests/suite/profile_harvest.rs
+++ b/crates/ai-memory-consolidate/tests/suite/profile_harvest.rs
@@ -521,6 +521,119 @@ async fn page_metadata_fields_are_never_candidates() {
assert!(pages[0].1.contains("small focused commits"), "{pages:?}");
}
+/// A curated page the auto-improve scheduler auto-approved is model output
+/// nobody reviewed (#1211): it never becomes a profile candidate. A page a
+/// human approved still counts, and a hand-written page counts (controls).
+#[tokio::test]
+async fn auto_approved_auto_improve_pages_are_never_candidates() {
+ use ai_memory_consolidate::auto_improve_schedule::AUTO_IMPROVE_AUTO_APPROVE_AGENT;
+ use ai_memory_store::{
+ AutoImproveProposalOperation, NewAutoImproveProposal, StageAutoImproveRun,
+ };
+
+ let fx = fixture().await;
+ let alpha = project(&fx, "alpha").await;
+
+ // Hand-written control.
+ fx.wiki
+ .write_page(WritePageRequest {
+ workspace_id: fx.ws,
+ project_id: alpha,
+ path: PagePath::new("decisions/hand-written.md").unwrap(),
+ frontmatter: serde_json::json!({}),
+ body: "# Hand-written rule\n\nAlways run the smoke suite before tagging.".into(),
+ tier: Tier::Semantic,
+ pinned: false,
+ title: None,
+ admission_ctx: None,
+ author_id: None,
+ actor: ActorContext::anonymous(),
+ evidence: Vec::new(),
+ })
+ .await
+ .unwrap();
+
+ // Two proposals: one auto-approved by the scheduler, one approved by a
+ // human.
+ let proposal = |path: &str, title: &str, body: &str| NewAutoImproveProposal {
+ operation: AutoImproveProposalOperation::Create,
+ target_path: PagePath::new(path).unwrap(),
+ kind: "rule".into(),
+ title: title.into(),
+ confidence: 0.9,
+ rationale: "because".into(),
+ evidence_json: serde_json::json!([]),
+ body_markdown: body.into(),
+ artifact_sha256: None,
+ edit_mode: None,
+ patch_json: None,
+ expected_base_body_sha256: None,
+ };
+ let staged = fx
+ .store
+ .writer
+ .stage_auto_improve_run_for_owner(
+ StageAutoImproveRun {
+ workspace_id: fx.ws,
+ project_id: alpha,
+ session_id: None,
+ proposals: vec![
+ proposal(
+ "decisions/auto-approved.md",
+ "Auto-approved rule",
+ "# Auto-approved rule\n\nAlways mock the clock in scheduler tests.",
+ ),
+ proposal(
+ "decisions/human-approved.md",
+ "Human-approved rule",
+ "# Human-approved rule\n\nAlways squash migrations before a release.",
+ ),
+ ],
+ proposal_actor: ActorContext::anonymous(),
+ warnings_json: serde_json::json!([]),
+ rejected_candidates_json: serde_json::json!([]),
+ config_json: serde_json::json!({}),
+ summary: None,
+ provider: None,
+ model: None,
+ },
+ None,
+ )
+ .await
+ .unwrap();
+ for (id, actor) in staged.proposal_ids.iter().zip([
+ ActorContext {
+ agent: Some(AUTO_IMPROVE_AUTO_APPROVE_AGENT.into()),
+ ..ActorContext::default()
+ },
+ ActorContext {
+ agent: Some("cli".into()),
+ user: Some("alice".into()),
+ ..ActorContext::default()
+ },
+ ]) {
+ fx.wiki
+ .approve_auto_improve_proposal(fx.ws, alpha, *id, actor, None, None)
+ .await
+ .unwrap();
+ }
+
+ pass(&fx, &single_user()).await;
+ let statements = candidate_statements(&fx);
+ assert!(
+ statements.iter().all(|s| !s.contains("mock the clock")),
+ "an auto-approved page became a candidate: {statements:?}"
+ );
+ assert!(
+ statements.iter().any(|s| s.contains("squash migrations")),
+ "the human-approved page was lost: {statements:?}"
+ );
+ assert!(
+ statements.iter().any(|s| s.contains("smoke suite")),
+ "the hand-written page was lost: {statements:?}"
+ );
+}
+
/// `[profile] contribute = false` keeps a project out entirely; the same
/// words in a contributing project are harvested (control).
#[tokio::test]
diff --git a/crates/ai-memory-store/src/profile.rs b/crates/ai-memory-store/src/profile.rs
index 27e61954..25de9556 100644
--- a/crates/ai-memory-store/src/profile.rs
+++ b/crates/ai-memory-store/src/profile.rs
@@ -2,13 +2,14 @@
//! (`docs/design-cross-project-profile.md`): the per-project `[profile]`
//! flags (V74) and the bounded reads the SessionStart digest needs.
-use std::collections::BTreeSet;
+use std::collections::{BTreeSet, HashMap};
use ai_memory_core::profile::{
PROFILE_PATH_PREFIX, ProfileCandidateSource, ProfileEntry, ProfileGenerality, stack_tags_in,
};
-use ai_memory_core::{ProjectId, WorkspaceId};
-use rusqlite::{Connection, OptionalExtension, params};
+use ai_memory_core::{AutoImproveProposalId, ProjectId, WorkspaceId};
+use rusqlite::types::Value;
+use rusqlite::{Connection, OptionalExtension, params, params_from_iter};
use crate::error::StoreResult;
use crate::reader::{not_expired, now_us};
@@ -501,6 +502,55 @@ pub(crate) fn profile_pages_since(
Ok(pages)
}
+/// The `agent` of each given proposal's decider
+/// (`auto_improve_proposals.decided_by_actor_json`), keyed by proposal id, in
+/// one batch lookup. The harvester reads it to tell a page the scheduler
+/// auto-approved (model output nobody reviewed, #1211) from a page a human
+/// approved. A proposal with no row — a legacy or imported page whose
+/// frontmatter id resolves nowhere — is absent, and stays curated.
+pub(crate) fn auto_improve_decided_by(
+ conn: &Connection,
+ workspace_id: WorkspaceId,
+ project_id: ProjectId,
+ proposal_ids: &[AutoImproveProposalId],
+) -> StoreResult<HashMap<AutoImproveProposalId, Option<String>>> {
+ if proposal_ids.is_empty() {
+ return Ok(HashMap::new());
+ }
+ let blobs: Vec<Value> = proposal_ids
+ .iter()
+ .map(|id| Value::Blob(id.as_bytes().to_vec()))
+ .collect();
+ let placeholders = std::iter::repeat_n("?", blobs.len())
+ .collect::<Vec<_>>()
+ .join(", ");
+ let sql = format!(
+ "SELECT id, json_extract(decided_by_actor_json, '$.agent') \
+ FROM auto_improve_proposals \
+ WHERE workspace_id = ? AND project_id = ? AND id IN ({placeholders})"
+ );
+ let mut stmt = conn.prepare(&sql)?;
+ let rows = stmt.query_map(
+ params_from_iter(
+ std::iter::once(&Value::Blob(workspace_id.as_bytes().to_vec()))
+ .chain(std::iter::once(&Value::Blob(
+ project_id.as_bytes().to_vec(),
+ )))
+ .chain(blobs.iter()),
+ ),
+ |row| Ok((row.get::<_, Vec<u8>>(0)?, row.get::<_, Option<String>>(1)?)),
+ )?;
+ let mut out = HashMap::new();
+ for row in rows {
+ let (id, agent) = row?;
+ let Ok(id) = AutoImproveProposalId::from_slice(&id) else {
+ continue;
+ };
+ out.insert(id, agent);
+ }
+ Ok(out)
+}
+
/// Record a project's candidates and advance its marks, in one transaction.
/// A candidate already recorded from the same source is ignored, and a mark
/// never moves backwards. Returns how many candidates were new.
diff --git a/crates/ai-memory-store/src/reader.rs b/crates/ai-memory-store/src/reader.rs
index 750a5681..253f8c4e 100644
--- a/crates/ai-memory-store/src/reader.rs
+++ b/crates/ai-memory-store/src/reader.rs
@@ -10206,6 +10206,23 @@ impl ReaderPool {
.await
}
+ /// The decider agent of each given auto-improve proposal in a scope,
+ /// keyed by proposal id; a proposal with no row is absent (#1211).
+ ///
+ /// # Errors
+ /// Propagates SQL or pool errors.
+ pub async fn auto_improve_decided_by(
+ &self,
+ workspace_id: WorkspaceId,
+ project_id: ProjectId,
+ proposal_ids: Vec<AutoImproveProposalId>,
+ ) -> StoreResult<std::collections::HashMap<AutoImproveProposalId, Option<String>>> {
+ self.with_conn(move |conn| {
+ crate::profile::auto_improve_decided_by(conn, workspace_id, project_id, &proposal_ids)
+ })
+ .await
+ }
+
/// The newest recorded profile candidates of contributing projects.
///
/// # Errors
diff --git a/docs/cross-project-profile.md b/docs/cross-project-profile.md
index d8bcbb35..1613f393 100644
--- a/docs/cross-project-profile.md
+++ b/docs/cross-project-profile.md
@@ -181,7 +181,9 @@ is new since the last one.
- **Curated pages** of the project: `_rules/`, `decisions/`, `gotchas/` and
`procedures/`. A page contributes its `summary`, or else its first line of
prose; metadata fields such as `**Status:** Accepted` or `**Date:**` at the
- top of an ADR are skipped.
+ top of an ADR are skipped. A page the auto-improve scheduler auto-approved
+ is skipped too: model output nobody reviewed is not curated, but a page a
+ human approved still counts.
- **Stack signals**: the languages the project's activity shows (from file
names such as `Cargo.toml` and source extensions).
diff --git a/docs/security-boundaries.md b/docs/security-boundaries.md
index 07aea70c..03b24486 100644
--- a/docs/security-boundaries.md
+++ b/docs/security-boundaries.md
@@ -29,7 +29,7 @@ means the boundary is not built yet.
| 1e | The shared profile scopes are read-open, write-gated like `_global` | `ai-memory-store/src/project_authz.rs` `is_reserved_global` (a workspace `_profile` joins `default/_global`: on a server that distinguishes operators a write needs root or a `write` grant, creating it grants nothing); `ops.rs` `initial_access_mode` keeps `_profile` open | store `integration::profile` `shared_profiles_are_write_gated_for_database_users` (ungranted user refused for both shares; root and a write grant admitted; reads open); `server.rs` `a_workspace_profile_is_write_gated_and_read_open`; both fail with `_profile` dropped from the gate | STRONG |
| 1f | Event capture never lands in a profile project, and the sweep keeps them | `ai-memory-hooks/src/router.rs` project resolution refuses `ai_memory_core::profile::is_reserved_scope_project` (`_global`, `_profile`, `_profile.*`) from a directory or a marker override, falling back to the server default; `ops.rs` `sweep_hollow_projects` exempts `_profile` and `_profile.%` | `router.rs` `capture_is_never_attributed_to_a_profile_project` (override and directory spellings refused; ordinary `my_profile` control resolves), fails with the check narrowed to `_global`; store `integration::profile` `the_hollow_project_sweep_keeps_empty_profile_projects` | STRONG |
| 1g | The profile reaches only the sessions it is meant for: off by default on a multi-user server, suppressed by `[profile] consume = false`, and an opt-out is sticky | `ai_memory_core::profile::ProfileSettings::effective_share` (`enabled = auto` is off once operators are distinguished); `router.rs` `persist_profile_flags` (flags are tri-state: an absent forwarded value keeps the stored one, so a client that sends nothing never undoes an opt-out; every front door sends explicit `0`/`1` once a marker resolved) and `render_requested_profile_digest` (a team profile is headed "team defaults"); `server.rs` `memory_query` drops `profile/` hits for a project whose stored `profile_consume` is off; `admin_profile.rs` `handle_apply` (`ai-memory profile apply`) returns no lines for such a project and sits behind the root-only `/admin/*` gate on a multi-user server | `router.rs` `a_multi_user_server_has_no_profile_digest_by_default`, `profile_digest_honours_consume_once_per_session_and_the_server_switch`, `session_start_records_the_marker_profile_flags` (a session start with no flags after an opt-out keeps the project out of the harvest and the digest; fails when an absent flag defaults to on); `server.rs` `the_single_user_profile_lives_in_global_and_honours_consume` (fails with the consume filter removed); `admin_profile_routes.rs` `apply_lists_the_lines_for_a_project_and_honours_consume`, `apply_is_root_only_on_a_multi_user_server` (database user refused, root control admitted); core `profile::tests::effective_share_matrix` | STRONG |
-| 1h | The profile learns only from what it may: the user's own prompts and curated pages, from contributing projects, never another operator's words in a private profile and never a restricted project in a shared one; stored text stays data | `ai-memory-store/src/profile.rs` `profile_prompts_since` (only `user-prompt` observations), `profile_harvest_projects` / `profile_candidates` (`profile_contribute = 0` excluded, including candidates recorded before the opt-out); `ai-memory-consolidate/src/profile.rs` `user_written` (a harness turn or Codex's injected instructions stored as a prompt is skipped whole, and ai-memory's routing and untrusted-history blocks, fenced by markers on their own lines, are cut out before any sentence is read), `convergence_targets` (a `user` target keeps only candidates whose `contributor` is that operator, from projects the per-project choke point lets them read; a `global`/`workspace` target on an operator-distinguishing server drops restricted projects), `min_contributors` / `converge` (a team profile admits a statement only on evidence from at least two distinct operators, so one operator cannot plant a default in everyone's session start) (never rewrites a page without its `generated_by` stamp or whose body changed; `profile_entry_ledger` keeps a forgotten entry out), `classify_batch` / `merge_entry` (sanitized, JSON-encoded input; the evidence quote is always the user's sentence) | consolidate `integration::profile_harvest` `tool_output_is_never_a_candidate`, `an_opted_out_project_is_never_harvested`, `a_private_profile_never_harvests_another_operator`, `a_team_profile_never_harvests_a_restricted_project`, `a_team_profile_needs_more_than_one_operator` (one operator in two open projects not admitted; a second operator admits it; fails with the threshold at one), `a_personal_profile_admits_one_operators_habit` (control), `a_hand_edited_entry_is_never_clobbered`, `a_forgotten_entry_is_not_recreated_until_said_again`, `injected_instructions_stay_data`, `injected_instructions_and_ai_memory_blocks_are_never_candidates`, `page_metadata_fields_are_never_candidates`, consolidate `profile::tests::a_stored_page_metadata_field_is_not_a_waiting_habit` (each with a legitimate control; each fails with its guard removed); mcp `integration::admin_profile_routes` `review_and_rebuild_are_root_only_on_a_multi_user_server` | STRONG |
+| 1h | The profile learns only from what it may: the user's own prompts and curated pages, from contributing projects, never another operator's words in a private profile and never a restricted project in a shared one; stored text stays data | `ai-memory-store/src/profile.rs` `profile_prompts_since` (only `user-prompt` observations), `auto_improve_decided_by` (the decider agent a page's `auto_improve_proposal_id` resolves to), `profile_harvest_projects` / `profile_candidates` (`profile_contribute = 0` excluded, including candidates recorded before the opt-out); `ai-memory-consolidate/src/profile.rs` `user_written` (a harness turn or Codex's injected instructions stored as a prompt is skipped whole, and ai-memory's routing and untrusted-history blocks, fenced by markers on their own lines, are cut out before any sentence is read), the auto-approved-proposal skip in `harvest_project` (a page the auto-improve scheduler auto-approved is model output nobody reviewed and never becomes a candidate; a human-approved page, or one whose proposal id has no row, stays curated, #1211), `convergence_targets` (a `user` target keeps only candidates whose `contributor` is that operator, from projects the per-project choke point lets them read; a `global`/`workspace` target on an operator-distinguishing server drops restricted projects), `min_contributors` / `converge` (a team profile admits a statement only on evidence from at least two distinct operators, so one operator cannot plant a default in everyone's session start) (never rewrites a page without its `generated_by` stamp or whose body changed; `profile_entry_ledger` keeps a forgotten entry out), `classify_batch` / `merge_entry` (sanitized, JSON-encoded input; the evidence quote is always the user's sentence) | consolidate `integration::profile_harvest` `tool_output_is_never_a_candidate`, `an_opted_out_project_is_never_harvested`, `a_private_profile_never_harvests_another_operator`, `a_team_profile_never_harvests_a_restricted_project`, `a_team_profile_needs_more_than_one_operator` (one operator in two open projects not admitted; a second operator admits it; fails with the threshold at one), `a_personal_profile_admits_one_operators_habit` (control), `a_hand_edited_entry_is_never_clobbered`, `a_forgotten_entry_is_not_recreated_until_said_again`, `injected_instructions_stay_data`, `injected_instructions_and_ai_memory_blocks_are_never_candidates`, `page_metadata_fields_are_never_candidates`, `auto_approved_auto_improve_pages_are_never_candidates` (an auto-approved page refused; human-approved and hand-written controls admitted; fails with the decider check removed), consolidate `profile::tests::a_stored_page_metadata_field_is_not_a_waiting_habit` (each with a legitimate control; each fails with its guard removed); mcp `integration::admin_profile_routes` `review_and_rebuild_are_root_only_on_a_multi_user_server` | STRONG |
| 2 | Workspace isolation | same as #1; same-named project → distinct ids per workspace | `scope.rs` cross-workspace resolution rows; `multi_scope` dedup/validate | STRONG |
| 2b | Managed-workstream discovery stays checkout-local, including pagination | `ai-memory-workstream/src/repository.rs` `inspect_repository_fingerprints` shares the launch identity derivation without checkpoint scans; `ai-memory-cli/src/commands/resume.rs` `candidates_for_checkout` queries only the cwd, never registry links; the explicit `--all` walk (`candidates_across_checkouts`) lists each linked checkout through its own fingerprint-scoped request and applies `--workspace` before any request; `ai-memory-hooks/src/workstream.rs` `list_recent_workstreams` resolves an authorized explicit scope on every page; `ai-memory-store/src/workstream.rs` `list_recent` applies workspace/project/repository/worktree predicates before `LIMIT`/`OFFSET` | `resume.rs` `resume_lists_all_current_checkout_rows_not_registered_foreign_checkouts` (same scope/remote foreign checkout refused, 125 local rows visible), `empty_current_checkout_does_not_fall_back_to_the_registry`, `resume_all_walks_every_linked_checkout_and_honours_the_workspace_filter` (a foreign workspace filter sends no request; the default picker still ignores the registry); `workstream.rs` `recent_workstream_pages_reach_older_rows_without_crossing_checkout_or_scope` (foreign repo, worktree, project and workspace excluded on every page; 105 legitimate rows reach the client, huge offsets return nothing); store `recent_workstreams_are_checkout_local_and_include_linked_harnesses` (page two keeps native harness links); `repository.rs` `reports_origin_push_url_and_linked_worktree` verifies lightweight/full fingerprint parity and distinct worktree keys; CLI `resume_yolo_displays_picker_without_scanning_git_status` verifies listing skips status scans | STRONG |
| 3 | Multi-user auth ladder | `ai-memory-core/src/actor.rs` `AuthLevel::authorize`; `ai-memory-mcp/src/auth.rs` middleware; `admin.rs` `require_root_for_multiuser_admin` / `require_root`; `identity.rs` authorizes `NormalRead` behind the same machine bearer middleware as MCP; `serve.rs` mounts API-only and web+API protected routers behind `require_dual_auth` | `admin.rs` `multiuser_admin_routes_reject_db_user_tier` / `…reject_anonymous` / `create_user_as_user_tier_returns_403`; `auth.rs` unknown-bearer 401; `actor.rs` `skip_admission_chain_rejects_db_users`; `identity.rs` `identity_real_auth_isolates_users_root_and_revoked_keys`, `identity_anonymous_ignores_forged_headers_and_proxy_qualifies_oidc` (distinct users and root, invalid/revoked keys, forged headers, anonymous control); `serve.rs` `api_only_mode_keeps_data_authenticated_and_web_absent` (anonymous API read refused, authenticated control admitted, browser route absent; #986) | STRONG |