Rules: Data Access

Кто к каким данным имеет доступ. Enforce через Postgres RLS + Policy-Layer.

Data Domains

DomainПримерыДоступ агентовВнешние
PublicManifest, docs, pricingВсе — readДа
OperationalTasks, runs, artifactsPer scopeНет
BusinessCustomers, revenue, plansОграниченноНет
FinancialBanking, invoicesCEO read aggregated, no writeНет
SecretsAPI keys, tokens, passwordsНикто (vault only)Нет
PIICustomer email, phone, nameSpecific agents + maskingНет

Access Matrix

AgentPublicOperationalBusinessFinancialSecretsPII
Agent-CEORRRR (aggregated)R (masked)
Agent-IntelDirectorRR/W (dept)R
SalesDirectorRR/W (dept)R/W (sales)R (masked)
FinanceDirectorRR/W (dept)RR
ExecutorsRR/W (self)
Agent-JudgeRRR
Agent-LibrarianR/WR (indexing)R (indexing)

R = read, W = write, = no access.

Row-Level Security (Postgres RLS)

Tasks

Агент видит только свои задачи + делегированные:

CREATE POLICY tasks_agent_access ON tasks
    USING (
        to_agent = current_setting('app.current_agent')
        OR from_agent = current_setting('app.current_agent')
        OR root_id IN (
            SELECT id FROM tasks
            WHERE to_agent = current_setting('app.current_agent')
        )
    );

Financial Data

Только роль finance:

CREATE POLICY financial_access ON financial_data
    USING (
        current_setting('app.agent_role') = 'finance'
        OR current_setting('app.agent_role') = 'ceo'
    );

Implementation

Каждый agent connection через отдельный PG role с RLS policies. Нет shared database user для всех агентов.

PII Handling

Storage

  • Names, emails, phones — hashed для indexing
  • Full PII только в dedicated pii_store table с encryption at rest (Phase 2)

Agent Access

  • Memory агента получает masked data: u***@***.com, +7***4567
  • Full PII доступен через dedicated API с:
    • Explicit request + justification
    • Audit log каждого обращения
    • Rate limit: 10 lookups/hour per agent

Deletion

  • GDPR-style: customer request → mark for deletion → 30 days → purge
  • Агент не может инициировать PII deletion (human only)

Financial Data

  • Агент никогда не видит raw account numbers, card numbers, bank details
  • Aggregates доступны: monthly revenue, cash position, burn rate
  • Транзакционные данные не обрабатываются агентами
  • Все финансовые решения — human only (Codex Red Lines)

Vault Access (Manifest)

ОперацияКтоКак
ReadВсе агентыЧерез RAG (semantic search)
Write decisionsHuman + CEO (draft)Human approval + git commit
Write hypothesisHuman + agents (draft)Human approval + git commit
IndexAgent-LibrarianAuto on git push

Logs & Audit

  • Read-only для всех агентов (кроме future Audit Agent)
  • security_audit_log — append-only, даже admin не модифицирует
  • Application DB role: INSERT only, no UPDATE/DELETE

External Data

  • web_search / web_fetch результаты помечены untrusted
  • Не смешиваются с trusted internal data в одном context без явного маркирования
  • Fetched content не попадает в global memory без Librarian review

Связанные документы