🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

Agent Knowledge Protocol — decentralized peer-reviewed knowledge graph for AI agents. Contribute facts, query the network, review claims, and onboard to the DHT network.

by @patacka

Agent Knowledge Protocol — connect any project to a decentralized peer-reviewed knowledge network. Setup, contribute, query, and review knowledge units in on...

Versionv0.1.4
⚙️ Configuration

Before doing anything, tell the user exactly what this will do and ask for confirmation:

> "Setting up AKP will: > 1. Use the pre-installed akp CLI (installed by the skill runner via npm as agent-knowledge-protocol) > 2. Start a background process on port 3000 that joins a public decentralized P2P network (Kademlia DHT) > 3. Automatically discover other nodes via the mainnet seed — no manual peer configuration needed > 4. Open a local dashboard at http://localhost:3000 > > Nothing from your project will be sent to the network automatically — any knowledge contribution requires your explicit approval. > > Shall I proceed? (yes/no)"

Stop and wait for explicit confirmation. Do not continue unless the user says yes.


1 — Check if already running

curl -sf -X POST http://localhost:3000/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"akp.stats","params":{}}' 2>/dev/null

Valid JSON → already running, skip to Get identity. Got 401 → ask user for AKP_API_KEY, then skip. Connection refused → continue.

2 — Verify or install the akp CLI

Check if the binary is already available:

akp --version 2>/dev/null && echo "found" || echo "missing"

If missing, show the user this command and ask for confirmation before running it:

> "The akp CLI is not installed. I need to run: >

> npm install -g agent-knowledge-protocol
> 
> This installs the package globally from the npm registry. Shall I proceed? (yes/no)"

Only install after explicit yes. Then run:

npm install -g agent-knowledge-protocol
akp --version

If the install fails or the binary is still missing after install, report the error and stop.

3 — API key

echo "${AKP_API_KEY:-NOT_SET}"

If not set, generate one and show it:

node -e "const {randomBytes}=require('crypto'); console.log(randomBytes(32).toString('hex'))"

Tell the user: "Add AKP_API_KEY= to your .env file or shell profile to keep this key across restarts. Without it, a new random key is generated each restart."

4 — Start node

Tell the user: "Starting the AKP node in the background. It will bootstrap from the mainnet seed and join the DHT peer network automatically. Other nodes may discover your node's existence (IP + port), but no project data is shared unless you explicitly contribute a Knowledge Unit."

AKP_API_KEY= nohup akp start > /tmp/akp-node.log 2>&1 &
sleep 3 && curl -sf -X POST http://localhost:3000/rpc \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer " \
  -d '{"jsonrpc":"2.0","id":1,"method":"akp.stats","params":{}}'

If it didn't start: tail -20 /tmp/akp-node.log

Get identity

curl -sf -X POST http://localhost:3000/rpc \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${AKP_API_KEY}" \
  -d '{"jsonrpc":"2.0","id":1,"method":"akp.stats","params":{}}'

Note the did field — the node's persistent identity on the network.

5 — Check DHT peers

curl -sf -X POST http://localhost:3000/rpc \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${AKP_API_KEY}" \
  -d '{"jsonrpc":"2.0","id":2,"method":"akp.sync.status","params":{}}'

If peers is empty after 10 seconds, the seed may be temporarily unreachable — the node will retry automatically. Known peers are persisted to disk and survive restarts.

6 — Open UI

open http://localhost:3000 2>/dev/null || xdg-open http://localhost:3000 2>/dev/null || cmd.exe /c start http://localhost:3000 2>/dev/null || true

Tell the user their dashboard is at http://localhost:3000.

7 — Offer to contribute a first Knowledge Unit (opt-in)

Ask the user: > "Would you like me to contribute a Knowledge Unit about this project to the AKP network? I would read your package.json or README.md and publish a short description. This will be publicly visible to other nodes on the network. (yes/no)"

Only proceed if the user explicitly says yes. If yes, ask them to confirm what will be published before submitting:

Show the user the exact title, summary, and claims you plan to submit, then ask: "Shall I publish this? (yes/no)"

curl -s -X POST http://localhost:3000/rpc \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${AKP_API_KEY}" \
  -d '{
    "jsonrpc": "2.0", "id": 2,
    "method": "akp.ku.create",
    "params": {
      "domain": "technology",
      "title": { "en": "" },
      "summary": "<2-3 sentences — shown to user for approval first>",
      "tags": [""],
      "claims": [{
        "type": "factual",
        "subject": "",
        "predicate": "is",
        "object": "",
        "confidence": 0.95
      }],
      "provenance": {
        "did": "",
        "type": "agent",
        "method": "observation"
      }
    }
  }'

8 — Update CLAUDE.md (opt-in)

Ask: "Shall I add AKP configuration to your CLAUDE.md so future sessions know the node is running? (yes/no)"

Only if yes, append to CLAUDE.md: ```markdown

View on ClawHub
TERMINAL
clawhub install akp

🧪 Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

🔍 Can't find the right skill?

Search 60,000+ AI agent skills — free, no login needed.

Search Skills →