Skip to content

feat: mirror Codex recall settings - #117

Open
Tomauskasz wants to merge 9 commits into
supermemoryai:mainfrom
Tomauskasz:feat/mirrored-auto-recall
Open

feat: mirror Codex recall settings#117
Tomauskasz wants to merge 9 commits into
supermemoryai:mainfrom
Tomauskasz:feat/mirrored-auto-recall

Conversation

@Tomauskasz

@Tomauskasz Tomauskasz commented Sep 2, 2026

Copy link
Copy Markdown

What

  • Load only the six recall options from ~/.codex/supermemory.json, then apply Claude-specific overrides from ~/.supermemory-claude/settings.json.
  • Reuse Codex's saved API base URL when Claude and Codex use the same saved key. Environment and project URL overrides remain authoritative.
  • Search the canonical repository and configured custom containers, tolerate partial request failures, then globally rank, deduplicate, and cap recalled memories.
  • Apply whole-context token budgets while preserving complete wrappers, and merge profile facts across containers with independent static and dynamic caps.
  • Track only emitted memories as seen.

Why

Claude and Codex can use one recall configuration and the same self-hosted endpoint. Unrelated Codex settings do not alter Claude, and a different Claude credential is not redirected to Codex's endpoint.

Review remediation

  • Prevented unrelated, non-object, malformed, and null-valued shared settings from disabling Claude behavior or leaking credential content.
  • Restored the legacy 500-token prompt budget when shared settings are absent.
  • Required a literal boolean for automatic container recall.
  • Preserved actionable non-404 failures when every container request fails.
  • Included provenance, container metadata, and the automatic-container catalog in the rendered budget.
  • Normalized whitespace consistently for result deduplication and seen-state hashing.
  • Preserved direct profile HTTP statuses across unexpected success responses, redirects, and malformed JSON bodies.
  • Removed duplicate cap, deduplication, configuration-loading, status-transport, and authenticated-test-home setup paths.
  • Split status, SessionStart, capture, recall, and shared test fixtures by runtime owner.
  • Added acceptance coverage for precedence, endpoint matching, caps, budgets, deduplication, emitted-only seen tracking, failure selection, status tri-state, redirect handling, and malformed response bodies.

Verification

  • npm test: 47/47 passed.
  • Node syntax checks passed for all maintained JavaScript and MJS modules.
  • npx biome ci .: 34 files checked, no errors.
  • Bun compiled plugin-inspector.ts.
  • git diff --check passed.
  • Live prompt recall queried coding_personal and copla_company, returned 15 globally capped memories, and stayed within the configured prompt budget.
  • Live SessionStart queried both custom containers and stayed within the configured session budget.

Compatibility

Implementation prepared with AI assistance and reviewed and verified by the contributor.

Tomauskasz and others added 9 commits September 2, 2026 08:20
Context:
Allow Claude's SessionStart and prompt hooks to consume shared Codex recall settings and apply them across the repository and configured custom containers.

Changes:
- Load optional shared settings before Claude-specific overrides and expose memory counts, context budgets, and automatic-container configuration.
- Fan out profile requests, tolerate partial container failures, globally rank and deduplicate prompt matches, and merge profile facts.
- Bound complete prompt and SessionStart contexts, retain prompt filtering and session deduplication, and mark only emitted memories as recalled.
- Document the configuration precedence and add multi-container, budget, partial-failure, and profile-merge coverage.

Impact:
Claude can use the same maxMemories, maxProfileItems, maxRecallTokens, maxPromptRecallTokens, autoRecallContainers, and customContainers values as Codex. Existing defaults remain five memories, five profile items per section, a 2,500-token context budget, and disabled automatic custom-container recall.

Validation:
- npm test: 27 tests passed.
- Node syntax checks passed for all changed hook modules.
- git diff --staged --check passed.
- npm run lint exited successfully; the repository Biome configuration processed only biome.json and reported a schema-version information message.

Notes:
Prompt recall still uses /v4/profile. Open PR supermemoryai#114 independently proposes /v3/search and may require conflict resolution before merge.

Signed-off-by: Tomas <180413002+Tomauskasz@users.noreply.github.com>
Context:
Claude now mirrors Codex recall limits, automatic containers, and the saved API endpoint when both clients use the same key. Claude-specific settings and explicit environment or project endpoint overrides remain authoritative.

Changes:
- Allowlist the six shared recall options and require a literal boolean for automatic container search.
- Globally rank and deduplicate search results, cap profile sections independently, and budget complete rendered prompt and SessionStart context.
- Track only emitted memories as seen and preserve complete wrappers when the final item is truncated.
- Prefer actionable non-404 failures when all container requests fail.
- Reuse loaded settings and project configuration across recall hooks.
- Mirror Codex's saved API base URL only for an identical active key.
- Document the shared configuration contract and add regression coverage for precedence, caps, deduplication, failure selection, endpoint matching, and context budgets.

Impact:
Claude can use the same expanded recall configuration and self-hosted Supermemory endpoint as Codex without importing unrelated Codex behavior or redirecting a different Claude credential.

Validation:
- `npm test`: 36 tests passed.
- Local marketplace `npm test`: 21 tests passed.
- Node syntax checks passed for all changed hook files.
- `npm run lint` exited successfully.
- `git diff --staged --check` passed.
- Live prompt recall returned 2,525 characters and 15 memories from both configured custom containers.
- Live SessionStart returned 4,491 characters and 30 profile facts from both configured custom containers.

Notes:
Biome reports its existing schema-version informational mismatch; no lint error was reported.

Signed-off-by: Tomas <180413002+Tomauskasz@users.noreply.github.com>
Context:
Shared Codex configuration and credentials now fail open at the optional-file boundary without exposing parser input, and bounded recall records only memory text that reached the emitted context.

Changes:
- Validate shared JSON as a non-array object and redact parse diagnostics.
- Ignore invalid mirrored endpoints, preserve explicit endpoint precedence, and normalize Codex-valid custom containers with empty descriptions.
- Track truncated facts only after fact content is emitted.
- Route the status command through the runtime credential and endpoint resolvers and remove the inspector's stale directive projection.
- Add credential, endpoint, capture, status, deduplication, and minimum-budget coverage, split across focused test files with shared fixtures.

Impact:
Malformed optional Codex files no longer disable Claude recall or capture. Matching credentials reuse only valid mirrored endpoints. Status probes the same endpoint as recall and writes. Prefix-only context cannot suppress an un-emitted memory.

Validation:
- `npm test`: 44 tests passed.
- `npx biome ci .`: passed.
- Node syntax checks passed for changed JavaScript and test modules.
- Bun bundled `plugin-inspector.ts` successfully.
- `git diff --staged --check`: passed.

Notes:
None.
Context:
Prompt recall treated truncated memories as fully seen, accepted finite negative relevance scores, and let the status command use a divergent request path and binary authentication result. The Biome gate also excluded the repository paths changed by the pull request.

Changes:
- Persist the exact emitted recall fragment and reject finite scores below the relevance threshold.
- Reuse the shared profile transport in the status probe and report indeterminate HTTP failures with authenticated set to null.
- Split status, SessionStart, and capture tests into owner-specific modules and add regressions for truncation, score filtering, trailing-slash routing, and status classification.
- Point Biome at the plugin, tests, inspector, and package manifest, then apply its formatting and import organization to the collected files.

Impact:
Partially emitted memories remain eligible until their complete text fits. Automatic recall excludes negatively scored results. Status requests now match runtime URL handling and distinguish rejected credentials from unavailable or rate-limited APIs. CI now checks 34 repository files instead of skipping the changed implementation.

Validation:
- npm ci completed with zero vulnerabilities.
- npm test passed 46 tests with zero failures.
- npx biome ci . passed across 34 files.
- Node syntax checks passed for every changed JavaScript and MJS entrypoint.
- Bun bundled plugin-inspector.ts successfully.
- git diff --cached --check passed.

Notes:
GitHub Actions for first-time fork commits still requires upstream workflow approval; local commands match the CI workflow.

Signed-off-by: Tomas <180413002+Tomauskasz@users.noreply.github.com>
Require the profile endpoint to return its expected HTTP 200 status so the shared transport preserves 201 and 204 as indeterminate authentication results instead of rewriting them to success.

Add regressions for unexpected successful responses and keep the status probe tri-state contract intact.

Signed-off-by: Tomas <180413002+Tomauskasz@users.noreply.github.com>
Route the remaining capture, prompt-recall, and SessionStart setup through makeAuthedHome so credentials have one test-fixture owner.

Signed-off-by: Tomas <180413002+Tomauskasz@users.noreply.github.com>
Signed-off-by: Tomas <tomas.bitvinskas@copla.com>
Signed-off-by: Tomas <tomas.bitvinskas@copla.com>
Signed-off-by: Tomas <tomas.bitvinskas@copla.com>
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.

2 participants