Awesome Reviewers

Default to explicit resource budgets and ensure they’re actually enforced.

Apply these rules in code review: 1) Bound inputs and remote pagination

2) Eliminate repeated expensive work in hot loops

3) Make enforcement observable/tested

Example (bounded pagination + draining):

const todos = await this.api.TodoLists.all({
  state: 'pending',
  perPage: 100,
  maxPages: 5,
});

for (const todo of todos) {
  if (unsupported(todo)) {
    // must drain/skipped items to avoid re-fetch forever
    await this.api.TodoLists.done({ todoId: todo.id });
    continue;
  }
  await this.process(todo);
  await this.api.TodoLists.done({ todoId: todo.id });
}

Example (memoize stable resolved roots):

// once per config/session
const resolvedPinnedRoots = memoryRoots.map((root) =>
  realpathExistingOrNew(path.resolve(root, AUTO_MEMORY_PINNED_DIRNAME)),
);

function isProtectedPinnedMemoryPath(resolvedCandidate: string|undefined, literalCandidate: string) {
  return memoryRoots.some((_, i) =>
    isWithinRootCaseInsensitive(literalCandidate, literalPinnedRoots[i]) ||
    (resolvedCandidate && resolvedPinnedRoots[i] &&
      isWithinRootCaseInsensitive(resolvedCandidate, resolvedPinnedRoots[i]!))
  );
}

4) Don’t endorse unverifiable perf claims