[Feature]: Let the workspace registry point at a connection config (per-workspace credentials)
Issue Origin
Observed or reproduced in a real environment
Problem Statement
A common setup is to give different kinds of agents (or different tenants) their own OpenViking user, which means each workspace needs different connection credentials (url / api_key / account / user).
Today the shared credential resolver (examples/memory-plugin-shared/lib/credentials.mjs) gets connection settings from exactly two places: environment variables, or the single global ovcli.conf (overridable via OPENVIKING_CLI_CONFIG_FILE). The workspace layers — .openviking/config.json, config.local.json, and the machine-local registry ~/.openviking/workspaces/<slot>.json — all run through the same parser and its FORBIDDEN_KEYS list in workspace-config.mjs, which strips every connection field. The denylist even includes cli_config_file, credential_path and configPath, so a workspace entry currently cannot even name a connection file.
The registry is machine-local, lives under $HOME, is never committed, and already outranks the in-repo workspace files (readEntry() in workspace-registry.mjs, merged in resolveWorkspaceSettings() in plugin-config.mjs). But because it reuses the workspace parser, it is defined purely as a workspace-settings override and has no way to participate in connection resolution.
The result: switching a workspace to another user/tenant requires per-process environment plumbing (OPENVIKING_CLI_CONFIG_FILE=... or OPENVIKING_API_KEY=...). That has to be wired separately for every harness and every launch path (shell hooks don't reach MCP proxies or GUI-launched processes), and there is no way to say "this workspace always uses that connection".
Proposed Solution
Let a registry entry carry a pointer to a connection configuration, while all secret material stays in user-private connection files — nothing changes for workspace files inside a repository.
Two possible shapes (happy to take whichever fits project conventions):
- A named connection resolved from a user-private connection library, e.g. files under
~/.openviking/connections/<name>.conf, or aconnectionsmap insideovcli.conf:
// ~/.openviking/workspaces/<slot>.json
{
"identity": "remote:https://github.com/org/repo",
"connection": { "name": "work-agent" }
}
- A direct file reference, the per-workspace equivalent of
OPENVIKING_CLI_CONFIG_FILE:
{
"connection": { "file": "~/.openviking/connections/dsh.conf" }
}
The pointed-to file is an ordinary ovcli-shaped connection file (url, api_key, account, user), resolved by the existing loadCredentialFiles() / resolveConnection() path rather than introducing a new credential format.
Properties that matter:
- Pointer only. The registry stores a name or path, never
api_keyor other secrets. The existing invariant — credentials never come from a file inside a repository — is untouched: the new key is allowlisted for theregistrylayer only, and in-repo workspace files keep stripping it loudly via the existing forbidden-key machinery. - Path safety. A
filepointer should be confined to user-private locations (e.g. under~/.openviking/, with the same symlink-escape guardreadWorkspaceFile()already applies), so a registry entry cannot reach arbitrary filesystem paths. - Precedence is otherwise unchanged. Explicit environment variables (
OPENVIKING_API_KEY,OPENVIKING_CLI_CONFIG_FILE, etc.) still override everything; the registry pointer simply selects which private connection file feeds the resolution chain when the environment doesn't. No match / no pointer means today's behavior exactly. - One resolution per session. The SessionStart hook and the stdio MCP proxy resolve the pointer once from the session's workspace (the hook's
cwd, the proxy's launch directory) and reuse the result, so Hook and MCP within one session always present the same identity — the same consistency guarantee #5277 asks for. - Observability.
ov-memory-doctorreports the selected connection name/file and where it came from, the way it reports the credential source today.
The change looks contained: carve one allowlisted pointer key out for the registry layer in workspace-config.mjs, have resolveWorkspaceSettings() expose it, and let loadCredentialFiles() consume the pointer before falling back to the default ovcli.conf path. Since the per-harness plugin copies are generated from the shared library, all harnesses inherit it together.
Alternatives Considered
- Path-scoped connections inside
ovcli.conf(#5277). Closely related and complementary: it matches directory prefixes in one global file. This proposal instead binds the connection to the existing workspace-slot identity (git remote / git dir / path), so the mapping is explicit per workspace rather than inferred from path prefixes, and it reuses separate connection files that users already maintain withOPENVIKING_CLI_CONFIG_FILE. #5277 considered puttingaccount/api_keydirectly in the registry and rejected it as one-entry-per-repo; this proposal keeps secrets out of the registry entirely — only a pointer — and per-repo granularity is the desired behavior here. - Environment variables / direnv per harness. Works only for processes launched from that shell, needs separate wiring per harness, and misses MCP proxies or GUI launches.
- One OS user or machine per tenant. Works, but is a heavy way to express a workspace boundary.
- Allowing raw credential fields in the registry. Deliberately not proposed: a pointer keeps the "no secrets outside user-private connection files" boundary easy to audit and lets multiple registries/machines reference the same connection library.
Feature Area
CLI Tools
Use Case
A developer runs several agent harnesses (for example dsh, Hermes, Claude Code-style hooks) against one OpenViking server, and assigns each class of agent its own OpenViking user so memories and account-level resources stay separated. With one registry entry per workspace naming the matching private connection file, opening that workspace makes every harness — hooks and MCP proxy alike — present that workspace's user automatically, with no per-shell environment variables and no risk of a session silently using the global default identity.
Example API (Optional)
// ~/.openviking/workspaces/<slot>.json — machine-local, never committed
{
"identity": "remote:https://github.com/org/repo",
"peer": { "id": "repo-agent" },
"connection": { "name": "work-agent" }
}
// ~/.openviking/connections/work-agent.conf — user-private, ovcli-shaped
{
"url": "https://ov.example.com",
"api_key": "…",
"account": "work",
"user": "repo-agent"
}
Additional Context
- Related: #5277 (path-scoped connections in
ovcli.conf), #3650 (unify agent integration settings inovcli.conf). Both keep connection ownership in the user-private config layer, which this proposal builds on. - Current code references:
FORBIDDEN_KEYSinexamples/memory-plugin-shared/lib/workspace-config.mjs; registry read inexamples/memory-plugin-shared/lib/workspace-registry.mjs; layer merge inexamples/memory-plugin-shared/lib/plugin-config.mjs; connection-file loading and env precedence inexamples/memory-plugin-shared/lib/credentials.mjs.
Contribution
- [ ] I am willing to contribute to implementing this feature
I'd like to take this one. Plan: implement the registry-level \connection\ pointer (name or user-private file) allowlisted only for the registry layer in \workspace-config.mjs, expose it via \ esolveWorkspaceSettings(), and consume it in \loadCredentialFiles()\ before the default \ovcli.conf\ fallback — keeping secrets out of the registry and leaving env-var precedence untouched. I'll work on a fork and open a PR referencing this issue.