Skip to content

feat: share workspace memory with CodeBuddy Code and oh-my-pi - #10

Open
Mirr0ch1 wants to merge 6 commits into
sdwolf4103:mainfrom
Mirr0ch1:feat/codebuddy-bridge
Open

Mirr0ch1 wants to merge 6 commits into
sdwolf4103:mainfrom
Mirr0ch1:feat/codebuddy-bridge

Conversation

@Mirr0ch1

@Mirr0ch1 Mirr0ch1 commented Oct 21, 2026 •

Copy link
Copy Markdown

Summary

Adds optional two-way bridges that let CodeBuddy Code and oh-my-pi read and edit OpenCode's workspace memory, so the same decisions, preferences, and project facts follow you between harnesses. The README now presents memory sharing as a project feature: CodeBuddy Code and oh-my-pi are supported today, more local harness agents are in progress.

Stacked on #9. This branch builds on the V2 adapter. The commits after feat: add OpenCode V2 plugin adapter are specific to this PR. Please merge #9 first; GitHub will then reduce this PR to the bridge diff.

What changed

CodeBuddy Code

  • Added src/codebuddy-bridge.ts, a filesystem bridge between the JSON workspace store and CodeBuddy's Markdown memory.
  • OpenCode writes opencode-<id>.md topic files plus one marked block in CodeBuddy's MEMORY.md.
  • CodeBuddy topic files are indexed in the OpenCode prompt; shared: true imports them into JSON memory.
  • Edits to opencode-*.md are imported back; deleting one supersedes the memory.

oh-my-pi (local backend)

  • Added src/oh-my-pi-bridge.ts, a line-oriented bridge for omp's plain-Markdown local memory backend.
  • OpenCode exports memories as - [opencode:<id>] <text> lesson lines in ~/.omp/agent/memories/<encoded-workdir>/learned.md.
  • oh-my-pi lessons are indexed in the OpenCode prompt; up to 12 recent lessons are imported as omp-tagged JSON memories.
  • Editing an exported line updates the memory, deleting it supersedes it, and deleting/re-adding an oh-my-pi lesson mirrors the imported copy.
  • memory_summary.md, MEMORY.md, and skills/ are owned by oh-my-pi's consolidation pipeline and are never written.

Shared plumbing

  • Wired both bridges into src/runtime.ts, so V1 and V2 adapters support them.
  • Added atomicWriteText to the storage layer for generated Markdown mirrors.
  • Added tests/codebuddy-bridge.test.ts and tests/oh-my-pi-bridge.test.ts, plus a V2 adapter integration test for each bridge.
  • Documented both bridges in README.md, docs/architecture.md, docs/configuration.md, AGENTS.md, and CHANGELOG.md.

Ownership model

Both bridges only write files/lines OpenCode owns and never rewrite another agent's content.

Target OpenCode-owned Target-owned
CodeBuddy opencode-<id>.md, one marked block in MEMORY.md All other topic files and index lines
oh-my-pi - [opencode:<id>] ... lines in learned.md Other - <lesson> lines, memory_summary.md, MEMORY.md, skills/
  • Per-workspace hashes live in codebuddy-bridge.json / oh-my-pi-bridge.json beside workspace-memory.json, preventing write/read loops.
  • Credential-looking content is skipped or redacted unless includeSensitive is enabled.
  • Neither bridge requires hooks or patches in the target agent.

Configuration

{
  "plugins": [
    {
      "package": "opencode-working-memory",
      "options": {
        "codeBuddyBridge": { "includeGlobal": true, "includeSensitive": false },
        "ohMyPiBridge": { "includeSensitive": false }
      }
    }
  ]
}

Both bridges are disabled unless their option object is present. oh-my-pi requires memory.backend: local in ~/.omp/agent/config.yml.

Verification

  • npm run typecheck
  • npm test: 565 passing (including 15 new bridge tests)
  • npm run build
  • npm run check:package-integrity
  • V2 adapter tests confirm each bridge runs from session.hook("context") and exports the expected files.

Scope and follow-ups

  • CodeBuddy is detected through ~/.codebuddy; oh-my-pi through ~/.omp/agent (both overridable).
  • oh-my-pi's mnemopi, hindsight, and sharpshooter backends are intentionally out of scope; only the plain-Markdown local backend is bridged.
  • Both bridges stay off by default because they write outside OpenCode's data directory.

- extract host-agnostic memory behavior into src/runtime.ts
- add src/plugin-v2.ts using session/tool hooks and event subscription
- port /memory TUI command to the V2 keymap and dialog APIs
- export dual entrypoint: setup() for V2, server() for V1
- keep the existing on-disk memory format and storage paths
- track V2 todowrite snapshots for compaction context
- export active OpenCode memories as opencode-*.md into CodeBuddy's project memory
- maintain a marked block in CodeBuddy MEMORY.md without touching its own lines
- index CodeBuddy project/global topics in the OpenCode prompt, bounded by a char budget
- import CodeBuddy edits to opencode-*.md and supersede on deletion
- import CodeBuddy files marked shared: true into workspace JSON
- skip credential-looking files by default; redact exported text
- add per-workspace hash state to prevent sync loops
- add bridge tests and fix a cross-process storage test race
- keep index summaries redacted but preserve raw body text when includeSensitive is enabled
- list sensitive CodeBuddy entries by name, prioritizing root/sudo/vps/access files
- import shared sensitive files without redaction when explicitly enabled
Frame the CodeBuddy bridge as the first cross-harness memory integration and state that CodeBuddy Code is supported today while other local harness agents are in progress.
Add a two-way bridge for oh-my-pi's plain-Markdown local memory backend. OpenCode exports memories as [opencode:<id>] lesson lines in learned.md, imports edits and deletions back, indexes oh-my-pi lessons in the prompt, and imports recent lessons as omp-tagged JSON memories. memory_summary.md, MEMORY.md, and skills/ stay owned by oh-my-pi.
@Mirr0ch1 Mirr0ch1 changed the title feat: share workspace memory with CodeBuddy Code feat: share workspace memory with CodeBuddy Code and oh-my-pi Oct 21, 2026
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.

1 participant