Skip to main content
Glama
oliveratech-platform

oliveratech-platform

README.md
# oliveratech-platform

> **ES** — El núcleo agéntico de un pequeño negocio revendedor de productos digitales.
> **EN** — The agentic core of a small digital-reseller business.

[Español](#español) · [English](#english) · License: [MIT](#licencia--license)

---

## Español

### Qué es y por qué

`oliveratech-platform` es **el corazón agéntico** de un pequeño negocio que revende productos digitales
(asientos de suites de productividad, tarjetas virtuales, recargas, suscripciones de software). Reúne:

- **CRM en PostgreSQL**: leads, consentimientos, hilos e interacciones, seguimientos, casos de soporte,
  pedidos, cotizaciones, cobros, tareas del directorio y bandeja de salida (outbox).
- **Servidor MCP como ÚNICA interfaz operativa para agentes de IA**. Cada agente (`attention`, `sales`,
  `support`, `marketing`, `finance_supervisor`, `ceo`, `qa`, más el puente de canal no-LLM `channel_gateway`) tiene su propia identidad y una lista
  cerrada de herramientas. Los canales (WhatsApp, chat web, agente de voz web de ElevenLabs) son
  **clientes MCP**: no tienen lógica de negocio propia.
- **Ruta del dinero determinista**: precios, tipo de cambio, margen de seguridad (buffer), montos de
  cotización, vencimientos, estado pagado/activo y libro mayor los calcula y escribe **código**, nunca
  un modelo de lenguaje. Ninguna herramienta MCP acepta montos, precios, monedas ni estados.
- **Base de conocimiento (KB) versionada**: políticas, FAQ, guiones y fichas de producto con versión,
  vigencia (`as_of`), hash de contenido y citas. La KB **nunca** contiene precios ni estados.

Los humanos (el **directorio** / _board_) sólo intervienen para lo que requiere criterio humano:
aprobar gasto, excepciones y nuevas condiciones, mensajes salientes sin consentimiento, reembolsos y
asuntos legales. Lo hacen mediante la **CLI del directorio** (`pnpm board …`), que no es accesible por MCP.

### Arquitectura (resumen)

Arquitectura hexagonal (puertos y adaptadores). Detalle completo en [ARCHITECTURE.md](ARCHITECTURE.md).

```
src/
  domain/        reglas puras: máquina de estados, dinero, precios, política de envío, KB, plugins
  ports/         interfaces: repositorios, proveedor de pagos, embeddings, canales, DNS
  application/   servicios: cotización, cobro, eventos de pago, cumplimiento, mensajería, KB, privacidad, finanzas, directorio
  adapters/      Postgres, memoria, Kaia Pay (REST + verificador de webhooks), proveedor falso, embeddings, precios
  mcp/           catálogo de herramientas, roles, capacidades prohibidas, ejecutor, auth, rate limit
  http/          servidor node:http: POST /mcp, webhook de pagos, /healthz
  cli/           board, migrate, kb:sync, kb:lint, privacy:purge, servidor stdio de desarrollo
  products/      plugins de tipo de producto (workspace + stubs)
```

### Inicio rápido

Requisitos: Node.js ≥ 20.19 y pnpm (ver `packageManager` en `package.json`).

```bash
pnpm install
cp .env.example .env          # revise y complete; nunca suba .env al repositorio

# Desarrollo con almacenamiento en memoria, KB de ejemplo y un token por rol (impresos en stderr)
KB_SEED_EXAMPLES=true DEV_BOOTSTRAP_AGENTS=true DNS_RESOLVER=offline pnpm dev

# Servidor MCP por stdio para un solo rol (memoria, proveedor falso, KB de ejemplo)
MCP_DEV_ROLE=sales pnpm dev:stdio
```

Con PostgreSQL (requiere la extensión `pgvector`):

```bash
export STORAGE=postgres DATABASE_URL=postgres://<user>:<password>@localhost:5432/<db>
pnpm migrate
```

Notas de desarrollo:

- Con `DNS_RESOLVER=offline` sólo "existen" los dominios bajo los TLD reservados `.test` y `.example`
  (p. ej. `mi-empresa.test`), así que `workspace` se puede cotizar sin red; cualquier otro dominio
  responde `domain_not_resolvable`. Use `DNS_RESOLVER=node` para dominios reales (obligatorio en producción).
- `PAYMENT_PROVIDER=fake` (por defecto) nunca mueve dinero. Un pedido sólo pasa a `paid` con un webhook
  firmado y verificado, así que para simularlo localmente defina `KAIA_PAY_WEBHOOK_SECRET` con un valor de
  prueba y envíe un evento firmado (ver [docs/payments-kaia-pay.md](docs/payments-kaia-pay.md)).
- Los comandos `pnpm board …`, `pnpm kb:sync` (sin `--dry-run`) y `pnpm privacy:purge` requieren
  `STORAGE=postgres`.

### Configuración

Toda la configuración se lee de variables de entorno y se valida al arrancar (`src/config/env.ts`); un
valor inválido detiene el proceso. La lista completa con comentarios está en `.env.example`.

| Grupo              | Variables principales                                                                                                                                                                                                                                                                       | Notas                                                                                                                                                                            |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Servidor           | `NODE_ENV`, `HOST`, `PORT`, `LOG_LEVEL`                                                                                                                                                                                                                                                     | `PORT` por defecto 8080                                                                                                                                                          |
| Almacenamiento     | `STORAGE` (`memory`\|`postgres`), `DATABASE_URL`, `DATABASE_SSL`                                                                                                                                                                                                                            | producción exige `postgres`                                                                                                                                                      |
| Autenticación MCP  | `AUTH_MODE` (`token`\|`jwt`), `JWT_ISSUER`, `JWT_AUDIENCE`, `JWT_JWKS_URL`, `JWT_ROLE_CLAIM`, `DEV_BOOTSTRAP_AGENTS`                                                                                                                                                                        | `DEV_BOOTSTRAP_AGENTS` prohibido en producción                                                                                                                                   |
| Pagos              | `PAYMENT_PROVIDER` (`fake`\|`kaia-pay`), `KAIA_PAY_BASE_URL`, `KAIA_PAY_API_KEY`, `KAIA_PAY_WEBHOOK_SECRET`, `KAIA_PAY_WEBHOOK_SECRET_PREVIOUS`, `KAIA_PAY_WEBHOOK_TOLERANCE_SECONDS`, `KAIA_PAY_QR_DURATION_MINUTES`, `KAIA_PAY_MERCHANT_DISPLAY_NAME`, `KAIA_PAY_MCP_URL`, `WEBHOOK_PATH` | `fake` prohibido en producción                                                                                                                                                   |
| Precios            | `PRICE_SOURCE` (`file`\|`db`), `PRICE_TABLE_FILE`                                                                                                                                                                                                                                           | producción exige `db` o un archivo explícito                                                                                                                                     |
| Reglas             | `QUOTE_VALIDITY_HOURS`, `CAP_MAX_QUANTITY`, `CAP_MAX_AMOUNT_MINOR`, `REPLY_WINDOW_HOURS`, `PROVIDER_LIMITS_CACHE_SECONDS`, `RETENTION_DAYS`, `DEFAULT_LOCALE`                                                                                                                               | montos en unidades menores                                                                                                                                                       |
| Límites            | `RATE_LIMIT_PER_MINUTE`, `MCP_MAX_BODY_BYTES`, `WEBHOOK_MAX_BODY_BYTES`                                                                                                                                                                                                                     | por agente / por petición                                                                                                                                                        |
| KB                 | `KB_MIN_CONFIDENCE`, `KB_REQUIRED_POLICY_KEYS`, `KB_SEED_EXAMPLES`, `EMBEDDINGS_PROVIDER`, `EMBEDDINGS_BASE_URL`, `EMBEDDINGS_API_KEY`, `EMBEDDINGS_MODEL`, `EMBEDDINGS_DIM`                                                                                                                | con Postgres `EMBEDDINGS_DIM` debe ser 256; `KB_MIN_CONFIDENCE` (0.30 por defecto) está ajustado al embedder local por hashing — reajústelo al usar un modelo de embeddings real |
| Productos          | `DNS_RESOLVER` (`node`\|`offline`), `WORKSPACE_EXISTING_TENANT_MX_SUFFIXES`                                                                                                                                                                                                                 |                                                                                                                                                                                  |
| CLI del directorio | `BOARD_TOKEN`, `BOARD_TOKEN_SHA256`, `BOARD_ACTOR`                                                                                                                                                                                                                                          | sólo para `pnpm board`                                                                                                                                                           |

Tabla completa y reglas de arranque: [docs/deployment.md](docs/deployment.md).

### Estado del proveedor de pagos

El adaptador de **Kaia Pay** sigue un contrato REST **provisional (2026-12-01)**, transmitido por el
agente del proveedor y aún no verificado contra el servidor real (marcado `TODO-sync-with-kaia-pay` en el
código). `PAYMENT_PROVIDER=fake` es el valor por defecto para desarrollo y pruebas y se rechaza en
producción. Ver [docs/payments-kaia-pay.md](docs/payments-kaia-pay.md).

### Pruebas

```bash
pnpm test          # unitarias + integración
pnpm lint          # eslint + prettier --check
pnpm typecheck
```

Las pruebas de integración sólo se ejecutan cuando `DATABASE_URL` apunta a un PostgreSQL con
`pgvector`, por ejemplo:

```bash
docker run --rm -d -p 5432:5432 -e POSTGRES_PASSWORD=dev pgvector/pgvector:pg17
DATABASE_URL=postgres://postgres:dev@localhost:5432/postgres pnpm test
```

### Herramientas MCP

Las herramientas se asignan por rol con denegación por defecto (`src/mcp/roles.ts`): una herramienta no
asignada no aparece en la lista ni puede invocarse. Ver la tabla en la [sección en inglés](#mcp-tools).

### CLI del directorio

Requiere `BOARD_TOKEN` (secreto del operador) cuyo SHA-256 coincida con `BOARD_TOKEN_SHA256`.

| Comando                                                                             | Efecto                                                                                |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `pnpm board list-tasks` / `resolve-task <taskId>`                                   | Tareas abiertas (escalamientos, facturas por emitir, revisiones)                      |
| `pnpm board resolve-case <caseId>`                                                  | Cerrar un caso de cobro/reembolso/legal (los agentes no pueden)                       |
| `pnpm board list-drafts` / `approve-draft <messageId>` / `reject-draft <messageId>` | Borradores salientes pendientes de aprobación                                         |
| `pnpm board release-order <orderId>` / `cancel-order <orderId>`                     | Liberar a `quoted` un pedido retenido por topes o límites del proveedor, o cancelarlo |
| `pnpm board create-agent <name> <role>` / `deactivate-agent <agentId>`              | Identidades de agentes (el token se muestra una sola vez)                             |
| `pnpm board load-prices <file.json>`                                                | Validar y activar una versión de la tabla de precios                                  |
| `pnpm board ledger-reverse <entryId> <reason…>`                                     | Asiento de reversión (el original nunca se modifica)                                  |
| `pnpm board export-subject <leadId>` / `erase-subject <leadId>`                     | Derechos del titular de datos                                                         |
| `pnpm board kaia-pay-webhook-help`                                                  | Cómo registra el webhook el propietario (sin llamadas de red)                         |

### Seguridad

- Ningún agente puede marcar pagos, cambiar estados, escribir el libro mayor, fijar precios, reembolsar,
  configurar webhooks, aprobar borradores, gestionar agentes ni borrar datos: estas capacidades están
  prohibidas y una prueba lo verifica.
- Sólo un webhook `charge.paid` verificado (HMAC-SHA256, tolerancia de 5 minutos, deduplicación por `evt_…`)
  puede marcar un pedido como pagado. Las capturas de pantalla nunca son prueba de pago.
- Los registros pasan por redacción obligatoria de PII y secretos.
- Reporte vulnerabilidades sólo por _GitHub private vulnerability reporting_: ver [SECURITY.md](SECURITY.md).

Más: [SECURITY.md](SECURITY.md), [PRIVACY.md](PRIVACY.md), [docs/threat-model.md](docs/threat-model.md).

---

## English

### What and why

`oliveratech-platform` is **the agentic heart** of a small business that resells digital products
(productivity-suite seats, virtual cards, mobile top-ups, software subscriptions). It combines:

- **A CRM in PostgreSQL**: leads, consents, threads and interactions, follow-ups, support cases, orders,
  quotes, charges, board tasks and an outbox.
- **An MCP server as the ONLY operating interface for AI agents.** Each agent (`attention`, `sales`,
  `support`, `marketing`, `finance_supervisor`, `ceo`, `qa`, plus the non-LLM channel bridge `channel_gateway`) has its own identity and a closed tool
  allow-list. Channels (WhatsApp, web chat, the ElevenLabs web voice agent) are **MCP clients** with no
  business logic of their own.
- **A deterministic money path**: prices, FX, buffer, quote amounts, expiry, paid/active status and the
  ledger are computed and written by **code**, never by a language model. No MCP tool accepts amounts,
  prices, currencies or states as input.
- **A versioned knowledge base (KB)**: policies, FAQs, scripts and product sheets with versions, validity
  (`as_of`), content hashes and citations. The KB **never** holds prices or statuses.

Humans (the **board**) only do what needs human judgement: approve spend, exceptions and new conditions,
outbound messages without consent, refunds and legal matters. They act through the **board CLI**
(`pnpm board …`), which is not reachable through MCP.

### Architecture overview

Hexagonal (ports and adapters). Full details in [ARCHITECTURE.md](ARCHITECTURE.md).

```mermaid
flowchart LR
  subgraph Channels[MCP clients]
    WA[WhatsApp bridge]
    WC[Web chat]
    EL[ElevenLabs web agent]
  end
  subgraph Core[oliveratech-platform]
    MCP[POST /mcp<br/>roles + strict schemas]
    APP[application services]
    DOM[domain rules]
    WH[POST webhook path<br/>HMAC verify + dedupe]
    W[in-process payment-event worker]
  end
  PG[(PostgreSQL + pgvector)]
  KP[Kaia Pay REST]
  BOARD[board CLI - humans]

  WA & WC & EL --> MCP --> APP --> DOM
  APP --> PG
  APP --> KP
  KP -- signed events --> WH --> PG
  W --> APP
  BOARD --> APP
```

### Quickstart

Requirements: Node.js ≥ 20.19 and pnpm (see `packageManager` in `package.json`).

```bash
pnpm install
cp .env.example .env          # review and fill in; never commit .env

# Dev run: in-memory storage, example KB, one token per role (printed to stderr)
KB_SEED_EXAMPLES=true DEV_BOOTSTRAP_AGENTS=true DNS_RESOLVER=offline pnpm dev

# stdio MCP server for a single role (memory storage, fake provider, example KB)
MCP_DEV_ROLE=sales pnpm dev:stdio
```

Call the HTTP MCP endpoint with any Streamable HTTP MCP client, or with `curl`:

```bash
curl -s http://localhost:8080/mcp \
  -H "Authorization: Bearer <dev-token-from-stderr>" \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

With PostgreSQL (the `pgvector` extension is required):

```bash
export STORAGE=postgres DATABASE_URL=postgres://<user>:<password>@localhost:5432/<db>
pnpm migrate
```

Development notes:

- With `DNS_RESOLVER=offline` only domains under the reserved `.test` and `.example` TLDs "exist"
  (e.g. `my-company.test`), so `workspace` can be quoted offline; any other domain answers
  `domain_not_resolvable`. Use `DNS_RESOLVER=node` for real domains (required in production).
- `PAYMENT_PROVIDER=fake` (the default) never moves money. An order only becomes `paid` through a
  verified, signed webhook, so to simulate one locally set `KAIA_PAY_WEBHOOK_SECRET` to a test value and
  post a signed event (see [docs/payments-kaia-pay.md](docs/payments-kaia-pay.md)).
- `pnpm board …`, `pnpm kb:sync` (without `--dry-run`) and `pnpm privacy:purge` require `STORAGE=postgres`.

### Configuration

All configuration comes from environment variables and is validated at boot (`src/config/env.ts`); any
invalid value stops the process (error messages name variables, never values). `.env.example` lists every
variable with comments. Summary:

| Group          | Main variables                                                                                                                                                                                                                                                                              | Notes                                                                                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Server         | `NODE_ENV`, `HOST`, `PORT`, `LOG_LEVEL`                                                                                                                                                                                                                                                     | `PORT` defaults to 8080                                                                                                                                                      |
| Storage        | `STORAGE` (`memory`\|`postgres`), `DATABASE_URL`, `DATABASE_SSL`                                                                                                                                                                                                                            | production requires `postgres`                                                                                                                                               |
| MCP auth       | `AUTH_MODE` (`token`\|`jwt`), `JWT_ISSUER`, `JWT_AUDIENCE`, `JWT_JWKS_URL`, `JWT_ROLE_CLAIM`, `DEV_BOOTSTRAP_AGENTS`                                                                                                                                                                        | `DEV_BOOTSTRAP_AGENTS` rejected in production                                                                                                                                |
| Payments       | `PAYMENT_PROVIDER` (`fake`\|`kaia-pay`), `KAIA_PAY_BASE_URL`, `KAIA_PAY_API_KEY`, `KAIA_PAY_WEBHOOK_SECRET`, `KAIA_PAY_WEBHOOK_SECRET_PREVIOUS`, `KAIA_PAY_WEBHOOK_TOLERANCE_SECONDS`, `KAIA_PAY_QR_DURATION_MINUTES`, `KAIA_PAY_MERCHANT_DISPLAY_NAME`, `KAIA_PAY_MCP_URL`, `WEBHOOK_PATH` | `fake` rejected in production                                                                                                                                                |
| Prices         | `PRICE_SOURCE` (`file`\|`db`), `PRICE_TABLE_FILE`                                                                                                                                                                                                                                           | production requires `db` or an explicit file                                                                                                                                 |
| Business rules | `QUOTE_VALIDITY_HOURS`, `CAP_MAX_QUANTITY`, `CAP_MAX_AMOUNT_MINOR`, `REPLY_WINDOW_HOURS`, `PROVIDER_LIMITS_CACHE_SECONDS`, `RETENTION_DAYS`, `DEFAULT_LOCALE`                                                                                                                               | amounts in minor units                                                                                                                                                       |
| Limits         | `RATE_LIMIT_PER_MINUTE`, `MCP_MAX_BODY_BYTES`, `WEBHOOK_MAX_BODY_BYTES`                                                                                                                                                                                                                     | per agent / per request                                                                                                                                                      |
| Knowledge base | `KB_MIN_CONFIDENCE`, `KB_REQUIRED_POLICY_KEYS`, `KB_SEED_EXAMPLES`, `EMBEDDINGS_PROVIDER`, `EMBEDDINGS_BASE_URL`, `EMBEDDINGS_API_KEY`, `EMBEDDINGS_MODEL`, `EMBEDDINGS_DIM`                                                                                                                | with Postgres `EMBEDDINGS_DIM` must be 256; `KB_MIN_CONFIDENCE` (default 0.30) is tuned for the local hashing embedder — re-tune it when switching to a real embedding model |
| Products       | `DNS_RESOLVER` (`node`\|`offline`), `WORKSPACE_EXISTING_TENANT_MX_SUFFIXES`                                                                                                                                                                                                                 |                                                                                                                                                                              |
| Board CLI      | `BOARD_TOKEN`, `BOARD_TOKEN_SHA256`, `BOARD_ACTOR`                                                                                                                                                                                                                                          | only read by `pnpm board`                                                                                                                                                    |

Full table with defaults and boot rules: [docs/deployment.md](docs/deployment.md).

### Payment provider status

The **Kaia Pay** adapter follows a REST contract that is **provisional (2026-12-01)**: relayed by the
provider's agent and not yet verified against the live server (marked `TODO-sync-with-kaia-pay` in code).
`PAYMENT_PROVIDER=fake` is the default for development and tests and is rejected in production. See
[docs/payments-kaia-pay.md](docs/payments-kaia-pay.md).

### Running tests

```bash
pnpm test          # unit + integration
pnpm test:unit
pnpm test:integration
pnpm lint          # eslint + prettier --check
pnpm typecheck
```

Integration tests run only when `DATABASE_URL` points to PostgreSQL with `pgvector`, for example:

```bash
docker run --rm -d -p 5432:5432 -e POSTGRES_PASSWORD=dev pgvector/pgvector:pg17
DATABASE_URL=postgres://postgres:dev@localhost:5432/postgres pnpm test
```

### MCP tools

Deny by default: a tool not granted to a role is neither listed nor callable, and the executor re-checks
authorization on every call. All input schemas are strict (unknown keys rejected). Source of truth:
`src/mcp/tools.ts` and `src/mcp/roles.ts`.

| Tool                        | Roles                                                  | Read-only |
| --------------------------- | ------------------------------------------------------ | --------- |
| `get_lead`                  | attention, sales, support, marketing                   | yes       |
| `upsert_lead`               | attention, sales, marketing, channel_gateway           | no        |
| `record_consent`            | attention, sales, marketing, channel_gateway¹          | no        |
| `move_lead_stage`           | sales                                                  | no        |
| `log_interaction`           | attention, sales, support, marketing, channel_gateway¹ | no        |
| `schedule_follow_up`        | attention, sales, support                              | no        |
| `search_knowledge`          | attention, sales, support, marketing, ceo, qa          | yes       |
| `get_policy`                | attention, sales, support, marketing, ceo, qa          | yes       |
| `get_prices`                | attention, sales, support, marketing, ceo, qa          | yes       |
| `check_eligibility`         | attention, sales                                       | yes       |
| `create_quote`              | sales                                                  | no        |
| `get_quote`                 | sales, finance_supervisor, ceo, qa                     | yes       |
| `accept_quote_terms`        | sales                                                  | no        |
| `issue_charge`              | sales                                                  | no        |
| `get_order_status`          | attention, sales, support, finance_supervisor, ceo, qa | yes       |
| `get_order`                 | support, finance_supervisor, ceo                       | yes       |
| `confirm_provisioning_data` | sales, support                                         | no        |
| `open_case`                 | attention, support                                     | no        |
| `update_case`               | support (not `resolved` for billing/refund/legal)      | no        |
| `escalate_to_human`         | attention, sales, support, finance_supervisor, ceo     | no        |
| `send_message`              | attention, sales, support, marketing                   | no        |
| `get_ledger_summary`        | finance_supervisor, ceo                                | yes       |
| `get_settlement_info`       | finance_supervisor                                     | yes       |
| `list_board_tasks`          | finance_supervisor, ceo                                | yes       |

¹ `channel_gateway` is not an LLM agent: it is the deterministic channel bridge (e.g. the WhatsApp/web-chat
webhook receiver). Only inbound messages it logs are `verified`; only verified inbound messages open
customer threads / reply windows (needed for `auto` replies) and serve as evidence for consent grants
recorded by LLM agents. Inbound text logged by an LLM agent is kept as a note but unlocks nothing.

Agent system-prompt templates: [docs/agents/](docs/agents/). Channel notes: [docs/channels/elevenlabs.md](docs/channels/elevenlabs.md).

### Board CLI

Every command (except `help` and `kaia-pay-webhook-help`) requires `BOARD_TOKEN` (operator secret) whose
SHA-256 equals `BOARD_TOKEN_SHA256` (deployment config), and `STORAGE=postgres`. `BOARD_ACTOR` labels the
actor in records.

| Command                                                                             | Effect                                                                           |
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `pnpm board list-tasks` / `resolve-task <taskId>`                                   | Open board tasks (escalations, invoice due, reviews, alerts)                     |
| `pnpm board resolve-case <caseId>`                                                  | Close a billing/refund/legal case (agents cannot)                                |
| `pnpm board list-drafts` / `approve-draft <messageId>` / `reject-draft <messageId>` | Outbound drafts awaiting approval (`never` rules are re-checked on approval)     |
| `pnpm board release-order <orderId>` / `cancel-order <orderId>`                     | Release an order held for caps or provider limits back to `quoted`, or cancel it |
| `pnpm board create-agent <name> <role>` / `deactivate-agent <agentId>`              | Agent identities (token printed once; only its hash is stored)                   |
| `pnpm board load-prices <file.json>`                                                | Validate and activate a price-table version                                      |
| `pnpm board ledger-reverse <entryId> <reason…>`                                     | Append a reversal entry (the original is never modified)                         |
| `pnpm board export-subject <leadId>` / `erase-subject <leadId>`                     | Data-subject rights                                                              |
| `pnpm board kaia-pay-webhook-help`                                                  | How the owner registers the provider webhook (no network call)                   |

Other CLIs: `pnpm migrate`, `pnpm kb:lint`, `pnpm kb:sync`, `pnpm privacy:purge` — see
[docs/knowledge-base.md](docs/knowledge-base.md) and [docs/deployment.md](docs/deployment.md).

### Security notes

- Agents can never mark payments, set order states, activate or provision, write or edit the ledger, set
  prices, refund, fund the wholesaler, configure webhooks, approve drafts, manage agents or erase data.
  These capabilities are forbidden and a test asserts no tool carries them.
- Only a verified `charge.paid` webhook (HMAC-SHA256, 5-minute tolerance, dedupe by `evt_…` id) can mark
  an order paid. Status polls never do; screenshots are never proof of payment.
- Per-agent bearer tokens are stored hashed; logs pass through mandatory PII/secret redaction.
- Report vulnerabilities only through GitHub private vulnerability reporting — see [SECURITY.md](SECURITY.md).

More: [ARCHITECTURE.md](ARCHITECTURE.md), [SECURITY.md](SECURITY.md), [PRIVACY.md](PRIVACY.md),
[docs/threat-model.md](docs/threat-model.md), [docs/products.md](docs/products.md),
[docs/knowledge-base.md](docs/knowledge-base.md), [docs/deployment.md](docs/deployment.md),
[CONTRIBUTING.md](CONTRIBUTING.md), [CHANGELOG.md](CHANGELOG.md).

---

## Licencia / License

MIT © 2026 Carlos Olivera Terrazas. Ver / see `LICENSE`.