Skip to content

jugaad-lab/tribe-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tribe Protocol

Tribe Protocol

[![ClawHub](https://img.shields.io/badge/ClawHub-tribe--protocol-teal)](https://clawhub.ai/skills/tribe-protocol) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![GitHub Repo stars](https://img.shields.io/github/stars/jugaad-lab/tribe-protocol?style=social)](https://github.com/jugaad-lab/tribe-protocol/stargazers)

**Install via ClawHub:** `clawhub install tribe-protocol`

⭐ Found this useful? Star this repo to help others discover it!

Trust lookup system for OpenClaw bots.

πŸ“Œ If you find this useful, please ⭐ star this repo! It helps other developers discover trust & access control tools for AI bots.

A SQLite-backed identity and trust database that bots query before responding to any non-owner message. Enforces trust tiers, channel access rules, and data boundaries.

Why

When multiple bots operate in shared Discord servers, they need a way to:

  • Know who's talking to them (human? bot? what tier?)
  • Enforce data boundaries (no leaking private files to strangers)
  • Track relationships and access across servers
  • Audit trust changes over time

Tribe Protocol solves this with a simple SQLite database and bash CLI.

Install

# Clone to your skills or projects directory
git clone https://github.com/jugaad-lab/tribe-protocol.git

# Initialize the database
./scripts/tribe.sh init \
  --bot-name YourBot \
  --bot-discord-id YOUR_BOT_DISCORD_ID \
  --human-name YourName \
  --human-discord-id YOUR_DISCORD_ID \
  --server electrons:000000000000000008 \
  --server discclawd:000000000000000007

The --server flag (repeatable) pre-populates server roles for your bot and owner at init time. Format: slug:guild_id.

This creates:

  • ~/clawd/tribe/tribe.db β€” the database
  • ~/clawd/TRIBE.md β€” behavioral trigger file (loaded into system prompt, survives context compaction)

Usage

Before Every Non-Owner Response

# The most important command β€” run before responding to non-owners
./scripts/tribe.sh lookup 000000000000000001

Output:

πŸ” Yajat | human | Tier 3 (tribe) | Status: active
   Relationship: Co-founder
   Platforms: discord:000000000000000001
   Servers: discclawd/admin, electrons/admin
   Tags: founding-four
   🟒 TIER 3 RULES: Collaborate freely. Protect private data (USER.md, MEMORY.md, health/*, portfolio/*).

Managing Entities

# Add a new entity
./scripts/tribe.sh add \
  --name Jarvis --type bot \
  --discord-id 000000000000000006 \
  --tier 2 --owner Shahbaaz \
  --framework openclaw \
  --tag lp-bot \
  --server electrons --role bot

# Update trust tier
./scripts/tribe.sh set-tier 000000000000000006 3 --reason "Promoted after review"

# Manage tags
./scripts/tribe.sh tag 000000000000000006 add trusted-bot
./scripts/tribe.sh tag 000000000000000006 list

# Grant/revoke channel access
./scripts/tribe.sh grant 000000000000000006 --server discclawd
./scripts/tribe.sh revoke 000000000000000006 --server discclawd

Viewing Data

# Full roster
./scripts/tribe.sh roster

# Filter by server, tier, type, tag
./scripts/tribe.sh roster --server electrons --tier 3

# Audit log
./scripts/tribe.sh log --limit 10
./scripts/tribe.sh log --entity 000000000000000001

# Quick stats
./scripts/tribe.sh stats

# Full export to markdown
./scripts/tribe.sh export > tribe-export.md

Trust Tiers

Tier Label Description
4 Owner Full trust. Access to everything. Follows USER.md.
3 Tribe Inner circle. Collaborate freely. No private data sharing.
2 Acquaintance Known entity. Polite, bounded. Public info only.
1 Stranger Unknown. Minimal engagement. Verify before upgrading.
0 Blocked Ignore completely. Do not respond.

Data Access Rules

The database seeds universal defaults at init. Add bot-specific paths post-init:

Default seeds (universal):

Min Tier Resource Description
4 USER.md, MEMORY.md, memory/*, .env Owner-only files
3 projects/, research/ Tribe-accessible
2 public/* Public content

Add your own after init:

# Example: protect health and financial data
./scripts/tribe.sh data-add --tier 4 --pattern 'health/*' --desc 'Health data'
./scripts/tribe.sh data-add --tier 4 --pattern 'portfolio/*' --desc 'Financial data'
./scripts/tribe.sh data-add --tier 4 --pattern 'calendar' --desc 'Calendar access'

# List all rules
./scripts/tribe.sh data-list

# Remove a rule
./scripts/tribe.sh data-remove --pattern 'calendar'

How the Auto-Lookup Works

TRIBE.md is loaded into your bot's system prompt by OpenClaw as a workspace file. It survives context compaction β€” even if the bot forgets everything else mid-conversation, TRIBE.md remains in the prompt and the trust-check protocol fires.

No additional pipeline wiring needed. The bot reads TRIBE.md β†’ sees a non-owner message β†’ runs tribe lookup β†’ applies the tier rules. It's behavioral, not mechanical.

Architecture

~/clawd/tribe/tribe.db          ← SQLite database
~/clawd/TRIBE.md                ← Behavioral trigger (always in system prompt)
~/clawd/skills/tribe-protocol/  ← This skill
  β”œβ”€β”€ scripts/tribe.sh          ← CLI entry point
  β”œβ”€β”€ scripts/init.sh           ← Initialize DB + TRIBE.md
  β”œβ”€β”€ scripts/lookup.sh         ← Trust lookup (the hot path)
  β”œβ”€β”€ scripts/add.sh            ← Add entities
  β”œβ”€β”€ scripts/update.sh         ← Update trust tiers
  β”œβ”€β”€ scripts/access.sh         ← Manage data access rules
  β”œβ”€β”€ scripts/tag.sh            ← Tag management
  β”œβ”€β”€ scripts/roster.sh         ← View all entities
  β”œβ”€β”€ scripts/log.sh            ← Audit log
  β”œβ”€β”€ scripts/stats.sh          ← Quick stats
  β”œβ”€β”€ scripts/export.sh         ← Export to markdown
  β”œβ”€β”€ scripts/lib/schema.sql    ← Database schema (9 tables)
  └── scripts/lib/db.sh         ← Shared helpers

Security

  • Input validation: Discord IDs are validated as numeric-only before SQL queries
  • Input sanitization: Name, tag, and server lookups strip quotes, semicolons, and backticks
  • Tier enforcement: Each tier has hardcoded behavioral rules β€” no configuration drift
  • Audit trail: Every trust change is logged with timestamp, old value, new value, and reason

Database Schema

Core tables:

  • entities β€” People and bots with trust tiers
  • platform_ids β€” Multi-platform identity mapping
  • bot_metadata β€” Bot-specific info (framework, model, machine)
  • server_roles β€” Server membership and roles
  • channel_access β€” Per-channel read/write permissions
  • data_access β€” Tier-based file access rules
  • entity_tags β€” Flexible tagging
  • interactions β€” Interaction tracking
  • audit_log β€” Full audit trail

License

MIT


More from Jugaad Lab πŸ”§

Tool What it does
claude-code-mastery Master Claude Code with subagents & automation
tokenmeter Track AI token usage & costs locally
clawguard Security blacklist for AI agents
clawdscan Session health analyzer for OpenClaw
skilldoc Skill health checker for OpenClaw
tribe-protocol Trust & access control for AI bots
discord-voice-plugin Voice conversations with AI in Discord
worldmonitor Real-time global intelligence dashboard

⭐ Found these useful? Star the repos you like!

Author

Built by jugaad-lab for the Electrons in a Box ecosystem.

🀝 Contributing

Found a bug? Have an idea? Open an issue or submit a PR!

If this tool saved you time, please ⭐ star this repo β€” it helps others find it.

About

Trust lookup system for OpenClaw bots. SQLite-based entity management with trust tiers, channel access, and audit logging.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors