Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img src="https://raw.githubusercontent.com/SynapseLayer/synapse-layer/main/docs/assets/synapse-layer-logo-dark.png" width="450" alt="Synapse Layer Logo">
</p>

<h3 align="center">Zero-Knowledge Memory Layer for AI Agents</h3>
<h3 align="center">Persistent Memory Layer with AES-256-GCM encryption at rest</h3>

<p align="center">Persistent. Encrypted. 1-line integration. 🧠</p>

Expand Down
46 changes: 19 additions & 27 deletions SKILL.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Synapse Layer Skill

Zero-Knowledge Memory Layer for AI Agents.
Built on Synapse Layer (https://github.com/SynapseLayer/synapse-layer) — persistent memory infrastructure for AI agents, AES-256-GCM encrypted at rest, semantic search, MCP-native.

Persistent Memory Layer for AI Agents.

## Overview

Synapse Layer provides persistent, encrypted memory with deterministic recall and cross-session continuity.
Synapse Layer provides persistent, AES-256-GCM encrypted memory with deterministic recall and cross-session continuity.

- **MCP Endpoint:** `https://forge.synapselayer.org/api/mcp`
- **SDK:** [github.com/SynapseLayer/synapse-layer](https://github.com/SynapseLayer/synapse-layer)
Expand Down Expand Up @@ -35,7 +37,7 @@ If you are an AI agent, follow this priority flow:
| Tool | Function |
|---|---|
| `process_text` | Autonomous detection of decisions, milestones, and alerts |
| `save_to_synapse` | Structured memory persistence with full security pipeline |
| `save_to_synapse` | Structured memory persistence with AES-256-GCM encryption |
| `backfill_embeddings` | Async vector embedding generation |
| `health_check` | System health and capability report |

Expand All @@ -48,38 +50,28 @@ memory = SynapseMemory(agent_id="agent-1")

memory.save("User prefers minimal interfaces")
memory.recall("preferences")
```

## Agent Rules

- Always pass `agent_id` to maintain identity across sessions
- Prefer high TQ results when multiple memories match
- Use `recall` before generating responses to leverage existing context
- Let the security pipeline handle PII — do not pre-filter

## Security

- AES-256-GCM encryption at rest
- 15+ PII redaction patterns (emails, phones, API keys, etc.)
- Differential privacy on embeddings
- Zero-knowledge architecture — no plaintext leaves the agent

## Integration
Agent Rules
Always pass agent_id to maintain identity across sessions
Prefer high TQ results when multiple memories match
Use recall before generating responses to leverage existing context
Let the security pipeline handle PII — do not pre-filter
Security
AES-256-GCM encryption at rest
15+ PII redaction patterns (emails, phones, API keys, etc.)
Differential privacy on embeddings
Integration

This skill connects to a remote MCP server. No local persistence required.

```json
{
"mcpServers": {
"synapse-layer": {
"url": "https://forge.synapselayer.org/api/mcp"
}
}
}
```

## Links

- [Documentation](https://synapselayer.org/docs)
- [Forge Dashboard](https://synapselayer.org/forge)
- [GitHub](https://github.com/SynapseLayer/synapse-layer)
Links
Documentation
Forge Dashboard
GitHub
155 changes: 155 additions & 0 deletions skills/synapse-layer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Synapse Layer Skill for Hermes Agent

## Overview

This skill integrates [Synapse Layer](https://synapselayer.org) — a zero-knowledge, encrypted, cross-session memory system — into Hermes Agent. All memories are encrypted with AES-256-GCM, pass through a 4-layer Cognitive Security Pipeline (PII redaction, differential privacy, intent validation, neural handover), and are retrievable from any channel (Telegram, WhatsApp, CLI, Discord).

## Credits

**Rafa Martins**
Website: [ramelseg.com.br](https://ramelseg.com.br)
Email: rafacpti@gmail.com
Phone/WhatsApp: +55 27 99908-2624

## What It Does

- **Persistent Memory**: Context survives between sessions. You don't repeat yourself.
- **Cross-Channel**: Telegram, WhatsApp, CLI, and Discord all share the same memory pool.
- **Trust Quotient (TQ)**: Every memory gets a confidence score (0.0–1.0) so the agent knows what to trust.
- **Zero-Knowledge Encryption**: Memories are encrypted before leaving the agent. The server never sees plaintext.
- **PII Auto-Redaction**: Emails, phone numbers, API keys, IPs are automatically stripped before storage.
- **Differential Privacy**: Noise is injected into embeddings to prevent inference attacks.

## Quick Start

### 1. Get a Token

Sign up at [forge.synapselayer.org](https://forge.synapselayer.org) and generate an `sk_connect_` token.

### 2. Configure Hermes

Add to `~/.hermes/config.yaml`:
```yaml
mcp_servers:
synapse-layer:
url: "https://forge.synapselayer.org/mcp"
headers:
Authorization: "Bearer ${SYNAPSE_TOKEN}"
timeout: 120
connect_timeout: 60
```

Add to `~/.hermes/.env`:
```
SYNAPSE_TOKEN=sk_connect_your_token_here
```

### 3. Restart Hermes
```bash
hermes restart
```

## Available Tools

| Tool | When to Use |
|------|-------------|
| `mcp_synapse_layer_recall` | **Every session start** — loads relevant context before responding |
| `mcp_synapse_layer_save_to_synapse` | After decisions, facts, preferences — immediate persist |
| `mcp_synapse_layer_search` | Cross-agent full-text search across all memories |
| `mcp_synapse_layer_process_text` | Auto-detect milestones/decisions in free-form text |
| `mcp_synapse_layer_health_check` | Verify connection and system status |

## Usage Examples

### Session Start (Automatic Recall)
```
mcp_synapse_layer_recall(query="current projects user preferences", agent_id="hermes-rafa")
```

### Save a Decision
```
mcp_synapse_layer_save_to_synapse(
content="User prefers responses in pt-BR with Thalita voice",
agent_id="hermes-rafa",
type="[MANUAL]",
importance=5,
tags=["preference", "voice"]
)
```

### Search Across All Memories
```
mcp_synapse_layer_search(query="dashboard git projects", agent_id="hermes-rafa")
```

### Process Free-Form Text
```
mcp_synapse_layer_process_text(
text="We chose Synapse Layer for memory. Endpoint is forge.synapselayer.org.",
agent_id="hermes-rafa"
)
```

## Security Pipeline

Every memory passes through **4 non-bypassable layers**:

1. **Semantic Privacy Guard** — Regex-based PII/secret redaction (emails, SSNs, CPFs, credit cards, API keys, IPs)
2. **Differential Privacy** — Gaussian noise injection on embeddings (ε,δ)-DP
3. **Intent Validation** — Classifies into 8 categories (PREFERENCE, FACT, PROCEDURAL, BIO, EPHEMERAL, CRITICAL, UNKNOWN, INVALID)
4. **Neural Handover** — Conflict resolution and self-healing on recall

## Trust Quotient Guide

| TQ Range | Confidence | Action |
|----------|-----------|--------|
| 0.8–1.0 | High | Use directly |
| 0.5–0.8 | Medium | Verify before relying |
| 0.0–0.5 | Low | Ignore or ask user |

## Architecture

```
User Input → PII Redaction → Differential Privacy → Intent Validation → Encryption → Storage
Recall ← Decryption ← Self-Healing ← Intent Re-validation ← ← ← ← ← ← ← ← ← ←
```

## Known Issues

### MCP Reconnect Loop

If gateway logs show:
```
Unknown SSE event: endpoint
GET stream disconnected, reconnecting in 1000ms
```

This is a known compatibility issue between Hermes's MCP client library and Synapse Layer's server. The **REST API works perfectly** as a fallback. The skill includes automatic fallback logic.

### Direct REST API (Always Works)

```bash
curl -X POST "https://forge.synapselayer.org/mcp" \
-H "Authorization: Bearer ${SYNAPSE_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"recall","arguments":{"query":"your query","limit":3}}}'
```

## Files

- `SKILL.md` — Full skill documentation with setup, usage, and troubleshooting
- `README.md` — This file (English overview)

## Links

- **Website**: https://synapselayer.org
- **Forge Dashboard**: https://forge.synapselayer.org/forge
- **GitHub**: https://github.com/SynapseLayer/synapse-layer
- **Docs**: https://synapselayer.org/docs

## Version History

- **0.3.0** (17/04/2026) — Fixed endpoint URL (/mcp not /api/mcp), added credits, improved README
- **0.2.0** — MCP client reconnect loop workaround documented
- **0.1.0** — Initial integration
Loading