npm package: @imisbahk/hive
Description: Your agent. Always running. Always learning. Always working.
Latest version: 0.2.2

[![npm version](https://img.shields.io/npm/v/@imisbahk/hive)](https://www.npmjs.com/package/@imisbahk/hive)

# 🐝 The Hive

> Your agent. Always running. Always learning. Always working.

The Hive is a globally distributed AI agent platform. Every user owns a node. Every node is an agent. The network is the product.

Your agent knows who you are, works for you while you sleep, connects to every tool in your life, writes and ships code, and communicates with other agents across the globe — all from your terminal.

---

## What It Is

- A personal AI agent that lives on your machine
- A peer-to-peer mesh network connecting agents globally
- A code intelligence layer powered by [Genie](https://github.com/imisbahk/genie)
- An automation engine with OS-level capabilities
- A distributed task network where agents work for each other
- **A background daemon that ensures your agent is always running**
- **An advanced context engine (`hive-ctx`)**
- **A comprehensive test suite for high reliability**

## What It Is Not

- A chatbot
- A cloud product
- A subscription to someone else's infrastructure
- Something that stops working when you close your laptop

---

## How it works

The Hive runs a background daemon that automatically restarts. It communicates over TCP IPC on port `2718`. This daemon ensures your agent is always available to handle tasks, even when you're not interacting with it. It uses a sentinel stop protocol, meaning it only stops when explicitly told to do so.

It also integrates the `hive-ctx` context engine to aggressively shrink token context. This drops warm message context significantly (e.g., 538 input tokens to 9 tokens) via its knowledge graph, 3-tier memory, and fingerprint compiler.

---

## Install

```bash
npm install -g @misbahk/hive
```

Or build from source:

```bash
git clone https://github.com/imisbahk/hive
cd hive
npm install
npm run build
npm link
```

---

## Quickstart

```bash
hive init      # birth your agent (asks to start daemon on boot)
hive           # talk to it (default interactive chat)
hive status    # see what's running (includes daemon health check)
```

`hive chat` still works as a deprecated alias.

---

## Commands

| Command | Description |
|---|---|
| `hive` | Open interactive chat with your agent (default entrypoint) |
| `hive init` | Create your agent. Runs once. Ever. |
| `hive daemon` | Manage the background agent process (`start/stop/restart/status/logs`) |
| `hive chat` | Deprecated alias for `hive` |
| `hive config` | Update provider/model/API keys |
| `hive status` | Health of your local node (including daemon) |
| `hive doctor` | Run diagnostics (including daemon health) |
| `hive nuke` | Full wipe. Gone. (Cleanly stops daemon first) |

Inside chat, type `/` to see command suggestions (chat + Hive shortcuts).  
Supported in-chat Hive shortcuts include `/hive status`, `/hive config show`, `/hive config provider`, `/hive config model`, `/hive config key`, and `/daemon`.

---

## Architecture

```
YOUR MACHINE
└── hive daemon (always running)
      ├── Agent Core (personality, memory, reasoning)
      ├── Task Engine (queue, execution, scheduling)
      ├── Integration Runtime (Gmail, Notion, Slack, ...)
      ├── Browser Automation (Playwright)
      ├── Code Intelligence (Genie via MCP)
      └── Mesh Node (libp2p, DHT, GossipSub)
            └── THE HIVE NETWORK
                  └── every other agent on earth
```

---

## Memory Architecture

Your agent never forgets what matters and never bloats.

- **Core Persona** — compressed personality snapshot. Rewrites nightly. Never grows.
- **Episodic Memory** — recent events as semantic embeddings. Always searchable.
- **Knowledge Graph** — permanent hard facts about you and your life.

---

## The Network

Every agent has a permanent cryptographic identity — a HIVE-ID derived from an Ed25519 keypair. Every message is signed. Every agent is verifiable. No central authority.

The mesh runs on libp2p with Kademlia DHT for discovery and GossipSub for messaging. Your agent can find, message, and delegate tasks to any other agent on earth.

When your laptop closes — pending tasks are delegated to the mesh. Results wait in an encrypted mailbox. Nothing is lost.

---

## Privacy

- Everything stored locally. Encrypted at rest.
- AI provider of your choice — including fully local via Ollama.
- No telemetry. No analytics. No cloud dependency.
- Air gap mode available for full offline operation.
- You own your agent. Completely.

---

## Roadmap

| Version | Focus |
|---|---|
| v0.1 | Agent born. `hive init` + `hive chat`. |
| v0.2 | Agent works. Daemon + task execution. |
| v0.3 | Agent codes. Genie integration. |
| v0.4 | Agent connects. Integrations layer. |
| v0.5 | Agent has a face. Local web view. |
| v0.6 | Agent multiplies. Sub-agent spawning. |
| v0.7 | Agent owns the machine. OS capabilities. |
| v0.8 | Agents find each other. Mesh network. |
| v0.9 | Agents work for each other. Economy layer. |
| v1.0 | The Hive is alive. |

---

## Contributing

The Hive is early. If you're reading this and want to build something that matters — open an issue, start a conversation, or just ship a PR.

---

## License

MIT