Skip to content

feat(integrations): add WorkBuddy integration - #1337

Open
AlexStocks wants to merge 3 commits into
oceanbase:masterfrom
AlexStocks:feat/integration-workbuddy
Open

feat(integrations): add WorkBuddy integration#1337
AlexStocks wants to merge 3 commits into
oceanbase:masterfrom
AlexStocks:feat/integration-workbuddy

Conversation

@AlexStocks

@AlexStocks AlexStocks commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

No issue or RFC. This PR adds a WorkBuddy integration following the existing
integrations/hermes pattern, requested by a WorkBuddy user.

Rationale for this change

WorkBuddy (Tencent) shares its engine with CodeBuddy CLI and supports hooks that
are nearly isomorphic to Claude Code's (UserPromptSubmit / PreToolUse /
SessionStart events; stdin JSON payload; hookSpecificOutput.additionalContext
injection). PowerContext's core value — automatic memory recall on every prompt
and automatic prompt capture as Content Source evidence — requires that hook
layer; MCP tools alone cannot replace it. This PR makes the integration
officially supported, including a powercontext setup workbuddy one-shot
installer.

What changes are included in this PR?

  • integrations/workbuddy/README.md: integration overview and install steps
    (CLI installer plus a manual alternative).
  • integrations/workbuddy/plugins/powercontext/: plugin layout matching the
    hermes/codex conventions:
    • .mcp.json: HTTP MCP server template pointing at http://127.0.0.1:8000/mcp.
    • hooks/workbuddy_powercontext_hook.py: UserPromptSubmit hook that recalls
      prepared context via /v1/context/prepare and injects it through
      additionalContext, and captures the prompt via /v1/sources/content;
      fail-open, loopback-only by default.
    • hooks/workbuddy_settings.py, hooks/prepared_context.py,
      scripts/project_scope.py: ported from the Claude Code plugin with
      POWERCONTEXT_WORKBUDDY_* environment variables.
    • hooks/hooks.workbuddy.json: WorkBuddy hooks config template.
    • skills/project-context/SKILL.md: usage protocol for memory/handoff tools.
    • README.md: plugin notes.
  • src/powercontext/cli/workbuddy.py: powercontext setup workbuddy and
    powercontext doctor workbuddy. The installer copies the hooks/scope
    resolver, merges the hook into ~/.workbuddy/settings.json and the MCP server
    into ~/.workbuddy/mcp.json (preserving existing entries), installs the
    project-context Skill with placeholder substitution, writes atomically, and
    rolls back snapshots on failure. WORKBUDDY_HOME overrides the default
    ~/.workbuddy location (also used by tests).
  • src/powercontext/cli/system.py: SetupError factories and the
    setup workbuddy / doctor workbuddy subcommands.
  • tests/test_cli_workbuddy.py: installer behavior (merge preserves existing
    fields, idempotency, rollback, diagnostics, no __pycache__ copy).
  • docs/zh/docs/how-to/configure-workbuddy.md and
    docs/en/docs/how-to/configure-workbuddy.md: CLI and manual install,
    behavior, configuration (env vars), authentication, scope resolution, failure
    behavior, diagnostics.
  • README.md, README_CN.md, README_JP.md: integration table entries for
    WorkBuddy.

Are there any user-facing changes?

Yes (additive only): a new supported integration with a one-shot installer. No
breaking changes to public APIs or persisted formats.

How was this change tested?

  • ruff check and ruff format --check on all added files — pass.
  • ty check (full repo) — pass.
  • pytest tests/test_cli_workbuddy.py — 9 passed (plus the existing CLI suite).
  • Independent QA verification: fresh install, idempotency, rollback, diagnostics
    in a temp WORKBUDDY_HOME; hook behavior (recall/additionalContext, capture,
    fail-open, loopback-only) against a running local server; MCP initialize
    handshake.
  • grep -rn "/Users/alex" integrations/workbuddy/ and new docs: 0 hits — no
    machine-specific paths remain (placeholders documented).

AI usage statement

AI tools (CodeBuddy/WorkBuddy software team with model assistance) were used to
author, review, and validate this change.

Add a WorkBuddy hooks integration backed by a running PowerContext
server: a UserPromptSubmit hook that recalls bounded prepared context
and captures user prompts as Sources, a Streamable HTTP MCP registration,
and the project-context Skill for Memory and Handoff workflows.

Also documents the manual installation in integrations/workbuddy/README.md
and docs (en/zh), and lists WorkBuddy in the README integration tables.
@Teingi

Teingi commented Aug 24, 2026

Copy link
Copy Markdown
Member

ci failed

@AlexStocks

Copy link
Copy Markdown
Contributor Author

ci failed

done

@Teingi Teingi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 510ee022; the inline findings below still reproduce.

entry: dict[str, Any] = {
"type": "http",
"url": WORKBUDDY_MCP_URL,
"headers": {},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always resets the PowerContext MCP entry to the loopback URL with no headers, even when the hook uses POWERCONTEXT_WORKBUDDY_SERVER_URL and POWERCONTEXT_WORKBUDDY_AUTHORIZATION. Re-running setup also overwrites an existing remote or authenticated MCP configuration, so authenticated servers lose all Memory and Handoff tools. WorkBuddy supports environment expansion in MCP URL and header values; please wire both transports to the same configuration and cover public and bearer-authenticated service chains.


entry: dict[str, Any] = {
"type": "command",
"command": f"python3 {hooks_dir}/{WORKBUDDY_HOOK_DRIVER}",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated shell command is not quoted. A valid WorkBuddy home such as /Users/Jane Doe/.workbuddy is split at the space; I reproduced setup succeeding and the hook then failing because Python tries to open the path only up to the space. Hard-coding python3 is also not portable across Windows installs. Please resolve a supported interpreter and quote the script path (or install a wrapper), with a path-containing-spaces and Windows regression test.

MCP remains available for explicit Memory maintenance and the inspected Handoff
lifecycle when the Server is reachable.

See [`integrations/workbuddy/README.md`](../README.md) for installation steps

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both relative links here are broken from this file: ../README.md resolves to integrations/workbuddy/plugins/README.md, and the docs link resolves under integrations/docs/.... Please use ../../README.md and ../../../../docs/en/docs/how-to/configure-workbuddy.md.

description: Install the PowerContext WorkBuddy hooks and control its local behavior.
---

# Configure WorkBuddy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zensical.toml uses an explicit Integrations nav, but neither the English nor Chinese WorkBuddy page is registered, so users cannot discover these new guides from the docs site navigation. Please add both locale entries.

Comment thread README.md
@@ -91,6 +91,7 @@ PowerContext Server; the host integrations do not start or embed the Server.
<td align="center" width="120"><a href="docs/en/docs/how-to/configure-dsh.md"><img src="https://github.com/deepseek-ai.png?size=120" alt="DeepSeek Harness" width="48" height="48" /><br /><sub><b>DeepSeek Harness</b></sub></a></td>
<td align="center" width="120"><a href="integrations/hermes/README.md"><img src="https://github.com/NousResearch/hermes-agent/blob/main/website/static/img/logo.png?raw=true&size=120" alt="Hermes Agent" width="48" height="48" /><br /><sub><b>Hermes Agent</b></sub></a></td>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub strips the src from this data:image/svg+xml value. I verified the exact pattern through GitHub GFM render API, which returns an <img> with no src, so the integration table shows a broken icon. Please commit an SVG or PNG asset and reference it with a repository-relative path.

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