Skip to content

feat: add local cross-agent message bus#14

Open
uttambharadwaj wants to merge 3 commits intowillynikes2:masterfrom
uttambharadwaj:uttam/pf-1884-message-bus
Open

feat: add local cross-agent message bus#14
uttambharadwaj wants to merge 3 commits intowillynikes2:masterfrom
uttambharadwaj:uttam/pf-1884-message-bus

Conversation

@uttambharadwaj
Copy link
Copy Markdown

Summary

  • add a local-only message bus to the knowledge-base MCP server for cross-model agent coordination
  • expose bus MCP tools, resource subscriptions, CLI fallbacks, and local registration updates
  • send best-effort push notifications for bus://<channel> resource subscribers and fix kb register to use an absolute Node entrypoint

Testing

  • node --test
  • node --test tests/register.test.js

@uttambharadwaj uttambharadwaj force-pushed the uttam/pf-1884-message-bus branch from fdd6ce3 to 3ce707b Compare April 23, 2026 17:37
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdd6ce3feb

ℹ️ 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".

Comment thread src/bus/resources.js
new ResourceTemplate('bus://{channel}', {
list: async () => ({
resources: listBusChannels().map(channel => ({
uri: `bus://${channel.channel}`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Percent-encode channel IDs in bus resource URIs

Channel IDs are documented/tested with values like ticket:PF-1884, but this code injects them directly into bus://${channel}. That produces invalid URIs (the suffix is interpreted as an authority/port, so parsers like URL reject it), which can cause MCP clients to drop resource listings/subscriptions and miss resources/updated notifications for normal channel names. Encode channel IDs (or place them in the path/query portion) before building resource URIs.

Useful? React with 👍 / 👎.

Comment thread src/bus/notifier.js
});

let watcher = null;
if (existsSync(watchedDir)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Create bus directory before attaching fs watcher

The notifier only calls watch() when watchedDir already exists, so on a fresh machine the MCP process starts without a filesystem watcher and never re-attempts setup. If another local process creates ~/.claude/bus later and writes messages, cross-process bus://... resource updates are missed until restart. Ensuring storage exists (or retrying watcher initialization) before this check would make first-run behavior match the documented push-notification flow.

Useful? React with 👍 / 👎.

Comment thread src/vault/indexer.js Outdated
Comment on lines 25 to 28
const isDir = entry.isDirectory() || (entry.isSymbolicLink() && statSync(fullPath).isDirectory());
const isFile = entry.isFile() || (entry.isSymbolicLink() && statSync(fullPath).isFile());
if (isDir) {
walk(fullPath);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid recursive symlink loops in vault scanner

This change descends into symlinked directories via walk(fullPath) without any visited-target tracking, so a symlink cycle (for example, a link pointing to an ancestor folder) can recurse indefinitely and hang/crash indexVault. Since symlink traversal is new in this commit, adding realpath-based cycle detection (and skipping already-seen targets) is needed to keep indexing robust.

Useful? React with 👍 / 👎.

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