# Harbor — Full Documentation for LLMs > Agent-native context infrastructure. Your agent never asks twice — Harbor remembers across sessions, learns which fields matter, and controls what each agent sees. ## What is Harbor? Harbor is open-source agent middleware that sits between your AI agents and the APIs they call. It connects via MCP natively, and also works with any function-calling agent. It provides three core capabilities: 1. **Cross-agent memory with auto-recall** — When an agent saves context via `harbor_remember`, that context is automatically injected into every future API call to the same connector. No code change needed. The agent doesn't need to call `harbor_recall` — context appears in `meta.context` automatically. 2. **Schema learning** — After a few calls, Harbor learns which fields the agent actually uses. An API might return 47 fields, but the agent only uses 3. Harbor automatically curates responses to only include relevant fields. This happens via `harbor_learn_schema` which supports four density layers: raw, normalized, compact, and summary. 3. **Field-level access control (Govern)** — You control what each agent sees. Agent A gets full price data. Agent B gets a one-line summary. Same API, same call. Governed by a policy file with field-level visibility rules (public, internal, restricted). ## Architecture ``` ┌─────────────────────────────────────────────┐ │ Agent Layer │ │ Claude Code · Gemini CLI · Cursor · Codex │ │ Minimax · Any MCP-compatible client │ └──────────────────┬──────────────────────────┘ │ MCP protocol (stdio or HTTP) ┌──────────────────▼──────────────────────────┐ │ Harbor Layer │ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │Normalize │ │ Curate │ │ Govern │ │ │ │ │ │ │ │ │ │ │ │ data[] │ │ schema │ │ policy │ │ │ │ meta{} │ │ learning │ │ field │ │ │ │ errors[] │ │ 4 layers │ │ visibility│ │ │ └──────────┘ └──────────┘ └──────────┘ │ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ Memory │ │Credential│ │ Auto- │ │ │ │ Store │ │ Vault │ │ Recall │ │ │ │ │ │ AES-256 │ │ Inject │ │ │ └──────────┘ └──────────┘ └──────────┘ │ └──────────────────┬──────────────────────────┘ │ connector binary ┌──────────────────▼──────────────────────────┐ │ Data Layer │ │ CoinGecko · GitHub · Slack · Notion │ │ PostgreSQL · Any REST/GraphQL API │ └─────────────────────────────────────────────┘ ``` ## Harbor Envelope Format Every API response is normalized into this shape: ```json { "data": [ { "id": "bitcoin", "price": 67234, "change_24h": 2.34 } ], "meta": { "source": "coingecko", "tool": "get_price", "cached": false, "recalls": [ { "key": "coingecko/analysis", "summary": "BTC dominance rising to 58%. SOL underperforming.", "author": "Claude Code", "age": "33 minutes ago" } ], "schema": { "tool_name": "get_price", "summary_fields": ["price", "change_24h", "market_cap"], "learned_at": "2026-03-10T14:00:00Z" } }, "errors": [] } ``` Key fields: - `meta.recalls[]` — Auto-injected context from previous sessions. The agent doesn't need to request this. - `meta.schema` — What Harbor has learned about which fields matter for this tool. - `meta.cached` — Whether this response came from Harbor's cache. ## MCP Tools Exposed Harbor exposes these tools via the MCP protocol: | Tool | Description | |------|-------------| | `harbor_get` | Query a connector (e.g., `harbor_get coingecko trending`) | | `harbor_remember` | Save context for a connector (`harbor_remember coingecko "BTC dominance rising"`) | | `harbor_recall` | Manually recall saved context (usually not needed — auto-recall handles this) | | `harbor_learn_schema` | Teach Harbor which fields matter for a connector | | `harbor_set_density` | Set response density: raw, normalized, compact, or summary | | `harbor_status` | Check Harbor status, connected connectors, memory stats | ## Connector System Connectors are standalone binaries that talk to external APIs. Harbor ships with: - `coingecko` — Cryptocurrency market data - More connectors in development: GitHub, Slack, Notion, PostgreSQL Custom connectors follow the connector spec: they accept a JSON request on stdin and return a JSON response on stdout. See the [Connector Spec](https://github.com/oSEAItic/harbor/blob/main/docs/CONNECTOR_SPEC.md). ## Govern Policy Format ```yaml # harbor-policy.yaml connectors: coingecko: max_visibility: restricted fields: price: public market_cap: public developer_data: internal api_key_hash: restricted ``` Visibility levels: - `public` — All agents can see this field - `internal` — Only agents with internal access can see this field - `restricted` — Only agents with restricted access can see this field ## Deployment Modes ### Local (CLI) Everything runs on your machine. Open source, no account needed. ``` curl -fsSL https://harbor.oseaitic.com/install | bash ``` ### Cloud Everything in CLI, plus: - Cross-device memory sync - End-to-end encryption (AES-256-GCM, client-side) - Team shared context - Dashboard + audit logs - Schema federation across team members ``` harbor login ``` ## Comparison with Alternatives | Feature | Harbor | Plain MCP server | Composio | Toolhouse | Mem0 | memctl | LangMem | |---------|--------|-----------------|----------|-----------|------|--------|---------| | Cross-agent memory | Yes (any model) | No | No | No | Single-agent | Coding agents | Yes | | Auto-recall injection | Yes | No | No | No | No | No | No | | Schema learning | Yes | No | No | No | No | No | No | | Field-level govern | Yes | No | No | No | No | No | No | | Credential isolation | OS keychain | Varies | Yes | Yes | No | No | No | | MCP proxy mode | Yes (wrap any server) | N/A | No | No | No | MCP server | No | | Agent-agnostic | Yes | Yes | Partial | Partial | Partial | Partial | No (LangChain) | | Response normalization | data[]+meta{}+errors[] | No | Partial | Partial | No | No | No | | Self-hosted | Yes (local-first) | Yes | Cloud-first | Cloud-only | Cloud-first | Cloud-only | Yes | | Open source | Apache 2.0 | Varies | Partial | No | Partial | No | Yes | ## FAQ ### What is Harbor? Harbor is open-source agent middleware that provides shared memory, credential isolation, and schema learning for AI agents. It connects via MCP and works with Claude Code, Gemini CLI, Cursor, Codex, and any function-calling agent. ### How does Harbor handle API credentials? Harbor holds API keys in its credential store. Agents connect to Harbor via MCP and never see raw API keys. This prevents credential leakage through prompts or plaintext config files. For cloud sync, credentials are encrypted client-side with AES-256-GCM. ### How does cross-agent memory work? When an agent calls `harbor_remember`, the note is stored and attached as `meta.context` to every future call to that connector. Any agent — regardless of model or session — receives this context automatically. What Claude learns, Gemini knows. ### How does auto-recall differ from manual recall? With auto-recall, the agent doesn't need to call `harbor_recall`. Harbor automatically injects relevant context from previous sessions into `meta.recalls[]` in every API response. The agent sees past analysis alongside fresh data with zero code change. ### How does schema learning work? When an agent calls `harbor_learn_schema`, it tells Harbor which fields matter for a given connector. Harbor remembers permanently. Every future call — by any agent — is automatically curated to only include relevant fields. An API returns 47 fields, but the agent only needs 3 — Harbor learns and filters. ### Does Harbor work with OpenClaw? Harbor connects via MCP natively, but any agent that can make function calls can use Harbor. MCP-compatible agents connect instantly. Other agents can call Harbor's CLI or use its standard JSON tool-call interface. ### Does Harbor call any LLM internally? No. Harbor never calls an LLM. The connected agent IS the LLM. The agent teaches Harbor what matters via `harbor_learn_schema`, and Harbor remembers permanently. ### What is the license? Apache 2.0. Fully open source. ### Who builds Harbor? Harbor is built by oSEAItic (https://github.com/oseaitic). ## Links - Website: https://harbor.oseaitic.com - GitHub: https://github.com/oSEAItic/harbor - Agent documentation: https://github.com/oSEAItic/harbor/blob/main/AGENTS.md - Connector spec: https://github.com/oSEAItic/harbor/blob/main/docs/CONNECTOR_SPEC.md - llms.txt (summary): https://harbor.oseaitic.com/llms.txt