Rules: Data Access
Кто к каким данным имеет доступ. Enforce через Postgres RLS + Policy-Layer.
Data Domains
| Domain | Примеры | Доступ агентов | Внешние |
|---|---|---|---|
| Public | Manifest, docs, pricing | Все — read | Да |
| Operational | Tasks, runs, artifacts | Per scope | Нет |
| Business | Customers, revenue, plans | Ограниченно | Нет |
| Financial | Banking, invoices | CEO read aggregated, no write | Нет |
| Secrets | API keys, tokens, passwords | Никто (vault only) | Нет |
| PII | Customer email, phone, name | Specific agents + masking | Нет |
Access Matrix
| Agent | Public | Operational | Business | Financial | Secrets | PII |
|---|---|---|---|---|---|---|
| Agent-CEO | R | R | R | R (aggregated) | — | R (masked) |
| Agent-IntelDirector | R | R/W (dept) | R | — | — | — |
| SalesDirector | R | R/W (dept) | R/W (sales) | — | — | R (masked) |
| FinanceDirector | R | R/W (dept) | R | R | — | — |
| Executors | R | R/W (self) | — | — | — | — |
| Agent-Judge | R | R | R | — | — | — |
| Agent-Librarian | R/W | R (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_storetable с 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 decisions | Human + CEO (draft) | Human approval + git commit |
| Write hypothesis | Human + agents (draft) | Human approval + git commit |
| Index | Agent-Librarian | Auto on git push |
Logs & Audit
- Read-only для всех агентов (кроме future Audit Agent)
security_audit_log— append-only, даже admin не модифицирует- Application DB role:
INSERTonly, noUPDATE/DELETE
External Data
web_search/web_fetchрезультаты помеченыuntrusted- Не смешиваются с trusted internal data в одном context без явного маркирования
- Fetched content не попадает в
globalmemory без Librarian review
Связанные документы
- Rules-Security — общие security правила
- Policy-Layer — enforcement через code
- Memory-Model — scope и access patterns
- Codex — Red Lines по данным