Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): align persisted prompt limits

Adam Eivy2a860b4fc236
diff --git a/server/lib/persistentMindTrajectory.js b/server/lib/persistentMindTrajectory.js
index 4859975ec2..e681d31513 100644
--- a/server/lib/persistentMindTrajectory.js
+++ b/server/lib/persistentMindTrajectory.js
@@ -8,6 +8,7 @@
*/
import { z } from 'zod';
+import { PERSISTENT_MIND_PROMPT_LIMITS } from './persistentMindPrompt.js';
export const PERSISTENT_MIND_ID = 'cos-persistent-mind';
export const PERSISTENT_MIND_ROLLUP_PROMPT_VERSION = 1;
@@ -37,8 +38,8 @@ export const PERSISTENT_MIND_TRAJECTORY_LIMITS = Object.freeze({
maxPageSize: 500,
recentContextEvents: 60,
maxContextChars: 32_000,
- maxIdentityChars: 2_000,
- maxInstructionsChars: 8_000,
+ maxIdentityChars: PERSISTENT_MIND_PROMPT_LIMITS.identityChars,
+ maxInstructionsChars: PERSISTENT_MIND_PROMPT_LIMITS.instructionsChars,
maxMemoriesChars: 8_000,
maxSummaryChars: 6_000,
maxStoredRollups: 100,
diff --git a/server/lib/persistentMindTrajectory.test.js b/server/lib/persistentMindTrajectory.test.js
index e3234ea0ee..9fad72d4e6 100644
--- a/server/lib/persistentMindTrajectory.test.js
+++ b/server/lib/persistentMindTrajectory.test.js
@@ -120,6 +120,17 @@ describe('assemblePersistentMindContext', () => {
expect(context.omittedRange).toMatchObject({ fromSequence: 1, toSequence: 3 });
});
+ it('includes every character accepted by the editable prompt contract', () => {
+ const identity = `${'i'.repeat(3_999)}!`;
+ const instructions = `${'o'.repeat(11_999)}!`;
+ const context = assemblePersistentMindContext({ identity, instructions, maxChars: 32_000 });
+
+ expect(context.identityChars).toBe(4_000);
+ expect(context.instructionsChars).toBe(12_000);
+ expect(context.text).toContain(identity);
+ expect(context.text).toContain(instructions);
+ });
+
it('distinguishes empty, unavailable, failed, stale, and not-needed context', () => {
expect(assemblePersistentMindContext().summaryState).toBe('empty');
expect(assemblePersistentMindContext({ events: history.slice(-1) }).summaryState).toBe('not-needed');