Skip to content

fix: add conditioned recall and automatic capture#61

Open
MaheshtheDev wants to merge 1 commit into
mainfrom
fix/opencode_rc
Open

fix: add conditioned recall and automatic capture#61
MaheshtheDev wants to merge 1 commit into
mainfrom
fix/opencode_rc

Conversation

@MaheshtheDev

Copy link
Copy Markdown
Member

Retargeting #59 onto main. #59 was originally stacked on feat/agents2 (merged via #58) and was never re-pointed at main before merging, so its commits (conditioned recall + automatic capture, and the 2.0.10 version bump) never landed on main or got published.

This PR brings those two commits onto main directly so they can be reviewed and merged properly, then published as opencode-supermemory@2.0.10.

Original PR: #59 (merged into feat/agents2 by mistake)
Related: #58 (Unify OpenCode agent memory containers, merged to main as 2.0.9)

Port the reasoned per-turn recall flow from #52, including scoped auto-approval for Supermemory search permissions and optional debug output.

Capture completed OpenCode conversations every configured N turns and flush the final remainder on session deletion or instance shutdown. Exclude synthetic plugin context, protect private content, and use stable custom IDs for idempotency.

Tests:
- bun run typecheck
- HOME=/private/tmp bun run test
- bun run build

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

this.searchMemories(
query,
canonicalTag,
supportsScopedCanonicalTag(canonicalTag) ? scope : undefined,
),

P2 Badge Apply scope filters to custom canonical containers

When projectContainerTag is set to a documented custom value such as my-awesome-project, supportsScopedCanonicalTag() returns false, so this call searches the unified canonical container without an sm_scope filter. Because new personal and project memories are both written to that container, scope: "user" can return project memories and scope: "project" can return personal memories; the same conditional is also used by profile and list operations. Preserve legacy reads separately, but always scope-filter new unified-container data.


export function getProjectTag(directory: string): string {
return (
loadClaudeProjectConfig(directory)?.repoContainerTag ||
CONFIG.projectContainerTag ||
loadCodexConfig()?.projectContainerTag ||
getGeneratedProjectTag(directory)

P2 Badge Honor the OpenCode project container override first

When a repository contains .claude/.supermemory-claude/config.json, its repoContainerTag takes precedence over the user's explicit OpenCode projectContainerTag. In that dual-client setup, OpenCode silently writes to and reads from the Claude-selected container even though the documented OpenCode setting says it overrides the unified write container; check CONFIG.projectContainerTag before importing another client's configuration.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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