Skip to content

feat(memory): allow 128 active directives per Agent - #2571

Merged
zerob13 merged 1 commit into
devfrom
dimagent/fix-2559-memory-directive-limit
Nov 26, 2026
Merged

zerob13 merged 1 commit into
devfrom
dimagent/fix-2559-memory-directive-limit

Conversation

@zerob13

@zerob13 zerob13 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2559

Each Agent can now store up to 128 active memory directives. A user with 64 active directives can approve a pending suggestion or create another instruction immediately after upgrading. Both creation and approval return the existing capacity error at 128. Settings uses the shared limit when reading directives and displaying that error.

The prompt builder considers all active directives in its existing priority order. It still applies a 192-token ceiling per item and a 512-token ceiling per request, or less when the available budget is smaller. The SQLite schema is unchanged.

                             BEFORE       AFTER
Active directives per Agent      64         128
Directive tokens per request    512         512

Verification

  • Reproduced the rejection on the original code with native SQLite. Approving the 65th directive returned capacity.
  • Checked that approval now succeeds at 65, creation succeeds through 128, and both paths reject a 129th active directive. Updating an existing directive at capacity and approving a pending one after a deletion still succeed.
  • Checked that all 128 candidates are considered and the resulting request stays within 512 estimated tokens with an available budget of 2,000.
  • pnpm run format:check, pnpm run i18n, pnpm run lint, and pnpm run typecheck passed. The memory suite passed all 986 tests with native SQLite required. The two settings component suites passed all 22 tests.

Summary by CodeRabbit

  • New Features
    • The app can now accommodate up to 128 active directives, doubling the previous limit.
  • Bug Fixes
    • Directive contributions continue to respect the 512-token budget when selecting content, including when some directives must be left out.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The active directive limit increases from 64 to 128. Tests cover approval beyond the former limit and verify that directive contributions remain within a 512-token budget at capacity.

Changes: Agent directive capacity

Layer / File(s) Summary
Directive limit and activation coverage
src/shared/types/agent-memory.ts, test/main/memory/agentMemoryDirectiveTable.test.ts
The active directive maximum changes to 128. The query-plan test uses the configured limit, and the capacity test covers approval beyond 64 active directives.
Contribution budget at capacity
test/main/memory/directiveService.test.ts
The test checks that contributions stay within a 512-token budget and account for 128 directives across selected and dropped entries.

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

Change: Feature · Severity of issue fixed: Medium

Suggested reviewers: yyhhyyyyyy

Merge Risk: Minimal · up to 93f5f

The active directive limit rises from 64 to 128, and approval and creation follow the new limit. The prompt budget is unchanged, so no concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(memory): allow 128 active directives per Agent" matches the main change. The PR raises AGENT_MEMORY_ACTIVE_DIRECTIVE_MAX_COUNT from 64 to 128, and the related tests and prompt-budget c…
Linked Issues check Passed Issue #2559 asks that a user with 64 active directives can activate one more while the per-request prompt budget stays bounded. The issue does not set a new limit. The diff changes AGENT_MEMORY_ACTIVE…
Out of Scope Changes check Passed The whole-PR change set, from the summary and the diff against the merge base, contains one production constant change and two test files. The constant change is the stated objective. The test changes…
Full details: Title check

Explanation

The title "feat(memory): allow 128 active directives per Agent" matches the main change. The PR raises AGENT_MEMORY_ACTIVE_DIRECTIVE_MAX_COUNT from 64 to 128, and the related tests and prompt-budget checks support that change. The title is short, specific, and states the primary change from the developer's perspective.

Full details: Linked Issues check

Explanation

Issue #2559 asks that a user with 64 active directives can activate one more while the per-request prompt budget stays bounded. The issue does not set a new limit. The diff changes AGENT_MEMORY_ACTIVE_DIRECTIVE_MAX_COUNT from 64 to 128 in src/shared/types/agent-memory.ts. The insertion and activation checks read this shared constant, so both paths allow up to 128 active directives. The prompt budget is unchanged in the reviewed head. buildDirectiveContribution in src/main/memory/core/directiveContribution.ts still caps the total at DIRECTIVE_TOKEN_CEILING, drops items that exceed the item budget, and drops items that would exceed the total budget. It iterates over all active rows, so the larger limit does not raise the per-request token use. Test updates in test/main/memory/agentMemoryDirectiveTable.test.ts and test/main/memory/directiveService.test.ts cover capacity at 128 and budget behavior with 128 candidates. No coding requirement from #2559 is unmet.

Full details: Out of Scope Changes check

Explanation

The whole-PR change set, from the summary and the diff against the merge base, contains one production constant change and two test files. The constant change is the stated objective. The test changes update the query-plan test to use the shared constant and add capacity tests at 64, 128, and 129 directives. They also check the prompt builder result with 128 candidates. These tests support the objective. No unrelated file or behavior change was found. The SQLite schema is unchanged, as stated.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c64df29-5339-427e-8846-7d75537ddd6e
Commits

Reviewing files that changed from the base of the PR and between fad532c and 93f5f12.

Files selected for processing: 3

  • src/shared/types/agent-memory.ts
  • test/main/memory/agentMemoryDirectiveTable.test.ts
  • test/main/memory/directiveService.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@zerob13
zerob13 merged commit 9e54505 into dev Nov 26, 2026
12 checks passed
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.

[Feature] Allow more than 64 active memory directives per Agent

1 participant