Skip to content

removeUserPrefix still lowercases peer ID, breaking parity with claude-honcho #29

Description

@idrinkritalin

Summary

removeUserPrefix: true is documented/intended to make the user peer ID match the sibling claude-honcho plugin's peer ID (per the comment in src/index.ts right above deriveUserPeerId), but it doesn't actually achieve parity, because normalizeId unconditionally lowercases the value:

const normalizeId = (value: string) =>
  trimHyphenEdges(value.toLowerCase().replace(/[^a-z0-9_-]+/g, "-")) || "default"

const deriveUserPeerId = (settings: Pick<HonchoSettings, "peerName" | "removeUserPrefix">) => {
  const name = settings.peerName || currentUserName()
  // removeUserPrefix=true drops the `user-` prefix to match the sibling
  // claude-honcho / hermes-honcho plugins; false (the legacy-safe default)
  // keeps the historical `user-<name>` peer and its accumulated memory.
  return settings.removeUserPrefix ? normalizeId(name) : normalizeId(`user:${name}`)
}

claude-honcho preserves the exact case of peerName as the peer ID (e.g. "Stefano"). Since Honcho peer IDs are case-sensitive, opencode-honcho with removeUserPrefix: true and peerName: "Stefano" still produces "stefano" ,a brand new, empty peer, disjoint from the one claude-honcho has been writing to.

Repro

  1. Use claude-honcho with peerName: "Stefano" for a while, it creates/writes to Honcho peer "Stefano" in some workspace.
  2. Install opencode-honcho, set the same peerName: "Stefano", same workspace, and hosts.opencode.removeUserPrefix: true.
  3. Query Honcho (GET /v3/workspaces/{workspace}/peers/list) , instead of one shared peer "Stefano", there are two: "Stefano" (from claude-honcho) and "stefano" (from opencode-honcho, all lowercase).
  4. Any honcho_chat/dialectic query in OpenCode comes back with "no memory yet" even though the Claude Code peer has substantial history, because it's reading a different peer.

Expected

With removeUserPrefix: true, the resulting peer ID should exactly match what claude-honcho would produce for the same peerName, so the two hosts genuinely share state as the shared ~/.honcho/config.json file (and the docs) imply. Given claude-honcho doesn't lowercase, deriveUserPeerId shouldn't run peerName through normalizeId's .toLowerCase() when removeUserPrefix is true (or at minimum, this case-folding behavior should be documented, since it silently breaks the "shared config across hosts" promise).

Suggested fix

Something like:

const deriveUserPeerId = (settings: Pick<HonchoSettings, "peerName" | "removeUserPrefix">) => {
  const name = settings.peerName || currentUserName()
  if (settings.removeUserPrefix) {
    // Preserve exact casing to match claude-honcho's peer id derivation.
    return trimHyphenEdges(name.replace(/[^a-zA-Z0-9_-]+/g, "-")) || "default"
  }
  return normalizeId(`user:${name}`)
}

(or expose an explicit preserveCase / raw peerId override in hosts.opencode config as an escape hatch.)

Environment

  • @honcho-ai/opencode-honcho: latest (resolved 0.1.3 at time of filing)
  • opencode: 1.18.9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions