Skip to content

brxtrac/tracaplot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TRACaPlot (@TRACaPlot_bot)

Telegram community assistant backed by OriginTrail DKG memory. TRACaPlot helps communities save and find useful answers, updates, decisions, milestones, and notes without interrupting group conversation.

It uses Telegram long-polling, SQLite working memory, OpenClaw DKG adapter, Shared Working Memory writes, and silent-by-default group behaviour.

Loop status

Loop Goal Status
1 Foundation & DKG connection Complete
2 Core memory & querying Complete
3 Trust, settings & admin controls Complete
4 UX polish & memory viewer Complete
5 Production hardening Planned

See docs/LOOP.md for the active loop log.

What it does

  • Polls Telegram with TRACaBot-style offset/idempotency
  • Stays silent in groups unless a user issues an explicit command
  • Heuristically extracts Conversation Artefacts from group messages
  • Publishes artefacts to DKG v10 Shared Working Memory (createKnowledgeAsset + SWM)
  • Presents a compact /start and /ask public command picker; advanced actions remain available through inline menus
  • Edits one inline menu message during navigation and provides a close action
  • Supports compatibility commands /help, /status, /recent, /teach, and admin-only /settings
  • Configures Telegram bot name, short description, full description, and scoped command lists on startup
  • Persists per-chat observation, recap, and topic-filter settings in SQLite
  • Awards light local trust points after accepted DKG publication
  • Sends no recaps by default; admin-enabled daily/weekly recaps use chat-scoped DKG memory
  • Serves an optional localhost-only, read-only web viewer for recent DKG artefacts

Quick start

cd /root/tracaplot
cp .env.example .env   # then fill TELEGRAM_BOT_TOKEN + TRACAPLOT_DKG_PSEUDONYM_KEY
npm test
npm run demo           # publish sample artefacts + query them back
npm start              # run the bot
npm run viewer         # browse read-only memory at http://127.0.0.1:4187

Teach flow

Use teach flow in private chat:

/teach What is a Context Graph? | A named DKG space where agents share structured knowledge.

Submission stays in local SQLite Working Memory and never appears in /recent, /ask, or web viewer. A user listed by numeric Telegram ID in TRACAPLOT_ADMINS may review and promote same text:

/teach What is a Context Graph? | A named DKG space where agents share structured knowledge. --publish

Published copy enters DKG Shared Working Memory with provenance user_teach. Group /teach only returns private-chat guidance; passive group traffic remains silent.

Memory viewer

Start viewer separately from bot:

cd /root/tracaplot
npm run viewer

Open http://127.0.0.1:4187. Viewer only accepts GET, returns an allowlisted artefact shape, and keeps DKG auth token server-side. Defaults bind loopback only. Use an authenticated reverse proxy before exposing it beyond localhost; do not bind publicly without access controls.

Viewer variables:

  • TRACAPLOT_VIEWER_HOST - default 127.0.0.1
  • TRACAPLOT_VIEWER_PORT - default 4187; use 0 for an ephemeral test port

Environment

Critical variables (see .env.example):

  • TELEGRAM_BOT_TOKEN@TRACaPlot_bot token
  • TRACAPLOT_CONTEXT_GRAPH — default tracaplot
  • DKG_NODE_URL — local daemon (default http://127.0.0.1:9200)
  • OPENCLAW_DKG_ADAPTER_PATH — OpenClaw adapter entrypoint
  • TRACAPLOT_DKG_PSEUDONYM_KEY — ≥32 bytes for identity pseudonymization
  • TRACAPLOT_SILENT_BY_DEFAULT=true — never spam groups
  • TRACAPLOT_ADMINS — comma-separated numeric Telegram user IDs allowed to publish reviewed teachings

Architecture

src/
  config.js       # env + defaults
  store.js        # SQLite WM, polling offsets, chat settings
  artefacts.js    # Conversation Artefact schema + heuristic extractor
  dkg-client.js   # Context Graph ensure + SWM publish + SPARQL query
  telegram.js     # silent polling bot
  index.js        # composition root
viewer/
  server.js       # loopback read-only DKG API + static server
  index.html      # responsive memory trail UI

Conversation Artefact (minimal schema)

{
  "event_type": "conversation_artefact",
  "payload": {
    "artefact_kind": "qa | announcement | decision | timeline | note",
    "title": "...",
    "summary": "...",
    "question": "...",
    "answer": "...",
    "topics": ["dkg", "origintrail"],
    "confidence": 85,
    "lifecycle_stage": "shared_memory",
    "provenance": "telegram_observation",
    "source_message_text_excerpt": "redacted excerpt"
  }
}

Ontology namespace: https://tracaplot.org/ontology#

Safety rules

  1. Silent by default in groups
  2. No auto-moderation / bans (that is TRACaBot’s job)
  3. DKG shared triples use HMAC pseudonyms for identities
  4. Optional recaps only when admins enable them (Loop 3)
  5. /teach drafts stay private; only configured bot admins can publish them
  6. Viewer exposes no DKG credentials and binds to loopback by default

systemd

sudo cp docs/tracaplot.service.example /etc/systemd/system/tracaplot.service
sudo systemctl daemon-reload
sudo systemctl enable --now tracaplot

About

Telegram community assistant backed by OriginTrail DKG memory

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages