Skip to content
This repository was archived by the owner on Jun 30, 2026. It is now read-only.

Phase 8 networking security - #3

Merged
nnlgsakib merged 16 commits into
masterfrom
phase-8-networking-security
Apr 10, 2026
Merged

nnlgsakib merged 16 commits into
masterfrom
phase-8-networking-security

Conversation

@nnlgsakib

@nnlgsakib nnlgsakib commented Apr 10, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Release Notes

  • New Features
    • Automatic skill detection and loading when users mention DMGN in conversations.
    • Distributed synchronization of knowledge-graph edges across connected peers using gossip and delta-sync protocols.
    • Added load_skill MCP tool for retrieving complete skill context on demand.

@nnlgsakib
nnlgsakib merged commit 4ab9885 into master Apr 10, 2026
4 checks passed
@coderabbitai

coderabbitai Bot commented Apr 10, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 389defd0-cc70-4c0b-88ed-4bf90a46161f

📥 Commits

Reviewing files that changed from the base of the PR and between 5f8fe9e and aba8b3d.

⛔ Files ignored due to path filters (1)
  • proto/dmgn/v1/dmgn.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (28)
  • .planning/ROADMAP.md
  • .planning/STATE.md
  • .planning/config.json
  • .planning/phases/09-skill-loader/09-01-PLAN.md
  • .planning/phases/09-skill-loader/09-01-SUMMARY.md
  • .planning/phases/09-skill-loader/09-CONTEXT.md
  • .planning/phases/09-skill-loader/09-DISCUSSION-LOG.md
  • .planning/phases/09-skill-loader/09-RESEARCH.md
  • .planning/phases/09-skill-loader/09-VERIFICATION.md
  • .planning/phases/10-graph-sync/10-01-PLAN.md
  • .planning/phases/10-graph-sync/10-01-SUMMARY.md
  • .planning/phases/10-graph-sync/10-CONTEXT.md
  • .planning/phases/10-graph-sync/10-RESEARCH.md
  • internal/daemon/daemon.go
  • pkg/mcp/server.go
  • pkg/skill/SKILL.md
  • pkg/skill/loader.go
  • pkg/skill/loader_test.go
  • pkg/skill/trigger.go
  • pkg/skill/trigger_test.go
  • pkg/storage/edge_test.go
  • pkg/storage/storage.go
  • pkg/sync/delta.go
  • pkg/sync/gossip.go
  • pkg/sync/vclock_store.go
  • pkg/sync/vclock_store_test.go
  • proto/dmgn/v1/dmgn.proto
  • skill/SKILL.md

📝 Walkthrough

Walkthrough

This pull request implements Phase 9 (Skill Loader MCP Tool) and Phase 10 (Distributed Knowledge Graph Sync), adding conversational skill loading via trigger detection and extending peer synchronization to propagate knowledge-graph edges through gossip and delta sync mechanisms. Updates planning documents, introduces a new Go skill package, extends protocol buffers with Edge messages, and integrates edge broadcasting into daemon and MCP infrastructure.

Changes

Cohort / File(s) Summary
Planning & Progress
.planning/ROADMAP.md, .planning/STATE.md, .planning/config.json
Updated roadmap and state to reflect Phase 9 completion (Skill Loader) and Phase 10 completion (Distributed Graph Sync). Enabled workflow._auto_chain_active flag. Adjusted progress metrics from 8 phases/6 completed to 10 phases/7 completed.
Phase 9 Planning Documentation
.planning/phases/09-skill-loader/09-01-PLAN.md, 09-01-SUMMARY.md, 09-CONTEXT.md, 09-DISCUSSION-LOG.md, 09-RESEARCH.md, 09-VERIFICATION.md
Comprehensive planning and verification docs for skill loader feature including trigger detection (direct phrase + fuzzy keyword matching), runtime skill loading from ./skill/SKILL.md with go:embed fallback, and MCP load_skill tool registration. Includes context, research, discussion, and verification artifacts.
Phase 10 Planning Documentation
.planning/phases/10-graph-sync/10-01-PLAN.md, 10-01-SUMMARY.md, 10-CONTEXT.md, 10-RESEARCH.md
Comprehensive planning docs for distributed edge synchronization covering proto schema extensions with Edge message, edge-aware gossip with "new_edge" message type, delta sync with edge version vectors, version-vector-based delta tracking, and orphan-edge buffering behavior.
Skill Package Implementation
pkg/skill/trigger.go, pkg/skill/trigger_test.go, pkg/skill/loader.go, pkg/skill/loader_test.go, pkg/skill/SKILL.md
New skill package providing trigger detection via direct phrase patterns (DirectPatterns) and fuzzy keyword matching (FuzzyKeywords), skill content loading from filesystem with go:embed fallback, 50KB file size limit, and comprehensive DMGN documentation including tool references, behavioral protocol, and setup guide.
Skill Content Reference
skill/SKILL.md
Added "Trigger Detection" section instructing agents to detect DMGN mentions and call load_skill MCP tool to load full skill context.
Protocol Buffer Extensions
proto/dmgn/v1/dmgn.proto
Introduced new Edge message with from_id, to_id, weight, edge_type, timestamp, creator_peer_id. Extended GossipMessage with edge field, SyncRequest with edge_version_vector map, and SyncResponse with edges repeated field and edge_version_vector map.
Synchronization Infrastructure
pkg/sync/gossip.go, pkg/sync/delta.go, pkg/sync/vclock_store.go, pkg/sync/vclock_store_test.go
Extended gossip manager with onEdgeReceive callback and PublishEdge() method supporting "new_edge" message type dispatching. Enhanced delta sync to handle edge version vectors alongside memory vectors, collect missing edges via GetEdgesAfter(), and process received edges. Added edge sequence persistence methods SaveEdgeSequence() and retrieval via GetEdgesAfter() with version-based queries.
Storage Layer Extensions
pkg/storage/storage.go, pkg/storage/edge_test.go
Added SaveEdgeWithMeta() and GetEdgeProto() methods to persist edges as serialized protobuf with metadata. Implemented legacy edge format fallback during retrieval. Included comprehensive tests validating edge persistence, overwrite semantics, not-found errors, and legacy format coexistence.
MCP Server & Daemon Integration
pkg/mcp/server.go, internal/daemon/daemon.go
Registered load_skill MCP tool returning skill content from skill.Load() with source path tracking. Added EdgeBroadcaster callback field and SetEdgeBroadcaster() method. Implemented edge broadcasting in handleLinkMemories. Updated daemon to load edge version vectors, register edge receive callback, implement broadcastEdge() function marshaling edges and publishing via gossip, and deduplicate multiaddrs in persistMultiaddrs().

Sequence Diagram(s)

sequenceDiagram
    participant Peer1 as Peer A<br/>(creates edge)
    participant Daemon1 as Daemon A
    participant Gossip1 as Gossip<br/>Manager A
    participant Network as Network/<br/>GossipSub
    participant Peer2 as Peer B<br/>(receives)
    participant Gossip2 as Gossip<br/>Manager B
    participant Daemon2 as Daemon B
    participant Storage2 as Storage B
    
    Peer1->>Daemon1: link_memories<br/>(from_id, to_id, weight)
    Daemon1->>Daemon1: create Edge protobuf<br/>& store in storage
    Daemon1->>Gossip1: edgeBroadcaster callback<br/>broadcastEdge(fromID, toID,...)
    Gossip1->>Gossip1: marshal Edge to bytes
    Gossip1->>Gossip1: increment & persist<br/>edge sequence
    Gossip1->>Network: publish GossipMessage<br/>type="new_edge"<br/>edge=serialized_bytes
    Network->>Gossip2: receive GossipMessage
    Gossip2->>Gossip2: decode edge bytes<br/>to Edge protobuf
    Gossip2->>Daemon2: onEdgeReceive callback<br/>validate & store edge
    Daemon2->>Storage2: SaveEdgeWithMeta(edge)
    Daemon2->>Daemon2: update edgeVV<br/>sequence tracking
    
    Note over Peer2: Edge now in graph<br/>for local queries
    
    rect rgba(100, 150, 200, 0.5)
    Peer2->>Daemon2: delta sync with Peer A
    Daemon2->>Daemon2: compute missing edges<br/>using edge version vectors
    Daemon2->>Daemon1: SyncRequest<br/>edge_version_vector
    Daemon1->>Daemon1: GetEdgesAfter(peerID, seq)
    Daemon1->>Daemon2: SyncResponse<br/>repeated edges
    Daemon2->>Storage2: persist edges
    Daemon2->>Daemon2: merge edge version<br/>vectors & update vvStore
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A skill loader hops into view,
Triggered by words the user says true,
Phase 10 gossips edges far and wide,
Delta sync keeps peers synchronized,
Knowledge graphs now span across the distributed tide! 🌐

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch phase-8-networking-security

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot mentioned this pull request Apr 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant