Skip to content

intellygentle/intercom-swap

Β 
Β 

Repository files navigation

Collaborative Research Team - Intercom Fork

Agent Information

Reward Address (TAP Wallet): trac1ajdk79pq47u0qqwr5qcph3y28j93gcywecawjec9w77wcrn5vqsqs825pq

Development Peer Address (CLI): trac1txz842lvhmtfxkt932j0c5le902q40erwgpc4ddvxc2add5wygzsd5xzdn

Peer Public Key: 59847aabecbed69359658aa4fc53f92bd40abf2372038ab5ac3615d6b68e2205


πŸ“‘ Trac Address

trac1ajdk79pq47u0qqwr5qcph3y28j93gcywecawjec9w77wcrn5vqsqs825pq


✨ What It Does

  • Joins the 0000intercom P2P sidechannel on startup
  • Announces itself to the network so peers know it is available
  • Responds to research: <topic> commands with complete Wikipedia summaries
  • Returns full, sentence-complete answers β€” never truncated mid-thought
  • Guides users who send unrecognized commands with usage instructions
  • Loads agent identity and domain knowledge from skills.md at startup

πŸš€ How to Use the Agent

pear run ~/intercom-swap

Once the agent is running, any peer on the Trac network can interact with it.

1. Join the intercom channel:

/sc_join --channel "0000intercom"

2. Send a research query:

/sc_send --channel "0000intercom" --message "research: Bitcoin" /sc_send --channel "0000intercom" --message "research: What is cryptocurrency?" /sc_send --channel "0000intercom" --message "research: Who is satoshi"

3. Get help:

/sc_send --channel "0000intercom" --message "help"

Command Reference

Command Description
research: <topic> Look up any topic on Wikipedia
help Show available commands and examples

πŸ› οΈ Running It Yourself

Prerequisites

Install & Run

https://github.com/intellygentle/intercom-swap
cd intercom-swap
npm install
pear run ~/intercom-swap

To confirm if others can use it while it is running on your pc

cd intercom-swap

https://github.com/user-attachments/assets/f3f72641-a097-4972-8a6d-c592fc97f907


pear run . --peer-store-name my-node

Test

/sc_join --channel "0000intercom"
/sc_send --channel "0000intercom" --message "research: What is cryptocurrency?"

The agent starts automatically with the node. On startup you will see:

πŸ“š Skills loaded from: /path/to/intercom-swap/skills.md πŸ€– Research Agent initialized and listening for P2P messages πŸ“‹ Response style loaded from skills.md Sidechannel: ready πŸ“£ Announcing Research Agent on channel "0000intercom"... βœ… Agent announcement broadcast successfully!


πŸ—οΈ Architecture

intercom-swap/ β”œβ”€β”€ index.js # Entry point β€” wires peer, MSB, sidechannel, agent β”œβ”€β”€ skills.md # Agent identity, domains, and response style └── features/ β”œβ”€β”€ research-agent/ β”‚ └── index.js # ResearchAgentHandler β€” core agent logic β”œβ”€β”€ sidechannel/ β”‚ └── index.js # Trac P2P sidechannel transport β”œβ”€β”€ sc-bridge/ β”‚ └── index.js # WebSocket bridge for external integrations └── price/ └── index.js # Price oracle feature

Message Flow

Peer on network β”‚ β”‚ /sc_send --channel "0000intercom" --message "research: Bitcoin" β–Ό Trac Sidechannel (0000intercom) β”‚ β–Ό ResearchAgentHandler.handleMessage() β”‚ β”œβ”€β”€ isProtocolMessage() β†’ drop silently if internal envelope β”œβ”€β”€ isOwnEcho() β†’ drop silently if our own broadcast β”‚ β–Ό researchWikipedia(topic) β”‚ Wikipedia API β–Ό truncateAtSentence(extract, 1200) ← complete sentence, never mid-thought β”‚ β–Ό buildResponse(topic, summary, elapsed) β”‚ injects skills.md context if topic matches a known domain β–Ό sidechannel.broadcast(channel, { text: response }) β”‚ β–Ό All peers on "0000intercom" receive the response


🧠 skills.md β€” Agent Context

The agent reads skills.md at startup to load its identity, response style, and domain knowledge. Updating this file changes how the agent presents itself on the network without any code changes.

# Research Agent Skills

## Identity
You are a Research Agent running on the Trac peer-to-peer network...

## Capabilities
- Research any topic using the `research: <topic>` command
- Return complete, well-formed summaries...

## Response Style
- Always return complete sentences β€” never cut off mid-thought
- Keep summaries informative but concise...

## Knowledge Domains
- Cryptocurrency and blockchain technology
- Peer-to-peer networking protocols
- Distributed systems
- General encyclopedic knowledge via Wikipedia

πŸ“Έ Proof of Work

Agent receiving and responding to a query from a network peer

πŸ“© [0000intercom] from 59847aabecbed693...: research: Bitcoin ═══════════════════════════════════════ πŸ“¨ Research Agent received P2P message πŸ‘€ From: 59847aabecbed693... πŸ“’ Channel: 0000intercom πŸ’¬ Message: research: Bitcoin ═══════════════════════════════════════ πŸ“‹ Researching "Bitcoin"... βœ… Research completed in 741ms πŸ“€ Response prepared: ─────────────────────────────────────── πŸ“Œ Topic: Bitcoin πŸ“„ Summary: Bitcoin (abbreviation: BTC; sign: β‚Ώ) is the first decentralized cryptocurrency. Based on a free-market ideology, bitcoin was invented in 2008 when an unknown person published a white paper under the pseudonym of Satoshi Nakamoto. Use of bitcoin as a currency began in 2009, with the release of its open-source implementation. ⏱️ Processed in: 741ms ─────────────────────────────────────── βœ… Response broadcast successfully!

Agent guiding a peer who used the wrong command format

πŸ“© [0000intercom] from 27e4908d63e1e0af...: /ask What is Bitcoin? πŸ€– Research Agent β€” I didn't understand that command. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Here's how to use me: research: β€” look up any topic help β€” show this message Examples: research: Bitcoin research: What is cryptocurrency? research: Who is satoshi πŸ“‘ Running on the Trac P2P network (intercom-swap)

Agent announcing itself on startup

πŸ“£ Announcing Research Agent on channel "0000intercom"... πŸ€– Research Agent β€” Online ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ I am a research assistant running on the Trac P2P network. use the command like this:

sc_send--channel"0000intercom"--message "research: Bitcoin"

I fetch Wikipedia summaries and return complete, readable answers. πŸ“– How to use me: research: β€” look up any topic help β€” show available commands πŸ’‘ Examples: research: Bitcoin research: What is Cryptocurrency research: Who is Satoshi? πŸ—‚οΈ I know about: Cryptocurrency and blockchain technology, Peer-to-peer networking protocols, Distributed systems, General encyclopedic knowledge via Wikipedia ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“‘ Listening on channel: 0000intercom βœ… Agent announcement broadcast successfully!


πŸ”§ Key Implementation Details

Sentence-complete summaries β€” the truncateAtSentence() function finds the last period-space boundary within a 1200-character budget so responses always end at a natural point rather than cutting mid-word or mid-thought.

skills.md context injection β€” when a query topic matches a section heading or body in skills.md, a relevant snippet is prepended to the response under πŸ“˜ Agent context:.

Echo filtering β€” the agent detects its own broadcast echoes by prefix and drops them silently, preventing infinite response loops on shared open channels.

Protocol envelope filtering β€” internal Trac/swap messages (swap.rfq, ping, agent.announce, etc.) are identified and dropped before they reach command parsing.

Announce-on-first-message fallback β€” if no peers are connected when the scheduled 6-second announcement fires, _announced resets to false and the announcement is retried the moment the first real message arrives.


video proof

tracproofvideo_YZI43L8N.mp4

πŸ“„ License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 75.3%
  • TypeScript 20.3%
  • Rust 2.0%
  • Shell 1.0%
  • CSS 1.0%
  • PowerShell 0.4%