You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(memory): allow 128 active directives per Agent - #2571
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.
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
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
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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Verification
capacity.pnpm run format:check,pnpm run i18n,pnpm run lint, andpnpm run typecheckpassed. The memory suite passed all 986 tests with native SQLite required. The two settings component suites passed all 22 tests.Summary by CodeRabbit