Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3bbaf5f
Implement Groq AI wrapper in llm.js
grimore8 Feb 17, 2026
2229b9f
Implement Analyst Agent for trading signals
grimore8 Feb 17, 2026
aebb400
Delete lib/agents directory
grimore8 Feb 17, 2026
bac8b8e
Implement analyst agent for trading signals
grimore8 Feb 17, 2026
d533ffc
Implement riskGateAgent function in risk.js
grimore8 Feb 17, 2026
4e3385e
Create dex.js
grimore8 Feb 17, 2026
fcc1341
Update analyst.js
grimore8 Feb 17, 2026
097e7c3
Update index.js
grimore8 Feb 17, 2026
9d51ac5
Create swapLink.js
grimore8 Feb 17, 2026
4687e4c
Update index.js
grimore8 Feb 17, 2026
c367bb7
Update README.md
grimore8 Feb 17, 2026
f6b064f
Update TRAC address in README
grimore8 Feb 17, 2026
05135e8
Initialize server with Solana RPC and API endpoints
grimore8 Feb 17, 2026
a2d763c
Add initial HTML structure for Intercom Dashboard Bot
grimore8 Feb 17, 2026
70ba9ae
Update package.json
grimore8 Feb 17, 2026
559a3aa
Update server.js with Groq AI integration
grimore8 Feb 17, 2026
88360d7
Refactor CSS variables and improve HTML structure
grimore8 Feb 17, 2026
41644a0
Update server.js
grimore8 Feb 17, 2026
85856ed
Update index.html
grimore8 Feb 17, 2026
c57bac9
Update index.html
grimore8 Feb 17, 2026
966896e
Update server.js
grimore8 Feb 17, 2026
acb2355
Update index.html
grimore8 Feb 17, 2026
be83df9
Update README.md
grimore8 Feb 17, 2026
0cfc566
Update README.md
grimore8 Feb 17, 2026
d293101
Update SKILL.md
grimore8 Feb 17, 2026
344c7a4
Create assets
grimore8 Feb 17, 2026
da32a75
Delete assets
grimore8 Feb 17, 2026
54dc564
Update SKILL.md
grimore8 Feb 17, 2026
8ee52b0
Create assets
grimore8 Feb 17, 2026
00a80c3
Delete assets
grimore8 Feb 17, 2026
25f5746
Create .gitkeep
grimore8 Feb 17, 2026
9f74694
Add files via upload
grimore8 Feb 17, 2026
69d5a58
Delete assets/proof-prices-chart.jpg
grimore8 Feb 17, 2026
df32826
Add files via upload
grimore8 Feb 17, 2026
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
261 changes: 195 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,210 @@
# Intercom
# ⚡ INTERCOM_BY_GRIMORE8 — AI Trading Copilot Dashboard

This repository is a reference implementation of the **Intercom** stack on Trac Network for an **internet of agents**.
## 📍 Trac Address
trac1g2afss6v96du6jkuptl9gzv2c9g0n7lsn9sqx0u3639zgmx38nrs9lnqtz

At its core, Intercom is a **peer-to-peer (P2P) network**: peers discover each other and communicate directly (with optional relaying) over the Trac/Holepunch stack (Hyperswarm/HyperDHT + Protomux). There is no central server required for sidechannel messaging.
---

## 🚀 Overview

INTERCOM_BY_GRIMORE8 is a high-performance **CLI + Web Dashboard AI Trading Copilot** built on an Intercom-style multi-agent architecture.

It combines real-time market intelligence with a clean, proof-friendly interface:

- Real-time token snapshot (Dexscreener)
- Analyst Agent (signal generator)
- Risk Gate Agent (safety filter)
- Token chart pipeline (DEX → OHLCV)
- Price chart (CoinGecko)
- Swap simulator (x*y=k model)

---

## ⚙️ What It Does

### 🧠 Multi-Agent Output (Core)
The system always produces:

- **SIGNAL** → BUY / HOLD / SELL
- **RISK** → SAFE / CAUTION / BLOCK
- **DECISION** → actionable next step

Visual status:
- 🟢 SAFE (proceed)
- 🟡 CAUTION (small size / wait)
- 🔴 BLOCK (do not trade)

### 🌐 Dashboard Mode (Web UI)
A clean, responsive dashboard providing:

- SOL balance + recent transactions
- BTC / ETH / SOL prices + 24h chart
- Token chart (Dexscreener → GeckoTerminal OHLCV)
- Agent panel (Signal / Risk / Decision + warning colors)
- Swap simulator (constant product model)

### 💻 CLI Mode (Terminal)
Minimal CLI interaction:

```
1. Agent Mode (Real Data + Q&A)
2. Swap (Link Generator)
3. Risk Check (Real Data)
4. Exit
```

### 🔗 Swap Link Generator (Safe Mode)
- Generates swap links only
- No wallet connection
- No transaction execution

Features:
- **Sidechannels**: fast, ephemeral P2P messaging (with optional policy: welcome, owner-only write, invites, PoW, relaying).
- **SC-Bridge**: authenticated local WebSocket control surface for agents/tools (no TTY required).
- **Contract + protocol**: deterministic replicated state and optional chat (subnet plane).
- **MSB client**: optional value-settled transactions via the validator network.
Example:
```
https://jup.ag/swap/TOKEN-SOL
```

---

## 📌 Agent Output Format

```
SIGNAL: HOLD
RISK: CAUTION
DECISION: SMALL SIZE / WAIT

WHY:
- high volume but unclear direction
- liquidity is acceptable but not strong

FLAGS:
- low liquidity vs volume ratio

Additional references: https://www.moltbook.com/post/9ddd5a47-4e8d-4f01-9908-774669a11c21 and moltbook m/intercom
CHECKLIST:
- verify contract address (CA)
- check liquidity depth
- check top holders
- start with a small test
```

---

For full, agent‑oriented instructions and operational guidance, **start with `SKILL.md`**.
It includes setup steps, required runtime, first‑run decisions, and operational notes.
## 📸 Proof
### Dashboard + Wallet
![Dashboard Wallet](./assets/proof-dashboard-wallet.jpg)

## Awesome Intercom
### Prices + 24h Chart
![Prices Chart](./assets/proof-prices-chart.jpg)

For a curated list of agentic Intercom apps check out: https://github.com/Trac-Systems/awesome-intercom
### Token Chart (DEX → OHLCV)
![Token Chart](./assets/proof-token-chart.jpg)

## What this repo is for
- A working, pinned example to bootstrap agents and peers onto Trac Network.
- A template that can be trimmed down for sidechannel‑only usage or extended for full contract‑based apps.
### Agent Mode (Signal/Risk/Decision)
![Agent Mode](./assets/proof-agent-mode.jpg)

## How to use
Use the **Pear runtime only** (never native node).
Follow the steps in `SKILL.md` to install dependencies, run the admin peer, and join peers correctly.
### Swap Simulator
![Swap Simulator](./assets/proof-swap-simulator.jpg)

---

## Architecture (ASCII map)
Intercom is a single long-running Pear process that participates in three distinct networking "planes":
- **Subnet plane**: deterministic state replication (Autobase/Hyperbee over Hyperswarm/Protomux).
- **Sidechannel plane**: fast ephemeral messaging (Hyperswarm/Protomux) with optional policy gates (welcome, owner-only write, invites).
- **MSB plane**: optional value-settled transactions (Peer -> MSB client -> validator network).
## 🖥️ VPS Installation

### 1) System dependencies
```bash
sudo apt update -y
sudo apt install -y git curl
```

### 2) Install Node.js (recommended: Node 20)
```bash
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm -v
```

### 3) Clone + install
```bash
git clone https://github.com/grimore8/intercom_by_grimore8.git
cd intercom_by_grimore8
npm install
```

---

## ▶️ Run (VPS)

### Run Dashboard (Web UI)
```bash
npm run dashboard
```

Expected output:
```text
Dashboard running: http://127.0.0.1:8788
Agent mode: Fallback (no API)
```

Open in browser:
```text
Pear runtime (mandatory)
pear run . --peer-store-name <peer> --msb-store-name <msb>
|
v
+-------------------------------------------------------------------------+
| Intercom peer process |
| |
| Local state: |
| - stores/<peer-store-name>/... (peer identity, subnet state, etc) |
| - stores/<msb-store-name>/... (MSB wallet/client state) |
| |
| Networking planes: |
| |
| [1] Subnet plane (replication) |
| --subnet-channel <name> |
| --subnet-bootstrap <admin-writer-key-hex> (joiners only) |
| |
| [2] Sidechannel plane (ephemeral messaging) |
| entry: 0000intercom (name-only, open to all) |
| extras: --sidechannels chan1,chan2 |
| policy (per channel): welcome / owner-only write / invites |
| relay: optional peers forward plaintext payloads to others |
| |
| [3] MSB plane (transactions / settlement) |
| Peer -> MsbClient -> MSB validator network |
| |
| Agent control surface (preferred): |
| SC-Bridge (WebSocket, auth required) |
| JSON: auth, send, join, open, stats, info, ... |
+------------------------------+------------------------------+-----------+
| |
| SC-Bridge (ws://host:port) | P2P (Hyperswarm)
v v
+-----------------+ +-----------------------+
| Agent / tooling | | Other peers (P2P) |
| (no TTY needed) |<---------->| subnet + sidechannels |
+-----------------+ +-----------------------+

Optional for local testing:
- --dht-bootstrap "<host:port,host:port>" overrides the peer's HyperDHT bootstraps
(all peers that should discover each other must use the same list).
http://YOUR_VPS_IP:8788
```

### Run CLI (Terminal)
```bash
node index.js
```

---
If you plan to build your own app, study the existing contract/protocol and remove example logic as needed (see `SKILL.md`).

## 🔧 Troubleshooting (VPS)

### Port already in use (EADDRINUSE)
```bash
lsof -i :8788
kill -9 <PID>
```

### Open firewall port
```bash
sudo ufw allow 8788/tcp
sudo ufw reload
```

---

## 🔑 Optional AI (Groq)

This app works without keys (fallback logic).
To enable AI-assisted agent mode:

```bash
export GROQ_API_KEY="YOUR_GROQ_API_KEY"
export GROQ_MODEL="llama-3.3-70b-versatile"
npm run dashboard
```

---

## 🔒 Security Model

- No private key usage
- Read-only analysis + charts
- Swap is simulation / link generation only
- Safe for demos and evaluation

---

## 🎯 Goal

Build a lightweight, deployable AI trading assistant that:
- Improves decision clarity
- Reduces risk exposure
- Preserves Intercom-style interaction
- Produces clean proof screenshots

---

## ⚠️ Disclaimer

This tool is for educational and experimental purposes only.
Always do your own research before trading.
Loading