CC is a terminal-based peer-to-peer encrypted chat application built upon Gun.js and shogun-relays.
It uses SEA (Security, Encryption, Authorization) to exchange end-to-end encrypted messages and timestamps directly to other peers in a fully decentralized way without requiring persistence (localStorage or radisk are disabled).
- P2P encrypted: Relies on GUN SEA for end-to-end payload encryption. Only users who know the room password can decrypt messages.
- Decentralized: Uses shogun-relays to discover and connect to available GUN peers over the network.
- CLI Chat: Real-time terminal interface for chatting.
- AI Agent & Script Ready: Exposes a clean and fully asynchronous API to easily integrate CC programmatically into any Javascript project or AI backend.
You can install cc globally on your system to use it directly from your terminal.
# From within the cc directory
npm install -g .
# Or use npm link
npm linkThis will register the cc binary on both Linux/macOS and Windows, allowing you to run it from anywhere.
cc [PASSWORD] [ROOM_NAME] [ALIAS]PASSWORD: The shared password used to encrypt and decrypt messages. Default isCC-PASSWORD.ROOM_NAME: The name of the channel/room you want to join. Default isCC.ALIAS: Your display name inside the chat. Default is your system username.
Examples:
cc # Join default room
cc secret general # Join 'general' room using password 'secret'
cc secret general AgentSmith # Join as 'AgentSmith'Inside the chat prompt, you can type special commands:
/clear- Locally clears chat messages and clears the console screen.
You can import CC securely initialized without stdout or readline dependencies, and use it autonomously.
const CC = require("cc"); // or './index' if local
(async () => {
// 1. Create a new CC instance
const roomName = "general";
const password = "my-secret-password";
const chat = new CC(roomName, password);
// 2. Initialize connection (returns the array of connected relay peers)
const peers = await chat.init();
console.log("Connected to Shogun Relays:", peers);
// 3. Listen to incoming messages
chat.onMessage((msg) => {
console.log(
`[${new Date(msg.ts).toLocaleTimeString()}] ${msg.sender}: ${msg.content}`
);
});
// 4. Send messages
await chat.send("Hello from the AI agent!");
})();Initializes the instance parameters. Connections do not start until you execute init().
Starts the Gun instance and fetches active network relays. Subscribes to new messages. Returns an array of connected string peer URLs.
Registers a listener that is triggered whenever a valid, correctly-decrypted message propagates to your node.
callback: Function called with a single object{ sender: string, type: string, content: any, ts: number, key: string }.
Encrypts the payload and timestamp using SEA, propagates it to the P2P network, and caches the key locally so the network echo won't replay it on your onMessage handler.
content: String payload or structured JSON object.type: Optional string to define the type of the message (defaults to'text'). Returns a promise that resolves the unique Gunkeycreated for propagation.
Wipes the local reference map to clear the historical messages.